From 0120373c99dcc093b4d7db944a12ee10698f88a5 Mon Sep 17 00:00:00 2001 From: Zoey76 <zoey_76@msn.com> Date: Sat, 11 Jan 2020 21:57:44 -0300 Subject: [PATCH] Full source format --- .../fantasy_isle/HandysBlockCheckerEvent.java | 37 +- .../datapack/ai/fantasy_isle/MC_Show.java | 152 +- .../datapack/ai/fantasy_isle/StartMCShow.java | 6 +- .../ai/group_template/AltarsOfSacrifice.java | 90 +- .../datapack/ai/group_template/BeastFarm.java | 145 +- .../datapack/ai/group_template/DenOfEvil.java | 83 +- .../ai/group_template/DragonValley.java | 71 +- .../ai/group_template/FairyTrees.java | 27 +- .../ai/group_template/FeedableBeasts.java | 160 +- .../ai/group_template/FleeMonsters.java | 15 +- .../ai/group_template/FrozenLabyrinth.java | 18 +- .../ai/group_template/GiantsCave.java | 51 +- .../ai/group_template/HotSprings.java | 36 +- .../ai/group_template/IsleOfPrayer.java | 18 +- .../ai/group_template/LairOfAntharas.java | 58 +- .../ai/group_template/MinionSpawnManager.java | 43 +- .../ai/group_template/MonasteryOfSilence.java | 148 +- .../ai/group_template/NonLethalableNpcs.java | 15 +- .../ai/group_template/NonTalkingNpcs.java | 12 +- .../ai/group_template/PavelArchaic.java | 15 +- .../ai/group_template/PlainsOfDion.java | 37 +- .../ai/group_template/PlainsOfLizardman.java | 97 +- .../ai/group_template/PolymorphingAngel.java | 15 +- .../group_template/PolymorphingOnAttack.java | 39 +- .../ai/group_template/PrimevalIsle.java | 276 ++-- .../ai/group_template/PrisonGuards.java | 73 +- .../ai/group_template/RaidBossCancel.java | 24 +- .../ai/group_template/RandomSpawn.java | 39 +- .../ai/group_template/RangeGuard.java | 25 +- .../datapack/ai/group_template/Remnants.java | 27 +- .../ai/group_template/Sandstorms.java | 12 +- .../group_template/SeeThroughSilentMove.java | 15 +- .../ai/group_template/SelMahumDrill.java | 155 +- .../ai/group_template/SelMahumSquad.java | 186 +-- .../ai/group_template/SilentValley.java | 84 +- .../ai/group_template/StakatoNest.java | 85 +- .../datapack/ai/group_template/SummonPc.java | 43 +- .../ai/group_template/TreasureChest.java | 77 +- .../datapack/ai/group_template/TurekOrcs.java | 59 +- .../ai/group_template/VarkaKetra.java | 70 +- .../group_template/WarriorFishingBlock.java | 52 +- .../datapack/ai/individual/Anais.java | 83 +- .../ai/individual/Antharas/Antharas.java | 637 +++----- .../datapack/ai/individual/Baium/Baium.java | 487 ++----- .../datapack/ai/individual/Ballista.java | 27 +- .../datapack/ai/individual/Beleth.java | 329 ++--- .../ai/individual/BlackdaggerWing.java | 45 +- .../datapack/ai/individual/BleedingFly.java | 49 +- .../datapack/ai/individual/Core.java | 84 +- .../ai/individual/CrimsonHatuOtis.java | 40 +- .../ai/individual/DarkWaterDragon.java | 83 +- .../datapack/ai/individual/DivineBeast.java | 22 +- .../datapack/ai/individual/DrChaos.java | 55 +- .../datapack/ai/individual/DrakosWarrior.java | 18 +- .../datapack/ai/individual/DustRider.java | 18 +- .../datapack/ai/individual/EmeraldHorn.java | 52 +- .../datapack/ai/individual/Epidos.java | 61 +- .../datapack/ai/individual/EvasGiftBox.java | 24 +- .../ai/individual/FrightenedRagnaOrc.java | 60 +- .../datapack/ai/individual/Gordon.java | 18 +- .../datapack/ai/individual/GraveRobbers.java | 12 +- .../datapack/ai/individual/MuscleBomber.java | 39 +- .../ai/individual/NecromancerOfTheValley.java | 31 +- .../datapack/ai/individual/Orfen.java | 159 +- .../datapack/ai/individual/QueenAnt.java | 167 +-- .../datapack/ai/individual/QueenShyeed.java | 30 +- .../ai/individual/RagnaOrcCommander.java | 12 +- .../datapack/ai/individual/RagnaOrcHero.java | 12 +- .../datapack/ai/individual/RagnaOrcSeer.java | 12 +- .../ai/individual/Sailren/Sailren.java | 163 +-- .../ai/individual/ShadowSummoner.java | 54 +- .../datapack/ai/individual/SinEater.java | 95 +- .../datapack/ai/individual/SinWardens.java | 28 +- .../datapack/ai/individual/Valakas.java | 243 +--- .../datapack/ai/individual/Venom/Venom.java | 166 +-- .../ai/npc/Abercrombie/Abercrombie.java | 23 +- .../datapack/ai/npc/AbstractNpcAI.java | 45 +- .../datapack/ai/npc/Alarm/Alarm.java | 192 +-- .../ai/npc/Alexandria/Alexandria.java | 56 +- .../ai/npc/ArenaManager/ArenaManager.java | 66 +- .../datapack/ai/npc/Asamah/Asamah.java | 18 +- .../ai/npc/AvantGarde/AvantGarde.java | 211 +-- .../ai/npc/BlackJudge/BlackJudge.java | 35 +- .../BlackMarketeerOfMammon.java | 49 +- .../CastleAmbassador/CastleAmbassador.java | 73 +- .../CastleBlacksmith/CastleBlacksmith.java | 21 +- .../CastleChamberlain/CastleChamberlain.java | 787 +++------- .../CastleCourtMagician.java | 146 +- .../CastleMercenaryManager.java | 68 +- .../CastleSiegeManager.java | 50 +- .../CastleTeleporter/CastleTeleporter.java | 34 +- .../npc/CastleWarehouse/CastleWarehouse.java | 43 +- .../ai/npc/ClanTrader/ClanTrader.java | 45 +- .../ai/npc/ClassMaster/ClassMaster.java | 252 +--- .../datapack/ai/npc/Dorian/Dorian.java | 18 +- .../ai/npc/DragonVortex/DragonVortex.java | 77 +- .../ai/npc/EchoCrystals/EchoCrystals.java | 50 +- .../ai/npc/FameManager/FameManager.java | 58 +- .../datapack/ai/npc/Fisherman/Fisherman.java | 56 +- .../ai/npc/ForgeOfTheGods/ForgeOfTheGods.java | 87 +- .../ai/npc/ForgeOfTheGods/Rooney.java | 54 +- .../ai/npc/ForgeOfTheGods/TarBeetle.java | 40 +- .../ai/npc/ForgeOfTheGods/TarBeetleSpawn.java | 138 +- .../FortressArcherCaptain.java | 15 +- .../FortressSiegeManager.java | 107 +- .../ai/npc/FreyasSteward/FreyasSteward.java | 18 +- .../datapack/ai/npc/Jinia/Jinia.java | 48 +- .../datapack/ai/npc/Katenar/Katenar.java | 66 +- .../npc/KetraOrcSupport/KetraOrcSupport.java | 72 +- .../l2jserver/datapack/ai/npc/Kier/Kier.java | 29 +- .../ai/npc/ManorManager/ManorManager.java | 39 +- .../MercenaryCaptain/MercenaryCaptain.java | 115 +- .../datapack/ai/npc/Minigame/Minigame.java | 241 +-- .../MonumentOfHeroes/MonumentOfHeroes.java | 50 +- .../ai/npc/NevitsHerald/NevitsHerald.java | 72 +- .../ai/npc/NpcBuffers/NpcBufferAI.java | 115 +- .../ai/npc/NpcBuffers/NpcBufferData.java | 15 +- .../ai/npc/NpcBuffers/NpcBufferSkillData.java | 21 +- .../ai/npc/NpcBuffers/NpcBuffers.java | 21 +- .../ai/npc/NpcBuffers/NpcBuffersData.java | 45 +- .../ai/npc/NpcBuffers/impl/CabaleBuffer.java | 154 +- .../PriestOfBlessing/PriestOfBlessing.java | 84 +- .../datapack/ai/npc/Rafforty/Rafforty.java | 24 +- .../datapack/ai/npc/Rignos/Rignos.java | 45 +- .../datapack/ai/npc/Selina/Selina.java | 54 +- .../datapack/ai/npc/Sirra/Sirra.java | 19 +- .../SubclassCertification.java | 134 +- .../Summons/MerchantGolem/GolemTrader.java | 12 +- .../ai/npc/Summons/Pets/BabyPets.java | 52 +- .../ai/npc/Summons/Pets/ImprovedBabyPets.java | 106 +- .../ai/npc/Summons/Servitors/Servitors.java | 21 +- .../SupportUnitCaptain.java | 133 +- .../ai/npc/SymbolMaker/SymbolMaker.java | 30 +- .../ai/npc/Teleports/Asher/Asher.java | 26 +- .../npc/Teleports/CrumaTower/CrumaTower.java | 15 +- .../DelusionTeleport/DelusionTeleport.java | 25 +- .../ElrokiTeleporters/ElrokiTeleporters.java | 19 +- .../GatekeeperSpirit/GatekeeperSpirit.java | 54 +- .../GhostChamberlainOfElmoreden.java | 41 +- .../GrandBossTeleporters.java | 103 +- .../HuntingGroundsTeleport.java | 54 +- .../ai/npc/Teleports/Klemis/Klemis.java | 22 +- .../MithrilMinesTeleporter.java | 30 +- .../Teleports/NewbieGuide/NewbieGuide.java | 813 ++++------- .../NoblesseTeleport/NoblesseTeleport.java | 28 +- .../OracleTeleport/OracleTeleport.java | 180 +-- .../PaganTeleporters/PaganTeleporters.java | 54 +- .../SeparatedSoul/SeparatedSoul.java | 47 +- .../StakatoNestTeleporter.java | 30 +- .../SteelCitadelTeleport.java | 36 +- .../StrongholdsTeleports.java | 18 +- .../ai/npc/Teleports/Survivor/Survivor.java | 29 +- .../TeleportToFantasy/TeleportToFantasy.java | 35 +- .../TeleportToRaceTrack.java | 32 +- .../TeleportToUndergroundColiseum.java | 48 +- .../TeleportWithCharm/TeleportWithCharm.java | 35 +- .../ai/npc/Teleports/ToIVortex/ToIVortex.java | 38 +- .../TerritoryManagers/TerritoryManagers.java | 136 +- .../datapack/ai/npc/TownPets/TownPets.java | 24 +- .../Trainers/HealerTrainer/HealerTrainer.java | 92 +- .../datapack/ai/npc/Tunatun/Tunatun.java | 25 +- .../VarkaSilenosSupport.java | 72 +- .../FirstClassTransferTalk.java | 89 +- .../datapack/ai/npc/WeaverOlf/WeaverOlf.java | 88 +- .../ai/npc/WyvernManager/WyvernManager.java | 170 +-- .../DevastatedCastle/DevastatedCastle.java | 62 +- .../FortressOfResistance.java | 63 +- .../FortressOfTheDead/FortressOfTheDead.java | 76 +- .../RainbowSpringsChateau.java | 503 ++----- .../BanditStronghold/BanditStronghold.java | 33 +- .../conquerablehalls/flagwar/FlagWar.java | 482 ++---- .../WildBeastReserve/WildBeastReserve.java | 36 +- .../com/l2jserver/datapack/cron/example.java | 6 +- .../custom/Validators/SubClassSkills.java | 173 +-- .../datapack/custom/events/Elpies/Elpies.java | 78 +- .../custom/events/Rabbits/Rabbits.java | 100 +- .../datapack/custom/events/Race/Race.java | 33 +- .../events/TvT/TvTManager/TvTManager.java | 115 +- .../custom/events/Wedding/Wedding.java | 82 +- .../custom/listeners/ListenerTest.java | 45 +- .../CharacterBirthday/CharacterBirthday.java | 42 +- .../FreyaCelebration/FreyaCelebration.java | 57 +- .../events/GiftOfVitality/GiftOfVitality.java | 67 +- .../events/HeavyMedal/HeavyMedal.java | 70 +- .../LoveYourGatekeeper.java | 41 +- .../MasterOfEnchanting.java | 112 +- .../TheValentineEvent/TheValentineEvent.java | 25 +- .../features/SkillTransfer/SkillTransfer.java | 78 +- .../datapack/gracia/AI/EnergySeeds.java | 18 +- .../datapack/gracia/AI/Lindvior.java | 41 +- .../l2jserver/datapack/gracia/AI/Maguen.java | 139 +- .../AI/NPC/FortuneTelling/FortuneTelling.java | 16 +- .../AI/NPC/GeneralDilios/GeneralDilios.java | 46 +- .../datapack/gracia/AI/NPC/Lekon/Lekon.java | 37 +- .../datapack/gracia/AI/NPC/Nemo/Nemo.java | 48 +- .../gracia/AI/NPC/Nottingale/Nottingale.java | 49 +- .../datapack/gracia/AI/NPC/Seyo/Seyo.java | 95 +- .../AI/NPC/ZealotOfShilen/ZealotOfShilen.java | 37 +- .../SeedOfAnnihilation.java | 126 +- .../datapack/gracia/AI/StarStones.java | 26 +- .../instances/SecretArea/SecretArea.java | 31 +- .../instances/SeedOfDestruction/Stage1.java | 563 +++---- .../HallOfSuffering/HallOfSuffering.java | 289 ++-- .../gracia/vehicles/AirShipController.java | 240 +-- .../AirShipGludioGracia.java | 133 +- .../KeucereusNorthController.java | 18 +- .../KeucereusSouthController.java | 18 +- .../vehicles/SoDController/SoDController.java | 18 +- .../vehicles/SoIController/SoIController.java | 18 +- .../handlers/EffectMasterHandler.java | 12 +- .../L2ArtefactInstanceAction.java | 27 +- .../actionhandlers/L2DecoyAction.java | 12 +- .../actionhandlers/L2DoorInstanceAction.java | 58 +- .../actionhandlers/L2ItemInstanceAction.java | 23 +- .../handlers/actionhandlers/L2NpcAction.java | 80 +- .../actionhandlers/L2PcInstanceAction.java | 68 +- .../actionhandlers/L2PetInstanceAction.java | 42 +- .../L2StaticObjectInstanceAction.java | 40 +- .../actionhandlers/L2SummonAction.java | 43 +- .../handlers/actionhandlers/L2TrapAction.java | 12 +- .../L2DoorInstanceActionShift.java | 12 +- .../L2ItemInstanceActionShift.java | 12 +- .../actionshifthandlers/L2NpcActionShift.java | 68 +- .../L2PcInstanceActionShift.java | 18 +- .../L2StaticObjectInstanceActionShift.java | 12 +- .../L2SummonActionShift.java | 18 +- .../admincommandhandlers/AdminAdmin.java | 168 +-- .../AdminAnnouncements.java | 253 ++-- .../admincommandhandlers/AdminBBS.java | 12 +- .../admincommandhandlers/AdminBuffs.java | 192 +-- .../admincommandhandlers/AdminCHSiege.java | 244 +--- .../admincommandhandlers/AdminCamera.java | 36 +- .../AdminChangeAccessLevel.java | 74 +- .../admincommandhandlers/AdminClan.java | 97 +- .../admincommandhandlers/AdminCreateItem.java | 164 +-- .../AdminCursedWeapons.java | 122 +- .../admincommandhandlers/AdminDebug.java | 42 +- .../admincommandhandlers/AdminDelete.java | 35 +- .../admincommandhandlers/AdminDisconnect.java | 32 +- .../AdminDoorControl.java | 96 +- .../admincommandhandlers/AdminEditChar.java | 321 ++-- .../admincommandhandlers/AdminEffects.java | 533 ++----- .../admincommandhandlers/AdminElement.java | 95 +- .../admincommandhandlers/AdminEnchant.java | 155 +- .../AdminEventEngine.java | 274 +--- .../admincommandhandlers/AdminEvents.java | 94 +- .../admincommandhandlers/AdminExpSp.java | 101 +- .../AdminFightCalculator.java | 149 +- .../admincommandhandlers/AdminFortSiege.java | 99 +- .../admincommandhandlers/AdminGeodata.java | 72 +- .../admincommandhandlers/AdminGm.java | 15 +- .../admincommandhandlers/AdminGmChat.java | 54 +- .../AdminGraciaSeeds.java | 32 +- .../admincommandhandlers/AdminGrandBoss.java | 176 +-- .../admincommandhandlers/AdminHeal.java | 77 +- .../admincommandhandlers/AdminHellbound.java | 35 +- .../admincommandhandlers/AdminHtml.java | 47 +- .../admincommandhandlers/AdminInstance.java | 77 +- .../AdminInstanceZone.java | 67 +- .../admincommandhandlers/AdminInvul.java | 37 +- .../admincommandhandlers/AdminKick.java | 30 +- .../admincommandhandlers/AdminKill.java | 91 +- .../admincommandhandlers/AdminLevel.java | 45 +- .../admincommandhandlers/AdminLogin.java | 118 +- .../admincommandhandlers/AdminMammon.java | 75 +- .../admincommandhandlers/AdminManor.java | 15 +- .../admincommandhandlers/AdminMenu.java | 181 +-- .../admincommandhandlers/AdminMessages.java | 62 +- .../admincommandhandlers/AdminMobGroup.java | 340 ++--- .../AdminMonsterRace.java | 49 +- .../admincommandhandlers/AdminPForge.java | 332 ++--- .../admincommandhandlers/AdminPathNode.java | 54 +- .../AdminPcCondOverride.java | 65 +- .../admincommandhandlers/AdminPetition.java | 67 +- .../admincommandhandlers/AdminPledge.java | 93 +- .../admincommandhandlers/AdminPolymorph.java | 94 +- .../admincommandhandlers/AdminPunishment.java | 205 +-- .../admincommandhandlers/AdminQuest.java | 187 +-- .../admincommandhandlers/AdminReload.java | 109 +- .../admincommandhandlers/AdminRepairChar.java | 37 +- .../admincommandhandlers/AdminRes.java | 100 +- .../admincommandhandlers/AdminRide.java | 80 +- .../admincommandhandlers/AdminScan.java | 63 +- .../admincommandhandlers/AdminShop.java | 43 +- .../admincommandhandlers/AdminShowQuests.java | 182 +-- .../admincommandhandlers/AdminShutdown.java | 60 +- .../admincommandhandlers/AdminSiege.java | 233 +-- .../admincommandhandlers/AdminSkill.java | 281 ++-- .../admincommandhandlers/AdminSpawn.java | 303 ++-- .../admincommandhandlers/AdminSummon.java | 35 +- .../admincommandhandlers/AdminTarget.java | 32 +- .../admincommandhandlers/AdminTargetSay.java | 25 +- .../admincommandhandlers/AdminTeleport.java | 345 ++--- .../AdminTerritoryWar.java | 94 +- .../admincommandhandlers/AdminTest.java | 68 +- .../admincommandhandlers/AdminTvTEvent.java | 47 +- .../admincommandhandlers/AdminUnblockIp.java | 28 +- .../admincommandhandlers/AdminVitality.java | 71 +- .../admincommandhandlers/AdminZone.java | 64 +- .../handlers/bypasshandlers/Augment.java | 25 +- .../datapack/handlers/bypasshandlers/Buy.java | 25 +- .../bypasshandlers/BuyShadowItem.java | 30 +- .../handlers/bypasshandlers/ChatLink.java | 29 +- .../bypasshandlers/ClanWarehouse.java | 83 +- .../handlers/bypasshandlers/EventEngine.java | 29 +- .../handlers/bypasshandlers/Festival.java | 160 +- .../handlers/bypasshandlers/Freight.java | 45 +- .../bypasshandlers/ItemAuctionLink.java | 63 +- .../handlers/bypasshandlers/Link.java | 18 +- .../handlers/bypasshandlers/Loto.java | 149 +- .../handlers/bypasshandlers/Multisell.java | 25 +- .../handlers/bypasshandlers/NpcViewMod.java | 33 +- .../handlers/bypasshandlers/Observation.java | 53 +- .../bypasshandlers/OlympiadManagerLink.java | 135 +- .../bypasshandlers/OlympiadObservation.java | 44 +- .../handlers/bypasshandlers/PlayerHelp.java | 32 +- .../bypasshandlers/PrivateWarehouse.java | 65 +- .../handlers/bypasshandlers/QuestLink.java | 175 +-- .../handlers/bypasshandlers/QuestList.java | 15 +- .../bypasshandlers/ReceivePremium.java | 18 +- .../bypasshandlers/ReleaseAttribute.java | 15 +- .../handlers/bypasshandlers/RentPet.java | 69 +- .../handlers/bypasshandlers/Rift.java | 43 +- .../handlers/bypasshandlers/SkillList.java | 64 +- .../bypasshandlers/SupportBlessing.java | 18 +- .../handlers/bypasshandlers/SupportMagic.java | 89 +- .../bypasshandlers/TerritoryStatus.java | 29 +- .../bypasshandlers/TutorialClose.java | 12 +- .../handlers/bypasshandlers/VoiceCommand.java | 28 +- .../handlers/bypasshandlers/Wear.java | 34 +- .../handlers/chathandlers/ChatAll.java | 54 +- .../handlers/chathandlers/ChatAlliance.java | 18 +- .../chathandlers/ChatBattlefield.java | 24 +- .../handlers/chathandlers/ChatClan.java | 18 +- .../handlers/chathandlers/ChatHeroVoice.java | 27 +- .../handlers/chathandlers/ChatParty.java | 18 +- .../chathandlers/ChatPartyMatchRoom.java | 24 +- .../chathandlers/ChatPartyRoomAll.java | 21 +- .../chathandlers/ChatPartyRoomCommander.java | 21 +- .../handlers/chathandlers/ChatPetition.java | 18 +- .../handlers/chathandlers/ChatShout.java | 37 +- .../handlers/chathandlers/ChatTell.java | 47 +- .../handlers/chathandlers/ChatTrade.java | 37 +- .../handlers/communityboard/ClanBoard.java | 198 +-- .../communityboard/FavoriteBoard.java | 59 +- .../handlers/communityboard/FriendsBoard.java | 23 +- .../handlers/communityboard/HomeBoard.java | 41 +- .../communityboard/HomepageBoard.java | 12 +- .../handlers/communityboard/MailBoard.java | 15 +- .../handlers/communityboard/MemoBoard.java | 15 +- .../handlers/communityboard/RegionBoard.java | 28 +- .../handlers/custom/CustomAnnouncePkPvP.java | 25 +- .../consume/ConsumeChameleonRest.java | 37 +- .../consume/ConsumeFakeDeath.java | 27 +- .../effecthandlers/consume/ConsumeHp.java | 15 +- .../effecthandlers/consume/ConsumeMp.java | 15 +- .../consume/ConsumeMpByLevel.java | 15 +- .../effecthandlers/consume/ConsumeRest.java | 40 +- .../effecthandlers/custom/BlockAction.java | 33 +- .../handlers/effecthandlers/custom/Buff.java | 12 +- .../effecthandlers/custom/Debuff.java | 9 +- .../effecthandlers/custom/Detection.java | 27 +- .../handlers/effecthandlers/custom/Flag.java | 15 +- .../handlers/effecthandlers/custom/Grow.java | 21 +- .../effecthandlers/custom/ImmobileBuff.java | 15 +- .../custom/ImmobilePetBuff.java | 18 +- .../handlers/effecthandlers/custom/Mute.java | 15 +- .../effecthandlers/custom/OpenChest.java | 25 +- .../effecthandlers/custom/OpenDoor.java | 37 +- .../effecthandlers/custom/Paralyze.java | 21 +- .../effecthandlers/custom/Recovery.java | 15 +- .../handlers/effecthandlers/custom/Root.java | 21 +- .../effecthandlers/custom/SilentMove.java | 9 +- .../handlers/effecthandlers/custom/Sleep.java | 21 +- .../handlers/effecthandlers/custom/Stun.java | 18 +- .../effecthandlers/custom/ThrowUp.java | 24 +- .../effecthandlers/instant/AddHate.java | 22 +- .../effecthandlers/instant/Backstab.java | 30 +- .../effecthandlers/instant/Blink.java | 12 +- .../effecthandlers/instant/Bluff.java | 18 +- .../effecthandlers/instant/CallParty.java | 24 +- .../effecthandlers/instant/CallPc.java | 18 +- .../effecthandlers/instant/CallSkill.java | 12 +- .../effecthandlers/instant/ChangeFace.java | 15 +- .../instant/ChangeHairColor.java | 15 +- .../instant/ChangeHairStyle.java | 15 +- .../effecthandlers/instant/ClanGate.java | 15 +- .../effecthandlers/instant/Confuse.java | 33 +- .../effecthandlers/instant/ConsumeBody.java | 15 +- .../effecthandlers/instant/ConvertItem.java | 68 +- .../handlers/effecthandlers/instant/Cp.java | 47 +- .../effecthandlers/instant/DeathLink.java | 34 +- .../effecthandlers/instant/DeleteHate.java | 21 +- .../instant/DeleteHateOfMe.java | 21 +- .../instant/DetectHiddenObjects.java | 18 +- .../effecthandlers/instant/DispelAll.java | 15 +- .../instant/DispelByCategory.java | 21 +- .../effecthandlers/instant/DispelBySlot.java | 43 +- .../instant/DispelBySlotProbability.java | 46 +- .../effecthandlers/instant/EnergyAttack.java | 58 +- .../effecthandlers/instant/Escape.java | 18 +- .../effecthandlers/instant/FatalBlow.java | 33 +- .../effecthandlers/instant/Fishing.java | 118 +- .../effecthandlers/instant/FlySelf.java | 24 +- .../effecthandlers/instant/FocusEnergy.java | 15 +- .../instant/FocusMaxEnergy.java | 18 +- .../effecthandlers/instant/FocusSouls.java | 25 +- .../effecthandlers/instant/FoodForPet.java | 26 +- .../effecthandlers/instant/GetAgro.java | 18 +- .../instant/GiveRecommendation.java | 31 +- .../effecthandlers/instant/GiveSp.java | 15 +- .../effecthandlers/instant/Harvesting.java | 65 +- .../instant/HeadquarterCreate.java | 26 +- .../handlers/effecthandlers/instant/Heal.java | 58 +- .../handlers/effecthandlers/instant/Hp.java | 47 +- .../effecthandlers/instant/HpByLevel.java | 18 +- .../effecthandlers/instant/HpDrain.java | 35 +- .../effecthandlers/instant/HpPerMax.java | 28 +- .../effecthandlers/instant/Lethal.java | 39 +- .../effecthandlers/instant/MagicalAttack.java | 34 +- .../instant/MagicalAttackByAbnormal.java | 34 +- .../instant/MagicalAttackMp.java | 36 +- .../instant/MagicalSoulAttack.java | 37 +- .../instant/ManaHealByLevel.java | 66 +- .../handlers/effecthandlers/instant/Mp.java | 58 +- .../effecthandlers/instant/MpPerMax.java | 28 +- .../instant/OpenCommonRecipeBook.java | 18 +- .../instant/OpenDwarfRecipeBook.java | 18 +- .../effecthandlers/instant/OutpostCreate.java | 18 +- .../instant/OutpostDestroy.java | 21 +- .../instant/PhysicalAttack.java | 40 +- .../instant/PhysicalAttackHpLink.java | 31 +- .../instant/PhysicalSoulAttack.java | 43 +- .../effecthandlers/instant/Pumping.java | 33 +- .../effecthandlers/instant/RandomizeHate.java | 21 +- .../effecthandlers/instant/RebalanceHP.java | 50 +- .../effecthandlers/instant/Reeling.java | 33 +- .../effecthandlers/instant/RefuelAirship.java | 15 +- .../effecthandlers/instant/Restoration.java | 25 +- .../instant/RestorationRandom.java | 36 +- .../effecthandlers/instant/Resurrection.java | 25 +- .../effecthandlers/instant/RunAway.java | 21 +- .../effecthandlers/instant/SetSkill.java | 18 +- .../effecthandlers/instant/SkillTurning.java | 18 +- .../effecthandlers/instant/SoulBlow.java | 30 +- .../handlers/effecthandlers/instant/Sow.java | 50 +- .../effecthandlers/instant/Spoil.java | 21 +- .../effecthandlers/instant/StaticDamage.java | 18 +- .../effecthandlers/instant/StealAbnormal.java | 24 +- .../effecthandlers/instant/Summon.java | 25 +- .../instant/SummonAgathion.java | 18 +- .../effecthandlers/instant/SummonCubic.java | 34 +- .../effecthandlers/instant/SummonNpc.java | 58 +- .../effecthandlers/instant/SummonPet.java | 33 +- .../effecthandlers/instant/SummonTrap.java | 27 +- .../effecthandlers/instant/Sweeper.java | 34 +- .../effecthandlers/instant/TakeCastle.java | 15 +- .../effecthandlers/instant/TakeFort.java | 18 +- .../effecthandlers/instant/TakeFortStart.java | 18 +- .../instant/TakeTerritoryFlag.java | 18 +- .../effecthandlers/instant/TargetCancel.java | 15 +- .../instant/TargetMeProbability.java | 24 +- .../effecthandlers/instant/Teleport.java | 15 +- .../instant/TeleportToTarget.java | 18 +- .../effecthandlers/instant/TransferHate.java | 27 +- .../effecthandlers/instant/TrapDetect.java | 21 +- .../effecthandlers/instant/TrapRemove.java | 33 +- .../effecthandlers/instant/Unsummon.java | 24 +- .../instant/UnsummonAgathion.java | 15 +- .../instant/VitalityPointUp.java | 15 +- .../effecthandlers/pump/AttackTrait.java | 30 +- .../handlers/effecthandlers/pump/Betray.java | 21 +- .../effecthandlers/pump/BlockBuff.java | 9 +- .../effecthandlers/pump/BlockBuffSlot.java | 22 +- .../effecthandlers/pump/BlockChat.java | 18 +- .../effecthandlers/pump/BlockDamage.java | 12 +- .../effecthandlers/pump/BlockDebuff.java | 9 +- .../effecthandlers/pump/BlockParty.java | 15 +- .../pump/BlockResurrection.java | 9 +- .../pump/ChangeFishingMastery.java | 6 +- .../pump/CrystalGradeModify.java | 21 +- .../effecthandlers/pump/CubicMastery.java | 18 +- .../effecthandlers/pump/DefenceTrait.java | 58 +- .../handlers/effecthandlers/pump/Disarm.java | 15 +- .../effecthandlers/pump/EnableCloak.java | 18 +- .../handlers/effecthandlers/pump/Fear.java | 34 +- .../handlers/effecthandlers/pump/Hide.java | 30 +- .../handlers/effecthandlers/pump/Lucky.java | 12 +- .../handlers/effecthandlers/pump/MaxCp.java | 48 +- .../handlers/effecthandlers/pump/MaxHp.java | 48 +- .../handlers/effecthandlers/pump/MaxMp.java | 48 +- .../effecthandlers/pump/NoblesseBless.java | 15 +- .../handlers/effecthandlers/pump/Passive.java | 15 +- .../pump/PhysicalAttackMute.java | 12 +- .../effecthandlers/pump/PhysicalMute.java | 12 +- .../pump/ProtectionBlessing.java | 12 +- .../effecthandlers/pump/ResistSkill.java | 30 +- .../pump/ResurrectionSpecial.java | 24 +- .../effecthandlers/pump/ServitorShare.java | 33 +- .../effecthandlers/pump/SingleTarget.java | 9 +- .../effecthandlers/pump/SoulEating.java | 30 +- .../effecthandlers/pump/TalismanSlot.java | 18 +- .../effecthandlers/pump/TargetMe.java | 24 +- .../effecthandlers/pump/TransferDamage.java | 18 +- .../effecthandlers/pump/Transformation.java | 15 +- .../pump/TriggerSkillByAttack.java | 61 +- .../pump/TriggerSkillByAvoid.java | 36 +- .../pump/TriggerSkillByDamage.java | 42 +- .../pump/TriggerSkillBySkill.java | 36 +- .../handlers/effecthandlers/ticks/TickHp.java | 43 +- .../effecthandlers/ticks/TickHpFatal.java | 24 +- .../handlers/effecthandlers/ticks/TickMp.java | 31 +- .../handlers/itemhandlers/BeastSoulShot.java | 33 +- .../itemhandlers/BeastSpiritShot.java | 33 +- .../itemhandlers/BlessedSpiritShot.java | 33 +- .../datapack/handlers/itemhandlers/Book.java | 16 +- .../handlers/itemhandlers/Bypass.java | 16 +- .../handlers/itemhandlers/Calculator.java | 9 +- .../handlers/itemhandlers/CharmOfCourage.java | 38 +- .../handlers/itemhandlers/Disguise.java | 23 +- .../handlers/itemhandlers/Elixir.java | 9 +- .../itemhandlers/EnchantAttribute.java | 15 +- .../handlers/itemhandlers/EnchantScrolls.java | 15 +- .../handlers/itemhandlers/EventItem.java | 33 +- .../itemhandlers/ExtractableItems.java | 37 +- .../handlers/itemhandlers/FishShots.java | 24 +- .../handlers/itemhandlers/Harvester.java | 22 +- .../handlers/itemhandlers/ItemSkills.java | 9 +- .../itemhandlers/ItemSkillsTemplate.java | 120 +- .../handlers/itemhandlers/ManaPotion.java | 9 +- .../datapack/handlers/itemhandlers/Maps.java | 9 +- .../handlers/itemhandlers/MercTicket.java | 55 +- .../handlers/itemhandlers/NicknameColor.java | 9 +- .../handlers/itemhandlers/PetFood.java | 43 +- .../handlers/itemhandlers/Recipes.java | 41 +- .../handlers/itemhandlers/RollingDice.java | 27 +- .../datapack/handlers/itemhandlers/Seed.java | 42 +- .../itemhandlers/SevenSignsRecord.java | 9 +- .../handlers/itemhandlers/SoulShots.java | 43 +- .../handlers/itemhandlers/SpecialXMas.java | 9 +- .../handlers/itemhandlers/SpiritShot.java | 33 +- .../handlers/itemhandlers/SummonItems.java | 27 +- .../itemhandlers/TeleportBookmark.java | 12 +- .../punishmenthandlers/BanHandler.java | 46 +- .../punishmenthandlers/ChatBanHandler.java | 79 +- .../punishmenthandlers/JailHandler.java | 115 +- .../handlers/targethandlers/Area.java | 49 +- .../targethandlers/AreaCorpseMob.java | 30 +- .../handlers/targethandlers/AreaFriendly.java | 84 +- .../handlers/targethandlers/AreaSummon.java | 39 +- .../handlers/targethandlers/Aura.java | 33 +- .../targethandlers/AuraCorpseMob.java | 24 +- .../handlers/targethandlers/AuraFriendly.java | 48 +- .../targethandlers/AuraUndeadEnemy.java | 24 +- .../handlers/targethandlers/BehindArea.java | 52 +- .../handlers/targethandlers/BehindAura.java | 30 +- .../handlers/targethandlers/Clan.java | 88 +- .../handlers/targethandlers/ClanMember.java | 37 +- .../targethandlers/CommandChannel.java | 30 +- .../handlers/targethandlers/CorpseClan.java | 82 +- .../handlers/targethandlers/CorpseMob.java | 21 +- .../handlers/targethandlers/Enemy.java | 24 +- .../handlers/targethandlers/EnemyOnly.java | 24 +- .../handlers/targethandlers/EnemySummon.java | 18 +- .../handlers/targethandlers/FlagPole.java | 15 +- .../handlers/targethandlers/FrontArea.java | 52 +- .../handlers/targethandlers/FrontAura.java | 30 +- .../handlers/targethandlers/Ground.java | 30 +- .../handlers/targethandlers/Holy.java | 15 +- .../datapack/handlers/targethandlers/One.java | 15 +- .../handlers/targethandlers/OwnerPet.java | 18 +- .../handlers/targethandlers/Party.java | 43 +- .../handlers/targethandlers/PartyClan.java | 75 +- .../handlers/targethandlers/PartyMember.java | 22 +- .../handlers/targethandlers/PartyNotMe.java | 37 +- .../handlers/targethandlers/PartyOther.java | 38 +- .../handlers/targethandlers/PcBody.java | 54 +- .../datapack/handlers/targethandlers/Pet.java | 15 +- .../handlers/targethandlers/Self.java | 12 +- .../handlers/targethandlers/Servitor.java | 15 +- .../handlers/targethandlers/Summon.java | 15 +- .../handlers/targethandlers/TargetParty.java | 31 +- .../handlers/targethandlers/Unlockable.java | 15 +- .../handlers/telnethandlers/ChatsHandler.java | 54 +- .../handlers/telnethandlers/DebugHandler.java | 48 +- .../handlers/telnethandlers/HelpHandler.java | 19 +- .../telnethandlers/PlayerHandler.java | 146 +- .../telnethandlers/ReloadHandler.java | 78 +- .../telnethandlers/ServerHandler.java | 45 +- .../telnethandlers/StatusHandler.java | 30 +- .../telnethandlers/ThreadHandler.java | 25 +- .../usercommandhandlers/ChannelDelete.java | 21 +- .../usercommandhandlers/ChannelInfo.java | 18 +- .../usercommandhandlers/ChannelLeave.java | 21 +- .../usercommandhandlers/ClanPenalty.java | 27 +- .../usercommandhandlers/ClanWarsList.java | 47 +- .../usercommandhandlers/Dismount.java | 22 +- .../usercommandhandlers/InstanceZone.java | 37 +- .../handlers/usercommandhandlers/Loc.java | 29 +- .../handlers/usercommandhandlers/Mount.java | 15 +- .../usercommandhandlers/MyBirthday.java | 15 +- .../usercommandhandlers/OlympiadStat.java | 29 +- .../usercommandhandlers/PartyInfo.java | 24 +- .../usercommandhandlers/SiegeStatus.java | 30 +- .../handlers/usercommandhandlers/Time.java | 32 +- .../handlers/usercommandhandlers/Unstuck.java | 45 +- .../voicedcommandhandlers/Banking.java | 43 +- .../voicedcommandhandlers/CastleVCmd.java | 54 +- .../voicedcommandhandlers/ChangePassword.java | 54 +- .../voicedcommandhandlers/ChatAdmin.java | 78 +- .../handlers/voicedcommandhandlers/Debug.java | 25 +- .../voicedcommandhandlers/Hellbound.java | 15 +- .../handlers/voicedcommandhandlers/Lang.java | 27 +- .../voicedcommandhandlers/SetVCmd.java | 34 +- .../voicedcommandhandlers/StatsVCmd.java | 27 +- .../voicedcommandhandlers/Wedding.java | 247 +--- .../datapack/hellbound/AI/Amaskari.java | 87 +- .../datapack/hellbound/AI/Chimeras.java | 56 +- .../datapack/hellbound/AI/DemonPrince.java | 46 +- .../datapack/hellbound/AI/HellboundCore.java | 28 +- .../datapack/hellbound/AI/Keltas.java | 48 +- .../hellbound/AI/NPC/Bernarde/Bernarde.java | 42 +- .../hellbound/AI/NPC/Budenka/Budenka.java | 29 +- .../hellbound/AI/NPC/Buron/Buron.java | 47 +- .../hellbound/AI/NPC/Deltuva/Deltuva.java | 15 +- .../datapack/hellbound/AI/NPC/Falk/Falk.java | 30 +- .../datapack/hellbound/AI/NPC/Hude/Hude.java | 60 +- .../datapack/hellbound/AI/NPC/Jude/Jude.java | 24 +- .../hellbound/AI/NPC/Kanaf/Kanaf.java | 12 +- .../datapack/hellbound/AI/NPC/Kief/Kief.java | 85 +- .../hellbound/AI/NPC/Natives/Natives.java | 99 +- .../hellbound/AI/NPC/Quarry/Quarry.java | 82 +- .../hellbound/AI/NPC/Shadai/Shadai.java | 25 +- .../hellbound/AI/NPC/Solomon/Solomon.java | 16 +- .../hellbound/AI/NPC/Warpgate/Warpgate.java | 51 +- .../datapack/hellbound/AI/NaiaLock.java | 9 +- .../datapack/hellbound/AI/OutpostCaptain.java | 34 +- .../datapack/hellbound/AI/Ranku.java | 52 +- .../datapack/hellbound/AI/Slaves.java | 30 +- .../datapack/hellbound/AI/Typhoon.java | 21 +- .../AI/Zones/AnomicFoundry/AnomicFoundry.java | 124 +- .../AI/Zones/BaseTower/BaseTower.java | 42 +- .../TowerOfInfinitum/TowerOfInfinitum.java | 92 +- .../AI/Zones/TowerOfNaia/TowerOfNaia.java | 408 ++---- .../AI/Zones/TullyWorkshop/TullyWorkshop.java | 800 ++++------ .../datapack/hellbound/HellboundEngine.java | 169 +-- .../hellbound/HellboundPointData.java | 65 +- .../datapack/hellbound/HellboundSpawns.java | 75 +- .../DemonPrinceFloor/DemonPrinceFloor.java | 88 +- .../Instances/RankuFloor/RankuFloor.java | 88 +- .../Instances/UrbanArea/UrbanArea.java | 231 +-- .../datapack/instances/AbstractInstance.java | 155 +- .../CastleDungeon/CastleDungeon.java | 101 +- .../CavernOfThePirateCaptain.java | 232 +-- .../instances/ChambersOfDelusion/Chamber.java | 314 ++-- .../ChamberOfDelusionEast.java | 9 +- .../ChamberOfDelusionNorth.java | 9 +- .../ChamberOfDelusionSouth.java | 9 +- .../ChamberOfDelusionSquare.java | 9 +- .../ChamberOfDelusionTower.java | 9 +- .../ChamberOfDelusionWest.java | 9 +- .../CrystalCaverns/CrystalCaverns.java | 975 ++++--------- .../DarkCloudMansion/DarkCloudMansion.java | 540 +++---- .../DisciplesNecropolisPast.java | 221 +-- .../instances/ElcadiasTent/ElcadiasTent.java | 32 +- .../FinalEmperialTomb/FinalEmperialTomb.java | 661 +++------ .../HideoutOfTheDawn/HideoutOfTheDawn.java | 30 +- .../IceQueensCastle/IceQueensCastle.java | 84 +- .../IceQueensCastleNormalBattle.java | 750 +++------- .../JiniaGuildHideout1.java | 21 +- .../JiniaGuildHideout2.java | 21 +- .../JiniaGuildHideout3.java | 21 +- .../JiniaGuildHideout4.java | 21 +- .../datapack/instances/Kamaloka/Kamaloka.java | 297 ++-- .../LibraryOfSages/LibraryOfSages.java | 48 +- .../instances/MithrilMine/MithrilMine.java | 101 +- .../MonasteryOfSilence1.java | 231 +-- .../NornilsGarden/NornilsGarden.java | 303 ++-- .../NornilsGardenQuest.java | 52 +- .../PailakaDevilsLegacy.java | 143 +- .../PailakaSongOfIceAndFire.java | 90 +- .../SanctumOftheLordsOfDawn.java | 106 +- .../SecretAreaInTheKeucereusFortress1.java | 24 +- .../datapack/quests/AbstractSagaQuest.java | 123 +- .../Dummy/Q00201_HumanFighterTutorial.java | 6 +- .../Dummy/Q00202_HumanMageTutorial.java | 6 +- .../quests/Dummy/Q00203_ElfTutorial.java | 6 +- .../quests/Dummy/Q00204_DarkElfTutorial.java | 6 +- .../quests/Dummy/Q00205_OrcTutorial.java | 6 +- .../quests/Dummy/Q00206_DwarfTutorial.java | 6 +- .../Dummy/Q00207_NewbieWeaponCoupon.java | 6 +- .../Dummy/Q00208_NewbieAccessoryCoupon.java | 6 +- .../quests/Dummy/Q00209_KamaelTutorial.java | 6 +- .../quests/Dummy/Q00728_TerritoryWar.java | 6 +- .../Q00001_LettersOfLove.java | 124 +- .../Q00002_WhatWomenWant.java | 61 +- .../Q00003_WillTheSealBeBroken.java | 46 +- .../Q00004_LongLiveThePaagrioLord.java | 44 +- .../Q00005_MinersFavor.java | 53 +- .../Q00006_StepIntoTheFuture.java | 54 +- .../Q00007_ATripBegins.java | 54 +- .../Q00008_AnAdventureBegins.java | 54 +- .../Q00009_IntoTheCityOfHumans.java | 33 +- .../Q00010_IntoTheWorld.java | 50 +- .../Q00011_SecretMeetingWithKetraOrcs.java | 75 +- .../Q00012_SecretMeetingWithVarkaSilenos.java | 75 +- .../Q00013_ParcelDelivery.java | 61 +- .../Q00014_WhereaboutsOfTheArchaeologist.java | 37 +- .../Q00015_SweetWhispers.java | 42 +- .../Q00016_TheComingDarkness.java | 45 +- .../Q00017_LightAndDarkness.java | 48 +- .../Q00018_MeetingWithTheGoldenRam.java | 45 +- .../Q00019_GoToThePastureland.java | 50 +- .../Q00020_BringUpWithLove.java | 51 +- .../Q00021_HiddenTruth.java | 251 +--- .../Q00022_TragedyInVonHellmannForest.java | 381 ++--- .../Q00023_LidiasHeart.java | 286 ++-- ...00024_InhabitantsOfTheForestOfTheDead.java | 94 +- .../Q00025_HidingBehindTheTruth.java | 416 ++---- .../Q00026_TiredOfWaiting.java | 47 +- .../Q00027_ChestCaughtWithABaitOfWind.java | 50 +- .../Q00028_ChestCaughtWithABaitOfIcyAir.java | 42 +- .../Q00029_ChestCaughtWithABaitOfEarth.java | 42 +- .../Q00030_ChestCaughtWithABaitOfFire.java | 42 +- .../Q00031_SecretBuriedInTheSwamp.java | 106 +- .../Q00032_AnObviousLie.java | 154 +- .../Q00033_MakeAPairOfDressShoes.java | 57 +- .../Q00034_InSearchOfCloth.java | 65 +- .../Q00035_FindGlitteringJewelry.java | 63 +- .../Q00036_MakeASewingKit.java | 50 +- .../Q00037_MakeFormalWear.java | 57 +- .../Q00038_DragonFangs.java | 188 +-- .../Q00039_RedEyedInvaders.java | 162 +-- .../Q00040_ASpecialOrder.java | 138 +- .../Q00042_HelpTheUncle.java | 67 +- .../Q00043_HelpTheSister.java | 67 +- .../Q00044_HelpTheSon/Q00044_HelpTheSon.java | 67 +- .../Q00045_ToTalkingIsland.java | 165 +-- ...0046_OnceMoreInTheArmsOfTheMotherTree.java | 165 +-- .../Q00047_IntoTheDarkElvenForest.java | 165 +-- .../Q00048_ToTheImmortalPlateau.java | 165 +-- .../Q00049_TheRoadHome.java | 165 +-- .../Q00050_LanoscosSpecialBait.java | 39 +- .../Q00051_OFullesSpecialBait.java | 39 +- .../Q00052_WilliesSpecialBait.java | 39 +- .../Q00053_LinnaeusSpecialBait.java | 43 +- .../Q00060_GoodWorksReward.java | 836 ++++------- .../Q00061_LawEnforcement.java | 130 +- .../Q00062_PathOfTheTrooper.java | 177 +-- .../Q00063_PathOfTheWarder.java | 340 ++--- .../Q00064_CertifiedBerserker.java | 303 ++-- .../Q00065_CertifiedSoulBreaker.java | 498 ++----- .../Q00066_CertifiedArbalester.java | 725 +++------- .../Q00067_SagaOfTheDoombringer.java | 27 +- .../Q00068_SagaOfTheSoulHound.java | 27 +- .../Q00069_SagaOfTheTrickster.java | 27 +- .../Q00070_SagaOfThePhoenixKnight.java | 27 +- .../Q00071_SagaOfEvasTemplar.java | 27 +- .../Q00072_SagaOfTheSwordMuse.java | 27 +- .../Q00073_SagaOfTheDuelist.java | 39 +- .../Q00074_SagaOfTheDreadnought.java | 27 +- .../Q00075_SagaOfTheTitan.java | 27 +- .../Q00076_SagaOfTheGrandKhavatari.java | 27 +- .../Q00077_SagaOfTheDominator.java | 27 +- .../Q00078_SagaOfTheDoomcryer.java | 27 +- .../Q00079_SagaOfTheAdventurer.java | 27 +- .../Q00080_SagaOfTheWindRider.java | 27 +- .../Q00081_SagaOfTheGhostHunter.java | 27 +- .../Q00082_SagaOfTheSagittarius.java | 27 +- .../Q00083_SagaOfTheMoonlightSentinel.java | 27 +- .../Q00084_SagaOfTheGhostSentinel.java | 27 +- .../Q00085_SagaOfTheCardinal.java | 27 +- .../Q00086_SagaOfTheHierophant.java | 27 +- .../Q00087_SagaOfEvasSaint.java | 27 +- .../Q00088_SagaOfTheArchmage.java | 27 +- .../Q00089_SagaOfTheMysticMuse.java | 27 +- .../Q00090_SagaOfTheStormScreamer.java | 27 +- .../Q00091_SagaOfTheArcanaLord.java | 27 +- .../Q00092_SagaOfTheElementalMaster.java | 27 +- .../Q00093_SagaOfTheSpectralMaster.java | 27 +- .../Q00094_SagaOfTheSoultaker.java | 27 +- .../Q00095_SagaOfTheHellKnight.java | 27 +- .../Q00096_SagaOfTheSpectralDancer.java | 27 +- .../Q00097_SagaOfTheShillienTemplar.java | 27 +- .../Q00098_SagaOfTheShillienSaint.java | 27 +- .../Q00099_SagaOfTheFortuneSeeker.java | 27 +- .../Q00100_SagaOfTheMaestro.java | 27 +- .../Q00101_SwordOfSolidarity.java | 167 +-- .../Q00102_SeaOfSporesFever.java | 134 +- .../Q00103_SpiritOfCraftsman.java | 142 +- .../Q00104_SpiritOfMirrors.java | 74 +- .../Q00105_SkirmishWithOrcs.java | 88 +- .../Q00106_ForgottenTruth.java | 108 +- .../Q00107_MercilessPunishment.java | 149 +- .../Q00108_JumbleTumbleDiamondFuss.java | 323 ++--- .../Q00109_InSearchOfTheNest.java | 40 +- .../Q00110_ToThePrimevalIsle.java | 27 +- .../Q00111_ElrokianHuntersProof.java | 233 +-- .../Q00112_WalkOfFate/Q00112_WalkOfFate.java | 39 +- .../Q00113_StatusOfTheBeaconTower.java | 34 +- .../Q00114_ResurrectionOfAnOldManager.java | 119 +- .../Q00115_TheOtherSideOfTruth.java | 501 ++----- .../Q00116_BeyondTheHillsOfWinter.java | 82 +- .../Q00117_TheOceanOfDistantStars.java | 203 +-- .../Q00118_ToLeadAndBeLed.java | 240 +-- .../Q00119_LastImperialPrince.java | 82 +- .../Q00120_PavelsLastResearch.java | 922 ++++-------- .../Q00121_PavelTheGiant.java | 27 +- .../Q00122_OminousNews.java | 27 +- .../Q00123_TheLeaderAndTheFollower.java | 240 +-- .../Q00124_MeetingTheElroki.java | 69 +- .../Q00125_TheNameOfEvil1.java | 125 +- .../Q00126_TheNameOfEvil2.java | 156 +- .../Q00128_PailakaSongOfIceAndFire.java | 179 +-- .../Q00129_PailakaDevilsLegacy.java | 167 +-- .../Q00130_PathToHellbound.java | 110 +- .../Q00131_BirdInACage.java | 125 +- .../Q00132_MatrasCuriosity.java | 76 +- .../Q00133_ThatsBloodyHot.java | 121 +- .../Q00134_TempleMissionary.java | 90 +- .../Q00135_TempleExecutor.java | 114 +- .../Q00136_MoreThanMeetsTheEye.java | 101 +- .../Q00137_TempleChampionPart1.java | 56 +- .../Q00138_TempleChampionPart2.java | 74 +- .../Q00139_ShadowFoxPart1.java | 45 +- .../Q00140_ShadowFoxPart2.java | 61 +- .../Q00141_ShadowFoxPart3.java | 60 +- .../Q00142_FallenAngelRequestOfDawn.java | 101 +- .../Q00143_FallenAngelRequestOfDusk.java | 71 +- .../Q00146_TheZeroHour.java | 44 +- ...Q00147_PathtoBecominganEliteMercenary.java | 45 +- ...0148_PathtoBecominganExaltedMercenary.java | 46 +- .../Q00151_CureForFever.java | 51 +- .../Q00152_ShardsOfGolem.java | 109 +- .../Q00153_DeliverGoods.java | 70 +- .../Q00154_SacrificeToTheSea.java | 86 +- .../Q00155_FindSirWindawood.java | 24 +- .../Q00156_MillenniumLove.java | 86 +- .../Q00157_RecoverSmuggledGoods.java | 56 +- .../Q00158_SeedOfEvil/Q00158_SeedOfEvil.java | 37 +- .../Q00159_ProtectTheWaterSource.java | 82 +- .../Q00160_NerupasRequest.java | 104 +- .../Q00161_FruitOfTheMotherTree.java | 41 +- .../Q00162_CurseOfTheUndergroundFortress.java | 85 +- .../Q00163_LegacyOfThePoet.java | 92 +- .../Q00164_BloodFiend/Q00164_BloodFiend.java | 40 +- .../Q00165_ShilensHunt.java | 50 +- .../Q00166_MassOfDarkness.java | 59 +- .../Q00167_DwarvenKinship.java | 79 +- .../Q00168_DeliverSupplies.java | 86 +- .../Q00169_OffspringOfNightmares.java | 63 +- .../Q00170_DangerousSeduction.java | 34 +- .../Q00171_ActsOfEvil/Q00171_ActsOfEvil.java | 394 ++--- .../Q00172_NewHorizons.java | 27 +- .../Q00173_ToTheIsleOfSouls.java | 27 +- .../Q00174_SupplyCheck.java | 45 +- .../Q00175_TheWayOfTheWarrior.java | 156 +- .../Q00176_StepsForHonor.java | 24 +- .../Q00178_IconicTrinity.java | 314 ++-- .../Q00179_IntoTheLargeCavern.java | 63 +- .../Q00182_NewRecruits.java | 88 +- .../Q00183_RelicExploration.java | 107 +- .../Q00184_ArtOfPersuasion.java | 171 +-- .../Q00185_NikolasCooperation.java | 171 +-- .../Q00186_ContractExecution.java | 125 +- .../Q00187_NikolasHeart.java | 96 +- .../Q00188_SealRemoval.java | 102 +- .../Q00189_ContractCompletion.java | 116 +- .../Q00190_LostDream/Q00190_LostDream.java | 116 +- .../Q00191_VainConclusion.java | 119 +- .../Q00192_SevenSignsSeriesOfDoubt.java | 183 +-- .../Q00193_SevenSignsDyingMessage.java | 180 +-- .../Q00194_SevenSignsMammonsContract.java | 339 ++--- ...95_SevenSignsSecretRitualOfThePriests.java | 196 +-- .../Q00196_SevenSignsSealOfTheEmperor.java | 203 +-- .../Q00197_SevenSignsTheSacredBookOfSeal.java | 212 +-- .../Q00198_SevenSignsEmbryo.java | 124 +- .../Q00211_TrialOfTheChallenger.java | 247 +--- .../Q00212_TrialOfDuty.java | 329 ++--- .../Q00213_TrialOfTheSeeker.java | 362 ++--- .../Q00214_TrialOfTheScholar.java | 704 +++------ .../Q00215_TrialOfThePilgrim.java | 330 ++--- .../Q00216_TrialOfTheGuildsman.java | 373 ++--- .../Q00217_TestimonyOfTrust.java | 482 ++---- .../Q00218_TestimonyOfLife.java | 462 ++---- .../Q00219_TestimonyOfFate.java | 443 ++---- .../Q00220_TestimonyOfGlory.java | 674 +++------ .../Q00221_TestimonyOfProsperity.java | 641 +++----- .../Q00222_TestOfTheDuelist.java | 292 ++-- .../Q00223_TestOfTheChampion.java | 411 ++---- .../Q00224_TestOfSagittarius.java | 331 ++--- .../Q00225_TestOfTheSearcher.java | 371 ++--- .../Q00226_TestOfTheHealer.java | 425 ++---- .../Q00227_TestOfTheReformer.java | 382 ++--- .../Q00228_TestOfMagus.java | 417 ++---- .../Q00229_TestOfWitchcraft.java | 541 +++---- .../Q00230_TestOfTheSummoner.java | 767 +++------- .../Q00231_TestOfTheMaestro.java | 296 ++-- .../Q00232_TestOfTheLord.java | 452 ++---- .../Q00233_TestOfTheWarSpirit.java | 388 ++--- .../Q00234_FatesWhisper.java | 586 +++----- .../Q00235_MimirsElixir.java | 187 +-- .../Q00236_SeedsOfChaos.java | 742 +++------- .../Q00237_WindsOfChange.java | 80 +- .../Q00238_SuccessFailureOfBusiness.java | 80 +- .../Q00239_WontYouJoinUs.java | 80 +- .../Q00240_ImTheOnlyOneYouCanTrust.java | 43 +- .../Q00241_PossessorOfAPreciousSoul1.java | 158 +- .../Q00242_PossessorOfAPreciousSoul2.java | 116 +- .../Q00246_PossessorOfAPreciousSoul3.java | 153 +- .../Q00247_PossessorOfAPreciousSoul4.java | 51 +- .../Q00249_PoisonedPlainsOfTheLizardmen.java | 45 +- .../Q00250_WatchWhatYouEat.java | 85 +- .../Q00251_NoSecrets/Q00251_NoSecrets.java | 61 +- .../Q00252_ItSmellsDelicious.java | 78 +- .../Q00254_LegendaryTales.java | 84 +- .../Q00255_Tutorial/Q00255_Tutorial.java | 1288 +++++------------ .../Q00257_TheGuardIsBusy.java | 67 +- .../Q00258_BringWolfPelts.java | 61 +- .../Q00259_RequestFromTheFarmOwner.java | 73 +- .../Q00260_OrcHunting/Q00260_OrcHunting.java | 52 +- .../Q00261_CollectorsDream.java | 58 +- .../Q00262_TradeWithTheIvoryTower.java | 58 +- .../Q00263_OrcSubjugation.java | 52 +- .../Q00264_KeenClaws/Q00264_KeenClaws.java | 66 +- .../Q00265_BondsOfSlavery.java | 52 +- .../Q00266_PleasOfPixies.java | 86 +- .../Q00267_WrathOfVerdure.java | 52 +- .../Q00268_TracesOfEvil.java | 52 +- .../Q00269_InventionAmbition.java | 59 +- .../Q00270_TheOneWhoEndsSilence.java | 260 +--- .../Q00271_ProofOfValor.java | 56 +- .../Q00272_WrathOfAncestors.java | 49 +- .../Q00273_InvadersOfTheHolyLand.java | 59 +- .../Q00274_SkirmishWithTheWerewolves.java | 62 +- .../Q00275_DarkWingedSpies.java | 70 +- .../Q00276_TotemOfTheHestui.java | 72 +- .../Q00277_GatekeepersOffering.java | 41 +- .../Q00278_HomeSecurity.java | 110 +- .../Q00279_TargetOfOpportunity.java | 69 +- .../Q00280_TheFoodChain.java | 88 +- .../Q00281_HeadForTheHills.java | 95 +- .../Q00283_TheFewTheProudTheBrave.java | 52 +- .../Q00284_MuertosFeather.java | 53 +- .../Q00286_FabulousFeathers.java | 50 +- .../Q00287_FiguringItOut.java | 56 +- .../Q00288_HandleWithCare.java | 113 +- .../Q00289_NoMoreSoupForYou.java | 70 +- .../Q00290_ThreatRemoval.java | 97 +- .../Q00291_RevengeOfTheRedbonnet.java | 53 +- .../Q00292_BrigandsSweep.java | 121 +- .../Q00293_TheHiddenVeins.java | 78 +- .../Q00294_CovertBusiness.java | 54 +- .../Q00295_DreamingOfTheSkies.java | 45 +- .../Q00296_TarantulasSpiderSilk.java | 86 +- .../Q00297_GatekeepersFavor.java | 41 +- .../Q00298_LizardmensConspiracy.java | 81 +- .../Q00299_GatherIngredientsForPie.java | 153 +- .../Q00300_HuntingLetoLizardman.java | 85 +- .../Q00303_CollectArrowheads.java | 48 +- .../Q00306_CrystalOfFireAndIce.java | 68 +- .../Q00307_ControlDeviceOfTheGiants.java | 81 +- .../Q00308_ReedFieldMaintenance.java | 88 +- .../Q00309_ForAGoodCause.java | 88 +- .../Q00310_OnlyWhatRemains.java | 44 +- .../Q00311_ExpulsionOfEvilSpirits.java | 70 +- .../Q00312_TakeAdvantageOfTheCrisis.java | 30 +- .../Q00313_CollectSpores.java | 60 +- .../Q00316_DestroyPlagueCarriers.java | 73 +- .../Q00317_CatchTheWind.java | 49 +- .../Q00319_ScentOfDeath.java | 58 +- .../Q00320_BonesTellTheFuture.java | 40 +- .../Q00324_SweetestVenom.java | 56 +- .../Q00325_GrimCollector.java | 134 +- .../Q00326_VanquishRemnants.java | 52 +- .../Q00327_RecoverTheFarmland.java | 252 +--- .../Q00328_SenseForBusiness.java | 63 +- .../Q00329_CuriosityOfADwarf.java | 61 +- .../Q00330_AdeptOfTaste.java | 695 +++------ .../Q00331_ArrowOfVengeance.java | 67 +- .../Q00333_HuntOfTheBlackLion.java | 854 ++++------- .../Q00334_TheWishingPotion.java | 611 +++----- .../Q00335_TheSongOfTheHunter.java | 736 +++------- .../Q00336_CoinsOfMagic.java | 1025 +++++-------- .../Q00337_AudienceWithTheLandDragon.java | 516 +++---- .../Q00338_AlligatorHunter.java | 33 +- .../Q00340_SubjugationOfLizardmen.java | 202 +-- .../Q00341_HuntingForWildBeasts.java | 62 +- .../Q00343_UnderTheShadowOfTheIvoryTower.java | 410 ++---- .../Q00344_1000YearsTheEndOfLamentation.java | 220 +-- .../Q00345_MethodToRaiseTheDead.java | 255 +--- .../Q00347_GoGetTheCalculator.java | 141 +- .../Q00348_AnArrogantSearch.java | 955 ++++-------- .../Q00351_BlackSwan/Q00351_BlackSwan.java | 101 +- .../Q00352_HelpRoodRaiseANewPet.java | 80 +- .../Q00354_ConquestOfAlligatorIsland.java | 74 +- .../Q00355_FamilyHonor.java | 122 +- .../Q00356_DigUpTheSeaOfSpores.java | 88 +- .../Q00357_WarehouseKeepersAmbition.java | 59 +- .../Q00358_IllegitimateChildOfTheGoddess.java | 50 +- .../Q00359_ForASleeplessDeadman.java | 60 +- .../Q00360_PlunderTheirSupplies.java | 79 +- .../Q00362_BardsMandolin.java | 94 +- .../Q00363_SorrowfulSoundOfFlute.java | 208 +-- .../Q00364_JovialAccordion.java | 167 +-- .../Q00365_DevilsLegacy.java | 137 +- .../Q00366_SilverHairedShaman.java | 56 +- .../Q00367_ElectrifyingRecharge.java | 124 +- .../Q00368_TrespassingIntoTheHolyGround.java | 59 +- .../Q00369_CollectorOfJewels.java | 84 +- .../Q00370_AnElderSowsSeeds.java | 81 +- .../Q00371_ShrieksOfGhosts.java | 112 +- .../Q00372_LegacyOfInsolence.java | 410 ++---- .../Q00373_SupplierOfReagents.java | 48 +- ...00376_ExplorationOfTheGiantsCavePart1.java | 43 +- ...00377_ExplorationOfTheGiantsCavePart2.java | 50 +- .../Q00378_GrandFeast/Q00378_GrandFeast.java | 153 +- .../Q00379_FantasyWine.java | 72 +- ...Q00380_BringOutTheFlavorOfIngredients.java | 86 +- .../Q00381_LetsBecomeARoyalMember.java | 95 +- .../Q00382_KailsMagicCoin.java | 53 +- .../Q00383_TreasureHunt.java | 216 +-- .../Q00385_YokeOfThePast.java | 52 +- .../Q00386_StolenDignity.java | 456 ++---- .../Q00401_PathOfTheWarrior.java | 211 +-- .../Q00402_PathOfTheHumanKnight.java | 368 ++--- .../Q00403_PathOfTheRogue.java | 212 +-- .../Q00404_PathOfTheHumanWizard.java | 244 +--- .../Q00405_PathOfTheCleric.java | 198 +-- .../Q00406_PathOfTheElvenKnight.java | 157 +- .../Q00407_PathOfTheElvenScout.java | 205 +-- .../Q00408_PathOfTheElvenWizard.java | 302 ++-- .../Q00409_PathOfTheElvenOracle.java | 248 +--- .../Q00410_PathOfThePalusKnight.java | 192 +-- .../Q00411_PathOfTheAssassin.java | 204 +-- .../Q00412_PathOfTheDarkWizard.java | 253 +--- .../Q00413_PathOfTheShillienOracle.java | 195 +-- .../Q00414_PathOfTheOrcRaider.java | 224 +-- .../Q00415_PathOfTheOrcMonk.java | 440 ++---- .../Q00416_PathOfTheOrcShaman.java | 381 ++--- .../Q00417_PathOfTheScavenger.java | 424 ++---- .../Q00418_PathOfTheArtisan.java | 381 ++--- .../quests/Q00419_GetAPet/Q00419_GetAPet.java | 551 +++---- .../Q00420_LittleWing/Q00420_LittleWing.java | 522 +++---- .../Q00421_LittleWingsBigAdventure.java | 66 +- .../Q00422_RepentYourSins.java | 317 ++-- .../Q00423_TakeYourBestShot.java | 92 +- .../Q00426_QuestForFishingShot.java | 6 +- .../Q00431_WeddingMarch.java | 47 +- .../Q00432_BirthdayPartySong.java | 37 +- .../Q00450_GraveRobberRescue.java | 58 +- .../Q00451_LuciensAltar.java | 62 +- .../Q00452_FindingtheLostSoldiers.java | 69 +- .../Q00453_NotStrongEnoughAlone.java | 172 +-- .../Q00454_CompletelyLost.java | 546 +++---- .../Q00455_WingsOfSand.java | 124 +- .../Q00456_DontKnowDontCare.java | 141 +- .../Q00457_LostAndFound.java | 106 +- .../Q00458_PerfectForm.java | 153 +- .../Q00461_RumbleInTheBase.java | 70 +- .../Q00463_IMustBeaGenius.java | 81 +- .../quests/Q00464_Oath/Q00464_Oath.java | 75 +- .../Q00501_ProofOfClanAlliance.java | 323 ++--- .../Q00503_PursuitOfClanAmbition.java | 544 +++---- ...504_CompetitionForTheBanditStronghold.java | 79 +- .../Q00508_AClansReputation.java | 69 +- .../Q00509_AClansFame/Q00509_AClansFame.java | 69 +- .../Q00510_AClansPrestige.java | 53 +- .../Q00511_AwlUnderFoot.java | 246 +--- .../Q00512_BladeUnderFoot.java | 98 +- .../Q00551_OlympiadStarter.java | 134 +- .../Q00552_OlympiadVeteran.java | 121 +- .../Q00553_OlympiadUndefeated.java | 94 +- .../Q00601_WatchingEyes.java | 46 +- .../Q00602_ShadowOfLight.java | 49 +- .../Q00603_DaimonTheWhiteEyedPart1.java | 99 +- .../Q00604_DaimonTheWhiteEyedPart2.java | 151 +- .../Q00605_AllianceWithKetraOrcs.java | 105 +- .../Q00606_BattleAgainstVarkaSilenos.java | 33 +- .../Q00607_ProveYourCourageKetra.java | 37 +- .../Q00608_SlayTheEnemyCommanderKetra.java | 37 +- .../Q00609_MagicalPowerOfWaterPart1.java | 69 +- .../Q00610_MagicalPowerOfWaterPart2.java | 85 +- .../Q00611_AllianceWithVarkaSilenos.java | 105 +- .../Q00612_BattleAgainstKetraOrcs.java | 33 +- .../Q00613_ProveYourCourageVarka.java | 37 +- .../Q00614_SlayTheEnemyCommanderVarka.java | 37 +- .../Q00615_MagicalPowerOfFirePart1.java | 69 +- .../Q00616_MagicalPowerOfFirePart2.java | 85 +- .../Q00617_GatherTheFlames.java | 66 +- .../Q00618_IntoTheFlame.java | 73 +- .../Q00619_RelicsOfTheOldEmpire.java | 84 +- .../Q00620_FourGoblets.java | 555 ++----- .../Q00621_EggDelivery.java | 153 +- .../Q00622_SpecialtyLiquorDelivery.java | 153 +- .../Q00623_TheFinestFood.java | 90 +- .../Q00624_TheFinestIngredientsPart1.java | 71 +- .../Q00625_TheFinestIngredientsPart2.java | 162 +-- .../Q00626_ADarkTwilight.java | 49 +- .../Q00627_HeartInSearchOfPower.java | 68 +- .../Q00628_HuntGoldenRam.java | 107 +- .../Q00629_CleanUpTheSwampOfScreams.java | 62 +- .../Q00631_DeliciousTopChoiceMeat.java | 105 +- .../Q00632_NecromancersRequest.java | 73 +- .../Q00633_InTheForgottenVillage.java | 77 +- ...Q00634_InSearchOfFragmentsOfDimension.java | 55 +- .../Q00635_IntoTheDimensionalRift.java | 6 +- .../Q00636_TruthBeyond.java | 56 +- .../Q00637_ThroughOnceMore.java | 72 +- .../Q00638_SeekersOfTheHolyGrail.java | 96 +- .../Q00639_GuardiansOfTheHolyGrail.java | 12 +- .../Q00641_AttackSailren.java | 50 +- .../Q00642_APowerfulPrimevalCreature.java | 67 +- .../Q00643_RiseAndFallOfTheElrokiTribe.java | 114 +- .../Q00644_GraveRobberAnnihilation.java | 61 +- .../Q00645_GhostsOfBatur.java | 65 +- .../Q00646_SignsOfRevolt.java | 12 +- .../Q00647_InfluxOfMachines.java | 57 +- .../Q00648_AnIceMerchantsDream.java | 206 +-- .../Q00649_ALooterAndARailroadMan.java | 55 +- .../Q00650_ABrokenDream.java | 76 +- .../Q00651_RunawayYouth.java | 34 +- .../Q00652_AnAgedExAdventurer.java | 41 +- .../Q00653_WildMaiden/Q00653_WildMaiden.java | 34 +- .../Q00654_JourneyToASettlement.java | 56 +- .../Q00655_AGrandPlanForTamingWildBeasts.java | 140 +- ...00659_IdRatherBeCollectingFairyBreath.java | 53 +- .../Q00660_AidingTheFloranVillage.java | 206 +-- .../Q00661_MakingTheHarvestGroundsSafe.java | 58 +- .../Q00662_AGameOfCards.java | 501 ++----- .../Q00663_SeductiveWhispers.java | 489 ++----- .../Q00688_DefeatTheElrokianRaiders.java | 71 +- .../Q00690_JudesRequest.java | 84 +- .../Q00691_MatrasSuspiciousRequest.java | 60 +- .../Q00692_HowtoOpposeEvil.java | 125 +- .../Q00695_DefendTheHallOfSuffering.java | 45 +- .../Q00699_GuardianOfTheSkies.java | 77 +- .../Q00700_CursedLife/Q00700_CursedLife.java | 147 +- .../Q00701_ProofOfExistence.java | 67 +- .../Q00702_ATrapForRevenge.java | 264 +--- .../Q00901_HowLavasaurusesAreMade.java | 64 +- .../Q00902_ReclaimOurEra.java | 120 +- .../Q00903_TheCallOfAntharas.java | 98 +- .../Q00904_DragonTrophyAntharas.java | 86 +- .../Q00905_RefinedDragonBlood.java | 93 +- .../Q00906_TheCallOfValakas.java | 86 +- .../Q00907_DragonTrophyValakas.java | 86 +- .../Q00998_FallenAngelSelect.java | 27 +- .../Q10267_JourneyToGracia.java | 34 +- .../Q10268_ToTheSeedOfInfinity.java | 27 +- .../Q10269_ToTheSeedOfDestruction.java | 27 +- .../Q10270_BirthOfTheSeed.java | 229 +-- .../Q10271_TheEnvelopingDarkness.java | 50 +- .../Q10272_LightFragment.java | 145 +- .../Q10273_GoodDayToFly.java | 61 +- .../Q10274_CollectingInTheAir.java | 43 +- .../Q10275_ContainingTheAttributePower.java | 95 +- .../Q10276_MutatedKaneusGludio.java | 59 +- .../Q10277_MutatedKaneusDion.java | 59 +- .../Q10278_MutatedKaneusHeine.java | 59 +- .../Q10279_MutatedKaneusOren.java | 59 +- .../Q10280_MutatedKaneusSchuttgart.java | 59 +- .../Q10281_MutatedKaneusRune.java | 52 +- .../Q10282_ToTheSeedOfAnnihilation.java | 38 +- .../Q10283_RequestOfIceMerchant.java | 107 +- .../Q10284_AcquisitionOfDivineSword.java | 192 +-- .../Q10285_MeetingSirra.java | 202 +-- .../Q10286_ReunionWithSirra.java | 136 +- .../Q10287_StoryOfThoseLeft.java | 127 +- .../Q10288_SecretMission.java | 58 +- .../Q10289_FadeToBlack.java | 84 +- .../Q10290_LandDragonConqueror.java | 73 +- .../Q10291_FireDragonDestroyer.java | 73 +- .../Q10292_SevenSignsGirlOfDoubt.java | 198 +-- ...nsForbiddenBookOfTheElmoreAdenKingdom.java | 234 +-- ...294_SevenSignsToTheMonasteryOfSilence.java | 207 +-- .../Q10295_SevenSignsSolinasTomb.java | 375 ++--- ...evenSignsOneWhoSeeksThePowerOfTheSeal.java | 182 +-- .../Q10501_ZakenEmbroideredSoulCloak.java | 55 +- .../Q10502_FreyaEmbroideredSoulCloak.java | 55 +- .../Q10503_FrintezzaEmbroideredSoulCloak.java | 55 +- .../Q10504_JewelOfAntharas.java | 75 +- .../Q10505_JewelOfValakas.java | 75 +- .../datapack/quests/QuestMasterHandler.java | 19 +- ...Q00717_ForTheSakeOfTheTerritoryGludio.java | 15 +- .../Q00718_ForTheSakeOfTheTerritoryDion.java | 15 +- .../Q00719_ForTheSakeOfTheTerritoryGiran.java | 15 +- .../Q00720_ForTheSakeOfTheTerritoryOren.java | 15 +- .../Q00721_ForTheSakeOfTheTerritoryAden.java | 15 +- ...0722_ForTheSakeOfTheTerritoryInnadril.java | 15 +- ...00723_ForTheSakeOfTheTerritoryGoddard.java | 15 +- .../Q00724_ForTheSakeOfTheTerritoryRune.java | 15 +- ...25_ForTheSakeOfTheTerritorySchuttgart.java | 15 +- .../Q00729_ProtectTheTerritoryCatapult.java | 12 +- .../Q00730_ProtectTheSuppliesSafe.java | 12 +- ...1_ProtectTheMilitaryAssociationLeader.java | 12 +- ..._ProtectTheReligiousAssociationLeader.java | 12 +- ...3_ProtectTheEconomicAssociationLeader.java | 12 +- .../Q00734_PierceThroughAShield.java | 12 +- .../Q00735_MakeSpearsDull.java | 12 +- .../Q00736_WeakenTheMagic.java | 12 +- .../Q00737_DenyBlessings.java | 12 +- .../Q00738_DestroyKeyTargets.java | 12 +- .../TerritoryWarSuperClass.java | 292 ++-- .../datapack/vehicles/BoatGiranTalking.java | 46 +- .../datapack/vehicles/BoatGludinRune.java | 58 +- .../datapack/vehicles/BoatInnadrilTour.java | 31 +- .../datapack/vehicles/BoatRunePrimeval.java | 46 +- .../datapack/vehicles/BoatTalkingGludin.java | 58 +- .../village_master/Alliance/Alliance.java | 18 +- .../datapack/village_master/Clan/Clan.java | 24 +- .../DarkElfChange1/DarkElfChange1.java | 143 +- .../DarkElfChange2/DarkElfChange2.java | 217 +-- .../DwarfBlacksmithChange1.java | 67 +- .../DwarfBlacksmithChange2.java | 70 +- .../DwarfWarehouseChange1.java | 67 +- .../DwarfWarehouseChange2.java | 70 +- .../ElfHumanClericChange2.java | 118 +- .../ElfHumanFighterChange1.java | 162 +-- .../ElfHumanFighterChange2.java | 284 +--- .../ElfHumanWizardChange1.java | 140 +- .../ElfHumanWizardChange2.java | 162 +-- .../KamaelChange1/KamaelChange1.java | 111 +- .../KamaelChange2/KamaelChange2.java | 268 +--- .../village_master/OrcChange1/OrcChange1.java | 118 +- .../village_master/OrcChange2/OrcChange2.java | 144 +- 1226 files changed, 37430 insertions(+), 81714 deletions(-) diff --git a/src/main/java/com/l2jserver/datapack/ai/fantasy_isle/HandysBlockCheckerEvent.java b/src/main/java/com/l2jserver/datapack/ai/fantasy_isle/HandysBlockCheckerEvent.java index 565f066b19..f36542d6d1 100644 --- a/src/main/java/com/l2jserver/datapack/ai/fantasy_isle/HandysBlockCheckerEvent.java +++ b/src/main/java/com/l2jserver/datapack/ai/fantasy_isle/HandysBlockCheckerEvent.java @@ -37,8 +37,7 @@ import com.l2jserver.gameserver.network.serverpackets.ExCubeGameTeamList; * Handys Block Checker Event AI. * @authors BiggBoss, Gigiikun */ -public class HandysBlockCheckerEvent extends Quest -{ +public class HandysBlockCheckerEvent extends Quest { private static final Logger LOG = LoggerFactory.getLogger(HandysBlockCheckerEvent.class); @@ -48,36 +47,30 @@ public class HandysBlockCheckerEvent extends Quest private static final int A_MANAGER_3 = 32523; private static final int A_MANAGER_4 = 32524; - public HandysBlockCheckerEvent() - { + public HandysBlockCheckerEvent() { super(-1, HandysBlockCheckerEvent.class.getSimpleName(), "Handy's Block Checker Event"); addFirstTalkId(A_MANAGER_1, A_MANAGER_2, A_MANAGER_3, A_MANAGER_4); HandysBlockCheckerManager.getInstance().startUpParticipantsQueue(); } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { - if ((npc == null) || (player == null)) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { + if ((npc == null) || (player == null)) { return null; } final int arena = npc.getId() - A_MANAGER_1; - if (eventIsFull(arena)) - { + if (eventIsFull(arena)) { player.sendPacket(SystemMessageId.CANNOT_REGISTER_CAUSE_QUEUE_FULL); return null; } - if (HandysBlockCheckerManager.getInstance().arenaIsBeingUsed(arena)) - { + if (HandysBlockCheckerManager.getInstance().arenaIsBeingUsed(arena)) { player.sendPacket(SystemMessageId.MATCH_BEING_PREPARED_TRY_LATER); return null; } - if (HandysBlockCheckerManager.getInstance().addPlayerToArena(player, arena)) - { + if (HandysBlockCheckerManager.getInstance().addPlayerToArena(player, arena)) { ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(arena); final ExCubeGameTeamList tl = new ExCubeGameTeamList(holder.getRedPlayers(), holder.getBluePlayers(), arena); @@ -88,8 +81,7 @@ public class HandysBlockCheckerEvent extends Quest int countRed = holder.getRedTeamSize(); int minMembers = general().getBlockCheckerMinTeamMembers(); - if ((countBlue >= minMembers) && (countRed >= minMembers)) - { + if ((countBlue >= minMembers) && (countRed >= minMembers)) { holder.updateEvent(); holder.broadCastPacketToTeam(new ExCubeGameRequestReady()); holder.broadCastPacketToTeam(new ExCubeGameChangeTimeToStart(10)); @@ -98,20 +90,15 @@ public class HandysBlockCheckerEvent extends Quest return null; } - private boolean eventIsFull(int arena) - { + private boolean eventIsFull(int arena) { return HandysBlockCheckerManager.getInstance().getHolder(arena).getAllPlayers().size() == 12; } - public static void main(String[] args) - { - if (general().enableBlockCheckerEvent()) - { + public static void main(String[] args) { + if (general().enableBlockCheckerEvent()) { new HandysBlockCheckerEvent(); LOG.info("Handy's Block Checker event is enabled."); - } - else - { + } else { LOG.info("Handy's Block Checker event is disabled."); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/fantasy_isle/MC_Show.java b/src/main/java/com/l2jserver/datapack/ai/fantasy_isle/MC_Show.java index e8d28f5da7..167c1d1ef3 100644 --- a/src/main/java/com/l2jserver/datapack/ai/fantasy_isle/MC_Show.java +++ b/src/main/java/com/l2jserver/datapack/ai/fantasy_isle/MC_Show.java @@ -40,8 +40,7 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * MC Show AI. * @author Kerberos */ -public class MC_Show extends AbstractNpcAI -{ +public class MC_Show extends AbstractNpcAI { private static int MC = 32433; // @formatter:off private static int[] SINGERS = @@ -62,8 +61,7 @@ public class MC_Show extends AbstractNpcAI }; // @formatter:on private static boolean IS_STARTED = false; - private static NpcStringId[] MESSAGES = - { + private static NpcStringId[] MESSAGES = { NpcStringId.HOW_COME_PEOPLE_ARE_NOT_HERE_WE_ARE_ABOUT_TO_START_THE_SHOW_HMM, NpcStringId.UGH_I_HAVE_BUTTERFLIES_IN_MY_STOMACH_THE_SHOW_STARTS_SOON, NpcStringId.THANK_YOU_ALL_FOR_COMING_HERE_TONIGHT, @@ -90,14 +88,12 @@ public class MC_Show extends AbstractNpcAI NpcStringId.WE_LOVE_YOU }; - private class ShoutInfo - { + private class ShoutInfo { private final NpcStringId _npcStringId; private final String _nextEvent; private final int _time; - public ShoutInfo(NpcStringId npcStringId, String nextEvent, int time) - { + public ShoutInfo(NpcStringId npcStringId, String nextEvent, int time) { _npcStringId = npcStringId; _nextEvent = nextEvent; _time = time; @@ -106,36 +102,31 @@ public class MC_Show extends AbstractNpcAI /** * @return the _npcStringId */ - public NpcStringId getNpcStringId() - { + public NpcStringId getNpcStringId() { return _npcStringId; } /** * @return the _nextEvent */ - public String getNextEvent() - { + public String getNextEvent() { return _nextEvent; } /** * @return the _time */ - public int getTime() - { + public int getTime() { return _time; } } - private class WalkInfo - { + private class WalkInfo { private final Location _charPos; private final String _nextEvent; private final int _time; - public WalkInfo(Location charPos, String nextEvent, int time) - { + public WalkInfo(Location charPos, String nextEvent, int time) { _charPos = charPos; _nextEvent = nextEvent; _time = time; @@ -144,24 +135,21 @@ public class MC_Show extends AbstractNpcAI /** * @return the _charPos */ - public Location getCharPos() - { + public Location getCharPos() { return _charPos; } /** * @return the _nextEvent */ - public String getNextEvent() - { + public String getNextEvent() { return _nextEvent; } /** * @return the _time */ - public int getTime() - { + public int getTime() { return _time; } } @@ -169,16 +157,14 @@ public class MC_Show extends AbstractNpcAI private static final Map<String, ShoutInfo> TALKS = new HashMap<>(); private static final Map<String, WalkInfo> WALKS = new HashMap<>(); - private MC_Show() - { + private MC_Show() { super(MC_Show.class.getSimpleName(), "ai/fantasy_isle"); addSpawnId(32433, 32431, 32432, 32442, 32443, 32444, 32445, 32446, 32424, 32425, 32426, 32427, 32428); load(); scheduleTimer(); } - private void load() - { + private void load() { // TODO put this stuff in Routes.xml TALKS.put("1", new ShoutInfo(MESSAGES[1], "2", 1000)); TALKS.put("2", new ShoutInfo(MESSAGES[2], "3", 6000)); @@ -288,28 +274,24 @@ public class MC_Show extends AbstractNpcAI WALKS.put("27", new WalkInfo(new Location(-56702, -56340, -2008, 0), "29", 1800)); } - private void scheduleTimer() - { + private void scheduleTimer() { int gameTime = GameTimeController.getInstance().getGameTime(); int hours = (gameTime / 60) % 24; int minutes = gameTime % 60; int hourDiff, minDiff; hourDiff = (20 - hours); - if (hourDiff < 0) - { + if (hourDiff < 0) { hourDiff = 24 - (hourDiff *= -1); } minDiff = (30 - minutes); - if (minDiff < 0) - { + if (minDiff < 0) { minDiff = 60 - (minDiff *= -1); } long diff; hourDiff *= 3600000; minDiff *= 60000; diff = hourDiff + minDiff; - if (general().debug()) - { + if (general().debug()) { SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); _log.info("Fantasy Isle: MC show script starting at " + format.format(System.currentTimeMillis() + diff) + " and is scheduled each next 4 hours."); } @@ -318,18 +300,14 @@ public class MC_Show extends AbstractNpcAI ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new StartMCShow(), diff, 14400000L); } - private void autoChat(L2Npc npc, NpcStringId npcString, int type) - { + private void autoChat(L2Npc npc, NpcStringId npcString, int type) { npc.broadcastPacket(new NpcSay(npc.getObjectId(), type, npc.getId(), npcString)); } @Override - public String onSpawn(L2Npc npc) - { - if (IS_STARTED) - { - switch (npc.getId()) - { + public String onSpawn(L2Npc npc) { + if (IS_STARTED) { + switch (npc.getId()) { case 32433: autoChat(npc, MESSAGES[0], Say2.NPC_SHOUT); startQuestTimer("1", 30000, npc, null); @@ -365,24 +343,18 @@ public class MC_Show extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if ((event == null) || event.isEmpty()) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if ((event == null) || event.isEmpty()) { _log.warning("MC_Show: Null/Empty event for npc " + npc + " and player " + player + "!"); return null; } - if (event.equalsIgnoreCase("Start")) - { + if (event.equalsIgnoreCase("Start")) { IS_STARTED = true; addSpawn(MC, -56698, -56430, -2008, 32768, false, 0); - } - else if ((npc != null) && IS_STARTED) - { + } else if ((npc != null) && IS_STARTED) { // TODO switch on event - if (event.equalsIgnoreCase("6")) - { + if (event.equalsIgnoreCase("6")) { autoChat(npc, MESSAGES[6], Say2.NPC_SHOUT); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(-56511, -56647, -2008, 36863)); npc.broadcastPacket(Music.NS22_F.getPacket()); @@ -394,11 +366,8 @@ public class MC_Show extends AbstractNpcAI addSpawn(SINGERS[1], -56580, -56203, -2008, 36863, false, 224000); addSpawn(SINGERS[1], -56606, -56157, -2008, 36863, false, 224000); startQuestTimer("7", 215000, npc, null); - } - else if (event.equalsIgnoreCase("7")) - { - switch (npc.getId()) - { + } else if (event.equalsIgnoreCase("7")) { + switch (npc.getId()) { case 32433: autoChat(npc, MESSAGES[7], Say2.NPC_SHOUT); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(-56698, -56430, -2008, 32768)); @@ -409,9 +378,7 @@ public class MC_Show extends AbstractNpcAI npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(-56594, -56064, -2008, 32768)); break; } - } - else if (event.equalsIgnoreCase("10")) - { + } else if (event.equalsIgnoreCase("10")) { npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(-56483, -56665, -2034, 32768)); npc.broadcastPacket(Music.TP05_F.getPacket()); startQuestTimer("npc1_1", 3000, addSpawn(CIRCUS[0], -56495, -56375, -2008, 32768, false, 101000), null); @@ -424,11 +391,8 @@ public class MC_Show extends AbstractNpcAI startQuestTimer("npc8_1", 3000, addSpawn(CIRCUS[4], -56493, -56473, -2008, 32768, false, 101000), null); startQuestTimer("npc9_1", 3000, addSpawn(CIRCUS[4], -56504, -56201, -2008, 32768, false, 101000), null); startQuestTimer("11", 100000, npc, null); - } - else if (event.equalsIgnoreCase("11")) - { - switch (npc.getId()) - { + } else if (event.equalsIgnoreCase("11")) { + switch (npc.getId()) { case 32433: autoChat(npc, MESSAGES[11], Say2.NPC_SHOUT); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(-56698, -56430, -2008, 32768)); @@ -438,25 +402,17 @@ public class MC_Show extends AbstractNpcAI npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(-56343, -56330, -2008, 32768)); break; } - } - else if (event.equalsIgnoreCase("14")) - { + } else if (event.equalsIgnoreCase("14")) { startQuestTimer("social1", 2000, addSpawn(INDIVIDUALS[0], -56700, -56385, -2008, 32768, false, 49000), null); startQuestTimer("15", 7000, npc, null); - } - else if (event.equalsIgnoreCase("17")) - { + } else if (event.equalsIgnoreCase("17")) { autoChat(npc, MESSAGES[16], Say2.NPC_SHOUT); startQuestTimer("social1", 2000, addSpawn(INDIVIDUALS[1], -56700, -56340, -2008, 32768, false, 32000), null); startQuestTimer("18", 9000, npc, null); - } - else if (event.equalsIgnoreCase("20")) - { + } else if (event.equalsIgnoreCase("20")) { startQuestTimer("social1", 2000, addSpawn(INDIVIDUALS[2], -56703, -56296, -2008, 32768, false, 13000), null); startQuestTimer("21", 8000, npc, null); - } - else if (event.equalsIgnoreCase("23")) - { + } else if (event.equalsIgnoreCase("23")) { npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(-56702, -56340, -2008, 32768)); startQuestTimer("24", 2800, npc, null); addSpawn(SHOWSTUFF[0], -56672, -56406, -2000, 32768, false, 20900); @@ -464,43 +420,28 @@ public class MC_Show extends AbstractNpcAI addSpawn(SHOWSTUFF[2], -56608, -56338, -2000, 32768, false, 20900); addSpawn(SHOWSTUFF[3], -56652, -56307, -2000, 32768, false, 20900); addSpawn(SHOWSTUFF[4], -56672, -56272, -2000, 32768, false, 20900); - } - else if (event.equalsIgnoreCase("28")) - { + } else if (event.equalsIgnoreCase("28")) { autoChat(npc, MESSAGES[23], Say2.NPC_ALL); startQuestTimer("social1", 1, npc, null); - } - else if (event.equalsIgnoreCase("29")) - { + } else if (event.equalsIgnoreCase("29")) { npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(-56730, -56340, -2008, 32768)); startQuestTimer("clean_npc", 4100, npc, null); startQuestTimer("timer_check", 60000, null, null, true); - } - else if (event.equalsIgnoreCase("social1")) - { + } else if (event.equalsIgnoreCase("social1")) { npc.broadcastSocialAction(1); - } - else if (event.equalsIgnoreCase("clean_npc")) - { + } else if (event.equalsIgnoreCase("clean_npc")) { IS_STARTED = false; npc.deleteMe(); - } - else - { - if (TALKS.containsKey(event)) - { + } else { + if (TALKS.containsKey(event)) { final ShoutInfo si = TALKS.get(event); - if (si != null) - { + if (si != null) { autoChat(npc, si.getNpcStringId(), Say2.NPC_SHOUT); startQuestTimer(si.getNextEvent(), si.getTime(), npc, null); } - } - else if (WALKS.containsKey(event)) - { + } else if (WALKS.containsKey(event)) { final WalkInfo wi = WALKS.get(event); - if (wi != null) - { + if (wi != null) { npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, wi.getCharPos()); startQuestTimer(wi.getNextEvent(), wi.getTime(), npc, null); } @@ -510,8 +451,7 @@ public class MC_Show extends AbstractNpcAI return null; } - public static void main(String[] args) - { + public static void main(String[] args) { new MC_Show(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/fantasy_isle/StartMCShow.java b/src/main/java/com/l2jserver/datapack/ai/fantasy_isle/StartMCShow.java index e9c3d7eef3..c6a9bd53dd 100644 --- a/src/main/java/com/l2jserver/datapack/ai/fantasy_isle/StartMCShow.java +++ b/src/main/java/com/l2jserver/datapack/ai/fantasy_isle/StartMCShow.java @@ -23,11 +23,9 @@ import com.l2jserver.gameserver.instancemanager.QuestManager; /** * Start MC Show. */ -public class StartMCShow implements Runnable -{ +public class StartMCShow implements Runnable { @Override - public void run() - { + public void run() { QuestManager.getInstance().getQuest("MC_Show").notifyEvent("Start", null, null); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/AltarsOfSacrifice.java b/src/main/java/com/l2jserver/datapack/ai/group_template/AltarsOfSacrifice.java index 26d0a19cb8..b37c621090 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/AltarsOfSacrifice.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/AltarsOfSacrifice.java @@ -35,25 +35,20 @@ import com.l2jserver.gameserver.model.interfaces.ILocational; * @author FinalDestination * @author lion */ -public final class AltarsOfSacrifice extends AbstractNpcAI -{ - private final class Altar - { +public final class AltarsOfSacrifice extends AbstractNpcAI { + private final class Altar { private final ILocational _middlePoint; private final int[] _bossNpcIds; private L2Npc _spawnedBoss; - protected Altar(final ILocational middlePoint, final int... bossNpcIds) - { + protected Altar(final ILocational middlePoint, final int... bossNpcIds) { _middlePoint = middlePoint; _bossNpcIds = bossNpcIds; _spawnedBoss = null; } - protected void spawnBoss() throws Exception - { - if (!hasBosses() || (_spawnedBoss != null)) - { + protected void spawnBoss() throws Exception { + if (!hasBosses() || (_spawnedBoss != null)) { throw new IllegalStateException(); } @@ -71,27 +66,22 @@ public final class AltarsOfSacrifice extends AbstractNpcAI _spawnedBoss = spawn.spawnOne(false); } - protected void despawnBoss() - { - if (_spawnedBoss != null) - { + protected void despawnBoss() { + if (_spawnedBoss != null) { _spawnedBoss.deleteMe(); _spawnedBoss = null; } } - protected void unload() - { + protected void unload() { despawnBoss(); } - protected boolean hasBosses() - { + protected boolean hasBosses() { return _bossNpcIds.length > 0; } - protected boolean isBossFighting() - { + protected boolean isBossFighting() { return (_spawnedBoss != null) && _spawnedBoss.isInCombat(); } } @@ -212,61 +202,49 @@ public final class AltarsOfSacrifice extends AbstractNpcAI }; // @formatter:on - public static void main(String[] args) - { + public static void main(String[] args) { new AltarsOfSacrifice(); } - private AltarsOfSacrifice() - { + private AltarsOfSacrifice() { super("AltarsOfSacrifice", "ai/group_template"); - for (int i = 0; i < _altars.length; ++i) - { - if (_altars[i].hasBosses()) - { + for (int i = 0; i < _altars.length; ++i) { + if (_altars[i].hasBosses()) { startQuestTimer(makeSpawnBossEvt(i), ALTAR_STATE_CHANGE_DELAY, null, null); } } } - private String makeSpawnBossEvt(int altarIndex) - { + private String makeSpawnBossEvt(int altarIndex) { return EVT_SPAWN_BOSS_PRE + altarIndex; } - private String makeDespawnBossEvt(int altarIndex) - { + private String makeDespawnBossEvt(int altarIndex) { return EVT_DESPAWN_BOSS_PRE + altarIndex; } - private boolean isSpawnBossEvt(String event) - { + private boolean isSpawnBossEvt(String event) { return event.startsWith(EVT_SPAWN_BOSS_PRE); } - private boolean isDespawnBossEvt(String event) - { + private boolean isDespawnBossEvt(String event) { return event.startsWith(EVT_DESPAWN_BOSS_PRE); } - private int getSpawnBossIndex(String event) - { + private int getSpawnBossIndex(String event) { return Integer.parseInt(event.substring(EVT_SPAWN_BOSS_PRE.length())); } - private int getDespawnBossIndex(String event) - { + private int getDespawnBossIndex(String event) { return Integer.parseInt(event.substring(EVT_DESPAWN_BOSS_PRE.length())); } @Override - public boolean unload(boolean removeFromList) - { + public boolean unload(boolean removeFromList) { _log.info(getClass().getSimpleName() + ": Unloading altars due to script unloading."); - for (final Altar altar : _altars) - { + for (final Altar altar : _altars) { altar.unload(); } @@ -274,35 +252,25 @@ public final class AltarsOfSacrifice extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (isSpawnBossEvt(event)) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (isSpawnBossEvt(event)) { final int altarIndex = getSpawnBossIndex(event); final Altar altar = _altars[altarIndex]; - try - { + try { altar.spawnBoss(); startQuestTimer(makeDespawnBossEvt(altarIndex), ALTAR_STATE_CHANGE_DELAY, null, null); - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, getClass().getSimpleName() + ": Failed to spawn altar boss.", e); // let's try again to spawn it in 5 seconds startQuestTimer(event, 5000, null, null); } - } - else if (isDespawnBossEvt(event)) - { + } else if (isDespawnBossEvt(event)) { final int altarIndex = getDespawnBossIndex(event); final Altar altar = _altars[altarIndex]; - if (altar.isBossFighting()) - { + if (altar.isBossFighting()) { // periodically check if the altar boss is fighting, only despawn when not fighting anymore startQuestTimer(event, 5000, null, null); - } - else - { + } else { altar.despawnBoss(); startQuestTimer(makeSpawnBossEvt(altarIndex), ALTAR_STATE_CHANGE_DELAY, null, null); } diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/BeastFarm.java b/src/main/java/com/l2jserver/datapack/ai/group_template/BeastFarm.java index 1d677af641..10ec010b5b 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/BeastFarm.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/BeastFarm.java @@ -43,8 +43,7 @@ import com.l2jserver.gameserver.util.Util; * Updated to Freya. * @author Fulminus, Gigiikun */ -public final class BeastFarm extends AbstractNpcAI -{ +public final class BeastFarm extends AbstractNpcAI { private static final int GOLDEN_SPICE = 15474; private static final int CRYSTAL_SPICE = 15475; private static final int SKILL_GOLDEN_SPICE = 9049; @@ -53,23 +52,20 @@ public final class BeastFarm extends AbstractNpcAI private static final int SKILL_BLESSED_CRYSTAL_SPICE = 9052; private static final int SKILL_SGRADE_GOLDEN_SPICE = 9053; private static final int SKILL_SGRADE_CRYSTAL_SPICE = 9054; - private static final int[] TAMED_BEASTS = - { + private static final int[] TAMED_BEASTS = { 18869, 18870, 18871, 18872 }; private static final int TAME_CHANCE = 20; - protected static final int[] SPECIAL_SPICE_CHANCES = - { + protected static final int[] SPECIAL_SPICE_CHANCES = { 33, 75 }; // all mobs that can eat... - private static final int[] FEEDABLE_BEASTS = - { + private static final int[] FEEDABLE_BEASTS = { // Kookaburras 18873, 18874, @@ -108,8 +104,7 @@ public final class BeastFarm extends AbstractNpcAI private static final Map<Integer, GrowthCapableMob> GROWTH_CAPABLE_MONSTERS = new HashMap<>(); private static List<TamedBeast> TAMED_BEAST_DATA = new ArrayList<>(); - private BeastFarm() - { + private BeastFarm() { super(BeastFarm.class.getSimpleName(), "ai/group_template"); addSkillSeeId(FEEDABLE_BEASTS); addKillId(FEEDABLE_BEASTS); @@ -229,13 +224,10 @@ public final class BeastFarm extends AbstractNpcAI TAMED_BEAST_DATA.add(new TamedBeast("%name% of Vigor", new SkillHolder(6431, 1), new SkillHolder(6666, 1))); } - public void spawnNext(L2Npc npc, L2PcInstance player, int nextNpcId, int food) - { + public void spawnNext(L2Npc npc, L2PcInstance player, int nextNpcId, int food) { // remove the feedinfo of the mob that got despawned, if any - if (FEED_INFO.containsKey(npc.getObjectId())) - { - if (FEED_INFO.get(npc.getObjectId()) == player.getObjectId()) - { + if (FEED_INFO.containsKey(npc.getObjectId())) { + if (FEED_INFO.get(npc.getObjectId()) == player.getObjectId()) { FEED_INFO.remove(npc.getObjectId()); } } @@ -249,14 +241,12 @@ public final class BeastFarm extends AbstractNpcAI // if this is finally a trained mob, then despawn any other trained mobs that the // player might have and initialize the Tamed Beast. - if (Util.contains(TAMED_BEASTS, nextNpcId)) - { + if (Util.contains(TAMED_BEASTS, nextNpcId)) { final L2TamedBeastInstance nextNpc = new L2TamedBeastInstance(nextNpcId, player, food, npc.getX(), npc.getY(), npc.getZ(), true); TamedBeast beast = TAMED_BEAST_DATA.get(getRandom(TAMED_BEAST_DATA.size())); String name = beast.getName(); - switch (nextNpcId) - { + switch (nextNpcId) { case 18869: name = name.replace("%name%", "Alpine Kookaburra"); break; @@ -275,15 +265,12 @@ public final class BeastFarm extends AbstractNpcAI nextNpc.setRunning(); SkillData st = SkillData.getInstance(); - for (SkillHolder sh : beast.getSkills()) - { + for (SkillHolder sh : beast.getSkills()) { nextNpc.addBeastSkill(st.getSkill(sh.getSkillId(), sh.getSkillLvl())); } Q00020_BringUpWithLove.checkJewelOfInnocence(player); - } - else - { + } else { // if not trained, the newly spawned mob will automatically be agro against its feeder // (what happened to "never bite the hand that feeds you" anyway?!) L2Attackable nextNpc = (L2Attackable) addSpawn(nextNpcId, npc); @@ -299,35 +286,30 @@ public final class BeastFarm extends AbstractNpcAI } @Override - public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) - { + public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) { // this behavior is only run when the target of skill is the passed npc (chest) // i.e. when the player is attempting to open the chest using a skill - if (!Util.contains(targets, npc)) - { + if (!Util.contains(targets, npc)) { return super.onSkillSee(npc, caster, skill, targets, isSummon); } // gather some values on local variables int npcId = npc.getId(); int skillId = skill.getId(); // check if the npc and skills used are valid for this script. Exit if invalid. - if (!Util.contains(FEEDABLE_BEASTS, npcId) || ((skillId != SKILL_GOLDEN_SPICE) && (skillId != SKILL_CRYSTAL_SPICE) && (skillId != SKILL_BLESSED_GOLDEN_SPICE) && (skillId != SKILL_BLESSED_CRYSTAL_SPICE) && (skillId != SKILL_SGRADE_GOLDEN_SPICE) && (skillId != SKILL_SGRADE_CRYSTAL_SPICE))) - { + if (!Util.contains(FEEDABLE_BEASTS, npcId) || ((skillId != SKILL_GOLDEN_SPICE) && (skillId != SKILL_CRYSTAL_SPICE) && (skillId != SKILL_BLESSED_GOLDEN_SPICE) && (skillId != SKILL_BLESSED_CRYSTAL_SPICE) && (skillId != SKILL_SGRADE_GOLDEN_SPICE) && (skillId != SKILL_SGRADE_CRYSTAL_SPICE))) { return super.onSkillSee(npc, caster, skill, targets, isSummon); } // first gather some values on local variables int objectId = npc.getObjectId(); int growthLevel = 3; // if a mob is in FEEDABLE_BEASTS but not in _GrowthCapableMobs, then it's at max growth (3) - if (GROWTH_CAPABLE_MONSTERS.containsKey(npcId)) - { + if (GROWTH_CAPABLE_MONSTERS.containsKey(npcId)) { growthLevel = GROWTH_CAPABLE_MONSTERS.get(npcId).getGrowthLevel(); } // prevent exploit which allows 2 players to simultaneously raise the same 0-growth beast // If the mob is at 0th level (when it still listens to all feeders) lock it to the first feeder! - if ((growthLevel == 0) && FEED_INFO.containsKey(objectId)) - { + if ((growthLevel == 0) && FEED_INFO.containsKey(objectId)) { return super.onSkillSee(npc, caster, skill, targets, isSummon); } @@ -337,41 +319,31 @@ public final class BeastFarm extends AbstractNpcAI npc.broadcastSocialAction(2); int food = 0; - if ((skillId == SKILL_GOLDEN_SPICE) || (skillId == SKILL_BLESSED_GOLDEN_SPICE)) - { + if ((skillId == SKILL_GOLDEN_SPICE) || (skillId == SKILL_BLESSED_GOLDEN_SPICE)) { food = GOLDEN_SPICE; - } - else if ((skillId == SKILL_CRYSTAL_SPICE) || (skillId == SKILL_BLESSED_CRYSTAL_SPICE)) - { + } else if ((skillId == SKILL_CRYSTAL_SPICE) || (skillId == SKILL_BLESSED_CRYSTAL_SPICE)) { food = CRYSTAL_SPICE; } // if this pet can't grow, it's all done. - if (GROWTH_CAPABLE_MONSTERS.containsKey(npcId)) - { + if (GROWTH_CAPABLE_MONSTERS.containsKey(npcId)) { // do nothing if this mob doesn't eat the specified food (food gets consumed but has no effect). int newNpcId = GROWTH_CAPABLE_MONSTERS.get(npcId).getLeveledNpcId(skillId); - if (newNpcId == -1) - { - if (growthLevel == 0) - { + if (newNpcId == -1) { + if (growthLevel == 0) { FEED_INFO.remove(objectId); npc.setRunning(); ((L2Attackable) npc).addDamageHate(caster, 0, 1); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, caster); } return super.onSkillSee(npc, caster, skill, targets, isSummon); - } - else if ((growthLevel > 0) && (FEED_INFO.get(objectId) != caster.getObjectId())) - { + } else if ((growthLevel > 0) && (FEED_INFO.get(objectId) != caster.getObjectId())) { // check if this is the same player as the one who raised it from growth 0. // if no, then do not allow a chance to raise the pet (food gets consumed but has no effect). return super.onSkillSee(npc, caster, skill, targets, isSummon); } spawnNext(npc, caster, newNpcId, food); - } - else - { + } else { caster.sendMessage("The beast spit out the feed instead of eating it."); npc.dropItem(caster, food, 1); } @@ -379,105 +351,78 @@ public final class BeastFarm extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { // remove the feedinfo of the mob that got killed, if any - if (FEED_INFO.containsKey(npc.getObjectId())) - { + if (FEED_INFO.containsKey(npc.getObjectId())) { FEED_INFO.remove(npc.getObjectId()); } return super.onKill(npc, killer, isSummon); } // all mobs that grow by eating - private static class GrowthCapableMob - { + private static class GrowthCapableMob { private final int _chance; private final int _growthLevel; private final int _tameNpcId; private final Map<Integer, Integer> _skillSuccessNpcIdList = new HashMap<>(); - public GrowthCapableMob(int chance, int growthLevel, int tameNpcId) - { + public GrowthCapableMob(int chance, int growthLevel, int tameNpcId) { _chance = chance; _growthLevel = growthLevel; _tameNpcId = tameNpcId; } - public void addNpcIdForSkillId(int skillId, int npcId) - { + public void addNpcIdForSkillId(int skillId, int npcId) { _skillSuccessNpcIdList.put(skillId, npcId); } - public int getGrowthLevel() - { + public int getGrowthLevel() { return _growthLevel; } - public int getLeveledNpcId(int skillId) - { - if (!_skillSuccessNpcIdList.containsKey(skillId)) - { + public int getLeveledNpcId(int skillId) { + if (!_skillSuccessNpcIdList.containsKey(skillId)) { return -1; - } - else if ((skillId == SKILL_BLESSED_GOLDEN_SPICE) || (skillId == SKILL_BLESSED_CRYSTAL_SPICE) || (skillId == SKILL_SGRADE_GOLDEN_SPICE) || (skillId == SKILL_SGRADE_CRYSTAL_SPICE)) - { - if (getRandom(100) < SPECIAL_SPICE_CHANCES[0]) - { - if (getRandom(100) < SPECIAL_SPICE_CHANCES[1]) - { + } else if ((skillId == SKILL_BLESSED_GOLDEN_SPICE) || (skillId == SKILL_BLESSED_CRYSTAL_SPICE) || (skillId == SKILL_SGRADE_GOLDEN_SPICE) || (skillId == SKILL_SGRADE_CRYSTAL_SPICE)) { + if (getRandom(100) < SPECIAL_SPICE_CHANCES[0]) { + if (getRandom(100) < SPECIAL_SPICE_CHANCES[1]) { return _skillSuccessNpcIdList.get(skillId); - } - else if ((skillId == SKILL_BLESSED_GOLDEN_SPICE) || (skillId == SKILL_SGRADE_GOLDEN_SPICE)) - { + } else if ((skillId == SKILL_BLESSED_GOLDEN_SPICE) || (skillId == SKILL_SGRADE_GOLDEN_SPICE)) { return _skillSuccessNpcIdList.get(SKILL_GOLDEN_SPICE); - } - else - { + } else { return _skillSuccessNpcIdList.get(SKILL_CRYSTAL_SPICE); } } return -1; - } - else if ((_growthLevel == 2) && (getRandom(100) < TAME_CHANCE)) - { + } else if ((_growthLevel == 2) && (getRandom(100) < TAME_CHANCE)) { return _tameNpcId; - } - else if (getRandom(100) < _chance) - { + } else if (getRandom(100) < _chance) { return _skillSuccessNpcIdList.get(skillId); - } - else - { + } else { return -1; } } } - private static class TamedBeast - { + private static class TamedBeast { private final String name; private final SkillHolder[] sh; - public TamedBeast(String beastName, SkillHolder... holders) - { + public TamedBeast(String beastName, SkillHolder... holders) { name = beastName; sh = holders; } - public String getName() - { + public String getName() { return name; } - public SkillHolder[] getSkills() - { + public SkillHolder[] getSkills() { return sh; } } - public static void main(String[] args) - { + public static void main(String[] args) { new BeastFarm(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/DenOfEvil.java b/src/main/java/com/l2jserver/datapack/ai/group_template/DenOfEvil.java index 6df0cbd48e..5c22f14bea 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/DenOfEvil.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/DenOfEvil.java @@ -35,11 +35,9 @@ import com.l2jserver.gameserver.util.Util; * Dummy AI for spawns/respawns only for testing. * @author Gnacik */ -public final class DenOfEvil extends AbstractNpcAI -{ +public final class DenOfEvil extends AbstractNpcAI { // private static final int _buffer_id = 32656; - protected static final int[] EYE_IDS = - { + protected static final int[] EYE_IDS = { 18812, 18813, 18814 @@ -47,8 +45,7 @@ public final class DenOfEvil extends AbstractNpcAI private static final int SKILL_ID = 6150; // others +2 private static final long KASHA_DESTRUCT_DELAY = 120000; - private static final Location[] EYE_SPAWNS = - { + private static final Location[] EYE_SPAWNS = { new Location(71544, -129400, -3360, 16472), new Location(70954, -128854, -3360, 16), new Location(72145, -128847, -3368, 32832), @@ -95,32 +92,27 @@ public final class DenOfEvil extends AbstractNpcAI new Location(62905, -106109, -2384, 51288) }; - private DenOfEvil() - { + private DenOfEvil() { super(DenOfEvil.class.getSimpleName(), "ai/group_template"); addKillId(EYE_IDS); addSpawnId(EYE_IDS); - for (Location loc : EYE_SPAWNS) - { + for (Location loc : EYE_SPAWNS) { addSpawn(EYE_IDS[getRandom(EYE_IDS.length)], loc, false, 0); } } - private int getSkillIdByNpcId(int npcId) - { + private int getSkillIdByNpcId(int npcId) { int diff = npcId - EYE_IDS[0]; diff *= 2; return SKILL_ID + diff; } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { npc.disableCoreAI(true); npc.setIsImmobilized(true); L2EffectZone zone = ZoneManager.getInstance().getZone(npc, L2EffectZone.class); - if (zone == null) - { + if (zone == null) { _log.warning("NPC " + npc + " spawned outside of L2EffectZone, check your zone coords! X:" + npc.getX() + " Y:" + npc.getY() + " Z:" + npc.getZ()); return null; } @@ -131,24 +123,19 @@ public final class DenOfEvil extends AbstractNpcAI { ThreadPoolManager.getInstance().scheduleAi(new KashaDestruction(zone), KASHA_DESTRUCT_DELAY); zone.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.KASHA_EYE_PITCHES_TOSSES_EXPLODE)); - } - else if (skillLevel == 2) - { + } else if (skillLevel == 2) { zone.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.I_CAN_FEEL_ENERGY_KASHA_EYE_GETTING_STRONGER_RAPIDLY)); } return super.onSpawn(npc); } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - ThreadPoolManager.getInstance().scheduleAi(() -> - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + ThreadPoolManager.getInstance().scheduleAi(() -> { addSpawn(EYE_IDS[getRandom(EYE_IDS.length)], npc.getLocation(), false, 0); }, 15000); L2EffectZone zone = ZoneManager.getInstance().getZone(npc, L2EffectZone.class); - if (zone == null) - { + if (zone == null) { _log.warning("NPC " + npc + " killed outside of L2EffectZone, check your zone coords! X:" + npc.getX() + " Y:" + npc.getY() + " Z:" + npc.getZ()); return null; } @@ -158,54 +145,40 @@ public final class DenOfEvil extends AbstractNpcAI return super.onKill(npc, killer, isSummon); } - private static class KashaDestruction implements Runnable - { + private static class KashaDestruction implements Runnable { private static final SkillHolder KASHAS_BETRAYAL = new SkillHolder(6149); L2EffectZone _zone; - public KashaDestruction(L2EffectZone zone) - { + public KashaDestruction(L2EffectZone zone) { _zone = zone; } @Override - public void run() - { - for (int i = SKILL_ID; i <= (SKILL_ID + 4); i = i + 2) - { + public void run() { + for (int i = SKILL_ID; i <= (SKILL_ID + 4); i = i + 2) { // test 3 skills if some is lvl 4 - if (_zone.getSkillLevel(i) > 3) - { + if (_zone.getSkillLevel(i) > 3) { destroyZone(); break; } } } - private void destroyZone() - { - for (L2Character character : _zone.getCharactersInside()) - { - if (character == null) - { + private void destroyZone() { + for (L2Character character : _zone.getCharactersInside()) { + if (character == null) { continue; } - if (character.isPlayable()) - { + if (character.isPlayable()) { KASHAS_BETRAYAL.getSkill().applyEffects(character, character); - } - else - { + } else { if (character.doDie(null)) // mobs die { - if (character.isNpc()) - { + if (character.isNpc()) { // respawn eye L2Npc npc = (L2Npc) character; - if (Util.contains(EYE_IDS, npc.getId())) - { - ThreadPoolManager.getInstance().scheduleAi(() -> - { + if (Util.contains(EYE_IDS, npc.getId())) { + ThreadPoolManager.getInstance().scheduleAi(() -> { addSpawn(EYE_IDS[getRandom(EYE_IDS.length)], npc.getLocation(), false, 0); }, 15000); } @@ -213,15 +186,13 @@ public final class DenOfEvil extends AbstractNpcAI } } } - for (int i = SKILL_ID; i <= (SKILL_ID + 4); i = i + 2) - { + for (int i = SKILL_ID; i <= (SKILL_ID + 4); i = i + 2) { _zone.removeSkill(i); } } } - public static void main(String[] args) - { + public static void main(String[] args) { new DenOfEvil(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/DragonValley.java b/src/main/java/com/l2jserver/datapack/ai/group_template/DragonValley.java index 8d2dd9b3d7..b7e7414209 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/DragonValley.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/DragonValley.java @@ -33,24 +33,20 @@ import com.l2jserver.gameserver.util.Util; * Dragon Valley AI. * @author St3eT */ -public final class DragonValley extends AbstractNpcAI -{ +public final class DragonValley extends AbstractNpcAI { // NPC private static final int DRAKOS_ASSASSIN = 22823; - private static final int[] SUMMON_NPC = - { + private static final int[] SUMMON_NPC = { 22824, // Drakos Guardian 22862, // Drakos Hunter }; - private static final int[] SPAWN_ANIMATION = - { + private static final int[] SPAWN_ANIMATION = { 22826, // Scorpion Bones 22823, // Drakos Assassin 22828, // Parasitic Leech }; - private static final int[] SPOIL_REACT_MONSTER = - { + private static final int[] SPOIL_REACT_MONSTER = { 22822, // Drakos Warrior 22823, // Drakos Assassin 22824, // Drakos Guardian @@ -120,8 +116,7 @@ public final class DragonValley extends AbstractNpcAI CLASS_POINTS.put(ClassId.windRider, 0.2); } - private DragonValley() - { + private DragonValley() { super(DragonValley.class.getSimpleName(), "ai/group_template"); addAttackId(SUMMON_NPC); addKillId(SPOIL_REACT_MONSTER); @@ -129,14 +124,11 @@ public final class DragonValley extends AbstractNpcAI } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if ((npc.getCurrentHp() < (npc.getMaxHp() / 2)) && (getRandom(100) < 5) && npc.isScriptValue(0)) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if ((npc.getCurrentHp() < (npc.getMaxHp() / 2)) && (getRandom(100) < 5) && npc.isScriptValue(0)) { npc.setScriptValue(1); final int rnd = getRandom(3, 5); - for (int i = 0; i < rnd; i++) - { + for (int i = 0; i < rnd; i++) { final L2Playable playable = isSummon ? attacker.getSummon() : attacker; final L2Npc minion = addSpawn(DRAKOS_ASSASSIN, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), true, 0, true); addAttackDesire(minion, playable); @@ -146,10 +138,8 @@ public final class DragonValley extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (((L2Attackable) npc).isSpoiled()) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (((L2Attackable) npc).isSpoiled()) { npc.dropItem(killer, getRandom(GREATER_HERB_OF_MANA, SUPERIOR_HERB_OF_MANA), 1); manageMoraleBoost(killer, npc); } @@ -157,49 +147,35 @@ public final class DragonValley extends AbstractNpcAI } @Override - public String onSpawn(L2Npc npc) - { - if (Util.contains(SPAWN_ANIMATION, npc.getId())) - { + public String onSpawn(L2Npc npc) { + if (Util.contains(SPAWN_ANIMATION, npc.getId())) { npc.setShowSummonAnimation(true); } return super.onSpawn(npc); } - private void manageMoraleBoost(L2PcInstance player, L2Npc npc) - { + private void manageMoraleBoost(L2PcInstance player, L2Npc npc) { double points = 0; int moraleBoostLv = 0; - if (player.isInParty() && (player.getParty().getMemberCount() >= MIN_MEMBERS) && (npc != null)) - { - for (L2PcInstance member : player.getParty().getMembers()) - { - if ((member.getLevel() >= MIN_LVL) && (member.getClassId().level() >= CLASS_LVL) && (npc.calculateDistance(member, true, false) < MIN_DISTANCE)) - { + if (player.isInParty() && (player.getParty().getMemberCount() >= MIN_MEMBERS) && (npc != null)) { + for (L2PcInstance member : player.getParty().getMembers()) { + if ((member.getLevel() >= MIN_LVL) && (member.getClassId().level() >= CLASS_LVL) && (npc.calculateDistance(member, true, false) < MIN_DISTANCE)) { points += CLASS_POINTS.get(member.getClassId()); } } - if (points >= 3) - { + if (points >= 3) { moraleBoostLv = 3; - } - else if (points >= 2) - { + } else if (points >= 2) { moraleBoostLv = 2; - } - else if (points >= 1) - { + } else if (points >= 1) { moraleBoostLv = 1; } - for (L2PcInstance member : player.getParty().getMembers()) - { - if (npc.calculateDistance(member, true, false) < MIN_DISTANCE) - { - switch (moraleBoostLv) - { + for (L2PcInstance member : player.getParty().getMembers()) { + if (npc.calculateDistance(member, true, false) < MIN_DISTANCE) { + switch (moraleBoostLv) { case 1: MORALE_BOOST1.getSkill().applyEffects(member, member); break; @@ -215,8 +191,7 @@ public final class DragonValley extends AbstractNpcAI } } - public static void main(String[] args) - { + public static void main(String[] args) { new DragonValley(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/FairyTrees.java b/src/main/java/com/l2jserver/datapack/ai/group_template/FairyTrees.java index e7e3d46401..64ad43ede8 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/FairyTrees.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/FairyTrees.java @@ -28,13 +28,11 @@ import com.l2jserver.gameserver.model.holders.SkillHolder; * Fairy Trees AI. * @author Charus */ -public class FairyTrees extends AbstractNpcAI -{ +public class FairyTrees extends AbstractNpcAI { // NPC private static final int SOUL_GUARDIAN = 27189; // Soul of Tree Guardian - private static final int[] MOBS = - { + private static final int[] MOBS = { 27185, // Fairy Tree of Wind 27186, // Fairy Tree of Star 27187, // Fairy Tree of Twilight @@ -47,25 +45,20 @@ public class FairyTrees extends AbstractNpcAI // Misc private static final int MIN_DISTANCE = 1500; - private FairyTrees() - { + private FairyTrees() { super(FairyTrees.class.getSimpleName(), "ai/group_template"); addKillId(MOBS); addSpawnId(MOBS); } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (npc.calculateDistance(killer, true, false) <= MIN_DISTANCE) - { - for (int i = 0; i < 20; i++) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (npc.calculateDistance(killer, true, false) <= MIN_DISTANCE) { + for (int i = 0; i < 20; i++) { final L2Npc guardian = addSpawn(SOUL_GUARDIAN, npc, false, 30000); final L2Playable attacker = isSummon ? killer.getSummon() : killer; addAttackDesire(guardian, attacker); - if (getRandomBoolean()) - { + if (getRandomBoolean()) { guardian.setTarget(attacker); guardian.doCast(VENOMOUS_POISON); } @@ -75,15 +68,13 @@ public class FairyTrees extends AbstractNpcAI } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { npc.setIsNoRndWalk(true); npc.setIsImmobilized(true); return super.onSpawn(npc); } - public static void main(String[] args) - { + public static void main(String[] args) { new FairyTrees(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/FeedableBeasts.java b/src/main/java/com/l2jserver/datapack/ai/group_template/FeedableBeasts.java index 33ea24114e..7c8892f7eb 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/FeedableBeasts.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/FeedableBeasts.java @@ -40,8 +40,7 @@ import com.l2jserver.gameserver.util.Util; * Growth-capable mobs: Polymorphing upon successful feeding. * @author Fulminus */ -public final class FeedableBeasts extends AbstractNpcAI -{ +public final class FeedableBeasts extends AbstractNpcAI { private static final int GOLDEN_SPICE = 6643; private static final int CRYSTAL_SPICE = 6644; private static final int SKILL_GOLDEN_SPICE = 2188; @@ -76,8 +75,7 @@ public final class FeedableBeasts extends AbstractNpcAI // @formatter:on private static final Map<Integer, Integer> MAD_COW_POLYMORPH = new HashMap<>(); - static - { + static { MAD_COW_POLYMORPH.put(21824, 21468); MAD_COW_POLYMORPH.put(21825, 21469); MAD_COW_POLYMORPH.put(21826, 21487); @@ -86,8 +84,7 @@ public final class FeedableBeasts extends AbstractNpcAI MAD_COW_POLYMORPH.put(21829, 21507); } - private static final NpcStringId[][] TEXT = - { + private static final NpcStringId[][] TEXT = { { NpcStringId.WHAT_DID_YOU_JUST_DO_TO_ME, NpcStringId.ARE_YOU_TRYING_TO_TAME_ME_DONT_DO_THAT, @@ -116,8 +113,7 @@ public final class FeedableBeasts extends AbstractNpcAI } }; - private static final NpcStringId[] TAMED_TEXT = - { + private static final NpcStringId[] TAMED_TEXT = { NpcStringId.S1_SO_WHAT_DO_YOU_THINK_IT_IS_LIKE_TO_BE_TAMED, NpcStringId.S1_WHENEVER_I_SEE_SPICE_I_THINK_I_WILL_MISS_YOUR_HAND_THAT_USED_TO_FEED_IT_TO_ME, NpcStringId.S1_DONT_GO_TO_THE_VILLAGE_I_DONT_HAVE_THE_STRENGTH_TO_FOLLOW_YOU, @@ -132,54 +128,45 @@ public final class FeedableBeasts extends AbstractNpcAI private static final Map<Integer, GrowthCapableMob> GROWTH_CAPABLE_MONSTERS = new HashMap<>(); // all mobs that grow by eating - private static class GrowthCapableMob - { + private static class GrowthCapableMob { private final int _growthLevel; private final int _chance; private final Map<Integer, int[][]> _spiceToMob = new HashMap<>(); - public GrowthCapableMob(int growthLevel, int chance) - { + public GrowthCapableMob(int growthLevel, int chance) { _growthLevel = growthLevel; _chance = chance; } - public void addMobs(int spice, int[][] Mobs) - { + public void addMobs(int spice, int[][] Mobs) { _spiceToMob.put(spice, Mobs); } - public Integer getMob(int spice, int mobType, int classType) - { - if (_spiceToMob.containsKey(spice)) - { + public Integer getMob(int spice, int mobType, int classType) { + if (_spiceToMob.containsKey(spice)) { return _spiceToMob.get(spice)[mobType][classType]; } return null; } - public Integer getRandomMob(int spice) - { + public Integer getRandomMob(int spice) { int[][] temp; temp = _spiceToMob.get(spice); int rand = getRandom(temp[0].length); return temp[0][rand]; } - public Integer getChance() - { + public Integer getChance() { return _chance; } - public Integer getGrowthLevel() - { + public Integer getGrowthLevel() { return _growthLevel; } } - private FeedableBeasts() - { + private FeedableBeasts() { super(FeedableBeasts.class.getSimpleName(), "ai/group_template"); addKillId(FEEDABLE_BEASTS); addSkillSeeId(FEEDABLE_BEASTS); @@ -355,51 +342,36 @@ public final class FeedableBeasts extends AbstractNpcAI GROWTH_CAPABLE_MONSTERS.put(21505, temp); } - private void spawnNext(L2Npc npc, int growthLevel, L2PcInstance player, int food) - { + private void spawnNext(L2Npc npc, int growthLevel, L2PcInstance player, int food) { int npcId = npc.getId(); int nextNpcId = 0; // find the next mob to spawn, based on the current npcId, growthlevel, and food. - if (growthLevel == 2) - { + if (growthLevel == 2) { // if tamed, the mob that will spawn depends on the class type (fighter/mage) of the player! - if (getRandom(2) == 0) - { - if (player.getClassId().isMage()) - { + if (getRandom(2) == 0) { + if (player.getClassId().isMage()) { nextNpcId = GROWTH_CAPABLE_MONSTERS.get(npcId).getMob(food, 1, 1); - } - else - { + } else { nextNpcId = GROWTH_CAPABLE_MONSTERS.get(npcId).getMob(food, 1, 0); } - } - else - { + } else { // if not tamed, there is a small chance that have "mad cow" disease. // that is a stronger-than-normal animal that attacks its feeder - if (getRandom(5) == 0) - { + if (getRandom(5) == 0) { nextNpcId = GROWTH_CAPABLE_MONSTERS.get(npcId).getMob(food, 0, 1); - } - else - { + } else { nextNpcId = GROWTH_CAPABLE_MONSTERS.get(npcId).getMob(food, 0, 0); } } - } - else - { + } else { // all other levels of growth are straight-forward nextNpcId = GROWTH_CAPABLE_MONSTERS.get(npcId).getRandomMob(food); } // remove the feedinfo of the mob that got despawned, if any - if (FEED_INFO.containsKey(npc.getObjectId())) - { - if (FEED_INFO.get(npc.getObjectId()) == player.getObjectId()) - { + if (FEED_INFO.containsKey(npc.getObjectId())) { + if (FEED_INFO.get(npc.getObjectId()) == player.getObjectId()) { FEED_INFO.remove(npc.getObjectId()); } } @@ -420,10 +392,8 @@ public final class FeedableBeasts extends AbstractNpcAI // if this is finally a trained mob, then despawn any other trained mobs that the // player might have and initialize the Tamed Beast. - if (Util.contains(TAMED_BEASTS, nextNpcId)) - { - for (L2TamedBeastInstance oldTrained : player.getTamedBeasts()) - { + if (Util.contains(TAMED_BEASTS, nextNpcId)) { + for (L2TamedBeastInstance oldTrained : player.getTamedBeasts()) { oldTrained.deleteMe(); } @@ -435,8 +405,7 @@ public final class FeedableBeasts extends AbstractNpcAI Q00655_AGrandPlanForTamingWildBeasts.reward(player, nextNpc); // also, perform a rare random chat - if (getRandom(20) == 0) - { + if (getRandom(20) == 0) { NpcStringId message = NpcStringId.getNpcStringId(getRandom(2024, 2029)); NpcSay packet = new NpcSay(nextNpc, 0, message); if (message.getParamCount() > 0) // player name, $s1 @@ -459,15 +428,12 @@ public final class FeedableBeasts extends AbstractNpcAI } */ // @formatter:on - } - else - { + } else { // if not trained, the newly spawned mob will automatically be aggro against its feeder // (what happened to "never bite the hand that feeds you" anyway?!) L2Attackable nextNpc = (L2Attackable) addSpawn(nextNpcId, npc); - if (MAD_COW_POLYMORPH.containsKey(nextNpcId)) - { + if (MAD_COW_POLYMORPH.containsKey(nextNpcId)) { this.startQuestTimer("polymorph Mad Cow", 10000, nextNpc, player); } @@ -480,15 +446,11 @@ public final class FeedableBeasts extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equalsIgnoreCase("polymorph Mad Cow") && (npc != null) && (player != null)) - { - if (MAD_COW_POLYMORPH.containsKey(npc.getId())) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equalsIgnoreCase("polymorph Mad Cow") && (npc != null) && (player != null)) { + if (MAD_COW_POLYMORPH.containsKey(npc.getId())) { // remove the feed info from the previous mob - if (FEED_INFO.get(npc.getObjectId()) == player.getObjectId()) - { + if (FEED_INFO.get(npc.getObjectId()) == player.getObjectId()) { FEED_INFO.remove(npc.getObjectId()); } // despawn the mad cow @@ -507,47 +469,39 @@ public final class FeedableBeasts extends AbstractNpcAI } @Override - public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) - { + public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) { // this behavior is only run when the target of skill is the passed npc (chest) // i.e. when the player is attempting to open the chest using a skill - if (!Util.contains(targets, npc)) - { + if (!Util.contains(targets, npc)) { return super.onSkillSee(npc, caster, skill, targets, isSummon); } // gather some values on local variables int npcId = npc.getId(); int skillId = skill.getId(); // check if the npc and skills used are valid for this script. Exit if invalid. - if ((skillId != SKILL_GOLDEN_SPICE) && (skillId != SKILL_CRYSTAL_SPICE)) - { + if ((skillId != SKILL_GOLDEN_SPICE) && (skillId != SKILL_CRYSTAL_SPICE)) { return super.onSkillSee(npc, caster, skill, targets, isSummon); } // first gather some values on local variables int objectId = npc.getObjectId(); int growthLevel = 3; // if a mob is in FEEDABLE_BEASTS but not in _GrowthCapableMobs, then it's at max growth (3) - if (GROWTH_CAPABLE_MONSTERS.containsKey(npcId)) - { + if (GROWTH_CAPABLE_MONSTERS.containsKey(npcId)) { growthLevel = GROWTH_CAPABLE_MONSTERS.get(npcId).getGrowthLevel(); } // prevent exploit which allows 2 players to simultaneously raise the same 0-growth beast // If the mob is at 0th level (when it still listens to all feeders) lock it to the first feeder! - if ((growthLevel == 0) && FEED_INFO.containsKey(objectId)) - { + if ((growthLevel == 0) && FEED_INFO.containsKey(objectId)) { return super.onSkillSee(npc, caster, skill, targets, isSummon); } FEED_INFO.put(objectId, caster.getObjectId()); int food = 0; - if (skillId == SKILL_GOLDEN_SPICE) - { + if (skillId == SKILL_GOLDEN_SPICE) { food = GOLDEN_SPICE; - } - else if (skillId == SKILL_CRYSTAL_SPICE) - { + } else if (skillId == SKILL_CRYSTAL_SPICE) { food = CRYSTAL_SPICE; } @@ -555,17 +509,14 @@ public final class FeedableBeasts extends AbstractNpcAI npc.broadcastSocialAction(2); // if this pet can't grow, it's all done. - if (GROWTH_CAPABLE_MONSTERS.containsKey(npcId)) - { + if (GROWTH_CAPABLE_MONSTERS.containsKey(npcId)) { // do nothing if this mob doesn't eat the specified food (food gets consumed but has no effect). - if (GROWTH_CAPABLE_MONSTERS.get(npcId).getMob(food, 0, 0) == null) - { + if (GROWTH_CAPABLE_MONSTERS.get(npcId).getMob(food, 0, 0) == null) { return super.onSkillSee(npc, caster, skill, targets, isSummon); } // rare random talk... - if (getRandom(20) == 0) - { + if (getRandom(20) == 0) { NpcStringId message = TEXT[growthLevel][getRandom(TEXT[growthLevel].length)]; NpcSay packet = new NpcSay(npc, 0, message); if (message.getParamCount() > 0) // player name, $s1 @@ -575,29 +526,23 @@ public final class FeedableBeasts extends AbstractNpcAI npc.broadcastPacket(packet); } - if ((growthLevel > 0) && (FEED_INFO.get(objectId) != caster.getObjectId())) - { + if ((growthLevel > 0) && (FEED_INFO.get(objectId) != caster.getObjectId())) { // check if this is the same player as the one who raised it from growth 0. // if no, then do not allow a chance to raise the pet (food gets consumed but has no effect). return super.onSkillSee(npc, caster, skill, targets, isSummon); } // Polymorph the mob, with a certain chance, given its current growth level - if (getRandom(100) < GROWTH_CAPABLE_MONSTERS.get(npcId).getChance()) - { + if (getRandom(100) < GROWTH_CAPABLE_MONSTERS.get(npcId).getChance()) { spawnNext(npc, growthLevel, caster, food); } - } - else if (Util.contains(TAMED_BEASTS, npcId) && (npc instanceof L2TamedBeastInstance)) - { + } else if (Util.contains(TAMED_BEASTS, npcId) && (npc instanceof L2TamedBeastInstance)) { L2TamedBeastInstance beast = ((L2TamedBeastInstance) npc); - if (skillId == beast.getFoodType()) - { + if (skillId == beast.getFoodType()) { beast.onReceiveFood(); NpcStringId message = TAMED_TEXT[getRandom(TAMED_TEXT.length)]; NpcSay packet = new NpcSay(npc, 0, message); - if (message.getParamCount() > 0) - { + if (message.getParamCount() > 0) { packet.addStringParameter(caster.getName()); } beast.broadcastPacket(packet); @@ -607,18 +552,15 @@ public final class FeedableBeasts extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { // remove the feedinfo of the mob that got killed, if any - if (FEED_INFO.containsKey(npc.getObjectId())) - { + if (FEED_INFO.containsKey(npc.getObjectId())) { FEED_INFO.remove(npc.getObjectId()); } return super.onKill(npc, killer, isSummon); } - public static void main(String[] args) - { + public static void main(String[] args) { new FeedableBeasts(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/FleeMonsters.java b/src/main/java/com/l2jserver/datapack/ai/group_template/FleeMonsters.java index 6077ab74d4..cb3b465d43 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/FleeMonsters.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/FleeMonsters.java @@ -32,11 +32,9 @@ import com.l2jserver.gameserver.util.Util; * Flee Monsters AI. * @author Pandragon, NosBit */ -public final class FleeMonsters extends AbstractNpcAI -{ +public final class FleeMonsters extends AbstractNpcAI { // NPCs - private static final int[] MOBS = - { + private static final int[] MOBS = { 18150, // Victim 18151, // Victim 18152, // Victim @@ -53,15 +51,13 @@ public final class FleeMonsters extends AbstractNpcAI // Misc private static final int FLEE_DISTANCE = 500; - private FleeMonsters() - { + private FleeMonsters() { super(FleeMonsters.class.getSimpleName(), "ai/group_template"); addAttackId(MOBS); } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { npc.disableCoreAI(true); npc.setRunning(); @@ -77,8 +73,7 @@ public final class FleeMonsters extends AbstractNpcAI return super.onAttack(npc, attacker, damage, isSummon); } - public static void main(String[] args) - { + public static void main(String[] args) { new FleeMonsters(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/FrozenLabyrinth.java b/src/main/java/com/l2jserver/datapack/ai/group_template/FrozenLabyrinth.java index f52c7f56d7..eb1e115b1a 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/FrozenLabyrinth.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/FrozenLabyrinth.java @@ -27,29 +27,24 @@ import com.l2jserver.gameserver.model.skills.Skill; * Frozen Labyrinth AI. * @author malyelfik */ -public final class FrozenLabyrinth extends AbstractNpcAI -{ +public final class FrozenLabyrinth extends AbstractNpcAI { // Monsters private static final int PRONGHORN_SPIRIT = 22087; private static final int PRONGHORN = 22088; private static final int LOST_BUFFALO = 22093; private static final int FROST_BUFFALO = 22094; - private FrozenLabyrinth() - { + private FrozenLabyrinth() { super(FrozenLabyrinth.class.getSimpleName(), "ai/group_template"); addAttackId(PRONGHORN, FROST_BUFFALO); } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) - { - if (npc.isScriptValue(0) && (skill != null) && !skill.isMagic()) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) { + if (npc.isScriptValue(0) && (skill != null) && !skill.isMagic()) { final int spawnId = (npc.getId() == PRONGHORN) ? PRONGHORN_SPIRIT : LOST_BUFFALO; int diff = 0; - for (int i = 0; i < 6; i++) - { + for (int i = 0; i < 6; i++) { final int x = diff < 60 ? npc.getX() + diff : npc.getX(); final int y = diff >= 60 ? npc.getY() + (diff - 40) : npc.getY(); @@ -63,8 +58,7 @@ public final class FrozenLabyrinth extends AbstractNpcAI return super.onAttack(npc, attacker, damage, isSummon, skill); } - public static void main(String[] args) - { + public static void main(String[] args) { new FrozenLabyrinth(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/GiantsCave.java b/src/main/java/com/l2jserver/datapack/ai/group_template/GiantsCave.java index a9121de6a2..515ec87ad7 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/GiantsCave.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/GiantsCave.java @@ -29,56 +29,43 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Giant's Cave AI. * @author Gnacik, St3eT */ -public final class GiantsCave extends AbstractNpcAI -{ +public final class GiantsCave extends AbstractNpcAI { // NPC - private static final int[] SCOUTS = - { + private static final int[] SCOUTS = { 22668, // Gamlin (Scout) 22669, // Leogul (Scout) }; - private GiantsCave() - { + private GiantsCave() { super(GiantsCave.class.getSimpleName(), "ai/group_template"); addAttackId(SCOUTS); addAggroRangeEnterId(SCOUTS); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equals("ATTACK") && (player != null) && (npc != null) && !npc.isDead()) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equals("ATTACK") && (player != null) && (npc != null) && !npc.isDead()) { if (npc.getId() == SCOUTS[0]) // Gamlin { broadcastNpcSay(npc, Say2.NPC_SHOUT, NpcStringId._INTRUDER_DETECTED); - } - else - { + } else { broadcastNpcSay(npc, Say2.NPC_SHOUT, NpcStringId.OH_GIANTS_AN_INTRUDER_HAS_BEEN_DISCOVERED); } - for (L2Character characters : npc.getKnownList().getKnownCharactersInRadius(450)) - { - if ((characters != null) && (characters.isAttackable()) && (getRandomBoolean())) - { + for (L2Character characters : npc.getKnownList().getKnownCharactersInRadius(450)) { + if ((characters != null) && (characters.isAttackable()) && (getRandomBoolean())) { addAttackDesire((L2Npc) characters, player); } } - } - else if (event.equals("CLEAR") && (npc != null) && !npc.isDead()) - { + } else if (event.equals("CLEAR") && (npc != null) && !npc.isDead()) { npc.setScriptValue(0); } return super.onAdvEvent(event, npc, player); } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (npc.isScriptValue(0)) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (npc.isScriptValue(0)) { npc.setScriptValue(1); startQuestTimer("ATTACK", 6000, npc, attacker); startQuestTimer("CLEAR", 120000, npc, null); @@ -87,17 +74,12 @@ public final class GiantsCave extends AbstractNpcAI } @Override - public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) - { - if (npc.isScriptValue(0)) - { + public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) { + if (npc.isScriptValue(0)) { npc.setScriptValue(1); - if (getRandomBoolean()) - { + if (getRandomBoolean()) { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.YOU_GUYS_ARE_DETECTED); - } - else - { + } else { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.WHAT_KIND_OF_CREATURES_ARE_YOU); } startQuestTimer("ATTACK", 6000, npc, player); @@ -106,8 +88,7 @@ public final class GiantsCave extends AbstractNpcAI return super.onAggroRangeEnter(npc, player, isSummon); } - public static void main(String[] args) - { + public static void main(String[] args) { new GiantsCave(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/HotSprings.java b/src/main/java/com/l2jserver/datapack/ai/group_template/HotSprings.java index fa5b5d6195..876e5602ea 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/HotSprings.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/HotSprings.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.skills.Skill; * Hot Springs AI. * @author Pandragon */ -public final class HotSprings extends AbstractNpcAI -{ +public final class HotSprings extends AbstractNpcAI { // NPCs private static final int BANDERSNATCHLING = 21314; private static final int FLAVA = 21316; @@ -47,39 +46,31 @@ public final class HotSprings extends AbstractNpcAI // Misc private static final int DISEASE_CHANCE = 10; - private HotSprings() - { + private HotSprings() { super(HotSprings.class.getSimpleName(), "ai/group_template"); addAttackId(BANDERSNATCHLING, FLAVA, ATROXSPAWN, NEPENTHES, ATROX, BANDERSNATCH); } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (getRandom(100) < DISEASE_CHANCE) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (getRandom(100) < DISEASE_CHANCE) { tryToInfect(npc, attacker, MALARIA); } - if (getRandom(100) < DISEASE_CHANCE) - { - switch (npc.getId()) - { + if (getRandom(100) < DISEASE_CHANCE) { + switch (npc.getId()) { case BANDERSNATCHLING: - case ATROX: - { + case ATROX: { tryToInfect(npc, attacker, RHEUMATISM); break; } case FLAVA: - case NEPENTHES: - { + case NEPENTHES: { tryToInfect(npc, attacker, CHOLERA); break; } case ATROXSPAWN: - case BANDERSNATCH: - { + case BANDERSNATCH: { tryToInfect(npc, attacker, FLU); break; } @@ -88,21 +79,18 @@ public final class HotSprings extends AbstractNpcAI return super.onAttack(npc, attacker, damage, isSummon); } - private void tryToInfect(L2Npc npc, L2Character player, int diseaseId) - { + private void tryToInfect(L2Npc npc, L2Character player, int diseaseId) { final BuffInfo info = player.getEffectList().getBuffInfoBySkillId(diseaseId); final int skillLevel = (info == null) ? 1 : (info.getSkill().getLevel() < 10) ? info.getSkill().getLevel() + 1 : 10; final Skill skill = SkillData.getInstance().getSkill(diseaseId, skillLevel); - if ((skill != null) && !npc.isCastingNow() && npc.checkDoCastConditions(skill)) - { + if ((skill != null) && !npc.isCastingNow() && npc.checkDoCastConditions(skill)) { npc.setTarget(player); npc.doCast(skill); } } - public static void main(String[] args) - { + public static void main(String[] args) { new HotSprings(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/IsleOfPrayer.java b/src/main/java/com/l2jserver/datapack/ai/group_template/IsleOfPrayer.java index 260c158ad5..54258c8f06 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/IsleOfPrayer.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/IsleOfPrayer.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.holders.ItemChanceHolder; * Isle of Prayer AI. * @author Zoey76 */ -public final class IsleOfPrayer extends AbstractNpcAI -{ +public final class IsleOfPrayer extends AbstractNpcAI { // Items private static final int YELLOW_SEED_OF_EVIL_SHARD = 9593; private static final int GREEN_SEED_OF_EVIL_SHARD = 9594; @@ -39,8 +38,7 @@ public final class IsleOfPrayer extends AbstractNpcAI private static final int RED_SEED_OF_EVIL_SHARD = 9596; // Monsters private static final Map<Integer, ItemChanceHolder> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(22257, new ItemChanceHolder(YELLOW_SEED_OF_EVIL_SHARD, 2087)); // Island Guardian MONSTERS.put(22258, new ItemChanceHolder(YELLOW_SEED_OF_EVIL_SHARD, 2147)); // White Sand Mirage MONSTERS.put(22259, new ItemChanceHolder(YELLOW_SEED_OF_EVIL_SHARD, 2642)); // Muddy Coral @@ -58,25 +56,21 @@ public final class IsleOfPrayer extends AbstractNpcAI MONSTERS.put(22271, new ItemChanceHolder(BLUE_SEED_OF_EVIL_SHARD, 1008)); // Water Dragon Detractor } - private IsleOfPrayer() - { + private IsleOfPrayer() { super(IsleOfPrayer.class.getSimpleName(), "ai/group_template"); addKillId(MONSTERS.keySet()); } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final ItemChanceHolder holder = MONSTERS.get(npc.getId()); - if (getRandom(10000) <= holder.getChance()) - { + if (getRandom(10000) <= holder.getChance()) { npc.dropItem(killer, holder); } return super.onKill(npc, killer, isSummon); } - public static void main(String[] args) - { + public static void main(String[] args) { new IsleOfPrayer(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/LairOfAntharas.java b/src/main/java/com/l2jserver/datapack/ai/group_template/LairOfAntharas.java index 41c70aa2e8..0d17c13efd 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/LairOfAntharas.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/LairOfAntharas.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.network.serverpackets.ValidateLocation; * Lair of Antharas AI. * @author St3eT, UnAfraid */ -public final class LairOfAntharas extends AbstractNpcAI -{ +public final class LairOfAntharas extends AbstractNpcAI { // NPC final private static int KNORIKS = 22857; final private static int DRAGON_KNIGHT = 22844; @@ -45,8 +44,7 @@ public final class LairOfAntharas extends AbstractNpcAI final private static int KNORIKS_CHANCE = 60; final private static int KNORIKS_CHANCE2 = 50; - private LairOfAntharas() - { + private LairOfAntharas() { super(LairOfAntharas.class.getSimpleName(), "ai/group_template"); addKillId(DRAGON_KNIGHT, DRAGON_KNIGHT2, DRAGON_GUARD, DRAGON_MAGE); addSpawnId(DRAGON_KNIGHT, DRAGON_KNIGHT2, DRAGON_GUARD, DRAGON_MAGE); @@ -55,16 +53,11 @@ public final class LairOfAntharas extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equals("CHECK_HOME") && (npc != null) && !npc.isDead()) - { - if ((npc.calculateDistance(npc.getSpawn().getLocation(), false, false) > 10) && !npc.isInCombat()) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equals("CHECK_HOME") && (npc != null) && !npc.isDead()) { + if ((npc.calculateDistance(npc.getSpawn().getLocation(), false, false) > 10) && !npc.isInCombat()) { ((L2Attackable) npc).returnHome(); - } - else if ((npc.getHeading() != npc.getSpawn().getHeading()) && !npc.isInCombat()) - { + } else if ((npc.getHeading() != npc.getSpawn().getHeading()) && !npc.isInCombat()) { npc.setHeading(npc.getSpawn().getHeading()); npc.broadcastPacket(new ValidateLocation(npc)); } @@ -73,12 +66,9 @@ public final class LairOfAntharas extends AbstractNpcAI } @Override - public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) - { - if (npc.isScriptValue(0) && (getRandom(100) < KNORIKS_CHANCE)) - { - if (getRandom(100) < KNORIKS_CHANCE2) - { + public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) { + if (npc.isScriptValue(0) && (getRandom(100) < KNORIKS_CHANCE)) { + if (getRandom(100) < KNORIKS_CHANCE2) { npc.setScriptValue(1); } broadcastNpcSay(npc, Say2.NPC_SHOUT, NpcStringId.WHOS_THERE_IF_YOU_DISTURB_THE_TEMPER_OF_THE_GREAT_LAND_DRAGON_ANTHARAS_I_WILL_NEVER_FORGIVE_YOU); @@ -87,14 +77,10 @@ public final class LairOfAntharas extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - switch (npc.getId()) - { - case DRAGON_KNIGHT: - { - if (getRandom(100) > KNIGHT_CHANCE) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + switch (npc.getId()) { + case DRAGON_KNIGHT: { + if (getRandom(100) > KNIGHT_CHANCE) { final L2Npc newKnight = addSpawn(DRAGON_KNIGHT2, npc, false, 0, true); npc.deleteMe(); broadcastNpcSay(newKnight, Say2.NPC_SHOUT, NpcStringId.THOSE_WHO_SET_FOOT_IN_THIS_PLACE_SHALL_NOT_LEAVE_ALIVE); @@ -102,10 +88,8 @@ public final class LairOfAntharas extends AbstractNpcAI } break; } - case DRAGON_KNIGHT2: - { - if (getRandom(100) > KNIGHT_CHANCE) - { + case DRAGON_KNIGHT2: { + if (getRandom(100) > KNIGHT_CHANCE) { final L2Npc eliteKnight = addSpawn(ELITE_DRAGON_KNIGHT, npc, false, 0, true); npc.deleteMe(); broadcastNpcSay(eliteKnight, Say2.NPC_SHOUT, NpcStringId.IF_YOU_WISH_TO_SEE_HELL_I_WILL_GRANT_YOU_YOUR_WISH); @@ -114,8 +98,7 @@ public final class LairOfAntharas extends AbstractNpcAI break; } case DRAGON_GUARD: - case DRAGON_MAGE: - { + case DRAGON_MAGE: { cancelQuestTimer("CHECK_HOME", npc, null); break; } @@ -124,20 +107,17 @@ public final class LairOfAntharas extends AbstractNpcAI } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { final L2Attackable mob = (L2Attackable) npc; mob.setOnKillDelay(0); - if ((npc.getId() == DRAGON_GUARD) || (npc.getId() == DRAGON_MAGE)) - { + if ((npc.getId() == DRAGON_GUARD) || (npc.getId() == DRAGON_MAGE)) { mob.setIsNoRndWalk(true); startQuestTimer("CHECK_HOME", 10000, npc, null, true); } return super.onSpawn(npc); } - public static void main(String[] args) - { + public static void main(String[] args) { new LairOfAntharas(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/MinionSpawnManager.java b/src/main/java/com/l2jserver/datapack/ai/group_template/MinionSpawnManager.java index a16cb8b60b..786ac72920 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/MinionSpawnManager.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/MinionSpawnManager.java @@ -33,12 +33,10 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Minion Spawn Manager. * @author Zealar */ -public final class MinionSpawnManager extends AbstractNpcAI -{ +public final class MinionSpawnManager extends AbstractNpcAI { private static final Set<Integer> NPC = new HashSet<>(354); - static - { + static { NPC.add(18344); // Ancient Egg NPC.add(18352); // Kamael Guard NPC.add(18353); // Guardian of Records @@ -396,21 +394,18 @@ public final class MinionSpawnManager extends AbstractNpcAI NPC.add(29147); // Lost Captain } - private static final NpcStringId[] ON_ATTACK_MSG = - { + private static final NpcStringId[] ON_ATTACK_MSG = { NpcStringId.COME_OUT_YOU_CHILDREN_OF_DARKNESS, NpcStringId.SHOW_YOURSELVES, NpcStringId.DESTROY_THE_ENEMY_MY_BROTHERS, NpcStringId.FORCES_OF_DARKNESS_FOLLOW_ME }; - private static final int[] ON_ATTACK_NPC = - { + private static final int[] ON_ATTACK_NPC = { 20767, // Timak Orc Troop Leader }; - private MinionSpawnManager() - { + private MinionSpawnManager() { super(MinionSpawnManager.class.getSimpleName(), "ai/group_template"); addSpawnId(NPC); @@ -418,32 +413,23 @@ public final class MinionSpawnManager extends AbstractNpcAI } @Override - public String onSpawn(L2Npc npc) - { - if (npc.getTemplate().getParameters().getSet().get("SummonPrivateRate") == null) - { + public String onSpawn(L2Npc npc) { + if (npc.getTemplate().getParameters().getSet().get("SummonPrivateRate") == null) { ((L2MonsterInstance) npc).getMinionList().spawnMinions(npc.getTemplate().getParameters().getMinionList("Privates")); npc.setScriptValue(1); - } - else - { + } else { npc.setScriptValue(0); } return super.onSpawn(npc); } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (npc.isMonster()) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (npc.isMonster()) { final L2MonsterInstance monster = (L2MonsterInstance) npc; - if (!monster.isTeleporting()) - { - if ((getRandom(1, 100) <= npc.getTemplate().getParameters().getInt("SummonPrivateRate", 0)) && npc.isScriptValue(0)) - { - for (MinionHolder is : npc.getTemplate().getParameters().getMinionList("Privates")) - { + if (!monster.isTeleporting()) { + if ((getRandom(1, 100) <= npc.getTemplate().getParameters().getInt("SummonPrivateRate", 0)) && npc.isScriptValue(0)) { + for (MinionHolder is : npc.getTemplate().getParameters().getMinionList("Privates")) { addMinion((L2MonsterInstance) npc, is.getId()); } broadcastNpcSay(npc, Say2.NPC_ALL, ON_ATTACK_MSG[getRandom(ON_ATTACK_MSG.length)]); @@ -454,8 +440,7 @@ public final class MinionSpawnManager extends AbstractNpcAI return super.onAttack(npc, attacker, damage, isSummon); } - public static void main(String[] args) - { + public static void main(String[] args) { new MinionSpawnManager(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/MonasteryOfSilence.java b/src/main/java/com/l2jserver/datapack/ai/group_template/MonasteryOfSilence.java index 3665370e94..e3790b3247 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/MonasteryOfSilence.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/MonasteryOfSilence.java @@ -35,8 +35,7 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Monastery of Silence AI. * @author Kerberos, nonom */ -public final class MonasteryOfSilence extends AbstractNpcAI -{ +public final class MonasteryOfSilence extends AbstractNpcAI { // NPCs private static final int CAPTAIN = 18910; // Solina Knight Captain private static final int KNIGHT = 18909; // Solina Knights @@ -45,8 +44,7 @@ public final class MonasteryOfSilence extends AbstractNpcAI private static final int SEEKER = 22790; // Seeker Solina private static final int SAVIOR = 22791; // Savior Solina private static final int ASCETIC = 22793; // Ascetic Solina - private static final int[] DIVINITY_CLAN = - { + private static final int[] DIVINITY_CLAN = { 22794, // Divinity Judge 22795, // Divinity Manager }; @@ -60,20 +58,17 @@ public final class MonasteryOfSilence extends AbstractNpcAI private static final SkillHolder WARRIOR_THRUSTING = new SkillHolder(6311); // Solina Thrust private static final SkillHolder KNIGHT_BLESS = new SkillHolder(6313); // Solina Bless // Misc - private static final NpcStringId[] DIVINITY_MSG = - { + private static final NpcStringId[] DIVINITY_MSG = { NpcStringId.S1_WHY_WOULD_YOU_CHOOSE_THE_PATH_OF_DARKNESS, NpcStringId.S1_HOW_DARE_YOU_DEFY_THE_WILL_OF_EINHASAD }; - private static final NpcStringId[] SOLINA_KNIGHTS_MSG = - { + private static final NpcStringId[] SOLINA_KNIGHTS_MSG = { NpcStringId.PUNISH_ALL_THOSE_WHO_TREAD_FOOTSTEPS_IN_THIS_PLACE, NpcStringId.WE_ARE_THE_SWORD_OF_TRUTH_THE_SWORD_OF_SOLINA, NpcStringId.WE_RAISE_OUR_BLADES_FOR_THE_GLORY_OF_SOLINA }; - private MonasteryOfSilence() - { + private MonasteryOfSilence() { super(MonasteryOfSilence.class.getSimpleName(), "ai/group_template"); addSkillSeeId(DIVINITY_CLAN); addAttackId(KNIGHT, CAPTAIN, GUIDE, SEEKER, ASCETIC); @@ -83,25 +78,17 @@ public final class MonasteryOfSilence extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { - case "TRAINING": - { - for (L2Character character : npc.getKnownList().getKnownCharactersInRadius(400)) - { - if ((getRandom(100) < 30) && character.isNpc() && !character.isDead() && !character.isInCombat()) - { - if ((character.getId() == CAPTAIN) && (getRandom(100) < 10) && npc.isScriptValue(0)) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { + case "TRAINING": { + for (L2Character character : npc.getKnownList().getKnownCharactersInRadius(400)) { + if ((getRandom(100) < 30) && character.isNpc() && !character.isDead() && !character.isInCombat()) { + if ((character.getId() == CAPTAIN) && (getRandom(100) < 10) && npc.isScriptValue(0)) { final L2Npc captain = (L2Npc) character; broadcastNpcSay(captain, Say2.NPC_ALL, SOLINA_KNIGHTS_MSG[getRandom(SOLINA_KNIGHTS_MSG.length)]); captain.setScriptValue(1); startQuestTimer("TIMER", 10000, captain, null); - } - else if (character.getId() == KNIGHT) - { + } else if (character.getId() == KNIGHT) { character.setRunning(); ((L2Attackable) character).addDamageHate(npc, 0, 100); character.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, npc, null); @@ -110,12 +97,9 @@ public final class MonasteryOfSilence extends AbstractNpcAI } break; } - case "DO_CAST": - { - if ((npc != null) && (player != null) && (getRandom(100) < 3)) - { - if (npc.checkDoCastConditions(STUDENT_CANCEL.getSkill())) - { + case "DO_CAST": { + if ((npc != null) && (player != null) && (getRandom(100) < 3)) { + if (npc.checkDoCastConditions(STUDENT_CANCEL.getSkill())) { npc.setTarget(player); npc.doCast(STUDENT_CANCEL); } @@ -123,10 +107,8 @@ public final class MonasteryOfSilence extends AbstractNpcAI } break; } - case "TIMER": - { - if (npc != null) - { + case "TIMER": { + if (npc != null) { npc.setScriptValue(0); } break; @@ -136,27 +118,20 @@ public final class MonasteryOfSilence extends AbstractNpcAI } @Override - public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isSummon) - { + public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isSummon) { final L2Attackable mob = (L2Attackable) npc; - switch (npc.getId()) - { - case KNIGHT: - { - if ((getRandom(100) < 10) && (mob.getMostHated() == player) && mob.checkDoCastConditions(WARRIOR_THRUSTING.getSkill())) - { + switch (npc.getId()) { + case KNIGHT: { + if ((getRandom(100) < 10) && (mob.getMostHated() == player) && mob.checkDoCastConditions(WARRIOR_THRUSTING.getSkill())) { npc.setTarget(player); npc.doCast(WARRIOR_THRUSTING); } break; } - case CAPTAIN: - { - if ((getRandom(100) < 20) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.5)) && npc.isScriptValue(0)) - { - if (npc.checkDoCastConditions(KNIGHT_BLESS.getSkill())) - { + case CAPTAIN: { + if ((getRandom(100) < 20) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.5)) && npc.isScriptValue(0)) { + if (npc.checkDoCastConditions(KNIGHT_BLESS.getSkill())) { npc.setTarget(npc); npc.doCast(KNIGHT_BLESS); } @@ -166,28 +141,22 @@ public final class MonasteryOfSilence extends AbstractNpcAI } break; } - case GUIDE: - { - if ((getRandom(100) < 3) && (mob.getMostHated() == player) && npc.checkDoCastConditions(ORDEAL_STRIKE.getSkill())) - { + case GUIDE: { + if ((getRandom(100) < 3) && (mob.getMostHated() == player) && npc.checkDoCastConditions(ORDEAL_STRIKE.getSkill())) { npc.setTarget(player); npc.doCast(ORDEAL_STRIKE); } break; } - case SEEKER: - { - if ((getRandom(100) < 33) && (mob.getMostHated() == player) && npc.checkDoCastConditions(SAVER_STRIKE.getSkill())) - { + case SEEKER: { + if ((getRandom(100) < 33) && (mob.getMostHated() == player) && npc.checkDoCastConditions(SAVER_STRIKE.getSkill())) { npc.setTarget(npc); npc.doCast(SAVER_STRIKE); } break; } - case ASCETIC: - { - if ((mob.getMostHated() == player) && npc.isScriptValue(0)) - { + case ASCETIC: { + if ((mob.getMostHated() == player) && npc.isScriptValue(0)) { npc.setScriptValue(1); startQuestTimer("DO_CAST", 20000, npc, player); } @@ -198,46 +167,35 @@ public final class MonasteryOfSilence extends AbstractNpcAI } @Override - public boolean onNpcHate(L2Attackable mob, L2PcInstance player, boolean isSummon) - { + public boolean onNpcHate(L2Attackable mob, L2PcInstance player, boolean isSummon) { return player.getActiveWeaponInstance() != null; } @Override - public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) - { - if (player.getActiveWeaponInstance() != null) - { + public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) { + if (player.getActiveWeaponInstance() != null) { SkillHolder skill = null; - switch (npc.getId()) - { - case GUIDE: - { - if (getRandom(100) < 3) - { + switch (npc.getId()) { + case GUIDE: { + if (getRandom(100) < 3) { skill = LEADER_STRIKE; } break; } - case SEEKER: - { + case SEEKER: { skill = SAVER_BLEED; break; } - case SAVIOR: - { + case SAVIOR: { skill = LEARNING_MAGIC; break; } - case ASCETIC: - { - if (getRandom(100) < 3) - { + case ASCETIC: { + if (getRandom(100) < 3) { skill = STUDENT_CANCEL; } - if (npc.isScriptValue(0)) - { + if (npc.isScriptValue(0)) { npc.setScriptValue(1); startQuestTimer("DO_CAST", 20000, npc, player); } @@ -245,14 +203,12 @@ public final class MonasteryOfSilence extends AbstractNpcAI } } - if ((skill != null) && npc.checkDoCastConditions(skill.getSkill())) - { + if ((skill != null) && npc.checkDoCastConditions(skill.getSkill())) { npc.setTarget(player); npc.doCast(skill); } - if (!npc.isInCombat()) - { + if (!npc.isInCombat()) { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.YOU_CANNOT_CARRY_A_WEAPON_WITHOUT_AUTHORIZATION); } @@ -262,14 +218,10 @@ public final class MonasteryOfSilence extends AbstractNpcAI } @Override - public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) - { - if (skill.hasEffectType(L2EffectType.AGGRESSION) && (targets.length != 0)) - { - for (L2Object obj : targets) - { - if (obj.equals(npc)) - { + public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) { + if (skill.hasEffectType(L2EffectType.AGGRESSION) && (targets.length != 0)) { + for (L2Object obj : targets) { + if (obj.equals(npc)) { broadcastNpcSay(npc, Say2.NPC_ALL, DIVINITY_MSG[getRandom(DIVINITY_MSG.length)], caster.getName()); addAttackDesire(npc, caster); break; @@ -280,16 +232,14 @@ public final class MonasteryOfSilence extends AbstractNpcAI } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { npc.setIsInvul(true); npc.disableCoreAI(true); startQuestTimer("TRAINING", 30000, npc, null, true); return super.onSpawn(npc); } - public static void main(String[] args) - { + public static void main(String[] args) { new MonasteryOfSilence(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/NonLethalableNpcs.java b/src/main/java/com/l2jserver/datapack/ai/group_template/NonLethalableNpcs.java index 42d242e36c..a3cc7b0b6f 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/NonLethalableNpcs.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/NonLethalableNpcs.java @@ -24,28 +24,23 @@ import com.l2jserver.gameserver.model.actor.L2Npc; /** * @author UnAfraid */ -public final class NonLethalableNpcs extends AbstractNpcAI -{ - private static final int[] NPCS = - { +public final class NonLethalableNpcs extends AbstractNpcAI { + private static final int[] NPCS = { 35062, // Headquarters }; - public NonLethalableNpcs() - { + public NonLethalableNpcs() { super(NonLethalableNpcs.class.getSimpleName(), "ai/group_template"); addSpawnId(NPCS); } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { npc.setLethalable(false); return super.onSpawn(npc); } - public static void main(String[] args) - { + public static void main(String[] args) { new NonLethalableNpcs(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/NonTalkingNpcs.java b/src/main/java/com/l2jserver/datapack/ai/group_template/NonTalkingNpcs.java index 1b24d56a87..9025951076 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/NonTalkingNpcs.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/NonTalkingNpcs.java @@ -25,8 +25,7 @@ import com.l2jserver.gameserver.model.actor.L2Npc; * AI for handle Non-Talking NPCs. * @author St3eT */ -public final class NonTalkingNpcs extends AbstractNpcAI -{ +public final class NonTalkingNpcs extends AbstractNpcAI { // @formatter:off private static final int[] NONTALKINGNPCS = { @@ -53,21 +52,18 @@ public final class NonTalkingNpcs extends AbstractNpcAI }; // @formatter:on - public NonTalkingNpcs() - { + public NonTalkingNpcs() { super(NonTalkingNpcs.class.getSimpleName(), "ai/group_template"); addSpawnId(NONTALKINGNPCS); } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { npc.setTalking(false); return super.onSpawn(npc); } - public static void main(String[] args) - { + public static void main(String[] args) { new NonTalkingNpcs(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/PavelArchaic.java b/src/main/java/com/l2jserver/datapack/ai/group_template/PavelArchaic.java index 5beb4373e9..2181632577 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/PavelArchaic.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/PavelArchaic.java @@ -26,25 +26,21 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Pavel Archaic AI. * @author Gnacik, St3eT */ -public final class PavelArchaic extends AbstractNpcAI -{ +public final class PavelArchaic extends AbstractNpcAI { private static final int SAFETY_DEVICE = 18917; // Pavel Safety Device private static final int PINCER_GOLEM = 22801; // Cruel Pincer Golem private static final int PINCER_GOLEM2 = 22802; // Cruel Pincer Golem private static final int PINCER_GOLEM3 = 22803; // Cruel Pincer Golem private static final int JACKHAMMER_GOLEM = 22804; // Horrifying Jackhammer Golem - private PavelArchaic() - { + private PavelArchaic() { super(PavelArchaic.class.getSimpleName(), "ai/group_template"); addKillId(SAFETY_DEVICE, PINCER_GOLEM, JACKHAMMER_GOLEM); } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (getRandom(100) < 70) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (getRandom(100) < 70) { final L2Npc golem1 = addSpawn(PINCER_GOLEM2, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, false); addAttackDesire(golem1, killer); @@ -54,8 +50,7 @@ public final class PavelArchaic extends AbstractNpcAI return super.onKill(npc, killer, isSummon); } - public static void main(String[] args) - { + public static void main(String[] args) { new PavelArchaic(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/PlainsOfDion.java b/src/main/java/com/l2jserver/datapack/ai/group_template/PlainsOfDion.java index f1e4d49e7d..b1ebb942a1 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/PlainsOfDion.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/PlainsOfDion.java @@ -31,17 +31,14 @@ import com.l2jserver.gameserver.util.Util; * AI for mobs in Plains of Dion (near Floran Village). * @author Gladicek */ -public final class PlainsOfDion extends AbstractNpcAI -{ - private static final int DELU_LIZARDMEN[] = - { +public final class PlainsOfDion extends AbstractNpcAI { + private static final int DELU_LIZARDMEN[] = { 21104, // Delu Lizardman Supplier 21105, // Delu Lizardman Special Agent 21107, // Delu Lizardman Commander }; - private static final NpcStringId[] MONSTERS_MSG = - { + private static final NpcStringId[] MONSTERS_MSG = { NpcStringId.S1_HOW_DARE_YOU_INTERRUPT_OUR_FIGHT_HEY_GUYS_HELP, NpcStringId.S1_HEY_WERE_HAVING_A_DUEL_HERE, NpcStringId.THE_DUEL_IS_OVER_ATTACK, @@ -49,38 +46,29 @@ public final class PlainsOfDion extends AbstractNpcAI NpcStringId.HOW_DARE_YOU_INTERRUPT_A_SACRED_DUEL_YOU_MUST_BE_TAUGHT_A_LESSON }; - private static final NpcStringId[] MONSTERS_ASSIST_MSG = - { + private static final NpcStringId[] MONSTERS_ASSIST_MSG = { NpcStringId.DIE_YOU_COWARD, NpcStringId.KILL_THE_COWARD, NpcStringId.WHAT_ARE_YOU_LOOKING_AT }; - private PlainsOfDion() - { + private PlainsOfDion() { super(PlainsOfDion.class.getSimpleName(), "ai/group_template"); addAttackId(DELU_LIZARDMEN); } @Override - public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isSummon) - { - if (npc.isScriptValue(0)) - { + public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isSummon) { + if (npc.isScriptValue(0)) { final int i = getRandom(5); - if (i < 2) - { + if (i < 2) { broadcastNpcSay(npc, Say2.NPC_ALL, MONSTERS_MSG[i], player.getName()); - } - else - { + } else { broadcastNpcSay(npc, Say2.NPC_ALL, MONSTERS_MSG[i]); } - for (L2Character obj : npc.getKnownList().getKnownCharactersInRadius(npc.getTemplate().getClanHelpRange())) - { - if (obj.isMonster() && Util.contains(DELU_LIZARDMEN, obj.getId()) && !obj.isAttackingNow() && !obj.isDead() && GeoData.getInstance().canSeeTarget(npc, obj)) - { + for (L2Character obj : npc.getKnownList().getKnownCharactersInRadius(npc.getTemplate().getClanHelpRange())) { + if (obj.isMonster() && Util.contains(DELU_LIZARDMEN, obj.getId()) && !obj.isAttackingNow() && !obj.isDead() && GeoData.getInstance().canSeeTarget(npc, obj)) { final L2Npc monster = (L2Npc) obj; addAttackDesire(monster, player); broadcastNpcSay(monster, Say2.NPC_ALL, MONSTERS_ASSIST_MSG[getRandom(3)]); @@ -91,8 +79,7 @@ public final class PlainsOfDion extends AbstractNpcAI return super.onAttack(npc, player, damage, isSummon); } - public static void main(String[] args) - { + public static void main(String[] args) { new PlainsOfDion(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/PlainsOfLizardman.java b/src/main/java/com/l2jserver/datapack/ai/group_template/PlainsOfLizardman.java index eefec4d923..014fcc4e66 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/PlainsOfLizardman.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/PlainsOfLizardman.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.model.holders.SkillHolder; * Plains of Lizardmen AI. * @author Gnacik, malyelfik */ -public final class PlainsOfLizardman extends AbstractNpcAI -{ +public final class PlainsOfLizardman extends AbstractNpcAI { // NPCs private static final int INVISIBLE_NPC = 18919; private static final int TANTA_GUARD = 18862; @@ -44,8 +43,7 @@ public final class PlainsOfLizardman extends AbstractNpcAI private static final int TANTA_SCOUT = 22768; private static final int TANTA_MAGICIAN = 22773; private static final int TANTA_SUMMONER = 22774; - private static final int[] TANTA_LIZARDMEN = - { + private static final int[] TANTA_LIZARDMEN = { 22768, // Tanta Lizardman Scout 22769, // Tanta Lizardman Warrior 22770, // Tanta Lizardman Soldier @@ -64,8 +62,7 @@ public final class PlainsOfLizardman extends AbstractNpcAI // Misc private static final double HP_PERCENTAGE = 0.60; // Buffs - private static final SkillHolder[] BUFFS = - { + private static final SkillHolder[] BUFFS = { new SkillHolder(6625, 1), // Energy of Life new SkillHolder(6626, 2), // Energy of Life's Power new SkillHolder(6627, 3), // Energy of Life's Highest Power @@ -89,23 +86,18 @@ public final class PlainsOfLizardman extends AbstractNpcAI }; // @formatter:on - private PlainsOfLizardman() - { + private PlainsOfLizardman() { super(PlainsOfLizardman.class.getSimpleName(), "ai/group_template"); addAttackId(FANTASY_MUSHROOM, RAINBOW_FROG, STICKY_MUSHROOM, ENERGY_PLANT, TANTA_SUMMONER); addKillId(TANTA_LIZARDMEN); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equals("fantasy_mushroom") && (npc != null) && (player != null)) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equals("fantasy_mushroom") && (npc != null) && (player != null)) { npc.doCast(FANTASY_MUSHROOM_SKILL); - for (L2Character target : npc.getKnownList().getKnownCharactersInRadius(200)) - { - if ((target != null) && target.isAttackable()) - { + for (L2Character target : npc.getKnownList().getKnownCharactersInRadius(200)) { + if ((target != null) && target.isAttackable()) { final L2Npc monster = (L2Npc) target; npc.setTarget(monster); npc.doCast(STUN_EFFECT); @@ -118,13 +110,10 @@ public final class PlainsOfLizardman extends AbstractNpcAI } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - switch (npc.getId()) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + switch (npc.getId()) { case TANTA_SUMMONER: - if ((npc.getCurrentHp() < (npc.getMaxHp() * HP_PERCENTAGE)) && npc.isScriptValue(0)) - { + if ((npc.getCurrentHp() < (npc.getMaxHp() * HP_PERCENTAGE)) && npc.isScriptValue(0)) { npc.setScriptValue(1); npc.doCast(DEMOTIVATION_HEX); addAttackDesire(addSpawn(TANTA_SCOUT, npc.getX(), npc.getY(), npc.getZ(), 0, false, 0, false), attacker); @@ -141,17 +130,13 @@ public final class PlainsOfLizardman extends AbstractNpcAI castSkill(npc, attacker, STICKY_MUSHROOM_SKILL); break; case FANTASY_MUSHROOM: - if (npc.isScriptValue(0)) - { + if (npc.isScriptValue(0)) { npc.setScriptValue(1); npc.setIsInvul(true); - for (L2Character target : npc.getKnownList().getKnownCharactersInRadius(1000)) - { - if ((target != null) && target.isAttackable()) - { + for (L2Character target : npc.getKnownList().getKnownCharactersInRadius(1000)) { + if ((target != null) && target.isAttackable()) { final L2Attackable monster = (L2Attackable) target; - if ((monster.getId() == TANTA_MAGICIAN) || (monster.getId() == TANTA_SCOUT)) - { + if ((monster.getId() == TANTA_MAGICIAN) || (monster.getId() == TANTA_SCOUT)) { target.setIsRunning(true); target.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(npc.getX(), npc.getY(), npc.getZ(), 0)); } @@ -165,11 +150,9 @@ public final class PlainsOfLizardman extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { // Tanta Guard - if (getRandom(1000) == 0) - { + if (getRandom(1000) == 0) { addAttackDesire(addSpawn(TANTA_GUARD, npc), killer); } @@ -178,38 +161,28 @@ public final class PlainsOfLizardman extends AbstractNpcAI final L2Npc buffer = addSpawn(INVISIBLE_NPC, npc.getLocation(), false, 6000); buffer.setTarget(killer); - if (random <= 42) - { + if (random <= 42) { castRandomBuff(buffer, 7, 45, BUFFS[0], BUFFS[1], BUFFS[2]); } - if (random <= 11) - { + if (random <= 11) { castRandomBuff(buffer, 8, 60, BUFFS[3], BUFFS[4], BUFFS[5]); castRandomBuff(buffer, 3, 6, BUFFS[9], BUFFS[10], BUFFS[12]); } - if (random <= 25) - { + if (random <= 25) { buffer.doCast(BUFFS[BUFF_LIST[getRandom(BUFF_LIST.length)]]); } - if (random <= 10) - { + if (random <= 10) { buffer.doCast(BUFFS[13].getSkill()); } - if (random <= 1) - { + if (random <= 1) { final int i = getRandom(100); - if (i <= 34) - { + if (i <= 34) { buffer.doCast(BUFFS[6]); buffer.doCast(BUFFS[7]); buffer.doCast(BUFFS[8]); - } - else if (i < 67) - { + } else if (i < 67) { buffer.doCast(BUFFS[13]); - } - else - { + } else { buffer.doCast(BUFFS[2]); buffer.doCast(BUFFS[5]); } @@ -217,32 +190,24 @@ public final class PlainsOfLizardman extends AbstractNpcAI return super.onKill(npc, killer, isSummon); } - private void castRandomBuff(L2Npc npc, int chance1, int chance2, SkillHolder... buffs) - { + private void castRandomBuff(L2Npc npc, int chance1, int chance2, SkillHolder... buffs) { final int rand = getRandom(100); - if (rand <= chance1) - { + if (rand <= chance1) { npc.doCast(buffs[2]); - } - else if (rand <= chance2) - { + } else if (rand <= chance2) { npc.doCast(buffs[1]); - } - else - { + } else { npc.doCast(buffs[0]); } } @Override - protected void castSkill(L2Npc npc, L2Playable target, SkillHolder skill) - { + protected void castSkill(L2Npc npc, L2Playable target, SkillHolder skill) { npc.doDie(target); super.castSkill(addSpawn(INVISIBLE_NPC, npc, false, 6000), target, skill); } - public static void main(String[] args) - { + public static void main(String[] args) { new PlainsOfLizardman(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/PolymorphingAngel.java b/src/main/java/com/l2jserver/datapack/ai/group_template/PolymorphingAngel.java index b392dc1e81..88a8ff9fd7 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/PolymorphingAngel.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/PolymorphingAngel.java @@ -29,11 +29,9 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; /** * Angel spawns...when one of the angels in the keys dies, the other angel will spawn. */ -public final class PolymorphingAngel extends AbstractNpcAI -{ +public final class PolymorphingAngel extends AbstractNpcAI { private static final Map<Integer, Integer> ANGELSPAWNS = new HashMap<>(); - static - { + static { ANGELSPAWNS.put(20830, 20859); ANGELSPAWNS.put(21067, 21068); ANGELSPAWNS.put(21062, 21063); @@ -41,22 +39,19 @@ public final class PolymorphingAngel extends AbstractNpcAI ANGELSPAWNS.put(21070, 21071); } - private PolymorphingAngel() - { + private PolymorphingAngel() { super(PolymorphingAngel.class.getSimpleName(), "ai/group_template"); addKillId(ANGELSPAWNS.keySet()); } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final L2Attackable newNpc = (L2Attackable) addSpawn(ANGELSPAWNS.get(npc.getId()), npc); newNpc.setRunning(); return super.onKill(npc, killer, isSummon); } - public static void main(String[] args) - { + public static void main(String[] args) { new PolymorphingAngel(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/PolymorphingOnAttack.java b/src/main/java/com/l2jserver/datapack/ai/group_template/PolymorphingOnAttack.java index 0ab4e51373..790f561f7c 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/PolymorphingOnAttack.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/PolymorphingOnAttack.java @@ -37,11 +37,9 @@ import com.l2jserver.gameserver.network.serverpackets.CreatureSay; * Polymorphing on attack monsters AI. * @author Slyce */ -public final class PolymorphingOnAttack extends AbstractNpcAI -{ +public final class PolymorphingOnAttack extends AbstractNpcAI { private static final Map<Integer, List<Integer>> MOBSPAWNS = new HashMap<>(); - static - { + static { MOBSPAWNS.put(21258, Arrays.asList(21259, 100, 100, -1)); // Fallen Orc Shaman -> Sharp Talon Tiger (always polymorphs) MOBSPAWNS.put(21261, Arrays.asList(21262, 100, 20, 0)); // Ol Mahum Transcender 1st stage MOBSPAWNS.put(21262, Arrays.asList(21263, 100, 10, 1)); // Ol Mahum Transcender 2nd stage @@ -56,46 +54,36 @@ public final class PolymorphingOnAttack extends AbstractNpcAI MOBSPAWNS.put(21533, Arrays.asList(21534, 100, 30, -1)); // Alliance of Splendor MOBSPAWNS.put(21537, Arrays.asList(21538, 100, 30, -1)); // Fang of Splendor } - protected static final NpcStringId[][] MOBTEXTS = - { - new NpcStringId[] - { + protected static final NpcStringId[][] MOBTEXTS = { + new NpcStringId[] { NpcStringId.ENOUGH_FOOLING_AROUND_GET_READY_TO_DIE, NpcStringId.YOU_IDIOT_IVE_JUST_BEEN_TOYING_WITH_YOU, NpcStringId.NOW_THE_FUN_STARTS }, - new NpcStringId[] - { + new NpcStringId[] { NpcStringId.I_MUST_ADMIT_NO_ONE_MAKES_MY_BLOOD_BOIL_QUITE_LIKE_YOU_DO, NpcStringId.NOW_THE_BATTLE_BEGINS, NpcStringId.WITNESS_MY_TRUE_POWER }, - new NpcStringId[] - { + new NpcStringId[] { NpcStringId.PREPARE_TO_DIE, NpcStringId.ILL_DOUBLE_MY_STRENGTH, NpcStringId.YOU_HAVE_MORE_SKILL_THAN_I_THOUGHT } }; - private PolymorphingOnAttack() - { + private PolymorphingOnAttack() { super(PolymorphingOnAttack.class.getSimpleName(), "ai/group_template"); addAttackId(MOBSPAWNS.keySet()); } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (npc.isVisible() && !npc.isDead()) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (npc.isVisible() && !npc.isDead()) { final List<Integer> tmp = MOBSPAWNS.get(npc.getId()); - if (tmp != null) - { - if ((npc.getCurrentHp() <= ((npc.getMaxHp() * tmp.get(1)) / 100.0)) && (getRandom(100) < tmp.get(2))) - { - if (tmp.get(3) >= 0) - { + if (tmp != null) { + if ((npc.getCurrentHp() <= ((npc.getMaxHp() * tmp.get(1)) / 100.0)) && (getRandom(100) < tmp.get(2))) { + if (tmp.get(3) >= 0) { NpcStringId npcString = MOBTEXTS[tmp.get(3)][getRandom(MOBTEXTS[tmp.get(3)].length)]; npc.broadcastPacket(new CreatureSay(npc.getObjectId(), Say2.NPC_ALL, npc.getName(), npcString)); @@ -112,8 +100,7 @@ public final class PolymorphingOnAttack extends AbstractNpcAI return super.onAttack(npc, attacker, damage, isSummon); } - public static void main(String[] args) - { + public static void main(String[] args) { new PolymorphingOnAttack(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/PrimevalIsle.java b/src/main/java/com/l2jserver/datapack/ai/group_template/PrimevalIsle.java index 8f76314215..1c00526f1e 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/PrimevalIsle.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/PrimevalIsle.java @@ -40,20 +40,17 @@ import com.l2jserver.gameserver.util.Util; * Primeval Isle AI. * @author St3eT */ -public final class PrimevalIsle extends AbstractNpcAI -{ +public final class PrimevalIsle extends AbstractNpcAI { // NPC private static final int EGG = 18344; // Ancient Egg private static final int SAILREN = 29065; // Sailren private static final int ORNIT = 22742; // Ornithomimus private static final int DEINO = 22743; // Deinonychus - private static final int[] SPRIGNANT = - { + private static final int[] SPRIGNANT = { 18345, // Sprigant (Anesthesia) 18346, // Sprigant (Deadly Poison) }; - private static final int[] MONSTERS = - { + private static final int[] MONSTERS = { 22196, // Velociraptor 22198, // Velociraptor 22200, // Ornithomimus @@ -72,14 +69,12 @@ public final class PrimevalIsle extends AbstractNpcAI 22742, // Ornithomimus 22743, // Deinonychus }; - private static final int[] TREX = - { + private static final int[] TREX = { 22215, // Tyrannosaurus 22216, // Tyrannosaurus 22217, // Tyrannosaurus }; - private static final int[] VEGETABLE = - { + private static final int[] VEGETABLE = { 22200, // Ornithomimus 22201, // Ornithomimus 22202, // Ornithomimus @@ -103,8 +98,7 @@ public final class PrimevalIsle extends AbstractNpcAI private static final SkillHolder CREW_SKILL = new SkillHolder(6172, 1); // Presentation - Tyranno private static final SkillHolder INVIN_BUFF_ON = new SkillHolder(5225, 1); // Invincible - private PrimevalIsle() - { + private PrimevalIsle() { super(PrimevalIsle.class.getSimpleName(), "ai/group_template"); addSpawnId(TREX); addSpawnId(SPRIGNANT); @@ -120,53 +114,39 @@ public final class PrimevalIsle extends AbstractNpcAI } @Override - public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) - { - if (skill.getId() == CREW_SKILL.getSkillId()) - { + public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) { + if (skill.getId() == CREW_SKILL.getSkillId()) { startQuestTimer("START_INVUL", 4000, npc, null); final L2Npc target = (L2Npc) npc.getTarget(); - if (target != null) - { + if (target != null) { target.doDie(npc); } } - if (npc.isInCombat()) - { + if (npc.isInCombat()) { final L2Attackable mob = (L2Attackable) npc; final L2Character target = mob.getMostHated(); - if (((npc.getCurrentHp() / npc.getMaxHp()) * 100) < 60) - { - if (skill.getId() == SELFBUFF1.getSkillId()) - { + if (((npc.getCurrentHp() / npc.getMaxHp()) * 100) < 60) { + if (skill.getId() == SELFBUFF1.getSkillId()) { npc.setScriptValue(3); - if ((target != null)) - { + if ((target != null)) { npc.setTarget(target); mob.setIsRunning(true); mob.addDamageHate(target, 0, 555); mob.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); } } - } - else if (((npc.getCurrentHp() / npc.getMaxHp()) * 100) < 30) - { - if (skill.getId() == SELFBUFF1.getSkillId()) - { + } else if (((npc.getCurrentHp() / npc.getMaxHp()) * 100) < 30) { + if (skill.getId() == SELFBUFF1.getSkillId()) { npc.setScriptValue(1); - if ((target != null)) - { + if ((target != null)) { npc.setTarget(target); mob.setIsRunning(true); mob.addDamageHate(target, 0, 555); mob.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); } - } - else if (skill.getId() == SELFBUFF2.getSkillId()) - { + } else if (skill.getId() == SELFBUFF2.getSkillId()) { npc.setScriptValue(5); - if ((target != null)) - { + if ((target != null)) { npc.setTarget(target); mob.setIsRunning(true); mob.addDamageHate(target, 0, 555); @@ -179,41 +159,29 @@ public final class PrimevalIsle extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { - case "USE_SKILL": - { - if ((npc != null) && !npc.isDead()) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { + case "USE_SKILL": { + if ((npc != null) && !npc.isDead()) { npc.doCast((npc.getId() == SPRIGNANT[0] ? ANESTHESIA : DEADLY_POISON)); startQuestTimer("USE_SKILL", 15000, npc, null); } break; } - case "GHOST_DESPAWN": - { - if ((npc != null) && !npc.isDead()) - { - if (!npc.isInCombat()) - { + case "GHOST_DESPAWN": { + if ((npc != null) && !npc.isDead()) { + if (!npc.isInCombat()) { npc.deleteMe(); - } - else - { + } else { startQuestTimer("GHOST_DESPAWN", 1800000, npc, null); } } break; } - case "TREX_ATTACK": - { - if ((npc != null) && (player != null)) - { + case "TREX_ATTACK": { + if ((npc != null) && (player != null)) { npc.setScriptValue(0); - if (player.isInsideRadius(npc, 800, true, false)) - { + if (player.isInsideRadius(npc, 800, true, false)) { npc.setTarget(player); npc.doCast(LONGRANGEDMAGIC1); addAttackDesire(npc, player); @@ -221,19 +189,15 @@ public final class PrimevalIsle extends AbstractNpcAI } break; } - case "START_INVUL": - { - if ((npc != null) && !npc.isDead()) - { + case "START_INVUL": { + if ((npc != null) && !npc.isDead()) { npc.doCast(INVIN_BUFF_ON); startQuestTimer("START_INVUL_2", 30000, npc, null); } break; } - case "START_INVUL_2": - { - if ((npc != null) && !npc.isDead()) - { + case "START_INVUL_2": { + if ((npc != null) && !npc.isDead()) { INVIN_BUFF_ON.getSkill().applyEffects(npc, npc); } break; @@ -243,12 +207,9 @@ public final class PrimevalIsle extends AbstractNpcAI } @Override - public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) - { - if (Util.contains(MONSTERS, npc.getId())) - { - if (creature.isPlayer()) - { + public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) { + if (Util.contains(MONSTERS, npc.getId())) { + if (creature.isPlayer()) { final L2Attackable mob = (L2Attackable) npc; final int ag_type = npc.getTemplate().getParameters().getInt("ag_type", 0); final int probPhysicalSpecial1 = npc.getTemplate().getParameters().getInt("ProbPhysicalSpecial1", 0); @@ -256,8 +217,7 @@ public final class PrimevalIsle extends AbstractNpcAI final SkillHolder physicalSpecial1 = npc.getTemplate().getParameters().getObject("PhysicalSpecial1", SkillHolder.class); final SkillHolder physicalSpecial2 = npc.getTemplate().getParameters().getObject("PhysicalSpecial2", SkillHolder.class); - if (((getRandom(100) < 30) && (npc.getId() == DEINO)) || ((npc.getId() == ORNIT) && npc.isScriptValue(0))) - { + if (((getRandom(100) < 30) && (npc.getId() == DEINO)) || ((npc.getId() == ORNIT) && npc.isScriptValue(0))) { mob.clearAggroList(); npc.setScriptValue(1); npc.setRunning(); @@ -272,30 +232,21 @@ public final class PrimevalIsle extends AbstractNpcAI final int newY = (int) (npc.getY() + (sin * distance)); final Location loc = GeoData.getInstance().moveCheck(npc.getX(), npc.getY(), npc.getZ(), newX, newY, npc.getZ(), npc.getInstanceId()); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, loc, 0); - } - else if (ag_type == 1) - { - if (getRandom(100) <= (probPhysicalSpecial1 * npc.getVariables().getInt("SKILL_MULTIPLER"))) - { - if (!npc.isSkillDisabled(physicalSpecial1.getSkillId())) - { + } else if (ag_type == 1) { + if (getRandom(100) <= (probPhysicalSpecial1 * npc.getVariables().getInt("SKILL_MULTIPLER"))) { + if (!npc.isSkillDisabled(physicalSpecial1.getSkillId())) { npc.setTarget(creature); npc.doCast(physicalSpecial1); } - } - else if (getRandom(100) <= (probPhysicalSpecial2 * npc.getVariables().getInt("SKILL_MULTIPLER"))) - { - if (!npc.isSkillDisabled(physicalSpecial2.getSkill())) - { + } else if (getRandom(100) <= (probPhysicalSpecial2 * npc.getVariables().getInt("SKILL_MULTIPLER"))) { + if (!npc.isSkillDisabled(physicalSpecial2.getSkill())) { npc.setTarget(creature); npc.doCast(physicalSpecial2); } } } } - } - else if (Util.contains(VEGETABLE, creature.getId())) - { + } else if (Util.contains(VEGETABLE, creature.getId())) { npc.setTarget(creature); npc.doCast(CREW_SKILL); npc.setIsRunning(true); @@ -305,10 +256,8 @@ public final class PrimevalIsle extends AbstractNpcAI } @Override - public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) - { - if (npc.isScriptValue(0)) - { + public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) { + if (npc.isScriptValue(0)) { npc.setScriptValue(1); broadcastNpcSay(npc, Say2.NPC_ALL, "?"); ((L2Attackable) npc).clearAggroList(); @@ -318,88 +267,62 @@ public final class PrimevalIsle extends AbstractNpcAI } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (npc.getId() == EGG) - { - if ((getRandom(100) <= 80) && npc.isScriptValue(0)) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (npc.getId() == EGG) { + if ((getRandom(100) <= 80) && npc.isScriptValue(0)) { npc.setScriptValue(1); final L2Playable playable = isSummon ? attacker.getSummon() : attacker; - for (L2Character characters : npc.getKnownList().getKnownCharactersInRadius(500)) - { - if ((characters != null) && (characters.isAttackable()) && (getRandomBoolean())) - { + for (L2Character characters : npc.getKnownList().getKnownCharactersInRadius(500)) { + if ((characters != null) && (characters.isAttackable()) && (getRandomBoolean())) { L2Attackable monster = (L2Attackable) characters; addAttackDesire(monster, playable); } } } - } - else if (Util.contains(TREX, npc.getId())) - { + } else if (Util.contains(TREX, npc.getId())) { final L2Attackable mob = (L2Attackable) npc; final L2Character target = mob.getMostHated(); - if (((npc.getCurrentHp() / npc.getMaxHp()) * 100) <= 30) - { - if (npc.isScriptValue(3)) - { - if (!npc.isSkillDisabled(SELFBUFF1.getSkill())) - { + if (((npc.getCurrentHp() / npc.getMaxHp()) * 100) <= 30) { + if (npc.isScriptValue(3)) { + if (!npc.isSkillDisabled(SELFBUFF1.getSkill())) { npc.doCast(SELFBUFF1); } - } - else if (npc.isScriptValue(1)) - { - if (!npc.isSkillDisabled(SELFBUFF2.getSkill())) - { + } else if (npc.isScriptValue(1)) { + if (!npc.isSkillDisabled(SELFBUFF2.getSkill())) { npc.doCast(SELFBUFF2); } } - } - else if ((((npc.getCurrentHp() / npc.getMaxHp()) * 100) <= 60) && (npc.isScriptValue(3))) - { - if (!npc.isSkillDisabled(SELFBUFF1.getSkill())) - { + } else if ((((npc.getCurrentHp() / npc.getMaxHp()) * 100) <= 60) && (npc.isScriptValue(3))) { + if (!npc.isSkillDisabled(SELFBUFF1.getSkill())) { npc.doCast(SELFBUFF1); } } - if (Util.calculateDistance(npc, attacker, true, false) > 100) - { - if (!npc.isSkillDisabled(LONGRANGEDMAGIC1.getSkill()) && (getRandom(100) <= (10 * npc.getScriptValue()))) - { + if (Util.calculateDistance(npc, attacker, true, false) > 100) { + if (!npc.isSkillDisabled(LONGRANGEDMAGIC1.getSkill()) && (getRandom(100) <= (10 * npc.getScriptValue()))) { npc.setTarget(attacker); npc.doCast(LONGRANGEDMAGIC1); } - } - else - { - if (!npc.isSkillDisabled(LONGRANGEDMAGIC1.getSkill()) && (getRandom(100) <= (10 * npc.getScriptValue()))) - { + } else { + if (!npc.isSkillDisabled(LONGRANGEDMAGIC1.getSkill()) && (getRandom(100) <= (10 * npc.getScriptValue()))) { npc.setTarget(target); npc.doCast(LONGRANGEDMAGIC1); } - if (!npc.isSkillDisabled(PHYSICALSPECIAL1.getSkill()) && (getRandom(100) <= (5 * npc.getScriptValue()))) - { + if (!npc.isSkillDisabled(PHYSICALSPECIAL1.getSkill()) && (getRandom(100) <= (5 * npc.getScriptValue()))) { npc.setTarget(target); npc.doCast(PHYSICALSPECIAL1); } - if (!npc.isSkillDisabled(PHYSICALSPECIAL2.getSkill()) && (getRandom(100) <= (3 * npc.getScriptValue()))) - { + if (!npc.isSkillDisabled(PHYSICALSPECIAL2.getSkill()) && (getRandom(100) <= (3 * npc.getScriptValue()))) { npc.setTarget(target); npc.doCast(PHYSICALSPECIAL2); } - if (!npc.isSkillDisabled(PHYSICALSPECIAL3.getSkill()) && (getRandom(100) <= (5 * npc.getScriptValue()))) - { + if (!npc.isSkillDisabled(PHYSICALSPECIAL3.getSkill()) && (getRandom(100) <= (5 * npc.getScriptValue()))) { npc.setTarget(target); npc.doCast(PHYSICALSPECIAL3); } } - } - else - { + } else { L2Character target = null; final int probPhysicalSpecial1 = npc.getTemplate().getParameters().getInt("ProbPhysicalSpecial1", 0); final int probPhysicalSpecial2 = npc.getTemplate().getParameters().getInt("ProbPhysicalSpecial2", 0); @@ -407,22 +330,17 @@ public final class PrimevalIsle extends AbstractNpcAI final SkillHolder physicalSpecial1 = npc.getTemplate().getParameters().getObject("PhysicalSpecial1", SkillHolder.class); final SkillHolder physicalSpecial2 = npc.getTemplate().getParameters().getObject("PhysicalSpecial2", SkillHolder.class); - if (((npc.getCurrentHp() / npc.getMaxHp()) * 100) <= 50) - { + if (((npc.getCurrentHp() / npc.getMaxHp()) * 100) <= 50) { npc.getVariables().set("SKILL_MULTIPLER", 2); - } - else - { + } else { npc.getVariables().set("SKILL_MULTIPLER", 1); } - if ((((npc.getCurrentHp() / npc.getMaxHp()) * 100) <= 30) && (npc.getVariables().getInt("SELFBUFF_USED") == 0)) - { + if ((((npc.getCurrentHp() / npc.getMaxHp()) * 100) <= 30) && (npc.getVariables().getInt("SELFBUFF_USED") == 0)) { final L2Attackable mob = (L2Attackable) npc; target = mob.getMostHated(); mob.clearAggroList(); - if (!npc.isSkillDisabled(selfRangeBuff1.getSkillId())) - { + if (!npc.isSkillDisabled(selfRangeBuff1.getSkillId())) { npc.getVariables().set("SELFBUFF_USED", 1); npc.doCast(selfRangeBuff1); npc.setIsRunning(true); @@ -430,20 +348,15 @@ public final class PrimevalIsle extends AbstractNpcAI } } - if (target != null) - { - if (getRandom(100) <= (probPhysicalSpecial1 * npc.getVariables().getInt("SKILL_MULTIPLER"))) - { - if (!npc.isSkillDisabled(physicalSpecial1.getSkill())) - { + if (target != null) { + if (getRandom(100) <= (probPhysicalSpecial1 * npc.getVariables().getInt("SKILL_MULTIPLER"))) { + if (!npc.isSkillDisabled(physicalSpecial1.getSkill())) { npc.setTarget(target); npc.doCast(physicalSpecial1); } } - if (getRandom(100) <= (probPhysicalSpecial2 * npc.getVariables().getInt("SKILL_MULTIPLER"))) - { - if (!npc.isSkillDisabled(physicalSpecial2.getSkill())) - { + if (getRandom(100) <= (probPhysicalSpecial2 * npc.getVariables().getInt("SKILL_MULTIPLER"))) { + if (!npc.isSkillDisabled(physicalSpecial2.getSkill())) { npc.setTarget(target); npc.doCast(physicalSpecial2); } @@ -454,28 +367,21 @@ public final class PrimevalIsle extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if ((npc.getId() == DEINO) || ((npc.getId() == ORNIT) && !npc.isScriptValue(1))) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if ((npc.getId() == DEINO) || ((npc.getId() == ORNIT) && !npc.isScriptValue(1))) { return super.onKill(npc, killer, isSummon); } - if ((npc.getId() == SAILREN) || (getRandom(100) < 3)) - { + if ((npc.getId() == SAILREN) || (getRandom(100) < 3)) { final L2PcInstance player = npc.getId() == SAILREN ? getRandomPartyMember(killer) : killer; - if (player.getInventory().getSize(false) <= (player.getInventoryLimit() * 0.8)) - { + if (player.getInventory().getSize(false) <= (player.getInventoryLimit() * 0.8)) { giveItems(player, DEINONYCHUS, 1); final L2ItemInstance summonItem = player.getInventory().getItemByItemId(DEINONYCHUS); final IItemHandler handler = ItemHandler.getInstance().getHandler(summonItem.getEtcItem()); - if ((handler != null) && !player.hasPet()) - { + if ((handler != null) && !player.hasPet()) { handler.useItem(player, summonItem, true); } showOnScreenMsg(player, NpcStringId.LIFE_STONE_FROM_THE_BEGINNING_ACQUIRED, 2, 6000); - } - else - { + } else { showOnScreenMsg(player, NpcStringId.WHEN_INVENTORY_WEIGHT_NUMBER_ARE_MORE_THAN_80_THE_LIFE_STONE_FROM_THE_BEGINNING_CANNOT_BE_ACQUIRED, 2, 6000); } } @@ -483,32 +389,24 @@ public final class PrimevalIsle extends AbstractNpcAI } @Override - public String onSpawn(L2Npc npc) - { - if (Util.contains(SPRIGNANT, npc.getId())) - { + public String onSpawn(L2Npc npc) { + if (Util.contains(SPRIGNANT, npc.getId())) { startQuestTimer("USE_SKILL", 15000, npc, null); - } - else if (Util.contains(TREX, npc.getId())) - { + } else if (Util.contains(TREX, npc.getId())) { final int collectGhost = npc.getTemplate().getParameters().getInt("CollectGhost", 0); final int collectDespawn = npc.getTemplate().getParameters().getInt("CollectGhostDespawnTime", 30); - if (collectGhost == 1) - { + if (collectGhost == 1) { startQuestTimer("GHOST_DESPAWN", collectDespawn * 60000, npc, null); } - } - else - { + } else { npc.getVariables().set("SELFBUFF_USED", 0); npc.getVariables().set("SKILL_MULTIPLER", 1); } return super.onSpawn(npc); } - public static void main(String[] args) - { + public static void main(String[] args) { new PrimevalIsle(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/PrisonGuards.java b/src/main/java/com/l2jserver/datapack/ai/group_template/PrisonGuards.java index 5bcd0f47dd..03df2b8be1 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/PrisonGuards.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/PrisonGuards.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Prison Guards AI. * @author St3eT */ -public final class PrisonGuards extends AbstractNpcAI -{ +public final class PrisonGuards extends AbstractNpcAI { // NPCs private static final int GUARD_HEAD = 18367; // Prison Guard private static final int GUARD = 18368; // Prison Guard @@ -44,8 +43,7 @@ public final class PrisonGuards extends AbstractNpcAI private static final SkillHolder STONE = new SkillHolder(4578); // Petrification private static final SkillHolder SILENCE = new SkillHolder(4098, 9); // Silence - private PrisonGuards() - { + private PrisonGuards() { super(PrisonGuards.class.getSimpleName(), "ai/group_template"); addAttackId(GUARD_HEAD, GUARD); addSpawnId(GUARD_HEAD, GUARD); @@ -55,16 +53,11 @@ public final class PrisonGuards extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equals("CLEAR_STATUS")) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equals("CLEAR_STATUS")) { npc.setScriptValue(0); - } - else if (event.equals("CHECK_HOME")) - { - if ((npc.calculateDistance(npc.getSpawn().getLocation(), false, false) > 10) && !npc.isInCombat() && !npc.isDead()) - { + } else if (event.equals("CHECK_HOME")) { + if ((npc.calculateDistance(npc.getSpawn().getLocation(), false, false) > 10) && !npc.isInCombat() && !npc.isDead()) { npc.teleToLocation(npc.getSpawn().getLocation()); } startQuestTimer("CHECK_HOME", 30000, npc, null); @@ -73,33 +66,23 @@ public final class PrisonGuards extends AbstractNpcAI } @Override - public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isSummon) - { - if (npc.getId() == GUARD_HEAD) - { - if (player.isAffectedBySkill(TIMER)) - { - if ((getRandom(100) < 10) && (npc.calculateDistance(player, true, false) < 100)) - { - if ((getQuestItemsCount(player, STAMP) <= 3) && npc.isScriptValue(0)) - { + public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isSummon) { + if (npc.getId() == GUARD_HEAD) { + if (player.isAffectedBySkill(TIMER)) { + if ((getRandom(100) < 10) && (npc.calculateDistance(player, true, false) < 100)) { + if ((getQuestItemsCount(player, STAMP) <= 3) && npc.isScriptValue(0)) { giveItems(player, STAMP, 1); npc.setScriptValue(1); startQuestTimer("CLEAR_STATUS", 600000, npc, null); } } - } - else - { + } else { npc.setTarget(player); npc.doCast(STONE); broadcastNpcSay(npc, Say2.ALL, NpcStringId.ITS_NOT_EASY_TO_OBTAIN); } - } - else - { - if (!player.isAffectedBySkill(TIMER) && (npc.calculateDistance(npc.getSpawn().getLocation(), false, false) < 2000)) - { + } else { + if (!player.isAffectedBySkill(TIMER) && (npc.calculateDistance(npc.getSpawn().getLocation(), false, false) < 2000)) { npc.setTarget(player); npc.doCast(STONE); broadcastNpcSay(npc, Say2.ALL, NpcStringId.YOURE_OUT_OF_YOUR_MIND_COMING_HERE); @@ -109,10 +92,8 @@ public final class PrisonGuards extends AbstractNpcAI } @Override - public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) - { - if (!caster.isAffectedBySkill(TIMER)) - { + public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) { + if (!caster.isAffectedBySkill(TIMER)) { npc.setTarget(caster); npc.doCast(SILENCE); } @@ -120,10 +101,8 @@ public final class PrisonGuards extends AbstractNpcAI } @Override - public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) - { - if ((skill == SILENCE.getSkill()) || (skill == STONE.getSkill())) - { + public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) { + if ((skill == SILENCE.getSkill()) || (skill == STONE.getSkill())) { ((L2Attackable) npc).clearAggroList(); npc.setTarget(npc); } @@ -131,21 +110,16 @@ public final class PrisonGuards extends AbstractNpcAI } @Override - public boolean onNpcHate(L2Attackable mob, L2PcInstance player, boolean isSummon) - { + public boolean onNpcHate(L2Attackable mob, L2PcInstance player, boolean isSummon) { return player.isAffectedBySkill(TIMER); } @Override - public String onSpawn(L2Npc npc) - { - if (npc.getId() == GUARD_HEAD) - { + public String onSpawn(L2Npc npc) { + if (npc.getId() == GUARD_HEAD) { npc.setIsImmobilized(true); npc.setIsInvul(true); - } - else - { + } else { npc.setIsNoRndWalk(true); cancelQuestTimer("CHECK_HOME", npc, null); startQuestTimer("CHECK_HOME", 30000, npc, null); @@ -153,8 +127,7 @@ public final class PrisonGuards extends AbstractNpcAI return super.onSpawn(npc); } - public static void main(String[] args) - { + public static void main(String[] args) { new PrisonGuards(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/RaidBossCancel.java b/src/main/java/com/l2jserver/datapack/ai/group_template/RaidBossCancel.java index 6ce9036277..da8b3e5c25 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/RaidBossCancel.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/RaidBossCancel.java @@ -31,11 +31,9 @@ import com.l2jserver.gameserver.util.Util; * @author Adry_85 * @since 2.6.0.0 */ -public final class RaidBossCancel extends AbstractNpcAI -{ +public final class RaidBossCancel extends AbstractNpcAI { // Raid Bosses - private static final int[] RAID_BOSSES = - { + private static final int[] RAID_BOSSES = { 25019, // Pan Dryad 25050, // Verfa 25063, // Chertuba of Great Soul @@ -103,37 +101,31 @@ public final class RaidBossCancel extends AbstractNpcAI 29095, // Gordon }; - public RaidBossCancel() - { + public RaidBossCancel() { super(RaidBossCancel.class.getSimpleName(), "ai/group_template"); addAttackId(RAID_BOSSES); addSkillSeeId(RAID_BOSSES); } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { final SkillHolder selfRangeCancel = npc.getTemplate().getParameters().getObject("SelfRangeCancel_a", SkillHolder.class); - if (Util.checkIfInRange(150, npc, attacker, true) && (getRandom(750) < 1)) - { + if (Util.checkIfInRange(150, npc, attacker, true) && (getRandom(750) < 1)) { addSkillCastDesire(npc, attacker, selfRangeCancel, 1000000L); } return super.onAttack(npc, attacker, damage, isSummon); } @Override - public String onSkillSee(L2Npc npc, L2PcInstance player, Skill skill, L2Object[] targets, boolean isSummon) - { + public String onSkillSee(L2Npc npc, L2PcInstance player, Skill skill, L2Object[] targets, boolean isSummon) { final SkillHolder selfRangeCancel = npc.getTemplate().getParameters().getObject("SelfRangeCancel_a", SkillHolder.class); - if (Util.checkIfInRange(150, npc, player, true) && (getRandom(750) < 1)) - { + if (Util.checkIfInRange(150, npc, player, true) && (getRandom(750) < 1)) { addSkillCastDesire(npc, player, selfRangeCancel, 1000000L); } return super.onSkillSee(npc, player, skill, targets, isSummon); } - public static void main(String[] args) - { + public static void main(String[] args) { new RaidBossCancel(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/RandomSpawn.java b/src/main/java/com/l2jserver/datapack/ai/group_template/RandomSpawn.java index 13a8772a7c..9396f24de8 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/RandomSpawn.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/RandomSpawn.java @@ -30,22 +30,18 @@ import com.l2jserver.gameserver.model.actor.L2Npc; * Manages spawn of NPCs having several random spawn points. * @author GKR */ -public final class RandomSpawn extends AbstractNpcAI -{ +public final class RandomSpawn extends AbstractNpcAI { private static final Map<Integer, Location[]> SPAWN_POINTS = new HashMap<>(); - static - { + static { // Keltas - SPAWN_POINTS.put(22341, new Location[] - { + SPAWN_POINTS.put(22341, new Location[] { new Location(-27136, 250938, -3523), new Location(-29658, 252897, -3523), new Location(-27237, 251943, -3527), new Location(-28868, 250113, -3479) }); // Keymaster - SPAWN_POINTS.put(22361, new Location[] - { + SPAWN_POINTS.put(22361, new Location[] { new Location(14091, 250533, -1940), new Location(15762, 252440, -2015), new Location(19836, 256212, -2090), @@ -53,8 +49,7 @@ public final class RandomSpawn extends AbstractNpcAI new Location(17299, 252943, -2015), }); // Typhoon - SPAWN_POINTS.put(25539, new Location[] - { + SPAWN_POINTS.put(25539, new Location[] { new Location(-20641, 255370, -3235), new Location(-16157, 250993, -3058), new Location(-18269, 250721, -3151), @@ -67,8 +62,7 @@ public final class RandomSpawn extends AbstractNpcAI new Location(-4883, 253171, -3322) }); // Mutated Elpy - SPAWN_POINTS.put(25604, new Location[] - { + SPAWN_POINTS.put(25604, new Location[] { new Location(-46080, 246368, -14183), new Location(-44816, 246368, -14183), new Location(-44224, 247440, -14184), @@ -78,45 +72,38 @@ public final class RandomSpawn extends AbstractNpcAI }); } - public RandomSpawn() - { + public RandomSpawn() { super(RandomSpawn.class.getSimpleName(), "ai/group_template"); addSpawnId(SPAWN_POINTS.keySet()); } @Override - public final String onSpawn(L2Npc npc) - { + public final String onSpawn(L2Npc npc) { final Location[] spawnlist = SPAWN_POINTS.get(npc.getId()); final Location loc = spawnlist[getRandom(spawnlist.length)]; - if (!npc.isInsideRadius(loc, 200, false, false)) - { + if (!npc.isInsideRadius(loc, 200, false, false)) { npc.getSpawn().setLocation(loc); ThreadPoolManager.getInstance().scheduleGeneral(new Teleport(npc, loc), 100); } return super.onSpawn(npc); } - private static class Teleport implements Runnable - { + private static class Teleport implements Runnable { private final L2Npc _npc; private final Location _loc; - public Teleport(L2Npc npc, Location loc) - { + public Teleport(L2Npc npc, Location loc) { _npc = npc; _loc = loc; } @Override - public void run() - { + public void run() { _npc.teleToLocation(_loc, false); } } - public static void main(String[] args) - { + public static void main(String[] args) { new RandomSpawn(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/RangeGuard.java b/src/main/java/com/l2jserver/datapack/ai/group_template/RangeGuard.java index 804fb17682..cec4776108 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/RangeGuard.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/RangeGuard.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.util.Util; * Range Guard AI. * @author St3eT. */ -public final class RangeGuard extends AbstractNpcAI -{ +public final class RangeGuard extends AbstractNpcAI { // Skill private static final SkillHolder ULTIMATE_DEFENSE = new SkillHolder(5044, 3); // NPC Ultimate Defense //@formatter:off @@ -79,32 +78,25 @@ public final class RangeGuard extends AbstractNpcAI // Misc private static final int MIN_DISTANCE = 150; - private RangeGuard() - { + private RangeGuard() { super(RangeGuard.class.getSimpleName(), "ai/group_template"); - for (L2NpcTemplate template : NpcData.getInstance().getAllNpcOfClassType("L2Monster")) - { - if (template.getParameters().getInt("LongRangeGuardRate", -1) > 0) - { + for (L2NpcTemplate template : NpcData.getInstance().getAllNpcOfClassType("L2Monster")) { + if (template.getParameters().getInt("LongRangeGuardRate", -1) > 0) { addAttackId(template.getId()); } } } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) { final L2Playable playable = (isSummon) ? attacker.getSummon() : attacker; final int longRangeGuardRate = npc.getTemplate().getParameters().getInt("LongRangeGuardRate"); final double distance = Util.calculateDistance(npc, playable, true, false); - if (npc.isAffectedBySkill(ULTIMATE_DEFENSE.getSkillId()) && (distance <= MIN_DISTANCE)) - { + if (npc.isAffectedBySkill(ULTIMATE_DEFENSE.getSkillId()) && (distance <= MIN_DISTANCE)) { npc.stopSkillEffects(true, ULTIMATE_DEFENSE.getSkillId()); - } - else if ((distance > MIN_DISTANCE) && !npc.isSkillDisabled(ULTIMATE_DEFENSE.getSkillId()) && !((skill != null) && Util.contains(NOT_ALLOWED_SKILLS, skill.getId())) && (getRandom(100) < longRangeGuardRate)) - { + } else if ((distance > MIN_DISTANCE) && !npc.isSkillDisabled(ULTIMATE_DEFENSE.getSkillId()) && !((skill != null) && Util.contains(NOT_ALLOWED_SKILLS, skill.getId())) && (getRandom(100) < longRangeGuardRate)) { final L2Object target = npc.getTarget(); npc.setTarget(npc); npc.doCast(ULTIMATE_DEFENSE); @@ -113,8 +105,7 @@ public final class RangeGuard extends AbstractNpcAI return super.onAttack(npc, attacker, damage, isSummon, skill); } - public static void main(String[] args) - { + public static void main(String[] args) { new RangeGuard(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/Remnants.java b/src/main/java/com/l2jserver/datapack/ai/group_template/Remnants.java index ad089a59a2..b81f392d5d 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/Remnants.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/Remnants.java @@ -28,10 +28,8 @@ import com.l2jserver.gameserver.model.skills.Skill; * Remnants AI. * @author DS */ -public final class Remnants extends AbstractNpcAI -{ - private static final int[] NPCS = - { +public final class Remnants extends AbstractNpcAI { + private static final int[] NPCS = { 18463, 18464, 18465 @@ -41,8 +39,7 @@ public final class Remnants extends AbstractNpcAI // TODO: Find retail strings. // private static final String MSG = "The holy water affects Remnants Ghost. You have freed his soul."; // private static final String MSG_DEREK = "The holy water affects Derek. You have freed his soul."; - private Remnants() - { + private Remnants() { super(Remnants.class.getSimpleName(), "ai/group_template"); addSpawnId(NPCS); addSkillSeeId(NPCS); @@ -50,21 +47,16 @@ public final class Remnants extends AbstractNpcAI } @Override - public final String onSpawn(L2Npc npc) - { + public final String onSpawn(L2Npc npc) { npc.setIsMortal(false); return super.onSpawn(npc); } @Override - public final String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) - { - if (skill.getId() == SKILL_HOLY_WATER) - { - if (!npc.isDead()) - { - if ((targets.length > 0) && (targets[0] == npc)) - { + public final String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) { + if (skill.getId() == SKILL_HOLY_WATER) { + if (!npc.isDead()) { + if ((targets.length > 0) && (targets[0] == npc)) { if (npc.getCurrentHp() < (npc.getMaxHp() * 0.02)) // Lower, than 2% { npc.doDie(caster); @@ -85,8 +77,7 @@ public final class Remnants extends AbstractNpcAI return super.onSkillSee(npc, caster, skill, targets, isSummon); } - public static void main(String[] args) - { + public static void main(String[] args) { new Remnants(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/Sandstorms.java b/src/main/java/com/l2jserver/datapack/ai/group_template/Sandstorms.java index 7a7e67688e..d8f483f948 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/Sandstorms.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/Sandstorms.java @@ -27,29 +27,25 @@ import com.l2jserver.gameserver.model.holders.SkillHolder; * Sandstorms AI. * @author Ectis */ -public class Sandstorms extends AbstractNpcAI -{ +public class Sandstorms extends AbstractNpcAI { // NPCs private static final int SANDSTORM = 32350; // Skills private static final SkillHolder GUST = new SkillHolder(5435); // Gust - public Sandstorms() - { + public Sandstorms() { super(Sandstorms.class.getSimpleName(), "ai/group_template"); addAggroRangeEnterId(SANDSTORM); // Sandstorm } @Override - public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) { npc.setTarget(player); npc.doCast(GUST); return super.onAggroRangeEnter(npc, player, isSummon); } - public static void main(String[] args) - { + public static void main(String[] args) { new Sandstorms(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/SeeThroughSilentMove.java b/src/main/java/com/l2jserver/datapack/ai/group_template/SeeThroughSilentMove.java index cf4134de3c..00a16f743e 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/SeeThroughSilentMove.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/SeeThroughSilentMove.java @@ -26,8 +26,7 @@ import com.l2jserver.gameserver.model.actor.L2Npc; * See Through Silent Move AI. * @author Gigiikun */ -public class SeeThroughSilentMove extends AbstractNpcAI -{ +public class SeeThroughSilentMove extends AbstractNpcAI { //@formatter:off private static final int[] MONSTERS = { @@ -39,24 +38,20 @@ public class SeeThroughSilentMove extends AbstractNpcAI }; //@formatter:on - private SeeThroughSilentMove() - { + private SeeThroughSilentMove() { super(SeeThroughSilentMove.class.getSimpleName(), "ai/group_template"); addSpawnId(MONSTERS); } @Override - public String onSpawn(L2Npc npc) - { - if (npc.isAttackable()) - { + public String onSpawn(L2Npc npc) { + if (npc.isAttackable()) { ((L2Attackable) npc).setSeeThroughSilentMove(true); } return super.onSpawn(npc); } - public static void main(String[] args) - { + public static void main(String[] args) { new SeeThroughSilentMove(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/SelMahumDrill.java b/src/main/java/com/l2jserver/datapack/ai/group_template/SelMahumDrill.java index 3515d77333..de5c524a32 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/SelMahumDrill.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/SelMahumDrill.java @@ -35,17 +35,14 @@ import com.l2jserver.gameserver.util.Util; * Sel Mahum Training Ground AI for drill groups. * @author GKR */ -public final class SelMahumDrill extends AbstractNpcAI -{ - private static final int[] MAHUM_CHIEFS = - { +public final class SelMahumDrill extends AbstractNpcAI { + private static final int[] MAHUM_CHIEFS = { 22775, // Sel Mahum Drill Sergeant 22776, // Sel Mahum Training Officer 22778, // Sel Mahum Drill Sergeant }; - private static final int[] MAHUM_SOLDIERS = - { + private static final int[] MAHUM_SOLDIERS = { 22780, // Sel Mahum Recruit 22782, // Sel Mahum Recruit 22783, // Sel Mahum Soldier @@ -53,30 +50,26 @@ public final class SelMahumDrill extends AbstractNpcAI 22785, // Sel Mahum Soldier }; - private static final int[] CHIEF_SOCIAL_ACTIONS = - { + private static final int[] CHIEF_SOCIAL_ACTIONS = { 1, 4, 5, 7 }; - private static final Actions[] SOLDIER_SOCIAL_ACTIONS = - { + private static final Actions[] SOLDIER_SOCIAL_ACTIONS = { Actions.SCE_TRAINING_ACTION_A, Actions.SCE_TRAINING_ACTION_B, Actions.SCE_TRAINING_ACTION_C, Actions.SCE_TRAINING_ACTION_D }; - private static final NpcStringId[] CHIEF_FSTRINGS = - { + private static final NpcStringId[] CHIEF_FSTRINGS = { NpcStringId.HOW_DARE_YOU_ATTACK_MY_RECRUITS, NpcStringId.WHO_IS_DISRUPTING_THE_ORDER }; - private static final NpcStringId[] SOLDIER_FSTRINGS = - { + private static final NpcStringId[] SOLDIER_FSTRINGS = { NpcStringId.THE_DRILLMASTER_IS_DEAD, NpcStringId.LINE_UP_THE_RANKS }; @@ -84,8 +77,7 @@ public final class SelMahumDrill extends AbstractNpcAI // Chiefs event broadcast range private static final int TRAINING_RANGE = 1000; - private static enum Actions - { + private static enum Actions { SCE_TRAINING_ACTION_A(4, -1, 2, 2333), SCE_TRAINING_ACTION_B(1, -1, 2, 4333), SCE_TRAINING_ACTION_C(6, 5, 4, 1000), @@ -96,37 +88,31 @@ public final class SelMahumDrill extends AbstractNpcAI private final int _repeatCount; private final int _repeatInterval; - private Actions(int socialActionId, int altSocialActionId, int repeatCount, int repeatInterval) - { + private Actions(int socialActionId, int altSocialActionId, int repeatCount, int repeatInterval) { _socialActionId = socialActionId; _altSocialActionId = altSocialActionId; _repeatCount = repeatCount; _repeatInterval = repeatInterval; } - protected int getSocialActionId() - { + protected int getSocialActionId() { return _socialActionId; } - protected int getAltSocialActionId() - { + protected int getAltSocialActionId() { return _altSocialActionId; } - protected int getRepeatCount() - { + protected int getRepeatCount() { return _repeatCount; } - protected int getRepeatInterval() - { + protected int getRepeatInterval() { return _repeatInterval; } } - private SelMahumDrill() - { + private SelMahumDrill() { super(SelMahumDrill.class.getSimpleName(), "ai/group_template"); addAttackId(MAHUM_SOLDIERS); @@ -140,21 +126,14 @@ public final class SelMahumDrill extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { - case "do_social_action": - { - if ((npc != null) && !npc.isDead()) - { - if (Util.contains(MAHUM_CHIEFS, npc.getId())) - { - if ((npc.getVariables().getInt("BUSY_STATE") == 0) && (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_ACTIVE) && npc.staysInSpawnLoc()) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { + case "do_social_action": { + if ((npc != null) && !npc.isDead()) { + if (Util.contains(MAHUM_CHIEFS, npc.getId())) { + if ((npc.getVariables().getInt("BUSY_STATE") == 0) && (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_ACTIVE) && npc.staysInSpawnLoc()) { final int idx = getRandom(6); - if (idx <= (CHIEF_SOCIAL_ACTIONS.length - 1)) - { + if (idx <= (CHIEF_SOCIAL_ACTIONS.length - 1)) { npc.broadcastSocialAction(CHIEF_SOCIAL_ACTIONS[idx]); npc.getVariables().set("SOCIAL_ACTION_NEXT_INDEX", idx); // Pass social action index to soldiers via script value npc.broadcastEvent("do_social_action", TRAINING_RANGE, null); @@ -162,32 +141,25 @@ public final class SelMahumDrill extends AbstractNpcAI } startQuestTimer("do_social_action", 15000, npc, null); - } - else if (Util.contains(MAHUM_SOLDIERS, npc.getId())) - { + } else if (Util.contains(MAHUM_SOLDIERS, npc.getId())) { handleSocialAction(npc, SOLDIER_SOCIAL_ACTIONS[npc.getVariables().getInt("SOCIAL_ACTION_NEXT_INDEX")], false); } } break; } - case "reset_busy_state": - { - if (npc != null) - { + case "reset_busy_state": { + if (npc != null) { npc.getVariables().remove("BUSY_STATE"); npc.disableCoreAI(false); } break; } - case "return_home": - { - for (int npcId : MAHUM_SOLDIERS) - { - for (L2Spawn npcSpawn : SpawnTable.getInstance().getSpawns(npcId)) - { + case "return_home": { + for (int npcId : MAHUM_SOLDIERS) { + for (L2Spawn npcSpawn : SpawnTable.getInstance().getSpawns(npcId)) { final L2Npc soldier = npcSpawn.getLastSpawn(); - if ((soldier != null) && !soldier.isDead() && (npcSpawn.getName() != null) && npcSpawn.getName().startsWith("smtg_drill_group") && !soldier.staysInSpawnLoc() && ((soldier.getAI().getIntention() == CtrlIntention.AI_INTENTION_ACTIVE) || (soldier.getAI().getIntention() == CtrlIntention.AI_INTENTION_IDLE))) - { + if ((soldier != null) && !soldier.isDead() && (npcSpawn.getName() != null) && npcSpawn.getName().startsWith("smtg_drill_group") && !soldier.staysInSpawnLoc() + && ((soldier.getAI().getIntention() == CtrlIntention.AI_INTENTION_ACTIVE) || (soldier.getAI().getIntention() == CtrlIntention.AI_INTENTION_IDLE))) { soldier.setHeading(npcSpawn.getHeading()); soldier.teleToLocation(npcSpawn.getLocation(), false); } @@ -200,42 +172,31 @@ public final class SelMahumDrill extends AbstractNpcAI } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (getRandom(10) < 1) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (getRandom(10) < 1) { npc.broadcastEvent("ATTACKED", 1000, null); } return super.onAttack(npc, attacker, damage, isSummon); } @Override - public String onEventReceived(String eventName, L2Npc sender, L2Npc receiver, L2Object reference) - { - if ((receiver != null) && !receiver.isDead() && receiver.isInMySpawnGroup(sender)) - { - switch (eventName) - { - case "do_social_action": - { - if (Util.contains(MAHUM_SOLDIERS, receiver.getId())) - { + public String onEventReceived(String eventName, L2Npc sender, L2Npc receiver, L2Object reference) { + if ((receiver != null) && !receiver.isDead() && receiver.isInMySpawnGroup(sender)) { + switch (eventName) { + case "do_social_action": { + if (Util.contains(MAHUM_SOLDIERS, receiver.getId())) { final int actionIndex = sender.getVariables().getInt("SOCIAL_ACTION_NEXT_INDEX"); receiver.getVariables().set("SOCIAL_ACTION_NEXT_INDEX", actionIndex); handleSocialAction(receiver, SOLDIER_SOCIAL_ACTIONS[actionIndex], true); } break; } - case "CHIEF_DIED": - { - if (Util.contains(MAHUM_SOLDIERS, receiver.getId())) - { - if (getRandom(4) < 1) - { + case "CHIEF_DIED": { + if (Util.contains(MAHUM_SOLDIERS, receiver.getId())) { + if (getRandom(4) < 1) { broadcastNpcSay(receiver, Say2.NPC_ALL, SOLDIER_FSTRINGS[getRandom(2)]); } - if (receiver.canBeAttacked()) - { + if (receiver.canBeAttacked()) { ((L2Attackable) receiver).clearAggroList(); } receiver.disableCoreAI(true); @@ -246,10 +207,8 @@ public final class SelMahumDrill extends AbstractNpcAI } break; } - case "ATTACKED": - { - if (Util.contains(MAHUM_CHIEFS, receiver.getId())) - { + case "ATTACKED": { + if (Util.contains(MAHUM_CHIEFS, receiver.getId())) { broadcastNpcSay(receiver, Say2.NPC_ALL, CHIEF_FSTRINGS[getRandom(2)]); } break; @@ -260,22 +219,18 @@ public final class SelMahumDrill extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { npc.broadcastEvent("CHIEF_DIED", TRAINING_RANGE, null); return null; } @Override - public String onSpawn(L2Npc npc) - { - if (Util.contains(MAHUM_CHIEFS, npc.getId())) - { + public String onSpawn(L2Npc npc) { + if (Util.contains(MAHUM_CHIEFS, npc.getId())) { startQuestTimer("do_social_action", 15000, npc, null); } - else if ((getRandom(18) < 1) && Util.contains(MAHUM_SOLDIERS, npc.getId())) - { + else if ((getRandom(18) < 1) && Util.contains(MAHUM_SOLDIERS, npc.getId())) { npc.getVariables().set("SOCIAL_ACTION_ALT_BEHAVIOR", 1); } @@ -284,37 +239,31 @@ public final class SelMahumDrill extends AbstractNpcAI return super.onSpawn(npc); } - private void handleSocialAction(L2Npc npc, Actions action, boolean firstCall) - { - if ((npc.getVariables().getInt("BUSY_STATE") != 0) || (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ACTIVE) || !npc.staysInSpawnLoc()) - { + private void handleSocialAction(L2Npc npc, Actions action, boolean firstCall) { + if ((npc.getVariables().getInt("BUSY_STATE") != 0) || (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ACTIVE) || !npc.staysInSpawnLoc()) { return; } final int socialActionId = (npc.getVariables().getInt("SOCIAL_ACTION_ALT_BEHAVIOR") == 0) ? action.getSocialActionId() : action.getAltSocialActionId(); - if (socialActionId < 0) - { + if (socialActionId < 0) { return; } - if (firstCall) - { + if (firstCall) { npc.getVariables().set("SOCIAL_ACTION_REMAINED_COUNT", action.getRepeatCount()); } npc.broadcastSocialAction(socialActionId); final int remainedCount = npc.getVariables().getInt("SOCIAL_ACTION_REMAINED_COUNT"); - if (remainedCount > 0) - { + if (remainedCount > 0) { npc.getVariables().set("SOCIAL_ACTION_REMAINED_COUNT", (remainedCount - 1)); startQuestTimer("do_social_action", action.getRepeatInterval(), npc, null); } } - public static void main(String[] args) - { + public static void main(String[] args) { new SelMahumDrill(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/SelMahumSquad.java b/src/main/java/com/l2jserver/datapack/ai/group_template/SelMahumSquad.java index 5282228029..a7c7cbfe94 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/SelMahumSquad.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/SelMahumSquad.java @@ -36,8 +36,7 @@ import com.l2jserver.gameserver.util.Util; * Sel Mahum Training Ground AI for squads and chefs. * @author GKR */ -public final class SelMahumSquad extends AbstractNpcAI -{ +public final class SelMahumSquad extends AbstractNpcAI { // NPC's private static final int CHEF = 18908; private static final int FIRE = 18927; @@ -53,15 +52,13 @@ public final class SelMahumSquad extends AbstractNpcAI private static final SkillHolder SOUP_OF_FAILURE = new SkillHolder(6688); // Sel Mahum Squad Leaders - private static final int[] SQUAD_LEADERS = - { + private static final int[] SQUAD_LEADERS = { 22786, 22787, 22788 }; - private static final NpcStringId[] CHEF_FSTRINGS = - { + private static final NpcStringId[] CHEF_FSTRINGS = { NpcStringId.I_BROUGHT_THE_FOOD, NpcStringId.COME_AND_EAT }; @@ -73,8 +70,7 @@ public final class SelMahumSquad extends AbstractNpcAI private static final int MAHUM_EFFECT_SLEEP = 2; private static final int MAHUM_EFFECT_NONE = 3; - private SelMahumSquad() - { + private SelMahumSquad() { super(SelMahumSquad.class.getSimpleName(), "ai/group_template"); addAttackId(CHEF); @@ -92,66 +88,51 @@ public final class SelMahumSquad extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { - case "chef_disable_reward": - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { + case "chef_disable_reward": { npc.getVariables().set("REWARD_TIME_GONE", 1); break; } - case "chef_heal_player": - { + case "chef_heal_player": { healPlayer(npc, player); break; } - case "chef_remove_invul": - { - if (npc.isMonster()) - { + case "chef_remove_invul": { + if (npc.isMonster()) { npc.setIsInvul(false); npc.getVariables().remove("INVUL_REMOVE_TIMER_STARTED"); - if ((player != null) && !player.isDead() && npc.getKnownList().knowsThePlayer(player)) - { + if ((player != null) && !player.isDead() && npc.getKnownList().knowsThePlayer(player)) { addAttackDesire(npc, player); } } break; } - case "chef_set_invul": - { - if (!npc.isDead()) - { + case "chef_set_invul": { + if (!npc.isDead()) { npc.setIsInvul(true); } break; } - case "fire": - { + case "fire": { startQuestTimer("fire", 30000 + getRandom(5000), npc, null); npc.setDisplayEffect(FIRE_EFFECT_NONE); - if (getRandom(GameTimeController.getInstance().isNight() ? 2 : 4) < 1) - { + if (getRandom(GameTimeController.getInstance().isNight() ? 2 : 4) < 1) { npc.setDisplayEffect(FIRE_EFFECT_BURN); // fire burns npc.broadcastEvent("SCE_CAMPFIRE_START", 600, null); - } - else - { + } else { npc.setDisplayEffect(FIRE_EFFECT_NONE); // fire goes out npc.broadcastEvent("SCE_CAMPFIRE_END", 600, null); } break; } - case "fire_arrived": - { + case "fire_arrived": { // myself.i_quest0 = 1; npc.setIsRunning(false); npc.setTarget(npc); - if (npc.isNoRndWalk()) - { + if (npc.isNoRndWalk()) { npc.doCast(CAMP_FIRE_TIRED); npc.setDisplayEffect(MAHUM_EFFECT_SLEEP); } @@ -164,27 +145,22 @@ public final class SelMahumSquad extends AbstractNpcAI startQuestTimer("remove_effects", 300000, npc, null); break; } - case "notify_dinner": - { + case "notify_dinner": { npc.broadcastEvent("SCE_DINNER_EAT", 600, null); break; } - case "remove_effects": - { + case "remove_effects": { // myself.i_quest0 = 0; npc.setIsRunning(true); npc.setDisplayEffect(MAHUM_EFFECT_NONE); break; } - case "reset_full_bottle_prize": - { + case "reset_full_bottle_prize": { npc.getVariables().remove("FULL_BARREL_REWARDING_PLAYER"); break; } - case "return_from_fire": - { - if (npc.isMonster() && !npc.isDead()) - { + case "return_from_fire": { + if (npc.isMonster() && !npc.isDead()) { ((L2MonsterInstance) npc).returnHome(); } break; @@ -194,12 +170,9 @@ public final class SelMahumSquad extends AbstractNpcAI } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) - { - if ((npc.getId() == CHEF) && (npc.getVariables().getInt("BUSY_STATE") == 0)) - { - if (npc.getVariables().getInt("INVUL_REMOVE_TIMER_STARTED") == 0) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) { + if ((npc.getId() == CHEF) && (npc.getVariables().getInt("BUSY_STATE") == 0)) { + if (npc.getVariables().getInt("INVUL_REMOVE_TIMER_STARTED") == 0) { startQuestTimer("chef_remove_invul", 180000, npc, attacker); startQuestTimer("chef_disable_reward", 60000, npc, null); npc.getVariables().set("INVUL_REMOVE_TIMER_STARTED", 1); @@ -207,30 +180,23 @@ public final class SelMahumSquad extends AbstractNpcAI startQuestTimer("chef_heal_player", 1000, npc, attacker); startQuestTimer("chef_set_invul", 60000, npc, null); npc.getVariables().set("BUSY_STATE", 1); - } - else if (Util.contains(SQUAD_LEADERS, npc.getId())) - { + } else if (Util.contains(SQUAD_LEADERS, npc.getId())) { handlePreAttackMotion(npc); } return super.onAttack(npc, attacker, damage, isSummon, skill); } @Override - public String onFactionCall(L2Npc npc, L2Npc caller, L2PcInstance attacker, boolean isSummon) - { + public String onFactionCall(L2Npc npc, L2Npc caller, L2PcInstance attacker, boolean isSummon) { handlePreAttackMotion(npc); return super.onFactionCall(npc, caller, attacker, isSummon); } @Override - public String onEventReceived(String eventName, L2Npc sender, L2Npc receiver, L2Object reference) - { - switch (eventName) - { - case "SCE_DINNER_CHECK": - { - if (receiver.getId() == FIRE) - { + public String onEventReceived(String eventName, L2Npc sender, L2Npc receiver, L2Object reference) { + switch (eventName) { + case "SCE_DINNER_CHECK": { + if (receiver.getId() == FIRE) { receiver.setDisplayEffect(FIRE_EFFECT_BURN); final L2Npc stove = addSpawn(STOVE, receiver.getX(), receiver.getY(), receiver.getZ() + 100, 0, false, 0); stove.setSummoner(receiver); @@ -239,10 +205,8 @@ public final class SelMahumSquad extends AbstractNpcAI } break; } - case "SCE_CAMPFIRE_START": - { - if (!receiver.isNoRndWalk() && !receiver.isDead() && (receiver.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) && Util.contains(SQUAD_LEADERS, receiver.getId())) - { + case "SCE_CAMPFIRE_START": { + if (!receiver.isNoRndWalk() && !receiver.isDead() && (receiver.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) && Util.contains(SQUAD_LEADERS, receiver.getId())) { receiver.setIsNoRndWalk(true); // Moving to fire - i_ai0 = 1 receiver.setIsRunning(true); final Location loc = sender.getPointInRange(100, 200); @@ -254,14 +218,10 @@ public final class SelMahumSquad extends AbstractNpcAI } break; } - case "SCE_CAMPFIRE_END": - { - if ((receiver.getId() == STOVE) && (receiver.getSummoner() == sender)) - { + case "SCE_CAMPFIRE_END": { + if ((receiver.getId() == STOVE) && (receiver.getSummoner() == sender)) { receiver.deleteMe(); - } - else if ((receiver.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) && Util.contains(SQUAD_LEADERS, receiver.getId())) - { + } else if ((receiver.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) && Util.contains(SQUAD_LEADERS, receiver.getId())) { receiver.setIsNoRndWalk(false); receiver.getVariables().remove("BUSY_STATE"); receiver.setRHandId(THS_Weapon); @@ -269,10 +229,8 @@ public final class SelMahumSquad extends AbstractNpcAI } break; } - case "SCE_DINNER_EAT": - { - if (!receiver.isDead() && (receiver.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) && (receiver.getVariables().getInt("BUSY_STATE", 0) == 0) && Util.contains(SQUAD_LEADERS, receiver.getId())) - { + case "SCE_DINNER_EAT": { + if (!receiver.isDead() && (receiver.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) && (receiver.getVariables().getInt("BUSY_STATE", 0) == 0) && Util.contains(SQUAD_LEADERS, receiver.getId())) { if (receiver.isNoRndWalk()) // i_ai0 == 1 { receiver.setRHandId(THS_Weapon); @@ -290,10 +248,8 @@ public final class SelMahumSquad extends AbstractNpcAI } break; } - case "SCE_SOUP_FAILURE": - { - if (Util.contains(SQUAD_LEADERS, receiver.getId())) - { + case "SCE_SOUP_FAILURE": { + if (Util.contains(SQUAD_LEADERS, receiver.getId())) { receiver.getVariables().set("FULL_BARREL_REWARDING_PLAYER", reference.getObjectId()); // TODO: Use it in 289 quest startQuestTimer("reset_full_bottle_prize", 180000, receiver, null); } @@ -304,10 +260,8 @@ public final class SelMahumSquad extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (npc.isMonster() && (npc.getVariables().getInt("REWARD_TIME_GONE") == 0)) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (npc.isMonster() && (npc.getVariables().getInt("REWARD_TIME_GONE") == 0)) { ((L2MonsterInstance) npc).dropItem(killer, 15492, 1); } cancelQuestTimer("chef_remove_invul", npc, null); @@ -318,27 +272,22 @@ public final class SelMahumSquad extends AbstractNpcAI } @Override - public void onMoveFinished(L2Npc npc) - { + public void onMoveFinished(L2Npc npc) { // Npc moves to fire - if (npc.isNoRndWalk() && (npc.getX() == npc.getVariables().getInt("DESTINATION_X")) && (npc.getY() == npc.getVariables().getInt("DESTINATION_Y"))) - { + if (npc.isNoRndWalk() && (npc.getX() == npc.getVariables().getInt("DESTINATION_X")) && (npc.getY() == npc.getVariables().getInt("DESTINATION_Y"))) { npc.setRHandId(OHS_Weapon); startQuestTimer("fire_arrived", 3000, npc, null); } } @Override - public void onNodeArrived(L2Npc npc) - { + public void onNodeArrived(L2Npc npc) { npc.broadcastEvent("SCE_DINNER_CHECK", 300, null); } @Override - public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) - { - if ((npc.getId() == STOVE) && (skill.getId() == 9075) && Util.contains(targets, npc)) - { + public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) { + if ((npc.getId() == STOVE) && (skill.getId() == 9075) && Util.contains(targets, npc)) { npc.doCast(SOUP_OF_FAILURE); npc.broadcastEvent("SCE_SOUP_FAILURE", 600, caster); } @@ -346,18 +295,12 @@ public final class SelMahumSquad extends AbstractNpcAI } @Override - public String onSpawn(L2Npc npc) - { - if (npc.getId() == CHEF) - { + public String onSpawn(L2Npc npc) { + if (npc.getId() == CHEF) { npc.setIsInvul(false); - } - else if (npc.getId() == FIRE) - { + } else if (npc.getId() == FIRE) { startQuestTimer("fire", 1000, npc, null); - } - else if (Util.contains(SQUAD_LEADERS, npc.getId())) - { + } else if (Util.contains(SQUAD_LEADERS, npc.getId())) { npc.setDisplayEffect(3); npc.setIsNoRndWalk(false); } @@ -365,24 +308,18 @@ public final class SelMahumSquad extends AbstractNpcAI } @Override - public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) - { - if ((skill != null) && (skill.getId() == 6330)) - { + public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) { + if ((skill != null) && (skill.getId() == 6330)) { healPlayer(npc, player); } return super.onSpellFinished(npc, player, skill); } - private void healPlayer(L2Npc npc, L2PcInstance player) - { - if ((player != null) && !player.isDead() && (npc.getVariables().getInt("INVUL_REMOVE_TIMER_STARTED") != 1) && ((npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_ATTACK) || (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_CAST))) - { + private void healPlayer(L2Npc npc, L2PcInstance player) { + if ((player != null) && !player.isDead() && (npc.getVariables().getInt("INVUL_REMOVE_TIMER_STARTED") != 1) && ((npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_ATTACK) || (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_CAST))) { npc.setTarget(player); npc.doCast(SALMON_PORRIDGE_ATTACK); - } - else - { + } else { cancelQuestTimer("chef_set_invul", npc, null); npc.getVariables().remove("BUSY_STATE"); npc.getVariables().remove("INVUL_REMOVE_TIMER_STARTED"); @@ -390,21 +327,18 @@ public final class SelMahumSquad extends AbstractNpcAI } } - private void handlePreAttackMotion(L2Npc attacked) - { + private void handlePreAttackMotion(L2Npc attacked) { cancelQuestTimer("remove_effects", attacked, null); attacked.getVariables().remove("BUSY_STATE"); attacked.setIsNoRndWalk(false); attacked.setDisplayEffect(MAHUM_EFFECT_NONE); - if (attacked.getRightHandItem() == OHS_Weapon) - { + if (attacked.getRightHandItem() == OHS_Weapon) { attacked.setRHandId(THS_Weapon); } // TODO: Check about i_quest0 } - public static void main(String[] args) - { + public static void main(String[] args) { new SelMahumSquad(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/SilentValley.java b/src/main/java/com/l2jserver/datapack/ai/group_template/SilentValley.java index b61758fb28..8e5b8c406f 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/SilentValley.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/SilentValley.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Silent Valley AI * @author malyelfik */ -public final class SilentValley extends AbstractNpcAI -{ +public final class SilentValley extends AbstractNpcAI { // Skills private static final SkillHolder BETRAYAL = new SkillHolder(6033); // Treasure Seeker's Betrayal private static final SkillHolder BLAZE = new SkillHolder(4157, 10); // NPC Blaze - Magic @@ -46,8 +45,7 @@ public final class SilentValley extends AbstractNpcAI private static final int CHEST = 18693; // Treasure Chest of the Ancient Giants private static final int GUARD1 = 18694; // Treasure Chest Guard private static final int GUARD2 = 18695; // Treasure Chest Guard - private static final int[] MOBS = - { + private static final int[] MOBS = { 20965, // Chimera Piece 20966, // Changed Creation 20967, // Past Creature @@ -59,8 +57,7 @@ public final class SilentValley extends AbstractNpcAI 20973, // Forgotten Ancient People }; - private SilentValley() - { + private SilentValley() { super(SilentValley.class.getSimpleName(), "ai/group_template"); addAttackId(MOBS); addAttackId(CHEST, GUARD1, GUARD2); @@ -72,12 +69,9 @@ public final class SilentValley extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if ((npc != null) && !npc.isDead()) - { - switch (event) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if ((npc != null) && !npc.isDead()) { + switch (event) { case "CLEAR": npc.doDie(null); break; @@ -94,21 +88,15 @@ public final class SilentValley extends AbstractNpcAI } @Override - public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isSummon) - { - switch (npc.getId()) - { - case CHEST: - { - if (!isSummon && npc.isScriptValue(0)) - { + public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isSummon) { + switch (npc.getId()) { + case CHEST: { + if (!isSummon && npc.isScriptValue(0)) { npc.setScriptValue(1); broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.YOU_WILL_BE_CURSED_FOR_SEEKING_THE_TREASURE); npc.setTarget(player); npc.doCast(BETRAYAL); - } - else if (isSummon || (getRandom(100) < CHEST_DIE_CHANCE)) - { + } else if (isSummon || (getRandom(100) < CHEST_DIE_CHANCE)) { npc.dropItem(player, SACK, 1); npc.broadcastEvent("CLEAR_ALL", 2000, null); npc.doDie(null); @@ -117,17 +105,14 @@ public final class SilentValley extends AbstractNpcAI break; } case GUARD1: - case GUARD2: - { + case GUARD2: { npc.setTarget(player); npc.doCast(BLAZE); addAttackDesire(npc, player); break; } - default: - { - if (isSummon) - { + default: { + if (isSummon) { addAttackDesire(npc, player); } } @@ -136,10 +121,8 @@ public final class SilentValley extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (getRandom(1000) < SPAWN_CHANCE) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (getRandom(1000) < SPAWN_CHANCE) { final int newZ = npc.getZ() + 100; addSpawn(GUARD2, npc.getX() + 100, npc.getY(), newZ, 0, false, 0); addSpawn(GUARD1, npc.getX() - 100, npc.getY(), newZ, 0, false, 0); @@ -150,19 +133,14 @@ public final class SilentValley extends AbstractNpcAI } @Override - public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) - { - if (creature.isPlayable()) - { + public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) { + if (creature.isPlayable()) { final L2PcInstance player = (isSummon) ? ((L2Summon) creature).getOwner() : creature.getActingPlayer(); - if ((npc.getId() == GUARD1) || (npc.getId() == GUARD2)) - { + if ((npc.getId() == GUARD1) || (npc.getId() == GUARD2)) { npc.setTarget(player); npc.doCast(BLAZE); addAttackDesire(npc, player); - } - else if (creature.isAffectedBySkill(BETRAYAL.getSkillId())) - { + } else if (creature.isAffectedBySkill(BETRAYAL.getSkillId())) { addAttackDesire(npc, player); } } @@ -170,27 +148,20 @@ public final class SilentValley extends AbstractNpcAI } @Override - public String onSpawn(L2Npc npc) - { - if (npc.getId() == CHEST) - { + public String onSpawn(L2Npc npc) { + if (npc.getId() == CHEST) { npc.setIsInvul(true); startQuestTimer("CLEAR_EVENT", 300000, npc, null); - } - else - { + } else { startQuestTimer("SPAWN_CHEST", 10000, npc, null); } return super.onSpawn(npc); } @Override - public String onEventReceived(String eventName, L2Npc sender, L2Npc receiver, L2Object reference) - { - if ((receiver != null) && !receiver.isDead()) - { - switch (eventName) - { + public String onEventReceived(String eventName, L2Npc sender, L2Npc receiver, L2Object reference) { + if ((receiver != null) && !receiver.isDead()) { + switch (eventName) { case "CLEAR_ALL": startQuestTimer("CLEAR", 60000, receiver, null); break; @@ -202,8 +173,7 @@ public final class SilentValley extends AbstractNpcAI return super.onEventReceived(eventName, sender, receiver, reference); } - public static void main(String[] args) - { + public static void main(String[] args) { new SilentValley(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/StakatoNest.java b/src/main/java/com/l2jserver/datapack/ai/group_template/StakatoNest.java index 03fc6fa264..857241b001 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/StakatoNest.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/StakatoNest.java @@ -35,8 +35,7 @@ import com.l2jserver.gameserver.util.Util; * Stakato Nest AI. * @author Gnacik */ -public final class StakatoNest extends AbstractNpcAI -{ +public final class StakatoNest extends AbstractNpcAI { // @formatter:off // List of all mobs just for register private static final int[] STAKATO_MOBS = @@ -83,27 +82,22 @@ public final class StakatoNest extends AbstractNpcAI // Skill private static final SkillHolder EATING_FOLLOWER_HEAL = new SkillHolder(4484); - private StakatoNest() - { + private StakatoNest() { super(StakatoNest.class.getSimpleName(), "ai/group_template"); registerMobs(STAKATO_MOBS); } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { final L2MonsterInstance mob = (L2MonsterInstance) npc; - if ((mob.getId() == STAKATO_LEADER) && (getRandom(1000) < 100) && (mob.getCurrentHp() < (mob.getMaxHp() * 0.3))) - { + if ((mob.getId() == STAKATO_LEADER) && (getRandom(1000) < 100) && (mob.getCurrentHp() < (mob.getMaxHp() * 0.3))) { final L2MonsterInstance _follower = checkMinion(npc); - if (_follower != null) - { + if (_follower != null) { double _hp = _follower.getCurrentHp(); - if (_hp > (_follower.getMaxHp() * 0.3)) - { + if (_hp > (_follower.getMaxHp() * 0.3)) { mob.abortAttack(); mob.abortCast(); mob.setHeading(Util.calculateHeadingFrom(mob, _follower)); @@ -118,18 +112,14 @@ public final class StakatoNest extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final L2MonsterInstance monster; - switch (npc.getId()) - { + switch (npc.getId()) { case STAKATO_NURSE: monster = checkMinion(npc); - if (monster != null) - { + if (monster != null) { Broadcast.toSelfAndKnownPlayers(npc, new MagicSkillUse(npc, 2046, 1, 1000, 0)); - for (int i = 0; i < 3; i++) - { + for (int i = 0; i < 3; i++) { L2Npc spawned = addSpawn(STAKATO_CAPTAIN, monster, true); addAttackDesire(spawned, killer); } @@ -137,18 +127,15 @@ public final class StakatoNest extends AbstractNpcAI break; case STAKATO_BABY: monster = ((L2MonsterInstance) npc).getLeader(); - if ((monster != null) && !monster.isDead()) - { + if ((monster != null) && !monster.isDead()) { startQuestTimer("nurse_change", 5000, monster, killer); } break; case STAKATO_MALE: monster = checkMinion(npc); - if (monster != null) - { + if (monster != null) { Broadcast.toSelfAndKnownPlayers(npc, new MagicSkillUse(npc, 2046, 1, 1000, 0)); - for (int i = 0; i < 3; i++) - { + for (int i = 0; i < 3; i++) { L2Npc spawned = addSpawn(STAKATO_GUARD, monster, true); addAttackDesire(spawned, killer); } @@ -156,22 +143,17 @@ public final class StakatoNest extends AbstractNpcAI break; case STAKATO_FEMALE: monster = ((L2MonsterInstance) npc).getLeader(); - if ((monster != null) && !monster.isDead()) - { + if ((monster != null) && !monster.isDead()) { startQuestTimer("male_change", 5000, monster, killer); } break; case STAKATO_CHIEF: - if (killer.isInParty()) - { + if (killer.isInParty()) { List<L2PcInstance> party = killer.getParty().getMembers(); - for (L2PcInstance member : party) - { + for (L2PcInstance member : party) { giveCocoon(member, npc); } - } - else - { + } else { giveCocoon(killer, npc); } break; @@ -180,10 +162,8 @@ public final class StakatoNest extends AbstractNpcAI } @Override - public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) - { - if (Util.contains(COCOONS, npc.getId()) && Util.contains(targets, npc) && (skill.getId() == GROWTH_ACCELERATOR)) - { + public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) { + if (Util.contains(COCOONS, npc.getId()) && Util.contains(targets, npc) && (skill.getId() == GROWTH_ACCELERATOR)) { npc.doDie(caster); final L2Npc spawned = addSpawn(STAKATO_CHIEF, npc.getX(), npc.getY(), npc.getZ(), Util.calculateHeadingFrom(npc, caster), false, 0, true); addAttackDesire(spawned, caster); @@ -192,16 +172,13 @@ public final class StakatoNest extends AbstractNpcAI } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if ((npc == null) || (player == null) || npc.isDead()) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if ((npc == null) || (player == null) || npc.isDead()) { return null; } int npcId = 0; - switch (event) - { + switch (event) { case "nurse_change": npcId = STAKATO_NURSE_2; break; @@ -209,8 +186,7 @@ public final class StakatoNest extends AbstractNpcAI npcId = STAKATO_MALE_2; break; } - if (npcId > 0) - { + if (npcId > 0) { npc.getSpawn().decreaseCount(npc); npc.deleteMe(); final L2Npc spawned = addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0, true); @@ -219,27 +195,22 @@ public final class StakatoNest extends AbstractNpcAI return super.onAdvEvent(event, npc, player); } - private static L2MonsterInstance checkMinion(L2Npc npc) - { + private static L2MonsterInstance checkMinion(L2Npc npc) { final L2MonsterInstance mob = (L2MonsterInstance) npc; - if (mob.hasMinions()) - { + if (mob.hasMinions()) { final List<L2MonsterInstance> minion = mob.getMinionList().getSpawnedMinions(); - if ((minion != null) && !minion.isEmpty() && (minion.get(0) != null) && !minion.get(0).isDead()) - { + if ((minion != null) && !minion.isEmpty() && (minion.get(0) != null) && !minion.get(0).isDead()) { return minion.get(0); } } return null; } - private static void giveCocoon(L2PcInstance player, L2Npc npc) - { + private static void giveCocoon(L2PcInstance player, L2Npc npc) { player.addItem("StakatoCocoon", ((getRandom(100) > 80) ? LARGE_COCOON : SMALL_COCOON), 1, npc, true); } - public static void main(String[] args) - { + public static void main(String[] args) { new StakatoNest(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/SummonPc.java b/src/main/java/com/l2jserver/datapack/ai/group_template/SummonPc.java index ffa711601d..cb69e04369 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/SummonPc.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/SummonPc.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.skills.Skill; * Summon the player to the NPC on attack. * @author Zoey76 */ -public final class SummonPc extends AbstractNpcAI -{ +public final class SummonPc extends AbstractNpcAI { // NPCs private static final int PORTA = 20213; private static final int PERUM = 20221; @@ -41,38 +40,29 @@ public final class SummonPc extends AbstractNpcAI private static final int MIN_DISTANCE = 300; private static final int MIN_DISTANCE_MOST_HATED = 100; - private SummonPc() - { + private SummonPc() { super(SummonPc.class.getSimpleName(), "ai/group_template"); addAttackId(PORTA, PERUM); addSpellFinishedId(PORTA, PERUM); } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { final boolean attacked = npc.getVariables().getBoolean("attacked", false); - if (attacked) - { + if (attacked) { return super.onAttack(npc, attacker, damage, isSummon); } final int chance = getRandom(100); final double distance = npc.calculateDistance(attacker, true, false); - if (distance > MIN_DISTANCE) - { - if (chance < 50) - { + if (distance > MIN_DISTANCE) { + if (chance < 50) { doSummonPc(npc, attacker); } - } - else if (distance > MIN_DISTANCE_MOST_HATED) - { + } else if (distance > MIN_DISTANCE_MOST_HATED) { final L2Attackable monster = (L2Attackable) npc; - if (monster.getMostHated() != null) - { - if (((monster.getMostHated() == attacker) && (chance < 50)) || (chance < 10)) - { + if (monster.getMostHated() != null) { + if (((monster.getMostHated() == attacker) && (chance < 50)) || (chance < 10)) { doSummonPc(npc, attacker); } } @@ -81,10 +71,8 @@ public final class SummonPc extends AbstractNpcAI } @Override - public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) - { - if ((skill.getId() == SUMMON_PC.getSkillId()) && !npc.isDead() && npc.getVariables().getBoolean("attacked", false)) - { + public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) { + if ((skill.getId() == SUMMON_PC.getSkillId()) && !npc.isDead() && npc.getVariables().getBoolean("attacked", false)) { player.teleToLocation(npc); npc.getVariables().set("attacked", false); @@ -94,18 +82,15 @@ public final class SummonPc extends AbstractNpcAI return super.onSpellFinished(npc, player, skill); } - private static void doSummonPc(L2Npc npc, L2PcInstance attacker) - { - if ((SUMMON_PC.getSkill().getMpConsume2() < npc.getCurrentMp()) && (SUMMON_PC.getSkill().getHpConsume() < npc.getCurrentHp()) && !npc.isSkillDisabled(SUMMON_PC.getSkill())) - { + private static void doSummonPc(L2Npc npc, L2PcInstance attacker) { + if ((SUMMON_PC.getSkill().getMpConsume2() < npc.getCurrentMp()) && (SUMMON_PC.getSkill().getHpConsume() < npc.getCurrentHp()) && !npc.isSkillDisabled(SUMMON_PC.getSkill())) { npc.setTarget(attacker); npc.doCast(SUMMON_PC); npc.getVariables().set("attacked", true); } } - public static void main(String[] args) - { + public static void main(String[] args) { new SummonPc(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/TreasureChest.java b/src/main/java/com/l2jserver/datapack/ai/group_template/TreasureChest.java index 1de3bc02f5..223cc130b4 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/TreasureChest.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/TreasureChest.java @@ -35,16 +35,14 @@ import com.l2jserver.gameserver.network.SystemMessageId; * Treasure Chest AI. * @author ivantotov */ -public final class TreasureChest extends AbstractNpcAI -{ +public final class TreasureChest extends AbstractNpcAI { private static final String TIMER_1 = "5001"; private static final String TIMER_2 = "5002"; private static final int MAX_SPAWN_TIME = 14400000; private static final int ATTACK_SPAWN_TIME = 5000; private static final int PLAYER_LEVEL_THRESHOLD = 78; private static final int MAESTROS_KEY_SKILL_ID = 22271; - private static final SkillHolder[] TREASURE_BOMBS = new SkillHolder[] - { + private static final SkillHolder[] TREASURE_BOMBS = new SkillHolder[] { new SkillHolder(4143, 1), new SkillHolder(4143, 2), new SkillHolder(4143, 3), @@ -59,8 +57,7 @@ public final class TreasureChest extends AbstractNpcAI private static final Map<Integer, List<ItemChanceHolder>> DROPS = new HashMap<>(); - static - { + static { DROPS.put(18265, Arrays.asList( // Treasure Chest new ItemChanceHolder(736, 2703, 7), // Scroll of Escape new ItemChanceHolder(1061, 2365, 4), // Major Healing Potion @@ -828,8 +825,7 @@ public final class TreasureChest extends AbstractNpcAI new ItemChanceHolder(21749, 29, 1))); // Great Adventurer's Treasure Sack } - private TreasureChest() - { + private TreasureChest() { super(TreasureChest.class.getSimpleName(), "ai/group_template"); addSpawnId(DROPS.keySet()); @@ -837,13 +833,10 @@ public final class TreasureChest extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { case TIMER_1: - case TIMER_2: - { + case TIMER_2: { npc.deleteMe(); break; } @@ -852,8 +845,7 @@ public final class TreasureChest extends AbstractNpcAI } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { // TODO(Zoey76): Disable Core AI. npc.getVariables().set("MAESTRO_SKILL_USED", 0); startQuestTimer(TIMER_2, MAX_SPAWN_TIME, npc, null); @@ -861,60 +853,40 @@ public final class TreasureChest extends AbstractNpcAI } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) - { - if (attacker.getLevel() < PLAYER_LEVEL_THRESHOLD) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) { + if (attacker.getLevel() < PLAYER_LEVEL_THRESHOLD) { npc.getVariables().set("MAX_LEVEL_DIFFERENCE", 6); - } - else - { + } else { npc.getVariables().set("MAX_LEVEL_DIFFERENCE", 5); } - if (npc.getVariables().getInt("MAESTRO_SKILL_USED") == 0) - { - if ((skill != null) && (skill.getId() == MAESTROS_KEY_SKILL_ID)) - { + if (npc.getVariables().getInt("MAESTRO_SKILL_USED") == 0) { + if ((skill != null) && (skill.getId() == MAESTROS_KEY_SKILL_ID)) { npc.getVariables().set("MAESTRO_SKILL_USED", 1); startQuestTimer(TIMER_1, ATTACK_SPAWN_TIME, npc, null); - if ((npc.getLevel() - npc.getVariables().getInt("MAX_LEVEL_DIFFERENCE")) > attacker.getLevel()) - { + if ((npc.getLevel() - npc.getVariables().getInt("MAX_LEVEL_DIFFERENCE")) > attacker.getLevel()) { addSkillCastDesire(npc, attacker, TREASURE_BOMBS[npc.getLevel() / 10], 1000000); - } - else - { - if (getRandom(100) < 10) - { + } else { + if (getRandom(100) < 10) { npc.doDie(null); final List<ItemChanceHolder> items = DROPS.get(npc.getId()); - if (items == null) - { + if (items == null) { _log.warning("Tresure Chest ID " + npc.getId() + " doesn't have a drop list!"); - } - else - { - for (ItemChanceHolder item : items) - { - if (getRandom(10000) < item.getChance()) - { + } else { + for (ItemChanceHolder item : items) { + if (getRandom(10000) < item.getChance()) { npc.dropItem(attacker, item.getId(), item.getCount()); } } } - } - else - { + } else { addSkillCastDesire(npc, attacker, TREASURE_BOMBS[npc.getLevel() / 10], 1000000); } } - } - else - { - if (getRandom(100) < 30) - { + } else { + if (getRandom(100) < 30) { attacker.sendPacket(SystemMessageId.IF_YOU_HAVE_A_MAESTROS_KEY_YOU_CAN_USE_IT_TO_OPEN_THE_TREASURE_CHEST); } } @@ -922,8 +894,7 @@ public final class TreasureChest extends AbstractNpcAI return super.onAttack(npc, attacker, damage, isSummon); } - public static void main(String[] args) - { + public static void main(String[] args) { new TreasureChest(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/TurekOrcs.java b/src/main/java/com/l2jserver/datapack/ai/group_template/TurekOrcs.java index 0aecd56b7a..c3c98b1d50 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/TurekOrcs.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/TurekOrcs.java @@ -32,11 +32,9 @@ import com.l2jserver.gameserver.network.NpcStringId; * Turek Orcs AI - flee and return with assistance * @author GKR */ -public final class TurekOrcs extends AbstractNpcAI -{ +public final class TurekOrcs extends AbstractNpcAI { // NPC's - private static final int[] MOBS = - { + private static final int[] MOBS = { 20494, // Turek War Hound 20495, // Turek Orc Warlord 20497, // Turek Orc Skirmisher @@ -45,8 +43,7 @@ public final class TurekOrcs extends AbstractNpcAI 20500, // Turek Orc Sentinel }; - private TurekOrcs() - { + private TurekOrcs() { super(TurekOrcs.class.getSimpleName(), "ai/group_template"); addAttackId(MOBS); addEventReceivedId(MOBS); @@ -54,17 +51,12 @@ public final class TurekOrcs extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equalsIgnoreCase("checkState") && !npc.isDead() && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK)) - { - if ((npc.getCurrentHp() > (npc.getMaxHp() * 0.7)) && (npc.getVariables().getInt("state") == 2)) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equalsIgnoreCase("checkState") && !npc.isDead() && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK)) { + if ((npc.getCurrentHp() > (npc.getMaxHp() * 0.7)) && (npc.getVariables().getInt("state") == 2)) { npc.getVariables().set("state", 3); ((L2Attackable) npc).returnHome(); - } - else - { + } else { npc.getVariables().remove("state"); } } @@ -72,14 +64,11 @@ public final class TurekOrcs extends AbstractNpcAI } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (!npc.getVariables().hasVariable("isHit")) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (!npc.getVariables().hasVariable("isHit")) { npc.getVariables().set("isHit", 1); - } - else if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.5)) && (npc.getCurrentHp() > (npc.getMaxHp() * 0.3)) && (attacker.getCurrentHp() > (attacker.getMaxHp() * 0.25)) && npc.hasAIValue("fleeX") && npc.hasAIValue("fleeY") && npc.hasAIValue("fleeZ") && (npc.getVariables().getInt("state") == 0) && (getRandom(100) < 10)) - { + } else if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.5)) && (npc.getCurrentHp() > (npc.getMaxHp() * 0.3)) && (attacker.getCurrentHp() > (attacker.getMaxHp() * 0.25)) && npc.hasAIValue("fleeX") && npc.hasAIValue("fleeY") && npc.hasAIValue("fleeZ") && (npc.getVariables().getInt("state") == 0) + && (getRandom(100) < 10)) { // Say and flee broadcastNpcSay(npc, 0, NpcStringId.getNpcStringId(getRandom(1000007, 1000027))); npc.disableCoreAI(true); // to avoid attacking behaviour, while flee @@ -92,10 +81,8 @@ public final class TurekOrcs extends AbstractNpcAI } @Override - public String onEventReceived(String eventName, L2Npc sender, L2Npc receiver, L2Object reference) - { - if (eventName.equals("WARNING") && !receiver.isDead() && (receiver.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) && (reference != null) && (reference.getActingPlayer() != null) && !reference.getActingPlayer().isDead()) - { + public String onEventReceived(String eventName, L2Npc sender, L2Npc receiver, L2Object reference) { + if (eventName.equals("WARNING") && !receiver.isDead() && (receiver.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) && (reference != null) && (reference.getActingPlayer() != null) && !reference.getActingPlayer().isDead()) { receiver.getVariables().set("state", 3); receiver.setIsRunning(true); ((L2Attackable) receiver).addDamageHate(reference.getActingPlayer(), 0, 99999); @@ -105,32 +92,24 @@ public final class TurekOrcs extends AbstractNpcAI } @Override - public void onMoveFinished(L2Npc npc) - { + public void onMoveFinished(L2Npc npc) { // NPC reaches flee point - if (npc.getVariables().getInt("state") == 1) - { - if ((npc.getX() == npc.getAIValue("fleeX")) && (npc.getY() == npc.getAIValue("fleeY"))) - { + if (npc.getVariables().getInt("state") == 1) { + if ((npc.getX() == npc.getAIValue("fleeX")) && (npc.getY() == npc.getAIValue("fleeY"))) { npc.disableCoreAI(false); startQuestTimer("checkState", 15000, npc, null); npc.getVariables().set("state", 2); npc.broadcastEvent("WARNING", 400, L2World.getInstance().getPlayer(npc.getVariables().getInt("attacker"))); - } - else - { + } else { npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(npc.getAIValue("fleeX"), npc.getAIValue("fleeY"), npc.getAIValue("fleeZ"))); } - } - else if ((npc.getVariables().getInt("state") == 3) && npc.staysInSpawnLoc()) - { + } else if ((npc.getVariables().getInt("state") == 3) && npc.staysInSpawnLoc()) { npc.disableCoreAI(false); npc.getVariables().remove("state"); } } - public static void main(String[] args) - { + public static void main(String[] args) { new TurekOrcs(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/VarkaKetra.java b/src/main/java/com/l2jserver/datapack/ai/group_template/VarkaKetra.java index 268ae0c623..cc4f28c00e 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/VarkaKetra.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/VarkaKetra.java @@ -41,11 +41,9 @@ import com.l2jserver.gameserver.util.Util; * Varka Silenos Barracks and Ketra Orc Outpost AI. * @author malyelfik */ -public class VarkaKetra extends AbstractNpcAI -{ +public class VarkaKetra extends AbstractNpcAI { // Monsters - private static final int[] KETRA = - { + private static final int[] KETRA = { 21324, // Ketra Orc Footman 21325, // Ketra's War Hound 21327, // Ketra Orc Raider @@ -72,8 +70,7 @@ public class VarkaKetra extends AbstractNpcAI 25305, // Ketra's Chief Brakki (Raid Boss) 25306, // Soul of Fire Nastron (Raid Boss) }; - private static final int[] VARKA = - { + private static final int[] VARKA = { 21350, // Varka Silenos Recruit 21351, // Varka Silenos Footman 21353, // Varka Silenos Scout @@ -101,16 +98,14 @@ public class VarkaKetra extends AbstractNpcAI 25316, // Soul of Water Ashutar (Raid Boss) }; // Items - private static final int[] KETRA_MARKS = - { + private static final int[] KETRA_MARKS = { 7211, // Mark of Ketra's Alliance - Level 1 7212, // Mark of Ketra's Alliance - Level 2 7213, // Mark of Ketra's Alliance - Level 3 7214, // Mark of Ketra's Alliance - Level 4 7215, // Mark of Ketra's Alliance - Level 5 }; - private static final int[] VARKA_MARKS = - { + private static final int[] VARKA_MARKS = { 7221, // Mark of Varka's Alliance - Level 1 7222, // Mark of Varka's Alliance - Level 2 7223, // Mark of Varka's Alliance - Level 3 @@ -118,8 +113,7 @@ public class VarkaKetra extends AbstractNpcAI 7225, // Mark of Varka's Alliance - Level 5 }; // Quests - private static final String[] KETRA_QUESTS = - { + private static final String[] KETRA_QUESTS = { Q00605_AllianceWithKetraOrcs.class.getSimpleName(), Q00606_BattleAgainstVarkaSilenos.class.getSimpleName(), Q00607_ProveYourCourageKetra.class.getSimpleName(), @@ -127,8 +121,7 @@ public class VarkaKetra extends AbstractNpcAI Q00609_MagicalPowerOfWaterPart1.class.getSimpleName(), Q00610_MagicalPowerOfWaterPart2.class.getSimpleName() }; - private static final String[] VARKA_QUESTS = - { + private static final String[] VARKA_QUESTS = { Q00611_AllianceWithVarkaSilenos.class.getSimpleName(), Q00612_BattleAgainstKetraOrcs.class.getSimpleName(), Q00613_ProveYourCourageVarka.class.getSimpleName(), @@ -137,8 +130,7 @@ public class VarkaKetra extends AbstractNpcAI Q00616_MagicalPowerOfFirePart2.class.getSimpleName() }; - private VarkaKetra() - { + private VarkaKetra() { super(VarkaKetra.class.getSimpleName(), "ai/group_template"); addKillId(KETRA); addKillId(VARKA); @@ -147,32 +139,23 @@ public class VarkaKetra extends AbstractNpcAI } @Override - public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) - { - if (Util.checkIfInRange(1500, player, npc, false)) - { - if (Util.contains(KETRA, npc.getId()) && hasAtLeastOneQuestItem(player, KETRA_MARKS)) - { + public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) { + if (Util.checkIfInRange(1500, player, npc, false)) { + if (Util.contains(KETRA, npc.getId()) && hasAtLeastOneQuestItem(player, KETRA_MARKS)) { decreaseAlliance(player, KETRA_MARKS); exitQuests(player, KETRA_QUESTS); - } - else if (Util.contains(VARKA, npc.getId()) && hasAtLeastOneQuestItem(player, VARKA_MARKS)) - { + } else if (Util.contains(VARKA, npc.getId()) && hasAtLeastOneQuestItem(player, VARKA_MARKS)) { decreaseAlliance(player, VARKA_MARKS); exitQuests(player, VARKA_QUESTS); } } } - private final void decreaseAlliance(L2PcInstance player, int[] marks) - { - for (int i = 0; i < marks.length; i++) - { - if (hasQuestItems(player, marks[i])) - { + private final void decreaseAlliance(L2PcInstance player, int[] marks) { + for (int i = 0; i < marks.length; i++) { + if (hasQuestItems(player, marks[i])) { takeItems(player, marks[i], -1); - if (i > 0) - { + if (i > 0) { giveItems(player, marks[i - 1], 1); } return; @@ -180,37 +163,30 @@ public class VarkaKetra extends AbstractNpcAI } } - private final void exitQuests(L2PcInstance player, String[] quests) - { - for (String quest : quests) - { + private final void exitQuests(L2PcInstance player, String[] quests) { + for (String quest : quests) { final QuestState qs = player.getQuestState(quest); - if ((qs != null) && qs.isStarted()) - { + if ((qs != null) && qs.isStarted()) { qs.exitQuest(true); } } } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { executeForEachPlayer(killer, npc, isSummon, true, false); return super.onKill(npc, killer, isSummon); } @Override - public boolean onNpcHate(L2Attackable mob, L2PcInstance player, boolean isSummon) - { - if (Util.contains(KETRA, mob.getId())) - { + public boolean onNpcHate(L2Attackable mob, L2PcInstance player, boolean isSummon) { + if (Util.contains(KETRA, mob.getId())) { return !hasAtLeastOneQuestItem(player, KETRA_MARKS); } return !hasAtLeastOneQuestItem(player, VARKA_MARKS); } - public static void main(String[] args) - { + public static void main(String[] args) { new VarkaKetra(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/group_template/WarriorFishingBlock.java b/src/main/java/com/l2jserver/datapack/ai/group_template/WarriorFishingBlock.java index 934ffa6591..c2417af092 100644 --- a/src/main/java/com/l2jserver/datapack/ai/group_template/WarriorFishingBlock.java +++ b/src/main/java/com/l2jserver/datapack/ai/group_template/WarriorFishingBlock.java @@ -31,11 +31,9 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Warrior Fishing Block AI. * @author Zoey76 */ -public final class WarriorFishingBlock extends AbstractNpcAI -{ +public final class WarriorFishingBlock extends AbstractNpcAI { // Monsters - private static final int[] MONSTERS = - { + private static final int[] MONSTERS = { 18319, // Caught Frog 18320, // Caught Undine 18321, // Caught Rakul @@ -46,20 +44,17 @@ public final class WarriorFishingBlock extends AbstractNpcAI 18326, // Caught Gigantic Eye }; // NPC Strings - private static final NpcStringId[] NPC_STRINGS_ON_SPAWN = - { + private static final NpcStringId[] NPC_STRINGS_ON_SPAWN = { NpcStringId.CROAK_CROAK_FOOD_LIKE_S1_IN_THIS_PLACE, NpcStringId.S1_HOW_LUCKY_I_AM, NpcStringId.PRAY_THAT_YOU_CAUGHT_A_WRONG_FISH_S1 }; - private static final NpcStringId[] NPC_STRINGS_ON_ATTACK = - { + private static final NpcStringId[] NPC_STRINGS_ON_ATTACK = { NpcStringId.DO_YOU_KNOW_WHAT_A_FROG_TASTES_LIKE, NpcStringId.I_WILL_SHOW_YOU_THE_POWER_OF_A_FROG, NpcStringId.I_WILL_SWALLOW_AT_A_MOUTHFUL }; - private static final NpcStringId[] NPC_STRINGS_ON_KILL = - { + private static final NpcStringId[] NPC_STRINGS_ON_KILL = { NpcStringId.UGH_NO_CHANCE_HOW_COULD_THIS_ELDER_PASS_AWAY_LIKE_THIS, NpcStringId.CROAK_CROAK_A_FROG_IS_DYING, NpcStringId.A_FROG_TASTES_BAD_YUCK @@ -68,8 +63,7 @@ public final class WarriorFishingBlock extends AbstractNpcAI private static final int CHANCE_TO_SHOUT_ON_ATTACK = 33; private static final int DESPAWN_TIME = 50; // 50 seconds to despawn - public WarriorFishingBlock() - { + public WarriorFishingBlock() { super(WarriorFishingBlock.class.getSimpleName(), "ai/group_template"); addAttackId(MONSTERS); addKillId(MONSTERS); @@ -77,19 +71,13 @@ public final class WarriorFishingBlock extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { - case "SPAWN": - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { + case "SPAWN": { final L2Object obj = npc.getTarget(); - if ((obj == null) || !obj.isPlayer()) - { + if ((obj == null) || !obj.isPlayer()) { npc.decayMe(); - } - else - { + } else { final L2PcInstance target = obj.getActingPlayer(); broadcastNpcSay(npc, Say2.NPC_ALL, NPC_STRINGS_ON_SPAWN[getRandom(NPC_STRINGS_ON_SPAWN.length)], target.getName()); ((L2Attackable) npc).addDamageHate(target, 0, 2000); @@ -100,8 +88,7 @@ public final class WarriorFishingBlock extends AbstractNpcAI } break; } - case "DESPAWN": - { + case "DESPAWN": { npc.decayMe(); break; } @@ -110,32 +97,27 @@ public final class WarriorFishingBlock extends AbstractNpcAI } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (getRandom(100) < CHANCE_TO_SHOUT_ON_ATTACK) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (getRandom(100) < CHANCE_TO_SHOUT_ON_ATTACK) { broadcastNpcSay(npc, Say2.NPC_ALL, NPC_STRINGS_ON_ATTACK[getRandom(NPC_STRINGS_ON_ATTACK.length)]); } return super.onAttack(npc, attacker, damage, isSummon); } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { broadcastNpcSay(npc, Say2.NPC_ALL, NPC_STRINGS_ON_KILL[getRandom(NPC_STRINGS_ON_KILL.length)]); cancelQuestTimer("DESPAWN", npc, killer); return super.onKill(npc, killer, isSummon); } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { startQuestTimer("SPAWN", 2000, npc, null); return super.onSpawn(npc); } - public static void main(String[] args) - { + public static void main(String[] args) { new WarriorFishingBlock(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/Anais.java b/src/main/java/com/l2jserver/datapack/ai/individual/Anais.java index 79e08985ce..3259426a01 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/Anais.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/Anais.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.model.quest.QuestTimer; * Anais AI. * @author nonom */ -public final class Anais extends AbstractNpcAI -{ +public final class Anais extends AbstractNpcAI { // NPCs private static final int ANAIS = 25701; private static final int DIVINE_BURNER = 18915; @@ -48,52 +47,41 @@ public final class Anais extends AbstractNpcAI private L2Npc _current = null; private int _pot = 0; - private Anais() - { + private Anais() { super(Anais.class.getSimpleName(), "ai/individual"); addAttackId(ANAIS); addSpawnId(DIVINE_BURNER); addKillId(GRAIL_WARD); } - private void burnerOnAttack(int pot, L2Npc anais) - { + private void burnerOnAttack(int pot, L2Npc anais) { L2Npc npc = _divineBurners.get(pot); npc.setDisplayEffect(1); npc.setIsRunning(false); - if (pot < 4) - { + if (pot < 4) { _current = npc; QuestTimer checkAround = getQuestTimer("CHECK", anais, null); if (checkAround == null) // || !checkAround.getIsActive() { startQuestTimer("CHECK", 3000, anais, null); } - } - else - { + } else { cancelQuestTimer("CHECK", anais, null); } } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { - case "CHECK": - { - if (!npc.isAttackingNow()) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { + case "CHECK": { + if (!npc.isAttackingNow()) { cancelQuestTimer("CHECK", npc, null); } - if ((_current != null) || (_pot < 4)) - { + if ((_current != null) || (_pot < 4)) { final Map<Integer, L2PcInstance> players = npc.getKnownList().getKnownPlayers(); final L2PcInstance target = players.get(getRandom(players.size() - 1)); _nextTarget = target; - if (_nextTarget == null) - { + if (_nextTarget == null) { _nextTarget = (L2PcInstance) npc.getTarget(); } final L2Npc b = _divineBurners.get(_pot); @@ -110,29 +98,22 @@ public final class Anais extends AbstractNpcAI } break; } - case "GUARD_ATTACK": - { - if (_nextTarget != null) - { + case "GUARD_ATTACK": { + if (_nextTarget != null) { final double distance = npc.calculateDistance(_nextTarget, false, false); - if (distance < 100) - { + if (distance < 100) { npc.doCast(DIVINE_NOVA); - } - else if (distance > 2000) - { + } else if (distance > 2000) { npc.doDie(null); cancelQuestTimer("GUARD_ATTACK", npc, player); } } break; } - case "SUICIDE": - { + case "SUICIDE": { npc.doCast(DIVINE_NOVA); cancelQuestTimer("GUARD_ATTACK", npc, _nextTarget); - if (_current != null) - { + if (_current != null) { _current.setDisplayEffect(2); _current.setIsRunning(false); _current = null; @@ -145,22 +126,14 @@ public final class Anais extends AbstractNpcAI } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (_pot == 0) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (_pot == 0) { burnerOnAttack(0, npc); - } - else if ((npc.getCurrentHp() <= (npc.getMaxRecoverableHp() * 0.75)) && (_pot == 1)) - { + } else if ((npc.getCurrentHp() <= (npc.getMaxRecoverableHp() * 0.75)) && (_pot == 1)) { burnerOnAttack(1, npc); - } - else if ((npc.getCurrentHp() <= (npc.getMaxRecoverableHp() * 0.5)) && (_pot == 2)) - { + } else if ((npc.getCurrentHp() <= (npc.getMaxRecoverableHp() * 0.5)) && (_pot == 2)) { burnerOnAttack(2, npc); - } - else if ((npc.getCurrentHp() <= (npc.getMaxRecoverableHp() * 0.25)) && (_pot == 3)) - { + } else if ((npc.getCurrentHp() <= (npc.getMaxRecoverableHp() * 0.25)) && (_pot == 3)) { burnerOnAttack(3, npc); } return super.onAttack(npc, attacker, damage, isSummon); @@ -171,20 +144,17 @@ public final class Anais extends AbstractNpcAI * @see com.l2jserver.gameserver.model.quest.Quest#onSpawn(com.l2jserver.gameserver.model.actor.L2Npc) */ @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { _divineBurners.add(npc); return super.onSpawn(npc); } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { npc.doCast(DIVINE_NOVA.getSkill()); cancelQuestTimer("GUARD_ATTACK", npc, _nextTarget); cancelQuestTimer("CHECK", npc, null); - if (_current != null) - { + if (_current != null) { _current.setDisplayEffect(2); _current.setIsRunning(false); _current = null; @@ -192,8 +162,7 @@ public final class Anais extends AbstractNpcAI return super.onKill(npc, killer, isSummon); } - public static void main(String[] args) - { + public static void main(String[] args) { new Anais(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/Antharas/Antharas.java b/src/main/java/com/l2jserver/datapack/ai/individual/Antharas/Antharas.java index c21ebc2cf2..7adab0f5b7 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/Antharas/Antharas.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/Antharas/Antharas.java @@ -53,8 +53,7 @@ import com.l2jserver.gameserver.util.Util; * Antharas AI. * @author St3eT */ -public final class Antharas extends AbstractNpcAI -{ +public final class Antharas extends AbstractNpcAI { // NPC private static final int ANTHARAS = 29068; // Antharas private static final int BEHEMOTH = 29069; // Behemoth Dragon @@ -125,8 +124,7 @@ public final class Antharas extends AbstractNpcAI private static int attacker_2_hate = 0; private static int attacker_3_hate = 0; - private Antharas() - { + private Antharas() { super(Antharas.class.getSimpleName(), "ai/individual"); addStartNpc(HEART, CUBE); addTalkId(HEART, CUBE); @@ -148,25 +146,21 @@ public final class Antharas extends AbstractNpcAI final int heading = info.getInt("heading"); final long respawnTime = info.getLong("respawn_time"); - switch (getStatus()) - { - case ALIVE: - { + switch (getStatus()) { + case ALIVE: { _antharas = (L2GrandBossInstance) addSpawn(ANTHARAS, 185708, 114298, -8221, 0, false, 0); _antharas.setCurrentHpMp(curr_hp, curr_mp); addBoss(_antharas); break; } - case WAITING: - { + case WAITING: { _antharas = (L2GrandBossInstance) addSpawn(ANTHARAS, 185708, 114298, -8221, 0, false, 0); _antharas.setCurrentHpMp(curr_hp, curr_mp); addBoss(_antharas); startQuestTimer("SPAWN_ANTHARAS", grandBoss().getAntharasWaitTime(), null, null); break; } - case IN_FIGHT: - { + case IN_FIGHT: { _antharas = (L2GrandBossInstance) addSpawn(ANTHARAS, loc_x, loc_y, loc_z, heading, false, 0); _antharas.setCurrentHpMp(curr_hp, curr_mp); addBoss(_antharas); @@ -175,15 +169,11 @@ public final class Antharas extends AbstractNpcAI startQuestTimer("SPAWN_MINION", 300000, _antharas, null); break; } - case DEAD: - { + case DEAD: { final long remain = respawnTime - System.currentTimeMillis(); - if (remain > 0) - { + if (remain > 0) { startQuestTimer("CLEAR_STATUS", remain, null, null); - } - else - { + } else { setStatus(ALIVE); _antharas = (L2GrandBossInstance) addSpawn(ANTHARAS, 185708, 114298, -8221, 0, false, 0); addBoss(_antharas); @@ -194,70 +184,44 @@ public final class Antharas extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { - case "enter": - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { + case "enter": { String htmltext = null; - if (getStatus() == DEAD) - { + if (getStatus() == DEAD) { htmltext = "13001-01.html"; - } - else if (getStatus() == IN_FIGHT) - { + } else if (getStatus() == IN_FIGHT) { htmltext = "13001-02.html"; - } - else if (zone.getPlayersInside().size() >= MAX_PEOPLE) - { + } else if (zone.getPlayersInside().size() >= MAX_PEOPLE) { htmltext = "13001-04.html"; - } - else if (player.isInParty()) - { + } else if (player.isInParty()) { final L2Party party = player.getParty(); final boolean isInCC = party.isInCommandChannel(); final List<L2PcInstance> members = (isInCC) ? party.getCommandChannel().getMembers() : party.getMembers(); final boolean isPartyLeader = (isInCC) ? party.getCommandChannel().isLeader(player) : party.isLeader(player); - if (!isPartyLeader) - { + if (!isPartyLeader) { htmltext = "13001-05.html"; - } - else if (!hasQuestItems(player, STONE)) - { + } else if (!hasQuestItems(player, STONE)) { htmltext = "13001-03.html"; - } - else if (members.size() > (MAX_PEOPLE - zone.getPlayersInside().size())) - { + } else if (members.size() > (MAX_PEOPLE - zone.getPlayersInside().size())) { htmltext = "13001-04.html"; - } - else - { - for (L2PcInstance member : members) - { - if (member.isInsideRadius(npc, 1000, true, false)) - { + } else { + for (L2PcInstance member : members) { + if (member.isInsideRadius(npc, 1000, true, false)) { member.teleToLocation(179700 + getRandom(700), 113800 + getRandom(2100), -7709); } } - if (getStatus() != WAITING) - { + if (getStatus() != WAITING) { setStatus(WAITING); startQuestTimer("SPAWN_ANTHARAS", grandBoss().getAntharasWaitTime(), null, null); } } - } - else - { - if (!hasQuestItems(player, STONE)) - { + } else { + if (!hasQuestItems(player, STONE)) { htmltext = "13001-03.html"; - } - else - { + } else { player.teleToLocation(179700 + getRandom(700), 113800 + getRandom(2100), -7709); - if (getStatus() != WAITING) - { + if (getStatus() != WAITING) { setStatus(WAITING); startQuestTimer("SPAWN_ANTHARAS", grandBoss().getAntharasWaitTime(), null, null); } @@ -265,13 +229,11 @@ public final class Antharas extends AbstractNpcAI } return htmltext; } - case "teleportOut": - { + case "teleportOut": { player.teleToLocation(79800 + getRandom(600), 151200 + getRandom(1100), -3534); break; } - case "SPAWN_ANTHARAS": - { + case "SPAWN_ANTHARAS": { _antharas.teleToLocation(181323, 114850, -7623, 32542); setStatus(IN_FIGHT); _lastAttack = System.currentTimeMillis(); @@ -279,49 +241,40 @@ public final class Antharas extends AbstractNpcAI startQuestTimer("CAMERA_1", 23, _antharas, null); break; } - case "CAMERA_1": - { + case "CAMERA_1": { zone.broadcastPacket(new SpecialCamera(npc, 700, 13, -19, 0, 10000, 20000, 0, 0, 0, 0, 0)); startQuestTimer("CAMERA_2", 3000, npc, null); break; } - case "CAMERA_2": - { + case "CAMERA_2": { zone.broadcastPacket(new SpecialCamera(npc, 700, 13, 0, 6000, 10000, 20000, 0, 0, 0, 0, 0)); startQuestTimer("CAMERA_3", 10000, npc, null); break; } - case "CAMERA_3": - { + case "CAMERA_3": { zone.broadcastPacket(new SpecialCamera(npc, 3700, 0, -3, 0, 10000, 10000, 0, 0, 0, 0, 0)); zone.broadcastPacket(new SocialAction(npc.getObjectId(), 1)); startQuestTimer("CAMERA_4", 200, npc, null); startQuestTimer("SOCIAL", 5200, npc, null); break; } - case "CAMERA_4": - { + case "CAMERA_4": { zone.broadcastPacket(new SpecialCamera(npc, 1100, 0, -3, 22000, 10000, 30000, 0, 0, 0, 0, 0)); startQuestTimer("CAMERA_5", 10800, npc, null); break; } - case "CAMERA_5": - { + case "CAMERA_5": { zone.broadcastPacket(new SpecialCamera(npc, 1100, 0, -3, 300, 10000, 7000, 0, 0, 0, 0, 0)); startQuestTimer("START_MOVE", 1900, npc, null); break; } - case "SOCIAL": - { + case "SOCIAL": { zone.broadcastPacket(new SocialAction(npc.getObjectId(), 2)); break; } - case "START_MOVE": - { - for (L2PcInstance players : npc.getKnownList().getKnownPlayersInRadius(4000)) - { - if (players.isHero()) - { + case "START_MOVE": { + for (L2PcInstance players : npc.getKnownList().getKnownPlayersInRadius(4000)) { + if (players.isHero()) { zone.broadcastPacket(new ExShowScreenMessage(NpcStringId.S1_YOU_CANNOT_HOPE_TO_DEFEAT_ME_WITH_YOUR_MEAGER_STRENGTH, 2, 4000, players.getName())); break; } @@ -331,80 +284,53 @@ public final class Antharas extends AbstractNpcAI startQuestTimer("SPAWN_MINION", 300000, npc, null); break; } - case "SET_REGEN": - { - if (npc != null) - { - if (npc.getCurrentHp() < (npc.getMaxHp() * 0.25)) - { - if (!npc.isAffectedBySkill(ANTH_REGEN_4.getSkillId())) - { + case "SET_REGEN": { + if (npc != null) { + if (npc.getCurrentHp() < (npc.getMaxHp() * 0.25)) { + if (!npc.isAffectedBySkill(ANTH_REGEN_4.getSkillId())) { npc.doCast(ANTH_REGEN_4); } - } - else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.5)) - { - if (!npc.isAffectedBySkill(ANTH_REGEN_3.getSkillId())) - { + } else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.5)) { + if (!npc.isAffectedBySkill(ANTH_REGEN_3.getSkillId())) { npc.doCast(ANTH_REGEN_3); } - } - else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.75)) - { - if (!npc.isAffectedBySkill(ANTH_REGEN_2.getSkillId())) - { + } else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.75)) { + if (!npc.isAffectedBySkill(ANTH_REGEN_2.getSkillId())) { npc.doCast(ANTH_REGEN_2); } - } - else if (!npc.isAffectedBySkill(ANTH_REGEN_1.getSkillId())) - { + } else if (!npc.isAffectedBySkill(ANTH_REGEN_1.getSkillId())) { npc.doCast(ANTH_REGEN_1); } startQuestTimer("SET_REGEN", 60000, npc, null); } break; } - case "CHECK_ATTACK": - { - if ((npc != null) && ((_lastAttack + 900000) < System.currentTimeMillis())) - { + case "CHECK_ATTACK": { + if ((npc != null) && ((_lastAttack + 900000) < System.currentTimeMillis())) { setStatus(ALIVE); - for (L2Character charInside : zone.getCharactersInside()) - { - if (charInside != null) - { - if (charInside.isNpc()) - { - if (charInside.getId() == ANTHARAS) - { + for (L2Character charInside : zone.getCharactersInside()) { + if (charInside != null) { + if (charInside.isNpc()) { + if (charInside.getId() == ANTHARAS) { charInside.teleToLocation(185708, 114298, -8221); - } - else - { + } else { charInside.deleteMe(); } - } - else if (charInside.isPlayer()) - { + } else if (charInside.isPlayer()) { charInside.teleToLocation(79800 + getRandom(600), 151200 + getRandom(1100), -3534); } } } cancelQuestTimer("CHECK_ATTACK", npc, null); cancelQuestTimer("SPAWN_MINION", npc, null); - } - else if (npc != null) - { - if (attacker_1_hate > 10) - { + } else if (npc != null) { + if (attacker_1_hate > 10) { attacker_1_hate -= getRandom(10); } - if (attacker_2_hate > 10) - { + if (attacker_2_hate > 10) { attacker_2_hate -= getRandom(10); } - if (attacker_3_hate > 10) - { + if (attacker_3_hate > 10) { attacker_3_hate -= getRandom(10); } manageSkills(npc); @@ -412,58 +338,42 @@ public final class Antharas extends AbstractNpcAI } break; } - case "SPAWN_MINION": - { - if ((minionMultipler > 1) && (_minionCount < (100 - (minionMultipler * 2)))) - { - for (int i = 0; i < minionMultipler; i++) - { + case "SPAWN_MINION": { + if ((minionMultipler > 1) && (_minionCount < (100 - (minionMultipler * 2)))) { + for (int i = 0; i < minionMultipler; i++) { addSpawn(BEHEMOTH, npc, true); addSpawn(TERASQUE, npc, true); } _minionCount += (minionMultipler * 2); - } - else if (_minionCount < 98) - { + } else if (_minionCount < 98) { addSpawn(BEHEMOTH, npc, true); addSpawn(TERASQUE, npc, true); _minionCount += 2; - } - else if (_minionCount < 99) - { + } else if (_minionCount < 99) { addSpawn((getRandomBoolean() ? BEHEMOTH : TERASQUE), npc, true); _minionCount++; } - if ((getRandom(100) > 10) && (minionMultipler < 4)) - { + if ((getRandom(100) > 10) && (minionMultipler < 4)) { minionMultipler++; } startQuestTimer("SPAWN_MINION", 300000, npc, null); break; } - case "CLEAR_ZONE": - { - for (L2Character charInside : zone.getCharactersInside()) - { - if (charInside != null) - { - if (charInside.isNpc()) - { + case "CLEAR_ZONE": { + for (L2Character charInside : zone.getCharactersInside()) { + if (charInside != null) { + if (charInside.isNpc()) { charInside.deleteMe(); - } - else if (charInside.isPlayer()) - { + } else if (charInside.isPlayer()) { charInside.teleToLocation(79800 + getRandom(600), 151200 + getRandom(1100), -3534); } } } break; } - case "TID_USED_FEAR": - { - if ((npc != null) && (sandStorm == 0)) - { + case "TID_USED_FEAR": { + if ((npc != null) && (sandStorm == 0)) { sandStorm = 1; npc.disableCoreAI(true); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(177648, 114816, -7735)); @@ -472,82 +382,61 @@ public final class Antharas extends AbstractNpcAI } break; } - case "TID_FEAR_COOLTIME": - { + case "TID_FEAR_COOLTIME": { sandStorm = 0; break; } - case "TID_FEAR_MOVE_TIMEOVER": - { - if ((sandStorm == 1) && (npc.getX() == 177648) && (npc.getY() == 114816)) - { + case "TID_FEAR_MOVE_TIMEOVER": { + if ((sandStorm == 1) && (npc.getX() == 177648) && (npc.getY() == 114816)) { sandStorm = 2; moveChance = 0; npc.disableCoreAI(false); INVISIBLE_NPC.entrySet().forEach(entry -> addSpawn(entry.getKey(), entry.getValue())); - } - else if (sandStorm == 1) - { - if (moveChance <= 3) - { + } else if (sandStorm == 1) { + if (moveChance <= 3) { moveChance++; npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(177648, 114816, -7735)); startQuestTimer("TID_FEAR_MOVE_TIMEOVER", 5000, npc, null); - } - else - { + } else { npc.teleToLocation(177648, 114816, -7735, npc.getHeading()); startQuestTimer("TID_FEAR_MOVE_TIMEOVER", 1000, npc, null); } } break; } - case "CLEAR_STATUS": - { + case "CLEAR_STATUS": { _antharas = (L2GrandBossInstance) addSpawn(ANTHARAS, 185708, 114298, -8221, 0, false, 0); addBoss(_antharas); Broadcast.toAllOnlinePlayers(new Earthquake(185708, 114298, -8221, 20, 10)); setStatus(ALIVE); break; } - case "SKIP_WAITING": - { - if (getStatus() == WAITING) - { + case "SKIP_WAITING": { + if (getStatus() == WAITING) { cancelQuestTimer("SPAWN_ANTHARAS", null, null); notifyEvent("SPAWN_ANTHARAS", null, null); player.sendMessage(getClass().getSimpleName() + ": Skipping waiting time ..."); - } - else - { + } else { player.sendMessage(getClass().getSimpleName() + ": You can't skip waiting time right now!"); } break; } - case "RESPAWN_ANTHARAS": - { - if (getStatus() == DEAD) - { + case "RESPAWN_ANTHARAS": { + if (getStatus() == DEAD) { setRespawn(0); cancelQuestTimer("CLEAR_STATUS", null, null); notifyEvent("CLEAR_STATUS", null, null); player.sendMessage(getClass().getSimpleName() + ": Antharas has been respawned."); - } - else - { + } else { player.sendMessage(getClass().getSimpleName() + ": You can't respawn antharas while antharas is alive!"); } break; } - case "DESPAWN_MINIONS": - { - if (getStatus() == IN_FIGHT) - { + case "DESPAWN_MINIONS": { + if (getStatus() == IN_FIGHT) { _minionCount = 0; - for (L2Character charInside : zone.getCharactersInside()) - { - if ((charInside != null) && charInside.isNpc() && ((charInside.getId() == BEHEMOTH) || (charInside.getId() == TERASQUE))) - { + for (L2Character charInside : zone.getCharactersInside()) { + if ((charInside != null) && charInside.isNpc() && ((charInside.getId() == BEHEMOTH) || (charInside.getId() == TERASQUE))) { charInside.deleteMe(); } } @@ -555,51 +444,37 @@ public final class Antharas extends AbstractNpcAI { player.sendMessage(getClass().getSimpleName() + ": All minions have been deleted!"); } - } - else if (player != null) // Player dont will be null just when is this event called from GM command + } else if (player != null) // Player dont will be null just when is this event called from GM command { player.sendMessage(getClass().getSimpleName() + ": You can't despawn minions right now!"); } break; } - case "ABORT_FIGHT": - { - if (getStatus() == IN_FIGHT) - { + case "ABORT_FIGHT": { + if (getStatus() == IN_FIGHT) { setStatus(ALIVE); cancelQuestTimer("CHECK_ATTACK", _antharas, null); cancelQuestTimer("SPAWN_MINION", _antharas, null); - for (L2Character charInside : zone.getCharactersInside()) - { - if (charInside != null) - { - if (charInside.isNpc()) - { - if (charInside.getId() == ANTHARAS) - { + for (L2Character charInside : zone.getCharactersInside()) { + if (charInside != null) { + if (charInside.isNpc()) { + if (charInside.getId() == ANTHARAS) { charInside.teleToLocation(185708, 114298, -8221); - } - else - { + } else { charInside.deleteMe(); } - } - else if (charInside.isPlayer() && !charInside.isGM()) - { + } else if (charInside.isPlayer() && !charInside.isGM()) { charInside.teleToLocation(79800 + getRandom(600), 151200 + getRandom(1100), -3534); } } } player.sendMessage(getClass().getSimpleName() + ": Fight has been aborted!"); - } - else - { + } else { player.sendMessage(getClass().getSimpleName() + ": You can't abort fight right now!"); } break; } - case "MANAGE_SKILL": - { + case "MANAGE_SKILL": { manageSkills(npc); break; } @@ -608,61 +483,43 @@ public final class Antharas extends AbstractNpcAI } @Override - public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) { npc.doCast(DISPEL_BOM); npc.doDie(player); return super.onAggroRangeEnter(npc, player, isSummon); } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) { _lastAttack = System.currentTimeMillis(); - if (npc.getId() == BOMBER) - { - if (npc.calculateDistance(attacker, true, false) < 230) - { + if (npc.getId() == BOMBER) { + if (npc.calculateDistance(attacker, true, false) < 230) { npc.doCast(DISPEL_BOM); npc.doDie(attacker); } - } - else if (npc.getId() == ANTHARAS) - { - if (!zone.isCharacterInZone(attacker) || (getStatus() != IN_FIGHT)) - { + } else if (npc.getId() == ANTHARAS) { + if (!zone.isCharacterInZone(attacker) || (getStatus() != IN_FIGHT)) { _log.warning(getClass().getSimpleName() + ": Player " + attacker.getName() + " attacked Antharas in invalid conditions!"); attacker.teleToLocation(80464, 152294, -3534); } - if ((attacker.getMountType() == MountType.STRIDER) && !attacker.isAffectedBySkill(ANTH_ANTI_STRIDER.getSkillId())) - { - if (npc.checkDoCastConditions(ANTH_ANTI_STRIDER.getSkill())) - { + if ((attacker.getMountType() == MountType.STRIDER) && !attacker.isAffectedBySkill(ANTH_ANTI_STRIDER.getSkillId())) { + if (npc.checkDoCastConditions(ANTH_ANTI_STRIDER.getSkill())) { npc.setTarget(attacker); npc.doCast(ANTH_ANTI_STRIDER); } } - if (skill == null) - { + if (skill == null) { refreshAiParams(attacker, (damage * 1000)); - } - else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.25)) - { + } else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.25)) { refreshAiParams(attacker, ((damage / 3) * 100)); - } - else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.5)) - { + } else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.5)) { refreshAiParams(attacker, (damage * 20)); - } - else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.75)) - { + } else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.75)) { refreshAiParams(attacker, (damage * 10)); - } - else - { + } else { refreshAiParams(attacker, ((damage / 3) * 20)); } manageSkills(npc); @@ -671,12 +528,9 @@ public final class Antharas extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (zone.isCharacterInZone(killer)) - { - if (npc.getId() == ANTHARAS) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (zone.isCharacterInZone(killer)) { + if (npc.getId() == ANTHARAS) { _antharas = null; notifyEvent("DESPAWN_MINIONS", null, null); zone.broadcastPacket(new SpecialCamera(npc, 1200, 20, -10, 0, 10000, 13000, 0, 0, 0, 0, 0)); @@ -690,9 +544,7 @@ public final class Antharas extends AbstractNpcAI cancelQuestTimer("SPAWN_MINION", npc, null); startQuestTimer("CLEAR_ZONE", 900000, null, null); setStatus(DEAD); - } - else - { + } else { _minionCount--; } } @@ -700,25 +552,19 @@ public final class Antharas extends AbstractNpcAI } @Override - public void onMoveFinished(L2Npc npc) - { + public void onMoveFinished(L2Npc npc) { npc.doCast(DISPEL_BOM); npc.doDie(null); } @Override - public String onSpawn(L2Npc npc) - { - if (npc.getId() == ANTHARAS) - { + public String onSpawn(L2Npc npc) { + if (npc.getId() == ANTHARAS) { cancelQuestTimer("SET_REGEN", npc, null); startQuestTimer("SET_REGEN", 60000, npc, null); ((L2Attackable) npc).setOnKillDelay(0); - } - else - { - for (int i = 1; i <= 6; i++) - { + } else { + for (int i = 1; i <= 6; i++) { final int x = npc.getTemplate().getParameters().getInt("suicide" + i + "_x"); final int y = npc.getTemplate().getParameters().getInt("suicide" + i + "_y"); final L2Attackable bomber = (L2Attackable) addSpawn(BOMBER, npc.getX(), npc.getY(), npc.getZ(), 0, true, 15000, true); @@ -730,10 +576,8 @@ public final class Antharas extends AbstractNpcAI } @Override - public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) - { - if ((skill.getId() == ANTH_FEAR.getSkillId()) || (skill.getId() == ANTH_FEAR_SHORT.getSkillId())) - { + public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) { + if ((skill.getId() == ANTH_FEAR.getSkillId()) || (skill.getId() == ANTH_FEAR_SHORT.getSkillId())) { startQuestTimer("TID_USED_FEAR", 7000, npc, null); } startQuestTimer("MANAGE_SKILL", 1000, npc, null); @@ -741,142 +585,105 @@ public final class Antharas extends AbstractNpcAI } @Override - public boolean unload(boolean removeFromList) - { - if (_antharas != null) - { + public boolean unload(boolean removeFromList) { + if (_antharas != null) { _antharas.deleteMe(); _antharas = null; } return super.unload(removeFromList); } - private int getStatus() - { + private int getStatus() { return GrandBossManager.getInstance().getBossStatus(ANTHARAS); } - private void addBoss(L2GrandBossInstance grandboss) - { + private void addBoss(L2GrandBossInstance grandboss) { GrandBossManager.getInstance().addBoss(grandboss); } - private void setStatus(int status) - { + private void setStatus(int status) { GrandBossManager.getInstance().setBossStatus(ANTHARAS, status); } - private void setRespawn(long respawnTime) - { + private void setRespawn(long respawnTime) { GrandBossManager.getInstance().getStatsSet(ANTHARAS).set("respawn_time", (System.currentTimeMillis() + respawnTime)); } - private final void refreshAiParams(L2PcInstance attacker, int damage) - { - if ((attacker_1 != null) && (attacker == attacker_1)) - { - if (attacker_1_hate < (damage + 1000)) - { + private final void refreshAiParams(L2PcInstance attacker, int damage) { + if ((attacker_1 != null) && (attacker == attacker_1)) { + if (attacker_1_hate < (damage + 1000)) { attacker_1_hate = damage + getRandom(3000); } - } - else if ((attacker_2 != null) && (attacker == attacker_2)) - { - if (attacker_2_hate < (damage + 1000)) - { + } else if ((attacker_2 != null) && (attacker == attacker_2)) { + if (attacker_2_hate < (damage + 1000)) { attacker_2_hate = damage + getRandom(3000); } - } - else if ((attacker_3 != null) && (attacker == attacker_3)) - { - if (attacker_3_hate < (damage + 1000)) - { + } else if ((attacker_3 != null) && (attacker == attacker_3)) { + if (attacker_3_hate < (damage + 1000)) { attacker_3_hate = damage + getRandom(3000); } - } - else - { + } else { final int i1 = Util.min(attacker_1_hate, attacker_2_hate, attacker_3_hate); - if (attacker_1_hate == i1) - { + if (attacker_1_hate == i1) { attacker_1_hate = damage + getRandom(3000); attacker_1 = attacker; - } - else if (attacker_2_hate == i1) - { + } else if (attacker_2_hate == i1) { attacker_2_hate = damage + getRandom(3000); attacker_2 = attacker; - } - else if (attacker_3_hate == i1) - { + } else if (attacker_3_hate == i1) { attacker_3_hate = damage + getRandom(3000); attacker_3 = attacker; } } } - private void manageSkills(L2Npc npc) - { - if (npc.isCastingNow() || npc.isCoreAIDisabled() || !npc.isInCombat()) - { + private void manageSkills(L2Npc npc) { + if (npc.isCastingNow() || npc.isCoreAIDisabled() || !npc.isInCombat()) { return; } int i1 = 0; int i2 = 0; L2PcInstance c2 = null; - if ((attacker_1 == null) || (npc.calculateDistance(attacker_1, true, false) > 9000) || attacker_1.isDead()) - { + if ((attacker_1 == null) || (npc.calculateDistance(attacker_1, true, false) > 9000) || attacker_1.isDead()) { attacker_1_hate = 0; } - if ((attacker_2 == null) || (npc.calculateDistance(attacker_2, true, false) > 9000) || attacker_2.isDead()) - { + if ((attacker_2 == null) || (npc.calculateDistance(attacker_2, true, false) > 9000) || attacker_2.isDead()) { attacker_2_hate = 0; } - if ((attacker_3 == null) || (npc.calculateDistance(attacker_3, true, false) > 9000) || attacker_3.isDead()) - { + if ((attacker_3 == null) || (npc.calculateDistance(attacker_3, true, false) > 9000) || attacker_3.isDead()) { attacker_3_hate = 0; } - if (attacker_1_hate > attacker_2_hate) - { + if (attacker_1_hate > attacker_2_hate) { i1 = 2; i2 = attacker_1_hate; c2 = attacker_1; - } - else if (attacker_2_hate > 0) - { + } else if (attacker_2_hate > 0) { i1 = 3; i2 = attacker_2_hate; c2 = attacker_2; } - if (attacker_3_hate > i2) - { + if (attacker_3_hate > i2) { i1 = 4; i2 = attacker_3_hate; c2 = attacker_3; } - if (i2 > 0) - { - if (getRandom(100) < 70) - { - switch (i1) - { - case 2: - { + if (i2 > 0) { + if (getRandom(100) < 70) { + switch (i1) { + case 2: { attacker_1_hate = 500; break; } - case 3: - { + case 3: { attacker_2_hate = 500; break; } - case 4: - { + case 4: { attacker_3_hate = 500; break; } @@ -887,166 +694,102 @@ public final class Antharas extends AbstractNpcAI final double direction_c2 = npc.calculateDirectionTo(c2); SkillHolder skillToCast = null; - if (npc.getCurrentHp() < (npc.getMaxHp() * 0.25)) - { - if (getRandom(100) < 30) - { + if (npc.getCurrentHp() < (npc.getMaxHp() * 0.25)) { + if (getRandom(100) < 30) { npc.setTarget(c2); skillToCast = ANTH_MOUTH; - } - else if ((getRandom(100) < 80) && (((distance_c2 < 1423) && (direction_c2 < 188) && (direction_c2 > 172)) || ((distance_c2 < 802) && (direction_c2 < 194) && (direction_c2 > 166)))) - { + } else if ((getRandom(100) < 80) && (((distance_c2 < 1423) && (direction_c2 < 188) && (direction_c2 > 172)) || ((distance_c2 < 802) && (direction_c2 < 194) && (direction_c2 > 166)))) { skillToCast = ANTH_TAIL; - } - else if ((getRandom(100) < 40) && (((distance_c2 < 850) && (direction_c2 < 210) && (direction_c2 > 150)) || ((distance_c2 < 425) && (direction_c2 < 270) && (direction_c2 > 90)))) - { + } else if ((getRandom(100) < 40) && (((distance_c2 < 850) && (direction_c2 < 210) && (direction_c2 > 150)) || ((distance_c2 < 425) && (direction_c2 < 270) && (direction_c2 > 90)))) { skillToCast = ANTH_DEBUFF; - } - else if ((getRandom(100) < 10) && (distance_c2 < 1100)) - { + } else if ((getRandom(100) < 10) && (distance_c2 < 1100)) { skillToCast = ANTH_JUMP; - } - else if (getRandom(100) < 10) - { + } else if (getRandom(100) < 10) { npc.setTarget(c2); skillToCast = ANTH_METEOR; - } - else if (getRandom(100) < 6) - { + } else if (getRandom(100) < 6) { npc.setTarget(c2); skillToCast = ANTH_BREATH; - } - else if (getRandomBoolean()) - { + } else if (getRandomBoolean()) { npc.setTarget(c2); skillToCast = ANTH_NORM_ATTACK_EX; - } - else if (getRandom(100) < 5) - { + } else if (getRandom(100) < 5) { npc.setTarget(c2); skillToCast = getRandomBoolean() ? ANTH_FEAR : ANTH_FEAR_SHORT; - } - else - { + } else { npc.setTarget(c2); skillToCast = ANTH_NORM_ATTACK; } - } - else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.5)) - { - if ((getRandom(100) < 80) && (((distance_c2 < 1423) && (direction_c2 < 188) && (direction_c2 > 172)) || ((distance_c2 < 802) && (direction_c2 < 194) && (direction_c2 > 166)))) - { + } else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.5)) { + if ((getRandom(100) < 80) && (((distance_c2 < 1423) && (direction_c2 < 188) && (direction_c2 > 172)) || ((distance_c2 < 802) && (direction_c2 < 194) && (direction_c2 > 166)))) { skillToCast = ANTH_TAIL; - } - else if ((getRandom(100) < 40) && (((distance_c2 < 850) && (direction_c2 < 210) && (direction_c2 > 150)) || ((distance_c2 < 425) && (direction_c2 < 270) && (direction_c2 > 90)))) - { + } else if ((getRandom(100) < 40) && (((distance_c2 < 850) && (direction_c2 < 210) && (direction_c2 > 150)) || ((distance_c2 < 425) && (direction_c2 < 270) && (direction_c2 > 90)))) { skillToCast = ANTH_DEBUFF; - } - else if ((getRandom(100) < 10) && (distance_c2 < 1100)) - { + } else if ((getRandom(100) < 10) && (distance_c2 < 1100)) { skillToCast = ANTH_JUMP; - } - else if (getRandom(100) < 7) - { + } else if (getRandom(100) < 7) { npc.setTarget(c2); skillToCast = ANTH_METEOR; - } - else if (getRandom(100) < 6) - { + } else if (getRandom(100) < 6) { npc.setTarget(c2); skillToCast = ANTH_BREATH; - } - else if (getRandomBoolean()) - { + } else if (getRandomBoolean()) { npc.setTarget(c2); skillToCast = ANTH_NORM_ATTACK_EX; - } - else if (getRandom(100) < 5) - { + } else if (getRandom(100) < 5) { npc.setTarget(c2); skillToCast = getRandomBoolean() ? ANTH_FEAR : ANTH_FEAR_SHORT; - } - else - { + } else { npc.setTarget(c2); skillToCast = ANTH_NORM_ATTACK; } - } - else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.75)) - { - if ((getRandom(100) < 80) && (((distance_c2 < 1423) && (direction_c2 < 188) && (direction_c2 > 172)) || ((distance_c2 < 802) && (direction_c2 < 194) && (direction_c2 > 166)))) - { + } else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.75)) { + if ((getRandom(100) < 80) && (((distance_c2 < 1423) && (direction_c2 < 188) && (direction_c2 > 172)) || ((distance_c2 < 802) && (direction_c2 < 194) && (direction_c2 > 166)))) { skillToCast = ANTH_TAIL; - } - else if ((getRandom(100) < 10) && (distance_c2 < 1100)) - { + } else if ((getRandom(100) < 10) && (distance_c2 < 1100)) { skillToCast = ANTH_JUMP; - } - else if (getRandom(100) < 5) - { + } else if (getRandom(100) < 5) { npc.setTarget(c2); skillToCast = ANTH_METEOR; - } - else if (getRandom(100) < 6) - { + } else if (getRandom(100) < 6) { npc.setTarget(c2); skillToCast = ANTH_BREATH; - } - else if (getRandomBoolean()) - { + } else if (getRandomBoolean()) { npc.setTarget(c2); skillToCast = ANTH_NORM_ATTACK_EX; - } - else if (getRandom(100) < 5) - { + } else if (getRandom(100) < 5) { npc.setTarget(c2); skillToCast = getRandomBoolean() ? ANTH_FEAR : ANTH_FEAR_SHORT; - } - else - { + } else { npc.setTarget(c2); skillToCast = ANTH_NORM_ATTACK; } - } - else if ((getRandom(100) < 80) && (((distance_c2 < 1423) && (direction_c2 < 188) && (direction_c2 > 172)) || ((distance_c2 < 802) && (direction_c2 < 194) && (direction_c2 > 166)))) - { + } else if ((getRandom(100) < 80) && (((distance_c2 < 1423) && (direction_c2 < 188) && (direction_c2 > 172)) || ((distance_c2 < 802) && (direction_c2 < 194) && (direction_c2 > 166)))) { skillToCast = ANTH_TAIL; - } - else if (getRandom(100) < 3) - { + } else if (getRandom(100) < 3) { npc.setTarget(c2); skillToCast = ANTH_METEOR; - } - else if (getRandom(100) < 6) - { + } else if (getRandom(100) < 6) { npc.setTarget(c2); skillToCast = ANTH_BREATH; - } - else if (getRandomBoolean()) - { + } else if (getRandomBoolean()) { npc.setTarget(c2); skillToCast = ANTH_NORM_ATTACK_EX; - } - else if (getRandom(100) < 5) - { + } else if (getRandom(100) < 5) { npc.setTarget(c2); skillToCast = getRandomBoolean() ? ANTH_FEAR : ANTH_FEAR_SHORT; - } - else - { + } else { npc.setTarget(c2); skillToCast = ANTH_NORM_ATTACK; } - if ((skillToCast != null) && npc.checkDoCastConditions(skillToCast.getSkill())) - { + if ((skillToCast != null) && npc.checkDoCastConditions(skillToCast.getSkill())) { npc.doCast(skillToCast); } } } - public static void main(String[] args) - { + public static void main(String[] args) { new Antharas(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/Baium/Baium.java b/src/main/java/com/l2jserver/datapack/ai/individual/Baium/Baium.java index 43ed627cfb..05c82ecdc5 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/Baium/Baium.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/Baium/Baium.java @@ -49,8 +49,7 @@ import com.l2jserver.gameserver.util.Util; * Baium AI. * @author St3eT */ -public final class Baium extends AbstractNpcAI -{ +public final class Baium extends AbstractNpcAI { // NPCs private static final int BAIUM = 29020; // Baium private static final int BAIUM_STONE = 29025; // Baium @@ -82,14 +81,12 @@ public final class Baium extends AbstractNpcAI private static final Location BAIUM_LOC = new Location(116033, 17447, 10107, -25348); private static final Location TELEPORT_CUBIC_LOC = new Location(115017, 15549, 10090); private static final Location TELEPORT_IN_LOC = new Location(114077, 15882, 10078); - private static final Location[] TELEPORT_OUT_LOC = - { + private static final Location[] TELEPORT_OUT_LOC = { new Location(108784, 16000, -4928), new Location(113824, 10448, -5164), new Location(115488, 22096, -5168), }; - private static final Location[] ARCHANGEL_LOC = - { + private static final Location[] ARCHANGEL_LOC = { new Location(115792, 16608, 10136, 0), new Location(115168, 17200, 10136, 0), new Location(115780, 15564, 10136, 13620), @@ -100,8 +97,7 @@ public final class Baium extends AbstractNpcAI private L2GrandBossInstance _baium = null; private static long _lastAttack = 0; - private Baium() - { + private Baium() { super(Baium.class.getSimpleName(), "ai/individual"); addFirstTalkId(ANG_VORTEX); addTalkId(ANG_VORTEX, TELE_CUBE, BAIUM_STONE); @@ -120,41 +116,32 @@ public final class Baium extends AbstractNpcAI final int heading = info.getInt("heading"); final long respawnTime = info.getLong("respawn_time"); - switch (getStatus()) - { - case WAITING: - { + switch (getStatus()) { + case WAITING: { setStatus(ALIVE); } - case ALIVE: - { + case ALIVE: { addSpawn(BAIUM_STONE, BAIUM_LOC, false, 0); break; } - case IN_FIGHT: - { + case IN_FIGHT: { _baium = (L2GrandBossInstance) addSpawn(BAIUM, loc_x, loc_y, loc_z, heading, false, 0); _baium.setCurrentHpMp(curr_hp, curr_mp); _lastAttack = System.currentTimeMillis(); addBoss(_baium); - for (Location loc : ARCHANGEL_LOC) - { + for (Location loc : ARCHANGEL_LOC) { final L2Npc archangel = addSpawn(ARCHANGEL, loc, false, 0, true); startQuestTimer("SELECT_TARGET", 5000, archangel, null); } startQuestTimer("CHECK_ATTACK", 60000, _baium, null); break; } - case DEAD: - { + case DEAD: { final long remain = respawnTime - System.currentTimeMillis(); - if (remain > 0) - { + if (remain > 0) { startQuestTimer("CLEAR_STATUS", remain, null, null); - } - else - { + } else { notifyEvent("CLEAR_STATUS", null, null); } break; @@ -163,46 +150,32 @@ public final class Baium extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { - case "31862-04.html": - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { + case "31862-04.html": { return event; } - case "enter": - { + case "enter": { String htmltext = null; - if (getStatus() == DEAD) - { + if (getStatus() == DEAD) { htmltext = "31862-03.html"; - } - else if (getStatus() == IN_FIGHT) - { + } else if (getStatus() == IN_FIGHT) { htmltext = "31862-02.html"; - } - else if (!hasQuestItems(player, FABRIC)) - { + } else if (!hasQuestItems(player, FABRIC)) { htmltext = "31862-01.html"; - } - else - { + } else { takeItems(player, FABRIC, 1); player.teleToLocation(TELEPORT_IN_LOC); } return htmltext; } - case "teleportOut": - { + case "teleportOut": { final Location destination = TELEPORT_OUT_LOC[getRandom(TELEPORT_OUT_LOC.length)]; player.teleToLocation(destination.getX() + getRandom(100), destination.getY() + getRandom(100), destination.getZ()); break; } - case "wakeUp": - { - if (getStatus() == ALIVE) - { + case "wakeUp": { + if (getStatus() == ALIVE) { npc.deleteMe(); setStatus(IN_FIGHT); _baium = (L2GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0); @@ -216,71 +189,53 @@ public final class Baium extends AbstractNpcAI } break; } - case "WAKEUP_ACTION": - { - if (npc != null) - { + case "WAKEUP_ACTION": { + if (npc != null) { zone.broadcastPacket(new SocialAction(_baium.getObjectId(), 2)); } break; } - case "MANAGE_EARTHQUAKE": - { - if (npc != null) - { + case "MANAGE_EARTHQUAKE": { + if (npc != null) { zone.broadcastPacket(new Earthquake(npc.getX(), npc.getY(), npc.getZ(), 40, 10)); zone.broadcastPacket(Music.BS02_A_6000.getPacket()); } break; } - case "SOCIAL_ACTION": - { - if (npc != null) - { + case "SOCIAL_ACTION": { + if (npc != null) { zone.broadcastPacket(new SocialAction(npc.getObjectId(), 3)); startQuestTimer("PLAYER_PORT", 6000, npc, player); } break; } - case "PLAYER_PORT": - { - if (npc != null) - { - if ((player != null) && player.isInsideRadius(npc, 16000, true, false)) - { + case "PLAYER_PORT": { + if (npc != null) { + if ((player != null) && player.isInsideRadius(npc, 16000, true, false)) { player.teleToLocation(BAIUM_GIFT_LOC); startQuestTimer("PLAYER_KILL", 3000, npc, player); - } - else - { + } else { L2PcInstance randomPlayer = getRandomPlayer(npc); - if (randomPlayer != null) - { + if (randomPlayer != null) { randomPlayer.teleToLocation(BAIUM_GIFT_LOC); startQuestTimer("PLAYER_KILL", 3000, npc, randomPlayer); - } - else - { + } else { startQuestTimer("PLAYER_KILL", 3000, npc, null); } } } break; } - case "PLAYER_KILL": - { - if ((player != null) && player.isInsideRadius(npc, 16000, true, false)) - { + case "PLAYER_KILL": { + if ((player != null) && player.isInsideRadius(npc, 16000, true, false)) { zone.broadcastPacket(new SocialAction(npc.getObjectId(), 1)); broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.HOW_DARE_YOU_WAKE_ME_NOW_YOU_SHALL_DIE, player.getName()); npc.setTarget(player); npc.doCast(BAIUM_PRESENT); } - for (L2PcInstance insidePlayer : zone.getPlayersInside()) - { - if (insidePlayer.isHero()) - { + for (L2PcInstance insidePlayer : zone.getPlayersInside()) { + if (insidePlayer.isHero()) { zone.broadcastPacket(new ExShowScreenMessage(NpcStringId.NOT_EVEN_THE_GODS_THEMSELVES_COULD_TOUCH_ME_BUT_YOU_S1_YOU_DARE_CHALLENGE_ME_IGNORANT_MORTAL, 2, 4000, insidePlayer.getName())); break; } @@ -288,60 +243,44 @@ public final class Baium extends AbstractNpcAI startQuestTimer("SPAWN_ARCHANGEL", 8000, npc, player); break; } - case "SPAWN_ARCHANGEL": - { + case "SPAWN_ARCHANGEL": { _baium.disableCoreAI(false); - for (Location loc : ARCHANGEL_LOC) - { + for (Location loc : ARCHANGEL_LOC) { final L2Npc archangel = addSpawn(ARCHANGEL, loc, false, 0, true); startQuestTimer("SELECT_TARGET", 5000, archangel, null); } - if ((player != null) && !player.isDead()) - { + if ((player != null) && !player.isDead()) { addAttackDesire(npc, player); - } - else - { + } else { L2PcInstance randomPlayer = getRandomPlayer(npc); - if (randomPlayer != null) - { + if (randomPlayer != null) { addAttackDesire(npc, randomPlayer); } } break; } - case "SELECT_TARGET": - { - if (npc != null) - { + case "SELECT_TARGET": { + if (npc != null) { final L2Attackable mob = (L2Attackable) npc; final L2Character mostHated = mob.getMostHated(); - if ((_baium == null) || _baium.isDead()) - { + if ((_baium == null) || _baium.isDead()) { mob.deleteMe(); break; } - if ((mostHated != null) && mostHated.isPlayer() && zone.isInsideZone(mostHated)) - { - if (mob.getTarget() != mostHated) - { + if ((mostHated != null) && mostHated.isPlayer() && zone.isInsideZone(mostHated)) { + if (mob.getTarget() != mostHated) { mob.clearAggroList(); } addAttackDesire(mob, mostHated); - } - else - { + } else { boolean found = false; - for (L2Character creature : mob.getKnownList().getKnownCharactersInRadius(1000)) - { - if ((creature != null) && creature.isPlayable() && zone.isInsideZone(creature) && !creature.isDead()) - { - if (mob.getTarget() != creature) - { + for (L2Character creature : mob.getKnownList().getKnownCharactersInRadius(1000)) { + if ((creature != null) && creature.isPlayable() && zone.isInsideZone(creature) && !creature.isDead()) { + if (mob.getTarget() != creature) { mob.clearAggroList(); } addAttackDesire(mob, creature); @@ -350,20 +289,15 @@ public final class Baium extends AbstractNpcAI } } - if (!found) - { - if (mob.isInsideRadius(_baium, 40, true, false)) - { - if (mob.getTarget() != _baium) - { + if (!found) { + if (mob.isInsideRadius(_baium, 40, true, false)) { + if (mob.getTarget() != _baium) { mob.clearAggroList(); } mob.setIsRunning(true); mob.addDamageHate(_baium, 0, 999); mob.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, _baium); - } - else - { + } else { mob.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, _baium); } } @@ -372,19 +306,14 @@ public final class Baium extends AbstractNpcAI } break; } - case "CHECK_ATTACK": - { - if ((npc != null) && ((_lastAttack + 1800000) < System.currentTimeMillis())) - { + case "CHECK_ATTACK": { + if ((npc != null) && ((_lastAttack + 1800000) < System.currentTimeMillis())) { cancelQuestTimers("SELECT_TARGET"); notifyEvent("CLEAR_ZONE", null, null); addSpawn(BAIUM_STONE, BAIUM_LOC, false, 0); setStatus(ALIVE); - } - else if (npc != null) - { - if (((_lastAttack + 300000) < System.currentTimeMillis()) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.75))) - { + } else if (npc != null) { + if (((_lastAttack + 300000) < System.currentTimeMillis()) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.75))) { npc.setTarget(npc); npc.doCast(HEAL_OF_BAIUM); } @@ -392,87 +321,63 @@ public final class Baium extends AbstractNpcAI } break; } - case "CLEAR_STATUS": - { + case "CLEAR_STATUS": { setStatus(ALIVE); addSpawn(BAIUM_STONE, BAIUM_LOC, false, 0); break; } - case "CLEAR_ZONE": - { - for (L2Character charInside : zone.getCharactersInside()) - { - if (charInside != null) - { - if (charInside.isNpc()) - { + case "CLEAR_ZONE": { + for (L2Character charInside : zone.getCharactersInside()) { + if (charInside != null) { + if (charInside.isNpc()) { charInside.deleteMe(); - } - else if (charInside.isPlayer()) - { + } else if (charInside.isPlayer()) { notifyEvent("teleportOut", null, (L2PcInstance) charInside); } } } break; } - case "RESPAWN_BAIUM": - { - if (getStatus() == DEAD) - { + case "RESPAWN_BAIUM": { + if (getStatus() == DEAD) { setRespawn(0); cancelQuestTimer("CLEAR_STATUS", null, null); notifyEvent("CLEAR_STATUS", null, null); - } - else - { + } else { player.sendMessage(getClass().getSimpleName() + ": You cant respawn Baium while Baium is alive!"); } break; } - case "ABORT_FIGHT": - { - if (getStatus() == IN_FIGHT) - { + case "ABORT_FIGHT": { + if (getStatus() == IN_FIGHT) { _baium = null; notifyEvent("CLEAR_ZONE", null, null); notifyEvent("CLEAR_STATUS", null, null); player.sendMessage(getClass().getSimpleName() + ": Aborting fight!"); - } - else - { + } else { player.sendMessage(getClass().getSimpleName() + ": You cant abort attack right now!"); } cancelQuestTimers("CHECK_ATTACK"); cancelQuestTimers("SELECT_TARGET"); break; } - case "DESPAWN_MINIONS": - { - if (getStatus() == IN_FIGHT) - { - for (L2Character charInside : zone.getCharactersInside()) - { - if ((charInside != null) && charInside.isNpc() && (charInside.getId() == ARCHANGEL)) - { + case "DESPAWN_MINIONS": { + if (getStatus() == IN_FIGHT) { + for (L2Character charInside : zone.getCharactersInside()) { + if ((charInside != null) && charInside.isNpc() && (charInside.getId() == ARCHANGEL)) { charInside.deleteMe(); } } - if (player != null) - { + if (player != null) { player.sendMessage(getClass().getSimpleName() + ": All archangels has been deleted!"); } - } - else if (player != null) - { + } else if (player != null) { player.sendMessage(getClass().getSimpleName() + ": You cant despawn archangels right now!"); } break; } - case "MANAGE_SKILLS": - { - if (npc != null) - { + case "MANAGE_SKILLS": { + if (npc != null) { manageSkills(npc); } break; @@ -482,64 +387,44 @@ public final class Baium extends AbstractNpcAI } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) { _lastAttack = System.currentTimeMillis(); - if (npc.getId() == BAIUM) - { - if ((attacker.getMountType() == MountType.STRIDER) && !attacker.isAffectedBySkill(ANTI_STRIDER.getSkillId())) - { - if (!npc.isSkillDisabled(ANTI_STRIDER.getSkill())) - { + if (npc.getId() == BAIUM) { + if ((attacker.getMountType() == MountType.STRIDER) && !attacker.isAffectedBySkill(ANTI_STRIDER.getSkillId())) { + if (!npc.isSkillDisabled(ANTI_STRIDER.getSkill())) { npc.setTarget(attacker); npc.doCast(ANTI_STRIDER); } } - if (skill == null) - { + if (skill == null) { refreshAiParams(attacker, npc, (damage * 1000)); - } - else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.25)) - { + } else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.25)) { refreshAiParams(attacker, npc, ((damage / 3) * 100)); - } - else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.5)) - { + } else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.5)) { refreshAiParams(attacker, npc, (damage * 20)); - } - else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.75)) - { + } else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.75)) { refreshAiParams(attacker, npc, (damage * 10)); - } - else - { + } else { refreshAiParams(attacker, npc, ((damage / 3) * 20)); } manageSkills(npc); - } - else - { + } else { final L2Attackable mob = (L2Attackable) npc; final L2Character mostHated = mob.getMostHated(); - if ((getRandom(100) < 10) && mob.checkDoCastConditions(SPEAR_ATTACK.getSkill())) - { - if ((mostHated != null) && (npc.calculateDistance(mostHated, true, false) < 1000) && zone.isCharacterInZone(mostHated)) - { + if ((getRandom(100) < 10) && mob.checkDoCastConditions(SPEAR_ATTACK.getSkill())) { + if ((mostHated != null) && (npc.calculateDistance(mostHated, true, false) < 1000) && zone.isCharacterInZone(mostHated)) { mob.setTarget(mostHated); mob.doCast(SPEAR_ATTACK); - } - else if (zone.isCharacterInZone(attacker)) - { + } else if (zone.isCharacterInZone(attacker)) { mob.setTarget(attacker); mob.doCast(SPEAR_ATTACK); } } - if ((getRandom(100) < 5) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.5)) && mob.checkDoCastConditions(ANGEL_HEAL.getSkill())) - { + if ((getRandom(100) < 5) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.5)) && mob.checkDoCastConditions(ANGEL_HEAL.getSkill())) { npc.setTarget(npc); npc.doCast(ANGEL_HEAL); } @@ -548,10 +433,8 @@ public final class Baium extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (zone.isCharacterInZone(killer)) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (zone.isCharacterInZone(killer)) { setStatus(DEAD); addSpawn(TELE_CUBE, TELEPORT_CUBIC_LOC, false, 900000); zone.broadcastPacket(Music.BS01_D_10000.getPacket()); @@ -566,34 +449,22 @@ public final class Baium extends AbstractNpcAI } @Override - public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) - { - if (!zone.isInsideZone(creature) || (creature.isNpc() && (creature.getId() == BAIUM_STONE))) - { + public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) { + if (!zone.isInsideZone(creature) || (creature.isNpc() && (creature.getId() == BAIUM_STONE))) { return super.onSeeCreature(npc, creature, isSummon); } - if (creature.isInCategory(CategoryType.CLERIC_GROUP)) - { - if (npc.getCurrentHp() < (npc.getMaxHp() * 0.25)) - { + if (creature.isInCategory(CategoryType.CLERIC_GROUP)) { + if (npc.getCurrentHp() < (npc.getMaxHp() * 0.25)) { refreshAiParams(creature, npc, 10000); - } - else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.5)) - { + } else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.5)) { refreshAiParams(creature, npc, 10000, 6000); - } - else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.75)) - { + } else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.75)) { refreshAiParams(creature, npc, 10000, 3000); - } - else - { + } else { refreshAiParams(creature, npc, 10000, 2000); } - } - else - { + } else { refreshAiParams(creature, npc, 10000, 1000); } manageSkills(npc); @@ -601,43 +472,34 @@ public final class Baium extends AbstractNpcAI } @Override - public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) - { + public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) { startQuestTimer("MANAGE_SKILLS", 1000, npc, null); - if (!zone.isCharacterInZone(npc) && (_baium != null)) - { + if (!zone.isCharacterInZone(npc) && (_baium != null)) { _baium.teleToLocation(BAIUM_LOC); } return super.onSpellFinished(npc, player, skill); } @Override - public boolean unload(boolean removeFromList) - { - if (_baium != null) - { + public boolean unload(boolean removeFromList) { + if (_baium != null) { _baium.deleteMe(); } return super.unload(removeFromList); } - private final void refreshAiParams(L2Character attacker, L2Npc npc, int damage) - { + private final void refreshAiParams(L2Character attacker, L2Npc npc, int damage) { refreshAiParams(attacker, npc, damage, damage); } - private final void refreshAiParams(L2Character attacker, L2Npc npc, int damage, int aggro) - { + private final void refreshAiParams(L2Character attacker, L2Npc npc, int damage, int aggro) { final int newAggroVal = damage + getRandom(3000); final int aggroVal = aggro + 1000; final NpcVariables vars = npc.getVariables(); - for (int i = 0; i < 3; i++) - { - if (attacker == vars.getObject("c_quest" + i, L2Character.class)) - { - if (vars.getInt("i_quest" + i) < aggroVal) - { + for (int i = 0; i < 3; i++) { + if (attacker == vars.getObject("c_quest" + i, L2Character.class)) { + if (vars.getInt("i_quest" + i) < aggroVal) { vars.set("i_quest" + i, newAggroVal); } return; @@ -648,153 +510,102 @@ public final class Baium extends AbstractNpcAI vars.set("c_quest" + index, attacker); } - private int getStatus() - { + private int getStatus() { return GrandBossManager.getInstance().getBossStatus(BAIUM); } - private void addBoss(L2GrandBossInstance grandboss) - { + private void addBoss(L2GrandBossInstance grandboss) { GrandBossManager.getInstance().addBoss(grandboss); } - private void setStatus(int status) - { + private void setStatus(int status) { GrandBossManager.getInstance().setBossStatus(BAIUM, status); } - private void setRespawn(long respawnTime) - { + private void setRespawn(long respawnTime) { GrandBossManager.getInstance().getStatsSet(BAIUM).set("respawn_time", (System.currentTimeMillis() + respawnTime)); } - private void manageSkills(L2Npc npc) - { - if (npc.isCastingNow() || npc.isCoreAIDisabled() || !npc.isInCombat()) - { + private void manageSkills(L2Npc npc) { + if (npc.isCastingNow() || npc.isCoreAIDisabled() || !npc.isInCombat()) { return; } final NpcVariables vars = npc.getVariables(); - for (int i = 0; i < 3; i++) - { + for (int i = 0; i < 3; i++) { final L2Character attacker = vars.getObject("c_quest" + i, L2Character.class); - if ((attacker == null) || ((npc.calculateDistance(attacker, true, false) > 9000) || attacker.isDead())) - { + if ((attacker == null) || ((npc.calculateDistance(attacker, true, false) > 9000) || attacker.isDead())) { vars.set("i_quest" + i, 0); } } final int index = Util.getIndexOfMaxValue(vars.getInt("i_quest0"), vars.getInt("i_quest1"), vars.getInt("i_quest2")); final L2Character player = vars.getObject("c_quest" + index, L2Character.class); final int i2 = vars.getInt("i_quest" + index); - if ((i2 > 0) && (getRandom(100) < 70)) - { + if ((i2 > 0) && (getRandom(100) < 70)) { vars.set("i_quest" + index, 500); } SkillHolder skillToCast = null; - if ((player != null) && !player.isDead()) - { - if (npc.getCurrentHp() > (npc.getMaxHp() * 0.75)) - { - if (getRandom(100) < 10) - { + if ((player != null) && !player.isDead()) { + if (npc.getCurrentHp() > (npc.getMaxHp() * 0.75)) { + if (getRandom(100) < 10) { skillToCast = ENERGY_WAVE; - } - else if (getRandom(100) < 10) - { + } else if (getRandom(100) < 10) { skillToCast = EARTH_QUAKE; - } - else - { + } else { skillToCast = BAIUM_ATTACK; } - } - else if (npc.getCurrentHp() > (npc.getMaxHp() * 0.5)) - { - if (getRandom(100) < 10) - { + } else if (npc.getCurrentHp() > (npc.getMaxHp() * 0.5)) { + if (getRandom(100) < 10) { skillToCast = GROUP_HOLD; - } - else if (getRandom(100) < 10) - { + } else if (getRandom(100) < 10) { skillToCast = ENERGY_WAVE; - } - else if (getRandom(100) < 10) - { + } else if (getRandom(100) < 10) { skillToCast = EARTH_QUAKE; - } - else - { + } else { skillToCast = BAIUM_ATTACK; } - } - else if (npc.getCurrentHp() > (npc.getMaxHp() * 0.25)) - { - if (getRandom(100) < 10) - { + } else if (npc.getCurrentHp() > (npc.getMaxHp() * 0.25)) { + if (getRandom(100) < 10) { skillToCast = THUNDERBOLT; - } - else if (getRandom(100) < 10) - { + } else if (getRandom(100) < 10) { skillToCast = GROUP_HOLD; - } - else if (getRandom(100) < 10) - { + } else if (getRandom(100) < 10) { skillToCast = ENERGY_WAVE; - } - else if (getRandom(100) < 10) - { + } else if (getRandom(100) < 10) { skillToCast = EARTH_QUAKE; - } - else - { + } else { skillToCast = BAIUM_ATTACK; } - } - else if (getRandom(100) < 10) - { + } else if (getRandom(100) < 10) { skillToCast = THUNDERBOLT; - } - else if (getRandom(100) < 10) - { + } else if (getRandom(100) < 10) { skillToCast = GROUP_HOLD; - } - else if (getRandom(100) < 10) - { + } else if (getRandom(100) < 10) { skillToCast = ENERGY_WAVE; - } - else if (getRandom(100) < 10) - { + } else if (getRandom(100) < 10) { skillToCast = EARTH_QUAKE; - } - else - { + } else { skillToCast = BAIUM_ATTACK; } } - if ((skillToCast != null) && npc.checkDoCastConditions(skillToCast.getSkill())) - { + if ((skillToCast != null) && npc.checkDoCastConditions(skillToCast.getSkill())) { npc.setTarget(player); npc.doCast(skillToCast); } } - private L2PcInstance getRandomPlayer(L2Npc npc) - { - for (L2Character creature : npc.getKnownList().getKnownCharactersInRadius(2000)) - { - if ((creature != null) && creature.isPlayer() && zone.isInsideZone(creature) && !creature.isDead()) - { + private L2PcInstance getRandomPlayer(L2Npc npc) { + for (L2Character creature : npc.getKnownList().getKnownCharactersInRadius(2000)) { + if ((creature != null) && creature.isPlayer() && zone.isInsideZone(creature) && !creature.isDead()) { return (L2PcInstance) creature; } } return null; } - public static void main(String[] args) - { + public static void main(String[] args) { new Baium(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/Ballista.java b/src/main/java/com/l2jserver/datapack/ai/individual/Ballista.java index af68f343ea..95c2a2e64f 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/Ballista.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/Ballista.java @@ -32,11 +32,9 @@ import com.l2jserver.gameserver.network.SystemMessageId; * Ballista AI. * @author St3eT */ -public final class Ballista extends AbstractNpcAI -{ +public final class Ballista extends AbstractNpcAI { // NPCs - private static final int[] BALLISTA = - { + private static final int[] BALLISTA = { 35685, // Shanty Fortress 35723, // Southern Fortress 35754, // Hive Fortress @@ -64,22 +62,17 @@ public final class Ballista extends AbstractNpcAI // Misc private static final int MIN_CLAN_LV = 5; - private Ballista() - { + private Ballista() { super(Ballista.class.getSimpleName(), "ai/individual"); addSkillSeeId(BALLISTA); addSpawnId(BALLISTA); } @Override - public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) - { - if ((skill != null) && (caster.getTarget() == npc) && (getRandom(100) < 40) && (skill == BOMB.getSkill())) - { - if (npc.getFort().getSiege().isInProgress()) - { - if ((caster.getClan() != null) && (caster.getClan().getLevel() >= MIN_CLAN_LV)) - { + public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) { + if ((skill != null) && (caster.getTarget() == npc) && (getRandom(100) < 40) && (skill == BOMB.getSkill())) { + if (npc.getFort().getSiege().isInProgress()) { + if ((caster.getClan() != null) && (caster.getClan().getLevel() >= MIN_CLAN_LV)) { caster.getClan().addReputationScore(clan().getKillBallistaPoints(), true); caster.sendPacket(SystemMessageId.BALLISTA_DESTROYED_CLAN_REPU_INCREASED); } @@ -90,15 +83,13 @@ public final class Ballista extends AbstractNpcAI } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { npc.disableCoreAI(true); npc.setIsMortal(false); return super.onSpawn(npc); } - public static void main(String[] args) - { + public static void main(String[] args) { new Ballista(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/Beleth.java b/src/main/java/com/l2jserver/datapack/ai/individual/Beleth.java index 35854f470e..65fad9f1ff 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/Beleth.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/Beleth.java @@ -56,8 +56,7 @@ import com.l2jserver.gameserver.util.Util; * Beleth's AI. * @author Treat, Sahar */ -public final class Beleth extends AbstractNpcAI -{ +public final class Beleth extends AbstractNpcAI { // Status private static final int ALIVE = 0; private static final int INIT = 1; @@ -98,8 +97,7 @@ public final class Beleth extends AbstractNpcAI private long _lastAttack; private final List<L2Npc> _minions = new CopyOnWriteArrayList<>(); - private Beleth() - { + private Beleth() { super(Beleth.class.getSimpleName(), "ai/individual"); addEnterZoneId(ZONE.getId()); registerMobs(REAL_BELETH, FAKE_BELETH); @@ -108,49 +106,36 @@ public final class Beleth extends AbstractNpcAI addFirstTalkId(ELF); StatsSet info = GrandBossManager.getInstance().getStatsSet(REAL_BELETH); int status = GrandBossManager.getInstance().getBossStatus(REAL_BELETH); - if (status == DEAD) - { + if (status == DEAD) { final long time = (info.getLong("respawn_time") - System.currentTimeMillis()); - if (time > 0) - { + if (time > 0) { startQuestTimer("BELETH_UNLOCK", time, null, null); - } - else - { + } else { GrandBossManager.getInstance().setBossStatus(REAL_BELETH, ALIVE); } - } - else if (status != ALIVE) - { + } else if (status != ALIVE) { GrandBossManager.getInstance().setBossStatus(REAL_BELETH, ALIVE); } DoorData.getInstance().getDoor(DOOR1).openMe(); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { - case "BELETH_UNLOCK": - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { + case "BELETH_UNLOCK": { GrandBossManager.getInstance().setBossStatus(REAL_BELETH, ALIVE); DoorData.getInstance().getDoor(DOOR1).openMe(); break; } - case "CAST": - { - if (!npc.isDead() && !npc.isCastingNow()) - { + case "CAST": { + if (!npc.isDead() && !npc.isCastingNow()) { npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); npc.doCast(FIREBALL); } break; } - case "SPAWN1": - { - ZONE.getCharactersInside().forEach(c -> - { + case "SPAWN1": { + ZONE.getCharactersInside().forEach(c -> { c.disableAllSkills(); c.setIsInvul(true); c.setIsImmobilized(true); @@ -168,36 +153,31 @@ public final class Beleth extends AbstractNpcAI startQuestTimer("SPAWN2", 300, null, null); break; } - case "SPAWN2": - { + case "SPAWN2": { ZONE.broadcastPacket(new SpecialCamera(_camera1, 1800, -45, -45, 5000, 5000, 0, 0, 1, 0, 0)); startQuestTimer("SPAWN3", 4900, null, null); break; } - case "SPAWN3": - { + case "SPAWN3": { ZONE.broadcastPacket(new SpecialCamera(_camera1, 2500, -120, -45, 5000, 5000, 0, 0, 1, 0, 0)); startQuestTimer("SPAWN4", 4900, null, null); break; } - case "SPAWN4": - { + case "SPAWN4": { ZONE.broadcastPacket(new SpecialCamera(_camera2, 2200, 130, 0, 0, 1500, -20, 15, 1, 0, 0)); startQuestTimer("SPAWN5", 1400, null, null); break; } - case "SPAWN5": - { + case "SPAWN5": { ZONE.broadcastPacket(new SpecialCamera(_camera2, 2300, 100, 0, 2000, 4500, 0, 10, 1, 0, 0)); startQuestTimer("SPAWN6", 2500, null, null); break; } - case "SPAWN6": - { + case "SPAWN6": { final L2DoorInstance door = DoorData.getInstance().getDoor(DOOR1); door.closeMe(); @@ -207,16 +187,14 @@ public final class Beleth extends AbstractNpcAI startQuestTimer("SPAWN7", 1700, null, null); break; } - case "SPAWN7": - { + case "SPAWN7": { ZONE.broadcastPacket(new SpecialCamera(_camera4, 1500, 210, 0, 0, 1500, 0, 0, 1, 0, 0)); ZONE.broadcastPacket(new SpecialCamera(_camera4, 900, 255, 0, 5000, 6500, 0, 10, 1, 0, 0)); startQuestTimer("SPAWN8", 6000, null, null); break; } - case "SPAWN8": - { + case "SPAWN8": { _whirpool = addSpawn(WHIRPOOL, new Location(16323, 214917, -9356)); ZONE.broadcastPacket(new SpecialCamera(_camera4, 900, 255, 0, 0, 1500, 0, 10, 1, 0, 0)); @@ -224,15 +202,13 @@ public final class Beleth extends AbstractNpcAI startQuestTimer("SPAWN9", 1000, null, null); break; } - case "SPAWN9": - { + case "SPAWN9": { ZONE.broadcastPacket(new SpecialCamera(_camera4, 1000, 255, 0, 7000, 17000, 0, 25, 1, 0, 0)); startQuestTimer("SPAWN10", 3000, null, null); break; } - case "SPAWN10": - { + case "SPAWN10": { _beleth = addSpawn(REAL_BELETH, new Location(16321, 214211, -9352, 49369)); _beleth.disableAllSkills(); _beleth.setIsInvul(true); @@ -241,12 +217,10 @@ public final class Beleth extends AbstractNpcAI startQuestTimer("SPAWN11", 200, null, null); break; } - case "SPAWN11": - { + case "SPAWN11": { ZONE.broadcastPacket(new SocialAction(_beleth.getObjectId(), 1)); - for (int i = 0; i < 6; i++) - { + for (int i = 0; i < 6; i++) { int x = (int) ((150 * Math.cos(i * 1.046666667)) + 16323); int y = (int) ((150 * Math.sin(i * 1.046666667)) + 213059); L2Npc minion = addSpawn(FAKE_BELETH, new Location(x, y, -9357, 49152)); @@ -259,62 +233,53 @@ public final class Beleth extends AbstractNpcAI startQuestTimer("SPAWN12", 6800, null, null); break; } - case "SPAWN12": - { + case "SPAWN12": { ZONE.broadcastPacket(new SpecialCamera(_beleth, 0, 270, -5, 0, 4000, 0, 0, 1, 0, 0)); startQuestTimer("SPAWN13", 3500, null, null); break; } - case "SPAWN13": - { + case "SPAWN13": { ZONE.broadcastPacket(new SpecialCamera(_beleth, 800, 270, 10, 3000, 6000, 0, 0, 1, 0, 0)); startQuestTimer("SPAWN14", 5000, null, null); break; } - case "SPAWN14": - { + case "SPAWN14": { ZONE.broadcastPacket(new SpecialCamera(_camera3, 100, 270, 15, 0, 5000, 0, 0, 1, 0, 0)); ZONE.broadcastPacket(new SpecialCamera(_camera3, 100, 270, 15, 0, 5000, 0, 0, 1, 0, 0)); startQuestTimer("SPAWN15", 100, null, null); break; } - case "SPAWN15": - { + case "SPAWN15": { ZONE.broadcastPacket(new SpecialCamera(_camera3, 100, 270, 15, 3000, 6000, 0, 5, 1, 0, 0)); startQuestTimer("SPAWN16", 1400, null, null); break; } - case "SPAWN16": - { + case "SPAWN16": { _beleth.teleToLocation(BELETH_SPAWN); startQuestTimer("SPAWN17", 200, null, null); break; } - case "SPAWN17": - { + case "SPAWN17": { ZONE.broadcastPacket(new MagicSkillUse(_beleth, _beleth, 5532, 1, 2000, 0)); startQuestTimer("SPAWN18", 2000, null, null); break; } - case "SPAWN18": - { + case "SPAWN18": { ZONE.broadcastPacket(new SpecialCamera(_camera3, 700, 270, 20, 1500, 8000, 0, 0, 1, 0, 0)); startQuestTimer("SPAWN19", 6900, null, null); break; } - case "SPAWN19": - { + case "SPAWN19": { ZONE.broadcastPacket(new SpecialCamera(_camera3, 40, 260, 0, 0, 4000, 0, 0, 1, 0, 0)); - for (L2Npc fakeBeleth : _minions) - { + for (L2Npc fakeBeleth : _minions) { fakeBeleth.spawnMe(); fakeBeleth.disableAllSkills(); fakeBeleth.setIsInvul(true); @@ -324,41 +289,35 @@ public final class Beleth extends AbstractNpcAI startQuestTimer("SPAWN20", 3000, null, null); break; } - case "SPAWN20": - { + case "SPAWN20": { ZONE.broadcastPacket(new SpecialCamera(_camera3, 40, 280, 0, 0, 4000, 5, 0, 1, 0, 0)); startQuestTimer("SPAWN21", 3000, null, null); break; } - case "SPAWN21": - { + case "SPAWN21": { ZONE.broadcastPacket(new SpecialCamera(_camera3, 5, 250, 5, 0, 13000, 20, 15, 1, 0, 0)); startQuestTimer("SPAWN22", 1000, null, null); break; } - case "SPAWN22": - { + case "SPAWN22": { ZONE.broadcastPacket(new SocialAction(_beleth.getObjectId(), 3)); startQuestTimer("SPAWN23", 4000, null, null); break; } - case "SPAWN23": - { + case "SPAWN23": { ZONE.broadcastPacket(new MagicSkillUse(_beleth, _beleth, 5533, 1, 2000, 0)); startQuestTimer("SPAWN24", 6800, null, null); break; } - case "SPAWN24": - { + case "SPAWN24": { _beleth.deleteMe(); _beleth = null; - for (L2Npc fakeBeleth : _minions) - { + for (L2Npc fakeBeleth : _minions) { fakeBeleth.deleteMe(); } _minions.clear(); @@ -368,8 +327,7 @@ public final class Beleth extends AbstractNpcAI _camera3.deleteMe(); _camera4.deleteMe(); - for (L2Character c : ZONE.getCharactersInside()) - { + for (L2Character c : ZONE.getCharactersInside()) { c.enableAllSkills(); c.setIsInvul(false); c.setIsImmobilized(false); @@ -382,13 +340,11 @@ public final class Beleth extends AbstractNpcAI startQuestTimer("SPAWN25", 60000, null, null); break; } - case "SPAWN25": - { + case "SPAWN25": { _minions.clear(); int a = 0; - for (int i = 0; i < 16; i++) - { + for (int i = 0; i < 16; i++) { a++; int x = (int) ((650 * Math.cos(i * 0.39)) + 16323); @@ -397,8 +353,7 @@ public final class Beleth extends AbstractNpcAI npc = addSpawn(FAKE_BELETH, new Location(x, y, -9357, 49152)); _minions.add(npc); - if (a >= 2) - { + if (a >= 2) { npc.setIsOverloaded(true); a = 0; } @@ -406,8 +361,7 @@ public final class Beleth extends AbstractNpcAI int[] xm = new int[16]; int[] ym = new int[16]; - for (int i = 0; i < 4; i++) - { + for (int i = 0; i < 4; i++) { xm[i] = (int) ((1700 * Math.cos((i * 1.57) + 0.78)) + 16323); ym[i] = (int) ((1700 * Math.sin((i * 1.57) + 0.78)) + 213170); @@ -466,13 +420,11 @@ public final class Beleth extends AbstractNpcAI _allowedObjId = _minions.get(getRandom(_minions.size())).getObjectId(); break; } - case "SPAWN_REAL": - { + case "SPAWN_REAL": { _beleth = addSpawn(REAL_BELETH, new Location(16323, 213170, -9357, 49152)); break; } - case "SPAWN26": - { + case "SPAWN26": { _beleth.doDie(null); _camera1 = addSpawn(29122, new Location(16323, 213170, -9357)); @@ -486,30 +438,26 @@ public final class Beleth extends AbstractNpcAI startQuestTimer("SPAWN27", 4000, null, null); break; } - case "SPAWN27": - { + case "SPAWN27": { ZONE.broadcastPacket(new SpecialCamera(_camera1, 400, 295, 25, 4000, 5000, 0, 0, 1, 0, 0)); startQuestTimer("SPAWN28", 4500, null, null); break; } - case "SPAWN28": - { + case "SPAWN28": { ZONE.broadcastPacket(new SpecialCamera(_camera1, 400, 295, 10, 4000, 11000, 0, 25, 1, 0, 0)); startQuestTimer("SPAWN29", 9000, null, null); break; } - case "SPAWN29": - { + case "SPAWN29": { ZONE.broadcastPacket(new SpecialCamera(_camera1, 250, 90, 25, 0, 1000, 0, 0, 1, 0, 0)); ZONE.broadcastPacket(new SpecialCamera(_camera1, 250, 90, 25, 0, 10000, 0, 0, 1, 0, 0)); startQuestTimer("SPAWN30", 2000, null, null); break; } - case "SPAWN30": - { + case "SPAWN30": { _priest.spawnMe(); _beleth.deleteMe(); @@ -518,8 +466,7 @@ public final class Beleth extends AbstractNpcAI startQuestTimer("SPAWN31", 3500, null, null); break; } - case "SPAWN31": - { + case "SPAWN31": { ZONE.broadcastPacket(new SpecialCamera(_camera2, 800, 180, 0, 0, 4000, 0, 10, 1, 0, 0)); ZONE.broadcastPacket(new SpecialCamera(_camera2, 800, 180, 0, 0, 4000, 0, 10, 1, 0, 0)); @@ -535,37 +482,27 @@ public final class Beleth extends AbstractNpcAI _camera2.deleteMe(); _whirpool.deleteMe(); - for (L2Character c : ZONE.getCharactersInside()) - { + for (L2Character c : ZONE.getCharactersInside()) { c.enableAllSkills(); c.setIsInvul(false); c.setIsImmobilized(false); } break; } - case "CHECK_ATTACK": - { - if ((_lastAttack + 900000) < System.currentTimeMillis()) - { + case "CHECK_ATTACK": { + if ((_lastAttack + 900000) < System.currentTimeMillis()) { GrandBossManager.getInstance().setBossStatus(REAL_BELETH, ALIVE); - for (L2Character charInside : ZONE.getCharactersInside()) - { - if (charInside != null) - { - if (charInside.isNpc()) - { + for (L2Character charInside : ZONE.getCharactersInside()) { + if (charInside != null) { + if (charInside.isNpc()) { charInside.deleteMe(); - } - else if (charInside.isPlayer()) - { + } else if (charInside.isPlayer()) { charInside.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(charInside, TeleportWhereType.TOWN)); } } } cancelQuestTimer("CHECK_ATTACK", null, null); - } - else - { + } else { startQuestTimer("CHECK_ATTACK", 60000, null, null); } break; @@ -575,16 +512,12 @@ public final class Beleth extends AbstractNpcAI } @Override - public String onEnterZone(L2Character character, L2ZoneType zone) - { - if (character.isPlayer() && (GrandBossManager.getInstance().getBossStatus(REAL_BELETH) == INIT)) - { - if (_priest != null) - { + public String onEnterZone(L2Character character, L2ZoneType zone) { + if (character.isPlayer() && (GrandBossManager.getInstance().getBossStatus(REAL_BELETH) == INIT)) { + if (_priest != null) { _priest.deleteMe(); } - if (_stone != null) - { + if (_stone != null) { _stone.deleteMe(); } @@ -596,10 +529,8 @@ public final class Beleth extends AbstractNpcAI } @Override - public String onSkillSee(L2Npc npc, L2PcInstance player, Skill skill, L2Object[] targets, boolean isSummon) - { - if (!npc.isDead() && (npc.getId() == REAL_BELETH) && !npc.isCastingNow() && skill.hasEffectType(L2EffectType.HP) && (getRandom(100) < 80)) - { + public String onSkillSee(L2Npc npc, L2PcInstance player, Skill skill, L2Object[] targets, boolean isSummon) { + if (!npc.isDead() && (npc.getId() == REAL_BELETH) && !npc.isCastingNow() && skill.hasEffectType(L2EffectType.HP) && (getRandom(100) < 80)) { npc.setTarget(player); npc.doCast(HORN_OF_RISING); } @@ -608,14 +539,10 @@ public final class Beleth extends AbstractNpcAI } @Override - public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) - { - if (!npc.isDead() && !npc.isCastingNow()) - { - if (getRandom(100) < 40) - { - if (!npc.getKnownList().getKnownPlayersInRadius(200).isEmpty()) - { + public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) { + if (!npc.isDead() && !npc.isCastingNow()) { + if (getRandom(100) < 40) { + if (!npc.getKnownList().getKnownPlayersInRadius(200).isEmpty()) { npc.doCast(BLEED); return null; } @@ -628,38 +555,29 @@ public final class Beleth extends AbstractNpcAI } @Override - public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) - { - if (!npc.isDead() && !npc.isCastingNow()) - { - if (!player.isDead()) - { + public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) { + if (!npc.isDead() && !npc.isCastingNow()) { + if (!player.isDead()) { final double distance2 = npc.calculateDistance(player, false, false); - if ((distance2 > 890) && !npc.isMovementDisabled()) - { + if ((distance2 > 890) && !npc.isMovementDisabled()) { npc.setTarget(player); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); double speed = npc.isRunning() ? npc.getRunSpeed() : npc.getWalkSpeed(); int time = (int) (((distance2 - 890) / speed) * 1000); startQuestTimer("CAST", time, npc, null); - } - else if (distance2 < 890) - { + } else if (distance2 < 890) { npc.setTarget(player); npc.doCast(FIREBALL); } return null; } - if (getRandom(100) < 40) - { - if (!npc.getKnownList().getKnownPlayersInRadius(200).isEmpty()) - { + if (getRandom(100) < 40) { + if (!npc.getKnownList().getKnownPlayersInRadius(200).isEmpty()) { npc.doCast(LIGHTENING); return null; } } - for (L2PcInstance plr : npc.getKnownList().getKnownPlayersInRadius(950)) - { + for (L2PcInstance plr : npc.getKnownList().getKnownPlayersInRadius(950)) { npc.setTarget(plr); npc.doCast(FIREBALL); return null; @@ -670,15 +588,12 @@ public final class Beleth extends AbstractNpcAI } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { npc.setRunning(); - if (!npc.getKnownList().getKnownPlayersInRadius(300).isEmpty() && (getRandom(100) < 60)) - { + if (!npc.getKnownList().getKnownPlayersInRadius(300).isEmpty() && (getRandom(100) < 60)) { npc.doCast(BLEED); } - if (npc.getId() == REAL_BELETH) - { + if (npc.getId() == REAL_BELETH) { npc.getSpawn().setRespawnDelay(0); } @@ -686,19 +601,15 @@ public final class Beleth extends AbstractNpcAI } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String html; - if ((_killer != null) && (player.getObjectId() == _killer.getObjectId())) - { + if ((_killer != null) && (player.getObjectId() == _killer.getObjectId())) { _killer = null; giveItems(player, RING); html = "32470a.htm"; - } - else - { + } else { html = "32470b.htm"; } @@ -706,40 +617,30 @@ public final class Beleth extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return onTalk(npc, player); } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (getRandom(100) < 40) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (getRandom(100) < 40) { return null; } final double distance = npc.calculateDistance(attacker, false, false); - if ((distance > 500) || (getRandom(100) < 80)) - { - for (L2Npc beleth : _minions) - { - if ((beleth != null) && !beleth.isDead() && Util.checkIfInRange(900, beleth, attacker, false) && !beleth.isCastingNow()) - { + if ((distance > 500) || (getRandom(100) < 80)) { + for (L2Npc beleth : _minions) { + if ((beleth != null) && !beleth.isDead() && Util.checkIfInRange(900, beleth, attacker, false) && !beleth.isCastingNow()) { beleth.setTarget(attacker); beleth.doCast(FIREBALL); } } - if ((_beleth != null) && !_beleth.isDead() && Util.checkIfInRange(900, _beleth, attacker, false) && !_beleth.isCastingNow()) - { + if ((_beleth != null) && !_beleth.isDead() && Util.checkIfInRange(900, _beleth, attacker, false) && !_beleth.isCastingNow()) { _beleth.setTarget(attacker); _beleth.doCast(FIREBALL); } - } - else if (!npc.isDead() && !npc.isCastingNow()) - { - if (!npc.getKnownList().getKnownPlayersInRadius(200).isEmpty()) - { + } else if (!npc.isDead() && !npc.isCastingNow()) { + if (!npc.getKnownList().getKnownPlayersInRadius(200).isEmpty()) { npc.doCast(LIGHTENING); return null; } @@ -750,10 +651,8 @@ public final class Beleth extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (npc.getId() == REAL_BELETH) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (npc.getId() == REAL_BELETH) { cancelQuestTimer("CHECK_ATTACK", null, null); setBelethKiller(killer); @@ -767,8 +666,7 @@ public final class Beleth extends AbstractNpcAI deleteAll(); npc.deleteMe(); - for (L2Character c : ZONE.getCharactersInside()) - { + for (L2Character c : ZONE.getCharactersInside()) { c.disableAllSkills(); c.setIsInvul(true); c.setIsImmobilized(true); @@ -786,18 +684,13 @@ public final class Beleth extends AbstractNpcAI _stone = addSpawn(STONE_COFFIN, new Location(12470, 215607, -9381, 49152)); startQuestTimer("SPAWN26", 1000, null, null); - } - else if (npc.getObjectId() == _allowedObjId) - { + } else if (npc.getObjectId() == _allowedObjId) { deleteAll(); _killedCount++; - if (_killedCount >= 5) - { + if (_killedCount >= 5) { startQuestTimer("SPAWN_REAL", 60000, null, null); - } - else - { + } else { startQuestTimer("SPAWN25", 60000, null, null); } } @@ -805,29 +698,20 @@ public final class Beleth extends AbstractNpcAI return null; } - private void setBelethKiller(L2PcInstance killer) - { - if (killer.getParty() != null) - { - if (killer.getParty().getCommandChannel() != null) - { + private void setBelethKiller(L2PcInstance killer) { + if (killer.getParty() != null) { + if (killer.getParty().getCommandChannel() != null) { _killer = killer.getParty().getCommandChannel().getLeader(); - } - else - { + } else { _killer = killer.getParty().getLeader(); } - } - else - { + } else { _killer = killer; } } - private void deleteAll() - { - _minions.stream().filter(n -> !n.isDead()).forEach(n -> - { + private void deleteAll() { + _minions.stream().filter(n -> !n.isDead()).forEach(n -> { n.abortCast(); n.setTarget(null); n.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); @@ -836,8 +720,7 @@ public final class Beleth extends AbstractNpcAI _allowedObjId = 0; } - public static void main(String[] args) - { + public static void main(String[] args) { new Beleth(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/BlackdaggerWing.java b/src/main/java/com/l2jserver/datapack/ai/individual/BlackdaggerWing.java index f2dbf6e367..81621dbaff 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/BlackdaggerWing.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/BlackdaggerWing.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.util.Util; * @author Zoey76 * @since 2.6.0.0 */ -public class BlackdaggerWing extends AbstractNpcAI -{ +public class BlackdaggerWing extends AbstractNpcAI { // NPCs private static final int BLACKDAGGER_WING = 25721; // Skills @@ -50,8 +49,7 @@ public class BlackdaggerWing extends AbstractNpcAI private static final int MAX_CHASE_DIST = 2500; private static final double MID_HP_PERCENTAGE = 0.50; - public BlackdaggerWing() - { + public BlackdaggerWing() { super(BlackdaggerWing.class.getSimpleName(), "ai/individual"); addAttackId(BLACKDAGGER_WING); addSeeCreatureId(BLACKDAGGER_WING); @@ -59,15 +57,12 @@ public class BlackdaggerWing extends AbstractNpcAI } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (Util.calculateDistance(npc, npc.getSpawn(), false, false) > MAX_CHASE_DIST) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (Util.calculateDistance(npc, npc.getSpawn(), false, false) > MAX_CHASE_DIST) { npc.teleToLocation(npc.getSpawn().getX(), npc.getSpawn().getY(), npc.getSpawn().getZ()); } - if ((npc.getCurrentHp() < (npc.getMaxHp() * MID_HP_PERCENTAGE)) && !npc.getVariables().getBoolean(MID_HP_FLAG, false)) - { + if ((npc.getCurrentHp() < (npc.getMaxHp() * MID_HP_PERCENTAGE)) && !npc.getVariables().getBoolean(MID_HP_FLAG, false)) { npc.getVariables().set(MID_HP_FLAG, true); startQuestTimer(DAMAGE_TIMER, 10000, npc, attacker); } @@ -75,15 +70,11 @@ public class BlackdaggerWing extends AbstractNpcAI } @Override - public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) - { - if (npc.getVariables().getBoolean(MID_HP_FLAG, false)) - { + public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) { + if (npc.getVariables().getBoolean(MID_HP_FLAG, false)) { final L2Character mostHated = ((L2Attackable) npc).getMostHated(); - if ((mostHated != null) && mostHated.isPlayer() && (mostHated != creature)) - { - if (getRandom(5) < 1) - { + if ((mostHated != null) && mostHated.isPlayer() && (mostHated != creature)) { + if (getRandom(5) < 1) { addSkillCastDesire(npc, creature, RANGE_MAGIC_ATTACK, 9999900000000000L); } } @@ -92,13 +83,10 @@ public class BlackdaggerWing extends AbstractNpcAI } @Override - public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) - { - if (skill.getId() == POWER_STRIKE.getSkillId()) - { + public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) { + if (skill.getId() == POWER_STRIKE.getSkillId()) { npc.getVariables().set(POWER_STRIKE_CAST_COUNT, npc.getVariables().getInt(POWER_STRIKE_CAST_COUNT) + 1); - if (npc.getVariables().getInt(POWER_STRIKE_CAST_COUNT) > 3) - { + if (npc.getVariables().getInt(POWER_STRIKE_CAST_COUNT) > 3) { addSkillCastDesire(npc, player, RANGE_MAGIC_ATTACK, 9999900000000000L); npc.getVariables().set(POWER_STRIKE_CAST_COUNT, 0); } @@ -107,18 +95,15 @@ public class BlackdaggerWing extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (DAMAGE_TIMER.equals(event)) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (DAMAGE_TIMER.equals(event)) { npc.getAI().setIntention(AI_INTENTION_ATTACK); startQuestTimer(DAMAGE_TIMER, 30000, npc, player); } return super.onAdvEvent(event, npc, player); } - public static void main(String[] args) - { + public static void main(String[] args) { new BlackdaggerWing(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/BleedingFly.java b/src/main/java/com/l2jserver/datapack/ai/individual/BleedingFly.java index c55abf3f36..33a12cff95 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/BleedingFly.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/BleedingFly.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.util.Util; * @author Zoey76 * @since 2.6.0.0 */ -public class BleedingFly extends AbstractNpcAI -{ +public class BleedingFly extends AbstractNpcAI { // NPCs private static final int BLEEDING_FLY = 25720; private static final int PARASITIC_LEECH = 25734; @@ -50,37 +49,31 @@ public class BleedingFly extends AbstractNpcAI private static final double MID_HP_PERCENTAGE = 0.50; private static final double MIN_HP_PERCENTAGE = 0.25; - public BleedingFly() - { + public BleedingFly() { super(BleedingFly.class.getSimpleName(), "ai/individual"); addAttackId(BLEEDING_FLY); addSpawnId(BLEEDING_FLY); } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { npc.getVariables().set(MID_HP_MINION_COUNT, 5); npc.getVariables().set(LOW_HP_MINION_COUNT, 10); return super.onSpawn(npc); } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (Util.calculateDistance(npc, npc.getSpawn(), false, false) > MAX_CHASE_DIST) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (Util.calculateDistance(npc, npc.getSpawn(), false, false) > MAX_CHASE_DIST) { npc.teleToLocation(npc.getSpawn().getX(), npc.getSpawn().getY(), npc.getSpawn().getZ()); } - if ((npc.getCurrentHp() < (npc.getMaxHp() * MID_HP_PERCENTAGE)) && !npc.getVariables().getBoolean(MID_HP_FLAG, false)) - { + if ((npc.getCurrentHp() < (npc.getMaxHp() * MID_HP_PERCENTAGE)) && !npc.getVariables().getBoolean(MID_HP_FLAG, false)) { npc.getVariables().set(MID_HP_FLAG, true); startQuestTimer(TIMER_MID_HP, 1000, npc, null); } - if ((npc.getCurrentHp() < (npc.getMaxHp() * MIN_HP_PERCENTAGE)) && !npc.getVariables().getBoolean(LOW_HP_FLAG, false)) - { + if ((npc.getCurrentHp() < (npc.getMaxHp() * MIN_HP_PERCENTAGE)) && !npc.getVariables().getBoolean(LOW_HP_FLAG, false)) { npc.getVariables().set(MID_HP_FLAG, false); npc.getVariables().set(LOW_HP_FLAG, true); startQuestTimer(TIMER_LOW_HP, 1000, npc, null); @@ -89,40 +82,31 @@ public class BleedingFly extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (npc.isDead()) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (npc.isDead()) { return super.onAdvEvent(event, npc, player); } - if (TIMER_MID_HP.equals(event)) - { - if (npc.getVariables().getInt(MID_HP_MINION_COUNT) > 0) - { + if (TIMER_MID_HP.equals(event)) { + if (npc.getVariables().getInt(MID_HP_MINION_COUNT) > 0) { npc.getVariables().set(MID_HP_MINION_COUNT, npc.getVariables().getInt(MID_HP_MINION_COUNT) - 1); addSkillCastDesire(npc, npc, SUMMON_PARASITE_LEECH, 9999999999900000L); addSpawn(PARASITIC_LEECH, npc.getX() + getRandom(150), npc.getY() + getRandom(150), npc.getZ(), npc.getHeading(), false, 0); addSpawn(PARASITIC_LEECH, npc.getX() + getRandom(150), npc.getY() + getRandom(150), npc.getZ(), npc.getHeading(), false, 0); - if (npc.getVariables().getBoolean(MID_HP_FLAG, false)) - { + if (npc.getVariables().getBoolean(MID_HP_FLAG, false)) { startQuestTimer(TIMER_MID_HP, 140000, npc, null); } } - } - else if (TIMER_LOW_HP.equals(event)) - { - if (npc.getVariables().getInt(LOW_HP_MINION_COUNT) > 0) - { + } else if (TIMER_LOW_HP.equals(event)) { + if (npc.getVariables().getInt(LOW_HP_MINION_COUNT) > 0) { npc.getVariables().set(LOW_HP_MINION_COUNT, npc.getVariables().getInt(LOW_HP_MINION_COUNT) - 1); addSkillCastDesire(npc, npc, SUMMON_PARASITE_LEECH, 9999999999900000L); addSkillCastDesire(npc, npc, NPC_ACUMEN_LVL_3, 9999999999900000L); addSpawn(PARASITIC_LEECH, npc.getX() + getRandom(150), npc.getY() + getRandom(150), npc.getZ(), npc.getHeading(), false, 0); addSpawn(PARASITIC_LEECH, npc.getX() + getRandom(150), npc.getY() + getRandom(150), npc.getZ(), npc.getHeading(), false, 0); - if (npc.getVariables().getBoolean(LOW_HP_FLAG, false)) - { + if (npc.getVariables().getBoolean(LOW_HP_FLAG, false)) { startQuestTimer(TIMER_LOW_HP, 80000, npc, null); } } @@ -130,8 +114,7 @@ public class BleedingFly extends AbstractNpcAI return super.onAdvEvent(event, npc, player); } - public static void main(String[] args) - { + public static void main(String[] args) { new BleedingFly(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/Core.java b/src/main/java/com/l2jserver/datapack/ai/individual/Core.java index 709c2deb0b..490230ac2e 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/Core.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/Core.java @@ -39,8 +39,7 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * Core AI. * @author DrLecter, Emperorc */ -public final class Core extends AbstractNpcAI -{ +public final class Core extends AbstractNpcAI { private static final int CORE = 29006; private static final int DEATH_KNIGHT = 29007; private static final int DOOM_WRAITH = 29008; @@ -58,37 +57,29 @@ public final class Core extends AbstractNpcAI private final List<L2Attackable> _minions = new CopyOnWriteArrayList<>(); - private Core() - { + private Core() { super(Core.class.getSimpleName(), "ai/individual"); registerMobs(CORE, DEATH_KNIGHT, DOOM_WRAITH, SUSCEPTOR); _firstAttacked = false; final StatsSet info = GrandBossManager.getInstance().getStatsSet(CORE); final int status = GrandBossManager.getInstance().getBossStatus(CORE); - if (status == DEAD) - { + if (status == DEAD) { // load the unlock date and time for Core from DB long temp = (info.getLong("respawn_time") - System.currentTimeMillis()); // if Core is locked until a certain time, mark it so and start the unlock timer // the unlock time has not yet expired. - if (temp > 0) - { + if (temp > 0) { startQuestTimer("core_unlock", temp, null, null); - } - else - { + } else { // the time has already expired while the server was offline. Immediately spawn Core. L2GrandBossInstance core = (L2GrandBossInstance) addSpawn(CORE, 17726, 108915, -6480, 0, false, 0); GrandBossManager.getInstance().setBossStatus(CORE, ALIVE); spawnBoss(core); } - } - else - { + } else { final String test = loadGlobalQuestVar("Core_Attacked"); - if (test.equalsIgnoreCase("true")) - { + if (test.equalsIgnoreCase("true")) { _firstAttacked = true; } final int loc_x = info.getInt("loc_x"); @@ -104,19 +95,16 @@ public final class Core extends AbstractNpcAI } @Override - public void saveGlobalData() - { + public void saveGlobalData() { saveGlobalQuestVar("Core_Attacked", Boolean.toString(_firstAttacked)); } - public void spawnBoss(L2GrandBossInstance npc) - { + public void spawnBoss(L2GrandBossInstance npc) { GrandBossManager.getInstance().addBoss(npc); npc.broadcastPacket(Music.BS01_A_10000.getPacket()); // Spawn minions L2Attackable mob; - for (int i = 0; i < 5; i++) - { + for (int i = 0; i < 5; i++) { final int x = 16800 + (i * 360); mob = (L2Attackable) addSpawn(DEATH_KNIGHT, x, 110000, npc.getZ(), 280 + getRandom(40), false, 0); mob.setIsRaidMinion(true); @@ -129,8 +117,7 @@ public final class Core extends AbstractNpcAI mob.setIsRaidMinion(true); _minions.add(mob); } - for (int i = 0; i < 4; i++) - { + for (int i = 0; i < 4; i++) { int x = 16800 + (i * 450); mob = (L2Attackable) addSpawn(SUSCEPTOR, x, 110300, npc.getZ(), 280 + getRandom(40), false, 0); mob.setIsRaidMinion(true); @@ -139,22 +126,16 @@ public final class Core extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equalsIgnoreCase("core_unlock")) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equalsIgnoreCase("core_unlock")) { L2GrandBossInstance core = (L2GrandBossInstance) addSpawn(CORE, 17726, 108915, -6480, 0, false, 0); GrandBossManager.getInstance().setBossStatus(CORE, ALIVE); spawnBoss(core); - } - else if (event.equalsIgnoreCase("spawn_minion")) - { + } else if (event.equalsIgnoreCase("spawn_minion")) { L2Attackable mob = (L2Attackable) addSpawn(npc.getId(), npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0); mob.setIsRaidMinion(true); _minions.add(mob); - } - else if (event.equalsIgnoreCase("despawn_minions")) - { + } else if (event.equalsIgnoreCase("despawn_minions")) { _minions.forEach(m -> m.decayMe()); _minions.clear(); } @@ -162,19 +143,13 @@ public final class Core extends AbstractNpcAI } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (npc.getId() == CORE) - { - if (_firstAttacked) - { - if (getRandom(100) == 0) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (npc.getId() == CORE) { + if (_firstAttacked) { + if (getRandom(100) == 0) { npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.REMOVING_INTRUDERS)); } - } - else - { + } else { _firstAttacked = true; npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.A_NON_PERMITTED_TARGET_HAS_BEEN_DISCOVERED)); npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.INTRUDER_REMOVAL_SYSTEM_INITIATED)); @@ -184,10 +159,8 @@ public final class Core extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (npc.getId() == CORE) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (npc.getId() == CORE) { int objId = npc.getObjectId(); npc.broadcastPacket(Music.BS02_D_10000.getPacket()); npc.broadcastPacket(new NpcSay(objId, Say2.NPC_ALL, npc.getId(), NpcStringId.A_FATAL_ERROR_HAS_OCCURRED)); @@ -204,9 +177,7 @@ public final class Core extends AbstractNpcAI GrandBossManager.getInstance().setStatsSet(CORE, info); startQuestTimer("despawn_minions", 20000, null, null); cancelQuestTimers("spawn_minion"); - } - else if ((GrandBossManager.getInstance().getBossStatus(CORE) == ALIVE) && _minions.contains(npc)) - { + } else if ((GrandBossManager.getInstance().getBossStatus(CORE) == ALIVE) && _minions.contains(npc)) { _minions.remove(npc); startQuestTimer("spawn_minion", 60000, npc, null); } @@ -214,17 +185,14 @@ public final class Core extends AbstractNpcAI } @Override - public String onSpawn(L2Npc npc) - { - if (npc.getId() == CORE) - { + public String onSpawn(L2Npc npc) { + if (npc.getId() == CORE) { npc.setIsImmobilized(true); } return super.onSpawn(npc); } - public static void main(String[] args) - { + public static void main(String[] args) { new Core(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/CrimsonHatuOtis.java b/src/main/java/com/l2jserver/datapack/ai/individual/CrimsonHatuOtis.java index 78a0f826c2..474575080f 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/CrimsonHatuOtis.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/CrimsonHatuOtis.java @@ -29,30 +29,24 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * AI for Kamaloka (33) - Crimson Hatu Otis * @author Gladicek */ -public final class CrimsonHatuOtis extends AbstractNpcAI -{ +public final class CrimsonHatuOtis extends AbstractNpcAI { // Npc private static final int CRIMSON_HATU_OTIS = 18558; // Skills private static final SkillHolder BOSS_SPINING_SLASH = new SkillHolder(4737); private static final SkillHolder BOSS_HASTE = new SkillHolder(4175); - private CrimsonHatuOtis() - { + private CrimsonHatuOtis() { super(CrimsonHatuOtis.class.getSimpleName(), "ai/individual"); addAttackId(CRIMSON_HATU_OTIS); addKillId(CRIMSON_HATU_OTIS); } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { - case "SKILL": - { - if (npc.isDead()) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { + case "SKILL": { + if (npc.isDead()) { cancelQuestTimer("SKILL", npc, null); return null; } @@ -61,10 +55,8 @@ public final class CrimsonHatuOtis extends AbstractNpcAI startQuestTimer("SKILL", 60000, npc, null); break; } - case "BUFF": - { - if (npc.isScriptValue(2)) - { + case "BUFF": { + if (npc.isScriptValue(2)) { npc.setTarget(npc); npc.doCast(BOSS_HASTE); } @@ -75,15 +67,11 @@ public final class CrimsonHatuOtis extends AbstractNpcAI } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (npc.isScriptValue(0)) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (npc.isScriptValue(0)) { npc.setScriptValue(1); startQuestTimer("SKILL", 5000, npc, null); - } - else if (npc.isScriptValue(1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.3))) - { + } else if (npc.isScriptValue(1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.3))) { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.IVE_HAD_IT_UP_TO_HERE_WITH_YOU_ILL_TAKE_CARE_OF_YOU); npc.setScriptValue(2); startQuestTimer("BUFF", 1000, npc, null); @@ -92,15 +80,13 @@ public final class CrimsonHatuOtis extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { cancelQuestTimer("SKILL", npc, null); cancelQuestTimer("BUFF", npc, null); return super.onKill(npc, player, isSummon); } - public static void main(String[] args) - { + public static void main(String[] args) { new CrimsonHatuOtis(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/DarkWaterDragon.java b/src/main/java/com/l2jserver/datapack/ai/individual/DarkWaterDragon.java index dd6919c113..f9babb3259 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/DarkWaterDragon.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/DarkWaterDragon.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; /** * Dark Water Dragon's AI. */ -public final class DarkWaterDragon extends AbstractNpcAI -{ +public final class DarkWaterDragon extends AbstractNpcAI { private static final int DRAGON = 22267; private static final int SHADE1 = 22268; private static final int SHADE2 = 22269; @@ -45,11 +44,9 @@ public final class DarkWaterDragon extends AbstractNpcAI private static Set<Integer> MY_TRACKING_SET = ConcurrentHashMap.newKeySet(); // Used to track instances of npcs private static Map<Integer, L2PcInstance> ID_MAP = new ConcurrentHashMap<>(); // Used to track instances of npcs - private DarkWaterDragon() - { + private DarkWaterDragon() { super(DarkWaterDragon.class.getSimpleName(), "ai/individual"); - int[] mobs = - { + int[] mobs = { DRAGON, SHADE1, SHADE2, @@ -65,43 +62,33 @@ public final class DarkWaterDragon extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (npc != null) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (npc != null) { if (event.equalsIgnoreCase("first_spawn")) // timer to start timer "1" { startQuestTimer("1", 40000, npc, null, true); // spawns detractor every 40 seconds - } - else if (event.equalsIgnoreCase("second_spawn")) // timer to start timer "2" + } else if (event.equalsIgnoreCase("second_spawn")) // timer to start timer "2" { startQuestTimer("2", 40000, npc, null, true); // spawns detractor every 40 seconds - } - else if (event.equalsIgnoreCase("third_spawn")) // timer to start timer "3" + } else if (event.equalsIgnoreCase("third_spawn")) // timer to start timer "3" { startQuestTimer("3", 40000, npc, null, true); // spawns detractor every 40 seconds - } - else if (event.equalsIgnoreCase("fourth_spawn")) // timer to start timer "4" + } else if (event.equalsIgnoreCase("fourth_spawn")) // timer to start timer "4" { startQuestTimer("4", 40000, npc, null, true); // spawns detractor every 40 seconds - } - else if (event.equalsIgnoreCase("1")) // spawns a detractor + } else if (event.equalsIgnoreCase("1")) // spawns a detractor { addSpawn(DETRACTOR1, (npc.getX() + 100), (npc.getY() + 100), npc.getZ(), 0, false, 40000); - } - else if (event.equalsIgnoreCase("2")) // spawns a detractor + } else if (event.equalsIgnoreCase("2")) // spawns a detractor { addSpawn(DETRACTOR2, (npc.getX() + 100), (npc.getY() - 100), npc.getZ(), 0, false, 40000); - } - else if (event.equalsIgnoreCase("3")) // spawns a detractor + } else if (event.equalsIgnoreCase("3")) // spawns a detractor { addSpawn(DETRACTOR1, (npc.getX() - 100), (npc.getY() + 100), npc.getZ(), 0, false, 40000); - } - else if (event.equalsIgnoreCase("4")) // spawns a detractor + } else if (event.equalsIgnoreCase("4")) // spawns a detractor { addSpawn(DETRACTOR2, (npc.getX() - 100), (npc.getY() - 100), npc.getZ(), 0, false, 40000); - } - else if (event.equalsIgnoreCase("fafurion_despawn")) // Fafurion Kindred disappears and drops reward + } else if (event.equalsIgnoreCase("fafurion_despawn")) // Fafurion Kindred disappears and drops reward { cancelQuestTimer("fafurion_poison", npc, null); cancelQuestTimer("1", npc, null); @@ -111,17 +98,14 @@ public final class DarkWaterDragon extends AbstractNpcAI MY_TRACKING_SET.remove(npc.getObjectId()); player = ID_MAP.remove(npc.getObjectId()); - if (player != null) - { + if (player != null) { ((L2Attackable) npc).doItemDrop(NpcData.getInstance().getTemplate(18485), player); } npc.deleteMe(); - } - else if (event.equalsIgnoreCase("fafurion_poison")) // Reduces Fafurions hp like it is poisoned + } else if (event.equalsIgnoreCase("fafurion_poison")) // Reduces Fafurions hp like it is poisoned { - if (npc.getCurrentHp() <= 500) - { + if (npc.getCurrentHp() <= 500) { cancelQuestTimer("fafurion_despawn", npc, null); cancelQuestTimer("first_spawn", npc, null); cancelQuestTimer("second_spawn", npc, null); @@ -141,12 +125,10 @@ public final class DarkWaterDragon extends AbstractNpcAI } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { int npcId = npc.getId(); int npcObjId = npc.getObjectId(); - if (npcId == DRAGON) - { + if (npcId == DRAGON) { if (!MY_TRACKING_SET.contains(npcObjId)) // this allows to handle multiple instances of npc { MY_TRACKING_SET.add(npcObjId); @@ -157,9 +139,7 @@ public final class DarkWaterDragon extends AbstractNpcAI spawnShade(originalAttacker, SHADE1, npc.getX() - 100, npc.getY() + 100, npc.getZ()); spawnShade(originalAttacker, SHADE2, npc.getX() - 100, npc.getY() - 100, npc.getZ()); spawnShade(originalAttacker, SHADE1, npc.getX() - 150, npc.getY() + 150, npc.getZ()); - } - else if ((npc.getCurrentHp() < (npc.getMaxHp() / 2.0)) && !(SECOND_SPAWN.contains(npcObjId))) - { + } else if ((npc.getCurrentHp() < (npc.getMaxHp() / 2.0)) && !(SECOND_SPAWN.contains(npcObjId))) { SECOND_SPAWN.add(npcObjId); // Spawn second 5 shades on half hp of on Dark Water Dragon L2Character originalAttacker = isSummon ? attacker.getSummon() : attacker; @@ -174,19 +154,15 @@ public final class DarkWaterDragon extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { int npcId = npc.getId(); int npcObjId = npc.getObjectId(); - if (npcId == DRAGON) - { + if (npcId == DRAGON) { MY_TRACKING_SET.remove(npcObjId); SECOND_SPAWN.remove(npcObjId); L2Attackable faf = (L2Attackable) addSpawn(FAFURION, npc.getX(), npc.getY(), npc.getZ(), 0, false, 0); // spawns Fafurion Kindred when Dard Water Dragon is dead ID_MAP.put(faf.getObjectId(), killer); - } - else if (npcId == FAFURION) - { + } else if (npcId == FAFURION) { cancelQuestTimer("fafurion_poison", npc, null); cancelQuestTimer("fafurion_despawn", npc, null); cancelQuestTimer("first_spawn", npc, null); @@ -204,14 +180,11 @@ public final class DarkWaterDragon extends AbstractNpcAI } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { int npcId = npc.getId(); int npcObjId = npc.getObjectId(); - if (npcId == FAFURION) - { - if (!MY_TRACKING_SET.contains(npcObjId)) - { + if (npcId == FAFURION) { + if (!MY_TRACKING_SET.contains(npcObjId)) { MY_TRACKING_SET.add(npcObjId); // Spawn 4 Detractors on spawn of Fafurion int x = npc.getX(); @@ -231,16 +204,14 @@ public final class DarkWaterDragon extends AbstractNpcAI return super.onSpawn(npc); } - public void spawnShade(L2Character attacker, int npcId, int x, int y, int z) - { + public void spawnShade(L2Character attacker, int npcId, int x, int y, int z) { final L2Npc shade = addSpawn(npcId, x, y, z, 0, false, 0); shade.setRunning(); ((L2Attackable) shade).addDamageHate(attacker, 0, 999); shade.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker); } - public static void main(String[] args) - { + public static void main(String[] args) { new DarkWaterDragon(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/DivineBeast.java b/src/main/java/com/l2jserver/datapack/ai/individual/DivineBeast.java index 2609b7c5fd..95e84eefb5 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/DivineBeast.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/DivineBeast.java @@ -27,33 +27,26 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Simple AI that manages special conditions for Divine Beast summon. * @author UnAfraid */ -public final class DivineBeast extends AbstractNpcAI -{ +public final class DivineBeast extends AbstractNpcAI { private static final int DIVINE_BEAST = 14870; private static final int TRANSFORMATION_ID = 258; private static final int CHECK_TIME = 2 * 1000; - private DivineBeast() - { + private DivineBeast() { super(DivineBeast.class.getSimpleName(), "ai"); addSummonSpawnId(DIVINE_BEAST); } @Override - public void onSummonSpawn(L2Summon summon) - { + public void onSummonSpawn(L2Summon summon) { startQuestTimer("VALIDATE_TRANSFORMATION", CHECK_TIME, null, summon.getActingPlayer(), true); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if ((player == null) || !player.hasServitor()) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if ((player == null) || !player.hasServitor()) { cancelQuestTimer(event, npc, player); - } - else if (player.getTransformationId() != TRANSFORMATION_ID) - { + } else if (player.getTransformationId() != TRANSFORMATION_ID) { cancelQuestTimer(event, npc, player); player.getSummon().unSummon(player); } @@ -61,8 +54,7 @@ public final class DivineBeast extends AbstractNpcAI return super.onAdvEvent(event, npc, player); } - public static void main(String[] args) - { + public static void main(String[] args) { new DivineBeast(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/DrChaos.java b/src/main/java/com/l2jserver/datapack/ai/individual/DrChaos.java index 4661bb1ef5..0b4438e274 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/DrChaos.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/DrChaos.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.network.serverpackets.SpecialCamera; * DrChaos' AI. * @author Kerberos */ -public final class DrChaos extends Quest -{ +public final class DrChaos extends Quest { private static final int DR_CHAOS = 32033; private static final int STRANGE_MACHINE = 32032; private static final int CHAOS_GOLEM = 25703; @@ -41,8 +40,7 @@ public final class DrChaos extends Quest private static final Location PLAYER_TELEPORT = new Location(94832, -112624, -3304); private static final Location NPC_LOCATION = new Location(-113091, -243942, -15536); - private DrChaos() - { + private DrChaos() { // TODO extends AbstractNpcAI super(-1, "Doctor Chaos", "ai/individual"); addFirstTalkId(DR_CHAOS); @@ -50,63 +48,49 @@ public final class DrChaos extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { - case "1": - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { + case "1": { L2Npc machine = null; - for (L2Spawn spawn : SpawnTable.getInstance().getSpawns(STRANGE_MACHINE)) - { - if (spawn != null) - { + for (L2Spawn spawn : SpawnTable.getInstance().getSpawns(STRANGE_MACHINE)) { + if (spawn != null) { machine = spawn.getLastSpawn(); } } - if (machine != null) - { + if (machine != null) { npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, machine); machine.broadcastPacket(new SpecialCamera(machine, 1, -200, 15, 10000, 1000, 20000, 0, 0, 0, 0, 0)); - } - else - { + } else { startQuestTimer("2", 2000, npc, player); } startQuestTimer("3", 10000, npc, player); break; } - case "2": - { + case "2": { npc.broadcastSocialAction(3); break; } - case "3": - { + case "3": { npc.broadcastPacket(new SpecialCamera(npc, 1, -150, 10, 3000, 1000, 20000, 0, 0, 0, 0, 0)); startQuestTimer("4", 2500, npc, player); break; } - case "4": - { + case "4": { npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(96055, -110759, -3312, 0)); startQuestTimer("5", 2000, npc, player); break; } - case "5": - { + case "5": { player.teleToLocation(PLAYER_TELEPORT); npc.teleToLocation(NPC_LOCATION); - if (!_IsGolemSpawned) - { + if (!_IsGolemSpawned) { L2Npc golem = addSpawn(CHAOS_GOLEM, 94640, -112496, -3336, 0, false, 0); _IsGolemSpawned = true; startQuestTimer("6", 1000, golem, player); } break; } - case "6": - { + case "6": { npc.broadcastPacket(new SpecialCamera(npc, 30, -200, 20, 6000, 700, 8000, 0, 0, 0, 0, 0)); break; } @@ -115,18 +99,15 @@ public final class DrChaos extends Quest } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { - if (npc.getId() == DR_CHAOS) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { + if (npc.getId() == DR_CHAOS) { npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(96323, -110914, -3328, 0)); this.startQuestTimer("1", 3000, npc, player); } return ""; } - public static void main(String[] args) - { + public static void main(String[] args) { new DrChaos(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/DrakosWarrior.java b/src/main/java/com/l2jserver/datapack/ai/individual/DrakosWarrior.java index 828d615836..239e1cdbfc 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/DrakosWarrior.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/DrakosWarrior.java @@ -28,37 +28,31 @@ import com.l2jserver.gameserver.model.holders.SkillHolder; * @author Adry_85 * @since 2.6.0.0 */ -public class DrakosWarrior extends AbstractNpcAI -{ +public class DrakosWarrior extends AbstractNpcAI { // NPCs private static final int DRAKOS_WARRIOR = 22822; private static final int DRAKOS_ASSASSIN = 22823; // Skill private static final SkillHolder SUMMON = new SkillHolder(6858); - public DrakosWarrior() - { + public DrakosWarrior() { super(DrakosWarrior.class.getSimpleName(), "ai/individual"); addAttackId(DRAKOS_WARRIOR); } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (getRandom(100) < 1) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (getRandom(100) < 1) { addSkillCastDesire(npc, npc, SUMMON, 99999999900000000L); final int count = 2 + getRandom(3); - for (int i = 0; i < count; i++) - { + for (int i = 0; i < count; i++) { addSpawn(DRAKOS_ASSASSIN, npc.getX() + getRandom(200), npc.getY() + getRandom(200), npc.getZ(), 0, false, 0, false); } } return super.onAttack(npc, attacker, damage, isSummon); } - public static void main(String[] args) - { + public static void main(String[] args) { new DrakosWarrior(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/DustRider.java b/src/main/java/com/l2jserver/datapack/ai/individual/DustRider.java index f35c47a965..5bcc0b681a 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/DustRider.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/DustRider.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.util.Util; * @author Zoey76 * @since 2.6.0.0 */ -public class DustRider extends AbstractNpcAI -{ +public class DustRider extends AbstractNpcAI { private static final int DUST_RIDER = 25719; // Skills private static final SkillHolder NPC_HASTE_LVL_3 = new SkillHolder(6914, 3); @@ -40,30 +39,25 @@ public class DustRider extends AbstractNpcAI private static final int MAX_CHASE_DIST = 2500; private static final double MIN_HP_PERCENTAGE = 0.30; - public DustRider() - { + public DustRider() { super(DustRider.class.getSimpleName(), "ai/individual"); addAttackId(DUST_RIDER); } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (Util.calculateDistance(npc, npc.getSpawn(), false, false) > MAX_CHASE_DIST) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (Util.calculateDistance(npc, npc.getSpawn(), false, false) > MAX_CHASE_DIST) { npc.teleToLocation(npc.getSpawn().getX(), npc.getSpawn().getY(), npc.getSpawn().getZ()); } - if (!npc.getVariables().getBoolean(CAST_FLAG, false) && (npc.getCurrentHp() < (npc.getMaxHp() * MIN_HP_PERCENTAGE))) - { + if (!npc.getVariables().getBoolean(CAST_FLAG, false) && (npc.getCurrentHp() < (npc.getMaxHp() * MIN_HP_PERCENTAGE))) { npc.getVariables().set(CAST_FLAG, true); addSkillCastDesire(npc, npc, NPC_HASTE_LVL_3, 99999999999000000L); } return super.onAttack(npc, attacker, damage, isSummon); } - public static void main(String[] args) - { + public static void main(String[] args) { new DustRider(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/EmeraldHorn.java b/src/main/java/com/l2jserver/datapack/ai/individual/EmeraldHorn.java index c9ba45e65c..9c2d24284c 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/EmeraldHorn.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/EmeraldHorn.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.util.Util; * @author Zoey76 * @since 2.6.0.0 */ -public class EmeraldHorn extends AbstractNpcAI -{ +public class EmeraldHorn extends AbstractNpcAI { private static final int EMERALD_HORN = 25718; // Skills private static final SkillHolder REFLECT_ATTACK = new SkillHolder(6823, 1); @@ -49,39 +48,32 @@ public class EmeraldHorn extends AbstractNpcAI // Misc private static final int MAX_CHASE_DIST = 2500; - public EmeraldHorn() - { + public EmeraldHorn() { super(EmeraldHorn.class.getSimpleName(), "ai/individual"); addAttackId(EMERALD_HORN); addSpellFinishedId(EMERALD_HORN); } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (Util.calculateDistance(npc, npc.getSpawn(), false, false) > MAX_CHASE_DIST) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (Util.calculateDistance(npc, npc.getSpawn(), false, false) > MAX_CHASE_DIST) { npc.teleToLocation(npc.getSpawn().getX(), npc.getSpawn().getY(), npc.getSpawn().getZ()); } - if (npc.isAffectedBySkill(REFLECT_ATTACK.getSkillId())) - { - if (npc.getVariables().getBoolean(CAST_FLAG, false)) - { + if (npc.isAffectedBySkill(REFLECT_ATTACK.getSkillId())) { + if (npc.getVariables().getBoolean(CAST_FLAG, false)) { npc.getVariables().set(TOTAL_DAMAGE_COUNT, npc.getVariables().getInt(TOTAL_DAMAGE_COUNT) + damage); } } - if (npc.getVariables().getInt(TOTAL_DAMAGE_COUNT) > 5000) - { + if (npc.getVariables().getInt(TOTAL_DAMAGE_COUNT) > 5000) { addSkillCastDesire(npc, attacker, BLEED_LVL_2, 9999000000000000L); npc.getVariables().set(TOTAL_DAMAGE_COUNT, 0); npc.getVariables().set(CAST_FLAG, false); npc.getVariables().set(HIGH_DAMAGE_FLAG, true); } - if (npc.getVariables().getInt(TOTAL_DAMAGE_COUNT) > 10000) - { + if (npc.getVariables().getInt(TOTAL_DAMAGE_COUNT) > 10000) { addSkillCastDesire(npc, attacker, BLEED_LVL_1, 9999000000000000L); npc.getVariables().set(TOTAL_DAMAGE_COUNT, 0); npc.getVariables().set(CAST_FLAG, false); @@ -91,10 +83,8 @@ public class EmeraldHorn extends AbstractNpcAI } @Override - public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) - { - if (getRandom(5) < 1) - { + public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) { + if (getRandom(5) < 1) { npc.getVariables().set(TOTAL_DAMAGE_COUNT, 0); npc.getVariables().set(CAST_FLAG, true); addSkillCastDesire(npc, npc, REFLECT_ATTACK, 99999000000000000L); @@ -104,21 +94,14 @@ public class EmeraldHorn extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (DAMAGE_TIMER_15S.equals(event)) - { - if (!npc.getVariables().getBoolean(HIGH_DAMAGE_FLAG, false)) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (DAMAGE_TIMER_15S.equals(event)) { + if (!npc.getVariables().getBoolean(HIGH_DAMAGE_FLAG, false)) { final L2Character mostHated = ((L2Attackable) npc).getMostHated(); - if (mostHated != null) - { - if (mostHated.isDead()) - { + if (mostHated != null) { + if (mostHated.isDead()) { ((L2Attackable) npc).stopHating(mostHated); - } - else - { + } else { addSkillCastDesire(npc, mostHated, PIERCING_STORM, 9999000000000000L); } } @@ -128,8 +111,7 @@ public class EmeraldHorn extends AbstractNpcAI return super.onAdvEvent(event, npc, player); } - public static void main(String[] args) - { + public static void main(String[] args) { new EmeraldHorn(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/Epidos.java b/src/main/java/com/l2jserver/datapack/ai/individual/Epidos.java index a00c75578a..59080c02c3 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/Epidos.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/Epidos.java @@ -33,26 +33,22 @@ import com.l2jserver.gameserver.util.MinionList; * Manages minion's spawn, idle despawn and Teleportation Cube spawn. * @author GKR */ -public final class Epidos extends AbstractNpcAI -{ - private static final int[] EPIDOSES = - { +public final class Epidos extends AbstractNpcAI { + private static final int[] EPIDOSES = { 25609, 25610, 25611, 25612 }; - private static final int[] MINIONS = - { + private static final int[] MINIONS = { 25605, 25606, 25607, 25608 }; - private static final int[] MINIONS_COUNT = - { + private static final int[] MINIONS_COUNT = { 3, 6, 11 @@ -60,39 +56,29 @@ public final class Epidos extends AbstractNpcAI private final Map<Integer, Double> _lastHp = new ConcurrentHashMap<>(); - private Epidos() - { + private Epidos() { super(Epidos.class.getSimpleName(), "ai/individual"); addKillId(EPIDOSES); addSpawnId(EPIDOSES); } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equalsIgnoreCase("check_minions")) - { - if ((getRandom(1000) > 250) && _lastHp.containsKey(npc.getObjectId())) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equalsIgnoreCase("check_minions")) { + if ((getRandom(1000) > 250) && _lastHp.containsKey(npc.getObjectId())) { int hpDecreasePercent = (int) (((_lastHp.get(npc.getObjectId()) - npc.getCurrentHp()) * 100) / npc.getMaxHp()); int minionsCount = 0; int spawnedMinions = ((L2MonsterInstance) npc).getMinionList().countSpawnedMinions(); - if ((hpDecreasePercent > 5) && (hpDecreasePercent <= 15) && (spawnedMinions <= 9)) - { + if ((hpDecreasePercent > 5) && (hpDecreasePercent <= 15) && (spawnedMinions <= 9)) { minionsCount = MINIONS_COUNT[0]; - } - else if ((((hpDecreasePercent > 1) && (hpDecreasePercent <= 5)) || ((hpDecreasePercent > 15) && (hpDecreasePercent <= 30))) && (spawnedMinions <= 6)) - { + } else if ((((hpDecreasePercent > 1) && (hpDecreasePercent <= 5)) || ((hpDecreasePercent > 15) && (hpDecreasePercent <= 30))) && (spawnedMinions <= 6)) { minionsCount = MINIONS_COUNT[1]; - } - else if (spawnedMinions == 0) - { + } else if (spawnedMinions == 0) { minionsCount = MINIONS_COUNT[2]; } - for (int i = 0; i < minionsCount; i++) - { + for (int i = 0; i < minionsCount; i++) { MinionList.spawnMinion((L2MonsterInstance) npc, MINIONS[Arrays.binarySearch(EPIDOSES, npc.getId())]); } @@ -100,15 +86,10 @@ public final class Epidos extends AbstractNpcAI } startQuestTimer("check_minions", 10000, npc, null); - } - else if (event.equalsIgnoreCase("check_idle")) - { - if (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_ACTIVE) - { + } else if (event.equalsIgnoreCase("check_idle")) { + if (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_ACTIVE) { npc.deleteMe(); - } - else - { + } else { startQuestTimer("check_idle", 600000, npc, null); } } @@ -116,10 +97,8 @@ public final class Epidos extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (npc.isInsideRadius(-45474, 247450, -13994, 2000, true, false)) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (npc.isInsideRadius(-45474, 247450, -13994, 2000, true, false)) { addSpawn(32376, -45482, 246277, -14184, 0, false, 0, false); } @@ -128,8 +107,7 @@ public final class Epidos extends AbstractNpcAI } @Override - public final String onSpawn(L2Npc npc) - { + public final String onSpawn(L2Npc npc) { startQuestTimer("check_minions", 10000, npc, null); startQuestTimer("check_idle", 600000, npc, null); _lastHp.put(npc.getObjectId(), (double) npc.getMaxHp()); @@ -137,8 +115,7 @@ public final class Epidos extends AbstractNpcAI return super.onSpawn(npc); } - public static void main(String[] args) - { + public static void main(String[] args) { new Epidos(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/EvasGiftBox.java b/src/main/java/com/l2jserver/datapack/ai/individual/EvasGiftBox.java index 4b607044a5..4d296b269f 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/EvasGiftBox.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/EvasGiftBox.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.holders.ItemHolder; * Eva's Gift Box AI. * @author St3eT */ -public final class EvasGiftBox extends AbstractNpcAI -{ +public final class EvasGiftBox extends AbstractNpcAI { // NPC private static final int BOX = 32342; // Eva's Gift Box // Skill @@ -38,25 +37,20 @@ public final class EvasGiftBox extends AbstractNpcAI private static final ItemHolder CORAL = new ItemHolder(9692, 1); // Red Coral private static final ItemHolder CRYSTAL = new ItemHolder(9693, 1); // Crystal Fragment - private EvasGiftBox() - { + private EvasGiftBox() { super(EvasGiftBox.class.getSimpleName(), "ai/individual"); addKillId(BOX); addSpawnId(BOX); } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (killer.isAffectedBySkill(BUFF)) - { - if (getRandomBoolean()) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (killer.isAffectedBySkill(BUFF)) { + if (getRandomBoolean()) { npc.dropItem(killer, CRYSTAL); } - if (getRandom(100) < 33) - { + if (getRandom(100) < 33) { npc.dropItem(killer, CORAL); } } @@ -64,15 +58,13 @@ public final class EvasGiftBox extends AbstractNpcAI } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { npc.setIsNoRndWalk(true); ((L2Attackable) npc).setOnKillDelay(0); return super.onSpawn(npc); } - public static void main(String[] args) - { + public static void main(String[] args) { new EvasGiftBox(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/FrightenedRagnaOrc.java b/src/main/java/com/l2jserver/datapack/ai/individual/FrightenedRagnaOrc.java index 927ab0a252..e8ba3c22f7 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/FrightenedRagnaOrc.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/FrightenedRagnaOrc.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Frightened Ragna Orc AI. * @author Gladicek, malyelfik */ -public final class FrightenedRagnaOrc extends AbstractNpcAI -{ +public final class FrightenedRagnaOrc extends AbstractNpcAI { // NPC ID private static final int MOB_ID = 18807; // Chances @@ -45,23 +44,18 @@ public final class FrightenedRagnaOrc extends AbstractNpcAI // Skill private static final SkillHolder SKILL = new SkillHolder(6234); - private FrightenedRagnaOrc() - { + private FrightenedRagnaOrc() { super(FrightenedRagnaOrc.class.getSimpleName(), "ai/individual"); addAttackId(MOB_ID); addKillId(MOB_ID); } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (npc.isScriptValue(0)) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (npc.isScriptValue(0)) { npc.setScriptValue(1); startQuestTimer("say", (getRandom(5) + 3) * 1000, npc, null, true); - } - else if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.2)) && npc.isScriptValue(1)) - { + } else if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.2)) && npc.isScriptValue(1)) { startQuestTimer("reward", 10000, npc, attacker); broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.WAIT_WAIT_STOP_SAVE_ME_AND_ILL_GIVE_YOU_10000000_ADENA); npc.setScriptValue(2); @@ -70,8 +64,7 @@ public final class FrightenedRagnaOrc extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final NpcStringId msg = getRandomBoolean() ? NpcStringId.UGH_A_CURSE_UPON_YOU : NpcStringId.I_REALLY_DIDNT_WANT_TO_FIGHT; broadcastNpcSay(npc, Say2.NPC_ALL, msg); cancelQuestTimer("say", npc, null); @@ -80,14 +73,10 @@ public final class FrightenedRagnaOrc extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { - case "say": - { - if (npc.isDead() || !npc.isScriptValue(1)) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { + case "say": { + if (npc.isDead() || !npc.isScriptValue(1)) { cancelQuestTimer("say", npc, null); return null; } @@ -95,34 +84,25 @@ public final class FrightenedRagnaOrc extends AbstractNpcAI broadcastNpcSay(npc, Say2.NPC_ALL, msg); break; } - case "reward": - { - if (!npc.isDead() && npc.isScriptValue(2)) - { - if (getRandom(100000) < CHANCE2) - { + case "reward": { + if (!npc.isDead() && npc.isScriptValue(2)) { + if (getRandom(100000) < CHANCE2) { final NpcStringId msg = getRandomBoolean() ? NpcStringId.TH_THANKS_I_COULD_HAVE_BECOME_GOOD_FRIENDS_WITH_YOU : NpcStringId.ILL_GIVE_YOU_10000000_ADENA_LIKE_I_PROMISED_I_MIGHT_BE_AN_ORC_WHO_KEEPS_MY_PROMISES; broadcastNpcSay(npc, Say2.NPC_ALL, msg); npc.setScriptValue(3); npc.doCast(SKILL); - for (int i = 0; i < 10; i++) - { + for (int i = 0; i < 10; i++) { npc.dropItem(player, Inventory.ADENA_ID, ADENA2); } - } - else if (getRandom(100000) < CHANCE) - { + } else if (getRandom(100000) < CHANCE) { final NpcStringId msg = getRandomBoolean() ? NpcStringId.TH_THANKS_I_COULD_HAVE_BECOME_GOOD_FRIENDS_WITH_YOU : NpcStringId.SORRY_BUT_THIS_IS_ALL_I_HAVE_GIVE_ME_A_BREAK; broadcastNpcSay(npc, Say2.NPC_ALL, msg); npc.setScriptValue(3); npc.doCast(SKILL); - for (int i = 0; i < 10; i++) - { + for (int i = 0; i < 10; i++) { ((L2Attackable) npc).dropItem(player, Inventory.ADENA_ID, ADENA); } - } - else - { + } else { final NpcStringId msg = getRandomBoolean() ? NpcStringId.THANKS_BUT_THAT_THING_ABOUT_10000000_ADENA_WAS_A_LIE_SEE_YA : NpcStringId.YOURE_PRETTY_DUMB_TO_BELIEVE_ME; broadcastNpcSay(npc, Say2.NPC_ALL, msg); } @@ -130,8 +110,7 @@ public final class FrightenedRagnaOrc extends AbstractNpcAI } break; } - case "despawn": - { + case "despawn": { npc.setRunning(); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location((npc.getX() + getRandom(-800, 800)), (npc.getY() + getRandom(-800, 800)), npc.getZ(), npc.getHeading())); npc.deleteMe(); @@ -141,8 +120,7 @@ public final class FrightenedRagnaOrc extends AbstractNpcAI return null; } - public static void main(String[] args) - { + public static void main(String[] args) { new FrightenedRagnaOrc(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/Gordon.java b/src/main/java/com/l2jserver/datapack/ai/individual/Gordon.java index 0be82ad059..55ede3de28 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/Gordon.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/Gordon.java @@ -28,36 +28,30 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Gordon AI * @author TOFIZ, malyelfik */ -public final class Gordon extends AbstractNpcAI -{ +public final class Gordon extends AbstractNpcAI { private static final int GORDON = 29095; - private Gordon() - { + private Gordon() { super(Gordon.class.getSimpleName(), "ai/individual"); addSpawnId(GORDON); addSeeCreatureId(GORDON); } @Override - public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) - { - if (creature.isPlayer() && ((L2PcInstance) creature).isCursedWeaponEquipped()) - { + public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) { + if (creature.isPlayer() && ((L2PcInstance) creature).isCursedWeaponEquipped()) { addAttackDesire(npc, creature); } return super.onSeeCreature(npc, creature, isSummon); } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { ((L2Attackable) npc).setCanReturnToSpawnPoint(false); return super.onSpawn(npc); } - public static void main(String[] args) - { + public static void main(String[] args) { new Gordon(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/GraveRobbers.java b/src/main/java/com/l2jserver/datapack/ai/individual/GraveRobbers.java index 273f3f51df..297df6118a 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/GraveRobbers.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/GraveRobbers.java @@ -29,26 +29,22 @@ import com.l2jserver.gameserver.model.actor.L2Npc; * </ul> * @author Zealar */ -public final class GraveRobbers extends AbstractNpcAI -{ +public final class GraveRobbers extends AbstractNpcAI { private static final int GRAVE_ROBBER_SUMMONER = 22678; private static final int GRAVE_ROBBER_MEGICIAN = 22679; - private GraveRobbers() - { + private GraveRobbers() { super(GraveRobbers.class.getSimpleName(), "ai/individual"); addSpawnId(GRAVE_ROBBER_SUMMONER, GRAVE_ROBBER_MEGICIAN); } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { spawnMinions(npc, "Privates" + getRandom(1, 2)); return super.onSpawn(npc); } - public static void main(String[] args) - { + public static void main(String[] args) { new GraveRobbers(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/MuscleBomber.java b/src/main/java/com/l2jserver/datapack/ai/individual/MuscleBomber.java index 86fa40e693..f324abec0c 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/MuscleBomber.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/MuscleBomber.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.util.Util; * @author Zoey76 * @since 2.6.0.0 */ -public class MuscleBomber extends AbstractNpcAI -{ +public class MuscleBomber extends AbstractNpcAI { // NPC private static final int MUSCLE_BOMBER = 25724; private static final int DRAKOS_ASSASSIN = 22823; @@ -49,28 +48,23 @@ public class MuscleBomber extends AbstractNpcAI private static final double HIGH_HP_PERCENTAGE = 0.80; private static final double MED_HP_PERCENTAGE = 0.50; - public MuscleBomber() - { + public MuscleBomber() { super(MuscleBomber.class.getSimpleName(), "ai/individual"); addAttackId(MUSCLE_BOMBER); } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (Util.calculateDistance(npc, npc.getSpawn(), false, false) > MAX_CHASE_DIST) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (Util.calculateDistance(npc, npc.getSpawn(), false, false) > MAX_CHASE_DIST) { npc.teleToLocation(npc.getSpawn().getX(), npc.getSpawn().getY(), npc.getSpawn().getZ()); } - if ((npc.getCurrentHp() < (npc.getMaxHp() * HIGH_HP_PERCENTAGE)) && !npc.getVariables().getBoolean(HIGH_HP_FLAG, false)) - { + if ((npc.getCurrentHp() < (npc.getMaxHp() * HIGH_HP_PERCENTAGE)) && !npc.getVariables().getBoolean(HIGH_HP_FLAG, false)) { npc.getVariables().set(HIGH_HP_FLAG, true); addSkillCastDesire(npc, npc, ENHANCE_LVL_1, 999999999000000000L); } - if ((npc.getCurrentHp() < (npc.getMaxHp() * MED_HP_PERCENTAGE)) && !npc.getVariables().getBoolean(MED_HP_FLAG, false)) - { + if ((npc.getCurrentHp() < (npc.getMaxHp() * MED_HP_PERCENTAGE)) && !npc.getVariables().getBoolean(MED_HP_FLAG, false)) { npc.getVariables().set(MED_HP_FLAG, true); addSkillCastDesire(npc, npc, ENHANCE_LVL_2, 999999999000000000L); startQuestTimer(TIMER_SUMMON, 60000, npc, attacker); @@ -80,21 +74,15 @@ public class MuscleBomber extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { - case TIMER_LIMIT: - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { + case TIMER_LIMIT: { npc.getVariables().set(LIMIT_FLAG, true); break; } - case TIMER_SUMMON: - { - if (!npc.isDead() && !npc.getVariables().getBoolean(LIMIT_FLAG, false)) - { - if (player != null) - { + case TIMER_SUMMON: { + if (!npc.isDead() && !npc.getVariables().getBoolean(LIMIT_FLAG, false)) { + if (player != null) { addAttackDesire(addSpawn(DRAKOS_ASSASSIN, npc.getX() + getRandom(100), npc.getY() + getRandom(10), npc.getZ(), npc.getHeading(), false, 0), player); addAttackDesire(addSpawn(DRAKOS_ASSASSIN, npc.getX() + getRandom(100), npc.getY() + getRandom(10), npc.getZ(), npc.getHeading(), false, 0), player); } @@ -106,8 +94,7 @@ public class MuscleBomber extends AbstractNpcAI return super.onAdvEvent(event, npc, player); } - public static void main(String[] args) - { + public static void main(String[] args) { new MuscleBomber(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/NecromancerOfTheValley.java b/src/main/java/com/l2jserver/datapack/ai/individual/NecromancerOfTheValley.java index 4460e53313..2eb4690032 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/NecromancerOfTheValley.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/NecromancerOfTheValley.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.skills.Skill; * @author Adry_85 * @since 2.6.0.0 */ -public class NecromancerOfTheValley extends AbstractNpcAI -{ +public class NecromancerOfTheValley extends AbstractNpcAI { // NPCs private static final int EXPLODING_ORC_GHOST = 22818; private static final int WRATHFUL_ORC_GHOST = 22819; @@ -40,28 +39,21 @@ public class NecromancerOfTheValley extends AbstractNpcAI // Misc private static final double HP_PERCENTAGE = 0.60; - public NecromancerOfTheValley() - { + public NecromancerOfTheValley() { super(NecromancerOfTheValley.class.getSimpleName(), "ai/individual"); addAttackId(NECROMANCER_OF_THE_VALLEY); addSpellFinishedId(EXPLODING_ORC_GHOST); } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if ((npc.getCurrentHp() < (npc.getMaxHp() * HP_PERCENTAGE))) - { - if (getRandom(10) < 1) - { - if (getRandomBoolean()) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if ((npc.getCurrentHp() < (npc.getMaxHp() * HP_PERCENTAGE))) { + if (getRandom(10) < 1) { + if (getRandomBoolean()) { final L2Npc explodingOrcGhost = addSpawn(EXPLODING_ORC_GHOST, npc.getX(), npc.getY(), npc.getZ(), 0, false, 0, false); addAttackDesire(explodingOrcGhost, attacker, 10000); addSkillCastDesire(npc, attacker, SELF_DESTRUCTION, 999999999L); - } - else - { + } else { final L2Npc wrathfulOrcGhost = addSpawn(WRATHFUL_ORC_GHOST, npc.getX(), npc.getY(), npc.getZ(), 0, false, 0, false); addAttackDesire(wrathfulOrcGhost, attacker, 10000); } @@ -71,17 +63,14 @@ public class NecromancerOfTheValley extends AbstractNpcAI } @Override - public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) - { - if ((skill == SELF_DESTRUCTION.getSkill()) && (npc != null) && !npc.isDead()) - { + public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) { + if ((skill == SELF_DESTRUCTION.getSkill()) && (npc != null) && !npc.isDead()) { npc.doDie(player); } return super.onSpellFinished(npc, player, skill); } - public static void main(String[] args) - { + public static void main(String[] args) { new NecromancerOfTheValley(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/Orfen.java b/src/main/java/com/l2jserver/datapack/ai/individual/Orfen.java index 4f865c257f..47bc1bb975 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/Orfen.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/Orfen.java @@ -47,18 +47,15 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * Orfen's AI * @author Emperorc */ -public final class Orfen extends AbstractNpcAI -{ - private static final Location[] POS = - { +public final class Orfen extends AbstractNpcAI { + private static final Location[] POS = { new Location(43728, 17220, -4342), new Location(55024, 17368, -5412), new Location(53504, 21248, -5486), new Location(53248, 24576, -5262) }; - private static final NpcStringId[] TEXT = - { + private static final NpcStringId[] TEXT = { NpcStringId.S1_STOP_KIDDING_YOURSELF_ABOUT_YOUR_OWN_POWERLESSNESS, NpcStringId.S1_ILL_MAKE_YOU_FEEL_WHAT_TRUE_FEAR_IS, NpcStringId.YOURE_REALLY_STUPID_TO_HAVE_CHALLENGED_ME_S1_GET_READY, @@ -83,11 +80,9 @@ public final class Orfen extends AbstractNpcAI private static final SkillHolder NPC_MORTAL_BLOW = new SkillHolder(4067, 4); private static final SkillHolder ORFEN_HEAL = new SkillHolder(4516); - private Orfen() - { + private Orfen() { super(Orfen.class.getSimpleName(), "ai/individual"); - int[] mobs = - { + int[] mobs = { ORFEN, RAIKEL_LEOS, RIBA_IREN @@ -97,40 +92,29 @@ public final class Orfen extends AbstractNpcAI ZONE = GrandBossManager.getInstance().getZone(POS[0]); StatsSet info = GrandBossManager.getInstance().getStatsSet(ORFEN); int status = GrandBossManager.getInstance().getBossStatus(ORFEN); - if (status == DEAD) - { + if (status == DEAD) { // load the unlock date and time for Orfen from DB long temp = info.getLong("respawn_time") - System.currentTimeMillis(); // if Orfen is locked until a certain time, mark it so and start the unlock timer // the unlock time has not yet expired. - if (temp > 0) - { + if (temp > 0) { startQuestTimer("orfen_unlock", temp, null, null); - } - else - { + } else { // the time has already expired while the server was offline. Immediately spawn Orfen. int i = getRandom(10); Location loc; - if (i < 4) - { + if (i < 4) { loc = POS[1]; - } - else if (i < 7) - { + } else if (i < 7) { loc = POS[2]; - } - else - { + } else { loc = POS[3]; } L2GrandBossInstance orfen = (L2GrandBossInstance) addSpawn(ORFEN, loc, false, 0); GrandBossManager.getInstance().setBossStatus(ORFEN, ALIVE); spawnBoss(orfen); } - } - else - { + } else { int loc_x = info.getInt("loc_x"); int loc_y = info.getInt("loc_y"); int loc_z = info.getInt("loc_z"); @@ -143,8 +127,7 @@ public final class Orfen extends AbstractNpcAI } } - public void setSpawnPoint(L2Npc npc, int index) - { + public void setSpawnPoint(L2Npc npc, int index) { ((L2Attackable) npc).clearAggroList(); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, null, null); L2Spawn spawn = npc.getSpawn(); @@ -152,8 +135,7 @@ public final class Orfen extends AbstractNpcAI npc.teleToLocation(POS[index], false); } - public void spawnBoss(L2GrandBossInstance npc) - { + public void spawnBoss(L2GrandBossInstance npc) { GrandBossManager.getInstance().addBoss(npc); npc.broadcastPacket(Music.BS01_A_7000.getPacket()); startQuestTimer("check_orfen_pos", 10000, npc, null, true); @@ -177,67 +159,45 @@ public final class Orfen extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equalsIgnoreCase("orfen_unlock")) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equalsIgnoreCase("orfen_unlock")) { int i = getRandom(10); Location loc; - if (i < 4) - { + if (i < 4) { loc = POS[1]; - } - else if (i < 7) - { + } else if (i < 7) { loc = POS[2]; - } - else - { + } else { loc = POS[3]; } L2GrandBossInstance orfen = (L2GrandBossInstance) addSpawn(ORFEN, loc, false, 0); GrandBossManager.getInstance().setBossStatus(ORFEN, ALIVE); spawnBoss(orfen); - } - else if (event.equalsIgnoreCase("check_orfen_pos")) - { - if ((_IsTeleported && (npc.getCurrentHp() > (npc.getMaxHp() * 0.95))) || (!ZONE.isInsideZone(npc) && !_IsTeleported)) - { + } else if (event.equalsIgnoreCase("check_orfen_pos")) { + if ((_IsTeleported && (npc.getCurrentHp() > (npc.getMaxHp() * 0.95))) || (!ZONE.isInsideZone(npc) && !_IsTeleported)) { setSpawnPoint(npc, getRandom(3) + 1); _IsTeleported = false; - } - else if (_IsTeleported && !ZONE.isInsideZone(npc)) - { + } else if (_IsTeleported && !ZONE.isInsideZone(npc)) { setSpawnPoint(npc, 0); } - } - else if (event.equalsIgnoreCase("check_minion_loc")) - { - for (int i = 0; i < MINIONS.size(); i++) - { + } else if (event.equalsIgnoreCase("check_minion_loc")) { + for (int i = 0; i < MINIONS.size(); i++) { L2Attackable mob = MINIONS.get(i); - if (!npc.isInsideRadius(mob, 3000, false, false)) - { + if (!npc.isInsideRadius(mob, 3000, false, false)) { mob.teleToLocation(npc.getLocation()); ((L2Attackable) npc).clearAggroList(); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, null, null); } } - } - else if (event.equalsIgnoreCase("despawn_minions")) - { - for (int i = 0; i < MINIONS.size(); i++) - { + } else if (event.equalsIgnoreCase("despawn_minions")) { + for (int i = 0; i < MINIONS.size(); i++) { L2Attackable mob = MINIONS.get(i); - if (mob != null) - { + if (mob != null) { mob.decayMe(); } } MINIONS.clear(); - } - else if (event.equalsIgnoreCase("spawn_minion")) - { + } else if (event.equalsIgnoreCase("spawn_minion")) { L2Attackable mob = (L2Attackable) addSpawn(RAIKEL_LEOS, npc.getX(), npc.getY(), npc.getZ(), 0, false, 0); mob.setIsRaidMinion(true); MINIONS.add(mob); @@ -246,13 +206,10 @@ public final class Orfen extends AbstractNpcAI } @Override - public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) - { - if (npc.getId() == ORFEN) - { + public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) { + if (npc.getId() == ORFEN) { L2Character originalCaster = isSummon ? caster.getSummon() : caster; - if ((skill.getEffectPoint() > 0) && (getRandom(5) == 0) && npc.isInsideRadius(originalCaster, 1000, false, false)) - { + if ((skill.getEffectPoint() > 0) && (getRandom(5) == 0) && npc.isInsideRadius(originalCaster, 1000, false, false)) { NpcSay packet = new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), TEXT[getRandom(4)]); packet.addStringParameter(caster.getName().toString()); npc.broadcastPacket(packet); @@ -265,28 +222,21 @@ public final class Orfen extends AbstractNpcAI } @Override - public String onFactionCall(L2Npc npc, L2Npc caller, L2PcInstance attacker, boolean isSummon) - { - if ((caller == null) || (npc == null) || npc.isCastingNow()) - { + public String onFactionCall(L2Npc npc, L2Npc caller, L2PcInstance attacker, boolean isSummon) { + if ((caller == null) || (npc == null) || npc.isCastingNow()) { return super.onFactionCall(npc, caller, attacker, isSummon); } int npcId = npc.getId(); int callerId = caller.getId(); - if ((npcId == RAIKEL_LEOS) && (getRandom(20) == 0)) - { + if ((npcId == RAIKEL_LEOS) && (getRandom(20) == 0)) { npc.setTarget(attacker); npc.doCast(NPC_MORTAL_BLOW); - } - else if (npcId == RIBA_IREN) - { + } else if (npcId == RIBA_IREN) { int chance = 1; - if (callerId == ORFEN) - { + if (callerId == ORFEN) { chance = 9; } - if ((callerId != RIBA_IREN) && (caller.getCurrentHp() < (caller.getMaxHp() / 2.0)) && (getRandom(10) < chance)) - { + if ((callerId != RIBA_IREN) && (caller.getCurrentHp() < (caller.getMaxHp() / 2.0)) && (getRandom(10) < chance)) { npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, null, null); npc.setTarget(caller); npc.doCast(ORFEN_HEAL); @@ -296,18 +246,13 @@ public final class Orfen extends AbstractNpcAI } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { int npcId = npc.getId(); - if (npcId == ORFEN) - { - if (!_IsTeleported && ((npc.getCurrentHp() - damage) < (npc.getMaxHp() / 2))) - { + if (npcId == ORFEN) { + if (!_IsTeleported && ((npc.getCurrentHp() - damage) < (npc.getMaxHp() / 2))) { _IsTeleported = true; setSpawnPoint(npc, 0); - } - else if (npc.isInsideRadius(attacker, 1000, false, false) && !npc.isInsideRadius(attacker, 300, false, false) && (getRandom(10) == 0)) - { + } else if (npc.isInsideRadius(attacker, 1000, false, false) && !npc.isInsideRadius(attacker, 300, false, false) && (getRandom(10) == 0)) { NpcSay packet = new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npcId, TEXT[getRandom(3)]); packet.addStringParameter(attacker.getName().toString()); npc.broadcastPacket(packet); @@ -315,11 +260,8 @@ public final class Orfen extends AbstractNpcAI npc.setTarget(attacker); npc.doCast(PARALYSIS); } - } - else if (npcId == RIBA_IREN) - { - if (!npc.isCastingNow() && ((npc.getCurrentHp() - damage) < (npc.getMaxHp() / 2.0))) - { + } else if (npcId == RIBA_IREN) { + if (!npc.isCastingNow() && ((npc.getCurrentHp() - damage) < (npc.getMaxHp() / 2.0))) { npc.setTarget(attacker); npc.doCast(ORFEN_HEAL); } @@ -328,10 +270,8 @@ public final class Orfen extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (npc.getId() == ORFEN) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (npc.getId() == ORFEN) { npc.broadcastPacket(Music.BS02_D_7000.getPacket()); GrandBossManager.getInstance().setBossStatus(ORFEN, DEAD); // Calculate Min and Max respawn times randomly. @@ -346,17 +286,14 @@ public final class Orfen extends AbstractNpcAI cancelQuestTimer("check_orfen_pos", npc, null); startQuestTimer("despawn_minions", 20000, null, null); cancelQuestTimers("spawn_minion"); - } - else if ((GrandBossManager.getInstance().getBossStatus(ORFEN) == ALIVE) && (npc.getId() == RAIKEL_LEOS)) - { + } else if ((GrandBossManager.getInstance().getBossStatus(ORFEN) == ALIVE) && (npc.getId() == RAIKEL_LEOS)) { MINIONS.remove(npc); startQuestTimer("spawn_minion", 360000, npc, null); } return super.onKill(npc, killer, isSummon); } - public static void main(String[] args) - { + public static void main(String[] args) { new Orfen(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/QueenAnt.java b/src/main/java/com/l2jserver/datapack/ai/individual/QueenAnt.java index 02194c4a37..a988a221b2 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/QueenAnt.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/QueenAnt.java @@ -46,16 +46,14 @@ import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse; * Queen Ant's AI * @author Emperorc */ -public final class QueenAnt extends AbstractNpcAI -{ +public final class QueenAnt extends AbstractNpcAI { private static final int QUEEN = 29001; private static final int LARVA = 29002; private static final int NURSE = 29003; private static final int GUARD = 29004; private static final int ROYAL = 29005; - private static final int[] MOBS = - { + private static final int[] MOBS = { QUEEN, LARVA, NURSE, @@ -84,8 +82,7 @@ public final class QueenAnt extends AbstractNpcAI private L2MonsterInstance _larva = null; private final List<L2MonsterInstance> _nurses = new CopyOnWriteArrayList<>(); - private QueenAnt() - { + private QueenAnt() { super(QueenAnt.class.getSimpleName(), "ai/individual"); addSpawnId(MOBS); addKillId(MOBS); @@ -95,34 +92,27 @@ public final class QueenAnt extends AbstractNpcAI _zone = GrandBossManager.getInstance().getZone(QUEEN_X, QUEEN_Y, QUEEN_Z); StatsSet info = GrandBossManager.getInstance().getStatsSet(QUEEN); int status = GrandBossManager.getInstance().getBossStatus(QUEEN); - if (status == DEAD) - { + if (status == DEAD) { // load the unlock date and time for queen ant from DB long temp = info.getLong("respawn_time") - System.currentTimeMillis(); // if queen ant is locked until a certain time, mark it so and start the unlock timer // the unlock time has not yet expired. - if (temp > 0) - { + if (temp > 0) { startQuestTimer("queen_unlock", temp, null, null); - } - else - { + } else { // the time has already expired while the server was offline. Immediately spawn queen ant. L2GrandBossInstance queen = (L2GrandBossInstance) addSpawn(QUEEN, QUEEN_X, QUEEN_Y, QUEEN_Z, 0, false, 0); GrandBossManager.getInstance().setBossStatus(QUEEN, ALIVE); spawnBoss(queen); } - } - else - { + } else { int loc_x = info.getInt("loc_x"); int loc_y = info.getInt("loc_y"); int loc_z = info.getInt("loc_z"); int heading = info.getInt("heading"); int hp = info.getInt("currentHP"); int mp = info.getInt("currentMP"); - if (!_zone.isInsideZone(loc_x, loc_y, loc_z)) - { + if (!_zone.isInsideZone(loc_x, loc_y, loc_z)) { loc_x = QUEEN_X; loc_y = QUEEN_Y; loc_z = QUEEN_Z; @@ -133,19 +123,13 @@ public final class QueenAnt extends AbstractNpcAI } } - private void spawnBoss(L2GrandBossInstance npc) - { + private void spawnBoss(L2GrandBossInstance npc) { GrandBossManager.getInstance().addBoss(npc); - if (getRandom(100) < 33) - { + if (getRandom(100) < 33) { _zone.movePlayersTo(OUST_LOC_1); - } - else if (getRandom(100) < 50) - { + } else if (getRandom(100) < 50) { _zone.movePlayersTo(OUST_LOC_2); - } - else - { + } else { _zone.movePlayersTo(OUST_LOC_3); } GrandBossManager.getInstance().addBoss(npc); @@ -157,67 +141,49 @@ public final class QueenAnt extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equalsIgnoreCase("heal")) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equalsIgnoreCase("heal")) { boolean notCasting; final boolean larvaNeedHeal = (_larva != null) && (_larva.getCurrentHp() < _larva.getMaxHp()); final boolean queenNeedHeal = (_queen != null) && (_queen.getCurrentHp() < _queen.getMaxHp()); - for (L2MonsterInstance nurse : _nurses) - { - if ((nurse == null) || nurse.isDead() || nurse.isCastingNow()) - { + for (L2MonsterInstance nurse : _nurses) { + if ((nurse == null) || nurse.isDead() || nurse.isCastingNow()) { continue; } notCasting = nurse.getAI().getIntention() != CtrlIntention.AI_INTENTION_CAST; - if (larvaNeedHeal) - { - if ((nurse.getTarget() != _larva) || notCasting) - { + if (larvaNeedHeal) { + if ((nurse.getTarget() != _larva) || notCasting) { nurse.setTarget(_larva); nurse.useMagic(getRandomBoolean() ? HEAL1.getSkill() : HEAL2.getSkill()); } continue; } - if (queenNeedHeal) - { - if (nurse.getLeader() == _larva) - { + if (queenNeedHeal) { + if (nurse.getLeader() == _larva) { continue; } - if ((nurse.getTarget() != _queen) || notCasting) - { + if ((nurse.getTarget() != _queen) || notCasting) { nurse.setTarget(_queen); nurse.useMagic(HEAL1.getSkill()); } continue; } // if nurse not casting - remove target - if (notCasting && (nurse.getTarget() != null)) - { + if (notCasting && (nurse.getTarget() != null)) { nurse.setTarget(null); } } - } - else if (event.equalsIgnoreCase("action") && (npc != null)) - { - if (getRandom(3) == 0) - { - if (getRandom(2) == 0) - { + } else if (event.equalsIgnoreCase("action") && (npc != null)) { + if (getRandom(3) == 0) { + if (getRandom(2) == 0) { npc.broadcastSocialAction(3); - } - else - { + } else { npc.broadcastSocialAction(4); } } - } - else if (event.equalsIgnoreCase("queen_unlock")) - { + } else if (event.equalsIgnoreCase("queen_unlock")) { L2GrandBossInstance queen = (L2GrandBossInstance) addSpawn(QUEEN, QUEEN_X, QUEEN_Y, QUEEN_Z, 0, false, 0); GrandBossManager.getInstance().setBossStatus(QUEEN, ALIVE); spawnBoss(queen); @@ -226,11 +192,9 @@ public final class QueenAnt extends AbstractNpcAI } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { final L2MonsterInstance mob = (L2MonsterInstance) npc; - switch (npc.getId()) - { + switch (npc.getId()) { case LARVA: mob.setIsImmobilized(true); mob.setIsMortal(false); @@ -251,17 +215,13 @@ public final class QueenAnt extends AbstractNpcAI } @Override - public String onFactionCall(L2Npc npc, L2Npc caller, L2PcInstance attacker, boolean isSummon) - { - if ((caller == null) || (npc == null)) - { + public String onFactionCall(L2Npc npc, L2Npc caller, L2PcInstance attacker, boolean isSummon) { + if ((caller == null) || (npc == null)) { return super.onFactionCall(npc, caller, attacker, isSummon); } - if (!npc.isCastingNow() && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_CAST)) - { - if (caller.getCurrentHp() < caller.getMaxHp()) - { + if (!npc.isCastingNow() && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_CAST)) { + if (caller.getCurrentHp() < caller.getMaxHp()) { npc.setTarget(caller); ((L2Attackable) npc).useMagic(HEAL1.getSkill()); } @@ -270,51 +230,38 @@ public final class QueenAnt extends AbstractNpcAI } @Override - public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) - { - if ((npc == null) || (player.isGM() && player.isInvisible())) - { + public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) { + if ((npc == null) || (player.isGM() && player.isInvisible())) { return null; } final boolean isMage; final L2Playable character; - if (isSummon) - { + if (isSummon) { isMage = false; character = player.getSummon(); - } - else - { + } else { isMage = player.isMageClass(); character = player; } - if (character == null) - { + if (character == null) { return null; } - if (npc().raidCurse() && ((character.getLevel() - npc.getLevel()) > 8)) - { + if (npc().raidCurse() && ((character.getLevel() - npc.getLevel()) > 8)) { Skill curse = null; - if (isMage) - { - if (!character.isMuted() && (getRandom(4) == 0)) - { + if (isMage) { + if (!character.isMuted() && (getRandom(4) == 0)) { curse = CommonSkill.RAID_CURSE.getSkill(); } - } - else - { - if (!character.isParalyzed() && (getRandom(4) == 0)) - { + } else { + if (!character.isParalyzed() && (getRandom(4) == 0)) { curse = CommonSkill.RAID_CURSE2.getSkill(); } } - if (curse != null) - { + if (curse != null) { npc.broadcastPacket(new MagicSkillUse(npc, character, curse.getId(), curse.getLevel(), 300, 0)); curse.applyEffects(npc, character); } @@ -327,11 +274,9 @@ public final class QueenAnt extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { int npcId = npc.getId(); - if (npcId == QUEEN) - { + if (npcId == QUEEN) { npc.broadcastPacket(Music.BS02_D_10000.getPacket()); GrandBossManager.getInstance().setBossStatus(QUEEN, DEAD); // Calculate Min and Max respawn times randomly. @@ -348,23 +293,16 @@ public final class QueenAnt extends AbstractNpcAI _larva.deleteMe(); _larva = null; _queen = null; - } - else if ((_queen != null) && !_queen.isAlikeDead()) - { - if (npcId == ROYAL) - { + } else if ((_queen != null) && !_queen.isAlikeDead()) { + if (npcId == ROYAL) { L2MonsterInstance mob = (L2MonsterInstance) npc; - if (mob.getLeader() != null) - { + if (mob.getLeader() != null) { mob.getLeader().getMinionList().onMinionDie(mob, (280 + getRandom(40)) * 1000); } - } - else if (npcId == NURSE) - { + } else if (npcId == NURSE) { L2MonsterInstance mob = (L2MonsterInstance) npc; _nurses.remove(mob); - if (mob.getLeader() != null) - { + if (mob.getLeader() != null) { mob.getLeader().getMinionList().onMinionDie(mob, 10000); } } @@ -372,8 +310,7 @@ public final class QueenAnt extends AbstractNpcAI return super.onKill(npc, killer, isSummon); } - public static void main(String[] args) - { + public static void main(String[] args) { new QueenAnt(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/QueenShyeed.java b/src/main/java/com/l2jserver/datapack/ai/individual/QueenShyeed.java index 7953f34eb8..7460d84213 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/QueenShyeed.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/QueenShyeed.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Queen Shyeed AI * @author malyelfik */ -public final class QueenShyeed extends AbstractNpcAI -{ +public final class QueenShyeed extends AbstractNpcAI { // NPC private static final int SHYEED = 25671; private static final Location SHYEED_LOC = new Location(79634, -55428, -6104, 0); @@ -47,16 +46,13 @@ public final class QueenShyeed extends AbstractNpcAI private static final L2EffectZone PC_BUFF_ZONE = ZoneManager.getInstance().getZoneById(200105, L2EffectZone.class); @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { case "respawn": spawnShyeed(); break; case "despawn": - if (!npc.isDead()) - { + if (!npc.isDead()) { npc.deleteMe(); startRespawn(); } @@ -66,27 +62,23 @@ public final class QueenShyeed extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.SHYEEDS_CRY_IS_STEADILY_DYING_DOWN); startRespawn(); PC_BUFF_ZONE.setEnabled(true); return super.onKill(npc, killer, isSummon); } - private QueenShyeed() - { + private QueenShyeed() { super(QueenShyeed.class.getSimpleName(), "ai/individual"); addKillId(SHYEED); spawnShyeed(); } - private void spawnShyeed() - { + private void spawnShyeed() { final String respawn = loadGlobalQuestVar("Respawn"); final long remain = (!respawn.isEmpty()) ? Long.parseLong(respawn) - System.currentTimeMillis() : 0; - if (remain > 0) - { + if (remain > 0) { startQuestTimer("respawn", remain, null, null); return; } @@ -97,8 +89,7 @@ public final class QueenShyeed extends AbstractNpcAI MOB_BUFF_DISPLAY_ZONE.setEnabled(true); } - private void startRespawn() - { + private void startRespawn() { final int respawnTime = RESPAWN - getRandom(RANDOM_RESPAWN); saveGlobalQuestVar("Respawn", Long.toString(System.currentTimeMillis() + respawnTime)); startQuestTimer("respawn", respawnTime, null, null); @@ -106,8 +97,7 @@ public final class QueenShyeed extends AbstractNpcAI MOB_BUFF_DISPLAY_ZONE.setEnabled(false); } - public static void main(String[] args) - { + public static void main(String[] args) { new QueenShyeed(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/RagnaOrcCommander.java b/src/main/java/com/l2jserver/datapack/ai/individual/RagnaOrcCommander.java index db2bfa9e54..1e5a65c641 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/RagnaOrcCommander.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/RagnaOrcCommander.java @@ -25,26 +25,22 @@ import com.l2jserver.gameserver.model.actor.L2Npc; * Ragna Orc Commander AI. * @author Zealar */ -public final class RagnaOrcCommander extends AbstractNpcAI -{ +public final class RagnaOrcCommander extends AbstractNpcAI { private static final int RAGNA_ORC_COMMANDER = 22694; - private RagnaOrcCommander() - { + private RagnaOrcCommander() { super(RagnaOrcCommander.class.getSimpleName(), "ai/individual"); addSpawnId(RAGNA_ORC_COMMANDER); } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { spawnMinions(npc, "Privates1"); spawnMinions(npc, getRandomBoolean() ? "Privates2" : "Privates3"); return super.onSpawn(npc); } - public static void main(String[] args) - { + public static void main(String[] args) { new RagnaOrcCommander(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/RagnaOrcHero.java b/src/main/java/com/l2jserver/datapack/ai/individual/RagnaOrcHero.java index 9d14ce1be5..184f88be64 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/RagnaOrcHero.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/RagnaOrcHero.java @@ -25,25 +25,21 @@ import com.l2jserver.gameserver.model.actor.L2Npc; * Ragna Orc Hero AI. * @author Zealar */ -public final class RagnaOrcHero extends AbstractNpcAI -{ +public final class RagnaOrcHero extends AbstractNpcAI { private static final int RAGNA_ORC_HERO = 22693; - private RagnaOrcHero() - { + private RagnaOrcHero() { super(RagnaOrcHero.class.getSimpleName(), "ai/individual"); addSpawnId(RAGNA_ORC_HERO); } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { spawnMinions(npc, getRandom(100) < 70 ? "Privates1" : "Privates2"); return super.onSpawn(npc); } - public static void main(String[] args) - { + public static void main(String[] args) { new RagnaOrcHero(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/RagnaOrcSeer.java b/src/main/java/com/l2jserver/datapack/ai/individual/RagnaOrcSeer.java index e1e9fab3a5..910462fdeb 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/RagnaOrcSeer.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/RagnaOrcSeer.java @@ -25,25 +25,21 @@ import com.l2jserver.gameserver.model.actor.L2Npc; * Ragna Orc Seer AI. * @author Zealar */ -public final class RagnaOrcSeer extends AbstractNpcAI -{ +public final class RagnaOrcSeer extends AbstractNpcAI { private static final int RAGNA_ORC_SEER = 22697; - private RagnaOrcSeer() - { + private RagnaOrcSeer() { super(RagnaOrcSeer.class.getSimpleName(), "ai/individual"); addSpawnId(RAGNA_ORC_SEER); } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { spawnMinions(npc, "Privates" + getRandom(1, 2)); return super.onSpawn(npc); } - public static void main(String[] args) - { + public static void main(String[] args) { new RagnaOrcSeer(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/Sailren/Sailren.java b/src/main/java/com/l2jserver/datapack/ai/individual/Sailren/Sailren.java index 6a5ee930df..f97ee72776 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/Sailren/Sailren.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/Sailren/Sailren.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.network.serverpackets.SpecialCamera; * Sailren AI. * @author St3eT */ -public final class Sailren extends AbstractNpcAI -{ +public final class Sailren extends AbstractNpcAI { // NPCs private static final int STATUE = 32109; // Shilen's Stone Statue private static final int MOVIE_NPC = 32110; // Invisible NPC for movie @@ -57,15 +56,13 @@ public final class Sailren extends AbstractNpcAI private static int _killCount = 0; private static long _lastAttack = 0; - private static enum Status - { + private static enum Status { ALIVE, IN_FIGHT, DEAD } - private Sailren() - { + private Sailren() { super(Sailren.class.getSimpleName(), "ai/individual"); addStartNpc(STATUE, CUBIC); addTalkId(STATUE, CUBIC); @@ -74,57 +71,39 @@ public final class Sailren extends AbstractNpcAI addAttackId(VELOCIRAPTOR, PTEROSAUR, TREX, SAILREN); final long remain = GlobalVariablesManager.getInstance().getLong("SailrenRespawn", 0) - System.currentTimeMillis(); - if (remain > 0) - { + if (remain > 0) { STATUS = Status.DEAD; startQuestTimer("CLEAR_STATUS", remain, null, null); } } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { case "32109-01.html": case "32109-01a.html": case "32109-02a.html": - case "32109-03a.html": - { + case "32109-03a.html": { return event; } - case "enter": - { + case "enter": { String htmltext = null; - if (!player.isInParty()) - { + if (!player.isInParty()) { htmltext = "32109-01.html"; - } - else if (STATUS == Status.DEAD) - { + } else if (STATUS == Status.DEAD) { htmltext = "32109-04.html"; - } - else if (STATUS == Status.IN_FIGHT) - { + } else if (STATUS == Status.IN_FIGHT) { htmltext = "32109-05.html"; - } - else if (!player.getParty().isLeader(player)) - { + } else if (!player.getParty().isLeader(player)) { htmltext = "32109-03.html"; - } - else if (!hasQuestItems(player, GAZKH)) - { + } else if (!hasQuestItems(player, GAZKH)) { htmltext = "32109-02.html"; - } - else - { + } else { takeItems(player, GAZKH, 1); STATUS = Status.IN_FIGHT; _lastAttack = System.currentTimeMillis(); - for (L2PcInstance member : player.getParty().getMembers()) - { - if (member.isInsideRadius(npc, 1000, true, false)) - { + for (L2PcInstance member : player.getParty().getMembers()) { + if (member.isInsideRadius(npc, 1000, true, false)) { member.teleToLocation(27549, -6638, -2008); } } @@ -134,21 +113,17 @@ public final class Sailren extends AbstractNpcAI } return htmltext; } - case "teleportOut": - { + case "teleportOut": { player.teleToLocation(TeleportWhereType.TOWN); break; } - case "SPAWN_VELOCIRAPTOR": - { - for (int i = 0; i < 3; i++) - { + case "SPAWN_VELOCIRAPTOR": { + for (int i = 0; i < 3; i++) { addSpawn(VELOCIRAPTOR, 27313 + getRandom(150), -6766 + getRandom(150), -1975, 0, false, 0); } break; } - case "SPAWN_SAILREN": - { + case "SPAWN_SAILREN": { final L2RaidBossInstance sailren = (L2RaidBossInstance) addSpawn(SAILREN, 27549, -6638, -2008, 0, false, 0); final L2Npc movieNpc = addSpawn(MOVIE_NPC, sailren.getX(), sailren.getY(), sailren.getZ() + 30, 0, false, 26000); sailren.setIsInvul(true); @@ -160,93 +135,72 @@ public final class Sailren extends AbstractNpcAI startQuestTimer("CAMERA_1", 4100, movieNpc, null); break; } - case "ANIMATION": - { - if (npc != null) - { + case "ANIMATION": { + if (npc != null) { npc.setTarget(npc); npc.doCast(ANIMATION); startQuestTimer("ANIMATION", 2000, npc, null); } break; } - case "CAMERA_1": - { + case "CAMERA_1": { zone.broadcastPacket(new SpecialCamera(npc, 100, 180, 30, 3000, 1500, 20000, 0, 50, 1, 0, 0)); startQuestTimer("CAMERA_2", 3000, npc, null); break; } - case "CAMERA_2": - { + case "CAMERA_2": { zone.broadcastPacket(new SpecialCamera(npc, 150, 270, 25, 3000, 1500, 20000, 0, 30, 1, 0, 0)); startQuestTimer("CAMERA_3", 3000, npc, null); break; } - case "CAMERA_3": - { + case "CAMERA_3": { zone.broadcastPacket(new SpecialCamera(npc, 160, 360, 20, 3000, 1500, 20000, 10, 15, 1, 0, 0)); startQuestTimer("CAMERA_4", 3000, npc, null); break; } - case "CAMERA_4": - { + case "CAMERA_4": { zone.broadcastPacket(new SpecialCamera(npc, 160, 450, 10, 3000, 1500, 20000, 0, 10, 1, 0, 0)); startQuestTimer("CAMERA_5", 3000, npc, null); break; } - case "CAMERA_5": - { + case "CAMERA_5": { zone.broadcastPacket(new SpecialCamera(npc, 160, 560, 0, 3000, 1500, 20000, 0, 10, 1, 0, 0)); startQuestTimer("CAMERA_6", 7000, npc, null); break; } - case "CAMERA_6": - { + case "CAMERA_6": { zone.broadcastPacket(new SpecialCamera(npc, 70, 560, 0, 500, 1500, 7000, -15, 20, 1, 0, 0)); break; } - case "ATTACK": - { + case "ATTACK": { npc.setIsInvul(false); npc.setIsImmobilized(false); break; } - case "CLEAR_STATUS": - { + case "CLEAR_STATUS": { STATUS = Status.ALIVE; break; } - case "TIME_OUT": - { - if (STATUS == Status.IN_FIGHT) - { + case "TIME_OUT": { + if (STATUS == Status.IN_FIGHT) { STATUS = Status.ALIVE; } - for (L2Character charInside : zone.getCharactersInside()) - { - if (charInside != null) - { - if (charInside.isPlayer()) - { + for (L2Character charInside : zone.getCharactersInside()) { + if (charInside != null) { + if (charInside.isPlayer()) { charInside.teleToLocation(TeleportWhereType.TOWN); - } - else if (charInside.isNpc()) - { + } else if (charInside.isNpc()) { charInside.deleteMe(); } } } break; } - case "CHECK_ATTACK": - { - if (!zone.getPlayersInside().isEmpty() && ((_lastAttack + 600000) < System.currentTimeMillis())) - { + case "CHECK_ATTACK": { + if (!zone.getPlayersInside().isEmpty() && ((_lastAttack + 600000) < System.currentTimeMillis())) { cancelQuestTimer("TIME_OUT", null, null); notifyEvent("TIME_OUT", null, null); - } - else - { + } else { startQuestTimer("CHECK_ATTACK", 120000, null, null); } break; @@ -256,24 +210,18 @@ public final class Sailren extends AbstractNpcAI } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (zone.isCharacterInZone(attacker)) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (zone.isCharacterInZone(attacker)) { _lastAttack = System.currentTimeMillis(); } return super.onAttack(npc, attacker, damage, isSummon); } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (zone.isCharacterInZone(killer)) - { - switch (npc.getId()) - { - case SAILREN: - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (zone.isCharacterInZone(killer)) { + switch (npc.getId()) { + case SAILREN: { STATUS = Status.DEAD; addSpawn(CUBIC, 27644, -6638, -2008, 0, false, 300000); final long respawnTime = RESPAWN * 3600000; @@ -284,25 +232,21 @@ public final class Sailren extends AbstractNpcAI startQuestTimer("TIME_OUT", 300000, null, null); break; } - case VELOCIRAPTOR: - { + case VELOCIRAPTOR: { _killCount++; - if (_killCount == 3) - { + if (_killCount == 3) { final L2Npc pterosaur = addSpawn(PTEROSAUR, 27313, -6766, -1975, 0, false, 0); addAttackDesire(pterosaur, killer); _killCount = 0; } break; } - case PTEROSAUR: - { + case PTEROSAUR: { final L2Npc trex = addSpawn(TREX, 27313, -6766, -1975, 0, false, 0); addAttackDesire(trex, killer); break; } - case TREX: - { + case TREX: { startQuestTimer("SPAWN_SAILREN", 180000, null, null); break; } @@ -312,18 +256,15 @@ public final class Sailren extends AbstractNpcAI } @Override - public boolean unload(boolean removeFromList) - { - if (STATUS == Status.IN_FIGHT) - { + public boolean unload(boolean removeFromList) { + if (STATUS == Status.IN_FIGHT) { _log.info(getClass().getSimpleName() + ": Script is being unloaded while Sailren is active, clearing zone."); notifyEvent("TIME_OUT", null, null); } return super.unload(removeFromList); } - public static void main(String[] args) - { + public static void main(String[] args) { new Sailren(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/ShadowSummoner.java b/src/main/java/com/l2jserver/datapack/ai/individual/ShadowSummoner.java index 8ed0594989..6d79dc21bc 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/ShadowSummoner.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/ShadowSummoner.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.util.Util; * @author Zoey76 * @since 2.6.0.0 */ -public class ShadowSummoner extends AbstractNpcAI -{ +public class ShadowSummoner extends AbstractNpcAI { // NPCs private static final int SHADOW_SUMMONER = 25722; private static final int DEMONS_BANQUET_1 = 25730; @@ -53,23 +52,19 @@ public class ShadowSummoner extends AbstractNpcAI private static final int MAX_CHASE_DIST = 2500; private static final double MIN_HP_PERCENTAGE = 0.25; - public ShadowSummoner() - { + public ShadowSummoner() { super(ShadowSummoner.class.getSimpleName(), "ai/individual"); addAttackId(SHADOW_SUMMONER); addSeeCreatureId(SHADOW_SUMMONER); } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (Util.calculateDistance(npc, npc.getSpawn(), false, false) > MAX_CHASE_DIST) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (Util.calculateDistance(npc, npc.getSpawn(), false, false) > MAX_CHASE_DIST) { npc.teleToLocation(npc.getSpawn().getX(), npc.getSpawn().getY(), npc.getSpawn().getZ()); } - if ((npc.getCurrentHp() < (npc.getMaxHp() * MIN_HP_PERCENTAGE)) && !npc.getVariables().getBoolean(LOW_HP_FLAG, false)) - { + if ((npc.getCurrentHp() < (npc.getMaxHp() * MIN_HP_PERCENTAGE)) && !npc.getVariables().getBoolean(LOW_HP_FLAG, false)) { npc.getVariables().set(LOW_HP_FLAG, true); startQuestTimer(SUMMON_TIMER, 1000, npc, attacker); startQuestTimer(FEED_TIMER, 30000, npc, attacker); @@ -79,12 +74,9 @@ public class ShadowSummoner extends AbstractNpcAI } @Override - public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) - { - if (!creature.isPlayer()) - { - if (creature.getId() == DEMONS_BANQUET_2) - { + public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) { + if (!creature.isPlayer()) { + if (creature.getId() == DEMONS_BANQUET_2) { ((L2Attackable) npc).clearAggroList(); addAttackDesire(npc, creature, 9999999999999999L); } @@ -93,35 +85,24 @@ public class ShadowSummoner extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (npc.isDead()) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (npc.isDead()) { return super.onAdvEvent(event, npc, player); } - if (SUMMON_TIMER.equals(event)) - { - if (!npc.getVariables().getBoolean(LIMIT_FLAG, false)) - { + if (SUMMON_TIMER.equals(event)) { + if (!npc.getVariables().getBoolean(LIMIT_FLAG, false)) { startQuestTimer(DELAY_TIMER, 5000, npc, player); startQuestTimer(SUMMON_TIMER, 30000, npc, player); } - } - else if (FEED_TIMER.equals(event)) - { - if (!npc.getVariables().getBoolean(LIMIT_FLAG, false)) - { + } else if (FEED_TIMER.equals(event)) { + if (!npc.getVariables().getBoolean(LIMIT_FLAG, false)) { npc.getAI().setIntention(AI_INTENTION_ATTACK); startQuestTimer(FEED_TIMER, 30000, npc, player); } - } - else if (LIMIT_TIMER.equals(event)) - { + } else if (LIMIT_TIMER.equals(event)) { npc.getVariables().set(LIMIT_FLAG, true); - } - else if (DELAY_TIMER.equals(event)) - { + } else if (DELAY_TIMER.equals(event)) { addSkillCastDesire(npc, npc, SUMMON_SKELETON, 9999999999900000L); final L2Npc demonsBanquet = addSpawn(getRandom(2) < 1 ? DEMONS_BANQUET_1 : DEMONS_BANQUET_2, npc.getX() + 150, npc.getY() + 150, npc.getZ(), npc.getHeading(), false, 0); addAttackDesire(demonsBanquet, player, 10000); @@ -129,8 +110,7 @@ public class ShadowSummoner extends AbstractNpcAI return super.onAdvEvent(event, npc, player); } - public static void main(String[] args) - { + public static void main(String[] args) { new ShadowSummoner(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/SinEater.java b/src/main/java/com/l2jserver/datapack/ai/individual/SinEater.java index 87a768b63f..7866d475d9 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/SinEater.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/SinEater.java @@ -37,46 +37,32 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * Sin Eater AI. * @author St3eT. */ -public final class SinEater extends AbstractNpcAI -{ +public final class SinEater extends AbstractNpcAI { // NPCs private static final int SIN_EATER = 12564; - private SinEater() - { + private SinEater() { super(SinEater.class.getSimpleName(), "ai/individual"); addSummonSpawnId(SIN_EATER); addSummonTalkId(SIN_EATER); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equals("TALK") && (player != null) && (player.getSummon() != null)) - { - if (getRandom(100) < 30) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equals("TALK") && (player != null) && (player.getSummon() != null)) { + if (getRandom(100) < 30) { final int random = getRandom(100); final L2Summon summon = player.getSummon(); - if (random < 20) - { + if (random < 20) { broadcastSummonSay(summon, NpcStringId.YAWWWWN_ITS_SO_BORING_HERE_WE_SHOULD_GO_AND_FIND_SOME_ACTION); - } - else if (random < 40) - { + } else if (random < 40) { broadcastSummonSay(summon, NpcStringId.HEY_IF_YOU_CONTINUE_TO_WASTE_TIME_YOU_WILL_NEVER_FINISH_YOUR_PENANCE); - } - else if (random < 60) - { + } else if (random < 60) { broadcastSummonSay(summon, NpcStringId.I_KNOW_YOU_DONT_LIKE_ME_THE_FEELING_IS_MUTUAL); - } - else if (random < 80) - { + } else if (random < 80) { broadcastSummonSay(summon, NpcStringId.I_NEED_A_DRINK); - } - else - { + } else { broadcastSummonSay(summon, NpcStringId.OH_THIS_IS_DRAGGING_ON_TOO_LONG_AT_THIS_RATE_I_WONT_MAKE_IT_HOME_BEFORE_THE_SEVEN_SEALS_ARE_BROKEN); } } @@ -88,21 +74,15 @@ public final class SinEater extends AbstractNpcAI @RegisterEvent(EventType.ON_CREATURE_KILL) @RegisterType(ListenerRegisterType.NPC) @Id(SIN_EATER) - public void onCreatureKill(OnCreatureKill event) - { + public void onCreatureKill(OnCreatureKill event) { final int random = getRandom(100); final L2Summon summon = (L2Summon) event.getTarget(); - if (random < 30) - { + if (random < 30) { broadcastSummonSay(summon, NpcStringId.OH_THIS_IS_JUST_GREAT_WHAT_ARE_YOU_GOING_TO_DO_NOW); - } - else if (random < 70) - { + } else if (random < 70) { broadcastSummonSay(summon, NpcStringId.YOU_INCONSIDERATE_MORON_CANT_YOU_EVEN_TAKE_CARE_OF_LITTLE_OLD_ME); - } - else - { + } else { broadcastSummonSay(summon, NpcStringId.OH_NO_THE_MAN_WHO_EATS_ONES_SINS_HAS_DIED_PENITENCE_IS_FURTHER_AWAY); } } @@ -110,68 +90,49 @@ public final class SinEater extends AbstractNpcAI @RegisterEvent(EventType.ON_CREATURE_ATTACKED) @RegisterType(ListenerRegisterType.NPC) @Id(SIN_EATER) - public void onCreatureAttacked(OnCreatureAttacked event) - { - if (getRandom(100) < 30) - { + public void onCreatureAttacked(OnCreatureAttacked event) { + if (getRandom(100) < 30) { final int random = getRandom(100); final L2Summon summon = (L2Summon) event.getTarget(); - if (random < 35) - { + if (random < 35) { broadcastSummonSay(summon, NpcStringId.OH_THAT_SMARTS); - } - else if (random < 70) - { + } else if (random < 70) { broadcastSummonSay(summon, NpcStringId.HEY_MASTER_PAY_ATTENTION_IM_DYING_OVER_HERE); - } - else - { + } else { broadcastSummonSay(summon, NpcStringId.WHAT_HAVE_I_DONE_TO_DESERVE_THIS); } } } @Override - public void onSummonSpawn(L2Summon summon) - { + public void onSummonSpawn(L2Summon summon) { broadcastSummonSay(summon, getRandomBoolean() ? NpcStringId.HEY_IT_SEEMS_LIKE_YOU_NEED_MY_HELP_DOESNT_IT : NpcStringId.ALMOST_GOT_IT_OUCH_STOP_DAMN_THESE_BLOODY_MANACLES); startQuestTimer("TALK", 60000, null, summon.getOwner()); } @Override - public void onSummonTalk(L2Summon summon) - { - if (getRandom(100) < 10) - { + public void onSummonTalk(L2Summon summon) { + if (getRandom(100) < 10) { final int random = getRandom(100); - if (random < 25) - { + if (random < 25) { broadcastSummonSay(summon, NpcStringId.USING_A_SPECIAL_SKILL_HERE_COULD_TRIGGER_A_BLOODBATH); - } - else if (random < 50) - { + } else if (random < 50) { broadcastSummonSay(summon, NpcStringId.HEY_WHAT_DO_YOU_EXPECT_OF_ME); - } - else if (random < 75) - { + } else if (random < 75) { broadcastSummonSay(summon, NpcStringId.UGGGGGH_PUSH_ITS_NOT_COMING_OUT); - } - else - { + } else { broadcastSummonSay(summon, NpcStringId.AH_I_MISSED_THE_MARK); } } } - private void broadcastSummonSay(L2Summon summon, NpcStringId npcstringId) - { + private void broadcastSummonSay(L2Summon summon, NpcStringId npcstringId) { summon.broadcastPacket(new NpcSay(summon.getObjectId(), Say2.NPC_ALL, summon.getId(), npcstringId)); } - public static void main(String[] args) - { + public static void main(String[] args) { new SinEater(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/SinWardens.java b/src/main/java/com/l2jserver/datapack/ai/individual/SinWardens.java index 199a3f5138..c77670de81 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/SinWardens.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/SinWardens.java @@ -33,10 +33,8 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * Manages Sin Wardens disappearing and chat. * @author GKR */ -public final class SinWardens extends AbstractNpcAI -{ - private static final int[] SIN_WARDEN_MINIONS = - { +public final class SinWardens extends AbstractNpcAI { + private static final int[] SIN_WARDEN_MINIONS = { 22424, 22425, 22426, @@ -55,31 +53,24 @@ public final class SinWardens extends AbstractNpcAI private final Map<Integer, Integer> killedMinionsCount = new ConcurrentHashMap<>(); - private SinWardens() - { + private SinWardens() { super(SinWardens.class.getSimpleName(), "ai/individual"); addKillId(SIN_WARDEN_MINIONS); } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (npc.isMinion()) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (npc.isMinion()) { final L2MonsterInstance master = ((L2MonsterInstance) npc).getLeader(); - if ((master != null) && !master.isDead()) - { + if ((master != null) && !master.isDead()) { int killedCount = killedMinionsCount.containsKey(master.getObjectId()) ? killedMinionsCount.get(master.getObjectId()) : 0; killedCount++; - if ((killedCount) == 5) - { + if ((killedCount) == 5) { master.broadcastPacket(new NpcSay(master.getObjectId(), Say2.NPC_ALL, master.getId(), NpcStringId.WE_MIGHT_NEED_NEW_SLAVES_ILL_BE_BACK_SOON_SO_WAIT)); master.doDie(killer); killedMinionsCount.remove(master.getObjectId()); - } - else - { + } else { killedMinionsCount.put(master.getObjectId(), killedCount); } } @@ -87,8 +78,7 @@ public final class SinWardens extends AbstractNpcAI return super.onKill(npc, killer, isSummon); } - public static void main(String[] args) - { + public static void main(String[] args) { new SinWardens(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/Valakas.java b/src/main/java/com/l2jserver/datapack/ai/individual/Valakas.java index bb828fdf06..cf6ea62ca3 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/Valakas.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/Valakas.java @@ -47,8 +47,7 @@ import com.l2jserver.gameserver.util.Util; * Valakas' AI. * @author Tryskell */ -public final class Valakas extends AbstractNpcAI -{ +public final class Valakas extends AbstractNpcAI { // NPC private static final int VALAKAS = 29028; // Skills @@ -59,16 +58,14 @@ public final class Valakas extends AbstractNpcAI private static final SkillHolder VALAKAS_REGENERATION_3 = new SkillHolder(4691, 3); private static final SkillHolder VALAKAS_REGENERATION_4 = new SkillHolder(4691, 4); - private static final SkillHolder[] VALAKAS_REGULAR_SKILLS = - { + private static final SkillHolder[] VALAKAS_REGULAR_SKILLS = { new SkillHolder(4681), // Valakas Trample new SkillHolder(4682), // Valakas Trample new SkillHolder(4683), // Valakas Dragon Breath new SkillHolder(4689), // Valakas Fear TODO: has two levels only level one is used. }; - private static final SkillHolder[] VALAKAS_LOWHP_SKILLS = - { + private static final SkillHolder[] VALAKAS_LOWHP_SKILLS = { new SkillHolder(4681), // Valakas Trample new SkillHolder(4682), // Valakas Trample new SkillHolder(4683), // Valakas Dragon Breath @@ -76,8 +73,7 @@ public final class Valakas extends AbstractNpcAI new SkillHolder(4690), // Valakas Meteor Storm }; - private static final SkillHolder[] VALAKAS_AOE_SKILLS = - { + private static final SkillHolder[] VALAKAS_AOE_SKILLS = { new SkillHolder(4683), // Valakas Dragon Breath new SkillHolder(4684), // Valakas Dragon Breath new SkillHolder(4685), // Valakas Tail Stomp @@ -88,8 +84,7 @@ public final class Valakas extends AbstractNpcAI }; // Locations - private static final Location TELEPORT_CUBE_LOCATIONS[] = - { + private static final Location TELEPORT_CUBE_LOCATIONS[] = { new Location(214880, -116144, -1644), new Location(213696, -116592, -1644), new Location(212112, -116688, -1644), @@ -119,8 +114,7 @@ public final class Valakas extends AbstractNpcAI private L2Playable _actualVictim; // Actual target of Valakas. private static L2BossZone ZONE; - private Valakas() - { + private Valakas() { super(Valakas.class.getSimpleName(), "ai/individual"); registerMobs(VALAKAS); @@ -128,17 +122,13 @@ public final class Valakas extends AbstractNpcAI final StatsSet info = GrandBossManager.getInstance().getStatsSet(VALAKAS); final int status = GrandBossManager.getInstance().getBossStatus(VALAKAS); - if (status == DEAD) - { + if (status == DEAD) { // load the unlock date and time for valakas from DB long temp = (info.getLong("respawn_time") - System.currentTimeMillis()); - if (temp > 0) - { + if (temp > 0) { // The time has not yet expired. Mark Valakas as currently locked (dead). startQuestTimer("valakas_unlock", temp, null, null); - } - else - { + } else { // The time has expired while the server was offline. Spawn valakas in his cave as DORMANT. final L2Npc valakas = addSpawn(VALAKAS, -105200, -253104, -15264, 0, false, 0); GrandBossManager.getInstance().setBossStatus(VALAKAS, DORMANT); @@ -149,9 +139,7 @@ public final class Valakas extends AbstractNpcAI valakas.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); } - } - else - { + } else { final int loc_x = info.getInt("loc_x"); final int loc_y = info.getInt("loc_y"); final int loc_z = info.getInt("loc_z"); @@ -166,22 +154,18 @@ public final class Valakas extends AbstractNpcAI valakas.setRunning(); // Start timers. - if (status == FIGHTING) - { + if (status == FIGHTING) { // stores current time for inactivity task. _timeTracker = System.currentTimeMillis(); startQuestTimer("regen_task", 60000, valakas, null, true); startQuestTimer("skill_task", 2000, valakas, null, true); - } - else - { + } else { valakas.setIsInvul(true); valakas.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); // Start timer to lock entry after 30 minutes - if (status == WAITING) - { + if (status == WAITING) { startQuestTimer("beginning", grandBoss().getValakasWaitTime(), valakas, null); } } @@ -189,12 +173,9 @@ public final class Valakas extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (npc != null) - { - if (event.equalsIgnoreCase("beginning")) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (npc != null) { + if (event.equalsIgnoreCase("beginning")) { // Stores current time _timeTracker = System.currentTimeMillis(); @@ -202,8 +183,7 @@ public final class Valakas extends AbstractNpcAI npc.teleToLocation(VALAKAS_LAIR); // Sound + socialAction. - for (L2PcInstance plyr : ZONE.getPlayersInside()) - { + for (L2PcInstance plyr : ZONE.getPlayersInside()) { plyr.sendPacket(Music.BS03_A_10000.getPacket()); plyr.sendPacket(new SocialAction(npc.getObjectId(), 3)); } @@ -221,13 +201,10 @@ public final class Valakas extends AbstractNpcAI startQuestTimer("spawn_10", 26000, npc, null); // 2500 - AI + unlock } // Regeneration && inactivity task - else if (event.equalsIgnoreCase("regen_task")) - { + else if (event.equalsIgnoreCase("regen_task")) { // Inactivity task - 15min - if (GrandBossManager.getInstance().getBossStatus(VALAKAS) == FIGHTING) - { - if ((_timeTracker + 900000) < System.currentTimeMillis()) - { + if (GrandBossManager.getInstance().getBossStatus(VALAKAS) == FIGHTING) { + if ((_timeTracker + 900000) < System.currentTimeMillis()) { npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); npc.teleToLocation(VALAKAS_REGENERATION_LOC); @@ -249,69 +226,46 @@ public final class Valakas extends AbstractNpcAI final int lvl = info != null ? info.getSkill().getLevel() : 0; // Current HPs are inferior to 25% ; apply lvl 4 of regen skill. - if ((npc.getCurrentHp() < (npc.getMaxHp() / 4)) && (lvl != 4)) - { + if ((npc.getCurrentHp() < (npc.getMaxHp() / 4)) && (lvl != 4)) { npc.setTarget(npc); npc.doCast(VALAKAS_REGENERATION_4); } // Current HPs are inferior to 50% ; apply lvl 3 of regen skill. - else if ((npc.getCurrentHp() < ((npc.getMaxHp() * 2) / 4.0)) && (lvl != 3)) - { + else if ((npc.getCurrentHp() < ((npc.getMaxHp() * 2) / 4.0)) && (lvl != 3)) { npc.setTarget(npc); npc.doCast(VALAKAS_REGENERATION_3); } // Current HPs are inferior to 75% ; apply lvl 2 of regen skill. - else if ((npc.getCurrentHp() < ((npc.getMaxHp() * 3) / 4.0)) && (lvl != 2)) - { + else if ((npc.getCurrentHp() < ((npc.getMaxHp() * 3) / 4.0)) && (lvl != 2)) { npc.setTarget(npc); npc.doCast(VALAKAS_REGENERATION_2); } // Apply lvl 1. - else if (lvl != 1) - { + else if (lvl != 1) { npc.setTarget(npc); npc.doCast(VALAKAS_REGENERATION_1); } } // Spawn cinematic, regen_task and choose of skill. - else if (event.equalsIgnoreCase("spawn_1")) - { + else if (event.equalsIgnoreCase("spawn_1")) { ZONE.broadcastPacket(new SpecialCamera(npc, 1800, 180, -1, 1500, 15000, 10000, 0, 0, 1, 0, 0)); - } - else if (event.equalsIgnoreCase("spawn_2")) - { + } else if (event.equalsIgnoreCase("spawn_2")) { ZONE.broadcastPacket(new SpecialCamera(npc, 1300, 180, -5, 3000, 15000, 10000, 0, -5, 1, 0, 0)); - } - else if (event.equalsIgnoreCase("spawn_3")) - { + } else if (event.equalsIgnoreCase("spawn_3")) { ZONE.broadcastPacket(new SpecialCamera(npc, 500, 180, -8, 600, 15000, 10000, 0, 60, 1, 0, 0)); - } - else if (event.equalsIgnoreCase("spawn_4")) - { + } else if (event.equalsIgnoreCase("spawn_4")) { ZONE.broadcastPacket(new SpecialCamera(npc, 800, 180, -8, 2700, 15000, 10000, 0, 30, 1, 0, 0)); - } - else if (event.equalsIgnoreCase("spawn_5")) - { + } else if (event.equalsIgnoreCase("spawn_5")) { ZONE.broadcastPacket(new SpecialCamera(npc, 200, 250, 70, 0, 15000, 10000, 30, 80, 1, 0, 0)); - } - else if (event.equalsIgnoreCase("spawn_6")) - { + } else if (event.equalsIgnoreCase("spawn_6")) { ZONE.broadcastPacket(new SpecialCamera(npc, 1100, 250, 70, 2500, 15000, 10000, 30, 80, 1, 0, 0)); - } - else if (event.equalsIgnoreCase("spawn_7")) - { + } else if (event.equalsIgnoreCase("spawn_7")) { ZONE.broadcastPacket(new SpecialCamera(npc, 700, 150, 30, 0, 15000, 10000, -10, 60, 1, 0, 0)); - } - else if (event.equalsIgnoreCase("spawn_8")) - { + } else if (event.equalsIgnoreCase("spawn_8")) { ZONE.broadcastPacket(new SpecialCamera(npc, 1200, 150, 20, 2900, 15000, 10000, -10, 30, 1, 0, 0)); - } - else if (event.equalsIgnoreCase("spawn_9")) - { + } else if (event.equalsIgnoreCase("spawn_9")) { ZONE.broadcastPacket(new SpecialCamera(npc, 750, 170, -10, 3400, 15000, 4000, 10, -15, 1, 0, 0)); - } - else if (event.equalsIgnoreCase("spawn_10")) - { + } else if (event.equalsIgnoreCase("spawn_10")) { GrandBossManager.getInstance().setBossStatus(VALAKAS, FIGHTING); npc.setIsInvul(false); @@ -319,60 +273,37 @@ public final class Valakas extends AbstractNpcAI startQuestTimer("skill_task", 2000, npc, null, true); } // Death cinematic, spawn of Teleport Cubes. - else if (event.equalsIgnoreCase("die_1")) - { + else if (event.equalsIgnoreCase("die_1")) { ZONE.broadcastPacket(new SpecialCamera(npc, 2000, 130, -1, 0, 15000, 10000, 0, 0, 1, 1, 0)); - } - else if (event.equalsIgnoreCase("die_2")) - { + } else if (event.equalsIgnoreCase("die_2")) { ZONE.broadcastPacket(new SpecialCamera(npc, 1100, 210, -5, 3000, 15000, 10000, -13, 0, 1, 1, 0)); - } - else if (event.equalsIgnoreCase("die_3")) - { + } else if (event.equalsIgnoreCase("die_3")) { ZONE.broadcastPacket(new SpecialCamera(npc, 1300, 200, -8, 3000, 15000, 10000, 0, 15, 1, 1, 0)); - } - else if (event.equalsIgnoreCase("die_4")) - { + } else if (event.equalsIgnoreCase("die_4")) { ZONE.broadcastPacket(new SpecialCamera(npc, 1000, 190, 0, 500, 15000, 10000, 0, 10, 1, 1, 0)); - } - else if (event.equalsIgnoreCase("die_5")) - { + } else if (event.equalsIgnoreCase("die_5")) { ZONE.broadcastPacket(new SpecialCamera(npc, 1700, 120, 0, 2500, 15000, 10000, 12, 40, 1, 1, 0)); - } - else if (event.equalsIgnoreCase("die_6")) - { + } else if (event.equalsIgnoreCase("die_6")) { ZONE.broadcastPacket(new SpecialCamera(npc, 1700, 20, 0, 700, 15000, 10000, 10, 10, 1, 1, 0)); - } - else if (event.equalsIgnoreCase("die_7")) - { + } else if (event.equalsIgnoreCase("die_7")) { ZONE.broadcastPacket(new SpecialCamera(npc, 1700, 10, 0, 1000, 15000, 10000, 20, 70, 1, 1, 0)); - } - else if (event.equalsIgnoreCase("die_8")) - { + } else if (event.equalsIgnoreCase("die_8")) { ZONE.broadcastPacket(new SpecialCamera(npc, 1700, 10, 0, 300, 15000, 250, 20, -20, 1, 1, 0)); - for (Location loc : TELEPORT_CUBE_LOCATIONS) - { + for (Location loc : TELEPORT_CUBE_LOCATIONS) { addSpawn(31759, loc, false, 900000); } startQuestTimer("remove_players", 900000, null, null); - } - else if (event.equalsIgnoreCase("skill_task")) - { + } else if (event.equalsIgnoreCase("skill_task")) { callSkillAI(npc); } - } - else - { - if (event.equalsIgnoreCase("valakas_unlock")) - { + } else { + if (event.equalsIgnoreCase("valakas_unlock")) { final L2Npc valakas = addSpawn(VALAKAS, -105200, -253104, -15264, 32768, false, 0); GrandBossManager.getInstance().addBoss((L2GrandBossInstance) valakas); GrandBossManager.getInstance().setBossStatus(VALAKAS, DORMANT); - } - else if (event.equalsIgnoreCase("remove_players")) - { + } else if (event.equalsIgnoreCase("remove_players")) { ZONE.oustAllPlayers(); } } @@ -380,37 +311,30 @@ public final class Valakas extends AbstractNpcAI } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { npc.disableCoreAI(true); return super.onSpawn(npc); } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (!ZONE.isInsideZone(attacker)) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (!ZONE.isInsideZone(attacker)) { attacker.doDie(attacker); return null; } - if (npc.isInvul()) - { + if (npc.isInvul()) { return null; } - if (GrandBossManager.getInstance().getBossStatus(VALAKAS) != FIGHTING) - { + if (GrandBossManager.getInstance().getBossStatus(VALAKAS) != FIGHTING) { attacker.teleToLocation(ATTACKER_REMOVE); return null; } // Debuff strider-mounted players. - if (attacker.getMountType() == MountType.STRIDER) - { - if (!attacker.isAffectedBySkill(HINDER_STRIDER.getSkillId())) - { + if (attacker.getMountType() == MountType.STRIDER) { + if (!attacker.isAffectedBySkill(HINDER_STRIDER.getSkillId())) { npc.setTarget(attacker); npc.doCast(HINDER_STRIDER); } @@ -421,8 +345,7 @@ public final class Valakas extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { // Cancel skill_task and regen_task. cancelQuestTimer("regen_task", npc, null); cancelQuestTimer("skill_task", npc, null); @@ -455,29 +378,23 @@ public final class Valakas extends AbstractNpcAI } @Override - public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) { return null; } - private void callSkillAI(L2Npc npc) - { - if (npc.isInvul() || npc.isCastingNow()) - { + private void callSkillAI(L2Npc npc) { + if (npc.isInvul() || npc.isCastingNow()) { return; } // Pickup a target if no or dead victim. 10% luck he decides to reconsiders his target. - if ((_actualVictim == null) || _actualVictim.isDead() || !(npc.getKnownList().knowsObject(_actualVictim)) || (getRandom(10) == 0)) - { + if ((_actualVictim == null) || _actualVictim.isDead() || !(npc.getKnownList().knowsObject(_actualVictim)) || (getRandom(10) == 0)) { _actualVictim = getRandomTarget(npc); } // If result is still null, Valakas will roam. Don't go deeper in skill AI. - if (_actualVictim == null) - { - if (getRandom(10) == 0) - { + if (_actualVictim == null) { + if (getRandom(10) == 0) { int x = npc.getX(); int y = npc.getY(); int z = npc.getZ(); @@ -485,8 +402,7 @@ public final class Valakas extends AbstractNpcAI int posX = x + getRandom(-1400, 1400); int posY = y + getRandom(-1400, 1400); - if (GeoData.getInstance().canMove(x, y, z, posX, posY, z, npc.getInstanceId())) - { + if (GeoData.getInstance().canMove(x, y, z, posX, posY, z, npc.getInstanceId())) { npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(posX, posY, z, 0)); } } @@ -496,15 +412,12 @@ public final class Valakas extends AbstractNpcAI final SkillHolder skill = getRandomSkill(npc); // Cast the skill or follow the target. - if (Util.checkIfInRange((skill.getSkill().getCastRange() < 600) ? 600 : skill.getSkill().getCastRange(), npc, _actualVictim, true)) - { + if (Util.checkIfInRange((skill.getSkill().getCastRange() < 600) ? 600 : skill.getSkill().getCastRange(), npc, _actualVictim, true)) { npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); npc.setIsCastingNow(true); npc.setTarget(_actualVictim); npc.doCast(skill); - } - else - { + } else { npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, _actualVictim, null); npc.setIsCastingNow(false); } @@ -517,24 +430,20 @@ public final class Valakas extends AbstractNpcAI * @param npc valakas * @return a skill holder */ - private SkillHolder getRandomSkill(L2Npc npc) - { + private SkillHolder getRandomSkill(L2Npc npc) { final int hpRatio = (int) ((npc.getCurrentHp() / npc.getMaxHp()) * 100); // Valakas Lava Skin has priority. - if ((hpRatio < 75) && (getRandom(150) == 0) && !npc.isAffectedBySkill(VALAKAS_LAVA_SKIN.getSkillId())) - { + if ((hpRatio < 75) && (getRandom(150) == 0) && !npc.isAffectedBySkill(VALAKAS_LAVA_SKIN.getSkillId())) { return VALAKAS_LAVA_SKIN; } // Valakas will use mass spells if he feels surrounded. - if (Util.getPlayersCountInRadius(1200, npc, false, false) >= 20) - { + if (Util.getPlayersCountInRadius(1200, npc, false, false) >= 20) { return VALAKAS_AOE_SKILLS[getRandom(VALAKAS_AOE_SKILLS.length)]; } - if (hpRatio > 50) - { + if (hpRatio > 50) { return VALAKAS_REGULAR_SKILLS[getRandom(VALAKAS_REGULAR_SKILLS.length)]; } @@ -546,18 +455,13 @@ public final class Valakas extends AbstractNpcAI * @param npc * @return a random L2Playable. */ - private L2Playable getRandomTarget(L2Npc npc) - { + private L2Playable getRandomTarget(L2Npc npc) { List<L2Playable> result = new ArrayList<>(); - for (L2Character obj : npc.getKnownList().getKnownCharacters()) - { - if ((obj == null) || obj.isPet()) - { + for (L2Character obj : npc.getKnownList().getKnownCharacters()) { + if ((obj == null) || obj.isPet()) { continue; - } - else if (!obj.isDead() && obj.isPlayable()) - { + } else if (!obj.isDead() && obj.isPlayable()) { result.add((L2Playable) obj); } } @@ -565,8 +469,7 @@ public final class Valakas extends AbstractNpcAI return (result.isEmpty()) ? null : result.get(getRandom(result.size())); } - public static void main(String[] args) - { + public static void main(String[] args) { new Valakas(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/individual/Venom/Venom.java b/src/main/java/com/l2jserver/datapack/ai/individual/Venom/Venom.java index 3fd266158c..8e68509b56 100644 --- a/src/main/java/com/l2jserver/datapack/ai/individual/Venom/Venom.java +++ b/src/main/java/com/l2jserver/datapack/ai/individual/Venom/Venom.java @@ -42,8 +42,7 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Venom AI on Rune Castle. * @author nonom, MELERIX */ -public final class Venom extends AbstractNpcAI -{ +public final class Venom extends AbstractNpcAI { private static final int CASTLE = 8; // Rune private static final int VENOM = 29054; @@ -55,8 +54,7 @@ public final class Venom extends AbstractNpcAI private static final int HOURS_BEFORE = 24; - private static final Location[] TARGET_TELEPORTS = - { + private static final Location[] TARGET_TELEPORTS = { new Location(12860, -49158, 976), new Location(14878, -51339, 1024), new Location(15674, -49970, 864), @@ -98,8 +96,7 @@ public final class Venom extends AbstractNpcAI private static List<L2PcInstance> _targets = new ArrayList<>(); - private Venom() - { + private Venom() { super(Venom.class.getSimpleName(), "ai/individual"); addStartNpc(DUNGEON_KEEPER, TELEPORT_CUBE); addFirstTalkId(DUNGEON_KEEPER, TELEPORT_CUBE); @@ -115,30 +112,22 @@ public final class Venom extends AbstractNpcAI final long currentTime = System.currentTimeMillis(); final long startSiegeDate = CastleManager.getInstance().getCastleById(CASTLE).getSiegeDate().getTimeInMillis(); final long openingDungeonDate = startSiegeDate - (HOURS_BEFORE * 360000); - if ((currentTime > openingDungeonDate) && (currentTime < startSiegeDate)) - { + if ((currentTime > openingDungeonDate) && (currentTime < startSiegeDate)) { _prisonIsOpen = true; } } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { - switch (npc.getId()) - { - case TELEPORT_CUBE: - { + public String onTalk(L2Npc npc, L2PcInstance talker) { + switch (npc.getId()) { + case TELEPORT_CUBE: { talker.teleToLocation(TeleportWhereType.TOWN); break; } - case DUNGEON_KEEPER: - { - if (_prisonIsOpen) - { + case DUNGEON_KEEPER: { + if (_prisonIsOpen) { talker.teleToLocation(TELEPORT); - } - else - { + } else { return "35506-02.html"; } break; @@ -148,13 +137,10 @@ public final class Venom extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { case "tower_check": - if (CastleManager.getInstance().getCastleById(CASTLE).getSiege().getControlTowerCount() <= 1) - { + if (CastleManager.getInstance().getCastleById(CASTLE).getSiege().getControlTowerCount() <= 1) { changeLocation(MoveTo.THRONE); broadcastNpcSay(_massymore, Say2.NPC_SHOUT, NpcStringId.OH_NO_THE_DEFENSES_HAVE_FAILED_IT_IS_TOO_DANGEROUS_TO_REMAIN_INSIDE_THE_CASTLE_FLEE_EVERY_MAN_FOR_HIMSELF); cancelQuestTimer("tower_check", npc, null); @@ -162,14 +148,12 @@ public final class Venom extends AbstractNpcAI } break; case "raid_check": - if (!npc.isInsideZone(ZoneId.SIEGE) && !npc.isTeleporting()) - { + if (!npc.isInsideZone(ZoneId.SIEGE) && !npc.isTeleporting()) { npc.teleToLocation(_loc); } break; case "cube_despawn": - if (npc != null) - { + if (npc != null) { npc.deleteMe(); } break; @@ -178,26 +162,21 @@ public final class Venom extends AbstractNpcAI } @Override - public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) - { - if (isSummon) - { + public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) { + if (isSummon) { return super.onAggroRangeEnter(npc, player, isSummon); } - if (_aggroMode && (_targets.size() < 10) && (getRandom(3) < 1) && !player.isDead()) - { + if (_aggroMode && (_targets.size() < 10) && (getRandom(3) < 1) && !player.isDead()) { _targets.add(player); } return super.onAggroRangeEnter(npc, player, isSummon); } - public void onSiegeStart(OnCastleSiegeStart event) - { + public void onSiegeStart(OnCastleSiegeStart event) { _aggroMode = true; _prisonIsOpen = false; - if ((_venom != null) && !_venom.isDead()) - { + if ((_venom != null) && !_venom.isDead()) { _venom.setCurrentHp(_venom.getMaxHp()); _venom.setCurrentMp(_venom.getMaxMp()); _venom.enableSkill(VENOM_TELEPORT.getSkill()); @@ -206,11 +185,9 @@ public final class Venom extends AbstractNpcAI } } - public void onSiegeFinish(OnCastleSiegeFinish event) - { + public void onSiegeFinish(OnCastleSiegeFinish event) { _aggroMode = false; - if ((_venom != null) && !_venom.isDead()) - { + if ((_venom != null) && !_venom.isDead()) { changeLocation(MoveTo.PRISON); _venom.disableSkill(VENOM_TELEPORT.getSkill(), -1); _venom.disableSkill(RANGE_TELEPORT.getSkill(), -1); @@ -221,10 +198,8 @@ public final class Venom extends AbstractNpcAI } @Override - public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) - { - switch (skill.getId()) - { + public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) { + switch (skill.getId()) { case 4222: npc.teleToLocation(_loc); break; @@ -235,16 +210,13 @@ public final class Venom extends AbstractNpcAI case 4996: teleportTarget(player); ((L2Attackable) npc).stopHating(player); - if ((_targets != null) && (_targets.size() > 0)) - { - for (L2PcInstance target : _targets) - { + if ((_targets != null) && (_targets.size() > 0)) { + for (L2PcInstance target : _targets) { final long x = player.getX() - target.getX(); final long y = player.getY() - target.getY(); final long z = player.getZ() - target.getZ(); final long range = 250; - if (((x * x) + (y * y) + (z * z)) <= (range * range)) - { + if (((x * x) + (y * y) + (z * z)) <= (range * range)) { teleportTarget(target); ((L2Attackable) npc).stopHating(target); } @@ -257,17 +229,13 @@ public final class Venom extends AbstractNpcAI } @Override - public final String onSpawn(L2Npc npc) - { - switch (npc.getId()) - { - case DUNGEON_KEEPER: - { + public final String onSpawn(L2Npc npc) { + switch (npc.getId()) { + case DUNGEON_KEEPER: { _massymore = npc; break; } - case VENOM: - { + case VENOM: { _venom = npc; _loc = _venom.getLocation(); @@ -276,19 +244,15 @@ public final class Venom extends AbstractNpcAI _venom.doRevive(); broadcastNpcSay(npc, Say2.NPC_SHOUT, NpcStringId.WHO_DARES_TO_COVET_THE_THRONE_OF_OUR_CASTLE_LEAVE_IMMEDIATELY_OR_YOU_WILL_PAY_THE_PRICE_OF_YOUR_AUDACITY_WITH_YOUR_VERY_OWN_BLOOD); ((L2Attackable) _venom).setCanReturnToSpawnPoint(false); - if (checkStatus() == DEAD) - { + if (checkStatus() == DEAD) { _venom.deleteMe(); } break; } } - if (checkStatus() == DEAD) - { + if (checkStatus() == DEAD) { npc.deleteMe(); - } - else - { + } else { npc.doRevive(); } @@ -296,26 +260,18 @@ public final class Venom extends AbstractNpcAI } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { final double distance = npc.calculateDistance(attacker, false, false); - if (_aggroMode && (getRandom(100) < 25)) - { + if (_aggroMode && (getRandom(100) < 25)) { npc.setTarget(attacker); npc.doCast(VENOM_TELEPORT); - } - else if (_aggroMode && (npc.getCurrentHp() < (npc.getMaxHp() / 3)) && (getRandom(100) < 25) && !npc.isCastingNow()) - { + } else if (_aggroMode && (npc.getCurrentHp() < (npc.getMaxHp() / 3)) && (getRandom(100) < 25) && !npc.isCastingNow()) { npc.setTarget(attacker); npc.doCast(RANGE_TELEPORT); - } - else if ((distance > 300) && (getRandom(100) < 10) && !npc.isCastingNow()) - { + } else if ((distance > 300) && (getRandom(100) < 10) && !npc.isCastingNow()) { npc.setTarget(attacker); npc.doCast(VENOM_STRIKE); - } - else if ((getRandom(100) < 10) && !npc.isCastingNow()) - { + } else if ((getRandom(100) < 10) && !npc.isCastingNow()) { npc.setTarget(attacker); npc.doCast(SONIC_STORM); } @@ -323,12 +279,10 @@ public final class Venom extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { updateStatus(DEAD); broadcastNpcSay(npc, Say2.NPC_SHOUT, NpcStringId.ITS_NOT_OVER_YET_IT_WONT_BE_OVER_LIKE_THIS_NEVER); - if (!CastleManager.getInstance().getCastleById(CASTLE).getSiege().isInProgress()) - { + if (!CastleManager.getInstance().getCastleById(CASTLE).getSiege().isInProgress()) { L2Npc cube = addSpawn(TELEPORT_CUBE, CUBE, false, 0); startQuestTimer("cube_despawn", 120000, cube, null); } @@ -340,20 +294,15 @@ public final class Venom extends AbstractNpcAI * Alters the Venom location * @param loc enum */ - private void changeLocation(MoveTo loc) - { - switch (loc) - { + private void changeLocation(MoveTo loc) { + switch (loc) { case THRONE: _venom.teleToLocation(TRHONE, false); break; case PRISON: - if ((_venom == null) || _venom.isDead() || _venom.isDecayed()) - { + if ((_venom == null) || _venom.isDead() || _venom.isDecayed()) { _venom = addSpawn(VENOM, DUNGEON, false, 0); - } - else - { + } else { _venom.teleToLocation(DUNGEON, false); } cancelQuestTimer("raid_check", _venom, null); @@ -363,10 +312,8 @@ public final class Venom extends AbstractNpcAI _loc.setLocation(_venom.getLocation()); } - private void teleportTarget(L2PcInstance player) - { - if ((player != null) && !player.isDead()) - { + private void teleportTarget(L2PcInstance player) { + if ((player != null) && !player.isDead()) { final int rnd = getRandom(11); player.teleToLocation(TARGET_TELEPORTS[rnd], TARGET_TELEPORTS_OFFSET[rnd]); player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); @@ -377,15 +324,11 @@ public final class Venom extends AbstractNpcAI * Checks if Venom is Alive or Dead * @return status */ - private int checkStatus() - { + private int checkStatus() { int checkStatus = ALIVE; - if (GlobalVariablesManager.getInstance().hasVariable("VenomStatus")) - { + if (GlobalVariablesManager.getInstance().hasVariable("VenomStatus")) { checkStatus = GlobalVariablesManager.getInstance().getInt("VenomStatus"); - } - else - { + } else { GlobalVariablesManager.getInstance().set("VenomStatus", 0); } return checkStatus; @@ -395,19 +338,16 @@ public final class Venom extends AbstractNpcAI * Update the Venom status * @param status the new status. 0 = ALIVE, 1 = DEAD. */ - private void updateStatus(int status) - { + private void updateStatus(int status) { GlobalVariablesManager.getInstance().set("VenomStatus", Integer.toString(status)); } - private enum MoveTo - { + private enum MoveTo { THRONE, PRISON } - public static void main(String[] args) - { + public static void main(String[] args) { new Venom(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Abercrombie/Abercrombie.java b/src/main/java/com/l2jserver/datapack/ai/npc/Abercrombie/Abercrombie.java index c5e8049a0b..d9d77de1c5 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Abercrombie/Abercrombie.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Abercrombie/Abercrombie.java @@ -26,41 +26,32 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Mercenary Supplier Abercrombie AI. * @author Zoey76 */ -public final class Abercrombie extends AbstractNpcAI -{ +public final class Abercrombie extends AbstractNpcAI { // NPC private static final int ABERCROMBIE = 31555; // Items private static final int GOLDEN_RAM_BADGE_RECRUIT = 7246; private static final int GOLDEN_RAM_BADGE_SOLDIER = 7247; - public Abercrombie() - { + public Abercrombie() { super(Abercrombie.class.getSimpleName(), "ai/npc"); addFirstTalkId(ABERCROMBIE); } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { final String htmltext; - if (hasQuestItems(player, GOLDEN_RAM_BADGE_SOLDIER)) - { + if (hasQuestItems(player, GOLDEN_RAM_BADGE_SOLDIER)) { htmltext = "31555-07.html"; - } - else if (hasQuestItems(player, GOLDEN_RAM_BADGE_RECRUIT)) - { + } else if (hasQuestItems(player, GOLDEN_RAM_BADGE_RECRUIT)) { htmltext = "31555-01.html"; - } - else - { + } else { htmltext = "31555-09.html"; } return htmltext; } - public static void main(String[] args) - { + public static void main(String[] args) { new Abercrombie(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/AbstractNpcAI.java b/src/main/java/com/l2jserver/datapack/ai/npc/AbstractNpcAI.java index ac8e5751ac..e16c5ae767 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/AbstractNpcAI.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/AbstractNpcAI.java @@ -33,10 +33,8 @@ import com.l2jserver.gameserver.util.Broadcast; * Abstract NPC AI class for datapack based AIs. * @author UnAfraid, Zoey76 */ -public abstract class AbstractNpcAI extends Quest -{ - public AbstractNpcAI(String name, String descr) - { +public abstract class AbstractNpcAI extends Quest { + public AbstractNpcAI(String name, String descr) { super(-1, name, descr); } @@ -44,8 +42,7 @@ public abstract class AbstractNpcAI extends Quest * Simple on first talk event handler. */ @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return npc.getId() + ".html"; } @@ -62,8 +59,7 @@ public abstract class AbstractNpcAI extends Quest * </ul> * @param mobs */ - public void registerMobs(int... mobs) - { + public void registerMobs(int... mobs) { addAttackId(mobs); addKillId(mobs); addSpawnId(mobs); @@ -79,8 +75,7 @@ public abstract class AbstractNpcAI extends Quest * @param type * @param text */ - protected void broadcastNpcSay(L2Npc npc, int type, String text) - { + protected void broadcastNpcSay(L2Npc npc, int type, String text) { Broadcast.toKnownPlayers(npc, new NpcSay(npc.getObjectId(), type, npc.getTemplate().getDisplayId(), text)); } @@ -90,8 +85,7 @@ public abstract class AbstractNpcAI extends Quest * @param type * @param stringId */ - protected void broadcastNpcSay(L2Npc npc, int type, NpcStringId stringId) - { + protected void broadcastNpcSay(L2Npc npc, int type, NpcStringId stringId) { Broadcast.toKnownPlayers(npc, new NpcSay(npc.getObjectId(), type, npc.getTemplate().getDisplayId(), stringId)); } @@ -102,13 +96,10 @@ public abstract class AbstractNpcAI extends Quest * @param stringId * @param parameters */ - protected void broadcastNpcSay(L2Npc npc, int type, NpcStringId stringId, String... parameters) - { + protected void broadcastNpcSay(L2Npc npc, int type, NpcStringId stringId, String... parameters) { final NpcSay say = new NpcSay(npc.getObjectId(), type, npc.getTemplate().getDisplayId(), stringId); - if (parameters != null) - { - for (String parameter : parameters) - { + if (parameters != null) { + for (String parameter : parameters) { say.addStringParameter(parameter); } } @@ -122,8 +113,7 @@ public abstract class AbstractNpcAI extends Quest * @param text * @param radius */ - protected void broadcastNpcSay(L2Npc npc, int type, String text, int radius) - { + protected void broadcastNpcSay(L2Npc npc, int type, String text, int radius) { Broadcast.toKnownPlayersInRadius(npc, new NpcSay(npc.getObjectId(), type, npc.getTemplate().getDisplayId(), text), radius); } @@ -134,8 +124,7 @@ public abstract class AbstractNpcAI extends Quest * @param stringId * @param radius */ - protected void broadcastNpcSay(L2Npc npc, int type, NpcStringId stringId, int radius) - { + protected void broadcastNpcSay(L2Npc npc, int type, NpcStringId stringId, int radius) { Broadcast.toKnownPlayersInRadius(npc, new NpcSay(npc.getObjectId(), type, npc.getTemplate().getDisplayId(), stringId), radius); } @@ -144,8 +133,7 @@ public abstract class AbstractNpcAI extends Quest * @param character * @param actionId */ - protected void broadcastSocialAction(L2Character character, int actionId) - { + protected void broadcastSocialAction(L2Character character, int actionId) { Broadcast.toSelfAndKnownPlayers(character, new SocialAction(character.getObjectId(), actionId)); } @@ -155,15 +143,12 @@ public abstract class AbstractNpcAI extends Quest * @param actionId * @param radius */ - protected void broadcastSocialAction(L2Character character, int actionId, int radius) - { + protected void broadcastSocialAction(L2Character character, int actionId, int radius) { Broadcast.toSelfAndKnownPlayersInRadius(character, new SocialAction(character.getObjectId(), actionId), radius); } - public void spawnMinions(final L2Npc npc, final String spawnName) - { - for (MinionHolder is : npc.getTemplate().getParameters().getMinionList(spawnName)) - { + public void spawnMinions(final L2Npc npc, final String spawnName) { + for (MinionHolder is : npc.getTemplate().getParameters().getMinionList(spawnName)) { addMinion((L2MonsterInstance) npc, is.getId()); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Alarm/Alarm.java b/src/main/java/com/l2jserver/datapack/ai/npc/Alarm/Alarm.java index 4ef9b64350..8a08363777 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Alarm/Alarm.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Alarm/Alarm.java @@ -32,16 +32,14 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Alarm AI for quests Art of Persuasion (184) and Nikola's Cooperation (185). * @author Zoey76 */ -public final class Alarm extends AbstractNpcAI -{ +public final class Alarm extends AbstractNpcAI { // NPC private static final int ALARM = 32367; // Misc private static final int ART_OF_PERSUASION_ID = 184; private static final int NIKOLAS_COOPERATION_ID = 185; - private Alarm() - { + private Alarm() { super(Alarm.class.getSimpleName(), "ai/npc"); addStartNpc(ALARM); addTalkId(ALARM); @@ -50,47 +48,35 @@ public final class Alarm extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; final L2PcInstance player0 = npc.getVariables().getObject("player0", L2PcInstance.class); final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class); - switch (event) - { - case "SELF_DESTRUCT_IN_60": - { + switch (event) { + case "SELF_DESTRUCT_IN_60": { startQuestTimer("SELF_DESTRUCT_IN_30", 30000, npc, null); broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.THE_ALARM_WILL_SELF_DESTRUCT_IN_60_SECONDS_ENTER_PASSCODE_TO_OVERRIDE); break; } - case "SELF_DESTRUCT_IN_30": - { + case "SELF_DESTRUCT_IN_30": { startQuestTimer("SELF_DESTRUCT_IN_10", 20000, npc, null); broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.THE_ALARM_WILL_SELF_DESTRUCT_IN_30_SECONDS_ENTER_PASSCODE_TO_OVERRIDE); break; } - case "SELF_DESTRUCT_IN_10": - { + case "SELF_DESTRUCT_IN_10": { startQuestTimer("RECORDER_CRUSHED", 10000, npc, null); broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.THE_ALARM_WILL_SELF_DESTRUCT_IN_10_SECONDS_ENTER_PASSCODE_TO_OVERRIDE); break; } - case "RECORDER_CRUSHED": - { - if (npc0 != null) - { - if (npc0.getVariables().getBoolean("SPAWNED")) - { + case "RECORDER_CRUSHED": { + if (npc0 != null) { + if (npc0.getVariables().getBoolean("SPAWNED")) { npc0.getVariables().set("SPAWNED", false); - if (player0 != null) - { + if (player0 != null) { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.RECORDER_CRUSHED); - if (verifyMemoState(player0, ART_OF_PERSUASION_ID, -1)) - { + if (verifyMemoState(player0, ART_OF_PERSUASION_ID, -1)) { setMemoState(player0, ART_OF_PERSUASION_ID, 5); - } - else if (verifyMemoState(player0, NIKOLAS_COOPERATION_ID, -1)) - { + } else if (verifyMemoState(player0, NIKOLAS_COOPERATION_ID, -1)) { setMemoState(player0, NIKOLAS_COOPERATION_ID, 5); } } @@ -101,105 +87,75 @@ public final class Alarm extends AbstractNpcAI } case "32367-184_04.html": case "32367-184_06.html": - case "32367-184_08.html": - { + case "32367-184_08.html": { htmltext = event; break; } - case "2": - { - if (player0 == player) - { - if (verifyMemoState(player, ART_OF_PERSUASION_ID, 3)) - { + case "2": { + if (player0 == player) { + if (verifyMemoState(player, ART_OF_PERSUASION_ID, 3)) { htmltext = "32367-184_02.html"; - } - else if (verifyMemoState(player, NIKOLAS_COOPERATION_ID, 3)) - { + } else if (verifyMemoState(player, NIKOLAS_COOPERATION_ID, 3)) { htmltext = "32367-185_02.html"; } } break; } - case "3": - { - if (verifyMemoState(player, ART_OF_PERSUASION_ID, 3)) - { + case "3": { + if (verifyMemoState(player, ART_OF_PERSUASION_ID, 3)) { setMemoStateEx(player, ART_OF_PERSUASION_ID, 1, 1); htmltext = "32367-184_04.html"; - } - else if (verifyMemoState(player, NIKOLAS_COOPERATION_ID, 3)) - { + } else if (verifyMemoState(player, NIKOLAS_COOPERATION_ID, 3)) { setMemoStateEx(player, NIKOLAS_COOPERATION_ID, 1, 1); htmltext = "32367-185_04.html"; } break; } - case "4": - { - if (verifyMemoState(player, ART_OF_PERSUASION_ID, 3)) - { + case "4": { + if (verifyMemoState(player, ART_OF_PERSUASION_ID, 3)) { setMemoStateEx(player, ART_OF_PERSUASION_ID, 1, getMemoStateEx(player, ART_OF_PERSUASION_ID, 1) + 1); htmltext = "32367-184_06.html"; - } - else if (verifyMemoState(player, NIKOLAS_COOPERATION_ID, 3)) - { + } else if (verifyMemoState(player, NIKOLAS_COOPERATION_ID, 3)) { setMemoStateEx(player, NIKOLAS_COOPERATION_ID, 1, getMemoStateEx(player, NIKOLAS_COOPERATION_ID, 1) + 1); htmltext = "32367-185_06.html"; } break; } - case "5": - { - if (verifyMemoState(player, ART_OF_PERSUASION_ID, 3)) - { + case "5": { + if (verifyMemoState(player, ART_OF_PERSUASION_ID, 3)) { setMemoStateEx(player, ART_OF_PERSUASION_ID, 1, getMemoStateEx(player, ART_OF_PERSUASION_ID, 1) + 1); htmltext = "32367-184_08.html"; - } - else if (verifyMemoState(player, NIKOLAS_COOPERATION_ID, 3)) - { + } else if (verifyMemoState(player, NIKOLAS_COOPERATION_ID, 3)) { setMemoStateEx(player, NIKOLAS_COOPERATION_ID, 1, getMemoStateEx(player, NIKOLAS_COOPERATION_ID, 1) + 1); htmltext = "32367-185_08.html"; } break; } - case "6": - { - if (verifyMemoState(player, ART_OF_PERSUASION_ID, 3)) - { + case "6": { + if (verifyMemoState(player, ART_OF_PERSUASION_ID, 3)) { int i0 = getMemoStateEx(player, ART_OF_PERSUASION_ID, 1); - if (i0 >= 3) - { - if ((npc0 != null) && npc0.getVariables().getBoolean("SPAWNED")) - { + if (i0 >= 3) { + if ((npc0 != null) && npc0.getVariables().getBoolean("SPAWNED")) { npc0.getVariables().set("SPAWNED", false); } npc.deleteMe(); setMemoState(player, ART_OF_PERSUASION_ID, 4); htmltext = "32367-184_09.html"; - } - else - { + } else { setMemoStateEx(player, ART_OF_PERSUASION_ID, 1, 0); htmltext = "32367-184_10.html"; } - } - else if (verifyMemoState(player, NIKOLAS_COOPERATION_ID, 3)) - { + } else if (verifyMemoState(player, NIKOLAS_COOPERATION_ID, 3)) { int i0 = getMemoStateEx(player, NIKOLAS_COOPERATION_ID, 1); - if (i0 >= 3) - { - if ((npc0 != null) && npc0.getVariables().getBoolean("SPAWNED")) - { + if (i0 >= 3) { + if ((npc0 != null) && npc0.getVariables().getBoolean("SPAWNED")) { npc0.getVariables().set("SPAWNED", false); } npc.deleteMe(); setMemoState(player, NIKOLAS_COOPERATION_ID, 4); htmltext = "32367-185_09.html"; - } - else - { + } else { setMemoStateEx(player, NIKOLAS_COOPERATION_ID, 1, 0); htmltext = "32367-185_10.html"; } @@ -211,18 +167,13 @@ public final class Alarm extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance talker) - { + public String onFirstTalk(L2Npc npc, L2PcInstance talker) { String htmltext = getNoQuestMsg(talker); - if (verifyMemoState(talker, ART_OF_PERSUASION_ID, 3) || verifyMemoState(talker, NIKOLAS_COOPERATION_ID, 3)) - { + if (verifyMemoState(talker, ART_OF_PERSUASION_ID, 3) || verifyMemoState(talker, NIKOLAS_COOPERATION_ID, 3)) { final L2PcInstance player = npc.getVariables().getObject("player0", L2PcInstance.class); - if (player == talker) - { + if (player == talker) { htmltext = "32367-01.html"; - } - else - { + } else { htmltext = "32367-02.html"; } } @@ -230,13 +181,11 @@ public final class Alarm extends AbstractNpcAI } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { startQuestTimer("SELF_DESTRUCT_IN_60", 60000, npc, null); broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.INTRUDER_ALERT_THE_ALARM_WILL_SELF_DESTRUCT_IN_2_MINUTES); final L2PcInstance player = npc.getVariables().getObject("player0", L2PcInstance.class); - if (player != null) - { + if (player != null) { playSound(player, Sound.ITEMSOUND_SIREN); } return super.onSpawn(npc); @@ -249,18 +198,14 @@ public final class Alarm extends AbstractNpcAI * @param memoState the memo state, if memo state is less than zero, only quest state is checked * @return {@code true} if the player has the memo state, {@code false} otherwise */ - private static final boolean verifyMemoState(L2PcInstance player, int questId, int memoState) - { + private static final boolean verifyMemoState(L2PcInstance player, int questId, int memoState) { QuestState qs = null; - switch (questId) - { - case ART_OF_PERSUASION_ID: - { + switch (questId) { + case ART_OF_PERSUASION_ID: { qs = player.getQuestState(Q00184_ArtOfPersuasion.class.getSimpleName()); break; } - case NIKOLAS_COOPERATION_ID: - { + case NIKOLAS_COOPERATION_ID: { qs = player.getQuestState(Q00185_NikolasCooperation.class.getSimpleName()); break; } @@ -274,24 +219,19 @@ public final class Alarm extends AbstractNpcAI * @param questId the quest ID * @param memoState the memo state */ - private static final void setMemoState(L2PcInstance player, int questId, int memoState) - { + private static final void setMemoState(L2PcInstance player, int questId, int memoState) { QuestState qs = null; - switch (questId) - { - case ART_OF_PERSUASION_ID: - { + switch (questId) { + case ART_OF_PERSUASION_ID: { qs = player.getQuestState(Q00184_ArtOfPersuasion.class.getSimpleName()); break; } - case NIKOLAS_COOPERATION_ID: - { + case NIKOLAS_COOPERATION_ID: { qs = player.getQuestState(Q00185_NikolasCooperation.class.getSimpleName()); break; } } - if (qs != null) - { + if (qs != null) { qs.setMemoState(memoState); } } @@ -303,18 +243,14 @@ public final class Alarm extends AbstractNpcAI * @param slot the slot * @return the memo state ex */ - private static final int getMemoStateEx(L2PcInstance player, int questId, int slot) - { + private static final int getMemoStateEx(L2PcInstance player, int questId, int slot) { QuestState qs = null; - switch (questId) - { - case ART_OF_PERSUASION_ID: - { + switch (questId) { + case ART_OF_PERSUASION_ID: { qs = player.getQuestState(Q00184_ArtOfPersuasion.class.getSimpleName()); break; } - case NIKOLAS_COOPERATION_ID: - { + case NIKOLAS_COOPERATION_ID: { qs = player.getQuestState(Q00185_NikolasCooperation.class.getSimpleName()); break; } @@ -329,30 +265,24 @@ public final class Alarm extends AbstractNpcAI * @param slot the slot * @param memoStateEx the memo state ex */ - private static final void setMemoStateEx(L2PcInstance player, int questId, int slot, int memoStateEx) - { + private static final void setMemoStateEx(L2PcInstance player, int questId, int slot, int memoStateEx) { QuestState qs = null; - switch (questId) - { - case ART_OF_PERSUASION_ID: - { + switch (questId) { + case ART_OF_PERSUASION_ID: { qs = player.getQuestState(Q00184_ArtOfPersuasion.class.getSimpleName()); break; } - case NIKOLAS_COOPERATION_ID: - { + case NIKOLAS_COOPERATION_ID: { qs = player.getQuestState(Q00185_NikolasCooperation.class.getSimpleName()); break; } } - if (qs != null) - { + if (qs != null) { qs.setMemoStateEx(slot, memoStateEx); } } - public static void main(String[] args) - { + public static void main(String[] args) { new Alarm(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Alexandria/Alexandria.java b/src/main/java/com/l2jserver/datapack/ai/npc/Alexandria/Alexandria.java index 8914dcbfaa..c678bc7677 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Alexandria/Alexandria.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Alexandria/Alexandria.java @@ -33,13 +33,11 @@ import com.l2jserver.gameserver.model.holders.QuestItemHolder; * Alexandria (Armor Merchant) AI. * @author xban1x */ -public final class Alexandria extends AbstractNpcAI -{ +public final class Alexandria extends AbstractNpcAI { // NPC private static final int ALEXANDRIA = 30098; // Items - private static final ItemHolder[] REQUIRED_ITEMS = new ItemHolder[] - { + private static final ItemHolder[] REQUIRED_ITEMS = new ItemHolder[] { new ItemHolder(57, 7500000), new ItemHolder(5094, 50), new ItemHolder(6471, 25), @@ -49,8 +47,7 @@ public final class Alexandria extends AbstractNpcAI new ItemHolder(9817, 5), }; // Agathions - private static final QuestItemHolder[] LITTLE_DEVILS = new QuestItemHolder[] - { + private static final QuestItemHolder[] LITTLE_DEVILS = new QuestItemHolder[] { new AdditionalQuestItemHolder(10321, 600, 1, 10408), new QuestItemHolder(10322, 10), new QuestItemHolder(10323, 10), @@ -58,8 +55,7 @@ public final class Alexandria extends AbstractNpcAI new QuestItemHolder(10325, 5), new QuestItemHolder(10326, 370), }; - private static final QuestItemHolder[] LITTLE_ANGELS = new QuestItemHolder[] - { + private static final QuestItemHolder[] LITTLE_ANGELS = new QuestItemHolder[] { new AdditionalQuestItemHolder(10315, 600, 1, 10408), new QuestItemHolder(10316, 10), new QuestItemHolder(10317, 10), @@ -68,14 +64,12 @@ public final class Alexandria extends AbstractNpcAI new QuestItemHolder(10320, 370), }; private static final Map<String, List<QuestItemHolder>> AGATHIONS = new HashMap<>(); - static - { + static { AGATHIONS.put("littleAngel", Arrays.asList(LITTLE_ANGELS)); AGATHIONS.put("littleDevil", Arrays.asList(LITTLE_DEVILS)); } - private Alexandria() - { + private Alexandria() { super(Alexandria.class.getSimpleName(), "ai/npc"); addStartNpc(ALEXANDRIA); addTalkId(ALEXANDRIA); @@ -83,36 +77,26 @@ public final class Alexandria extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - if (event.equals("30098-02.html")) - { + if (event.equals("30098-02.html")) { htmltext = event; - } - else if (AGATHIONS.containsKey(event)) - { + } else if (AGATHIONS.containsKey(event)) { final int chance = getRandom(1000); int chance2 = 0; int chance3 = 0; - for (QuestItemHolder agathion : AGATHIONS.get(event)) - { + for (QuestItemHolder agathion : AGATHIONS.get(event)) { chance3 += agathion.getChance(); - if ((chance2 <= chance) && (chance < chance3)) - { - if (takeAllItems(player, REQUIRED_ITEMS)) - { + if ((chance2 <= chance) && (chance < chance3)) { + if (takeAllItems(player, REQUIRED_ITEMS)) { giveItems(player, agathion); htmltext = "30098-03.html"; - if (agathion instanceof AdditionalQuestItemHolder) - { + if (agathion instanceof AdditionalQuestItemHolder) { giveItems(player, ((AdditionalQuestItemHolder) agathion).getAdditionalId(), 1); htmltext = "30098-03a.html"; } - } - else - { + } else { htmltext = "30098-04.html"; } break; @@ -123,24 +107,20 @@ public final class Alexandria extends AbstractNpcAI return htmltext; } - public static class AdditionalQuestItemHolder extends QuestItemHolder - { + public static class AdditionalQuestItemHolder extends QuestItemHolder { private final int _additionalId; - public AdditionalQuestItemHolder(int id, int chance, long count, int additionalId) - { + public AdditionalQuestItemHolder(int id, int chance, long count, int additionalId) { super(id, chance, count); _additionalId = additionalId; } - public int getAdditionalId() - { + public int getAdditionalId() { return _additionalId; } } - public static void main(String[] args) - { + public static void main(String[] args) { new Alexandria(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/ArenaManager/ArenaManager.java b/src/main/java/com/l2jserver/datapack/ai/npc/ArenaManager/ArenaManager.java index 999df9ece6..8c29c18a5e 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/ArenaManager/ArenaManager.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/ArenaManager/ArenaManager.java @@ -30,17 +30,14 @@ import com.l2jserver.gameserver.network.SystemMessageId; * Arena Manager AI. * @author St3eT */ -public class ArenaManager extends AbstractNpcAI -{ +public class ArenaManager extends AbstractNpcAI { // NPCs - private static final int[] ARENA_MANAGER = - { + private static final int[] ARENA_MANAGER = { 31226, // Arena Director (MDT) 31225, // Arena Manager (Coliseum) }; // Skill - private static final SkillHolder[] BUFFS = - { + private static final SkillHolder[] BUFFS = { new SkillHolder(6805), // Arena Empower new SkillHolder(6806), // Arena Acumen new SkillHolder(6807), // Arena Concentration @@ -55,8 +52,7 @@ public class ArenaManager extends AbstractNpcAI private static final int HP_COST = 1000; private static final int BUFF_COST = 2000; - private ArenaManager() - { + private ArenaManager() { super(ArenaManager.class.getSimpleName(), "ai/npc"); addStartNpc(ARENA_MANAGER); addTalkId(ARENA_MANAGER); @@ -64,67 +60,48 @@ public class ArenaManager extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { - case "CPrecovery": - { - if (player.getAdena() >= CP_COST) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { + case "CPrecovery": { + if (player.getAdena() >= CP_COST) { takeItems(player, Inventory.ADENA_ID, CP_COST); startQuestTimer("CPrecovery_delay", 2000, npc, player); - } - else - { + } else { player.sendPacket(SystemMessageId.YOU_NOT_ENOUGH_ADENA); } break; } - case "CPrecovery_delay": - { - if ((player != null) && !player.isInsideZone(ZoneId.PVP)) - { + case "CPrecovery_delay": { + if ((player != null) && !player.isInsideZone(ZoneId.PVP)) { npc.setTarget(player); npc.doCast(CP_RECOVERY); } break; } - case "HPrecovery": - { - if (player.getAdena() >= HP_COST) - { + case "HPrecovery": { + if (player.getAdena() >= HP_COST) { takeItems(player, Inventory.ADENA_ID, HP_COST); startQuestTimer("HPrecovery_delay", 2000, npc, player); - } - else - { + } else { player.sendPacket(SystemMessageId.YOU_NOT_ENOUGH_ADENA); } break; } - case "HPrecovery_delay": - { - if ((player != null) && !player.isInsideZone(ZoneId.PVP)) - { + case "HPrecovery_delay": { + if ((player != null) && !player.isInsideZone(ZoneId.PVP)) { npc.setTarget(player); npc.doCast(HP_RECOVERY); } break; } - case "Buff": - { - if (player.getAdena() >= BUFF_COST) - { + case "Buff": { + if (player.getAdena() >= BUFF_COST) { takeItems(player, Inventory.ADENA_ID, BUFF_COST); npc.setTarget(player); - for (SkillHolder skill : BUFFS) - { + for (SkillHolder skill : BUFFS) { npc.doCast(skill); } - } - else - { + } else { player.sendPacket(SystemMessageId.YOU_NOT_ENOUGH_ADENA); } break; @@ -133,8 +110,7 @@ public class ArenaManager extends AbstractNpcAI return null; } - public static void main(String[] args) - { + public static void main(String[] args) { new ArenaManager(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Asamah/Asamah.java b/src/main/java/com/l2jserver/datapack/ai/npc/Asamah/Asamah.java index c4ac2d135b..dd50e76c8f 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Asamah/Asamah.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Asamah/Asamah.java @@ -29,23 +29,19 @@ import com.l2jserver.gameserver.model.quest.QuestState; * @author Adry_85 * @since 2.6.0.0 */ -public final class Asamah extends AbstractNpcAI -{ +public final class Asamah extends AbstractNpcAI { // NPC private static final int ASAMAH = 32115; - public Asamah() - { + public Asamah() { super(Asamah.class.getSimpleName(), "ai/npc"); addFirstTalkId(ASAMAH); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - if (event.equals("32115-03.htm") || event.equals("32115-04.htm")) - { + if (event.equals("32115-03.htm") || event.equals("32115-04.htm")) { htmltext = event; } @@ -53,14 +49,12 @@ public final class Asamah extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { final QuestState st = player.getQuestState(Q00111_ElrokianHuntersProof.class.getSimpleName()); return ((st != null) && (st.isCompleted())) ? "32115-01.htm" : "32115-02.htm"; } - public static void main(String[] args) - { + public static void main(String[] args) { new Asamah(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/AvantGarde/AvantGarde.java b/src/main/java/com/l2jserver/datapack/ai/npc/AvantGarde/AvantGarde.java index 3e0949d460..776d044d23 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/AvantGarde/AvantGarde.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/AvantGarde/AvantGarde.java @@ -47,8 +47,7 @@ import com.l2jserver.gameserver.util.Util; * Transformation skill learning and transformation scroll sell. * @author Zoey76 */ -public class AvantGarde extends AbstractNpcAI -{ +public class AvantGarde extends AbstractNpcAI { // NPC private static final int AVANT_GARDE = 32323; // Items @@ -59,16 +58,14 @@ public class AvantGarde extends AbstractNpcAI }; // @formatter:on // Misc - private static final String[] QUEST_VAR_NAMES = - { + private static final String[] QUEST_VAR_NAMES = { "EmergentAbility65-", "EmergentAbility70-", "ClassAbility75-", "ClassAbility80-" }; - public AvantGarde() - { + public AvantGarde() { super(AvantGarde.class.getSimpleName(), "ai/npc"); addStartNpc(AVANT_GARDE); addTalkId(AVANT_GARDE); @@ -77,17 +74,13 @@ public class AvantGarde extends AbstractNpcAI } @Override - public String onAcquireSkill(L2Npc npc, L2PcInstance player, Skill skill, AcquireSkillType type) - { - switch (type) - { - case TRANSFORM: - { + public String onAcquireSkill(L2Npc npc, L2PcInstance player, Skill skill, AcquireSkillType type) { + switch (type) { + case TRANSFORM: { showTransformSkillList(player); break; } - case SUBCLASS: - { + case SUBCLASS: { showSubClassSkillList(player); break; } @@ -96,11 +89,9 @@ public class AvantGarde extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { + switch (event) { case "32323-02.html": case "32323-02a.html": case "32323-02b.html": @@ -109,158 +100,106 @@ public class AvantGarde extends AbstractNpcAI case "32323-05a.html": case "32323-05no.html": case "32323-06.html": - case "32323-06no.html": - { + case "32323-06no.html": { htmltext = event; break; } - case "LearnTransformationSkill": - { - if (RequestAcquireSkill.canTransform(player)) - { + case "LearnTransformationSkill": { + if (RequestAcquireSkill.canTransform(player)) { showTransformSkillList(player); - } - else - { + } else { htmltext = "32323-03.html"; } break; } - case "BuyTransformationItems": - { - if (RequestAcquireSkill.canTransform(player)) - { + case "BuyTransformationItems": { + if (RequestAcquireSkill.canTransform(player)) { MultisellData.getInstance().separateAndSend(32323001, player, npc, false); - } - else - { + } else { htmltext = "32323-04.html"; } break; } - case "LearnSubClassSkill": - { - if (!RequestAcquireSkill.canTransform(player)) - { + case "LearnSubClassSkill": { + if (!RequestAcquireSkill.canTransform(player)) { htmltext = "32323-04.html"; } - if (player.isSubClassActive()) - { + if (player.isSubClassActive()) { htmltext = "32323-08.html"; - } - else - { + } else { boolean hasItems = false; - for (int id : ITEMS) - { - if (player.getInventory().getItemByItemId(id) != null) - { + for (int id : ITEMS) { + if (player.getInventory().getItemByItemId(id) != null) { hasItems = true; break; } } - if (hasItems) - { + if (hasItems) { showSubClassSkillList(player); - } - else - { + } else { htmltext = "32323-08.html"; } } break; } - case "CancelCertification": - { - if (player.getSubClasses().size() == 0) - { + case "CancelCertification": { + if (player.getSubClasses().size() == 0) { htmltext = "32323-07.html"; - } - else if (player.isSubClassActive()) - { + } else if (player.isSubClassActive()) { htmltext = "32323-08.html"; - } - else if (player.getAdena() < character().getFeeDeleteSubClassSkills()) - { + } else if (player.getAdena() < character().getFeeDeleteSubClassSkills()) { htmltext = "32323-08no.html"; - } - else - { + } else { QuestState st = player.getQuestState(SubClassSkills.class.getSimpleName()); - if (st == null) - { + if (st == null) { st = QuestManager.getInstance().getQuest(SubClassSkills.class.getSimpleName()).newQuestState(player); } int activeCertifications = 0; - for (String varName : QUEST_VAR_NAMES) - { - for (int i = 1; i <= character().getMaxSubclass(); i++) - { + for (String varName : QUEST_VAR_NAMES) { + for (int i = 1; i <= character().getMaxSubclass(); i++) { String qvar = st.getGlobalQuestVar(varName + i); - if (!qvar.isEmpty() && (qvar.endsWith(";") || !qvar.equals("0"))) - { + if (!qvar.isEmpty() && (qvar.endsWith(";") || !qvar.equals("0"))) { activeCertifications++; } } } - if (activeCertifications == 0) - { + if (activeCertifications == 0) { htmltext = "32323-10no.html"; - } - else - { - for (String varName : QUEST_VAR_NAMES) - { - for (int i = 1; i <= character().getMaxSubclass(); i++) - { + } else { + for (String varName : QUEST_VAR_NAMES) { + for (int i = 1; i <= character().getMaxSubclass(); i++) { final String qvarName = varName + i; final String qvar = st.getGlobalQuestVar(qvarName); - if (qvar.endsWith(";")) - { + if (qvar.endsWith(";")) { final String skillIdVar = qvar.replace(";", ""); - if (Util.isDigit(skillIdVar)) - { + if (Util.isDigit(skillIdVar)) { int skillId = Integer.parseInt(skillIdVar); final Skill sk = SkillData.getInstance().getSkill(skillId, 1); - if (sk != null) - { + if (sk != null) { player.removeSkill(sk); st.saveGlobalQuestVar(qvarName, "0"); } - } - else - { + } else { _log.warning("Invalid Sub-Class Skill Id: " + skillIdVar + " for player " + player.getName() + "!"); } - } - else if (!qvar.isEmpty() && !qvar.equals("0")) - { - if (Util.isDigit(qvar)) - { + } else if (!qvar.isEmpty() && !qvar.equals("0")) { + if (Util.isDigit(qvar)) { final int itemObjId = Integer.parseInt(qvar); L2ItemInstance itemInstance = player.getInventory().getItemByObjectId(itemObjId); - if (itemInstance != null) - { + if (itemInstance != null) { player.destroyItem("CancelCertification", itemObjId, 1, player, false); - } - else - { + } else { itemInstance = player.getWarehouse().getItemByObjectId(itemObjId); - if (itemInstance != null) - { + if (itemInstance != null) { _log.warning("Somehow " + player.getName() + " put a certification book into warehouse!"); player.getWarehouse().destroyItem("CancelCertification", itemInstance, 1, player, false); - } - else - { + } else { _log.warning("Somehow " + player.getName() + " deleted a certification book!"); } } st.saveGlobalQuestVar(qvarName, "0"); - } - else - { + } else { _log.warning("Invalid item object Id: " + qvar + " for player " + player.getName() + "!"); } } @@ -273,11 +212,9 @@ public class AvantGarde extends AbstractNpcAI } // Let's consume all certification books, even those not present in database. - for (int itemId : ITEMS) - { + for (int itemId : ITEMS) { L2ItemInstance item = player.getInventory().getItemByItemId(itemId); - if (item != null) - { + if (item != null) { _log.warning(getClass().getName() + ": player " + player + " had 'extra' certification skill books while cancelling sub-class certifications!"); player.destroyItem("CancelCertificationExtraBooks", item, npc, false); } @@ -290,14 +227,12 @@ public class AvantGarde extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return "32323-01.html"; } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { return "32323-01.html"; } @@ -305,26 +240,20 @@ public class AvantGarde extends AbstractNpcAI * Display the Sub-Class Skill list to the player. * @param player the player */ - public static void showSubClassSkillList(L2PcInstance player) - { + public static void showSubClassSkillList(L2PcInstance player) { final List<L2SkillLearn> subClassSkills = SkillTreesData.getInstance().getAvailableSubClassSkills(player); final AcquireSkillList asl = new AcquireSkillList(AcquireSkillType.SUBCLASS); int count = 0; - for (L2SkillLearn s : subClassSkills) - { - if (SkillData.getInstance().getSkill(s.getSkillId(), s.getSkillLevel()) != null) - { + for (L2SkillLearn s : subClassSkills) { + if (SkillData.getInstance().getSkill(s.getSkillId(), s.getSkillLevel()) != null) { count++; asl.addSkill(s.getSkillId(), s.getSkillLevel(), s.getSkillLevel(), 0, 0); } } - if (count > 0) - { + if (count > 0) { player.sendPacket(asl); - } - else - { + } else { player.sendPacket(SystemMessageId.NO_MORE_SKILLS_TO_LEARN); } } @@ -333,44 +262,34 @@ public class AvantGarde extends AbstractNpcAI * This displays Transformation Skill List to the player. * @param player the active character. */ - public static void showTransformSkillList(L2PcInstance player) - { + public static void showTransformSkillList(L2PcInstance player) { final List<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailableTransformSkills(player); final AcquireSkillList asl = new AcquireSkillList(AcquireSkillType.TRANSFORM); int counts = 0; - for (L2SkillLearn s : skills) - { - if (SkillData.getInstance().getSkill(s.getSkillId(), s.getSkillLevel()) != null) - { + for (L2SkillLearn s : skills) { + if (SkillData.getInstance().getSkill(s.getSkillId(), s.getSkillLevel()) != null) { counts++; asl.addSkill(s.getSkillId(), s.getSkillLevel(), s.getSkillLevel(), s.getLevelUpSp(), 0); } } - if (counts == 0) - { + if (counts == 0) { final int minlevel = SkillTreesData.getInstance().getMinLevelForNewSkill(player, SkillTreesData.getInstance().getTransformSkillTree()); - if (minlevel > 0) - { + if (minlevel > 0) { // No more skills to learn, come back when you level. final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.DO_NOT_HAVE_FURTHER_SKILLS_TO_LEARN_S1); sm.addInt(minlevel); player.sendPacket(sm); - } - else - { + } else { player.sendPacket(SystemMessageId.NO_MORE_SKILLS_TO_LEARN); } - } - else - { + } else { player.sendPacket(asl); } } - public static void main(String[] args) - { + public static void main(String[] args) { new AvantGarde(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/BlackJudge/BlackJudge.java b/src/main/java/com/l2jserver/datapack/ai/npc/BlackJudge/BlackJudge.java index af42814897..4583370f9e 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/BlackJudge/BlackJudge.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/BlackJudge/BlackJudge.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.network.serverpackets.EtcStatusUpdate; * Black Judge AI. * @author St3eT */ -public class BlackJudge extends AbstractNpcAI -{ +public class BlackJudge extends AbstractNpcAI { // NPC private static final int BLACK_JUDGE = 30981; // Misc @@ -41,8 +40,7 @@ public class BlackJudge extends AbstractNpcAI }; // @formatter:on - private BlackJudge() - { + private BlackJudge() { super(BlackJudge.class.getSimpleName(), "ai/npc"); addStartNpc(BLACK_JUDGE); addTalkId(BLACK_JUDGE); @@ -50,37 +48,27 @@ public class BlackJudge extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; final int level = ((player.getExpertiseLevel() < 5) ? player.getExpertiseLevel() : 5); - switch (event) - { - case "remove_info": - { + switch (event) { + case "remove_info": { htmltext = "30981-0" + (level + 1) + ".html"; break; } - case "remove_dp": - { - if (player.getDeathPenaltyBuffLevel() > 0) - { + case "remove_dp": { + if (player.getDeathPenaltyBuffLevel() > 0) { int cost = COSTS[level]; - if (player.getAdena() >= cost) - { + if (player.getAdena() >= cost) { takeItems(player, Inventory.ADENA_ID, cost); player.setDeathPenaltyBuffLevel(player.getDeathPenaltyBuffLevel() - 1); player.sendPacket(SystemMessageId.DEATH_PENALTY_LIFTED); player.sendPacket(new EtcStatusUpdate(player)); - } - else - { + } else { htmltext = "30981-07.html"; } - } - else - { + } else { htmltext = "30981-08.html"; } break; @@ -89,8 +77,7 @@ public class BlackJudge extends AbstractNpcAI return htmltext; } - public static void main(String[] args) - { + public static void main(String[] args) { new BlackJudge(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/BlackMarketeerOfMammon/BlackMarketeerOfMammon.java b/src/main/java/com/l2jserver/datapack/ai/npc/BlackMarketeerOfMammon/BlackMarketeerOfMammon.java index 6cbbd54f57..f90dd55a8b 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/BlackMarketeerOfMammon/BlackMarketeerOfMammon.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/BlackMarketeerOfMammon/BlackMarketeerOfMammon.java @@ -32,64 +32,47 @@ import com.l2jserver.gameserver.model.quest.State; * Black Marketeer of Mammon - Exchange Adena for AA. * @author Adry_85 */ -public final class BlackMarketeerOfMammon extends AbstractNpcAI -{ +public final class BlackMarketeerOfMammon extends AbstractNpcAI { // NPC private static final int BLACK_MARKETEER = 31092; // Misc private static final int MIN_LEVEL = 60; - private BlackMarketeerOfMammon() - { + private BlackMarketeerOfMammon() { super(BlackMarketeerOfMammon.class.getSimpleName(), "ai/npc"); addStartNpc(BLACK_MARKETEER); addTalkId(BLACK_MARKETEER); } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { return exchangeAvailable() ? "31092-01.html" : "31092-02.html"; } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; - if ("exchange".equals(event)) - { - if (exchangeAvailable()) - { - if (player.getLevel() >= MIN_LEVEL) - { + if ("exchange".equals(event)) { + if (exchangeAvailable()) { + if (player.getLevel() >= MIN_LEVEL) { final QuestState qs = getQuestState(player, true); - if (!qs.isNowAvailable()) - { + if (!qs.isNowAvailable()) { htmltext = "31092-03.html"; - } - else - { - if (player.getAdena() >= 2000000) - { + } else { + if (player.getAdena() >= 2000000) { qs.setState(State.STARTED); takeItems(player, Inventory.ADENA_ID, 2000000); giveItems(player, Inventory.ANCIENT_ADENA_ID, 500000); htmltext = "31092-04.html"; qs.exitQuest(QuestType.DAILY, false); - } - else - { + } else { htmltext = "31092-05.html"; } } - } - else - { + } else { htmltext = "31092-06.html"; } - } - else - { + } else { htmltext = "31092-02.html"; } } @@ -97,14 +80,12 @@ public final class BlackMarketeerOfMammon extends AbstractNpcAI return htmltext; } - private boolean exchangeAvailable() - { + private boolean exchangeAvailable() { LocalTime localTime = LocalTime.now(); return (localTime.isAfter(LocalTime.parse("20:00:00")) && localTime.isBefore(LocalTime.MAX)); } - public static void main(String[] args) - { + public static void main(String[] args) { new BlackMarketeerOfMammon(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/CastleAmbassador/CastleAmbassador.java b/src/main/java/com/l2jserver/datapack/ai/npc/CastleAmbassador/CastleAmbassador.java index 620aaaf425..af1d374fd9 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/CastleAmbassador/CastleAmbassador.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/CastleAmbassador/CastleAmbassador.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; * Castle Ambassador AI. * @author St3eT */ -public final class CastleAmbassador extends AbstractNpcAI -{ +public final class CastleAmbassador extends AbstractNpcAI { // NPCs // @formatter:off private static final int[] CASTLE_AMBASSADOR = @@ -48,8 +47,7 @@ public final class CastleAmbassador extends AbstractNpcAI }; // @formatter:on - private CastleAmbassador() - { + private CastleAmbassador() { super(CastleAmbassador.class.getSimpleName(), "ai/npc"); addStartNpc(CASTLE_AMBASSADOR); addTalkId(CASTLE_AMBASSADOR); @@ -59,49 +57,36 @@ public final class CastleAmbassador extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (npc != null) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (npc != null) { final Fort fortresss = npc.getFort(); String htmltext = null; - switch (event) - { - case "signed": - { - if (fortresss.getFortState() == 0) - { + switch (event) { + case "signed": { + if (fortresss.getFortState() == 0) { fortresss.setFortState(2, fortresss.getCastleIdByAmbassador(npc.getId())); cancelQuestTimer("DESPAWN", npc, null); startQuestTimer("DESPAWN", 3000, npc, null); htmltext = "ambassador-05.html"; - } - else if (fortresss.getFortState() == 1) - { + } else if (fortresss.getFortState() == 1) { htmltext = "ambassador-04.html"; } break; } - case "rejected": - { - if (fortresss.getFortState() == 0) - { + case "rejected": { + if (fortresss.getFortState() == 0) { fortresss.setFortState(1, fortresss.getCastleIdByAmbassador(npc.getId())); cancelQuestTimer("DESPAWN", npc, null); startQuestTimer("DESPAWN", 3000, npc, null); htmltext = "ambassador-02.html"; - } - else if (fortresss.getFortState() == 2) - { + } else if (fortresss.getFortState() == 2) { htmltext = "ambassador-02.html"; } break; } - case "DESPAWN": - { - if (fortresss.getFortState() == 0) - { + case "DESPAWN": { + if (fortresss.getFortState() == 0) { fortresss.setFortState(1, fortresss.getCastleIdByAmbassador(npc.getId())); } cancelQuestTimer("DESPAWN", npc, null); @@ -111,8 +96,7 @@ public final class CastleAmbassador extends AbstractNpcAI } } - if (htmltext != null) - { + if (htmltext != null) { final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId()); packet.setHtml(getHtm(player.getHtmlPrefix(), htmltext)); packet.replace("%castleName%", String.valueOf(fortresss.getCastleByAmbassador(npc.getId()).getName())); @@ -123,28 +107,22 @@ public final class CastleAmbassador extends AbstractNpcAI } @Override - public String onEventReceived(String eventName, L2Npc sender, L2Npc receiver, L2Object reference) - { - if (receiver != null) - { + public String onEventReceived(String eventName, L2Npc sender, L2Npc receiver, L2Object reference) { + if (receiver != null) { receiver.deleteMe(); } return super.onEventReceived(eventName, sender, receiver, reference); } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { final Fort fortresss = npc.getFort(); final int fortOwner = fortresss.getOwnerClan() == null ? 0 : fortresss.getOwnerClan().getId(); String htmltext = null; - if (player.isClanLeader() && (player.getClanId() == fortOwner)) - { + if (player.isClanLeader() && (player.getClanId() == fortOwner)) { htmltext = (fortresss.isBorderFortress()) ? "ambassador-01.html" : "ambassador.html"; - } - else - { + } else { htmltext = "ambassador-03.html"; } @@ -156,22 +134,17 @@ public final class CastleAmbassador extends AbstractNpcAI } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { final Castle castle = npc.getFort().getCastleByAmbassador(npc.getId()); - if (castle.getOwnerId() == 0) - { + if (castle.getOwnerId() == 0) { npc.deleteMe(); - } - else - { + } else { startQuestTimer("DESPAWN", 3600000, npc, null); } return super.onSpawn(npc); } - public static void main(String[] args) - { + public static void main(String[] args) { new CastleAmbassador(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/CastleBlacksmith/CastleBlacksmith.java b/src/main/java/com/l2jserver/datapack/ai/npc/CastleBlacksmith/CastleBlacksmith.java index 3cbc11369c..8521842fb6 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/CastleBlacksmith/CastleBlacksmith.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/CastleBlacksmith/CastleBlacksmith.java @@ -28,11 +28,9 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Castle Blacksmith AI. * @author malyelfik */ -public final class CastleBlacksmith extends AbstractNpcAI -{ +public final class CastleBlacksmith extends AbstractNpcAI { // Blacksmith IDs - private static final int[] NPCS = - { + private static final int[] NPCS = { 35098, // Blacksmith (Gludio) 35140, // Blacksmith (Dion) 35182, // Blacksmith (Giran) @@ -44,33 +42,28 @@ public final class CastleBlacksmith extends AbstractNpcAI 35553, // Blacksmith (Schuttgart) }; - private CastleBlacksmith() - { + private CastleBlacksmith() { super(CastleBlacksmith.class.getSimpleName(), "ai/npc"); addStartNpc(NPCS); addTalkId(NPCS); addFirstTalkId(NPCS); } - private boolean hasRights(L2PcInstance player, L2Npc npc) - { + private boolean hasRights(L2PcInstance player, L2Npc npc) { return player.canOverrideCond(PcCondOverride.CASTLE_CONDITIONS) || npc.isMyLord(player) || ((player.getClanId() == npc.getCastle().getOwnerId()) && player.hasClanPrivilege(ClanPrivilege.CS_MANOR_ADMIN)); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { return (event.equalsIgnoreCase(npc.getId() + "-02.html") && hasRights(player, npc)) ? event : null; } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return (hasRights(player, npc)) ? npc.getId() + "-01.html" : "no.html"; } - public static void main(String[] args) - { + public static void main(String[] args) { new CastleBlacksmith(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/CastleChamberlain/CastleChamberlain.java b/src/main/java/com/l2jserver/datapack/ai/npc/CastleChamberlain/CastleChamberlain.java index 407db248b9..356408cdba 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/CastleChamberlain/CastleChamberlain.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/CastleChamberlain/CastleChamberlain.java @@ -71,11 +71,9 @@ import com.l2jserver.gameserver.util.Util; * Castle Chamberlain AI. * @author malyelfik */ -public final class CastleChamberlain extends AbstractNpcAI -{ +public final class CastleChamberlain extends AbstractNpcAI { // NPCs - private static final int[] NPC = - { + private static final int[] NPC = { 35100, // Sayres 35142, // Crosby 35184, // Saul @@ -91,8 +89,7 @@ public final class CastleChamberlain extends AbstractNpcAI // Fortress private static final Map<Integer, List<Integer>> FORTRESS = new HashMap<>(); - static - { + static { FORTRESS.put(1, Arrays.asList(101, 102, 112, 113)); // Gludio Castle FORTRESS.put(2, Arrays.asList(103, 112, 114, 115)); // Dion Castle FORTRESS.put(3, Arrays.asList(104, 114, 116, 118, 119)); // Giran Castle @@ -105,8 +102,7 @@ public final class CastleChamberlain extends AbstractNpcAI } // Buffs - private static final SkillHolder[] BUFFS = - { + private static final SkillHolder[] BUFFS = { new SkillHolder(4342, 2), // Wind Walk Lv.2 new SkillHolder(4343, 3), // Decrease Weight Lv.3 new SkillHolder(4344, 3), // Shield Lv.3 @@ -137,39 +133,30 @@ public final class CastleChamberlain extends AbstractNpcAI new SkillHolder(4360, 1), // Death Whisper Lv.1 }; - private CastleChamberlain() - { + private CastleChamberlain() { super(CastleChamberlain.class.getSimpleName(), "ai/npc"); addStartNpc(NPC); addTalkId(NPC); addFirstTalkId(NPC); } - private NpcHtmlMessage getHtmlPacket(L2PcInstance player, L2Npc npc, String htmlFile) - { + private NpcHtmlMessage getHtmlPacket(L2PcInstance player, L2Npc npc, String htmlFile) { final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId()); packet.setHtml(getHtm(player.getHtmlPrefix(), htmlFile)); return packet; } - private final String funcConfirmHtml(final L2PcInstance player, final L2Npc npc, final Castle castle, final int func, final int level) - { - if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_SET_FUNCTIONS)) - { + private final String funcConfirmHtml(final L2PcInstance player, final L2Npc npc, final Castle castle, final int func, final int level) { + if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_SET_FUNCTIONS)) { final NpcHtmlMessage html; final String fstring = (func == Castle.FUNC_TELEPORT) ? "9" : "10"; - if (level == 0) - { + if (level == 0) { html = getHtmlPacket(player, npc, "castleresetdeco.html"); html.replace("%AgitDecoSubmit%", Integer.toString(func)); - } - else if ((castle.getFunction(func) != null) && (castle.getFunction(func).getLvl() == level)) - { + } else if ((castle.getFunction(func) != null) && (castle.getFunction(func).getLvl() == level)) { html = getHtmlPacket(player, npc, "castledecoalreadyset.html"); html.replace("%AgitDecoEffect%", "<fstring p1=\"" + level + "\">" + fstring + "</fstring>"); - } - else - { + } else { html = getHtmlPacket(player, npc, "castledeco-0" + func + ".html"); html.replace("%AgitDecoCost%", "<fstring p1=\"" + getFunctionFee(func, level) + "\" p2=\"" + (getFunctionRatio(func) / 86400000) + "\">6</fstring>"); html.replace("%AgitDecoEffect%", "<fstring p1=\"" + level + "\">" + fstring + "</fstring>"); @@ -181,18 +168,14 @@ public final class CastleChamberlain extends AbstractNpcAI return "chamberlain-21.html"; } - private final void funcReplace(final Castle castle, final NpcHtmlMessage html, final int func, final String str) - { + private final void funcReplace(final Castle castle, final NpcHtmlMessage html, final int func, final String str) { final CastleFunction function = castle.getFunction(func); - if (function == null) - { + if (function == null) { html.replace("%" + str + "Depth%", "<fstring>4</fstring>"); html.replace("%" + str + "Cost%", ""); html.replace("%" + str + "Expire%", "<fstring>4</fstring>"); html.replace("%" + str + "Reset%", ""); - } - else - { + } else { final String fstring = ((func == Castle.FUNC_SUPPORT) || (func == Castle.FUNC_TELEPORT)) ? "9" : "10"; final Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(function.getEndTime()); @@ -203,11 +186,9 @@ public final class CastleChamberlain extends AbstractNpcAI } } - private final int getFunctionFee(final int func, final int level) - { + private final int getFunctionFee(final int func, final int level) { int fee = 0; - switch (func) - { + switch (func) { case Castle.FUNC_RESTORE_EXP: fee = (level == 45) ? castle().getExpRegenerationFeeLvl1() : castle().getExpRegenerationFeeLvl2(); break; @@ -227,11 +208,9 @@ public final class CastleChamberlain extends AbstractNpcAI return fee; } - private final long getFunctionRatio(final int func) - { + private final long getFunctionRatio(final int func) { long ratio = 0; - switch (func) - { + switch (func) { case Castle.FUNC_RESTORE_EXP: ratio = castle().getExpRegenerationFunctionFeeRatio(); break; @@ -251,15 +230,12 @@ public final class CastleChamberlain extends AbstractNpcAI return ratio; } - private final int getDoorUpgradePrice(final int type, final int level) - { + private final int getDoorUpgradePrice(final int type, final int level) { int price = 0; - switch (type) - { + switch (type) { case 1: // Outer Door { - switch (level) - { + switch (level) { case 2: price = castle().getOuterDoorUpgradePriceLvl2(); break; @@ -274,8 +250,7 @@ public final class CastleChamberlain extends AbstractNpcAI } case 2: // Inner Door { - switch (level) - { + switch (level) { case 2: price = castle().getInnerDoorUpgradePriceLvl2(); break; @@ -290,8 +265,7 @@ public final class CastleChamberlain extends AbstractNpcAI } case 3: // Wall { - switch (level) - { + switch (level) { case 2: price = castle().getWallUpgradePriceLvl2(); break; @@ -305,8 +279,7 @@ public final class CastleChamberlain extends AbstractNpcAI break; } } - switch (SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_STRIFE)) - { + switch (SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_STRIFE)) { case SevenSigns.CABAL_DUSK: price *= 3; break; @@ -317,11 +290,9 @@ public final class CastleChamberlain extends AbstractNpcAI return price; } - private final String getSealOwner(final int seal) - { + private final String getSealOwner(final int seal) { String npcString; - switch (SevenSigns.getInstance().getSealOwner(seal)) - { + switch (SevenSigns.getInstance().getSealOwner(seal)) { case SevenSigns.CABAL_DAWN: npcString = "1000511"; break; @@ -335,11 +306,9 @@ public final class CastleChamberlain extends AbstractNpcAI return npcString; } - private final int getTaxLimit() - { + private final int getTaxLimit() { final int taxLimit; - switch (SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_STRIFE)) - { + switch (SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_STRIFE)) { case SevenSigns.CABAL_DAWN: taxLimit = 25; break; @@ -353,11 +322,9 @@ public final class CastleChamberlain extends AbstractNpcAI return taxLimit; } - private final int getTrapUpgradePrice(final int level) - { + private final int getTrapUpgradePrice(final int level) { int price = 0; - switch (level) - { + switch (level) { case 1: price = castle().getTrapUpgradePriceLvl1(); break; @@ -372,8 +339,7 @@ public final class CastleChamberlain extends AbstractNpcAI break; } - switch (SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_STRIFE)) - { + switch (SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_STRIFE)) { case SevenSigns.CABAL_DUSK: price *= 3; break; @@ -384,57 +350,46 @@ public final class CastleChamberlain extends AbstractNpcAI return price; } - private final boolean isDomainFortressInContractStatus(final int castleId) - { + private final boolean isDomainFortressInContractStatus(final int castleId) { final int numFort = ((castleId == 1) || (castleId == 5)) ? 2 : 1; final List<Integer> fortList = FORTRESS.get(castleId); - for (int i = 0; i < numFort; i++) - { + for (int i = 0; i < numFort; i++) { final Fort fortress = FortManager.getInstance().getFortById(fortList.get(i)); - if (fortress.getFortState() == 2) - { + if (fortress.getFortState() == 2) { return true; } } return false; } - private final boolean isOwner(final L2PcInstance player, final L2Npc npc) - { + private final boolean isOwner(final L2PcInstance player, final L2Npc npc) { return player.canOverrideCond(PcCondOverride.CASTLE_CONDITIONS) || ((player.getClan() != null) && (player.getClanId() == npc.getCastle().getOwnerId())); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final Castle castle = npc.getCastle(); final StringTokenizer st = new StringTokenizer(event, " "); String htmltext = null; - switch (st.nextToken()) - { + switch (st.nextToken()) { case "chamberlain-01.html": case "manor-help-01.html": case "manor-help-02.html": case "manor-help-03.html": - case "manor-help-04.html": - { + case "manor-help-04.html": { htmltext = event; break; } - case "fort_status": - { - if (npc.isMyLord(player)) - { + case "fort_status": { + if (npc.isMyLord(player)) { final StringBuilder sb = new StringBuilder(); final List<Integer> fort = FORTRESS.get(castle.getResidenceId()); - for (int id : fort) - { + for (int id : fort) { final Fort fortress = FortManager.getInstance().getFortById(id); final int fortId = fortress.getResidenceId(); final String fortType = (fortId < 112) ? "1300133" : "1300134"; final String fortStatus; - switch (fortress.getFortState()) - { + switch (fortress.getFortState()) { case 1: fortStatus = "1300122"; break; @@ -452,168 +407,116 @@ public final class CastleChamberlain extends AbstractNpcAI final NpcHtmlMessage html = getHtmlPacket(player, npc, "chamberlain-28.html"); html.replace("%list%", sb.toString()); player.sendPacket(html); - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "siege_functions": - { - if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_SET_FUNCTIONS)) - { - if (castle.getSiege().isInProgress()) - { + case "siege_functions": { + if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_SET_FUNCTIONS)) { + if (castle.getSiege().isInProgress()) { htmltext = "chamberlain-08.html"; - } - else if (!isDomainFortressInContractStatus(castle.getResidenceId())) - { + } else if (!isDomainFortressInContractStatus(castle.getResidenceId())) { htmltext = "chamberlain-27.html"; - } - else if (!SevenSigns.getInstance().isCompResultsPeriod()) - { + } else if (!SevenSigns.getInstance().isCompResultsPeriod()) { htmltext = "chamberlain-26.html"; - } - else - { + } else { htmltext = "chamberlain-12.html"; } - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "manage_doors": - { - if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_SET_FUNCTIONS)) - { - if (st.hasMoreTokens()) - { + case "manage_doors": { + if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_SET_FUNCTIONS)) { + if (st.hasMoreTokens()) { final StringBuilder sb = new StringBuilder(); final NpcHtmlMessage html = getHtmlPacket(player, npc, "chamberlain-13.html"); html.replace("%type%", st.nextToken()); - while (st.hasMoreTokens()) - { + while (st.hasMoreTokens()) { sb.append(" " + st.nextToken()); } html.replace("%doors%", sb.toString()); player.sendPacket(html); - } - else - { + } else { htmltext = npc.getId() + "-du.html"; } - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "upgrade_doors": - { - if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_SET_FUNCTIONS)) - { + case "upgrade_doors": { + if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_SET_FUNCTIONS)) { final int type = Integer.parseInt(st.nextToken()); final int level = Integer.parseInt(st.nextToken()); final NpcHtmlMessage html = getHtmlPacket(player, npc, "chamberlain-14.html"); html.replace("%gate_price%", Integer.toString(getDoorUpgradePrice(type, level))); html.replace("%event%", event.substring("upgrade_doors".length() + 1)); player.sendPacket(html); - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "upgrade_doors_confirm": - { - if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_SET_FUNCTIONS)) - { - if (castle.getSiege().isInProgress()) - { + case "upgrade_doors_confirm": { + if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_SET_FUNCTIONS)) { + if (castle.getSiege().isInProgress()) { htmltext = "chamberlain-08.html"; - } - else - { + } else { final int type = Integer.parseInt(st.nextToken()); final int level = Integer.parseInt(st.nextToken()); final int price = getDoorUpgradePrice(type, level); final int[] doors = new int[2]; - for (int i = 0; i <= st.countTokens(); i++) - { + for (int i = 0; i <= st.countTokens(); i++) { doors[i] = Integer.parseInt(st.nextToken()); } final L2DoorInstance door = castle.getDoor(doors[0]); - if (door != null) - { + if (door != null) { final int currentLevel = door.getStat().getUpgradeHpRatio(); - if (currentLevel >= level) - { + if (currentLevel >= level) { final NpcHtmlMessage html = getHtmlPacket(player, npc, "chamberlain-15.html"); html.replace("%doorlevel%", Integer.toString(currentLevel)); player.sendPacket(html); - } - else if (player.getAdena() >= price) - { + } else if (player.getAdena() >= price) { takeItems(player, Inventory.ADENA_ID, price); - for (int doorId : doors) - { + for (int doorId : doors) { castle.setDoorUpgrade(doorId, level, true); } htmltext = "chamberlain-16.html"; - } - else - { + } else { htmltext = "chamberlain-09.html"; } } } - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "manage_trap": - { - if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_SET_FUNCTIONS)) - { - if (st.hasMoreTokens()) - { + case "manage_trap": { + if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_SET_FUNCTIONS)) { + if (st.hasMoreTokens()) { final NpcHtmlMessage html; - if (castle.getName().equalsIgnoreCase("aden")) - { + if (castle.getName().equalsIgnoreCase("aden")) { html = getHtmlPacket(player, npc, "chamberlain-17a.html"); - } - else - { + } else { html = getHtmlPacket(player, npc, "chamberlain-17.html"); } html.replace("%trapIndex%", st.nextToken()); player.sendPacket(html); - } - else - { + } else { htmltext = npc.getId() + "-tu.html"; } - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "upgrade_trap": - { - if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_SET_FUNCTIONS)) - { + case "upgrade_trap": { + if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_SET_FUNCTIONS)) { final String trapIndex = st.nextToken(); final int level = Integer.parseInt(st.nextToken()); final NpcHtmlMessage html = getHtmlPacket(player, npc, "chamberlain-18.html"); @@ -621,70 +524,50 @@ public final class CastleChamberlain extends AbstractNpcAI html.replace("%level%", Integer.toString(level)); html.replace("%dmgzone_price%", Integer.toString(getTrapUpgradePrice(level))); player.sendPacket(html); - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "upgrade_trap_confirm": - { - if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_SET_FUNCTIONS)) - { - if (castle.getSiege().isInProgress()) - { + case "upgrade_trap_confirm": { + if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_SET_FUNCTIONS)) { + if (castle.getSiege().isInProgress()) { htmltext = "chamberlain-08.html"; - } - else - { + } else { final int trapIndex = Integer.parseInt(st.nextToken()); final int level = Integer.parseInt(st.nextToken()); final int price = getTrapUpgradePrice(level); final int currentLevel = castle.getTrapUpgradeLevel(trapIndex); - if (currentLevel >= level) - { + if (currentLevel >= level) { final NpcHtmlMessage html = getHtmlPacket(player, npc, "chamberlain-19.html"); html.replace("%dmglevel%", Integer.toString(currentLevel)); player.sendPacket(html); - } - else if (player.getAdena() >= price) - { + } else if (player.getAdena() >= price) { takeItems(player, Inventory.ADENA_ID, price); castle.setTrapUpgrade(trapIndex, level, true); htmltext = "chamberlain-20.html"; - } - else - { + } else { htmltext = "chamberlain-09.html"; } } - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "receive_report": - { - if (npc.isMyLord(player)) - { - if (castle.getSiege().isInProgress()) - { + case "receive_report": { + if (npc.isMyLord(player)) { + if (castle.getSiege().isInProgress()) { htmltext = "chamberlain-07.html"; - } - else - { + } else { final L2Clan clan = ClanTable.getInstance().getClan(castle.getOwnerId()); final NpcHtmlMessage html = getHtmlPacket(player, npc, "chamberlain-02.html"); html.replace("%clanleadername%", clan.getLeaderName()); html.replace("%clanname%", clan.getName()); html.replace("%castlename%", String.valueOf(1001000 + castle.getResidenceId())); - switch (SevenSigns.getInstance().getCurrentPeriod()) - { + switch (SevenSigns.getInstance().getCurrentPeriod()) { case SevenSigns.PERIOD_COMP_RECRUITING: html.replace("%ss_event%", "1000509"); break; @@ -701,88 +584,62 @@ public final class CastleChamberlain extends AbstractNpcAI html.replace("%ss_strife%", getSealOwner(3)); player.sendPacket(html); } - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "manage_tax": - { - if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_TAXES)) - { - if (castle.getSiege().isInProgress()) - { + case "manage_tax": { + if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_TAXES)) { + if (castle.getSiege().isInProgress()) { htmltext = "chamberlain-08.html"; - } - else - { + } else { final NpcHtmlMessage html = getHtmlPacket(player, npc, "castlesettaxrate.html"); html.replace("%tax_rate%", Integer.toString(castle.getTaxPercent())); html.replace("%next_tax_rate%", "0"); // TODO: Implement me! html.replace("%tax_limit%", Integer.toString(getTaxLimit())); player.sendPacket(html); } - } - else if (isOwner(player, npc)) - { + } else if (isOwner(player, npc)) { final NpcHtmlMessage html = getHtmlPacket(player, npc, "chamberlain-03.html"); html.replace("%tax_rate%", Integer.toString(castle.getTaxPercent())); html.replace("%next_tax_rate%", "0"); // TODO: Implement me! player.sendPacket(html); - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "set_tax": - { - if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_TAXES)) - { - if (castle.getSiege().isInProgress()) - { + case "set_tax": { + if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_TAXES)) { + if (castle.getSiege().isInProgress()) { htmltext = "chamberlain-08.html"; - } - else - { + } else { final NpcHtmlMessage html; final int tax = (st.hasMoreTokens()) ? Integer.parseInt(st.nextToken()) : 0; final int taxLimit = getTaxLimit(); - if (tax > taxLimit) - { + if (tax > taxLimit) { html = getHtmlPacket(player, npc, "castletoohightaxrate.html"); html.replace("%tax_limit%", Integer.toString(taxLimit)); - } - else - { + } else { castle.setTaxPercent(tax); html = getHtmlPacket(player, npc, "castleaftersettaxrate.html"); html.replace("%next_tax_rate%", Integer.toString(tax)); } player.sendPacket(html); } - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "manage_vault": - { - if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_TAXES)) - { + case "manage_vault": { + if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_TAXES)) { long seedIncome = 0; - if (general().allowManor()) - { - for (SeedProduction sp : CastleManorManager.getInstance().getSeedProduction(castle.getResidenceId(), false)) - { + if (general().allowManor()) { + for (SeedProduction sp : CastleManorManager.getInstance().getSeedProduction(castle.getResidenceId(), false)) { final long diff = sp.getStartAmount() - sp.getAmount(); - if (diff != 0) - { + if (diff != 0) { seedIncome += diff * sp.getPrice(); } } @@ -793,243 +650,171 @@ public final class CastleChamberlain extends AbstractNpcAI html.replace("%tax_income_reserved%", "0"); // TODO: Implement me! html.replace("%seed_income%", Util.formatAdena(seedIncome)); player.sendPacket(html); - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "deposit": - { - if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_TAXES)) - { + case "deposit": { + if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_TAXES)) { final long amount = (st.hasMoreTokens()) ? Long.parseLong(st.nextToken()) : 0; - if ((amount > 0) && (amount < character().getMaxAdena())) - { - if (player.getAdena() >= amount) - { + if ((amount > 0) && (amount < character().getMaxAdena())) { + if (player.getAdena() >= amount) { takeItems(player, Inventory.ADENA_ID, amount); castle.addToTreasuryNoTax(amount); - } - else - { + } else { player.sendPacket(SystemMessageId.YOU_NOT_ENOUGH_ADENA); } } htmltext = "chamberlain-01.html"; - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "withdraw": - { - if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_TAXES)) - { + case "withdraw": { + if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_TAXES)) { final long amount = (st.hasMoreTokens()) ? Long.parseLong(st.nextToken()) : 0; - if (amount <= castle.getTreasury()) - { + if (amount <= castle.getTreasury()) { castle.addToTreasuryNoTax((-1) * amount); giveAdena(player, amount, false); htmltext = "chamberlain-01.html"; - } - else - { + } else { final NpcHtmlMessage html = getHtmlPacket(player, npc, "castlenotenoughbalance.html"); html.replace("%tax_income%", Util.formatAdena(castle.getTreasury())); html.replace("%withdraw_amount%", Util.formatAdena(amount)); player.sendPacket(html); } - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "manage_functions": - { - if (!isOwner(player, npc)) - { + case "manage_functions": { + if (!isOwner(player, npc)) { htmltext = "chamberlain-21.html"; - } - else if (castle.getSiege().isInProgress()) - { + } else if (castle.getSiege().isInProgress()) { htmltext = "chamberlain-08.html"; - } - else - { + } else { htmltext = "chamberlain-23.html"; } break; } - case "banish_foreigner_show": - { - if (!isOwner(player, npc) || !player.hasClanPrivilege(ClanPrivilege.CS_DISMISS)) - { + case "banish_foreigner_show": { + if (!isOwner(player, npc) || !player.hasClanPrivilege(ClanPrivilege.CS_DISMISS)) { htmltext = "chamberlain-21.html"; - } - else if (castle.getSiege().isInProgress()) - { + } else if (castle.getSiege().isInProgress()) { htmltext = "chamberlain-08.html"; - } - else - { + } else { htmltext = "chamberlain-10.html"; } break; } - case "banish_foreigner": - { - if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_DISMISS)) - { - if (castle.getSiege().isInProgress() || TerritoryWarManager.getInstance().isTWInProgress()) - { + case "banish_foreigner": { + if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_DISMISS)) { + if (castle.getSiege().isInProgress() || TerritoryWarManager.getInstance().isTWInProgress()) { htmltext = "chamberlain-08.html"; - } - else - { + } else { castle.banishForeigners(); htmltext = "chamberlain-11.html"; } - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "doors": - { - if (!isOwner(player, npc) || !player.hasClanPrivilege(ClanPrivilege.CS_OPEN_DOOR)) - { + case "doors": { + if (!isOwner(player, npc) || !player.hasClanPrivilege(ClanPrivilege.CS_OPEN_DOOR)) { htmltext = "chamberlain-21.html"; - } - else if (castle.getSiege().isInProgress()) - { + } else if (castle.getSiege().isInProgress()) { htmltext = "chamberlain-08.html"; - } - else - { + } else { htmltext = npc.getId() + "-d.html"; } break; } - case "operate_door": - { - if (!isOwner(player, npc) || !player.hasClanPrivilege(ClanPrivilege.CS_OPEN_DOOR)) - { + case "operate_door": { + if (!isOwner(player, npc) || !player.hasClanPrivilege(ClanPrivilege.CS_OPEN_DOOR)) { htmltext = "chamberlain-21.html"; - } - else if (castle.getSiege().isInProgress()) - { + } else if (castle.getSiege().isInProgress()) { htmltext = "chamberlain-08.html"; - } - else - { + } else { final boolean open = (Integer.parseInt(st.nextToken()) == 1); - while (st.hasMoreTokens()) - { + while (st.hasMoreTokens()) { castle.openCloseDoor(player, Integer.parseInt(st.nextToken()), open); } htmltext = (open ? "chamberlain-05.html" : "chamberlain-06.html"); } break; } - case "additional_functions": - { + case "additional_functions": { htmltext = (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_SET_FUNCTIONS)) ? "castletdecomanage.html" : "chamberlain-21.html"; break; } - case "recovery": - { - if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_SET_FUNCTIONS)) - { + case "recovery": { + if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_SET_FUNCTIONS)) { final NpcHtmlMessage html = getHtmlPacket(player, npc, "castledeco-AR01.html"); funcReplace(castle, html, Castle.FUNC_RESTORE_HP, "HP"); funcReplace(castle, html, Castle.FUNC_RESTORE_MP, "MP"); funcReplace(castle, html, Castle.FUNC_RESTORE_EXP, "XP"); player.sendPacket(html); - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "other": - { - if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_SET_FUNCTIONS)) - { + case "other": { + if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_SET_FUNCTIONS)) { final NpcHtmlMessage html = getHtmlPacket(player, npc, "castledeco-AE01.html"); funcReplace(castle, html, Castle.FUNC_TELEPORT, "TP"); funcReplace(castle, html, Castle.FUNC_SUPPORT, "BF"); player.sendPacket(html); - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "HP": - { + case "HP": { final int level = Integer.parseInt(st.nextToken()); htmltext = funcConfirmHtml(player, npc, castle, Castle.FUNC_RESTORE_HP, level); break; } - case "MP": - { + case "MP": { final int level = Integer.parseInt(st.nextToken()); htmltext = funcConfirmHtml(player, npc, castle, Castle.FUNC_RESTORE_MP, level); break; } - case "XP": - { + case "XP": { final int level = Integer.parseInt(st.nextToken()); htmltext = funcConfirmHtml(player, npc, castle, Castle.FUNC_RESTORE_EXP, level); break; } - case "TP": - { + case "TP": { final int level = Integer.parseInt(st.nextToken()); htmltext = funcConfirmHtml(player, npc, castle, Castle.FUNC_TELEPORT, level); break; } - case "BF": - { + case "BF": { final int level = Integer.parseInt(st.nextToken()); htmltext = funcConfirmHtml(player, npc, castle, Castle.FUNC_SUPPORT, level); break; } - case "set_func": - { - if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_SET_FUNCTIONS)) - { + case "set_func": { + if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_SET_FUNCTIONS)) { final int func = Integer.parseInt(st.nextToken()); final int level = Integer.parseInt(st.nextToken()); - if (level == 0) - { + if (level == 0) { castle.updateFunctions(player, func, level, 0, 0, false); - } - else if (!castle.updateFunctions(player, func, level, getFunctionFee(func, level), getFunctionRatio(func), castle.getFunction(func) == null)) - { + } else if (!castle.updateFunctions(player, func, level, getFunctionFee(func, level), getFunctionRatio(func), castle.getFunction(func) == null)) { htmltext = "chamberlain-09.html"; } - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "functions": - { - if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) - { + case "functions": { + if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) { final CastleFunction HP = castle.getFunction(Castle.FUNC_RESTORE_HP); final CastleFunction MP = castle.getFunction(Castle.FUNC_RESTORE_MP); final CastleFunction XP = castle.getFunction(Castle.FUNC_RESTORE_EXP); @@ -1038,93 +823,63 @@ public final class CastleChamberlain extends AbstractNpcAI html.replace("%MPDepth%", (MP == null) ? "0" : Integer.toString(MP.getLvl())); html.replace("%XPDepth%", (XP == null) ? "0" : Integer.toString(XP.getLvl())); player.sendPacket(html); - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "teleport": - { - if (!isOwner(player, npc) || !player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) - { + case "teleport": { + if (!isOwner(player, npc) || !player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) { htmltext = "chamberlain-21.html"; - } - else if (castle.getFunction(Castle.FUNC_TELEPORT) == null) - { + } else if (castle.getFunction(Castle.FUNC_TELEPORT) == null) { htmltext = "castlefuncdisabled.html"; - } - else - { + } else { htmltext = npc.getId() + "-t" + castle.getFunction(Castle.FUNC_TELEPORT).getLvl() + ".html"; } break; } - case "goto": - { - if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) - { + case "goto": { + if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) { final int locId = Integer.parseInt(st.nextToken()); final L2TeleportLocation list = TeleportLocationTable.getInstance().getTemplate(locId); - if (list != null) - { - if (takeItems(player, list.getItemId(), list.getPrice())) - { + if (list != null) { + if (takeItems(player, list.getItemId(), list.getPrice())) { player.teleToLocation(list.getLocX(), list.getLocY(), list.getLocZ()); } } - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "buffer": - { - if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) - { - if (castle.getFunction(Castle.FUNC_SUPPORT) == null) - { + case "buffer": { + if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) { + if (castle.getFunction(Castle.FUNC_SUPPORT) == null) { htmltext = "castlefuncdisabled.html"; - } - else - { + } else { final NpcHtmlMessage html = getHtmlPacket(player, npc, "castlebuff-0" + castle.getFunction(Castle.FUNC_SUPPORT).getLvl() + ".html"); html.replace("%MPLeft%", Integer.toString((int) npc.getCurrentMp())); player.sendPacket(html); } - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "cast_buff": - { - if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) - { - if (castle.getFunction(Castle.FUNC_SUPPORT) == null) - { + case "cast_buff": { + if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) { + if (castle.getFunction(Castle.FUNC_SUPPORT) == null) { htmltext = "castlefuncdisabled.html"; - } - else - { + } else { final int index = Integer.parseInt(st.nextToken()); - if (BUFFS.length > index) - { + if (BUFFS.length > index) { final NpcHtmlMessage html; final SkillHolder holder = BUFFS[index]; - if (holder.getSkill().getMpConsume2() < npc.getCurrentMp()) - { + if (holder.getSkill().getMpConsume2() < npc.getCurrentMp()) { npc.setTarget(player); npc.doCast(holder); html = getHtmlPacket(player, npc, "castleafterbuff.html"); - } - else - { + } else { html = getHtmlPacket(player, npc, "castlenotenoughmp.html"); } @@ -1132,180 +887,120 @@ public final class CastleChamberlain extends AbstractNpcAI player.sendPacket(html); } } - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "list_siege_clans": - { - if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_MANAGE_SIEGE)) - { + case "list_siege_clans": { + if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_MANAGE_SIEGE)) { castle.getSiege().listRegisterClan(player); - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "list_territory_clans": - { - if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_MANAGE_SIEGE)) - { + case "list_territory_clans": { + if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_MANAGE_SIEGE)) { player.sendPacket(new ExShowDominionRegistry(castle.getResidenceId(), player)); - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "manor": - { - if (general().allowManor()) - { + case "manor": { + if (general().allowManor()) { htmltext = (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_MANOR_ADMIN)) ? "manor.html" : "chamberlain-21.html"; - } - else - { + } else { player.sendMessage("Manor system is deactivated."); } break; } - case "products": - { - if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) - { + case "products": { + if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) { final NpcHtmlMessage html = getHtmlPacket(player, npc, "chamberlain-22.html"); html.replace("%npcId%", Integer.toString(npc.getId())); player.sendPacket(html); - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "buy": - { - if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) - { + case "buy": { + if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) { ((L2MerchantInstance) npc).showBuyWindow(player, Integer.parseInt(st.nextToken())); - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "give_crown": - { - if (castle.getSiege().isInProgress()) - { + case "give_crown": { + if (castle.getSiege().isInProgress()) { htmltext = "chamberlain-08.html"; - } - else if (npc.isMyLord(player)) - { - if (hasQuestItems(player, CROWN)) - { + } else if (npc.isMyLord(player)) { + if (hasQuestItems(player, CROWN)) { htmltext = "chamberlain-24.html"; - } - else - { + } else { final NpcHtmlMessage html = getHtmlPacket(player, npc, "chamberlain-25.html"); html.replace("%owner_name%", String.valueOf(player.getName())); html.replace("%feud_name%", String.valueOf(String.valueOf(1001000 + castle.getResidenceId()))); player.sendPacket(html); giveItems(player, CROWN, 1); } - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "manors_cert": - { - if (npc.isMyLord(player)) - { - if (castle.getSiege().isInProgress()) - { + case "manors_cert": { + if (npc.isMyLord(player)) { + if (castle.getSiege().isInProgress()) { htmltext = "chamberlain-08.html"; - } - else - { - if ((SevenSigns.getInstance().getPlayerCabal(player.getObjectId()) == SevenSigns.CABAL_DAWN) && SevenSigns.getInstance().isCompetitionPeriod()) - { + } else { + if ((SevenSigns.getInstance().getPlayerCabal(player.getObjectId()) == SevenSigns.CABAL_DAWN) && SevenSigns.getInstance().isCompetitionPeriod()) { final int ticketCount = castle.getTicketBuyCount(); - if (ticketCount < (sevenSings().getSevenSignsDawnTicketQuantity() / sevenSings().getSevenSignsDawnTicketBundle())) - { + if (ticketCount < (sevenSings().getSevenSignsDawnTicketQuantity() / sevenSings().getSevenSignsDawnTicketBundle())) { final NpcHtmlMessage html = getHtmlPacket(player, npc, "ssq_selldawnticket.html"); html.replace("%DawnTicketLeft%", String.valueOf(sevenSings().getSevenSignsDawnTicketQuantity() - (ticketCount * sevenSings().getSevenSignsDawnTicketBundle()))); html.replace("%DawnTicketBundle%", String.valueOf(sevenSings().getSevenSignsDawnTicketBundle())); html.replace("%DawnTicketPrice%", String.valueOf(sevenSings().getSevenSignsDawnTicketPrice() * sevenSings().getSevenSignsDawnTicketBundle())); player.sendPacket(html); - } - else - { + } else { htmltext = "ssq_notenoughticket.html"; } - } - else - { + } else { htmltext = "ssq_notdawnorevent.html"; } } - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; } - case "manors_cert_confirm": - { - if (npc.isMyLord(player)) - { - if (castle.getSiege().isInProgress()) - { + case "manors_cert_confirm": { + if (npc.isMyLord(player)) { + if (castle.getSiege().isInProgress()) { htmltext = "chamberlain-08.html"; - } - else - { - if ((SevenSigns.getInstance().getPlayerCabal(player.getObjectId()) == SevenSigns.CABAL_DAWN) && SevenSigns.getInstance().isCompetitionPeriod()) - { + } else { + if ((SevenSigns.getInstance().getPlayerCabal(player.getObjectId()) == SevenSigns.CABAL_DAWN) && SevenSigns.getInstance().isCompetitionPeriod()) { final int ticketCount = castle.getTicketBuyCount(); - if (ticketCount < (sevenSings().getSevenSignsDawnTicketQuantity() / sevenSings().getSevenSignsDawnTicketBundle())) - { + if (ticketCount < (sevenSings().getSevenSignsDawnTicketQuantity() / sevenSings().getSevenSignsDawnTicketBundle())) { final long totalCost = sevenSings().getSevenSignsDawnTicketPrice() * sevenSings().getSevenSignsDawnTicketBundle(); - if (player.getAdena() >= totalCost) - { + if (player.getAdena() >= totalCost) { takeItems(player, Inventory.ADENA_ID, totalCost); giveItems(player, sevenSings().getSevenSignsManorsAgreementId(), sevenSings().getSevenSignsDawnTicketBundle()); castle.setTicketBuyCount(ticketCount + 1); - } - else - { + } else { htmltext = "chamberlain-09.html"; } - } - else - { + } else { htmltext = "ssq_notenoughticket.html"; } - } - else - { + } else { htmltext = "ssq_notdawnorevent.html"; } } - } - else - { + } else { htmltext = "chamberlain-21.html"; } break; @@ -1315,8 +1010,7 @@ public final class CastleChamberlain extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return (isOwner(player, npc)) ? "chamberlain-01.html" : "chamberlain-04.html"; } @@ -1325,22 +1019,18 @@ public final class CastleChamberlain extends AbstractNpcAI @RegisterType(ListenerRegisterType.NPC) @Id({35100, 35142, 35184, 35226, 35274, 35316, 35363, 35509, 35555}) // @formatter:on - public final void onNpcManorBypass(OnNpcManorBypass evt) - { + public final void onNpcManorBypass(OnNpcManorBypass evt) { final L2PcInstance player = evt.getActiveChar(); final L2Npc npc = evt.getTarget(); - if (isOwner(player, npc)) - { + if (isOwner(player, npc)) { final CastleManorManager manor = CastleManorManager.getInstance(); - if (manor.isUnderMaintenance()) - { + if (manor.isUnderMaintenance()) { player.sendPacket(SystemMessageId.THE_MANOR_SYSTEM_IS_CURRENTLY_UNDER_MAINTENANCE); return; } final int castleId = (evt.getManorId() == -1) ? npc.getCastle().getResidenceId() : evt.getManorId(); - switch (evt.getRequest()) - { + switch (evt.getRequest()) { case 3: // Seed info player.sendPacket(new ExShowSeedInfo(castleId, evt.isNextPeriod(), true)); break; @@ -1351,16 +1041,14 @@ public final class CastleChamberlain extends AbstractNpcAI player.sendPacket(new ExShowManorDefaultInfo(true)); break; case 7: // Seed settings - if (manor.isManorApproved()) - { + if (manor.isManorApproved()) { player.sendPacket(SystemMessageId.A_MANOR_CANNOT_BE_SET_UP_BETWEEN_4_30_AM_AND_8_PM); return; } player.sendPacket(new ExShowSeedSetting(castleId)); break; case 8: // Crop settings - if (manor.isManorApproved()) - { + if (manor.isManorApproved()) { player.sendPacket(SystemMessageId.A_MANOR_CANNOT_BE_SET_UP_BETWEEN_4_30_AM_AND_8_PM); return; } @@ -1372,8 +1060,7 @@ public final class CastleChamberlain extends AbstractNpcAI } } - public static void main(String[] args) - { + public static void main(String[] args) { new CastleChamberlain(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/CastleCourtMagician/CastleCourtMagician.java b/src/main/java/com/l2jserver/datapack/ai/npc/CastleCourtMagician/CastleCourtMagician.java index b240d1f243..9f3b749591 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/CastleCourtMagician/CastleCourtMagician.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/CastleCourtMagician/CastleCourtMagician.java @@ -29,11 +29,9 @@ import com.l2jserver.gameserver.network.clientpackets.RequestAcquireSkill; * Castle Court Magician AI. * @author St3eT */ -public final class CastleCourtMagician extends AbstractNpcAI -{ +public final class CastleCourtMagician extends AbstractNpcAI { // NPCs - private static final int[] COURT_MAGICIAN = - { + private static final int[] COURT_MAGICIAN = { 35648, // Gludio 35649, // Dion 35650, // Giran @@ -67,8 +65,7 @@ public final class CastleCourtMagician extends AbstractNpcAI private static final int RED_LIFE_FORCE = 10518; // Red Talisman - Life Force private static final int BLUE_GREAT_HEAL = 10424; // Blue Talisman - Greater Healing private static final int WHITE_FIRE = 10421; // White Talisman - Fire - private static final int[] COMMON_TALISMANS = - { + private static final int[] COMMON_TALISMANS = { 9914, // Blue Talisman of Power 9915, // Blue Talisman of Wild Magic 9920, // Blue Talisman of Invisibility @@ -114,8 +111,7 @@ public final class CastleCourtMagician extends AbstractNpcAI 10419, // White Talisman - Darkness }; - private CastleCourtMagician() - { + private CastleCourtMagician() { super(CastleCourtMagician.class.getSimpleName(), "ai/npc"); addStartNpc(COURT_MAGICIAN); addTalkId(COURT_MAGICIAN); @@ -123,121 +119,74 @@ public final class CastleCourtMagician extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if ((player.getClan() == null) && (player.getClanId() != npc.getCastle().getOwnerId())) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if ((player.getClan() == null) && (player.getClanId() != npc.getCastle().getOwnerId())) { return "courtmagician-01.html"; } String htmltext = null; int itemId = 0; - switch (event) - { + switch (event) { case "courtmagician.html": - case "courtmagician-03.html": - { + case "courtmagician-03.html": { htmltext = event; break; } - case "giveTalisman": - { - if (getQuestItemsCount(player, EPAULETTE) < 10) - { + case "giveTalisman": { + if (getQuestItemsCount(player, EPAULETTE) < 10) { htmltext = "courtmagician-06.html"; break; } final int categoryChance = getRandom(100); - if (categoryChance <= 5) - { + if (categoryChance <= 5) { final int chance = getRandom(100); - if (chance <= 25) - { + if (chance <= 25) { itemId = RED_MEDITATION; - } - else if (chance <= 50) - { + } else if (chance <= 50) { itemId = BLUE_DIV_PROTECTION; - } - else if (chance <= 75) - { + } else if (chance <= 75) { itemId = BLUE_EXPLOSION; - } - else - { + } else { itemId = BLUE_M_EXPLOSION; } - } - else if (categoryChance <= 15) - { + } else if (categoryChance <= 15) { final int chance = getRandom(100); - if (chance <= 20) - { + if (chance <= 20) { itemId = RED_MIN_CLARITY; - } - else if (chance <= 40) - { + } else if (chance <= 40) { itemId = RED_MAX_CLARITY; - } - else if (chance <= 60) - { + } else if (chance <= 60) { itemId = RED_MENTAL_REG; - } - else if (chance <= 80) - { + } else if (chance <= 80) { itemId = BLUE_PROTECTION; - } - else - { + } else { itemId = BLUE_INVIS; } - } - else if (categoryChance <= 30) - { + } else if (categoryChance <= 30) { final int chance = getRandom(100); - if (chance <= 12) - { + if (chance <= 12) { itemId = BLUE_DEFENSE; - } - else if (chance <= 25) - { + } else if (chance <= 25) { itemId = BLACK_ESCAPE; - } - else if (chance <= 37) - { + } else if (chance <= 37) { itemId = BLUE_HEALING; - } - else if (chance <= 50) - { + } else if (chance <= 50) { itemId = RED_RECOVERY; - } - else if (chance <= 62) - { + } else if (chance <= 62) { itemId = BLUE_DEFENSE2; - } - else if (chance <= 75) - { + } else if (chance <= 75) { itemId = BLUE_M_DEFENSE; - } - else if (chance <= 87) - { + } else if (chance <= 87) { itemId = RED_LIFE_FORCE; - } - else - { + } else { itemId = BLUE_GREAT_HEAL; } - } - else - { + } else { final int chance = getRandom(46); - if (chance <= 42) - { + if (chance <= 42) { itemId = COMMON_TALISMANS[chance]; - } - else - { + } else { itemId = WHITE_FIRE; } } @@ -246,35 +195,26 @@ public final class CastleCourtMagician extends AbstractNpcAI htmltext = "courtmagician-04.html"; break; } - case "squadSkill": - { - if (player.isClanLeader() || player.hasClanPrivilege(ClanPrivilege.CL_TROOPS_FAME)) - { + case "squadSkill": { + if (player.isClanLeader() || player.hasClanPrivilege(ClanPrivilege.CL_TROOPS_FAME)) { RequestAcquireSkill.showSubUnitSkillList(player); - } - else - { + } else { htmltext = "courtmagician-05.html"; } break; } - case "clanTeleport": - { - if (player.getClanId() == npc.getCastle().getOwnerId()) - { + case "clanTeleport": { + if (player.getClanId() == npc.getCastle().getOwnerId()) { final L2PcInstance clanLeader = player.getClan().getLeader().getPlayerInstance(); - if ((clanLeader != null) && clanLeader.isAffectedBySkill(CLAN_GATE)) - { + if ((clanLeader != null) && clanLeader.isAffectedBySkill(CLAN_GATE)) { if (clanLeader.canSummonTarget(player)) // TODO: Custom one, retail dont check it but for sure lets check same conditions like when summon player by skill. { npc.setTarget(player); npc.doCast(DISPLAY_CLAN_GATE); player.teleToLocation(clanLeader.getLocation(), true); } - } - else - { + } else { htmltext = "courtmagician-02.html"; } } @@ -285,13 +225,11 @@ public final class CastleCourtMagician extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return ((player.getClan() != null) && (player.getClanId() == npc.getCastle().getOwnerId())) ? "courtmagician.html" : "courtmagician-01.html"; } - public static void main(String[] args) - { + public static void main(String[] args) { new CastleCourtMagician(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/CastleMercenaryManager/CastleMercenaryManager.java b/src/main/java/com/l2jserver/datapack/ai/npc/CastleMercenaryManager/CastleMercenaryManager.java index 072096f98c..8ec28e900e 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/CastleMercenaryManager/CastleMercenaryManager.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/CastleMercenaryManager/CastleMercenaryManager.java @@ -34,11 +34,9 @@ import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; * Castle Mercenary Manager AI. * @author malyelfik */ -public final class CastleMercenaryManager extends AbstractNpcAI -{ +public final class CastleMercenaryManager extends AbstractNpcAI { // NPCs - private static final int[] NPCS = - { + private static final int[] NPCS = { 35102, // Greenspan 35144, // Sanford 35186, // Arvid @@ -50,8 +48,7 @@ public final class CastleMercenaryManager extends AbstractNpcAI 35557, // Kendrew }; - private CastleMercenaryManager() - { + private CastleMercenaryManager() { super(CastleMercenaryManager.class.getSimpleName(), "ai/npc"); addStartNpc(NPCS); addTalkId(NPCS); @@ -59,52 +56,38 @@ public final class CastleMercenaryManager extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; final StringTokenizer st = new StringTokenizer(event, " "); - switch (st.nextToken()) - { - case "limit": - { + switch (st.nextToken()) { + case "limit": { final Castle castle = npc.getCastle(); final NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId()); - if (castle.getName().equals("aden")) - { + if (castle.getName().equals("aden")) { html.setHtml(getHtm(player.getHtmlPrefix(), "mercmanager-aden-limit.html")); - } - else if (castle.getName().equals("rune")) - { + } else if (castle.getName().equals("rune")) { html.setHtml(getHtm(player.getHtmlPrefix(), "mercmanager-rune-limit.html")); - } - else - { + } else { html.setHtml(getHtm(player.getHtmlPrefix(), "mercmanager-limit.html")); } html.replace("%feud_name%", String.valueOf(1001000 + castle.getResidenceId())); player.sendPacket(html); break; } - case "buy": - { - if (SevenSigns.getInstance().isSealValidationPeriod()) - { + case "buy": { + if (SevenSigns.getInstance().isSealValidationPeriod()) { final int listId = Integer.parseInt(npc.getId() + st.nextToken()); ((L2MerchantInstance) npc).showBuyWindow(player, listId, false); // NOTE: Not affected by Castle Taxes, baseTax is 20% (done in merchant buylists) - } - else - { + } else { htmltext = "mercmanager-ssq.html"; } break; } - case "main": - { + case "main": { htmltext = onFirstTalk(npc, player); break; } - case "mercmanager-01.html": - { + case "mercmanager-01.html": { htmltext = event; break; } @@ -113,19 +96,13 @@ public final class CastleMercenaryManager extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { final String htmltext; - if (player.canOverrideCond(PcCondOverride.CASTLE_CONDITIONS) || ((player.getClanId() == npc.getCastle().getOwnerId()) && player.hasClanPrivilege(ClanPrivilege.CS_MERCENARIES))) - { - if (npc.getCastle().getSiege().isInProgress()) - { + if (player.canOverrideCond(PcCondOverride.CASTLE_CONDITIONS) || ((player.getClanId() == npc.getCastle().getOwnerId()) && player.hasClanPrivilege(ClanPrivilege.CS_MERCENARIES))) { + if (npc.getCastle().getSiege().isInProgress()) { htmltext = "mercmanager-siege.html"; - } - else - { - switch (SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_STRIFE)) - { + } else { + switch (SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_STRIFE)) { case SevenSigns.CABAL_DUSK: htmltext = "mercmanager-dusk.html"; break; @@ -136,16 +113,13 @@ public final class CastleMercenaryManager extends AbstractNpcAI htmltext = "mercmanager.html"; } } - } - else - { + } else { htmltext = "mercmanager-no.html"; } return htmltext; } - public static void main(String[] args) - { + public static void main(String[] args) { new CastleMercenaryManager(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/CastleSiegeManager/CastleSiegeManager.java b/src/main/java/com/l2jserver/datapack/ai/npc/CastleSiegeManager/CastleSiegeManager.java index 3c0ea05b2a..f4ed6f04e4 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/CastleSiegeManager/CastleSiegeManager.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/CastleSiegeManager/CastleSiegeManager.java @@ -26,11 +26,9 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Castle Siege Manager AI. * @author St3eT */ -public final class CastleSiegeManager extends AbstractNpcAI -{ +public final class CastleSiegeManager extends AbstractNpcAI { // NPCs - private static final int[] SIEGE_MANAGER = - { + private static final int[] SIEGE_MANAGER = { 35104, // Gludio Castle 35146, // Dion Castle 35188, // Giran Castle @@ -44,60 +42,42 @@ public final class CastleSiegeManager extends AbstractNpcAI 35420, // Devastated Castle }; - private CastleSiegeManager() - { + private CastleSiegeManager() { super(CastleSiegeManager.class.getSimpleName(), "ai/npc"); addFirstTalkId(SIEGE_MANAGER); } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; - if (player.isClanLeader() && (player.getClanId() == npc.getCastle().getOwnerId())) - { - if (isInSiege(npc)) - { + if (player.isClanLeader() && (player.getClanId() == npc.getCastle().getOwnerId())) { + if (isInSiege(npc)) { htmltext = "CastleSiegeManager.html"; - } - else - { + } else { htmltext = "CastleSiegeManager-01.html"; } - } - else if (isInSiege(npc)) - { + } else if (isInSiege(npc)) { htmltext = "CastleSiegeManager-02.html"; - } - else - { - if (npc.getConquerableHall() != null) - { + } else { + if (npc.getConquerableHall() != null) { npc.getConquerableHall().showSiegeInfo(player); - } - else - { + } else { npc.getCastle().getSiege().listRegisterClan(player); } } return htmltext; } - private boolean isInSiege(L2Npc npc) - { - if ((npc.getConquerableHall() != null) && npc.getConquerableHall().isInSiege()) - { + private boolean isInSiege(L2Npc npc) { + if ((npc.getConquerableHall() != null) && npc.getConquerableHall().isInSiege()) { return true; - } - else if (npc.getCastle().getSiege().isInProgress()) - { + } else if (npc.getCastle().getSiege().isInProgress()) { return true; } return false; } - public static void main(String[] args) - { + public static void main(String[] args) { new CastleSiegeManager(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/CastleTeleporter/CastleTeleporter.java b/src/main/java/com/l2jserver/datapack/ai/npc/CastleTeleporter/CastleTeleporter.java index 0bfa0c723e..573b82f866 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/CastleTeleporter/CastleTeleporter.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/CastleTeleporter/CastleTeleporter.java @@ -32,11 +32,9 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * Castle Teleporter AI. * @author malyelfik */ -public final class CastleTeleporter extends AbstractNpcAI -{ +public final class CastleTeleporter extends AbstractNpcAI { // Teleporter IDs - private static final int[] NPCS = - { + private static final int[] NPCS = { 35095, // Mass Gatekeeper (Gludio) 35137, // Mass Gatekeeper (Dion) 35179, // Mass Gatekeeper (Giran) @@ -48,8 +46,7 @@ public final class CastleTeleporter extends AbstractNpcAI 35547, // Mass Gatekeeper (Schuttgart) }; - private CastleTeleporter() - { + private CastleTeleporter() { super(CastleTeleporter.class.getSimpleName(), "ai/npc"); addStartNpc(NPCS); addTalkId(NPCS); @@ -57,31 +54,24 @@ public final class CastleTeleporter extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equalsIgnoreCase("teleporter-03.html")) - { - if (npc.isScriptValue(0)) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equalsIgnoreCase("teleporter-03.html")) { + if (npc.isScriptValue(0)) { final Siege siege = npc.getCastle().getSiege(); final int time = (siege.isInProgress() && (siege.getControlTowerCount() == 0)) ? 480000 : 30000; startQuestTimer("teleport", time, npc, null); npc.setScriptValue(1); } return event; - } - else if (event.equalsIgnoreCase("teleport")) - { + } else if (event.equalsIgnoreCase("teleport")) { final int region = MapRegionManager.getInstance().getMapRegionLocId(npc.getX(), npc.getY()); final NpcSay msg = new NpcSay(npc, Say2.NPC_SHOUT, NpcStringId.THE_DEFENDERS_OF_S1_CASTLE_WILL_BE_TELEPORTED_TO_THE_INNER_CASTLE); msg.addStringParameter(npc.getCastle().getName()); npc.getCastle().oustAllPlayers(); npc.setScriptValue(0); // TODO: Is it possible to get all the players for that region, instead of all players? - for (L2PcInstance pl : L2World.getInstance().getPlayers()) - { - if (region == MapRegionManager.getInstance().getMapRegionLocId(pl)) - { + for (L2PcInstance pl : L2World.getInstance().getPlayers()) { + if (region == MapRegionManager.getInstance().getMapRegionLocId(pl)) { pl.sendPacket(msg); } } @@ -90,14 +80,12 @@ public final class CastleTeleporter extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { final Siege siege = npc.getCastle().getSiege(); return (npc.isScriptValue(0)) ? (siege.isInProgress() && (siege.getControlTowerCount() == 0)) ? "teleporter-02.html" : "teleporter-01.html" : "teleporter-03.html"; } - public static void main(String[] args) - { + public static void main(String[] args) { new CastleTeleporter(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/CastleWarehouse/CastleWarehouse.java b/src/main/java/com/l2jserver/datapack/ai/npc/CastleWarehouse/CastleWarehouse.java index e0011b9f07..92712031a0 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/CastleWarehouse/CastleWarehouse.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/CastleWarehouse/CastleWarehouse.java @@ -26,11 +26,9 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Castle Warehouse Keeper AI. * @author malyelfik */ -public final class CastleWarehouse extends AbstractNpcAI -{ +public final class CastleWarehouse extends AbstractNpcAI { // NPCs - private static final int[] NPCS = - { + private static final int[] NPCS = { 35099, // Warehouse Keeper (Gludio) 35141, // Warehouse Keeper (Dion) 35183, // Warehouse Keeper (Giran) @@ -45,8 +43,7 @@ public final class CastleWarehouse extends AbstractNpcAI private static final int BLOOD_OATH = 9910; private static final int BLOOD_ALLIANCE = 9911; - private CastleWarehouse() - { + private CastleWarehouse() { super(CastleWarehouse.class.getSimpleName(), "ai/npc"); addStartNpc(NPCS); addTalkId(NPCS); @@ -54,11 +51,9 @@ public final class CastleWarehouse extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; - switch (event) - { + switch (event) { case "warehouse-01.html": case "warehouse-02.html": case "warehouse-03.html": @@ -67,32 +62,22 @@ public final class CastleWarehouse extends AbstractNpcAI htmltext = (!npc.isMyLord(player)) ? "warehouse-no.html" : getHtm(player.getHtmlPrefix(), "warehouse-04.html").replace("%blood%", Integer.toString(player.getClan().getBloodAllianceCount())); break; case "Receive": - if (!npc.isMyLord(player)) - { + if (!npc.isMyLord(player)) { htmltext = "warehouse-no.html"; - } - else if (player.getClan().getBloodAllianceCount() == 0) - { + } else if (player.getClan().getBloodAllianceCount() == 0) { htmltext = "warehouse-05.html"; - } - else - { + } else { giveItems(player, BLOOD_ALLIANCE, player.getClan().getBloodAllianceCount()); player.getClan().resetBloodAllianceCount(); htmltext = "warehouse-06.html"; } break; case "Exchange": - if (!npc.isMyLord(player)) - { + if (!npc.isMyLord(player)) { htmltext = "warehouse-no.html"; - } - else if (!hasQuestItems(player, BLOOD_ALLIANCE)) - { + } else if (!hasQuestItems(player, BLOOD_ALLIANCE)) { htmltext = "warehouse-08.html"; - } - else - { + } else { takeItems(player, BLOOD_ALLIANCE, 1); giveItems(player, BLOOD_OATH, 30); htmltext = "warehouse-07.html"; @@ -106,13 +91,11 @@ public final class CastleWarehouse extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return "warehouse-01.html"; } - public static void main(String[] args) - { + public static void main(String[] args) { new CastleWarehouse(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/ClanTrader/ClanTrader.java b/src/main/java/com/l2jserver/datapack/ai/npc/ClanTrader/ClanTrader.java index 6e76be6581..92a539633b 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/ClanTrader/ClanTrader.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/ClanTrader/ClanTrader.java @@ -31,11 +31,9 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Clan Trader AI. * @author St3eT */ -public final class ClanTrader extends AbstractNpcAI -{ +public final class ClanTrader extends AbstractNpcAI { // Npc - private static final int[] CLAN_TRADER = - { + private static final int[] CLAN_TRADER = { 32024, // Mulia 32025, // Ilia }; @@ -47,18 +45,15 @@ public final class ClanTrader extends AbstractNpcAI private static final int KNIGHTS_EPAULETTE = 9912; // Knight's Epaulette private static final int KNIGHTS_EPAULETTE_COUNT = 100; // Knight's Epaulette Count - private ClanTrader() - { + private ClanTrader() { super(ClanTrader.class.getSimpleName(), "ai/npc"); addStartNpc(CLAN_TRADER); addTalkId(CLAN_TRADER); addFirstTalkId(CLAN_TRADER); } - private String giveReputation(L2Npc npc, L2PcInstance player, int count, int itemId, int itemCount) - { - if (getQuestItemsCount(player, itemId) >= itemCount) - { + private String giveReputation(L2Npc npc, L2PcInstance player, int count, int itemId, int itemCount) { + if (getQuestItemsCount(player, itemId) >= itemCount) { takeItems(player, itemId, itemCount); player.getClan().addReputationScore(count, true); @@ -71,36 +66,29 @@ public final class ClanTrader extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { + switch (event) { case "32024.html": case "32024-02.html": case "32025.html": - case "32025-02.html": - { + case "32025-02.html": { htmltext = event; break; } - case "repinfo": - { + case "repinfo": { htmltext = (player.getClan().getLevel() > 4) ? npc.getId() + "-02.html" : npc.getId() + "-05.html"; break; } - case "exchange-ba": - { + case "exchange-ba": { htmltext = giveReputation(npc, player, clan().getBloodAlliancePoints(), BLOOD_ALLIANCE, BLOOD_ALLIANCE_COUNT); break; } - case "exchange-bo": - { + case "exchange-bo": { htmltext = giveReputation(npc, player, clan().getBloodOathPoints(), BLOOD_OATH, BLOOD_OATH_COUNT); break; } - case "exchange-ke": - { + case "exchange-ke": { htmltext = giveReputation(npc, player, clan().getKnightsEpaulettePoints(), KNIGHTS_EPAULETTE, KNIGHTS_EPAULETTE_COUNT); break; } @@ -109,17 +97,14 @@ public final class ClanTrader extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { - if (player.isClanLeader() || player.hasClanPrivilege(ClanPrivilege.CL_TROOPS_FAME)) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { + if (player.isClanLeader() || player.hasClanPrivilege(ClanPrivilege.CL_TROOPS_FAME)) { return npc.getId() + ".html"; } return npc.getId() + "-01.html"; } - public static void main(String[] args) - { + public static void main(String[] args) { new ClanTrader(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/ClassMaster/ClassMaster.java b/src/main/java/com/l2jserver/datapack/ai/npc/ClassMaster/ClassMaster.java index 38f91d9b97..32976eeafb 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/ClassMaster/ClassMaster.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/ClassMaster/ClassMaster.java @@ -47,29 +47,25 @@ import com.l2jserver.gameserver.util.StringUtil; * @author Zealar * @since 2.6.0.0 */ -public final class ClassMaster extends AbstractNpcAI -{ +public final class ClassMaster extends AbstractNpcAI { // NPCs private static final int MR_CAT = 31756; private static final int MISS_QUEEN = 31757; // Vars private static final int CUSTOM_EVENT_ID = 1001; - private ClassMaster() - { + private ClassMaster() { super(ClassMaster.class.getSimpleName(), "ai/npc"); addStartNpc(MR_CAT, MISS_QUEEN); addFirstTalkId(MR_CAT, MISS_QUEEN); addTalkId(MR_CAT, MISS_QUEEN); - if (character().alternateClassMaster()) - { + if (character().alternateClassMaster()) { setOnEnterWorld(true); registerTutorialEvent(); registerTutorialQuestionMark(); } - if (character().allowClassMasters()) - { + if (character().allowClassMasters()) { addSpawn(MR_CAT, new Location(147728, 27408, -2198, 16500)); addSpawn(MISS_QUEEN, new Location(147761, 27408, -2198, 16500)); addSpawn(MR_CAT, new Location(148560, -57952, -2974, 53000)); @@ -126,21 +122,17 @@ public final class ClassMaster extends AbstractNpcAI } @Override - public void onTutorialEvent(L2PcInstance player, String command) - { - if (command.startsWith("CO")) - { + public void onTutorialEvent(L2PcInstance player, String command) { + if (command.startsWith("CO")) { onTutorialLink(player, command); } super.onTutorialEvent(player, command); } @Override - public String onEnterWorld(L2PcInstance player) - { + public String onEnterWorld(L2PcInstance player) { showQuestionMark(player); - Containers.Players().addListener(new ConsumerEventListener(Containers.Players(), ON_PLAYER_LEVEL_CHANGED, (OnPlayerLevelChanged event) -> - { + Containers.Players().addListener(new ConsumerEventListener(Containers.Players(), ON_PLAYER_LEVEL_CHANGED, (OnPlayerLevelChanged event) -> { showQuestionMark(event.getActiveChar()); }, this)); @@ -148,102 +140,72 @@ public final class ClassMaster extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.endsWith(".htm")) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.endsWith(".htm")) { return event; } - if (event.startsWith("1stClass")) - { + if (event.startsWith("1stClass")) { showHtmlMenu(player, npc.getObjectId(), 1); - } - else if (event.startsWith("2ndClass")) - { + } else if (event.startsWith("2ndClass")) { showHtmlMenu(player, npc.getObjectId(), 2); - } - else if (event.startsWith("3rdClass")) - { + } else if (event.startsWith("3rdClass")) { showHtmlMenu(player, npc.getObjectId(), 3); - } - else if (event.startsWith("change_class")) - { + } else if (event.startsWith("change_class")) { int val = Integer.parseInt(event.substring(13)); - if (checkAndChangeClass(player, val)) - { + if (checkAndChangeClass(player, val)) { String msg = getHtm(player.getHtmlPrefix(), "ok.htm").replace("%name%", ClassListData.getInstance().getClass(val).getClientCode()); showResult(player, msg); return ""; } - } - else if (event.startsWith("become_noble")) - { - if (!player.isNoble()) - { + } else if (event.startsWith("become_noble")) { + if (!player.isNoble()) { player.setNoble(true); player.sendPacket(new UserInfo(player)); player.sendPacket(new ExBrExtraUserInfo(player)); return "nobleok.htm"; } - } - else if (event.startsWith("learn_skills")) - { + } else if (event.startsWith("learn_skills")) { player.giveAvailableSkills(character().autoLearnForgottenScrollSkills(), true); - } - else if (event.startsWith("increase_clan_level")) - { - if (!player.isClanLeader()) - { + } else if (event.startsWith("increase_clan_level")) { + if (!player.isClanLeader()) { return "noclanleader.htm"; } - if (player.getClan().getLevel() >= 5) - { + if (player.getClan().getLevel() >= 5) { return "noclanlevel.htm"; } player.getClan().changeLevel(5); - } - else - { + } else { _log.warning("Player " + player + " send invalid request [" + event + "]"); } return ""; } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return npc.getId() + ".htm"; } - private void onTutorialLink(L2PcInstance player, String request) - { - if (!character().alternateClassMaster() || (request == null) || !request.startsWith("CO")) - { + private void onTutorialLink(L2PcInstance player, String request) { + if (!character().alternateClassMaster() || (request == null) || !request.startsWith("CO")) { return; } - if (!player.getFloodProtectors().getServerBypass().tryPerformAction("changeclass")) - { + if (!player.getFloodProtectors().getServerBypass().tryPerformAction("changeclass")) { return; } - try - { + try { int val = Integer.parseInt(request.substring(2)); checkAndChangeClass(player, val); - } - catch (NumberFormatException e) - { + } catch (NumberFormatException e) { _log.warning("Player " + player + " send invalid class change request [" + request + "]!"); } player.sendPacket(STATIC_PACKET); } @Override - public String onTutorialQuestionMark(L2PcInstance player, int number) - { - if (!character().alternateClassMaster() || (number != CUSTOM_EVENT_ID)) - { + public String onTutorialQuestionMark(L2PcInstance player, int number) { + if (!character().alternateClassMaster() || (number != CUSTOM_EVENT_ID)) { return ""; } @@ -251,82 +213,59 @@ public final class ClassMaster extends AbstractNpcAI return ""; } - private void showQuestionMark(L2PcInstance player) - { - if (!character().alternateClassMaster()) - { + private void showQuestionMark(L2PcInstance player) { + if (!character().alternateClassMaster()) { return; } final ClassId classId = player.getClassId(); - if (getMinLevel(classId.level()) > player.getLevel()) - { + if (getMinLevel(classId.level()) > player.getLevel()) { return; } - if (!character().getClassMaster().isAllowed(classId.level() + 1)) - { + if (!character().getClassMaster().isAllowed(classId.level() + 1)) { return; } player.sendPacket(new TutorialShowQuestionMark(CUSTOM_EVENT_ID)); } - private void showHtmlMenu(L2PcInstance player, int objectId, int level) - { - if (!character().allowClassMasters()) - { + private void showHtmlMenu(L2PcInstance player, int objectId, int level) { + if (!character().allowClassMasters()) { String msg = getHtm(player.getHtmlPrefix(), "disabled.htm"); showResult(player, msg); return; } - if (!character().getClassMaster().isAllowed(level)) - { + if (!character().getClassMaster().isAllowed(level)) { final NpcHtmlMessage html = new NpcHtmlMessage(objectId); final int jobLevel = player.getClassId().level(); final StringBuilder sb = new StringBuilder(100); sb.append("<html><body>"); - switch (jobLevel) - { + switch (jobLevel) { case 0: - if (character().getClassMaster().isAllowed(1)) - { + if (character().getClassMaster().isAllowed(1)) { sb.append("Come back here when you reached level 20 to change your class.<br>"); - } - else if (character().getClassMaster().isAllowed(2)) - { + } else if (character().getClassMaster().isAllowed(2)) { sb.append("Come back after your first occupation change.<br>"); - } - else if (character().getClassMaster().isAllowed(3)) - { + } else if (character().getClassMaster().isAllowed(3)) { sb.append("Come back after your second occupation change.<br>"); - } - else - { + } else { sb.append("I can't change your occupation.<br>"); } break; case 1: - if (character().getClassMaster().isAllowed(2)) - { + if (character().getClassMaster().isAllowed(2)) { sb.append("Come back here when you reached level 40 to change your class.<br>"); - } - else if (character().getClassMaster().isAllowed(3)) - { + } else if (character().getClassMaster().isAllowed(3)) { sb.append("Come back after your second occupation change.<br>"); - } - else - { + } else { sb.append("I can't change your occupation.<br>"); } break; case 2: - if (character().getClassMaster().isAllowed(3)) - { + if (character().getClassMaster().isAllowed(3)) { sb.append("Come back here when you reached level 76 to change your class.<br>"); - } - else - { + } else { sb.append("I can't change your occupation.<br>"); } break; @@ -342,31 +281,25 @@ public final class ClassMaster extends AbstractNpcAI } final ClassId currentClassId = player.getClassId(); - if (currentClassId.level() >= level) - { + if (currentClassId.level() >= level) { String msg = getHtm(player.getHtmlPrefix(), "nomore.htm"); showResult(player, msg); return; } final int minLevel = getMinLevel(currentClassId.level()); - if ((player.getLevel() >= minLevel) || character().allowEntireTree()) - { + if ((player.getLevel() >= minLevel) || character().allowEntireTree()) { final StringBuilder menu = new StringBuilder(100); - for (ClassId cid : ClassId.values()) - { - if ((cid == ClassId.inspector) && (player.getTotalSubClasses() < 2)) - { + for (ClassId cid : ClassId.values()) { + if ((cid == ClassId.inspector) && (player.getTotalSubClasses() < 2)) { continue; } - if (validateClassId(currentClassId, cid) && (cid.level() == level)) - { + if (validateClassId(currentClassId, cid) && (cid.level() == level)) { StringUtil.append(menu, "<a action=\"bypass -h Quest ClassMaster change_class ", String.valueOf(cid.getId()), "\">", ClassListData.getInstance().getClass(cid).getClientCode(), "</a><br>"); } } - if (menu.length() > 0) - { + if (menu.length() > 0) { String msg = getHtm(player.getHtmlPrefix(), "template.htm").replace("%name%", ClassListData.getInstance().getClass(currentClassId).getClientCode()).replace("%menu%", menu.toString()); showResult(player, msg); return; @@ -377,8 +310,7 @@ public final class ClassMaster extends AbstractNpcAI return; } - if (minLevel < Integer.MAX_VALUE) - { + if (minLevel < Integer.MAX_VALUE) { String msg = getHtm(player.getHtmlPrefix(), "comebacklater.htm").replace("%level%", String.valueOf(minLevel)); showResult(player, msg); return; @@ -387,11 +319,9 @@ public final class ClassMaster extends AbstractNpcAI showResult(player, getHtm(player.getHtmlPrefix(), "nomore.htm")); } - private void showTutorialHtml(L2PcInstance player) - { + private void showTutorialHtml(L2PcInstance player) { final ClassId currentClassId = player.getClassId(); - if ((getMinLevel(currentClassId.level()) > player.getLevel()) && !character().allowEntireTree()) - { + if ((getMinLevel(currentClassId.level()) > player.getLevel()) && !character().allowEntireTree()) { return; } @@ -399,14 +329,11 @@ public final class ClassMaster extends AbstractNpcAI msg = msg.replaceAll("%name%", ClassListData.getInstance().getClass(currentClassId).getEscapedClientCode()); final StringBuilder menu = new StringBuilder(100); - for (ClassId cid : ClassId.values()) - { - if ((cid == ClassId.inspector) && (player.getTotalSubClasses() < 2)) - { + for (ClassId cid : ClassId.values()) { + if ((cid == ClassId.inspector) && (player.getTotalSubClasses() < 2)) { continue; } - if (validateClassId(currentClassId, cid)) - { + if (validateClassId(currentClassId, cid)) { StringUtil.append(menu, "<a action=\"link CO", String.valueOf(cid.getId()), "\">", ClassListData.getInstance().getClass(cid).getEscapedClientCode(), "</a><br>"); } } @@ -416,68 +343,55 @@ public final class ClassMaster extends AbstractNpcAI player.sendPacket(new TutorialShowHtml(msg)); } - private boolean checkAndChangeClass(L2PcInstance player, int val) - { + private boolean checkAndChangeClass(L2PcInstance player, int val) { final ClassId currentClassId = player.getClassId(); - if ((getMinLevel(currentClassId.level()) > player.getLevel()) && !character().allowEntireTree()) - { + if ((getMinLevel(currentClassId.level()) > player.getLevel()) && !character().allowEntireTree()) { return false; } - if (!validateClassId(currentClassId, val)) - { + if (!validateClassId(currentClassId, val)) { return false; } final int newJobLevel = currentClassId.level() + 1; // Weight/Inventory check - if (!character().getClassMaster().getRewardItems(newJobLevel).isEmpty() && !player.isInventoryUnder90(false)) - { + if (!character().getClassMaster().getRewardItems(newJobLevel).isEmpty() && !player.isInventoryUnder90(false)) { player.sendPacket(INVENTORY_LESS_THAN_80_PERCENT); return false; } // check if player have all required items for class transfer - for (ItemHolder holder : character().getClassMaster().getRequireItems(newJobLevel)) - { - if (player.getInventory().getInventoryItemCount(holder.getId(), -1) < holder.getCount()) - { + for (ItemHolder holder : character().getClassMaster().getRequireItems(newJobLevel)) { + if (player.getInventory().getInventoryItemCount(holder.getId(), -1) < holder.getCount()) { player.sendPacket(NOT_ENOUGH_ITEMS); return false; } } // get all required items for class transfer - for (ItemHolder holder : character().getClassMaster().getRequireItems(newJobLevel)) - { - if (!player.destroyItemByItemId("ClassMaster", holder.getId(), holder.getCount(), player, true)) - { + for (ItemHolder holder : character().getClassMaster().getRequireItems(newJobLevel)) { + if (!player.destroyItemByItemId("ClassMaster", holder.getId(), holder.getCount(), player, true)) { return false; } } // reward player with items - for (ItemHolder holder : character().getClassMaster().getRewardItems(newJobLevel)) - { + for (ItemHolder holder : character().getClassMaster().getRewardItems(newJobLevel)) { player.addItem("ClassMaster", holder.getId(), holder.getCount(), player, true); } player.setClassId(val); - if (player.isSubClassActive()) - { + if (player.isSubClassActive()) { player.getSubClasses().get(player.getClassIndex()).setClassId(player.getActiveClass()); - } - else - { + } else { player.setBaseClass(player.getActiveClass()); } player.broadcastUserInfo(); - if (character().getClassMaster().isAllowed(player.getClassId().level() + 1) && character().alternateClassMaster() && (((player.getClassId().level() == 1) && (player.getLevel() >= 40)) || ((player.getClassId().level() == 2) && (player.getLevel() >= 76)))) - { + if (character().getClassMaster().isAllowed(player.getClassId().level() + 1) && character().alternateClassMaster() && (((player.getClassId().level() == 1) && (player.getLevel() >= 40)) || ((player.getClassId().level() == 2) && (player.getLevel() >= 76)))) { showQuestionMark(player); } @@ -488,10 +402,8 @@ public final class ClassMaster extends AbstractNpcAI * @param level - current skillId level (0 - start, 1 - first, etc) * @return minimum player level required for next class transfer */ - private static int getMinLevel(int level) - { - switch (level) - { + private static int getMinLevel(int level) { + switch (level) { case 0: return 20; case 1: @@ -509,8 +421,7 @@ public final class ClassMaster extends AbstractNpcAI * @param val new class index * @return {@code true} if the class ID is valid */ - private static boolean validateClassId(ClassId oldCID, int val) - { + private static boolean validateClassId(ClassId oldCID, int val) { return validateClassId(oldCID, ClassId.getClassId(val)); } @@ -520,20 +431,16 @@ public final class ClassMaster extends AbstractNpcAI * @param newCID new ClassId * @return true if class change is possible */ - private static boolean validateClassId(ClassId oldCID, ClassId newCID) - { + private static boolean validateClassId(ClassId oldCID, ClassId newCID) { return (newCID != null) && (newCID.getRace() != null) && ((oldCID.equals(newCID.getParent()) || (character().allowEntireTree() && newCID.childOf(oldCID)))); } - private static String getRequiredItems(int level) - { - if ((character().getClassMaster().getRequireItems(level) == null) || character().getClassMaster().getRequireItems(level).isEmpty()) - { + private static String getRequiredItems(int level) { + if ((character().getClassMaster().getRequireItems(level) == null) || character().getClassMaster().getRequireItems(level).isEmpty()) { return "<tr><td>none</td></tr>"; } final StringBuilder sb = new StringBuilder(); - for (ItemHolder holder : character().getClassMaster().getRequireItems(level)) - { + for (ItemHolder holder : character().getClassMaster().getRequireItems(level)) { sb.append("<tr><td><font color=\"LEVEL\">"); sb.append(holder.getCount()); sb.append("</font></td><td>"); @@ -543,8 +450,7 @@ public final class ClassMaster extends AbstractNpcAI return sb.toString(); } - public static void main(String[] args) - { + public static void main(String[] args) { new ClassMaster(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Dorian/Dorian.java b/src/main/java/com/l2jserver/datapack/ai/npc/Dorian/Dorian.java index 61636e4078..bab76395f4 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Dorian/Dorian.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Dorian/Dorian.java @@ -31,29 +31,24 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Dorian (Raid Fighter) - Quest AI * @author malyelfik */ -public final class Dorian extends AbstractNpcAI -{ +public final class Dorian extends AbstractNpcAI { // NPC private static final int DORIAN = 25332; // Items private static final int SILVER_CROSS = 7153; private static final int BROKEN_SILVER_CROSS = 7154; - private Dorian() - { + private Dorian() { super(Dorian.class.getSimpleName(), "ai/npc"); addSeeCreatureId(DORIAN); } @Override - public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) - { - if (creature.isPlayer()) - { + public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) { + if (creature.isPlayer()) { final L2PcInstance pl = creature.getActingPlayer(); final QuestState qs = pl.getQuestState(Q00024_InhabitantsOfTheForestOfTheDead.class.getSimpleName()); - if ((qs != null) && qs.isCond(3)) - { + if ((qs != null) && qs.isCond(3)) { takeItems(pl, SILVER_CROSS, -1); giveItems(pl, BROKEN_SILVER_CROSS, 1); qs.setCond(4, true); @@ -63,8 +58,7 @@ public final class Dorian extends AbstractNpcAI return super.onSeeCreature(npc, creature, isSummon); } - public static void main(String[] args) - { + public static void main(String[] args) { new Dorian(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/DragonVortex/DragonVortex.java b/src/main/java/com/l2jserver/datapack/ai/npc/DragonVortex/DragonVortex.java index dfbbe1625b..8917f9d3b8 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/DragonVortex/DragonVortex.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/DragonVortex/DragonVortex.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * @author Adry_85 * @since 2.6.0.0 */ -public final class DragonVortex extends AbstractNpcAI -{ +public final class DragonVortex extends AbstractNpcAI { // NPC private static final int DRAGON_VORTEX = 32871; // Raids @@ -50,8 +49,7 @@ public final class DragonVortex extends AbstractNpcAI private static final Location SPOT_3 = new Location(121637, 113657, -3792); private static final Location SPOT_4 = new Location(109346, 111849, -3040); - private DragonVortex() - { + private DragonVortex() { super(DragonVortex.class.getSimpleName(), "ai/npc"); addStartNpc(DRAGON_VORTEX); addFirstTalkId(DRAGON_VORTEX); @@ -59,68 +57,45 @@ public final class DragonVortex extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { - case "RAIDBOSS": - { - if (hasQuestItems(player, LARGE_DRAGON_BONE)) - { - if (!npc.getVariables().getBoolean(I_QUEST0, false)) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { + case "RAIDBOSS": { + if (hasQuestItems(player, LARGE_DRAGON_BONE)) { + if (!npc.getVariables().getBoolean(I_QUEST0, false)) { takeItems(player, LARGE_DRAGON_BONE, 1); final int random = getRandom(100); int raid = 0; - if (random < 3) - { + if (random < 3) { raid = MUSCLE_BOMBER; - } - else if (random < 8) - { + } else if (random < 8) { raid = SHADOW_SUMMONER; - } - else if (random < 15) - { + } else if (random < 15) { raid = SPIKE_SLASHER; - } - else if (random < 25) - { + } else if (random < 25) { raid = BLACKDAGGER_WING; - } - else if (random < 45) - { + } else if (random < 45) { raid = BLEEDING_FLY; - } - else if (random < 67) - { + } else if (random < 67) { raid = DUST_RIDER; - } - else - { + } else { raid = EMERALD_HORN; } Location LOC = null; - switch (npc.getX()) - { - case 92225: - { + switch (npc.getX()) { + case 92225: { LOC = SPOT_1; break; } - case 110116: - { + case 110116: { LOC = SPOT_2; break; } - case 121172: - { + case 121172: { LOC = SPOT_3; break; } - case 108924: - { + case 108924: { LOC = SPOT_4; break; } @@ -129,20 +104,15 @@ public final class DragonVortex extends AbstractNpcAI npc.getVariables().set(I_QUEST0, true); addSpawn(raid, LOC, false, 0, true); startQuestTimer("CANSPAWN", 60000, npc, null); - } - else - { + } else { return "32871-02.html"; } - } - else - { + } else { return "32871-01.html"; } break; } - case "CANSPAWN": - { + case "CANSPAWN": { npc.getVariables().set(I_QUEST0, false); break; } @@ -150,8 +120,7 @@ public final class DragonVortex extends AbstractNpcAI return super.onAdvEvent(event, npc, player); } - public static void main(String[] args) - { + public static void main(String[] args) { new DragonVortex(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/EchoCrystals/EchoCrystals.java b/src/main/java/com/l2jserver/datapack/ai/npc/EchoCrystals/EchoCrystals.java index d4f76255e9..5d7a17b5b2 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/EchoCrystals/EchoCrystals.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/EchoCrystals/EchoCrystals.java @@ -31,54 +31,45 @@ import com.l2jserver.gameserver.model.itemcontainer.Inventory; * @author Plim, Adry_85 * @since 2.6.0.0 */ -public final class EchoCrystals extends AbstractNpcAI -{ - private static final class RewardInfo - { +public final class EchoCrystals extends AbstractNpcAI { + private static final class RewardInfo { public final int _crystalId; public final String _okMsg; public final String _noAdenaMsg; public final String _noScoreMsg; - public RewardInfo(int crystalId, String okMsg, String noAdenaMsg, String noScoreMsg) - { + public RewardInfo(int crystalId, String okMsg, String noAdenaMsg, String noScoreMsg) { _crystalId = crystalId; _okMsg = okMsg; _noAdenaMsg = noAdenaMsg; _noScoreMsg = noScoreMsg; } - public int getCrystalId() - { + public int getCrystalId() { return _crystalId; } - public String getOkMsg() - { + public String getOkMsg() { return _okMsg; } - public String getNoAdenaMsg() - { + public String getNoAdenaMsg() { return _noAdenaMsg; } - public String getNoScoreMsg() - { + public String getNoScoreMsg() { return _noScoreMsg; } } // NPCs - private final static int[] NPCs = - { + private final static int[] NPCs = { 31042, // Kantabilon 31043, // Octavia }; private static final Map<Integer, RewardInfo> SCORES = new HashMap<>(); - static - { + static { SCORES.put(4410, new RewardInfo(4411, "01", "02", "03")); SCORES.put(4409, new RewardInfo(4412, "04", "05", "06")); SCORES.put(4408, new RewardInfo(4413, "07", "08", "09")); @@ -88,30 +79,22 @@ public final class EchoCrystals extends AbstractNpcAI SCORES.put(4418, new RewardInfo(4416, "17", "02", "03")); } - private EchoCrystals() - { + private EchoCrystals() { super(EchoCrystals.class.getSimpleName(), "ai/npc"); addStartNpc(NPCs); addTalkId(NPCs); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; final int score = Integer.valueOf(event); - if (SCORES.containsKey(score)) - { - if (!hasQuestItems(player, score)) - { + if (SCORES.containsKey(score)) { + if (!hasQuestItems(player, score)) { htmltext = npc.getId() + "-" + SCORES.get(score).getNoScoreMsg() + ".htm"; - } - else if (player.getAdena() < 200) - { + } else if (player.getAdena() < 200) { htmltext = npc.getId() + "-" + SCORES.get(score).getNoAdenaMsg() + ".htm"; - } - else - { + } else { takeItems(player, Inventory.ADENA_ID, 200); giveItems(player, SCORES.get(score).getCrystalId(), 1); htmltext = npc.getId() + "-" + SCORES.get(score).getOkMsg() + ".htm"; @@ -120,8 +103,7 @@ public final class EchoCrystals extends AbstractNpcAI return htmltext; } - public static void main(String[] args) - { + public static void main(String[] args) { new EchoCrystals(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/FameManager/FameManager.java b/src/main/java/com/l2jserver/datapack/ai/npc/FameManager/FameManager.java index 6dbfda52f6..4908e2ee65 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/FameManager/FameManager.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/FameManager/FameManager.java @@ -28,11 +28,9 @@ import com.l2jserver.gameserver.network.serverpackets.UserInfo; * Fame Manager AI. * @author St3eT */ -public final class FameManager extends AbstractNpcAI -{ +public final class FameManager extends AbstractNpcAI { // Npc - private static final int[] FAME_MANAGER = - { + private static final int[] FAME_MANAGER = { 36479, // Rapidus 36480, // Scipio }; @@ -43,8 +41,7 @@ public final class FameManager extends AbstractNpcAI private static final int MIN_CLAN_LVL = 5; private static final int CLASS_LVL = 2; - private FameManager() - { + private FameManager() { super(FameManager.class.getSimpleName(), "ai/npc"); addStartNpc(FAME_MANAGER); addTalkId(FAME_MANAGER); @@ -52,62 +49,45 @@ public final class FameManager extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { + switch (event) { case "36479.html": case "36479-02.html": case "36479-07.html": case "36480.html": case "36480-02.html": - case "36480-07.html": - { + case "36480-07.html": { htmltext = event; break; } - case "decreasePk": - { - if (player.getPkKills() > 0) - { - if ((player.getFame() >= DECREASE_COST) && (player.getLevel() >= MIN_LVL) && (player.getClassId().level() >= CLASS_LVL)) - { + case "decreasePk": { + if (player.getPkKills() > 0) { + if ((player.getFame() >= DECREASE_COST) && (player.getLevel() >= MIN_LVL) && (player.getClassId().level() >= CLASS_LVL)) { player.setFame(player.getFame() - DECREASE_COST); player.setPkKills(player.getPkKills() - 1); player.sendPacket(new UserInfo(player)); htmltext = npc.getId() + "-06.html"; - } - else - { + } else { htmltext = npc.getId() + "-01.html"; } - } - else - { + } else { htmltext = npc.getId() + "-05.html"; } break; } - case "clanRep": - { - if ((player.getClan() != null) && (player.getClan().getLevel() >= MIN_CLAN_LVL)) - { - if ((player.getFame() >= REPUTATION_COST) && (player.getLevel() >= MIN_LVL) && (player.getClassId().level() >= CLASS_LVL)) - { + case "clanRep": { + if ((player.getClan() != null) && (player.getClan().getLevel() >= MIN_CLAN_LVL)) { + if ((player.getFame() >= REPUTATION_COST) && (player.getLevel() >= MIN_LVL) && (player.getClassId().level() >= CLASS_LVL)) { player.setFame(player.getFame() - REPUTATION_COST); player.getClan().addReputationScore(50, true); player.sendPacket(new UserInfo(player)); player.sendPacket(SystemMessageId.ACQUIRED_50_CLAN_FAME_POINTS); htmltext = npc.getId() + "-04.html"; - } - else - { + } else { htmltext = npc.getId() + "-01.html"; } - } - else - { + } else { htmltext = npc.getId() + "-03.html"; } break; @@ -117,13 +97,11 @@ public final class FameManager extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return ((player.getFame() > 0) && (player.getLevel() >= MIN_LVL) && (player.getClassId().level() >= CLASS_LVL)) ? npc.getId() + ".html" : npc.getId() + "-01.html"; } - public static void main(String[] args) - { + public static void main(String[] args) { new FameManager(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Fisherman/Fisherman.java b/src/main/java/com/l2jserver/datapack/ai/npc/Fisherman/Fisherman.java index f1776da153..585f1f1af3 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Fisherman/Fisherman.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Fisherman/Fisherman.java @@ -39,11 +39,9 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * @author Adry_85 * @since 2.6.0.0 */ -public class Fisherman extends AbstractNpcAI -{ +public class Fisherman extends AbstractNpcAI { // NPC - private static final int[] FISHERMAN = - { + private static final int[] FISHERMAN = { 31562, 31563, 31564, @@ -69,8 +67,7 @@ public class Fisherman extends AbstractNpcAI 32348 }; - public Fisherman() - { + public Fisherman() { super(Fisherman.class.getSimpleName(), "ai/npc"); addStartNpc(FISHERMAN); addTalkId(FISHERMAN); @@ -78,23 +75,18 @@ public class Fisherman extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { - case "LearnFishSkill": - { + switch (event) { + case "LearnFishSkill": { showFishSkillList(player); break; } - case "fishing_championship.htm": - { + case "fishing_championship.htm": { htmltext = event; break; } - case "BuySellRefund": - { + case "BuySellRefund": { ((L2MerchantInstance) npc).showBuyWindow(player, npc.getId() * 100, true); break; } @@ -103,10 +95,8 @@ public class Fisherman extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { - if ((player.getKarma() > 0) && !character().karmaPlayerCanShop()) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { + if ((player.getKarma() > 0) && !character().karmaPlayerCanShop()) { return npc.getId() + "-pk.htm"; } return npc.getId() + ".htm"; @@ -116,43 +106,33 @@ public class Fisherman extends AbstractNpcAI * Display the Fishing Skill list to the player. * @param player the player */ - public static void showFishSkillList(L2PcInstance player) - { + public static void showFishSkillList(L2PcInstance player) { final List<L2SkillLearn> fishskills = SkillTreesData.getInstance().getAvailableFishingSkills(player); final AcquireSkillList asl = new AcquireSkillList(AcquireSkillType.FISHING); int count = 0; - for (L2SkillLearn s : fishskills) - { - if (SkillData.getInstance().getSkill(s.getSkillId(), s.getSkillLevel()) != null) - { + for (L2SkillLearn s : fishskills) { + if (SkillData.getInstance().getSkill(s.getSkillId(), s.getSkillLevel()) != null) { count++; asl.addSkill(s.getSkillId(), s.getSkillLevel(), s.getSkillLevel(), s.getLevelUpSp(), 1); } } - if (count > 0) - { + if (count > 0) { player.sendPacket(asl); - } - else - { + } else { final int minlLevel = SkillTreesData.getInstance().getMinLevelForNewSkill(player, SkillTreesData.getInstance().getFishingSkillTree()); - if (minlLevel > 0) - { + if (minlLevel > 0) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.DO_NOT_HAVE_FURTHER_SKILLS_TO_LEARN_S1); sm.addInt(minlLevel); player.sendPacket(sm); - } - else - { + } else { player.sendPacket(SystemMessageId.NO_MORE_SKILLS_TO_LEARN); } } } - public static void main(String[] args) - { + public static void main(String[] args) { new Fisherman(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/ForgeOfTheGods/ForgeOfTheGods.java b/src/main/java/com/l2jserver/datapack/ai/npc/ForgeOfTheGods/ForgeOfTheGods.java index d8c9f73f7d..b33212d85a 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/ForgeOfTheGods/ForgeOfTheGods.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/ForgeOfTheGods/ForgeOfTheGods.java @@ -28,11 +28,9 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Forge of the Gods AI * @author nonom, malyelfik */ -public final class ForgeOfTheGods extends AbstractNpcAI -{ +public final class ForgeOfTheGods extends AbstractNpcAI { // NPCs - private static final int[] FOG_MOBS = - { + private static final int[] FOG_MOBS = { 22634, // Scarlet Stakato Worker 22635, // Scarlet Stakato Soldier 22636, // Scarlet Stakato Noble @@ -51,8 +49,7 @@ public final class ForgeOfTheGods extends AbstractNpcAI 22649, // Magma Drake }; - private static final int[] LAVASAURUSES = - { + private static final int[] LAVASAURUSES = { 18799, // Newborn Lavasaurus 18800, // Fledgling Lavasaurus 18801, // Adult Lavasaurus @@ -81,8 +78,7 @@ public final class ForgeOfTheGods extends AbstractNpcAI // private static int _npcsAlive = 0; TODO: Require zone spawn support - private ForgeOfTheGods() - { + private ForgeOfTheGods() { super(ForgeOfTheGods.class.getSimpleName(), "ai/npc"); addKillId(FOG_MOBS); addSpawnId(LAVASAURUSES); @@ -90,13 +86,10 @@ public final class ForgeOfTheGods extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { case "suicide": - if (npc != null) - { + if (npc != null) { npc.doDie(null); } break; @@ -108,8 +101,7 @@ public final class ForgeOfTheGods extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { int rand = getRandom(100); L2Npc mob = null; _npcCount++; @@ -117,53 +109,33 @@ public final class ForgeOfTheGods extends AbstractNpcAI // For monsters at Forge of the Gods - Lower level if (npc.getSpawn().getZ() < -5000) // && (_npcsAlive < 48)) { - if ((_npcCount > BONUS_LOWER_LV03) && (rand <= FORGE_BONUS02)) - { + if ((_npcCount > BONUS_LOWER_LV03) && (rand <= FORGE_BONUS02)) { mob = addSpawn(LAVASAURUSES[4], npc, true); - } - else if (_npcCount > BONUS_LOWER_LV02) - { + } else if (_npcCount > BONUS_LOWER_LV02) { mob = spawnLavasaurus(npc, rand, LAVASAURUSES[4], LAVASAURUSES[3]); - } - else if (_npcCount > BONUS_LOWER_LV01) - { + } else if (_npcCount > BONUS_LOWER_LV01) { mob = spawnLavasaurus(npc, rand, LAVASAURUSES[3], LAVASAURUSES[2]); - } - else if (_npcCount >= MOBCOUNT_BONUS_MIN) - { + } else if (_npcCount >= MOBCOUNT_BONUS_MIN) { mob = spawnLavasaurus(npc, rand, LAVASAURUSES[2], LAVASAURUSES[1]); } - } - else + } else // if (_npcsAlive < 32) { - if ((_npcCount > BONUS_UPPER_LV05) && (rand <= FORGE_BONUS02)) - { + if ((_npcCount > BONUS_UPPER_LV05) && (rand <= FORGE_BONUS02)) { mob = addSpawn(LAVASAURUSES[1], npc, true); - } - else if (_npcCount > BONUS_UPPER_LV04) - { + } else if (_npcCount > BONUS_UPPER_LV04) { mob = spawnLavasaurus(npc, rand, LAVASAURUSES[4], LAVASAURUSES[3]); - } - else if (_npcCount > BONUS_UPPER_LV03) - { + } else if (_npcCount > BONUS_UPPER_LV03) { mob = spawnLavasaurus(npc, rand, LAVASAURUSES[3], LAVASAURUSES[2]); - } - else if (_npcCount > BONUS_UPPER_LV02) - { + } else if (_npcCount > BONUS_UPPER_LV02) { mob = spawnLavasaurus(npc, rand, LAVASAURUSES[2], LAVASAURUSES[1]); - } - else if (_npcCount > BONUS_UPPER_LV01) - { + } else if (_npcCount > BONUS_UPPER_LV01) { mob = spawnLavasaurus(npc, rand, LAVASAURUSES[1], LAVASAURUSES[0]); - } - else if ((_npcCount >= MOBCOUNT_BONUS_MIN) && (rand <= FORGE_BONUS01)) - { + } else if ((_npcCount >= MOBCOUNT_BONUS_MIN) && (rand <= FORGE_BONUS01)) { mob = addSpawn(LAVASAURUSES[0], npc, true); } } - if (mob != null) - { + if (mob != null) { ((L2Attackable) mob).addDamageHate(killer, 0, 9999); mob.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK); } @@ -171,33 +143,26 @@ public final class ForgeOfTheGods extends AbstractNpcAI } @Override - public final String onSpawn(L2Npc npc) - { + public final String onSpawn(L2Npc npc) { startQuestTimer("suicide", 60000, npc, null); return super.onSpawn(npc); } - private L2Npc spawnLavasaurus(L2Npc npc, int rand, int... mobs) - { - if (mobs.length < 2) - { + private L2Npc spawnLavasaurus(L2Npc npc, int rand, int... mobs) { + if (mobs.length < 2) { return null; } L2Npc mob = null; - if (rand <= FORGE_BONUS01) - { + if (rand <= FORGE_BONUS01) { mob = addSpawn(mobs[0], npc, true); - } - else if (rand <= FORGE_BONUS02) - { + } else if (rand <= FORGE_BONUS02) { mob = addSpawn(mobs[1], npc, true); } return mob; } - public static void main(String[] args) - { + public static void main(String[] args) { new ForgeOfTheGods(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/ForgeOfTheGods/Rooney.java b/src/main/java/com/l2jserver/datapack/ai/npc/ForgeOfTheGods/Rooney.java index e189e80a34..f96774d8c2 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/ForgeOfTheGods/Rooney.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/ForgeOfTheGods/Rooney.java @@ -30,13 +30,11 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Rooney AI * @author malyelfik, Adry_85 */ -public final class Rooney extends AbstractNpcAI -{ +public final class Rooney extends AbstractNpcAI { // NPC private static final int ROONEY = 32049; // Locations - private static final Location[] LOCATIONS = - { + private static final Location[] LOCATIONS = { new Location(179221, -115743, -3600), new Location(177668, -118775, -4080), new Location(179906, -108469, -5832), @@ -46,57 +44,44 @@ public final class Rooney extends AbstractNpcAI new Location(186418, -112998, -3272) }; - private Rooney() - { + private Rooney() { super(Rooney.class.getSimpleName(), "ai/npc"); addSeeCreatureId(ROONEY); addSpawn(ROONEY, LOCATIONS[getRandom(LOCATIONS.length)], false, 0); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { - case "teleport": - { - if (!npc.isDecayed()) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { + case "teleport": { + if (!npc.isDecayed()) { npc.setScriptValue(0); } break; } - case "message1": - { - if (!npc.isDecayed()) - { + case "message1": { + if (!npc.isDecayed()) { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.HURRY_HURRY); startQuestTimer("message2", 60000, npc, null); } break; } - case "message2": - { - if (!npc.isDecayed()) - { + case "message2": { + if (!npc.isDecayed()) { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.I_AM_NOT_THAT_TYPE_OF_PERSON_WHO_STAYS_IN_ONE_PLACE_FOR_A_LONG_TIME); startQuestTimer("message3", 60000, npc, null); } break; } - case "message3": - { - if (!npc.isDecayed()) - { + case "message3": { + if (!npc.isDecayed()) { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.ITS_HARD_FOR_ME_TO_KEEP_STANDING_LIKE_THIS); startQuestTimer("message4", 60000, npc, null); } break; } - case "message4": - { - if (!npc.isDecayed()) - { + case "message4": { + if (!npc.isDecayed()) { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.WHY_DONT_I_GO_THAT_WAY_THIS_TIME); } break; @@ -106,10 +91,8 @@ public final class Rooney extends AbstractNpcAI } @Override - public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) - { - if (creature.isPlayer() && npc.isScriptValue(0)) - { + public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) { + if (creature.isPlayer() && npc.isScriptValue(0)) { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.WELCOME); startQuestTimer("teleport", 3600000, npc, null); startQuestTimer("message1", 60000, npc, null); @@ -118,8 +101,7 @@ public final class Rooney extends AbstractNpcAI return super.onSeeCreature(npc, creature, isSummon); } - public static void main(String[] args) - { + public static void main(String[] args) { new Rooney(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/ForgeOfTheGods/TarBeetle.java b/src/main/java/com/l2jserver/datapack/ai/npc/ForgeOfTheGods/TarBeetle.java index 2d4cce6394..bd59159978 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/ForgeOfTheGods/TarBeetle.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/ForgeOfTheGods/TarBeetle.java @@ -29,14 +29,12 @@ import com.l2jserver.gameserver.model.skills.Skill; * Tar Beetle AI * @author nonom, malyelfik */ -public final class TarBeetle extends AbstractNpcAI -{ +public final class TarBeetle extends AbstractNpcAI { // NPC private static final int TAR_BEETLE = 18804; // Skills private static final int TAR_SPITE = 6142; - private static SkillHolder[] SKILLS = - { + private static SkillHolder[] SKILLS = { new SkillHolder(TAR_SPITE, 1), new SkillHolder(TAR_SPITE, 2), new SkillHolder(TAR_SPITE, 3) @@ -44,25 +42,20 @@ public final class TarBeetle extends AbstractNpcAI private static final TarBeetleSpawn spawn = new TarBeetleSpawn(); - private TarBeetle() - { + private TarBeetle() { super(TarBeetle.class.getSimpleName(), "ai/npc"); addAggroRangeEnterId(TAR_BEETLE); addSpellFinishedId(TAR_BEETLE); } @Override - public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) - { - if (npc.getScriptValue() > 0) - { + public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) { + if (npc.getScriptValue() > 0) { final BuffInfo info = player.getEffectList().getBuffInfoBySkillId(TAR_SPITE); final int level = (info != null) ? info.getSkill().getAbnormalLvl() : 0; - if (level < 3) - { + if (level < 3) { final Skill skill = SKILLS[level].getSkill(); - if (!npc.isSkillDisabled(skill)) - { + if (!npc.isSkillDisabled(skill)) { npc.setTarget(player); npc.doCast(skill); } @@ -72,17 +65,12 @@ public final class TarBeetle extends AbstractNpcAI } @Override - public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) - { - if ((skill != null) && (skill.getId() == TAR_SPITE)) - { + public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) { + if ((skill != null) && (skill.getId() == TAR_SPITE)) { final int val = npc.getScriptValue() - 1; - if ((val <= 0) || (SKILLS[0].getSkill().getMpConsume2() > npc.getCurrentMp())) - { + if ((val <= 0) || (SKILLS[0].getSkill().getMpConsume2() > npc.getCurrentMp())) { spawn.removeBeetle(npc); - } - else - { + } else { npc.setScriptValue(val); } } @@ -90,14 +78,12 @@ public final class TarBeetle extends AbstractNpcAI } @Override - public boolean unload() - { + public boolean unload() { spawn.unload(); return super.unload(); } - public static void main(String[] args) - { + public static void main(String[] args) { new TarBeetle(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/ForgeOfTheGods/TarBeetleSpawn.java b/src/main/java/com/l2jserver/datapack/ai/npc/ForgeOfTheGods/TarBeetleSpawn.java index a4eab64d94..fecb34f8bd 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/ForgeOfTheGods/TarBeetleSpawn.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/ForgeOfTheGods/TarBeetleSpawn.java @@ -40,69 +40,52 @@ import com.l2jserver.gameserver.util.IXmlReader; * Tar Beetle zone spawn * @author malyelfik */ -public class TarBeetleSpawn implements IXmlReader -{ +public class TarBeetleSpawn implements IXmlReader { private final List<SpawnZone> zones = new ArrayList<>(); private ScheduledFuture<?> spawnTask; private ScheduledFuture<?> shotTask; - public TarBeetleSpawn() - { + public TarBeetleSpawn() { load(); } @Override - public void load() - { + public void load() { parseDatapackFile("data/spawnZones/tar_beetle.xml"); - if (!zones.isEmpty()) - { + if (!zones.isEmpty()) { spawnTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(() -> zones.forEach(SpawnZone::refreshSpawn), 1000, 60000); shotTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(() -> zones.forEach(SpawnZone::refreshShots), 300000, 300000); } } @Override - public void parseDocument(Document doc) - { + public void parseDocument(Document doc) { int i = 0; - for (Node d = doc.getFirstChild(); d != null; d = d.getNextSibling()) - { - if (d.getNodeName().equals("list")) - { - for (Node r = d.getFirstChild(); r != null; r = r.getNextSibling()) - { - if (r.getNodeName().equals("spawnZone")) - { + for (Node d = doc.getFirstChild(); d != null; d = d.getNextSibling()) { + if (d.getNodeName().equals("list")) { + for (Node r = d.getFirstChild(); r != null; r = r.getNextSibling()) { + if (r.getNodeName().equals("spawnZone")) { NamedNodeMap attrs = r.getAttributes(); final int npcCount = parseInteger(attrs, "maxNpcCount"); final SpawnZone sp = new SpawnZone(npcCount, i); - for (Node b = r.getFirstChild(); b != null; b = b.getNextSibling()) - { - if (b.getNodeName().equals("zone")) - { + for (Node b = r.getFirstChild(); b != null; b = b.getNextSibling()) { + if (b.getNodeName().equals("zone")) { attrs = b.getAttributes(); final int minZ = parseInteger(attrs, "minZ"); final int maxZ = parseInteger(attrs, "maxZ"); final Zone zone = new Zone(); - for (Node c = b.getFirstChild(); c != null; c = c.getNextSibling()) - { + for (Node c = b.getFirstChild(); c != null; c = c.getNextSibling()) { attrs = c.getAttributes(); - if (c.getNodeName().equals("point")) - { + if (c.getNodeName().equals("point")) { final int x = parseInteger(attrs, "x"); final int y = parseInteger(attrs, "y"); zone.add(x, y, minZ, maxZ, 0); - } - else if (c.getNodeName().equals("bannedZone")) - { + } else if (c.getNodeName().equals("bannedZone")) { final Zone bannedZone = new Zone(); final int bMinZ = parseInteger(attrs, "minZ"); final int bMaxZ = parseInteger(attrs, "maxZ"); - for (Node f = c.getFirstChild(); f != null; f = f.getNextSibling()) - { - if (f.getNodeName().equals("point")) - { + for (Node f = c.getFirstChild(); f != null; f = f.getNextSibling()) { + if (f.getNodeName().equals("point")) { attrs = f.getAttributes(); int x = parseInteger(attrs, "x"); int y = parseInteger(attrs, "y"); @@ -122,63 +105,49 @@ public class TarBeetleSpawn implements IXmlReader } } - public final void unload() - { - if (spawnTask != null) - { + public final void unload() { + if (spawnTask != null) { spawnTask.cancel(false); } - if (shotTask != null) - { + if (shotTask != null) { shotTask.cancel(false); } zones.forEach(SpawnZone::unload); zones.clear(); } - public final void removeBeetle(L2Npc npc) - { + public final void removeBeetle(L2Npc npc) { zones.get(npc.getVariables().getInt("zoneIndex", 0)).removeSpawn(npc); npc.deleteMe(); } - private final class Zone extends L2Territory - { + private final class Zone extends L2Territory { private List<Zone> _bannedZones; - public Zone() - { + public Zone() { super(1); } @Override - public Location getRandomPoint() - { + public Location getRandomPoint() { Location location = super.getRandomPoint(); - while ((location != null) && isInsideBannedZone(location)) - { + while ((location != null) && isInsideBannedZone(location)) { location = super.getRandomPoint(); } return location; } - public final void addBannedZone(Zone bZone) - { - if (_bannedZones == null) - { + public final void addBannedZone(Zone bZone) { + if (_bannedZones == null) { _bannedZones = new ArrayList<>(); } _bannedZones.add(bZone); } - private final boolean isInsideBannedZone(Location location) - { - if (_bannedZones != null) - { - for (Zone z : _bannedZones) - { - if (z.isInside(location.getX(), location.getY())) - { + private final boolean isInsideBannedZone(Location location) { + if (_bannedZones != null) { + for (Zone z : _bannedZones) { + if (z.isInside(location.getX(), location.getY())) { return true; } } @@ -187,45 +156,36 @@ public class TarBeetleSpawn implements IXmlReader } } - private final class SpawnZone - { + private final class SpawnZone { private final List<Zone> _zones = new ArrayList<>(); private final List<L2Npc> _spawn = new CopyOnWriteArrayList<>(); private final int _maxNpcCount; private final int _index; - public SpawnZone(int maxNpcCount, int index) - { + public SpawnZone(int maxNpcCount, int index) { _maxNpcCount = maxNpcCount; _index = index; } - public final void addZone(Zone zone) - { + public final void addZone(Zone zone) { _zones.add(zone); } - public final void removeSpawn(L2Npc obj) - { + public final void removeSpawn(L2Npc obj) { _spawn.remove(obj); } - public final void unload() - { + public final void unload() { _spawn.forEach(L2Npc::deleteMe); _spawn.clear(); _zones.clear(); } - public final void refreshSpawn() - { - try - { - while (_spawn.size() < _maxNpcCount) - { + public final void refreshSpawn() { + try { + while (_spawn.size() < _maxNpcCount) { final Location location = _zones.get(Rnd.get(_zones.size())).getRandomPoint(); - if (location != null) - { + if (location != null) { final L2Spawn spawn = new L2Spawn(18804); spawn.setHeading(Rnd.get(65535)); spawn.setX(location.getX()); @@ -242,27 +202,19 @@ public class TarBeetleSpawn implements IXmlReader _spawn.add(npc); } } - } - catch (Exception e) - { + } catch (Exception e) { LOG.warn("{}: Could not refresh spawns!", getClass().getSimpleName(), e); } } - public final void refreshShots() - { - if (_spawn.size() > 0) - { - for (L2Npc npc : _spawn) - { + public final void refreshShots() { + if (_spawn.size() > 0) { + for (L2Npc npc : _spawn) { final int val = npc.getScriptValue(); - if (val == 5) - { + if (val == 5) { npc.deleteMe(); _spawn.remove(npc); - } - else - { + } else { npc.setScriptValue(val + 1); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/FortressArcherCaptain/FortressArcherCaptain.java b/src/main/java/com/l2jserver/datapack/ai/npc/FortressArcherCaptain/FortressArcherCaptain.java index 240845e8fa..00f843662d 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/FortressArcherCaptain/FortressArcherCaptain.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/FortressArcherCaptain/FortressArcherCaptain.java @@ -26,11 +26,9 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Fortress Archer Captain AI. * @author St3eT */ -public final class FortressArcherCaptain extends AbstractNpcAI -{ +public final class FortressArcherCaptain extends AbstractNpcAI { // NPCs - private static final int[] ARCHER_CAPTAIN = - { + private static final int[] ARCHER_CAPTAIN = { 35661, // Shanty Fortress 35692, // Southern Fortress 35730, // Hive Fortress @@ -54,22 +52,19 @@ public final class FortressArcherCaptain extends AbstractNpcAI 36358, // Monastic Fortress }; - private FortressArcherCaptain() - { + private FortressArcherCaptain() { super(FortressArcherCaptain.class.getSimpleName(), "ai/npc"); addStartNpc(ARCHER_CAPTAIN); addFirstTalkId(ARCHER_CAPTAIN); } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { final int fortOwner = npc.getFort().getOwnerClan() == null ? 0 : npc.getFort().getOwnerClan().getId(); return ((player.getClan() != null) && (player.getClanId() == fortOwner)) ? "FortressArcherCaptain.html" : "FortressArcherCaptain-01.html"; } - public static void main(String[] args) - { + public static void main(String[] args) { new FortressArcherCaptain(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/FortressSiegeManager/FortressSiegeManager.java b/src/main/java/com/l2jserver/datapack/ai/npc/FortressSiegeManager/FortressSiegeManager.java index 749a05b1d3..6a599e18e2 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/FortressSiegeManager/FortressSiegeManager.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/FortressSiegeManager/FortressSiegeManager.java @@ -36,11 +36,9 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Fortress Siege Manager AI. * @author St3eT */ -public final class FortressSiegeManager extends AbstractNpcAI -{ +public final class FortressSiegeManager extends AbstractNpcAI { // NPCs - private static final int[] MANAGERS = - { + private static final int[] MANAGERS = { 35659, // Shanty Fortress 35690, // Southern Fortress 35728, // Hive Fortress @@ -64,8 +62,7 @@ public final class FortressSiegeManager extends AbstractNpcAI 36356, // Monastic Fortress }; - private FortressSiegeManager() - { + private FortressSiegeManager() { super(FortressSiegeManager.class.getSimpleName(), "ai/npc"); addStartNpc(MANAGERS); addTalkId(MANAGERS); @@ -73,79 +70,54 @@ public final class FortressSiegeManager extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { + switch (event) { case "FortressSiegeManager-11.html": case "FortressSiegeManager-13.html": case "FortressSiegeManager-14.html": case "FortressSiegeManager-15.html": - case "FortressSiegeManager-16.html": - { + case "FortressSiegeManager-16.html": { return htmltext = event; } - case "register": - { - if (player.getClan() == null) - { + case "register": { + if (player.getClan() == null) { htmltext = "FortressSiegeManager-02.html"; - } - else - { + } else { final L2Clan clan = player.getClan(); final Fort fortress = npc.getFort(); final Castle castle = npc.getCastle(); - if (clan.getFortId() == fortress.getResidenceId()) - { + if (clan.getFortId() == fortress.getResidenceId()) { final NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId()); html.setHtml(getHtm(player.getHtmlPrefix(), "FortressSiegeManager-12.html")); html.replace("%clanName%", fortress.getOwnerClan().getName()); return html.getHtml(); - } - else if (!player.hasClanPrivilege(ClanPrivilege.CS_MANAGE_SIEGE)) - { + } else if (!player.hasClanPrivilege(ClanPrivilege.CS_MANAGE_SIEGE)) { htmltext = "FortressSiegeManager-10.html"; - } - else if ((clan.getLevel() < fortSiege().getSiegeClanMinLevel())) - { + } else if ((clan.getLevel() < fortSiege().getSiegeClanMinLevel())) { htmltext = "FortressSiegeManager-04.html"; - } - else if ((player.getClan().getCastleId() == castle.getResidenceId()) && (fortress.getFortState() == 2)) - { + } else if ((player.getClan().getCastleId() == castle.getResidenceId()) && (fortress.getFortState() == 2)) { htmltext = "FortressSiegeManager-18.html"; - } - else if ((clan.getCastleId() != 0) && (clan.getCastleId() != castle.getResidenceId()) && fortSiege().justToTerritory()) - { + } else if ((clan.getCastleId() != 0) && (clan.getCastleId() != castle.getResidenceId()) && fortSiege().justToTerritory()) { htmltext = "FortressSiegeManager-17.html"; - } - else if ((fortress.getTimeTillRebelArmy() > 0) && (fortress.getTimeTillRebelArmy() <= 7200)) - { + } else if ((fortress.getTimeTillRebelArmy() > 0) && (fortress.getTimeTillRebelArmy() <= 7200)) { htmltext = "FortressSiegeManager-19.html"; - } - else - { - switch (npc.getFort().getSiege().addAttacker(player, true)) - { - case 1: - { + } else { + switch (npc.getFort().getSiege().addAttacker(player, true)) { + case 1: { htmltext = "FortressSiegeManager-03.html"; break; } - case 2: - { + case 2: { htmltext = "FortressSiegeManager-07.html"; break; } - case 3: - { + case 3: { htmltext = "FortressSiegeManager-06.html"; break; } - case 4: - { + case 4: { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.REGISTERED_TO_S1_FORTRESS_BATTLE); sm.addString(npc.getFort().getName()); player.sendPacket(sm); @@ -157,42 +129,30 @@ public final class FortressSiegeManager extends AbstractNpcAI } break; } - case "cancel": - { - if (player.getClan() == null) - { + case "cancel": { + if (player.getClan() == null) { htmltext = "FortressSiegeManager-02.html"; - } - else - { + } else { final L2Clan clan = player.getClan(); final Fort fortress = npc.getFort(); - if (clan.getFortId() == fortress.getResidenceId()) - { + if (clan.getFortId() == fortress.getResidenceId()) { final NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId()); html.setHtml(getHtm(player.getHtmlPrefix(), "FortressSiegeManager-12.html")); html.replace("%clanName%", fortress.getOwnerClan().getName()); return html.getHtml(); - } - else if (!player.hasClanPrivilege(ClanPrivilege.CS_MANAGE_SIEGE)) - { + } else if (!player.hasClanPrivilege(ClanPrivilege.CS_MANAGE_SIEGE)) { htmltext = "FortressSiegeManager-10.html"; - } - else if (!FortSiegeManager.getInstance().checkIsRegistered(clan, fortress.getResidenceId())) - { + } else if (!FortSiegeManager.getInstance().checkIsRegistered(clan, fortress.getResidenceId())) { htmltext = "FortressSiegeManager-09.html"; - } - else - { + } else { fortress.getSiege().removeAttacker(player.getClan()); htmltext = "FortressSiegeManager-08.html"; } } break; } - case "warInfo": - { + case "warInfo": { htmltext = npc.getFort().getSiege().getAttackerClans().isEmpty() ? "FortressSiegeManager-20.html" : "FortressSiegeManager-21.html"; } } @@ -200,12 +160,10 @@ public final class FortressSiegeManager extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { final Fort fortress = npc.getFort(); final int fortOwner = fortress.getOwnerClan() == null ? 0 : fortress.getOwnerClan().getId(); - if (fortOwner == 0) - { + if (fortOwner == 0) { return "FortressSiegeManager.html"; } final NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId()); @@ -215,8 +173,7 @@ public final class FortressSiegeManager extends AbstractNpcAI return html.getHtml(); } - public static void main(String[] args) - { + public static void main(String[] args) { new FortressSiegeManager(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/FreyasSteward/FreyasSteward.java b/src/main/java/com/l2jserver/datapack/ai/npc/FreyasSteward/FreyasSteward.java index a8c1b76f37..8c25bf9628 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/FreyasSteward/FreyasSteward.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/FreyasSteward/FreyasSteward.java @@ -27,8 +27,7 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Freya's Steward AI. * @author Adry_85 */ -public final class FreyasSteward extends AbstractNpcAI -{ +public final class FreyasSteward extends AbstractNpcAI { // NPC private static final int FREYAS_STEWARD = 32029; // Location @@ -36,8 +35,7 @@ public final class FreyasSteward extends AbstractNpcAI // Misc private static final int MIN_LEVEL = 82; - private FreyasSteward() - { + private FreyasSteward() { super(FreyasSteward.class.getSimpleName(), "ai/npc"); addStartNpc(FREYAS_STEWARD); addFirstTalkId(FREYAS_STEWARD); @@ -45,24 +43,20 @@ public final class FreyasSteward extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return "32029.html"; } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { - if (player.getLevel() >= MIN_LEVEL) - { + public String onTalk(L2Npc npc, L2PcInstance player) { + if (player.getLevel() >= MIN_LEVEL) { player.teleToLocation(TELEPORT_LOC); return null; } return "32029-1.html"; } - public static void main(String[] args) - { + public static void main(String[] args) { new FreyasSteward(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Jinia/Jinia.java b/src/main/java/com/l2jserver/datapack/ai/npc/Jinia/Jinia.java index 45bab070c9..52d4cfe1e6 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Jinia/Jinia.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Jinia/Jinia.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Jinia AI. * @author Adry_85 */ -public final class Jinia extends AbstractNpcAI -{ +public final class Jinia extends AbstractNpcAI { // NPC private static final int JINIA = 32781; // Items @@ -38,8 +37,7 @@ public final class Jinia extends AbstractNpcAI // Misc private static final int MIN_LEVEL = 82; - private Jinia() - { + private Jinia() { super(Jinia.class.getSimpleName(), "ai/npc"); addStartNpc(JINIA); addFirstTalkId(JINIA); @@ -47,32 +45,22 @@ public final class Jinia extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; - switch (event) - { + switch (event) { case "32781-10.html": - case "32781-11.html": - { + case "32781-11.html": { htmltext = event; break; } - case "check": - { - if (hasAtLeastOneQuestItem(player, FROZEN_CORE, BLACK_FROZEN_CORE)) - { + case "check": { + if (hasAtLeastOneQuestItem(player, FROZEN_CORE, BLACK_FROZEN_CORE)) { htmltext = "32781-03.html"; - } - else - { + } else { final QuestState st = player.getQuestState(Q10286_ReunionWithSirra.class.getSimpleName()); - if ((st != null) && st.isCompleted()) - { + if ((st != null) && st.isCompleted()) { giveItems(player, FROZEN_CORE, 1); - } - else - { + } else { giveItems(player, BLACK_FROZEN_CORE, 1); } htmltext = "32781-04.html"; @@ -84,25 +72,19 @@ public final class Jinia extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { final QuestState st = player.getQuestState(Q10286_ReunionWithSirra.class.getSimpleName()); - if ((st != null) && (player.getLevel() >= MIN_LEVEL)) - { - if (st.isCompleted()) - { + if ((st != null) && (player.getLevel() >= MIN_LEVEL)) { + if (st.isCompleted()) { return "32781-02.html"; - } - else if (st.isCond(5) || st.isCond(6)) - { + } else if (st.isCond(5) || st.isCond(6)) { return "32781-09.html"; } } return "32781-01.html"; } - public static void main(String[] args) - { + public static void main(String[] args) { new Jinia(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Katenar/Katenar.java b/src/main/java/com/l2jserver/datapack/ai/npc/Katenar/Katenar.java index 47b9ac7ae2..6216dd1a1a 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Katenar/Katenar.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Katenar/Katenar.java @@ -30,15 +30,13 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Katenar AI for quests Certified Soul Breaker (65) * @author ivantotov */ -public final class Katenar extends AbstractNpcAI -{ +public final class Katenar extends AbstractNpcAI { // NPC private static final int KATENAR = 32242; // Item private static final int SEALED_DOCUMENT = 9803; - private Katenar() - { + private Katenar() { super(Katenar.class.getSimpleName(), "ai/npc"); addStartNpc(KATENAR); addTalkId(KATENAR); @@ -47,34 +45,25 @@ public final class Katenar extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class); String htmltext = null; - switch (event) - { - case "CREATED_50": - { - if (npc0 != null) - { - if (!npc.getVariables().getBoolean("SPAWNED", false)) - { + switch (event) { + case "CREATED_50": { + if (npc0 != null) { + if (!npc.getVariables().getBoolean("SPAWNED", false)) { npc0.getVariables().set("SPAWNED", false); } } npc.deleteMe(); break; } - case "GOOD_LUCK": - { + case "GOOD_LUCK": { final QuestState qs = player.getQuestState(Q00065_CertifiedSoulBreaker.class.getSimpleName()); - if (qs.isMemoState(14)) - { - if (npc0 != null) - { - if (!npc.getVariables().getBoolean("SPAWNED", false)) - { + if (qs.isMemoState(14)) { + if (npc0 != null) { + if (!npc.getVariables().getBoolean("SPAWNED", false)) { npc0.getVariables().set("SPAWNED", false); broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.GOOD_LUCK); } @@ -88,56 +77,43 @@ public final class Katenar extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance talker) - { + public String onFirstTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = talker.getQuestState(Q00065_CertifiedSoulBreaker.class.getSimpleName()); String htmltext = getNoQuestMsg(talker); final int memoState = qs.getMemoState(); - if (memoState == 12) - { + if (memoState == 12) { htmltext = "32242-01.html"; - } - else if (memoState == 13) - { + } else if (memoState == 13) { final L2PcInstance player = npc.getVariables().getObject("player0", L2PcInstance.class); - if (player == talker) - { + if (player == talker) { qs.setMemoState(14); qs.setCond(13, true); htmltext = "32242-02.html"; - } - else - { + } else { qs.setMemoState(14); qs.setCond(13, true); htmltext = "32242-03.html"; } - if (!hasQuestItems(player, SEALED_DOCUMENT)) - { + if (!hasQuestItems(player, SEALED_DOCUMENT)) { giveItems(player, SEALED_DOCUMENT, 1); } - } - else if (memoState == 14) - { + } else if (memoState == 14) { htmltext = "32242-04.html"; } return htmltext; } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { startQuestTimer("CREATED_50", 50000, npc, null); final L2PcInstance player = npc.getVariables().getObject("player0", L2PcInstance.class); - if (player != null) - { + if (player != null) { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.I_AM_LATE); } return super.onSpawn(npc); } - public static void main(String[] args) - { + public static void main(String[] args) { new Katenar(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/KetraOrcSupport/KetraOrcSupport.java b/src/main/java/com/l2jserver/datapack/ai/npc/KetraOrcSupport/KetraOrcSupport.java index 645ea473cd..5db7a2a84f 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/KetraOrcSupport/KetraOrcSupport.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/KetraOrcSupport/KetraOrcSupport.java @@ -33,26 +33,21 @@ import com.l2jserver.gameserver.util.Util; * Original Jython script by Emperorc and Kerberos_20. * @authors Nyaran */ -public final class KetraOrcSupport extends AbstractNpcAI -{ - private static class BuffsData - { +public final class KetraOrcSupport extends AbstractNpcAI { + private static class BuffsData { private final int _skill; private final int _cost; - public BuffsData(int skill, int cost) - { + public BuffsData(int skill, int cost) { _skill = skill; _cost = cost; } - public Skill getSkill() - { + public Skill getSkill() { return SkillData.getInstance().getSkill(_skill, 1); } - public int getCost() - { + public int getCost() { return _cost; } } @@ -67,8 +62,7 @@ public final class KetraOrcSupport extends AbstractNpcAI private static final int KURFA = 31376; // Gate Keeper // Items private static final int HORN = 7186; - private static final int[] KETRA_MARKS = - { + private static final int[] KETRA_MARKS = { 7211, // Mark of Ketra's Alliance - Level 1 7212, // Mark of Ketra's Alliance - Level 2 7213, // Mark of Ketra's Alliance - Level 3 @@ -77,8 +71,7 @@ public final class KetraOrcSupport extends AbstractNpcAI }; // Misc private static final Map<Integer, BuffsData> BUFF = new HashMap<>(); - static - { + static { BUFF.put(1, new BuffsData(4359, 2)); // Focus: Requires 2 Buffalo Horns BUFF.put(2, new BuffsData(4360, 2)); // Death Whisper: Requires 2 Buffalo Horns BUFF.put(3, new BuffsData(4345, 3)); // Might: Requires 3 Buffalo Horns @@ -89,20 +82,16 @@ public final class KetraOrcSupport extends AbstractNpcAI BUFF.put(8, new BuffsData(4357, 6)); // Haste: Requires 6 Buffalo Horns } - private KetraOrcSupport() - { + private KetraOrcSupport() { super(KetraOrcSupport.class.getSimpleName(), "ai/npc"); addFirstTalkId(KADUN, WAHKAN, ASEFA, ATAN, JAFF, JUMARA, KURFA); addTalkId(ASEFA, KURFA, JAFF); addStartNpc(KURFA, JAFF); } - private int getAllianceLevel(L2PcInstance player) - { - for (int i = 0; i < KETRA_MARKS.length; i++) - { - if (hasQuestItems(player, KETRA_MARKS[i])) - { + private int getAllianceLevel(L2PcInstance player) { + for (int i = 0; i < KETRA_MARKS.length; i++) { + if (hasQuestItems(player, KETRA_MARKS[i])) { return (i + 1); } } @@ -110,33 +99,23 @@ public final class KetraOrcSupport extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - if (Util.isDigit(event) && BUFF.containsKey(Integer.parseInt(event))) - { + if (Util.isDigit(event) && BUFF.containsKey(Integer.parseInt(event))) { final BuffsData buff = BUFF.get(Integer.parseInt(event)); - if (getQuestItemsCount(player, HORN) >= buff.getCost()) - { + if (getQuestItemsCount(player, HORN) >= buff.getCost()) { takeItems(player, HORN, buff.getCost()); npc.setTarget(player); npc.doCast(buff.getSkill()); npc.setCurrentHpMp(npc.getMaxHp(), npc.getMaxMp()); - } - else - { + } else { htmltext = "31372-02.html"; } - } - else if (event.equals("Teleport")) - { + } else if (event.equals("Teleport")) { final int AllianceLevel = getAllianceLevel(player); - if (AllianceLevel == 4) - { + if (AllianceLevel == 4) { htmltext = "31376-04.html"; - } - else if (AllianceLevel == 5) - { + } else if (AllianceLevel == 5) { htmltext = "31376-05.html"; } } @@ -144,12 +123,10 @@ public final class KetraOrcSupport extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final int AllianceLevel = getAllianceLevel(player); - switch (npc.getId()) - { + switch (npc.getId()) { case KADUN: htmltext = (AllianceLevel > 0) ? "31370-friend.html" : "31370-no.html"; break; @@ -166,8 +143,7 @@ public final class KetraOrcSupport extends AbstractNpcAI htmltext = (AllianceLevel > 0) ? (AllianceLevel == 1) ? "31374-01.html" : "31374-02.html" : "31374-no.html"; break; case JUMARA: - switch (AllianceLevel) - { + switch (AllianceLevel) { case 1: case 2: htmltext = "31375-01.html"; @@ -185,8 +161,7 @@ public final class KetraOrcSupport extends AbstractNpcAI } break; case KURFA: - switch (AllianceLevel) - { + switch (AllianceLevel) { case 1: case 2: case 3: @@ -207,8 +182,7 @@ public final class KetraOrcSupport extends AbstractNpcAI return htmltext; } - public static void main(String args[]) - { + public static void main(String args[]) { new KetraOrcSupport(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Kier/Kier.java b/src/main/java/com/l2jserver/datapack/ai/npc/Kier/Kier.java index 9d38ef3421..3a63b41522 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Kier/Kier.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Kier/Kier.java @@ -30,48 +30,37 @@ import com.l2jserver.gameserver.model.quest.QuestState; * @author Adry_85 * @since 2.6.0.0 */ -public final class Kier extends AbstractNpcAI -{ +public final class Kier extends AbstractNpcAI { // NPC private static final int KIER = 32022; - private Kier() - { + private Kier() { super(Kier.class.getSimpleName(), "ai/npc"); addFirstTalkId(KIER); } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; final QuestState st_Q00115 = player.getQuestState(Q00115_TheOtherSideOfTruth.class.getSimpleName()); - if (st_Q00115 == null) - { + if (st_Q00115 == null) { htmltext = "32022-02.html"; - } - else if (!st_Q00115.isCompleted()) - { + } else if (!st_Q00115.isCompleted()) { htmltext = "32022-01.html"; } final QuestState st_Q10283 = player.getQuestState(Q10283_RequestOfIceMerchant.class.getSimpleName()); - if (st_Q10283 != null) - { - if (st_Q10283.isMemoState(2)) - { + if (st_Q10283 != null) { + if (st_Q10283.isMemoState(2)) { htmltext = "32022-03.html"; - } - else if (st_Q10283.isCompleted()) - { + } else if (st_Q10283.isCompleted()) { htmltext = "32022-04.html"; } } return htmltext; } - public static void main(String[] args) - { + public static void main(String[] args) { new Kier(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/ManorManager/ManorManager.java b/src/main/java/com/l2jserver/datapack/ai/npc/ManorManager/ManorManager.java index 7fd7e2c2ab..c5dee4d436 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/ManorManager/ManorManager.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/ManorManager/ManorManager.java @@ -45,10 +45,8 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Manor manager AI. * @author malyelfik */ -public final class ManorManager extends AbstractNpcAI -{ - private static final int[] NPC = - { +public final class ManorManager extends AbstractNpcAI { + private static final int[] NPC = { 35644, 35645, 35319, @@ -65,8 +63,7 @@ public final class ManorManager extends AbstractNpcAI 35187 }; - public ManorManager() - { + public ManorManager() { super(ManorManager.class.getSimpleName(), "ai/npc"); addStartNpc(NPC); addFirstTalkId(NPC); @@ -74,11 +71,9 @@ public final class ManorManager extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { + switch (event) { case "manager-help-01.htm": case "manager-help-02.htm": case "manager-help-03.htm": @@ -89,13 +84,10 @@ public final class ManorManager extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { - if (general().allowManor()) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { + if (general().allowManor()) { final int castleId = npc.getTemplate().getParameters().getInt("manor_id", -1); - if (!player.canOverrideCond(PcCondOverride.CASTLE_CONDITIONS) && player.isClanLeader() && (castleId == player.getClan().getCastleId())) - { + if (!player.canOverrideCond(PcCondOverride.CASTLE_CONDITIONS) && player.isClanLeader() && (castleId == player.getClan().getCastleId())) { return "manager-lord.htm"; } return "manager.htm"; @@ -108,11 +100,9 @@ public final class ManorManager extends AbstractNpcAI @RegisterType(ListenerRegisterType.NPC) @Id({35644, 35645, 35319, 35366, 36456, 35512, 35558, 35229, 35230, 35231, 35277, 35103, 35145, 35187}) // @formatter:on - public final void onNpcManorBypass(OnNpcManorBypass evt) - { + public final void onNpcManorBypass(OnNpcManorBypass evt) { final L2PcInstance player = evt.getActiveChar(); - if (CastleManorManager.getInstance().isUnderMaintenance()) - { + if (CastleManorManager.getInstance().isUnderMaintenance()) { player.sendPacket(SystemMessageId.THE_MANOR_SYSTEM_IS_CURRENTLY_UNDER_MAINTENANCE); return; } @@ -120,12 +110,10 @@ public final class ManorManager extends AbstractNpcAI final L2Npc npc = evt.getTarget(); final int templateId = npc.getTemplate().getParameters().getInt("manor_id", -1); final int castleId = (evt.getManorId() == -1) ? templateId : evt.getManorId(); - switch (evt.getRequest()) - { + switch (evt.getRequest()) { case 1: // Seed purchase { - if (templateId != castleId) - { + if (templateId != castleId) { player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.HERE_YOU_CAN_BUY_ONLY_SEEDS_OF_S1_MANOR).addCastleId(templateId)); return; } @@ -155,8 +143,7 @@ public final class ManorManager extends AbstractNpcAI } } - public static void main(String[] args) - { + public static void main(String[] args) { new ManorManager(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/MercenaryCaptain/MercenaryCaptain.java b/src/main/java/com/l2jserver/datapack/ai/npc/MercenaryCaptain/MercenaryCaptain.java index 6abbf40156..4a307e5999 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/MercenaryCaptain/MercenaryCaptain.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/MercenaryCaptain/MercenaryCaptain.java @@ -40,12 +40,10 @@ import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; * Mercenary Captain AI. * @author malyelfik */ -public final class MercenaryCaptain extends AbstractNpcAI -{ +public final class MercenaryCaptain extends AbstractNpcAI { // NPCs private static final Map<Integer, Integer> NPCS = new HashMap<>(); - static - { + static { NPCS.put(36481, 13757); // Mercenary Captain (Gludio) NPCS.put(36482, 13758); // Mercenary Captain (Dion) NPCS.put(36483, 13759); // Mercenary Captain (Giran) @@ -68,22 +66,17 @@ public final class MercenaryCaptain extends AbstractNpcAI private static final int MIN_LEVEL = 40; private static final int CLASS_LEVEL = 2; - private MercenaryCaptain() - { + private MercenaryCaptain() { super(MercenaryCaptain.class.getSimpleName(), "ai/npc"); - for (int id : NPCS.keySet()) - { + for (int id : NPCS.keySet()) { addStartNpc(id); addFirstTalkId(id); addTalkId(id); } - for (Territory terr : TerritoryWarManager.getInstance().getAllTerritories()) - { - for (TerritoryNPCSpawn spawn : terr.getSpawnList()) - { - if (NPCS.keySet().contains(spawn.getId())) - { + for (Territory terr : TerritoryWarManager.getInstance().getAllTerritories()) { + for (TerritoryNPCSpawn spawn : terr.getSpawnList()) { + if (NPCS.keySet().contains(spawn.getId())) { startQuestTimer("say", DELAY, spawn.getNpc(), null, true); } } @@ -91,21 +84,16 @@ public final class MercenaryCaptain extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - if (player != null) - { + if (player != null) { final StringTokenizer st = new StringTokenizer(event, " "); - switch (st.nextToken()) - { - case "36481-02.html": - { + switch (st.nextToken()) { + case "36481-02.html": { htmltext = event; break; } - case "36481-03.html": - { + case "36481-03.html": { final NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId()); html.setHtml(getHtm(player.getHtmlPrefix(), "36481-03.html")); html.replace("%strider%", String.valueOf(territoryWar().getMinTerritoryBadgeForStriders())); @@ -113,46 +101,37 @@ public final class MercenaryCaptain extends AbstractNpcAI player.sendPacket(html); break; } - case "territory": - { + case "territory": { player.sendPacket(new ExShowDominionRegistry(npc.getCastle().getResidenceId(), player)); break; } - case "strider": - { + case "strider": { final String type = st.nextToken(); final int price = (type.equals("3")) ? territoryWar().getMinTerritoryBadgeForBigStrider() : territoryWar().getMinTerritoryBadgeForStriders(); final int badgeId = NPCS.get(npc.getId()); - if (getQuestItemsCount(player, badgeId) < price) - { + if (getQuestItemsCount(player, badgeId) < price) { return "36481-07.html"; } final int striderId; - switch (type) - { - case "0": - { + switch (type) { + case "0": { striderId = STRIDER_WIND; break; } - case "1": - { + case "1": { striderId = STRIDER_STAR; break; } - case "2": - { + case "2": { striderId = STRIDER_TWILIGHT; break; } - case "3": - { + case "3": { striderId = GUARDIAN_STRIDER; break; } - default: - { + default: { _log.warning(MercenaryCaptain.class.getSimpleName() + ": Unknown strider type: " + type); return null; } @@ -162,46 +141,31 @@ public final class MercenaryCaptain extends AbstractNpcAI htmltext = "36481-09.html"; break; } - case "elite": - { - if (!hasQuestItems(player, ELITE_MERCENARY_CERTIFICATE)) - { + case "elite": { + if (!hasQuestItems(player, ELITE_MERCENARY_CERTIFICATE)) { htmltext = "36481-10.html"; - } - else - { + } else { final int listId = 676 + npc.getCastle().getResidenceId(); MultisellData.getInstance().separateAndSend(listId, player, npc, false); } break; } - case "top-elite": - { - if (!hasQuestItems(player, TOP_ELITE_MERCENARY_CERTIFICATE)) - { + case "top-elite": { + if (!hasQuestItems(player, TOP_ELITE_MERCENARY_CERTIFICATE)) { htmltext = "36481-10.html"; - } - else - { + } else { final int listId = 685 + npc.getCastle().getResidenceId(); MultisellData.getInstance().separateAndSend(listId, player, npc, false); } break; } } - } - else if (event.equalsIgnoreCase("say") && !npc.isDecayed()) - { - if (TerritoryWarManager.getInstance().isTWInProgress()) - { + } else if (event.equalsIgnoreCase("say") && !npc.isDecayed()) { + if (TerritoryWarManager.getInstance().isTWInProgress()) { broadcastNpcSay(npc, Say2.NPC_SHOUT, NpcStringId.CHARGE_CHARGE_CHARGE); - } - else if (getRandom(2) == 0) - { + } else if (getRandom(2) == 0) { broadcastNpcSay(npc, Say2.NPC_SHOUT, NpcStringId.COURAGE_AMBITION_PASSION_MERCENARIES_WHO_WANT_TO_REALIZE_THEIR_DREAM_OF_FIGHTING_IN_THE_TERRITORY_WAR_COME_TO_ME_FORTUNE_AND_GLORY_ARE_WAITING_FOR_YOU); - } - else - { + } else { broadcastNpcSay(npc, Say2.NPC_SHOUT, NpcStringId.DO_YOU_WISH_TO_FIGHT_ARE_YOU_AFRAID_NO_MATTER_HOW_HARD_YOU_TRY_YOU_HAVE_NOWHERE_TO_RUN_BUT_IF_YOU_FACE_IT_HEAD_ON_OUR_MERCENARY_TROOP_WILL_HELP_YOU_OUT); } } @@ -209,26 +173,19 @@ public final class MercenaryCaptain extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { final String htmltext; - if ((player.getLevel() < MIN_LEVEL) || (player.getClassId().level() < CLASS_LEVEL)) - { + if ((player.getLevel() < MIN_LEVEL) || (player.getClassId().level() < CLASS_LEVEL)) { htmltext = "36481-08.html"; - } - else if (npc.isMyLord(player)) - { + } else if (npc.isMyLord(player)) { htmltext = (npc.getCastle().getSiege().isInProgress() || TerritoryWarManager.getInstance().isTWInProgress()) ? "36481-05.html" : "36481-04.html"; - } - else - { + } else { htmltext = (npc.getCastle().getSiege().isInProgress() || TerritoryWarManager.getInstance().isTWInProgress()) ? "36481-06.html" : npc.getId() + "-01.html"; } return htmltext; } - public static void main(String[] args) - { + public static void main(String[] args) { new MercenaryCaptain(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Minigame/Minigame.java b/src/main/java/com/l2jserver/datapack/ai/npc/Minigame/Minigame.java index 7507418b2c..e21b52121a 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Minigame/Minigame.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Minigame/Minigame.java @@ -40,8 +40,7 @@ import com.l2jserver.gameserver.util.Util; * Monastery Minigame AI. * @author nonom */ -public final class Minigame extends AbstractNpcAI -{ +public final class Minigame extends AbstractNpcAI { private static final int SUMIEL = 32758; private static final int BURNER = 18913; private static final int TREASURE_BOX = 18911; @@ -60,8 +59,7 @@ public final class Minigame extends AbstractNpcAI private final List<MinigameRoom> _rooms = new ArrayList<>(2); - private Minigame() - { + private Minigame() { super(Minigame.class.getSimpleName(), "ai/npc"); addStartNpc(SUMIEL); addFirstTalkId(SUMIEL); @@ -70,20 +68,14 @@ public final class Minigame extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final MinigameRoom room = getRoomByManager(npc); - switch (event) - { - case "restart": - { + switch (event) { + case "restart": { final boolean miniGameStarted = room.getStarted(); - if (!miniGameStarted && !hasQuestItems(player, UNLIT_TORCHLIGHT)) - { + if (!miniGameStarted && !hasQuestItems(player, UNLIT_TORCHLIGHT)) { return "32758-05.html"; - } - else if ((npc.getTarget() != null) && (npc.getTarget() != player)) - { + } else if ((npc.getTarget() != null) && (npc.getTarget() != player)) { return "32758-04.html"; } @@ -94,8 +86,7 @@ public final class Minigame extends AbstractNpcAI room.getManager().setTarget(player); room.setParticipant(player); room.setStarted(true); - for (int i = 0; i < 9; i++) - { + for (int i = 0; i < 9; i++) { room.getOrder()[i] = getRandom(8); } cancelQuestTimer("hurry_up", npc, null); @@ -107,53 +98,41 @@ public final class Minigame extends AbstractNpcAI startQuestTimer("start", 1000, npc, null); return null; } - case "off": - { - if (npc.getId() == BURNER) - { + case "off": { + if (npc.getId() == BURNER) { npc.setDisplayEffect(2); npc.setIsRunning(false); - } - else - { - for (L2Npc burner : room.getBurners()) - { + } else { + for (L2Npc burner : room.getBurners()) { burner.setDisplayEffect(2); burner.setIsRunning(false); } } break; } - case "teleport1": - { + case "teleport1": { player.teleToLocation(TELEPORT1, 0); break; } - case "teleport2": - { + case "teleport2": { player.teleToLocation(TELEPORT2, 0); break; } - case "start": - { + case "start": { room.burnThemAll(); startQuestTimer("off", 2000, npc, null); // It should be null to stop burnthemAll 2s after startQuestTimer("timer", 4000, npc, null); break; } - case "timer": - { - if (room.getCurrentPot() < 9) - { + case "timer": { + if (room.getCurrentPot() < 9) { L2Npc b = room.getBurners()[room.getOrder()[room.getCurrentPot()]]; b.setDisplayEffect(1); b.setIsRunning(false); startQuestTimer("off", 2000, b, null); // Stopping burning each pot 2s after startQuestTimer("timer", TIMER_INTERVAL * 1000, npc, null); room.setCurrentPot(room.getCurrentPot() + 1); - } - else - { + } else { broadcastNpcSay(room.getManager(), Say2.NPC_ALL, NpcStringId.NOW_LIGHT_THE_FURNACES_FIRE); room.burnThemAll(); startQuestTimer("off", 2000, npc, null); @@ -163,32 +142,27 @@ public final class Minigame extends AbstractNpcAI } break; } - case "hurry_up": - { + case "hurry_up": { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.THERES_ABOUT_1_MINUTE_LEFT); startQuestTimer("hurry_up2", 60000, npc, null); break; } - case "hurry_up2": - { + case "hurry_up2": { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.THERES_JUST_10_SECONDS_LEFT); startQuestTimer("expire", 10000, npc, null); break; } - case "expire": - { + case "expire": { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.TIME_IS_UP_AND_YOU_HAVE_FAILED_ANY_MORE_WILL_BE_DIFFICULT); } - case "end": - { + case "end": { cancelQuestTimer("expire", npc, null); cancelQuestTimer("hurry_up", npc, null); cancelQuestTimer("hurry_up2", npc, null); room.clean(); break; } - case "afterthat": - { + case "afterthat": { npc.deleteMe(); break; } @@ -197,38 +171,26 @@ public final class Minigame extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance talker) - { + public String onFirstTalk(L2Npc npc, L2PcInstance talker) { String htmltext = null; final MinigameRoom room = getRoomByManager(npc); final boolean miniGameStarted = room.getStarted(); - if (npc.getTarget() == null) - { + if (npc.getTarget() == null) { htmltext = (miniGameStarted ? "32758-08.html" : "32758.html"); - } - else if (npc.getTarget() == talker) - { - if (miniGameStarted) - { + } else if (npc.getTarget() == talker) { + if (miniGameStarted) { htmltext = "32758-07.html"; - } - else - { + } else { int attemptNumber = room.getAttemptNumber(); - if (attemptNumber == 2) - { + if (attemptNumber == 2) { htmltext = "32758-02.html"; - } - else if (attemptNumber == 3) - { + } else if (attemptNumber == 3) { htmltext = "32758-03.html"; } } - } - else - { + } else { htmltext = "32758-04.html"; } @@ -236,17 +198,13 @@ public final class Minigame extends AbstractNpcAI } @Override - public String onSpawn(L2Npc npc) - { - switch (npc.getId()) - { - case SUMIEL: - { + public String onSpawn(L2Npc npc) { + switch (npc.getId()) { + case SUMIEL: { _rooms.add(initRoom(npc)); break; } - case TREASURE_BOX: - { + case TREASURE_BOX: { npc.disableCoreAI(true); startQuestTimer("afterthat", 180000, npc, null); break; @@ -255,32 +213,23 @@ public final class Minigame extends AbstractNpcAI return super.onSpawn(npc); } - public void onSkillUse(OnCreatureSkillUse event) - { + public void onSkillUse(OnCreatureSkillUse event) { final MinigameRoom room = getRoomByParticipant((L2PcInstance) event.getCaster()); final boolean miniGameStarted = room.getStarted(); - if (miniGameStarted && (event.getSkill().getId() == SKILL_TORCH_LIGHT)) - { - for (L2Object obj : event.getTargets()) - { - if ((obj != null) && obj.isNpc()) - { + if (miniGameStarted && (event.getSkill().getId() == SKILL_TORCH_LIGHT)) { + for (L2Object obj : event.getTargets()) { + if ((obj != null) && obj.isNpc()) { L2Npc npc = (L2Npc) obj; - if (npc.getId() == BURNER) - { + if (npc.getId() == BURNER) { npc.doCast(TRIGGER_MIRAGE); final int pos = room.getBurnerPos(npc); - if (pos == room.getOrder()[room.getCurrentPot()]) - { - if (room.getCurrentPot() < 8) - { + if (pos == room.getOrder()[room.getCurrentPot()]) { + if (room.getCurrentPot() < 8) { npc.setDisplayEffect(1); npc.setIsRunning(false); startQuestTimer("off", 2000, npc, null); room.setCurrentPot(room.getCurrentPot() + 1); - } - else - { + } else { addSpawn(TREASURE_BOX, room.getParticipant().getLocation(), true, 0); broadcastNpcSay(room.getManager(), Say2.NPC_ALL, NpcStringId.OH_YOUVE_SUCCEEDED); room.setCurrentPot(0); @@ -288,19 +237,14 @@ public final class Minigame extends AbstractNpcAI startQuestTimer("off", 2000, room.getManager(), null); startQuestTimer("end", 4000, room.getManager(), null); } - } - else - { - if (room.getAttemptNumber() == MAX_ATTEMPTS) - { + } else { + if (room.getAttemptNumber() == MAX_ATTEMPTS) { broadcastNpcSay(room.getManager(), Say2.NPC_ALL, NpcStringId.AH_IVE_FAILED_GOING_FURTHER_WILL_BE_DIFFICULT); room.burnThemAll(); startQuestTimer("off", 2000, room.getManager(), null); room.getParticipant().removeListenerIf(EventType.ON_CREATURE_SKILL_USE, listener -> listener.getOwner() == room); startQuestTimer("end", 4000, room.getManager(), null); - } - else if (room.getAttemptNumber() < MAX_ATTEMPTS) - { + } else if (room.getAttemptNumber() < MAX_ATTEMPTS) { broadcastNpcSay(room.getManager(), Say2.NPC_ALL, NpcStringId.AH_IS_THIS_FAILURE_BUT_IT_LOOKS_LIKE_I_CAN_KEEP_GOING); room.burnThemAll(); startQuestTimer("off", 2000, room.getManager(), null); @@ -321,17 +265,14 @@ public final class Minigame extends AbstractNpcAI * @param manager the NPC instructor * @return MinigameRoom */ - private MinigameRoom initRoom(L2Npc manager) - { + private MinigameRoom initRoom(L2Npc manager) { final L2Npc[] burners = new L2Npc[9]; L2Npc lastSpawn; int potNumber = 0; - for (L2Spawn spawn : SpawnTable.getInstance().getSpawns(BURNER)) - { + for (L2Spawn spawn : SpawnTable.getInstance().getSpawns(BURNER)) { lastSpawn = spawn.getLastSpawn(); - if ((potNumber <= 8) && Util.checkIfInRange(1000, manager, lastSpawn, false)) - { + if ((potNumber <= 8) && Util.checkIfInRange(1000, manager, lastSpawn, false)) { lastSpawn.setAutoAttackable(true); burners[potNumber++] = lastSpawn; } @@ -344,12 +285,9 @@ public final class Minigame extends AbstractNpcAI * @param manager the NPC instructor * @return MinigameRoom */ - private MinigameRoom getRoomByManager(L2Npc manager) - { - for (MinigameRoom room : _rooms) - { - if (room.getManager() == manager) - { + private MinigameRoom getRoomByManager(L2Npc manager) { + for (MinigameRoom room : _rooms) { + if (room.getManager() == manager) { return room; } } @@ -361,12 +299,9 @@ public final class Minigame extends AbstractNpcAI * @param participant the L2PcInstance participating * @return MinigameRoom */ - private MinigameRoom getRoomByParticipant(L2PcInstance participant) - { - for (MinigameRoom room : _rooms) - { - if (room.getParticipant() == participant) - { + private MinigameRoom getRoomByParticipant(L2PcInstance participant) { + for (MinigameRoom room : _rooms) { + if (room.getParticipant() == participant) { return room; } } @@ -377,8 +312,7 @@ public final class Minigame extends AbstractNpcAI * An object that holds the participant, manager, burning order<br> * and game status for each secret room into Monastery of Silence. */ - private class MinigameRoom - { + private class MinigameRoom { private final L2Npc[] _burners; private final L2Npc _manager; private L2PcInstance _participant; @@ -388,8 +322,7 @@ public final class Minigame extends AbstractNpcAI private final int _order[]; private ConsumerEventListener _listener; - public MinigameRoom(L2Npc[] burners, L2Npc manager) - { + public MinigameRoom(L2Npc[] burners, L2Npc manager) { _burners = burners; _manager = manager; _participant = null; @@ -404,12 +337,9 @@ public final class Minigame extends AbstractNpcAI * @param npc the L2Npc burner * @return the array index */ - public int getBurnerPos(L2Npc npc) - { - for (int i = 0; i < 9; i++) - { - if (npc.equals(_burners[i])) - { + public int getBurnerPos(L2Npc npc) { + for (int i = 0; i < 9; i++) { + if (npc.equals(_burners[i])) { return i; } } @@ -419,10 +349,8 @@ public final class Minigame extends AbstractNpcAI /** * Burn all the pots into the room */ - public void burnThemAll() - { - for (L2Npc burner : _burners) - { + public void burnThemAll() { + for (L2Npc burner : _burners) { burner.setDisplayEffect(1); burner.setIsRunning(false); } @@ -432,8 +360,7 @@ public final class Minigame extends AbstractNpcAI * Retrieve a list of burners * @return An array of L2Npcs */ - public L2Npc[] getBurners() - { + public L2Npc[] getBurners() { return _burners; } @@ -441,8 +368,7 @@ public final class Minigame extends AbstractNpcAI * Retrieve the current game manager * @return The L2Npc game instructor */ - public L2Npc getManager() - { + public L2Npc getManager() { return _manager; } @@ -450,8 +376,7 @@ public final class Minigame extends AbstractNpcAI * Retrieve the current game participant * @return The L2PcInstance who is participating */ - public L2PcInstance getParticipant() - { + public L2PcInstance getParticipant() { return _participant; } @@ -459,8 +384,7 @@ public final class Minigame extends AbstractNpcAI * Set the current participant * @param participant The L2PcInstance participating */ - public void setParticipant(L2PcInstance participant) - { + public void setParticipant(L2PcInstance participant) { _participant = participant; } @@ -468,8 +392,7 @@ public final class Minigame extends AbstractNpcAI * Retrieves the MinigameRoom status * @return {@code true} if the game is started, {@code false} otherwise */ - public boolean getStarted() - { + public boolean getStarted() { return _started; } @@ -477,8 +400,7 @@ public final class Minigame extends AbstractNpcAI * Set the MinigameRoom status * @param started The game status {@code true} if the game is started, {@code false} otherwise */ - public void setStarted(boolean started) - { + public void setStarted(boolean started) { _started = started; } @@ -486,8 +408,7 @@ public final class Minigame extends AbstractNpcAI * Retrieve the current burner position * @return The array index */ - public int getCurrentPot() - { + public int getCurrentPot() { return _currentPot; } @@ -495,8 +416,7 @@ public final class Minigame extends AbstractNpcAI * Set the current burner position * @param pot The position */ - public void setCurrentPot(int pot) - { + public void setCurrentPot(int pot) { _currentPot = pot; } @@ -504,8 +424,7 @@ public final class Minigame extends AbstractNpcAI * Retrieve the current attempt Number * @return The attempt number */ - public int getAttemptNumber() - { + public int getAttemptNumber() { return _attemptNumber; } @@ -513,8 +432,7 @@ public final class Minigame extends AbstractNpcAI * Set the attempt number * @param attempt attempt number */ - public void setAttemptNumber(int attempt) - { + public void setAttemptNumber(int attempt) { _attemptNumber = attempt; } @@ -522,8 +440,7 @@ public final class Minigame extends AbstractNpcAI * Retrieve the burning order * @return an array of Ids */ - public int[] getOrder() - { + public int[] getOrder() { return _order; } @@ -531,8 +448,7 @@ public final class Minigame extends AbstractNpcAI * Set a listener for player inside room * @param listener */ - public void setListener(ConsumerEventListener listener) - { + public void setListener(ConsumerEventListener listener) { _listener = listener; _participant.addListener(listener); } @@ -540,10 +456,8 @@ public final class Minigame extends AbstractNpcAI /** * Clean the room values */ - public void clean() - { - if (_listener != null) - { + public void clean() { + if (_listener != null) { _participant.removeListener(_listener); _listener = null; } @@ -556,8 +470,7 @@ public final class Minigame extends AbstractNpcAI } } - public static void main(String[] args) - { + public static void main(String[] args) { new Minigame(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/MonumentOfHeroes/MonumentOfHeroes.java b/src/main/java/com/l2jserver/datapack/ai/npc/MonumentOfHeroes/MonumentOfHeroes.java index c74858d5f3..188f397d13 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/MonumentOfHeroes/MonumentOfHeroes.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/MonumentOfHeroes/MonumentOfHeroes.java @@ -27,11 +27,9 @@ import com.l2jserver.gameserver.util.Util; * Monument of Heroes AI. * @author Adry_85 */ -public final class MonumentOfHeroes extends AbstractNpcAI -{ +public final class MonumentOfHeroes extends AbstractNpcAI { // NPCs - private static final int[] MONUMENTS = - { + private static final int[] MONUMENTS = { 31690, 31769, 31770, @@ -40,8 +38,7 @@ public final class MonumentOfHeroes extends AbstractNpcAI }; // Items private static final int WINGS_OF_DESTINY_CIRCLET = 6842; - private static final int[] WEAPONS = - { + private static final int[] WEAPONS = { 6611, // Infinity Blade 6612, // Infinity Cleaver 6613, // Infinity Axe @@ -58,50 +55,36 @@ public final class MonumentOfHeroes extends AbstractNpcAI 9390, // Infinity Shooter }; - private MonumentOfHeroes() - { + private MonumentOfHeroes() { super(MonumentOfHeroes.class.getSimpleName(), "ai/npc"); addStartNpc(MONUMENTS); addTalkId(MONUMENTS); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { - case "HeroWeapon": - { - if (player.isHero()) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { + case "HeroWeapon": { + if (player.isHero()) { return hasAtLeastOneQuestItem(player, WEAPONS) ? "already_have_weapon.htm" : "weapon_list.htm"; } return "no_hero_weapon.htm"; } - case "HeroCirclet": - { - if (player.isHero()) - { - if (!hasQuestItems(player, WINGS_OF_DESTINY_CIRCLET)) - { + case "HeroCirclet": { + if (player.isHero()) { + if (!hasQuestItems(player, WINGS_OF_DESTINY_CIRCLET)) { giveItems(player, WINGS_OF_DESTINY_CIRCLET, 1); - } - else - { + } else { return "already_have_circlet.htm"; } - } - else - { + } else { return "no_hero_circlet.htm"; } break; } - default: - { + default: { int weaponId = Integer.parseInt(event); - if (Util.contains(WEAPONS, weaponId)) - { + if (Util.contains(WEAPONS, weaponId)) { giveItems(player, weaponId, 1); } break; @@ -110,8 +93,7 @@ public final class MonumentOfHeroes extends AbstractNpcAI return super.onAdvEvent(event, npc, player); } - public static void main(String[] args) - { + public static void main(String[] args) { new MonumentOfHeroes(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/NevitsHerald/NevitsHerald.java b/src/main/java/com/l2jserver/datapack/ai/npc/NevitsHerald/NevitsHerald.java index 350a9cb7d2..75cc0a5715 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/NevitsHerald/NevitsHerald.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/NevitsHerald/NevitsHerald.java @@ -37,12 +37,10 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * Nevit's Herald AI. * @author Sacrifice */ -public final class NevitsHerald extends AbstractNpcAI -{ +public final class NevitsHerald extends AbstractNpcAI { private static final int NEVITS_HERALD = 4326; private static final List<L2Npc> SPAWNS = new ArrayList<>(); - private static final Location[] NEVITS_HERALD_LOC = - { + private static final Location[] NEVITS_HERALD_LOC = { new Location(86971, -142772, -1336, 20480), // Town of Schuttgart new Location(44165, -48494, -792, 32768), // Rune Township new Location(148017, -55264, -2728, 49152), // Town of Goddard @@ -57,8 +55,7 @@ public final class NevitsHerald extends AbstractNpcAI }; private static final int ANTHARAS = 29068; // Antharas Strong (85) private static final int VALAKAS = 29028; // Valakas (85) - private static final NpcStringId[] SPAM = - { + private static final NpcStringId[] SPAM = { NpcStringId.SHOW_RESPECT_TO_THE_HEROES_WHO_DEFEATED_THE_EVIL_DRAGON_AND_PROTECTED_THIS_ADEN_WORLD, NpcStringId.SHOUT_TO_CELEBRATE_THE_VICTORY_OF_THE_HEROES, NpcStringId.PRAISE_THE_ACHIEVEMENT_OF_THE_HEROES_AND_RECEIVE_NEVITS_BLESSING @@ -67,8 +64,7 @@ public final class NevitsHerald extends AbstractNpcAI // Skill private static final SkillHolder FALL_OF_THE_DRAGON = new SkillHolder(23312); - private NevitsHerald() - { + private NevitsHerald() { super(NevitsHerald.class.getSimpleName(), "ai/npc"); addFirstTalkId(NEVITS_HERALD); addStartNpc(NEVITS_HERALD); @@ -77,77 +73,59 @@ public final class NevitsHerald extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return "4326.html"; } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; - if (npc.getId() == NEVITS_HERALD) - { - if (event.equalsIgnoreCase("buff")) - { - if (player.getEffectList().getFirstEffect(L2EffectType.NEVIT_HOURGLASS) != null) - { + if (npc.getId() == NEVITS_HERALD) { + if (event.equalsIgnoreCase("buff")) { + if (player.getEffectList().getFirstEffect(L2EffectType.NEVIT_HOURGLASS) != null) { return "4326-1.html"; } npc.setTarget(player); npc.doCast(FALL_OF_THE_DRAGON); return null; } - } - else if (event.equalsIgnoreCase("text_spam")) - { + } else if (event.equalsIgnoreCase("text_spam")) { cancelQuestTimer("text_spam", npc, player); npc.broadcastPacket(new NpcSay(NEVITS_HERALD, Say2.SHOUT, NEVITS_HERALD, SPAM[getRandom(0, SPAM.length - 1)])); startQuestTimer("text_spam", 60000, npc, player); return null; - } - else if (event.equalsIgnoreCase("despawn")) - { + } else if (event.equalsIgnoreCase("despawn")) { despawnHeralds(); } return htmltext; } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isPet) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isPet) { ExShowScreenMessage message = null; - if (npc.getId() == VALAKAS) - { + if (npc.getId() == VALAKAS) { message = new ExShowScreenMessage(NpcStringId.THE_EVIL_FIRE_DRAGON_VALAKAS_HAS_BEEN_DEFEATED, 2, 10000); - } - else - { + } else { message = new ExShowScreenMessage(NpcStringId.THE_EVIL_LAND_DRAGON_ANTHARAS_HAS_BEEN_DEFEATED, 2, 10000); } - for (L2PcInstance onlinePlayer : L2World.getInstance().getPlayers()) - { - if (onlinePlayer == null) - { + for (L2PcInstance onlinePlayer : L2World.getInstance().getPlayers()) { + if (onlinePlayer == null) { continue; } onlinePlayer.sendPacket(message); } - if (!isActive) - { + if (!isActive) { isActive = true; SPAWNS.clear(); - for (Location loc : NEVITS_HERALD_LOC) - { + for (Location loc : NEVITS_HERALD_LOC) { L2Npc herald = addSpawn(NEVITS_HERALD, loc, false, 0); - if (herald != null) - { + if (herald != null) { SPAWNS.add(herald); } } @@ -157,20 +135,16 @@ public final class NevitsHerald extends AbstractNpcAI return null; } - private void despawnHeralds() - { - if (!SPAWNS.isEmpty()) - { - for (L2Npc npc : SPAWNS) - { + private void despawnHeralds() { + if (!SPAWNS.isEmpty()) { + for (L2Npc npc : SPAWNS) { npc.deleteMe(); } } SPAWNS.clear(); } - public static void main(String[] args) - { + public static void main(String[] args) { new NevitsHerald(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/NpcBuffers/NpcBufferAI.java b/src/main/java/com/l2jserver/datapack/ai/npc/NpcBuffers/NpcBufferAI.java index a0094f09b2..7b9f7896bc 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/NpcBuffers/NpcBufferAI.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/NpcBuffers/NpcBufferAI.java @@ -30,77 +30,56 @@ import com.l2jserver.gameserver.util.Util; /** * @author UnAfraid */ -public class NpcBufferAI implements Runnable -{ +public class NpcBufferAI implements Runnable { private final L2Npc _npc; private final NpcBufferSkillData _skillData; - protected NpcBufferAI(L2Npc npc, NpcBufferSkillData skill) - { + protected NpcBufferAI(L2Npc npc, NpcBufferSkillData skill) { _npc = npc; _skillData = skill; } @Override - public void run() - { - if ((_npc == null) || !_npc.isVisible() || _npc.isDecayed() || _npc.isDead() || (_skillData == null) || (_skillData.getSkill() == null)) - { + public void run() { + if ((_npc == null) || !_npc.isVisible() || _npc.isDecayed() || _npc.isDead() || (_skillData == null) || (_skillData.getSkill() == null)) { return; } - if ((_npc.getSummoner() == null) || !_npc.getSummoner().isPlayer()) - { + if ((_npc.getSummoner() == null) || !_npc.getSummoner().isPlayer()) { return; } final Skill skill = _skillData.getSkill(); final L2PcInstance player = _npc.getSummoner().getActingPlayer(); - switch (_skillData.getAffectScope()) - { - case PARTY: - { - if (player.isInParty()) - { - for (L2PcInstance member : player.getParty().getMembers()) - { - if (Util.checkIfInRange(skill.getAffectRange(), _npc, member, true) && !member.isDead()) - { + switch (_skillData.getAffectScope()) { + case PARTY: { + if (player.isInParty()) { + for (L2PcInstance member : player.getParty().getMembers()) { + if (Util.checkIfInRange(skill.getAffectRange(), _npc, member, true) && !member.isDead()) { skill.applyEffects(player, member); } } - } - else - { - if (Util.checkIfInRange(skill.getAffectRange(), _npc, player, true) && !player.isDead()) - { + } else { + if (Util.checkIfInRange(skill.getAffectRange(), _npc, player, true) && !player.isDead()) { skill.applyEffects(player, player); } } break; } - case RANGE: - { - for (L2Character target : _npc.getKnownList().getKnownCharactersInRadius(skill.getAffectRange())) - { - switch (_skillData.getAffectObject()) - { - case FRIEND: - { - if (isFriendly(player, target) && !target.isDead()) - { + case RANGE: { + for (L2Character target : _npc.getKnownList().getKnownCharactersInRadius(skill.getAffectRange())) { + switch (_skillData.getAffectObject()) { + case FRIEND: { + if (isFriendly(player, target) && !target.isDead()) { skill.applyEffects(target, target); } break; } - case NOT_FRIEND: - { - if (isEnemy(player, target) && !target.isDead()) - { + case NOT_FRIEND: { + if (isEnemy(player, target) && !target.isDead()) { // Update PvP status - if (target.isPlayable()) - { + if (target.isPlayable()) { player.updatePvPStatus(target); } skill.applyEffects(target, target); @@ -121,39 +100,31 @@ public class NpcBufferAI implements Runnable * @param target the target * @return {@code true} if target can be affected by positive effect, {@code false} otherwise */ - private boolean isFriendly(L2PcInstance player, L2Character target) - { - if (target.isPlayable()) - { + private boolean isFriendly(L2PcInstance player, L2Character target) { + if (target.isPlayable()) { final L2PcInstance targetPlayer = target.getActingPlayer(); - if (player == targetPlayer) - { + if (player == targetPlayer) { return true; } - if (player.isInPartyWith(targetPlayer)) - { + if (player.isInPartyWith(targetPlayer)) { return true; } - if (player.isInCommandChannelWith(targetPlayer)) - { + if (player.isInCommandChannelWith(targetPlayer)) { return true; } - if (player.isInClanWith(targetPlayer)) - { + if (player.isInClanWith(targetPlayer)) { return true; } - if (player.isInAllyWith(targetPlayer)) - { + if (player.isInAllyWith(targetPlayer)) { return true; } - if (player.isOnSameSiegeSideWith(targetPlayer)) - { + if (player.isOnSameSiegeSideWith(targetPlayer)) { return true; } } @@ -166,46 +137,36 @@ public class NpcBufferAI implements Runnable * @param target the target * @return {@code true} if target can be affected by negative effect, {@code false} otherwise */ - private boolean isEnemy(L2PcInstance player, L2Character target) - { - if (isFriendly(player, target)) - { + private boolean isEnemy(L2PcInstance player, L2Character target) { + if (isFriendly(player, target)) { return false; } - if (target instanceof L2TamedBeastInstance) - { + if (target instanceof L2TamedBeastInstance) { return isEnemy(player, ((L2TamedBeastInstance) target).getOwner()); } - if (target.isMonster()) - { + if (target.isMonster()) { return true; } - if (target.isPlayable()) - { + if (target.isPlayable()) { final L2PcInstance targetPlayer = target.getActingPlayer(); - if (!isFriendly(player, targetPlayer)) - { - if (targetPlayer.getPvpFlag() != 0) - { + if (!isFriendly(player, targetPlayer)) { + if (targetPlayer.getPvpFlag() != 0) { return true; } - if (targetPlayer.getKarma() != 0) - { + if (targetPlayer.getKarma() != 0) { return true; } - if (player.isAtWarWith(targetPlayer)) - { + if (player.isAtWarWith(targetPlayer)) { return true; } - if (targetPlayer.isInsideZone(ZoneId.PVP)) - { + if (targetPlayer.isInsideZone(ZoneId.PVP)) { return true; } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/NpcBuffers/NpcBufferData.java b/src/main/java/com/l2jserver/datapack/ai/npc/NpcBuffers/NpcBufferData.java index d030ce0789..1a2ec6f134 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/NpcBuffers/NpcBufferData.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/NpcBuffers/NpcBufferData.java @@ -24,28 +24,23 @@ import java.util.List; /** * @author UnAfraid */ -public class NpcBufferData -{ +public class NpcBufferData { private final int _id; private final List<NpcBufferSkillData> _skills = new ArrayList<>(); - public NpcBufferData(int id) - { + public NpcBufferData(int id) { _id = id; } - public int getId() - { + public int getId() { return _id; } - public void addSkill(NpcBufferSkillData skill) - { + public void addSkill(NpcBufferSkillData skill) { _skills.add(skill); } - public List<NpcBufferSkillData> getSkills() - { + public List<NpcBufferSkillData> getSkills() { return _skills; } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/NpcBuffers/NpcBufferSkillData.java b/src/main/java/com/l2jserver/datapack/ai/npc/NpcBuffers/NpcBufferSkillData.java index 256cb79945..1eacd11798 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/NpcBuffers/NpcBufferSkillData.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/NpcBuffers/NpcBufferSkillData.java @@ -27,16 +27,14 @@ import com.l2jserver.gameserver.model.skills.targets.AffectScope; /** * @author UnAfraid */ -public class NpcBufferSkillData -{ +public class NpcBufferSkillData { private final SkillHolder _skill; private final int _initialDelay; private final int _delay; private final AffectScope _affectScope; private final AffectObject _affectObject; - public NpcBufferSkillData(StatsSet set) - { + public NpcBufferSkillData(StatsSet set) { _skill = new SkillHolder(set.getInt("id"), set.getInt("level")); _initialDelay = set.getInt("initialDelay", 0) * 1000; _delay = set.getInt("delay") * 1000; @@ -44,28 +42,23 @@ public class NpcBufferSkillData _affectObject = set.getEnum("affectObject", AffectObject.class); } - public Skill getSkill() - { + public Skill getSkill() { return _skill.getSkill(); } - public int getInitialDelay() - { + public int getInitialDelay() { return _initialDelay; } - public int getDelay() - { + public int getDelay() { return _delay; } - public AffectScope getAffectScope() - { + public AffectScope getAffectScope() { return _affectScope; } - public AffectObject getAffectObject() - { + public AffectObject getAffectObject() { return _affectObject; } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/NpcBuffers/NpcBuffers.java b/src/main/java/com/l2jserver/datapack/ai/npc/NpcBuffers/NpcBuffers.java index 2141e7b2e7..477c1fddd6 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/NpcBuffers/NpcBuffers.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/NpcBuffers/NpcBuffers.java @@ -26,16 +26,13 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; /** * @author UnAfraid */ -public final class NpcBuffers extends AbstractNpcAI -{ +public final class NpcBuffers extends AbstractNpcAI { private final NpcBuffersData _npcBuffers = new NpcBuffersData(); - private NpcBuffers() - { + private NpcBuffers() { super(NpcBuffers.class.getSimpleName(), "ai/npc"); - for (int npcId : _npcBuffers.getNpcBufferIds()) - { + for (int npcId : _npcBuffers.getNpcBufferIds()) { // TODO: Cleanup once npc rework is finished and default html is configurable. addFirstTalkId(npcId); addSpawnId(npcId); @@ -44,24 +41,20 @@ public final class NpcBuffers extends AbstractNpcAI // TODO: Cleanup once npc rework is finished and default html is configurable. @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return null; } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { final NpcBufferData data = _npcBuffers.getNpcBuffer(npc.getId()); - for (NpcBufferSkillData skill : data.getSkills()) - { + for (NpcBufferSkillData skill : data.getSkills()) { ThreadPoolManager.getInstance().scheduleAi(new NpcBufferAI(npc, skill), skill.getInitialDelay()); } return super.onSpawn(npc); } - public static void main(String[] args) - { + public static void main(String[] args) { new NpcBuffers(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/NpcBuffers/NpcBuffersData.java b/src/main/java/com/l2jserver/datapack/ai/npc/NpcBuffers/NpcBuffersData.java index b12aef7ea3..dea8d57ab6 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/NpcBuffers/NpcBuffersData.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/NpcBuffers/NpcBuffersData.java @@ -36,51 +36,39 @@ import com.l2jserver.gameserver.util.IXmlReader; * NPC Buffers data. * @author UnAfraid */ -public class NpcBuffersData implements IXmlReader -{ +public class NpcBuffersData implements IXmlReader { private static final Logger LOG = LoggerFactory.getLogger(NpcBuffersData.class); private final Map<Integer, NpcBufferData> _npcBuffers = new HashMap<>(); - protected NpcBuffersData() - { + protected NpcBuffersData() { load(); } @Override - public void load() - { + public void load() { parseDatapackFile("data/ai/npc/buffer/NpcBuffersData.xml"); LOG.info("Loaded {} buffers data.", _npcBuffers.size()); } @Override - public void parseDocument(Document doc) - { + public void parseDocument(Document doc) { StatsSet set; Node attr; NamedNodeMap attrs; - for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) - { - if ("list".equalsIgnoreCase(n.getNodeName())) - { - for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) - { - if ("npc".equalsIgnoreCase(d.getNodeName())) - { + for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) { + if ("list".equalsIgnoreCase(n.getNodeName())) { + for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) { + if ("npc".equalsIgnoreCase(d.getNodeName())) { attrs = d.getAttributes(); final int npcId = parseInteger(attrs, "id"); final NpcBufferData npc = new NpcBufferData(npcId); - for (Node c = d.getFirstChild(); c != null; c = c.getNextSibling()) - { - switch (c.getNodeName()) - { - case "skill": - { + for (Node c = d.getFirstChild(); c != null; c = c.getNextSibling()) { + switch (c.getNodeName()) { + case "skill": { attrs = c.getAttributes(); set = new StatsSet(); - for (int i = 0; i < attrs.getLength(); i++) - { + for (int i = 0; i < attrs.getLength(); i++) { attr = attrs.item(i); set.set(attr.getNodeName(), attr.getNodeValue()); } @@ -96,18 +84,15 @@ public class NpcBuffersData implements IXmlReader } } - public NpcBufferData getNpcBuffer(int npcId) - { + public NpcBufferData getNpcBuffer(int npcId) { return _npcBuffers.get(npcId); } - public Collection<NpcBufferData> getNpcBuffers() - { + public Collection<NpcBufferData> getNpcBuffers() { return _npcBuffers.values(); } - public Set<Integer> getNpcBufferIds() - { + public Set<Integer> getNpcBufferIds() { return _npcBuffers.keySet(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/NpcBuffers/impl/CabaleBuffer.java b/src/main/java/com/l2jserver/datapack/ai/npc/NpcBuffers/impl/CabaleBuffer.java index 162f7bc88a..0f3a958312 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/NpcBuffers/impl/CabaleBuffer.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/NpcBuffers/impl/CabaleBuffer.java @@ -35,20 +35,17 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Preacher of Doom and Orator of Revelations AI * @author UnAfraid, malyelfik */ -public final class CabaleBuffer extends AbstractNpcAI -{ +public final class CabaleBuffer extends AbstractNpcAI { private static final int DISTANCE_TO_WATCH_OBJECT = 900; // Messages - public static final NpcStringId[] ORATOR_MSG = - { + public static final NpcStringId[] ORATOR_MSG = { NpcStringId.THE_DAY_OF_JUDGMENT_IS_NEAR, NpcStringId.THE_PROPHECY_OF_DARKNESS_HAS_BEEN_FULFILLED, NpcStringId.AS_FORETOLD_IN_THE_PROPHECY_OF_DARKNESS_THE_ERA_OF_CHAOS_HAS_BEGUN, NpcStringId.THE_PROPHECY_OF_DARKNESS_HAS_COME_TO_PASS }; - public static final NpcStringId[] PREACHER_MSG = - { + public static final NpcStringId[] PREACHER_MSG = { NpcStringId.THIS_WORLD_WILL_SOON_BE_ANNIHILATED, NpcStringId.ALL_IS_LOST_PREPARE_TO_MEET_THE_GODDESS_OF_DEATH, NpcStringId.ALL_IS_LOST_THE_PROPHECY_OF_DESTRUCTION_HAS_BEEN_FULFILLED, @@ -61,44 +58,36 @@ public final class CabaleBuffer extends AbstractNpcAI private static final int PREACHER_FIGTER = 4361; private static final int PREACHER_MAGE = 4362; - private CabaleBuffer() - { + private CabaleBuffer() { super(CabaleBuffer.class.getSimpleName(), "ai/npc"); addFirstTalkId(SevenSigns.ORATOR_NPC_ID, SevenSigns.PREACHER_NPC_ID); addSpawnId(SevenSigns.ORATOR_NPC_ID, SevenSigns.PREACHER_NPC_ID); } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return null; } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { ThreadPoolManager.getInstance().scheduleGeneral(new CabaleAI(npc), 3000); ThreadPoolManager.getInstance().scheduleGeneral(new Talk(npc), 60000); return super.onSpawn(npc); } - protected class Talk implements Runnable - { + protected class Talk implements Runnable { private final L2Npc _npc; - protected Talk(L2Npc npc) - { + protected Talk(L2Npc npc) { _npc = npc; } @Override - public void run() - { - if ((_npc != null) && !_npc.isDecayed()) - { + public void run() { + if ((_npc != null) && !_npc.isDecayed()) { NpcStringId[] messages = ORATOR_MSG; - if (_npc.getId() == SevenSigns.PREACHER_NPC_ID) - { + if (_npc.getId() == SevenSigns.PREACHER_NPC_ID) { messages = PREACHER_MSG; } broadcastSay(_npc, messages[getRandom(messages.length)], null, -1); @@ -107,20 +96,16 @@ public final class CabaleBuffer extends AbstractNpcAI } } - protected class CabaleAI implements Runnable - { + protected class CabaleAI implements Runnable { private final L2Npc _npc; - protected CabaleAI(L2Npc npc) - { + protected CabaleAI(L2Npc npc) { _npc = npc; } @Override - public void run() - { - if ((_npc == null) || !_npc.isVisible()) - { + public void run() { + if ((_npc == null) || !_npc.isVisible()) { return; } @@ -130,88 +115,58 @@ public final class CabaleBuffer extends AbstractNpcAI final int winningCabal = SevenSigns.getInstance().getCabalHighestScore(); int losingCabal = SevenSigns.CABAL_NULL; - if (winningCabal == SevenSigns.CABAL_DAWN) - { + if (winningCabal == SevenSigns.CABAL_DAWN) { losingCabal = SevenSigns.CABAL_DUSK; - } - else if (winningCabal == SevenSigns.CABAL_DUSK) - { + } else if (winningCabal == SevenSigns.CABAL_DUSK) { losingCabal = SevenSigns.CABAL_DAWN; } Collection<L2PcInstance> plrs = _npc.getKnownList().getKnownPlayers().values(); - for (L2PcInstance player : plrs) - { - if ((player == null) || player.isInvul()) - { + for (L2PcInstance player : plrs) { + if ((player == null) || player.isInvul()) { continue; } final int playerCabal = SevenSigns.getInstance().getPlayerCabal(player.getObjectId()); - if ((playerCabal == winningCabal) && (playerCabal != SevenSigns.CABAL_NULL) && (_npc.getId() == SevenSigns.ORATOR_NPC_ID)) - { - if (!player.isMageClass()) - { - if (handleCast(player, ORATOR_FIGTER)) - { - if (getAbnormalLvl(player, ORATOR_FIGTER) == 2) - { + if ((playerCabal == winningCabal) && (playerCabal != SevenSigns.CABAL_NULL) && (_npc.getId() == SevenSigns.ORATOR_NPC_ID)) { + if (!player.isMageClass()) { + if (handleCast(player, ORATOR_FIGTER)) { + if (getAbnormalLvl(player, ORATOR_FIGTER) == 2) { broadcastSay(_npc, NpcStringId.S1_I_GIVE_YOU_THE_BLESSING_OF_PROPHECY, player.getName(), 500); - } - else - { + } else { broadcastSay(_npc, NpcStringId.I_BESTOW_UPON_YOU_A_BLESSING, null, 1); } isBuffAWinner = true; continue; } - } - else - { - if (handleCast(player, ORATOR_MAGE)) - { - if (getAbnormalLvl(player, ORATOR_MAGE) == 2) - { + } else { + if (handleCast(player, ORATOR_MAGE)) { + if (getAbnormalLvl(player, ORATOR_MAGE) == 2) { broadcastSay(_npc, NpcStringId.S1_I_BESTOW_UPON_YOU_THE_AUTHORITY_OF_THE_ABYSS, player.getName(), 500); - } - else - { + } else { broadcastSay(_npc, NpcStringId.HERALD_OF_THE_NEW_ERA_OPEN_YOUR_EYES, null, 1); } isBuffAWinner = true; continue; } } - } - else if ((playerCabal == losingCabal) && (playerCabal != SevenSigns.CABAL_NULL) && (_npc.getId() == SevenSigns.PREACHER_NPC_ID)) - { - if (!player.isMageClass()) - { - if (handleCast(player, PREACHER_FIGTER)) - { - if (getAbnormalLvl(player, PREACHER_FIGTER) == 2) - { + } else if ((playerCabal == losingCabal) && (playerCabal != SevenSigns.CABAL_NULL) && (_npc.getId() == SevenSigns.PREACHER_NPC_ID)) { + if (!player.isMageClass()) { + if (handleCast(player, PREACHER_FIGTER)) { + if (getAbnormalLvl(player, PREACHER_FIGTER) == 2) { broadcastSay(_npc, NpcStringId.A_CURSE_UPON_YOU, player.getName(), 500); - } - else - { + } else { broadcastSay(_npc, NpcStringId.YOU_DONT_HAVE_ANY_HOPE_YOUR_END_HAS_COME, null, 1); } isBuffALoser = true; continue; } - } - else - { - if (handleCast(player, PREACHER_MAGE)) - { - if (getAbnormalLvl(player, PREACHER_MAGE) == 2) - { + } else { + if (handleCast(player, PREACHER_MAGE)) { + if (getAbnormalLvl(player, PREACHER_MAGE) == 2) { broadcastSay(_npc, NpcStringId.S1_YOU_MIGHT_AS_WELL_GIVE_UP, player.getName(), 500); - } - else - { + } else { broadcastSay(_npc, NpcStringId.S1_YOU_BRING_AN_ILL_WIND, player.getName(), 1); } isBuffALoser = true; @@ -220,8 +175,7 @@ public final class CabaleBuffer extends AbstractNpcAI } } - if (isBuffAWinner && isBuffALoser) - { + if (isBuffAWinner && isBuffALoser) { break; } } @@ -244,10 +198,8 @@ public final class CabaleBuffer extends AbstractNpcAI * @param skillId * @return */ - private boolean handleCast(L2PcInstance player, int skillId) - { - if (player.isDead() || !player.isVisible() || !_npc.isInsideRadius(player, DISTANCE_TO_WATCH_OBJECT, false, false)) - { + private boolean handleCast(L2PcInstance player, int skillId) { + if (player.isDead() || !player.isVisible() || !_npc.isInsideRadius(player, DISTANCE_TO_WATCH_OBJECT, false, false)) { return false; } @@ -255,19 +207,15 @@ public final class CabaleBuffer extends AbstractNpcAI int skillLevel = 1; final int level = getAbnormalLvl(player, skillId); - if (level == 0) - { + if (level == 0) { doCast = true; - } - else if ((level == 1) && (getRandom(100) < 5)) - { + } else if ((level == 1) && (getRandom(100) < 5)) { doCast = true; skillLevel = 2; } - if (doCast) - { + if (doCast) { final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); _npc.setTarget(player); _npc.doCast(skill); @@ -277,26 +225,20 @@ public final class CabaleBuffer extends AbstractNpcAI } } - public void broadcastSay(L2Npc npc, NpcStringId message, String param, int chance) - { - if (chance == -1) - { + public void broadcastSay(L2Npc npc, NpcStringId message, String param, int chance) { + if (chance == -1) { broadcastNpcSay(npc, Say2.NPC_ALL, message); - } - else if (getRandom(10000) < chance) - { + } else if (getRandom(10000) < chance) { broadcastNpcSay(npc, Say2.NPC_ALL, message, param); } } - public int getAbnormalLvl(L2PcInstance player, int skillId) - { + public int getAbnormalLvl(L2PcInstance player, int skillId) { final BuffInfo info = player.getEffectList().getBuffInfoBySkillId(skillId); return (info != null) ? info.getSkill().getAbnormalLvl() : 0; } - public static void main(String[] args) - { + public static void main(String[] args) { new CabaleBuffer(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/PriestOfBlessing/PriestOfBlessing.java b/src/main/java/com/l2jserver/datapack/ai/npc/PriestOfBlessing/PriestOfBlessing.java index 26cbc61fab..73ed775673 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/PriestOfBlessing/PriestOfBlessing.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/PriestOfBlessing/PriestOfBlessing.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Priest Of Blessing AI. * @author Gnacik */ -public final class PriestOfBlessing extends AbstractNpcAI -{ +public final class PriestOfBlessing extends AbstractNpcAI { // NPC private static final int PRIEST = 32783; // Spawn state @@ -53,8 +52,7 @@ public final class PriestOfBlessing extends AbstractNpcAI // @formatter:on // Prices private static final int PRICE_VOICE = 100000; - private static final int[] PRICE_HOURGLASS = - { + private static final int[] PRICE_HOURGLASS = { 4000, 30000, 110000, @@ -64,8 +62,7 @@ public final class PriestOfBlessing extends AbstractNpcAI 5000000 }; // Locations - private static final Location[] SPAWNS = - { + private static final Location[] SPAWNS = { new Location(-84139, 243145, -3704, 8473), new Location(-119702, 44557, 360, 33023), new Location(45413, 48351, -3056, 50020), @@ -85,17 +82,14 @@ public final class PriestOfBlessing extends AbstractNpcAI new Location(116972, 77255, -2688, 41951) }; - private PriestOfBlessing() - { + private PriestOfBlessing() { super(PriestOfBlessing.class.getSimpleName(), "ai/npc"); addStartNpc(PRIEST); addFirstTalkId(PRIEST); addTalkId(PRIEST); - if (!SPAWNED) - { - for (Location spawn : SPAWNS) - { + if (!SPAWNED) { + for (Location spawn : SPAWNS) { addSpawn(PRIEST, spawn, false, 0); } SPAWNED = true; @@ -103,24 +97,18 @@ public final class PriestOfBlessing extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; - if (event.equalsIgnoreCase("buy_voice")) - { - if (player.getAdena() >= PRICE_VOICE) - { + if (event.equalsIgnoreCase("buy_voice")) { + if (player.getAdena() >= PRICE_VOICE) { String value = loadGlobalQuestVar(player.getAccountName() + "_voice"); long _reuse_time = value == "" ? 0 : Long.parseLong(value); - if (System.currentTimeMillis() > _reuse_time) - { + if (System.currentTimeMillis() > _reuse_time) { takeItems(player, Inventory.ADENA_ID, PRICE_VOICE); giveItems(player, NEVIT_VOICE, 1); saveGlobalQuestVar(player.getAccountName() + "_voice", Long.toString(System.currentTimeMillis() + (20 * 3600000))); - } - else - { + } else { long remainingTime = (_reuse_time - System.currentTimeMillis()) / 1000; int hours = (int) (remainingTime / 3600); int minutes = (int) ((remainingTime % 3600) / 60); @@ -133,27 +121,21 @@ public final class PriestOfBlessing extends AbstractNpcAI return null; } htmltext = "32783-adena.htm"; - } - else if (event.equalsIgnoreCase("buy_hourglass")) - { + } else if (event.equalsIgnoreCase("buy_hourglass")) { int _index = getHGIndex(player.getLevel()); int _price_hourglass = PRICE_HOURGLASS[_index]; - if (player.getAdena() >= _price_hourglass) - { + if (player.getAdena() >= _price_hourglass) { String value = loadGlobalQuestVar(player.getAccountName() + "_hg_" + _index); long _reuse_time = value == "" ? 0 : Long.parseLong(value); - if (System.currentTimeMillis() > _reuse_time) - { + if (System.currentTimeMillis() > _reuse_time) { int[] _hg = HOURGLASSES[_index]; int _nevit_hourglass = _hg[getRandom(0, _hg.length - 1)]; takeItems(player, Inventory.ADENA_ID, _price_hourglass); giveItems(player, _nevit_hourglass, 1); saveGlobalQuestVar(player.getAccountName() + "_hg_" + _index, Long.toString(System.currentTimeMillis() + (20 * 3600000))); - } - else - { + } else { long remainingTime = (_reuse_time - System.currentTimeMillis()) / 1000; int hours = (int) (remainingTime / 3600); int minutes = (int) ((remainingTime % 3600) / 60); @@ -171,49 +153,33 @@ public final class PriestOfBlessing extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { String content = getHtm(player.getHtmlPrefix(), "32783.htm"); content = content.replace("%donate%", Util.formatAdena(PRICE_HOURGLASS[getHGIndex(player.getLevel())])); return content; } - private int getHGIndex(int lvl) - { + private int getHGIndex(int lvl) { int index = 0; - if (lvl < 20) - { + if (lvl < 20) { index = 0; - } - else if (lvl < 40) - { + } else if (lvl < 40) { index = 1; - } - else if (lvl < 52) - { + } else if (lvl < 52) { index = 2; - } - else if (lvl < 61) - { + } else if (lvl < 61) { index = 3; - } - else if (lvl < 76) - { + } else if (lvl < 76) { index = 4; - } - else if (lvl < 80) - { + } else if (lvl < 80) { index = 5; - } - else if (lvl < 86) - { + } else if (lvl < 86) { index = 6; } return index; } - public static void main(String[] args) - { + public static void main(String[] args) { new PriestOfBlessing(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Rafforty/Rafforty.java b/src/main/java/com/l2jserver/datapack/ai/npc/Rafforty/Rafforty.java index de15b12ee3..8449baa1b7 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Rafforty/Rafforty.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Rafforty/Rafforty.java @@ -26,8 +26,7 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Rafforty AI. * @author malyelfik, Gladicek */ -public final class Rafforty extends AbstractNpcAI -{ +public final class Rafforty extends AbstractNpcAI { // NPC private static final int RAFFORTY = 32020; // Items @@ -36,26 +35,21 @@ public final class Rafforty extends AbstractNpcAI private static final int BOTTLE = 16027; @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; - switch (event) - { + switch (event) { case "32020-01.html": - if (!hasQuestItems(player, NECKLACE)) - { + if (!hasQuestItems(player, NECKLACE)) { htmltext = "32020-02.html"; } break; case "32020-04.html": - if (!hasQuestItems(player, BOTTLE)) - { + if (!hasQuestItems(player, BOTTLE)) { htmltext = "32020-05.html"; } break; case "32020-07.html": - if (!hasQuestItems(player, BOTTLE, NECKLACE)) - { + if (!hasQuestItems(player, BOTTLE, NECKLACE)) { return "32020-08.html"; } takeItems(player, NECKLACE, 1); @@ -66,16 +60,14 @@ public final class Rafforty extends AbstractNpcAI return htmltext; } - private Rafforty() - { + private Rafforty() { super(Rafforty.class.getSimpleName(), "ai/npc"); addStartNpc(RAFFORTY); addFirstTalkId(RAFFORTY); addTalkId(RAFFORTY); } - public static void main(String[] args) - { + public static void main(String[] args) { new Rafforty(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Rignos/Rignos.java b/src/main/java/com/l2jserver/datapack/ai/npc/Rignos/Rignos.java index ba52de3d05..480ab914d0 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Rignos/Rignos.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Rignos/Rignos.java @@ -27,8 +27,7 @@ import com.l2jserver.gameserver.model.holders.SkillHolder; * Rignos AI. * @author St3eT */ -public class Rignos extends AbstractNpcAI -{ +public class Rignos extends AbstractNpcAI { // NPC private static final int RIGNOS = 32349; // Rignos // Item @@ -39,8 +38,7 @@ public class Rignos extends AbstractNpcAI // Misc private static final int MIN_LV = 78; - private Rignos() - { + private Rignos() { super(Rignos.class.getSimpleName(), "ai/npc"); addStartNpc(RIGNOS); addTalkId(RIGNOS); @@ -48,44 +46,34 @@ public class Rignos extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { - case "32349-03.html": - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { + case "32349-03.html": { return event; } - case "startRace": - { - if (npc.isScriptValue(0)) - { + case "startRace": { + if (npc.isScriptValue(0)) { npc.setScriptValue(1); startQuestTimer("TIME_OUT", 1800000, npc, null); TIMER.getSkill().applyEffects(player, player); - if (player.hasSummon()) - { + if (player.hasSummon()) { TIMER.getSkill().applyEffects(player.getSummon(), player.getSummon()); } - if (hasQuestItems(player, STAMP)) - { + if (hasQuestItems(player, STAMP)) { takeItems(player, STAMP, -1); } } break; } - case "exchange": - { - if (getQuestItemsCount(player, STAMP) >= 4) - { + case "exchange": { + if (getQuestItemsCount(player, STAMP) >= 4) { giveItems(player, KEY, 3); takeItems(player, STAMP, -1); } break; } - case "TIME_OUT": - { + case "TIME_OUT": { npc.setScriptValue(0); break; } @@ -94,18 +82,15 @@ public class Rignos extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { String htmltext = (npc.isScriptValue(0) && (player.getLevel() >= MIN_LV)) ? "32349.html" : "32349-02.html"; - if (getQuestItemsCount(player, STAMP) >= 4) - { + if (getQuestItemsCount(player, STAMP) >= 4) { htmltext = "32349-01.html"; } return htmltext; } - public static void main(String[] args) - { + public static void main(String[] args) { new Rignos(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Selina/Selina.java b/src/main/java/com/l2jserver/datapack/ai/npc/Selina/Selina.java index e9513d1882..220135713c 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Selina/Selina.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Selina/Selina.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.skills.Skill; * Mercenary Medic Selina AI. * @author Zoey76 */ -public final class Selina extends AbstractNpcAI -{ +public final class Selina extends AbstractNpcAI { // NPC private static final int SELINA = 31556; // Items @@ -42,8 +41,7 @@ public final class Selina extends AbstractNpcAI // Skills private static final Map<String, BuffHolder> BUFFS = new HashMap<>(); - static - { + static { BUFFS.put("4359", new BuffHolder(4359, 2, 2)); // Focus BUFFS.put("4360", new BuffHolder(4360, 2, 2)); // Death Whisper BUFFS.put("4345", new BuffHolder(4345, 3, 3)); // Might @@ -54,8 +52,7 @@ public final class Selina extends AbstractNpcAI BUFFS.put("4357", new BuffHolder(4357, 2, 6)); // Haste } - public Selina() - { + public Selina() { super(Selina.class.getSimpleName(), "ai/npc"); addStartNpc(SELINA); addTalkId(SELINA); @@ -64,71 +61,54 @@ public final class Selina extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final BuffHolder buff = BUFFS.get(event); - if (buff != null) - { - if ((getQuestItemsCount(player, GOLDEN_RAM_COIN) >= buff.getCost())) - { + if (buff != null) { + if ((getQuestItemsCount(player, GOLDEN_RAM_COIN) >= buff.getCost())) { castSkill(npc, player, buff); return super.onAdvEvent(event, npc, player); } - } - else - { + } else { _log.warning(Selina.class.getSimpleName() + " AI: player " + player + " sent invalid bypass: " + event); } return "31556-02.html"; } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { final String htmltext; - if (hasQuestItems(player, GOLDEN_RAM_BADGE_SOLDIER)) - { + if (hasQuestItems(player, GOLDEN_RAM_BADGE_SOLDIER)) { htmltext = "31556-08.html"; - } - else if (hasQuestItems(player, GOLDEN_RAM_BADGE_RECRUIT)) - { + } else if (hasQuestItems(player, GOLDEN_RAM_BADGE_RECRUIT)) { htmltext = "31556-01.html"; - } - else - { + } else { htmltext = "31556-09.html"; } return htmltext; } @Override - public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) - { + public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) { final BuffHolder buff = BUFFS.get(Integer.toString(skill.getId())); - if (buff != null) - { + if (buff != null) { takeItems(player, GOLDEN_RAM_COIN, buff.getCost()); } return super.onSpellFinished(npc, player, skill); } - public static void main(String[] args) - { + public static void main(String[] args) { new Selina(); } - private static class BuffHolder extends SkillHolder - { + private static class BuffHolder extends SkillHolder { private final int _cost; - public BuffHolder(int skillId, int skillLvl, int cost) - { + public BuffHolder(int skillId, int skillLvl, int cost) { super(skillId, skillLvl); _cost = cost; } - public int getCost() - { + public int getCost() { return _cost; } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Sirra/Sirra.java b/src/main/java/com/l2jserver/datapack/ai/npc/Sirra/Sirra.java index 49b42b7f96..bda708c88d 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Sirra/Sirra.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Sirra/Sirra.java @@ -28,38 +28,31 @@ import com.l2jserver.gameserver.model.instancezone.InstanceWorld; * Sirra AI. * @author St3eT */ -public final class Sirra extends AbstractNpcAI -{ +public final class Sirra extends AbstractNpcAI { // NPC private static final int SIRRA = 32762; // Misc private static final int FREYA_INSTID = 139; private static final int FREYA_HARD_INSTID = 144; - private Sirra() - { + private Sirra() { super(Sirra.class.getSimpleName(), "ai/npc"); addFirstTalkId(SIRRA); } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { final InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if ((world != null) && (world.getTemplateId() == FREYA_INSTID)) - { + if ((world != null) && (world.getTemplateId() == FREYA_INSTID)) { return (world.isStatus(0)) ? "32762-easy.html" : "32762-easyfight.html"; - } - else if ((world != null) && (world.getTemplateId() == FREYA_HARD_INSTID)) - { + } else if ((world != null) && (world.getTemplateId() == FREYA_HARD_INSTID)) { return (world.isStatus(0)) ? "32762-hard.html" : "32762-hardfight.html"; } return "32762.html"; } - public static void main(String[] args) - { + public static void main(String[] args) { new Sirra(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/SubclassCertification/SubclassCertification.java b/src/main/java/com/l2jserver/datapack/ai/npc/SubclassCertification/SubclassCertification.java index fc97b93d62..525614666e 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/SubclassCertification/SubclassCertification.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/SubclassCertification/SubclassCertification.java @@ -37,8 +37,7 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Subclass certification * @author xban1x, jurchiks */ -public final class SubclassCertification extends AbstractNpcAI -{ +public final class SubclassCertification extends AbstractNpcAI { // @formatter:off private static final int[] NPCS = { @@ -60,8 +59,7 @@ public final class SubclassCertification extends AbstractNpcAI private static final int CERTIFICATE_MASTER_ABILITY = 10612; private static final Map<Integer, Integer> ABILITY_CERTIFICATES = new HashMap<>(); private static final Map<Integer, Integer> TRANSFORMATION_SEALBOOKS = new HashMap<>(); - static - { + static { ABILITY_CERTIFICATES.put(0, 10281); // Certificate - Warrior Ability ABILITY_CERTIFICATES.put(1, 10283); // Certificate - Rogue Ability ABILITY_CERTIFICATES.put(2, 10282); // Certificate - Knight Ability @@ -81,20 +79,17 @@ public final class SubclassCertification extends AbstractNpcAI private static final int MIN_LVL = 65; - private SubclassCertification() - { + private SubclassCertification() { super(SubclassCertification.class.getSimpleName(), "ai/npc"); addStartNpc(NPCS); addTalkId(NPCS); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st != null) - { + if (st != null) { st.setState(State.STARTED); htmltext = "Main.html"; } @@ -102,86 +97,65 @@ public final class SubclassCertification extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { - case "GetCertified": - { - if (!player.isSubClassActive()) - { + switch (event) { + case "GetCertified": { + if (!player.isSubClassActive()) { htmltext = "NotSubclass.html"; - } - else if (player.getLevel() < MIN_LVL) - { + } else if (player.getLevel() < MIN_LVL) { htmltext = "NotMinLevel.html"; - } - else if (((L2VillageMasterInstance) npc).checkVillageMaster(player.getActiveClass())) - { + } else if (((L2VillageMasterInstance) npc).checkVillageMaster(player.getActiveClass())) { htmltext = "CertificationList.html"; - } - else - { + } else { htmltext = "WrongVillageMaster.html"; } break; } - case "Obtain65": - { + case "Obtain65": { htmltext = replaceHtml(player, "EmergentAbility.html", true, null).replace("%level%", "65").replace("%skilltype%", "common skill").replace("%event%", "lvl65Emergent"); break; } - case "Obtain70": - { + case "Obtain70": { htmltext = replaceHtml(player, "EmergentAbility.html", true, null).replace("%level%", "70").replace("%skilltype%", "common skill").replace("%event%", "lvl70Emergent"); break; } - case "Obtain75": - { + case "Obtain75": { htmltext = replaceHtml(player, "ClassAbility.html", true, null); break; } - case "Obtain80": - { + case "Obtain80": { htmltext = replaceHtml(player, "EmergentAbility.html", true, null).replace("%level%", "80").replace("%skilltype%", "transformation skill").replace("%event%", "lvl80Class"); break; } - case "lvl65Emergent": - { + case "lvl65Emergent": { htmltext = doCertification(player, st, "EmergentAbility", CERTIFICATE_EMERGENT_ABILITY, 65); break; } - case "lvl70Emergent": - { + case "lvl70Emergent": { htmltext = doCertification(player, st, "EmergentAbility", CERTIFICATE_EMERGENT_ABILITY, 70); break; } - case "lvl75Master": - { + case "lvl75Master": { htmltext = doCertification(player, st, "ClassAbility", CERTIFICATE_MASTER_ABILITY, 75); break; } - case "lvl75Class": - { + case "lvl75Class": { htmltext = doCertification(player, st, "ClassAbility", ABILITY_CERTIFICATES.get(getClassIndex(player)), 75); break; } - case "lvl80Class": - { + case "lvl80Class": { htmltext = doCertification(player, st, "ClassAbility", TRANSFORMATION_SEALBOOKS.get(getClassIndex(player)), 80); break; } case "Main.html": case "Explanation.html": - case "NotObtain.html": - { + case "NotObtain.html": { htmltext = event; break; } @@ -189,58 +163,39 @@ public final class SubclassCertification extends AbstractNpcAI return htmltext; } - private String replaceHtml(L2PcInstance player, String htmlFile, boolean replaceClass, String levelToReplace) - { + private String replaceHtml(L2PcInstance player, String htmlFile, boolean replaceClass, String levelToReplace) { String htmltext = getHtm(player.getHtmlPrefix(), htmlFile); - if (replaceClass) - { + if (replaceClass) { htmltext = htmltext.replace("%class%", String.valueOf(ClassListData.getInstance().getClass(player.getActiveClass()).getClientCode())); } - if (levelToReplace != null) - { + if (levelToReplace != null) { htmltext = htmltext.replace("%level%", levelToReplace); } return htmltext; } - private static int getClassIndex(L2PcInstance player) - { - if (player.isInCategory(CategoryType.SUB_GROUP_WARRIOR)) - { + private static int getClassIndex(L2PcInstance player) { + if (player.isInCategory(CategoryType.SUB_GROUP_WARRIOR)) { return 0; - } - else if (player.isInCategory(CategoryType.SUB_GROUP_ROGUE)) - { + } else if (player.isInCategory(CategoryType.SUB_GROUP_ROGUE)) { return 1; - } - else if (player.isInCategory(CategoryType.SUB_GROUP_KNIGHT)) - { + } else if (player.isInCategory(CategoryType.SUB_GROUP_KNIGHT)) { return 2; - } - else if (player.isInCategory(CategoryType.SUB_GROUP_SUMMONER)) - { + } else if (player.isInCategory(CategoryType.SUB_GROUP_SUMMONER)) { return 3; - } - else if (player.isInCategory(CategoryType.SUB_GROUP_WIZARD)) - { + } else if (player.isInCategory(CategoryType.SUB_GROUP_WIZARD)) { return 4; - } - else if (player.isInCategory(CategoryType.SUB_GROUP_HEALER)) - { + } else if (player.isInCategory(CategoryType.SUB_GROUP_HEALER)) { return 5; - } - else if (player.isInCategory(CategoryType.SUB_GROUP_ENCHANTER)) - { + } else if (player.isInCategory(CategoryType.SUB_GROUP_ENCHANTER)) { return 6; } return -1; } - private String doCertification(L2PcInstance player, QuestState qs, String variable, Integer itemId, int level) - { - if (itemId == null) - { + private String doCertification(L2PcInstance player, QuestState qs, String variable, Integer itemId, int level) { + if (itemId == null) { return null; } @@ -248,20 +203,14 @@ public final class SubclassCertification extends AbstractNpcAI String tmp = variable + level + "-" + player.getClassIndex(); String globalVariable = qs.getGlobalQuestVar(tmp); - if (!globalVariable.equals("") && !globalVariable.equals("0")) - { + if (!globalVariable.equals("") && !globalVariable.equals("0")) { htmltext = "AlreadyReceived.html"; - } - else if (player.getLevel() < level) - { + } else if (player.getLevel() < level) { htmltext = replaceHtml(player, "LowLevel.html", false, Integer.toString(level)); - } - else - { + } else { // Add items to player's inventory final L2ItemInstance item = player.getInventory().addItem("Quest", itemId, 1, player, player.getTarget()); - if (item == null) - { + if (item == null) { return null; } @@ -275,8 +224,7 @@ public final class SubclassCertification extends AbstractNpcAI return htmltext; } - public static void main(String[] args) - { + public static void main(String[] args) { new SubclassCertification(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Summons/MerchantGolem/GolemTrader.java b/src/main/java/com/l2jserver/datapack/ai/npc/Summons/MerchantGolem/GolemTrader.java index 6b69f59876..30d7c1954e 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Summons/MerchantGolem/GolemTrader.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Summons/MerchantGolem/GolemTrader.java @@ -25,26 +25,22 @@ import com.l2jserver.gameserver.model.actor.L2Npc; * Golem Trader AI. * @author Zoey76 */ -public final class GolemTrader extends AbstractNpcAI -{ +public final class GolemTrader extends AbstractNpcAI { // NPC private static final int GOLEM_TRADER = 13128; - private GolemTrader() - { + private GolemTrader() { super(GolemTrader.class.getSimpleName(), "ai/npc/Summons"); addSpawnId(GOLEM_TRADER); } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { npc.scheduleDespawn(180000); return super.onSpawn(npc); } - public static void main(String[] args) - { + public static void main(String[] args) { new GolemTrader(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Summons/Pets/BabyPets.java b/src/main/java/com/l2jserver/datapack/ai/npc/Summons/Pets/BabyPets.java index 69f9ba4051..bef7ebf5db 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Summons/Pets/BabyPets.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Summons/Pets/BabyPets.java @@ -38,11 +38,9 @@ import com.l2jserver.gameserver.util.Util; * @author St3eT * @since 2.6.0.0 */ -public final class BabyPets extends AbstractNpcAI -{ +public final class BabyPets extends AbstractNpcAI { // NPCs - private static final int[] BABY_PETS = - { + private static final int[] BABY_PETS = { 12780, // Baby Buffalo 12781, // Baby Kookaburra 12782, // Baby Cougar @@ -52,33 +50,25 @@ public final class BabyPets extends AbstractNpcAI private static final int HEAL_TRICK = 4717; private static final int GREATER_HEAL_TRICK = 4718; - private BabyPets() - { + private BabyPets() { super(BabyPets.class.getSimpleName(), "ai/npc/Summons/Pets"); addSummonSpawnId(BABY_PETS); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equals("CAST_HEAL") && (player != null)) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equals("CAST_HEAL") && (player != null)) { final L2PetInstance pet = (L2PetInstance) player.getSummon(); - if (pet != null) - { - if (getRandom(100) <= 25) - { + if (pet != null) { + if (getRandom(100) <= 25) { castHealSkill(pet, new SkillHolder(HEAL_TRICK, getHealLevel(pet)), 80); } - if (getRandom(100) <= 75) - { + if (getRandom(100) <= 75) { castHealSkill(pet, new SkillHolder(GREATER_HEAL_TRICK, getHealLevel(pet)), 15); } - } - else - { + } else { cancelQuestTimer("CAST_HEAL", null, player); } } @@ -87,26 +77,21 @@ public final class BabyPets extends AbstractNpcAI @RegisterEvent(EventType.ON_PLAYER_LOGOUT) @RegisterType(ListenerRegisterType.GLOBAL) - public void OnPlayerLogout(OnPlayerLogout event) - { + public void OnPlayerLogout(OnPlayerLogout event) { cancelQuestTimer("CAST_HEAL", null, event.getActiveChar()); } @Override - public void onSummonSpawn(L2Summon summon) - { + public void onSummonSpawn(L2Summon summon) { startQuestTimer("CAST_HEAL", 1000, null, summon.getOwner(), true); } - private void castHealSkill(L2Summon summon, SkillHolder skill, int maxHpPer) - { + private void castHealSkill(L2Summon summon, SkillHolder skill, int maxHpPer) { final L2PcInstance owner = summon.getOwner(); - if (!owner.isDead() && !summon.isHungry() && (((owner.getCurrentHp() / owner.getMaxHp()) * 100) < maxHpPer) && summon.checkDoCastConditions(skill.getSkill())) - { + if (!owner.isDead() && !summon.isHungry() && (((owner.getCurrentHp() / owner.getMaxHp()) * 100) < maxHpPer) && summon.checkDoCastConditions(skill.getSkill())) { final boolean previousFollowStatus = summon.getFollowStatus(); - if (!previousFollowStatus && !summon.isInsideRadius(owner, skill.getSkill().getCastRange(), true, true)) - { + if (!previousFollowStatus && !summon.isInsideRadius(owner, skill.getSkill().getCastRange(), true, true)) { return; } @@ -114,21 +99,18 @@ public final class BabyPets extends AbstractNpcAI summon.doCast(skill.getSkill()); summon.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.PET_USES_S1).addSkillName(skill.getSkill())); - if (previousFollowStatus != summon.getFollowStatus()) - { + if (previousFollowStatus != summon.getFollowStatus()) { summon.setFollowStatus(previousFollowStatus); } } } - private int getHealLevel(L2Summon summon) - { + private int getHealLevel(L2Summon summon) { final int summonLevel = summon.getLevel(); return Util.constrain(summonLevel < 70 ? (summonLevel / 10) : (7 + ((summonLevel - 70) / 5)), 1, 12); } - public static void main(String[] args) - { + public static void main(String[] args) { new BabyPets(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Summons/Pets/ImprovedBabyPets.java b/src/main/java/com/l2jserver/datapack/ai/npc/Summons/Pets/ImprovedBabyPets.java index f669876255..21592e2be0 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Summons/Pets/ImprovedBabyPets.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Summons/Pets/ImprovedBabyPets.java @@ -40,11 +40,9 @@ import com.l2jserver.gameserver.util.Util; * @author St3eT * @since 2.6.0.0 */ -public final class ImprovedBabyPets extends AbstractNpcAI -{ +public final class ImprovedBabyPets extends AbstractNpcAI { // NPCs - private static final int[] IMPROVED_BABY_PETS = - { + private static final int[] IMPROVED_BABY_PETS = { 16034, // Improved Baby Buffalo 16035, // Improved Baby Kookaburra 16036, // Improved Baby Cougar @@ -53,63 +51,45 @@ public final class ImprovedBabyPets extends AbstractNpcAI // Skill private static final int BUFF_CONTROL = 5771; - private ImprovedBabyPets() - { + private ImprovedBabyPets() { super(ImprovedBabyPets.class.getSimpleName(), "ai/npc/Summons/Pets"); addSummonSpawnId(IMPROVED_BABY_PETS); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (player != null) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (player != null) { final L2PetInstance pet = (L2PetInstance) player.getSummon(); - if (pet == null) - { + if (pet == null) { cancelQuestTimer("CAST_BUFF", null, player); cancelQuestTimer("CAST_HEAL", null, player); - } - else if (event.equals("CAST_HEAL") && player.isInCombat() && !pet.isHungry()) - { + } else if (event.equals("CAST_HEAL") && player.isInCombat() && !pet.isHungry()) { final double hpPer = (player.getCurrentHp() / player.getMaxHp()) * 100; final double mpPer = (player.getCurrentMp() / player.getMaxMp()) * 100; final int healStep = (int) Math.floor((pet.getLevel() / 5) - 11); final int healType = pet.getTemplate().getParameters().getInt("heal_type", 0); - switch (healType) - { - case 0: - { - if (hpPer < 30) - { + switch (healType) { + case 0: { + if (hpPer < 30) { castHealSkill(pet, Util.constrain(healStep, 0, 3), 2); - } - else if (mpPer < 60) - { + } else if (mpPer < 60) { castHealSkill(pet, Util.constrain(healStep, 0, 3), 1); } break; } - case 1: - { - if ((hpPer >= 30) && (hpPer < 70)) - { + case 1: { + if ((hpPer >= 30) && (hpPer < 70)) { castHealSkill(pet, Util.constrain(healStep, 0, 3), 1); - } - else if (hpPer < 30) - { + } else if (hpPer < 30) { castHealSkill(pet, Util.constrain(healStep, 0, 3), 2); } break; } } - } - else if (event.equals("CAST_BUFF") && !pet.isAffectedBySkill(BUFF_CONTROL) && !pet.isHungry()) - { + } else if (event.equals("CAST_BUFF") && !pet.isAffectedBySkill(BUFF_CONTROL) && !pet.isHungry()) { final int buffStep = (int) Util.constrain(Math.floor((pet.getLevel() / 5) - 11), 0, 3); - for (int i = 1; i <= (2 * (1 + buffStep)); i++) - { + for (int i = 1; i <= (2 * (1 + buffStep)); i++) { castBuffSkill(pet, buffStep, i); } } @@ -119,56 +99,46 @@ public final class ImprovedBabyPets extends AbstractNpcAI @RegisterEvent(EventType.ON_PLAYER_LOGOUT) @RegisterType(ListenerRegisterType.GLOBAL) - public void OnPlayerLogout(OnPlayerLogout event) - { + public void OnPlayerLogout(OnPlayerLogout event) { cancelQuestTimer("CAST_BUFF", null, event.getActiveChar()); cancelQuestTimer("CAST_HEAL", null, event.getActiveChar()); } @Override - public void onSummonSpawn(L2Summon summon) - { + public void onSummonSpawn(L2Summon summon) { startQuestTimer("CAST_BUFF", 10000, null, summon.getOwner(), true); startQuestTimer("CAST_HEAL", 3000, null, summon.getOwner(), true); } - private boolean castBuffSkill(L2Summon summon, int stepNumber, int buffNumber) - { + private boolean castBuffSkill(L2Summon summon, int stepNumber, int buffNumber) { final L2PcInstance owner = summon.getOwner(); - if ((owner == null) || owner.isDead() || owner.isInvul()) - { + if ((owner == null) || owner.isDead() || owner.isInvul()) { return false; } final StatsSet parameters = summon.getTemplate().getParameters(); final SkillHolder skill = parameters.getObject("step" + stepNumber + "_buff0" + buffNumber, SkillHolder.class); - if (skill != null) - { + if (skill != null) { final SkillHolder mergedSkill = parameters.getObject("step" + stepNumber + "_merged_buff0" + buffNumber, SkillHolder.class); final int targetType = parameters.getInt("step" + stepNumber + "_buff_target0" + buffNumber, 0); - if (!hasAbnormal(owner, skill.getSkill().getAbnormalType()) && summon.checkDoCastConditions(skill.getSkill())) - { - if ((mergedSkill != null) && hasAbnormal(owner, mergedSkill.getSkill().getAbnormalType())) - { + if (!hasAbnormal(owner, skill.getSkill().getAbnormalType()) && summon.checkDoCastConditions(skill.getSkill())) { + if ((mergedSkill != null) && hasAbnormal(owner, mergedSkill.getSkill().getAbnormalType())) { return false; } final boolean previousFollowStatus = summon.getFollowStatus(); - if (!previousFollowStatus && !summon.isInsideRadius(owner, skill.getSkill().getCastRange(), true, true)) - { + if (!previousFollowStatus && !summon.isInsideRadius(owner, skill.getSkill().getCastRange(), true, true)) { return false; } - if ((targetType >= 0) && (targetType <= 2)) - { + if ((targetType >= 0) && (targetType <= 2)) { summon.setTarget((targetType == 1) ? summon : owner); summon.doCast(skill.getSkill()); summon.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.PET_USES_S1).addSkillName(skill.getSkill())); - if (previousFollowStatus != summon.getFollowStatus()) - { + if (previousFollowStatus != summon.getFollowStatus()) { summon.setFollowStatus(previousFollowStatus); } return true; @@ -178,32 +148,26 @@ public final class ImprovedBabyPets extends AbstractNpcAI return false; } - private void castHealSkill(L2Summon summon, int stepNumber, int healNumber) - { + private void castHealSkill(L2Summon summon, int stepNumber, int healNumber) { final L2PcInstance owner = summon.getOwner(); final StatsSet parameters = summon.getTemplate().getParameters(); final SkillHolder skill = parameters.getObject("step" + stepNumber + "_heal0" + healNumber, SkillHolder.class); final int targetType = parameters.getInt("step" + stepNumber + "_heal_target0" + healNumber, 0); - if ((skill != null) && (owner != null) && summon.checkDoCastConditions(skill.getSkill()) && !owner.isDead()) - { + if ((skill != null) && (owner != null) && summon.checkDoCastConditions(skill.getSkill()) && !owner.isDead()) { final boolean previousFollowStatus = summon.getFollowStatus(); - if (!previousFollowStatus && !summon.isInsideRadius(owner, skill.getSkill().getCastRange(), true, true)) - { + if (!previousFollowStatus && !summon.isInsideRadius(owner, skill.getSkill().getCastRange(), true, true)) { return; } - if (!hasAbnormal(owner, skill.getSkill().getAbnormalType())) - { - if ((targetType >= 0) && (targetType <= 2)) - { + if (!hasAbnormal(owner, skill.getSkill().getAbnormalType())) { + if ((targetType >= 0) && (targetType <= 2)) { summon.setTarget((targetType == 1) ? summon : owner); summon.doCast(skill.getSkill()); summon.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.PET_USES_S1).addSkillName(skill.getSkill())); - if (previousFollowStatus != summon.getFollowStatus()) - { + if (previousFollowStatus != summon.getFollowStatus()) { summon.setFollowStatus(previousFollowStatus); } } @@ -211,13 +175,11 @@ public final class ImprovedBabyPets extends AbstractNpcAI } } - private static boolean hasAbnormal(L2PcInstance player, AbnormalType type) - { + private static boolean hasAbnormal(L2PcInstance player, AbnormalType type) { return player.getEffectList().getBuffInfoByAbnormalType(type) != null; } - public static void main(String[] args) - { + public static void main(String[] args) { new ImprovedBabyPets(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Summons/Servitors/Servitors.java b/src/main/java/com/l2jserver/datapack/ai/npc/Summons/Servitors/Servitors.java index 2185f7f8ac..f43a8bf32f 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Summons/Servitors/Servitors.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Summons/Servitors/Servitors.java @@ -42,8 +42,7 @@ import com.l2jserver.gameserver.util.Util; * Servitor AI for quest Test Of The Summoner (230). * @author Zoey76 */ -public final class Servitors extends AbstractNpcAI -{ +public final class Servitors extends AbstractNpcAI { // Quest Monster private static final int PAKO_THE_CAT = 27102; private static final int UNICORN_RACER = 27103; @@ -72,8 +71,7 @@ public final class Servitors extends AbstractNpcAI private static final int CRYSTAL_OF_DEFEAT_6TH = 3388; private static final Map<Integer, List<Integer>> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(PAKO_THE_CAT, Arrays.asList(CRYSTAL_OF_STARTING_1ST, CRYSTAL_OF_INPROGRESS_1ST, CRYSTAL_OF_DEFEAT_1ST)); MONSTERS.put(UNICORN_RACER, Arrays.asList(CRYSTAL_OF_STARTING_3RD, CRYSTAL_OF_INPROGRESS_3RD, CRYSTAL_OF_DEFEAT_3RD)); MONSTERS.put(SHADOW_TUREN, Arrays.asList(CRYSTAL_OF_STARTING_5TH, CRYSTAL_OF_INPROGRESS_5TH, CRYSTAL_OF_DEFEAT_5TH)); @@ -82,8 +80,7 @@ public final class Servitors extends AbstractNpcAI MONSTERS.put(SILHOUETTE_TILFO, Arrays.asList(CRYSTAL_OF_STARTING_6TH, CRYSTAL_OF_INPROGRESS_6TH, CRYSTAL_OF_DEFEAT_6TH)); } - private Servitors() - { + private Servitors() { super(Servitors.class.getSimpleName(), "ai/npc/Summons"); } @@ -105,17 +102,14 @@ public final class Servitors extends AbstractNpcAI 14527, 14528, 14529, 14530 }) // @formatter:on - public void onCreatureKill(OnCreatureKill event) - { + public void onCreatureKill(OnCreatureKill event) { if (event.getAttacker().isNpc() && event.getTarget().isServitor() // - && Util.checkIfInRange(1500, event.getAttacker(), event.getTarget(), true)) - { + && Util.checkIfInRange(1500, event.getAttacker(), event.getTarget(), true)) { final L2ServitorInstance target = (L2ServitorInstance) event.getTarget(); final L2PcInstance master = target.getOwner(); final QuestState qs = master.getQuestState(Q00230_TestOfTheSummoner.class.getSimpleName()); - if ((qs != null) && hasQuestItems(master, CRYSTAL_OF_INPROGRESS_3RD)) - { + if ((qs != null) && hasQuestItems(master, CRYSTAL_OF_INPROGRESS_3RD)) { final L2Npc killer = (L2Npc) event.getAttacker(); final List<Integer> items = MONSTERS.get(killer.getId()); giveItems(master, items.get(2), 1); // Crystal of Defeat @@ -126,8 +120,7 @@ public final class Servitors extends AbstractNpcAI } } - public static void main(String[] args) - { + public static void main(String[] args) { new Servitors(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/SupportUnitCaptain/SupportUnitCaptain.java b/src/main/java/com/l2jserver/datapack/ai/npc/SupportUnitCaptain/SupportUnitCaptain.java index 8631e7a887..2af573b174 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/SupportUnitCaptain/SupportUnitCaptain.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/SupportUnitCaptain/SupportUnitCaptain.java @@ -28,11 +28,9 @@ import com.l2jserver.gameserver.network.clientpackets.RequestAcquireSkill; * Support Unit Captain AI. * @author St3eT */ -public final class SupportUnitCaptain extends AbstractNpcAI -{ +public final class SupportUnitCaptain extends AbstractNpcAI { // NPCs - private static final int[] UNIT_CAPTAIN = - { + private static final int[] UNIT_CAPTAIN = { 35662, // Shanty Fortress 35694, // Southern Fortress 35731, // Hive Fortress @@ -75,8 +73,7 @@ public final class SupportUnitCaptain extends AbstractNpcAI private static final int RED_LIFE_FORCE = 10518; // Red Talisman - Life Force private static final int BLUE_GREAT_HEALING = 10424; // Blue Talisman - Greater Healing private static final int WHITE_FIRE = 10421; // White Talisman - Fire - private static final int[] COMMON_TALISMANS = - { + private static final int[] COMMON_TALISMANS = { 9914, // Blue Talisman of Power 9915, // Blue Talisman of Wild Magic 9920, // Blue Talisman of Invisibility @@ -121,8 +118,7 @@ public final class SupportUnitCaptain extends AbstractNpcAI 10423, // Blue Talisman - Self-Destruction }; - private SupportUnitCaptain() - { + private SupportUnitCaptain() { super(SupportUnitCaptain.class.getSimpleName(), "ai/npc"); addStartNpc(UNIT_CAPTAIN); addTalkId(UNIT_CAPTAIN); @@ -130,123 +126,76 @@ public final class SupportUnitCaptain extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final int fortOwner = npc.getFort().getOwnerClan() == null ? 0 : npc.getFort().getOwnerClan().getId(); - if ((player.getClan() == null) || (player.getClanId() != fortOwner)) - { + if ((player.getClan() == null) || (player.getClanId() != fortOwner)) { return "unitcaptain-04.html"; } String htmltext = null; int itemId = 0; - switch (event) - { + switch (event) { case "unitcaptain.html": - case "unitcaptain-01.html": - { + case "unitcaptain-01.html": { htmltext = event; break; } - case "giveTalisman": - { - if (getQuestItemsCount(player, EPAULETTE) < 10) - { + case "giveTalisman": { + if (getQuestItemsCount(player, EPAULETTE) < 10) { htmltext = "unitcaptain-05.html"; break; } final int categoryChance = getRandom(100); - if (categoryChance <= 5) - { + if (categoryChance <= 5) { final int chance = getRandom(100); - if (chance <= 25) - { + if (chance <= 25) { itemId = RED_MEDITATION; - } - else if (chance <= 50) - { + } else if (chance <= 50) { itemId = BLUE_DIV_PROTECTION; - } - else if (chance <= 75) - { + } else if (chance <= 75) { itemId = BLUE_EXPLOSION; - } - else - { + } else { itemId = BLUE_M_EXPLOSION; } - } - else if (categoryChance <= 15) - { + } else if (categoryChance <= 15) { final int chance = getRandom(100); - if (chance <= 20) - { + if (chance <= 20) { itemId = RED_MIN_CLARITY; - } - else if (chance <= 40) - { + } else if (chance <= 40) { itemId = RED_MAX_CLARITY; - } - else if (chance <= 60) - { + } else if (chance <= 60) { itemId = RED_MENTAL_REG; - } - else if (chance <= 80) - { + } else if (chance <= 80) { itemId = BLUE_PROTECTION; - } - else - { + } else { itemId = BLUE_INVIS; } - } - else if (categoryChance <= 30) - { + } else if (categoryChance <= 30) { final int chance = getRandom(100); - if (chance <= 12) - { + if (chance <= 12) { itemId = BLUE_DEFENSE; - } - else if (chance <= 25) - { + } else if (chance <= 25) { itemId = BLACK_ESCAPE; - } - else if (chance <= 37) - { + } else if (chance <= 37) { itemId = BLUE_HEALING; - } - else if (chance <= 50) - { + } else if (chance <= 50) { itemId = RED_RECOVERY; - } - else if (chance <= 62) - { + } else if (chance <= 62) { itemId = BLUE_DEFENSE2; - } - else if (chance <= 75) - { + } else if (chance <= 75) { itemId = BLUE_M_DEFENSE; - } - else if (chance <= 87) - { + } else if (chance <= 87) { itemId = RED_LIFE_FORCE; - } - else - { + } else { itemId = BLUE_GREAT_HEALING; } - } - else - { + } else { final int chance = getRandom(46); - if (chance <= 41) - { + if (chance <= 41) { itemId = COMMON_TALISMANS[chance]; - } - else - { + } else { itemId = WHITE_FIRE; } } @@ -255,14 +204,10 @@ public final class SupportUnitCaptain extends AbstractNpcAI htmltext = "unitcaptain-02.html"; break; } - case "squadSkill": - { - if (player.isClanLeader() || player.hasClanPrivilege(ClanPrivilege.CL_TROOPS_FAME)) - { + case "squadSkill": { + if (player.isClanLeader() || player.hasClanPrivilege(ClanPrivilege.CL_TROOPS_FAME)) { RequestAcquireSkill.showSubUnitSkillList(player); - } - else - { + } else { htmltext = "unitcaptain-03.html"; } break; @@ -272,14 +217,12 @@ public final class SupportUnitCaptain extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { final int fortOwner = npc.getFort().getOwnerClan() == null ? 0 : npc.getFort().getOwnerClan().getId(); return ((player.getClan() != null) && (player.getClanId() == fortOwner)) ? "unitcaptain.html" : "unitcaptain-04.html"; } - public static void main(String[] args) - { + public static void main(String[] args) { new SupportUnitCaptain(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/SymbolMaker/SymbolMaker.java b/src/main/java/com/l2jserver/datapack/ai/npc/SymbolMaker/SymbolMaker.java index fe2b80827b..d736855f47 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/SymbolMaker/SymbolMaker.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/SymbolMaker/SymbolMaker.java @@ -28,11 +28,9 @@ import com.l2jserver.gameserver.network.serverpackets.HennaRemoveList; * Symbol Maker AI. * @author Adry_85 */ -public final class SymbolMaker extends AbstractNpcAI -{ +public final class SymbolMaker extends AbstractNpcAI { // NPCs - private static final int[] NPCS = - { + private static final int[] NPCS = { 31046, // Marsden 31047, // Kell 31048, // McDermott @@ -46,8 +44,7 @@ public final class SymbolMaker extends AbstractNpcAI 31953, // Rankar }; - private SymbolMaker() - { + private SymbolMaker() { super(SymbolMaker.class.getSimpleName(), "ai/npc"); addFirstTalkId(NPCS); addStartNpc(NPCS); @@ -55,26 +52,21 @@ public final class SymbolMaker extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { + switch (event) { case "symbol_maker.htm": case "symbol_maker-1.htm": case "symbol_maker-2.htm": - case "symbol_maker-3.htm": - { + case "symbol_maker-3.htm": { htmltext = event; break; } - case "Draw": - { + case "Draw": { player.sendPacket(new HennaEquipList(player)); break; } - case "Remove": - { + case "Remove": { player.sendPacket(new HennaRemoveList(player)); break; } @@ -83,13 +75,11 @@ public final class SymbolMaker extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return "symbol_maker.htm"; } - public static void main(String[] args) - { + public static void main(String[] args) { new SymbolMaker(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/Asher/Asher.java b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/Asher/Asher.java index 0029e73ec6..0f665512f0 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/Asher/Asher.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/Asher/Asher.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.itemcontainer.Inventory; * @author Adry_85 * @since 2.6.0.0 */ -public class Asher extends AbstractNpcAI -{ +public class Asher extends AbstractNpcAI { // NPC private static final int ASHER = 32714; // Location @@ -38,37 +37,28 @@ public class Asher extends AbstractNpcAI // Misc private static final int ADENA = 50000; - private Asher() - { + private Asher() { super(Asher.class.getSimpleName(), "ai/npc/Teleports"); addFirstTalkId(ASHER); addStartNpc(ASHER); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equals("teleport")) - { - if (player.getAdena() >= ADENA) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equals("teleport")) { + if (player.getAdena() >= ADENA) { player.teleToLocation(LOCATION); takeItems(player, Inventory.ADENA_ID, ADENA); - } - else - { + } else { return "32714-02.html"; } - } - else if (event.equals("32714-01.html")) - { + } else if (event.equals("32714-01.html")) { return event; } return super.onAdvEvent(event, npc, player); } - public static void main(String[] args) - { + public static void main(String[] args) { new Asher(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/CrumaTower/CrumaTower.java b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/CrumaTower/CrumaTower.java index edd7640615..e92a6fd320 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/CrumaTower/CrumaTower.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/CrumaTower/CrumaTower.java @@ -27,8 +27,7 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Cruma Tower teleport AI. * @author Plim */ -public final class CrumaTower extends AbstractNpcAI -{ +public final class CrumaTower extends AbstractNpcAI { // NPC private static final int MOZELLA = 30483; // Locations @@ -37,8 +36,7 @@ public final class CrumaTower extends AbstractNpcAI // Misc private static final int MAX_LEVEL = 55; - private CrumaTower() - { + private CrumaTower() { super(CrumaTower.class.getSimpleName(), "ai/npc/Teleports"); addFirstTalkId(MOZELLA); addStartNpc(MOZELLA); @@ -46,18 +44,15 @@ public final class CrumaTower extends AbstractNpcAI } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { - if (talker.getLevel() <= MAX_LEVEL) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { + if (talker.getLevel() <= MAX_LEVEL) { talker.teleToLocation(getRandomBoolean() ? TELEPORT_LOC1 : TELEPORT_LOC2); return null; } return "30483-1.html"; } - public static void main(String[] args) - { + public static void main(String[] args) { new CrumaTower(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/DelusionTeleport/DelusionTeleport.java b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/DelusionTeleport/DelusionTeleport.java index 8dd843e7dd..40601a8bb7 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/DelusionTeleport/DelusionTeleport.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/DelusionTeleport/DelusionTeleport.java @@ -32,11 +32,9 @@ import com.l2jserver.gameserver.model.zone.type.L2TownZone; * Chambers of Delusion teleport AI. * @author GKR */ -public final class DelusionTeleport extends AbstractNpcAI -{ +public final class DelusionTeleport extends AbstractNpcAI { // NPCs - private static final int[] NPCS = - { + private static final int[] NPCS = { 32484, // Pathfinder Worker 32658, // Guardian of Eastern Seal 32659, // Guardian of Western Seal @@ -46,8 +44,7 @@ public final class DelusionTeleport extends AbstractNpcAI 32663, // Guardian of Tower of Seal }; // Location - private static final Location[] HALL_LOCATIONS = - { + private static final Location[] HALL_LOCATIONS = { new Location(-114597, -152501, -6750), new Location(-114589, -154162, -6750) }; @@ -56,8 +53,7 @@ public final class DelusionTeleport extends AbstractNpcAI private static final Map<Integer, Location> RETURN_LOCATIONS = new HashMap<>(); - static - { + static { RETURN_LOCATIONS.put(0, new Location(43835, -47749, -792)); // Undefined origin, return to Rune RETURN_LOCATIONS.put(7, new Location(-14023, 123677, -3112)); // Gludio RETURN_LOCATIONS.put(8, new Location(18101, 145936, -3088)); // Dion @@ -67,25 +63,21 @@ public final class DelusionTeleport extends AbstractNpcAI RETURN_LOCATIONS.put(17, new Location(85991, -142234, -1336)); // Schuttgart } - private DelusionTeleport() - { + private DelusionTeleport() { super(DelusionTeleport.class.getSimpleName(), "ai/npc/Teleports"); addStartNpc(NPCS); addTalkId(NPCS); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { if (npc.getId() == NPCS[0]) // Pathfinder Worker { final L2TownZone town = TownManager.getTown(npc.getX(), npc.getY(), npc.getZ()); final int townId = ((town == null) ? 0 : town.getTownId()); player.getVariables().set(DELUSION_RETURN, townId); player.teleToLocation(HALL_LOCATIONS[getRandom(HALL_LOCATIONS.length)], false); - } - else - { + } else { final int townId = player.getVariables().getInt(DELUSION_RETURN, 0); player.teleToLocation(RETURN_LOCATIONS.get(townId), true); player.getVariables().remove(DELUSION_RETURN); @@ -93,8 +85,7 @@ public final class DelusionTeleport extends AbstractNpcAI return super.onTalk(npc, player); } - public static void main(String[] args) - { + public static void main(String[] args) { new DelusionTeleport(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/ElrokiTeleporters/ElrokiTeleporters.java b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/ElrokiTeleporters/ElrokiTeleporters.java index b5e3cc6c86..0ba65c4a60 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/ElrokiTeleporters/ElrokiTeleporters.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/ElrokiTeleporters/ElrokiTeleporters.java @@ -27,8 +27,7 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Elroki teleport AI. * @author Plim */ -public final class ElrokiTeleporters extends AbstractNpcAI -{ +public final class ElrokiTeleporters extends AbstractNpcAI { // NPCs private static final int ORAHOCHIN = 32111; private static final int GARIACHIN = 32112; @@ -36,8 +35,7 @@ public final class ElrokiTeleporters extends AbstractNpcAI private static final Location TELEPORT_ORAHOCIN = new Location(5171, -1889, -3165); private static final Location TELEPORT_GARIACHIN = new Location(7651, -5416, -3155); - private ElrokiTeleporters() - { + private ElrokiTeleporters() { super(ElrokiTeleporters.class.getSimpleName(), "ai/npc/Teleports"); addFirstTalkId(ORAHOCHIN, GARIACHIN); addStartNpc(ORAHOCHIN, GARIACHIN); @@ -45,21 +43,16 @@ public final class ElrokiTeleporters extends AbstractNpcAI } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { - if (!talker.isInCombat()) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { + if (!talker.isInCombat()) { talker.teleToLocation((npc.getId() == ORAHOCHIN) ? TELEPORT_ORAHOCIN : TELEPORT_GARIACHIN); - } - else - { + } else { return npc.getId() + "-no.html"; } return super.onTalk(npc, talker); } - public static void main(String[] args) - { + public static void main(String[] args) { new ElrokiTeleporters(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/GatekeeperSpirit/GatekeeperSpirit.java b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/GatekeeperSpirit/GatekeeperSpirit.java index 2eb8b3b992..bbe59f91ad 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/GatekeeperSpirit/GatekeeperSpirit.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/GatekeeperSpirit/GatekeeperSpirit.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Gatekeeper Spirit AI. * @author Zoey76 */ -public final class GatekeeperSpirit extends AbstractNpcAI -{ +public final class GatekeeperSpirit extends AbstractNpcAI { // NPCs private static final int GATEKEEPER_SPIRIT_ENTER = 31111; private static final int GATEKEEPER_SPIRIT_EXIT = 31112; @@ -43,8 +42,7 @@ public final class GatekeeperSpirit extends AbstractNpcAI private static final Location TELEPORT_DAWN = new Location(184448, -10112, -5504); private static final Location EXIT = new Location(182960, -11904, -4897); - private GatekeeperSpirit() - { + private GatekeeperSpirit() { super(GatekeeperSpirit.class.getSimpleName(), "ai/npc/Teleports"); addStartNpc(GATEKEEPER_SPIRIT_ENTER, GATEKEEPER_SPIRIT_EXIT); addFirstTalkId(GATEKEEPER_SPIRIT_ENTER, GATEKEEPER_SPIRIT_EXIT); @@ -53,46 +51,33 @@ public final class GatekeeperSpirit extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { - case "ANAKIM": - { + switch (event) { + case "ANAKIM": { addSpawn(GATEKEEPER_SPIRIT_EXIT, SPAWN_ANAKIM_GATEKEEPER, false, 900000); break; } - case "LILITH": - { + case "LILITH": { addSpawn(GATEKEEPER_SPIRIT_EXIT, SPAWN_LILITH_GATEKEEPER, false, 900000); break; } - case "TeleportIn": - { + case "TeleportIn": { final int playerCabal = SevenSigns.getInstance().getPlayerCabal(player.getObjectId()); final int sealOfAvariceOwner = SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_AVARICE); final int compWinner = SevenSigns.getInstance().getCabalHighestScore(); - if (!SevenSigns.getInstance().isSealValidationPeriod()) - { + if (!SevenSigns.getInstance().isSealValidationPeriod()) { htmltext = "31111-no.html"; - } - else if ((compWinner == SevenSigns.CABAL_DUSK) && (playerCabal == SevenSigns.CABAL_DUSK) && (sealOfAvariceOwner == SevenSigns.CABAL_DUSK)) - { + } else if ((compWinner == SevenSigns.CABAL_DUSK) && (playerCabal == SevenSigns.CABAL_DUSK) && (sealOfAvariceOwner == SevenSigns.CABAL_DUSK)) { player.teleToLocation(TELEPORT_DUSK, false); - } - else if ((compWinner == SevenSigns.CABAL_DAWN) && (playerCabal == SevenSigns.CABAL_DAWN) && (sealOfAvariceOwner == SevenSigns.CABAL_DAWN)) - { + } else if ((compWinner == SevenSigns.CABAL_DAWN) && (playerCabal == SevenSigns.CABAL_DAWN) && (sealOfAvariceOwner == SevenSigns.CABAL_DAWN)) { player.teleToLocation(TELEPORT_DAWN, false); - } - else - { + } else { htmltext = "31111-no.html"; } break; } - case "TeleportOut": - { + case "TeleportOut": { player.teleToLocation(EXIT, true); break; } @@ -101,17 +86,13 @@ public final class GatekeeperSpirit extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - switch (npc.getId()) - { - case ANAKIM: - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + switch (npc.getId()) { + case ANAKIM: { startQuestTimer("ANAKIM", 10000, npc, killer); break; } - case LILITH: - { + case LILITH: { startQuestTimer("LILITH", 10000, npc, killer); break; } @@ -119,8 +100,7 @@ public final class GatekeeperSpirit extends AbstractNpcAI return super.onKill(npc, killer, isSummon); } - public static void main(String[] args) - { + public static void main(String[] args) { new GatekeeperSpirit(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/GhostChamberlainOfElmoreden/GhostChamberlainOfElmoreden.java b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/GhostChamberlainOfElmoreden/GhostChamberlainOfElmoreden.java index b9b9c9b97c..7dbf335365 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/GhostChamberlainOfElmoreden/GhostChamberlainOfElmoreden.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/GhostChamberlainOfElmoreden/GhostChamberlainOfElmoreden.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * @author Adry_85 * @since 2.6.0.0 */ -public class GhostChamberlainOfElmoreden extends AbstractNpcAI -{ +public class GhostChamberlainOfElmoreden extends AbstractNpcAI { // NPCs private static final int GHOST_CHAMBERLAIN_OF_ELMOREDEN_1 = 31919; private static final int GHOST_CHAMBERLAIN_OF_ELMOREDEN_2 = 31920; @@ -40,8 +39,7 @@ public class GhostChamberlainOfElmoreden extends AbstractNpcAI private static final Location FOUR_SEPULCHERS_LOC = new Location(178127, -84435, -7215); private static final Location IMPERIAL_TOMB_LOC = new Location(186699, -75915, -2826); - private GhostChamberlainOfElmoreden() - { + private GhostChamberlainOfElmoreden() { super(GhostChamberlainOfElmoreden.class.getSimpleName(), "ai/npc/Teleports"); addStartNpc(GHOST_CHAMBERLAIN_OF_ELMOREDEN_1, GHOST_CHAMBERLAIN_OF_ELMOREDEN_2); addTalkId(GHOST_CHAMBERLAIN_OF_ELMOREDEN_1, GHOST_CHAMBERLAIN_OF_ELMOREDEN_2); @@ -49,45 +47,30 @@ public class GhostChamberlainOfElmoreden extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equals("FOUR_SEPULCHERS")) - { - if (hasQuestItems(player, USED_GRAVE_PASS)) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equals("FOUR_SEPULCHERS")) { + if (hasQuestItems(player, USED_GRAVE_PASS)) { takeItems(player, USED_GRAVE_PASS, 1); player.teleToLocation(FOUR_SEPULCHERS_LOC); - } - else if (hasQuestItems(player, ANTIQUE_BROOCH)) - { + } else if (hasQuestItems(player, ANTIQUE_BROOCH)) { player.teleToLocation(FOUR_SEPULCHERS_LOC); - } - else - { + } else { return npc.getId() + "-01.html"; } - } - else if (event.equals("IMPERIAL_TOMB")) - { - if (hasQuestItems(player, USED_GRAVE_PASS)) - { + } else if (event.equals("IMPERIAL_TOMB")) { + if (hasQuestItems(player, USED_GRAVE_PASS)) { takeItems(player, USED_GRAVE_PASS, 1); player.teleToLocation(IMPERIAL_TOMB_LOC); - } - else if (hasQuestItems(player, ANTIQUE_BROOCH)) - { + } else if (hasQuestItems(player, ANTIQUE_BROOCH)) { player.teleToLocation(IMPERIAL_TOMB_LOC); - } - else - { + } else { return npc.getId() + "-01.html"; } } return super.onAdvEvent(event, npc, player); } - public static void main(String[] args) - { + public static void main(String[] args) { new GhostChamberlainOfElmoreden(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/GrandBossTeleporters/GrandBossTeleporters.java b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/GrandBossTeleporters/GrandBossTeleporters.java index 5afa085b02..f307be0a1a 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/GrandBossTeleporters/GrandBossTeleporters.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/GrandBossTeleporters/GrandBossTeleporters.java @@ -38,11 +38,9 @@ import com.l2jserver.gameserver.model.zone.type.L2BossZone; * Original python script by Emperorc. * @author Plim */ -public final class GrandBossTeleporters extends AbstractNpcAI -{ +public final class GrandBossTeleporters extends AbstractNpcAI { // NPCs - private static final int[] NPCs = - { + private static final int[] NPCs = { 31384, // Gatekeeper of Fire Dragon : Opening some doors 31385, // Heart of Volcano : Teleport into Lair of Valakas 31540, // Watcher of Valakas Klein : Teleport into Hall of Flames @@ -58,58 +56,44 @@ public final class GrandBossTeleporters extends AbstractNpcAI private static int playerCount = 0; - private GrandBossTeleporters() - { + private GrandBossTeleporters() { super(GrandBossTeleporters.class.getSimpleName(), "ai/npc/Teleports"); addStartNpc(NPCs); addTalkId(NPCs); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = ""; final QuestState st = getQuestState(player, false); - if (hasQuestItems(player, VACUALITE_FLOATING_STONE)) - { + if (hasQuestItems(player, VACUALITE_FLOATING_STONE)) { player.teleToLocation(ENTER_HALL_OF_FLAMES); st.set("allowEnter", "1"); - } - else - { + } else { htmltext = "31540-06.htm"; } return htmltext; } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = ""; final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { - case 31385: - { - if (valakasAI() != null) - { + switch (npc.getId()) { + case 31385: { + if (valakasAI() != null) { int status = GrandBossManager.getInstance().getBossStatus(29028); - if ((status == 0) || (status == 1)) - { - if (playerCount >= 200) - { + if ((status == 0) || (status == 1)) { + if (playerCount >= 200) { htmltext = "31385-03.htm"; - } - else if (st.getInt("allowEnter") == 1) - { + } else if (st.getInt("allowEnter") == 1) { st.unset("allowEnter"); L2BossZone zone = GrandBossManager.getInstance().getZone(212852, -114842, -1632); - if (zone != null) - { + if (zone != null) { zone.allowPlayerEntry(player, 30); } @@ -117,74 +101,51 @@ public final class GrandBossTeleporters extends AbstractNpcAI playerCount++; - if (status == 0) - { + if (status == 0) { L2GrandBossInstance valakas = GrandBossManager.getInstance().getBoss(29028); valakasAI().startQuestTimer("beginning", grandBoss().getValakasWaitTime(), valakas, null); GrandBossManager.getInstance().setBossStatus(29028, 1); } - } - else - { + } else { htmltext = "31385-04.htm"; } - } - else if (status == 2) - { + } else if (status == 2) { htmltext = "31385-02.htm"; - } - else - { + } else { htmltext = "31385-01.htm"; } - } - else - { + } else { htmltext = "31385-01.htm"; } break; } - case 31384: - { + case 31384: { DoorData.getInstance().getDoor(24210004).openMe(); break; } - case 31686: - { + case 31686: { DoorData.getInstance().getDoor(24210006).openMe(); break; } - case 31687: - { + case 31687: { DoorData.getInstance().getDoor(24210005).openMe(); break; } - case 31540: - { - if (playerCount < 50) - { + case 31540: { + if (playerCount < 50) { htmltext = "31540-01.htm"; - } - else if (playerCount < 100) - { + } else if (playerCount < 100) { htmltext = "31540-02.htm"; - } - else if (playerCount < 150) - { + } else if (playerCount < 150) { htmltext = "31540-03.htm"; - } - else if (playerCount < 200) - { + } else if (playerCount < 200) { htmltext = "31540-04.htm"; - } - else - { + } else { htmltext = "31540-05.htm"; } break; } - case 31759: - { + case 31759: { player.teleToLocation(TELEPORT_OUT_OF_VALAKAS_LAIR.getX() + getRandom(500), TELEPORT_OUT_OF_VALAKAS_LAIR.getY() + getRandom(500), TELEPORT_OUT_OF_VALAKAS_LAIR.getZ()); break; } @@ -192,13 +153,11 @@ public final class GrandBossTeleporters extends AbstractNpcAI return htmltext; } - private Quest valakasAI() - { + private Quest valakasAI() { return QuestManager.getInstance().getQuest(Valakas.class.getSimpleName()); } - public static void main(String[] args) - { + public static void main(String[] args) { new GrandBossTeleporters(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/HuntingGroundsTeleport/HuntingGroundsTeleport.java b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/HuntingGroundsTeleport/HuntingGroundsTeleport.java index a7d05d3da1..fb86b62d44 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/HuntingGroundsTeleport/HuntingGroundsTeleport.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/HuntingGroundsTeleport/HuntingGroundsTeleport.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.util.Util; * Hunting Grounds teleport AI. * @author Charus */ -public final class HuntingGroundsTeleport extends AbstractNpcAI -{ +public final class HuntingGroundsTeleport extends AbstractNpcAI { // NPCs // @formatter:off private final static int[] PRIESTS = @@ -46,104 +45,87 @@ public final class HuntingGroundsTeleport extends AbstractNpcAI }; // @formatter:on - private HuntingGroundsTeleport() - { + private HuntingGroundsTeleport() { super(HuntingGroundsTeleport.class.getSimpleName(), "ai/npc/Teleports"); addStartNpc(PRIESTS); addTalkId(PRIESTS); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final SevenSigns ss = SevenSigns.getInstance(); final int playerCabal = ss.getPlayerCabal(player.getObjectId()); - if (playerCabal == SevenSigns.CABAL_NULL) - { + if (playerCabal == SevenSigns.CABAL_NULL) { return Util.contains(DAWN_NPCS, npc.getId()) ? "dawn_tele-no.htm" : "dusk_tele-no.htm"; } String htmltext = ""; final boolean check = ss.isSealValidationPeriod() && (playerCabal == ss.getSealOwner(SevenSigns.SEAL_GNOSIS)) && (ss.getPlayerSeal(player.getObjectId()) == SevenSigns.SEAL_GNOSIS); - switch (npc.getId()) - { + switch (npc.getId()) { case 31078: - case 31085: - { + case 31085: { htmltext = check ? "low_gludin.htm" : "hg_gludin.htm"; break; } case 31079: - case 31086: - { + case 31086: { htmltext = check ? "low_gludio.htm" : "hg_gludio.htm"; break; } case 31080: - case 31087: - { + case 31087: { htmltext = check ? "low_dion.htm" : "hg_dion.htm"; break; } case 31081: - case 31088: - { + case 31088: { htmltext = check ? "low_giran.htm" : "hg_giran.htm"; break; } case 31082: - case 31089: - { + case 31089: { htmltext = check ? "low_heine.htm" : "hg_heine.htm"; break; } case 31083: - case 31090: - { + case 31090: { htmltext = check ? "low_oren.htm" : "hg_oren.htm"; break; } case 31084: - case 31091: - { + case 31091: { htmltext = check ? "low_aden.htm" : "hg_aden.htm"; break; } case 31168: - case 31169: - { + case 31169: { htmltext = check ? "low_hw.htm" : "hg_hw.htm"; break; } case 31692: - case 31693: - { + case 31693: { htmltext = check ? "low_goddard.htm" : "hg_goddard.htm"; break; } case 31694: - case 31695: - { + case 31695: { htmltext = check ? "low_rune.htm" : "hg_rune.htm"; break; } case 31997: - case 31998: - { + case 31998: { htmltext = check ? "low_schuttgart.htm" : "hg_schuttgart.htm"; break; } - default: - { + default: { break; } } return htmltext; } - public static void main(String[] args) - { + public static void main(String[] args) { new HuntingGroundsTeleport(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/Klemis/Klemis.java b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/Klemis/Klemis.java index 5e9b8e2615..49e54c47b6 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/Klemis/Klemis.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/Klemis/Klemis.java @@ -27,8 +27,7 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Klemis AI. * @author St3eT */ -public class Klemis extends AbstractNpcAI -{ +public class Klemis extends AbstractNpcAI { // NPC private static final int KLEMIS = 32734; // Klemis // Location @@ -36,8 +35,7 @@ public class Klemis extends AbstractNpcAI // Misc private static final int MIN_LV = 80; - private Klemis() - { + private Klemis() { super(Klemis.class.getSimpleName(), "ai/npc/Teleports"); addStartNpc(KLEMIS); addTalkId(KLEMIS); @@ -45,24 +43,18 @@ public class Klemis extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equals("portInside")) - { - if (player.getLevel() >= MIN_LV) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equals("portInside")) { + if (player.getLevel() >= MIN_LV) { player.teleToLocation(LOCATION); - } - else - { + } else { return "32734-01.html"; } } return super.onAdvEvent(event, npc, player); } - public static void main(String[] args) - { + public static void main(String[] args) { new Klemis(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/MithrilMinesTeleporter/MithrilMinesTeleporter.java b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/MithrilMinesTeleporter/MithrilMinesTeleporter.java index d7c6392aee..0f4fae912f 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/MithrilMinesTeleporter/MithrilMinesTeleporter.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/MithrilMinesTeleporter/MithrilMinesTeleporter.java @@ -27,13 +27,11 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Mithril Mines teleport AI. * @author Charus */ -public final class MithrilMinesTeleporter extends AbstractNpcAI -{ +public final class MithrilMinesTeleporter extends AbstractNpcAI { // NPC private final static int TELEPORT_CRYSTAL = 32652; // Location - private static final Location[] LOCS = - { + private static final Location[] LOCS = { new Location(171946, -173352, 3440), new Location(175499, -181586, -904), new Location(173462, -174011, 3480), @@ -42,8 +40,7 @@ public final class MithrilMinesTeleporter extends AbstractNpcAI new Location(175499, -181586, -904) }; - private MithrilMinesTeleporter() - { + private MithrilMinesTeleporter() { super(MithrilMinesTeleporter.class.getSimpleName(), "ai/npc/Teleports"); addStartNpc(TELEPORT_CRYSTAL); addFirstTalkId(TELEPORT_CRYSTAL); @@ -51,11 +48,9 @@ public final class MithrilMinesTeleporter extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { int index = Integer.parseInt(event) - 1; - if (LOCS.length > index) - { + if (LOCS.length > index) { Location loc = LOCS[index]; player.teleToLocation(loc, false); } @@ -63,27 +58,22 @@ public final class MithrilMinesTeleporter extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { - if (npc.isInsideRadius(173147, -173762, 0, L2Npc.INTERACTION_DISTANCE, false, true)) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { + if (npc.isInsideRadius(173147, -173762, 0, L2Npc.INTERACTION_DISTANCE, false, true)) { return "32652-01.htm"; } - if (npc.isInsideRadius(181941, -174614, 0, L2Npc.INTERACTION_DISTANCE, false, true)) - { + if (npc.isInsideRadius(181941, -174614, 0, L2Npc.INTERACTION_DISTANCE, false, true)) { return "32652-02.htm"; } - if (npc.isInsideRadius(179560, -182956, 0, L2Npc.INTERACTION_DISTANCE, false, true)) - { + if (npc.isInsideRadius(179560, -182956, 0, L2Npc.INTERACTION_DISTANCE, false, true)) { return "32652-03.htm"; } return super.onFirstTalk(npc, player); } - public static void main(String[] args) - { + public static void main(String[] args) { new MithrilMinesTeleporter(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/NewbieGuide/NewbieGuide.java b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/NewbieGuide/NewbieGuide.java index a534ed7673..91371edf92 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/NewbieGuide/NewbieGuide.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/NewbieGuide/NewbieGuide.java @@ -42,8 +42,7 @@ import com.l2jserver.gameserver.network.NpcStringId; * @author Zealar * @since 2.6.0.0 */ -public final class NewbieGuide extends AbstractNpcAI -{ +public final class NewbieGuide extends AbstractNpcAI { // Suffix private static final String SUFFIX_FIGHTER_5_LEVEL = "-f05.htm"; private static final String SUFFIX_FIGHTER_10_LEVEL = "-f10.htm"; @@ -100,8 +99,7 @@ public final class NewbieGuide extends AbstractNpcAI private static final Map<Integer, List<Location>> TELEPORT_MAP = new HashMap<>(); - static - { + static { Location TALKING_ISLAND_VILLAGE = new Location(-84081, 243227, -3723); Location DARK_ELF_VILLAGE = new Location(12111, 16686, -4582); Location DWARVEN_VILLAGE = new Location(115632, -177996, -905); @@ -117,12 +115,10 @@ public final class NewbieGuide extends AbstractNpcAI TELEPORT_MAP.put(NEWBIE_GUIDE_KAMAEL, Arrays.asList(TALKING_ISLAND_VILLAGE, DARK_ELF_VILLAGE, ELVEN_VILLAGE, DWARVEN_VILLAGE, ORC_VILLAGE)); } - private NewbieGuide() - { + private NewbieGuide() { super(NewbieGuide.class.getSimpleName(), "ai/npc/Teleports"); - int[] newbieList = - { + int[] newbieList = { NEWBIE_GUIDE_HUMAN, NEWBIE_GUIDE_ELF, NEWBIE_GUIDE_DARK_ELF, @@ -139,13 +135,10 @@ public final class NewbieGuide extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { QuestState qs = player.getQuestState(Q00255_Tutorial.class.getSimpleName()); - if (qs != null) - { - if (npc.getId() == ADVENTURERS_GUIDE) - { + if (qs != null) { + if (npc.getId() == ADVENTURERS_GUIDE) { return "32327.htm"; } return talkGuide(player, qs); @@ -154,21 +147,15 @@ public final class NewbieGuide extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance talker) - { - if (event.endsWith(".htm")) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance talker) { + if (event.endsWith(".htm")) { return event; } - if (event.startsWith("teleport")) - { + if (event.startsWith("teleport")) { String[] tel = event.split("_"); - if (tel.length != 2) - { + if (tel.length != 2) { teleportRequest(talker, npc, -1); - } - else - { + } else { teleportRequest(talker, npc, Integer.parseInt(tel[1])); } return event; @@ -177,114 +164,64 @@ public final class NewbieGuide extends AbstractNpcAI int ask = Integer.parseInt(event.split(";")[0]); int reply = Integer.parseInt(event.split(";")[1]); - switch (ask) - { - case -7: - { - switch (reply) - { - case 1: - { - if (talker.getRace() == Race.KAMAEL) - { - if (talker.getRace() != npc.getRace()) - { + switch (ask) { + case -7: { + switch (reply) { + case 1: { + if (talker.getRace() == Race.KAMAEL) { + if (talker.getRace() != npc.getRace()) { showPage(talker, "32135-003.htm"); - } - else if ((talker.getLevel() > 20) || ((talker.getRace() != Race.KAMAEL) || (talker.getClassId().level() != 0))) - { + } else if ((talker.getLevel() > 20) || ((talker.getRace() != Race.KAMAEL) || (talker.getClassId().level() != 0))) { showPage(talker, "32135-002.htm"); - } - else if (talker.getClassId() == ClassId.maleSoldier) - { - if (talker.getLevel() <= 5) - { + } else if (talker.getClassId() == ClassId.maleSoldier) { + if (talker.getLevel() <= 5) { showPage(talker, "32135-kmf05.htm"); - } - else if (talker.getLevel() <= 10) - { + } else if (talker.getLevel() <= 10) { showPage(talker, "32135-kmf10.htm"); - } - else if (talker.getLevel() <= 15) - { + } else if (talker.getLevel() <= 15) { showPage(talker, "32135-kmf15.htm"); - } - else - { + } else { showPage(talker, "32135-kmf20.htm"); } - } - else if (talker.getClassId() == ClassId.femaleSoldier) - { - if (talker.getLevel() <= 5) - { + } else if (talker.getClassId() == ClassId.femaleSoldier) { + if (talker.getLevel() <= 5) { showPage(talker, "32135-kff05.htm"); - } - else if (talker.getLevel() <= 10) - { + } else if (talker.getLevel() <= 10) { showPage(talker, "32135-kff10.htm"); - } - else if (talker.getLevel() <= 15) - { + } else if (talker.getLevel() <= 15) { showPage(talker, "32135-kff15.htm"); - } - else - { + } else { showPage(talker, "32135-kff20.htm"); } } - } - else if (talker.getRace() != npc.getRace()) - { + } else if (talker.getRace() != npc.getRace()) { showPage(talker, ""); - } - else if ((talker.getLevel() > 20) || (talker.getClassId().level() != 0)) - { + } else if ((talker.getLevel() > 20) || (talker.getClassId().level() != 0)) { showPage(talker, ""); - } - else if (!talker.isMageClass()) - { - if (talker.getLevel() <= 5) - { + } else if (!talker.isMageClass()) { + if (talker.getLevel() <= 5) { showPage(talker, npc.getId() + SUFFIX_FIGHTER_5_LEVEL); - } - else if (talker.getLevel() <= 10) - { + } else if (talker.getLevel() <= 10) { showPage(talker, npc.getId() + SUFFIX_FIGHTER_10_LEVEL); - } - else if (talker.getLevel() <= 15) - { + } else if (talker.getLevel() <= 15) { showPage(talker, npc.getId() + SUFFIX_FIGHTER_15_LEVEL); - } - else - { + } else { showPage(talker, npc.getId() + SUFFIX_FIGHTER_20_LEVEL); } - } - else if (talker.getLevel() <= 7) - { + } else if (talker.getLevel() <= 7) { showPage(talker, npc.getId() + SUFFIX_MAGE_7_LEVEL); - } - else if (talker.getLevel() <= 14) - { + } else if (talker.getLevel() <= 14) { showPage(talker, npc.getId() + SUFFIX_MAGE_14_LEVEL); - } - else - { + } else { showPage(talker, npc.getId() + SUFFIX_MAGE_20_LEVEL); } break; } - case 2: - { - if (talker.getLevel() <= 75) - { - if (talker.getLevel() < 6) - { + case 2: { + if (talker.getLevel() <= 75) { + if (talker.getLevel() < 6) { showPage(talker, "buffs-low-level.htm"); - } - else if (!talker.isMageClass() && (talker.getClassId().level() < 3)) - { + } else if (!talker.isMageClass() && (talker.getClassId().level() < 3)) { npc.setTarget(talker); npc.doCast(WIND_WALK_FOR_BEGINNERS); npc.doCast(WIND_WALK_FOR_BEGINNERS); @@ -293,21 +230,16 @@ public final class NewbieGuide extends AbstractNpcAI npc.doCast(BLESS_THE_BODY_FOR_BEGINNERS); npc.doCast(VAMPIRIC_RAGE_FOR_BEGINNERS); npc.doCast(REGENERATION_FOR_BEGINNERS); - if ((talker.getLevel() >= 6) && (talker.getLevel() <= 39)) - { + if ((talker.getLevel() >= 6) && (talker.getLevel() <= 39)) { npc.doCast(HASTE_FOR_BEGINNERS); } - if ((talker.getLevel() >= 40) && (talker.getLevel() <= 75)) - { + if ((talker.getLevel() >= 40) && (talker.getLevel() <= 75)) { npc.doCast(ADVENTURERS_HASTE); } - if ((talker.getLevel() >= 16) && (talker.getLevel() <= 34)) - { + if ((talker.getLevel() >= 16) && (talker.getLevel() <= 34)) { npc.doCast(LIFE_CUBIC_FOR_BEGINNERS); } - } - else if (talker.isMageClass() && (talker.getClassId().level() < 3)) - { + } else if (talker.isMageClass() && (talker.getClassId().level() < 3)) { npc.setTarget(talker); npc.doCast(WIND_WALK_FOR_BEGINNERS); npc.doCast(SHIELD_FOR_BEGINNERS); @@ -316,42 +248,30 @@ public final class NewbieGuide extends AbstractNpcAI npc.doCast(ACUMEN_FOR_BEGINNERS); npc.doCast(CONCENTRATION_FOR_BEGINNERS); npc.doCast(EMPOWER_FOR_BEGINNERS); - if ((talker.getLevel() >= 16) && (talker.getLevel() <= 34)) - { + if ((talker.getLevel() >= 16) && (talker.getLevel() <= 34)) { npc.doCast(LIFE_CUBIC_FOR_BEGINNERS); } } - } - else - { + } else { showPage(talker, "buffs-big-level.htm"); } break; } - case 3: - { - if ((talker.getLevel() <= 39) && (talker.getClassId().level() < 3)) - { + case 3: { + if ((talker.getLevel() <= 39) && (talker.getClassId().level() < 3)) { npc.setTarget(talker); npc.doCast(BLESSING_OF_PROTECTION); - } - else - { + } else { showPage(talker, "pk-protection-002.htm"); } break; } - case 4: - { + case 4: { L2Summon summon = talker.getSummon(); - if ((summon != null) && !summon.isPet()) - { - if ((talker.getLevel() < 6) || (talker.getLevel() > 75)) - { + if ((summon != null) && !summon.isPet()) { + if ((talker.getLevel() < 6) || (talker.getLevel() > 75)) { showPage(talker, "buffs-big-level.htm"); - } - else - { + } else { npc.setTarget(talker); npc.doCast(WIND_WALK_FOR_BEGINNERS); npc.doCast(SHIELD_FOR_BEGINNERS); @@ -363,18 +283,14 @@ public final class NewbieGuide extends AbstractNpcAI npc.doCast(ACUMEN_FOR_BEGINNERS); npc.doCast(CONCENTRATION_FOR_BEGINNERS); npc.doCast(EMPOWER_FOR_BEGINNERS); - if ((talker.getLevel() >= 6) && (talker.getLevel() <= 39)) - { + if ((talker.getLevel() >= 6) && (talker.getLevel() <= 39)) { npc.doCast(HASTE_FOR_BEGINNERS); } - if ((talker.getLevel() >= 40) && (talker.getLevel() <= 75)) - { + if ((talker.getLevel() >= 40) && (talker.getLevel() <= 75)) { npc.doCast(ADVENTURERS_HASTE); } } - } - else - { + } else { showPage(talker, "buffs-no-pet.htm"); } break; @@ -382,64 +298,42 @@ public final class NewbieGuide extends AbstractNpcAI } break; } - case -1000: - { - switch (reply) - { - case 1: - { - if (talker.getLevel() > 5) - { - if ((talker.getLevel() < 20) && (talker.getClassId().level() == 0)) - { - if (getOneTimeQuestFlag(talker, 207) == 0) - { + case -1000: { + switch (reply) { + case 1: { + if (talker.getLevel() > 5) { + if ((talker.getLevel() < 20) && (talker.getClassId().level() == 0)) { + if (getOneTimeQuestFlag(talker, 207) == 0) { qs.giveItems(APPRENTICE_ADVENTURERS_WEAPON_EXCHANGE_COUPON, FIRST_COUPON_SIZE); setOneTimeQuestFlag(talker, 207, 1); showPage(talker, "newbie-guide-002.htm"); qs.setNRMemoState(talker, GUIDE_MISSION, qs.getNRMemoState(talker, GUIDE_MISSION) + 100); showOnScreenMsg(talker, NpcStringId.ACQUISITION_OF_WEAPON_EXCHANGE_COUPON_FOR_BEGINNERS_COMPLETE_N_GO_SPEAK_WITH_THE_NEWBIE_GUIDE, 2, 5000, ""); - } - else - { + } else { showPage(talker, "newbie-guide-004.htm"); } - } - else - { + } else { showPage(talker, "newbie-guide-003.htm"); } - } - else - { + } else { showPage(talker, "newbie-guide-003.htm"); } break; } - case 2: - { - if (talker.getClassId().level() == 2) - { - if (talker.getLevel() < 40) - { - if (getOneTimeQuestFlag(talker, 208) == 0) - { + case 2: { + if (talker.getClassId().level() == 2) { + if (talker.getLevel() < 40) { + if (getOneTimeQuestFlag(talker, 208) == 0) { qs.giveItems(ADVENTURERS_MAGIC_ACCESSORY_EXCHANGE_COUPON, SECOND_COUPON_SIZE); setOneTimeQuestFlag(talker, 208, 1); showPage(talker, "newbie-guide-011.htm"); - } - else - { + } else { showPage(talker, "newbie-guide-013.htm"); } - } - else - { + } else { showPage(talker, "newbie-guide-012.htm"); } - } - else - { + } else { showPage(talker, "newbie-guide-012.htm"); } break; @@ -448,41 +342,27 @@ public final class NewbieGuide extends AbstractNpcAI break; } - case -303: - { - switch (reply) - { + case -303: { + switch (reply) { case 528: - if (talker.getLevel() > 5) - { - if ((talker.getLevel() < 20) && (talker.getClassId().level() == 0)) - { + if (talker.getLevel() > 5) { + if ((talker.getLevel() < 20) && (talker.getClassId().level() == 0)) { MultisellData.getInstance().separateAndSend(WEAPON_MULTISELL, talker, npc, false); - } - else - { + } else { showPage(talker, "newbie-guide-005.htm"); } - } - else - { + } else { showPage(talker, "newbie-guide-005.htm"); } break; case 529: - if (talker.getLevel() > 5) - { - if ((talker.getLevel() < 40) && (talker.getClassId().level() == 1)) - { + if (talker.getLevel() > 5) { + if ((talker.getLevel() < 40) && (talker.getClassId().level() == 1)) { MultisellData.getInstance().separateAndSend(ACCESORIES_MULTISELL, talker, npc, false); - } - else - { + } else { showPage(talker, "newbie-guide-014.htm"); } - } - else - { + } else { showPage(talker, "newbie-guide-014.htm"); } break; @@ -490,58 +370,45 @@ public final class NewbieGuide extends AbstractNpcAI break; } } - switch (npc.getId()) - { - case NEWBIE_GUIDE_HUMAN: - { + switch (npc.getId()) { + case NEWBIE_GUIDE_HUMAN: { String ansGuideHumanCnacelot = eventGuideHumanCnacelot(reply, qs); - if (!ansGuideHumanCnacelot.isEmpty()) - { + if (!ansGuideHumanCnacelot.isEmpty()) { return ansGuideHumanCnacelot; } break; } - case NEWBIE_GUIDE_ELF: - { + case NEWBIE_GUIDE_ELF: { String ansGuideElfRoios = eventGuideElfRoios(reply, qs); - if (!ansGuideElfRoios.isEmpty()) - { + if (!ansGuideElfRoios.isEmpty()) { return ansGuideElfRoios; } break; } - case NEWBIE_GUIDE_DARK_ELF: - { + case NEWBIE_GUIDE_DARK_ELF: { String ansGuideDelfFrankia = eventGuideDelfFrankia(reply, qs); - if (!ansGuideDelfFrankia.isEmpty()) - { + if (!ansGuideDelfFrankia.isEmpty()) { return ansGuideDelfFrankia; } break; } - case NEWBIE_GUIDE_DWARF: - { + case NEWBIE_GUIDE_DWARF: { String ansGuideDwarfGullin = eventGuideDwarfGullin(reply, qs); - if (!ansGuideDwarfGullin.isEmpty()) - { + if (!ansGuideDwarfGullin.isEmpty()) { return ansGuideDwarfGullin; } break; } - case NEWBIE_GUIDE_ORC: - { + case NEWBIE_GUIDE_ORC: { String ansGuideOrcTanai = eventGuideOrcTanai(reply, qs); - if (!ansGuideOrcTanai.isEmpty()) - { + if (!ansGuideOrcTanai.isEmpty()) { return ansGuideOrcTanai; } break; } - case NEWBIE_GUIDE_KAMAEL: - { + case NEWBIE_GUIDE_KAMAEL: { String ansGuideKrenisk = eventGuideKrenisk(reply, qs); - if (!ansGuideKrenisk.isEmpty()) - { + if (!ansGuideKrenisk.isEmpty()) { return ansGuideKrenisk; } break; @@ -550,28 +417,17 @@ public final class NewbieGuide extends AbstractNpcAI return ""; } - private void teleportRequest(L2PcInstance talker, L2Npc npc, int teleportId) - { - if (talker.getLevel() >= 20) - { + private void teleportRequest(L2PcInstance talker, L2Npc npc, int teleportId) { + if (talker.getLevel() >= 20) { showPage(talker, "teleport-big-level.htm"); - } - else if ((talker.getTransformationId() == 111) || (talker.getTransformationId() == 112) || (talker.getTransformationId() == 124)) - { + } else if ((talker.getTransformationId() == 111) || (talker.getTransformationId() == 112) || (talker.getTransformationId() == 124)) { showPage(talker, "frog-teleport.htm"); - } - else - { - if ((teleportId < 0) || (teleportId > 5)) - { + } else { + if ((teleportId < 0) || (teleportId > 5)) { showPage(talker, npc.getId() + "-teleport.htm"); - } - else - { - if (TELEPORT_MAP.containsKey(npc.getId())) - { - if (TELEPORT_MAP.get(npc.getId()).size() > teleportId) - { + } else { + if (TELEPORT_MAP.containsKey(npc.getId())) { + if (TELEPORT_MAP.get(npc.getId()).size() > teleportId) { talker.teleToLocation(TELEPORT_MAP.get(npc.getId()).get(teleportId), false); } } @@ -579,81 +435,57 @@ public final class NewbieGuide extends AbstractNpcAI } } - private String talkGuide(L2PcInstance talker, QuestState tutorialQS) - { + private String talkGuide(L2PcInstance talker, QuestState tutorialQS) { final QuestState qs = getQuestState(talker, true); - if ((tutorialQS.getMemoStateEx(1) < 5) && (getOneTimeQuestFlag(talker, GUIDE_MISSION) == 0)) - { - if (!talker.isMageClass()) - { + if ((tutorialQS.getMemoStateEx(1) < 5) && (getOneTimeQuestFlag(talker, GUIDE_MISSION) == 0)) { + if (!talker.isMageClass()) { qs.playSound(Voice.TUTORIAL_VOICE_026_1000); qs.giveItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS, 200); qs.giveItems(SCROLL_RECOVERY_NO_GRADE, 2); tutorialQS.setMemoStateEx(1, 5); - if (talker.getLevel() <= 1) - { + if (talker.getLevel() <= 1) { qs.addExpAndSp(68, 50); - } - else - { + } else { qs.addExpAndSp(0, 50); } } - if (talker.isMageClass()) - { - if (talker.getClassId() == ClassId.orcMage) - { + if (talker.isMageClass()) { + if (talker.getClassId() == ClassId.orcMage) { qs.playSound(Voice.TUTORIAL_VOICE_026_1000); qs.giveItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS, 200); - } - else - { + } else { qs.playSound(Voice.TUTORIAL_VOICE_027_1000); qs.giveItems(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS, 100); } qs.giveItems(SCROLL_RECOVERY_NO_GRADE, 2); tutorialQS.setMemoStateEx(1, 5); - if (talker.getLevel() <= 1) - { + if (talker.getLevel() <= 1) { qs.addExpAndSp(68, 50); - } - else - { + } else { qs.addExpAndSp(0, 50); } } - if (talker.getLevel() < 6) - { - if ((qs.getNRMemoState(talker, GUIDE_MISSION) % 10) == 1) - { - if (talker.getLevel() >= 5) - { + if (talker.getLevel() < 6) { + if ((qs.getNRMemoState(talker, GUIDE_MISSION) % 10) == 1) { + if (talker.getLevel() >= 5) { qs.giveAdena(695, true); qs.addExpAndSp(3154, 127); - } - else if (talker.getLevel() >= 4) - { + } else if (talker.getLevel() >= 4) { qs.giveAdena(1041, true); qs.addExpAndSp(4870, 195); - } - else if (talker.getLevel() >= 3) - { + } else if (talker.getLevel() >= 3) { qs.giveAdena(1240, true); qs.addExpAndSp(5970, 239); } - if (!qs.haveNRMemo(talker, GUIDE_MISSION)) - { + if (!qs.haveNRMemo(talker, GUIDE_MISSION)) { qs.setNRMemo(talker, GUIDE_MISSION); qs.setNRMemoState(talker, GUIDE_MISSION, 10); - } - else - { + } else { qs.setNRMemoState(talker, GUIDE_MISSION, qs.getNRMemoState(talker, GUIDE_MISSION) + 10); } return "newbie-guide-02.htm"; } - switch (talker.getRace()) - { + switch (talker.getRace()) { case HUMAN: qs.addRadar(-84436, 242793, -3729); return "newbie-guide-01a.htm"; @@ -673,21 +505,15 @@ public final class NewbieGuide extends AbstractNpcAI qs.addRadar(-119378, 49242, 22); return "newbie-guide-01f.htm"; } - if (!qs.haveNRMemo(talker, GUIDE_MISSION)) - { + if (!qs.haveNRMemo(talker, GUIDE_MISSION)) { qs.setNRMemo(talker, GUIDE_MISSION); qs.setNRMemoState(talker, GUIDE_MISSION, 0); } - } - else if (talker.getLevel() < 10) - { - if ((((qs.getNRMemoState(talker, GUIDE_MISSION) % 1000) / 100) == 1) && (((qs.getNRMemoState(talker, GUIDE_MISSION) % 10000) / 100) == 1)) - { - switch (talker.getRace()) - { + } else if (talker.getLevel() < 10) { + if ((((qs.getNRMemoState(talker, GUIDE_MISSION) % 1000) / 100) == 1) && (((qs.getNRMemoState(talker, GUIDE_MISSION) % 10000) / 100) == 1)) { + switch (talker.getRace()) { case HUMAN: - if (!talker.isMageClass()) - { + if (!talker.isMageClass()) { qs.addRadar(-71384, 258304, -3109); return "newbie-guide-05a.htm"; } @@ -697,8 +523,7 @@ public final class NewbieGuide extends AbstractNpcAI qs.addRadar(47595, 51569, -2996); return "newbie-guide-05c.htm"; case DARK_ELF: - if (!talker.isMageClass()) - { + if (!talker.isMageClass()) { qs.addRadar(10580, 17574, -4554); return "newbie-guide-05d.htm"; } @@ -714,40 +539,27 @@ public final class NewbieGuide extends AbstractNpcAI qs.addRadar(115717, -183488, -1483); return "newbie-guide-05h.htm"; } - if (talker.getLevel() >= 9) - { + if (talker.getLevel() >= 9) { qs.giveAdena(5563, true); qs.addExpAndSp(16851, 711); - } - else if (talker.getLevel() >= 8) - { + } else if (talker.getLevel() >= 8) { qs.giveAdena(9290, true); qs.addExpAndSp(28806, 1207); - } - else if (talker.getLevel() >= 7) - { + } else if (talker.getLevel() >= 7) { qs.giveAdena(11567, true); qs.addExpAndSp(36942, 1541); - } - else - { + } else { qs.giveAdena(12928, true); qs.addExpAndSp(42191, 1753); } - if (!qs.haveNRMemo(talker, GUIDE_MISSION)) - { + if (!qs.haveNRMemo(talker, GUIDE_MISSION)) { qs.setNRMemo(talker, GUIDE_MISSION); qs.setNRMemoState(talker, GUIDE_MISSION, 10000); - } - else - { + } else { qs.setNRMemoState(talker, GUIDE_MISSION, qs.getNRMemoState(talker, GUIDE_MISSION) + 10000); } - } - else if ((((qs.getNRMemoState(talker, GUIDE_MISSION) % 1000) / 100) == 1) && (((qs.getNRMemoState(talker, GUIDE_MISSION) % 10000) / 100) != 1)) - { - switch (talker.getRace()) - { + } else if ((((qs.getNRMemoState(talker, GUIDE_MISSION) % 1000) / 100) == 1) && (((qs.getNRMemoState(talker, GUIDE_MISSION) % 10000) / 100) != 1)) { + switch (talker.getRace()) { case HUMAN: qs.addRadar(-82236, 241573, -3728); return "newbie-guide-04a.htm"; @@ -767,72 +579,50 @@ public final class NewbieGuide extends AbstractNpcAI qs.addRadar(-119378, 49242, 22); return "newbie-guide-04f.htm"; } - if (!qs.haveNRMemo(talker, GUIDE_MISSION)) - { + if (!qs.haveNRMemo(talker, GUIDE_MISSION)) { qs.setNRMemo(talker, GUIDE_MISSION); qs.setNRMemoState(talker, GUIDE_MISSION, 0); } - } - else - { - if (!qs.haveNRMemo(talker, GUIDE_MISSION)) - { + } else { + if (!qs.haveNRMemo(talker, GUIDE_MISSION)) { qs.setNRMemo(talker, GUIDE_MISSION); qs.setNRMemoState(talker, GUIDE_MISSION, 0); } return "newbie-guide-03.htm"; } - } - else - { + } else { setOneTimeQuestFlag(talker, GUIDE_MISSION, 1); - if (!qs.haveNRMemo(talker, GUIDE_MISSION)) - { + if (!qs.haveNRMemo(talker, GUIDE_MISSION)) { qs.setNRMemo(talker, GUIDE_MISSION); qs.setNRMemoState(talker, GUIDE_MISSION, 0); } return "newbie-guide-06.htm"; } - } - else if ((tutorialQS.getMemoStateEx(1) >= 5) && (getOneTimeQuestFlag(talker, GUIDE_MISSION) == 0)) - { - if (talker.getLevel() < 6) - { - if ((qs.getNRMemoState(talker, GUIDE_MISSION) % 10) == 1) - { - if (talker.getLevel() >= 5) - { + } else if ((tutorialQS.getMemoStateEx(1) >= 5) && (getOneTimeQuestFlag(talker, GUIDE_MISSION) == 0)) { + if (talker.getLevel() < 6) { + if ((qs.getNRMemoState(talker, GUIDE_MISSION) % 10) == 1) { + if (talker.getLevel() >= 5) { qs.giveAdena(695, true); qs.addExpAndSp(3154, 127); - } - else if (talker.getLevel() >= 4) - { + } else if (talker.getLevel() >= 4) { qs.giveAdena(1041, true); qs.addExpAndSp(4870, 195); - } - else if (talker.getLevel() >= 3) - { + } else if (talker.getLevel() >= 3) { qs.giveAdena(1186, true); qs.addExpAndSp(5675, 227); - } - else - { + } else { qs.giveAdena(1240, true); qs.addExpAndSp(5970, 239); } - if (!qs.haveNRMemo(talker, GUIDE_MISSION)) - { + if (!qs.haveNRMemo(talker, GUIDE_MISSION)) { qs.setNRMemo(talker, GUIDE_MISSION); qs.setNRMemoState(talker, GUIDE_MISSION, 10); - } - else - { + } else { qs.setNRMemoState(talker, GUIDE_MISSION, qs.getNRMemoState(talker, GUIDE_MISSION) + 10); } return "newbie-guide-08.htm"; } - switch (talker.getRace()) - { + switch (talker.getRace()) { case HUMAN: qs.addRadar(-84436, 242793, -3729); return "newbie-guide-07a.htm"; @@ -852,25 +642,17 @@ public final class NewbieGuide extends AbstractNpcAI qs.addRadar(-119378, 49242, 22); return "newbie-guide-07f.htm"; } - if (!qs.haveNRMemo(talker, GUIDE_MISSION)) - { + if (!qs.haveNRMemo(talker, GUIDE_MISSION)) { qs.setNRMemo(talker, GUIDE_MISSION); qs.setNRMemoState(talker, GUIDE_MISSION, 0); } - } - else if (talker.getLevel() < 10) - { - if (((qs.getNRMemoState(talker, GUIDE_MISSION) % 100000) / 10000) == 1) - { + } else if (talker.getLevel() < 10) { + if (((qs.getNRMemoState(talker, GUIDE_MISSION) % 100000) / 10000) == 1) { return "newbie-guide-09g.htm"; - } - else if ((((qs.getNRMemoState(talker, GUIDE_MISSION) % 1000) / 100) == 1) && (((qs.getNRMemoState(talker, GUIDE_MISSION) % 10000) / 1000) == 1) && (((qs.getNRMemoState(talker, GUIDE_MISSION) % 100000) / 10000) != 1)) - { - switch (talker.getRace()) - { + } else if ((((qs.getNRMemoState(talker, GUIDE_MISSION) % 1000) / 100) == 1) && (((qs.getNRMemoState(talker, GUIDE_MISSION) % 10000) / 1000) == 1) && (((qs.getNRMemoState(talker, GUIDE_MISSION) % 100000) / 10000) != 1)) { + switch (talker.getRace()) { case HUMAN: - if (!talker.isMageClass()) - { + if (!talker.isMageClass()) { qs.addRadar(-71384, 258304, -3109); return "newbie-guide-10a.htm"; } @@ -880,8 +662,7 @@ public final class NewbieGuide extends AbstractNpcAI qs.addRadar(47595, 51569, -2996); return "newbie-guide-10c.htm"; case DARK_ELF: - if (!talker.isMageClass()) - { + if (!talker.isMageClass()) { qs.addRadar(10580, 17574, -4554); return "newbie-guide-10d.htm"; } @@ -898,40 +679,27 @@ public final class NewbieGuide extends AbstractNpcAI return "newbie-guide-10h.htm"; } - if (talker.getLevel() >= 9) - { + if (talker.getLevel() >= 9) { qs.giveAdena(5563, true); qs.addExpAndSp(16851, 711); - } - else if (talker.getLevel() >= 8) - { + } else if (talker.getLevel() >= 8) { qs.giveAdena(9290, true); qs.addExpAndSp(28806, 1207); - } - else if (talker.getLevel() >= 7) - { + } else if (talker.getLevel() >= 7) { qs.giveAdena(11567, true); qs.addExpAndSp(36942, 1541); - } - else - { + } else { qs.giveAdena(12928, true); qs.addExpAndSp(42191, 1753); } - if (!qs.haveNRMemo(talker, GUIDE_MISSION)) - { + if (!qs.haveNRMemo(talker, GUIDE_MISSION)) { qs.setNRMemo(talker, GUIDE_MISSION); qs.setNRMemoState(talker, GUIDE_MISSION, 10000); - } - else - { + } else { qs.setNRMemoState(talker, GUIDE_MISSION, qs.getNRMemoState(talker, GUIDE_MISSION) + 10000); } - } - else if ((((qs.getNRMemoState(talker, GUIDE_MISSION) % 1000) / 100) == 1) && (((qs.getNRMemoState(talker, GUIDE_MISSION) % 10000) / 1000) != 1)) - { - switch (talker.getRace()) - { + } else if ((((qs.getNRMemoState(talker, GUIDE_MISSION) % 1000) / 100) == 1) && (((qs.getNRMemoState(talker, GUIDE_MISSION) % 10000) / 1000) != 1)) { + switch (talker.getRace()) { case HUMAN: qs.addRadar(-82236, 241573, -3728); return "newbie-guide-09a.htm"; @@ -951,32 +719,22 @@ public final class NewbieGuide extends AbstractNpcAI qs.addRadar(-119378, 49242, 22); return "newbie-guide-09f.htm"; } - if (!qs.haveNRMemo(talker, GUIDE_MISSION)) - { + if (!qs.haveNRMemo(talker, GUIDE_MISSION)) { qs.setNRMemo(talker, GUIDE_MISSION); qs.setNRMemoState(talker, GUIDE_MISSION, 0); } - } - else - { - if (!qs.haveNRMemo(talker, GUIDE_MISSION)) - { + } else { + if (!qs.haveNRMemo(talker, GUIDE_MISSION)) { qs.setNRMemo(talker, GUIDE_MISSION); qs.setNRMemoState(talker, GUIDE_MISSION, 0); } return "newbie-guide-08.htm"; } - } - else if (talker.getLevel() < 15) - { - if ((((qs.getNRMemoState(talker, GUIDE_MISSION) % 1000000) / 100000) == 1) && (((qs.getNRMemoState(talker, GUIDE_MISSION) % 10000000) / 1000000) == 1)) - { + } else if (talker.getLevel() < 15) { + if ((((qs.getNRMemoState(talker, GUIDE_MISSION) % 1000000) / 100000) == 1) && (((qs.getNRMemoState(talker, GUIDE_MISSION) % 10000000) / 1000000) == 1)) { return "newbie-guide-15.htm"; - } - else if ((((qs.getNRMemoState(talker, GUIDE_MISSION) % 1000000) / 100000) == 1) && (((qs.getNRMemoState(talker, GUIDE_MISSION) % 10000000) / 1000000) != 1)) - { - switch (talker.getRace()) - { + } else if ((((qs.getNRMemoState(talker, GUIDE_MISSION) % 1000000) / 100000) == 1) && (((qs.getNRMemoState(talker, GUIDE_MISSION) % 10000000) / 1000000) != 1)) { + switch (talker.getRace()) { case HUMAN: qs.addRadar(-84057, 242832, -3729); return "newbie-guide-11a.htm"; @@ -996,48 +754,32 @@ public final class NewbieGuide extends AbstractNpcAI qs.addRadar(-125872, 38208, 1251); return "newbie-guide-11f.htm"; } - if (talker.getLevel() >= 14) - { + if (talker.getLevel() >= 14) { qs.giveAdena(13002, true); qs.addExpAndSp(62876, 2891); - } - else if (talker.getLevel() >= 13) - { + } else if (talker.getLevel() >= 13) { qs.giveAdena(23468, true); qs.addExpAndSp(113137, 5161); - } - else if (talker.getLevel() >= 12) - { + } else if (talker.getLevel() >= 12) { qs.giveAdena(31752, true); qs.addExpAndSp(152653, 6914); - } - else if (talker.getLevel() >= 11) - { + } else if (talker.getLevel() >= 11) { qs.giveAdena(38180, true); qs.addExpAndSp(183128, 8242); - } - else - { + } else { qs.giveAdena(43054, true); qs.addExpAndSp(206101, 9227); } - if (!qs.haveNRMemo(talker, GUIDE_MISSION)) - { + if (!qs.haveNRMemo(talker, GUIDE_MISSION)) { qs.setNRMemo(talker, GUIDE_MISSION); qs.setNRMemoState(talker, GUIDE_MISSION, 1000000); - } - else - { + } else { qs.setNRMemoState(talker, GUIDE_MISSION, qs.getNRMemoState(talker, GUIDE_MISSION) + 1000000); } - } - else if (((qs.getNRMemoState(talker, GUIDE_MISSION) % 1000000) / 100000) != 1) - { - switch (talker.getRace()) - { + } else if (((qs.getNRMemoState(talker, GUIDE_MISSION) % 1000000) / 100000) != 1) { + switch (talker.getRace()) { case HUMAN: - if (!talker.isMageClass()) - { + if (!talker.isMageClass()) { qs.addRadar(-71384, 258304, -3109); return "newbie-guide-10a.htm"; } @@ -1047,8 +789,7 @@ public final class NewbieGuide extends AbstractNpcAI qs.addRadar(47595, 51569, -2996); return "newbie-guide-10c.htm"; case DARK_ELF: - if (!talker.isMageClass()) - { + if (!talker.isMageClass()) { qs.addRadar(10580, 17574, -4554); return "newbie-guide-10d.htm"; } @@ -1064,104 +805,75 @@ public final class NewbieGuide extends AbstractNpcAI qs.addRadar(-118080, 42835, 720); return "newbie-guide-10h.htm"; } - if (!qs.haveNRMemo(talker, GUIDE_MISSION)) - { + if (!qs.haveNRMemo(talker, GUIDE_MISSION)) { qs.setNRMemo(talker, GUIDE_MISSION); qs.setNRMemoState(talker, GUIDE_MISSION, 0); } } - } - else if (talker.getLevel() < 18) - { - if ((((qs.getNRMemoState(talker, GUIDE_MISSION) % 100000000) / 10000000) == 1) && (((qs.getNRMemoState(talker, GUIDE_MISSION) % 1000000000) / 100000000) == 1)) - { + } else if (talker.getLevel() < 18) { + if ((((qs.getNRMemoState(talker, GUIDE_MISSION) % 100000000) / 10000000) == 1) && (((qs.getNRMemoState(talker, GUIDE_MISSION) % 1000000000) / 100000000) == 1)) { setOneTimeQuestFlag(talker, GUIDE_MISSION, 1); return "newbie-guide-13.htm"; - } - else if ((((qs.getNRMemoState(talker, GUIDE_MISSION) % 100000000) / 10000000) == 1) && (((qs.getNRMemoState(talker, GUIDE_MISSION) % 1000000000) / 100000000) != 1)) - { - if (talker.getLevel() >= 17) - { + } else if ((((qs.getNRMemoState(talker, GUIDE_MISSION) % 100000000) / 10000000) == 1) && (((qs.getNRMemoState(talker, GUIDE_MISSION) % 1000000000) / 100000000) != 1)) { + if (talker.getLevel() >= 17) { qs.giveAdena(22996, true); qs.addExpAndSp(113712, 5518); - } - else if (talker.getLevel() >= 16) - { + } else if (talker.getLevel() >= 16) { qs.giveAdena(10018, true); qs.addExpAndSp(208133, 42237); - } - else - { + } else { qs.giveAdena(13648, true); qs.addExpAndSp(285670, 58155); } - if (!qs.haveNRMemo(talker, GUIDE_MISSION)) - { + if (!qs.haveNRMemo(talker, GUIDE_MISSION)) { qs.setNRMemo(talker, GUIDE_MISSION); qs.setNRMemoState(talker, GUIDE_MISSION, 100000000); - } - else - { + } else { qs.setNRMemoState(talker, GUIDE_MISSION, qs.getNRMemoState(talker, GUIDE_MISSION) + 100000000); } setOneTimeQuestFlag(talker, GUIDE_MISSION, 1); return "newbie-guide-12.htm"; - } - else if (((qs.getNRMemoState(talker, GUIDE_MISSION) % 100000000) / 10000000) != 1) - { - switch (talker.getRace()) - { + } else if (((qs.getNRMemoState(talker, GUIDE_MISSION) % 100000000) / 10000000) != 1) { + switch (talker.getRace()) { case HUMAN: qs.addRadar(-84057, 242832, -3729); return "newbie-guide-11a.htm"; - case ELF: - { + case ELF: { qs.addRadar(45859, 50827, -3058); return "newbie-guide-11b.htm"; } - case DARK_ELF: - { + case DARK_ELF: { qs.addRadar(11258, 14431, -4242); return "newbie-guide-11c.htm"; } - case ORC: - { + case ORC: { qs.addRadar(-45863, -112621, -200); return "newbie-guide-11d.htm"; } - case DWARF: - { + case DWARF: { qs.addRadar(116268, -177524, -914); return "newbie-guide-11e.htm"; } - case KAMAEL: - { + case KAMAEL: { qs.addRadar(-125872, 38208, 1251); return "newbie-guide-11f.htm"; } } } - if (!qs.haveNRMemo(talker, GUIDE_MISSION)) - { + if (!qs.haveNRMemo(talker, GUIDE_MISSION)) { qs.setNRMemo(talker, GUIDE_MISSION); qs.setNRMemoState(talker, GUIDE_MISSION, 0); } - } - else if (talker.getClassId().level() == 1) - { + } else if (talker.getClassId().level() == 1) { setOneTimeQuestFlag(talker, GUIDE_MISSION, 1); - if (!qs.haveNRMemo(talker, GUIDE_MISSION)) - { + if (!qs.haveNRMemo(talker, GUIDE_MISSION)) { qs.setNRMemo(talker, GUIDE_MISSION); qs.setNRMemoState(talker, GUIDE_MISSION, 0); } return "newbie-guide-13.htm"; - } - else - { + } else { setOneTimeQuestFlag(talker, GUIDE_MISSION, 1); - if (!qs.haveNRMemo(talker, GUIDE_MISSION)) - { + if (!qs.haveNRMemo(talker, GUIDE_MISSION)) { qs.setNRMemo(talker, GUIDE_MISSION); qs.setNRMemoState(talker, GUIDE_MISSION, 0); } @@ -1171,10 +883,8 @@ public final class NewbieGuide extends AbstractNpcAI return ""; } - private String eventGuideHumanCnacelot(int event, QuestState qs) - { - switch (event) - { + private String eventGuideHumanCnacelot(int event, QuestState qs) { + switch (event) { case 10: return "30598-04.htm"; case 11: @@ -1239,146 +949,122 @@ public final class NewbieGuide extends AbstractNpcAI qs.clearRadar(); qs.addRadar(-83789, 240799, -3717); return "30598-05.htm"; - case 42: - { + case 42: { qs.clearRadar(); qs.addRadar(-84204, 240403, -3717); return "30598-05.htm"; } - case 43: - { + case 43: { qs.clearRadar(); qs.addRadar(-86385, 243267, -3717); return "30598-05.htm"; } - case 44: - { + case 44: { qs.clearRadar(); qs.addRadar(-86733, 242918, -3717); return "30598-05.htm"; } - case 45: - { + case 45: { qs.clearRadar(); qs.addRadar(-84516, 245449, -3714); return "30598-05.htm"; } - case 46: - { + case 46: { qs.clearRadar(); qs.addRadar(-84729, 245001, -3726); return "30598-05.htm"; } - case 47: - { + case 47: { qs.clearRadar(); qs.addRadar(-84965, 245222, -3726); return "30598-05.htm"; } - case 48: - { + case 48: { qs.clearRadar(); qs.addRadar(-84981, 244764, -3726); return "30598-05.htm"; } - case 49: - { + case 49: { qs.clearRadar(); qs.addRadar(-85186, 245001, -3726); return "30598-05.htm"; } - case 50: - { + case 50: { qs.clearRadar(); qs.addRadar(-83326, 242964, -3718); return "30598-05.htm"; } - case 51: - { + case 51: { qs.clearRadar(); qs.addRadar(-83020, 242553, -3718); return "30598-05.htm"; } - case 52: - { + case 52: { qs.clearRadar(); qs.addRadar(-83175, 243065, -3718); return "30598-05.htm"; } - case 53: - { + case 53: { qs.clearRadar(); qs.addRadar(-82809, 242751, -3718); return "30598-05.htm"; } - case 54: - { + case 54: { qs.clearRadar(); qs.addRadar(-81895, 243917, -3721); return "30598-05.htm"; } - case 55: - { + case 55: { qs.clearRadar(); qs.addRadar(-81840, 243534, -3721); return "30598-05.htm"; } - case 56: - { + case 56: { qs.clearRadar(); qs.addRadar(-81512, 243424, -3720); return "30598-05.htm"; } - case 57: - { + case 57: { qs.clearRadar(); qs.addRadar(-84436, 242793, -3729); return "30598-05.htm"; } - case 58: - { + case 58: { qs.clearRadar(); qs.addRadar(-78939, 240305, -3443); return "30598-05.htm"; } - case 59: - { + case 59: { qs.clearRadar(); qs.addRadar(-85301, 244587, -3725); return "30598-05.htm"; } - case 60: - { + case 60: { qs.clearRadar(); qs.addRadar(-83163, 243560, -3728); return "30598-05.htm"; } - case 61: - { + case 61: { qs.clearRadar(); qs.addRadar(-97131, 258946, -3622); return "30598-05.htm"; } - case 62: - { + case 62: { qs.clearRadar(); qs.addRadar(-114685, 222291, -2925); return "30598-05.htm"; } - case 63: - { + case 63: { qs.clearRadar(); qs.addRadar(-84057, 242832, -3729); return "30598-05.htm"; } - case 64: - { + case 64: { qs.clearRadar(); qs.addRadar(-100332, 238019, -3573); return "30598-05.htm"; } - case 65: - { + case 65: { qs.clearRadar(); qs.addRadar(-82041, 242718, -3725); return "30598-05.htm"; @@ -1387,10 +1073,8 @@ public final class NewbieGuide extends AbstractNpcAI return ""; } - private String eventGuideElfRoios(int event, QuestState qs) - { - switch (event) - { + private String eventGuideElfRoios(int event, QuestState qs) { + switch (event) { case 10: return "30599-04.htm"; case 11: @@ -1537,10 +1221,8 @@ public final class NewbieGuide extends AbstractNpcAI return ""; } - private String eventGuideDelfFrankia(int event, QuestState qs) - { - switch (event) - { + private String eventGuideDelfFrankia(int event, QuestState qs) { + switch (event) { case 10: return "30600-04.htm"; case 11: @@ -1703,10 +1385,8 @@ public final class NewbieGuide extends AbstractNpcAI return ""; } - private String eventGuideDwarfGullin(int event, QuestState qs) - { - switch (event) - { + private String eventGuideDwarfGullin(int event, QuestState qs) { + switch (event) { case 10: return "30601-04.htm"; case 11: @@ -1873,10 +1553,8 @@ public final class NewbieGuide extends AbstractNpcAI return ""; } - private String eventGuideOrcTanai(int event, QuestState qs) - { - switch (event) - { + private String eventGuideOrcTanai(int event, QuestState qs) { + switch (event) { case 10: return "30602-04.htm"; case 11: @@ -2005,10 +1683,8 @@ public final class NewbieGuide extends AbstractNpcAI return ""; } - private String eventGuideKrenisk(int event, QuestState qs) - { - switch (event) - { + private String eventGuideKrenisk(int event, QuestState qs) { + switch (event) { case 10: return "32135-04.htm"; case 11: @@ -2211,8 +1887,7 @@ public final class NewbieGuide extends AbstractNpcAI return ""; } - public static void main(String[] args) - { + public static void main(String[] args) { new NewbieGuide(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/NoblesseTeleport/NoblesseTeleport.java b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/NoblesseTeleport/NoblesseTeleport.java index a6df27011b..ea18403650 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/NoblesseTeleport/NoblesseTeleport.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/NoblesseTeleport/NoblesseTeleport.java @@ -27,13 +27,11 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Original Jython script by Ham Wong. * @author Plim */ -public final class NoblesseTeleport extends AbstractNpcAI -{ +public final class NoblesseTeleport extends AbstractNpcAI { // Item private static final int OLYMPIAD_TOKEN = 13722; // NPCs - private static final int[] NPCs = - { + private static final int[] NPCs = { 30006, 30059, 30080, @@ -55,24 +53,18 @@ public final class NoblesseTeleport extends AbstractNpcAI 32163 }; - private NoblesseTeleport() - { + private NoblesseTeleport() { super(NoblesseTeleport.class.getSimpleName(), "ai/npc/Teleports"); addStartNpc(NPCs); addTalkId(NPCs); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if ("teleportWithToken".equals(event)) - { - if (hasQuestItems(player, OLYMPIAD_TOKEN)) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if ("teleportWithToken".equals(event)) { + if (hasQuestItems(player, OLYMPIAD_TOKEN)) { npc.showChatWindow(player, 3); - } - else - { + } else { return "noble-nopass.htm"; } } @@ -80,13 +72,11 @@ public final class NoblesseTeleport extends AbstractNpcAI } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { return player.isNoble() ? "nobleteleporter.htm" : "nobleteleporter-no.htm"; } - public static void main(String[] args) - { + public static void main(String[] args) { new NoblesseTeleport(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/OracleTeleport/OracleTeleport.java b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/OracleTeleport/OracleTeleport.java index b896a2dcdd..77ff498857 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/OracleTeleport/OracleTeleport.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/OracleTeleport/OracleTeleport.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.util.Util; * Oracle teleport AI. * @author Charus */ -public final class OracleTeleport extends AbstractNpcAI -{ +public final class OracleTeleport extends AbstractNpcAI { // @formatter:off private final static int[] TOWN_DAWN = { @@ -67,8 +66,7 @@ public final class OracleTeleport extends AbstractNpcAI 31122, 31123, 31124, 31125 }; // @formatter:on - private final static Location[] RETURN_LOCS = - { + private final static Location[] RETURN_LOCS = { new Location(-80555, 150337, -3040), new Location(-13953, 121404, -2984), new Location(16354, 142820, -2696), @@ -138,8 +136,7 @@ public final class OracleTeleport extends AbstractNpcAI // Item private static final int DIMENSIONAL_FRAGMENT = 7079; - private OracleTeleport() - { + private OracleTeleport() { super(OracleTeleport.class.getSimpleName(), "ai/npc/Teleports"); addStartNpc(RIFT_POSTERS); addStartNpc(TELEPORTERS); @@ -154,67 +151,47 @@ public final class OracleTeleport extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = ""; QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } final int npcId = npc.getId(); - if (event.equalsIgnoreCase("Return")) - { - if (Util.contains(TEMPLE_PRIEST, npcId) && (st.getState() == State.STARTED)) - { + if (event.equalsIgnoreCase("Return")) { + if (Util.contains(TEMPLE_PRIEST, npcId) && (st.getState() == State.STARTED)) { player.teleToLocation(RETURN_LOCS[st.getInt("id")]); player.setIsIn7sDungeon(false); st.exitQuest(true); - } - else if (Util.contains(RIFT_POSTERS, npcId) && (st.getState() == State.STARTED)) - { + } else if (Util.contains(RIFT_POSTERS, npcId) && (st.getState() == State.STARTED)) { player.teleToLocation(RETURN_LOCS[st.getInt("id")]); htmltext = "rift_back.htm"; st.exitQuest(true); } - } - else if (event.equalsIgnoreCase("Festival")) - { + } else if (event.equalsIgnoreCase("Festival")) { int id = st.getInt("id"); - if (Util.contains(TOWN_DAWN, id)) - { + if (Util.contains(TOWN_DAWN, id)) { player.teleToLocation(new Location(-80157, 111344, -4901)); player.setIsIn7sDungeon(true); - } - else if (Util.contains(TOWN_DUSK, id)) - { + } else if (Util.contains(TOWN_DUSK, id)) { player.teleToLocation(new Location(-81261, 86531, -5157)); player.setIsIn7sDungeon(true); - } - else - { + } else { htmltext = "oracle1.htm"; } - } - else if (event.equalsIgnoreCase("Dimensional")) - { + } else if (event.equalsIgnoreCase("Dimensional")) { htmltext = "oracle.htm"; player.teleToLocation(new Location(-114755, -179466, -6752)); - } - else if (event.equalsIgnoreCase("5.htm")) - { + } else if (event.equalsIgnoreCase("5.htm")) { int id = st.getInt("id"); - if (id > -1) - { + if (id > -1) { htmltext = "5a.htm"; } int i = 0; - for (int id1 : TELEPORTERS) - { - if (id1 == npcId) - { + for (int id1 : TELEPORTERS) { + if (id1 == npcId) { break; } i++; @@ -222,44 +199,27 @@ public final class OracleTeleport extends AbstractNpcAI st.set("id", Integer.toString(i)); st.setState(State.STARTED); player.teleToLocation(new Location(-114755, -179466, -6752)); - } - else if (event.equalsIgnoreCase("6.htm")) - { + } else if (event.equalsIgnoreCase("6.htm")) { htmltext = "6.htm"; st.exitQuest(true); - } - else if (event.equalsIgnoreCase("zigurratDimensional")) - { + } else if (event.equalsIgnoreCase("zigurratDimensional")) { int playerLevel = player.getLevel(); - if ((playerLevel >= 20) && (playerLevel < 30)) - { + if ((playerLevel >= 20) && (playerLevel < 30)) { takeItems(player, Inventory.ADENA_ID, 2000); - } - else if ((playerLevel >= 30) && (playerLevel < 40)) - { + } else if ((playerLevel >= 30) && (playerLevel < 40)) { takeItems(player, Inventory.ADENA_ID, 4500); - } - else if ((playerLevel >= 40) && (playerLevel < 50)) - { + } else if ((playerLevel >= 40) && (playerLevel < 50)) { takeItems(player, Inventory.ADENA_ID, 8000); - } - else if ((playerLevel >= 50) && (playerLevel < 60)) - { + } else if ((playerLevel >= 50) && (playerLevel < 60)) { takeItems(player, Inventory.ADENA_ID, 12500); - } - else if ((playerLevel >= 60) && (playerLevel < 70)) - { + } else if ((playerLevel >= 60) && (playerLevel < 70)) { takeItems(player, Inventory.ADENA_ID, 18000); - } - else if (playerLevel >= 70) - { + } else if (playerLevel >= 70) { takeItems(player, Inventory.ADENA_ID, 24500); } int i = 0; - for (int ziggurat : TELEPORTERS) - { - if (ziggurat == npcId) - { + for (int ziggurat : TELEPORTERS) { + if (ziggurat == npcId) { break; } i++; @@ -274,20 +234,16 @@ public final class OracleTeleport extends AbstractNpcAI } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = ""; QuestState st = getQuestState(player, true); int npcId = npc.getId(); - if (Util.contains(TOWN_DAWN, npcId)) - { + if (Util.contains(TOWN_DAWN, npcId)) { st.setState(State.STARTED); int i = 0; - for (int dawn : TELEPORTERS) - { - if (dawn == npcId) - { + for (int dawn : TELEPORTERS) { + if (dawn == npcId) { break; } i++; @@ -297,14 +253,11 @@ public final class OracleTeleport extends AbstractNpcAI player.teleToLocation(new Location(-80157, 111344, -4901)); player.setIsIn7sDungeon(true); } - if (Util.contains(TOWN_DUSK, npcId)) - { + if (Util.contains(TOWN_DUSK, npcId)) { st.setState(State.STARTED); int i = 0; - for (int dusk : TELEPORTERS) - { - if (dusk == npcId) - { + for (int dusk : TELEPORTERS) { + if (dusk == npcId) { break; } i++; @@ -313,87 +266,56 @@ public final class OracleTeleport extends AbstractNpcAI playSound(player, Sound.ITEMSOUND_QUEST_ACCEPT); player.teleToLocation(new Location(-81261, 86531, -5157)); player.setIsIn7sDungeon(true); - } - else if ((npcId >= 31494) && (npcId <= 31507)) - { - if (player.getLevel() < 20) - { + } else if ((npcId >= 31494) && (npcId <= 31507)) { + if (player.getLevel() < 20) { htmltext = "1.htm"; st.exitQuest(true); - } - else if (player.getAllActiveQuests().size() > 23) - { + } else if (player.getAllActiveQuests().size() > 23) { htmltext = "1a.htm"; st.exitQuest(true); - } - else if (!hasQuestItems(player, DIMENSIONAL_FRAGMENT)) - { + } else if (!hasQuestItems(player, DIMENSIONAL_FRAGMENT)) { htmltext = "3.htm"; - } - else - { + } else { st.setState(State.CREATED); htmltext = "4.htm"; } - } - else if (((npcId >= 31095) && (npcId <= 31111)) || ((npcId >= 31114) && (npcId <= 31126))) - { + } else if (((npcId >= 31095) && (npcId <= 31111)) || ((npcId >= 31114) && (npcId <= 31126))) { int playerLevel = player.getLevel(); - if (playerLevel < 20) - { + if (playerLevel < 20) { htmltext = "ziggurat_lowlevel.htm"; st.exitQuest(true); - } - else if (player.getAllActiveQuests().size() > 40) - { + } else if (player.getAllActiveQuests().size() > 40) { player.sendPacket(SystemMessageId.TOO_MANY_QUESTS); st.exitQuest(true); - } - else if (!hasQuestItems(player, DIMENSIONAL_FRAGMENT)) - { + } else if (!hasQuestItems(player, DIMENSIONAL_FRAGMENT)) { htmltext = "ziggurat_nofrag.htm"; st.exitQuest(true); - } - else if ((playerLevel >= 20) && (playerLevel < 30) && (player.getAdena() < 2000)) - { + } else if ((playerLevel >= 20) && (playerLevel < 30) && (player.getAdena() < 2000)) { htmltext = "ziggurat_noadena.htm"; st.exitQuest(true); - } - else if ((playerLevel >= 30) && (playerLevel < 40) && (player.getAdena() < 4500)) - { + } else if ((playerLevel >= 30) && (playerLevel < 40) && (player.getAdena() < 4500)) { htmltext = "ziggurat_noadena.htm"; st.exitQuest(true); - } - else if ((playerLevel >= 40) && (playerLevel < 50) && (player.getAdena() < 8000)) - { + } else if ((playerLevel >= 40) && (playerLevel < 50) && (player.getAdena() < 8000)) { htmltext = "ziggurat_noadena.htm"; st.exitQuest(true); - } - else if ((playerLevel >= 50) && (playerLevel < 60) && (player.getAdena() < 12500)) - { + } else if ((playerLevel >= 50) && (playerLevel < 60) && (player.getAdena() < 12500)) { htmltext = "ziggurat_noadena.htm"; st.exitQuest(true); - } - else if ((playerLevel >= 60) && (playerLevel < 70) && (player.getAdena() < 18000)) - { + } else if ((playerLevel >= 60) && (playerLevel < 70) && (player.getAdena() < 18000)) { htmltext = "ziggurat_noadena.htm"; st.exitQuest(true); - } - else if ((playerLevel >= 70) && (player.getAdena() < 24500)) - { + } else if ((playerLevel >= 70) && (player.getAdena() < 24500)) { htmltext = "ziggurat_noadena.htm"; st.exitQuest(true); - } - else - { + } else { htmltext = "ziggurat.htm"; } } return htmltext; } - public static void main(String[] args) - { + public static void main(String[] args) { new OracleTeleport(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/PaganTeleporters/PaganTeleporters.java b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/PaganTeleporters/PaganTeleporters.java index 9e8bfe78ce..25c87012ac 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/PaganTeleporters/PaganTeleporters.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/PaganTeleporters/PaganTeleporters.java @@ -31,15 +31,13 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Original Jython script by BiTi. * @author Plim */ -public final class PaganTeleporters extends AbstractNpcAI -{ +public final class PaganTeleporters extends AbstractNpcAI { // NPCs private static final int TRIOLS_MIRROR_1 = 32039; private static final int TRIOLS_MIRROR_2 = 32040; // Locations private static final Map<Integer, Location> TRIOLS_LOCS = new HashMap<>(); - static - { + static { TRIOLS_LOCS.put(TRIOLS_MIRROR_1, new Location(-12766, -35840, -10856)); TRIOLS_LOCS.put(TRIOLS_MIRROR_2, new Location(36640, -51218, 718)); } @@ -54,8 +52,7 @@ public final class PaganTeleporters extends AbstractNpcAI private static final int FADED_VISITORS_MARK = 8065; private static final int PAGANS_MARK = 8067; - private PaganTeleporters() - { + private PaganTeleporters() { super(PaganTeleporters.class.getSimpleName(), "ai/npc/Teleports"); addStartNpc(NPCS); addTalkId(NPCS); @@ -63,17 +60,13 @@ public final class PaganTeleporters extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { - case "Close_Door1": - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { + case "Close_Door1": { closeDoor(19160001, 0); break; } - case "Close_Door2": - { + case "Close_Door2": { closeDoor(19160010, 0); closeDoor(19160011, 0); break; @@ -83,40 +76,31 @@ public final class PaganTeleporters extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { - if (TRIOLS_LOCS.containsKey(npc.getId())) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { + if (TRIOLS_LOCS.containsKey(npc.getId())) { player.teleToLocation(TRIOLS_LOCS.get(npc.getId())); } return ""; } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { - switch (npc.getId()) - { - case 32034: - { - if (!hasAtLeastOneQuestItem(player, VISITORS_MARK, FADED_VISITORS_MARK, PAGANS_MARK)) - { + public String onTalk(L2Npc npc, L2PcInstance player) { + switch (npc.getId()) { + case 32034: { + if (!hasAtLeastOneQuestItem(player, VISITORS_MARK, FADED_VISITORS_MARK, PAGANS_MARK)) { return "noItem.htm"; } openDoor(19160001, 0); startQuestTimer("Close_Door1", 10000, null, null); return "FadedMark.htm"; } - case 32035: - { + case 32035: { openDoor(19160001, 0); startQuestTimer("Close_Door1", 10000, null, null); return "FadedMark.htm"; } - case 32036: - { - if (!hasQuestItems(player, PAGANS_MARK)) - { + case 32036: { + if (!hasQuestItems(player, PAGANS_MARK)) { return "noMark.htm"; } startQuestTimer("Close_Door2", 10000, null, null); @@ -124,8 +108,7 @@ public final class PaganTeleporters extends AbstractNpcAI openDoor(19160011, 0); return "openDoor.htm"; } - case 32037: - { + case 32037: { openDoor(19160010, 0); openDoor(19160011, 0); startQuestTimer("Close_Door2", 10000, null, null); @@ -135,8 +118,7 @@ public final class PaganTeleporters extends AbstractNpcAI return super.onTalk(npc, player); } - public static void main(String[] args) - { + public static void main(String[] args) { new PaganTeleporters(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/SeparatedSoul/SeparatedSoul.java b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/SeparatedSoul/SeparatedSoul.java index 5974131487..f2edff8f04 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/SeparatedSoul/SeparatedSoul.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/SeparatedSoul/SeparatedSoul.java @@ -30,11 +30,9 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Separated Soul teleport AI. * @author UnAfraid, improved by Adry_85, Zealar */ -public final class SeparatedSoul extends AbstractNpcAI -{ +public final class SeparatedSoul extends AbstractNpcAI { // NPCs - private static final int[] SEPARATED_SOULS = - { + private static final int[] SEPARATED_SOULS = { 32864, 32865, 32866, @@ -54,8 +52,7 @@ public final class SeparatedSoul extends AbstractNpcAI // Locations private static final Map<Integer, Location> LOCATIONS = new HashMap<>(); - static - { + static { LOCATIONS.put(1, new Location(117046, 76798, -2696)); // Hunter's Village LOCATIONS.put(2, new Location(99218, 110283, -3696)); // The Center of Dragon Valley LOCATIONS.put(3, new Location(116992, 113716, -3056)); // Deep inside Dragon Valley(North) @@ -66,8 +63,7 @@ public final class SeparatedSoul extends AbstractNpcAI LOCATIONS.put(8, new Location(131116, 114333, -3704)); // Entrance of Antharas' Lair } - private SeparatedSoul() - { + private SeparatedSoul() { super(SeparatedSoul.class.getSimpleName(), "ai/npc/Teleports"); addStartNpc(SEPARATED_SOULS); addTalkId(SEPARATED_SOULS); @@ -75,17 +71,14 @@ public final class SeparatedSoul extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return npc.getId() + ".htm"; } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final int ask = Integer.parseInt(event); - switch (ask) - { + switch (ask) { case 1: case 2: case 3: @@ -93,41 +86,31 @@ public final class SeparatedSoul extends AbstractNpcAI case 5: case 6: case 7: - case 8: - { - if (player.getLevel() >= MIN_LEVEL) - { + case 8: { + if (player.getLevel() >= MIN_LEVEL) { player.teleToLocation(LOCATIONS.get(ask), false); - } - else - { + } else { return "no-level.htm"; } break; } - case 23241: - { - if (hasQuestItems(player, WILL_OF_ANTHARAS, SEALED_BLOOD_CRYSTAL)) - { + case 23241: { + if (hasQuestItems(player, WILL_OF_ANTHARAS, SEALED_BLOOD_CRYSTAL)) { takeItems(player, WILL_OF_ANTHARAS, 1); takeItems(player, SEALED_BLOOD_CRYSTAL, 1); giveItems(player, ANTHARAS_BLOOD_CRYSTAL, 1); - } - else - { + } else { return "no-items.htm"; } } - case 23242: - { + case 23242: { return "separatedsoul.htm"; } } return super.onAdvEvent(event, npc, player); } - public static void main(String[] args) - { + public static void main(String[] args) { new SeparatedSoul(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/StakatoNestTeleporter/StakatoNestTeleporter.java b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/StakatoNestTeleporter/StakatoNestTeleporter.java index a2b720bf60..7d89480c98 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/StakatoNestTeleporter/StakatoNestTeleporter.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/StakatoNestTeleporter/StakatoNestTeleporter.java @@ -28,11 +28,9 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Stakato Nest Teleport AI. * @author Charus */ -public final class StakatoNestTeleporter extends AbstractNpcAI -{ +public final class StakatoNestTeleporter extends AbstractNpcAI { // Locations - private final static Location[] LOCS = - { + private final static Location[] LOCS = { new Location(80456, -52322, -5640), new Location(88718, -46214, -4640), new Location(87464, -54221, -5120), @@ -42,28 +40,22 @@ public final class StakatoNestTeleporter extends AbstractNpcAI // NPC private final static int KINTAIJIN = 32640; - private StakatoNestTeleporter() - { + private StakatoNestTeleporter() { super(StakatoNestTeleporter.class.getSimpleName(), "ai/npc/Teleports"); addStartNpc(KINTAIJIN); addTalkId(KINTAIJIN); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { int index = Integer.parseInt(event) - 1; - if (LOCS.length > index) - { + if (LOCS.length > index) { Location loc = LOCS[index]; - if (player.getParty() != null) - { - for (L2PcInstance partyMember : player.getParty().getMembers()) - { - if (partyMember.isInsideRadius(player, 1000, true, true)) - { + if (player.getParty() != null) { + for (L2PcInstance partyMember : player.getParty().getMembers()) { + if (partyMember.isInsideRadius(player, 1000, true, true)) { partyMember.teleToLocation(loc, true); } } @@ -74,13 +66,11 @@ public final class StakatoNestTeleporter extends AbstractNpcAI } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { return (player.hasQuestCompleted(Q00240_ImTheOnlyOneYouCanTrust.class.getSimpleName()) ? "32640.htm" : "32640-no.htm"); } - public static void main(String[] args) - { + public static void main(String[] args) { new StakatoNestTeleporter(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/SteelCitadelTeleport/SteelCitadelTeleport.java b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/SteelCitadelTeleport/SteelCitadelTeleport.java index 307ef9df06..4a8f35d8a3 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/SteelCitadelTeleport/SteelCitadelTeleport.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/SteelCitadelTeleport/SteelCitadelTeleport.java @@ -34,57 +34,46 @@ import com.l2jserver.gameserver.model.zone.type.L2BossZone; * Steel Citadel teleport AI. * @author GKR */ -public final class SteelCitadelTeleport extends AbstractNpcAI -{ +public final class SteelCitadelTeleport extends AbstractNpcAI { // NPCs private static final int BELETH = 29118; private static final int NAIA_CUBE = 32376; // Location private static final Location TELEPORT_CITADEL = new Location(16342, 209557, -9352); - private SteelCitadelTeleport() - { + private SteelCitadelTeleport() { super(SteelCitadelTeleport.class.getSimpleName(), "ai/npc/Teleports"); addStartNpc(NAIA_CUBE); addTalkId(NAIA_CUBE); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final int belethStatus = GrandBossManager.getInstance().getBossStatus(BELETH); - if (belethStatus == 3) - { + if (belethStatus == 3) { return "32376-02.htm"; } - if (belethStatus > 0) - { + if (belethStatus > 0) { return "32376-03.htm"; } final L2CommandChannel channel = player.getParty() == null ? null : player.getParty().getCommandChannel(); - if ((channel == null) || (channel.getLeader().getObjectId() != player.getObjectId()) || (channel.getMemberCount() < grandBoss().getBelethMinPlayers())) - { + if ((channel == null) || (channel.getLeader().getObjectId() != player.getObjectId()) || (channel.getMemberCount() < grandBoss().getBelethMinPlayers())) { return "32376-02a.htm"; } final L2BossZone zone = (L2BossZone) ZoneManager.getInstance().getZoneById(12018); - if (zone != null) - { + if (zone != null) { GrandBossManager.getInstance().setBossStatus(BELETH, 1); - for (L2Party party : channel.getPartys()) - { - if (party == null) - { + for (L2Party party : channel.getPartys()) { + if (party == null) { continue; } - for (L2PcInstance pl : party.getMembers()) - { - if (pl.isInsideRadius(npc.getX(), npc.getY(), npc.getZ(), 3000, true, false)) - { + for (L2PcInstance pl : party.getMembers()) { + if (pl.isInsideRadius(npc.getX(), npc.getY(), npc.getZ(), 3000, true, false)) { zone.allowPlayerEntry(pl, 30); pl.teleToLocation(TELEPORT_CITADEL, true); } @@ -94,8 +83,7 @@ public final class SteelCitadelTeleport extends AbstractNpcAI return null; } - public static void main(String[] args) - { + public static void main(String[] args) { new SteelCitadelTeleport(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/StrongholdsTeleports/StrongholdsTeleports.java b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/StrongholdsTeleports/StrongholdsTeleports.java index c50ad65e18..2931065ccb 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/StrongholdsTeleports/StrongholdsTeleports.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/StrongholdsTeleports/StrongholdsTeleports.java @@ -27,35 +27,29 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Original Jython script by Kerberos. * @author Plim */ -public final class StrongholdsTeleports extends AbstractNpcAI -{ +public final class StrongholdsTeleports extends AbstractNpcAI { // NPCs - private final static int[] NPCs = - { + private final static int[] NPCs = { 32163, 32181, 32184, 32186 }; - private StrongholdsTeleports() - { + private StrongholdsTeleports() { super(StrongholdsTeleports.class.getSimpleName(), "ai/npc/Teleports"); addFirstTalkId(NPCs); } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { - if (player.getLevel() < 20) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { + if (player.getLevel() < 20) { return String.valueOf(npc.getId()) + ".htm"; } return String.valueOf(npc.getId()) + "-no.htm"; } - public static void main(String[] args) - { + public static void main(String[] args) { new StrongholdsTeleports(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/Survivor/Survivor.java b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/Survivor/Survivor.java index ad4edb8a90..effaaf7dba 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/Survivor/Survivor.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/Survivor/Survivor.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.itemcontainer.Inventory; * Original Jython script by Kerberos. * @author Plim */ -public final class Survivor extends AbstractNpcAI -{ +public final class Survivor extends AbstractNpcAI { // NPC private static final int SURVIVOR = 32632; // Misc @@ -38,28 +37,20 @@ public final class Survivor extends AbstractNpcAI // Location private static final Location TELEPORT = new Location(-149406, 255247, -80); - private Survivor() - { + private Survivor() { super(Survivor.class.getSimpleName(), "ai/npc/Teleports"); addStartNpc(SURVIVOR); addTalkId(SURVIVOR); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if ("32632-2.htm".equals(event)) - { - if (player.getLevel() < MIN_LEVEL) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if ("32632-2.htm".equals(event)) { + if (player.getLevel() < MIN_LEVEL) { event = "32632-3.htm"; - } - else if (player.getAdena() < 150000) - { + } else if (player.getAdena() < 150000) { return event; - } - else - { + } else { takeItems(player, Inventory.ADENA_ID, 150000); player.teleToLocation(TELEPORT); return null; @@ -69,13 +60,11 @@ public final class Survivor extends AbstractNpcAI } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { return "32632-1.htm"; } - public static void main(String[] args) - { + public static void main(String[] args) { new Survivor(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/TeleportToFantasy/TeleportToFantasy.java b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/TeleportToFantasy/TeleportToFantasy.java index 3fce7b266c..e5f553be74 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/TeleportToFantasy/TeleportToFantasy.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/TeleportToFantasy/TeleportToFantasy.java @@ -32,14 +32,12 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Fantasy Island teleport AI. * @author Plim */ -public final class TeleportToFantasy extends AbstractNpcAI -{ +public final class TeleportToFantasy extends AbstractNpcAI { // NPC private static final int PADDIES = 32378; // Locations private static final Location RUNE_TOWNSHIP = new Location(43835, -47749, -792); - private static final Location[] RETURN_LOCATIONS = - { + private static final Location[] RETURN_LOCATIONS = { new Location(-80826, 149775, -3043), new Location(-12672, 122776, -3116), new Location(15670, 142983, -2705), @@ -53,8 +51,7 @@ public final class TeleportToFantasy extends AbstractNpcAI new Location(87386, -143246, -1293), new Location(12882, 181053, -3560) }; - private static final Location[] ISLE_LOCATIONS = - { + private static final Location[] ISLE_LOCATIONS = { new Location(-58752, -56898, -2032), new Location(-59716, -57868, -2032), new Location(-60691, -56893, -2032), @@ -62,8 +59,7 @@ public final class TeleportToFantasy extends AbstractNpcAI }; // Misc private static final Map<Integer, Integer> TELEPORTERS = new HashMap<>(); - static - { + static { TELEPORTERS.put(30059, 2); // Trisha TELEPORTERS.put(30080, 3); // Clarissa TELEPORTERS.put(30177, 5); // Valentina @@ -79,8 +75,7 @@ public final class TeleportToFantasy extends AbstractNpcAI // Player Variables private static final String FANTASY_RETURN = "FANTASY_RETURN"; - private TeleportToFantasy() - { + private TeleportToFantasy() { super(TeleportToFantasy.class.getSimpleName(), "ai/npc/Teleports"); addStartNpc(PADDIES); addStartNpc(TELEPORTERS.keySet()); @@ -89,33 +84,25 @@ public final class TeleportToFantasy extends AbstractNpcAI } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { - if (npc.getId() == PADDIES) - { + public String onTalk(L2Npc npc, L2PcInstance player) { + if (npc.getId() == PADDIES) { final int returnId = player.getVariables().getInt(FANTASY_RETURN, -1); - if (returnId != -1) - { + if (returnId != -1) { player.teleToLocation(RETURN_LOCATIONS[returnId]); player.getVariables().remove(FANTASY_RETURN); - } - else - { + } else { broadcastNpcSay(npc, Say2.ALL, NpcStringId.IF_YOUR_MEANS_OF_ARRIVAL_WAS_A_BIT_UNCONVENTIONAL_THEN_ILL_BE_SENDING_YOU_BACK_TO_RUNE_TOWNSHIP_WHICH_IS_THE_NEAREST_TOWN); player.teleToLocation(RUNE_TOWNSHIP); } - } - else - { + } else { player.teleToLocation(ISLE_LOCATIONS[getRandom(ISLE_LOCATIONS.length)]); player.getVariables().set(FANTASY_RETURN, String.valueOf(TELEPORTERS.get(npc.getId()))); } return super.onTalk(npc, player); } - public static void main(String[] args) - { + public static void main(String[] args) { new TeleportToFantasy(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/TeleportToRaceTrack/TeleportToRaceTrack.java b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/TeleportToRaceTrack/TeleportToRaceTrack.java index 10ba5e4adf..508bd775be 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/TeleportToRaceTrack/TeleportToRaceTrack.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/TeleportToRaceTrack/TeleportToRaceTrack.java @@ -32,15 +32,13 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Monster Derby Track teleport AI. * @author Plim */ -public final class TeleportToRaceTrack extends AbstractNpcAI -{ +public final class TeleportToRaceTrack extends AbstractNpcAI { // NPC private static final int RACE_MANAGER = 30995; // Locations private static final Location TELEPORT = new Location(12661, 181687, -3540); private static final Location DION_CASTLE_TOWN = new Location(15670, 142983, -2700); - private static final Location[] RETURN_LOCATIONS = - { + private static final Location[] RETURN_LOCATIONS = { new Location(-80826, 149775, -3043), new Location(-12672, 122776, -3116), new Location(15670, 142983, -2705), @@ -56,8 +54,7 @@ public final class TeleportToRaceTrack extends AbstractNpcAI }; // Misc private static final Map<Integer, Integer> TELEPORTERS = new HashMap<>(); - static - { + static { TELEPORTERS.put(30059, 2); // Trisha TELEPORTERS.put(30080, 3); // Clarissa TELEPORTERS.put(30177, 5); // Valentina @@ -73,8 +70,7 @@ public final class TeleportToRaceTrack extends AbstractNpcAI // Player Variables private static final String MONSTER_RETURN = "MONSTER_RETURN"; - private TeleportToRaceTrack() - { + private TeleportToRaceTrack() { super(TeleportToRaceTrack.class.getSimpleName(), "ai/npc/Teleports"); addStartNpc(RACE_MANAGER); addStartNpc(TELEPORTERS.keySet()); @@ -83,33 +79,25 @@ public final class TeleportToRaceTrack extends AbstractNpcAI } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { - if (npc.getId() == RACE_MANAGER) - { + public String onTalk(L2Npc npc, L2PcInstance player) { + if (npc.getId() == RACE_MANAGER) { final int returnId = player.getVariables().getInt(MONSTER_RETURN, -1); - if (returnId != -1) - { + if (returnId != -1) { player.teleToLocation(RETURN_LOCATIONS[returnId]); player.getVariables().remove(MONSTER_RETURN); - } - else - { + } else { broadcastNpcSay(npc, Say2.ALL, NpcStringId.IF_YOUR_MEANS_OF_ARRIVAL_WAS_A_BIT_UNCONVENTIONAL_THEN_ILL_BE_SENDING_YOU_BACK_TO_RUNE_TOWNSHIP_WHICH_IS_THE_NEAREST_TOWN); player.teleToLocation(DION_CASTLE_TOWN); } - } - else - { + } else { player.teleToLocation(TELEPORT); player.getVariables().set(MONSTER_RETURN, TELEPORTERS.get(npc.getId())); } return super.onTalk(npc, player); } - public static void main(String[] args) - { + public static void main(String[] args) { new TeleportToRaceTrack(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/TeleportToUndergroundColiseum/TeleportToUndergroundColiseum.java b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/TeleportToUndergroundColiseum/TeleportToUndergroundColiseum.java index 65abb84960..4ca38c6ef2 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/TeleportToUndergroundColiseum/TeleportToUndergroundColiseum.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/TeleportToUndergroundColiseum/TeleportToUndergroundColiseum.java @@ -28,13 +28,11 @@ import com.l2jserver.gameserver.util.Util; * Underground Coliseum teleport AI * @author malyelfik */ -public final class TeleportToUndergroundColiseum extends AbstractNpcAI -{ +public final class TeleportToUndergroundColiseum extends AbstractNpcAI { // NPCs private static final int COLISEUM_HELPER = 32491; private static final int PADDIES = 32378; - private static final int[] MANAGERS = - { + private static final int[] MANAGERS = { 32377, 32513, 32514, @@ -43,16 +41,14 @@ public final class TeleportToUndergroundColiseum extends AbstractNpcAI }; // Locations - private static final Location[] COLISEUM_LOCS = - { + private static final Location[] COLISEUM_LOCS = { new Location(-81896, -49589, -10352), new Location(-82271, -49196, -10352), new Location(-81886, -48784, -10352), new Location(-81490, -49167, -10352) }; - private static final Location[] RETURN_LOCS = - { + private static final Location[] RETURN_LOCS = { new Location(-59161, -56954, -2036), new Location(-59155, -56831, -2036), new Location(-59299, -56955, -2036), @@ -60,8 +56,7 @@ public final class TeleportToUndergroundColiseum extends AbstractNpcAI new Location(-59134, -56899, -2036) }; - private static final Location[][] MANAGERS_LOCS = - { + private static final Location[][] MANAGERS_LOCS = { { new Location(-84451, -45452, -10728), new Location(-84580, -45587, -10728) @@ -84,8 +79,7 @@ public final class TeleportToUndergroundColiseum extends AbstractNpcAI } }; - private TeleportToUndergroundColiseum() - { + private TeleportToUndergroundColiseum() { super(TeleportToUndergroundColiseum.class.getSimpleName(), "ai/npc/Teleports"); addStartNpc(MANAGERS); addStartNpc(COLISEUM_HELPER, PADDIES); @@ -95,18 +89,12 @@ public final class TeleportToUndergroundColiseum extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.endsWith(".htm")) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.endsWith(".htm")) { return event; - } - else if (event.equals("return")) - { + } else if (event.equals("return")) { player.teleToLocation(RETURN_LOCS[getRandom(RETURN_LOCS.length)], false); - } - else if (Util.isDigit(event)) - { + } else if (Util.isDigit(event)) { int val = Integer.parseInt(event) - 1; player.teleToLocation(MANAGERS_LOCS[val][getRandom(MANAGERS_LOCS[val].length)], false); } @@ -114,27 +102,21 @@ public final class TeleportToUndergroundColiseum extends AbstractNpcAI } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { - if (Util.contains(MANAGERS, npc.getId())) - { + public String onTalk(L2Npc npc, L2PcInstance player) { + if (Util.contains(MANAGERS, npc.getId())) { player.teleToLocation(RETURN_LOCS[getRandom(RETURN_LOCS.length)], false); - } - else - { + } else { player.teleToLocation(COLISEUM_LOCS[getRandom(COLISEUM_LOCS.length)], false); } return null; } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return "32491.htm"; } - public static void main(String[] args) - { + public static void main(String[] args) { new TeleportToUndergroundColiseum(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/TeleportWithCharm/TeleportWithCharm.java b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/TeleportWithCharm/TeleportWithCharm.java index ee7ab0bd0e..b5d7598e4e 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/TeleportWithCharm/TeleportWithCharm.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/TeleportWithCharm/TeleportWithCharm.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Original Jython script by DraX. * @author Plim */ -public final class TeleportWithCharm extends AbstractNpcAI -{ +public final class TeleportWithCharm extends AbstractNpcAI { // NPCs private final static int WHIRPY = 30540; private final static int TAMIL = 30576; @@ -40,40 +39,29 @@ public final class TeleportWithCharm extends AbstractNpcAI private final static Location ORC_TELEPORT = new Location(-80826, 149775, -3043); private final static Location DWARF_TELEPORT = new Location(-80826, 149775, -3043); - private TeleportWithCharm() - { + private TeleportWithCharm() { super(TeleportWithCharm.class.getSimpleName(), "ai/npc/Teleports"); addStartNpc(WHIRPY, TAMIL); addTalkId(WHIRPY, TAMIL); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { - switch (npc.getId()) - { - case WHIRPY: - { - if (hasQuestItems(player, DWARF_GATEKEEPER_TOKEN)) - { + public String onTalk(L2Npc npc, L2PcInstance player) { + switch (npc.getId()) { + case WHIRPY: { + if (hasQuestItems(player, DWARF_GATEKEEPER_TOKEN)) { takeItems(player, DWARF_GATEKEEPER_TOKEN, 1); player.teleToLocation(DWARF_TELEPORT); - } - else - { + } else { return "30540-01.htm"; } break; } - case TAMIL: - { - if (hasQuestItems(player, ORC_GATEKEEPER_CHARM)) - { + case TAMIL: { + if (hasQuestItems(player, ORC_GATEKEEPER_CHARM)) { takeItems(player, ORC_GATEKEEPER_CHARM, 1); player.teleToLocation(ORC_TELEPORT); - } - else - { + } else { return "30576-01.htm"; } break; @@ -82,8 +70,7 @@ public final class TeleportWithCharm extends AbstractNpcAI return super.onTalk(npc, player); } - public static void main(String[] args) - { + public static void main(String[] args) { new TeleportWithCharm(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/ToIVortex/ToIVortex.java b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/ToIVortex/ToIVortex.java index 27aee9a49d..5be484560c 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/ToIVortex/ToIVortex.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Teleports/ToIVortex/ToIVortex.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.model.itemcontainer.Inventory; * Reworked by xban1x. * @author Plim */ -public final class ToIVortex extends AbstractNpcAI -{ +public final class ToIVortex extends AbstractNpcAI { // NPCs private static final int KEPLON = 30949; private static final int EUCLIE = 30950; @@ -51,8 +50,7 @@ public final class ToIVortex extends AbstractNpcAI private static final Map<String, Location> TOI_FLOORS = new HashMap<>(); // Misc private static final Map<String, Integer> DIMENSION_TRADE = new HashMap<>(); - static - { + static { TOI_FLOORS.put("1", new Location(114356, 13423, -5096)); TOI_FLOORS.put("2", new Location(114666, 13380, -3608)); TOI_FLOORS.put("3", new Location(111982, 16028, -2120)); @@ -80,20 +78,17 @@ public final class ToIVortex extends AbstractNpcAI DIMENSION_TRADE.put("RED", RED_DIMENSION_STONE); } - private ToIVortex() - { + private ToIVortex() { super(ToIVortex.class.getSimpleName(), "ai/npc/Teleports"); addStartNpc(KEPLON, EUCLIE, PITHGON, DIMENSION_VORTEX_1, DIMENSION_VORTEX_2, DIMENSION_VORTEX_3); addTalkId(KEPLON, EUCLIE, PITHGON, DIMENSION_VORTEX_1, DIMENSION_VORTEX_2, DIMENSION_VORTEX_3); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { int npcId = npc.getId(); - switch (event) - { + switch (event) { case "1": case "2": case "3": @@ -103,32 +98,24 @@ public final class ToIVortex extends AbstractNpcAI case "7": case "8": case "9": - case "10": - { + case "10": { final Location loc = TOI_FLOORS.get(event); final int itemId = TOI_FLOOR_ITEMS.get(event); - if (hasQuestItems(player, itemId)) - { + if (hasQuestItems(player, itemId)) { takeItems(player, itemId, 1); player.teleToLocation(loc, true); - } - else - { + } else { return "no-stones.htm"; } break; } case "GREEN": case "BLUE": - case "RED": - { - if (player.getAdena() >= 10000) - { + case "RED": { + if (player.getAdena() >= 10000) { takeItems(player, Inventory.ADENA_ID, 10000); giveItems(player, DIMENSION_TRADE.get(event), 1); - } - else - { + } else { return npcId + "no-adena.htm"; } break; @@ -137,8 +124,7 @@ public final class ToIVortex extends AbstractNpcAI return super.onAdvEvent(event, npc, player); } - public static void main(String[] args) - { + public static void main(String[] args) { new ToIVortex(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/TerritoryManagers/TerritoryManagers.java b/src/main/java/com/l2jserver/datapack/ai/npc/TerritoryManagers/TerritoryManagers.java index f7eb752ce3..5aff8c0390 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/TerritoryManagers/TerritoryManagers.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/TerritoryManagers/TerritoryManagers.java @@ -42,10 +42,8 @@ import com.l2jserver.gameserver.network.serverpackets.UserInfo; * @author Zoey76 * @version 1.1 */ -public final class TerritoryManagers extends AbstractNpcAI -{ - private static final int[] preciousSoul1ItemIds = - { +public final class TerritoryManagers extends AbstractNpcAI { + private static final int[] preciousSoul1ItemIds = { 7587, 7588, 7589, @@ -53,24 +51,20 @@ public final class TerritoryManagers extends AbstractNpcAI 7598, 7599 }; - private static final int[] preciousSoul2ItemIds = - { + private static final int[] preciousSoul2ItemIds = { 7595 }; - private static final int[] preciousSoul3ItemIds = - { + private static final int[] preciousSoul3ItemIds = { 7678, 7591, 7592, 7593 }; - private TerritoryManagers() - { + private TerritoryManagers() { super(TerritoryManagers.class.getSimpleName(), "ai/npc"); - for (int i = 0; i < 9; i++) - { + for (int i = 0; i < 9; i++) { addFirstTalkId(36490 + i); addTalkId(36490 + i); addStartNpc(36490 + i); @@ -78,10 +72,8 @@ public final class TerritoryManagers extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { - if ((player.getClassId().level() < 2) || (player.getLevel() < 40)) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { + if ((player.getClassId().level() < 2) || (player.getLevel() < 40)) { // If the player does not have the second class transfer or is under level 40, it cannot continue. return "36490-08.html"; } @@ -89,16 +81,13 @@ public final class TerritoryManagers extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; final int npcId = npc.getId(); final int itemId = 13757 + (npcId - 36490); final int territoryId = 81 + (npcId - 36490); - switch (event) - { - case "36490-04.html": - { + switch (event) { + case "36490-04.html": { // L2J Custom for minimum badges required. final NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId()); html.setFile(player.getHtmlPrefix(), "data/scripts/ai/npc/TerritoryManagers/36490-04.html"); @@ -106,40 +95,28 @@ public final class TerritoryManagers extends AbstractNpcAI player.sendPacket(html); break; } - case "BuyProducts": - { - if (player.getInventory().getItemByItemId(itemId) != null) - { + case "BuyProducts": { + if (player.getInventory().getItemByItemId(itemId) != null) { // If the player has at least one Territory Badges then show the multisell. final int multiSellId = 364900001 + ((npcId - 36490) * 10000); MultisellData.getInstance().separateAndSend(multiSellId, player, npc, false); - } - else - { + } else { // If the player does not have Territory Badges, it cannot continue. htmltext = "36490-02.html"; } break; } - case "MakeMeNoble": - { - if (player.getInventory().getInventoryItemCount(itemId, -1) < territoryWar().getMinTerritoryBadgeForNobless()) - { + case "MakeMeNoble": { + if (player.getInventory().getInventoryItemCount(itemId, -1) < territoryWar().getMinTerritoryBadgeForNobless()) { // If the player does not have enough Territory Badges, it cannot continue. htmltext = "36490-02.html"; - } - else if (player.isNoble()) - { + } else if (player.isNoble()) { // If the player is already Noblesse, it cannot continue. htmltext = "36490-05.html"; - } - else if (player.getLevel() < 75) - { + } else if (player.getLevel() < 75) { // If the player is not level 75 or greater, it cannot continue. htmltext = "36490-06.html"; - } - else - { + } else { // Complete the Noblesse related quests. // Possessor of a Precious Soul - 1 (241) processNoblesseQuest(player, 241, preciousSoul1ItemIds); @@ -162,11 +139,9 @@ public final class TerritoryManagers extends AbstractNpcAI // Complete quest Seeds of Chaos (236) for Kamael characters. // Complete quest Mimir's Elixir (235) for other races characters. final Quest q = QuestManager.getInstance().getQuest((player.getRace() == Race.KAMAEL) ? 236 : 235); - if (q != null) - { + if (q != null) { QuestState qs = player.getQuestState(q.getName()); - if (qs == null) - { + if (qs == null) { qs = q.newQuestState(player); qs.setState(State.STARTED); } @@ -187,26 +162,18 @@ public final class TerritoryManagers extends AbstractNpcAI } break; } - case "CalcRewards": - { + case "CalcRewards": { final int[] reward = TerritoryWarManager.getInstance().calcReward(player); final NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId()); final String prefix = player.getHtmlPrefix(); - if (TerritoryWarManager.getInstance().isTWInProgress() || (reward[0] == 0)) - { + if (TerritoryWarManager.getInstance().isTWInProgress() || (reward[0] == 0)) { html.setFile(prefix, "data/scripts/ai/npc/TerritoryManagers/reward-0a.html"); - } - else if (reward[0] != territoryId) - { + } else if (reward[0] != territoryId) { html.setFile(prefix, "data/scripts/ai/npc/TerritoryManagers/reward-0b.html"); html.replace("%castle%", CastleManager.getInstance().getCastleById(reward[0] - 80).getName()); - } - else if (reward[1] == 0) - { + } else if (reward[1] == 0) { html.setFile(prefix, "data/scripts/ai/npc/TerritoryManagers/reward-0a.html"); - } - else - { + } else { html.setFile(prefix, "data/scripts/ai/npc/TerritoryManagers/reward-1.html"); html.replace("%castle%", CastleManager.getInstance().getCastleById(reward[0] - 80).getName()); html.replace("%badge%", String.valueOf(reward[1])); @@ -218,30 +185,21 @@ public final class TerritoryManagers extends AbstractNpcAI player.sendPacket(ActionFailed.STATIC_PACKET); break; } - case "ReceiveRewards": - { + case "ReceiveRewards": { int badgeId = 57; - if (TerritoryWarManager.TERRITORY_ITEM_IDS.containsKey(territoryId)) - { + if (TerritoryWarManager.TERRITORY_ITEM_IDS.containsKey(territoryId)) { badgeId = TerritoryWarManager.TERRITORY_ITEM_IDS.get(territoryId); } int[] reward = TerritoryWarManager.getInstance().calcReward(player); final NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId()); - if (TerritoryWarManager.getInstance().isTWInProgress() || (reward[0] == 0)) - { + if (TerritoryWarManager.getInstance().isTWInProgress() || (reward[0] == 0)) { html.setFile(player.getHtmlPrefix(), "data/scripts/ai/npc/TerritoryManagers/reward-0a.html"); - } - else if (reward[0] != territoryId) - { + } else if (reward[0] != territoryId) { html.setFile(player.getHtmlPrefix(), "data/scripts/ai/npc/TerritoryManagers/reward-0b.html"); html.replace("%castle%", CastleManager.getInstance().getCastleById(reward[0] - 80).getName()); - } - else if (reward[1] == 0) - { + } else if (reward[1] == 0) { html.setFile(player.getHtmlPrefix(), "data/scripts/ai/npc/TerritoryManagers/reward-0a.html"); - } - else - { + } else { html.setFile(player.getHtmlPrefix(), "data/scripts/ai/npc/TerritoryManagers/reward-2.html"); player.addItem("ReceiveRewards", badgeId, reward[1], npc, true); player.addAdena("ReceiveRewards", reward[1] * 5000, npc, true); @@ -253,8 +211,7 @@ public final class TerritoryManagers extends AbstractNpcAI player.sendPacket(ActionFailed.STATIC_PACKET); break; } - default: - { + default: { htmltext = event; break; } @@ -268,28 +225,22 @@ public final class TerritoryManagers extends AbstractNpcAI * @param questId the quest Id of the quest that will be processed * @param itemIds the item Ids should be deleted */ - private static void processNoblesseQuest(L2PcInstance player, int questId, int[] itemIds) - { + private static void processNoblesseQuest(L2PcInstance player, int questId, int[] itemIds) { final Quest q = QuestManager.getInstance().getQuest(questId); - if (q == null) - { + if (q == null) { return; } QuestState qs = player.getQuestState(q.getName()); - if (qs == null) - { + if (qs == null) { qs = q.newQuestState(player); qs.setState(State.STARTED); } - if (!qs.isCompleted()) - { + if (!qs.isCompleted()) { // Take the quest specific items. - if (itemIds != null) - { - for (int itemId : itemIds) - { + if (itemIds != null) { + for (int itemId : itemIds) { takeItems(player, itemId, -1); } } @@ -305,17 +256,14 @@ public final class TerritoryManagers extends AbstractNpcAI * @param event the event leading to this deletion * @param npc the npc referencing this deletion */ - private static void deleteIfExist(L2PcInstance player, int itemId, String event, L2Npc npc) - { + private static void deleteIfExist(L2PcInstance player, int itemId, String event, L2Npc npc) { final L2ItemInstance item = player.getInventory().getItemByItemId(itemId); - if (item != null) - { + if (item != null) { player.destroyItem(event, item, npc, true); } } - public static void main(String[] args) - { + public static void main(String[] args) { new TerritoryManagers(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/TownPets/TownPets.java b/src/main/java/com/l2jserver/datapack/ai/npc/TownPets/TownPets.java index 1a06a42117..d366454fc1 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/TownPets/TownPets.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/TownPets/TownPets.java @@ -30,11 +30,9 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Town Pets AI * @author malyelfik */ -public final class TownPets extends AbstractNpcAI -{ +public final class TownPets extends AbstractNpcAI { // Pet IDs - private static final int[] PETS = - { + private static final int[] PETS = { 31202, // Maximus 31203, // Moon Dancer 31204, // Georgio @@ -49,21 +47,17 @@ public final class TownPets extends AbstractNpcAI 31955, // Ruby }; - private TownPets() - { + private TownPets() { super(TownPets.class.getSimpleName(), "ai/npc"); - if (general().allowPetWalkers()) - { + if (general().allowPetWalkers()) { addSpawnId(PETS); } } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equalsIgnoreCase("move")) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equalsIgnoreCase("move")) { final int locX = (npc.getSpawn().getX() - 50) + getRandom(100); final int locY = (npc.getSpawn().getY() - 50) + getRandom(100); npc.setRunning(); @@ -74,14 +68,12 @@ public final class TownPets extends AbstractNpcAI } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { startQuestTimer("move", 3000, npc, null); return super.onSpawn(npc); } - public static void main(String[] args) - { + public static void main(String[] args) { new TownPets(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Trainers/HealerTrainer/HealerTrainer.java b/src/main/java/com/l2jserver/datapack/ai/npc/Trainers/HealerTrainer/HealerTrainer.java index d96bae6ad8..941b7cbc17 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Trainers/HealerTrainer/HealerTrainer.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Trainers/HealerTrainer/HealerTrainer.java @@ -38,8 +38,7 @@ import com.l2jserver.gameserver.network.serverpackets.AcquireSkillList; * Trainer healers AI. * @author Zoey76 */ -public final class HealerTrainer extends AbstractNpcAI -{ +public final class HealerTrainer extends AbstractNpcAI { // NPC // @formatter:off private static final int[] HEALER_TRAINERS = @@ -55,8 +54,7 @@ public final class HealerTrainer extends AbstractNpcAI private static final int MIN_LEVEL = 76; private static final int MIN_CLASS_LEVEL = 3; - private HealerTrainer() - { + private HealerTrainer() { super(HealerTrainer.class.getSimpleName(), "ai/npc/Trainers"); addStartNpc(HEALER_TRAINERS); addTalkId(HEALER_TRAINERS); @@ -64,94 +62,72 @@ public final class HealerTrainer extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { + switch (event) { case "30864.html": - case "30864-1.html": - { + case "30864-1.html": { htmltext = event; break; } - case "SkillTransfer": - { + case "SkillTransfer": { htmltext = "main.html"; break; } - case "SkillTransferLearn": - { - if (!npc.getTemplate().canTeach(player.getClassId())) - { + case "SkillTransferLearn": { + if (!npc.getTemplate().canTeach(player.getClassId())) { htmltext = npc.getId() + "-noteach.html"; break; } - if ((player.getLevel() < MIN_LEVEL) || (player.getClassId().level() < MIN_CLASS_LEVEL)) - { + if ((player.getLevel() < MIN_LEVEL) || (player.getClassId().level() < MIN_CLASS_LEVEL)) { htmltext = "learn-lowlevel.html"; break; } final AcquireSkillList asl = new AcquireSkillList(AcquireSkillType.TRANSFER); int count = 0; - for (L2SkillLearn skillLearn : SkillTreesData.getInstance().getAvailableTransferSkills(player)) - { - if (SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel()) != null) - { + for (L2SkillLearn skillLearn : SkillTreesData.getInstance().getAvailableTransferSkills(player)) { + if (SkillData.getInstance().getSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel()) != null) { count++; asl.addSkill(skillLearn.getSkillId(), skillLearn.getSkillLevel(), skillLearn.getSkillLevel(), skillLearn.getLevelUpSp(), 0); } } - if (count > 0) - { + if (count > 0) { player.sendPacket(asl); - } - else - { + } else { player.sendPacket(SystemMessageId.NO_MORE_SKILLS_TO_LEARN); } break; } - case "SkillTransferCleanse": - { - if (!npc.getTemplate().canTeach(player.getClassId())) - { + case "SkillTransferCleanse": { + if (!npc.getTemplate().canTeach(player.getClassId())) { htmltext = "cleanse-no.html"; break; } - if ((player.getLevel() < MIN_LEVEL) || (player.getClassId().level() < MIN_CLASS_LEVEL)) - { + if ((player.getLevel() < MIN_LEVEL) || (player.getClassId().level() < MIN_CLASS_LEVEL)) { htmltext = "cleanse-no.html"; break; } - if (player.getAdena() < character().getFeeDeleteTransferSkills()) - { + if (player.getAdena() < character().getFeeDeleteTransferSkills()) { player.sendPacket(SystemMessageId.CANNOT_RESET_SKILL_LINK_BECAUSE_NOT_ENOUGH_ADENA); break; } - if (hasTransferSkillItems(player)) - { + if (hasTransferSkillItems(player)) { // Come back when you have used all transfer skill items for this class. htmltext = "cleanse-no_skills.html"; - } - else - { + } else { boolean hasSkills = false; final Collection<L2SkillLearn> skills = SkillTreesData.getInstance().getTransferSkillTree(player.getClassId()).values(); - for (L2SkillLearn skillLearn : skills) - { + for (L2SkillLearn skillLearn : skills) { final Skill skill = player.getKnownSkill(skillLearn.getSkillId()); - if (skill != null) - { + if (skill != null) { player.removeSkill(skill); - for (ItemHolder item : skillLearn.getRequiredItems()) - { + for (ItemHolder item : skillLearn.getRequiredItems()) { player.addItem("Cleanse", item.getId(), item.getCount(), npc, true); } hasSkills = true; @@ -159,8 +135,7 @@ public final class HealerTrainer extends AbstractNpcAI } // Adena gets reduced once. - if (hasSkills) - { + if (hasSkills) { player.reduceAdena("Cleanse", character().getFeeDeleteTransferSkills(), npc, true); } } @@ -175,36 +150,29 @@ public final class HealerTrainer extends AbstractNpcAI * @param player the player to verify * @return {@code true} if the player has the item for the current class, {@code false} otherwise */ - private static boolean hasTransferSkillItems(L2PcInstance player) - { + private static boolean hasTransferSkillItems(L2PcInstance player) { int itemId; - switch (player.getClassId()) - { - case cardinal: - { + switch (player.getClassId()) { + case cardinal: { itemId = 15307; break; } - case evaSaint: - { + case evaSaint: { itemId = 15308; break; } - case shillienSaint: - { + case shillienSaint: { itemId = 15309; break; } - default: - { + default: { itemId = -1; } } return (player.getInventory().getInventoryItemCount(itemId, -1) > 0); } - public static void main(String[] args) - { + public static void main(String[] args) { new HealerTrainer(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/Tunatun/Tunatun.java b/src/main/java/com/l2jserver/datapack/ai/npc/Tunatun/Tunatun.java index f8d6510d78..7a0b9662ff 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/Tunatun/Tunatun.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/Tunatun/Tunatun.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Beast Herder Tunatun AI. * @author Adry_85 */ -public final class Tunatun extends AbstractNpcAI -{ +public final class Tunatun extends AbstractNpcAI { // NPC private static final int TUNATUN = 31537; // Item @@ -37,8 +36,7 @@ public final class Tunatun extends AbstractNpcAI // Misc private static final int MIN_LEVEL = 82; - private Tunatun() - { + private Tunatun() { super(Tunatun.class.getSimpleName(), "ai/npc"); addStartNpc(TUNATUN); addFirstTalkId(TUNATUN); @@ -46,22 +44,16 @@ public final class Tunatun extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if ("Whip".equals(event)) - { - if (hasQuestItems(player, BEAST_HANDLERS_WHIP)) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if ("Whip".equals(event)) { + if (hasQuestItems(player, BEAST_HANDLERS_WHIP)) { return "31537-01.html"; } QuestState st = player.getQuestState(Q00020_BringUpWithLove.class.getSimpleName()); - if ((st == null) && (player.getLevel() < MIN_LEVEL)) - { + if ((st == null) && (player.getLevel() < MIN_LEVEL)) { return "31537-02.html"; - } - else if ((st != null) || (player.getLevel() >= MIN_LEVEL)) - { + } else if ((st != null) || (player.getLevel() >= MIN_LEVEL)) { giveItems(player, BEAST_HANDLERS_WHIP, 1); return "31537-03.html"; } @@ -69,8 +61,7 @@ public final class Tunatun extends AbstractNpcAI return event; } - public static void main(String[] args) - { + public static void main(String[] args) { new Tunatun(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/VarkaSilenosSupport/VarkaSilenosSupport.java b/src/main/java/com/l2jserver/datapack/ai/npc/VarkaSilenosSupport/VarkaSilenosSupport.java index 4241d1f166..22d90f2bd2 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/VarkaSilenosSupport/VarkaSilenosSupport.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/VarkaSilenosSupport/VarkaSilenosSupport.java @@ -33,26 +33,21 @@ import com.l2jserver.gameserver.util.Util; * Original Jython script by Emperorc and Kerberos_20. * @author Nyaran */ -public final class VarkaSilenosSupport extends AbstractNpcAI -{ - private static class BuffsData - { +public final class VarkaSilenosSupport extends AbstractNpcAI { + private static class BuffsData { private final int _skill; private final int _cost; - public BuffsData(int skill, int cost) - { + public BuffsData(int skill, int cost) { _skill = skill; _cost = cost; } - public Skill getSkill() - { + public Skill getSkill() { return SkillData.getInstance().getSkill(_skill, 1); } - public int getCost() - { + public int getCost() { return _cost; } } @@ -67,8 +62,7 @@ public final class VarkaSilenosSupport extends AbstractNpcAI private static final int TERANU = 31383; // Teleporter // Items private static final int SEED = 7187; - private static final int[] VARKA_MARKS = - { + private static final int[] VARKA_MARKS = { 7221, // Mark of Varka's Alliance - Level 1 7222, // Mark of Varka's Alliance - Level 2 7223, // Mark of Varka's Alliance - Level 3 @@ -77,8 +71,7 @@ public final class VarkaSilenosSupport extends AbstractNpcAI }; // Misc private static final Map<Integer, BuffsData> BUFF = new HashMap<>(); - static - { + static { BUFF.put(1, new BuffsData(4359, 2)); // Focus: Requires 2 Nepenthese Seeds BUFF.put(2, new BuffsData(4360, 2)); // Death Whisper: Requires 2 Nepenthese Seeds BUFF.put(3, new BuffsData(4345, 3)); // Might: Requires 3 Nepenthese Seeds @@ -89,20 +82,16 @@ public final class VarkaSilenosSupport extends AbstractNpcAI BUFF.put(8, new BuffsData(4357, 6)); // Haste: Requires 6 Nepenthese Seeds } - private VarkaSilenosSupport() - { + private VarkaSilenosSupport() { super(VarkaSilenosSupport.class.getSimpleName(), "ai/npc"); addFirstTalkId(ASHAS, NARAN, UDAN, DIYABU, HAGOS, SHIKON, TERANU); addTalkId(UDAN, HAGOS, TERANU); addStartNpc(HAGOS, TERANU); } - private int getAllianceLevel(L2PcInstance player) - { - for (int i = 0; i < VARKA_MARKS.length; i++) - { - if (hasQuestItems(player, VARKA_MARKS[i])) - { + private int getAllianceLevel(L2PcInstance player) { + for (int i = 0; i < VARKA_MARKS.length; i++) { + if (hasQuestItems(player, VARKA_MARKS[i])) { return -(i + 1); } } @@ -110,33 +99,23 @@ public final class VarkaSilenosSupport extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - if (Util.isDigit(event) && BUFF.containsKey(Integer.parseInt(event))) - { + if (Util.isDigit(event) && BUFF.containsKey(Integer.parseInt(event))) { final BuffsData buff = BUFF.get(Integer.parseInt(event)); - if (getQuestItemsCount(player, SEED) >= buff.getCost()) - { + if (getQuestItemsCount(player, SEED) >= buff.getCost()) { takeItems(player, SEED, buff.getCost()); npc.setTarget(player); npc.doCast(buff.getSkill()); npc.setCurrentHpMp(npc.getMaxHp(), npc.getMaxMp()); - } - else - { + } else { htmltext = "31379-02.html"; } - } - else if (event.equals("Teleport")) - { + } else if (event.equals("Teleport")) { final int AllianceLevel = getAllianceLevel(player); - if (AllianceLevel == -4) - { + if (AllianceLevel == -4) { htmltext = "31383-04.html"; - } - else if (AllianceLevel == -5) - { + } else if (AllianceLevel == -5) { htmltext = "31383-05.html"; } } @@ -144,12 +123,10 @@ public final class VarkaSilenosSupport extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final int AllianceLevel = getAllianceLevel(player); - switch (npc.getId()) - { + switch (npc.getId()) { case ASHAS: htmltext = (AllianceLevel < 0) ? "31377-friend.html" : "31377-no.html"; break; @@ -166,8 +143,7 @@ public final class VarkaSilenosSupport extends AbstractNpcAI htmltext = (AllianceLevel < 0) ? (AllianceLevel == -1) ? "31381-01.html" : "31381-02.html" : "31381-no.html"; break; case SHIKON: - switch (AllianceLevel) - { + switch (AllianceLevel) { case -1: case -2: htmltext = "31382-01.html"; @@ -185,8 +161,7 @@ public final class VarkaSilenosSupport extends AbstractNpcAI } break; case TERANU: - switch (AllianceLevel) - { + switch (AllianceLevel) { case -1: case -2: case -3: @@ -207,8 +182,7 @@ public final class VarkaSilenosSupport extends AbstractNpcAI return htmltext; } - public static void main(String args[]) - { + public static void main(String args[]) { new VarkaSilenosSupport(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/VillageMasters/FirstClassTransferTalk/FirstClassTransferTalk.java b/src/main/java/com/l2jserver/datapack/ai/npc/VillageMasters/FirstClassTransferTalk/FirstClassTransferTalk.java index 6baf6b9b99..13cf9e286f 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/VillageMasters/FirstClassTransferTalk/FirstClassTransferTalk.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/VillageMasters/FirstClassTransferTalk/FirstClassTransferTalk.java @@ -33,11 +33,9 @@ import com.l2jserver.gameserver.model.actor.instance.L2VillageMasterPriestInstan * None of them provide actual class transfers, they only talk about it. * @author jurchiks, xban1x */ -public final class FirstClassTransferTalk extends AbstractNpcAI -{ +public final class FirstClassTransferTalk extends AbstractNpcAI { private static final Map<Integer, Race> MASTERS = new HashMap<>(); - static - { + static { MASTERS.put(30026, Race.HUMAN); // Blitz, TI Fighter Guild Head Master MASTERS.put(30031, Race.HUMAN); // Biotin, TI Einhasad Temple High Priest MASTERS.put(30154, Race.ELF); // Asterios, Elven Village Tetrarch @@ -56,103 +54,71 @@ public final class FirstClassTransferTalk extends AbstractNpcAI MASTERS.put(32154, Race.HUMAN); // Aldenia, Human Guild Grand Master } - private FirstClassTransferTalk() - { + private FirstClassTransferTalk() { super(FirstClassTransferTalk.class.getSimpleName(), "ai/npc/VillageMasters"); addStartNpc(MASTERS.keySet()); addTalkId(MASTERS.keySet()); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { return event; } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = npc.getId() + "_"; - if (MASTERS.get(npc.getId()) != player.getRace()) - { + if (MASTERS.get(npc.getId()) != player.getRace()) { return htmltext += "no.html"; } - switch (MASTERS.get(npc.getId())) - { - case HUMAN: - { - if (player.getClassId().level() == 0) - { - if (player.isMageClass()) - { - if (npc instanceof L2VillageMasterPriestInstance) - { + switch (MASTERS.get(npc.getId())) { + case HUMAN: { + if (player.getClassId().level() == 0) { + if (player.isMageClass()) { + if (npc instanceof L2VillageMasterPriestInstance) { htmltext += "mystic.html"; } - } - else - { - if (npc instanceof L2VillageMasterFighterInstance) - { + } else { + if (npc instanceof L2VillageMasterFighterInstance) { htmltext += "fighter.html"; } } - } - else if (player.getClassId().level() == 1) - { + } else if (player.getClassId().level() == 1) { htmltext += "transfer_1.html"; - } - else - { + } else { htmltext += "transfer_2.html"; } break; } case ELF: case DARK_ELF: - case ORC: - { - if (player.getClassId().level() == 0) - { - if (player.isMageClass()) - { + case ORC: { + if (player.getClassId().level() == 0) { + if (player.isMageClass()) { htmltext += "mystic.html"; - } - else - { + } else { htmltext += "fighter.html"; } - } - else if (player.getClassId().level() == 1) - { + } else if (player.getClassId().level() == 1) { htmltext += "transfer_1.html"; - } - else - { + } else { htmltext += "transfer_2.html"; } break; } - case DWARF: - { - if (player.getClassId().level() == 0) - { + case DWARF: { + if (player.getClassId().level() == 0) { htmltext += "fighter.html"; - } - else if (player.getClassId().level() == 1) - { + } else if (player.getClassId().level() == 1) { htmltext += "transfer_1.html"; - } - else - { + } else { htmltext += "transfer_2.html"; } break; } - default: - { + default: { htmltext += "no.html"; break; } @@ -160,8 +126,7 @@ public final class FirstClassTransferTalk extends AbstractNpcAI return htmltext; } - public static void main(String[] args) - { + public static void main(String[] args) { new FirstClassTransferTalk(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/WeaverOlf/WeaverOlf.java b/src/main/java/com/l2jserver/datapack/ai/npc/WeaverOlf/WeaverOlf.java index c802fa01a7..ae11576c56 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/WeaverOlf/WeaverOlf.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/WeaverOlf/WeaverOlf.java @@ -30,33 +30,28 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * Weaver Olf - Pins And Pouch Unseal AI. * @author Gigiikun, Bloodshed, Adry_85 */ -public final class WeaverOlf extends AbstractNpcAI -{ +public final class WeaverOlf extends AbstractNpcAI { // NPCs - private static final int[] NPCs = - { + private static final int[] NPCs = { 32610, // Olf Kanore 32612, // Olf Adams }; - private static final int[] UNSEAL_PRICE = - { + private static final int[] UNSEAL_PRICE = { 3200, 11800, 26500, 136600 }; - private static final int[] CHANCES = - { + private static final int[] CHANCES = { 1, // top 10, // high 40, // mid 100, // low }; - private static final int[][] PINS = - { + private static final int[][] PINS = { { 13898, // Sealed Magic Pin (C-Grade) 13905, // Top-Grade Magic Pin (C-Grade) @@ -87,8 +82,7 @@ public final class WeaverOlf extends AbstractNpcAI } }; - private static final int[][] POUCHS = - { + private static final int[][] POUCHS = { { 13918, // Sealed Magic Pouch (C-Grade) 13925, // Top-Grade Magic Pouch (C-Grade) @@ -119,8 +113,7 @@ public final class WeaverOlf extends AbstractNpcAI } }; - private static final int[][] CLIPS_ORNAMENTS = - { + private static final int[][] CLIPS_ORNAMENTS = { { 14902, // Sealed Magic Rune Clip (A-Grade) 14909, // Top-level Magic Rune Clip (A-Grade) @@ -151,81 +144,54 @@ public final class WeaverOlf extends AbstractNpcAI } }; - private WeaverOlf() - { + private WeaverOlf() { super(WeaverOlf.class.getSimpleName(), "ai/npc"); addStartNpc(NPCs); addTalkId(NPCs); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.contains("_grade_")) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.contains("_grade_")) { int grade = Integer.parseInt(event.substring(0, 1)); int price; int[] itemIds; - if (event.endsWith("_pin")) - { + if (event.endsWith("_pin")) { price = UNSEAL_PRICE[grade]; itemIds = PINS[grade]; - } - else if (event.endsWith("_pouch")) - { + } else if (event.endsWith("_pouch")) { price = UNSEAL_PRICE[grade]; itemIds = POUCHS[grade]; - } - else if (event.endsWith("_clip")) - { + } else if (event.endsWith("_clip")) { price = UNSEAL_PRICE[grade]; itemIds = CLIPS_ORNAMENTS[grade - 2]; - } - else if (event.endsWith("_ornament")) - { + } else if (event.endsWith("_ornament")) { price = UNSEAL_PRICE[grade]; itemIds = CLIPS_ORNAMENTS[grade]; - } - else - { + } else { return super.onAdvEvent(event, npc, player); } - if (hasQuestItems(player, itemIds[0])) - { - if (player.getAdena() > price) - { + if (hasQuestItems(player, itemIds[0])) { + if (player.getAdena() > price) { takeItems(player, Inventory.ADENA_ID, price); takeItems(player, itemIds[0], 1); int rand = getRandom(200); - if (rand <= CHANCES[0]) - { + if (rand <= CHANCES[0]) { giveItems(player, itemIds[1], 1); - } - else if (rand <= CHANCES[1]) - { + } else if (rand <= CHANCES[1]) { giveItems(player, itemIds[2], 1); - } - else if (rand <= CHANCES[2]) - { + } else if (rand <= CHANCES[2]) { giveItems(player, itemIds[3], 1); - } - else if (rand <= CHANCES[3]) - { + } else if (rand <= CHANCES[3]) { giveItems(player, itemIds[4], 1); - } - else - { + } else { npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.WHAT_A_PREDICAMENT_MY_ATTEMPTS_WERE_UNSUCCESSFUL)); } - } - else - { + } else { return npc.getId() + "-low.htm"; } - } - else - { + } else { return npc.getId() + "-no.htm"; } return super.onAdvEvent(event, npc, player); @@ -234,13 +200,11 @@ public final class WeaverOlf extends AbstractNpcAI } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { return npc.getId() + "-1.htm"; } - public static void main(String[] args) - { + public static void main(String[] args) { new WeaverOlf(); } } diff --git a/src/main/java/com/l2jserver/datapack/ai/npc/WyvernManager/WyvernManager.java b/src/main/java/com/l2jserver/datapack/ai/npc/WyvernManager/WyvernManager.java index b4050c5af4..7bc8534d90 100644 --- a/src/main/java/com/l2jserver/datapack/ai/npc/WyvernManager/WyvernManager.java +++ b/src/main/java/com/l2jserver/datapack/ai/npc/WyvernManager/WyvernManager.java @@ -35,10 +35,8 @@ import com.l2jserver.gameserver.util.Util; * Wyvern Manager * @author xban1x */ -public final class WyvernManager extends AbstractNpcAI -{ - private enum ManagerType - { +public final class WyvernManager extends AbstractNpcAI { + private enum ManagerType { CASTLE, CLAN_HALL, FORT, @@ -49,8 +47,7 @@ public final class WyvernManager extends AbstractNpcAI private static final int WYVERN = 12621; private static final int WYVERN_FEE = 25; private static final int STRIDER_LVL = 55; - private static final int[] STRIDERS = - { + private static final int[] STRIDERS = { 12526, 12527, 12528, @@ -62,8 +59,7 @@ public final class WyvernManager extends AbstractNpcAI }; // NPCS private static final Map<Integer, ManagerType> MANAGERS = new HashMap<>(); - static - { + static { MANAGERS.put(35101, ManagerType.CASTLE); MANAGERS.put(35143, ManagerType.CASTLE); MANAGERS.put(35185, ManagerType.CASTLE); @@ -98,20 +94,16 @@ public final class WyvernManager extends AbstractNpcAI MANAGERS.put(36477, ManagerType.FORT); } - private WyvernManager() - { + private WyvernManager() { super(WyvernManager.class.getSimpleName(), "ai/npc"); addStartNpc(MANAGERS.keySet()); addTalkId(MANAGERS.keySet()); addFirstTalkId(MANAGERS.keySet()); } - private String mountWyvern(L2Npc npc, L2PcInstance player) - { - if (player.isMounted() && (player.getMountLevel() >= STRIDER_LVL) && Util.contains(STRIDERS, player.getMountNpcId())) - { - if (isOwnerClan(npc, player) && (getQuestItemsCount(player, CRYSTAL_B_GRADE) >= WYVERN_FEE)) - { + private String mountWyvern(L2Npc npc, L2PcInstance player) { + if (player.isMounted() && (player.getMountLevel() >= STRIDER_LVL) && Util.contains(STRIDERS, player.getMountNpcId())) { + if (isOwnerClan(npc, player) && (getQuestItemsCount(player, CRYSTAL_B_GRADE) >= WYVERN_FEE)) { takeItems(player, CRYSTAL_B_GRADE, WYVERN_FEE); player.dismount(); player.mount(WYVERN, 0, true); @@ -122,154 +114,111 @@ public final class WyvernManager extends AbstractNpcAI return replacePart(player.getHtmlPrefix(), "wyvernmanager-05.html"); } - private boolean isOwnerClan(L2Npc npc, L2PcInstance player) - { - if (!player.isClanLeader()) - { + private boolean isOwnerClan(L2Npc npc, L2PcInstance player) { + if (!player.isClanLeader()) { return false; } - switch (MANAGERS.get(npc.getId())) - { - case CASTLE: - { - if (npc.getCastle() != null) - { + switch (MANAGERS.get(npc.getId())) { + case CASTLE: { + if (npc.getCastle() != null) { return player.getClanId() == npc.getCastle().getOwnerId(); } return false; } - case CLAN_HALL: - { - if (npc.getConquerableHall() != null) - { + case CLAN_HALL: { + if (npc.getConquerableHall() != null) { return player.getClanId() == npc.getConquerableHall().getOwnerId(); } return false; } - case FORT: - { + case FORT: { final Fort fort = npc.getFort(); - if ((fort != null) && (fort.getOwnerClan() != null)) - { + if ((fort != null) && (fort.getOwnerClan() != null)) { return player.getClanId() == npc.getFort().getOwnerClan().getId(); } return false; } - default: - { + default: { return false; } } } - private boolean isInSiege(L2Npc npc) - { - switch (MANAGERS.get(npc.getId())) - { - case CASTLE: - { + private boolean isInSiege(L2Npc npc) { + switch (MANAGERS.get(npc.getId())) { + case CASTLE: { return npc.getCastle().getZone().isActive(); } - case CLAN_HALL: - { + case CLAN_HALL: { SiegableHall hall = npc.getConquerableHall(); return (hall != null) ? hall.isInSiege() : npc.getCastle().getSiege().isInProgress(); } - case FORT: - { + case FORT: { return npc.getFort().getZone().isActive(); } - default: - { + default: { return false; } } } - private String getResidenceName(L2Npc npc) - { - switch (MANAGERS.get(npc.getId())) - { - case CASTLE: - { + private String getResidenceName(L2Npc npc) { + switch (MANAGERS.get(npc.getId())) { + case CASTLE: { return npc.getCastle().getName(); } - case CLAN_HALL: - { + case CLAN_HALL: { return npc.getConquerableHall().getName(); } - case FORT: - { + case FORT: { return npc.getFort().getName(); } - default: - { + default: { return null; } } } - private String replaceAll(L2Npc npc, String htmlPrefix) - { + private String replaceAll(L2Npc npc, String htmlPrefix) { return replacePart(htmlPrefix, "wyvernmanager-01.html").replace("%residence_name%", getResidenceName(npc)); } - private String replacePart(String htmlPrefix, String htmlFile) - { + private String replacePart(String htmlPrefix, String htmlFile) { return getHtm(htmlPrefix, htmlFile).replace("%wyvern_fee%", String.valueOf(WYVERN_FEE)).replace("%strider_level%", String.valueOf(STRIDER_LVL)); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { - case "Return": - { - if (!isOwnerClan(npc, player)) - { + switch (event) { + case "Return": { + if (!isOwnerClan(npc, player)) { htmltext = "wyvernmanager-02.html"; - } - else if (castle().allowRideWyvernAlways()) - { + } else if (castle().allowRideWyvernAlways()) { htmltext = replaceAll(npc, player.getHtmlPrefix()); - } - else if ((MANAGERS.get(npc.getId()) == ManagerType.CASTLE) && SevenSigns.getInstance().isSealValidationPeriod() && (SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_STRIFE) == SevenSigns.CABAL_DUSK)) - { + } else if ((MANAGERS.get(npc.getId()) == ManagerType.CASTLE) && SevenSigns.getInstance().isSealValidationPeriod() && (SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_STRIFE) == SevenSigns.CABAL_DUSK)) { htmltext = "wyvernmanager-dusk.html"; - } - else - { + } else { htmltext = replaceAll(npc, player.getHtmlPrefix()); } break; } - case "Help": - { + case "Help": { htmltext = MANAGERS.get(npc.getId()) == ManagerType.CASTLE ? replacePart(player.getHtmlPrefix(), "wyvernmanager-03.html") : replacePart(player.getHtmlPrefix(), "wyvernmanager-03b.html"); break; } - case "RideWyvern": - { - if (!castle().allowRideWyvernAlways()) - { - if (!castle().allowRideWyvernDuringSiege() && (isInSiege(npc) || player.isInSiege())) - { + case "RideWyvern": { + if (!castle().allowRideWyvernAlways()) { + if (!castle().allowRideWyvernDuringSiege() && (isInSiege(npc) || player.isInSiege())) { player.sendMessage("You cannot summon wyvern while in siege."); return null; } - if ((MANAGERS.get(npc.getId()) == ManagerType.CASTLE) && SevenSigns.getInstance().isSealValidationPeriod() && ((SevenSigns.getInstance()).getSealOwner(SevenSigns.SEAL_STRIFE) == SevenSigns.CABAL_DUSK)) - { + if ((MANAGERS.get(npc.getId()) == ManagerType.CASTLE) && SevenSigns.getInstance().isSealValidationPeriod() && ((SevenSigns.getInstance()).getSealOwner(SevenSigns.SEAL_STRIFE) == SevenSigns.CABAL_DUSK)) { htmltext = "wyvernmanager-dusk.html"; - } - else - { + } else { htmltext = mountWyvern(npc, player); } - } - else - { + } else { htmltext = mountWyvern(npc, player); } break; @@ -279,27 +228,17 @@ public final class WyvernManager extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; - if (!isOwnerClan(npc, player)) - { + if (!isOwnerClan(npc, player)) { htmltext = "wyvernmanager-02.html"; - } - else - { - if (castle().allowRideWyvernAlways()) - { + } else { + if (castle().allowRideWyvernAlways()) { htmltext = replaceAll(npc, player.getHtmlPrefix()); - } - else - { - if ((MANAGERS.get(npc.getId()) == ManagerType.CASTLE) && SevenSigns.getInstance().isSealValidationPeriod() && (SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_STRIFE) == SevenSigns.CABAL_DUSK)) - { + } else { + if ((MANAGERS.get(npc.getId()) == ManagerType.CASTLE) && SevenSigns.getInstance().isSealValidationPeriod() && (SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_STRIFE) == SevenSigns.CABAL_DUSK)) { htmltext = "wyvernmanager-dusk.html"; - } - else - { + } else { htmltext = replaceAll(npc, player.getHtmlPrefix()); } } @@ -307,8 +246,7 @@ public final class WyvernManager extends AbstractNpcAI return htmltext; } - public static void main(String[] args) - { + public static void main(String[] args) { new WyvernManager(); } } diff --git a/src/main/java/com/l2jserver/datapack/conquerablehalls/DevastatedCastle/DevastatedCastle.java b/src/main/java/com/l2jserver/datapack/conquerablehalls/DevastatedCastle/DevastatedCastle.java index 7de2d8b131..d740c9f4ba 100644 --- a/src/main/java/com/l2jserver/datapack/conquerablehalls/DevastatedCastle/DevastatedCastle.java +++ b/src/main/java/com/l2jserver/datapack/conquerablehalls/DevastatedCastle/DevastatedCastle.java @@ -37,8 +37,7 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Devastated Castle clan hall siege script. * @author BiggBoss */ -public final class DevastatedCastle extends ClanHallSiegeEngine -{ +public final class DevastatedCastle extends ClanHallSiegeEngine { private static final int GUSTAV = 35410; private static final int MIKHAIL = 35409; private static final int DIETRICH = 35408; @@ -46,8 +45,7 @@ public final class DevastatedCastle extends ClanHallSiegeEngine private static Map<Integer, Integer> _damageToGustav = new HashMap<>(); - private DevastatedCastle() - { + private DevastatedCastle() { super(DevastatedCastle.class.getSimpleName(), "conquerablehalls", DEVASTATED_CASTLE); addKillId(GUSTAV); addSpawnId(MIKHAIL); @@ -56,48 +54,36 @@ public final class DevastatedCastle extends ClanHallSiegeEngine } @Override - public String onSpawn(L2Npc npc) - { - if (npc.getId() == MIKHAIL) - { + public String onSpawn(L2Npc npc) { + if (npc.getId() == MIKHAIL) { broadcastNpcSay(npc, Say2.NPC_SHOUT, NpcStringId.GLORY_TO_ADEN_THE_KINGDOM_OF_THE_LION_GLORY_TO_SIR_GUSTAV_OUR_IMMORTAL_LORD); - } - else if (npc.getId() == DIETRICH) - { + } else if (npc.getId() == DIETRICH) { broadcastNpcSay(npc, Say2.NPC_SHOUT, NpcStringId.SOLDIERS_OF_GUSTAV_GO_FORTH_AND_DESTROY_THE_INVADERS); } return null; } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (!_hall.isInSiege()) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (!_hall.isInSiege()) { return null; } - synchronized (this) - { + synchronized (this) { final L2Clan clan = attacker.getClan(); - if ((clan != null) && checkIsAttacker(clan)) - { + if ((clan != null) && checkIsAttacker(clan)) { final int id = clan.getId(); - if (_damageToGustav.containsKey(id)) - { + if (_damageToGustav.containsKey(id)) { int newDamage = _damageToGustav.get(id); newDamage += damage; _damageToGustav.put(id, newDamage); - } - else - { + } else { _damageToGustav.put(id, damage); } } - if ((npc.getCurrentHp() < GUSTAV_TRIGGER_HP) && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_CAST)) - { + if ((npc.getCurrentHp() < GUSTAV_TRIGGER_HP) && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_CAST)) { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.THIS_IS_UNBELIEVABLE_HAVE_I_REALLY_BEEN_DEFEATED_I_SHALL_RETURN_AND_TAKE_YOUR_HEAD); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, SkillData.getInstance().getSkill(4235, 1), npc); } @@ -106,19 +92,15 @@ public final class DevastatedCastle extends ClanHallSiegeEngine } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (!_hall.isInSiege()) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (!_hall.isInSiege()) { return null; } _missionAccomplished = true; - if (npc.getId() == GUSTAV) - { - synchronized (this) - { + if (npc.getId() == GUSTAV) { + synchronized (this) { cancelSiegeTask(); endSiege(); } @@ -128,15 +110,12 @@ public final class DevastatedCastle extends ClanHallSiegeEngine } @Override - public L2Clan getWinner() - { + public L2Clan getWinner() { int counter = 0; int damagest = 0; - for (Entry<Integer, Integer> e : _damageToGustav.entrySet()) - { + for (Entry<Integer, Integer> e : _damageToGustav.entrySet()) { final int damage = e.getValue(); - if (damage > counter) - { + if (damage > counter) { counter = damage; damagest = e.getKey(); } @@ -144,8 +123,7 @@ public final class DevastatedCastle extends ClanHallSiegeEngine return ClanTable.getInstance().getClan(damagest); } - public static void main(String[] args) - { + public static void main(String[] args) { new DevastatedCastle(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/conquerablehalls/FortressOfResistance/FortressOfResistance.java b/src/main/java/com/l2jserver/datapack/conquerablehalls/FortressOfResistance/FortressOfResistance.java index 9ba375a977..73644d1d5b 100644 --- a/src/main/java/com/l2jserver/datapack/conquerablehalls/FortressOfResistance/FortressOfResistance.java +++ b/src/main/java/com/l2jserver/datapack/conquerablehalls/FortressOfResistance/FortressOfResistance.java @@ -37,33 +37,29 @@ import com.l2jserver.gameserver.util.Util; * Fortress of Resistance clan hall siege Script. * @author BiggBoss */ -public final class FortressOfResistance extends ClanHallSiegeEngine -{ +public final class FortressOfResistance extends ClanHallSiegeEngine { private final int MESSENGER = 35382; private final int BLOODY_LORD_NURKA = 35375; - private final Location[] NURKA_COORDS = - { + private final Location[] NURKA_COORDS = { new Location(45109, 112124, -1900), // 30% new Location(47653, 110816, -2110), // 40% new Location(47247, 109396, -2000) - // 30% + // 30% }; private L2Spawn _nurka; private final Map<Integer, Long> _damageToNurka = new HashMap<>(); private NpcHtmlMessage _messengerMsg; - private FortressOfResistance() - { + private FortressOfResistance() { super(FortressOfResistance.class.getSimpleName(), "conquerablehalls", FORTRESS_RESSISTANCE); addFirstTalkId(MESSENGER); addKillId(BLOODY_LORD_NURKA); addAttackId(BLOODY_LORD_NURKA); buildMessengerMessage(); - try - { + try { _nurka = new L2Spawn(BLOODY_LORD_NURKA); _nurka.setAmount(1); _nurka.setRespawnDelay(10800); @@ -83,18 +79,14 @@ public final class FortressOfResistance extends ClanHallSiegeEngine // } // @formatter:on _nurka.setLocation(NURKA_COORDS[0]); - } - catch (Exception e) - { + } catch (Exception e) { _log.warn("{}: Couldnt set the Bloody Lord Nurka spawn!", getName(), e); } } - private final void buildMessengerMessage() - { + private final void buildMessengerMessage() { String html = HtmCache.getInstance().getHtm(null, "data/scripts/conquerablehalls/FortressOfResistance/partisan_ordery_brakel001.htm"); - if (html != null) - { + if (html != null) { // FIXME: We don't have an object id to put in here :( _messengerMsg = new NpcHtmlMessage(); _messengerMsg.setHtml(html); @@ -103,23 +95,19 @@ public final class FortressOfResistance extends ClanHallSiegeEngine } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { player.sendPacket(_messengerMsg); return null; } @Override - public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isSummon) - { - if (!_hall.isInSiege()) - { + public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isSummon) { + if (!_hall.isInSiege()) { return null; } int clanId = player.getClanId(); - if (clanId > 0) - { + if (clanId > 0) { long clanDmg = (_damageToNurka.containsKey(clanId)) ? _damageToNurka.get(clanId) + damage : damage; _damageToNurka.put(clanId, clanDmg); @@ -128,17 +116,14 @@ public final class FortressOfResistance extends ClanHallSiegeEngine } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (!_hall.isInSiege()) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (!_hall.isInSiege()) { return null; } _missionAccomplished = true; - synchronized (this) - { + synchronized (this) { npc.getSpawn().stopRespawn(); npc.deleteMe(); cancelSiegeTask(); @@ -148,15 +133,12 @@ public final class FortressOfResistance extends ClanHallSiegeEngine } @Override - public L2Clan getWinner() - { + public L2Clan getWinner() { int winnerId = 0; long counter = 0; - for (Entry<Integer, Long> e : _damageToNurka.entrySet()) - { + for (Entry<Integer, Long> e : _damageToNurka.entrySet()) { long dam = e.getValue(); - if (dam > counter) - { + if (dam > counter) { winnerId = e.getKey(); counter = dam; } @@ -165,19 +147,16 @@ public final class FortressOfResistance extends ClanHallSiegeEngine } @Override - public void onSiegeStarts() - { + public void onSiegeStarts() { _nurka.init(); } @Override - public void onSiegeEnds() - { + public void onSiegeEnds() { buildMessengerMessage(); } - public static void main(String[] args) - { + public static void main(String[] args) { new FortressOfResistance(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/conquerablehalls/FortressOfTheDead/FortressOfTheDead.java b/src/main/java/com/l2jserver/datapack/conquerablehalls/FortressOfTheDead/FortressOfTheDead.java index 84deb45417..c790eb7107 100644 --- a/src/main/java/com/l2jserver/datapack/conquerablehalls/FortressOfTheDead/FortressOfTheDead.java +++ b/src/main/java/com/l2jserver/datapack/conquerablehalls/FortressOfTheDead/FortressOfTheDead.java @@ -36,16 +36,14 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Fortress of the Dead clan hall siege script. * @author BiggBoss */ -public final class FortressOfTheDead extends ClanHallSiegeEngine -{ +public final class FortressOfTheDead extends ClanHallSiegeEngine { private static final int LIDIA = 35629; private static final int ALFRED = 35630; private static final int GISELLE = 35631; private static Map<Integer, Integer> _damageToLidia = new HashMap<>(); - public FortressOfTheDead() - { + public FortressOfTheDead() { super(FortressOfTheDead.class.getSimpleName(), "conquerablehalls", FORTRESS_OF_DEAD); addKillId(LIDIA); addKillId(ALFRED); @@ -59,46 +57,33 @@ public final class FortressOfTheDead extends ClanHallSiegeEngine } @Override - public String onSpawn(L2Npc npc) - { - if (npc.getId() == LIDIA) - { + public String onSpawn(L2Npc npc) { + if (npc.getId() == LIDIA) { broadcastNpcSay(npc, Say2.NPC_SHOUT, NpcStringId.HMM_THOSE_WHO_ARE_NOT_OF_THE_BLOODLINE_ARE_COMING_THIS_WAY_TO_TAKE_OVER_THE_CASTLE_HUMPH_THE_BITTER_GRUDGES_OF_THE_DEAD_YOU_MUST_NOT_MAKE_LIGHT_OF_THEIR_POWER); - } - else if (npc.getId() == ALFRED) - { + } else if (npc.getId() == ALFRED) { broadcastNpcSay(npc, Say2.NPC_SHOUT, NpcStringId.HEH_HEH_I_SEE_THAT_THE_FEAST_HAS_BEGUN_BE_WARY_THE_CURSE_OF_THE_HELLMANN_FAMILY_HAS_POISONED_THIS_LAND); - } - else if (npc.getId() == GISELLE) - { + } else if (npc.getId() == GISELLE) { broadcastNpcSay(npc, Say2.NPC_SHOUT, NpcStringId.ARISE_MY_FAITHFUL_SERVANTS_YOU_MY_PEOPLE_WHO_HAVE_INHERITED_THE_BLOOD_IT_IS_THE_CALLING_OF_MY_DAUGHTER_THE_FEAST_OF_BLOOD_WILL_NOW_BEGIN); } return null; } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (!_hall.isInSiege()) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (!_hall.isInSiege()) { return null; } - synchronized (this) - { + synchronized (this) { final L2Clan clan = attacker.getClan(); - if ((clan != null) && checkIsAttacker(clan)) - { + if ((clan != null) && checkIsAttacker(clan)) { final int id = clan.getId(); - if ((id > 0) && _damageToLidia.containsKey(id)) - { + if ((id > 0) && _damageToLidia.containsKey(id)) { int newDamage = _damageToLidia.get(id); newDamage += damage; _damageToLidia.put(id, newDamage); - } - else - { + } else { _damageToLidia.put(id, damage); } } @@ -107,25 +92,20 @@ public final class FortressOfTheDead extends ClanHallSiegeEngine } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (!_hall.isInSiege()) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (!_hall.isInSiege()) { return null; } final int npcId = npc.getId(); - if ((npcId == ALFRED) || (npcId == GISELLE)) - { + if ((npcId == ALFRED) || (npcId == GISELLE)) { broadcastNpcSay(npc, Say2.NPC_SHOUT, NpcStringId.AARGH_IF_I_DIE_THEN_THE_MAGIC_FORCE_FIELD_OF_BLOOD_WILL); } - if (npcId == LIDIA) - { + if (npcId == LIDIA) { broadcastNpcSay(npc, Say2.NPC_SHOUT, NpcStringId.GRARR_FOR_THE_NEXT_2_MINUTES_OR_SO_THE_GAME_ARENA_ARE_WILL_BE_CLEANED_THROW_ANY_ITEMS_YOU_DONT_NEED_TO_THE_FLOOR_NOW); _missionAccomplished = true; - synchronized (this) - { + synchronized (this) { cancelSiegeTask(); endSiege(); } @@ -135,15 +115,12 @@ public final class FortressOfTheDead extends ClanHallSiegeEngine } @Override - public L2Clan getWinner() - { + public L2Clan getWinner() { int counter = 0; int damagest = 0; - for (Entry<Integer, Integer> e : _damageToLidia.entrySet()) - { + for (Entry<Integer, Integer> e : _damageToLidia.entrySet()) { final int damage = e.getValue(); - if (damage > counter) - { + if (damage > counter) { counter = damage; damagest = e.getKey(); } @@ -152,25 +129,20 @@ public final class FortressOfTheDead extends ClanHallSiegeEngine } @Override - public void startSiege() - { + public void startSiege() { // Siege must start at night int hoursLeft = (GameTimeController.getInstance().getGameTime() / 60) % 24; - if ((hoursLeft < 0) || (hoursLeft > 6)) - { + if ((hoursLeft < 0) || (hoursLeft > 6)) { cancelSiegeTask(); long scheduleTime = (24 - hoursLeft) * 10 * 60000; _siegeTask = ThreadPoolManager.getInstance().scheduleGeneral(new SiegeStarts(), scheduleTime); - } - else - { + } else { super.startSiege(); } } - public static void main(String[] args) - { + public static void main(String[] args) { new FortressOfTheDead(); } } diff --git a/src/main/java/com/l2jserver/datapack/conquerablehalls/RainbowSpringsChateau/RainbowSpringsChateau.java b/src/main/java/com/l2jserver/datapack/conquerablehalls/RainbowSpringsChateau/RainbowSpringsChateau.java index aaa077f76a..9897ff2d13 100644 --- a/src/main/java/com/l2jserver/datapack/conquerablehalls/RainbowSpringsChateau/RainbowSpringsChateau.java +++ b/src/main/java/com/l2jserver/datapack/conquerablehalls/RainbowSpringsChateau/RainbowSpringsChateau.java @@ -64,80 +64,62 @@ import com.l2jserver.gameserver.util.Util; * Rainbow Springs Chateau clan hall siege script. * @author BiggBoss */ -public final class RainbowSpringsChateau extends ClanHallSiegeEngine -{ - protected static class SetFinalAttackers implements Runnable - { +public final class RainbowSpringsChateau extends ClanHallSiegeEngine { + protected static class SetFinalAttackers implements Runnable { @Override - public void run() - { - if (_rainbow == null) - { + public void run() { + if (_rainbow == null) { _rainbow = ClanHallSiegeManager.getInstance().getSiegableHall(RAINBOW_SPRINGS); } int spotLeft = 4; - if (_rainbow.getOwnerId() > 0) - { + if (_rainbow.getOwnerId() > 0) { L2Clan owner = ClanTable.getInstance().getClan(_rainbow.getOwnerId()); - if (owner != null) - { + if (owner != null) { _rainbow.free(); owner.setHideoutId(0); _acceptedClans.add(owner); --spotLeft; } - for (int i = 0; i < spotLeft; i++) - { + for (int i = 0; i < spotLeft; i++) { long counter = 0; L2Clan clan = null; - for (int clanId : _warDecreesCount.keySet()) - { + for (int clanId : _warDecreesCount.keySet()) { L2Clan actingClan = ClanTable.getInstance().getClan(clanId); - if ((actingClan == null) || (actingClan.getDissolvingExpiryTime() > 0)) - { + if ((actingClan == null) || (actingClan.getDissolvingExpiryTime() > 0)) { _warDecreesCount.remove(clanId); continue; } final long count = _warDecreesCount.get(clanId); - if (count > counter) - { + if (count > counter) { counter = count; clan = actingClan; } } - if ((clan != null) && (_acceptedClans.size() < 4)) - { + if ((clan != null) && (_acceptedClans.size() < 4)) { _acceptedClans.add(clan); L2PcInstance leader = clan.getLeader().getPlayerInstance(); - if (leader != null) - { + if (leader != null) { leader.sendMessage("Your clan has been accepted to join the RainBow Srpings Chateau siege!"); } } } - if (_acceptedClans.size() >= 2) - { + if (_acceptedClans.size() >= 2) { _nextSiege = ThreadPoolManager.getInstance().scheduleGeneral(new SiegeStart(), 3600000); _rainbow.updateSiegeStatus(SiegeStatus.WAITING_BATTLE); - } - else - { + } else { Broadcast.toAllOnlinePlayers("Rainbow Springs Chateau siege aborted due lack of population"); } } } } - protected static class SiegeStart implements Runnable - { + protected static class SiegeStart implements Runnable { @Override - public void run() - { - if (_rainbow == null) - { + public void run() { + if (_rainbow == null) { _rainbow = ClanHallSiegeManager.getInstance().getSiegableHall(RAINBOW_SPRINGS); } @@ -151,32 +133,26 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine public static L2Clan _winner; @Override - public L2Clan getWinner() - { + public L2Clan getWinner() { return _winner; } - private static class SiegeEnd implements Runnable - { + private static class SiegeEnd implements Runnable { private final L2Clan _winner; - protected SiegeEnd(L2Clan winner) - { + protected SiegeEnd(L2Clan winner) { _winner = winner; } @Override - public void run() - { - if (_rainbow == null) - { + public void run() { + if (_rainbow == null) { _rainbow = ClanHallSiegeManager.getInstance().getSiegableHall(RAINBOW_SPRINGS); } unSpawnGourds(); - if (_winner != null) - { + if (_winner != null) { _rainbow.setOwner(_winner); } @@ -189,18 +165,13 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine } } - protected static class TeleportBack implements Runnable - { + protected static class TeleportBack implements Runnable { @Override - public void run() - { - for (int arenaId : ARENA_ZONES) - { + public void run() { + for (int arenaId : ARENA_ZONES) { final Collection<L2Character> chars = ZoneManager.getInstance().getZoneById(arenaId).getCharactersInside(); - for (L2Character chr : chars) - { - if (chr != null) - { + for (L2Character chr : chars) { + if (chr != null) { chr.teleToLocation(TeleportWhereType.TOWN); } } @@ -220,8 +191,7 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine private static final int CARETAKER = 35603; private static final int CHEST = 35593; - private static final int[] GOURDS = - { + private static final int[] GOURDS = { 35588, 35589, 35590, @@ -229,32 +199,28 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine }; private static L2Spawn[] _gourds = new L2Spawn[4]; - private static final int[] YETIS = - { + private static final int[] YETIS = { 35596, 35597, 35598, 35599 }; - private static final Location[] ARENAS = new Location[] - { + private static final Location[] ARENAS = new Location[] { new Location(151562, -127080, -2214), // Arena 1 new Location(153141, -125335, -2214), // Arena 2 new Location(153892, -127530, -2214), // Arena 3 new Location(155657, -125752, -2214), // Arena 4 }; - protected static final int[] ARENA_ZONES = - { + protected static final int[] ARENA_ZONES = { 112081, 112082, 112083, 112084 }; - private static final String[] _textPassages = - { + private static final String[] _textPassages = { "Fight for Rainbow Springs!", "Are you a match for the Yetti?", "Did somebody order a knuckle sandwich?" @@ -271,8 +237,7 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine protected static ScheduledFuture<?> _nextSiege, _siegeEnd; private static String _registrationEnds; - public RainbowSpringsChateau() - { + public RainbowSpringsChateau() { super(RainbowSpringsChateau.class.getSimpleName(), "conquerablehalls", RAINBOW_SPRINGS); addFirstTalkId(MESSENGER); @@ -285,64 +250,44 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine loadAttackers(); _rainbow = ClanHallSiegeManager.getInstance().getSiegableHall(RAINBOW_SPRINGS); - if (_rainbow != null) - { + if (_rainbow != null) { long delay = _rainbow.getNextSiegeTime(); - if (delay > -1) - { + if (delay > -1) { setRegistrationEndString(delay - 3600000); _nextSiege = ThreadPoolManager.getInstance().scheduleGeneral(new SetFinalAttackers(), delay); - } - else - { + } else { _log.warn("CHSiegeManager: No Date setted for RainBow Springs Chateau Clan hall siege!. SIEGE CANCELED!"); } } } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { String html = ""; final int npcId = npc.getId(); - if (npcId == MESSENGER) - { + if (npcId == MESSENGER) { final String main = (_rainbow.getOwnerId() > 0) ? "messenger_yetti001.htm" : "messenger_yetti001a.htm"; html = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), "data/scripts/conquerablehalls/RainbowSpringsChateau/" + main); html = html.replace("%time%", _registrationEnds); - if (_rainbow.getOwnerId() > 0) - { + if (_rainbow.getOwnerId() > 0) { html = html.replace("%owner%", ClanTable.getInstance().getClan(_rainbow.getOwnerId()).getName()); } - } - else if (npcId == CARETAKER) - { - if (_rainbow.isInSiege()) - { + } else if (npcId == CARETAKER) { + if (_rainbow.isInSiege()) { html = "game_manager003.htm"; - } - else - { + } else { html = "game_manager001.htm"; } - } - else if (Util.contains(YETIS, npcId)) - { + } else if (Util.contains(YETIS, npcId)) { // TODO: Review. - if (_rainbow.isInSiege()) - { - if (!player.isClanLeader()) - { + if (_rainbow.isInSiege()) { + if (!player.isClanLeader()) { html = "no_clan_leader.htm"; - } - else - { + } else { L2Clan clan = player.getClan(); - if (_acceptedClans.contains(clan)) - { + if (_acceptedClans.contains(clan)) { int index = _acceptedClans.indexOf(clan); - if (npcId == YETIS[index]) - { + if (npcId == YETIS[index]) { html = "yeti_main.htm"; } } @@ -354,45 +299,28 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String html = event; final L2Clan clan = player.getClan(); - switch (npc.getId()) - { + switch (npc.getId()) { case MESSENGER: - switch (event) - { + switch (event) { case "register": - if (!player.isClanLeader()) - { + if (!player.isClanLeader()) { html = "messenger_yetti010.htm"; - } - else if ((clan.getCastleId() > 0) || (clan.getFortId() > 0) || (clan.getHideoutId() > 0)) - { + } else if ((clan.getCastleId() > 0) || (clan.getFortId() > 0) || (clan.getHideoutId() > 0)) { html = "messenger_yetti012.htm"; - } - else if (!_rainbow.isRegistering()) - { + } else if (!_rainbow.isRegistering()) { html = "messenger_yetti014.htm"; - } - else if (_warDecreesCount.containsKey(clan.getId())) - { + } else if (_warDecreesCount.containsKey(clan.getId())) { html = "messenger_yetti013.htm"; - } - else if ((clan.getLevel() < 3) || (clan.getMembersCount() < 5)) - { + } else if ((clan.getLevel() < 3) || (clan.getMembersCount() < 5)) { html = "messenger_yetti011.htm"; - } - else - { + } else { final L2ItemInstance warDecrees = player.getInventory().getItemByItemId(WAR_DECREES); - if (warDecrees == null) - { + if (warDecrees == null) { html = "messenger_yetti008.htm"; - } - else - { + } else { long count = warDecrees.getCount(); _warDecreesCount.put(clan.getId(), count); player.destroyItem("Rainbow Springs Registration", warDecrees, npc, true); @@ -402,40 +330,27 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine } break; case "cancel": - if (!player.isClanLeader()) - { + if (!player.isClanLeader()) { html = "messenger_yetti010.htm"; - } - else if (!_warDecreesCount.containsKey(clan.getId())) - { + } else if (!_warDecreesCount.containsKey(clan.getId())) { html = "messenger_yetti016.htm"; - } - else if (!_rainbow.isRegistering()) - { + } else if (!_rainbow.isRegistering()) { html = "messenger_yetti017.htm"; - } - else - { + } else { removeAttacker(clan.getId()); html = "messenger_yetti018.htm"; } break; case "unregister": - if (_rainbow.isRegistering()) - { - if (_warDecreesCount.containsKey(clan.getId())) - { + if (_rainbow.isRegistering()) { + if (_warDecreesCount.containsKey(clan.getId())) { player.addItem("Rainbow Spring unregister", WAR_DECREES, _warDecreesCount.get(clan.getId()) / 2, npc, true); _warDecreesCount.remove(clan.getId()); html = "messenger_yetti019.htm"; - } - else - { + } else { html = "messenger_yetti020.htm"; } - } - else if (_rainbow.isWaitingBattle()) - { + } else if (_rainbow.isWaitingBattle()) { _acceptedClans.remove(clan); html = "messenger_yetti020.htm"; } @@ -443,52 +358,33 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine } break; case CARETAKER: - if (event.equals("portToArena")) - { + if (event.equals("portToArena")) { final L2Party party = player.getParty(); - if (clan == null) - { + if (clan == null) { html = "game_manager009.htm"; - } - else if (!player.isClanLeader()) - { + } else if (!player.isClanLeader()) { html = "game_manager004.htm"; - } - else if (!player.isInParty()) - { + } else if (!player.isInParty()) { html = "game_manager005.htm"; - } - else if (party.getLeaderObjectId() != player.getObjectId()) - { + } else if (party.getLeaderObjectId() != player.getObjectId()) { html = "game_manager006.htm"; - } - else - { + } else { final int clanId = player.getClanId(); boolean nonClanMemberInParty = false; - for (L2PcInstance member : party.getMembers()) - { - if (member.getClanId() != clanId) - { + for (L2PcInstance member : party.getMembers()) { + if (member.getClanId() != clanId) { nonClanMemberInParty = true; break; } } - if (nonClanMemberInParty) - { + if (nonClanMemberInParty) { html = "game_manager007.htm"; - } - else if (party.getMemberCount() < 5) - { + } else if (party.getMemberCount() < 5) { html = "game_manager008.htm"; - } - else if ((clan.getCastleId() > 0) || (clan.getFortId() > 0) || (clan.getHideoutId() > 0)) - { + } else if ((clan.getCastleId() > 0) || (clan.getFortId() > 0) || (clan.getHideoutId() > 0)) { html = "game_manager010.htm"; - } - else if (clan.getLevel() < clanhall().getMinClanLevel()) - { + } else if (clan.getLevel() < clanhall().getMinClanLevel()) { html = "game_manager011.htm"; } // else if () // Something about the rules. @@ -499,16 +395,14 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine // { // html = "game_manager013.htm"; // } - else if (!_acceptedClans.contains(clan)) - { + else if (!_acceptedClans.contains(clan)) { html = "game_manager014.htm"; } // else if () // Not have enough cards to register. // { // html = "game_manager015.htm"; // } - else - { + else { portToArena(player, _acceptedClans.indexOf(clan)); } } @@ -516,48 +410,36 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine break; } - if (event.startsWith("enterText")) - { + if (event.startsWith("enterText")) { // Shouldn't happen - if (!_acceptedClans.contains(clan)) - { + if (!_acceptedClans.contains(clan)) { return null; } String[] split = event.split("_ "); - if (split.length < 2) - { + if (split.length < 2) { return null; } final String passage = split[1]; - if (!isValidPassage(passage)) - { + if (!isValidPassage(passage)) { return null; } - if (_usedTextPassages.containsKey(passage)) - { + if (_usedTextPassages.containsKey(passage)) { ArrayList<L2Clan> list = _usedTextPassages.get(passage); - if (list.contains(clan)) - { + if (list.contains(clan)) { html = "yeti_passage_used.htm"; - } - else - { + } else { list.add(clan); - synchronized (_pendingItemToGet) - { - if (_pendingItemToGet.containsKey(clan)) - { + synchronized (_pendingItemToGet) { + if (_pendingItemToGet.containsKey(clan)) { int left = _pendingItemToGet.get(clan); ++left; _pendingItemToGet.put(clan, left); - } - else - { + } else { _pendingItemToGet.put(clan, 1); } } @@ -592,32 +474,24 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (!_rainbow.isInSiege()) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (!_rainbow.isInSiege()) { return null; } final L2Clan clan = killer.getClan(); - if ((clan == null) || !_acceptedClans.contains(clan)) - { + if ((clan == null) || !_acceptedClans.contains(clan)) { return null; } final int npcId = npc.getId(); final int index = _acceptedClans.indexOf(clan); - if (npcId == CHEST) - { + if (npcId == CHEST) { shoutRandomText(npc); - } - else if (npcId == GOURDS[index]) - { - synchronized (this) - { - if (_siegeEnd != null) - { + } else if (npcId == GOURDS[index]) { + synchronized (this) { + if (_siegeEnd != null) { _siegeEnd.cancel(false); } ThreadPoolManager.getInstance().executeGeneral(new SiegeEnd(clan)); @@ -628,29 +502,24 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine } @Override - public String onItemUse(L2Item item, L2PcInstance player) - { - if (!_rainbow.isInSiege()) - { + public String onItemUse(L2Item item, L2PcInstance player) { + if (!_rainbow.isInSiege()) { return null; } L2Object target = player.getTarget(); - if ((target == null) || !(target instanceof L2Npc)) - { + if ((target == null) || !(target instanceof L2Npc)) { return null; } int yeti = target.getId(); - if (!isYetiTarget(yeti)) - { + if (!isYetiTarget(yeti)) { return null; } final L2Clan clan = player.getClan(); - if ((clan == null) || !_acceptedClans.contains(clan)) - { + if ((clan == null) || !_acceptedClans.contains(clan)) { return null; } @@ -662,40 +531,28 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine // - Increase gourd hp ( increaseGourdHp(int) ) final int itemId = item.getId(); - if (itemId == RAINBOW_NECTAR) - { + if (itemId == RAINBOW_NECTAR) { // Spawn enraged (where?) reduceGourdHp(_acceptedClans.indexOf(clan), player); - } - else if (itemId == RAINBOW_MWATER) - { + } else if (itemId == RAINBOW_MWATER) { increaseGourdHp(_acceptedClans.indexOf(clan)); - } - else if (itemId == RAINBOW_WATER) - { + } else if (itemId == RAINBOW_WATER) { moveGourds(); - } - else if (itemId == RAINBOW_SULFUR) - { + } else if (itemId == RAINBOW_SULFUR) { castDebuffsOnEnemies(_acceptedClans.indexOf(clan)); } return null; } - private void portToArena(L2PcInstance leader, int arena) - { - if ((arena < 0) || (arena > 3)) - { + private void portToArena(L2PcInstance leader, int arena) { + if ((arena < 0) || (arena > 3)) { _log.warn("RainbowSptringChateau siege: Wrong arena ID passed {}!", arena); return; } - for (L2PcInstance pc : leader.getParty().getMembers()) - { - if (pc != null) - { + for (L2PcInstance pc : leader.getParty().getMembers()) { + if (pc != null) { pc.stopAllEffects(); - if (pc.hasSummon()) - { + if (pc.hasSummon()) { pc.getSummon().unSummon(pc); } pc.teleToLocation(ARENAS[arena]); @@ -703,23 +560,17 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine } } - protected static void spawnGourds() - { - for (int i = 0; i < _acceptedClans.size(); i++) - { - if (_gourds[i] == null) - { - try - { + protected static void spawnGourds() { + for (int i = 0; i < _acceptedClans.size(); i++) { + if (_gourds[i] == null) { + try { _gourds[i] = new L2Spawn(GOURDS[i]); _gourds[i].setX(ARENAS[i].getX() + 150); _gourds[i].setY(ARENAS[i].getY() + 150); _gourds[i].setZ(ARENAS[i].getZ()); _gourds[i].setHeading(1); _gourds[i].setAmount(1); - } - catch (Exception e) - { + } catch (Exception e) { _log.warn("Unable to spawn guard for clan index {}!", i, e); } } @@ -728,21 +579,17 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine } } - protected static void unSpawnGourds() - { - for (int i = 0; i < _acceptedClans.size(); i++) - { + protected static void unSpawnGourds() { + for (int i = 0; i < _acceptedClans.size(); i++) { _gourds[i].getLastSpawn().deleteMe(); SpawnTable.getInstance().deleteSpawn(_gourds[i], false); } } - private static void moveGourds() - { + private static void moveGourds() { L2Spawn[] tempArray = _gourds; int iterator = _acceptedClans.size(); - for (int i = 0; i < iterator; i++) - { + for (int i = 0; i < iterator; i++) { L2Spawn oldSpawn = _gourds[(iterator - 1) - i]; L2Spawn curSpawn = tempArray[i]; @@ -752,35 +599,27 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine } } - private static void reduceGourdHp(int index, L2PcInstance player) - { + private static void reduceGourdHp(int index, L2PcInstance player) { L2Spawn gourd = _gourds[index]; gourd.getLastSpawn().reduceCurrentHp(1000, player, null); } - private static void increaseGourdHp(int index) - { + private static void increaseGourdHp(int index) { L2Spawn gourd = _gourds[index]; L2Npc gourdNpc = gourd.getLastSpawn(); gourdNpc.setCurrentHp(gourdNpc.getCurrentHp() + 1000); } - private static void castDebuffsOnEnemies(int myArena) - { - for (int id : ARENA_ZONES) - { - if (id == myArena) - { + private static void castDebuffsOnEnemies(int myArena) { + for (int id : ARENA_ZONES) { + if (id == myArena) { continue; } final Collection<L2Character> chars = ZoneManager.getInstance().getZoneById(id).getCharactersInside(); - for (L2Character chr : chars) - { - if (chr != null) - { - for (Skill sk : DEBUFFS) - { + for (L2Character chr : chars) { + if (chr != null) { + for (Skill sk : DEBUFFS) { sk.applyEffects(chr, chr); } } @@ -788,24 +627,19 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine } } - private static void shoutRandomText(L2Npc npc) - { + private static void shoutRandomText(L2Npc npc) { int length = _textPassages.length; - if (_usedTextPassages.size() >= length) - { + if (_usedTextPassages.size() >= length) { return; } int randomPos = getRandom(length); String message = _textPassages[randomPos]; - if (_usedTextPassages.containsKey(message)) - { + if (_usedTextPassages.containsKey(message)) { shoutRandomText(npc); - } - else - { + } else { _usedTextPassages.put(message, new ArrayList<L2Clan>()); int shout = Say2.NPC_SHOUT; int objId = npc.getObjectId(); @@ -814,72 +648,54 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine } } - private static boolean isValidPassage(String text) - { - for (String st : _textPassages) - { - if (st.equalsIgnoreCase(text)) - { + private static boolean isValidPassage(String text) { + for (String st : _textPassages) { + if (st.equalsIgnoreCase(text)) { return true; } } return false; } - private static boolean isYetiTarget(int npcId) - { + private static boolean isYetiTarget(int npcId) { return Util.contains(YETIS, npcId); } - private static void removeAttacker(int clanId) - { + private static void removeAttacker(int clanId) { try (Connection con = ConnectionFactory.getInstance().getConnection(); - PreparedStatement ps = con.prepareStatement("DELETE FROM rainbowsprings_attacker_list WHERE clanId = ?")) - { + PreparedStatement ps = con.prepareStatement("DELETE FROM rainbowsprings_attacker_list WHERE clanId = ?")) { ps.setInt(1, clanId); ps.execute(); - } - catch (Exception e) - { + } catch (Exception e) { _log.warn("{}: Unable to remove attacker clan ID {} from database!", RainbowSpringsChateau.class.getSigners(), clanId, e); } } - private static void addAttacker(int clanId, long count) - { + private static void addAttacker(int clanId, long count) { try (Connection con = ConnectionFactory.getInstance().getConnection(); - PreparedStatement ps = con.prepareStatement("INSERT INTO rainbowsprings_attacker_list VALUES (?,?)")) - { + PreparedStatement ps = con.prepareStatement("INSERT INTO rainbowsprings_attacker_list VALUES (?,?)")) { ps.setInt(1, clanId); ps.setLong(2, count); ps.execute(); - } - catch (Exception e) - { + } catch (Exception e) { _log.warn("{}: Unable add attakers for clan ID {} and count {}!", RainbowSpringsChateau.class.getSigners(), clanId, count, e); } } @Override - public void loadAttackers() - { + public void loadAttackers() { try (Connection con = ConnectionFactory.getInstance().getConnection(); Statement s = con.createStatement(); - ResultSet rset = s.executeQuery("SELECT * FROM rainbowsprings_attacker_list")) - { - while (rset.next()) - { + ResultSet rset = s.executeQuery("SELECT * FROM rainbowsprings_attacker_list")) { + while (rset.next()) { _warDecreesCount.put(rset.getInt("clan_id"), rset.getLong("decrees_count")); } - } - catch (Exception e) - { + } catch (Exception e) { _log.warn("{}: Unable load attakers!", RainbowSpringsChateau.class.getSigners(), e); } } - protected static void setRegistrationEndString(long time) - { + protected static void setRegistrationEndString(long time) { Calendar c = Calendar.getInstance(); c.setTime(new Date(time)); int year = c.get(Calendar.YEAR); @@ -891,32 +707,26 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine _registrationEnds = year + "-" + month + "-" + day + " " + hour + (mins < 10 ? ":0" : ":") + mins; } - public static void launchSiege() - { + public static void launchSiege() { _nextSiege.cancel(false); ThreadPoolManager.getInstance().executeGeneral(new SiegeStart()); } @Override - public void endSiege() - { - if (_siegeEnd != null) - { + public void endSiege() { + if (_siegeEnd != null) { _siegeEnd.cancel(false); } ThreadPoolManager.getInstance().executeGeneral(new SiegeEnd(null)); } - public static void updateAdminDate(long date) - { - if (_rainbow == null) - { + public static void updateAdminDate(long date) { + if (_rainbow == null) { _rainbow = ClanHallSiegeManager.getInstance().getSiegableHall(RAINBOW_SPRINGS); } _rainbow.setNextSiegeDate(date); - if (_nextSiege != null) - { + if (_nextSiege != null) { _nextSiege.cancel(true); } date -= 3600000; @@ -924,8 +734,7 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine _nextSiege = ThreadPoolManager.getInstance().scheduleGeneral(new SetFinalAttackers(), _rainbow.getNextSiegeTime()); } - public static void main(String[] args) - { + public static void main(String[] args) { new RainbowSpringsChateau(); } } diff --git a/src/main/java/com/l2jserver/datapack/conquerablehalls/flagwar/BanditStronghold/BanditStronghold.java b/src/main/java/com/l2jserver/datapack/conquerablehalls/flagwar/BanditStronghold/BanditStronghold.java index e95552be50..6b1c323b20 100644 --- a/src/main/java/com/l2jserver/datapack/conquerablehalls/flagwar/BanditStronghold/BanditStronghold.java +++ b/src/main/java/com/l2jserver/datapack/conquerablehalls/flagwar/BanditStronghold/BanditStronghold.java @@ -28,10 +28,8 @@ import com.l2jserver.gameserver.model.zone.type.L2ResidenceHallTeleportZone; /** * @author BiggBoss */ -public final class BanditStronghold extends FlagWar -{ - static - { +public final class BanditStronghold extends FlagWar { + static { ROYAL_FLAG = 35422; FLAG_RED = 35423; FLAG_YELLOW = 35424; @@ -65,17 +63,14 @@ public final class BanditStronghold extends FlagWar Collection<L2ResidenceHallTeleportZone> zoneList = ZoneManager.getInstance().getAllZones(L2ResidenceHallTeleportZone.class); - for (L2ResidenceHallTeleportZone teleZone : zoneList) - { - if (teleZone.getResidenceId() != BANDIT_STRONGHOLD) - { + for (L2ResidenceHallTeleportZone teleZone : zoneList) { + if (teleZone.getResidenceId() != BANDIT_STRONGHOLD) { continue; } int id = teleZone.getResidenceZoneId(); - if ((id < 0) || (id >= 6)) - { + if ((id < 0) || (id >= 6)) { continue; } @@ -86,18 +81,15 @@ public final class BanditStronghold extends FlagWar CENTER = new Location(82882, -16280, -1894, 0); } - private BanditStronghold() - { + private BanditStronghold() { super(BanditStronghold.class.getSimpleName(), BANDIT_STRONGHOLD); } @Override - public String getFlagHtml(int flag) - { + public String getFlagHtml(int flag) { String result = null; - switch (flag) - { + switch (flag) { case 35423: result = "messenger_flag1.htm"; break; @@ -119,12 +111,10 @@ public final class BanditStronghold extends FlagWar } @Override - public String getAllyHtml(int ally) - { + public String getAllyHtml(int ally) { String result = null; - switch (ally) - { + switch (ally) { case 35428: result = "messenger_ally1result.htm"; break; @@ -145,8 +135,7 @@ public final class BanditStronghold extends FlagWar return result; } - public static void main(String[] args) - { + public static void main(String[] args) { new BanditStronghold(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/conquerablehalls/flagwar/FlagWar.java b/src/main/java/com/l2jserver/datapack/conquerablehalls/flagwar/FlagWar.java index 8a91d56f72..0bbd672ecb 100644 --- a/src/main/java/com/l2jserver/datapack/conquerablehalls/flagwar/FlagWar.java +++ b/src/main/java/com/l2jserver/datapack/conquerablehalls/flagwar/FlagWar.java @@ -53,8 +53,7 @@ import com.l2jserver.gameserver.util.Broadcast; /** * @author BiggBoss */ -public abstract class FlagWar extends ClanHallSiegeEngine -{ +public abstract class FlagWar extends ClanHallSiegeEngine { private static final String SQL_LOAD_ATTACKERS = "SELECT * FROM siegable_hall_flagwar_attackers WHERE hall_id = ?"; private static final String SQL_SAVE_ATTACKER = "INSERT INTO siegable_hall_flagwar_attackers_members VALUES (?,?,?)"; private static final String SQL_LOAD_MEMEBERS = "SELECT object_id FROM siegable_hall_flagwar_attackers_members WHERE clan_id = ?"; @@ -94,15 +93,13 @@ public abstract class FlagWar extends ClanHallSiegeEngine protected L2Clan _winner; private boolean _firstPhase; - public FlagWar(String name, int hallId) - { + public FlagWar(String name, int hallId) { super(name, "conquerablehalls/flagwar", hallId); addStartNpc(MESSENGER); addFirstTalkId(MESSENGER); addTalkId(MESSENGER); - for (int i = 0; i < 6; i++) - { + for (int i = 0; i < 6; i++) { addFirstTalkId(TELEPORT_1 + i); } @@ -123,33 +120,23 @@ public abstract class FlagWar extends ClanHallSiegeEngine } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { String html = null; - if (npc.getId() == MESSENGER) - { - if (!checkIsAttacker(player.getClan())) - { + if (npc.getId() == MESSENGER) { + if (!checkIsAttacker(player.getClan())) { L2Clan clan = ClanTable.getInstance().getClan(_hall.getOwnerId()); String content = getHtm(player.getHtmlPrefix(), "messenger_initial.htm"); content = content.replaceAll("%clanName%", (clan == null) ? "no owner" : clan.getName()); content = content.replaceAll("%objectId%", String.valueOf(npc.getObjectId())); html = content; - } - else - { + } else { html = "messenger_initial.htm"; } - } - else - { + } else { int index = npc.getId() - TELEPORT_1; - if ((index == 0) && _firstPhase) - { + if ((index == 0) && _firstPhase) { html = "teleporter_notyet.htm"; - } - else - { + } else { TELE_ZONES[index].checkTeleporTask(); html = "teleporter.htm"; } @@ -158,69 +145,47 @@ public abstract class FlagWar extends ClanHallSiegeEngine } @Override - public synchronized String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public synchronized String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String html = event; L2Clan clan = player.getClan(); if (event.startsWith("register_clan")) // Register the clan for the siege { - if (!_hall.isRegistering()) - { - if (_hall.isInSiege()) - { + if (!_hall.isRegistering()) { + if (_hall.isInSiege()) { html = "messenger_registrationpassed.htm"; - } - else - { + } else { sendRegistrationPageDate(player); return null; } - } - else if ((clan == null) || !player.isClanLeader()) - { + } else if ((clan == null) || !player.isClanLeader()) { html = "messenger_notclannotleader.htm"; - } - else if (getAttackers().size() >= 5) - { + } else if (getAttackers().size() >= 5) { html = "messenger_attackersqueuefull.htm"; - } - else if (checkIsAttacker(clan)) - { + } else if (checkIsAttacker(clan)) { html = "messenger_clanalreadyregistered.htm"; - } - else if (_hall.getOwnerId() == clan.getId()) - { + } else if (_hall.getOwnerId() == clan.getId()) { html = "messenger_curownermessage.htm"; - } - else - { + } else { String[] arg = event.split(" "); - if (arg.length >= 2) - { + if (arg.length >= 2) { // Register passing the quest - if (arg[1].equals("wQuest")) - { + if (arg[1].equals("wQuest")) { if (player.destroyItemByItemId(_hall.getName() + " Siege", QUEST_REWARD, 1, npc, false)) // Quest passed { registerClan(clan); html = getFlagHtml(_data.get(clan.getId()).flag); - } - else - { + } else { html = "messenger_noquest.htm"; } } // Register paying the fee - else if (arg[1].equals("wFee") && canPayRegistration()) - { + else if (arg[1].equals("wFee") && canPayRegistration()) { if (player.reduceAdena(getName() + " Siege", 200000, npc, false)) // Fee payed { registerClan(clan); html = getFlagHtml(_data.get(clan.getId()).flag); - } - else - { + } else { html = "messenger_nomoney.htm"; } } @@ -228,123 +193,81 @@ public abstract class FlagWar extends ClanHallSiegeEngine } } // Select the flag to defend - else if (event.startsWith("select_clan_npc")) - { - if (!player.isClanLeader()) - { + else if (event.startsWith("select_clan_npc")) { + if (!player.isClanLeader()) { html = "messenger_onlyleaderselectally.htm"; - } - else if (!_data.containsKey(clan.getId())) - { + } else if (!_data.containsKey(clan.getId())) { html = "messenger_clannotregistered.htm"; - } - else - { + } else { String[] var = event.split(" "); - if (var.length >= 2) - { + if (var.length >= 2) { int id = 0; - try - { + try { id = Integer.parseInt(var[1]); - } - catch (Exception e) - { + } catch (Exception e) { _log.warn("{}: select_clan_npc->Wrong mahum warrior ID {}!", getName(), var[1], e); } - if ((id > 0) && ((html = getAllyHtml(id)) != null)) - { + if ((id > 0) && ((html = getAllyHtml(id)) != null)) { _data.get(clan.getId()).npc = id; saveNpc(id, clan.getId()); } - } - else - { + } else { _log.warn("{}: Siege: Not enough parameters to save clan npc for clan {}! ", getName(), clan.getName()); } } } // View (and change ? ) the current selected mahum warrior - else if (event.startsWith("view_clan_npc")) - { + else if (event.startsWith("view_clan_npc")) { ClanData cd = null; - if (clan == null) - { + if (clan == null) { html = "messenger_clannotregistered.htm"; - } - else if ((cd = _data.get(clan.getId())) == null) - { + } else if ((cd = _data.get(clan.getId())) == null) { html = "messenger_notclannotleader.htm"; - } - else if (cd.npc == 0) - { + } else if (cd.npc == 0) { html = "messenger_leaderdidnotchooseyet.htm"; - } - else - { + } else { html = getAllyHtml(cd.npc); } } // Register a clan member for the fight - else if (event.equals("register_member")) - { - if (clan == null) - { + else if (event.equals("register_member")) { + if (clan == null) { html = "messenger_clannotregistered.htm"; - } - else if (!_hall.isRegistering()) - { + } else if (!_hall.isRegistering()) { html = "messenger_registrationpassed.htm"; - } - else if (!_data.containsKey(clan.getId())) - { + } else if (!_data.containsKey(clan.getId())) { html = "messenger_notclannotleader.htm"; - } - else if (_data.get(clan.getId()).players.size() >= 18) - { + } else if (_data.get(clan.getId()).players.size() >= 18) { html = "messenger_clanqueuefull.htm"; - } - else - { + } else { ClanData data = _data.get(clan.getId()); data.players.add(player.getObjectId()); saveMember(clan.getId(), player.getObjectId()); - if (data.npc == 0) - { + if (data.npc == 0) { html = "messenger_leaderdidnotchooseyet.htm"; - } - else - { + } else { html = "messenger_clanregistered.htm"; } } } // Show cur attacker list - else if (event.equals("view_attacker_list")) - { - if (_hall.isRegistering()) - { + else if (event.equals("view_attacker_list")) { + if (_hall.isRegistering()) { sendRegistrationPageDate(player); - } - else - { + } else { html = getHtm(player.getHtmlPrefix(), "messenger_registeredclans.htm"); int i = 0; - for (Entry<Integer, ClanData> clanData : _data.entrySet()) - { + for (Entry<Integer, ClanData> clanData : _data.entrySet()) { L2Clan attacker = ClanTable.getInstance().getClan(clanData.getKey()); - if (attacker == null) - { + if (attacker == null) { continue; } html = html.replaceAll("%clan" + i + "%", clan.getName()); html = html.replaceAll("%clanMem" + i + "%", String.valueOf(clanData.getValue().players.size())); i++; } - if (_data.size() < 5) - { - for (int c = _data.size(); c < 5; c++) - { + if (_data.size() < 5) { + for (int c = _data.size(); c < 5; c++) { html = html.replaceAll("%clan" + c + "%", "Empty pos. "); html = html.replaceAll("%clanMem" + c + "%", "Empty pos. "); } @@ -356,71 +279,56 @@ public abstract class FlagWar extends ClanHallSiegeEngine } @Override - public synchronized String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (_hall.isInSiege()) - { + public synchronized String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (_hall.isInSiege()) { final int npcId = npc.getId(); - for (int keys : _data.keySet()) - { - if (_data.get(keys).npc == npcId) - { + for (int keys : _data.keySet()) { + if (_data.get(keys).npc == npcId) { removeParticipant(keys, true); } } - synchronized (this) - { + synchronized (this) { // TODO: Zoey76: previous bad implementation. // Converting map.keySet() to List and map.values() to List doesn't ensure that // first element in the key's List correspond to the first element in the values' List // That's the reason that values aren't copied to a List, instead using _data.get(clanIds.get(0)) final List<Integer> clanIds = new ArrayList<>(_data.keySet()); - if (_firstPhase) - { + if (_firstPhase) { // Siege ends if just 1 flag is alive // Hall was free before battle or owner didn't set the ally npc - if (((clanIds.size() == 1) && (_hall.getOwnerId() <= 0)) || (_data.get(clanIds.get(0)).npc == 0)) - { + if (((clanIds.size() == 1) && (_hall.getOwnerId() <= 0)) || (_data.get(clanIds.get(0)).npc == 0)) { _missionAccomplished = true; // _winner = ClanTable.getInstance().getClan(_data.keySet()[0]); // removeParticipant(_data.keySet()[0], false); cancelSiegeTask(); endSiege(); - } - else if ((_data.size() == 2) && (_hall.getOwnerId() > 0)) // Hall has defender (owner) + } else if ((_data.size() == 2) && (_hall.getOwnerId() > 0)) // Hall has defender (owner) { cancelSiegeTask(); // No time limit now _firstPhase = false; _hall.getSiegeZone().setIsActive(false); - for (int doorId : INNER_DOORS_TO_OPEN) - { + for (int doorId : INNER_DOORS_TO_OPEN) { _hall.openCloseDoor(doorId, true); } - for (ClanData data : _data.values()) - { + for (ClanData data : _data.values()) { doUnSpawns(data); } - ThreadPoolManager.getInstance().scheduleGeneral(() -> - { - for (int doorId : INNER_DOORS_TO_OPEN) - { + ThreadPoolManager.getInstance().scheduleGeneral(() -> { + for (int doorId : INNER_DOORS_TO_OPEN) { _hall.openCloseDoor(doorId, false); } - for (Entry<Integer, ClanData> e : _data.entrySet()) - { + for (Entry<Integer, ClanData> e : _data.entrySet()) { doSpawns(e.getKey(), e.getValue()); } _hall.getSiegeZone().setIsActive(true); - } , 300000); + }, 300000); } - } - else - { + } else { _missionAccomplished = true; _winner = ClanTable.getInstance().getClan(clanIds.get(0)); removeParticipant(clanIds.get(0), false); @@ -432,23 +340,19 @@ public abstract class FlagWar extends ClanHallSiegeEngine } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, CENTER); return null; } @Override - public L2Clan getWinner() - { + public L2Clan getWinner() { return _winner; } @Override - public void prepareOwner() - { - if (_hall.getOwnerId() > 0) - { + public void prepareOwner() { + if (_hall.getOwnerId() > 0) { registerClan(ClanTable.getInstance().getClan(_hall.getOwnerId())); } @@ -462,10 +366,8 @@ public abstract class FlagWar extends ClanHallSiegeEngine } @Override - public void startSiege() - { - if (getAttackers().size() < 2) - { + public void startSiege() { + if (getAttackers().size() < 2) { onSiegeEnds(); getAttackers().clear(); _hall.updateNextSiege(); @@ -476,23 +378,18 @@ public abstract class FlagWar extends ClanHallSiegeEngine } // Open doors for challengers - for (int door : OUTTER_DOORS_TO_OPEN) - { + for (int door : OUTTER_DOORS_TO_OPEN) { _hall.openCloseDoor(door, true); } // Teleport owner inside - if (_hall.getOwnerId() > 0) - { + if (_hall.getOwnerId() > 0) { L2Clan owner = ClanTable.getInstance().getClan(_hall.getOwnerId()); final Location loc = _hall.getZone().getSpawns().get(0); // Owner restart point - for (L2ClanMember pc : owner.getMembers()) - { - if (pc != null) - { + for (L2ClanMember pc : owner.getMembers()) { + if (pc != null) { final L2PcInstance player = pc.getPlayerInstance(); - if ((player != null) && player.isOnline()) - { + if ((player != null) && player.isOnline()) { player.teleToLocation(loc, false); } } @@ -501,33 +398,26 @@ public abstract class FlagWar extends ClanHallSiegeEngine // Schedule open doors closement, banish non siege participants and<br> // siege start in 2 minutes - ThreadPoolManager.getInstance().scheduleGeneral(() -> - { - for (int door : OUTTER_DOORS_TO_OPEN) - { + ThreadPoolManager.getInstance().scheduleGeneral(() -> { + for (int door : OUTTER_DOORS_TO_OPEN) { _hall.openCloseDoor(door, false); } _hall.getZone().banishNonSiegeParticipants(); startSiege(); - } , 300000); + }, 300000); } @Override - public void onSiegeStarts() - { - for (Entry<Integer, ClanData> clan : _data.entrySet()) - { + public void onSiegeStarts() { + for (Entry<Integer, ClanData> clan : _data.entrySet()) { // Spawns challengers flags and npcs - try - { + try { ClanData data = clan.getValue(); doSpawns(clan.getKey(), data); fillPlayerList(data); - } - catch (Exception e) - { + } catch (Exception e) { endSiege(); _log.warn("{}: Problems in siege initialization!", getName(), e); } @@ -535,10 +425,8 @@ public abstract class FlagWar extends ClanHallSiegeEngine } @Override - public void endSiege() - { - if (_hall.getOwnerId() > 0) - { + public void endSiege() { + if (_hall.getOwnerId() > 0) { L2Clan clan = ClanTable.getInstance().getClan(_hall.getOwnerId()); clan.setHideoutId(0); _hall.free(); @@ -547,18 +435,12 @@ public abstract class FlagWar extends ClanHallSiegeEngine } @Override - public void onSiegeEnds() - { - if (_data.size() > 0) - { - for (int clanId : _data.keySet()) - { - if (_hall.getOwnerId() == clanId) - { + public void onSiegeEnds() { + if (_data.size() > 0) { + for (int clanId : _data.keySet()) { + if (_hall.getOwnerId() == clanId) { removeParticipant(clanId, false); - } - else - { + } else { removeParticipant(clanId, true); } } @@ -567,25 +449,17 @@ public abstract class FlagWar extends ClanHallSiegeEngine } @Override - public final Location getInnerSpawnLoc(final L2PcInstance player) - { + public final Location getInnerSpawnLoc(final L2PcInstance player) { Location loc = null; - if (player.getClanId() == _hall.getOwnerId()) - { + if (player.getClanId() == _hall.getOwnerId()) { loc = _hall.getZone().getSpawns().get(0); - } - else - { + } else { ClanData cd = _data.get(player.getClanId()); - if (cd != null) - { + if (cd != null) { int index = cd.flag - FLAG_RED; - if ((index >= 0) && (index <= 4)) - { + if ((index >= 0) && (index <= 4)) { loc = _hall.getZone().getChallengerSpawns().get(index); - } - else - { + } else { throw new ArrayIndexOutOfBoundsException(); } } @@ -594,28 +468,21 @@ public abstract class FlagWar extends ClanHallSiegeEngine } @Override - public final boolean canPlantFlag() - { + public final boolean canPlantFlag() { return false; } @Override - public final boolean doorIsAutoAttackable() - { + public final boolean doorIsAutoAttackable() { return false; } - void doSpawns(int clanId, ClanData data) - { - try - { + void doSpawns(int clanId, ClanData data) { + try { int index = 0; - if (_firstPhase) - { + if (_firstPhase) { index = data.flag - FLAG_RED; - } - else - { + } else { index = clanId == _hall.getOwnerId() ? 5 : 6; } Location loc = FLAG_COORDS[index]; @@ -632,27 +499,21 @@ public abstract class FlagWar extends ClanHallSiegeEngine data.warrior.setAmount(1); data.warrior.init(); ((L2SpecialSiegeGuardAI) data.warrior.getLastSpawn().getAI()).getAlly().addAll(data.players); - } - catch (Exception e) - { + } catch (Exception e) { _log.warn("{}: Could not make clan spawns!", getName(), e); } } - private void fillPlayerList(ClanData data) - { - for (int objId : data.players) - { + private void fillPlayerList(ClanData data) { + for (int objId : data.players) { L2PcInstance plr = L2World.getInstance().getPlayer(objId); - if (plr != null) - { + if (plr != null) { data.playersInstance.add(plr); } } } - private void registerClan(L2Clan clan) - { + private void registerClan(L2Clan clan) { final int clanId = clan.getId(); L2SiegeClan sc = new L2SiegeClan(clanId, SiegeClanType.ATTACKER); @@ -667,55 +528,43 @@ public abstract class FlagWar extends ClanHallSiegeEngine saveMember(clanId, clan.getLeaderId()); } - private final void doUnSpawns(ClanData data) - { - if (data.flagInstance != null) - { + private final void doUnSpawns(ClanData data) { + if (data.flagInstance != null) { data.flagInstance.stopRespawn(); data.flagInstance.getLastSpawn().deleteMe(); } - if (data.warrior != null) - { + if (data.warrior != null) { data.warrior.stopRespawn(); data.warrior.getLastSpawn().deleteMe(); } } - private final void removeParticipant(int clanId, boolean teleport) - { + private final void removeParticipant(int clanId, boolean teleport) { ClanData dat = _data.remove(clanId); - if (dat != null) - { + if (dat != null) { // Destroy clan flag - if (dat.flagInstance != null) - { + if (dat.flagInstance != null) { dat.flagInstance.stopRespawn(); - if (dat.flagInstance.getLastSpawn() != null) - { + if (dat.flagInstance.getLastSpawn() != null) { dat.flagInstance.getLastSpawn().deleteMe(); } } - if (dat.warrior != null) - { + if (dat.warrior != null) { // Destroy clan warrior dat.warrior.stopRespawn(); - if (dat.warrior.getLastSpawn() != null) - { + if (dat.warrior.getLastSpawn() != null) { dat.warrior.getLastSpawn().deleteMe(); } } dat.players.clear(); - if (teleport) - { + if (teleport) { // Teleport players outside - for (L2PcInstance pc : dat.playersInstance) - { - if (pc != null) - { + for (L2PcInstance pc : dat.playersInstance) { + if (pc != null) { pc.teleToLocation(TeleportWhereType.TOWN); } } @@ -725,13 +574,11 @@ public abstract class FlagWar extends ClanHallSiegeEngine } } - public boolean canPayRegistration() - { + public boolean canPayRegistration() { return true; } - private void sendRegistrationPageDate(L2PcInstance player) - { + private void sendRegistrationPageDate(L2PcInstance player) { final NpcHtmlMessage msg = new NpcHtmlMessage(); msg.setHtml(getHtm(player.getHtmlPrefix(), "siege_date.htm")); msg.replace("%nextSiege%", _hall.getSiegeDate().getTime().toString()); @@ -743,20 +590,15 @@ public abstract class FlagWar extends ClanHallSiegeEngine public abstract String getAllyHtml(int ally); @Override - public final void loadAttackers() - { + public final void loadAttackers() { try (Connection con = ConnectionFactory.getInstance().getConnection(); - PreparedStatement ps = con.prepareStatement(SQL_LOAD_ATTACKERS)) - { + PreparedStatement ps = con.prepareStatement(SQL_LOAD_ATTACKERS)) { ps.setInt(1, _hall.getId()); - try (ResultSet rset = ps.executeQuery()) - { - while (rset.next()) - { + try (ResultSet rset = ps.executeQuery()) { + while (rset.next()) { final int clanId = rset.getInt("clan_id"); - if (ClanTable.getInstance().getClan(clanId) == null) - { + if (ClanTable.getInstance().getClan(clanId) == null) { _log.warn("{}: Loaded an unexistent clan as attacker! Clan ID {}!", getName(), clanId); continue; } @@ -769,108 +611,82 @@ public abstract class FlagWar extends ClanHallSiegeEngine loadAttackerMembers(clanId); } } - } - catch (Exception e) - { + } catch (Exception e) { _log.warn("Could not load attackers for {}!", getName(), e); } } - private final void loadAttackerMembers(int clanId) - { + private final void loadAttackerMembers(int clanId) { final List<Integer> listInstance = _data.get(clanId).players; - if (listInstance == null) - { + if (listInstance == null) { _log.warn(getName() + ": Tried to load unregistered clan with ID " + clanId); return; } try (Connection con = ConnectionFactory.getInstance().getConnection(); - PreparedStatement ps = con.prepareStatement(SQL_LOAD_MEMEBERS)) - { + PreparedStatement ps = con.prepareStatement(SQL_LOAD_MEMEBERS)) { ps.setInt(1, clanId); - try (ResultSet rset = ps.executeQuery()) - { - while (rset.next()) - { + try (ResultSet rset = ps.executeQuery()) { + while (rset.next()) { listInstance.add(rset.getInt("object_id")); } } - } - catch (Exception e) - { + } catch (Exception e) { _log.warn("{}: loadAttackerMembers", getName(), e); } } - private final void saveClan(int clanId, int flag) - { + private final void saveClan(int clanId, int flag) { try (Connection con = ConnectionFactory.getInstance().getConnection(); - PreparedStatement ps = con.prepareStatement(SQL_SAVE_CLAN)) - { + PreparedStatement ps = con.prepareStatement(SQL_SAVE_CLAN)) { ps.setInt(1, _hall.getId()); ps.setInt(2, flag); ps.setInt(3, 0); ps.setInt(4, clanId); ps.execute(); - } - catch (Exception e) - { + } catch (Exception e) { _log.warn("{}: saveClan", getName(), e); } } - private final void saveNpc(int npc, int clanId) - { + private final void saveNpc(int npc, int clanId) { try (Connection con = ConnectionFactory.getInstance().getConnection(); - PreparedStatement ps = con.prepareStatement(SQL_SAVE_NPC)) - { + PreparedStatement ps = con.prepareStatement(SQL_SAVE_NPC)) { ps.setInt(1, npc); ps.setInt(2, clanId); ps.execute(); - } - catch (Exception e) - { + } catch (Exception e) { _log.warn("{}: saveNpc()", getName(), e); } } - private final void saveMember(int clanId, int objectId) - { + private final void saveMember(int clanId, int objectId) { try (Connection con = ConnectionFactory.getInstance().getConnection(); - PreparedStatement ps = con.prepareStatement(SQL_SAVE_ATTACKER)) - { + PreparedStatement ps = con.prepareStatement(SQL_SAVE_ATTACKER)) { ps.setInt(1, _hall.getId()); ps.setInt(2, clanId); ps.setInt(3, objectId); ps.execute(); - } - catch (Exception e) - { + } catch (Exception e) { _log.warn("{}: saveMember", getName(), e); } } - private void clearTables() - { + private void clearTables() { try (Connection con = ConnectionFactory.getInstance().getConnection(); PreparedStatement ps1 = con.prepareStatement(SQL_CLEAR_CLAN); - PreparedStatement ps2 = con.prepareStatement(SQL_CLEAR_CLAN_ATTACKERS)) - { + PreparedStatement ps2 = con.prepareStatement(SQL_CLEAR_CLAN_ATTACKERS)) { ps1.setInt(1, _hall.getId()); ps1.execute(); ps2.setInt(1, _hall.getId()); ps2.execute(); - } - catch (Exception e) - { + } catch (Exception e) { _log.warn("Unable to clear data tables for {}!", getName(), e); } } - class ClanData - { + class ClanData { int flag = 0; int npc = 0; List<Integer> players = new ArrayList<>(18); diff --git a/src/main/java/com/l2jserver/datapack/conquerablehalls/flagwar/WildBeastReserve/WildBeastReserve.java b/src/main/java/com/l2jserver/datapack/conquerablehalls/flagwar/WildBeastReserve/WildBeastReserve.java index 5397c6586e..ea728e5e30 100644 --- a/src/main/java/com/l2jserver/datapack/conquerablehalls/flagwar/WildBeastReserve/WildBeastReserve.java +++ b/src/main/java/com/l2jserver/datapack/conquerablehalls/flagwar/WildBeastReserve/WildBeastReserve.java @@ -28,10 +28,8 @@ import com.l2jserver.gameserver.model.zone.type.L2ResidenceHallTeleportZone; /** * @author BiggBoss */ -public final class WildBeastReserve extends FlagWar -{ - static - { +public final class WildBeastReserve extends FlagWar { + static { ROYAL_FLAG = 35606; FLAG_RED = 35607; // White flag FLAG_YELLOW = 35608; // Red flag @@ -65,17 +63,14 @@ public final class WildBeastReserve extends FlagWar Collection<L2ResidenceHallTeleportZone> zoneList = ZoneManager.getInstance().getAllZones(L2ResidenceHallTeleportZone.class); - for (L2ResidenceHallTeleportZone teleZone : zoneList) - { - if (teleZone.getResidenceId() != BEAST_FARM) - { + for (L2ResidenceHallTeleportZone teleZone : zoneList) { + if (teleZone.getResidenceId() != BEAST_FARM) { continue; } int id = teleZone.getResidenceZoneId(); - if ((id < 0) || (id >= 6)) - { + if ((id < 0) || (id >= 6)) { continue; } @@ -86,18 +81,15 @@ public final class WildBeastReserve extends FlagWar CENTER = new Location(57762, -92696, -1359, 0); } - private WildBeastReserve() - { + private WildBeastReserve() { super(WildBeastReserve.class.getSimpleName(), BEAST_FARM); } @Override - public String getFlagHtml(int flag) - { + public String getFlagHtml(int flag) { String result = null; - switch (flag) - { + switch (flag) { case 35607: result = "messenger_flag1.htm"; break; @@ -119,12 +111,10 @@ public final class WildBeastReserve extends FlagWar } @Override - public String getAllyHtml(int ally) - { + public String getAllyHtml(int ally) { String result = null; - switch (ally) - { + switch (ally) { case 35618: result = "messenger_ally1result.htm"; break; @@ -146,13 +136,11 @@ public final class WildBeastReserve extends FlagWar } @Override - public boolean canPayRegistration() - { + public boolean canPayRegistration() { return false; } - public static void main(String[] args) - { + public static void main(String[] args) { new WildBeastReserve(); } } diff --git a/src/main/java/com/l2jserver/datapack/cron/example.java b/src/main/java/com/l2jserver/datapack/cron/example.java index 5d7f8f6305..f47b21dfa3 100644 --- a/src/main/java/com/l2jserver/datapack/cron/example.java +++ b/src/main/java/com/l2jserver/datapack/cron/example.java @@ -18,10 +18,8 @@ */ package com.l2jserver.datapack.cron; -public class example -{ - public static void main(String[] args) - { +public class example { + public static void main(String[] args) { System.out.println("Hello world!"); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/custom/Validators/SubClassSkills.java b/src/main/java/com/l2jserver/datapack/custom/Validators/SubClassSkills.java index 3ce0aa49a1..0681859de5 100644 --- a/src/main/java/com/l2jserver/datapack/custom/Validators/SubClassSkills.java +++ b/src/main/java/com/l2jserver/datapack/custom/Validators/SubClassSkills.java @@ -40,8 +40,7 @@ import com.l2jserver.gameserver.util.Util; * TODO: Rewrite. * @author DS */ -public final class SubClassSkills extends Quest -{ +public final class SubClassSkills extends Quest { // arrays must be sorted // @formatter:off private static final int[] _allCertSkillIds = @@ -82,42 +81,34 @@ public final class SubClassSkills extends Quest }; // @formatter:on - private static final String[] VARS = - { + private static final String[] VARS = { "EmergentAbility65-", "EmergentAbility70-", "ClassAbility75-", "ClassAbility80-" }; - private SubClassSkills() - { + private SubClassSkills() { super(-1, SubClassSkills.class.getSimpleName(), "custom"); setOnEnterWorld(true); } @Override - public String onEnterWorld(L2PcInstance player) - { - if (!general().skillCheckEnable()) - { + public String onEnterWorld(L2PcInstance player) { + if (!general().skillCheckEnable()) { return null; } - if (player.canOverrideCond(PcCondOverride.SKILL_CONDITIONS) && !general().skillCheckGM()) - { + if (player.canOverrideCond(PcCondOverride.SKILL_CONDITIONS) && !general().skillCheckGM()) { return null; } final List<Skill> certSkills = getCertSkills(player); - if (player.isSubClassActive()) - { - for (Skill s : certSkills) - { + if (player.isSubClassActive()) { + for (Skill s : certSkills) { Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " has cert skill on subclass :" + s.getName() + "(" + s.getId() + "/" + s.getLevel() + "), class:" + ClassListData.getInstance().getClass(player.getClassId()).getClassName(), IllegalActionPunishmentType.NONE); - if (general().skillCheckRemove()) - { + if (general().skillCheckRemove()) { player.removeSkill(s); } } @@ -125,8 +116,7 @@ public final class SubClassSkills extends Quest } int[][] cSkills = new int[certSkills.size()][2]; // skillId/skillLvl - for (int i = certSkills.size(); --i >= 0;) - { + for (int i = certSkills.size(); --i >= 0;) { Skill skill = certSkills.get(i); cSkills[i][0] = skill.getId(); cSkills[i][1] = skill.getLevel(); @@ -134,169 +124,123 @@ public final class SubClassSkills extends Quest final List<L2ItemInstance> certItems = getCertItems(player); int[][] cItems = new int[certItems.size()][2]; // objectId/number - for (int i = certItems.size(); --i >= 0;) - { + for (int i = certItems.size(); --i >= 0;) { L2ItemInstance item = certItems.get(i); cItems[i][0] = item.getObjectId(); cItems[i][1] = (int) Math.min(item.getCount(), Integer.MAX_VALUE); } QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { st = newQuestState(player); } String qName, qValue; int id, index; - for (int i = VARS.length; --i >= 0;) - { - for (int j = character().getMaxSubclass(); j > 0; j--) - { + for (int i = VARS.length; --i >= 0;) { + for (int j = character().getMaxSubclass(); j > 0; j--) { qName = VARS[i] + String.valueOf(j); qValue = st.getGlobalQuestVar(qName); - if ((qValue == null) || qValue.isEmpty()) - { + if ((qValue == null) || qValue.isEmpty()) { continue; } if (qValue.endsWith(";")) // found skill { - try - { + try { id = Integer.parseInt(qValue.replace(";", "")); Skill skill = null; - if (certSkills != null) - { + if (certSkills != null) { // searching skill in test array - if (cSkills != null) - { - for (index = certSkills.size(); --index >= 0;) - { - if (cSkills[index][0] == id) - { + if (cSkills != null) { + for (index = certSkills.size(); --index >= 0;) { + if (cSkills[index][0] == id) { skill = certSkills.get(index); cSkills[index][1]--; break; } } } - if (skill != null) - { - if (!Util.contains(_certSkillsByLevel[i], id)) - { + if (skill != null) { + if (!Util.contains(_certSkillsByLevel[i], id)) { // should remove this skill ? Util.handleIllegalPlayerAction(player, "Invalid cert variable WITH skill:" + qName + "=" + qValue + " - skill does not match certificate level", IllegalActionPunishmentType.NONE); } - } - else - { + } else { Util.handleIllegalPlayerAction(player, "Invalid cert variable:" + qName + "=" + qValue + " - skill not found", IllegalActionPunishmentType.NONE); } - } - else - { + } else { Util.handleIllegalPlayerAction(player, "Invalid cert variable:" + qName + "=" + qValue + " - no certified skills found", IllegalActionPunishmentType.NONE); } - } - catch (NumberFormatException e) - { + } catch (NumberFormatException e) { Util.handleIllegalPlayerAction(player, "Invalid cert variable:" + qName + "=" + qValue + " - not a number", IllegalActionPunishmentType.NONE); } - } - else + } else // found item { - try - { + try { id = Integer.parseInt(qValue); - if (id == 0) - { + if (id == 0) { continue; } L2ItemInstance item = null; - if (certItems != null) - { + if (certItems != null) { // searching item in test array - if (cItems != null) - { - for (index = certItems.size(); --index >= 0;) - { - if (cItems[index][0] == id) - { + if (cItems != null) { + for (index = certItems.size(); --index >= 0;) { + if (cItems[index][0] == id) { item = certItems.get(index); cItems[index][1]--; break; } } } - if (item != null) - { - if (!Util.contains(_certItemsByLevel[i], item.getId())) - { + if (item != null) { + if (!Util.contains(_certItemsByLevel[i], item.getId())) { Util.handleIllegalPlayerAction(player, "Invalid cert variable:" + qName + "=" + qValue + " - item found but does not match certificate level", IllegalActionPunishmentType.NONE); } - } - else - { + } else { Util.handleIllegalPlayerAction(player, "Invalid cert variable:" + qName + "=" + qValue + " - item not found", IllegalActionPunishmentType.NONE); } - } - else - { + } else { Util.handleIllegalPlayerAction(player, "Invalid cert variable:" + qName + "=" + qValue + " - no cert item found in inventory", IllegalActionPunishmentType.NONE); } - } - catch (NumberFormatException e) - { + } catch (NumberFormatException e) { Util.handleIllegalPlayerAction(player, "Invalid cert variable:" + qName + "=" + qValue + " - not a number", IllegalActionPunishmentType.NONE); } } } } - if ((certSkills != null) && (cSkills != null)) - { - for (int i = cSkills.length; --i >= 0;) - { - if (cSkills[i][1] == 0) - { + if ((certSkills != null) && (cSkills != null)) { + for (int i = cSkills.length; --i >= 0;) { + if (cSkills[i][1] == 0) { continue; } Skill skill = certSkills.get(i); - if (cSkills[i][1] > 0) - { - if (cSkills[i][1] == skill.getLevel()) - { + if (cSkills[i][1] > 0) { + if (cSkills[i][1] == skill.getLevel()) { Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " has invalid cert skill :" + skill.getName() + "(" + skill.getId() + "/" + skill.getLevel() + ")", IllegalActionPunishmentType.NONE); - } - else - { + } else { Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " has invalid cert skill :" + skill.getName() + "(" + skill.getId() + "/" + skill.getLevel() + "), level too high", IllegalActionPunishmentType.NONE); } - if (general().skillCheckRemove()) - { + if (general().skillCheckRemove()) { player.removeSkill(skill); } - } - else - { + } else { Util.handleIllegalPlayerAction(player, "Invalid cert skill :" + skill.getName() + "(" + skill.getId() + "/" + skill.getLevel() + "), level too low", IllegalActionPunishmentType.NONE); } } } - if ((certItems != null) && (cItems != null)) - { - for (int i = cItems.length; --i >= 0;) - { - if (cItems[i][1] == 0) - { + if ((certItems != null) && (cItems != null)) { + for (int i = cItems.length; --i >= 0;) { + if (cItems[i][1] == 0) { continue; } @@ -308,34 +252,27 @@ public final class SubClassSkills extends Quest return null; } - private List<Skill> getCertSkills(L2PcInstance player) - { + private List<Skill> getCertSkills(L2PcInstance player) { final List<Skill> tmp = new ArrayList<>(); - for (Skill s : player.getAllSkills()) - { - if ((s != null) && (Arrays.binarySearch(_allCertSkillIds, s.getId()) >= 0)) - { + for (Skill s : player.getAllSkills()) { + if ((s != null) && (Arrays.binarySearch(_allCertSkillIds, s.getId()) >= 0)) { tmp.add(s); } } return tmp; } - private List<L2ItemInstance> getCertItems(L2PcInstance player) - { + private List<L2ItemInstance> getCertItems(L2PcInstance player) { final List<L2ItemInstance> tmp = new ArrayList<>(); - for (L2ItemInstance i : player.getInventory().getItems()) - { - if ((i != null) && (Arrays.binarySearch(_allCertItemIds, i.getId()) >= 0)) - { + for (L2ItemInstance i : player.getInventory().getItems()) { + if ((i != null) && (Arrays.binarySearch(_allCertItemIds, i.getId()) >= 0)) { tmp.add(i); } } return tmp; } - public static void main(String[] args) - { + public static void main(String[] args) { new SubClassSkills(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/custom/events/Elpies/Elpies.java b/src/main/java/com/l2jserver/datapack/custom/events/Elpies/Elpies.java index c53de24791..cee57d606f 100644 --- a/src/main/java/com/l2jserver/datapack/custom/events/Elpies/Elpies.java +++ b/src/main/java/com/l2jserver/datapack/custom/events/Elpies/Elpies.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.quest.Event; import com.l2jserver.gameserver.util.Broadcast; -public final class Elpies extends Event -{ +public final class Elpies extends Event { // NPC private static final int ELPY = 900100; // Amount of Elpies to spawn when the event starts @@ -68,30 +67,25 @@ public final class Elpies extends Event private ScheduledFuture<?> _eventTask = null; private final Set<L2Npc> _elpies = ConcurrentHashMap.newKeySet(ELPY_AMOUNT); - private Elpies() - { + private Elpies() { super(Elpies.class.getSimpleName(), "custom/events"); addSpawnId(ELPY); addKillId(ELPY); } @Override - public boolean eventBypass(L2PcInstance activeChar, String bypass) - { + public boolean eventBypass(L2PcInstance activeChar, String bypass) { return false; } @Override - public boolean eventStart(L2PcInstance eventMaker) - { - if (EVENT_ACTIVE) - { + public boolean eventStart(L2PcInstance eventMaker) { + if (EVENT_ACTIVE) { return false; } // Check Custom Table - we use custom NPC's - if (!general().customNpcData()) - { + if (!general().customNpcData()) { _log.info(getName() + ": Event can't be started because custom NPC table is disabled!"); eventMaker.sendMessage("Event " + getName() + " can't be started because custom NPC table is disabled!"); return false; @@ -104,8 +98,7 @@ public final class Elpies extends Event long despawnDelay = EVENT_DURATION_MINUTES * 60000; - for (int i = 0; i < ELPY_AMOUNT; i++) - { + for (int i = 0; i < ELPY_AMOUNT; i++) { _elpies.add(addSpawn(ELPY, randomLoc.getRandomX(), randomLoc.getRandomY(), randomLoc.getZ(), 0, true, despawnDelay)); } @@ -114,8 +107,7 @@ public final class Elpies extends Event Broadcast.toAllOnlinePlayers("Help us exterminate them!"); Broadcast.toAllOnlinePlayers("You have " + EVENT_DURATION_MINUTES + " minutes!"); - _eventTask = ThreadPoolManager.getInstance().scheduleGeneral(() -> - { + _eventTask = ThreadPoolManager.getInstance().scheduleGeneral(() -> { Broadcast.toAllOnlinePlayers("Time is up!"); eventStop(); }, despawnDelay); @@ -123,23 +115,19 @@ public final class Elpies extends Event } @Override - public boolean eventStop() - { - if (!EVENT_ACTIVE) - { + public boolean eventStop() { + if (!EVENT_ACTIVE) { return false; } EVENT_ACTIVE = false; - if (_eventTask != null) - { + if (_eventTask != null) { _eventTask.cancel(true); _eventTask = null; } - for (L2Npc npc : _elpies) - { + for (L2Npc npc : _elpies) { npc.deleteMe(); } _elpies.clear(); @@ -150,17 +138,14 @@ public final class Elpies extends Event } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (EVENT_ACTIVE) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (EVENT_ACTIVE) { _elpies.remove(npc); dropItem(npc, killer, DROPLIST_CONSUMABLES); dropItem(npc, killer, DROPLIST_CRYSTALS); - if (_elpies.isEmpty()) - { + if (_elpies.isEmpty()) { Broadcast.toAllOnlinePlayers("All elpies have been killed!"); eventStop(); } @@ -170,15 +155,13 @@ public final class Elpies extends Event } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { ((L2EventMonsterInstance) npc).eventSetDropOnGround(true); ((L2EventMonsterInstance) npc).eventSetBlockOffensiveSkills(true); return super.onSpawn(npc); } - private static enum EventLocation - { + private static enum EventLocation { ADEN("Aden", 146558, 148341, 26622, 28560, -2200), DION("Dion", 18564, 19200, 144377, 145782, -3081), GLUDIN("Gludin", -84040, -81420, 150257, 151175, -3125), @@ -192,8 +175,7 @@ public final class Elpies extends Event private final int _maxY; private final int _z; - EventLocation(String name, int minX, int maxX, int minY, int maxY, int z) - { + EventLocation(String name, int minX, int maxX, int minY, int maxY, int z) { _name = name; _minX = minX; _maxX = maxX; @@ -202,43 +184,35 @@ public final class Elpies extends Event _z = z; } - public String getName() - { + public String getName() { return _name; } - public int getRandomX() - { + public int getRandomX() { return getRandom(_minX, _maxX); } - public int getRandomY() - { + public int getRandomY() { return getRandom(_minY, _maxY); } - public int getZ() - { + public int getZ() { return _z; } } - private static final void dropItem(L2Npc mob, L2PcInstance player, int[][] droplist) - { + private static final void dropItem(L2Npc mob, L2PcInstance player, int[][] droplist) { final int chance = getRandom(100); - for (int[] drop : droplist) - { - if (chance >= drop[1]) - { + for (int[] drop : droplist) { + if (chance >= drop[1]) { mob.dropItem(player, drop[0], getRandom(drop[2], drop[3])); break; } } } - public static void main(String[] args) - { + public static void main(String[] args) { new Elpies(); } } diff --git a/src/main/java/com/l2jserver/datapack/custom/events/Rabbits/Rabbits.java b/src/main/java/com/l2jserver/datapack/custom/events/Rabbits/Rabbits.java index 7f10d4d7a9..2e08a431d1 100644 --- a/src/main/java/com/l2jserver/datapack/custom/events/Rabbits/Rabbits.java +++ b/src/main/java/com/l2jserver/datapack/custom/events/Rabbits/Rabbits.java @@ -39,8 +39,7 @@ import com.l2jserver.gameserver.util.Util; * Chests are hidden at Fantasy Isle and players must use the Rabbit transformation's skills to find and open them. * @author Gnacik, Zoey76 */ -public final class Rabbits extends Event -{ +public final class Rabbits extends Event { // NPCs private static final int NPC_MANAGER = 900101; private static final int CHEST = 900102; @@ -77,8 +76,7 @@ public final class Rabbits extends Event }; // @formatter:on - private Rabbits() - { + private Rabbits() { super(Rabbits.class.getSimpleName(), "custom/events"); addFirstTalkId(NPC_MANAGER, CHEST); addTalkId(NPC_MANAGER); @@ -88,18 +86,15 @@ public final class Rabbits extends Event } @Override - public boolean eventStart(L2PcInstance eventMaker) - { + public boolean eventStart(L2PcInstance eventMaker) { // Don't start event if its active - if (_isActive) - { + if (_isActive) { eventMaker.sendMessage("Event " + getName() + " is already started!"); return false; } // Check starting conditions - if (!general().customNpcData()) - { + if (!general().customNpcData()) { _log.info(getName() + ": Event can't be started, because custom NPCs are disabled!"); eventMaker.sendMessage("Event " + getName() + " can't be started because custom NPCs are disabled!"); return false; @@ -111,8 +106,7 @@ public final class Rabbits extends Event // Spawn Manager recordSpawn(_npcs, NPC_MANAGER, -59227, -56939, -2039, 64106, false, 0); // Spawn Chests - for (int i = 0; i <= TOTAL_CHEST_COUNT; i++) - { + for (int i = 0; i <= TOTAL_CHEST_COUNT; i++) { recordSpawn(_npcs, CHEST, getRandom(-60653, -58772), getRandom(-55830, -58146), -2030, 0, false, EVENT_TIME * 60000); } @@ -127,11 +121,9 @@ public final class Rabbits extends Event } @Override - public boolean eventStop() - { + public boolean eventStop() { // Don't stop inactive event - if (!_isActive) - { + if (!_isActive) { return false; } @@ -142,16 +134,13 @@ public final class Rabbits extends Event cancelQuestTimers("END_RABBITS_EVENT"); // Despawn NPCs - for (L2Npc npc : _npcs) - { + for (L2Npc npc : _npcs) { npc.deleteMe(); } _npcs.clear(); - for (L2PcInstance player : _players) - { - if (player.getTransformationId() == TRANSFORMATION_ID) - { + for (L2PcInstance player : _players) { + if (player.getTransformationId() == TRANSFORMATION_ID) { player.untransform(); } } @@ -164,20 +153,15 @@ public final class Rabbits extends Event } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { - case "900101-1.htm": - { + switch (event) { + case "900101-1.htm": { htmltext = "900101-1.htm"; break; } - case "transform": - { - if (player.isTransformed() || player.isInStance()) - { + case "transform": { + if (player.isTransformed() || player.isInStance()) { player.untransform(); } @@ -185,8 +169,7 @@ public final class Rabbits extends Event _players.add(player); break; } - case "END_RABBITS_EVENT": - { + case "END_RABBITS_EVENT": { Broadcast.toAllOnlinePlayers("Rabbits Event: Time up!"); eventStop(); break; @@ -196,33 +179,25 @@ public final class Rabbits extends Event } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return npc.getId() + ".htm"; } @Override - public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) - { - if (skill.getId() == RABBIT_TORNADO.getSkillId()) - { - if (!npc.isInvisible() && Util.contains(targets, npc)) - { + public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) { + if (skill.getId() == RABBIT_TORNADO.getSkillId()) { + if (!npc.isInvisible() && Util.contains(targets, npc)) { dropItem(npc, caster, DROPLIST); npc.deleteMe(); _npcs.remove(npc); - if (_npcs.isEmpty()) - { + if (_npcs.isEmpty()) { Broadcast.toAllOnlinePlayers("Rabbits Event: No more chests..."); eventStop(); } } - } - else if (skill.getId() == RABBIT_MAGIC_EYE.getSkillId()) - { - if (npc.isInvisible() && npc.isInsideRadius(caster, skill.getAffectRange(), false, false)) - { + } else if (skill.getId() == RABBIT_MAGIC_EYE.getSkillId()) { + if (npc.isInvisible() && npc.isInsideRadius(caster, skill.getAffectRange(), false, false)) { npc.setInvisible(false); } } @@ -230,33 +205,26 @@ public final class Rabbits extends Event } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) - { - if (_isActive && ((skill == null) || (skill.getId() != RABBIT_TORNADO.getSkillId()))) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) { + if (_isActive && ((skill == null) || (skill.getId() != RABBIT_TORNADO.getSkillId()))) { RAID_CURSE.getSkill().applyEffects(npc, attacker); } return super.onAttack(npc, attacker, damage, isSummon); } - private static void dropItem(L2Npc npc, L2PcInstance player, int[][] droplist) - { + private static void dropItem(L2Npc npc, L2PcInstance player, int[][] droplist) { final int chance = getRandom(100); - for (int[] drop : droplist) - { - if (chance > drop[1]) - { + for (int[] drop : droplist) { + if (chance > drop[1]) { npc.dropItem(player, drop[0], getRandom(drop[2], drop[3])); return; } } } - private static void recordSpawn(Set<L2Npc> npcs, int npcId, int x, int y, int z, int heading, boolean randomOffSet, long despawnDelay) - { + private static void recordSpawn(Set<L2Npc> npcs, int npcId, int x, int y, int z, int heading, boolean randomOffSet, long despawnDelay) { final L2Npc npc = addSpawn(npcId, x, y, z, heading, randomOffSet, despawnDelay); - if (npc.getId() == CHEST) - { + if (npc.getId() == CHEST) { npc.setIsImmobilized(true); npc.disableCoreAI(true); npc.setInvisible(true); @@ -265,13 +233,11 @@ public final class Rabbits extends Event } @Override - public boolean eventBypass(L2PcInstance activeChar, String bypass) - { + public boolean eventBypass(L2PcInstance activeChar, String bypass) { return false; } - public static void main(String[] args) - { + public static void main(String[] args) { new Rabbits(); } } diff --git a/src/main/java/com/l2jserver/datapack/custom/events/Race/Race.java b/src/main/java/com/l2jserver/datapack/custom/events/Race/Race.java index 7f35f22cd7..41f907e7ab 100644 --- a/src/main/java/com/l2jserver/datapack/custom/events/Race/Race.java +++ b/src/main/java/com/l2jserver/datapack/custom/events/Race/Race.java @@ -162,8 +162,7 @@ public final class Race extends Event { sendMessage(player, "Race started! Go find Finish NPC as fast as you can... He is located near " + LOCATIONS[location]); transformPlayer(player); player.getRadar().addMarker(_randspawn[0], _randspawn[1], _randspawn[2]); - } - else { + } else { sendMessage(player, "I told you stay near me right? Distance was too high, you are excluded from race"); _players.remove(player); } @@ -214,26 +213,22 @@ public final class Race extends Event { if (bypass.startsWith("skill")) { if (_isRaceStarted) { activeChar.sendMessage("Race already started, you cannot change transform skill now"); - } - else { + } else { int _number = Integer.valueOf(bypass.substring(5)); Skill _sk = SkillData.getInstance().getSkill(_number, 1); if (_sk != null) { _skill = _number; activeChar.sendMessage("Transform skill set to:"); activeChar.sendMessage(_sk.getName()); - } - else { + } else { activeChar.sendMessage("Error while changing transform skill"); } } - } - else if (bypass.startsWith("tele")) { + } else if (bypass.startsWith("tele")) { if ((Integer.valueOf(bypass.substring(4)) > 0) && (_randspawn != null)) { activeChar.teleToLocation(_randspawn[0], _randspawn[1], _randspawn[2]); - } - else { + } else { activeChar.teleToLocation(18429, 145861, -3090); } } @@ -252,30 +247,25 @@ public final class Race extends Event { if (event.equalsIgnoreCase("transform")) { transformPlayer(player); return null; - } - else if (event.equalsIgnoreCase("untransform")) { + } else if (event.equalsIgnoreCase("untransform")) { player.untransform(); return null; - } - else if (event.equalsIgnoreCase("showfinish")) { + } else if (event.equalsIgnoreCase("showfinish")) { player.getRadar().addMarker(_randspawn[0], _randspawn[1], _randspawn[2]); return null; - } - else if (event.equalsIgnoreCase("signup")) { + } else if (event.equalsIgnoreCase("signup")) { if (_players.contains(player)) { return "900103-onlist.htm"; } _players.add(player); return "900103-signup.htm"; - } - else if (event.equalsIgnoreCase("quit")) { + } else if (event.equalsIgnoreCase("quit")) { player.untransform(); if (_players.contains(player)) { _players.remove(player); } return "900103-quit.htm"; - } - else if (event.equalsIgnoreCase("finish")) { + } else if (event.equalsIgnoreCase("finish")) { if (player.isAffectedBySkill(_skill)) { winRace(player); return "900104-winner.htm"; @@ -294,8 +284,7 @@ public final class Race extends Event { return START_NPC + "-started-" + isRacing(player) + ".htm"; } return START_NPC + "-" + isRacing(player) + ".htm"; - } - else if ((npc.getId() == STOP_NPC) && _isRaceStarted) { + } else if ((npc.getId() == STOP_NPC) && _isRaceStarted) { return STOP_NPC + "-" + isRacing(player) + ".htm"; } return npc.getId() + ".htm"; diff --git a/src/main/java/com/l2jserver/datapack/custom/events/TvT/TvTManager/TvTManager.java b/src/main/java/com/l2jserver/datapack/custom/events/TvT/TvTManager/TvTManager.java index 9aa6d5d3e3..16d53022a6 100644 --- a/src/main/java/com/l2jserver/datapack/custom/events/TvT/TvTManager/TvTManager.java +++ b/src/main/java/com/l2jserver/datapack/custom/events/TvT/TvTManager/TvTManager.java @@ -34,96 +34,68 @@ import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; * TvT Manager AI. * @author Zoey76 */ -public final class TvTManager extends AbstractNpcAI implements IVoicedCommandHandler -{ +public final class TvTManager extends AbstractNpcAI implements IVoicedCommandHandler { private static final int MANAGER_ID = 70010; - private static final String[] COMMANDS = - { + private static final String[] COMMANDS = { "tvt", "tvtjoin", "tvtleave" }; - public TvTManager() - { + public TvTManager() { super(TvTManager.class.getSimpleName(), "custom/events/TvT"); addFirstTalkId(MANAGER_ID); addTalkId(MANAGER_ID); addStartNpc(MANAGER_ID); - if (tvt().allowVoicedInfoCommand()) - { + if (tvt().allowVoicedInfoCommand()) { VoicedCommandHandler.getInstance().registerHandler(this); } } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if ((player == null) || !TvTEvent.isParticipating()) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if ((player == null) || !TvTEvent.isParticipating()) { return super.onAdvEvent(event, npc, player); } String htmltext = null; - switch (event) - { - case "join": - { + switch (event) { + case "join": { int playerLevel = player.getLevel(); final int team1Count = TvTEvent.getTeamsPlayerCounts()[0]; final int team2Count = TvTEvent.getTeamsPlayerCounts()[1]; - if (player.isCursedWeaponEquipped()) - { + if (player.isCursedWeaponEquipped()) { htmltext = getHtm(player.getHtmlPrefix(), "CursedWeaponEquipped.html"); - } - else if (OlympiadManager.getInstance().isRegistered(player)) - { + } else if (OlympiadManager.getInstance().isRegistered(player)) { htmltext = getHtm(player.getHtmlPrefix(), "Olympiad.html"); - } - else if (player.getKarma() > 0) - { + } else if (player.getKarma() > 0) { htmltext = getHtm(player.getHtmlPrefix(), "Karma.html"); - } - else if ((playerLevel < tvt().getMinPlayerLevel()) || (playerLevel > tvt().getMaxPlayerLevel())) - { + } else if ((playerLevel < tvt().getMinPlayerLevel()) || (playerLevel > tvt().getMaxPlayerLevel())) { htmltext = getHtm(player.getHtmlPrefix(), "Level.html"); htmltext = htmltext.replaceAll("%min%", String.valueOf(tvt().getMinPlayerLevel())); htmltext = htmltext.replaceAll("%max%", String.valueOf(tvt().getMaxPlayerLevel())); - } - else if ((team1Count == tvt().getMaxPlayersInTeams()) && (team2Count == tvt().getMaxPlayersInTeams())) - { + } else if ((team1Count == tvt().getMaxPlayersInTeams()) && (team2Count == tvt().getMaxPlayersInTeams())) { htmltext = getHtm(player.getHtmlPrefix(), "TeamsFull.html"); htmltext = htmltext.replaceAll("%max%", String.valueOf(tvt().getMaxPlayersInTeams())); - } - else if ((tvt().getMaxParticipantsPerIP() > 0) && !AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.TVT_ID, player, tvt().getMaxParticipantsPerIP())) - { + } else if ((tvt().getMaxParticipantsPerIP() > 0) && !AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.TVT_ID, player, tvt().getMaxParticipantsPerIP())) { htmltext = getHtm(player.getHtmlPrefix(), "IPRestriction.html"); htmltext = htmltext.replaceAll("%max%", String.valueOf(AntiFeedManager.getInstance().getLimit(player, tvt().getMaxParticipantsPerIP()))); - } - else if (TvTEvent.needParticipationFee() && !TvTEvent.hasParticipationFee(player)) - { + } else if (TvTEvent.needParticipationFee() && !TvTEvent.hasParticipationFee(player)) { htmltext = getHtm(player.getHtmlPrefix(), "ParticipationFee.html"); htmltext = htmltext.replaceAll("%fee%", TvTEvent.getParticipationFee()); - } - else if (TvTEvent.addParticipant(player)) - { + } else if (TvTEvent.addParticipant(player)) { htmltext = getHtm(player.getHtmlPrefix(), "Registered.html"); } break; } - case "remove": - { - if (TvTEvent.removeParticipant(player.getObjectId())) - { - if (tvt().getMaxParticipantsPerIP() > 0) - { + case "remove": { + if (TvTEvent.removeParticipant(player.getObjectId())) { + if (tvt().getMaxParticipantsPerIP() > 0) { AntiFeedManager.getInstance().removePlayer(AntiFeedManager.TVT_ID, player); } htmltext = getHtm(player.getHtmlPrefix(), "Unregistered.html"); - } - else - { + } else { player.sendMessage("You cannot unregister to this event."); } break; @@ -133,11 +105,9 @@ public final class TvTManager extends AbstractNpcAI implements IVoicedCommandHan } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; - if (TvTEvent.isParticipating()) - { + if (TvTEvent.isParticipating()) { final boolean isParticipant = TvTEvent.isPlayerParticipant(player.getObjectId()); int[] teamsPlayerCounts = TvTEvent.getTeamsPlayerCounts(); htmltext = getHtm(player.getHtmlPrefix(), (!isParticipant ? "Participation.html" : "RemoveParticipation.html")); @@ -148,57 +118,44 @@ public final class TvTManager extends AbstractNpcAI implements IVoicedCommandHan htmltext = htmltext.replaceAll("%team2playercount%", String.valueOf(teamsPlayerCounts[1])); htmltext = htmltext.replaceAll("%playercount%", String.valueOf(teamsPlayerCounts[0] + teamsPlayerCounts[1])); - if (!isParticipant) - { + if (!isParticipant) { htmltext = htmltext.replaceAll("%fee%", TvTEvent.getParticipationFee()); } - } - else if (TvTEvent.isStarting() || TvTEvent.isStarted()) - { + } else if (TvTEvent.isStarting() || TvTEvent.isStarted()) { htmltext = getTvTStatus(player); } return htmltext; } @Override - public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) - { + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) { String html = null; - switch (command) - { - case "tvt": - { - if (TvTEvent.isStarting() || TvTEvent.isStarted()) - { + switch (command) { + case "tvt": { + if (TvTEvent.isStarting() || TvTEvent.isStarted()) { html = getTvTStatus(activeChar); - } - else - { + } else { html = "The event has not started."; } break; } - case "tvtjoin": - { + case "tvtjoin": { html = onAdvEvent("join", null, activeChar); break; } - case "tvtleave": - { + case "tvtleave": { html = onAdvEvent("remove", null, activeChar); break; } } - if (html != null) - { + if (html != null) { activeChar.sendPacket(new NpcHtmlMessage(html)); } return true; } - private String getTvTStatus(L2PcInstance player) - { + private String getTvTStatus(L2PcInstance player) { int[] teamsPlayerCounts = TvTEvent.getTeamsPlayerCounts(); int[] teamsPointsCounts = TvTEvent.getTeamsPoints(); String htmltext = getHtm(player.getHtmlPrefix(), "Status.html"); @@ -212,13 +169,11 @@ public final class TvTManager extends AbstractNpcAI implements IVoicedCommandHan } @Override - public String[] getVoicedCommandList() - { + public String[] getVoicedCommandList() { return COMMANDS; } - public static void main(String[] args) - { + public static void main(String[] args) { new TvTManager(); } } diff --git a/src/main/java/com/l2jserver/datapack/custom/events/Wedding/Wedding.java b/src/main/java/com/l2jserver/datapack/custom/events/Wedding/Wedding.java index 9faf304a73..6400df9bdb 100644 --- a/src/main/java/com/l2jserver/datapack/custom/events/Wedding/Wedding.java +++ b/src/main/java/com/l2jserver/datapack/custom/events/Wedding/Wedding.java @@ -37,15 +37,13 @@ import com.l2jserver.gameserver.util.Broadcast; * Wedding AI. * @author Zoey76 */ -public final class Wedding extends AbstractNpcAI -{ +public final class Wedding extends AbstractNpcAI { // NPC private static final int MANAGER_ID = 50007; // Item private static final int FORMAL_WEAR = 6408; - public Wedding() - { + public Wedding() { super(Wedding.class.getSimpleName(), "custom/events"); addFirstTalkId(MANAGER_ID); addTalkId(MANAGER_ID); @@ -53,38 +51,29 @@ public final class Wedding extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (player.getPartnerId() == 0) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (player.getPartnerId() == 0) { return "NoPartner.html"; } final L2PcInstance partner = L2World.getInstance().getPlayer(player.getPartnerId()); - if ((partner == null) || !partner.isOnline()) - { + if ((partner == null) || !partner.isOnline()) { return "NotFound.html"; } - if (player.isMarried()) - { + if (player.isMarried()) { return "Already.html"; } - if (player.isMarryAccepted()) - { + if (player.isMarryAccepted()) { return "WaitForPartner.html"; } String htmltext = null; - if (player.isMarryRequest()) - { - if (!isWearingFormalWear(player) || !isWearingFormalWear(partner)) - { + if (player.isMarryRequest()) { + if (!isWearingFormalWear(player) || !isWearingFormalWear(partner)) { htmltext = sendHtml(partner, "NoFormal.html", null, null); - } - else - { + } else { player.setMarryRequest(false); partner.setMarryRequest(false); htmltext = getHtm(player.getHtmlPrefix(), "Ask.html"); @@ -93,16 +82,11 @@ public final class Wedding extends AbstractNpcAI return htmltext; } - switch (event) - { - case "ask": - { - if (!isWearingFormalWear(player) || !isWearingFormalWear(partner)) - { + switch (event) { + case "ask": { + if (!isWearingFormalWear(player) || !isWearingFormalWear(partner)) { htmltext = sendHtml(partner, "NoFormal.html", null, null); - } - else - { + } else { player.setMarryAccepted(true); partner.setMarryRequest(true); @@ -113,18 +97,12 @@ public final class Wedding extends AbstractNpcAI } break; } - case "accept": - { - if (!isWearingFormalWear(player) || !isWearingFormalWear(partner)) - { + case "accept": { + if (!isWearingFormalWear(player) || !isWearingFormalWear(partner)) { htmltext = sendHtml(partner, "NoFormal.html", null, null); - } - else if ((player.getAdena() < customs().getWeddingPrice()) || (partner.getAdena() < customs().getWeddingPrice())) - { + } else if ((player.getAdena() < customs().getWeddingPrice()) || (partner.getAdena() < customs().getWeddingPrice())) { htmltext = sendHtml(partner, "Adena.html", "%fee%", String.valueOf(customs().getWeddingPrice())); - } - else - { + } else { player.reduceAdena("Wedding", customs().getWeddingPrice(), player.getLastFolkNPC(), true); partner.reduceAdena("Wedding", customs().getWeddingPrice(), player.getLastFolkNPC(), true); @@ -147,8 +125,7 @@ public final class Wedding extends AbstractNpcAI // Fireworks Skill skill = CommonSkill.LARGE_FIREWORK.getSkill(); - if (skill != null) - { + if (skill != null) { player.doCast(skill); partner.doCast(skill); } @@ -159,8 +136,7 @@ public final class Wedding extends AbstractNpcAI } break; } - case "decline": - { + case "decline": { player.setMarryRequest(false); partner.setMarryRequest(false); player.setMarryAccepted(false); @@ -177,35 +153,29 @@ public final class Wedding extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { final String htmltext = getHtm(player.getHtmlPrefix(), "Start.html"); return htmltext.replaceAll("%fee%", String.valueOf(customs().getWeddingPrice())); } - private String sendHtml(L2PcInstance player, String fileName, String regex, String replacement) - { + private String sendHtml(L2PcInstance player, String fileName, String regex, String replacement) { String html = getHtm(player.getHtmlPrefix(), fileName); - if ((regex != null) && (replacement != null)) - { + if ((regex != null) && (replacement != null)) { html = html.replaceAll(regex, replacement); } player.sendPacket(new NpcHtmlMessage(html)); return html; } - private static boolean isWearingFormalWear(L2PcInstance player) - { - if (customs().weddingFormalWear()) - { + private static boolean isWearingFormalWear(L2PcInstance player) { + if (customs().weddingFormalWear()) { final L2ItemInstance formalWear = player.getChestArmorInstance(); return (formalWear != null) && (formalWear.getId() == FORMAL_WEAR); } return true; } - public static void main(String[] args) - { + public static void main(String[] args) { new Wedding(); } } diff --git a/src/main/java/com/l2jserver/datapack/custom/listeners/ListenerTest.java b/src/main/java/com/l2jserver/datapack/custom/listeners/ListenerTest.java index 3af4421f52..4480f62df4 100644 --- a/src/main/java/com/l2jserver/datapack/custom/listeners/ListenerTest.java +++ b/src/main/java/com/l2jserver/datapack/custom/listeners/ListenerTest.java @@ -45,16 +45,13 @@ import com.l2jserver.gameserver.model.holders.ItemHolder; * An example usage of Listeners. * @author UnAfraid */ -public class ListenerTest extends AbstractNpcAI -{ - private static final int[] ELPIES = - { +public class ListenerTest extends AbstractNpcAI { + private static final int[] ELPIES = { 20432, 22228 }; - private ListenerTest() - { + private ListenerTest() { super(ListenerTest.class.getSimpleName(), "ai/npc"); // Method preset listener registration @@ -62,8 +59,7 @@ public class ListenerTest extends AbstractNpcAI setAttackableAttackId(this::onAttackableAttack, ELPIES); // Manual listener registration - Containers.Global().addListener(new ConsumerEventListener(Containers.Global(), EventType.ON_PLAYER_DLG_ANSWER, (OnPlayerDlgAnswer event) -> - { + Containers.Global().addListener(new ConsumerEventListener(Containers.Global(), EventType.ON_PLAYER_DLG_ANSWER, (OnPlayerDlgAnswer event) -> { _log.log(Level.INFO, ListenerTest.class.getSimpleName() + ": " + event.getActiveChar() + " OnPlayerDlgAnswer: Answer: " + event.getAnswer() + " MessageId: " + event.getMessageId()); }, this)); } @@ -72,8 +68,7 @@ public class ListenerTest extends AbstractNpcAI * This method will be invoked as soon as an L2Attackable (Rabbits 20432 and 22228) is being attacked from L2PcInstance (a player) * @param event */ - public void onAttackableAttack(OnAttackableAttack event) - { + public void onAttackableAttack(OnAttackableAttack event) { _log.log(Level.INFO, getClass().getSimpleName() + ": " + event.getClass().getSimpleName() + " invoked attacker: " + event.getAttacker() + " target: " + event.getTarget() + " damage: " + event.getDamage() + " skill: " + event.getSkill()); } @@ -87,8 +82,7 @@ public class ListenerTest extends AbstractNpcAI @RegisterType(ListenerRegisterType.NPC) @Id(20432) @Id(22228) - public void onCreatureKill(OnCreatureKill event) - { + public void onCreatureKill(OnCreatureKill event) { _log.log(Level.INFO, getClass().getSimpleName() + ": " + event.getClass().getSimpleName() + " invoked attacker: " + event.getAttacker() + " target: " + event.getTarget()); } @@ -100,8 +94,7 @@ public class ListenerTest extends AbstractNpcAI @RegisterEvent(EventType.ON_CASTLE_SIEGE_START) @RegisterType(ListenerRegisterType.CASTLE) @Range(from = 1, to = 9) - public void onSiegeStart(OnCastleSiegeStart event) - { + public void onSiegeStart(OnCastleSiegeStart event) { _log.log(Level.INFO, getClass().getSimpleName() + ": The siege of " + event.getSiege().getCastle().getName() + " (" + event.getSiege().getCastle().getResidenceId() + ") has started!"); } @@ -113,8 +106,7 @@ public class ListenerTest extends AbstractNpcAI @RegisterEvent(EventType.ON_ITEM_CREATE) @RegisterType(ListenerRegisterType.ITEM) @Id(5575) - public void onItemCreate(OnItemCreate event) - { + public void onItemCreate(OnItemCreate event) { _log.log(Level.INFO, getClass().getSimpleName() + ": Item [" + event.getItem() + "] has been created actor: " + event.getActiveChar() + " process: " + event.getProcess() + " reference: " + event.getReference()); } @@ -128,17 +120,14 @@ public class ListenerTest extends AbstractNpcAI @RegisterType(ListenerRegisterType.NPC) @NpcLevelRange(from = 1, to = 10) @Priority(100) - public void OnCreatureKill(OnCreatureKill event) - { + public void OnCreatureKill(OnCreatureKill event) { // 70% chance to drop - if (getRandom(100) >= 70) - { + if (getRandom(100) >= 70) { return; } // Make sure a player killed this monster. - if ((event.getAttacker() != null) && event.getAttacker().isPlayable() && event.getTarget().isAttackable()) - { + if ((event.getAttacker() != null) && event.getAttacker().isPlayable() && event.getTarget().isAttackable()) { final L2Attackable monster = (L2Attackable) event.getTarget(); monster.dropItem(event.getAttacker().getActingPlayer(), new ItemHolder(57, getRandom(100, 1000))); } @@ -151,8 +140,7 @@ public class ListenerTest extends AbstractNpcAI */ @RegisterEvent(EventType.ON_PLAYER_LOGIN) @RegisterType(ListenerRegisterType.GLOBAL_PLAYERS) - public void onPlayerLogin(OnPlayerLogin event) - { + public void onPlayerLogin(OnPlayerLogin event) { _log.log(Level.INFO, getClass().getSimpleName() + ": Player: " + event.getActiveChar() + " has logged in!"); } @@ -167,18 +155,15 @@ public class ListenerTest extends AbstractNpcAI @RegisterEvent(EventType.ON_CREATURE_KILL) @RegisterType(ListenerRegisterType.GLOBAL_PLAYERS) @Priority(Integer.MAX_VALUE) - public TerminateReturn onPlayerDeath(OnCreatureKill event) - { - if (event.getTarget().isGM()) - { + public TerminateReturn onPlayerDeath(OnCreatureKill event) { + if (event.getTarget().isGM()) { _log.log(Level.INFO, getClass().getSimpleName() + ": Player: " + event.getTarget() + " was prevented from dying!"); return new TerminateReturn(true, true, true); } return null; } - public static void main(String[] args) - { + public static void main(String[] args) { new ListenerTest(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/events/CharacterBirthday/CharacterBirthday.java b/src/main/java/com/l2jserver/datapack/events/CharacterBirthday/CharacterBirthday.java index 374f87ad3f..d10a34a14d 100644 --- a/src/main/java/com/l2jserver/datapack/events/CharacterBirthday/CharacterBirthday.java +++ b/src/main/java/com/l2jserver/datapack/events/CharacterBirthday/CharacterBirthday.java @@ -28,13 +28,11 @@ import com.l2jserver.gameserver.util.Util; * Updated to H5 by Nyaran. * @author Gnacik */ -public final class CharacterBirthday extends Quest -{ +public final class CharacterBirthday extends Quest { private static final int ALEGRIA = 32600; private static int SPAWNS = 0; - private final static int[] GK = - { + private final static int[] GK = { 30006, 30059, 30080, @@ -56,8 +54,7 @@ public final class CharacterBirthday extends Quest 32163 }; - private CharacterBirthday() - { + private CharacterBirthday() { super(-1, CharacterBirthday.class.getSimpleName(), "events"); addStartNpc(ALEGRIA); addStartNpc(GK); @@ -66,30 +63,23 @@ public final class CharacterBirthday extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; - if (event.equalsIgnoreCase("despawn_npc")) - { + if (event.equalsIgnoreCase("despawn_npc")) { npc.doDie(player); SPAWNS--; htmltext = null; - } - else if (event.equalsIgnoreCase("change")) - { + } else if (event.equalsIgnoreCase("change")) { // Change Hat - if (hasQuestItems(player, 10250)) - { + if (hasQuestItems(player, 10250)) { takeItems(player, 10250, 1); // Adventurer Hat (Event) giveItems(player, 21594, 1); // Birthday Hat htmltext = null; // FIXME: Probably has html // Despawn npc npc.doDie(player); SPAWNS--; - } - else - { + } else { htmltext = "32600-nohat.htm"; } } @@ -97,28 +87,22 @@ public final class CharacterBirthday extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { - if (SPAWNS >= 3) - { + public String onTalk(L2Npc npc, L2PcInstance player) { + if (SPAWNS >= 3) { return "busy.htm"; } - if (!Util.checkIfInRange(10, npc, player, true)) - { + if (!Util.checkIfInRange(10, npc, player, true)) { L2Npc spawned = addSpawn(32600, player.getX() + 10, player.getY() + 10, player.getZ() + 10, 0, false, 0, true); startQuestTimer("despawn_npc", 180000, spawned, player); SPAWNS++; - } - else - { + } else { return "tooclose.htm"; } return null; } - public static void main(String[] args) - { + public static void main(String[] args) { new CharacterBirthday(); } } diff --git a/src/main/java/com/l2jserver/datapack/events/FreyaCelebration/FreyaCelebration.java b/src/main/java/com/l2jserver/datapack/events/FreyaCelebration/FreyaCelebration.java index 60f99b1f01..e47d21f3d3 100644 --- a/src/main/java/com/l2jserver/datapack/events/FreyaCelebration/FreyaCelebration.java +++ b/src/main/java/com/l2jserver/datapack/events/FreyaCelebration/FreyaCelebration.java @@ -35,8 +35,7 @@ import com.l2jserver.gameserver.util.Util; * Freya Celebration event AI. * @author Gnacik */ -public final class FreyaCelebration extends LongTimeEvent -{ +public final class FreyaCelebration extends LongTimeEvent { // NPC private static final int FREYA = 13296; // Items @@ -45,8 +44,7 @@ public final class FreyaCelebration extends LongTimeEvent // Misc private static final int HOURS = 20; - private static final int[] SKILLS = - { + private static final int[] SKILLS = { 9150, 9151, 9152, @@ -56,8 +54,7 @@ public final class FreyaCelebration extends LongTimeEvent 9156 }; - private static final NpcStringId[] FREYA_TEXT = - { + private static final NpcStringId[] FREYA_TEXT = { NpcStringId.EVEN_THOUGH_YOU_BRING_SOMETHING_CALLED_A_GIFT_AMONG_YOUR_HUMANS_IT_WOULD_JUST_BE_PROBLEMATIC_FOR_ME, NpcStringId.I_JUST_DONT_KNOW_WHAT_EXPRESSION_I_SHOULD_HAVE_IT_APPEARED_ON_ME_ARE_HUMANS_EMOTIONS_LIKE_THIS_FEELING, NpcStringId.THE_FEELING_OF_THANKS_IS_JUST_TOO_MUCH_DISTANT_MEMORY_FOR_ME, @@ -65,8 +62,7 @@ public final class FreyaCelebration extends LongTimeEvent NpcStringId.I_AM_ICE_QUEEN_FREYA_THIS_FEELING_AND_EMOTION_ARE_NOTHING_BUT_A_PART_OF_MELISSAA_MEMORIES }; - private FreyaCelebration() - { + private FreyaCelebration() { super(FreyaCelebration.class.getSimpleName(), "events"); addStartNpc(FREYA); addFirstTalkId(FREYA); @@ -75,24 +71,18 @@ public final class FreyaCelebration extends LongTimeEvent } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equalsIgnoreCase("give_potion")) - { - if (getQuestItemsCount(player, Inventory.ADENA_ID) > 1) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equalsIgnoreCase("give_potion")) { + if (getQuestItemsCount(player, Inventory.ADENA_ID) > 1) { long _curr_time = System.currentTimeMillis(); String value = loadGlobalQuestVar(player.getAccountName()); long _reuse_time = value == "" ? 0 : Long.parseLong(value); - if (_curr_time > _reuse_time) - { + if (_curr_time > _reuse_time) { takeItems(player, Inventory.ADENA_ID, 1); giveItems(player, FREYA_POTION, 1); saveGlobalQuestVar(player.getAccountName(), Long.toString(System.currentTimeMillis() + (HOURS * 3600000))); - } - else - { + } else { long remainingTime = (_reuse_time - System.currentTimeMillis()) / 1000; int hours = (int) (remainingTime / 3600); int minutes = (int) ((remainingTime % 3600) / 60); @@ -102,9 +92,7 @@ public final class FreyaCelebration extends LongTimeEvent sm.addInt(minutes); player.sendPacket(sm); } - } - else - { + } else { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S2_UNIT_OF_THE_ITEM_S1_REQUIRED); sm.addItemName(Inventory.ADENA_ID); sm.addInt(1); @@ -115,28 +103,21 @@ public final class FreyaCelebration extends LongTimeEvent } @Override - public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) - { - if ((caster == null) || (npc == null)) - { + public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) { + if ((caster == null) || (npc == null)) { return null; } - if ((npc.getId() == FREYA) && Util.contains(targets, npc) && Util.contains(SKILLS, skill.getId())) - { - if (getRandom(100) < 5) - { + if ((npc.getId() == FREYA) && Util.contains(targets, npc) && Util.contains(SKILLS, skill.getId())) { + if (getRandom(100) < 5) { CreatureSay cs = new CreatureSay(npc.getObjectId(), Say2.NPC_ALL, npc.getName(), NpcStringId.DEAR_S1_THINK_OF_THIS_AS_MY_APPRECIATION_FOR_THE_GIFT_TAKE_THIS_WITH_YOU_THERES_NOTHING_STRANGE_ABOUT_IT_ITS_JUST_A_BIT_OF_MY_CAPRICIOUSNESS); cs.addStringParameter(caster.getName()); npc.broadcastPacket(cs); caster.addItem("FreyaCelebration", FREYA_GIFT, 1, npc, true); - } - else - { - if (getRandom(10) < 2) - { + } else { + if (getRandom(10) < 2) { npc.broadcastPacket(new CreatureSay(npc.getObjectId(), Say2.NPC_ALL, npc.getName(), FREYA_TEXT[getRandom(FREYA_TEXT.length - 1)])); } } @@ -145,13 +126,11 @@ public final class FreyaCelebration extends LongTimeEvent } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return "13296.htm"; } - public static void main(String[] args) - { + public static void main(String[] args) { new FreyaCelebration(); } } diff --git a/src/main/java/com/l2jserver/datapack/events/GiftOfVitality/GiftOfVitality.java b/src/main/java/com/l2jserver/datapack/events/GiftOfVitality/GiftOfVitality.java index 913a245a59..a932f0a425 100644 --- a/src/main/java/com/l2jserver/datapack/events/GiftOfVitality/GiftOfVitality.java +++ b/src/main/java/com/l2jserver/datapack/events/GiftOfVitality/GiftOfVitality.java @@ -29,16 +29,14 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Gift of Vitality event AI. * @author Gnacik, Adry_85 */ -public final class GiftOfVitality extends LongTimeEvent -{ +public final class GiftOfVitality extends LongTimeEvent { // NPC private static final int STEVE_SHYAGEL = 4306; // Skills private static final SkillHolder GIFT_OF_VITALITY = new SkillHolder(23179, 1); private static final SkillHolder JOY_OF_VITALITY = new SkillHolder(23180, 1); - private static SkillHolder[] FIGHTER_SKILLS = - { + private static SkillHolder[] FIGHTER_SKILLS = { new SkillHolder(5627), // Wind Walk new SkillHolder(5628), // Shield new SkillHolder(5637), // Magic Barrier @@ -48,8 +46,7 @@ public final class GiftOfVitality extends LongTimeEvent new SkillHolder(5632), // Haste }; - private static SkillHolder[] MAGE_SKILLS = - { + private static SkillHolder[] MAGE_SKILLS = { new SkillHolder(5627), // Wind Walk new SkillHolder(5628), // Shield new SkillHolder(5637), // Magic Barrier @@ -59,8 +56,7 @@ public final class GiftOfVitality extends LongTimeEvent new SkillHolder(5636), // Empower }; - private static SkillHolder[] SERVITOR_SKILLS = - { + private static SkillHolder[] SERVITOR_SKILLS = { new SkillHolder(5627), // Wind Walk new SkillHolder(5628), // Shield new SkillHolder(5637), // Magic Barrier @@ -79,8 +75,7 @@ public final class GiftOfVitality extends LongTimeEvent private static final int MIN_LEVEL = 75; private static final String REUSE = GiftOfVitality.class.getSimpleName() + "_reuse"; - private GiftOfVitality() - { + private GiftOfVitality() { super(GiftOfVitality.class.getSimpleName(), "events"); addStartNpc(STEVE_SHYAGEL); addFirstTalkId(STEVE_SHYAGEL); @@ -88,16 +83,12 @@ public final class GiftOfVitality extends LongTimeEvent } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; - switch (event) - { - case "vitality": - { + switch (event) { + case "vitality": { final long reuse = player.getVariables().getLong(REUSE, 0); - if (reuse > System.currentTimeMillis()) - { + if (reuse > System.currentTimeMillis()) { long remainingTime = (reuse - System.currentTimeMillis()) / 1000; int hours = (int) (remainingTime / 3600); int minutes = (int) ((remainingTime % 3600) / 60); @@ -107,9 +98,7 @@ public final class GiftOfVitality extends LongTimeEvent sm.addInt(minutes); player.sendPacket(sm); htmltext = "4306-notime.htm"; - } - else - { + } else { player.doCast(GIFT_OF_VITALITY); player.doSimultaneousCast(JOY_OF_VITALITY); player.getVariables().set(REUSE, System.currentTimeMillis() + (HOURS * 3600000)); @@ -117,39 +106,27 @@ public final class GiftOfVitality extends LongTimeEvent } break; } - case "memories_player": - { - if (player.getLevel() <= MIN_LEVEL) - { + case "memories_player": { + if (player.getLevel() <= MIN_LEVEL) { htmltext = "4306-nolevel.htm"; - } - else - { + } else { final SkillHolder[] skills = (player.isMageClass()) ? MAGE_SKILLS : FIGHTER_SKILLS; npc.setTarget(player); - for (SkillHolder sk : skills) - { + for (SkillHolder sk : skills) { npc.doCast(sk); } htmltext = "4306-okbuff.htm"; } break; } - case "memories_summon": - { - if (player.getLevel() <= MIN_LEVEL) - { + case "memories_summon": { + if (player.getLevel() <= MIN_LEVEL) { htmltext = "4306-nolevel.htm"; - } - else if (!player.hasServitor()) - { + } else if (!player.hasServitor()) { htmltext = "4306-nosummon.htm"; - } - else - { + } else { npc.setTarget(player.getSummon()); - for (SkillHolder sk : SERVITOR_SKILLS) - { + for (SkillHolder sk : SERVITOR_SKILLS) { npc.doCast(sk); } htmltext = "4306-okbuff.htm"; @@ -161,13 +138,11 @@ public final class GiftOfVitality extends LongTimeEvent } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return "4306.htm"; } - public static void main(String[] args) - { + public static void main(String[] args) { new GiftOfVitality(); } } diff --git a/src/main/java/com/l2jserver/datapack/events/HeavyMedal/HeavyMedal.java b/src/main/java/com/l2jserver/datapack/events/HeavyMedal/HeavyMedal.java index 1310c3cb27..8c938ab646 100644 --- a/src/main/java/com/l2jserver/datapack/events/HeavyMedal/HeavyMedal.java +++ b/src/main/java/com/l2jserver/datapack/events/HeavyMedal/HeavyMedal.java @@ -27,31 +27,27 @@ import com.l2jserver.gameserver.model.event.LongTimeEvent; * Heavy Medals event AI. * @author Gnacik */ -public final class HeavyMedal extends LongTimeEvent -{ +public final class HeavyMedal extends LongTimeEvent { private final static int CAT_ROY = 31228; private final static int CAT_WINNIE = 31229; private final static int GLITTERING_MEDAL = 6393; private final static int WIN_CHANCE = 50; - private final static int[] MEDALS = - { + private final static int[] MEDALS = { 5, 10, 20, 40 }; - private final static int[] BADGES = - { + private final static int[] BADGES = { 6399, 6400, 6401, 6402 }; - private HeavyMedal() - { + private HeavyMedal() { super(HeavyMedal.class.getSimpleName(), "events"); addStartNpc(CAT_ROY); addStartNpc(CAT_WINNIE); @@ -62,33 +58,22 @@ public final class HeavyMedal extends LongTimeEvent } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; int level = checkLevel(player); - if (event.equalsIgnoreCase("game")) - { + if (event.equalsIgnoreCase("game")) { htmltext = getQuestItemsCount(player, GLITTERING_MEDAL) < MEDALS[level] ? "31229-no.htm" : "31229-game.htm"; - } - else if (event.equalsIgnoreCase("heads") || event.equalsIgnoreCase("tails")) - { - if (getQuestItemsCount(player, GLITTERING_MEDAL) < MEDALS[level]) - { + } else if (event.equalsIgnoreCase("heads") || event.equalsIgnoreCase("tails")) { + if (getQuestItemsCount(player, GLITTERING_MEDAL) < MEDALS[level]) { htmltext = "31229-" + event.toLowerCase() + "-10.htm"; - } - else - { + } else { takeItems(player, GLITTERING_MEDAL, MEDALS[level]); - if (getRandom(100) > WIN_CHANCE) - { + if (getRandom(100) > WIN_CHANCE) { level = 0; - } - else - { - if (level > 0) - { + } else { + if (level > 0) { takeItems(player, BADGES[level - 1], -1); } giveItems(player, BADGES[level], 1); @@ -97,48 +82,35 @@ public final class HeavyMedal extends LongTimeEvent } htmltext = "31229-" + event.toLowerCase() + "-" + String.valueOf(level) + ".htm"; } - } - else if (event.equalsIgnoreCase("talk")) - { + } else if (event.equalsIgnoreCase("talk")) { htmltext = String.valueOf(npc.getId()) + "-lvl-" + String.valueOf(level) + ".htm"; } return htmltext; } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { - if (player.getQuestState(getName()) == null) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { + if (player.getQuestState(getName()) == null) { newQuestState(player); } return npc.getId() + ".htm"; } - public int checkLevel(L2PcInstance player) - { + public int checkLevel(L2PcInstance player) { int _lev = 0; - if (hasQuestItems(player, 6402)) - { + if (hasQuestItems(player, 6402)) { _lev = 4; - } - else if (hasQuestItems(player, 6401)) - { + } else if (hasQuestItems(player, 6401)) { _lev = 3; - } - else if (hasQuestItems(player, 6400)) - { + } else if (hasQuestItems(player, 6400)) { _lev = 2; - } - else if (hasQuestItems(player, 6399)) - { + } else if (hasQuestItems(player, 6399)) { _lev = 1; } return _lev; } - public static void main(String[] args) - { + public static void main(String[] args) { new HeavyMedal(); } } diff --git a/src/main/java/com/l2jserver/datapack/events/LoveYourGatekeeper/LoveYourGatekeeper.java b/src/main/java/com/l2jserver/datapack/events/LoveYourGatekeeper/LoveYourGatekeeper.java index 4f862d207a..c2ddc64e14 100644 --- a/src/main/java/com/l2jserver/datapack/events/LoveYourGatekeeper/LoveYourGatekeeper.java +++ b/src/main/java/com/l2jserver/datapack/events/LoveYourGatekeeper/LoveYourGatekeeper.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Love Your Gatekeeper event. * @author Gladicek */ -public final class LoveYourGatekeeper extends LongTimeEvent -{ +public final class LoveYourGatekeeper extends LongTimeEvent { // NPC private static final int GATEKEEPER = 32477; // Item @@ -43,8 +42,7 @@ public final class LoveYourGatekeeper extends LongTimeEvent private static final int PRICE = 10000; private static final String REUSE = LoveYourGatekeeper.class.getSimpleName() + "_reuse"; - private LoveYourGatekeeper() - { + private LoveYourGatekeeper() { super(LoveYourGatekeeper.class.getSimpleName(), "events"); addStartNpc(GATEKEEPER); addFirstTalkId(GATEKEEPER); @@ -52,17 +50,12 @@ public final class LoveYourGatekeeper extends LongTimeEvent } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { - case "transform_stick": - { - if (player.getAdena() >= PRICE) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { + case "transform_stick": { + if (player.getAdena() >= PRICE) { final long reuse = player.getVariables().getLong(REUSE, 0); - if (reuse > System.currentTimeMillis()) - { + if (reuse > System.currentTimeMillis()) { final long remainingTime = (reuse - System.currentTimeMillis()) / 1000; final int hours = (int) (remainingTime / 3600); final int minutes = (int) ((remainingTime % 3600) / 60); @@ -71,24 +64,18 @@ public final class LoveYourGatekeeper extends LongTimeEvent sm.addInt(hours); sm.addInt(minutes); player.sendPacket(sm); - } - else - { + } else { takeItems(player, Inventory.ADENA_ID, PRICE); giveItems(player, GATEKEEPER_TRANSFORMATION_STICK, 1); player.getVariables().set(REUSE, System.currentTimeMillis() + (HOURS * 3600000)); } - } - else - { + } else { return "32477-3.htm"; } return null; } - case "transform": - { - if (!player.isTransformed()) - { + case "transform": { + if (!player.isTransformed()) { player.doCast(TELEPORTER_TRANSFORM); } return null; @@ -98,13 +85,11 @@ public final class LoveYourGatekeeper extends LongTimeEvent } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return "32477.htm"; } - public static void main(String[] args) - { + public static void main(String[] args) { new LoveYourGatekeeper(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/events/MasterOfEnchanting/MasterOfEnchanting.java b/src/main/java/com/l2jserver/datapack/events/MasterOfEnchanting/MasterOfEnchanting.java index 291ffb1b83..6a210bcfdb 100644 --- a/src/main/java/com/l2jserver/datapack/events/MasterOfEnchanting/MasterOfEnchanting.java +++ b/src/main/java/com/l2jserver/datapack/events/MasterOfEnchanting/MasterOfEnchanting.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Master of Enchanting event AI. * @author Gnacik */ -public final class MasterOfEnchanting extends LongTimeEvent -{ +public final class MasterOfEnchanting extends LongTimeEvent { // NPC private static final int MASTER_YOGI = 32599; // Items @@ -45,20 +44,17 @@ public final class MasterOfEnchanting extends LongTimeEvent private static final int SCROLL_1_PRICE = 500000; private static final int SCROLL_10_PRICE = 5000000; - private static final int[] HAT_SHADOW_REWARD = - { + private static final int[] HAT_SHADOW_REWARD = { 13074, 13075, 13076 }; - private static final int[] HAT_EVENT_REWARD = - { + private static final int[] HAT_EVENT_REWARD = { 13518, 13519, 13522 }; - private static final int[] CRYSTAL_REWARD = - { + private static final int[] CRYSTAL_REWARD = { 9570, 9571, 9572 @@ -67,8 +63,7 @@ public final class MasterOfEnchanting extends LongTimeEvent @SuppressWarnings("deprecation") private static final Date EVENT_START = new Date(2011, 7, 1); - private MasterOfEnchanting() - { + private MasterOfEnchanting() { super(MasterOfEnchanting.class.getSimpleName(), "events"); addStartNpc(MASTER_YOGI); addFirstTalkId(MASTER_YOGI); @@ -76,116 +71,80 @@ public final class MasterOfEnchanting extends LongTimeEvent } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; - if (event.equalsIgnoreCase("buy_staff")) - { - if (!hasQuestItems(player, MASTER_YOGI_STAFF) && (getQuestItemsCount(player, Inventory.ADENA_ID) > STAFF_PRICE)) - { + if (event.equalsIgnoreCase("buy_staff")) { + if (!hasQuestItems(player, MASTER_YOGI_STAFF) && (getQuestItemsCount(player, Inventory.ADENA_ID) > STAFF_PRICE)) { takeItems(player, Inventory.ADENA_ID, STAFF_PRICE); giveItems(player, MASTER_YOGI_STAFF, 1); htmltext = "32599-staffbuyed.htm"; - } - else - { + } else { htmltext = "32599-staffcant.htm"; } - } - else if (event.equalsIgnoreCase("buy_scroll_24")) - { + } else if (event.equalsIgnoreCase("buy_scroll_24")) { long curTime = System.currentTimeMillis(); String value = loadGlobalQuestVar(player.getAccountName()); long reuse = value == "" ? 0 : Long.parseLong(value); - if (player.getCreateDate().after(EVENT_START)) - { + if (player.getCreateDate().after(EVENT_START)) { return "32599-bidth.htm"; } - if (curTime > reuse) - { - if (getQuestItemsCount(player, Inventory.ADENA_ID) > SCROLL_24_PRICE) - { + if (curTime > reuse) { + if (getQuestItemsCount(player, Inventory.ADENA_ID) > SCROLL_24_PRICE) { takeItems(player, Inventory.ADENA_ID, SCROLL_24_PRICE); giveItems(player, MASTER_YOGI_SCROLL, 24); saveGlobalQuestVar(player.getAccountName(), Long.toString(System.currentTimeMillis() + (SCROLL_24_TIME * 3600000))); htmltext = "32599-scroll24.htm"; - } - else - { + } else { htmltext = "32599-s24-no.htm"; } - } - else - { + } else { long remainingTime = (reuse - curTime) / 1000; int hours = (int) remainingTime / 3600; int minutes = ((int) remainingTime % 3600) / 60; - if (hours > 0) - { + if (hours > 0) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.ITEM_PURCHASABLE_IN_S1_HOURS_S2_MINUTES); sm.addInt(hours); sm.addInt(minutes); player.sendPacket(sm); htmltext = "32599-scroll24.htm"; - } - else if (minutes > 0) - { + } else if (minutes > 0) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.ITEM_PURCHASABLE_IN_S1_MINUTES); sm.addInt(minutes); player.sendPacket(sm); htmltext = "32599-scroll24.htm"; - } - else - { + } else { // Little glitch. There is no SystemMessage with seconds only. // If time is less than 1 minute player can buy scrolls - if (getQuestItemsCount(player, Inventory.ADENA_ID) > SCROLL_24_PRICE) - { + if (getQuestItemsCount(player, Inventory.ADENA_ID) > SCROLL_24_PRICE) { takeItems(player, Inventory.ADENA_ID, SCROLL_24_PRICE); giveItems(player, MASTER_YOGI_SCROLL, 24); saveGlobalQuestVar(player.getAccountName(), Long.toString(System.currentTimeMillis() + (SCROLL_24_TIME * 3600000))); htmltext = "32599-scroll24.htm"; - } - else - { + } else { htmltext = "32599-s24-no.htm"; } } } - } - else if (event.equalsIgnoreCase("buy_scroll_1")) - { - if (getQuestItemsCount(player, Inventory.ADENA_ID) > SCROLL_1_PRICE) - { + } else if (event.equalsIgnoreCase("buy_scroll_1")) { + if (getQuestItemsCount(player, Inventory.ADENA_ID) > SCROLL_1_PRICE) { takeItems(player, Inventory.ADENA_ID, SCROLL_1_PRICE); giveItems(player, MASTER_YOGI_SCROLL, 1); htmltext = "32599-scroll-ok.htm"; - } - else - { + } else { htmltext = "32599-s1-no.htm"; } - } - else if (event.equalsIgnoreCase("buy_scroll_10")) - { - if (getQuestItemsCount(player, Inventory.ADENA_ID) > SCROLL_10_PRICE) - { + } else if (event.equalsIgnoreCase("buy_scroll_10")) { + if (getQuestItemsCount(player, Inventory.ADENA_ID) > SCROLL_10_PRICE) { takeItems(player, Inventory.ADENA_ID, SCROLL_10_PRICE); giveItems(player, MASTER_YOGI_SCROLL, 10); htmltext = "32599-scroll-ok.htm"; - } - else - { + } else { htmltext = "32599-s10-no.htm"; } - } - else if (event.equalsIgnoreCase("receive_reward")) - { - if ((getItemEquipped(player, Inventory.PAPERDOLL_RHAND) == MASTER_YOGI_STAFF) && (getEnchantLevel(player, MASTER_YOGI_STAFF) > 3)) - { - switch (getEnchantLevel(player, MASTER_YOGI_STAFF)) - { + } else if (event.equalsIgnoreCase("receive_reward")) { + if ((getItemEquipped(player, Inventory.PAPERDOLL_RHAND) == MASTER_YOGI_STAFF) && (getEnchantLevel(player, MASTER_YOGI_STAFF) > 3)) { + switch (getEnchantLevel(player, MASTER_YOGI_STAFF)) { case 4: giveItems(player, 6406, 1); // Firework break; @@ -252,17 +211,14 @@ public final class MasterOfEnchanting extends LongTimeEvent case 23: giveItems(player, 13988, 1); // S80 Grade Weapon Chest (Event) default: - if (getEnchantLevel(player, MASTER_YOGI_STAFF) > 23) - { + if (getEnchantLevel(player, MASTER_YOGI_STAFF) > 23) { giveItems(player, 13988, 1); // S80 Grade Weapon Chest (Event) } break; } takeItems(player, MASTER_YOGI_STAFF, 1); htmltext = "32599-rewardok.htm"; - } - else - { + } else { htmltext = "32599-rewardnostaff.htm"; } } @@ -270,13 +226,11 @@ public final class MasterOfEnchanting extends LongTimeEvent } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return npc.getId() + ".htm"; } - public static void main(String[] args) - { + public static void main(String[] args) { new MasterOfEnchanting(); } } diff --git a/src/main/java/com/l2jserver/datapack/events/TheValentineEvent/TheValentineEvent.java b/src/main/java/com/l2jserver/datapack/events/TheValentineEvent/TheValentineEvent.java index 4fdbb911f7..525f56b06e 100644 --- a/src/main/java/com/l2jserver/datapack/events/TheValentineEvent/TheValentineEvent.java +++ b/src/main/java/com/l2jserver/datapack/events/TheValentineEvent/TheValentineEvent.java @@ -27,8 +27,7 @@ import com.l2jserver.gameserver.model.event.LongTimeEvent; * The Valentine Event event AI. * @author Gnacik */ -public final class TheValentineEvent extends LongTimeEvent -{ +public final class TheValentineEvent extends LongTimeEvent { // NPC private static final int NPC = 4301; // Item @@ -36,8 +35,7 @@ public final class TheValentineEvent extends LongTimeEvent // Misc private static final String COMPLETED = TheValentineEvent.class.getSimpleName() + "_completed"; - private TheValentineEvent() - { + private TheValentineEvent() { super(TheValentineEvent.class.getSimpleName(), "events"); addStartNpc(NPC); addFirstTalkId(NPC); @@ -45,17 +43,12 @@ public final class TheValentineEvent extends LongTimeEvent } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; - if (event.equalsIgnoreCase("4301-3.htm")) - { - if (player.getVariables().getBoolean(COMPLETED, false)) - { + if (event.equalsIgnoreCase("4301-3.htm")) { + if (player.getVariables().getBoolean(COMPLETED, false)) { htmltext = "4301-4.htm"; - } - else - { + } else { giveItems(player, RECIPE, 1); playSound(player, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -64,13 +57,11 @@ public final class TheValentineEvent extends LongTimeEvent } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return npc.getId() + ".htm"; } - public static void main(String[] args) - { + public static void main(String[] args) { new TheValentineEvent(); } } diff --git a/src/main/java/com/l2jserver/datapack/features/SkillTransfer/SkillTransfer.java b/src/main/java/com/l2jserver/datapack/features/SkillTransfer/SkillTransfer.java index fb2d037ac3..51f38b617f 100644 --- a/src/main/java/com/l2jserver/datapack/features/SkillTransfer/SkillTransfer.java +++ b/src/main/java/com/l2jserver/datapack/features/SkillTransfer/SkillTransfer.java @@ -39,11 +39,9 @@ import com.l2jserver.gameserver.util.Util; * Skill Transfer feature. * @author Zoey76 */ -public final class SkillTransfer extends AbstractNpcAI -{ +public final class SkillTransfer extends AbstractNpcAI { private static final String HOLY_POMANDER = "HOLY_POMANDER_"; - private static final ItemHolder[] PORMANDERS = - { + private static final ItemHolder[] PORMANDERS = { // Cardinal (97) new ItemHolder(15307, 1), // Eva's Saint (105) @@ -52,47 +50,40 @@ public final class SkillTransfer extends AbstractNpcAI new ItemHolder(15309, 4) }; - private SkillTransfer() - { + private SkillTransfer() { super(SkillTransfer.class.getSimpleName(), "features"); setPlayerProfessionChangeId(this::onProfessionChange); setPlayerProfessionCancelId(this::onProfessionCancel); setOnEnterWorld(general().skillCheckEnable()); } - public void onProfessionChange(OnPlayerProfessionChange event) - { + public void onProfessionChange(OnPlayerProfessionChange event) { final L2PcInstance player = event.getActiveChar(); final int index = getTransferClassIndex(player); - if (index < 0) - { + if (index < 0) { return; } final String name = HOLY_POMANDER + player.getClassId().getId(); - if (!player.getVariables().getBoolean(name, false)) - { + if (!player.getVariables().getBoolean(name, false)) { player.getVariables().set(name, true); giveItems(player, PORMANDERS[index]); } } - public void onProfessionCancel(OnPlayerProfessionCancel event) - { + public void onProfessionCancel(OnPlayerProfessionCancel event) { final L2PcInstance player = event.getActiveChar(); final int index = getTransferClassIndex(player); // is a transfer class - if (index < 0) - { + if (index < 0) { return; } int pomanderId = PORMANDERS[index].getId(); // remove unsused HolyPomander PcInventory inv = player.getInventory(); - for (L2ItemInstance itemI : inv.getAllItemsByItemId(pomanderId)) - { + for (L2ItemInstance itemI : inv.getAllItemsByItemId(pomanderId)) { inv.destroyItem("[HolyPomander - remove]", itemI, player, null); } // remove holy pomander variable @@ -101,35 +92,26 @@ public final class SkillTransfer extends AbstractNpcAI } @Override - public String onEnterWorld(L2PcInstance player) - { - if (!player.canOverrideCond(PcCondOverride.SKILL_CONDITIONS) || general().skillCheckGM()) - { + public String onEnterWorld(L2PcInstance player) { + if (!player.canOverrideCond(PcCondOverride.SKILL_CONDITIONS) || general().skillCheckGM()) { final int index = getTransferClassIndex(player); - if (index < 0) - { + if (index < 0) { return super.onEnterWorld(player); } long count = PORMANDERS[index].getCount() - player.getInventory().getInventoryItemCount(PORMANDERS[index].getId(), -1, false); - for (Skill sk : player.getAllSkills()) - { - for (L2SkillLearn s : SkillTreesData.getInstance().getTransferSkillTree(player.getClassId()).values()) - { - if (s.getSkillId() == sk.getId()) - { + for (Skill sk : player.getAllSkills()) { + for (L2SkillLearn s : SkillTreesData.getInstance().getTransferSkillTree(player.getClassId()).values()) { + if (s.getSkillId() == sk.getId()) { // Holy Weapon allowed for Shilien Saint/Inquisitor stance - if ((sk.getId() == 1043) && (index == 2) && player.isInStance()) - { + if ((sk.getId() == 1043) && (index == 2) && player.isInStance()) { continue; } count--; - if (count < 0) - { + if (count < 0) { final String className = ClassListData.getInstance().getClass(player.getClassId()).getClassName(); Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " has too many transfered skills or items, skill:" + s.getName() + " (" + sk.getId() + "/" + sk.getLevel() + "), class:" + className, IllegalActionPunishmentType.BROADCAST); - if (general().skillCheckRemove()) - { + if (general().skillCheckRemove()) { player.removeSkill(sk); } } @@ -137,39 +119,31 @@ public final class SkillTransfer extends AbstractNpcAI } } // SkillTransfer or HolyPomander missing - if (count > 0) - { + if (count > 0) { player.getInventory().addItem("[HolyPomander- missing]", PORMANDERS[index].getId(), count, player, null); } } return super.onEnterWorld(player); } - private static int getTransferClassIndex(L2PcInstance player) - { - switch (player.getClassId()) - { - case cardinal: - { + private static int getTransferClassIndex(L2PcInstance player) { + switch (player.getClassId()) { + case cardinal: { return 0; } - case evaSaint: - { + case evaSaint: { return 1; } - case shillienSaint: - { + case shillienSaint: { return 2; } - default: - { + default: { return -1; } } } - public static void main(String[] args) - { + public static void main(String[] args) { new SkillTransfer(); } } diff --git a/src/main/java/com/l2jserver/datapack/gracia/AI/EnergySeeds.java b/src/main/java/com/l2jserver/datapack/gracia/AI/EnergySeeds.java index 881667db61..774d0967cc 100644 --- a/src/main/java/com/l2jserver/datapack/gracia/AI/EnergySeeds.java +++ b/src/main/java/com/l2jserver/datapack/gracia/AI/EnergySeeds.java @@ -52,8 +52,7 @@ import com.l2jserver.gameserver.util.Util; * Energy Seeds AI. * @author Gigiikun */ -public class EnergySeeds extends AbstractNpcAI -{ +public class EnergySeeds extends AbstractNpcAI { private static final int HOWTOOPPOSEEVIL_CHANCE = 60; private static final int RATE = 1; private static final int RESPAWN = 480000; @@ -740,28 +739,23 @@ public class EnergySeeds extends AbstractNpcAI //@formatter:on } - private class ESSpawn - { + private class ESSpawn { protected final int _spawnId; protected final GraciaSeeds _seedId; protected final int[] _npcIds; protected final Location _loc; - public ESSpawn(int spawnId, GraciaSeeds seedId, Location loc, int[] npcIds) - { + public ESSpawn(int spawnId, GraciaSeeds seedId, Location loc, int[] npcIds) { _spawnId = spawnId; _seedId = seedId; _loc = loc; _npcIds = npcIds; } - public void scheduleRespawn(long waitTime) - { - ThreadPoolManager.getInstance().scheduleGeneral(() -> - { + public void scheduleRespawn(long waitTime) { + ThreadPoolManager.getInstance().scheduleGeneral(() -> { // if the AI is inactive, do not spawn the NPC - if (isSeedActive(_seedId)) - { + if (isSeedActive(_seedId)) { // get a random NPC that should spawn at this location Integer spawnId = _spawnId; // the map uses "Integer", not "int" _spawnedNpcs.put(addSpawn(_npcIds[getRandom(_npcIds.length)], _loc, false, 0), spawnId); diff --git a/src/main/java/com/l2jserver/datapack/gracia/AI/Lindvior.java b/src/main/java/com/l2jserver/datapack/gracia/AI/Lindvior.java index 40fd90556c..104b46fde6 100644 --- a/src/main/java/com/l2jserver/datapack/gracia/AI/Lindvior.java +++ b/src/main/java/com/l2jserver/datapack/gracia/AI/Lindvior.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Lindvior Scene AI. * @author nonom */ -public class Lindvior extends AbstractNpcAI -{ +public class Lindvior extends AbstractNpcAI { private static final int LINDVIOR_CAMERA = 18669; private static final int TOMARIS = 32552; private static final int ARTIUS = 32559; @@ -52,17 +51,14 @@ public class Lindvior extends AbstractNpcAI private L2Npc _tomaris = null; private L2Npc _artius = null; - public Lindvior() - { + public Lindvior() { super(Lindvior.class.getSimpleName(), "gracia/AI"); scheduleNextLindviorVisit(); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { case "tomaris_shout1": broadcastNpcSay(npc, Say2.NPC_SHOUT, NpcStringId.HUH_THE_SKY_LOOKS_FUNNY_WHATS_THAT); break; @@ -73,12 +69,9 @@ public class Lindvior extends AbstractNpcAI broadcastNpcSay(npc, Say2.NPC_SHOUT, NpcStringId.BE_CAREFUL_SOMETHINGS_COMING); break; case "lindvior_scene": - if (npc != null) - { - for (L2PcInstance pl : npc.getKnownList().getKnownPlayersInRadius(4000)) - { - if ((pl.getZ() >= 1100) && (pl.getZ() <= 3100)) - { + if (npc != null) { + for (L2PcInstance pl : npc.getKnownList().getKnownPlayersInRadius(4000)) { + if ((pl.getZ() >= 1100) && (pl.getZ() <= 3100)) { pl.showQuestMovie(LINDVIOR_SCENE_ID); } } @@ -99,33 +92,25 @@ public class Lindvior extends AbstractNpcAI return super.onAdvEvent(event, npc, player); } - public void scheduleNextLindviorVisit() - { + public void scheduleNextLindviorVisit() { long delay = (ALT_MODE) ? ALT_MODE_MIN * 60000 : scheduleNextLindviorDate(); startQuestTimer("start", delay, null, null); } - protected long scheduleNextLindviorDate() - { + protected long scheduleNextLindviorDate() { GregorianCalendar date = new GregorianCalendar(); date.set(Calendar.MINUTE, RESET_MIN); date.set(Calendar.HOUR_OF_DAY, RESET_HOUR); - if (System.currentTimeMillis() >= date.getTimeInMillis()) - { + if (System.currentTimeMillis() >= date.getTimeInMillis()) { date.add(Calendar.DAY_OF_WEEK, 1); } int dayOfWeek = date.get(Calendar.DAY_OF_WEEK); - if (dayOfWeek <= RESET_DAY_1) - { + if (dayOfWeek <= RESET_DAY_1) { date.add(Calendar.DAY_OF_WEEK, RESET_DAY_1 - dayOfWeek); - } - else if (dayOfWeek <= RESET_DAY_2) - { + } else if (dayOfWeek <= RESET_DAY_2) { date.add(Calendar.DAY_OF_WEEK, RESET_DAY_2 - dayOfWeek); - } - else - { + } else { date.add(Calendar.DAY_OF_WEEK, 1 + RESET_DAY_1); } return date.getTimeInMillis() - System.currentTimeMillis(); diff --git a/src/main/java/com/l2jserver/datapack/gracia/AI/Maguen.java b/src/main/java/com/l2jserver/datapack/gracia/AI/Maguen.java index d6c76b0fc0..22daee8c65 100644 --- a/src/main/java/com/l2jserver/datapack/gracia/AI/Maguen.java +++ b/src/main/java/com/l2jserver/datapack/gracia/AI/Maguen.java @@ -35,12 +35,10 @@ import com.l2jserver.gameserver.network.NpcStringId; * Maguen AI. * @author St3eT */ -public final class Maguen extends AbstractNpcAI -{ +public final class Maguen extends AbstractNpcAI { // NPC private static final int MAGUEN = 18839; // Wild Maguen - private static final int[] ELITES = - { + private static final int[] ELITES = { 22750, // Elite Bgurent (Bistakon) 22751, // Elite Brakian (Bistakon) 22752, // Elite Groikan (Bistakon) @@ -73,8 +71,7 @@ public final class Maguen extends AbstractNpcAI private static final SkillHolder R_PLASMA2 = new SkillHolder(6369, 2); // Maguen Plasma - Reptilikon private static final SkillHolder R_PLASMA3 = new SkillHolder(6369, 3); // Maguen Plasma - Reptilikon - public Maguen() - { + public Maguen() { super(Maguen.class.getSimpleName(), "gracia/AI"); addKillId(ELITES); addSkillSeeId(MAGUEN); @@ -82,17 +79,13 @@ public final class Maguen extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if ((npc == null) || (player == null)) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if ((npc == null) || (player == null)) { return null; } - switch (event) - { - case "SPAWN_MAGUEN": - { + switch (event) { + case "SPAWN_MAGUEN": { final L2Npc maguen = addSpawn(MAGUEN, npc.getLocation(), true, 60000, true); maguen.getVariables().set("SUMMON_PLAYER", player); maguen.setTitle(player.getName()); @@ -103,21 +96,16 @@ public final class Maguen extends AbstractNpcAI startQuestTimer("DIST_CHECK_TIMER", 1000, maguen, player); break; } - case "DIST_CHECK_TIMER": - { - if ((npc.calculateDistance(player, true, false) < 100) && (npc.getVariables().getInt("IS_NEAR_PLAYER") == 0)) - { + case "DIST_CHECK_TIMER": { + if ((npc.calculateDistance(player, true, false) < 100) && (npc.getVariables().getInt("IS_NEAR_PLAYER") == 0)) { npc.getVariables().set("IS_NEAR_PLAYER", 1); startQuestTimer("FIRST_TIMER", 4000, npc, player); - } - else - { + } else { startQuestTimer("DIST_CHECK_TIMER", 1000, npc, player); } break; } - case "FIRST_TIMER": - { + case "FIRST_TIMER": { npc.getAI().stopFollow(); final int randomEffect = getRandom(1, 3); npc.setDisplayEffect(randomEffect); @@ -126,8 +114,7 @@ public final class Maguen extends AbstractNpcAI npc.broadcastSocialAction(getRandom(1, 3)); break; } - case "SECOND_TIMER": - { + case "SECOND_TIMER": { final int randomEffect = getRandom(1, 3); npc.setDisplayEffect(4); npc.setDisplayEffect(randomEffect); @@ -136,8 +123,7 @@ public final class Maguen extends AbstractNpcAI npc.broadcastSocialAction(getRandom(1, 3)); break; } - case "THIRD_TIMER": - { + case "THIRD_TIMER": { final int randomEffect = getRandom(1, 3); npc.setDisplayEffect(4); npc.setDisplayEffect(randomEffect); @@ -146,18 +132,15 @@ public final class Maguen extends AbstractNpcAI npc.broadcastSocialAction(getRandom(1, 3)); break; } - case "FORTH_TIMER": - { + case "FORTH_TIMER": { npc.getVariables().set("NPC_EFFECT", 0); npc.setDisplayEffect(4); startQuestTimer("END_TIMER", 500, npc, player); npc.broadcastSocialAction(getRandom(1, 3)); break; } - case "END_TIMER": - { - if (npc.getVariables().getInt("TEST_MAGUEN") == 1) - { + case "END_TIMER": { + if (npc.getVariables().getInt("TEST_MAGUEN") == 1) { player.getEffectList().stopSkillEffects(true, B_PLASMA1.getSkill().getAbnormalType()); player.getEffectList().stopSkillEffects(true, C_PLASMA1.getSkill().getAbnormalType()); player.getEffectList().stopSkillEffects(true, R_PLASMA1.getSkill().getAbnormalType()); @@ -171,8 +154,7 @@ public final class Maguen extends AbstractNpcAI } @Override - public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) - { + public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) { final BuffInfo b_info = player.getEffectList().getBuffInfoByAbnormalType(B_PLASMA1.getSkill().getAbnormalType()); final BuffInfo c_info = player.getEffectList().getBuffInfoByAbnormalType(C_PLASMA1.getSkill().getAbnormalType()); final BuffInfo r_info = player.getEffectList().getBuffInfoByAbnormalType(R_PLASMA1.getSkill().getAbnormalType()); @@ -181,44 +163,35 @@ public final class Maguen extends AbstractNpcAI final int c = c_info == null ? 0 : c_info.getSkill().getAbnormalLvl(); final int r = r_info == null ? 0 : r_info.getSkill().getAbnormalLvl(); - if ((b == 3) && (c == 0) && (r == 0)) - { + if ((b == 3) && (c == 0) && (r == 0)) { showOnScreenMsg(player, NpcStringId.ENOUGH_MAGUEN_PLASMA_BISTAKON_HAVE_GATHERED, 2, 4000); player.getEffectList().stopSkillEffects(true, B_PLASMA1.getSkill().getAbnormalType()); npc.setTarget(player); npc.doCast((getRandom(100) < 70) ? B_BUFF_1 : B_BUFF_2); maguenPetChance(player); startQuestTimer("END_TIMER", 3000, npc, player); - } - else if ((b == 0) && (c == 3) && (r == 0)) - { + } else if ((b == 0) && (c == 3) && (r == 0)) { showOnScreenMsg(player, NpcStringId.ENOUGH_MAGUEN_PLASMA_COKRAKON_HAVE_GATHERED, 2, 4000); player.getEffectList().stopSkillEffects(true, C_PLASMA1.getSkill().getAbnormalType()); npc.setTarget(player); npc.doCast((getRandom(100) < 70) ? C_BUFF_1 : C_BUFF_2); maguenPetChance(player); startQuestTimer("END_TIMER", 3000, npc, player); - } - else if ((b == 0) && (c == 0) && (r == 3)) - { + } else if ((b == 0) && (c == 0) && (r == 3)) { showOnScreenMsg(player, NpcStringId.ENOUGH_MAGUEN_PLASMA_LEPTILIKON_HAVE_GATHERED, 2, 4000); player.getEffectList().stopSkillEffects(true, R_PLASMA1.getSkill().getAbnormalType()); npc.setTarget(player); npc.doCast((getRandom(100) < 70) ? R_BUFF_1 : R_BUFF_2); maguenPetChance(player); startQuestTimer("END_TIMER", 3000, npc, player); - } - else if ((b + c + r) == 3) - { - if ((b == 1) && (c == 1) && (r == 1)) - { + } else if ((b + c + r) == 3) { + if ((b == 1) && (c == 1) && (r == 1)) { player.getEffectList().stopSkillEffects(true, B_PLASMA1.getSkill().getAbnormalType()); player.getEffectList().stopSkillEffects(true, C_PLASMA1.getSkill().getAbnormalType()); player.getEffectList().stopSkillEffects(true, R_PLASMA1.getSkill().getAbnormalType()); showOnScreenMsg(player, NpcStringId.THE_PLASMAS_HAVE_FILLED_THE_AEROSCOPE_AND_ARE_HARMONIZED, 2, 4000); SkillHolder skillToCast = null; - switch (getRandom(3)) - { + switch (getRandom(3)) { case 0: skillToCast = (getRandom(100) < 70) ? B_BUFF_1 : B_BUFF_2; break; @@ -230,24 +203,19 @@ public final class Maguen extends AbstractNpcAI break; } - if (skillToCast != null) - { + if (skillToCast != null) { npc.setTarget(player); npc.doCast(skillToCast); } maguenPetChance(player); startQuestTimer("END_TIMER", 3000, npc, player); - } - else - { + } else { showOnScreenMsg(player, NpcStringId.THE_PLASMAS_HAVE_FILLED_THE_AEROSCOPE_BUT_THEY_ARE_RAMMING_INTO_EACH_OTHER_EXPLODING_AND_DYING, 2, 4000); player.getEffectList().stopSkillEffects(true, B_PLASMA1.getSkill().getAbnormalType()); player.getEffectList().stopSkillEffects(true, C_PLASMA1.getSkill().getAbnormalType()); player.getEffectList().stopSkillEffects(true, R_PLASMA1.getSkill().getAbnormalType()); } - } - else - { + } else { startQuestTimer("END_TIMER", 1000, npc, player); } npc.setDisplayEffect(4); @@ -255,12 +223,9 @@ public final class Maguen extends AbstractNpcAI } @Override - public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) - { - if ((skill == MACHINE.getSkill()) && (caster == npc.getVariables().getObject("SUMMON_PLAYER", L2PcInstance.class))) - { - if ((npc.getVariables().getInt("NPC_EFFECT") != 0) && (npc.getVariables().getInt("BLOCKED_SKILLSEE") == 0)) - { + public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) { + if ((skill == MACHINE.getSkill()) && (caster == npc.getVariables().getObject("SUMMON_PLAYER", L2PcInstance.class))) { + if ((npc.getVariables().getInt("NPC_EFFECT") != 0) && (npc.getVariables().getInt("BLOCKED_SKILLSEE") == 0)) { final BuffInfo i1_info = caster.getEffectList().getBuffInfoByAbnormalType(B_PLASMA1.getSkill().getAbnormalType()); final BuffInfo i2_info = caster.getEffectList().getBuffInfoByAbnormalType(C_PLASMA1.getSkill().getAbnormalType()); final BuffInfo i3_info = caster.getEffectList().getBuffInfoByAbnormalType(R_PLASMA1.getSkill().getAbnormalType()); @@ -279,12 +244,9 @@ public final class Maguen extends AbstractNpcAI npc.getVariables().set("BLOCKED_SKILLSEE", 1); SkillHolder skillToCast = null; - switch (npc.getVariables().getInt("NPC_EFFECT")) - { - case 1: - { - switch (i1) - { + switch (npc.getVariables().getInt("NPC_EFFECT")) { + case 1: { + switch (i1) { case 0: skillToCast = B_PLASMA1; break; @@ -297,10 +259,8 @@ public final class Maguen extends AbstractNpcAI } break; } - case 2: - { - switch (i2) - { + case 2: { + switch (i2) { case 0: skillToCast = C_PLASMA1; break; @@ -313,10 +273,8 @@ public final class Maguen extends AbstractNpcAI } break; } - case 3: - { - switch (i3) - { + case 3: { + switch (i3) { case 0: skillToCast = R_PLASMA1; break; @@ -331,8 +289,7 @@ public final class Maguen extends AbstractNpcAI } } - if (skillToCast != null) - { + if (skillToCast != null) { npc.setTarget(caster); npc.doCast(skillToCast); } @@ -342,37 +299,29 @@ public final class Maguen extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (killer.isInParty()) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (killer.isInParty()) { final L2PcInstance partyMember = getRandomPartyMember(killer); final int i0 = 10 + (10 * killer.getParty().getMemberCount()); - if ((getRandom(1000) < i0) && (npc.calculateDistance(killer, true, false) < 2000) && (npc.calculateDistance(partyMember, true, false) < 2000)) - { + if ((getRandom(1000) < i0) && (npc.calculateDistance(killer, true, false) < 2000) && (npc.calculateDistance(partyMember, true, false) < 2000)) { notifyEvent("SPAWN_MAGUEN", npc, partyMember); } } return super.onKill(npc, killer, isSummon); } - private void maguenPetChance(L2PcInstance player) - { + private void maguenPetChance(L2PcInstance player) { final int chance1 = getRandom(10000); final int chance2 = getRandom(20); - if ((chance1 == 0) && (chance2 != 0)) - { + if ((chance1 == 0) && (chance2 != 0)) { giveItems(player, MAGUEN_PET, 1); - } - else if ((chance1 == 0) && (chance2 == 0)) - { + } else if ((chance1 == 0) && (chance2 == 0)) { giveItems(player, ELITE_MAGUEN_PET, 1); } } - private Quest nemoAi() - { + private Quest nemoAi() { return QuestManager.getInstance().getQuest(Nemo.class.getSimpleName()); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/FortuneTelling/FortuneTelling.java b/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/FortuneTelling/FortuneTelling.java index 15699107e9..8247f01746 100644 --- a/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/FortuneTelling/FortuneTelling.java +++ b/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/FortuneTelling/FortuneTelling.java @@ -28,30 +28,24 @@ import com.l2jserver.gameserver.model.itemcontainer.Inventory; * Original Jython script by Kerberos. * @author Nyaran */ -public class FortuneTelling extends AbstractNpcAI -{ +public class FortuneTelling extends AbstractNpcAI { // NPC private static final int MINE = 32616; // Misc private static final int COST = 1000; - public FortuneTelling() - { + public FortuneTelling() { super(FortuneTelling.class.getSimpleName(), "gracia/AI/NPC"); addStartNpc(MINE); addTalkId(MINE); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); - if (player.getAdena() < COST) - { + if (player.getAdena() < COST) { htmltext = "lowadena.htm"; - } - else - { + } else { takeItems(player, Inventory.ADENA_ID, COST); htmltext = getHtm(player.getHtmlPrefix(), "fortune.htm").replace("%fortune%", String.valueOf(getRandom(1800309, 1800695))); } diff --git a/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/GeneralDilios/GeneralDilios.java b/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/GeneralDilios/GeneralDilios.java index 926237cc52..3f8dd92789 100644 --- a/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/GeneralDilios/GeneralDilios.java +++ b/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/GeneralDilios/GeneralDilios.java @@ -34,60 +34,48 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * Dilios AI * @author JIV, Sephiroth, Apocalipce */ -public final class GeneralDilios extends AbstractNpcAI -{ +public final class GeneralDilios extends AbstractNpcAI { private static final int GENERAL_ID = 32549; private static final int GUARD_ID = 32619; private L2Npc _general = null; private final Set<L2Spawn> _guards = Collections.newSetFromMap(new ConcurrentHashMap<L2Spawn, Boolean>()); - private static final NpcStringId[] DILIOS_TEXT = - { + private static final NpcStringId[] DILIOS_TEXT = { NpcStringId.MESSENGER_INFORM_THE_PATRONS_OF_THE_KEUCEREUS_ALLIANCE_BASE_WERE_GATHERING_BRAVE_ADVENTURERS_TO_ATTACK_TIATS_MOUNTED_TROOP_THATS_ROOTED_IN_THE_SEED_OF_DESTRUCTION, // NpcStringId.MESSENGER_INFORM_THE_PATRONS_OF_THE_KEUCEREUS_ALLIANCE_BASE_THE_SEED_OF_DESTRUCTION_IS_CURRENTLY_SECURED_UNDER_THE_FLAG_OF_THE_KEUCEREUS_ALLIANCE, // NpcStringId.MESSENGER_INFORM_THE_PATRONS_OF_THE_KEUCEREUS_ALLIANCE_BASE_TIATS_MOUNTED_TROOP_IS_CURRENTLY_TRYING_TO_RETAKE_SEED_OF_DESTRUCTION_COMMIT_ALL_THE_AVAILABLE_REINFORCEMENTS_INTO_SEED_OF_DESTRUCTION, NpcStringId.MESSENGER_INFORM_THE_BROTHERS_IN_KUCEREUS_CLAN_OUTPOST_BRAVE_ADVENTURERS_WHO_HAVE_CHALLENGED_THE_SEED_OF_INFINITY_ARE_CURRENTLY_INFILTRATING_THE_HALL_OF_EROSION_THROUGH_THE_DEFENSIVELY_WEAK_HALL_OF_SUFFERING, // NpcStringId.MESSENGER_INFORM_THE_BROTHERS_IN_KUCEREUS_CLAN_OUTPOST_SWEEPING_THE_SEED_OF_INFINITY_IS_CURRENTLY_COMPLETE_TO_THE_HEART_OF_THE_SEED_EKIMUS_IS_BEING_DIRECTLY_ATTACKED_AND_THE_UNDEAD_REMAINING_IN_THE_HALL_OF_SUFFERING_ARE_BEING_ERADICATED, NpcStringId.MESSENGER_INFORM_THE_PATRONS_OF_THE_KEUCEREUS_ALLIANCE_BASE_THE_SEED_OF_INFINITY_IS_CURRENTLY_SECURED_UNDER_THE_FLAG_OF_THE_KEUCEREUS_ALLIANCE - // NpcStringId.MESSENGER_INFORM_THE_PATRONS_OF_THE_KEUCEREUS_ALLIANCE_BASE_THE_RESURRECTED_UNDEAD_IN_THE_SEED_OF_INFINITY_ARE_POURING_INTO_THE_HALL_OF_SUFFERING_AND_THE_HALL_OF_EROSION - // NpcStringId.MESSENGER_INFORM_THE_BROTHERS_IN_KUCEREUS_CLAN_OUTPOST_EKIMUS_IS_ABOUT_TO_BE_REVIVED_BY_THE_RESURRECTED_UNDEAD_IN_SEED_OF_INFINITY_SEND_ALL_REINFORCEMENTS_TO_THE_HEART_AND_THE_HALL_OF_SUFFERING + // NpcStringId.MESSENGER_INFORM_THE_PATRONS_OF_THE_KEUCEREUS_ALLIANCE_BASE_THE_RESURRECTED_UNDEAD_IN_THE_SEED_OF_INFINITY_ARE_POURING_INTO_THE_HALL_OF_SUFFERING_AND_THE_HALL_OF_EROSION + // NpcStringId.MESSENGER_INFORM_THE_BROTHERS_IN_KUCEREUS_CLAN_OUTPOST_EKIMUS_IS_ABOUT_TO_BE_REVIVED_BY_THE_RESURRECTED_UNDEAD_IN_SEED_OF_INFINITY_SEND_ALL_REINFORCEMENTS_TO_THE_HEART_AND_THE_HALL_OF_SUFFERING }; - public GeneralDilios() - { + public GeneralDilios() { super(GeneralDilios.class.getSimpleName(), "gracia/AI/NPC"); addSpawnId(GENERAL_ID, GUARD_ID); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.startsWith("command_")) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.startsWith("command_")) { int value = Integer.parseInt(event.substring(8)); - if (value < 6) - { + if (value < 6) { _general.broadcastPacket(new NpcSay(_general.getObjectId(), Say2.NPC_ALL, GENERAL_ID, NpcStringId.STABBING_THREE_TIMES)); startQuestTimer("guard_animation_0", 3400, null, null); - } - else - { + } else { value = -1; _general.broadcastPacket(new NpcSay(_general.getObjectId(), Say2.NPC_SHOUT, GENERAL_ID, DILIOS_TEXT[getRandom(DILIOS_TEXT.length)])); } startQuestTimer("command_" + (value + 1), 60000, null, null); - } - else if (event.startsWith("guard_animation_")) - { + } else if (event.startsWith("guard_animation_")) { int value = Integer.parseInt(event.substring(16)); - for (L2Spawn guard : _guards) - { + for (L2Spawn guard : _guards) { guard.getLastSpawn().broadcastSocialAction(4); } - if (value < 2) - { + if (value < 2) { startQuestTimer("guard_animation_" + (value + 1), 1500, null, null); } } @@ -95,15 +83,11 @@ public final class GeneralDilios extends AbstractNpcAI } @Override - public String onSpawn(L2Npc npc) - { - if (npc.getId() == GENERAL_ID) - { + public String onSpawn(L2Npc npc) { + if (npc.getId() == GENERAL_ID) { startQuestTimer("command_0", 60000, null, null); _general = npc; - } - else if (npc.getId() == GUARD_ID) - { + } else if (npc.getId() == GUARD_ID) { _guards.add(npc.getSpawn()); } return super.onSpawn(npc); diff --git a/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/Lekon/Lekon.java b/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/Lekon/Lekon.java index f94708d95e..9805ba3b7f 100644 --- a/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/Lekon/Lekon.java +++ b/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/Lekon/Lekon.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.network.SystemMessageId; * Lekon AI. * @author St3eT */ -public final class Lekon extends AbstractNpcAI -{ +public final class Lekon extends AbstractNpcAI { // NPCs private static final int LEKON = 32557; // Items @@ -40,8 +39,7 @@ public final class Lekon extends AbstractNpcAI private static final int MIN_CLAN_LV = 5; private static final int STONE_COUNT = 10; - public Lekon() - { + public Lekon() { super(Lekon.class.getSimpleName(), "gracia/AI/NPC"); addFirstTalkId(LEKON); addTalkId(LEKON); @@ -49,38 +47,25 @@ public final class Lekon extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { - case "32557-01.html": - { + switch (event) { + case "32557-01.html": { htmltext = event; break; } - case "licence": - { + case "licence": { final L2Clan clan = player.getClan(); - if ((clan == null) || !player.isClanLeader() || (clan.getLevel() < MIN_CLAN_LV)) - { + if ((clan == null) || !player.isClanLeader() || (clan.getLevel() < MIN_CLAN_LV)) { htmltext = "32557-02.html"; - } - else if (hasAtLeastOneQuestItem(player, LICENCE)) - { + } else if (hasAtLeastOneQuestItem(player, LICENCE)) { htmltext = "32557-04.html"; - } - else if (AirShipManager.getInstance().hasAirShipLicense(clan.getId())) - { + } else if (AirShipManager.getInstance().hasAirShipLicense(clan.getId())) { player.sendPacket(SystemMessageId.THE_AIRSHIP_SUMMON_LICENSE_ALREADY_ACQUIRED); - } - else if (getQuestItemsCount(player, STONE) >= STONE_COUNT) - { + } else if (getQuestItemsCount(player, STONE) >= STONE_COUNT) { takeItems(player, STONE, STONE_COUNT); giveItems(player, LICENCE, 1); - } - else - { + } else { htmltext = "32557-03.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/Nemo/Nemo.java b/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/Nemo/Nemo.java index ee96f26c5b..d8d8455f62 100644 --- a/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/Nemo/Nemo.java +++ b/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/Nemo/Nemo.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.network.NpcStringId; * Nemo AI. * @author St3eT */ -public final class Nemo extends AbstractNpcAI -{ +public final class Nemo extends AbstractNpcAI { // NPC private static final int NEMO = 32735; // Nemo private static final int MAGUEN = 18839; // Wild Maguen @@ -41,8 +40,7 @@ public final class Nemo extends AbstractNpcAI // Misc private static final int MAXIMUM_MAGUEN = 18; // Maximum maguens in one time - public Nemo() - { + public Nemo() { super(Nemo.class.getSimpleName(), "gracia/AI/NPC"); addStartNpc(NEMO); addFirstTalkId(NEMO); @@ -50,37 +48,26 @@ public final class Nemo extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { - case "32735-01.html": - { + switch (event) { + case "32735-01.html": { htmltext = event; break; } - case "giveCollector": - { - if (hasQuestItems(player, COLLECTOR)) - { + case "giveCollector": { + if (hasQuestItems(player, COLLECTOR)) { htmltext = "32735-03.html"; - } - else if (!player.isInventoryUnder90(false)) - { + } else if (!player.isInventoryUnder90(false)) { htmltext = "32735-04.html"; - } - else - { + } else { htmltext = "32735-02.html"; giveItems(player, COLLECTOR, 1); } break; } - case "summonMaguen": - { - if ((player.getVariables().getInt("TEST_MAGUEN", 0) == 0) && (npc.getScriptValue() < MAXIMUM_MAGUEN)) - { + case "summonMaguen": { + if ((player.getVariables().getInt("TEST_MAGUEN", 0) == 0) && (npc.getScriptValue() < MAXIMUM_MAGUEN)) { final L2Npc maguen = addSpawn(MAGUEN, npc.getLocation(), true, 60000, true); maguen.getVariables().set("SUMMON_PLAYER", player); maguen.getVariables().set("SPAWNED_NPC", npc); @@ -94,18 +81,14 @@ public final class Nemo extends AbstractNpcAI maguenAi().startQuestTimer("DIST_CHECK_TIMER", 1000, maguen, player); npc.setScriptValue(npc.getScriptValue() + 1); htmltext = "32735-05.html"; - } - else - { + } else { htmltext = "32735-06.html"; } break; } - case "DECREASE_COUNT": - { + case "DECREASE_COUNT": { final L2Npc spawnedNpc = npc.getVariables().getObject("SPAWNED_NPC", L2Npc.class); - if ((spawnedNpc != null) && (spawnedNpc.getScriptValue() > 0)) - { + if ((spawnedNpc != null) && (spawnedNpc.getScriptValue() > 0)) { player.getVariables().remove("TEST_MAGUEN"); spawnedNpc.setScriptValue(spawnedNpc.getScriptValue() - 1); } @@ -114,8 +97,7 @@ public final class Nemo extends AbstractNpcAI return htmltext; } - private Quest maguenAi() - { + private Quest maguenAi() { return QuestManager.getInstance().getQuest(Maguen.class.getSimpleName()); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/Nottingale/Nottingale.java b/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/Nottingale/Nottingale.java index c54914f039..1ce0d38bb4 100644 --- a/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/Nottingale/Nottingale.java +++ b/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/Nottingale/Nottingale.java @@ -34,14 +34,12 @@ import com.l2jserver.gameserver.network.serverpackets.RadarControl; * Nottingale AI * @author xban1x */ -public final class Nottingale extends AbstractNpcAI -{ +public final class Nottingale extends AbstractNpcAI { // NPC private static final int NOTTINGALE = 32627; // Misc private static final Map<Integer, RadarControl> RADARS = new HashMap<>(); - static - { + static { RADARS.put(2, new RadarControl(0, -184545, 243120, 1581, 2)); RADARS.put(5, new RadarControl(0, -192361, 254528, 3598, 1)); RADARS.put(6, new RadarControl(0, -174600, 219711, 4424, 1)); @@ -51,8 +49,7 @@ public final class Nottingale extends AbstractNpcAI RADARS.put(10, new RadarControl(0, -246899, 251918, 4352, 1)); } - public Nottingale() - { + public Nottingale() { super(Nottingale.class.getSimpleName(), "gracia/AI/NPC"); addStartNpc(NOTTINGALE); addTalkId(NOTTINGALE); @@ -60,44 +57,29 @@ public final class Nottingale extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { + switch (event) { case "32627-02.html": case "32627-03.html": - case "32627-04.html": - { - if (player.getClan() != null) - { - if (player.hasClanPrivilege(ClanPrivilege.CL_SUMMON_AIRSHIP) && AirShipManager.getInstance().hasAirShipLicense(player.getClanId()) && !AirShipManager.getInstance().hasAirShip(player.getClanId())) - { + case "32627-04.html": { + if (player.getClan() != null) { + if (player.hasClanPrivilege(ClanPrivilege.CL_SUMMON_AIRSHIP) && AirShipManager.getInstance().hasAirShipLicense(player.getClanId()) && !AirShipManager.getInstance().hasAirShip(player.getClanId())) { htmltext = event; - } - else - { + } else { final QuestState st = player.getQuestState(Q10273_GoodDayToFly.class.getSimpleName()); - if ((st != null) && st.isCompleted()) - { + if ((st != null) && st.isCompleted()) { htmltext = event; - } - else - { + } else { player.sendPacket(RADARS.get(2)); htmltext = "32627-01.html"; } } - } - else - { + } else { final QuestState st = player.getQuestState(Q10273_GoodDayToFly.class.getSimpleName()); - if ((st != null) && st.isCompleted()) - { + if ((st != null) && st.isCompleted()) { htmltext = event; - } - else - { + } else { player.sendPacket(RADARS.get(2)); htmltext = "32627-01.html"; } @@ -109,8 +91,7 @@ public final class Nottingale extends AbstractNpcAI case "32627-07.html": case "32627-08.html": case "32627-09.html": - case "32627-10.html": - { + case "32627-10.html": { player.sendPacket(RADARS.get(Integer.valueOf(event.substring(6, 8)))); htmltext = event; break; diff --git a/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/Seyo/Seyo.java b/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/Seyo/Seyo.java index 21a34c2bc2..77a2ed00b8 100644 --- a/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/Seyo/Seyo.java +++ b/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/Seyo/Seyo.java @@ -28,15 +28,13 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Seyo AI. * @author St3eT */ -public final class Seyo extends AbstractNpcAI -{ +public final class Seyo extends AbstractNpcAI { // NPC private static final int SEYO = 32737; // Item private static final int STONE_FRAGMENT = 15486; // Spirit Stone Fragment // Misc - private static final NpcStringId[] TEXT = - { + private static final NpcStringId[] TEXT = { NpcStringId.NO_ONE_ELSE_DONT_WORRY_I_DONT_BITE_HAHA, NpcStringId.OK_MASTER_OF_LUCK_THATS_YOU_HAHA_WELL_ANYONE_CAN_COME_AFTER_ALL, NpcStringId.SHEDDING_BLOOD_IS_A_GIVEN_ON_THE_BATTLEFIELD_AT_LEAST_ITS_SAFE_HERE, @@ -44,8 +42,7 @@ public final class Seyo extends AbstractNpcAI NpcStringId.THERE_WAS_SOMEONE_WHO_WON_10000_FROM_ME_A_WARRIOR_SHOULDNT_JUST_BE_GOOD_AT_FIGHTING_RIGHT_YOUVE_GOTTA_BE_GOOD_IN_EVERYTHING }; - public Seyo() - { + public Seyo() { super(Seyo.class.getSimpleName(), "gracia/AI/NPC"); addStartNpc(SEYO); addTalkId(SEYO); @@ -53,77 +50,52 @@ public final class Seyo extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - if (npc == null) - { + if (npc == null) { return htmltext; } - switch (event) - { - case "TRICKERY_TIMER": - { - if (npc.isScriptValue(1)) - { + switch (event) { + case "TRICKERY_TIMER": { + if (npc.isScriptValue(1)) { npc.setScriptValue(0); broadcastNpcSay(npc, Say2.NPC_ALL, TEXT[getRandom(TEXT.length)]); } break; } - case "give1": - { - if (npc.isScriptValue(1)) - { + case "give1": { + if (npc.isScriptValue(1)) { htmltext = "32737-04.html"; - } - else if (!hasQuestItems(player, STONE_FRAGMENT)) - { + } else if (!hasQuestItems(player, STONE_FRAGMENT)) { htmltext = "32737-01.html"; - } - else - { + } else { npc.setScriptValue(1); takeItems(player, STONE_FRAGMENT, 1); - if (getRandom(100) == 0) - { + if (getRandom(100) == 0) { giveItems(player, STONE_FRAGMENT, 100); broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.AMAZING_S1_TOOK_100_OF_THESE_SOUL_STONE_FRAGMENTS_WHAT_A_COMPLETE_SWINDLER, player.getName()); - } - else - { + } else { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.HMM_HEY_DID_YOU_GIVE_S1_SOMETHING_BUT_IT_WAS_JUST_1_HAHA, player.getName()); } startQuestTimer("TRICKERY_TIMER", 5000, npc, null); } break; } - case "give5": - { - if (npc.isScriptValue(1)) - { + case "give5": { + if (npc.isScriptValue(1)) { htmltext = "32737-04.html"; - } - else if (getQuestItemsCount(player, STONE_FRAGMENT) < 5) - { + } else if (getQuestItemsCount(player, STONE_FRAGMENT) < 5) { htmltext = "32737-02.html"; - } - else - { + } else { npc.setScriptValue(1); takeItems(player, STONE_FRAGMENT, 5); final int chance = getRandom(100); - if (chance < 20) - { + if (chance < 20) { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.AHEM_S1_HAS_NO_LUCK_AT_ALL_TRY_PRAYING, player.getName()); - } - else if (chance < 80) - { + } else if (chance < 80) { giveItems(player, STONE_FRAGMENT, 1); broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.ITS_BETTER_THAN_LOSING_IT_ALL_RIGHT_OR_DOES_THIS_FEEL_WORSE); - } - else - { + } else { final int itemCount = getRandom(10, 16); giveItems(player, STONE_FRAGMENT, itemCount); broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.S1_PULLED_ONE_WITH_S2_DIGITS_LUCKY_NOT_BAD, player.getName(), String.valueOf(itemCount)); @@ -132,33 +104,22 @@ public final class Seyo extends AbstractNpcAI } break; } - case "give20": - { - if (npc.isScriptValue(1)) - { + case "give20": { + if (npc.isScriptValue(1)) { htmltext = "32737-04.html"; - } - else if (getQuestItemsCount(player, STONE_FRAGMENT) < 20) - { + } else if (getQuestItemsCount(player, STONE_FRAGMENT) < 20) { htmltext = "32737-03.html"; - } - else - { + } else { npc.setScriptValue(1); takeItems(player, STONE_FRAGMENT, 20); final int chance = getRandom(10000); - if (chance == 0) - { + if (chance == 0) { giveItems(player, STONE_FRAGMENT, 10000); broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.AH_ITS_OVER_WHAT_KIND_OF_GUY_IS_THAT_DAMN_FINE_YOU_S1_TAKE_IT_AND_GET_OUTTA_HERE, player.getName()); - } - else if (chance < 10) - { + } else if (chance < 10) { giveItems(player, STONE_FRAGMENT, 1); broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.YOU_DONT_FEEL_BAD_RIGHT_ARE_YOU_SAD_BUT_DONT_CRY); - } - else - { + } else { giveItems(player, STONE_FRAGMENT, getRandom(1, 100)); broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.A_BIG_PIECE_IS_MADE_UP_OF_LITTLE_PIECES_SO_HERES_A_LITTLE_PIECE); } diff --git a/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/ZealotOfShilen/ZealotOfShilen.java b/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/ZealotOfShilen/ZealotOfShilen.java index 0bb19e2e38..8e522847d0 100644 --- a/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/ZealotOfShilen/ZealotOfShilen.java +++ b/src/main/java/com/l2jserver/datapack/gracia/AI/NPC/ZealotOfShilen/ZealotOfShilen.java @@ -29,18 +29,15 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Zealot of Shilen AI. * @author nonom */ -public final class ZealotOfShilen extends AbstractNpcAI -{ +public final class ZealotOfShilen extends AbstractNpcAI { // NPCs private static final int ZEALOT = 18782; - private static final int[] GUARDS = - { + private static final int[] GUARDS = { 32628, 32629 }; - public ZealotOfShilen() - { + public ZealotOfShilen() { super(ZealotOfShilen.class.getSimpleName(), "gracia/AI/NPC"); addSpawnId(ZEALOT); addSpawnId(GUARDS); @@ -48,20 +45,15 @@ public final class ZealotOfShilen extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (npc == null) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (npc == null) { return null; } startQuestTimer("WATCHING", 10000, npc, null, true); - if (event.equalsIgnoreCase("WATCHING") && !npc.isAttackingNow()) - { - for (L2Character character : npc.getKnownList().getKnownCharacters()) - { - if (character.isMonster() && !character.isDead() && !((L2Attackable) character).isDecayed()) - { + if (event.equalsIgnoreCase("WATCHING") && !npc.isAttackingNow()) { + for (L2Character character : npc.getKnownList().getKnownCharacters()) { + if (character.isMonster() && !character.isDead() && !((L2Attackable) character).isDecayed()) { npc.setRunning(); ((L2Attackable) npc).addDamageHate(character, 0, 999); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, character, null); @@ -72,20 +64,15 @@ public final class ZealotOfShilen extends AbstractNpcAI } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return (npc.isAttackingNow()) ? "32628-01.html" : npc.getId() + ".html"; } @Override - public String onSpawn(L2Npc npc) - { - if (npc.getId() == ZEALOT) - { + public String onSpawn(L2Npc npc) { + if (npc.getId() == ZEALOT) { npc.setIsNoRndWalk(true); - } - else - { + } else { npc.setIsInvul(true); ((L2Attackable) npc).setCanReturnToSpawnPoint(false); startQuestTimer("WATCHING", 10000, npc, null, true); diff --git a/src/main/java/com/l2jserver/datapack/gracia/AI/SeedOfAnnihilation/SeedOfAnnihilation.java b/src/main/java/com/l2jserver/datapack/gracia/AI/SeedOfAnnihilation/SeedOfAnnihilation.java index 872aec3f9d..463e87e5e1 100644 --- a/src/main/java/com/l2jserver/datapack/gracia/AI/SeedOfAnnihilation/SeedOfAnnihilation.java +++ b/src/main/java/com/l2jserver/datapack/gracia/AI/SeedOfAnnihilation/SeedOfAnnihilation.java @@ -38,8 +38,7 @@ import com.l2jserver.gameserver.util.Util; * Seed Of Annihilation AI. * @author Gigiikun */ -public class SeedOfAnnihilation extends AbstractNpcAI -{ +public class SeedOfAnnihilation extends AbstractNpcAI { private static final Map<Integer, Location> TELEPORT_ZONES = new HashMap<>(); private static final int ANNIHILATION_FURNACE = 18928; @@ -48,8 +47,7 @@ public class SeedOfAnnihilation extends AbstractNpcAI private static final SkillHolder TREYKAN_TRANSFORMATION = new SkillHolder(6649); // Strength, Agility, Wisdom - private static final int[] ZONE_BUFFS = - { + private static final int[] ZONE_BUFFS = { 0, 6443, 6444, @@ -72,26 +70,21 @@ public class SeedOfAnnihilation extends AbstractNpcAI private final SeedRegion[] _regionsData = new SeedRegion[3]; private Long _seedsNextStatusChange; - static - { + static { TELEPORT_ZONES.put(60002, new Location(-213175, 182648, -10992)); TELEPORT_ZONES.put(60003, new Location(-181217, 186711, -10528)); TELEPORT_ZONES.put(60004, new Location(-180211, 182984, -15152)); TELEPORT_ZONES.put(60005, new Location(-179275, 186802, -10720)); } - public SeedOfAnnihilation() - { + public SeedOfAnnihilation() { super(SeedOfAnnihilation.class.getSimpleName(), "gracia/AI"); loadSeedRegionData(); - for (int i : TELEPORT_ZONES.keySet()) - { + for (int i : TELEPORT_ZONES.keySet()) { addEnterZoneId(i); } - for (SeedRegion element : _regionsData) - { - for (int elite_mob_id : element.elite_mob_ids) - { + for (SeedRegion element : _regionsData) { + for (int elite_mob_id : element.elite_mob_ids) { addSpawnId(elite_mob_id); } } @@ -100,17 +93,14 @@ public class SeedOfAnnihilation extends AbstractNpcAI startEffectZonesControl(); } - public void loadSeedRegionData() - { + public void loadSeedRegionData() { // Bistakon data - _regionsData[0] = new SeedRegion(new int[] - { + _regionsData[0] = new SeedRegion(new int[] { 22750, 22751, 22752, 22753 - }, new int[][] - { + }, new int[][] { { 22746, 22746, @@ -131,8 +121,7 @@ public class SeedOfAnnihilation extends AbstractNpcAI 22749, 22749 } - }, 60006, new int[][] - { + }, 60006, new int[][] { { -180450, 185507, @@ -148,20 +137,17 @@ public class SeedOfAnnihilation extends AbstractNpcAI }); // Reptilikon data - _regionsData[1] = new SeedRegion(new int[] - { + _regionsData[1] = new SeedRegion(new int[] { 22757, 22758, 22759 - }, new int[][] - { + }, new int[][] { { 22754, 22755, 22756 } - }, 60007, new int[][] - { + }, 60007, new int[][] { { -179600, 186998, @@ -177,13 +163,11 @@ public class SeedOfAnnihilation extends AbstractNpcAI }); // Cokrakon data - _regionsData[2] = new SeedRegion(new int[] - { + _regionsData[2] = new SeedRegion(new int[] { 22763, 22764, 22765 - }, new int[][] - { + }, new int[][] { { 22760, 22760, @@ -214,8 +198,7 @@ public class SeedOfAnnihilation extends AbstractNpcAI 22762, 22761 } - }, 60008, new int[][] - { + }, 60008, new int[][] { { -180971, 186361, @@ -232,44 +215,35 @@ public class SeedOfAnnihilation extends AbstractNpcAI int buffsNow = 0; String var = loadGlobalQuestVar("SeedNextStatusChange"); - if (var.equalsIgnoreCase("") || (Long.parseLong(var) < System.currentTimeMillis())) - { + if (var.equalsIgnoreCase("") || (Long.parseLong(var) < System.currentTimeMillis())) { buffsNow = getRandom(ZONE_BUFFS_LIST.length); saveGlobalQuestVar("SeedBuffsList", String.valueOf(buffsNow)); _seedsNextStatusChange = getNextSeedsStatusChangeTime(); saveGlobalQuestVar("SeedNextStatusChange", String.valueOf(_seedsNextStatusChange)); - } - else - { + } else { _seedsNextStatusChange = Long.parseLong(var); buffsNow = Integer.parseInt(loadGlobalQuestVar("SeedBuffsList")); } - for (int i = 0; i < _regionsData.length; i++) - { + for (int i = 0; i < _regionsData.length; i++) { _regionsData[i].activeBuff = ZONE_BUFFS_LIST[buffsNow][i]; } } - private Long getNextSeedsStatusChangeTime() - { + private Long getNextSeedsStatusChangeTime() { Calendar reenter = Calendar.getInstance(); reenter.set(Calendar.SECOND, 0); reenter.set(Calendar.MINUTE, 0); reenter.set(Calendar.HOUR_OF_DAY, 13); reenter.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); - if (reenter.getTimeInMillis() <= System.currentTimeMillis()) - { + if (reenter.getTimeInMillis() <= System.currentTimeMillis()) { reenter.add(Calendar.DAY_OF_MONTH, 7); } return reenter.getTimeInMillis(); } - private void startEffectZonesControl() - { - for (int i = 0; i < _regionsData.length; i++) - { - for (int j = 0; j < _regionsData[i].af_spawns.length; j++) - { + private void startEffectZonesControl() { + for (int i = 0; i < _regionsData.length; i++) { + for (int j = 0; j < _regionsData[i].af_spawns.length; j++) { _regionsData[i].af_npcs[j] = addSpawn(ANNIHILATION_FURNACE, _regionsData[i].af_spawns[j][0], _regionsData[i].af_spawns[j][1], _regionsData[i].af_spawns[j][2], _regionsData[i].af_spawns[j][3], false, 0); _regionsData[i].af_npcs[j].setDisplayEffect(_regionsData[i].activeBuff); } @@ -278,21 +252,16 @@ public class SeedOfAnnihilation extends AbstractNpcAI startQuestTimer("ChangeSeedsStatus", _seedsNextStatusChange - System.currentTimeMillis(), null, null); } - private void spawnGroupOfMinion(L2MonsterInstance npc, int[] mobIds) - { - for (int mobId : mobIds) - { + private void spawnGroupOfMinion(L2MonsterInstance npc, int[] mobIds) { + for (int mobId : mobIds) { addMinion(npc, mobId); } } @Override - public String onSpawn(L2Npc npc) - { - for (SeedRegion element : _regionsData) - { - if (Util.contains(element.elite_mob_ids, npc.getId())) - { + public String onSpawn(L2Npc npc) { + for (SeedRegion element : _regionsData) { + if (Util.contains(element.elite_mob_ids, npc.getId())) { spawnGroupOfMinion((L2MonsterInstance) npc, element.minion_lists[getRandom(element.minion_lists.length)]); } } @@ -300,20 +269,16 @@ public class SeedOfAnnihilation extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equalsIgnoreCase("ChangeSeedsStatus")) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equalsIgnoreCase("ChangeSeedsStatus")) { int buffsNow = getRandom(ZONE_BUFFS_LIST.length); saveGlobalQuestVar("SeedBuffsList", String.valueOf(buffsNow)); _seedsNextStatusChange = getNextSeedsStatusChangeTime(); saveGlobalQuestVar("SeedNextStatusChange", String.valueOf(_seedsNextStatusChange)); - for (int i = 0; i < _regionsData.length; i++) - { + for (int i = 0; i < _regionsData.length; i++) { _regionsData[i].activeBuff = ZONE_BUFFS_LIST[buffsNow][i]; - for (L2Npc af : _regionsData[i].af_npcs) - { + for (L2Npc af : _regionsData[i].af_npcs) { af.setDisplayEffect(_regionsData[i].activeBuff); } @@ -322,15 +287,10 @@ public class SeedOfAnnihilation extends AbstractNpcAI zone.addSkill(ZONE_BUFFS[_regionsData[i].activeBuff], 1); } startQuestTimer("ChangeSeedsStatus", _seedsNextStatusChange - System.currentTimeMillis(), null, null); - } - else if (event.equalsIgnoreCase("transform")) - { - if (player.isAffectedBySkill(SOUL_WEAKNESS.getSkillId())) - { + } else if (event.equalsIgnoreCase("transform")) { + if (player.isAffectedBySkill(SOUL_WEAKNESS.getSkillId())) { npc.showChatWindow(player, 2); - } - else - { + } else { npc.setTarget(player); npc.doCast(SOUL_WEAKNESS); npc.doCast(TREYKAN_TRANSFORMATION); @@ -341,18 +301,15 @@ public class SeedOfAnnihilation extends AbstractNpcAI } @Override - public String onEnterZone(L2Character character, L2ZoneType zone) - { - if (TELEPORT_ZONES.containsKey(zone.getId())) - { + public String onEnterZone(L2Character character, L2ZoneType zone) { + if (TELEPORT_ZONES.containsKey(zone.getId())) { Location teleLoc = TELEPORT_ZONES.get(zone.getId()); character.teleToLocation(teleLoc, false); } return super.onEnterZone(character, zone); } - private static class SeedRegion - { + private static class SeedRegion { public int[] elite_mob_ids; public int[][] minion_lists; public int buff_zone; @@ -360,8 +317,7 @@ public class SeedOfAnnihilation extends AbstractNpcAI public L2Npc[] af_npcs = new L2Npc[2]; public int activeBuff = 0; - public SeedRegion(int[] emi, int[][] ml, int bz, int[][] as) - { + public SeedRegion(int[] emi, int[][] ml, int bz, int[][] as) { elite_mob_ids = emi; minion_lists = ml; buff_zone = bz; diff --git a/src/main/java/com/l2jserver/datapack/gracia/AI/StarStones.java b/src/main/java/com/l2jserver/datapack/gracia/AI/StarStones.java index 4fffb01c39..f2e410ab9c 100644 --- a/src/main/java/com/l2jserver/datapack/gracia/AI/StarStones.java +++ b/src/main/java/com/l2jserver/datapack/gracia/AI/StarStones.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.network.SystemMessageId; * Star Stones AI. * @author Gigiikun */ -public class StarStones extends AbstractNpcAI -{ +public class StarStones extends AbstractNpcAI { // @formatter:off private static final int[] MOBS = { @@ -40,21 +39,17 @@ public class StarStones extends AbstractNpcAI private static final int COLLECTION_RATE = 1; - public StarStones() - { + public StarStones() { super(StarStones.class.getSimpleName(), "gracia/AI"); addSkillSeeId(MOBS); } @Override - public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) - { - if (skill.getId() == 932) - { + public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) { + if (skill.getId() == 932) { int itemId = 0; - switch (npc.getId()) - { + switch (npc.getId()) { case 18684: case 18685: case 18686: @@ -77,18 +72,13 @@ public class StarStones extends AbstractNpcAI // unknown npc! return super.onSkillSee(npc, caster, skill, targets, isSummon); } - if (getRandom(100) < 33) - { + if (getRandom(100) < 33) { caster.sendPacket(SystemMessageId.THE_COLLECTION_HAS_SUCCEEDED); caster.addItem("StarStone", itemId, getRandom(COLLECTION_RATE + 1, 2 * COLLECTION_RATE), null, true); - } - else if (((skill.getLevel() == 1) && (getRandom(100) < 15)) || ((skill.getLevel() == 2) && (getRandom(100) < 50)) || ((skill.getLevel() == 3) && (getRandom(100) < 75))) - { + } else if (((skill.getLevel() == 1) && (getRandom(100) < 15)) || ((skill.getLevel() == 2) && (getRandom(100) < 50)) || ((skill.getLevel() == 3) && (getRandom(100) < 75))) { caster.sendPacket(SystemMessageId.THE_COLLECTION_HAS_SUCCEEDED); caster.addItem("StarStone", itemId, getRandom(1, COLLECTION_RATE), null, true); - } - else - { + } else { caster.sendPacket(SystemMessageId.THE_COLLECTION_HAS_FAILED); } npc.deleteMe(); diff --git a/src/main/java/com/l2jserver/datapack/gracia/instances/SecretArea/SecretArea.java b/src/main/java/com/l2jserver/datapack/gracia/instances/SecretArea/SecretArea.java index 489f6b3f93..a629c7f61f 100644 --- a/src/main/java/com/l2jserver/datapack/gracia/instances/SecretArea/SecretArea.java +++ b/src/main/java/com/l2jserver/datapack/gracia/instances/SecretArea/SecretArea.java @@ -30,10 +30,8 @@ import com.l2jserver.gameserver.network.SystemMessageId; * Secret Area in the Keucereus Fortress instance zone. * @author Gladicek */ -public final class SecretArea extends Quest -{ - protected class SAWorld extends InstanceWorld - { +public final class SecretArea extends Quest { + protected class SAWorld extends InstanceWorld { } @@ -42,28 +40,23 @@ public final class SecretArea extends Quest private static final int LELRIKIA = 32567; private static final int ENTER = 0; private static final int EXIT = 1; - private static final Location[] TELEPORTS = - { + private static final Location[] TELEPORTS = { new Location(-23758, -8959, -5384), new Location(-185057, 242821, 1576) }; - public SecretArea() - { + public SecretArea() { super(-1, SecretArea.class.getSimpleName(), "gracia/instances"); addStartNpc(GINBY); addTalkId(GINBY); addTalkId(LELRIKIA); } - protected void enterInstance(L2PcInstance player) - { + protected void enterInstance(L2PcInstance player) { InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - if (world != null) - { - if (world instanceof SAWorld) - { + if (world != null) { + if (world instanceof SAWorld) { teleportPlayer(player, TELEPORTS[ENTER], world.getInstanceId()); return; } @@ -81,16 +74,12 @@ public final class SecretArea extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); - if ((npc.getId() == GINBY) && event.equalsIgnoreCase("enter")) - { + if ((npc.getId() == GINBY) && event.equalsIgnoreCase("enter")) { enterInstance(player); return "32566-01.html"; - } - else if ((npc.getId() == LELRIKIA) && event.equalsIgnoreCase("exit")) - { + } else if ((npc.getId() == LELRIKIA) && event.equalsIgnoreCase("exit")) { teleportPlayer(player, TELEPORTS[EXIT], 0); return "32567-01.html"; } diff --git a/src/main/java/com/l2jserver/datapack/gracia/instances/SeedOfDestruction/Stage1.java b/src/main/java/com/l2jserver/datapack/gracia/instances/SeedOfDestruction/Stage1.java index 77ba6e43aa..b532e3574f 100644 --- a/src/main/java/com/l2jserver/datapack/gracia/instances/SeedOfDestruction/Stage1.java +++ b/src/main/java/com/l2jserver/datapack/gracia/instances/SeedOfDestruction/Stage1.java @@ -75,10 +75,8 @@ import com.l2jserver.gameserver.util.Util; * Please maintain consistency between the Seed scripts. * @author Gigiikun */ -public final class Stage1 extends AbstractInstance -{ - protected class SOD1World extends InstanceWorld - { +public final class Stage1 extends AbstractInstance { + protected class SOD1World extends InstanceWorld { protected List<L2PcInstance> playersInside = new ArrayList<>(); protected Map<L2Npc, Boolean> npcList = new HashMap<>(); protected int deviceSpawnedMobCount = 0; @@ -86,8 +84,7 @@ public final class Stage1 extends AbstractInstance protected L2MonsterInstance tiat; } - protected static class SODSpawn - { + protected static class SODSpawn { public boolean isZone = false; public boolean isNeededNextFlag = false; public int npcId; @@ -118,15 +115,13 @@ public final class Stage1 extends AbstractInstance private static final SkillHolder TRAP_HOLD = new SkillHolder(4186, 9); // 18720-18728 private static final SkillHolder TRAP_STUN = new SkillHolder(4072, 10); // 18729-18736 private static final SkillHolder TRAP_DAMAGE = new SkillHolder(5340, 4); // 18737-18770 - private static final int[] TRAP_18771_NPCS = - { + private static final int[] TRAP_18771_NPCS = { 22541, 22544, 22541, 22544 }; - private static final int[] TRAP_OTHER_NPCS = - { + private static final int[] TRAP_OTHER_NPCS = { 22546, 22546, 22538, @@ -150,8 +145,7 @@ public final class Stage1 extends AbstractInstance private static final Location MOVE_TO_DOOR = new Location(-251432, 214905, -12088, 16384); // TODO: handle this better - private static final int[] SPAWN_MOB_IDS = - { + private static final int[] SPAWN_MOB_IDS = { 22536, 22537, 22538, @@ -169,8 +163,7 @@ public final class Stage1 extends AbstractInstance }; // Doors/Walls/Zones - private static final int[] ATTACKABLE_DOORS = - { + private static final int[] ATTACKABLE_DOORS = { 12240005, 12240006, 12240007, @@ -194,13 +187,11 @@ public final class Stage1 extends AbstractInstance 12240030 }; - private static final int[] ENTRANCE_ROOM_DOORS = - { + private static final int[] ENTRANCE_ROOM_DOORS = { 12240001, 12240002 }; - private static final int[] SQUARE_DOORS = - { + private static final int[] SQUARE_DOORS = { 12240003, 12240004, 12240011, @@ -212,8 +203,7 @@ public final class Stage1 extends AbstractInstance private static final int FORTRESS_DOOR = 12240030; private static final int THRONE_DOOR = 12240031; - public Stage1() - { + public Stage1() { super(Stage1.class.getSimpleName(), "gracia/instances"); load(); addStartNpc(ALENOS, TELEPORT); @@ -224,149 +214,111 @@ public final class Stage1 extends AbstractInstance addKillId(_mustKillMobsId); addAggroRangeEnterId(TIAT_VIDEO_NPC); // registering spawn traps which handled in this script - for (int i = 18771; i <= 18774; i++) - { + for (int i = 18771; i <= 18774; i++) { addTrapActionId(i); } } - private void load() - { + private void load() { int spawnCount = 0; - try - { + try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false); factory.setIgnoringComments(true); File file = new File(server().getDatapackRoot(), "/data/spawnZones/seed_of_destruction.xml"); - if (!file.exists()) - { + if (!file.exists()) { _log.severe("[Seed of Destruction] Missing seed_of_destruction.xml. The quest wont work without it!"); return; } Document doc = factory.newDocumentBuilder().parse(file); Node first = doc.getFirstChild(); - if ((first != null) && "list".equalsIgnoreCase(first.getNodeName())) - { - for (Node n = first.getFirstChild(); n != null; n = n.getNextSibling()) - { - if ("npc".equalsIgnoreCase(n.getNodeName())) - { - for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) - { - if ("spawn".equalsIgnoreCase(d.getNodeName())) - { + if ((first != null) && "list".equalsIgnoreCase(first.getNodeName())) { + for (Node n = first.getFirstChild(); n != null; n = n.getNextSibling()) { + if ("npc".equalsIgnoreCase(n.getNodeName())) { + for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) { + if ("spawn".equalsIgnoreCase(d.getNodeName())) { NamedNodeMap attrs = d.getAttributes(); Node att = attrs.getNamedItem("npcId"); - if (att == null) - { + if (att == null) { _log.severe("[Seed of Destruction] Missing npcId in npc List, skipping"); continue; } int npcId = Integer.parseInt(attrs.getNamedItem("npcId").getNodeValue()); att = attrs.getNamedItem("flag"); - if (att == null) - { + if (att == null) { _log.severe("[Seed of Destruction] Missing flag in npc List npcId: " + npcId + ", skipping"); continue; } int flag = Integer.parseInt(attrs.getNamedItem("flag").getNodeValue()); - if (!_spawnList.containsKey(flag)) - { + if (!_spawnList.containsKey(flag)) { _spawnList.put(flag, new ArrayList<SODSpawn>()); } - for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling()) - { - if ("loc".equalsIgnoreCase(cd.getNodeName())) - { + for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling()) { + if ("loc".equalsIgnoreCase(cd.getNodeName())) { attrs = cd.getAttributes(); SODSpawn spw = new SODSpawn(); spw.npcId = npcId; att = attrs.getNamedItem("x"); - if (att != null) - { + if (att != null) { spw.x = Integer.parseInt(att.getNodeValue()); - } - else - { + } else { continue; } att = attrs.getNamedItem("y"); - if (att != null) - { + if (att != null) { spw.y = Integer.parseInt(att.getNodeValue()); - } - else - { + } else { continue; } att = attrs.getNamedItem("z"); - if (att != null) - { + if (att != null) { spw.z = Integer.parseInt(att.getNodeValue()); - } - else - { + } else { continue; } att = attrs.getNamedItem("heading"); - if (att != null) - { + if (att != null) { spw.h = Integer.parseInt(att.getNodeValue()); - } - else - { + } else { continue; } att = attrs.getNamedItem("mustKill"); - if (att != null) - { + if (att != null) { spw.isNeededNextFlag = Boolean.parseBoolean(att.getNodeValue()); } - if (spw.isNeededNextFlag) - { + if (spw.isNeededNextFlag) { _mustKillMobsId.add(npcId); } _spawnList.get(flag).add(spw); spawnCount++; - } - else if ("zone".equalsIgnoreCase(cd.getNodeName())) - { + } else if ("zone".equalsIgnoreCase(cd.getNodeName())) { attrs = cd.getAttributes(); SODSpawn spw = new SODSpawn(); spw.npcId = npcId; spw.isZone = true; att = attrs.getNamedItem("id"); - if (att != null) - { + if (att != null) { spw.zone = Integer.parseInt(att.getNodeValue()); - } - else - { + } else { continue; } att = attrs.getNamedItem("count"); - if (att != null) - { + if (att != null) { spw.count = Integer.parseInt(att.getNodeValue()); - } - else - { + } else { continue; } att = attrs.getNamedItem("mustKill"); - if (att != null) - { + if (att != null) { spw.isNeededNextFlag = Boolean.parseBoolean(att.getNodeValue()); } - if (spw.isNeededNextFlag) - { + if (spw.isNeededNextFlag) { _mustKillMobsId.add(npcId); } _spawnList.get(flag).add(spw); @@ -375,59 +327,44 @@ public final class Stage1 extends AbstractInstance } } } - } - else if ("spawnZones".equalsIgnoreCase(n.getNodeName())) - { - for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) - { - if ("zone".equalsIgnoreCase(d.getNodeName())) - { + } else if ("spawnZones".equalsIgnoreCase(n.getNodeName())) { + for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) { + if ("zone".equalsIgnoreCase(d.getNodeName())) { NamedNodeMap attrs = d.getAttributes(); Node att = attrs.getNamedItem("id"); - if (att == null) - { + if (att == null) { _log.severe("[Seed of Destruction] Missing id in spawnZones List, skipping"); continue; } int id = Integer.parseInt(att.getNodeValue()); att = attrs.getNamedItem("minZ"); - if (att == null) - { + if (att == null) { _log.severe("[Seed of Destruction] Missing minZ in spawnZones List id: " + id + ", skipping"); continue; } int minz = Integer.parseInt(att.getNodeValue()); att = attrs.getNamedItem("maxZ"); - if (att == null) - { + if (att == null) { _log.severe("[Seed of Destruction] Missing maxZ in spawnZones List id: " + id + ", skipping"); continue; } int maxz = Integer.parseInt(att.getNodeValue()); L2Territory ter = new L2Territory(id); - for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling()) - { - if ("point".equalsIgnoreCase(cd.getNodeName())) - { + for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling()) { + if ("point".equalsIgnoreCase(cd.getNodeName())) { attrs = cd.getAttributes(); int x, y; att = attrs.getNamedItem("x"); - if (att != null) - { + if (att != null) { x = Integer.parseInt(att.getNodeValue()); - } - else - { + } else { continue; } att = attrs.getNamedItem("y"); - if (att != null) - { + if (att != null) { y = Integer.parseInt(att.getNodeValue()); - } - else - { + } else { continue; } @@ -441,66 +378,51 @@ public final class Stage1 extends AbstractInstance } } } - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, "[Seed of Destruction] Could not parse data.xml file: " + e.getMessage(), e); } - if (general().debug()) - { + if (general().debug()) { _log.info("[Seed of Destruction] Loaded " + spawnCount + " spawns data."); _log.info("[Seed of Destruction] Loaded " + _spawnZoneList.size() + " spawn zones data."); } } @Override - protected boolean checkConditions(L2PcInstance player) - { - if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) - { + protected boolean checkConditions(L2PcInstance player) { + if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) { return true; } final L2Party party = player.getParty(); - if (party == null) - { + if (party == null) { player.sendPacket(SystemMessageId.NOT_IN_PARTY_CANT_ENTER); return false; } final L2CommandChannel channel = party.getCommandChannel(); - if (channel == null) - { + if (channel == null) { player.sendPacket(SystemMessageId.NOT_IN_COMMAND_CHANNEL_CANT_ENTER); return false; - } - else if (channel.getLeader() != player) - { + } else if (channel.getLeader() != player) { player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); return false; - } - else if ((channel.getMemberCount() < MIN_PLAYERS) || (channel.getMemberCount() > MAX_PLAYERS)) - { + } else if ((channel.getMemberCount() < MIN_PLAYERS) || (channel.getMemberCount() > MAX_PLAYERS)) { player.sendPacket(SystemMessageId.PARTY_EXCEEDED_THE_LIMIT_CANT_ENTER); return false; } - for (L2PcInstance partyMember : channel.getMembers()) - { - if (partyMember.getLevel() < MIN_LEVEL) - { + for (L2PcInstance partyMember : channel.getMembers()) { + if (partyMember.getLevel() < MIN_LEVEL) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; } - if (!Util.checkIfInRange(1000, player, partyMember, true)) - { + if (!Util.checkIfInRange(1000, player, partyMember, true)) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; } - if (System.currentTimeMillis() < InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), TEMPLATE_ID)) - { + if (System.currentTimeMillis() < InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), TEMPLATE_ID)) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET); sm.addPcName(partyMember); party.broadcastPacket(sm); @@ -511,123 +433,86 @@ public final class Stage1 extends AbstractInstance } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { - if (!player.isInParty()) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { + if (!player.isInParty()) { managePlayerEnter(player, (SOD1World) world); - } - else if (player.getParty().isInCommandChannel()) - { - for (L2PcInstance players : player.getParty().getCommandChannel().getMembers()) - { + } else if (player.getParty().isInCommandChannel()) { + for (L2PcInstance players : player.getParty().getCommandChannel().getMembers()) { managePlayerEnter(players, (SOD1World) world); } - } - else - { - for (L2PcInstance players : player.getParty().getMembers()) - { + } else { + for (L2PcInstance players : player.getParty().getMembers()) { managePlayerEnter(players, (SOD1World) world); } } spawnState((SOD1World) world); - for (L2DoorInstance door : InstanceManager.getInstance().getInstance(world.getInstanceId()).getDoors()) - { - if (Util.contains(ATTACKABLE_DOORS, door.getId())) - { + for (L2DoorInstance door : InstanceManager.getInstance().getInstance(world.getInstanceId()).getDoors()) { + if (Util.contains(ATTACKABLE_DOORS, door.getId())) { door.setIsAttackableDoor(true); } } - } - else - { + } else { teleportPlayer(player, ENTER_TELEPORT_1, world.getInstanceId()); } } - private void managePlayerEnter(L2PcInstance player, SOD1World world) - { + private void managePlayerEnter(L2PcInstance player, SOD1World world) { world.playersInside.add(player); world.addAllowed(player.getObjectId()); teleportPlayer(player, ENTER_TELEPORT_1, world.getInstanceId(), false); } - protected boolean checkKillProgress(L2Npc mob, SOD1World world) - { - if (world.npcList.containsKey(mob)) - { + protected boolean checkKillProgress(L2Npc mob, SOD1World world) { + if (world.npcList.containsKey(mob)) { world.npcList.put(mob, true); } - for (boolean isDead : world.npcList.values()) - { - if (!isDead) - { + for (boolean isDead : world.npcList.values()) { + if (!isDead) { return false; } } return true; } - private void spawnFlaggedNPCs(SOD1World world, int flag) - { - if (world.lock.tryLock()) - { - try - { - for (SODSpawn spw : _spawnList.get(flag)) - { - if (spw.isZone) - { - for (int i = 0; i < spw.count; i++) - { - if (_spawnZoneList.containsKey(spw.zone)) - { + private void spawnFlaggedNPCs(SOD1World world, int flag) { + if (world.lock.tryLock()) { + try { + for (SODSpawn spw : _spawnList.get(flag)) { + if (spw.isZone) { + for (int i = 0; i < spw.count; i++) { + if (_spawnZoneList.containsKey(spw.zone)) { final Location location = _spawnZoneList.get(spw.zone).getRandomPoint(); - if (location != null) - { + if (location != null) { spawn(world, spw.npcId, location.getX(), location.getY(), GeoData.getInstance().getSpawnHeight(location), getRandom(65535), spw.isNeededNextFlag); } - } - else - { + } else { _log.info("[Seed of Destruction] Missing zone: " + spw.zone); } } - } - else - { + } else { spawn(world, spw.npcId, spw.x, spw.y, spw.z, spw.h, spw.isNeededNextFlag); } } - } - finally - { + } finally { world.lock.unlock(); } } } - protected boolean spawnState(SOD1World world) - { - if (world.lock.tryLock()) - { - try - { + protected boolean spawnState(SOD1World world) { + if (world.lock.tryLock()) { + try { world.npcList.clear(); - switch (world.getStatus()) - { + switch (world.getStatus()) { case 0: spawnFlaggedNPCs(world, 0); break; case 1: manageScreenMsg(world, NpcStringId.THE_ENEMIES_HAVE_ATTACKED_EVERYONE_COME_OUT_AND_FIGHT_URGH); - for (int i : ENTRANCE_ROOM_DOORS) - { + for (int i : ENTRANCE_ROOM_DOORS) { openDoor(i, world.getInstanceId()); } spawnFlaggedNPCs(world, 1); @@ -638,8 +523,7 @@ public final class Stage1 extends AbstractInstance return true; case 4: manageScreenMsg(world, NpcStringId.OBELISK_HAS_COLLAPSED_DONT_LET_THE_ENEMIES_JUMP_AROUND_WILDLY_ANYMORE); - for (int i : SQUARE_DOORS) - { + for (int i : SQUARE_DOORS) { openDoor(i, world.getInstanceId()); } spawnFlaggedNPCs(world, 4); @@ -666,31 +550,22 @@ public final class Stage1 extends AbstractInstance } world.incStatus(); return true; - } - finally - { + } finally { world.lock.unlock(); } } return false; } - protected void spawn(SOD1World world, int npcId, int x, int y, int z, int h, boolean addToKillTable) - { + protected void spawn(SOD1World world, int npcId, int x, int y, int z, int h, boolean addToKillTable) { // traps - if ((npcId >= 18720) && (npcId <= 18774)) - { + if ((npcId >= 18720) && (npcId <= 18774)) { Skill skill = null; - if (npcId <= 18728) - { + if (npcId <= 18728) { skill = TRAP_HOLD.getSkill(); - } - else if (npcId <= 18736) - { + } else if (npcId <= 18736) { skill = TRAP_STUN.getSkill(); - } - else if (npcId <= 18770) - { + } else if (npcId <= 18770) { skill = TRAP_DAMAGE.getSkill(); } @@ -698,78 +573,56 @@ public final class Stage1 extends AbstractInstance return; } L2Npc npc = addSpawn(npcId, x, y, z, h, false, 0, false, world.getInstanceId()); - if (addToKillTable) - { + if (addToKillTable) { world.npcList.put(npc, false); } npc.setIsNoRndWalk(true); - if (npc.isInstanceTypes(InstanceType.L2Attackable)) - { + if (npc.isInstanceTypes(InstanceType.L2Attackable)) { ((L2Attackable) npc).setSeeThroughSilentMove(true); } - if (npcId == TIAT_VIDEO_NPC) - { + if (npcId == TIAT_VIDEO_NPC) { startQuestTimer("DoorCheck", 10000, npc, null); - } - else if (npcId == SPAWN_DEVICE) - { + } else if (npcId == SPAWN_DEVICE) { npc.disableCoreAI(true); startQuestTimer("Spawn", 10000, npc, null, true); - } - else if (npcId == TIAT) - { + } else if (npcId == TIAT) { npc.setIsImmobilized(true); world.tiat = (L2MonsterInstance) npc; - for (int i = 0; i < TIAT_GUARD_NUMBER; i++) - { + for (int i = 0; i < TIAT_GUARD_NUMBER; i++) { addMinion(world.tiat, TIAT_GUARD); } } } - private void manageScreenMsg(SOD1World world, NpcStringId stringId) - { - for (L2PcInstance players : world.playersInside) - { - if ((players != null) && (players.getInstanceId() == world.getInstanceId())) - { + private void manageScreenMsg(SOD1World world, NpcStringId stringId) { + for (L2PcInstance players : world.playersInside) { + if ((players != null) && (players.getInstanceId() == world.getInstanceId())) { showOnScreenMsg(players, stringId, 2, 5000); } } } @Override - public String onSpawn(L2Npc npc) - { - if (npc.getId() == TIAT_GUARD) - { + public String onSpawn(L2Npc npc) { + if (npc.getId() == TIAT_GUARD) { startQuestTimer("GuardThink", 2500 + getRandom(-200, 200), npc, null, true); - } - else - { + } else { npc.disableCoreAI(true); } return super.onSpawn(npc); } @Override - public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) - { - if ((isSummon == false) && (player != null)) - { + public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) { + if ((isSummon == false) && (player != null)) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(player.getInstanceId()); - if (tmpworld instanceof SOD1World) - { + if (tmpworld instanceof SOD1World) { SOD1World world = (SOD1World) tmpworld; - if (world.getStatus() == 7) - { - if (spawnState(world)) - { - for (int objId : world.getAllowed()) - { + if (world.getStatus() == 7) { + if (spawnState(world)) { + for (int objId : world.getAllowed()) { L2PcInstance pl = L2World.getInstance().getPlayer(objId); - if (pl != null) - { + if (pl != null) { pl.showQuestMovie(5); } } @@ -782,28 +635,19 @@ public final class Stage1 extends AbstractInstance } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof SOD1World) - { + if (tmpworld instanceof SOD1World) { SOD1World world = (SOD1World) tmpworld; - if ((world.getStatus() == 2) && (npc.getId() == OBELISK)) - { + if ((world.getStatus() == 2) && (npc.getId() == OBELISK)) { world.setStatus(4); spawnFlaggedNPCs(world, 3); - } - else if ((world.getStatus() == 3) && (npc.getId() == OBELISK)) - { + } else if ((world.getStatus() == 3) && (npc.getId() == OBELISK)) { world.setStatus(4); spawnFlaggedNPCs(world, 2); - } - else if ((world.getStatus() <= 8) && (npc.getId() == TIAT)) - { - if (npc.getCurrentHp() < (npc.getMaxHp() / 2)) - { - if (spawnState(world)) - { + } else if ((world.getStatus() <= 8) && (npc.getId() == TIAT)) { + if (npc.getCurrentHp() < (npc.getMaxHp() / 2)) { + if (spawnState(world)) { startQuestTimer("TiatFullHp", 3000, npc, null); } } @@ -813,65 +657,45 @@ public final class Stage1 extends AbstractInstance } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof SOD1World) - { + if (tmpworld instanceof SOD1World) { SOD1World world = (SOD1World) tmpworld; - if (event.equalsIgnoreCase("Spawn")) - { + if (event.equalsIgnoreCase("Spawn")) { L2PcInstance target = L2World.getInstance().getPlayer(world.getAllowed().get(getRandom(world.getAllowed().size()))); - if ((world.deviceSpawnedMobCount < MAX_DEVICESPAWNEDMOBCOUNT) && (target != null) && (target.getInstanceId() == npc.getInstanceId()) && !target.isDead()) - { + if ((world.deviceSpawnedMobCount < MAX_DEVICESPAWNEDMOBCOUNT) && (target != null) && (target.getInstanceId() == npc.getInstanceId()) && !target.isDead()) { L2Attackable mob = (L2Attackable) addSpawn(SPAWN_MOB_IDS[getRandom(SPAWN_MOB_IDS.length)], npc.getSpawn().getLocation(), false, 0, false, world.getInstanceId()); world.deviceSpawnedMobCount++; mob.setSeeThroughSilentMove(true); mob.setRunning(); - if (world.getStatus() >= 7) - { + if (world.getStatus() >= 7) { mob.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, MOVE_TO_TIAT); - } - else - { + } else { mob.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, MOVE_TO_DOOR); } } - } - else if (event.equalsIgnoreCase("DoorCheck")) - { + } else if (event.equalsIgnoreCase("DoorCheck")) { L2DoorInstance tmp = getDoor(FORTRESS_DOOR, npc.getInstanceId()); - if (tmp.getCurrentHp() < tmp.getMaxHp()) - { + if (tmp.getCurrentHp() < tmp.getMaxHp()) { world.deviceSpawnedMobCount = 0; spawnFlaggedNPCs(world, 6); manageScreenMsg(world, NpcStringId.ENEMIES_ARE_TRYING_TO_DESTROY_THE_FORTRESS_EVERYONE_DEFEND_THE_FORTRESS); - } - else - { + } else { startQuestTimer("DoorCheck", 10000, npc, null); } - } - else if (event.equalsIgnoreCase("TiatFullHp")) - { - if (!npc.isStunned() && !npc.isInvul()) - { + } else if (event.equalsIgnoreCase("TiatFullHp")) { + if (!npc.isStunned() && !npc.isInvul()) { npc.setCurrentHp(npc.getMaxHp()); } - } - else if (event.equalsIgnoreCase("BodyGuardThink")) - { + } else if (event.equalsIgnoreCase("BodyGuardThink")) { L2Character mostHate = ((L2Attackable) npc).getMostHated(); - if (mostHate != null) - { + if (mostHate != null) { double dist = Util.calculateDistance(mostHate.getXdestination(), mostHate.getYdestination(), 0, npc.getSpawn().getX(), npc.getSpawn().getY(), 0, false, false); - if (dist > 900) - { + if (dist > 900) { ((L2Attackable) npc).reduceHate(mostHate, ((L2Attackable) npc).getHating(mostHate)); } mostHate = ((L2Attackable) npc).getMostHated(); - if ((mostHate != null) || (((L2Attackable) npc).getHating(mostHate) < 5)) - { + if ((mostHate != null) || (((L2Attackable) npc).getHating(mostHate) < 5)) { ((L2Attackable) npc).returnHome(); } } @@ -881,72 +705,48 @@ public final class Stage1 extends AbstractInstance } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { - if (npc.getId() == SPAWN_DEVICE) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { + if (npc.getId() == SPAWN_DEVICE) { cancelQuestTimer("Spawn", npc, null); return ""; } InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof SOD1World) - { + if (tmpworld instanceof SOD1World) { SOD1World world = (SOD1World) tmpworld; - if (world.getStatus() == 1) - { - if (checkKillProgress(npc, world)) - { + if (world.getStatus() == 1) { + if (checkKillProgress(npc, world)) { spawnState(world); } - } - else if (world.getStatus() == 2) - { - if (checkKillProgress(npc, world)) - { + } else if (world.getStatus() == 2) { + if (checkKillProgress(npc, world)) { world.incStatus(); } - } - else if ((world.getStatus() == 4) && (npc.getId() == OBELISK)) - { + } else if ((world.getStatus() == 4) && (npc.getId() == OBELISK)) { spawnState(world); - } - else if ((world.getStatus() == 5) && (npc.getId() == POWERFUL_DEVICE)) - { - if (checkKillProgress(npc, world)) - { + } else if ((world.getStatus() == 5) && (npc.getId() == POWERFUL_DEVICE)) { + if (checkKillProgress(npc, world)) { spawnState(world); } - } - else if ((world.getStatus() == 6) && (npc.getId() == THRONE_POWERFUL_DEVICE)) - { - if (checkKillProgress(npc, world)) - { + } else if ((world.getStatus() == 6) && (npc.getId() == THRONE_POWERFUL_DEVICE)) { + if (checkKillProgress(npc, world)) { spawnState(world); } - } - else if (world.getStatus() >= 7) - { - if (npc.getId() == TIAT) - { + } else if (world.getStatus() >= 7) { + if (npc.getId() == TIAT) { world.incStatus(); - for (int objId : world.getAllowed()) - { + for (int objId : world.getAllowed()) { L2PcInstance pl = L2World.getInstance().getPlayer(objId); - if (pl != null) - { + if (pl != null) { pl.showQuestMovie(6); } } - for (L2Npc mob : InstanceManager.getInstance().getInstance(world.getInstanceId()).getNpcs()) - { + for (L2Npc mob : InstanceManager.getInstance().getInstance(world.getInstanceId()).getNpcs()) { mob.deleteMe(); } GraciaSeedsManager.getInstance().increaseSoDTiatKilled(); finishInstance(world); - } - else if (npc.getId() == TIAT_GUARD) - { + } else if (npc.getId() == TIAT_GUARD) { addMinion(world.tiat, TIAT_GUARD); } } @@ -955,50 +755,35 @@ public final class Stage1 extends AbstractInstance } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { int npcId = npc.getId(); getQuestState(player, true); - if (npcId == ALENOS) - { + if (npcId == ALENOS) { InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - if ((GraciaSeedsManager.getInstance().getSoDState() == 1) || ((world != null) && (world instanceof SOD1World))) - { + if ((GraciaSeedsManager.getInstance().getSoDState() == 1) || ((world != null) && (world instanceof SOD1World))) { enterInstance(player, new SOD1World(), "SeedOfDestructionStage1.xml", TEMPLATE_ID); - } - else if (GraciaSeedsManager.getInstance().getSoDState() == 2) - { + } else if (GraciaSeedsManager.getInstance().getSoDState() == 2) { teleportPlayer(player, ENTER_TELEPORT_2, 0, false); } - } - else if (npcId == TELEPORT) - { + } else if (npcId == TELEPORT) { teleportPlayer(player, CENTER_TELEPORT, player.getInstanceId(), false); } return ""; } @Override - public String onTrapAction(L2TrapInstance trap, L2Character trigger, TrapAction action) - { + public String onTrapAction(L2TrapInstance trap, L2Character trigger, TrapAction action) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(trap.getInstanceId()); - if (tmpworld instanceof SOD1World) - { + if (tmpworld instanceof SOD1World) { SOD1World world = (SOD1World) tmpworld; - switch (action) - { + switch (action) { case TRAP_TRIGGERED: - if (trap.getId() == 18771) - { - for (int npcId : TRAP_18771_NPCS) - { + if (trap.getId() == 18771) { + for (int npcId : TRAP_18771_NPCS) { addSpawn(npcId, trap.getX(), trap.getY(), trap.getZ(), trap.getHeading(), true, 0, true, world.getInstanceId()); } - } - else - { - for (int npcId : TRAP_OTHER_NPCS) - { + } else { + for (int npcId : TRAP_OTHER_NPCS) { addSpawn(npcId, trap.getX(), trap.getY(), trap.getZ(), trap.getHeading(), true, 0, true, world.getInstanceId()); } } diff --git a/src/main/java/com/l2jserver/datapack/gracia/instances/SeedOfInfinity/HallOfSuffering/HallOfSuffering.java b/src/main/java/com/l2jserver/datapack/gracia/instances/SeedOfInfinity/HallOfSuffering/HallOfSuffering.java index 438b9913ac..9f786af8bd 100644 --- a/src/main/java/com/l2jserver/datapack/gracia/instances/SeedOfInfinity/HallOfSuffering/HallOfSuffering.java +++ b/src/main/java/com/l2jserver/datapack/gracia/instances/SeedOfInfinity/HallOfSuffering/HallOfSuffering.java @@ -50,10 +50,8 @@ import com.l2jserver.gameserver.util.Util; * - after 15mins mobs are despawned<br> * @author Gigiikun, ZakaX, Didldak */ -public final class HallOfSuffering extends AbstractInstance -{ - protected class HSWorld extends InstanceWorld - { +public final class HallOfSuffering extends AbstractInstance { + protected class HSWorld extends InstanceWorld { protected Map<L2Npc, Boolean> npcList = new HashMap<>(); protected L2Npc klodekus = null; protected L2Npc klanikus = null; @@ -77,8 +75,7 @@ public final class HallOfSuffering extends AbstractInstance private static final int KLANIKUS = 25666; private static final int TUMOR_ALIVE = 18704; private static final int TUMOR_DEAD = 18705; - private static final int[] TUMOR_MOBIDS = - { + private static final int[] TUMOR_MOBIDS = { 22509, 22510, 22511, @@ -87,8 +84,7 @@ public final class HallOfSuffering extends AbstractInstance 22514, 22515 }; - private static final int[] TWIN_MOBIDS = - { + private static final int[] TWIN_MOBIDS = { 22509, 22510, 22511, @@ -151,8 +147,7 @@ public final class HallOfSuffering extends AbstractInstance { 22515, -177075, 217647, -9528 } }; // @formatter:on - private static final Location[] TUMOR_SPAWNS = - { + private static final Location[] TUMOR_SPAWNS = { new Location(-186327, 208286, -9544), new Location(-184429, 211155, -9544), new Location(-182811, 213871, -9496), @@ -171,8 +166,7 @@ public final class HallOfSuffering extends AbstractInstance private static final int MIN_LEVEL = 75; private static final int MAX_LEVEL = 82; - public HallOfSuffering() - { + public HallOfSuffering() { super(HallOfSuffering.class.getSimpleName(), "gracia/instances/SeedOfInfinity"); addStartNpc(MOUTH_OF_EKIMUS, TEPIOS); addTalkId(MOUTH_OF_EKIMUS, TEPIOS); @@ -184,44 +178,36 @@ public final class HallOfSuffering extends AbstractInstance } @Override - protected boolean checkConditions(L2PcInstance player) - { - if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) - { + protected boolean checkConditions(L2PcInstance player) { + if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) { return true; } final L2Party party = player.getParty(); - if (party == null) - { + if (party == null) { player.sendPacket(SystemMessageId.NOT_IN_PARTY_CANT_ENTER); return false; } - if (party.getLeader() != player) - { + if (party.getLeader() != player) { player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); return false; } - for (L2PcInstance partyMember : party.getMembers()) - { - if ((partyMember.getLevel() < MIN_LEVEL) || (partyMember.getLevel() > MAX_LEVEL)) - { + for (L2PcInstance partyMember : party.getMembers()) { + if ((partyMember.getLevel() < MIN_LEVEL) || (partyMember.getLevel() > MAX_LEVEL)) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; } - if (!Util.checkIfInRange(1000, player, partyMember, true)) - { + if (!Util.checkIfInRange(1000, player, partyMember, true)) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; } - if (System.currentTimeMillis() < InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), TEMPLATE_ID)) - { + if (System.currentTimeMillis() < InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), TEMPLATE_ID)) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET); sm.addPcName(partyMember); party.broadcastPacket(sm); @@ -232,19 +218,13 @@ public final class HallOfSuffering extends AbstractInstance } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { - if (!player.isInParty()) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { + if (!player.isInParty()) { teleportPlayer(player, ENTER_TELEPORT, world.getInstanceId()); world.addAllowed(player.getObjectId()); - } - else - { - for (L2PcInstance players : player.getParty().getMembers()) - { + } else { + for (L2PcInstance players : player.getParty().getMembers()) { teleportPlayer(players, ENTER_TELEPORT, world.getInstanceId()); world.addAllowed(players.getObjectId()); getQuestState(players, true); @@ -252,33 +232,25 @@ public final class HallOfSuffering extends AbstractInstance } runTumors((HSWorld) world); - } - else - { + } else { teleportPlayer(player, ENTER_TELEPORT, world.getInstanceId()); } } - private boolean checkKillProgress(L2Npc mob, HSWorld world) - { - if (world.npcList.containsKey(mob)) - { + private boolean checkKillProgress(L2Npc mob, HSWorld world) { + if (world.npcList.containsKey(mob)) { world.npcList.put(mob, true); } - for (boolean isDead : world.npcList.values()) - { - if (!isDead) - { + for (boolean isDead : world.npcList.values()) { + if (!isDead) { return false; } } return true; } - private int[][] getRoomSpawns(int room) - { - switch (room) - { + private int[][] getRoomSpawns(int room) { + switch (room) { case 0: return ROOM_1_MOBS; case 1: @@ -294,10 +266,8 @@ public final class HallOfSuffering extends AbstractInstance return new int[][] {}; } - private void runTumors(HSWorld world) - { - for (int[] mob : getRoomSpawns(world.getStatus())) - { + private void runTumors(HSWorld world) { + for (int[] mob : getRoomSpawns(world.getStatus())) { final L2Npc npc = addSpawn(mob[0], mob[1], mob[2], mob[3], 0, false, 0, false, world.getInstanceId()); world.npcList.put(npc, false); } @@ -310,8 +280,7 @@ public final class HallOfSuffering extends AbstractInstance world.incStatus(); } - private void runTwins(HSWorld world) - { + private void runTwins(HSWorld world) { world.incStatus(); world.klodekus = addSpawn(KLODEKUS, KLODEKUS_SPAWN, false, 0, false, world.getInstanceId()); world.klanikus = addSpawn(KLANIKUS, KLANIKUS_SPAWN, false, 0, false, world.getInstanceId()); @@ -319,13 +288,10 @@ public final class HallOfSuffering extends AbstractInstance world.klodekus.setIsMortal(false); } - private void bossSimpleDie(L2Npc boss) - { + private void bossSimpleDie(L2Npc boss) { // killing is only possible one time - synchronized (this) - { - if (boss.isDead()) - { + synchronized (this) { + if (boss.isDead()) { return; } // now reset currentHp to zero @@ -350,82 +316,57 @@ public final class HallOfSuffering extends AbstractInstance // Notify L2Character AI boss.getAI().notifyEvent(CtrlEvent.EVT_DEAD); - if (boss.getWorldRegion() != null) - { + if (boss.getWorldRegion() != null) { boss.getWorldRegion().onDeath(boss); } } - private void calcRewardItemId(HSWorld world) - { + private void calcRewardItemId(HSWorld world) { Long finishDiff = System.currentTimeMillis() - world.startTime; - if (finishDiff < 1200000) - { + if (finishDiff < 1200000) { world.rewardHtm = "32530-00.htm"; world.rewardItemId = 13777; - } - else if (finishDiff <= 1260000) - { + } else if (finishDiff <= 1260000) { world.rewardHtm = "32530-01.htm"; world.rewardItemId = 13778; - } - else if (finishDiff <= 1320000) - { + } else if (finishDiff <= 1320000) { world.rewardHtm = "32530-02.htm"; world.rewardItemId = 13779; - } - else if (finishDiff <= 1380000) - { + } else if (finishDiff <= 1380000) { world.rewardHtm = "32530-03.htm"; world.rewardItemId = 13780; - } - else if (finishDiff <= 1440000) - { + } else if (finishDiff <= 1440000) { world.rewardHtm = "32530-04.htm"; world.rewardItemId = 13781; - } - else if (finishDiff <= 1500000) - { + } else if (finishDiff <= 1500000) { world.rewardHtm = "32530-05.htm"; world.rewardItemId = 13782; - } - else if (finishDiff <= 1560000) - { + } else if (finishDiff <= 1560000) { world.rewardHtm = "32530-06.htm"; world.rewardItemId = 13783; - } - else if (finishDiff <= 1620000) - { + } else if (finishDiff <= 1620000) { world.rewardHtm = "32530-07.htm"; world.rewardItemId = 13784; - } - else if (finishDiff <= 1680000) - { + } else if (finishDiff <= 1680000) { world.rewardHtm = "32530-08.htm"; world.rewardItemId = 13785; - } - else - { + } else { world.rewardHtm = "32530-09.htm"; world.rewardItemId = 13786; } } - private String getPtLeaderText(L2PcInstance player, HSWorld world) - { + private String getPtLeaderText(L2PcInstance player, HSWorld world) { String htmltext = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), "/data/scripts/gracia/instances/SeedOfInfinity/HallOfSuffering/32530-10.htm"); htmltext = htmltext.replaceAll("%ptLeader%", String.valueOf(world.ptLeaderName)); return htmltext; } @Override - public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) - { - if (skill.hasEffectType(L2EffectType.REBALANCE_HP, L2EffectType.HP)) - { + public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) { + if (skill.hasEffectType(L2EffectType.REBALANCE_HP, L2EffectType.HP)) { int hate = 2 * skill.getEffectPoint(); - if (hate < 2) - { + if (hate < 2) { hate = 1000; } ((L2Attackable) npc).addDamageHate(caster, 0, hate); @@ -434,44 +375,32 @@ public final class HallOfSuffering extends AbstractInstance } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof HSWorld) - { + if (tmpworld instanceof HSWorld) { HSWorld world = (HSWorld) tmpworld; - if (event.equalsIgnoreCase("spawnBossGuards")) - { - if (!world.klanikus.isInCombat() && !world.klodekus.isInCombat()) - { + if (event.equalsIgnoreCase("spawnBossGuards")) { + if (!world.klanikus.isInCombat() && !world.klodekus.isInCombat()) { world.isBossesAttacked = false; return ""; } L2Npc mob = addSpawn(TWIN_MOBIDS[getRandom(TWIN_MOBIDS.length)], KLODEKUS_SPAWN, false, 0, false, npc.getInstanceId()); ((L2Attackable) mob).addDamageHate(((L2Attackable) npc).getMostHated(), 0, 1); - if (getRandom(100) < 33) - { + if (getRandom(100) < 33) { mob = addSpawn(TWIN_MOBIDS[getRandom(TWIN_MOBIDS.length)], KLANIKUS_SPAWN, false, 0, false, npc.getInstanceId()); ((L2Attackable) mob).addDamageHate(((L2Attackable) npc).getMostHated(), 0, 1); } startQuestTimer("spawnBossGuards", BOSS_MINION_SPAWN_TIME, npc, null); - } - else if (event.equalsIgnoreCase("isTwinSeparated")) - { - if (Util.checkIfInRange(500, world.klanikus, world.klodekus, false)) - { + } else if (event.equalsIgnoreCase("isTwinSeparated")) { + if (Util.checkIfInRange(500, world.klanikus, world.klodekus, false)) { world.klanikus.setIsInvul(false); world.klodekus.setIsInvul(false); - } - else - { + } else { world.klanikus.setIsInvul(true); world.klodekus.setIsInvul(true); } startQuestTimer("isTwinSeparated", 10000, npc, null); - } - else if (event.equalsIgnoreCase("ressurectTwin")) - { + } else if (event.equalsIgnoreCase("ressurectTwin")) { L2Npc aliveTwin = (world.klanikus == npc ? world.klodekus : world.klanikus); npc.doRevive(); npc.doCast(PRESENTATION_DISTRICT1_BOSS_ARISE); @@ -479,16 +408,13 @@ public final class HallOfSuffering extends AbstractInstance // get most hated of other boss L2Character hated = ((L2MonsterInstance) aliveTwin).getMostHated(); - if (hated != null) - { + if (hated != null) { npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, hated, 1000); } aliveTwin.setIsInvul(true); // make other boss invul startQuestTimer("uninvul", BOSS_INVUL_TIME, aliveTwin, null); - } - else if (event.equals("uninvul")) - { + } else if (event.equals("uninvul")) { npc.setIsInvul(false); } } @@ -496,34 +422,24 @@ public final class HallOfSuffering extends AbstractInstance } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) { final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof HSWorld) - { + if (tmpworld instanceof HSWorld) { final HSWorld world = (HSWorld) tmpworld; - if (!world.isBossesAttacked) - { + if (!world.isBossesAttacked) { world.isBossesAttacked = true; startQuestTimer("spawnBossGuards", BOSS_MINION_SPAWN_TIME, npc, null); startQuestTimer("isTwinSeparated", 10000, npc, null); - } - else if (damage >= npc.getCurrentHp()) - { - if (world.klanikus.isDead()) - { + } else if (damage >= npc.getCurrentHp()) { + if (world.klanikus.isDead()) { world.klanikus.setIsDead(false); world.klanikus.doDie(attacker); world.klodekus.doDie(attacker); - } - else if (((HSWorld) tmpworld).klodekus.isDead()) - { + } else if (((HSWorld) tmpworld).klodekus.isDead()) { world.klodekus.setIsDead(false); world.klodekus.doDie(attacker); world.klanikus.doDie(attacker); - } - else - { + } else { bossSimpleDie(npc); startQuestTimer("ressurectTwin", BOSS_RESSURECT_TIME, npc, null); } @@ -533,35 +449,24 @@ public final class HallOfSuffering extends AbstractInstance } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof HSWorld) - { + if (tmpworld instanceof HSWorld) { final HSWorld world = (HSWorld) tmpworld; - if (npc.getId() == TUMOR_ALIVE) - { + if (npc.getId() == TUMOR_ALIVE) { addSpawn(TUMOR_DEAD, npc, false, 0, false, npc.getInstanceId()); } - if (world.getStatus() < 5) - { - if (checkKillProgress(npc, world)) - { + if (world.getStatus() < 5) { + if (checkKillProgress(npc, world)) { runTumors(world); } - } - else if (world.getStatus() == 5) - { - if (checkKillProgress(npc, world)) - { + } else if (world.getStatus() == 5) { + if (checkKillProgress(npc, world)) { runTwins(world); } - } - else if ((world.getStatus() == 6) && ((npc.getId() == KLODEKUS) || (npc.getId() == KLANIKUS))) - { - if (world.klanikus.isDead() && world.klodekus.isDead()) - { + } else if ((world.getStatus() == 6) && ((npc.getId() == KLODEKUS) || (npc.getId() == KLANIKUS))) { + if (world.klanikus.isDead() && world.klodekus.isDead()) { world.incStatus(); // instance end calcRewardItemId(world); @@ -579,22 +484,15 @@ public final class HallOfSuffering extends AbstractInstance } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { - if (npc.getId() == TEPIOS) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { + if (npc.getId() == TEPIOS) { InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - if (((HSWorld) world).rewardItemId == -1) - { + if (((HSWorld) world).rewardItemId == -1) { _log.warning("Hall of Suffering: " + player.getName() + "(" + player.getObjectId() + ") is try to cheat!"); return getPtLeaderText(player, (HSWorld) world); - } - else if (((HSWorld) world).isRewarded) - { + } else if (((HSWorld) world).isRewarded) { return "32530-11.htm"; - } - else if ((player.getParty() != null) && (player.getParty().getLeaderObjectId() == player.getObjectId())) - { + } else if ((player.getParty() != null) && (player.getParty().getLeaderObjectId() == player.getObjectId())) { return ((HSWorld) world).rewardHtm; } @@ -604,33 +502,22 @@ public final class HallOfSuffering extends AbstractInstance } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { getQuestState(talker, true); - if (npc.getId() == MOUTH_OF_EKIMUS) - { + if (npc.getId() == MOUTH_OF_EKIMUS) { enterInstance(talker, new HSWorld(), "HallOfSuffering.xml", TEMPLATE_ID); - } - else if (npc.getId() == TEPIOS) - { + } else if (npc.getId() == TEPIOS) { InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(talker); - if (((HSWorld) world).rewardItemId == -1) - { + if (((HSWorld) world).rewardItemId == -1) { _log.warning("Hall of Suffering: " + talker.getName() + "(" + talker.getObjectId() + ") is try to cheat!"); return getPtLeaderText(talker, (HSWorld) world); - } - else if (((HSWorld) world).isRewarded) - { + } else if (((HSWorld) world).isRewarded) { return "32530-11.htm"; - } - else if ((talker.getParty() != null) && (talker.getParty().getLeaderObjectId() == talker.getObjectId())) - { + } else if ((talker.getParty() != null) && (talker.getParty().getLeaderObjectId() == talker.getObjectId())) { ((HSWorld) world).isRewarded = true; - for (L2PcInstance member : talker.getParty().getMembers()) - { + for (L2PcInstance member : talker.getParty().getMembers()) { final QuestState st = member.getQuestState(Q00695_DefendTheHallOfSuffering.class.getSimpleName()); - if ((st != null) && st.isMemoState(2)) - { + if ((st != null) && st.isMemoState(2)) { giveItems(member, 736, 1); // Scroll of Escape giveItems(member, ((HSWorld) world).rewardItemId, 1); st.exitQuest(true); diff --git a/src/main/java/com/l2jserver/datapack/gracia/vehicles/AirShipController.java b/src/main/java/com/l2jserver/datapack/gracia/vehicles/AirShipController.java index 181d7a4d41..aadb470b1f 100644 --- a/src/main/java/com/l2jserver/datapack/gracia/vehicles/AirShipController.java +++ b/src/main/java/com/l2jserver/datapack/gracia/vehicles/AirShipController.java @@ -42,33 +42,23 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; import com.l2jserver.gameserver.network.serverpackets.NpcSay; import com.l2jserver.gameserver.network.serverpackets.SystemMessage; -public abstract class AirShipController extends Quest -{ - protected final class DecayTask implements Runnable - { +public abstract class AirShipController extends Quest { + protected final class DecayTask implements Runnable { @Override - public void run() - { - if (_dockedShip != null) - { + public void run() { + if (_dockedShip != null) { _dockedShip.deleteMe(); } } } - protected final class DepartTask implements Runnable - { + protected final class DepartTask implements Runnable { @Override - public void run() - { - if ((_dockedShip != null) && _dockedShip.isInDock() && !_dockedShip.isMoving()) - { - if (_departPath != null) - { + public void run() { + if ((_dockedShip != null) && _dockedShip.isInDock() && !_dockedShip.isMoving()) { + if (_departPath != null) { _dockedShip.executePath(_departPath); - } - else - { + } else { _dockedShip.deleteMe(); } } @@ -112,164 +102,117 @@ public abstract class AirShipController extends Quest private static final SystemMessage SM_NEED_MORE = SystemMessage.getSystemMessage(SystemMessageId.THE_AIRSHIP_NEED_MORE_S1).addItemName(STARSTONE); - public AirShipController(int questId, String name, String descr) - { + public AirShipController(int questId, String name, String descr) { super(questId, name, descr); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if ("summon".equalsIgnoreCase(event)) - { - if (_dockedShip != null) - { - if (_dockedShip.isOwner(player)) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if ("summon".equalsIgnoreCase(event)) { + if (_dockedShip != null) { + if (_dockedShip.isOwner(player)) { player.sendPacket(SystemMessageId.THE_AIRSHIP_IS_ALREADY_EXISTS); } return null; } - if (_isBusy) - { + if (_isBusy) { player.sendPacket(SystemMessageId.ANOTHER_AIRSHIP_ALREADY_SUMMONED); return null; } - if (!player.hasClanPrivilege(ClanPrivilege.CL_SUMMON_AIRSHIP)) - { + if (!player.hasClanPrivilege(ClanPrivilege.CL_SUMMON_AIRSHIP)) { player.sendPacket(SystemMessageId.THE_AIRSHIP_NO_PRIVILEGES); return null; } int ownerId = player.getClanId(); - if (!AirShipManager.getInstance().hasAirShipLicense(ownerId)) - { + if (!AirShipManager.getInstance().hasAirShipLicense(ownerId)) { player.sendPacket(SystemMessageId.THE_AIRSHIP_NEED_LICENSE_TO_SUMMON); return null; } - if (AirShipManager.getInstance().hasAirShip(ownerId)) - { + if (AirShipManager.getInstance().hasAirShip(ownerId)) { player.sendPacket(SystemMessageId.THE_AIRSHIP_ALREADY_USED); return null; } - if (!player.destroyItemByItemId("AirShipSummon", STARSTONE, SUMMON_COST, npc, true)) - { + if (!player.destroyItemByItemId("AirShipSummon", STARSTONE, SUMMON_COST, npc, true)) { player.sendPacket(SM_NEED_MORE); return null; } _isBusy = true; final L2AirShipInstance ship = AirShipManager.getInstance().getNewAirShip(_shipSpawnX, _shipSpawnY, _shipSpawnZ, _shipHeading, ownerId); - if (ship != null) - { - if (_arrivalPath != null) - { + if (ship != null) { + if (_arrivalPath != null) { ship.executePath(_arrivalPath); } - if (_arrivalMessage == null) - { + if (_arrivalMessage == null) { _arrivalMessage = new NpcSay(npc.getObjectId(), Say2.NPC_SHOUT, npc.getId(), NpcStringId.THE_AIRSHIP_HAS_BEEN_SUMMONED_IT_WILL_AUTOMATICALLY_DEPART_IN_5_MINUTES); } npc.broadcastPacket(_arrivalMessage); - } - else - { + } else { _isBusy = false; } return null; - } - else if ("board".equalsIgnoreCase(event)) - { - if (player.isTransformed()) - { + } else if ("board".equalsIgnoreCase(event)) { + if (player.isTransformed()) { player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_TRANSFORMED); return null; - } - else if (player.isParalyzed()) - { + } else if (player.isParalyzed()) { player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_PETRIFIED); return null; - } - else if (player.isDead() || player.isFakeDeath()) - { + } else if (player.isDead() || player.isFakeDeath()) { player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_DEAD); return null; - } - else if (player.isFishing()) - { + } else if (player.isFishing()) { player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_FISHING); return null; - } - else if (player.isInCombat()) - { + } else if (player.isInCombat()) { player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_IN_BATTLE); return null; - } - else if (player.isInDuel()) - { + } else if (player.isInDuel()) { player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_IN_A_DUEL); return null; - } - else if (player.isSitting()) - { + } else if (player.isSitting()) { player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_SITTING); return null; - } - else if (player.isCastingNow()) - { + } else if (player.isCastingNow()) { player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_CASTING); return null; - } - else if (player.isCursedWeaponEquipped()) - { + } else if (player.isCursedWeaponEquipped()) { player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_A_CURSED_WEAPON_IS_EQUIPPED); return null; - } - else if (player.isCombatFlagEquipped()) - { + } else if (player.isCombatFlagEquipped()) { player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_HOLDING_A_FLAG); return null; - } - else if (player.hasSummon() || player.isMounted()) - { + } else if (player.hasSummon() || player.isMounted()) { player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_A_PET_OR_A_SERVITOR_IS_SUMMONED); return null; - } - else if (player.isFlyingMounted()) - { + } else if (player.isFlyingMounted()) { player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_NOT_MEET_REQUEIREMENTS); return null; } - if (_dockedShip != null) - { + if (_dockedShip != null) { _dockedShip.addPassenger(player); } return null; - } - else if ("register".equalsIgnoreCase(event)) - { - if ((player.getClan() == null) || (player.getClan().getLevel() < 5)) - { + } else if ("register".equalsIgnoreCase(event)) { + if ((player.getClan() == null) || (player.getClan().getLevel() < 5)) { player.sendPacket(SystemMessageId.THE_AIRSHIP_NEED_CLANLVL_5_TO_SUMMON); return null; } - if (!player.isClanLeader()) - { + if (!player.isClanLeader()) { player.sendPacket(SystemMessageId.THE_AIRSHIP_NO_PRIVILEGES); return null; } final int ownerId = player.getClanId(); - if (AirShipManager.getInstance().hasAirShipLicense(ownerId)) - { + if (AirShipManager.getInstance().hasAirShipLicense(ownerId)) { player.sendPacket(SystemMessageId.THE_AIRSHIP_SUMMON_LICENSE_ALREADY_ACQUIRED); return null; } - if (!player.destroyItemByItemId("AirShipLicense", LICENSE, 1, npc, true)) - { + if (!player.destroyItemByItemId("AirShipLicense", LICENSE, 1, npc, true)) { player.sendPacket(SM_NEED_MORE); return null; } @@ -277,42 +220,31 @@ public abstract class AirShipController extends Quest AirShipManager.getInstance().registerLicense(ownerId); player.sendPacket(SystemMessageId.THE_AIRSHIP_SUMMON_LICENSE_ENTERED); return null; - } - else - { + } else { return event; } } @Override - public String onEnterZone(L2Character character, L2ZoneType zone) - { - if (character instanceof L2ControllableAirShipInstance) - { - if (_dockedShip == null) - { + public String onEnterZone(L2Character character, L2ZoneType zone) { + if (character instanceof L2ControllableAirShipInstance) { + if (_dockedShip == null) { _dockedShip = (L2ControllableAirShipInstance) character; _dockedShip.setInDock(_dockZone); _dockedShip.setOustLoc(_oustLoc); // Ship is not empty - display movie to passengers and dock - if (!_dockedShip.isEmpty()) - { - if (_movieId != 0) - { - for (L2PcInstance passenger : _dockedShip.getPassengers()) - { - if (passenger != null) - { + if (!_dockedShip.isEmpty()) { + if (_movieId != 0) { + for (L2PcInstance passenger : _dockedShip.getPassengers()) { + if (passenger != null) { passenger.showQuestMovie(_movieId); } } } ThreadPoolManager.getInstance().scheduleGeneral(_decayTask, 1000); - } - else - { + } else { _departSchedule = ThreadPoolManager.getInstance().scheduleGeneral(_departTask, DEPART_INTERVAL); } } @@ -321,14 +253,10 @@ public abstract class AirShipController extends Quest } @Override - public String onExitZone(L2Character character, L2ZoneType zone) - { - if (character instanceof L2ControllableAirShipInstance) - { - if (character.equals(_dockedShip)) - { - if (_departSchedule != null) - { + public String onExitZone(L2Character character, L2ZoneType zone) { + if (character instanceof L2ControllableAirShipInstance) { + if (character.equals(_dockedShip)) { + if (_departSchedule != null) { _departSchedule.cancel(false); _departSchedule = null; } @@ -342,81 +270,59 @@ public abstract class AirShipController extends Quest } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return npc.getId() + ".htm"; } - protected void validityCheck() - { + protected void validityCheck() { L2ScriptZone zone = ZoneManager.getInstance().getZoneById(_dockZone, L2ScriptZone.class); - if (zone == null) - { + if (zone == null) { _log.log(Level.WARNING, getName() + ": Invalid zone " + _dockZone + ", controller disabled"); _isBusy = true; return; } VehiclePathPoint p; - if (_arrivalPath != null) - { - if (_arrivalPath.length == 0) - { + if (_arrivalPath != null) { + if (_arrivalPath.length == 0) { _log.log(Level.WARNING, getName() + ": Zero arrival path length."); _arrivalPath = null; - } - else - { + } else { p = _arrivalPath[_arrivalPath.length - 1]; - if (!zone.isInsideZone(p.getLocation())) - { + if (!zone.isInsideZone(p.getLocation())) { _log.log(Level.WARNING, getName() + ": Arrival path finish point (" + p.getX() + "," + p.getY() + "," + p.getZ() + ") not in zone " + _dockZone); _arrivalPath = null; } } } - if (_arrivalPath == null) - { - if (!ZoneManager.getInstance().getZoneById(_dockZone, L2ScriptZone.class).isInsideZone(_shipSpawnX, _shipSpawnY, _shipSpawnZ)) - { + if (_arrivalPath == null) { + if (!ZoneManager.getInstance().getZoneById(_dockZone, L2ScriptZone.class).isInsideZone(_shipSpawnX, _shipSpawnY, _shipSpawnZ)) { _log.log(Level.WARNING, getName() + ": Arrival path is null and spawn point not in zone " + _dockZone + ", controller disabled"); _isBusy = true; return; } } - if (_departPath != null) - { - if (_departPath.length == 0) - { + if (_departPath != null) { + if (_departPath.length == 0) { _log.log(Level.WARNING, getName() + ": Zero depart path length."); _departPath = null; - } - else - { + } else { p = _departPath[_departPath.length - 1]; - if (zone.isInsideZone(p.getLocation())) - { + if (zone.isInsideZone(p.getLocation())) { _log.log(Level.WARNING, getName() + ": Departure path finish point (" + p.getX() + "," + p.getY() + "," + p.getZ() + ") in zone " + _dockZone); _departPath = null; } } } - if (_teleportsTable != null) - { - if (_fuelTable == null) - { + if (_teleportsTable != null) { + if (_fuelTable == null) { _log.log(Level.WARNING, getName() + ": Fuel consumption not defined."); - } - else - { - if (_teleportsTable.length != _fuelTable.length) - { + } else { + if (_teleportsTable.length != _fuelTable.length) { _log.log(Level.WARNING, getName() + ": Fuel consumption not match teleport list."); - } - else - { + } else { AirShipManager.getInstance().registerAirShipTeleportList(_dockZone, _locationId, _teleportsTable, _fuelTable); } } diff --git a/src/main/java/com/l2jserver/datapack/gracia/vehicles/AirShipGludioGracia/AirShipGludioGracia.java b/src/main/java/com/l2jserver/datapack/gracia/vehicles/AirShipGludioGracia/AirShipGludioGracia.java index df22ba260a..8ee192b99c 100644 --- a/src/main/java/com/l2jserver/datapack/gracia/vehicles/AirShipGludioGracia/AirShipGludioGracia.java +++ b/src/main/java/com/l2jserver/datapack/gracia/vehicles/AirShipGludioGracia/AirShipGludioGracia.java @@ -36,10 +36,8 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; /** * @author DS */ -public final class AirShipGludioGracia extends Quest implements Runnable -{ - private static final int[] CONTROLLERS = - { +public final class AirShipGludioGracia extends Quest implements Runnable { + private static final int[] CONTROLLERS = { 32607, 32609 }; @@ -50,16 +48,14 @@ public final class AirShipGludioGracia extends Quest implements Runnable private static final Location OUST_GLUDIO = new Location(-149379, 255246, -80); private static final Location OUST_GRACIA = new Location(-186563, 243590, 2608); - private static final VehiclePathPoint[] GLUDIO_TO_WARPGATE = - { + private static final VehiclePathPoint[] GLUDIO_TO_WARPGATE = { new VehiclePathPoint(-151202, 252556, 231), new VehiclePathPoint(-160403, 256144, 222), new VehiclePathPoint(-167874, 256731, -509, 0, 41035) - // teleport: x,y,z,speed=0,heading + // teleport: x,y,z,speed=0,heading }; - private static final VehiclePathPoint[] WARPGATE_TO_GRACIA = - { + private static final VehiclePathPoint[] WARPGATE_TO_GRACIA = { new VehiclePathPoint(-169763, 254815, 282), new VehiclePathPoint(-171822, 250061, 425), new VehiclePathPoint(-172595, 247737, 398), @@ -70,8 +66,7 @@ public final class AirShipGludioGracia extends Quest implements Runnable new VehiclePathPoint(-186936, 244563, 2617) }; - private static final VehiclePathPoint[] GRACIA_TO_WARPGATE = - { + private static final VehiclePathPoint[] GRACIA_TO_WARPGATE = { new VehiclePathPoint(-187801, 244997, 2672), new VehiclePathPoint(-188520, 245932, 2465), new VehiclePathPoint(-189932, 245243, 1682), @@ -88,11 +83,10 @@ public final class AirShipGludioGracia extends Quest implements Runnable new VehiclePathPoint(-169763, 254815, 282), new VehiclePathPoint(-168067, 256626, 343), new VehiclePathPoint(-157261, 255664, 221, 0, 64781) - // teleport: x,y,z,speed=0,heading + // teleport: x,y,z,speed=0,heading }; - private static final VehiclePathPoint[] WARPGATE_TO_GLUDIO = - { + private static final VehiclePathPoint[] WARPGATE_TO_GLUDIO = { new VehiclePathPoint(-153414, 255385, 221), new VehiclePathPoint(-149548, 258172, 221), new VehiclePathPoint(-146884, 257097, 221), @@ -109,8 +103,7 @@ public final class AirShipGludioGracia extends Quest implements Runnable private boolean _foundAtcGracia = false; private L2Npc _atcGracia = null; - public AirShipGludioGracia() - { + public AirShipGludioGracia() { super(-1, AirShipGludioGracia.class.getSimpleName(), "gracia/vehicles"); addStartNpc(CONTROLLERS); addFirstTalkId(CONTROLLERS); @@ -122,43 +115,32 @@ public final class AirShipGludioGracia extends Quest implements Runnable _ship.runEngine(60000); } - private final void broadcastInGludio(NpcStringId npcString) - { - if (!_foundAtcGludio) - { + private final void broadcastInGludio(NpcStringId npcString) { + if (!_foundAtcGludio) { _foundAtcGludio = true; _atcGludio = findController(); } - if (_atcGludio != null) - { + if (_atcGludio != null) { _atcGludio.broadcastPacket(new NpcSay(_atcGludio.getObjectId(), Say2.NPC_SHOUT, _atcGludio.getId(), npcString)); } } - private final void broadcastInGracia(NpcStringId npcStringId) - { - if (!_foundAtcGracia) - { + private final void broadcastInGracia(NpcStringId npcStringId) { + if (!_foundAtcGracia) { _foundAtcGracia = true; _atcGracia = findController(); } - if (_atcGracia != null) - { + if (_atcGracia != null) { _atcGracia.broadcastPacket(new NpcSay(_atcGracia.getObjectId(), Say2.NPC_SHOUT, _atcGracia.getId(), npcStringId)); } } - private final L2Npc findController() - { + private final L2Npc findController() { // check objects around the ship - for (L2Object obj : L2World.getInstance().getVisibleObjects(_ship, 600)) - { - if (obj.isNpc()) - { - for (int id : CONTROLLERS) - { - if (obj.getId() == id) - { + for (L2Object obj : L2World.getInstance().getVisibleObjects(_ship, 600)) { + if (obj.isNpc()) { + for (int id : CONTROLLERS) { + if (obj.getId() == id) { return (L2Npc) obj; } } @@ -168,65 +150,41 @@ public final class AirShipGludioGracia extends Quest implements Runnable } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (player.isTransformed()) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (player.isTransformed()) { player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_TRANSFORMED); return null; - } - else if (player.isParalyzed()) - { + } else if (player.isParalyzed()) { player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_PETRIFIED); return null; - } - else if (player.isDead() || player.isFakeDeath()) - { + } else if (player.isDead() || player.isFakeDeath()) { player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_DEAD); return null; - } - else if (player.isFishing()) - { + } else if (player.isFishing()) { player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_FISHING); return null; - } - else if (player.isInCombat()) - { + } else if (player.isInCombat()) { player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_IN_BATTLE); return null; - } - else if (player.isInDuel()) - { + } else if (player.isInDuel()) { player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_IN_A_DUEL); return null; - } - else if (player.isSitting()) - { + } else if (player.isSitting()) { player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_SITTING); return null; - } - else if (player.isCastingNow()) - { + } else if (player.isCastingNow()) { player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_CASTING); return null; - } - else if (player.isCursedWeaponEquipped()) - { + } else if (player.isCursedWeaponEquipped()) { player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_A_CURSED_WEAPON_IS_EQUIPPED); return null; - } - else if (player.isCombatFlagEquipped()) - { + } else if (player.isCombatFlagEquipped()) { player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_HOLDING_A_FLAG); return null; - } - else if (player.hasSummon() || player.isMounted()) - { + } else if (player.hasSummon() || player.isMounted()) { player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_A_PET_OR_A_SERVITOR_IS_SUMMONED); return null; - } - else if (_ship.isInDock() && _ship.isInsideRadius(player, 600, true, false)) - { + } else if (_ship.isInDock() && _ship.isInsideRadius(player, 600, true, false)) { _ship.addPassenger(player); } @@ -234,18 +192,14 @@ public final class AirShipGludioGracia extends Quest implements Runnable } @Override - public final String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public final String onFirstTalk(L2Npc npc, L2PcInstance player) { return npc.getId() + ".htm"; } @Override - public void run() - { - try - { - switch (_cycle) - { + public void run() { + try { + switch (_cycle) { case 0: broadcastInGludio(NpcStringId.THE_REGULARLY_SCHEDULED_AIRSHIP_THAT_FLIES_TO_THE_GRACIA_CONTINENT_HAS_DEPARTED); _ship.setInDock(0); @@ -286,22 +240,17 @@ public final class AirShipGludioGracia extends Quest implements Runnable break; } _cycle++; - if (_cycle > 7) - { + if (_cycle > 7) { _cycle = 0; } - } - catch (Exception e) - { + } catch (Exception e) { e.printStackTrace(); } } @Override - public boolean unload(boolean removeFromList) - { - if (_ship != null) - { + public boolean unload(boolean removeFromList) { + if (_ship != null) { _ship.oustPlayers(); _ship.deleteMe(); } diff --git a/src/main/java/com/l2jserver/datapack/gracia/vehicles/KeucereusNorthController/KeucereusNorthController.java b/src/main/java/com/l2jserver/datapack/gracia/vehicles/KeucereusNorthController/KeucereusNorthController.java index ef44382533..00a61b0284 100644 --- a/src/main/java/com/l2jserver/datapack/gracia/vehicles/KeucereusNorthController/KeucereusNorthController.java +++ b/src/main/java/com/l2jserver/datapack/gracia/vehicles/KeucereusNorthController/KeucereusNorthController.java @@ -22,26 +22,22 @@ import com.l2jserver.datapack.gracia.vehicles.AirShipController; import com.l2jserver.gameserver.model.Location; import com.l2jserver.gameserver.model.VehiclePathPoint; -public final class KeucereusNorthController extends AirShipController -{ +public final class KeucereusNorthController extends AirShipController { private static final int DOCK_ZONE = 50602; private static final int LOCATION = 100; private static final int CONTROLLER_ID = 32606; - private static final VehiclePathPoint[] ARRIVAL = - { + private static final VehiclePathPoint[] ARRIVAL = { new VehiclePathPoint(-183218, 239494, 2500, 280, 2000), new VehiclePathPoint(-183218, 239494, 1336, 280, 2000) }; - private static final VehiclePathPoint[] DEPART = - { + private static final VehiclePathPoint[] DEPART = { new VehiclePathPoint(-183218, 239494, 1700, 280, 2000), new VehiclePathPoint(-181974, 235358, 1700, 280, 2000) }; - private static final VehiclePathPoint[][] TELEPORTS = - { + private static final VehiclePathPoint[][] TELEPORTS = { { new VehiclePathPoint(-183218, 239494, 1700, 280, 2000), new VehiclePathPoint(-181974, 235358, 1700, 280, 2000), @@ -59,15 +55,13 @@ public final class KeucereusNorthController extends AirShipController } }; - private static final int[] FUEL = - { + private static final int[] FUEL = { 0, 50, 100 }; - public KeucereusNorthController() - { + public KeucereusNorthController() { super(-1, KeucereusNorthController.class.getSimpleName(), "gracia/vehicles"); addStartNpc(CONTROLLER_ID); addFirstTalkId(CONTROLLER_ID); diff --git a/src/main/java/com/l2jserver/datapack/gracia/vehicles/KeucereusSouthController/KeucereusSouthController.java b/src/main/java/com/l2jserver/datapack/gracia/vehicles/KeucereusSouthController/KeucereusSouthController.java index d34779aa24..9586fd8e55 100644 --- a/src/main/java/com/l2jserver/datapack/gracia/vehicles/KeucereusSouthController/KeucereusSouthController.java +++ b/src/main/java/com/l2jserver/datapack/gracia/vehicles/KeucereusSouthController/KeucereusSouthController.java @@ -22,26 +22,22 @@ import com.l2jserver.datapack.gracia.vehicles.AirShipController; import com.l2jserver.gameserver.model.Location; import com.l2jserver.gameserver.model.VehiclePathPoint; -public final class KeucereusSouthController extends AirShipController -{ +public final class KeucereusSouthController extends AirShipController { private static final int DOCK_ZONE = 50603; private static final int LOCATION = 100; private static final int CONTROLLER_ID = 32517; - private static final VehiclePathPoint[] ARRIVAL = - { + private static final VehiclePathPoint[] ARRIVAL = { new VehiclePathPoint(-185312, 246544, 2500), new VehiclePathPoint(-185312, 246544, 1336) }; - private static final VehiclePathPoint[] DEPART = - { + private static final VehiclePathPoint[] DEPART = { new VehiclePathPoint(-185312, 246544, 1700, 280, 2000), new VehiclePathPoint(-186900, 251699, 1700, 280, 2000) }; - private static final VehiclePathPoint[][] TELEPORTS = - { + private static final VehiclePathPoint[][] TELEPORTS = { { new VehiclePathPoint(-185312, 246544, 1700, 280, 2000), new VehiclePathPoint(-186900, 251699, 1700, 280, 2000), @@ -59,15 +55,13 @@ public final class KeucereusSouthController extends AirShipController } }; - private static final int[] FUEL = - { + private static final int[] FUEL = { 0, 50, 100 }; - public KeucereusSouthController() - { + public KeucereusSouthController() { super(-1, KeucereusSouthController.class.getSimpleName(), "gracia/vehicles"); addStartNpc(CONTROLLER_ID); addFirstTalkId(CONTROLLER_ID); diff --git a/src/main/java/com/l2jserver/datapack/gracia/vehicles/SoDController/SoDController.java b/src/main/java/com/l2jserver/datapack/gracia/vehicles/SoDController/SoDController.java index 07c7364c17..3547c534bb 100644 --- a/src/main/java/com/l2jserver/datapack/gracia/vehicles/SoDController/SoDController.java +++ b/src/main/java/com/l2jserver/datapack/gracia/vehicles/SoDController/SoDController.java @@ -22,24 +22,20 @@ import com.l2jserver.datapack.gracia.vehicles.AirShipController; import com.l2jserver.gameserver.model.Location; import com.l2jserver.gameserver.model.VehiclePathPoint; -public final class SoDController extends AirShipController -{ +public final class SoDController extends AirShipController { private static final int DOCK_ZONE = 50601; private static final int LOCATION = 102; private static final int CONTROLLER_ID = 32605; - private static final VehiclePathPoint[] ARRIVAL = - { + private static final VehiclePathPoint[] ARRIVAL = { new VehiclePathPoint(-246445, 252331, 4359, 280, 2000), }; - private static final VehiclePathPoint[] DEPART = - { + private static final VehiclePathPoint[] DEPART = { new VehiclePathPoint(-245245, 251040, 4359, 280, 2000) }; - private static final VehiclePathPoint[][] TELEPORTS = - { + private static final VehiclePathPoint[][] TELEPORTS = { { new VehiclePathPoint(-245245, 251040, 4359, 280, 2000), new VehiclePathPoint(-235693, 248843, 5100, 0, 0) @@ -50,14 +46,12 @@ public final class SoDController extends AirShipController } }; - private static final int[] FUEL = - { + private static final int[] FUEL = { 0, 100 }; - public SoDController() - { + public SoDController() { super(-1, SoDController.class.getSimpleName(), "gracia/vehicles"); addStartNpc(CONTROLLER_ID); addFirstTalkId(CONTROLLER_ID); diff --git a/src/main/java/com/l2jserver/datapack/gracia/vehicles/SoIController/SoIController.java b/src/main/java/com/l2jserver/datapack/gracia/vehicles/SoIController/SoIController.java index 771aff3a56..0fe79deba2 100644 --- a/src/main/java/com/l2jserver/datapack/gracia/vehicles/SoIController/SoIController.java +++ b/src/main/java/com/l2jserver/datapack/gracia/vehicles/SoIController/SoIController.java @@ -22,26 +22,22 @@ import com.l2jserver.datapack.gracia.vehicles.AirShipController; import com.l2jserver.gameserver.model.Location; import com.l2jserver.gameserver.model.VehiclePathPoint; -public final class SoIController extends AirShipController -{ +public final class SoIController extends AirShipController { private static final int DOCK_ZONE = 50600; private static final int LOCATION = 101; private static final int CONTROLLER_ID = 32604; - private static final VehiclePathPoint[] ARRIVAL = - { + private static final VehiclePathPoint[] ARRIVAL = { new VehiclePathPoint(-214422, 211396, 5000, 280, 2000), new VehiclePathPoint(-214422, 211396, 4422, 280, 2000) }; - private static final VehiclePathPoint[] DEPART = - { + private static final VehiclePathPoint[] DEPART = { new VehiclePathPoint(-214422, 211396, 5000, 280, 2000), new VehiclePathPoint(-215877, 209709, 5000, 280, 2000) }; - private static final VehiclePathPoint[][] TELEPORTS = - { + private static final VehiclePathPoint[][] TELEPORTS = { { new VehiclePathPoint(-214422, 211396, 5000, 280, 2000), new VehiclePathPoint(-215877, 209709, 5000, 280, 2000), @@ -54,14 +50,12 @@ public final class SoIController extends AirShipController } }; - private static final int[] FUEL = - { + private static final int[] FUEL = { 0, 50 }; - public SoIController() - { + public SoIController() { super(-1, SoIController.class.getSimpleName(), "gracia/vehicles"); addStartNpc(CONTROLLER_ID); addFirstTalkId(CONTROLLER_ID); diff --git a/src/main/java/com/l2jserver/datapack/handlers/EffectMasterHandler.java b/src/main/java/com/l2jserver/datapack/handlers/EffectMasterHandler.java index 5320547740..dc40ecb548 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/EffectMasterHandler.java +++ b/src/main/java/com/l2jserver/datapack/handlers/EffectMasterHandler.java @@ -189,12 +189,10 @@ import com.l2jserver.gameserver.model.effects.AbstractEffect; * @author BiggBoss * @author Zoey76 */ -public final class EffectMasterHandler -{ +public final class EffectMasterHandler { private static final Logger LOG = LoggerFactory.getLogger(EffectMasterHandler.class); - private static final Class<?>[] EFFECTS = - { + private static final Class<?>[] EFFECTS = { AddHate.class, AttackTrait.class, Backstab.class, @@ -358,10 +356,8 @@ public final class EffectMasterHandler }; @SuppressWarnings("unchecked") - public static void main(String[] args) - { - for (Class<?> c : EFFECTS) - { + public static void main(String[] args) { + for (Class<?> c : EFFECTS) { EffectHandler.getInstance().registerHandler((Class<? extends AbstractEffect>) c); } LOG.info("Loaded {} effect handlers.", EffectHandler.getInstance().size()); diff --git a/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2ArtefactInstanceAction.java b/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2ArtefactInstanceAction.java index e894f2a351..565fbf5604 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2ArtefactInstanceAction.java +++ b/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2ArtefactInstanceAction.java @@ -25,15 +25,15 @@ import com.l2jserver.gameserver.model.L2Object; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -public class L2ArtefactInstanceAction implements IActionHandler -{ +public class L2ArtefactInstanceAction implements IActionHandler { /** * Manage actions when a player click on the L2ArtefactInstance.<BR> * <BR> * <B><U> Actions</U> :</B><BR> * <BR> - * <li>Set the L2NpcInstance as target of the L2PcInstance player (if necessary)</li> <li>Send a Server->Client packet MyTargetSelected to the L2PcInstance player (display the select window)</li> <li>Send a Server->Client packet ValidateLocation to correct the L2NpcInstance position and heading - * on the client</li><BR> + * <li>Set the L2NpcInstance as target of the L2PcInstance player (if necessary)</li> + * <li>Send a Server->Client packet MyTargetSelected to the L2PcInstance player (display the select window)</li> + * <li>Send a Server->Client packet ValidateLocation to correct the L2NpcInstance position and heading on the client</li><BR> * <BR> * <B><U> Example of use </U> :</B><BR> * <BR> @@ -41,21 +41,15 @@ public class L2ArtefactInstanceAction implements IActionHandler * <BR> */ @Override - public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) - { - if (!((L2Npc) target).canTarget(activeChar)) - { + public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) { + if (!((L2Npc) target).canTarget(activeChar)) { return false; } - if (activeChar.getTarget() != target) - { + if (activeChar.getTarget() != target) { activeChar.setTarget(target); - } - else if (interact) - { + } else if (interact) { // Calculate the distance between the L2PcInstance and the L2NpcInstance - if (!((L2Npc) target).canInteract(activeChar)) - { + if (!((L2Npc) target).canInteract(activeChar)) { // Notify the L2PcInstance AI with AI_INTENTION_INTERACT activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target); } @@ -64,8 +58,7 @@ public class L2ArtefactInstanceAction implements IActionHandler } @Override - public InstanceType getInstanceType() - { + public InstanceType getInstanceType() { return InstanceType.L2ArtefactInstance; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2DecoyAction.java b/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2DecoyAction.java index ae91ed869b..0e6c659551 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2DecoyAction.java +++ b/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2DecoyAction.java @@ -24,14 +24,11 @@ import com.l2jserver.gameserver.model.L2Object; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.SystemMessageId; -public class L2DecoyAction implements IActionHandler -{ +public class L2DecoyAction implements IActionHandler { @Override - public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) - { + public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) { // Aggression target lock effect - if (activeChar.isLockedTarget() && (activeChar.getLockedTarget() != target)) - { + if (activeChar.isLockedTarget() && (activeChar.getLockedTarget() != target)) { activeChar.sendPacket(SystemMessageId.FAILED_CHANGE_TARGET); return false; } @@ -41,8 +38,7 @@ public class L2DecoyAction implements IActionHandler } @Override - public InstanceType getInstanceType() - { + public InstanceType getInstanceType() { return InstanceType.L2Decoy; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2DoorInstanceAction.java b/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2DoorInstanceAction.java index 6ba82168e8..85b519032e 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2DoorInstanceAction.java +++ b/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2DoorInstanceAction.java @@ -30,62 +30,39 @@ import com.l2jserver.gameserver.model.entity.clanhall.SiegableHall; import com.l2jserver.gameserver.model.holders.DoorRequestHolder; import com.l2jserver.gameserver.network.serverpackets.ConfirmDlg; -public class L2DoorInstanceAction implements IActionHandler -{ +public class L2DoorInstanceAction implements IActionHandler { @Override - public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) - { + public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) { // Check if the L2PcInstance already target the L2NpcInstance - if (activeChar.getTarget() != target) - { + if (activeChar.getTarget() != target) { activeChar.setTarget(target); - } - else if (interact) - { + } else if (interact) { L2DoorInstance door = (L2DoorInstance) target; // MyTargetSelected my = new MyTargetSelected(getObjectId(), activeChar.getLevel()); // activeChar.sendPacket(my); - if (target.isAutoAttackable(activeChar)) - { - if (Math.abs(activeChar.getZ() - target.getZ()) < 400) - { + if (target.isAutoAttackable(activeChar)) { + if (Math.abs(activeChar.getZ() - target.getZ()) < 400) { activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); } - } - else if ((activeChar.getClan() != null) && (door.getClanHall() != null) && (activeChar.getClanId() == door.getClanHall().getOwnerId())) - { - if (!door.isInsideRadius(activeChar, L2Npc.INTERACTION_DISTANCE, false, false)) - { + } else if ((activeChar.getClan() != null) && (door.getClanHall() != null) && (activeChar.getClanId() == door.getClanHall().getOwnerId())) { + if (!door.isInsideRadius(activeChar, L2Npc.INTERACTION_DISTANCE, false, false)) { activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target); - } - else if (!door.getClanHall().isSiegableHall() || !((SiegableHall) door.getClanHall()).isInSiege()) - { + } else if (!door.getClanHall().isSiegableHall() || !((SiegableHall) door.getClanHall()).isInSiege()) { activeChar.addScript(new DoorRequestHolder(door)); - if (!door.getOpen()) - { + if (!door.getOpen()) { activeChar.sendPacket(new ConfirmDlg(1140)); - } - else - { + } else { activeChar.sendPacket(new ConfirmDlg(1141)); } } - } - else if ((activeChar.getClan() != null) && (((L2DoorInstance) target).getFort() != null) && (activeChar.getClan() == ((L2DoorInstance) target).getFort().getOwnerClan()) && ((L2DoorInstance) target).isOpenableBySkill() && !((L2DoorInstance) target).getFort().getSiege().isInProgress()) - { - if (!((L2Character) target).isInsideRadius(activeChar, L2Npc.INTERACTION_DISTANCE, false, false)) - { + } else if ((activeChar.getClan() != null) && (((L2DoorInstance) target).getFort() != null) && (activeChar.getClan() == ((L2DoorInstance) target).getFort().getOwnerClan()) && ((L2DoorInstance) target).isOpenableBySkill() && !((L2DoorInstance) target).getFort().getSiege().isInProgress()) { + if (!((L2Character) target).isInsideRadius(activeChar, L2Npc.INTERACTION_DISTANCE, false, false)) { activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target); - } - else - { + } else { activeChar.addScript(new DoorRequestHolder((L2DoorInstance) target)); - if (!((L2DoorInstance) target).getOpen()) - { + if (!((L2DoorInstance) target).getOpen()) { activeChar.sendPacket(new ConfirmDlg(1140)); - } - else - { + } else { activeChar.sendPacket(new ConfirmDlg(1141)); } } @@ -95,8 +72,7 @@ public class L2DoorInstanceAction implements IActionHandler } @Override - public InstanceType getInstanceType() - { + public InstanceType getInstanceType() { return InstanceType.L2DoorInstance; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2ItemInstanceAction.java b/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2ItemInstanceAction.java index fbc060af90..ce02e02afa 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2ItemInstanceAction.java +++ b/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2ItemInstanceAction.java @@ -25,31 +25,23 @@ import com.l2jserver.gameserver.instancemanager.MercTicketManager; import com.l2jserver.gameserver.model.L2Object; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -public class L2ItemInstanceAction implements IActionHandler -{ +public class L2ItemInstanceAction implements IActionHandler { @Override - public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) - { + public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) { // this causes the validate position handler to do the pickup if the location is reached. // mercenary tickets can only be picked up by the castle owner. final int castleId = MercTicketManager.getInstance().getTicketCastleId(target.getId()); - if ((castleId > 0) && (!activeChar.isCastleLord(castleId) || activeChar.isInParty())) - { - if (activeChar.isInParty()) - { + if ((castleId > 0) && (!activeChar.isCastleLord(castleId) || activeChar.isInParty())) { + if (activeChar.isInParty()) { activeChar.sendMessage("You cannot pickup mercenaries while in a party."); - } - else - { + } else { activeChar.sendMessage("Only the castle lord can pickup mercenaries."); } activeChar.setTarget(target); activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); - } - else if (!activeChar.isFlying()) - { + } else if (!activeChar.isFlying()) { activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_PICK_UP, target); } @@ -57,8 +49,7 @@ public class L2ItemInstanceAction implements IActionHandler } @Override - public InstanceType getInstanceType() - { + public InstanceType getInstanceType() { return InstanceType.L2ItemInstance; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2NpcAction.java b/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2NpcAction.java index 0e7fd84fb5..e3084bc4c8 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2NpcAction.java +++ b/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2NpcAction.java @@ -35,20 +35,22 @@ import com.l2jserver.gameserver.model.events.EventType; import com.l2jserver.gameserver.model.events.impl.character.npc.OnNpcFirstTalk; import com.l2jserver.gameserver.network.serverpackets.MoveToPawn; -public class L2NpcAction implements IActionHandler -{ +public class L2NpcAction implements IActionHandler { /** * Manage actions when a player click on the L2Npc.<BR> * <BR> * <B><U> Actions on first click on the L2Npc (Select it)</U> :</B><BR> * <BR> - * <li>Set the L2Npc as target of the L2PcInstance player (if necessary)</li> <li>Send a Server->Client packet MyTargetSelected to the L2PcInstance player (display the select window)</li> <li>If L2Npc is autoAttackable, send a Server->Client packet StatusUpdate to the L2PcInstance in order to - * update L2Npc HP bar</li> <li>Send a Server->Client packet ValidateLocation to correct the L2Npc position and heading on the client</li><BR> + * <li>Set the L2Npc as target of the L2PcInstance player (if necessary)</li> + * <li>Send a Server->Client packet MyTargetSelected to the L2PcInstance player (display the select window)</li> + * <li>If L2Npc is autoAttackable, send a Server->Client packet StatusUpdate to the L2PcInstance in order to update L2Npc HP bar</li> + * <li>Send a Server->Client packet ValidateLocation to correct the L2Npc position and heading on the client</li><BR> * <BR> * <B><U> Actions on second click on the L2Npc (Attack it/Intercat with it)</U> :</B><BR> * <BR> - * <li>Send a Server->Client packet MyTargetSelected to the L2PcInstance player (display the select window)</li> <li>If L2Npc is autoAttackable, notify the L2PcInstance AI with AI_INTENTION_ATTACK (after a height verification)</li> <li>If L2Npc is NOT autoAttackable, notify the L2PcInstance AI - * with AI_INTENTION_INTERACT (after a distance verification) and show message</li><BR> + * <li>Send a Server->Client packet MyTargetSelected to the L2PcInstance player (display the select window)</li> + * <li>If L2Npc is autoAttackable, notify the L2PcInstance AI with AI_INTENTION_ATTACK (after a height verification)</li> + * <li>If L2Npc is NOT autoAttackable, notify the L2PcInstance AI with AI_INTENTION_INTERACT (after a distance verification) and show message</li><BR> * <BR> * <FONT COLOR=#FF0000><B> <U>Caution</U> : Each group of Server->Client packet must be terminated by a ActionFailed packet in order to avoid that client wait an other packet</B></FONT><BR> * <BR> @@ -59,86 +61,61 @@ public class L2NpcAction implements IActionHandler * @param activeChar The L2PcInstance that start an action on the L2Npc */ @Override - public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) - { + public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) { final L2Npc npc = (L2Npc) target; - if (!npc.canTarget(activeChar)) - { + if (!npc.canTarget(activeChar)) { return false; } activeChar.setLastFolkNPC(npc); // Check if the L2PcInstance already target the L2Npc - if (npc != activeChar.getTarget()) - { + if (npc != activeChar.getTarget()) { // Set the target of the L2PcInstance activeChar activeChar.setTarget(npc); // Check if the activeChar is attackable (without a forced attack) - if (npc.isAutoAttackable(activeChar)) - { + if (npc.isAutoAttackable(activeChar)) { npc.getAI(); // wake up ai } - } - else if (interact) - { + } else if (interact) { // Check if the activeChar is attackable (without a forced attack) and isn't dead - if (npc.isAutoAttackable(activeChar) && !npc.isAlikeDead()) - { - if (GeoData.getInstance().canSeeTarget(activeChar, npc)) - { + if (npc.isAutoAttackable(activeChar) && !npc.isAlikeDead()) { + if (GeoData.getInstance().canSeeTarget(activeChar, npc)) { activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, npc); - } - else - { + } else { final Location destination = GeoData.getInstance().moveCheck(activeChar, npc); activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination); } - } - else if (!npc.isAutoAttackable(activeChar)) - { - if (!GeoData.getInstance().canSeeTarget(activeChar, npc)) - { + } else if (!npc.isAutoAttackable(activeChar)) { + if (!GeoData.getInstance().canSeeTarget(activeChar, npc)) { final Location destination = GeoData.getInstance().moveCheck(activeChar, npc); activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination); return true; } // Verifies if the NPC can interact with the player. - if (!npc.canInteract(activeChar)) - { + if (!npc.canInteract(activeChar)) { // Notify the L2PcInstance AI with AI_INTENTION_INTERACT activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, npc); - } - else - { + } else { // Turn NPC to the player. activeChar.sendPacket(new MoveToPawn(activeChar, npc, 100)); - if (npc.hasRandomAnimation()) - { + if (npc.hasRandomAnimation()) { npc.onRandomAnimation(Rnd.get(8)); } // Open a chat window on client with the text of the L2Npc - if (npc.isEventMob()) - { + if (npc.isEventMob()) { L2Event.showEventHtml(activeChar, String.valueOf(npc.getObjectId())); - } - else - { - if (npc.hasListener(EventType.ON_NPC_QUEST_START)) - { + } else { + if (npc.hasListener(EventType.ON_NPC_QUEST_START)) { activeChar.setLastQuestNpcObject(npc.getObjectId()); } - if (npc.hasListener(EventType.ON_NPC_FIRST_TALK)) - { + if (npc.hasListener(EventType.ON_NPC_FIRST_TALK)) { EventDispatcher.getInstance().notifyEventAsync(new OnNpcFirstTalk(npc, activeChar), npc); - } - else - { + } else { npc.showChatWindow(activeChar); } } - if ((character().getNpcTalkBlockingTime() > 0) && !activeChar.isGM()) - { + if ((character().getNpcTalkBlockingTime() > 0) && !activeChar.isGM()) { activeChar.updateNotMoveUntil(); } } @@ -148,8 +125,7 @@ public class L2NpcAction implements IActionHandler } @Override - public InstanceType getInstanceType() - { + public InstanceType getInstanceType() { return InstanceType.L2Npc; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2PcInstanceAction.java b/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2PcInstanceAction.java index 980b879eb5..37a47ae15b 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2PcInstanceAction.java +++ b/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2PcInstanceAction.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.entity.TvTEvent; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.ActionFailed; -public class L2PcInstanceAction implements IActionHandler -{ +public class L2PcInstanceAction implements IActionHandler { private static final int CURSED_WEAPON_VICTIM_MIN_LEVEL = 21; /** @@ -39,12 +38,14 @@ public class L2PcInstanceAction implements IActionHandler * <BR> * <B><U> Actions on first click on the L2PcInstance (Select it)</U> :</B><BR> * <BR> - * <li>Set the target of the player</li> <li>Send a Server->Client packet MyTargetSelected to the player (display the select window)</li><BR> + * <li>Set the target of the player</li> + * <li>Send a Server->Client packet MyTargetSelected to the player (display the select window)</li><BR> * <BR> * <B><U> Actions on second click on the L2PcInstance (Follow it/Attack it/Intercat with it)</U> :</B><BR> * <BR> - * <li>Send a Server->Client packet MyTargetSelected to the player (display the select window)</li> <li>If target L2PcInstance has a Private Store, notify the player AI with AI_INTENTION_INTERACT</li> <li>If target L2PcInstance is autoAttackable, notify the player AI with AI_INTENTION_ATTACK</li> - * <BR> + * <li>Send a Server->Client packet MyTargetSelected to the player (display the select window)</li> + * <li>If target L2PcInstance has a Private Store, notify the player AI with AI_INTENTION_INTERACT</li> + * <li>If target L2PcInstance is autoAttackable, notify the player AI with AI_INTENTION_ATTACK</li> <BR> * <BR> * <li>If target L2PcInstance is NOT autoAttackable, notify the player AI with AI_INTENTION_FOLLOW</li><BR> * <BR> @@ -55,75 +56,53 @@ public class L2PcInstanceAction implements IActionHandler * @param activeChar The player that start an action on target L2PcInstance */ @Override - public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) - { + public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) { // See description in TvTEvent.java - if (!TvTEvent.onAction(activeChar, target.getObjectId())) - { + if (!TvTEvent.onAction(activeChar, target.getObjectId())) { return false; } // Check if the L2PcInstance is confused - if (activeChar.isOutOfControl()) - { + if (activeChar.isOutOfControl()) { return false; } // Aggression target lock effect - if (activeChar.isLockedTarget() && (activeChar.getLockedTarget() != target)) - { + if (activeChar.isLockedTarget() && (activeChar.getLockedTarget() != target)) { activeChar.sendPacket(SystemMessageId.FAILED_CHANGE_TARGET); return false; } // Check if the activeChar already target this L2PcInstance - if (activeChar.getTarget() != target) - { + if (activeChar.getTarget() != target) { // Set the target of the activeChar activeChar.setTarget(target); - } - else if (interact) - { + } else if (interact) { final L2PcInstance player = target.getActingPlayer(); // Check if this L2PcInstance has a Private Store - if (player.getPrivateStoreType() != PrivateStoreType.NONE) - { + if (player.getPrivateStoreType() != PrivateStoreType.NONE) { activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, player); - } - else - { + } else { // Check if this L2PcInstance is autoAttackable - if (player.isAutoAttackable(activeChar)) - { + if (player.isAutoAttackable(activeChar)) { if ((player.isCursedWeaponEquipped() && (activeChar.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL)) // - || (activeChar.isCursedWeaponEquipped() && (player.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL))) - { + || (activeChar.isCursedWeaponEquipped() && (player.getLevel() < CURSED_WEAPON_VICTIM_MIN_LEVEL))) { activeChar.sendPacket(ActionFailed.STATIC_PACKET); - } - else - { - if (GeoData.getInstance().canSeeTarget(activeChar, player)) - { + } else { + if (GeoData.getInstance().canSeeTarget(activeChar, player)) { activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player); - } - else - { + } else { final Location destination = GeoData.getInstance().moveCheck(activeChar, player); activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination); } activeChar.onActionRequest(); } - } - else - { + } else { // This Action Failed packet avoids activeChar getting stuck when clicking three or more times activeChar.sendPacket(ActionFailed.STATIC_PACKET); - if (GeoData.getInstance().canSeeTarget(activeChar, player)) - { + if (GeoData.getInstance().canSeeTarget(activeChar, player)) { activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); - } - else - { + } else { final Location destination = GeoData.getInstance().moveCheck(activeChar, player); activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination); } @@ -134,8 +113,7 @@ public class L2PcInstanceAction implements IActionHandler } @Override - public InstanceType getInstanceType() - { + public InstanceType getInstanceType() { return InstanceType.L2PcInstance; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2PetInstanceAction.java b/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2PetInstanceAction.java index a1a142beff..cacbf57c5d 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2PetInstanceAction.java +++ b/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2PetInstanceAction.java @@ -32,53 +32,38 @@ import com.l2jserver.gameserver.model.events.impl.character.player.OnPlayerSummo import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.PetStatusShow; -public class L2PetInstanceAction implements IActionHandler -{ +public class L2PetInstanceAction implements IActionHandler { @Override - public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) - { + public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) { // Aggression target lock effect - if (activeChar.isLockedTarget() && (activeChar.getLockedTarget() != target)) - { + if (activeChar.isLockedTarget() && (activeChar.getLockedTarget() != target)) { activeChar.sendPacket(SystemMessageId.FAILED_CHANGE_TARGET); return false; } boolean isOwner = activeChar.getObjectId() == ((L2PetInstance) target).getOwner().getObjectId(); - if (isOwner && (activeChar != ((L2PetInstance) target).getOwner())) - { + if (isOwner && (activeChar != ((L2PetInstance) target).getOwner())) { ((L2PetInstance) target).updateRefOwner(activeChar); } - if (activeChar.getTarget() != target) - { + if (activeChar.getTarget() != target) { // Set the target of the L2PcInstance activeChar activeChar.setTarget(target); - } - else if (interact) - { + } else if (interact) { // Check if the pet is attackable (without a forced attack) and isn't dead - if (target.isAutoAttackable(activeChar) && !isOwner) - { - if (GeoData.getInstance().canSeeTarget(activeChar, target)) - { + if (target.isAutoAttackable(activeChar) && !isOwner) { + if (GeoData.getInstance().canSeeTarget(activeChar, target)) { // Set the L2PcInstance Intention to AI_INTENTION_ATTACK activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); activeChar.onActionRequest(); } - } - else if (!((L2Character) target).isInsideRadius(activeChar, 150, false, false)) - { - if (GeoData.getInstance().canSeeTarget(activeChar, target)) - { + } else if (!((L2Character) target).isInsideRadius(activeChar, 150, false, false)) { + if (GeoData.getInstance().canSeeTarget(activeChar, target)) { activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target); activeChar.onActionRequest(); } - } - else - { - if (isOwner) - { + } else { + if (isOwner) { activeChar.sendPacket(new PetStatusShow((L2PetInstance) target)); // Notify to scripts @@ -91,8 +76,7 @@ public class L2PetInstanceAction implements IActionHandler } @Override - public InstanceType getInstanceType() - { + public InstanceType getInstanceType() { return InstanceType.L2PetInstance; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2StaticObjectInstanceAction.java b/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2StaticObjectInstanceAction.java index 6e2ff1c4f1..58f066d501 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2StaticObjectInstanceAction.java +++ b/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2StaticObjectInstanceAction.java @@ -28,52 +28,37 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.actor.instance.L2StaticObjectInstance; import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; -public class L2StaticObjectInstanceAction implements IActionHandler -{ +public class L2StaticObjectInstanceAction implements IActionHandler { @Override - public boolean action(final L2PcInstance activeChar, final L2Object target, final boolean interact) - { + public boolean action(final L2PcInstance activeChar, final L2Object target, final boolean interact) { final L2StaticObjectInstance staticObject = (L2StaticObjectInstance) target; - if (staticObject.getType() < 0) - { + if (staticObject.getType() < 0) { _log.info("L2StaticObjectInstance: StaticObject with invalid type! StaticObjectId: " + staticObject.getId()); } // Check if the L2PcInstance already target the L2NpcInstance - if (activeChar.getTarget() != staticObject) - { + if (activeChar.getTarget() != staticObject) { // Set the target of the L2PcInstance activeChar activeChar.setTarget(staticObject); - } - else if (interact) - { + } else if (interact) { // Calculate the distance between the L2PcInstance and the L2NpcInstance - if (!activeChar.isInsideRadius(staticObject, L2Npc.INTERACTION_DISTANCE, false, false)) - { + if (!activeChar.isInsideRadius(staticObject, L2Npc.INTERACTION_DISTANCE, false, false)) { // Notify the L2PcInstance AI with AI_INTENTION_INTERACT activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, staticObject); - } - else - { - if (staticObject.getType() == 2) - { + } else { + if (staticObject.getType() == 2) { final String filename = (staticObject.getId() == 24230101) ? "data/html/signboards/tomb_of_crystalgolem.htm" : "data/html/signboards/pvp_signboard.htm"; final String content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), filename); final NpcHtmlMessage html = new NpcHtmlMessage(staticObject.getObjectId()); - if (content == null) - { + if (content == null) { html.setHtml("<html><body>Signboard is missing:<br>" + filename + "</body></html>"); - } - else - { + } else { html.setHtml(content); } activeChar.sendPacket(html); - } - else if (staticObject.getType() == 0) - { + } else if (staticObject.getType() == 0) { activeChar.sendPacket(staticObject.getMap()); } } @@ -82,8 +67,7 @@ public class L2StaticObjectInstanceAction implements IActionHandler } @Override - public InstanceType getInstanceType() - { + public InstanceType getInstanceType() { return InstanceType.L2StaticObjectInstance; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2SummonAction.java b/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2SummonAction.java index da52e3c9e4..0cf132d402 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2SummonAction.java +++ b/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2SummonAction.java @@ -31,53 +31,37 @@ import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.ActionFailed; import com.l2jserver.gameserver.network.serverpackets.PetStatusShow; -public class L2SummonAction implements IActionHandler -{ +public class L2SummonAction implements IActionHandler { @Override - public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) - { + public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) { // Aggression target lock effect - if (activeChar.isLockedTarget() && (activeChar.getLockedTarget() != target)) - { + if (activeChar.isLockedTarget() && (activeChar.getLockedTarget() != target)) { activeChar.sendPacket(SystemMessageId.FAILED_CHANGE_TARGET); return false; } - if ((activeChar == ((L2Summon) target).getOwner()) && (activeChar.getTarget() == target)) - { + if ((activeChar == ((L2Summon) target).getOwner()) && (activeChar.getTarget() == target)) { activeChar.sendPacket(new PetStatusShow((L2Summon) target)); activeChar.updateNotMoveUntil(); activeChar.sendPacket(ActionFailed.STATIC_PACKET); // Notify to scripts EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSummonTalk((L2Summon) target), (L2Summon) target); - } - else if (activeChar.getTarget() != target) - { + } else if (activeChar.getTarget() != target) { activeChar.setTarget(target); - } - else if (interact) - { - if (target.isAutoAttackable(activeChar)) - { - if (GeoData.getInstance().canSeeTarget(activeChar, target)) - { + } else if (interact) { + if (target.isAutoAttackable(activeChar)) { + if (GeoData.getInstance().canSeeTarget(activeChar, target)) { activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); activeChar.onActionRequest(); } - } - else - { + } else { // This Action Failed packet avoids activeChar getting stuck when clicking three or more times activeChar.sendPacket(ActionFailed.STATIC_PACKET); - if (((L2Summon) target).isInsideRadius(activeChar, 150, false, false)) - { + if (((L2Summon) target).isInsideRadius(activeChar, 150, false, false)) { activeChar.updateNotMoveUntil(); - } - else - { - if (GeoData.getInstance().canSeeTarget(activeChar, target)) - { + } else { + if (GeoData.getInstance().canSeeTarget(activeChar, target)) { activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, target); } } @@ -87,8 +71,7 @@ public class L2SummonAction implements IActionHandler } @Override - public InstanceType getInstanceType() - { + public InstanceType getInstanceType() { return InstanceType.L2Summon; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2TrapAction.java b/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2TrapAction.java index 9bfa8d4a87..50fa6aa633 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2TrapAction.java +++ b/src/main/java/com/l2jserver/datapack/handlers/actionhandlers/L2TrapAction.java @@ -24,14 +24,11 @@ import com.l2jserver.gameserver.model.L2Object; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.SystemMessageId; -public class L2TrapAction implements IActionHandler -{ +public class L2TrapAction implements IActionHandler { @Override - public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) - { + public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) { // Aggression target lock effect - if (activeChar.isLockedTarget() && (activeChar.getLockedTarget() != target)) - { + if (activeChar.isLockedTarget() && (activeChar.getLockedTarget() != target)) { activeChar.sendPacket(SystemMessageId.FAILED_CHANGE_TARGET); return false; } @@ -41,8 +38,7 @@ public class L2TrapAction implements IActionHandler } @Override - public InstanceType getInstanceType() - { + public InstanceType getInstanceType() { return InstanceType.L2TrapInstance; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/actionshifthandlers/L2DoorInstanceActionShift.java b/src/main/java/com/l2jserver/datapack/handlers/actionshifthandlers/L2DoorInstanceActionShift.java index 78dc785c11..f1e4b04a36 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/actionshifthandlers/L2DoorInstanceActionShift.java +++ b/src/main/java/com/l2jserver/datapack/handlers/actionshifthandlers/L2DoorInstanceActionShift.java @@ -26,13 +26,10 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; import com.l2jserver.gameserver.network.serverpackets.StaticObject; -public class L2DoorInstanceActionShift implements IActionShiftHandler -{ +public class L2DoorInstanceActionShift implements IActionShiftHandler { @Override - public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) - { - if (activeChar.getAccessLevel().isGm()) - { + public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) { + if (activeChar.getAccessLevel().isGm()) { activeChar.setTarget(target); L2DoorInstance door = (L2DoorInstance) target; activeChar.sendPacket(new StaticObject(door, activeChar.isGM())); @@ -60,8 +57,7 @@ public class L2DoorInstanceActionShift implements IActionShiftHandler } @Override - public InstanceType getInstanceType() - { + public InstanceType getInstanceType() { return InstanceType.L2DoorInstance; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/actionshifthandlers/L2ItemInstanceActionShift.java b/src/main/java/com/l2jserver/datapack/handlers/actionshifthandlers/L2ItemInstanceActionShift.java index 74c00021c0..db89956f5f 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/actionshifthandlers/L2ItemInstanceActionShift.java +++ b/src/main/java/com/l2jserver/datapack/handlers/actionshifthandlers/L2ItemInstanceActionShift.java @@ -26,13 +26,10 @@ import com.l2jserver.gameserver.model.items.instance.L2ItemInstance; import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; import com.l2jserver.gameserver.util.StringUtil; -public class L2ItemInstanceActionShift implements IActionShiftHandler -{ +public class L2ItemInstanceActionShift implements IActionShiftHandler { @Override - public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) - { - if (activeChar.getAccessLevel().isGm()) - { + public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) { + if (activeChar.getAccessLevel().isGm()) { final NpcHtmlMessage html = new NpcHtmlMessage(StringUtil.concat("<html><body><center><font color=\"LEVEL\">Item Info</font></center><br><table border=0>", "<tr><td>Object ID: </td><td>", String.valueOf(target.getObjectId()), "</td></tr><tr><td>Item ID: </td><td>", String.valueOf(target.getId()), "</td></tr><tr><td>Owner ID: </td><td>", String.valueOf(((L2ItemInstance) target).getOwnerId()), "</td></tr><tr><td>Location: </td><td>", String.valueOf(((L2ItemInstance) target).getLocation()), "</td></tr><tr><td><br></td></tr><tr><td>Class: </td><td>", target.getClass().getSimpleName(), "</td></tr></table></body></html>")); activeChar.sendPacket(html); } @@ -40,8 +37,7 @@ public class L2ItemInstanceActionShift implements IActionShiftHandler } @Override - public InstanceType getInstanceType() - { + public InstanceType getInstanceType() { return InstanceType.L2ItemInstance; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/actionshifthandlers/L2NpcActionShift.java b/src/main/java/com/l2jserver/datapack/handlers/actionshifthandlers/L2NpcActionShift.java index 4f7c07ca2c..50d11c3960 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/actionshifthandlers/L2NpcActionShift.java +++ b/src/main/java/com/l2jserver/datapack/handlers/actionshifthandlers/L2NpcActionShift.java @@ -36,8 +36,7 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; import com.l2jserver.gameserver.util.Util; -public class L2NpcActionShift implements IActionShiftHandler -{ +public class L2NpcActionShift implements IActionShiftHandler { /** * Manage and Display the GM console to modify the L2NpcInstance (GM only).<BR> * <BR> @@ -48,14 +47,17 @@ public class L2NpcActionShift implements IActionShiftHandler * <li>If L2NpcInstance is autoAttackable, send a Server->Client packet StatusUpdate to the L2PcInstance in order to update L2NpcInstance HP bar</li> * <li>Send a Server->Client NpcHtmlMessage() containing the GM console about this L2NpcInstance</li><BR> * <BR> - * <FONT COLOR=#FF0000><B> <U>Caution</U> : Each group of Server->Client packet must be terminated by a ActionFailed packet in order to avoid that client wait an other packet</B></FONT><BR> <BR> <B><U> Example of use </U> :</B><BR> <BR> <li>Client packet : Action</li><BR> <BR> + * <FONT COLOR=#FF0000><B> <U>Caution</U> : Each group of Server->Client packet must be terminated by a ActionFailed packet in order to avoid that client wait an other packet</B></FONT><BR> + * <BR> + * <B><U> Example of use </U> :</B><BR> + * <BR> + * <li>Client packet : Action</li><BR> + * <BR> */ @Override - public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) - { + public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) { // Check if the L2PcInstance is a GM - if (activeChar.getAccessLevel().isGm()) - { + if (activeChar.getAccessLevel().isGm()) { // Set the target of the L2PcInstance activeChar activeChar.setTarget(target); @@ -109,37 +111,26 @@ public class L2NpcActionShift implements IActionShiftHandler html.replace("%ele_dholy%", String.valueOf(((L2Character) target).getDefenseElementValue(Elementals.HOLY))); html.replace("%ele_ddark%", String.valueOf(((L2Character) target).getDefenseElementValue(Elementals.DARK))); - if (((L2Npc) target).getSpawn() != null) - { + if (((L2Npc) target).getSpawn() != null) { html.replace("%territory%", ((L2Npc) target).getSpawn().getSpawnTerritory() == null ? "None" : ((L2Npc) target).getSpawn().getSpawnTerritory().getName()); - if (((L2Npc) target).getSpawn().isTerritoryBased()) - { + if (((L2Npc) target).getSpawn().isTerritoryBased()) { html.replace("%spawntype%", "Random"); final Location spawnLoc = ((L2Npc) target).getSpawn().getLocation(target); html.replace("%spawn%", spawnLoc.getX() + " " + spawnLoc.getY() + " " + spawnLoc.getZ()); - } - else - { + } else { html.replace("%spawntype%", "Fixed"); html.replace("%spawn%", ((L2Npc) target).getSpawn().getX() + " " + ((L2Npc) target).getSpawn().getY() + " " + ((L2Npc) target).getSpawn().getZ()); } html.replace("%loc2d%", String.valueOf((int) target.calculateDistance(((L2Npc) target).getSpawn().getLocation(target), false, false))); html.replace("%loc3d%", String.valueOf((int) target.calculateDistance(((L2Npc) target).getSpawn().getLocation(target), true, false))); - if (((L2Npc) target).getSpawn().getRespawnMinDelay() == 0) - { + if (((L2Npc) target).getSpawn().getRespawnMinDelay() == 0) { html.replace("%resp%", "None"); - } - else if (((L2Npc) target).getSpawn().hasRespawnRandom()) - { + } else if (((L2Npc) target).getSpawn().hasRespawnRandom()) { html.replace("%resp%", String.valueOf(((L2Npc) target).getSpawn().getRespawnMinDelay() / 1000) + "-" + String.valueOf((((L2Npc) target).getSpawn().getRespawnMaxDelay() / 1000) + " sec")); - } - else - { + } else { html.replace("%resp%", String.valueOf(((L2Npc) target).getSpawn().getRespawnMinDelay() / 1000) + " sec"); } - } - else - { + } else { html.replace("%territory%", "<font color=FF0000>--</font>"); html.replace("%spawntype%", "<font color=FF0000>--</font>"); html.replace("%spawn%", "<font color=FF0000>null</font>"); @@ -148,8 +139,7 @@ public class L2NpcActionShift implements IActionShiftHandler html.replace("%resp%", "<font color=FF0000>--</font>"); } - if (((L2Npc) target).hasAI()) - { + if (((L2Npc) target).hasAI()) { Set<Integer> clans = ((L2Npc) target).getTemplate().getClans(); Set<Integer> ignoreClanNpcIds = ((L2Npc) target).getTemplate().getIgnoreClanNpcIds(); String clansString = clans != null ? Util.implode(clans.toArray(), ", ") : ""; @@ -159,10 +149,9 @@ public class L2NpcActionShift implements IActionShiftHandler html.replace("%ai%", "<tr><td><table width=270 border=0><tr><td width=100><font color=FFAA00>AI</font></td><td align=right width=170>" + ((L2Npc) target).getAI().getClass().getSimpleName() + "</td></tr></table></td></tr>"); html.replace("%ai_type%", "<tr><td><table width=270 border=0 bgcolor=131210><tr><td width=100><font color=FFAA00>AIType</font></td><td align=right width=170>" + String.valueOf(((L2Npc) target).getAiType()) + "</td></tr></table></td></tr>"); html.replace("%ai_clan%", "<tr><td><table width=270 border=0><tr><td width=100><font color=FFAA00>Clan & Range:</font></td><td align=right width=170>" + clansString + " " + String.valueOf(((L2Npc) target).getTemplate().getClanHelpRange()) + "</td></tr></table></td></tr>"); - html.replace("%ai_enemy_clan%", "<tr><td><table width=270 border=0 bgcolor=131210><tr><td width=100><font color=FFAA00>Ignore & Range:</font></td><td align=right width=170>" + ignoreClanNpcIdsString + " " + String.valueOf(((L2Npc) target).getTemplate().getAggroRange()) + "</td></tr></table></td></tr>"); - } - else - { + html.replace("%ai_enemy_clan%", "<tr><td><table width=270 border=0 bgcolor=131210><tr><td width=100><font color=FFAA00>Ignore & Range:</font></td><td align=right width=170>" + ignoreClanNpcIdsString + " " + String.valueOf(((L2Npc) target).getTemplate().getAggroRange()) + + "</td></tr></table></td></tr>"); + } else { html.replace("%ai_intention%", ""); html.replace("%ai%", ""); html.replace("%ai_type%", ""); @@ -171,20 +160,14 @@ public class L2NpcActionShift implements IActionShiftHandler } final String routeName = WalkingManager.getInstance().getRouteName((L2Npc) target); - if (!routeName.isEmpty()) - { + if (!routeName.isEmpty()) { html.replace("%route%", "<tr><td><table width=270 border=0><tr><td width=100><font color=LEVEL>Route:</font></td><td align=right width=170>" + routeName + "</td></tr></table></td></tr>"); - } - else - { + } else { html.replace("%route%", ""); } activeChar.sendPacket(html); - } - else if (npc().viewNpc()) - { - if (!target.isNpc()) - { + } else if (npc().viewNpc()) { + if (!target.isNpc()) { return false; } activeChar.setTarget(target); @@ -194,8 +177,7 @@ public class L2NpcActionShift implements IActionShiftHandler } @Override - public InstanceType getInstanceType() - { + public InstanceType getInstanceType() { return InstanceType.L2Npc; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/actionshifthandlers/L2PcInstanceActionShift.java b/src/main/java/com/l2jserver/datapack/handlers/actionshifthandlers/L2PcInstanceActionShift.java index 72112c3fb4..c276022849 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/actionshifthandlers/L2PcInstanceActionShift.java +++ b/src/main/java/com/l2jserver/datapack/handlers/actionshifthandlers/L2PcInstanceActionShift.java @@ -25,23 +25,18 @@ import com.l2jserver.gameserver.handler.IAdminCommandHandler; import com.l2jserver.gameserver.model.L2Object; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -public class L2PcInstanceActionShift implements IActionShiftHandler -{ +public class L2PcInstanceActionShift implements IActionShiftHandler { @Override - public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) - { - if (activeChar.isGM()) - { + public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) { + if (activeChar.isGM()) { // Check if the gm already target this l2pcinstance - if (activeChar.getTarget() != target) - { + if (activeChar.getTarget() != target) { // Set the target of the L2PcInstance activeChar activeChar.setTarget(target); } IAdminCommandHandler ach = AdminCommandHandler.getInstance().getHandler("admin_character_info"); - if (ach != null) - { + if (ach != null) { ach.useAdminCommand("admin_character_info " + target.getName(), activeChar); } } @@ -49,8 +44,7 @@ public class L2PcInstanceActionShift implements IActionShiftHandler } @Override - public InstanceType getInstanceType() - { + public InstanceType getInstanceType() { return InstanceType.L2PcInstance; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/actionshifthandlers/L2StaticObjectInstanceActionShift.java b/src/main/java/com/l2jserver/datapack/handlers/actionshifthandlers/L2StaticObjectInstanceActionShift.java index b8dcb74600..ca10272303 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/actionshifthandlers/L2StaticObjectInstanceActionShift.java +++ b/src/main/java/com/l2jserver/datapack/handlers/actionshifthandlers/L2StaticObjectInstanceActionShift.java @@ -27,13 +27,10 @@ import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; import com.l2jserver.gameserver.network.serverpackets.StaticObject; import com.l2jserver.gameserver.util.StringUtil; -public class L2StaticObjectInstanceActionShift implements IActionShiftHandler -{ +public class L2StaticObjectInstanceActionShift implements IActionShiftHandler { @Override - public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) - { - if (activeChar.getAccessLevel().isGm()) - { + public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) { + if (activeChar.getAccessLevel().isGm()) { activeChar.setTarget(target); activeChar.sendPacket(new StaticObject((L2StaticObjectInstance) target)); @@ -44,8 +41,7 @@ public class L2StaticObjectInstanceActionShift implements IActionShiftHandler } @Override - public InstanceType getInstanceType() - { + public InstanceType getInstanceType() { return InstanceType.L2StaticObjectInstance; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/actionshifthandlers/L2SummonActionShift.java b/src/main/java/com/l2jserver/datapack/handlers/actionshifthandlers/L2SummonActionShift.java index 9c10d90662..756da9b7bd 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/actionshifthandlers/L2SummonActionShift.java +++ b/src/main/java/com/l2jserver/datapack/handlers/actionshifthandlers/L2SummonActionShift.java @@ -25,22 +25,17 @@ import com.l2jserver.gameserver.handler.IAdminCommandHandler; import com.l2jserver.gameserver.model.L2Object; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -public class L2SummonActionShift implements IActionShiftHandler -{ +public class L2SummonActionShift implements IActionShiftHandler { @Override - public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) - { - if (activeChar.isGM()) - { - if (activeChar.getTarget() != target) - { + public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) { + if (activeChar.isGM()) { + if (activeChar.getTarget() != target) { // Set the target of the L2PcInstance activeChar activeChar.setTarget(target); } final IAdminCommandHandler ach = AdminCommandHandler.getInstance().getHandler("admin_summon_info"); - if (ach != null) - { + if (ach != null) { ach.useAdminCommand("admin_summon_info", activeChar); } } @@ -48,8 +43,7 @@ public class L2SummonActionShift implements IActionShiftHandler } @Override - public InstanceType getInstanceType() - { + public InstanceType getInstanceType() { return InstanceType.L2Summon; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminAdmin.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminAdmin.java index bc0315c1f8..94368415ff 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminAdmin.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminAdmin.java @@ -40,12 +40,10 @@ import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; * tradeoff = toggles trade acceptance mode - reload = reloads specified component from multisell|skill|npc|htm|item - set/set_menu/set_mod = alters specified server setting - saveolymp = saves olympiad state manually - manualhero = cycles olympiad and calculate new heroes. * @version $Revision: 1.3.2.1.2.4 $ $Date: 2007/07/28 10:06:06 $ */ -public class AdminAdmin implements IAdminCommandHandler -{ +public class AdminAdmin implements IAdminCommandHandler { private static final Logger _log = Logger.getLogger(AdminAdmin.class.getName()); - private static final String[] ADMIN_COMMANDS = - { + private static final String[] ADMIN_COMMANDS = { "admin_admin", "admin_admin1", "admin_admin2", @@ -71,63 +69,41 @@ public class AdminAdmin implements IAdminCommandHandler }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.startsWith("admin_admin")) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.startsWith("admin_admin")) { showMainPage(activeChar, command); - } - else if (command.equals("admin_config_server")) - { + } else if (command.equals("admin_config_server")) { showConfigPage(activeChar); - } - else if (command.startsWith("admin_gmliston")) - { + } else if (command.startsWith("admin_gmliston")) { AdminData.getInstance().showGm(activeChar); activeChar.sendMessage("Registered into gm list"); AdminHtml.showAdminHtml(activeChar, "gm_menu.htm"); - } - else if (command.startsWith("admin_gmlistoff")) - { + } else if (command.startsWith("admin_gmlistoff")) { AdminData.getInstance().hideGm(activeChar); activeChar.sendMessage("Removed from gm list"); AdminHtml.showAdminHtml(activeChar, "gm_menu.htm"); - } - else if (command.startsWith("admin_silence")) - { + } else if (command.startsWith("admin_silence")) { if (activeChar.isSilenceMode()) // already in message refusal mode { activeChar.setSilenceMode(false); activeChar.sendPacket(SystemMessageId.MESSAGE_ACCEPTANCE_MODE); - } - else - { + } else { activeChar.setSilenceMode(true); activeChar.sendPacket(SystemMessageId.MESSAGE_REFUSAL_MODE); } AdminHtml.showAdminHtml(activeChar, "gm_menu.htm"); - } - else if (command.startsWith("admin_saveolymp")) - { + } else if (command.startsWith("admin_saveolymp")) { Olympiad.getInstance().saveOlympiadStatus(); activeChar.sendMessage("olympiad system saved."); - } - else if (command.startsWith("admin_endolympiad")) - { - try - { + } else if (command.startsWith("admin_endolympiad")) { + try { Olympiad.getInstance().manualSelectHeroes(); - } - catch (Exception e) - { + } catch (Exception e) { _log.warning("An error occured while ending olympiad: " + e); } activeChar.sendMessage("Heroes formed."); - } - else if (command.startsWith("admin_sethero")) - { - if (activeChar.getTarget() == null) - { + } else if (command.startsWith("admin_sethero")) { + if (activeChar.getTarget() == null) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return false; } @@ -135,97 +111,67 @@ public class AdminAdmin implements IAdminCommandHandler final L2PcInstance target = activeChar.getTarget().isPlayer() ? activeChar.getTarget().getActingPlayer() : activeChar; target.setHero(!target.isHero()); target.broadcastUserInfo(); - } - else if (command.startsWith("admin_givehero")) - { - if (activeChar.getTarget() == null) - { + } else if (command.startsWith("admin_givehero")) { + if (activeChar.getTarget() == null) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return false; } final L2PcInstance target = activeChar.getTarget().isPlayer() ? activeChar.getTarget().getActingPlayer() : activeChar; - if (Hero.getInstance().isHero(target.getObjectId())) - { + if (Hero.getInstance().isHero(target.getObjectId())) { activeChar.sendMessage("This player has already claimed the hero status."); return false; } - if (!Hero.getInstance().isUnclaimedHero(target.getObjectId())) - { + if (!Hero.getInstance().isUnclaimedHero(target.getObjectId())) { activeChar.sendMessage("This player cannot claim the hero status."); return false; } Hero.getInstance().claimHero(target); - } - else if (command.startsWith("admin_diet")) - { - try - { + } else if (command.startsWith("admin_diet")) { + try { StringTokenizer st = new StringTokenizer(command); st.nextToken(); - if (st.nextToken().equalsIgnoreCase("on")) - { + if (st.nextToken().equalsIgnoreCase("on")) { activeChar.setDietMode(true); activeChar.sendMessage("Diet mode on"); - } - else if (st.nextToken().equalsIgnoreCase("off")) - { + } else if (st.nextToken().equalsIgnoreCase("off")) { activeChar.setDietMode(false); activeChar.sendMessage("Diet mode off"); } - } - catch (Exception ex) - { - if (activeChar.getDietMode()) - { + } catch (Exception ex) { + if (activeChar.getDietMode()) { activeChar.setDietMode(false); activeChar.sendMessage("Diet mode off"); - } - else - { + } else { activeChar.setDietMode(true); activeChar.sendMessage("Diet mode on"); } - } - finally - { + } finally { activeChar.refreshOverloaded(); } AdminHtml.showAdminHtml(activeChar, "gm_menu.htm"); - } - else if (command.startsWith("admin_tradeoff")) - { - try - { + } else if (command.startsWith("admin_tradeoff")) { + try { String mode = command.substring(15); - if (mode.equalsIgnoreCase("on")) - { + if (mode.equalsIgnoreCase("on")) { activeChar.setTradeRefusal(true); activeChar.sendMessage("Trade refusal enabled"); - } - else if (mode.equalsIgnoreCase("off")) - { + } else if (mode.equalsIgnoreCase("off")) { activeChar.setTradeRefusal(false); activeChar.sendMessage("Trade refusal disabled"); } - } - catch (Exception ex) - { - if (activeChar.getTradeRefusal()) - { + } catch (Exception ex) { + if (activeChar.getTradeRefusal()) { activeChar.setTradeRefusal(false); activeChar.sendMessage("Trade refusal disabled"); - } - else - { + } else { activeChar.setTradeRefusal(true); activeChar.sendMessage("Trade refusal enabled"); } } AdminHtml.showAdminHtml(activeChar, "gm_menu.htm"); - } - else if (command.startsWith("admin_set")) { + } else if (command.startsWith("admin_set")) { StringTokenizer st = new StringTokenizer(command); st.nextToken(); try { @@ -247,33 +193,25 @@ public class AdminAdmin implements IAdminCommandHandler } finally { showConfigPage(activeChar); } - } - else if (command.startsWith("admin_gmon")) - { + } else if (command.startsWith("admin_gmon")) { // nothing } return true; } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } - private void showMainPage(L2PcInstance activeChar, String command) - { + private void showMainPage(L2PcInstance activeChar, String command) { int mode = 0; String filename = null; - try - { + try { mode = Integer.parseInt(command.substring(11)); + } catch (Exception e) { } - catch (Exception e) - { - } - switch (mode) - { + switch (mode) { case 1: filename = "main"; break; @@ -302,22 +240,28 @@ public class AdminAdmin implements IAdminCommandHandler AdminHtml.showAdminHtml(activeChar, filename + "_menu.htm"); } - public void showConfigPage(L2PcInstance activeChar) - { + public void showConfigPage(L2PcInstance activeChar) { final NpcHtmlMessage adminReply = new NpcHtmlMessage(); StringBuilder replyMSG = new StringBuilder("<html><title>L2J :: Config</title><body>"); replyMSG.append("<center><table width=270><tr><td width=60><button value=\"Main\" action=\"bypass -h admin_admin\" width=60 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td width=150>Config Server Panel</td><td width=60><button value=\"Back\" action=\"bypass -h admin_admin4\" width=60 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table></center><br>"); replyMSG.append("<center><table width=260><tr><td width=140></td><td width=40></td><td width=40></td></tr>"); replyMSG.append("<tr><td><font color=\"00AA00\">Drop:</font></td><td></td><td></td></tr>"); - replyMSG.append("<tr><td><font color=\"LEVEL\">Rate EXP</font> = " + rates().getRateXp() + "</td><td><edit var=\"param1\" width=40 height=15></td><td><button value=\"Set\" action=\"bypass -h admin_setconfig RateXp $param1\" width=40 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"); - replyMSG.append("<tr><td><font color=\"LEVEL\">Rate SP</font> = " + rates().getRateSp() + "</td><td><edit var=\"param2\" width=40 height=15></td><td><button value=\"Set\" action=\"bypass -h admin_setconfig RateSp $param2\" width=40 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"); - replyMSG.append("<tr><td><font color=\"LEVEL\">Rate Drop Spoil</font> = " + rates().getCorpseDropChanceMultiplier() + "</td><td><edit var=\"param4\" width=40 height=15></td><td><button value=\"Set\" action=\"bypass -h admin_setconfig RateDropSpoil $param4\" width=40 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"); + replyMSG.append("<tr><td><font color=\"LEVEL\">Rate EXP</font> = " + rates().getRateXp() + + "</td><td><edit var=\"param1\" width=40 height=15></td><td><button value=\"Set\" action=\"bypass -h admin_setconfig RateXp $param1\" width=40 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"); + replyMSG.append("<tr><td><font color=\"LEVEL\">Rate SP</font> = " + rates().getRateSp() + + "</td><td><edit var=\"param2\" width=40 height=15></td><td><button value=\"Set\" action=\"bypass -h admin_setconfig RateSp $param2\" width=40 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"); + replyMSG.append("<tr><td><font color=\"LEVEL\">Rate Drop Spoil</font> = " + rates().getCorpseDropChanceMultiplier() + + "</td><td><edit var=\"param4\" width=40 height=15></td><td><button value=\"Set\" action=\"bypass -h admin_setconfig RateDropSpoil $param4\" width=40 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"); replyMSG.append("<tr><td width=140></td><td width=40></td><td width=40></td></tr>"); replyMSG.append("<tr><td><font color=\"00AA00\">Enchant:</font></td><td></td><td></td></tr>"); - replyMSG.append("<tr><td><font color=\"LEVEL\">Enchant Element Stone</font> = " + character().getEnchantChanceElementStone() + "</td><td><edit var=\"param8\" width=40 height=15></td><td><button value=\"Set\" action=\"bypass -h admin_setconfig EnchantChanceElementStone $param8\" width=40 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"); - replyMSG.append("<tr><td><font color=\"LEVEL\">Enchant Element Crystal</font> = " + character().getEnchantChanceElementCrystal() + "</td><td><edit var=\"param9\" width=40 height=15></td><td><button value=\"Set\" action=\"bypass -h admin_setconfig EnchantChanceElementCrystal $param9\" width=40 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"); - replyMSG.append("<tr><td><font color=\"LEVEL\">Enchant Element Jewel</font> = " + character().getEnchantChanceElementJewel() + "</td><td><edit var=\"param10\" width=40 height=15></td><td><button value=\"Set\" action=\"bypass -h admin_setconfig EnchantChanceElementJewel $param10\" width=40 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"); - replyMSG.append("<tr><td><font color=\"LEVEL\">Enchant Element Energy</font> = " + character().getEnchantChanceElementEnergy() + "</td><td><edit var=\"param11\" width=40 height=15></td><td><button value=\"Set\" action=\"bypass -h admin_setconfig EnchantChanceElementEnergy $param11\" width=40 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"); + replyMSG.append("<tr><td><font color=\"LEVEL\">Enchant Element Stone</font> = " + character().getEnchantChanceElementStone() + + "</td><td><edit var=\"param8\" width=40 height=15></td><td><button value=\"Set\" action=\"bypass -h admin_setconfig EnchantChanceElementStone $param8\" width=40 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"); + replyMSG.append("<tr><td><font color=\"LEVEL\">Enchant Element Crystal</font> = " + character().getEnchantChanceElementCrystal() + + "</td><td><edit var=\"param9\" width=40 height=15></td><td><button value=\"Set\" action=\"bypass -h admin_setconfig EnchantChanceElementCrystal $param9\" width=40 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"); + replyMSG.append("<tr><td><font color=\"LEVEL\">Enchant Element Jewel</font> = " + character().getEnchantChanceElementJewel() + + "</td><td><edit var=\"param10\" width=40 height=15></td><td><button value=\"Set\" action=\"bypass -h admin_setconfig EnchantChanceElementJewel $param10\" width=40 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"); + replyMSG.append("<tr><td><font color=\"LEVEL\">Enchant Element Energy</font> = " + character().getEnchantChanceElementEnergy() + + "</td><td><edit var=\"param11\" width=40 height=15></td><td><button value=\"Set\" action=\"bypass -h admin_setconfig EnchantChanceElementEnergy $param11\" width=40 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"); replyMSG.append("</table></body></html>"); adminReply.setHtml(replyMSG.toString()); diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminAnnouncements.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminAnnouncements.java index fe0f7c844b..34174e4167 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminAnnouncements.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminAnnouncements.java @@ -38,10 +38,8 @@ import com.l2jserver.gameserver.util.Util; /** * @author UnAfraid */ -public class AdminAnnouncements implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminAnnouncements implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_announce", "admin_announce_crit", "admin_announce_screen", @@ -49,34 +47,25 @@ public class AdminAnnouncements implements IAdminCommandHandler }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { final StringTokenizer st = new StringTokenizer(command); final String cmd = st.hasMoreTokens() ? st.nextToken() : ""; - switch (cmd) - { + switch (cmd) { case "admin_announce": case "admin_announce_crit": - case "admin_announce_screen": - { - if (!st.hasMoreTokens()) - { + case "admin_announce_screen": { + if (!st.hasMoreTokens()) { activeChar.sendMessage("Syntax: //announce <text to announce here>"); return false; } String announce = st.nextToken(); - while (st.hasMoreTokens()) - { + while (st.hasMoreTokens()) { announce += " " + st.nextToken(); } - if (cmd.equals("admin_announce_screen")) - { + if (cmd.equals("admin_announce_screen")) { Broadcast.toAllOnlinePlayersOnScreen(announce); - } - else - { - if (general().gmShowAnnouncerName()) - { + } else { + if (general().gmShowAnnouncerName()) { announce = announce + " [" + activeChar.getName() + "]"; } Broadcast.toAllOnlinePlayers(announce, cmd.equals("admin_announce_crit")); @@ -84,15 +73,11 @@ public class AdminAnnouncements implements IAdminCommandHandler AdminHtml.showAdminHtml(activeChar, "gm_menu.htm"); break; } - case "admin_announces": - { + case "admin_announces": { final String subCmd = st.hasMoreTokens() ? st.nextToken() : ""; - switch (subCmd) - { - case "add": - { - if (!st.hasMoreTokens()) - { + switch (subCmd) { + case "add": { + if (!st.hasMoreTokens()) { String content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/admin/announces-add.htm"); Util.sendCBHtml(activeChar, content); break; @@ -100,100 +85,82 @@ public class AdminAnnouncements implements IAdminCommandHandler final String annType = st.nextToken(); final AnnouncementType type = AnnouncementType.findByName(annType); // ************************************ - if (!st.hasMoreTokens()) - { + if (!st.hasMoreTokens()) { activeChar.sendMessage("Syntax: //announces add <type> <delay> <repeat> <text>"); break; } String annInitDelay = st.nextToken(); - if (!Util.isDigit(annInitDelay)) - { + if (!Util.isDigit(annInitDelay)) { activeChar.sendMessage("Syntax: //announces add <type> <delay> <repeat> <text>"); break; } int initDelay = Integer.parseInt(annInitDelay) * 1000; // ************************************ - if (!st.hasMoreTokens()) - { + if (!st.hasMoreTokens()) { activeChar.sendMessage("Syntax: //announces add <type> <delay> <repeat> <text>"); break; } String annDelay = st.nextToken(); - if (!Util.isDigit(annDelay)) - { + if (!Util.isDigit(annDelay)) { activeChar.sendMessage("Syntax: //announces add <type> <delay> <repeat> <text>"); break; } int delay = Integer.parseInt(annDelay) * 1000; - if ((delay < (10 * 1000)) && ((type == AnnouncementType.AUTO_NORMAL) || (type == AnnouncementType.AUTO_CRITICAL))) - { + if ((delay < (10 * 1000)) && ((type == AnnouncementType.AUTO_NORMAL) || (type == AnnouncementType.AUTO_CRITICAL))) { activeChar.sendMessage("Delay cannot be less then 10 seconds!"); break; } // ************************************ - if (!st.hasMoreTokens()) - { + if (!st.hasMoreTokens()) { activeChar.sendMessage("Syntax: //announces add <type> <delay> <repeat> <text>"); break; } String annRepeat = st.nextToken(); - if (!Util.isDigit(annRepeat)) - { + if (!Util.isDigit(annRepeat)) { activeChar.sendMessage("Syntax: //announces add <type> <delay> <repeat> <text>"); break; } int repeat = Integer.parseInt(annRepeat); - if (repeat == 0) - { + if (repeat == 0) { repeat = -1; } // ************************************ - if (!st.hasMoreTokens()) - { + if (!st.hasMoreTokens()) { activeChar.sendMessage("Syntax: //announces add <type> <delay> <repeat> <text>"); break; } String content = st.nextToken(); - while (st.hasMoreTokens()) - { + while (st.hasMoreTokens()) { content += " " + st.nextToken(); } // ************************************ final IAnnouncement announce; - if ((type == AnnouncementType.AUTO_CRITICAL) || (type == AnnouncementType.AUTO_NORMAL)) - { + if ((type == AnnouncementType.AUTO_CRITICAL) || (type == AnnouncementType.AUTO_NORMAL)) { announce = new AutoAnnouncement(type, content, activeChar.getName(), initDelay, delay, repeat); - } - else - { + } else { announce = new Announcement(type, content, activeChar.getName()); } AnnouncementsTable.getInstance().addAnnouncement(announce); activeChar.sendMessage("Announcement has been successfully added!"); return useAdminCommand("admin_announces list", activeChar); } - case "edit": - { - if (!st.hasMoreTokens()) - { + case "edit": { + if (!st.hasMoreTokens()) { activeChar.sendMessage("Syntax: //announces edit <id>"); break; } String annId = st.nextToken(); - if (!Util.isDigit(annId)) - { + if (!Util.isDigit(annId)) { activeChar.sendMessage("Syntax: //announces edit <id>"); break; } int id = Integer.parseInt(annId); final IAnnouncement announce = AnnouncementsTable.getInstance().getAnnounce(id); - if (announce == null) - { + if (announce == null) { activeChar.sendMessage("Announcement doesnt exists!"); break; } - if (!st.hasMoreTokens()) - { + if (!st.hasMoreTokens()) { String content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/admin/announces-edit.htm"); String announcementId = "" + announce.getId(); String announcementType = announce.getType().name(); @@ -202,8 +169,7 @@ public class AdminAnnouncements implements IAdminCommandHandler String announcementRepeat = "0"; String announcementAuthor = announce.getAuthor(); String announcementContent = announce.getContent(); - if (announce instanceof AutoAnnouncement) - { + if (announce instanceof AutoAnnouncement) { final AutoAnnouncement autoAnnounce = (AutoAnnouncement) announce; announcementInital = "" + (autoAnnounce.getInitial() / 1000); announcementDelay = "" + (autoAnnounce.getDelay() / 1000); @@ -221,20 +187,15 @@ public class AdminAnnouncements implements IAdminCommandHandler } final String annType = st.nextToken(); final AnnouncementType type = AnnouncementType.findByName(annType); - switch (announce.getType()) - { + switch (announce.getType()) { case AUTO_CRITICAL: - case AUTO_NORMAL: - { - switch (type) - { + case AUTO_NORMAL: { + switch (type) { case AUTO_CRITICAL: - case AUTO_NORMAL: - { + case AUTO_NORMAL: { break; } - default: - { + default: { activeChar.sendMessage("Announce type can be changed only to AUTO_NORMAL or AUTO_CRITICAL!"); return false; } @@ -242,17 +203,13 @@ public class AdminAnnouncements implements IAdminCommandHandler break; } case NORMAL: - case CRITICAL: - { - switch (type) - { + case CRITICAL: { + switch (type) { case NORMAL: - case CRITICAL: - { + case CRITICAL: { break; } - default: - { + default: { activeChar.sendMessage("Announce type can be changed only to NORMAL or CRITICAL!"); return false; } @@ -261,73 +218,61 @@ public class AdminAnnouncements implements IAdminCommandHandler } } // ************************************ - if (!st.hasMoreTokens()) - { + if (!st.hasMoreTokens()) { activeChar.sendMessage("Syntax: //announces add <type> <delay> <repeat> <text>"); break; } String annInitDelay = st.nextToken(); - if (!Util.isDigit(annInitDelay)) - { + if (!Util.isDigit(annInitDelay)) { activeChar.sendMessage("Syntax: //announces add <type> <delay> <repeat> <text>"); break; } int initDelay = Integer.parseInt(annInitDelay); // ************************************ - if (!st.hasMoreTokens()) - { + if (!st.hasMoreTokens()) { activeChar.sendMessage("Syntax: //announces add <type> <delay> <repeat> <text>"); break; } String annDelay = st.nextToken(); - if (!Util.isDigit(annDelay)) - { + if (!Util.isDigit(annDelay)) { activeChar.sendMessage("Syntax: //announces add <type> <delay> <repeat> <text>"); break; } int delay = Integer.parseInt(annDelay); - if ((delay < 10) && ((type == AnnouncementType.AUTO_NORMAL) || (type == AnnouncementType.AUTO_CRITICAL))) - { + if ((delay < 10) && ((type == AnnouncementType.AUTO_NORMAL) || (type == AnnouncementType.AUTO_CRITICAL))) { activeChar.sendMessage("Delay cannot be less then 10 seconds!"); break; } // ************************************ - if (!st.hasMoreTokens()) - { + if (!st.hasMoreTokens()) { activeChar.sendMessage("Syntax: //announces add <type> <delay> <repeat> <text>"); break; } String annRepeat = st.nextToken(); - if (!Util.isDigit(annRepeat)) - { + if (!Util.isDigit(annRepeat)) { activeChar.sendMessage("Syntax: //announces add <type> <delay> <repeat> <text>"); break; } int repeat = Integer.parseInt(annRepeat); - if (repeat == 0) - { + if (repeat == 0) { repeat = -1; } // ************************************ String content = ""; - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { content = st.nextToken(); - while (st.hasMoreTokens()) - { + while (st.hasMoreTokens()) { content += " " + st.nextToken(); } } - if (content.isEmpty()) - { + if (content.isEmpty()) { content = announce.getContent(); } // ************************************ announce.setType(type); announce.setContent(content); announce.setAuthor(activeChar.getName()); - if (announce instanceof AutoAnnouncement) - { + if (announce instanceof AutoAnnouncement) { AutoAnnouncement autoAnnounce = (AutoAnnouncement) announce; autoAnnounce.setInitial(initDelay * 1000); autoAnnounce.setDelay(delay * 1000); @@ -337,38 +282,28 @@ public class AdminAnnouncements implements IAdminCommandHandler activeChar.sendMessage("Announcement has been successfully edited!"); return useAdminCommand("admin_announces list", activeChar); } - case "remove": - { - if (!st.hasMoreTokens()) - { + case "remove": { + if (!st.hasMoreTokens()) { activeChar.sendMessage("Syntax: //announces remove <announcement id>"); break; } String token = st.nextToken(); - if (!Util.isDigit(token)) - { + if (!Util.isDigit(token)) { activeChar.sendMessage("Syntax: //announces remove <announcement id>"); break; } int id = Integer.parseInt(token); - if (AnnouncementsTable.getInstance().deleteAnnouncement(id)) - { + if (AnnouncementsTable.getInstance().deleteAnnouncement(id)) { activeChar.sendMessage("Announcement has been successfully removed!"); - } - else - { + } else { activeChar.sendMessage("Announcement doesnt exists!"); } return useAdminCommand("admin_announces list", activeChar); } - case "restart": - { - if (!st.hasMoreTokens()) - { - for (IAnnouncement announce : AnnouncementsTable.getInstance().getAllAnnouncements()) - { - if (announce instanceof AutoAnnouncement) - { + case "restart": { + if (!st.hasMoreTokens()) { + for (IAnnouncement announce : AnnouncementsTable.getInstance().getAllAnnouncements()) { + if (announce instanceof AutoAnnouncement) { final AutoAnnouncement autoAnnounce = (AutoAnnouncement) announce; autoAnnounce.restartMe(); } @@ -377,49 +312,38 @@ public class AdminAnnouncements implements IAdminCommandHandler break; } String token = st.nextToken(); - if (!Util.isDigit(token)) - { + if (!Util.isDigit(token)) { activeChar.sendMessage("Syntax: //announces show <announcement id>"); break; } int id = Integer.parseInt(token); final IAnnouncement announce = AnnouncementsTable.getInstance().getAnnounce(id); - if (announce != null) - { - if (announce instanceof AutoAnnouncement) - { + if (announce != null) { + if (announce instanceof AutoAnnouncement) { final AutoAnnouncement autoAnnounce = (AutoAnnouncement) announce; autoAnnounce.restartMe(); activeChar.sendMessage("Auto announcement has been successfully restarted"); - } - else - { + } else { activeChar.sendMessage("This option has effect only on auto announcements!"); } - } - else - { + } else { activeChar.sendMessage("Announcement doesnt exists!"); } break; } - case "show": - { - if (!st.hasMoreTokens()) - { + case "show": { + if (!st.hasMoreTokens()) { activeChar.sendMessage("Syntax: //announces show <announcement id>"); break; } String token = st.nextToken(); - if (!Util.isDigit(token)) - { + if (!Util.isDigit(token)) { activeChar.sendMessage("Syntax: //announces show <announcement id>"); break; } int id = Integer.parseInt(token); final IAnnouncement announce = AnnouncementsTable.getInstance().getAnnounce(id); - if (announce != null) - { + if (announce != null) { String content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/admin/announces-show.htm"); String announcementId = "" + announce.getId(); String announcementType = announce.getType().name(); @@ -428,8 +352,7 @@ public class AdminAnnouncements implements IAdminCommandHandler String announcementRepeat = "0"; String announcementAuthor = announce.getAuthor(); String announcementContent = announce.getContent(); - if (announce instanceof AutoAnnouncement) - { + if (announce instanceof AutoAnnouncement) { final AutoAnnouncement autoAnnounce = (AutoAnnouncement) announce; announcementInital = "" + (autoAnnounce.getInitial() / 1000); announcementDelay = "" + (autoAnnounce.getDelay() / 1000); @@ -448,45 +371,34 @@ public class AdminAnnouncements implements IAdminCommandHandler activeChar.sendMessage("Announcement doesnt exists!"); return useAdminCommand("admin_announces list", activeChar); } - case "list": - { + case "list": { int page = 0; - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { final String token = st.nextToken(); - if (Util.isDigit(token)) - { + if (Util.isDigit(token)) { page = Integer.valueOf(token); } } String content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/admin/announces-list.htm"); - final PageResult result = HtmlUtil.createPage(AnnouncementsTable.getInstance().getAllAnnouncements(), page, 8, currentPage -> - { + final PageResult result = HtmlUtil.createPage(AnnouncementsTable.getInstance().getAllAnnouncements(), page, 8, currentPage -> { return "<td align=center><button action=\"bypass admin_announces list " + currentPage + "\" value=\"" + (currentPage + 1) + "\" width=35 height=20 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"></td>"; - }, announcement -> - { + }, announcement -> { final StringBuilder sb = new StringBuilder(); sb.append("<tr>"); sb.append("<td width=5></td>"); sb.append("<td width=80>" + announcement.getId() + "</td>"); sb.append("<td width=100>" + announcement.getType() + "</td>"); sb.append("<td width=100>" + announcement.getAuthor() + "</td>"); - if ((announcement.getType() == AnnouncementType.AUTO_NORMAL) || (announcement.getType() == AnnouncementType.AUTO_CRITICAL)) - { + if ((announcement.getType() == AnnouncementType.AUTO_NORMAL) || (announcement.getType() == AnnouncementType.AUTO_CRITICAL)) { sb.append("<td width=60><button action=\"bypass -h admin_announces restart " + announcement.getId() + "\" value=\"Restart\" width=\"60\" height=\"21\" back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"></td>"); - } - else - { + } else { sb.append("<td width=60><button action=\"\" value=\"\" width=\"60\" height=\"21\" back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"></td>"); } - if (announcement.getType() == AnnouncementType.EVENT) - { + if (announcement.getType() == AnnouncementType.EVENT) { sb.append("<td width=60><button action=\"bypass -h admin_announces show " + announcement.getId() + "\" value=\"Show\" width=\"60\" height=\"21\" back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"></td>"); sb.append("<td width=60></td>"); - } - else - { + } else { sb.append("<td width=60><button action=\"bypass -h admin_announces show " + announcement.getId() + "\" value=\"Show\" width=\"60\" height=\"21\" back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"></td>"); sb.append("<td width=60><button action=\"bypass -h admin_announces edit " + announcement.getId() + "\" value=\"Edit\" width=\"60\" height=\"21\" back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"></td>"); } @@ -507,8 +419,7 @@ public class AdminAnnouncements implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminBBS.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminBBS.java index 68b2bb8e94..19a7171aaa 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminBBS.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminBBS.java @@ -21,22 +21,18 @@ package com.l2jserver.datapack.handlers.admincommandhandlers; import com.l2jserver.gameserver.handler.IAdminCommandHandler; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -public class AdminBBS implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminBBS implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_bbs" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { return true; } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminBuffs.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminBuffs.java index 220fcc8c15..2c0d7b4382 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminBuffs.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminBuffs.java @@ -41,12 +41,10 @@ import com.l2jserver.gameserver.network.serverpackets.SkillCoolTime; import com.l2jserver.gameserver.util.GMAudit; import com.l2jserver.gameserver.util.StringUtil; -public class AdminBuffs implements IAdminCommandHandler -{ +public class AdminBuffs implements IAdminCommandHandler { private final static int PAGE_LIMIT = 20; - private static final String[] ADMIN_COMMANDS = - { + private static final String[] ADMIN_COMMANDS = { "admin_getbuffs", "admin_getbuffs_ps", "admin_stopbuff", @@ -60,21 +58,16 @@ public class AdminBuffs implements IAdminCommandHandler private static final String FONT_RED2 = "</font>"; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.startsWith("admin_getbuffs")) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.startsWith("admin_getbuffs")) { final StringTokenizer st = new StringTokenizer(command, " "); command = st.nextToken(); - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { final String playername = st.nextToken(); L2PcInstance player = L2World.getInstance().getPlayer(playername); - if (player != null) - { + if (player != null) { int page = 1; - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { page = Integer.parseInt(st.nextToken()); } showBuffs(activeChar, player, page, command.endsWith("_ps")); @@ -82,22 +75,15 @@ public class AdminBuffs implements IAdminCommandHandler } activeChar.sendMessage("The player " + playername + " is not online."); return false; - } - else if ((activeChar.getTarget() != null) && activeChar.getTarget().isCharacter()) - { + } else if ((activeChar.getTarget() != null) && activeChar.getTarget().isCharacter()) { showBuffs(activeChar, (L2Character) activeChar.getTarget(), 1, command.endsWith("_ps")); return true; - } - else - { + } else { activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT); return false; } - } - else if (command.startsWith("admin_stopbuff")) - { - try - { + } else if (command.startsWith("admin_stopbuff")) { + try { StringTokenizer st = new StringTokenizer(command, " "); st.nextToken(); @@ -106,82 +92,60 @@ public class AdminBuffs implements IAdminCommandHandler removeBuff(activeChar, objectId, skillId); return true; - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Failed removing effect: " + e.getMessage()); activeChar.sendMessage("Usage: //stopbuff <objectId> <skillId>"); return false; } - } - else if (command.startsWith("admin_stopallbuffs")) - { - try - { + } else if (command.startsWith("admin_stopallbuffs")) { + try { StringTokenizer st = new StringTokenizer(command, " "); st.nextToken(); int objectId = Integer.parseInt(st.nextToken()); removeAllBuffs(activeChar, objectId); return true; - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Failed removing all effects: " + e.getMessage()); activeChar.sendMessage("Usage: //stopallbuffs <objectId>"); return false; } - } - else if (command.startsWith("admin_areacancel")) - { + } else if (command.startsWith("admin_areacancel")) { StringTokenizer st = new StringTokenizer(command, " "); st.nextToken(); String val = st.nextToken(); - try - { + try { int radius = Integer.parseInt(val); - for (L2Character knownChar : activeChar.getKnownList().getKnownCharactersInRadius(radius)) - { - if (knownChar.isPlayer() && !knownChar.equals(activeChar)) - { + for (L2Character knownChar : activeChar.getKnownList().getKnownCharactersInRadius(radius)) { + if (knownChar.isPlayer() && !knownChar.equals(activeChar)) { knownChar.stopAllEffects(); } } activeChar.sendMessage("All effects canceled within radius " + radius); return true; - } - catch (NumberFormatException e) - { + } catch (NumberFormatException e) { activeChar.sendMessage("Usage: //areacancel <radius>"); return false; } - } - else if (command.startsWith("admin_removereuse")) - { + } else if (command.startsWith("admin_removereuse")) { StringTokenizer st = new StringTokenizer(command, " "); command = st.nextToken(); L2Character creature = null; - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { creature = L2World.getInstance().getPlayer(st.nextToken()); - if (creature == null) - { + if (creature == null) { activeChar.sendPacket(SystemMessageId.TARGET_IS_NOT_FOUND_IN_THE_GAME); return false; } - } - else - { + } else { final L2Object target = activeChar.getTarget(); - if ((target != null) && target.isCharacter()) - { + if ((target != null) && target.isCharacter()) { creature = (L2Character) target; } - if (creature == null) - { + if (creature == null) { activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT); return false; } @@ -189,17 +153,13 @@ public class AdminBuffs implements IAdminCommandHandler creature.resetTimeStamps(); creature.resetDisabledSkills(); - if (creature.isPlayer()) - { + if (creature.isPlayer()) { creature.sendPacket(new SkillCoolTime(creature.getActingPlayer())); } activeChar.sendMessage("Skill reuse was removed from " + creature.getName() + "."); return true; - } - else if (command.startsWith("admin_switch_gm_buffs")) - { - if (general().gmGiveSpecialSkills() != general().gmGiveSpecialAuraSkills()) - { + } else if (command.startsWith("admin_switch_gm_buffs")) { + if (general().gmGiveSpecialSkills() != general().gmGiveSpecialAuraSkills()) { final boolean toAuraSkills = activeChar.getKnownSkill(7041) != null; switchSkills(activeChar, toAuraSkills); activeChar.sendSkillList(); @@ -216,42 +176,33 @@ public class AdminBuffs implements IAdminCommandHandler * @param gmchar the player to switch the Game Master skills. * @param toAuraSkills if {@code true} it will remove "GM Aura" skills and add "GM regular" skills, vice versa if {@code false}. */ - public static void switchSkills(L2PcInstance gmchar, boolean toAuraSkills) - { + public static void switchSkills(L2PcInstance gmchar, boolean toAuraSkills) { final Collection<Skill> skills = toAuraSkills ? SkillTreesData.getInstance().getGMSkillTree().values() : SkillTreesData.getInstance().getGMAuraSkillTree().values(); - for (Skill skill : skills) - { + for (Skill skill : skills) { gmchar.removeSkill(skill, false); // Don't Save GM skills to database } SkillTreesData.getInstance().addSkills(gmchar, toAuraSkills); } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } - public static void showBuffs(L2PcInstance activeChar, L2Character target, int page, boolean passive) - { + public static void showBuffs(L2PcInstance activeChar, L2Character target, int page, boolean passive) { final List<BuffInfo> effects = new ArrayList<>(); - if (!passive) - { + if (!passive) { effects.addAll(target.getEffectList().getEffects()); - } - else - { + } else { effects.addAll(target.getEffectList().getPassives()); } - if ((page > ((effects.size() / PAGE_LIMIT) + 1)) || (page < 1)) - { + if ((page > ((effects.size() / PAGE_LIMIT) + 1)) || (page < 1)) { return; } int max = effects.size() / PAGE_LIMIT; - if (effects.size() > (PAGE_LIMIT * max)) - { + if (effects.size() > (PAGE_LIMIT * max)) { max++; } @@ -260,13 +211,10 @@ public class AdminBuffs implements IAdminCommandHandler int start = ((page - 1) * PAGE_LIMIT); int end = Math.min(((page - 1) * PAGE_LIMIT) + PAGE_LIMIT, effects.size()); int count = 0; - for (BuffInfo info : effects) - { - if ((count >= start) && (count < end)) - { + for (BuffInfo info : effects) { + if ((count >= start) && (count < end)) { final Skill skill = info.getSkill(); - for (AbstractEffect effect : info.getEffects()) - { + for (AbstractEffect effect : info.getEffects()) { StringUtil.append(html, "<tr><td>", (!info.isInUse() ? FONT_RED1 : "") + skill.getName(), " Lv ", String.valueOf(skill.getLevel()), " (", effect.getClass().getSimpleName(), ")" + (!info.isInUse() ? FONT_RED2 : ""), "</td><td>", skill.isToggle() ? "T (" + info.getTickCount(effect) + ")" : skill.isPassive() ? "P" : info.getTime() + "s", "</td><td><button value=\"X\" action=\"bypass -h admin_stopbuff ", Integer.toString(target.getObjectId()), " ", String.valueOf(skill.getId()), "\" width=30 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"); @@ -276,17 +224,13 @@ public class AdminBuffs implements IAdminCommandHandler } html.append("</table><table width=300 bgcolor=444444><tr>"); - for (int x = 0; x < max; x++) - { + for (int x = 0; x < max; x++) { int pagenr = x + 1; - if (page == pagenr) - { + if (page == pagenr) { html.append("<td>Page "); html.append(pagenr); html.append("</td>"); - } - else - { + } else { html.append("<td><a action=\"bypass -h admin_getbuffs" + (passive ? "_ps " : " ")); html.append(target.getName()); html.append(" "); @@ -303,22 +247,18 @@ public class AdminBuffs implements IAdminCommandHandler StringUtil.append(html, "<br><center><button value=\"Refresh\" action=\"bypass -h admin_getbuffs", (passive ? "_ps " : " "), target.getName(), "\" width=80 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); StringUtil.append(html, "<button value=\"Remove All\" action=\"bypass -h admin_stopallbuffs ", Integer.toString(target.getObjectId()), "\" width=80 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><br>"); // Legend - if (!passive) - { + if (!passive) { StringUtil.append(html, FONT_RED1, "Inactive buffs: ", String.valueOf(target.getEffectList().getHiddenBuffsCount()), FONT_RED2, "<br>"); } StringUtil.append(html, "Total", passive ? " passive" : "", " buff count: ", String.valueOf(effects.size())); - if ((target.getEffectList().getAllBlockedBuffSlots() != null) && !target.getEffectList().getAllBlockedBuffSlots().isEmpty()) - { + if ((target.getEffectList().getAllBlockedBuffSlots() != null) && !target.getEffectList().getAllBlockedBuffSlots().isEmpty()) { StringUtil.append(html, "<br>Blocked buff slots: "); String slots = ""; - for (AbnormalType slot : target.getEffectList().getAllBlockedBuffSlots()) - { + for (AbnormalType slot : target.getEffectList().getAllBlockedBuffSlots()) { slots += slot.toString() + ", "; } - if (!slots.isEmpty() && (slots.length() > 3)) - { + if (!slots.isEmpty() && (slots.length() > 3)) { StringUtil.append(html, slots.substring(0, slots.length() - 2)); } } @@ -326,57 +266,43 @@ public class AdminBuffs implements IAdminCommandHandler // Send the packet activeChar.sendPacket(new NpcHtmlMessage(html.toString())); - if (general().gmAudit()) - { + if (general().gmAudit()) { GMAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", "getbuffs", target.getName() + " (" + Integer.toString(target.getObjectId()) + ")", ""); } } - private static void removeBuff(L2PcInstance activeChar, int objId, int skillId) - { + private static void removeBuff(L2PcInstance activeChar, int objId, int skillId) { L2Character target = null; - try - { + try { target = (L2Character) L2World.getInstance().findObject(objId); - } - catch (Exception e) - { + } catch (Exception e) { } - if ((target != null) && (skillId > 0)) - { - if (target.isAffectedBySkill(skillId)) - { + if ((target != null) && (skillId > 0)) { + if (target.isAffectedBySkill(skillId)) { target.stopSkillEffects(true, skillId); activeChar.sendMessage("Removed skill ID: " + skillId + " effects from " + target.getName() + " (" + objId + ")."); } showBuffs(activeChar, target, 1, false); - if (general().gmAudit()) - { + if (general().gmAudit()) { GMAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", "stopbuff", target.getName() + " (" + objId + ")", Integer.toString(skillId)); } } } - private static void removeAllBuffs(L2PcInstance activeChar, int objId) - { + private static void removeAllBuffs(L2PcInstance activeChar, int objId) { L2Character target = null; - try - { + try { target = (L2Character) L2World.getInstance().findObject(objId); - } - catch (Exception e) - { + } catch (Exception e) { } - if (target != null) - { + if (target != null) { target.stopAllEffects(); activeChar.sendMessage("Removed all effects from " + target.getName() + " (" + objId + ")"); showBuffs(activeChar, target, 1, false); - if (general().gmAudit()) - { + if (general().gmAudit()) { GMAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", "stopallbuffs", target.getName() + " (" + objId + ")", ""); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminCHSiege.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminCHSiege.java index a73e553e86..e46e5074aa 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminCHSiege.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminCHSiege.java @@ -36,10 +36,8 @@ import com.l2jserver.gameserver.network.serverpackets.SiegeInfo; /** * @author BiggBoss */ -public final class AdminCHSiege implements IAdminCommandHandler -{ - private static final String[] COMMANDS = - { +public final class AdminCHSiege implements IAdminCommandHandler { + private static final String[] COMMANDS = { "admin_chsiege_siegablehall", "admin_chsiege_startSiege", "admin_chsiege_endsSiege", @@ -52,108 +50,74 @@ public final class AdminCHSiege implements IAdminCommandHandler }; @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return COMMANDS; } @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { final String[] split = command.split(" "); SiegableHall hall = null; - if (general().noQuests()) - { + if (general().noQuests()) { activeChar.sendMessage("AltDevNoQuests = true; Clan Hall Sieges are disabled!"); return false; } - if (split.length < 2) - { + if (split.length < 2) { activeChar.sendMessage("You have to specify the hall id at least"); return false; } - if ((hall = getHall(split[1], activeChar)) == null) - { + if ((hall = getHall(split[1], activeChar)) == null) { activeChar.sendMessage("Couldnt find he desired siegable hall (" + split[1] + ")"); return false; } - if (hall.getSiege() == null) - { + if (hall.getSiege() == null) { activeChar.sendMessage("The given hall dont have any attached siege!"); return false; } - if (split[0].equals(COMMANDS[1])) - { - if (hall.isInSiege()) - { + if (split[0].equals(COMMANDS[1])) { + if (hall.isInSiege()) { activeChar.sendMessage("The requested clan hall is alredy in siege!"); - } - else - { + } else { L2Clan owner = ClanTable.getInstance().getClan(hall.getOwnerId()); - if (owner != null) - { + if (owner != null) { hall.free(); owner.setHideoutId(0); hall.addAttacker(owner); } hall.getSiege().startSiege(); } - } - else if (split[0].equals(COMMANDS[2])) - { - if (!hall.isInSiege()) - { + } else if (split[0].equals(COMMANDS[2])) { + if (!hall.isInSiege()) { activeChar.sendMessage("The requested clan hall isnt in siege!"); - } - else - { + } else { hall.getSiege().endSiege(); } - } - else if (split[0].equals(COMMANDS[3])) - { - if (!hall.isRegistering()) - { + } else if (split[0].equals(COMMANDS[3])) { + if (!hall.isRegistering()) { activeChar.sendMessage("Cannot change siege date while hall is in siege"); - } - else if (split.length < 3) - { + } else if (split.length < 3) { activeChar.sendMessage("The date format is incorrect. Try again."); - } - else - { + } else { String[] rawDate = split[2].split(";"); - if (rawDate.length < 2) - { + if (rawDate.length < 2) { activeChar.sendMessage("You have to specify this format DD-MM-YYYY;HH:MM"); - } - else - { + } else { String[] day = rawDate[0].split("-"); String[] hour = rawDate[1].split(":"); - if ((day.length < 3) || (hour.length < 2)) - { + if ((day.length < 3) || (hour.length < 2)) { activeChar.sendMessage("Incomplete day, hour or both!"); - } - else - { + } else { int d = parseInt(day[0]); int month = parseInt(day[1]) - 1; int year = parseInt(day[2]); int h = parseInt(hour[0]); int min = parseInt(hour[1]); - if (((month == 2) && (d > 28)) || (d > 31) || (d <= 0) || (month <= 0) || (month > 12) || (year < Calendar.getInstance().get(Calendar.YEAR))) - { + if (((month == 2) && (d > 28)) || (d > 31) || (d <= 0) || (month <= 0) || (month > 12) || (year < Calendar.getInstance().get(Calendar.YEAR))) { activeChar.sendMessage("Wrong day/month/year gave!"); - } - else if ((h <= 0) || (h > 24) || (min < 0) || (min >= 60)) - { + } else if ((h <= 0) || (h > 24) || (min < 0) || (min >= 60)) { activeChar.sendMessage("Wrong hour/minutes gave!"); - } - else - { + } else { Calendar c = Calendar.getInstance(); c.set(Calendar.YEAR, year); c.set(Calendar.MONTH, month); @@ -162,15 +126,12 @@ public final class AdminCHSiege implements IAdminCommandHandler c.set(Calendar.MINUTE, min); c.set(Calendar.SECOND, 0); - if (c.getTimeInMillis() > System.currentTimeMillis()) - { + if (c.getTimeInMillis() > System.currentTimeMillis()) { activeChar.sendMessage(hall.getName() + " siege: " + c.getTime().toString()); hall.setNextSiegeDate(c.getTimeInMillis()); hall.getSiege().updateSiege(); hall.updateDb(); - } - else - { + } else { activeChar.sendMessage("The given time is in the past!"); } } @@ -178,134 +139,83 @@ public final class AdminCHSiege implements IAdminCommandHandler } } - } - else if (split[0].equals(COMMANDS[4])) - { - if (hall.isInSiege()) - { + } else if (split[0].equals(COMMANDS[4])) { + if (hall.isInSiege()) { activeChar.sendMessage("The clan hall is in siege, cannot add attackers now."); return false; } L2Clan attacker = null; - if (split.length < 3) - { + if (split.length < 3) { L2Object rawTarget = activeChar.getTarget(); L2PcInstance target = null; - if (rawTarget == null) - { + if (rawTarget == null) { activeChar.sendMessage("You must target a clan member of the attacker!"); - } - else if (!(rawTarget instanceof L2PcInstance)) - { + } else if (!(rawTarget instanceof L2PcInstance)) { activeChar.sendMessage("You must target a player with clan!"); - } - else if ((target = (L2PcInstance) rawTarget).getClan() == null) - { + } else if ((target = (L2PcInstance) rawTarget).getClan() == null) { activeChar.sendMessage("Your target does not have any clan!"); - } - else if (hall.getSiege().checkIsAttacker(target.getClan())) - { + } else if (hall.getSiege().checkIsAttacker(target.getClan())) { activeChar.sendMessage("Your target's clan is alredy participating!"); - } - else - { + } else { attacker = target.getClan(); } - } - else - { + } else { L2Clan rawClan = ClanTable.getInstance().getClanByName(split[2]); - if (rawClan == null) - { + if (rawClan == null) { activeChar.sendMessage("The given clan does not exist!"); - } - else if (hall.getSiege().checkIsAttacker(rawClan)) - { + } else if (hall.getSiege().checkIsAttacker(rawClan)) { activeChar.sendMessage("The given clan is alredy participating!"); - } - else - { + } else { attacker = rawClan; } } - if (attacker != null) - { + if (attacker != null) { hall.addAttacker(attacker); } - } - else if (split[0].equals(COMMANDS[5])) - { - if (hall.isInSiege()) - { + } else if (split[0].equals(COMMANDS[5])) { + if (hall.isInSiege()) { activeChar.sendMessage("The clan hall is in siege, cannot remove attackers now."); return false; } - if (split.length < 3) - { + if (split.length < 3) { L2Object rawTarget = activeChar.getTarget(); L2PcInstance target = null; - if (rawTarget == null) - { + if (rawTarget == null) { activeChar.sendMessage("You must target a clan member of the attacker!"); - } - else if (!(rawTarget instanceof L2PcInstance)) - { + } else if (!(rawTarget instanceof L2PcInstance)) { activeChar.sendMessage("You must target a player with clan!"); - } - else if ((target = (L2PcInstance) rawTarget).getClan() == null) - { + } else if ((target = (L2PcInstance) rawTarget).getClan() == null) { activeChar.sendMessage("Your target does not have any clan!"); - } - else if (!hall.getSiege().checkIsAttacker(target.getClan())) - { + } else if (!hall.getSiege().checkIsAttacker(target.getClan())) { activeChar.sendMessage("Your target's clan is not participating!"); - } - else - { + } else { hall.removeAttacker(target.getClan()); } - } - else - { + } else { L2Clan rawClan = ClanTable.getInstance().getClanByName(split[2]); - if (rawClan == null) - { + if (rawClan == null) { activeChar.sendMessage("The given clan does not exist!"); - } - else if (!hall.getSiege().checkIsAttacker(rawClan)) - { + } else if (!hall.getSiege().checkIsAttacker(rawClan)) { activeChar.sendMessage("The given clan is not participating!"); - } - else - { + } else { hall.removeAttacker(rawClan); } } - } - else if (split[0].equals(COMMANDS[6])) - { - if (hall.isInSiege()) - { + } else if (split[0].equals(COMMANDS[6])) { + if (hall.isInSiege()) { activeChar.sendMessage("The requested hall is in siege right now, cannot clear attacker list!"); - } - else - { + } else { hall.getSiege().getAttackers().clear(); } - } - else if (split[0].equals(COMMANDS[7])) - { + } else if (split[0].equals(COMMANDS[7])) { activeChar.sendPacket(new SiegeInfo(hall)); - } - else if (split[0].equals(COMMANDS[8])) - { + } else if (split[0].equals(COMMANDS[8])) { ClanHallSiegeEngine siegable = hall.getSiege(); siegable.cancelSiegeTask(); - switch (hall.getSiegeStatus()) - { + switch (hall.getSiegeStatus()) { case REGISTERING: siegable.prepareOwner(); break; @@ -322,59 +232,45 @@ public final class AdminCHSiege implements IAdminCommandHandler return false; } - private SiegableHall getHall(String id, L2PcInstance gm) - { + private SiegableHall getHall(String id, L2PcInstance gm) { int ch = parseInt(id); - if (ch == 0) - { + if (ch == 0) { gm.sendMessage("Wrong clan hall id, unparseable id!"); return null; } SiegableHall hall = ClanHallSiegeManager.getInstance().getSiegableHall(ch); - if (hall == null) - { + if (hall == null) { gm.sendMessage("Couldnt find the clan hall."); } return hall; } - private int parseInt(String st) - { + private int parseInt(String st) { int val = 0; - try - { + try { val = Integer.parseInt(st); - } - catch (NumberFormatException e) - { + } catch (NumberFormatException e) { e.printStackTrace(); } return val; } - private void sendSiegableHallPage(L2PcInstance activeChar, String hallId, SiegableHall hall) - { + private void sendSiegableHallPage(L2PcInstance activeChar, String hallId, SiegableHall hall) { final NpcHtmlMessage msg = new NpcHtmlMessage(); msg.setFile(null, "data/html/admin/siegablehall.htm"); msg.replace("%clanhallId%", hallId); msg.replace("%clanhallName%", hall.getName()); - if (hall.getOwnerId() > 0) - { + if (hall.getOwnerId() > 0) { L2Clan owner = ClanTable.getInstance().getClan(hall.getOwnerId()); - if (owner != null) - { + if (owner != null) { msg.replace("%clanhallOwner%", owner.getName()); - } - else - { + } else { msg.replace("%clanhallOwner%", "No Owner"); } - } - else - { + } else { msg.replace("%clanhallOwner%", "No Owner"); } activeChar.sendPacket(msg); diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminCamera.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminCamera.java index e73d204732..582bd2ca6b 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminCamera.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminCamera.java @@ -28,52 +28,41 @@ import com.l2jserver.gameserver.network.SystemMessageId; * Camera commands. * @author Zoey76 */ -public class AdminCamera implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminCamera implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_cam", "admin_camex", "admin_cam3" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if ((activeChar.getTarget() == null) || !activeChar.getTarget().isCharacter()) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if ((activeChar.getTarget() == null) || !activeChar.getTarget().isCharacter()) { activeChar.sendPacket(SystemMessageId.TARGET_CANT_FOUND); return false; } final L2Character target = (L2Character) activeChar.getTarget(); final String[] com = command.split(" "); - switch (com[0]) - { - case "admin_cam": - { - if (com.length != 12) - { + switch (com[0]) { + case "admin_cam": { + if (com.length != 12) { activeChar.sendMessage("Usage: //cam force angle1 angle2 time range duration relYaw relPitch isWide relAngle"); return false; } AbstractScript.specialCamera(activeChar, target, Integer.parseInt(com[1]), Integer.parseInt(com[2]), Integer.parseInt(com[3]), Integer.parseInt(com[4]), Integer.parseInt(com[5]), Integer.parseInt(com[6]), Integer.parseInt(com[7]), Integer.parseInt(com[8]), Integer.parseInt(com[9]), Integer.parseInt(com[10])); break; } - case "admin_camex": - { - if (com.length != 10) - { + case "admin_camex": { + if (com.length != 10) { activeChar.sendMessage("Usage: //camex force angle1 angle2 time duration relYaw relPitch isWide relAngle"); return false; } AbstractScript.specialCameraEx(activeChar, target, Integer.parseInt(com[1]), Integer.parseInt(com[2]), Integer.parseInt(com[3]), Integer.parseInt(com[4]), Integer.parseInt(com[5]), Integer.parseInt(com[6]), Integer.parseInt(com[7]), Integer.parseInt(com[8]), Integer.parseInt(com[9])); break; } - case "admin_cam3": - { - if (com.length != 12) - { + case "admin_cam3": { + if (com.length != 12) { activeChar.sendMessage("Usage: //cam3 force angle1 angle2 time range duration relYaw relPitch isWide relAngle unk"); return false; } @@ -85,8 +74,7 @@ public class AdminCamera implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminChangeAccessLevel.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminChangeAccessLevel.java index b3744b89e4..49fc7059e4 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminChangeAccessLevel.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminChangeAccessLevel.java @@ -35,68 +35,46 @@ import com.l2jserver.gameserver.network.SystemMessageId; /** * Change access level command handler. */ -public final class AdminChangeAccessLevel implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public final class AdminChangeAccessLevel implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_changelvl" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { String[] parts = command.split(" "); - if (parts.length == 2) - { - try - { + if (parts.length == 2) { + try { int lvl = Integer.parseInt(parts[1]); - if (activeChar.getTarget() instanceof L2PcInstance) - { + if (activeChar.getTarget() instanceof L2PcInstance) { onlineChange(activeChar, (L2PcInstance) activeChar.getTarget(), lvl); - } - else - { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); } - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //changelvl <target_new_level> | <player_name> <new_level>"); } - } - else if (parts.length == 3) - { + } else if (parts.length == 3) { String name = parts[1]; int lvl = Integer.parseInt(parts[2]); L2PcInstance player = L2World.getInstance().getPlayer(name); - if (player != null) - { + if (player != null) { onlineChange(activeChar, player, lvl); - } - else - { + } else { try (Connection con = ConnectionFactory.getInstance().getConnection(); - PreparedStatement ps = con.prepareStatement("UPDATE characters SET accesslevel=? WHERE char_name=?")) - { + PreparedStatement ps = con.prepareStatement("UPDATE characters SET accesslevel=? WHERE char_name=?")) { ps.setInt(1, lvl); ps.setString(2, name); ps.execute(); - if (ps.getUpdateCount() == 0) - { + if (ps.getUpdateCount() == 0) { activeChar.sendMessage("Character not found or access level unaltered."); - } - else - { + } else { activeChar.sendMessage("Character's access level is now set to " + lvl); } - } - catch (SQLException se) - { + } catch (SQLException se) { activeChar.sendMessage("SQLException while changing character's access level"); - if (general().debug()) - { + if (general().debug()) { se.printStackTrace(); } } @@ -106,8 +84,7 @@ public final class AdminChangeAccessLevel implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } @@ -116,24 +93,17 @@ public final class AdminChangeAccessLevel implements IAdminCommandHandler * @param player the online target * @param lvl the access level */ - private static void onlineChange(L2PcInstance activeChar, L2PcInstance player, int lvl) - { - if (lvl >= 0) - { - if (AdminData.getInstance().hasAccessLevel(lvl)) - { + private static void onlineChange(L2PcInstance activeChar, L2PcInstance player, int lvl) { + if (lvl >= 0) { + if (AdminData.getInstance().hasAccessLevel(lvl)) { final L2AccessLevel acccessLevel = AdminData.getInstance().getAccessLevel(lvl); player.setAccessLevel(lvl); player.sendMessage("Your access level has been changed to " + acccessLevel.getName() + " (" + acccessLevel.getLevel() + ")."); activeChar.sendMessage(player.getName() + "'s access level has been changed to " + acccessLevel.getName() + " (" + acccessLevel.getLevel() + ")."); - } - else - { + } else { activeChar.sendMessage("You are trying to set unexisting access level: " + lvl + " please try again with a valid one!"); } - } - else - { + } else { player.setAccessLevel(lvl); player.sendMessage("Your character has been banned. Bye."); player.logout(); diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminClan.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminClan.java index b0df895ac3..e66d3060a1 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminClan.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminClan.java @@ -38,10 +38,8 @@ import com.l2jserver.gameserver.util.Util; /** * @author UnAfraid, Zoey76 */ -public class AdminClan implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminClan implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_clan_info", "admin_clan_changeleader", "admin_clan_show_pending", @@ -49,23 +47,18 @@ public class AdminClan implements IAdminCommandHandler }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { final StringTokenizer st = new StringTokenizer(command); final String cmd = st.nextToken(); - switch (cmd) - { - case "admin_clan_info": - { + switch (cmd) { + case "admin_clan_info": { final L2PcInstance player = getPlayer(activeChar, st); - if (player == null) - { + if (player == null) { break; } final L2Clan clan = player.getClan(); - if (clan == null) - { + if (clan == null) { activeChar.sendPacket(SystemMessageId.TARGET_MUST_BE_IN_CLAN); return false; } @@ -86,44 +79,34 @@ public class AdminClan implements IAdminCommandHandler activeChar.sendPacket(html); break; } - case "admin_clan_changeleader": - { + case "admin_clan_changeleader": { final L2PcInstance player = getPlayer(activeChar, st); - if (player == null) - { + if (player == null) { break; } final L2Clan clan = player.getClan(); - if (clan == null) - { + if (clan == null) { activeChar.sendPacket(SystemMessageId.TARGET_MUST_BE_IN_CLAN); return false; } final L2ClanMember member = clan.getClanMember(player.getObjectId()); - if (member != null) - { - if (player.isAcademyMember()) - { + if (member != null) { + if (player.isAcademyMember()) { player.sendPacket(SystemMessageId.RIGHT_CANT_TRANSFERRED_TO_ACADEMY_MEMBER); - } - else - { + } else { clan.setNewLeader(member); } } break; } - case "admin_clan_show_pending": - { + case "admin_clan_show_pending": { final NpcHtmlMessage html = new NpcHtmlMessage(0, 1); html.setHtml(HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/admin/clanchanges.htm")); StringBuilder sb = new StringBuilder(); - for (L2Clan clan : ClanTable.getInstance().getClans()) - { - if (clan.getNewLeaderId() != 0) - { + for (L2Clan clan : ClanTable.getInstance().getClans()) { + if (clan.getNewLeaderId() != 0) { sb.append("<tr>"); sb.append("<td>" + clan.getName() + "</td>"); sb.append("<td>" + clan.getNewLeaderName() + "</td>"); @@ -135,26 +118,21 @@ public class AdminClan implements IAdminCommandHandler activeChar.sendPacket(html); break; } - case "admin_clan_force_pending": - { - if (st.hasMoreElements()) - { + case "admin_clan_force_pending": { + if (st.hasMoreElements()) { String token = st.nextToken(); - if (!Util.isDigit(token)) - { + if (!Util.isDigit(token)) { break; } int clanId = Integer.parseInt(token); final L2Clan clan = ClanTable.getInstance().getClan(clanId); - if (clan == null) - { + if (clan == null) { break; } final L2ClanMember member = clan.getClanMember(clan.getNewLeaderId()); - if (member == null) - { + if (member == null) { break; } @@ -172,42 +150,30 @@ public class AdminClan implements IAdminCommandHandler * @param st * @return */ - private L2PcInstance getPlayer(L2PcInstance activeChar, StringTokenizer st) - { + private L2PcInstance getPlayer(L2PcInstance activeChar, StringTokenizer st) { String val; L2PcInstance player = null; - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { val = st.nextToken(); // From the HTML we receive player's object Id. - if (Util.isDigit(val)) - { + if (Util.isDigit(val)) { player = L2World.getInstance().getPlayer(Integer.parseInt(val)); - if (player == null) - { + if (player == null) { activeChar.sendPacket(SystemMessageId.TARGET_IS_NOT_FOUND_IN_THE_GAME); return null; } - } - else - { + } else { player = L2World.getInstance().getPlayer(val); - if (player == null) - { + if (player == null) { activeChar.sendPacket(SystemMessageId.INCORRECT_NAME_TRY_AGAIN); return null; } } - } - else - { + } else { L2Object targetObj = activeChar.getTarget(); - if (targetObj instanceof L2PcInstance) - { + if (targetObj instanceof L2PcInstance) { player = targetObj.getActingPlayer(); - } - else - { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return null; } @@ -216,8 +182,7 @@ public class AdminClan implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminCreateItem.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminCreateItem.java index 759af24923..9022cc7acc 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminCreateItem.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminCreateItem.java @@ -30,10 +30,8 @@ import com.l2jserver.gameserver.model.items.L2Item; * This class handles following admin commands: - itemcreate = show menu - create_item <id> [num] = creates num items with respective id, if num is not specified, assumes 1. * @version $Revision: 1.2.2.2.2.3 $ $Date: 2005/04/11 10:06:06 $ */ -public class AdminCreateItem implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminCreateItem implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_itemcreate", "admin_create_item", "admin_create_coin", @@ -42,154 +40,109 @@ public class AdminCreateItem implements IAdminCommandHandler }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.equals("admin_itemcreate")) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.equals("admin_itemcreate")) { AdminHtml.showAdminHtml(activeChar, "itemcreation.htm"); - } - else if (command.startsWith("admin_create_item")) - { - try - { + } else if (command.startsWith("admin_create_item")) { + try { String val = command.substring(17); StringTokenizer st = new StringTokenizer(val); - if (st.countTokens() == 2) - { + if (st.countTokens() == 2) { String id = st.nextToken(); int idval = Integer.parseInt(id); String num = st.nextToken(); long numval = Long.parseLong(num); createItem(activeChar, activeChar, idval, numval); - } - else if (st.countTokens() == 1) - { + } else if (st.countTokens() == 1) { String id = st.nextToken(); int idval = Integer.parseInt(id); createItem(activeChar, activeChar, idval, 1); } - } - catch (StringIndexOutOfBoundsException e) - { + } catch (StringIndexOutOfBoundsException e) { activeChar.sendMessage("Usage: //create_item <itemId> [amount]"); - } - catch (NumberFormatException nfe) - { + } catch (NumberFormatException nfe) { activeChar.sendMessage("Specify a valid number."); } AdminHtml.showAdminHtml(activeChar, "itemcreation.htm"); - } - else if (command.startsWith("admin_create_coin")) - { - try - { + } else if (command.startsWith("admin_create_coin")) { + try { String val = command.substring(17); StringTokenizer st = new StringTokenizer(val); - if (st.countTokens() == 2) - { + if (st.countTokens() == 2) { String name = st.nextToken(); int idval = getCoinId(name); - if (idval > 0) - { + if (idval > 0) { String num = st.nextToken(); long numval = Long.parseLong(num); createItem(activeChar, activeChar, idval, numval); } - } - else if (st.countTokens() == 1) - { + } else if (st.countTokens() == 1) { String name = st.nextToken(); int idval = getCoinId(name); createItem(activeChar, activeChar, idval, 1); } - } - catch (StringIndexOutOfBoundsException e) - { + } catch (StringIndexOutOfBoundsException e) { activeChar.sendMessage("Usage: //create_coin <name> [amount]"); - } - catch (NumberFormatException nfe) - { + } catch (NumberFormatException nfe) { activeChar.sendMessage("Specify a valid number."); } AdminHtml.showAdminHtml(activeChar, "itemcreation.htm"); - } - else if (command.startsWith("admin_give_item_target")) - { - try - { + } else if (command.startsWith("admin_give_item_target")) { + try { L2PcInstance target; - if (activeChar.getTarget() instanceof L2PcInstance) - { + if (activeChar.getTarget() instanceof L2PcInstance) { target = (L2PcInstance) activeChar.getTarget(); - } - else - { + } else { activeChar.sendMessage("Invalid target."); return false; } String val = command.substring(22); StringTokenizer st = new StringTokenizer(val); - if (st.countTokens() == 2) - { + if (st.countTokens() == 2) { String id = st.nextToken(); int idval = Integer.parseInt(id); String num = st.nextToken(); long numval = Long.parseLong(num); createItem(activeChar, target, idval, numval); - } - else if (st.countTokens() == 1) - { + } else if (st.countTokens() == 1) { String id = st.nextToken(); int idval = Integer.parseInt(id); createItem(activeChar, target, idval, 1); } - } - catch (StringIndexOutOfBoundsException e) - { + } catch (StringIndexOutOfBoundsException e) { activeChar.sendMessage("Usage: //give_item_target <itemId> [amount]"); - } - catch (NumberFormatException nfe) - { + } catch (NumberFormatException nfe) { activeChar.sendMessage("Specify a valid number."); } AdminHtml.showAdminHtml(activeChar, "itemcreation.htm"); - } - else if (command.startsWith("admin_give_item_to_all")) - { + } else if (command.startsWith("admin_give_item_to_all")) { String val = command.substring(22); StringTokenizer st = new StringTokenizer(val); int idval = 0; long numval = 0; - if (st.countTokens() == 2) - { + if (st.countTokens() == 2) { String id = st.nextToken(); idval = Integer.parseInt(id); String num = st.nextToken(); numval = Long.parseLong(num); - } - else if (st.countTokens() == 1) - { + } else if (st.countTokens() == 1) { String id = st.nextToken(); idval = Integer.parseInt(id); numval = 1; } int counter = 0; L2Item template = ItemTable.getInstance().getTemplate(idval); - if (template == null) - { + if (template == null) { activeChar.sendMessage("This item doesn't exist."); return false; } - if ((numval > 10) && !template.isStackable()) - { + if ((numval > 10) && !template.isStackable()) { activeChar.sendMessage("This item does not stack - Creation aborted."); return false; } - for (L2PcInstance onlinePlayer : L2World.getInstance().getPlayers()) - { - if ((activeChar != onlinePlayer) && onlinePlayer.isOnline() && ((onlinePlayer.getClient() != null) && !onlinePlayer.getClient().isDetached())) - { + for (L2PcInstance onlinePlayer : L2World.getInstance().getPlayers()) { + if ((activeChar != onlinePlayer) && onlinePlayer.isOnline() && ((onlinePlayer.getClient() != null) && !onlinePlayer.getClient().isDetached())) { onlinePlayer.getInventory().addItem("Admin", idval, numval, onlinePlayer, activeChar); onlinePlayer.sendMessage("Admin spawned " + numval + " " + template.getName() + " in your inventory."); counter++; @@ -201,71 +154,48 @@ public class AdminCreateItem implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } - private void createItem(L2PcInstance activeChar, L2PcInstance target, int id, long num) - { + private void createItem(L2PcInstance activeChar, L2PcInstance target, int id, long num) { L2Item template = ItemTable.getInstance().getTemplate(id); - if (template == null) - { + if (template == null) { activeChar.sendMessage("This item doesn't exist."); return; } - if ((num > 10) && !template.isStackable()) - { + if ((num > 10) && !template.isStackable()) { activeChar.sendMessage("This item does not stack - Creation aborted."); return; } target.getInventory().addItem("Admin", id, num, activeChar, null); - if (activeChar != target) - { + if (activeChar != target) { target.sendMessage("Admin spawned " + num + " " + template.getName() + " in your inventory."); } activeChar.sendMessage("You have spawned " + num + " " + template.getName() + "(" + id + ") in " + target.getName() + " inventory."); } - private int getCoinId(String name) - { + private int getCoinId(String name) { int id; - if (name.equalsIgnoreCase("adena")) - { + if (name.equalsIgnoreCase("adena")) { id = 57; - } - else if (name.equalsIgnoreCase("ancientadena")) - { + } else if (name.equalsIgnoreCase("ancientadena")) { id = 5575; - } - else if (name.equalsIgnoreCase("festivaladena")) - { + } else if (name.equalsIgnoreCase("festivaladena")) { id = 6673; - } - else if (name.equalsIgnoreCase("blueeva")) - { + } else if (name.equalsIgnoreCase("blueeva")) { id = 4355; - } - else if (name.equalsIgnoreCase("goldeinhasad")) - { + } else if (name.equalsIgnoreCase("goldeinhasad")) { id = 4356; - } - else if (name.equalsIgnoreCase("silvershilen")) - { + } else if (name.equalsIgnoreCase("silvershilen")) { id = 4357; - } - else if (name.equalsIgnoreCase("bloodypaagrio")) - { + } else if (name.equalsIgnoreCase("bloodypaagrio")) { id = 4358; - } - else if (name.equalsIgnoreCase("fantasyislecoin")) - { + } else if (name.equalsIgnoreCase("fantasyislecoin")) { id = 13067; - } - else - { + } else { id = 0; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminCursedWeapons.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminCursedWeapons.java index e5fc277726..b646b5dafd 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminCursedWeapons.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminCursedWeapons.java @@ -35,10 +35,8 @@ import com.l2jserver.gameserver.util.StringUtil; * teleports GM to the specified cursed weapon - cw_reload = reloads instance manager * @version $Revision: 1.1.6.3 $ $Date: 2007/07/31 10:06:06 $ */ -public class AdminCursedWeapons implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminCursedWeapons implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_cw_info", "admin_cw_remove", "admin_cw_goto", @@ -50,8 +48,7 @@ public class AdminCursedWeapons implements IAdminCommandHandler private int itemId; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { CursedWeaponsManager cwm = CursedWeaponsManager.getInstance(); int id = 0; @@ -59,59 +56,49 @@ public class AdminCursedWeapons implements IAdminCommandHandler StringTokenizer st = new StringTokenizer(command); st.nextToken(); - if (command.startsWith("admin_cw_info")) - { - if (!command.contains("menu")) - { + if (command.startsWith("admin_cw_info")) { + if (!command.contains("menu")) { activeChar.sendMessage("====== Cursed Weapons: ======"); - for (CursedWeapon cw : cwm.getCursedWeapons()) - { + for (CursedWeapon cw : cwm.getCursedWeapons()) { activeChar.sendMessage("> " + cw.getName() + " (" + cw.getItemId() + ")"); - if (cw.isActivated()) - { + if (cw.isActivated()) { L2PcInstance pl = cw.getPlayer(); activeChar.sendMessage(" Player holding: " + (pl == null ? "null" : pl.getName())); activeChar.sendMessage(" Player karma: " + cw.getPlayerKarma()); activeChar.sendMessage(" Time Remaining: " + (cw.getTimeLeft() / 60000) + " min."); activeChar.sendMessage(" Kills : " + cw.getNbKills()); - } - else if (cw.isDropped()) - { + } else if (cw.isDropped()) { activeChar.sendMessage(" Lying on the ground."); activeChar.sendMessage(" Time Remaining: " + (cw.getTimeLeft() / 60000) + " min."); activeChar.sendMessage(" Kills : " + cw.getNbKills()); - } - else - { + } else { activeChar.sendMessage(" Don't exist in the world."); } activeChar.sendPacket(SystemMessageId.FRIEND_LIST_FOOTER); } - } - else - { + } else { final Collection<CursedWeapon> cws = cwm.getCursedWeapons(); final StringBuilder replyMSG = new StringBuilder(cws.size() * 300); final NpcHtmlMessage adminReply = new NpcHtmlMessage(); adminReply.setFile(activeChar.getHtmlPrefix(), "data/html/admin/cwinfo.htm"); - for (CursedWeapon cw : cwm.getCursedWeapons()) - { + for (CursedWeapon cw : cwm.getCursedWeapons()) { itemId = cw.getItemId(); StringUtil.append(replyMSG, "<table width=270><tr><td>Name:</td><td>", cw.getName(), "</td></tr>"); - if (cw.isActivated()) - { + if (cw.isActivated()) { L2PcInstance pl = cw.getPlayer(); - StringUtil.append(replyMSG, "<tr><td>Weilder:</td><td>", (pl == null ? "null" : pl.getName()), "</td></tr>" + "<tr><td>Karma:</td><td>", String.valueOf(cw.getPlayerKarma()), "</td></tr>" + "<tr><td>Kills:</td><td>", String.valueOf(cw.getPlayerPkKills()), "/", String.valueOf(cw.getNbKills()), "</td></tr>" + "<tr><td>Time remaining:</td><td>", String.valueOf(cw.getTimeLeft() / 60000), " min.</td></tr>" + "<tr><td><button value=\"Remove\" action=\"bypass -h admin_cw_remove ", String.valueOf(itemId), "\" width=73 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" + "<td><button value=\"Go\" action=\"bypass -h admin_cw_goto ", String.valueOf(itemId), "\" width=73 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"); - } - else if (cw.isDropped()) - { - StringUtil.append(replyMSG, "<tr><td>Position:</td><td>Lying on the ground</td></tr>" + "<tr><td>Time remaining:</td><td>", String.valueOf(cw.getTimeLeft() / 60000), " min.</td></tr>" + "<tr><td>Kills:</td><td>", String.valueOf(cw.getNbKills()), "</td></tr>" + "<tr><td><button value=\"Remove\" action=\"bypass -h admin_cw_remove ", String.valueOf(itemId), "\" width=73 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" + "<td><button value=\"Go\" action=\"bypass -h admin_cw_goto ", String.valueOf(itemId), "\" width=73 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"); - } - else - { - StringUtil.append(replyMSG, "<tr><td>Position:</td><td>Doesn't exist.</td></tr>" + "<tr><td><button value=\"Give to Target\" action=\"bypass -h admin_cw_add ", String.valueOf(itemId), "\" width=130 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td></td></tr>"); + StringUtil.append(replyMSG, "<tr><td>Weilder:</td><td>", (pl == null ? "null" : pl.getName()), "</td></tr>" + "<tr><td>Karma:</td><td>", String.valueOf(cw.getPlayerKarma()), "</td></tr>" + + "<tr><td>Kills:</td><td>", String.valueOf(cw.getPlayerPkKills()), "/", String.valueOf(cw.getNbKills()), "</td></tr>" + "<tr><td>Time remaining:</td><td>", String.valueOf(cw.getTimeLeft() / 60000), " min.</td></tr>" + + "<tr><td><button value=\"Remove\" action=\"bypass -h admin_cw_remove ", String.valueOf(itemId), "\" width=73 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" + + "<td><button value=\"Go\" action=\"bypass -h admin_cw_goto ", String.valueOf(itemId), "\" width=73 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"); + } else if (cw.isDropped()) { + StringUtil.append(replyMSG, "<tr><td>Position:</td><td>Lying on the ground</td></tr>" + "<tr><td>Time remaining:</td><td>", String.valueOf(cw.getTimeLeft() / 60000), " min.</td></tr>" + "<tr><td>Kills:</td><td>", String.valueOf(cw.getNbKills()), "</td></tr>" + + "<tr><td><button value=\"Remove\" action=\"bypass -h admin_cw_remove ", String.valueOf(itemId), "\" width=73 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" + + "<td><button value=\"Go\" action=\"bypass -h admin_cw_goto ", String.valueOf(itemId), "\" width=73 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"); + } else { + StringUtil.append(replyMSG, "<tr><td>Position:</td><td>Doesn't exist.</td></tr>" + + "<tr><td><button value=\"Give to Target\" action=\"bypass -h admin_cw_add ", String.valueOf(itemId), "\" width=130 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td></td></tr>"); } replyMSG.append("</table><br>"); @@ -119,77 +106,51 @@ public class AdminCursedWeapons implements IAdminCommandHandler adminReply.replace("%cwinfo%", replyMSG.toString()); activeChar.sendPacket(adminReply); } - } - else if (command.startsWith("admin_cw_reload")) - { + } else if (command.startsWith("admin_cw_reload")) { cwm.reload(); - } - else - { + } else { CursedWeapon cw = null; - try - { + try { String parameter = st.nextToken(); - if (parameter.matches("[0-9]*")) - { + if (parameter.matches("[0-9]*")) { id = Integer.parseInt(parameter); - } - else - { + } else { parameter = parameter.replace('_', ' '); - for (CursedWeapon cwp : cwm.getCursedWeapons()) - { - if (cwp.getName().toLowerCase().contains(parameter.toLowerCase())) - { + for (CursedWeapon cwp : cwm.getCursedWeapons()) { + if (cwp.getName().toLowerCase().contains(parameter.toLowerCase())) { id = cwp.getItemId(); break; } } } cw = cwm.getCursedWeapon(id); - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //cw_remove|//cw_goto|//cw_add <itemid|name>"); } - if (cw == null) - { + if (cw == null) { activeChar.sendMessage("Unknown cursed weapon ID."); return false; } - if (command.startsWith("admin_cw_remove ")) - { + if (command.startsWith("admin_cw_remove ")) { cw.endOfLife(); - } - else if (command.startsWith("admin_cw_goto ")) - { + } else if (command.startsWith("admin_cw_goto ")) { cw.goTo(activeChar); - } - else if (command.startsWith("admin_cw_add")) - { - if (cw.isActive()) - { + } else if (command.startsWith("admin_cw_add")) { + if (cw.isActive()) { activeChar.sendMessage("This cursed weapon is already active."); - } - else - { + } else { L2Object target = activeChar.getTarget(); - if (target instanceof L2PcInstance) - { + if (target instanceof L2PcInstance) { ((L2PcInstance) target).addItem("AdminCursedWeaponAdd", id, 1, target, true); - } - else - { + } else { activeChar.addItem("AdminCursedWeaponAdd", id, 1, activeChar, true); } cw.setEndTime(System.currentTimeMillis() + (cw.getDuration() * 60000L)); cw.reActivate(); } - } - else - { + } else { activeChar.sendMessage("Unknown command."); } } @@ -197,8 +158,7 @@ public class AdminCursedWeapons implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminDebug.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminDebug.java index 5ee1900ae6..700fef36ea 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminDebug.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminDebug.java @@ -25,40 +25,29 @@ import com.l2jserver.gameserver.model.actor.L2Character; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.SystemMessageId; -public class AdminDebug implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminDebug implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_debug" }; @Override - public final boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public final boolean useAdminCommand(String command, L2PcInstance activeChar) { String[] commandSplit = command.split(" "); - if (ADMIN_COMMANDS[0].equalsIgnoreCase(commandSplit[0])) - { + if (ADMIN_COMMANDS[0].equalsIgnoreCase(commandSplit[0])) { L2Object target; - if (commandSplit.length > 1) - { + if (commandSplit.length > 1) { target = L2World.getInstance().getPlayer(commandSplit[1].trim()); - if (target == null) - { + if (target == null) { activeChar.sendPacket(SystemMessageId.TARGET_IS_NOT_FOUND_IN_THE_GAME); return true; } - } - else - { + } else { target = activeChar.getTarget(); } - if (target instanceof L2Character) - { + if (target instanceof L2Character) { setDebug(activeChar, (L2Character) target); - } - else - { + } else { setDebug(activeChar, activeChar); } } @@ -66,20 +55,15 @@ public class AdminDebug implements IAdminCommandHandler } @Override - public final String[] getAdminCommandList() - { + public final String[] getAdminCommandList() { return ADMIN_COMMANDS; } - private final void setDebug(L2PcInstance activeChar, L2Character target) - { - if (target.isDebug()) - { + private final void setDebug(L2PcInstance activeChar, L2Character target) { + if (target.isDebug()) { target.setDebug(null); activeChar.sendMessage("Stop debugging " + target.getName()); - } - else - { + } else { target.setDebug(activeChar); activeChar.sendMessage("Start debugging " + target.getName()); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminDelete.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminDelete.java index 7078c9719b..128978afda 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminDelete.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminDelete.java @@ -30,57 +30,44 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * This class handles following admin commands: - delete = deletes target * @version $Revision: 1.2.2.1.2.4 $ $Date: 2005/04/11 10:05:56 $ */ -public class AdminDelete implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminDelete implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_delete" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.equals("admin_delete")) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.equals("admin_delete")) { handleDelete(activeChar); } return true; } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } // TODO: add possibility to delete any L2Object (except L2PcInstance) - private void handleDelete(L2PcInstance activeChar) - { + private void handleDelete(L2PcInstance activeChar) { L2Object obj = activeChar.getTarget(); - if (obj instanceof L2Npc) - { + if (obj instanceof L2Npc) { L2Npc target = (L2Npc) obj; target.deleteMe(); L2Spawn spawn = target.getSpawn(); - if (spawn != null) - { + if (spawn != null) { spawn.stopRespawn(); - if (RaidBossSpawnManager.getInstance().isDefined(spawn.getId())) - { + if (RaidBossSpawnManager.getInstance().isDefined(spawn.getId())) { RaidBossSpawnManager.getInstance().deleteSpawn(spawn, true); - } - else - { + } else { SpawnTable.getInstance().deleteSpawn(spawn, true); } } activeChar.sendMessage("Deleted " + target.getName() + " from " + target.getObjectId() + "."); - } - else - { + } else { activeChar.sendMessage("Incorrect target."); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminDisconnect.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminDisconnect.java index 6e7e50fc44..6705fd2b2a 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminDisconnect.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminDisconnect.java @@ -26,48 +26,36 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * This class handles following admin commands: - character_disconnect = disconnects target player * @version $Revision: 1.2.4.4 $ $Date: 2005/04/11 10:06:00 $ */ -public class AdminDisconnect implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminDisconnect implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_character_disconnect" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.equals("admin_character_disconnect")) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.equals("admin_character_disconnect")) { disconnectCharacter(activeChar); } return true; } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } - private void disconnectCharacter(L2PcInstance activeChar) - { + private void disconnectCharacter(L2PcInstance activeChar) { L2Object target = activeChar.getTarget(); L2PcInstance player = null; - if (target instanceof L2PcInstance) - { + if (target instanceof L2PcInstance) { player = (L2PcInstance) target; - } - else - { + } else { return; } - if (player == activeChar) - { + if (player == activeChar) { activeChar.sendMessage("You cannot logout your own character."); - } - else - { + } else { activeChar.sendMessage("Character " + player.getName() + " disconnected from server."); player.logout(); diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminDoorControl.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminDoorControl.java index 3cda0a8bc0..19e7b35e9a 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminDoorControl.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminDoorControl.java @@ -31,11 +31,9 @@ import com.l2jserver.gameserver.model.entity.Castle; * door 24190002 - close3 = close coloseum door 24190003 - close4 = close coloseum door 24190004 - closeall = close all coloseum door - open = open selected door - close = close selected door * @version $Revision: 1.2.4.5 $ $Date: 2005/04/11 10:06:06 $ */ -public class AdminDoorControl implements IAdminCommandHandler -{ +public class AdminDoorControl implements IAdminCommandHandler { private static DoorData _doorTable = DoorData.getInstance(); - private static final String[] ADMIN_COMMANDS = - { + private static final String[] ADMIN_COMMANDS = { "admin_open", "admin_close", "admin_openall", @@ -43,110 +41,76 @@ public class AdminDoorControl implements IAdminCommandHandler }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - try - { - if (command.startsWith("admin_open ")) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + try { + if (command.startsWith("admin_open ")) { int doorId = Integer.parseInt(command.substring(11)); - if (_doorTable.getDoor(doorId) != null) - { + if (_doorTable.getDoor(doorId) != null) { _doorTable.getDoor(doorId).openMe(); - } - else - { - for (Castle castle : CastleManager.getInstance().getCastles()) - { - if (castle.getDoor(doorId) != null) - { + } else { + for (Castle castle : CastleManager.getInstance().getCastles()) { + if (castle.getDoor(doorId) != null) { castle.getDoor(doorId).openMe(); } } } - } - else if (command.startsWith("admin_close ")) - { + } else if (command.startsWith("admin_close ")) { int doorId = Integer.parseInt(command.substring(12)); - if (_doorTable.getDoor(doorId) != null) - { + if (_doorTable.getDoor(doorId) != null) { _doorTable.getDoor(doorId).closeMe(); - } - else - { - for (Castle castle : CastleManager.getInstance().getCastles()) - { - if (castle.getDoor(doorId) != null) - { + } else { + for (Castle castle : CastleManager.getInstance().getCastles()) { + if (castle.getDoor(doorId) != null) { castle.getDoor(doorId).closeMe(); } } } } - if (command.equals("admin_closeall")) - { - for (L2DoorInstance door : _doorTable.getDoors()) - { + if (command.equals("admin_closeall")) { + for (L2DoorInstance door : _doorTable.getDoors()) { door.closeMe(); } - for (Castle castle : CastleManager.getInstance().getCastles()) - { - for (L2DoorInstance door : castle.getDoors()) - { + for (Castle castle : CastleManager.getInstance().getCastles()) { + for (L2DoorInstance door : castle.getDoors()) { door.closeMe(); } } } - if (command.equals("admin_openall")) - { - for (L2DoorInstance door : _doorTable.getDoors()) - { + if (command.equals("admin_openall")) { + for (L2DoorInstance door : _doorTable.getDoors()) { door.openMe(); } - for (Castle castle : CastleManager.getInstance().getCastles()) - { - for (L2DoorInstance door : castle.getDoors()) - { + for (Castle castle : CastleManager.getInstance().getCastles()) { + for (L2DoorInstance door : castle.getDoors()) { door.openMe(); } } } - if (command.equals("admin_open")) - { + if (command.equals("admin_open")) { L2Object target = activeChar.getTarget(); - if (target instanceof L2DoorInstance) - { + if (target instanceof L2DoorInstance) { ((L2DoorInstance) target).openMe(); - } - else - { + } else { activeChar.sendMessage("Incorrect target."); } } - if (command.equals("admin_close")) - { + if (command.equals("admin_close")) { L2Object target = activeChar.getTarget(); - if (target instanceof L2DoorInstance) - { + if (target instanceof L2DoorInstance) { ((L2DoorInstance) target).closeMe(); - } - else - { + } else { activeChar.sendMessage("Incorrect target."); } } - } - catch (Exception e) - { + } catch (Exception e) { e.printStackTrace(); } return true; } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminEditChar.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminEditChar.java index 7ac2a67807..b7ef9e9baf 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminEditChar.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminEditChar.java @@ -107,96 +107,78 @@ public class AdminEditChar implements IAdminCommandHandler { public boolean useAdminCommand(String command, L2PcInstance activeChar) { if (command.equals("admin_current_player")) { showCharacterInfo(activeChar, activeChar); - } - else if (command.startsWith("admin_character_info")) { + } else if (command.startsWith("admin_character_info")) { String[] data = command.split(" "); if ((data.length > 1)) { showCharacterInfo(activeChar, L2World.getInstance().getPlayer(data[1])); - } - else if (activeChar.getTarget() instanceof L2PcInstance) { + } else if (activeChar.getTarget() instanceof L2PcInstance) { showCharacterInfo(activeChar, activeChar.getTarget().getActingPlayer()); - } - else { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); } - } - else if (command.startsWith("admin_character_list")) { + } else if (command.startsWith("admin_character_list")) { listCharacters(activeChar, 0); - } - else if (command.startsWith("admin_show_characters")) { + } else if (command.startsWith("admin_show_characters")) { try { String val = command.substring(22); int page = Integer.parseInt(val); listCharacters(activeChar, page); - } - catch (StringIndexOutOfBoundsException e) { + } catch (StringIndexOutOfBoundsException e) { // Case of empty page number activeChar.sendMessage("Usage: //show_characters <page_number>"); } - } - else if (command.startsWith("admin_find_character")) { + } else if (command.startsWith("admin_find_character")) { try { String val = command.substring(21); findCharacter(activeChar, val); - } - catch (StringIndexOutOfBoundsException e) { + } catch (StringIndexOutOfBoundsException e) { // Case of empty character name activeChar.sendMessage("Usage: //find_character <character_name>"); listCharacters(activeChar, 0); } - } - else if (command.startsWith("admin_find_ip")) { + } else if (command.startsWith("admin_find_ip")) { try { String val = command.substring(14); findCharactersPerIp(activeChar, val); - } - catch (Exception e) { + } catch (Exception e) { // Case of empty or malformed IP number activeChar.sendMessage("Usage: //find_ip <www.xxx.yyy.zzz>"); listCharacters(activeChar, 0); } - } - else if (command.startsWith("admin_find_account")) { + } else if (command.startsWith("admin_find_account")) { try { String val = command.substring(19); findCharactersPerAccount(activeChar, val); - } - catch (Exception ex) { + } catch (Exception ex) { // Case of empty or malformed player name activeChar.sendMessage("Usage: //find_account <player_name>"); listCharacters(activeChar, 0); } - } - else if (command.startsWith("admin_edit_character")) { + } else if (command.startsWith("admin_edit_character")) { String[] data = command.split(" "); if ((data.length > 1)) { editCharacter(activeChar, data[1]); - } - else if (activeChar.getTarget() instanceof L2PcInstance) { + } else if (activeChar.getTarget() instanceof L2PcInstance) { editCharacter(activeChar, null); - } - else { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); } } // Karma control commands else if (command.equals("admin_nokarma")) { setTargetKarma(activeChar, 0); - } - else if (command.startsWith("admin_setkarma")) { + } else if (command.startsWith("admin_setkarma")) { try { String val = command.substring(15); int karma = Integer.parseInt(val); setTargetKarma(activeChar, karma); - } - catch (Exception e) { + } catch (Exception e) { if (general().developer()) { _log.warning("Set karma error: " + e); } activeChar.sendMessage("Usage: //setkarma <new_karma_value>"); } - } - else if (command.startsWith("admin_setpk")) { + } else if (command.startsWith("admin_setpk")) { try { String val = command.substring(12); int pk = Integer.parseInt(val); @@ -209,19 +191,16 @@ public class AdminEditChar implements IAdminCommandHandler { player.sendPacket(new ExBrExtraUserInfo(player)); player.sendMessage("A GM changed your PK count to " + pk); activeChar.sendMessage(player.getName() + "'s PK count changed to " + pk); - } - else { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); } - } - catch (Exception ex) { + } catch (Exception ex) { if (general().developer()) { _log.warning("Set pk error: " + ex); } activeChar.sendMessage("Usage: //setpk <pk_count>"); } - } - else if (command.startsWith("admin_setpvp")) { + } else if (command.startsWith("admin_setpvp")) { try { String val = command.substring(13); int pvp = Integer.parseInt(val); @@ -234,19 +213,16 @@ public class AdminEditChar implements IAdminCommandHandler { player.sendPacket(new ExBrExtraUserInfo(player)); player.sendMessage("A GM changed your PVP count to " + pvp); activeChar.sendMessage(player.getName() + "'s PVP count changed to " + pvp); - } - else { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); } - } - catch (Exception ex) { + } catch (Exception ex) { if (general().developer()) { _log.warning("Set pvp error: " + ex); } activeChar.sendMessage("Usage: //setpvp <pvp_count>"); } - } - else if (command.startsWith("admin_setfame")) { + } else if (command.startsWith("admin_setfame")) { try { String val = command.substring(14); int fame = Integer.parseInt(val); @@ -259,19 +235,16 @@ public class AdminEditChar implements IAdminCommandHandler { player.sendPacket(new ExBrExtraUserInfo(player)); player.sendMessage("A GM changed your Reputation points to " + fame); activeChar.sendMessage(player.getName() + "'s Fame changed to " + fame); - } - else { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); } - } - catch (Exception ex) { + } catch (Exception ex) { if (general().developer()) { _log.warning("Set Fame error: " + ex); } activeChar.sendMessage("Usage: //setfame <new_fame_value>"); } - } - else if (command.startsWith("admin_rec")) { + } else if (command.startsWith("admin_rec")) { try { String val = command.substring(10); int recVal = Integer.parseInt(val); @@ -285,16 +258,13 @@ public class AdminEditChar implements IAdminCommandHandler { player.sendPacket(new ExVoteSystemInfo(player)); player.sendMessage("A GM changed your Recommend points to " + recVal); activeChar.sendMessage(player.getName() + "'s Recommend changed to " + recVal); - } - else { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); } - } - catch (Exception e) { + } catch (Exception e) { activeChar.sendMessage("Usage: //rec number"); } - } - else if (command.startsWith("admin_setclass")) { + } else if (command.startsWith("admin_setclass")) { try { String val = command.substring(15).trim(); int classidval = Integer.parseInt(val); @@ -302,8 +272,7 @@ public class AdminEditChar implements IAdminCommandHandler { L2PcInstance player = null; if (target instanceof L2PcInstance) { player = (L2PcInstance) target; - } - else { + } else { return false; } boolean valid = false; @@ -326,46 +295,38 @@ public class AdminEditChar implements IAdminCommandHandler { activeChar.setTarget(null); activeChar.setTarget(player); activeChar.sendMessage(player.getName() + " is a " + newclass + "."); - } - else { + } else { activeChar.sendMessage("Usage: //setclass <valid_new_classid>"); } - } - catch (StringIndexOutOfBoundsException e) { + } catch (StringIndexOutOfBoundsException e) { AdminHtml.showAdminHtml(activeChar, "setclass/human_fighter.htm"); - } - catch (NumberFormatException e) { + } catch (NumberFormatException e) { activeChar.sendMessage("Usage: //setclass <valid_new_classid>"); } - } - else if (command.startsWith("admin_settitle")) { + } else if (command.startsWith("admin_settitle")) { try { String val = command.substring(15); L2Object target = activeChar.getTarget(); L2PcInstance player = null; if (target instanceof L2PcInstance) { player = (L2PcInstance) target; - } - else { + } else { return false; } player.setTitle(val); player.sendMessage("Your title has been changed by a GM"); player.broadcastTitleInfo(); - } - catch (StringIndexOutOfBoundsException e) { // Case of empty character title + } catch (StringIndexOutOfBoundsException e) { // Case of empty character title activeChar.sendMessage("You need to specify the new title."); } - } - else if (command.startsWith("admin_changename")) { + } else if (command.startsWith("admin_changename")) { try { String val = command.substring(17); L2Object target = activeChar.getTarget(); L2PcInstance player = null; if (target instanceof L2PcInstance) { player = (L2PcInstance) target; - } - else { + } else { return false; } if (CharNameTable.getInstance().getIdByName(val) > 0) { @@ -392,77 +353,65 @@ public class AdminEditChar implements IAdminCommandHandler { if (player.getClan() != null) { player.getClan().broadcastClanStatus(); } - } - catch (StringIndexOutOfBoundsException e) { + } catch (StringIndexOutOfBoundsException e) { // Case of empty character name activeChar.sendMessage("Usage: //setname new_name_for_target"); } - } - else if (command.startsWith("admin_setsex")) { + } else if (command.startsWith("admin_setsex")) { L2Object target = activeChar.getTarget(); L2PcInstance player = null; if (target instanceof L2PcInstance) { player = (L2PcInstance) target; - } - else { + } else { return false; } player.getAppearance().setSex(player.getAppearance().getSex() ? false : true); player.sendMessage("Your gender has been changed by a GM"); player.broadcastUserInfo(); - } - else if (command.startsWith("admin_setcolor")) { + } else if (command.startsWith("admin_setcolor")) { try { String val = command.substring(15); L2Object target = activeChar.getTarget(); L2PcInstance player = null; if (target instanceof L2PcInstance) { player = (L2PcInstance) target; - } - else { + } else { return false; } player.getAppearance().setNameColor(Integer.decode("0x" + val)); player.sendMessage("Your name color has been changed by a GM"); player.broadcastUserInfo(); - } - catch (Exception e) { + } catch (Exception e) { // Case of empty color or invalid hex string activeChar.sendMessage("You need to specify a valid new color."); } - } - else if (command.startsWith("admin_settcolor")) { + } else if (command.startsWith("admin_settcolor")) { try { String val = command.substring(16); L2Object target = activeChar.getTarget(); L2PcInstance player = null; if (target instanceof L2PcInstance) { player = (L2PcInstance) target; - } - else { + } else { return false; } player.getAppearance().setTitleColor(Integer.decode("0x" + val)); player.sendMessage("Your title color has been changed by a GM"); player.broadcastUserInfo(); - } - catch (Exception e) { + } catch (Exception e) { // Case of empty color or invalid hex string activeChar.sendMessage("You need to specify a valid new color."); } - } - else if (command.startsWith("admin_fullfood")) { + } else if (command.startsWith("admin_fullfood")) { L2Object target = activeChar.getTarget(); if (target instanceof L2PetInstance) { L2PetInstance targetPet = (L2PetInstance) target; targetPet.setCurrentFed(targetPet.getMaxFed()); targetPet.broadcastStatusUpdate(); - } - else { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); } - } - else if (command.startsWith("admin_remove_clan_penalty")) { + } else if (command.startsWith("admin_remove_clan_penalty")) { try { StringTokenizer st = new StringTokenizer(command, " "); if (st.countTokens() != 3) { @@ -485,24 +434,20 @@ public class AdminEditChar implements IAdminCommandHandler { ps.setString(1, playerName); ps.execute(); } - } - else { + } else { // removing penalty if (changeCreateExpiryTime) { player.setClanCreateExpiryTime(0); - } - else { + } else { player.setClanJoinExpiryTime(0); } } activeChar.sendMessage("Clan penalty successfully removed to character: " + playerName); - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } - } - else if (command.startsWith("admin_find_dualbox")) { + } else if (command.startsWith("admin_find_dualbox")) { int multibox = 2; try { String val = command.substring(19); @@ -511,12 +456,10 @@ public class AdminEditChar implements IAdminCommandHandler { activeChar.sendMessage("Usage: //find_dualbox [number > 0]"); return false; } - } - catch (Exception e) { + } catch (Exception e) { } findDualbox(activeChar, multibox); - } - else if (command.startsWith("admin_strict_find_dualbox")) { + } else if (command.startsWith("admin_strict_find_dualbox")) { int multibox = 2; try { String val = command.substring(26); @@ -525,18 +468,15 @@ public class AdminEditChar implements IAdminCommandHandler { activeChar.sendMessage("Usage: //strict_find_dualbox [number > 0]"); return false; } - } - catch (Exception e) { + } catch (Exception e) { } findDualboxStrict(activeChar, multibox); - } - else if (command.startsWith("admin_tracert")) { + } else if (command.startsWith("admin_tracert")) { String[] data = command.split(" "); L2PcInstance pl = null; if ((data.length > 1)) { pl = L2World.getInstance().getPlayer(data[1]); - } - else { + } else { L2Object target = activeChar.getTarget(); if (target instanceof L2PcInstance) { pl = (L2PcInstance) target; @@ -571,26 +511,21 @@ public class AdminEditChar implements IAdminCommandHandler { } activeChar.sendMessage("Hop" + i + ": " + ip); } - } - else if (command.startsWith("admin_summon_info")) { + } else if (command.startsWith("admin_summon_info")) { L2Object target = activeChar.getTarget(); if (target instanceof L2Summon) { gatherSummonInfo((L2Summon) target, activeChar); - } - else { + } else { activeChar.sendMessage("Invalid target."); } - } - else if (command.startsWith("admin_unsummon")) { + } else if (command.startsWith("admin_unsummon")) { L2Object target = activeChar.getTarget(); if (target instanceof L2Summon) { ((L2Summon) target).unSummon(((L2Summon) target).getOwner()); - } - else { + } else { activeChar.sendMessage("Usable only with Pets/Summons"); } - } - else if (command.startsWith("admin_summon_setlvl")) { + } else if (command.startsWith("admin_summon_setlvl")) { L2Object target = activeChar.getTarget(); if (target instanceof L2PetInstance) { L2PetInstance pet = (L2PetInstance) target; @@ -602,37 +537,30 @@ public class AdminEditChar implements IAdminCommandHandler { newexp = pet.getStat().getExpForLevel(level); if (oldexp > newexp) { pet.getStat().removeExp(oldexp - newexp); - } - else if (oldexp < newexp) { + } else if (oldexp < newexp) { pet.getStat().addExp(newexp - oldexp); } + } catch (Exception e) { } - catch (Exception e) { - } - } - else { + } else { activeChar.sendMessage("Usable only with Pets"); } - } - else if (command.startsWith("admin_show_pet_inv")) { + } else if (command.startsWith("admin_show_pet_inv")) { L2Object target; try { String val = command.substring(19); int objId = Integer.parseInt(val); target = L2World.getInstance().getPet(objId); - } - catch (Exception e) { + } catch (Exception e) { target = activeChar.getTarget(); } if (target instanceof L2PetInstance) { activeChar.sendPacket(new GMViewItemList((L2PetInstance) target)); - } - else { + } else { activeChar.sendMessage("Usable only with Pets"); } - } - else if (command.startsWith("admin_partyinfo")) { + } else if (command.startsWith("admin_partyinfo")) { L2Object target; try { String val = command.substring(16); @@ -640,30 +568,25 @@ public class AdminEditChar implements IAdminCommandHandler { if (target == null) { target = activeChar.getTarget(); } - } - catch (Exception e) { + } catch (Exception e) { target = activeChar.getTarget(); } if (target instanceof L2PcInstance) { if (((L2PcInstance) target).isInParty()) { gatherPartyInfo((L2PcInstance) target, activeChar); - } - else { + } else { activeChar.sendMessage("Not in party."); } - } - else { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); } - } - else if (command.equals("admin_setnoble")) { + } else if (command.equals("admin_setnoble")) { L2PcInstance player = null; if (activeChar.getTarget() == null) { player = activeChar; - } - else if ((activeChar.getTarget() != null) && (activeChar.getTarget() instanceof L2PcInstance)) { + } else if ((activeChar.getTarget() != null) && (activeChar.getTarget() instanceof L2PcInstance)) { player = (L2PcInstance) activeChar.getTarget(); } @@ -674,8 +597,7 @@ public class AdminEditChar implements IAdminCommandHandler { } player.sendMessage("GM changed your nobless status!"); } - } - else if (command.startsWith("admin_set_hp")) { + } else if (command.startsWith("admin_set_hp")) { final String[] data = command.split(" "); try { final L2Object target = activeChar.getTarget(); @@ -684,12 +606,10 @@ public class AdminEditChar implements IAdminCommandHandler { return false; } ((L2Character) target).setCurrentHp(Double.parseDouble(data[1])); - } - catch (Exception e) { + } catch (Exception e) { activeChar.sendMessage("Usage: //set_hp 1000"); } - } - else if (command.startsWith("admin_set_mp")) { + } else if (command.startsWith("admin_set_mp")) { final String[] data = command.split(" "); try { final L2Object target = activeChar.getTarget(); @@ -698,12 +618,10 @@ public class AdminEditChar implements IAdminCommandHandler { return false; } ((L2Character) target).setCurrentMp(Double.parseDouble(data[1])); - } - catch (Exception e) { + } catch (Exception e) { activeChar.sendMessage("Usage: //set_mp 1000"); } - } - else if (command.startsWith("admin_set_cp")) { + } else if (command.startsWith("admin_set_cp")) { final String[] data = command.split(" "); try { final L2Object target = activeChar.getTarget(); @@ -712,12 +630,10 @@ public class AdminEditChar implements IAdminCommandHandler { return false; } ((L2Character) target).setCurrentCp(Double.parseDouble(data[1])); - } - catch (Exception e) { + } catch (Exception e) { activeChar.sendMessage("Usage: //set_cp 1000"); } - } - else if (command.startsWith("admin_set_pvp_flag")) { + } else if (command.startsWith("admin_set_pvp_flag")) { try { final L2Object target = activeChar.getTarget(); if ((target == null) || !target.isPlayable()) { @@ -726,8 +642,7 @@ public class AdminEditChar implements IAdminCommandHandler { } final L2Playable playable = ((L2Playable) target); playable.updatePvPFlag(Math.abs(playable.getPvpFlag() - 1)); - } - catch (Exception e) { + } catch (Exception e) { activeChar.sendMessage("Usage: //set_pvp_flag"); } } @@ -758,8 +673,7 @@ public class AdminEditChar implements IAdminCommandHandler { if (result.getPages() > 0) { html.replace("%pages%", "<table width=280 cellspacing=0><tr>" + result.getPagerTemplate() + "</tr></table>"); - } - else { + } else { html.replace("%pages%", ""); } @@ -772,12 +686,10 @@ public class AdminEditChar implements IAdminCommandHandler { L2Object target = activeChar.getTarget(); if (target instanceof L2PcInstance) { player = (L2PcInstance) target; - } - else { + } else { return; } - } - else { + } else { activeChar.setTarget(player); } gatherCharacterInfo(activeChar, player, "charinfo.htm"); @@ -800,11 +712,9 @@ public class AdminEditChar implements IAdminCommandHandler { final L2GameClient client = player.getClient(); if (client == null) { activeChar.sendMessage("Client is null."); - } - else if (client.isDetached()) { + } else if (client.isDetached()) { activeChar.sendMessage("Client is detached."); - } - else { + } else { ip = client.getConnection().getInetAddress().getHostAddress(); } @@ -860,8 +770,7 @@ public class AdminEditChar implements IAdminCommandHandler { L2PcInstance player = null; if (target instanceof L2PcInstance) { player = (L2PcInstance) target; - } - else { + } else { return; } @@ -879,8 +788,7 @@ public class AdminEditChar implements IAdminCommandHandler { if (general().debug()) { _log.fine("[SET KARMA] [GM]" + activeChar.getName() + " Changed karma for " + player.getName() + " from (" + oldKarma + ") to (" + newKarma + ")."); } - } - else { + } else { // tell admin of mistake activeChar.sendMessage("You must enter a value for karma greater than or equal to 0."); if (general().debug()) { @@ -893,8 +801,7 @@ public class AdminEditChar implements IAdminCommandHandler { L2Object target = null; if (targetName != null) { target = L2World.getInstance().getPlayer(targetName); - } - else { + } else { target = activeChar.getTarget(); } @@ -927,15 +834,12 @@ public class AdminEditChar implements IAdminCommandHandler { final String replyMSG2; if (CharactersFound == 0) { replyMSG2 = "s. Please try again."; - } - else if (CharactersFound > 20) { + } else if (CharactersFound > 20) { adminReply.replace("%number%", " more than 20"); replyMSG2 = "s.<br>Please refine your search to see all of the results."; - } - else if (CharactersFound == 1) { + } else if (CharactersFound == 1) { replyMSG2 = "."; - } - else { + } else { replyMSG2 = "s."; } @@ -949,8 +853,7 @@ public class AdminEditChar implements IAdminCommandHandler { if (IpAdress.equals("disconnected")) { findDisconnected = true; - } - else { + } else { if (!IpAdress.matches("^(?:(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2(?:[0-4][0-9]|5[0-5]))\\.){3}(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2(?:[0-4][0-9]|5[0-5]))$")) { throw new IllegalArgumentException("Malformed IPv4 number"); } @@ -972,8 +875,7 @@ public class AdminEditChar implements IAdminCommandHandler { if (!findDisconnected) { continue; } - } - else { + } else { if (findDisconnected) { continue; } @@ -997,15 +899,12 @@ public class AdminEditChar implements IAdminCommandHandler { final String replyMSG2; if (CharactersFound == 0) { replyMSG2 = "s. Maybe they got d/c? :)"; - } - else if (CharactersFound > 20) { + } else if (CharactersFound > 20) { adminReply.replace("%number%", " more than " + String.valueOf(CharactersFound)); replyMSG2 = "s.<br>In order to avoid you a client crash I won't <br1>display results beyond the 20th character."; - } - else if (CharactersFound == 1) { + } else if (CharactersFound == 1) { replyMSG2 = "."; - } - else { + } else { replyMSG2 = "s."; } adminReply.replace("%ip%", IpAdress); @@ -1054,8 +953,7 @@ public class AdminEditChar implements IAdminCommandHandler { Integer count = dualboxIPs.get(ip); if (count == null) { dualboxIPs.put(ip, multibox); - } - else { + } else { dualboxIPs.put(ip, count + 1); } } @@ -1098,8 +996,7 @@ public class AdminEditChar implements IAdminCommandHandler { Integer count = dualboxIPs.get(pack); if (count == null) { dualboxIPs.put(pack, multibox); - } - else { + } else { dualboxIPs.put(pack, count + 1); } } @@ -1160,8 +1057,7 @@ public class AdminEditChar implements IAdminCommandHandler { if (other._ip != null) { return false; } - } - else if (!_ip.equals(other._ip)) { + } else if (!_ip.equals(other._ip)) { return false; } for (int i = 0; i < _tracert.length; i++) { @@ -1197,15 +1093,13 @@ public class AdminEditChar implements IAdminCommandHandler { if (target instanceof L2PetInstance) { int objId = target.getActingPlayer().getObjectId(); html.replace("%inv%", " <a action=\"bypass admin_show_pet_inv " + objId + "\">view</a>"); - } - else { + } else { html.replace("%inv%", "none"); } if (target instanceof L2PetInstance) { html.replace("%food%", ((L2PetInstance) target).getCurrentFed() + "/" + ((L2PetInstance) target).getPetLevelData().getPetMaxFeed()); html.replace("%load%", ((L2PetInstance) target).getInventory().getTotalWeight() + "/" + ((L2PetInstance) target).getMaxLoad()); - } - else { + } else { html.replace("%food%", "N/A"); html.replace("%load%", "N/A"); } @@ -1220,8 +1114,7 @@ public class AdminEditChar implements IAdminCommandHandler { for (L2PcInstance member : target.getParty().getMembers()) { if (color) { text.append("<tr><td><table width=270 border=0 bgcolor=131210 cellpadding=2><tr><td width=30 align=right>"); - } - else { + } else { text.append("<tr><td><table width=270 border=0 cellpadding=2><tr><td width=30 align=right>"); } text.append(member.getLevel() + "</td><td width=130><a action=\"bypass -h admin_character_info " + member.getName() + "\">" + member.getName() + "</a>"); diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminEffects.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminEffects.java index 2faef4075b..56dca5aa33 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminEffects.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminEffects.java @@ -67,10 +67,8 @@ import com.l2jserver.gameserver.util.Util; * <li>play_sound/play_sounds = Music broadcasting related commands * <li>atmosphere = sky change related commands. */ -public class AdminEffects implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminEffects implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_invis", "admin_invisible", "admin_setinvis", @@ -114,23 +112,18 @@ public class AdminEffects implements IAdminCommandHandler }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { StringTokenizer st = new StringTokenizer(command); st.nextToken(); - if (command.equals("admin_invis_menu")) - { - if (!activeChar.isInvisible()) - { + if (command.equals("admin_invis_menu")) { + if (!activeChar.isInvisible()) { activeChar.setInvisible(true); activeChar.broadcastUserInfo(); activeChar.decayMe(); activeChar.spawnMe(); activeChar.sendMessage("You are now invisible."); - } - else - { + } else { activeChar.setInvisible(false); activeChar.broadcastUserInfo(); activeChar.sendMessage("You are now visible."); @@ -138,25 +131,18 @@ public class AdminEffects implements IAdminCommandHandler command = ""; AdminHtml.showAdminHtml(activeChar, "gm_menu.htm"); - } - else if (command.startsWith("admin_invis")) - { + } else if (command.startsWith("admin_invis")) { activeChar.setInvisible(true); activeChar.broadcastUserInfo(); activeChar.decayMe(); activeChar.spawnMe(); activeChar.sendMessage("You are now invisible."); - } - else if (command.startsWith("admin_vis")) - { + } else if (command.startsWith("admin_vis")) { activeChar.setInvisible(false); activeChar.broadcastUserInfo(); activeChar.sendMessage("You are now visible."); - } - else if (command.startsWith("admin_setinvis")) - { - if ((activeChar.getTarget() == null) || !activeChar.getTarget().isCharacter()) - { + } else if (command.startsWith("admin_setinvis")) { + if ((activeChar.getTarget() == null) || !activeChar.getTarget().isCharacter()) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return false; } @@ -164,225 +150,145 @@ public class AdminEffects implements IAdminCommandHandler target.setInvisible(!target.isInvisible()); activeChar.sendMessage("You've made " + target.getName() + " " + (target.isInvisible() ? "invisible" : "visible") + "."); - if (target.isPlayer()) - { + if (target.isPlayer()) { ((L2PcInstance) target).broadcastUserInfo(); } - } - else if (command.startsWith("admin_earthquake")) - { - try - { + } else if (command.startsWith("admin_earthquake")) { + try { String val1 = st.nextToken(); int intensity = Integer.parseInt(val1); String val2 = st.nextToken(); int duration = Integer.parseInt(val2); Earthquake eq = new Earthquake(activeChar.getX(), activeChar.getY(), activeChar.getZ(), intensity, duration); activeChar.broadcastPacket(eq); - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //earthquake <intensity> <duration>"); } - } - else if (command.startsWith("admin_atmosphere")) - { - try - { + } else if (command.startsWith("admin_atmosphere")) { + try { String type = st.nextToken(); String state = st.nextToken(); int duration = Integer.parseInt(st.nextToken()); adminAtmosphere(type, state, duration, activeChar); - } - catch (Exception ex) - { + } catch (Exception ex) { activeChar.sendMessage("Usage: //atmosphere <signsky dawn|dusk>|<sky day|night|red> <duration>"); } - } - else if (command.equals("admin_play_sounds")) - { + } else if (command.equals("admin_play_sounds")) { AdminHtml.showAdminHtml(activeChar, "songs/songs.htm"); - } - else if (command.startsWith("admin_play_sounds")) - { - try - { + } else if (command.startsWith("admin_play_sounds")) { + try { AdminHtml.showAdminHtml(activeChar, "songs/songs" + command.substring(18) + ".htm"); - } - catch (StringIndexOutOfBoundsException e) - { + } catch (StringIndexOutOfBoundsException e) { activeChar.sendMessage("Usage: //play_sounds <pagenumber>"); } - } - else if (command.startsWith("admin_play_sound")) - { - try - { + } else if (command.startsWith("admin_play_sound")) { + try { playAdminSound(activeChar, command.substring(17)); - } - catch (StringIndexOutOfBoundsException e) - { + } catch (StringIndexOutOfBoundsException e) { activeChar.sendMessage("Usage: //play_sound <soundname>"); } - } - else if (command.equals("admin_para_all")) - { - try - { + } else if (command.equals("admin_para_all")) { + try { Collection<L2PcInstance> plrs = activeChar.getKnownList().getKnownPlayers().values(); - for (L2PcInstance player : plrs) - { - if (!player.isGM()) - { + for (L2PcInstance player : plrs) { + if (!player.isGM()) { player.startAbnormalVisualEffect(true, AbnormalVisualEffect.PARALYZE); player.setIsParalyzed(true); player.startParalyze(); } } + } catch (Exception e) { } - catch (Exception e) - { - } - } - else if (command.equals("admin_unpara_all")) - { - try - { + } else if (command.equals("admin_unpara_all")) { + try { Collection<L2PcInstance> plrs = activeChar.getKnownList().getKnownPlayers().values(); - for (L2PcInstance player : plrs) - { + for (L2PcInstance player : plrs) { player.stopAbnormalVisualEffect(true, AbnormalVisualEffect.PARALYZE); player.setIsParalyzed(false); } + } catch (Exception e) { } - catch (Exception e) - { - } - } - else if (command.startsWith("admin_para")) // || command.startsWith("admin_para_menu")) + } else if (command.startsWith("admin_para")) // || command.startsWith("admin_para_menu")) { String type = "1"; - try - { + try { type = st.nextToken(); + } catch (Exception e) { } - catch (Exception e) - { - } - try - { + try { L2Object target = activeChar.getTarget(); L2Character player = null; - if (target instanceof L2Character) - { + if (target instanceof L2Character) { player = (L2Character) target; - if (type.equals("1")) - { + if (type.equals("1")) { player.startAbnormalVisualEffect(true, AbnormalVisualEffect.PARALYZE); - } - else - { + } else { player.startAbnormalVisualEffect(true, AbnormalVisualEffect.FLESH_STONE); } player.setIsParalyzed(true); player.startParalyze(); } + } catch (Exception e) { } - catch (Exception e) - { - } - } - else if (command.startsWith("admin_unpara")) // || command.startsWith("admin_unpara_menu")) + } else if (command.startsWith("admin_unpara")) // || command.startsWith("admin_unpara_menu")) { String type = "1"; - try - { + try { type = st.nextToken(); + } catch (Exception e) { } - catch (Exception e) - { - } - try - { + try { L2Object target = activeChar.getTarget(); L2Character player = null; - if (target instanceof L2Character) - { + if (target instanceof L2Character) { player = (L2Character) target; - if (type.equals("1")) - { + if (type.equals("1")) { player.stopAbnormalVisualEffect(true, AbnormalVisualEffect.PARALYZE); - } - else - { + } else { player.stopAbnormalVisualEffect(true, AbnormalVisualEffect.FLESH_STONE); } player.setIsParalyzed(false); } + } catch (Exception e) { } - catch (Exception e) - { - } - } - else if (command.startsWith("admin_bighead")) - { - try - { + } else if (command.startsWith("admin_bighead")) { + try { L2Object target = activeChar.getTarget(); L2Character player = null; - if (target instanceof L2Character) - { + if (target instanceof L2Character) { player = (L2Character) target; player.startAbnormalVisualEffect(true, AbnormalVisualEffect.BIG_HEAD); } + } catch (Exception e) { } - catch (Exception e) - { - } - } - else if (command.startsWith("admin_shrinkhead")) - { - try - { + } else if (command.startsWith("admin_shrinkhead")) { + try { L2Object target = activeChar.getTarget(); L2Character player = null; - if (target instanceof L2Character) - { + if (target instanceof L2Character) { player = (L2Character) target; player.stopAbnormalVisualEffect(true, AbnormalVisualEffect.BIG_HEAD); } + } catch (Exception e) { } - catch (Exception e) - { - } - } - else if (command.startsWith("admin_gmspeed")) - { - try - { + } else if (command.startsWith("admin_gmspeed")) { + try { int val = Integer.parseInt(st.nextToken()); boolean sendMessage = activeChar.isAffectedBySkill(7029); activeChar.stopSkillEffects((val == 0) && sendMessage, 7029); - if ((val >= 1) && (val <= 4)) - { + if ((val >= 1) && (val <= 4)) { Skill gmSpeedSkill = SkillData.getInstance().getSkill(7029, val); activeChar.doSimultaneousCast(gmSpeedSkill); } - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //gmspeed <value> (0=off...4=max)"); } - if (command.contains("_menu")) - { + if (command.contains("_menu")) { command = ""; AdminHtml.showAdminHtml(activeChar, "gm_menu.htm"); } - } - else if (command.startsWith("admin_polyself")) - { - try - { + } else if (command.startsWith("admin_polyself")) { + try { String id = st.nextToken(); activeChar.getPoly().setPolyInfo("npc", id); activeChar.teleToLocation(activeChar.getLocation()); @@ -391,14 +297,10 @@ public class AdminEffects implements IAdminCommandHandler UserInfo info2 = new UserInfo(activeChar); activeChar.sendPacket(info2); activeChar.broadcastPacket(new ExBrExtraUserInfo(activeChar)); - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //polyself <npcId>"); } - } - else if (command.startsWith("admin_unpolyself")) - { + } else if (command.startsWith("admin_unpolyself")) { activeChar.getPoly().setPolyInfo(null, "1"); activeChar.decayMe(); activeChar.spawnMe(activeChar.getX(), activeChar.getY(), activeChar.getZ()); @@ -407,254 +309,172 @@ public class AdminEffects implements IAdminCommandHandler UserInfo info2 = new UserInfo(activeChar); activeChar.sendPacket(info2); activeChar.broadcastPacket(new ExBrExtraUserInfo(activeChar)); - } - else if (command.equals("admin_clearteams")) - { - try - { + } else if (command.equals("admin_clearteams")) { + try { Collection<L2PcInstance> plrs = activeChar.getKnownList().getKnownPlayers().values(); - for (L2PcInstance player : plrs) - { + for (L2PcInstance player : plrs) { player.setTeam(Team.NONE); player.broadcastUserInfo(); } + } catch (Exception e) { } - catch (Exception e) - { - } - } - else if (command.startsWith("admin_setteam_close")) - { - try - { + } else if (command.startsWith("admin_setteam_close")) { + try { String val = st.nextToken(); int radius = 400; - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { radius = Integer.parseInt(st.nextToken()); } Team team = Team.valueOf(val.toUpperCase()); Collection<L2Character> plrs = activeChar.getKnownList().getKnownCharactersInRadius(radius); - for (L2Character player : plrs) - { + for (L2Character player : plrs) { player.setTeam(team); } - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //setteam_close <none|blue|red> [radius]"); } - } - else if (command.startsWith("admin_setteam")) - { - try - { + } else if (command.startsWith("admin_setteam")) { + try { Team team = Team.valueOf(st.nextToken().toUpperCase()); L2Character target = null; - if (activeChar.getTarget() instanceof L2Character) - { + if (activeChar.getTarget() instanceof L2Character) { target = (L2Character) activeChar.getTarget(); - } - else - { + } else { return false; } target.setTeam(team); - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //setteam <none|blue|red>"); } - } - else if (command.startsWith("admin_social")) - { - try - { + } else if (command.startsWith("admin_social")) { + try { String target = null; L2Object obj = activeChar.getTarget(); - if (st.countTokens() == 2) - { + if (st.countTokens() == 2) { int social = Integer.parseInt(st.nextToken()); target = st.nextToken(); - if (target != null) - { + if (target != null) { L2PcInstance player = L2World.getInstance().getPlayer(target); - if (player != null) - { - if (performSocial(social, player, activeChar)) - { + if (player != null) { + if (performSocial(social, player, activeChar)) { activeChar.sendMessage(player.getName() + " was affected by your request."); } - } - else - { - try - { + } else { + try { int radius = Integer.parseInt(target); Collection<L2Object> objs = activeChar.getKnownList().getKnownObjects().values(); - for (L2Object object : objs) - { - if (activeChar.isInsideRadius(object, radius, false, false)) - { + for (L2Object object : objs) { + if (activeChar.isInsideRadius(object, radius, false, false)) { performSocial(social, object, activeChar); } } activeChar.sendMessage(radius + " units radius affected by your request."); - } - catch (NumberFormatException nbe) - { + } catch (NumberFormatException nbe) { activeChar.sendMessage("Incorrect parameter"); } } } - } - else if (st.countTokens() == 1) - { + } else if (st.countTokens() == 1) { int social = Integer.parseInt(st.nextToken()); - if (obj == null) - { + if (obj == null) { obj = activeChar; } - if (performSocial(social, obj, activeChar)) - { + if (performSocial(social, obj, activeChar)) { activeChar.sendMessage(obj.getName() + " was affected by your request."); - } - else - { + } else { activeChar.sendPacket(SystemMessageId.NOTHING_HAPPENED); } - } - else if (!command.contains("menu")) - { + } else if (!command.contains("menu")) { activeChar.sendMessage("Usage: //social <social_id> [player_name|radius]"); } - } - catch (Exception e) - { - if (general().debug()) - { + } catch (Exception e) { + if (general().debug()) { e.printStackTrace(); } } - } - else if (command.startsWith("admin_ave_abnormal") || command.startsWith("admin_ave_special") || command.startsWith("admin_ave_event")) - { - if (st.countTokens() > 0) - { + } else if (command.startsWith("admin_ave_abnormal") || command.startsWith("admin_ave_special") || command.startsWith("admin_ave_event")) { + if (st.countTokens() > 0) { final String param1 = st.nextToken(); AbnormalVisualEffect ave; - try - { + try { ave = AbnormalVisualEffect.valueOf(param1); - } - catch (Exception e) - { + } catch (Exception e) { return false; } int radius = 0; String param2 = null; - if (st.countTokens() == 1) - { + if (st.countTokens() == 1) { param2 = st.nextToken(); - if (Util.isDigit(param2)) - { + if (Util.isDigit(param2)) { radius = Integer.parseInt(param2); } } - if (radius > 0) - { - for (L2Object object : activeChar.getKnownList().getKnownObjects().values()) - { - if (activeChar.isInsideRadius(object, radius, false, false)) - { + if (radius > 0) { + for (L2Object object : activeChar.getKnownList().getKnownObjects().values()) { + if (activeChar.isInsideRadius(object, radius, false, false)) { performAbnormalVisualEffect(ave, object); } } activeChar.sendMessage("Affected all characters in radius " + param2 + " by " + param1 + " abnormal visual effect."); - } - else - { + } else { final L2Object obj = activeChar.getTarget() != null ? activeChar.getTarget() : activeChar; - if (performAbnormalVisualEffect(ave, obj)) - { + if (performAbnormalVisualEffect(ave, obj)) { activeChar.sendMessage(obj.getName() + " affected by " + param1 + " abnormal visual effect."); - } - else - { + } else { activeChar.sendPacket(SystemMessageId.NOTHING_HAPPENED); } } - } - else - { + } else { activeChar.sendMessage("Usage: //" + command.replace("admin_", "") + " <AbnormalVisualEffect> [radius]"); } - } - else if (command.startsWith("admin_effect")) - { - try - { + } else if (command.startsWith("admin_effect")) { + try { L2Object obj = activeChar.getTarget(); int level = 1, hittime = 1; int skill = Integer.parseInt(st.nextToken()); - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { level = Integer.parseInt(st.nextToken()); } - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { hittime = Integer.parseInt(st.nextToken()); } - if (obj == null) - { + if (obj == null) { obj = activeChar; } - if (!(obj instanceof L2Character)) - { + if (!(obj instanceof L2Character)) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); - } - else - { + } else { L2Character target = (L2Character) obj; target.broadcastPacket(new MagicSkillUse(target, activeChar, skill, level, hittime, 0)); activeChar.sendMessage(obj.getName() + " performs MSU " + skill + "/" + level + " by your request."); } - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //effect skill [level | level hittime]"); } - } - else if (command.startsWith("admin_set_displayeffect")) - { + } else if (command.startsWith("admin_set_displayeffect")) { L2Object target = activeChar.getTarget(); - if (!(target instanceof L2Npc)) - { + if (!(target instanceof L2Npc)) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return false; } L2Npc npc = (L2Npc) target; - try - { + try { String type = st.nextToken(); int diplayeffect = Integer.parseInt(type); npc.setDisplayEffect(diplayeffect); - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //set_displayeffect <id>"); } } - if (command.contains("menu") || command.contains("ave_")) - { + if (command.contains("menu") || command.contains("ave_")) { showMainPage(activeChar, command); } return true; @@ -665,17 +485,12 @@ public class AdminEffects implements IAdminCommandHandler * @param target the target * @return {@code true} if target's abnormal state was affected, {@code false} otherwise. */ - private boolean performAbnormalVisualEffect(AbnormalVisualEffect ave, L2Object target) - { - if (target instanceof L2Character) - { + private boolean performAbnormalVisualEffect(AbnormalVisualEffect ave, L2Object target) { + if (target instanceof L2Character) { final L2Character character = (L2Character) target; - if (character.hasAbnormalVisualEffect(ave)) - { + if (character.hasAbnormalVisualEffect(ave)) { character.stopAbnormalVisualEffect(true, ave); - } - else - { + } else { character.startAbnormalVisualEffect(true, ave); } return true; @@ -683,37 +498,27 @@ public class AdminEffects implements IAdminCommandHandler return false; } - private boolean performSocial(int action, L2Object target, L2PcInstance activeChar) - { - try - { - if (target instanceof L2Character) - { - if (target instanceof L2ChestInstance) - { + private boolean performSocial(int action, L2Object target, L2PcInstance activeChar) { + try { + if (target instanceof L2Character) { + if (target instanceof L2ChestInstance) { activeChar.sendPacket(SystemMessageId.NOTHING_HAPPENED); return false; } - if ((target instanceof L2Npc) && ((action < 1) || (action > 3))) - { + if ((target instanceof L2Npc) && ((action < 1) || (action > 3))) { activeChar.sendPacket(SystemMessageId.NOTHING_HAPPENED); return false; } - if ((target instanceof L2PcInstance) && ((action < 2) || ((action > 18) && (action != SocialAction.LEVEL_UP)))) - { + if ((target instanceof L2PcInstance) && ((action < 2) || ((action > 18) && (action != SocialAction.LEVEL_UP)))) { activeChar.sendPacket(SystemMessageId.NOTHING_HAPPENED); return false; } L2Character character = (L2Character) target; character.broadcastPacket(new SocialAction(character.getObjectId(), action)); - } - else - { + } else { return false; } - } - catch (Exception e) - { + } catch (Exception e) { } return true; } @@ -724,55 +529,36 @@ public class AdminEffects implements IAdminCommandHandler * @param duration * @param activeChar */ - private void adminAtmosphere(String type, String state, int duration, L2PcInstance activeChar) - { + private void adminAtmosphere(String type, String state, int duration, L2PcInstance activeChar) { L2GameServerPacket packet = null; - if (type.equals("signsky")) - { - if (state.equals("dawn")) - { + if (type.equals("signsky")) { + if (state.equals("dawn")) { packet = new SSQInfo(2); - } - else if (state.equals("dusk")) - { + } else if (state.equals("dusk")) { packet = new SSQInfo(1); } - } - else if (type.equals("sky")) - { - if (state.equals("night")) - { + } else if (type.equals("sky")) { + if (state.equals("night")) { packet = SunSet.STATIC_PACKET; - } - else if (state.equals("day")) - { + } else if (state.equals("day")) { packet = SunRise.STATIC_PACKET; - } - else if (state.equals("red")) - { - if (duration != 0) - { + } else if (state.equals("red")) { + if (duration != 0) { packet = new ExRedSky(duration); - } - else - { + } else { packet = new ExRedSky(10); } } - } - else - { + } else { activeChar.sendMessage("Usage: //atmosphere <signsky dawn|dusk>|<sky day|night|red> <duration>"); } - if (packet != null) - { + if (packet != null) { Broadcast.toAllOnlinePlayers(packet); } } - private void playAdminSound(L2PcInstance activeChar, String sound) - { + private void playAdminSound(L2PcInstance activeChar, String sound) { PlaySound _snd = PlaySound.createSound(sound); activeChar.sendPacket(_snd); activeChar.broadcastPacket(_snd); @@ -780,28 +566,19 @@ public class AdminEffects implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } - private void showMainPage(L2PcInstance activeChar, String command) - { + private void showMainPage(L2PcInstance activeChar, String command) { String filename = "effects_menu"; - if (command.contains("ave_abnormal")) - { + if (command.contains("ave_abnormal")) { filename = "ave_abnormal"; - } - else if (command.contains("ave_special")) - { + } else if (command.contains("ave_special")) { filename = "ave_special"; - } - else if (command.contains("ave_event")) - { + } else if (command.contains("ave_event")) { filename = "ave_event"; - } - else if (command.contains("social")) - { + } else if (command.contains("social")) { filename = "social"; } AdminHtml.showAdminHtml(activeChar, filename + ".htm"); diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminElement.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminElement.java index 7e8ddedcb9..4576cd797f 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminElement.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminElement.java @@ -31,10 +31,8 @@ import com.l2jserver.gameserver.network.serverpackets.InventoryUpdate; * This class handles following admin commands: - delete = deletes target * @version $Revision: 1.2.2.1.2.4 $ $Date: 2005/04/11 10:05:56 $ */ -public class AdminElement implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminElement implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_setlh", "admin_setlc", "admin_setll", @@ -45,57 +43,38 @@ public class AdminElement implements IAdminCommandHandler }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { int armorType = -1; - if (command.startsWith("admin_setlh")) - { + if (command.startsWith("admin_setlh")) { armorType = Inventory.PAPERDOLL_HEAD; - } - else if (command.startsWith("admin_setlc")) - { + } else if (command.startsWith("admin_setlc")) { armorType = Inventory.PAPERDOLL_CHEST; - } - else if (command.startsWith("admin_setlg")) - { + } else if (command.startsWith("admin_setlg")) { armorType = Inventory.PAPERDOLL_GLOVES; - } - else if (command.startsWith("admin_setlb")) - { + } else if (command.startsWith("admin_setlb")) { armorType = Inventory.PAPERDOLL_FEET; - } - else if (command.startsWith("admin_setll")) - { + } else if (command.startsWith("admin_setll")) { armorType = Inventory.PAPERDOLL_LEGS; - } - else if (command.startsWith("admin_setlw")) - { + } else if (command.startsWith("admin_setlw")) { armorType = Inventory.PAPERDOLL_RHAND; - } - else if (command.startsWith("admin_setls")) - { + } else if (command.startsWith("admin_setls")) { armorType = Inventory.PAPERDOLL_LHAND; } - if (armorType != -1) - { - try - { + if (armorType != -1) { + try { String[] args = command.split(" "); byte element = Elementals.getElementId(args[1]); int value = Integer.parseInt(args[2]); - if ((element < -1) || (element > 5) || (value < 0) || (value > 450)) - { + if ((element < -1) || (element > 5) || (value < 0) || (value > 450)) { activeChar.sendMessage("Usage: //setlh/setlc/setlg/setlb/setll/setlw/setls <element> <value>[0-450]"); return false; } setElement(activeChar, element, value, armorType); - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //setlh/setlc/setlg/setlb/setll/setlw/setls <element>[0-5] <value>[0-450]"); return false; } @@ -105,26 +84,20 @@ public class AdminElement implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } - private void setElement(L2PcInstance activeChar, byte type, int value, int armorType) - { + private void setElement(L2PcInstance activeChar, byte type, int value, int armorType) { // get the target L2Object target = activeChar.getTarget(); - if (target == null) - { + if (target == null) { target = activeChar; } L2PcInstance player = null; - if (target instanceof L2PcInstance) - { + if (target instanceof L2PcInstance) { player = (L2PcInstance) target; - } - else - { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return; } @@ -133,42 +106,31 @@ public class AdminElement implements IAdminCommandHandler // only attempt to enchant if there is a weapon equipped L2ItemInstance parmorInstance = player.getInventory().getPaperdollItem(armorType); - if ((parmorInstance != null) && (parmorInstance.getLocationSlot() == armorType)) - { + if ((parmorInstance != null) && (parmorInstance.getLocationSlot() == armorType)) { itemInstance = parmorInstance; } - if (itemInstance != null) - { + if (itemInstance != null) { String old, current; Elementals element = itemInstance.getElemental(type); - if (element == null) - { + if (element == null) { old = "None"; - } - else - { + } else { old = element.toString(); } // set enchant value player.getInventory().unEquipItemInSlot(armorType); - if (type == -1) - { + if (type == -1) { itemInstance.clearElementAttr(type); - } - else - { + } else { itemInstance.setElementAttr(type, value); } player.getInventory().equipItem(itemInstance); - if (itemInstance.getElementals() == null) - { + if (itemInstance.getElementals() == null) { current = "None"; - } - else - { + } else { current = itemInstance.getElemental(type).toString(); } @@ -179,8 +141,7 @@ public class AdminElement implements IAdminCommandHandler // informations activeChar.sendMessage("Changed elemental power of " + player.getName() + "'s " + itemInstance.getItem().getName() + " from " + old + " to " + current + "."); - if (player != activeChar) - { + if (player != activeChar) { player.sendMessage(activeChar.getName() + " has changed the elemental power of your " + itemInstance.getItem().getName() + " from " + old + " to " + current + "."); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminEnchant.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminEnchant.java index 053fc9ae27..d496bf4320 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminEnchant.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminEnchant.java @@ -37,130 +37,84 @@ import com.l2jserver.gameserver.network.serverpackets.UserInfo; * This class handles following admin commands: - enchant_armor * @version $Revision: 1.3.2.1.2.10 $ $Date: 2005/08/24 21:06:06 $ */ -public class AdminEnchant implements IAdminCommandHandler -{ +public class AdminEnchant implements IAdminCommandHandler { private static Logger _log = Logger.getLogger(AdminEnchant.class.getName()); - private static final String[] ADMIN_COMMANDS = - { - "admin_seteh",// 6 - "admin_setec",// 10 - "admin_seteg",// 9 - "admin_setel",// 11 - "admin_seteb",// 12 - "admin_setew",// 7 - "admin_setes",// 8 - "admin_setle",// 1 - "admin_setre",// 2 - "admin_setlf",// 4 - "admin_setrf",// 5 - "admin_seten",// 3 - "admin_setun",// 0 - "admin_setba",// 13 + private static final String[] ADMIN_COMMANDS = { + "admin_seteh", // 6 + "admin_setec", // 10 + "admin_seteg", // 9 + "admin_setel", // 11 + "admin_seteb", // 12 + "admin_setew", // 7 + "admin_setes", // 8 + "admin_setle", // 1 + "admin_setre", // 2 + "admin_setlf", // 4 + "admin_setrf", // 5 + "admin_seten", // 3 + "admin_setun", // 0 + "admin_setba", // 13 "admin_setbe", "admin_enchant" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.equals("admin_enchant")) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.equals("admin_enchant")) { showMainPage(activeChar); - } - else - { + } else { int armorType = -1; - if (command.startsWith("admin_seteh")) - { + if (command.startsWith("admin_seteh")) { armorType = Inventory.PAPERDOLL_HEAD; - } - else if (command.startsWith("admin_setec")) - { + } else if (command.startsWith("admin_setec")) { armorType = Inventory.PAPERDOLL_CHEST; - } - else if (command.startsWith("admin_seteg")) - { + } else if (command.startsWith("admin_seteg")) { armorType = Inventory.PAPERDOLL_GLOVES; - } - else if (command.startsWith("admin_seteb")) - { + } else if (command.startsWith("admin_seteb")) { armorType = Inventory.PAPERDOLL_FEET; - } - else if (command.startsWith("admin_setel")) - { + } else if (command.startsWith("admin_setel")) { armorType = Inventory.PAPERDOLL_LEGS; - } - else if (command.startsWith("admin_setew")) - { + } else if (command.startsWith("admin_setew")) { armorType = Inventory.PAPERDOLL_RHAND; - } - else if (command.startsWith("admin_setes")) - { + } else if (command.startsWith("admin_setes")) { armorType = Inventory.PAPERDOLL_LHAND; - } - else if (command.startsWith("admin_setle")) - { + } else if (command.startsWith("admin_setle")) { armorType = Inventory.PAPERDOLL_LEAR; - } - else if (command.startsWith("admin_setre")) - { + } else if (command.startsWith("admin_setre")) { armorType = Inventory.PAPERDOLL_REAR; - } - else if (command.startsWith("admin_setlf")) - { + } else if (command.startsWith("admin_setlf")) { armorType = Inventory.PAPERDOLL_LFINGER; - } - else if (command.startsWith("admin_setrf")) - { + } else if (command.startsWith("admin_setrf")) { armorType = Inventory.PAPERDOLL_RFINGER; - } - else if (command.startsWith("admin_seten")) - { + } else if (command.startsWith("admin_seten")) { armorType = Inventory.PAPERDOLL_NECK; - } - else if (command.startsWith("admin_setun")) - { + } else if (command.startsWith("admin_setun")) { armorType = Inventory.PAPERDOLL_UNDER; - } - else if (command.startsWith("admin_setba")) - { + } else if (command.startsWith("admin_setba")) { armorType = Inventory.PAPERDOLL_CLOAK; - } - else if (command.startsWith("admin_setbe")) - { + } else if (command.startsWith("admin_setbe")) { armorType = Inventory.PAPERDOLL_BELT; } - if (armorType != -1) - { - try - { + if (armorType != -1) { + try { int ench = Integer.parseInt(command.substring(12)); // check value - if ((ench < 0) || (ench > 65535)) - { + if ((ench < 0) || (ench > 65535)) { activeChar.sendMessage("You must set the enchant level to be between 0-65535."); - } - else - { + } else { setEnchant(activeChar, ench, armorType); } - } - catch (StringIndexOutOfBoundsException e) - { - if (general().developer()) - { + } catch (StringIndexOutOfBoundsException e) { + if (general().developer()) { _log.warning("Set enchant error: " + e); } activeChar.sendMessage("Please specify a new enchant value."); - } - catch (NumberFormatException e) - { - if (general().developer()) - { + } catch (NumberFormatException e) { + if (general().developer()) { _log.warning("Set enchant error: " + e); } activeChar.sendMessage("Please specify a valid new enchant value."); @@ -174,21 +128,16 @@ public class AdminEnchant implements IAdminCommandHandler return true; } - private void setEnchant(L2PcInstance activeChar, int ench, int armorType) - { + private void setEnchant(L2PcInstance activeChar, int ench, int armorType) { // get the target L2Object target = activeChar.getTarget(); - if (target == null) - { + if (target == null) { target = activeChar; } L2PcInstance player = null; - if (target instanceof L2PcInstance) - { + if (target instanceof L2PcInstance) { player = (L2PcInstance) target; - } - else - { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return; } @@ -199,13 +148,11 @@ public class AdminEnchant implements IAdminCommandHandler // only attempt to enchant if there is a weapon equipped L2ItemInstance parmorInstance = player.getInventory().getPaperdollItem(armorType); - if ((parmorInstance != null) && (parmorInstance.getLocationSlot() == armorType)) - { + if ((parmorInstance != null) && (parmorInstance.getLocationSlot() == armorType)) { itemInstance = parmorInstance; } - if (itemInstance != null) - { + if (itemInstance != null) { curEnchant = itemInstance.getEnchantLevel(); // set enchant value @@ -227,14 +174,12 @@ public class AdminEnchant implements IAdminCommandHandler } } - private void showMainPage(L2PcInstance activeChar) - { + private void showMainPage(L2PcInstance activeChar) { AdminHtml.showAdminHtml(activeChar, "enchant.htm"); } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminEventEngine.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminEventEngine.java index 35c5783c93..291c402208 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminEventEngine.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminEventEngine.java @@ -49,11 +49,9 @@ import com.l2jserver.gameserver.util.StringUtil; * This class handles following admin commands: - admin = shows menu * @version $Revision: 1.3.2.1.2.4 $ $Date: 2005/04/11 10:06:06 $ */ -public class AdminEventEngine implements IAdminCommandHandler -{ +public class AdminEventEngine implements IAdminCommandHandler { - private static final String[] ADMIN_COMMANDS = - { + private static final String[] ADMIN_COMMANDS = { "admin_event", "admin_event_new", "admin_event_choose", @@ -87,45 +85,31 @@ public class AdminEventEngine implements IAdminCommandHandler private static boolean npcsDeleted = false; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { StringTokenizer st = new StringTokenizer(command); String actualCommand = st.nextToken(); - try - { - if (actualCommand.equals("admin_event")) - { - if (L2Event.eventState != EventState.OFF) - { + try { + if (actualCommand.equals("admin_event")) { + if (L2Event.eventState != EventState.OFF) { showEventControl(activeChar); - } - else - { + } else { showMainPage(activeChar); } - } - else if (actualCommand.equals("admin_event_new")) - { + } else if (actualCommand.equals("admin_event_new")) { showNewEventPage(activeChar); - } - else if (actualCommand.startsWith("admin_add")) - { + } else if (actualCommand.startsWith("admin_add")) { // There is an exception here for not using the ST. We use spaces (ST delim) for the event info. tempBuffer += command.substring(10); showNewEventPage(activeChar); - } - else if (actualCommand.startsWith("admin_event_see")) - { + } else if (actualCommand.startsWith("admin_event_see")) { // There is an exception here for not using the ST. We use spaces (ST delim) for the event name. String eventName = command.substring(16); - try - { + try { final NpcHtmlMessage adminReply = new NpcHtmlMessage(); try (FileInputStream fis = new FileInputStream(server().getDatapackRoot() + "/data/events/" + eventName); InputStreamReader isr = new InputStreamReader(fis); - BufferedReader br = new BufferedReader(isr)) - { + BufferedReader br = new BufferedReader(isr)) { adminReply.setFile("en", "data/html/mods/EventEngine/Participation.htm"); adminReply.replace("%eventName%", eventName); adminReply.replace("%eventCreator%", br.readLine()); @@ -134,73 +118,50 @@ public class AdminEventEngine implements IAdminCommandHandler adminReply.replace("button value=\"Participate\"", "button value=\"Back\""); activeChar.sendPacket(adminReply); } - } - catch (Exception e) - { + } catch (Exception e) { e.printStackTrace(); } - } - else if (actualCommand.startsWith("admin_event_del")) - { + } else if (actualCommand.startsWith("admin_event_del")) { // There is an exception here for not using the ST. We use spaces (ST delim) for the event name. String eventName = command.substring(16); File file = new File(server().getDatapackRoot() + "/data/events/" + eventName); file.delete(); showMainPage(activeChar); - } - else if (actualCommand.startsWith("admin_event_name")) - { + } else if (actualCommand.startsWith("admin_event_name")) { // There is an exception here for not using the ST. We use spaces (ST delim) for the event name. tempName += command.substring(17); showNewEventPage(activeChar); - } - else if (actualCommand.equalsIgnoreCase("admin_delete_buffer")) - { + } else if (actualCommand.equalsIgnoreCase("admin_delete_buffer")) { tempBuffer = ""; showNewEventPage(activeChar); - } - else if (actualCommand.startsWith("admin_event_store")) - { - try - { + } else if (actualCommand.startsWith("admin_event_store")) { + try { try (FileOutputStream file = new FileOutputStream(new File(server().getDatapackRoot(), "data/events/" + tempName)); - PrintStream p = new PrintStream(file)) - { + PrintStream p = new PrintStream(file)) { p.println(activeChar.getName()); p.println(tempBuffer); } - } - catch (Exception e) - { + } catch (Exception e) { e.printStackTrace(); } tempBuffer = ""; tempName = ""; showMainPage(activeChar); - } - else if (actualCommand.startsWith("admin_event_set")) - { + } else if (actualCommand.startsWith("admin_event_set")) { // There is an exception here for not using the ST. We use spaces (ST delim) for the event name. L2Event._eventName = command.substring(16); showEventParameters(activeChar, 2); - } - else if (actualCommand.startsWith("admin_event_change_teams_number")) - { + } else if (actualCommand.startsWith("admin_event_change_teams_number")) { showEventParameters(activeChar, Integer.parseInt(st.nextToken())); - } - else if (actualCommand.startsWith("admin_event_panel")) - { + } else if (actualCommand.startsWith("admin_event_panel")) { showEventControl(activeChar); - } - else if (actualCommand.startsWith("admin_event_announce")) - { + } else if (actualCommand.startsWith("admin_event_announce")) { L2Event._npcId = Integer.parseInt(st.nextToken()); L2Event._teamsNumber = Integer.parseInt(st.nextToken()); String temp = " "; String temp2 = ""; - while (st.hasMoreElements()) - { + while (st.hasMoreElements()) { temp += st.nextToken() + " "; } @@ -208,11 +169,9 @@ public class AdminEventEngine implements IAdminCommandHandler Integer i = 1; - while (st.hasMoreElements()) - { + while (st.hasMoreElements()) { temp2 = st.nextToken(); - if (!temp2.equals(" ")) - { + if (!temp2.equals(" ")) { L2Event._teamNames.put(i++, temp2.substring(1, temp2.length() - 1)); } } @@ -229,77 +188,56 @@ public class AdminEventEngine implements IAdminCommandHandler final String replyMSG = StringUtil.concat("<html><title>[ L2J EVENT ENGINE ]</title><body><br>", "<center>The event <font color=\"LEVEL\">", L2Event._eventName, "</font> has been announced, now you can type //event_panel to see the event panel control</center><br>", "</body></html>"); adminReply.setHtml(replyMSG); activeChar.sendPacket(adminReply); - } - else if (actualCommand.startsWith("admin_event_control_begin")) - { + } else if (actualCommand.startsWith("admin_event_control_begin")) { // Starts the event and sends a message of the result activeChar.sendMessage(L2Event.startEvent()); showEventControl(activeChar); - } - else if (actualCommand.startsWith("admin_event_control_finish")) - { + } else if (actualCommand.startsWith("admin_event_control_finish")) { // Finishes the event and sends a message of the result activeChar.sendMessage(L2Event.finishEvent()); - } - else if (actualCommand.startsWith("admin_event_control_teleport")) - { + } else if (actualCommand.startsWith("admin_event_control_teleport")) { while (st.hasMoreElements()) // Every next ST should be a team number { int teamId = Integer.parseInt(st.nextToken()); - for (L2PcInstance player : L2Event._teams.get(teamId)) - { + for (L2PcInstance player : L2Event._teams.get(teamId)) { player.setTitle(L2Event._teamNames.get(teamId)); player.teleToLocation(activeChar.getLocation(), true); player.setInstanceId(activeChar.getInstanceId()); } } showEventControl(activeChar); - } - else if (actualCommand.startsWith("admin_event_control_sit")) - { + } else if (actualCommand.startsWith("admin_event_control_sit")) { while (st.hasMoreElements()) // Every next ST should be a team number { // Integer.parseInt(st.nextToken()) == teamId - for (L2PcInstance player : L2Event._teams.get(Integer.parseInt(st.nextToken()))) - { - if (player.getEventStatus() == null) - { + for (L2PcInstance player : L2Event._teams.get(Integer.parseInt(st.nextToken()))) { + if (player.getEventStatus() == null) { continue; } player.getEventStatus().setSitForced(!player.getEventStatus().isSitForced()); - if (player.getEventStatus().isSitForced()) - { + if (player.getEventStatus().isSitForced()) { player.sitDown(); - } - else - { + } else { player.standUp(); } } } showEventControl(activeChar); - } - else if (actualCommand.startsWith("admin_event_control_kill")) - { + } else if (actualCommand.startsWith("admin_event_control_kill")) { while (st.hasMoreElements()) // Every next ST should be a team number { - for (L2PcInstance player : L2Event._teams.get(Integer.parseInt(st.nextToken()))) - { + for (L2PcInstance player : L2Event._teams.get(Integer.parseInt(st.nextToken()))) { player.reduceCurrentHp(player.getMaxHp() + player.getMaxCp() + 1, activeChar, null); } } showEventControl(activeChar); - } - else if (actualCommand.startsWith("admin_event_control_res")) - { + } else if (actualCommand.startsWith("admin_event_control_res")) { while (st.hasMoreElements()) // Every next ST should be a team number { - for (L2PcInstance player : L2Event._teams.get(Integer.parseInt(st.nextToken()))) - { - if ((player == null) || !player.isDead()) - { + for (L2PcInstance player : L2Event._teams.get(Integer.parseInt(st.nextToken()))) { + if ((player == null) || !player.isDead()) { continue; } player.restoreExp(100.0); @@ -309,9 +247,7 @@ public class AdminEventEngine implements IAdminCommandHandler } } showEventControl(activeChar); - } - else if (actualCommand.startsWith("admin_event_control_poly")) - { + } else if (actualCommand.startsWith("admin_event_control_poly")) { int teamId = Integer.parseInt(st.nextToken()); String[] polyIds = new String[st.countTokens()]; int i = 0; @@ -320,8 +256,7 @@ public class AdminEventEngine implements IAdminCommandHandler polyIds[i++] = st.nextToken(); } - for (L2PcInstance player : L2Event._teams.get(teamId)) - { + for (L2PcInstance player : L2Event._teams.get(teamId)) { player.getPoly().setPolyInfo("npc", polyIds[Rnd.get(polyIds.length)]); player.teleToLocation(player.getLocation(), true); CharInfo info1 = new CharInfo(player); @@ -331,13 +266,10 @@ public class AdminEventEngine implements IAdminCommandHandler player.broadcastPacket(new ExBrExtraUserInfo(player)); } showEventControl(activeChar); - } - else if (actualCommand.startsWith("admin_event_control_unpoly")) - { + } else if (actualCommand.startsWith("admin_event_control_unpoly")) { while (st.hasMoreElements()) // Every next ST should be a team number { - for (L2PcInstance player : L2Event._teams.get(Integer.parseInt(st.nextToken()))) - { + for (L2PcInstance player : L2Event._teams.get(Integer.parseInt(st.nextToken()))) { player.getPoly().setPolyInfo(null, "1"); player.decayMe(); player.spawnMe(player.getX(), player.getY(), player.getZ()); @@ -349,9 +281,7 @@ public class AdminEventEngine implements IAdminCommandHandler } } showEventControl(activeChar); - } - else if (actualCommand.startsWith("admin_event_control_transform")) - { + } else if (actualCommand.startsWith("admin_event_control_transform")) { int teamId = Integer.parseInt(st.nextToken()); int[] transIds = new int[st.countTokens()]; int i = 0; @@ -360,51 +290,37 @@ public class AdminEventEngine implements IAdminCommandHandler transIds[i++] = Integer.parseInt(st.nextToken()); } - for (L2PcInstance player : L2Event._teams.get(teamId)) - { + for (L2PcInstance player : L2Event._teams.get(teamId)) { int transId = transIds[Rnd.get(transIds.length)]; - if (!TransformData.getInstance().transformPlayer(transId, player)) - { + if (!TransformData.getInstance().transformPlayer(transId, player)) { AdminData.getInstance().broadcastMessageToGMs("EventEngine: Unknow transformation id: " + transId); } } showEventControl(activeChar); - } - else if (actualCommand.startsWith("admin_event_control_untransform")) - { + } else if (actualCommand.startsWith("admin_event_control_untransform")) { while (st.hasMoreElements()) // Every next ST should be a team number { - for (L2PcInstance player : L2Event._teams.get(Integer.parseInt(st.nextToken()))) - { + for (L2PcInstance player : L2Event._teams.get(Integer.parseInt(st.nextToken()))) { player.stopTransformation(true); } } showEventControl(activeChar); - } - else if (actualCommand.startsWith("admin_event_control_kick")) - { + } else if (actualCommand.startsWith("admin_event_control_kick")) { if (st.hasMoreElements()) // If has next token, it should be player name. { - while (st.hasMoreElements()) - { + while (st.hasMoreElements()) { L2PcInstance player = L2World.getInstance().getPlayer(st.nextToken()); - if (player != null) - { + if (player != null) { L2Event.removeAndResetPlayer(player); } } - } - else - { - if ((activeChar.getTarget() != null) && (activeChar.getTarget() instanceof L2PcInstance)) - { + } else { + if ((activeChar.getTarget() != null) && (activeChar.getTarget() instanceof L2PcInstance)) { L2Event.removeAndResetPlayer((L2PcInstance) activeChar.getTarget()); } } showEventControl(activeChar); - } - else if (actualCommand.startsWith("admin_event_control_prize")) - { + } else if (actualCommand.startsWith("admin_event_control_prize")) { int[] teamIds = new int[st.countTokens() - 2]; int i = 0; while ((st.countTokens() - 2) > 0) // The last 2 tokens are used for "n" and "item id" @@ -415,15 +331,12 @@ public class AdminEventEngine implements IAdminCommandHandler String[] n = st.nextToken().split("\\*"); int itemId = Integer.parseInt(st.nextToken()); - for (int teamId : teamIds) - { + for (int teamId : teamIds) { rewardTeam(activeChar, teamId, Integer.parseInt(n[0]), itemId, n.length == 2 ? n[1] : ""); } showEventControl(activeChar); } - } - catch (Exception e) - { + } catch (Exception e) { e.printStackTrace(); AdminData.getInstance().broadcastMessageToGMs("EventEngine: Error! Possible blank boxes while executing a command which requires a value in the box?"); } @@ -431,29 +344,22 @@ public class AdminEventEngine implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } - private String showStoredEvents() - { + private String showStoredEvents() { final File dir = new File(server().getDatapackRoot(), "/data/events"); - if (dir.isFile()) - { + if (dir.isFile()) { return "<font color=\"FF0000\">The directory '" + dir.getAbsolutePath() + "' is a file or is corrupted!</font><br>"; } String note = ""; - if (!dir.exists()) - { + if (!dir.exists()) { note = "<font color=\"FF0000\">The directory '" + dir.getAbsolutePath() + "' does not exist!</font><br><font color=\"0099FF\">Trying to create it now...<br></font><br>"; - if (dir.mkdirs()) - { + if (dir.mkdirs()) { note += "<font color=\"006600\">The directory '" + dir.getAbsolutePath() + "' has been created!</font><br>"; - } - else - { + } else { note += "<font color=\"FF0000\">The directory '" + dir.getAbsolutePath() + "' hasn't been created!</font><br>"; return note; } @@ -462,8 +368,7 @@ public class AdminEventEngine implements IAdminCommandHandler final String[] files = dir.list(); final StringBuilder result = new StringBuilder(files.length * 500); result.append("<table>"); - for (String fileName : files) - { + for (String fileName : files) { StringUtil.append(result, "<tr><td align=center>", fileName, " </td></tr><tr><td><table cellspacing=0><tr><td><button value=\"Select Event\" action=\"bypass -h admin_event_set ", fileName, "\" width=90 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><button value=\"View Event\" action=\"bypass -h admin_event_see ", fileName, "\" width=90 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><button value=\"Delete Event\" action=\"bypass -h admin_event_del ", fileName, "\" width=90 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table></td></tr>", "<tr><td> </td></tr><tr><td> </td></tr>"); } @@ -472,8 +377,7 @@ public class AdminEventEngine implements IAdminCommandHandler return note + result.toString(); } - public void showMainPage(L2PcInstance activeChar) - { + public void showMainPage(L2PcInstance activeChar) { final NpcHtmlMessage adminReply = new NpcHtmlMessage(); final String replyMSG = StringUtil.concat("<html><title>[ L2J EVENT ENGINE ]</title><body>" + "<br><center><button value=\"Create NEW event \" action=\"bypass -h admin_event_new\" width=150 height=32 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" @@ -482,38 +386,30 @@ public class AdminEventEngine implements IAdminCommandHandler activeChar.sendPacket(adminReply); } - public void showNewEventPage(L2PcInstance activeChar) - { + public void showNewEventPage(L2PcInstance activeChar) { final NpcHtmlMessage adminReply = new NpcHtmlMessage(); final StringBuilder replyMSG = StringUtil.startAppend(500, "<html><title>[ L2J EVENT ENGINE ]</title><body><br><br><center><font color=LEVEL>Event name:</font><br>"); - if (tempName.isEmpty()) - { + if (tempName.isEmpty()) { replyMSG.append("You can also use //event_name text to insert a new title"); replyMSG.append("<center><multiedit var=\"name\" width=260 height=24> <button value=\"Set Event Name\" action=\"bypass -h admin_event_name $name\" width=120 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); - } - else - { + } else { replyMSG.append(tempName); } replyMSG.append("<br><br><font color=LEVEL>Event description:</font><br></center>"); - if (tempBuffer.isEmpty()) - { + if (tempBuffer.isEmpty()) { replyMSG.append("You can also use //add text to add text or //delete_buffer to remove the text."); - } - else - { + } else { replyMSG.append(tempBuffer); } replyMSG.append("<center><multiedit var=\"txt\" width=270 height=100> <button value=\"Add text\" action=\"bypass -h admin_add $txt\" width=120 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); replyMSG.append("<button value=\"Remove text\" action=\"bypass -h admin_delete_buffer\" width=120 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); - if (!(tempName.isEmpty() && tempBuffer.isEmpty())) - { + if (!(tempName.isEmpty() && tempBuffer.isEmpty())) { replyMSG.append("<br><button value=\"Store Event Data\" action=\"bypass -h admin_event_store\" width=160 height=32 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); } @@ -523,8 +419,7 @@ public class AdminEventEngine implements IAdminCommandHandler activeChar.sendPacket(adminReply); } - public void showEventParameters(L2PcInstance activeChar, int teamnumbers) - { + public void showEventParameters(L2PcInstance activeChar, int teamnumbers) { final NpcHtmlMessage adminReply = new NpcHtmlMessage(); StringBuilder sb = new StringBuilder(); @@ -560,8 +455,7 @@ public class AdminEventEngine implements IAdminCommandHandler activeChar.sendPacket(adminReply); } - private void showEventControl(L2PcInstance activeChar) - { + private void showEventControl(L2PcInstance activeChar) { final NpcHtmlMessage adminReply = new NpcHtmlMessage(); StringBuilder sb = new StringBuilder(); @@ -569,8 +463,7 @@ public class AdminEventEngine implements IAdminCommandHandler sb.append(L2Event._eventName); sb.append("</font></center><br><table cellspacing=-1 width=280><tr><td align=center>Type the team ID(s) that will be affected by the commands. Commands with '*' work with only 1 team ID in the field, while '!' - none.</td></tr><tr><td align=center><edit var=\"team_number\" width=100 height=15></td></tr>"); sb.append("<tr><td> </td></tr><tr><td><table width=200>"); - if (!npcsDeleted) - { + if (!npcsDeleted) { sb.append("<tr><td><button value=\"Start!\" action=\"bypass -h admin_event_control_begin\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Destroys all event npcs so no more people can't participate now on</font></td></tr>"); } @@ -600,21 +493,14 @@ public class AdminEventEngine implements IAdminCommandHandler activeChar.sendPacket(adminReply); } - private void rewardTeam(L2PcInstance activeChar, int team, int n, int id, String type) - { + private void rewardTeam(L2PcInstance activeChar, int team, int n, int id, String type) { int num = n; - for (L2PcInstance player : L2Event._teams.get(team)) - { - if (type.equalsIgnoreCase("level")) - { + for (L2PcInstance player : L2Event._teams.get(team)) { + if (type.equalsIgnoreCase("level")) { num = n * player.getLevel(); - } - else if (type.equalsIgnoreCase("kills") && (player.getEventStatus() != null)) - { + } else if (type.equalsIgnoreCase("kills") && (player.getEventStatus() != null)) { num = n * player.getEventStatus().getKills().size(); - } - else - { + } else { num = n; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminEvents.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminEvents.java index 5053197914..baafed8c8b 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminEvents.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminEvents.java @@ -28,10 +28,8 @@ import com.l2jserver.gameserver.model.quest.Quest; import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; import com.l2jserver.gameserver.util.StringUtil; -public class AdminEvents implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminEvents implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_event_menu", "admin_event_start", "admin_event_stop", @@ -41,16 +39,13 @@ public class AdminEvents implements IAdminCommandHandler }; @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (activeChar == null) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (activeChar == null) { return false; } @@ -58,31 +53,23 @@ public class AdminEvents implements IAdminCommandHandler String _event_bypass = ""; StringTokenizer st = new StringTokenizer(command, " "); st.nextToken(); - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { event_name = st.nextToken(); } - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { _event_bypass = st.nextToken(); } - if (command.contains("_menu")) - { + if (command.contains("_menu")) { showMenu(activeChar); } - if (command.startsWith("admin_event_start")) - { - try - { - if (event_name != null) - { + if (command.startsWith("admin_event_start")) { + try { + if (event_name != null) { Event event = (Event) QuestManager.getInstance().getQuest(event_name); - if (event != null) - { - if (event.eventStart(activeChar)) - { + if (event != null) { + if (event.eventStart(activeChar)) { activeChar.sendMessage("Event " + event_name + " started."); return true; } @@ -91,25 +78,17 @@ public class AdminEvents implements IAdminCommandHandler return true; } } - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //event_start <eventname>"); e.printStackTrace(); return false; } - } - else if (command.startsWith("admin_event_stop")) - { - try - { - if (event_name != null) - { + } else if (command.startsWith("admin_event_stop")) { + try { + if (event_name != null) { Event event = (Event) QuestManager.getInstance().getQuest(event_name); - if (event != null) - { - if (event.eventStop()) - { + if (event != null) { + if (event.eventStop()) { activeChar.sendMessage("Event " + event_name + " stopped."); return true; } @@ -118,29 +97,20 @@ public class AdminEvents implements IAdminCommandHandler return true; } } - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //event_start <eventname>"); e.printStackTrace(); return false; } - } - else if (command.startsWith("admin_event_bypass")) - { - try - { - if (event_name != null) - { + } else if (command.startsWith("admin_event_bypass")) { + try { + if (event_name != null) { Event event = (Event) QuestManager.getInstance().getQuest(event_name); - if (event != null) - { + if (event != null) { event.eventBypass(activeChar, _event_bypass); } } - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //event_bypass <eventname> <bypass>"); e.printStackTrace(); return false; @@ -149,16 +119,16 @@ public class AdminEvents implements IAdminCommandHandler return false; } - private void showMenu(L2PcInstance activeChar) - { + private void showMenu(L2PcInstance activeChar) { final NpcHtmlMessage html = new NpcHtmlMessage(); html.setFile(activeChar.getHtmlPrefix(), "data/html/admin/gm_events.htm"); final StringBuilder cList = new StringBuilder(500); - for (Quest event : QuestManager.getInstance().getScripts().values()) - { - if (event instanceof Event) - { - StringUtil.append(cList, "<font color=\"LEVEL\">" + event.getName() + ":</font><br1>", "<table width=270><tr>", "<td><button value=\"Start\" action=\"bypass -h admin_event_start_menu " + event.getName() + "\" width=80 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>", "<td><button value=\"Stop\" action=\"bypass -h admin_event_stop_menu " + event.getName() + "\" width=80 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>", "<td><button value=\"Menu\" action=\"bypass -h admin_event_bypass " + event.getName() + "\" width=80 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>", "</tr></table><br>"); + for (Quest event : QuestManager.getInstance().getScripts().values()) { + if (event instanceof Event) { + StringUtil.append(cList, "<font color=\"LEVEL\">" + event.getName() + ":</font><br1>", "<table width=270><tr>", "<td><button value=\"Start\" action=\"bypass -h admin_event_start_menu " + event.getName() + + "\" width=80 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>", "<td><button value=\"Stop\" action=\"bypass -h admin_event_stop_menu " + event.getName() + + "\" width=80 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>", "<td><button value=\"Menu\" action=\"bypass -h admin_event_bypass " + event.getName() + + "\" width=80 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>", "</tr></table><br>"); } } html.replace("%LIST%", cList.toString()); diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminExpSp.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminExpSp.java index 39cce837d2..e52222b8dc 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminExpSp.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminExpSp.java @@ -37,47 +37,33 @@ import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; * <li>remove_exp_sp exp sp <i>Removes exp & sp from target, displays menu if a parameter is missing</i> * @version $Revision: 1.2.4.6 $ $Date: 2005/04/11 10:06:06 $ */ -public class AdminExpSp implements IAdminCommandHandler -{ +public class AdminExpSp implements IAdminCommandHandler { private static Logger _log = Logger.getLogger(AdminExpSp.class.getName()); - private static final String[] ADMIN_COMMANDS = - { + private static final String[] ADMIN_COMMANDS = { "admin_add_exp_sp_to_character", "admin_add_exp_sp", "admin_remove_exp_sp" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.startsWith("admin_add_exp_sp")) - { - try - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.startsWith("admin_add_exp_sp")) { + try { String val = command.substring(16); - if (!adminAddExpSp(activeChar, val)) - { + if (!adminAddExpSp(activeChar, val)) { activeChar.sendMessage("Usage: //add_exp_sp exp sp"); } - } - catch (StringIndexOutOfBoundsException e) - { // Case of missing parameter + } catch (StringIndexOutOfBoundsException e) { // Case of missing parameter activeChar.sendMessage("Usage: //add_exp_sp exp sp"); } - } - else if (command.startsWith("admin_remove_exp_sp")) - { - try - { + } else if (command.startsWith("admin_remove_exp_sp")) { + try { String val = command.substring(19); - if (!adminRemoveExpSP(activeChar, val)) - { + if (!adminRemoveExpSP(activeChar, val)) { activeChar.sendMessage("Usage: //remove_exp_sp exp sp"); } - } - catch (StringIndexOutOfBoundsException e) - { // Case of missing parameter + } catch (StringIndexOutOfBoundsException e) { // Case of missing parameter activeChar.sendMessage("Usage: //remove_exp_sp exp sp"); } } @@ -86,21 +72,16 @@ public class AdminExpSp implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } - private void addExpSp(L2PcInstance activeChar) - { + private void addExpSp(L2PcInstance activeChar) { L2Object target = activeChar.getTarget(); L2PcInstance player = null; - if (target instanceof L2PcInstance) - { + if (target instanceof L2PcInstance) { player = (L2PcInstance) target; - } - else - { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return; } @@ -114,22 +95,17 @@ public class AdminExpSp implements IAdminCommandHandler activeChar.sendPacket(adminReply); } - private boolean adminAddExpSp(L2PcInstance activeChar, String ExpSp) - { + private boolean adminAddExpSp(L2PcInstance activeChar, String ExpSp) { L2Object target = activeChar.getTarget(); L2PcInstance player = null; - if (target instanceof L2PcInstance) - { + if (target instanceof L2PcInstance) { player = (L2PcInstance) target; - } - else - { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return false; } StringTokenizer st = new StringTokenizer(ExpSp); - if (st.countTokens() != 2) - { + if (st.countTokens() != 2) { return false; } @@ -137,47 +113,37 @@ public class AdminExpSp implements IAdminCommandHandler String sp = st.nextToken(); long expval = 0; int spval = 0; - try - { + try { expval = Long.parseLong(exp); spval = Integer.parseInt(sp); - } - catch (Exception e) - { + } catch (Exception e) { return false; } - if ((expval != 0) || (spval != 0)) - { + if ((expval != 0) || (spval != 0)) { // Common character information player.sendMessage("Admin is adding you " + expval + " xp and " + spval + " sp."); player.addExpAndSp(expval, spval); player.broadcastUserInfo(); // Admin information activeChar.sendMessage("Added " + expval + " xp and " + spval + " sp to " + player.getName() + "."); - if (general().debug()) - { + if (general().debug()) { _log.fine("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") added " + expval + " xp and " + spval + " sp to " + player.getObjectId() + "."); } } return true; } - private boolean adminRemoveExpSP(L2PcInstance activeChar, String ExpSp) - { + private boolean adminRemoveExpSP(L2PcInstance activeChar, String ExpSp) { L2Object target = activeChar.getTarget(); L2PcInstance player = null; - if (target instanceof L2PcInstance) - { + if (target instanceof L2PcInstance) { player = (L2PcInstance) target; - } - else - { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return false; } StringTokenizer st = new StringTokenizer(ExpSp); - if (st.countTokens() != 2) - { + if (st.countTokens() != 2) { return false; } @@ -185,25 +151,20 @@ public class AdminExpSp implements IAdminCommandHandler String sp = st.nextToken(); long expval = 0; int spval = 0; - try - { + try { expval = Long.parseLong(exp); spval = Integer.parseInt(sp); - } - catch (Exception e) - { + } catch (Exception e) { return false; } - if ((expval != 0) || (spval != 0)) - { + if ((expval != 0) || (spval != 0)) { // Common character information player.sendMessage("Admin is removing you " + expval + " xp and " + spval + " sp."); player.removeExpAndSp(expval, spval); player.broadcastUserInfo(); // Admin information activeChar.sendMessage("Removed " + expval + " xp and " + spval + " sp from " + player.getName() + "."); - if (general().debug()) - { + if (general().debug()) { _log.fine("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") removed " + expval + " xp and " + spval + " sp from " + player.getObjectId() + "."); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminFightCalculator.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminFightCalculator.java index 8f3ec36ab2..98e45e0287 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminFightCalculator.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminFightCalculator.java @@ -36,10 +36,8 @@ import com.l2jserver.gameserver.util.StringUtil; * This class handles following admin commands: - gm = turns gm mode on/off * @version $Revision: 1.1.2.1 $ $Date: 2005/03/15 21:32:48 $ */ -public class AdminFightCalculator implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminFightCalculator implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_fight_calculator", "admin_fight_calculator_show", "admin_fcs", @@ -47,75 +45,57 @@ public class AdminFightCalculator implements IAdminCommandHandler // TODO: remove from gm list etc etc @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - try - { - if (command.startsWith("admin_fight_calculator_show")) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + try { + if (command.startsWith("admin_fight_calculator_show")) { handleShow(command.substring("admin_fight_calculator_show".length()), activeChar); - } - else if (command.startsWith("admin_fcs")) - { + } else if (command.startsWith("admin_fcs")) { handleShow(command.substring("admin_fcs".length()), activeChar); - } - else if (command.startsWith("admin_fight_calculator")) - { + } else if (command.startsWith("admin_fight_calculator")) { handleStart(command.substring("admin_fight_calculator".length()), activeChar); } - } - catch (StringIndexOutOfBoundsException e) - { + } catch (StringIndexOutOfBoundsException e) { } return true; } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } - private void handleStart(String params, L2PcInstance activeChar) - { + private void handleStart(String params, L2PcInstance activeChar) { StringTokenizer st = new StringTokenizer(params); int lvl1 = 0; int lvl2 = 0; int mid1 = 0; int mid2 = 0; - while (st.hasMoreTokens()) - { + while (st.hasMoreTokens()) { String s = st.nextToken(); - if (s.equals("lvl1")) - { + if (s.equals("lvl1")) { lvl1 = Integer.parseInt(st.nextToken()); continue; } - if (s.equals("lvl2")) - { + if (s.equals("lvl2")) { lvl2 = Integer.parseInt(st.nextToken()); continue; } - if (s.equals("mid1")) - { + if (s.equals("mid1")) { mid1 = Integer.parseInt(st.nextToken()); continue; } - if (s.equals("mid2")) - { + if (s.equals("mid2")) { mid2 = Integer.parseInt(st.nextToken()); continue; } } L2NpcTemplate npc1 = null; - if (mid1 != 0) - { + if (mid1 != 0) { npc1 = NpcData.getInstance().getTemplate(mid1); } L2NpcTemplate npc2 = null; - if (mid2 != 0) - { + if (mid2 != 0) { npc2 = NpcData.getInstance().getTemplate(mid2); } @@ -123,40 +103,31 @@ public class AdminFightCalculator implements IAdminCommandHandler final String replyMSG; - if ((npc1 != null) && (npc2 != null)) - { + if ((npc1 != null) && (npc2 != null)) { replyMSG = StringUtil.concat("<html><title>Selected mobs to fight</title>" + "<body>" + "<table>" + "<tr><td>First</td><td>Second</td></tr>" + "<tr><td>level ", String.valueOf(lvl1), "</td><td>level ", String.valueOf(lvl2), "</td></tr>" + "<tr><td>id ", String.valueOf(npc1.getId()), "</td><td>id ", String.valueOf(npc2.getId()), "</td></tr>" + "<tr><td>", npc1.getName(), "</td><td>", npc2.getName(), "</td></tr>" + "</table>" + "<center><br><br><br>" + "<button value=\"OK\" action=\"bypass -h admin_fight_calculator_show ", String.valueOf(npc1.getId()), " ", String.valueOf(npc2.getId()), "\" width=100 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "</center>" + "</body></html>"); - } - else if ((lvl1 != 0) && (npc1 == null)) - { + } else if ((lvl1 != 0) && (npc1 == null)) { final List<L2NpcTemplate> npcs = NpcData.getInstance().getAllOfLevel(lvl1); final StringBuilder sb = StringUtil.startAppend(50 + (npcs.size() * 200), "<html><title>Select first mob to fight</title>" + "<body><table>"); - for (L2NpcTemplate n : npcs) - { + for (L2NpcTemplate n : npcs) { StringUtil.append(sb, "<tr><td><a action=\"bypass -h admin_fight_calculator lvl1 ", String.valueOf(lvl1), " lvl2 ", String.valueOf(lvl2), " mid1 ", String.valueOf(n.getId()), " mid2 ", String.valueOf(mid2), "\">", n.getName(), "</a></td></tr>"); } sb.append("</table></body></html>"); replyMSG = sb.toString(); - } - else if ((lvl2 != 0) && (npc2 == null)) - { + } else if ((lvl2 != 0) && (npc2 == null)) { final List<L2NpcTemplate> npcs = NpcData.getInstance().getAllOfLevel(lvl2); final StringBuilder sb = StringUtil.startAppend(50 + (npcs.size() * 200), "<html><title>Select second mob to fight</title>" + "<body><table>"); - for (L2NpcTemplate n : npcs) - { + for (L2NpcTemplate n : npcs) { StringUtil.append(sb, "<tr><td><a action=\"bypass -h admin_fight_calculator lvl1 ", String.valueOf(lvl1), " lvl2 ", String.valueOf(lvl2), " mid1 ", String.valueOf(mid1), " mid2 ", String.valueOf(n.getId()), "\">", n.getName(), "</a></td></tr>"); } sb.append("</table></body></html>"); replyMSG = sb.toString(); - } - else - { + } else { replyMSG = "<html><title>Select mobs to fight</title>" + "<body>" + "<table>" + "<tr><td>First</td><td>Second</td></tr>" + "<tr><td><edit var=\"lvl1\" width=80></td><td><edit var=\"lvl2\" width=80></td></tr>" + "</table>" + "<center><br><br><br>" + "<button value=\"OK\" action=\"bypass -h admin_fight_calculator lvl1 $lvl1 lvl2 $lvl2\" width=100 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "</center>" + "</body></html>"; } @@ -165,24 +136,19 @@ public class AdminFightCalculator implements IAdminCommandHandler activeChar.sendPacket(adminReply); } - private void handleShow(String params, L2PcInstance activeChar) - { + private void handleShow(String params, L2PcInstance activeChar) { params = params.trim(); L2Character npc1 = null; L2Character npc2 = null; - if (params.length() == 0) - { + if (params.length() == 0) { npc1 = activeChar; npc2 = (L2Character) activeChar.getTarget(); - if (npc2 == null) - { + if (npc2 == null) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return; } - } - else - { + } else { int mid1 = 0; int mid2 = 0; StringTokenizer st = new StringTokenizer(params); @@ -213,21 +179,17 @@ public class AdminFightCalculator implements IAdminCommandHandler sAtk1 = 100000 / sAtk1; sAtk2 = 100000 / sAtk2; - for (int i = 0; i < 10000; i++) - { + for (int i = 0; i < 10000; i++) { boolean _miss1 = Formulas.calcHitMiss(npc1, npc2); - if (_miss1) - { + if (_miss1) { miss1++; } byte _shld1 = Formulas.calcShldUse(npc1, npc2, null, false); - if (_shld1 > 0) - { + if (_shld1 > 0) { shld1++; } boolean _crit1 = Formulas.calcCrit(npc1, npc2); - if (_crit1) - { + if (_crit1) { crit1++; } @@ -238,29 +200,24 @@ public class AdminFightCalculator implements IAdminCommandHandler double _pdef1 = npc1.getPDef(npc2); pdef1 += _pdef1; - if (!_miss1) - { + if (!_miss1) { double _dmg1 = Formulas.calcPhysDam(npc1, npc2, _shld1, _crit1, false); dmg1 += _dmg1; npc1.abortAttack(); } } - for (int i = 0; i < 10000; i++) - { + for (int i = 0; i < 10000; i++) { boolean _miss2 = Formulas.calcHitMiss(npc2, npc1); - if (_miss2) - { + if (_miss2) { miss2++; } byte _shld2 = Formulas.calcShldUse(npc2, npc1, null, false); - if (_shld2 > 0) - { + if (_shld2 > 0) { shld2++; } boolean _crit2 = Formulas.calcCrit(npc2, npc1); - if (_crit2) - { + if (_crit2) { crit2++; } @@ -271,8 +228,7 @@ public class AdminFightCalculator implements IAdminCommandHandler double _pdef2 = npc2.getPDef(npc1); pdef2 += _pdef2; - if (!_miss2) - { + if (!_miss2) { double _dmg2 = Formulas.calcPhysDam(npc2, npc1, _shld2, _crit2, false); dmg2 += _dmg2; npc2.abortAttack(); @@ -306,12 +262,9 @@ public class AdminFightCalculator implements IAdminCommandHandler final StringBuilder replyMSG = StringUtil.startAppend(1000, "<html><title>Selected mobs to fight</title>" + "<body>" + "<table>"); - if (params.length() == 0) - { + if (params.length() == 0) { replyMSG.append("<tr><td width=140>Parameter</td><td width=70>me</td><td width=70>target</td></tr>"); - } - else - { + } else { StringUtil.append(replyMSG, "<tr><td width=140>Parameter</td><td width=70>", ((L2NpcTemplate) npc1.getTemplate()).getName(), "</td><td width=70>", ((L2NpcTemplate) npc2.getTemplate()).getName(), "</td></tr>"); } @@ -322,32 +275,23 @@ public class AdminFightCalculator implements IAdminCommandHandler + "<tr><td>got dmg</td><td>", String.valueOf(tdmg2), "</td><td>", String.valueOf(tdmg1), "</td></tr>" + "<tr><td>got regen</td><td>", String.valueOf(hp1), "</td><td>", String.valueOf(hp2), "</td></tr>" + "<tr><td>had HP</td><td>", String.valueOf((int) maxHp1), "</td><td>", String.valueOf((int) maxHp2), "</td></tr>" + "<tr><td>die</td>"); - if ((tdmg2 - hp1) > 1) - { + if ((tdmg2 - hp1) > 1) { StringUtil.append(replyMSG, "<td>", String.valueOf((int) ((100 * maxHp1) / (tdmg2 - hp1))), " sec</td>"); - } - else - { + } else { replyMSG.append("<td>never</td>"); } - if ((tdmg1 - hp2) > 1) - { + if ((tdmg1 - hp2) > 1) { StringUtil.append(replyMSG, "<td>", String.valueOf((int) ((100 * maxHp2) / (tdmg1 - hp2))), " sec</td>"); - } - else - { + } else { replyMSG.append("<td>never</td>"); } replyMSG.append("</tr>" + "</table>" + "<center><br>"); - if (params.length() == 0) - { + if (params.length() == 0) { replyMSG.append("<button value=\"Retry\" action=\"bypass -h admin_fight_calculator_show\" width=100 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); - } - else - { + } else { StringUtil.append(replyMSG, "<button value=\"Retry\" action=\"bypass -h admin_fight_calculator_show ", String.valueOf(((L2NpcTemplate) npc1.getTemplate()).getId()), " ", String.valueOf(((L2NpcTemplate) npc2.getTemplate()).getId()), "\" width=100 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); } @@ -355,8 +299,7 @@ public class AdminFightCalculator implements IAdminCommandHandler adminReply.setHtml(replyMSG.toString()); activeChar.sendPacket(adminReply); - if (params.length() != 0) - { + if (params.length() != 0) { ((L2MonsterInstance) npc1).deleteMe(); ((L2MonsterInstance) npc2).deleteMe(); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminFortSiege.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminFortSiege.java index 49ec57a7eb..c3387e915a 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminFortSiege.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminFortSiege.java @@ -35,12 +35,10 @@ import com.l2jserver.gameserver.util.StringUtil; /** * This class handles all siege commands: Todo: change the class name, and neaten it up */ -public class AdminFortSiege implements IAdminCommandHandler -{ +public class AdminFortSiege implements IAdminCommandHandler { // private static Logger _log = Logger.getLogger(AdminFortSiege.class.getName()); - private static final String[] ADMIN_COMMANDS = - { + private static final String[] ADMIN_COMMANDS = { "admin_fortsiege", "admin_add_fortattacker", "admin_list_fortsiege_clans", @@ -53,95 +51,62 @@ public class AdminFortSiege implements IAdminCommandHandler }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { StringTokenizer st = new StringTokenizer(command, " "); command = st.nextToken(); // Get actual command // Get fort Fort fort = null; int fortId = 0; - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { fortId = Integer.parseInt(st.nextToken()); fort = FortManager.getInstance().getFortById(fortId); } // Get fort - if (((fort == null) || (fortId == 0))) - { + if (((fort == null) || (fortId == 0))) { // No fort specified showFortSelectPage(activeChar); - } - else - { + } else { L2Object target = activeChar.getTarget(); L2PcInstance player = null; - if (target instanceof L2PcInstance) - { + if (target instanceof L2PcInstance) { player = (L2PcInstance) target; } - if (command.equalsIgnoreCase("admin_add_fortattacker")) - { - if (player == null) - { + if (command.equalsIgnoreCase("admin_add_fortattacker")) { + if (player == null) { activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT); - } - else - { - if (fort.getSiege().addAttacker(player, false) == 4) - { + } else { + if (fort.getSiege().addAttacker(player, false) == 4) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.REGISTERED_TO_S1_FORTRESS_BATTLE); sm.addCastleId(fort.getResidenceId()); player.sendPacket(sm); - } - else - { + } else { player.sendMessage("During registering error occurred!"); } } - } - else if (command.equalsIgnoreCase("admin_clear_fortsiege_list")) - { + } else if (command.equalsIgnoreCase("admin_clear_fortsiege_list")) { fort.getSiege().clearSiegeClan(); - } - else if (command.equalsIgnoreCase("admin_endfortsiege")) - { + } else if (command.equalsIgnoreCase("admin_endfortsiege")) { fort.getSiege().endSiege(); - } - else if (command.equalsIgnoreCase("admin_list_fortsiege_clans")) - { + } else if (command.equalsIgnoreCase("admin_list_fortsiege_clans")) { activeChar.sendMessage("Not implemented yet."); - } - else if (command.equalsIgnoreCase("admin_setfort")) - { - if ((player == null) || (player.getClan() == null)) - { + } else if (command.equalsIgnoreCase("admin_setfort")) { + if ((player == null) || (player.getClan() == null)) { activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT); - } - else - { + } else { fort.endOfSiege(player.getClan()); } - } - else if (command.equalsIgnoreCase("admin_removefort")) - { + } else if (command.equalsIgnoreCase("admin_removefort")) { L2Clan clan = fort.getOwnerClan(); - if (clan != null) - { + if (clan != null) { fort.removeOwner(true); - } - else - { + } else { activeChar.sendMessage("Unable to remove fort"); } - } - else if (command.equalsIgnoreCase("admin_spawn_fortdoors")) - { + } else if (command.equalsIgnoreCase("admin_spawn_fortdoors")) { fort.resetDoors(); - } - else if (command.equalsIgnoreCase("admin_startfortsiege")) - { + } else if (command.equalsIgnoreCase("admin_startfortsiege")) { fort.getSiege().startSiege(); } @@ -150,8 +115,7 @@ public class AdminFortSiege implements IAdminCommandHandler return true; } - private void showFortSelectPage(L2PcInstance activeChar) - { + private void showFortSelectPage(L2PcInstance activeChar) { int i = 0; final NpcHtmlMessage adminReply = new NpcHtmlMessage(); adminReply.setFile(activeChar.getHtmlPrefix(), "data/html/admin/forts.htm"); @@ -159,16 +123,13 @@ public class AdminFortSiege implements IAdminCommandHandler final List<Fort> forts = FortManager.getInstance().getForts(); final StringBuilder cList = new StringBuilder(forts.size() * 100); - for (Fort fort : forts) - { - if (fort != null) - { + for (Fort fort : forts) { + if (fort != null) { StringUtil.append(cList, "<td fixwidth=90><a action=\"bypass -h admin_fortsiege ", String.valueOf(fort.getResidenceId()), "\">", fort.getName(), " id: ", String.valueOf(fort.getResidenceId()), "</a></td>"); i++; } - if (i > 2) - { + if (i > 2) { cList.append("</tr><tr>"); i = 0; } @@ -178,8 +139,7 @@ public class AdminFortSiege implements IAdminCommandHandler activeChar.sendPacket(adminReply); } - private void showFortSiegePage(L2PcInstance activeChar, Fort fort) - { + private void showFortSiegePage(L2PcInstance activeChar, Fort fort) { final NpcHtmlMessage adminReply = new NpcHtmlMessage(); adminReply.setFile(activeChar.getHtmlPrefix(), "data/html/admin/fort.htm"); adminReply.replace("%fortName%", fort.getName()); @@ -188,8 +148,7 @@ public class AdminFortSiege implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminGeodata.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminGeodata.java index ee8ba25c04..010d7ec201 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminGeodata.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminGeodata.java @@ -31,10 +31,8 @@ import com.l2jserver.gameserver.util.GeoUtils; /** * @author -Nemesiss-, HorridoJoho */ -public class AdminGeodata implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminGeodata implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_geo_pos", "admin_geo_spawn_pos", "admin_geo_can_move", @@ -43,90 +41,65 @@ public class AdminGeodata implements IAdminCommandHandler }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { final StringTokenizer st = new StringTokenizer(command, " "); final String actualCommand = st.nextToken(); - switch (actualCommand.toLowerCase()) - { - case "admin_geo_pos": - { + switch (actualCommand.toLowerCase()) { + case "admin_geo_pos": { final int worldX = activeChar.getX(); final int worldY = activeChar.getY(); final int worldZ = activeChar.getZ(); final int geoX = GeoData.getInstance().getGeoX(worldX); final int geoY = GeoData.getInstance().getGeoY(worldY); - if (GeoData.getInstance().hasGeoPos(geoX, geoY)) - { + if (GeoData.getInstance().hasGeoPos(geoX, geoY)) { activeChar.sendMessage("WorldX: " + worldX + ", WorldY: " + worldY + ", WorldZ: " + worldZ + ", GeoX: " + geoX + ", GeoY: " + geoY + ", GeoZ: " + GeoData.getInstance().getNearestZ(geoX, geoY, worldZ)); - } - else - { + } else { activeChar.sendMessage("There is no geodata at this position."); } break; } - case "admin_geo_spawn_pos": - { + case "admin_geo_spawn_pos": { final int worldX = activeChar.getX(); final int worldY = activeChar.getY(); final int worldZ = activeChar.getZ(); final int geoX = GeoData.getInstance().getGeoX(worldX); final int geoY = GeoData.getInstance().getGeoY(worldY); - if (GeoData.getInstance().hasGeoPos(geoX, geoY)) - { + if (GeoData.getInstance().hasGeoPos(geoX, geoY)) { activeChar.sendMessage("WorldX: " + worldX + ", WorldY: " + worldY + ", WorldZ: " + worldZ + ", GeoX: " + geoX + ", GeoY: " + geoY + ", GeoZ: " + GeoData.getInstance().getSpawnHeight(worldX, worldY, worldZ)); - } - else - { + } else { activeChar.sendMessage("There is no geodata at this position."); } break; } - case "admin_geo_can_move": - { + case "admin_geo_can_move": { final L2Object target = activeChar.getTarget(); - if (target != null) - { - if (GeoData.getInstance().canSeeTarget(activeChar, target)) - { + if (target != null) { + if (GeoData.getInstance().canSeeTarget(activeChar, target)) { activeChar.sendMessage("Can move beeline."); - } - else - { + } else { activeChar.sendMessage("Can not move beeline!"); } - } - else - { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); } break; } - case "admin_geo_can_see": - { + case "admin_geo_can_see": { final L2Object target = activeChar.getTarget(); - if (target != null) - { - if (GeoData.getInstance().canSeeTarget(activeChar, target)) - { + if (target != null) { + if (GeoData.getInstance().canSeeTarget(activeChar, target)) { activeChar.sendMessage("Can see target."); - } - else - { + } else { activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CANT_SEE_TARGET)); } - } - else - { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); } break; } - case "admin_geogrid": - { + case "admin_geogrid": { GeoUtils.debugGrid(activeChar); break; } @@ -135,8 +108,7 @@ public class AdminGeodata implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminGm.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminGm.java index f88aea17c5..497f17f23f 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminGm.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminGm.java @@ -28,19 +28,15 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * This class handles following admin commands: - gm = turns gm mode off * @version $Revision: 1.2.4.4 $ $Date: 2005/04/11 10:06:06 $ */ -public class AdminGm implements IAdminCommandHandler -{ +public class AdminGm implements IAdminCommandHandler { private static Logger _log = Logger.getLogger(AdminGm.class.getName()); - private static final String[] ADMIN_COMMANDS = - { + private static final String[] ADMIN_COMMANDS = { "admin_gm" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.equals("admin_gm") && activeChar.isGM()) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.equals("admin_gm") && activeChar.isGM()) { AdminData.getInstance().deleteGm(activeChar); activeChar.setAccessLevel(0); activeChar.sendMessage("You no longer have GM status."); @@ -50,8 +46,7 @@ public class AdminGm implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminGmChat.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminGmChat.java index 363532300d..a7f2024d08 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminGmChat.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminGmChat.java @@ -31,29 +31,22 @@ import com.l2jserver.gameserver.network.serverpackets.CreatureSay; * This class handles following admin commands: - gmchat text = sends text to all online GM's - gmchat_menu text = same as gmchat, displays the admin panel after chat * @version $Revision: 1.2.4.3 $ $Date: 2005/04/11 10:06:06 $ */ -public class AdminGmChat implements IAdminCommandHandler -{ +public class AdminGmChat implements IAdminCommandHandler { - private static final String[] ADMIN_COMMANDS = - { + private static final String[] ADMIN_COMMANDS = { "admin_gmchat", "admin_snoop", "admin_gmchat_menu" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.startsWith("admin_gmchat")) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.startsWith("admin_gmchat")) { handleGmChat(command, activeChar); - } - else if (command.startsWith("admin_snoop")) - { + } else if (command.startsWith("admin_snoop")) { snoop(command, activeChar); } - if (command.startsWith("admin_gmchat_menu")) - { + if (command.startsWith("admin_gmchat_menu")) { AdminHtml.showAdminHtml(activeChar, "gm_menu.htm"); } return true; @@ -63,25 +56,20 @@ public class AdminGmChat implements IAdminCommandHandler * @param command * @param activeChar */ - private void snoop(String command, L2PcInstance activeChar) - { + private void snoop(String command, L2PcInstance activeChar) { L2Object target = null; - if (command.length() > 12) - { + if (command.length() > 12) { target = L2World.getInstance().getPlayer(command.substring(12)); } - if (target == null) - { + if (target == null) { target = activeChar.getTarget(); } - if (target == null) - { + if (target == null) { activeChar.sendPacket(SystemMessageId.SELECT_TARGET); return; } - if (!(target instanceof L2PcInstance)) - { + if (!(target instanceof L2PcInstance)) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return; } @@ -91,8 +79,7 @@ public class AdminGmChat implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } @@ -100,26 +87,19 @@ public class AdminGmChat implements IAdminCommandHandler * @param command * @param activeChar */ - private void handleGmChat(String command, L2PcInstance activeChar) - { - try - { + private void handleGmChat(String command, L2PcInstance activeChar) { + try { int offset = 0; String text; - if (command.startsWith("admin_gmchat_menu")) - { + if (command.startsWith("admin_gmchat_menu")) { offset = 18; - } - else - { + } else { offset = 13; } text = command.substring(offset); CreatureSay cs = new CreatureSay(0, Say2.ALLIANCE, activeChar.getName(), text); AdminData.getInstance().broadcastToGMs(cs); - } - catch (StringIndexOutOfBoundsException e) - { + } catch (StringIndexOutOfBoundsException e) { // Who cares? } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminGraciaSeeds.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminGraciaSeeds.java index 0176b41a3c..9661acedcc 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminGraciaSeeds.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminGraciaSeeds.java @@ -26,33 +26,26 @@ import com.l2jserver.gameserver.instancemanager.GraciaSeedsManager; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; -public class AdminGraciaSeeds implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminGraciaSeeds implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_gracia_seeds", "admin_kill_tiat", "admin_set_sodstate" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { StringTokenizer st = new StringTokenizer(command, " "); String actualCommand = st.nextToken(); // Get actual command String val = ""; - if (st.countTokens() >= 1) - { + if (st.countTokens() >= 1) { val = st.nextToken(); } - if (actualCommand.equalsIgnoreCase("admin_kill_tiat")) - { + if (actualCommand.equalsIgnoreCase("admin_kill_tiat")) { GraciaSeedsManager.getInstance().increaseSoDTiatKilled(); - } - else if (actualCommand.equalsIgnoreCase("admin_set_sodstate")) - { + } else if (actualCommand.equalsIgnoreCase("admin_set_sodstate")) { GraciaSeedsManager.getInstance().setSoDState(Integer.parseInt(val), true); } @@ -60,28 +53,23 @@ public class AdminGraciaSeeds implements IAdminCommandHandler return true; } - private void showMenu(L2PcInstance activeChar) - { + private void showMenu(L2PcInstance activeChar) { final NpcHtmlMessage html = new NpcHtmlMessage(); html.setFile(activeChar.getHtmlPrefix(), "data/html/admin/graciaseeds.htm"); html.replace("%sodstate%", String.valueOf(GraciaSeedsManager.getInstance().getSoDState())); html.replace("%sodtiatkill%", String.valueOf(GraciaSeedsManager.getInstance().getSoDTiatKilled())); - if (GraciaSeedsManager.getInstance().getSoDTimeForNextStateChange() > 0) - { + if (GraciaSeedsManager.getInstance().getSoDTimeForNextStateChange() > 0) { Calendar nextChangeDate = Calendar.getInstance(); nextChangeDate.setTimeInMillis(System.currentTimeMillis() + GraciaSeedsManager.getInstance().getSoDTimeForNextStateChange()); html.replace("%sodtime%", nextChangeDate.getTime().toString()); - } - else - { + } else { html.replace("%sodtime%", "-1"); } activeChar.sendPacket(html); } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminGrandBoss.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminGrandBoss.java index 52731933d9..ea68d6d566 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminGrandBoss.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminGrandBoss.java @@ -38,8 +38,7 @@ import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; /** * @author St3eT */ -public class AdminGrandBoss implements IAdminCommandHandler -{ +public class AdminGrandBoss implements IAdminCommandHandler { private static final int ANTHARAS = 29068; // Antharas private static final int ANTHARAS_ZONE = 70050; // Antharas Nest private static final int VALAKAS = 29028; // Valakas @@ -49,8 +48,7 @@ public class AdminGrandBoss implements IAdminCommandHandler private static final int ORFEN = 29014; // Orfen private static final int CORE = 29006; // Core - private static final String[] ADMIN_COMMANDS = - { + private static final String[] ADMIN_COMMANDS = { "admin_grandboss", "admin_grandboss_skip", "admin_grandboss_respawn", @@ -59,21 +57,15 @@ public class AdminGrandBoss implements IAdminCommandHandler }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { final StringTokenizer st = new StringTokenizer(command, " "); final String actualCommand = st.nextToken(); - switch (actualCommand.toLowerCase()) - { - case "admin_grandboss": - { - if (st.hasMoreTokens()) - { + switch (actualCommand.toLowerCase()) { + case "admin_grandboss": { + if (st.hasMoreTokens()) { final int grandBossId = Integer.parseInt(st.nextToken()); manageHtml(activeChar, grandBossId); - } - else - { + } else { NpcHtmlMessage html = new NpcHtmlMessage(0, 1); html.setHtml(HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/admin/grandboss.htm")); activeChar.sendPacket(html); @@ -81,118 +73,87 @@ public class AdminGrandBoss implements IAdminCommandHandler break; } - case "admin_grandboss_skip": - { - if (st.hasMoreTokens()) - { + case "admin_grandboss_skip": { + if (st.hasMoreTokens()) { final int grandBossId = Integer.parseInt(st.nextToken()); - if (grandBossId == ANTHARAS) - { + if (grandBossId == ANTHARAS) { antharasAi().notifyEvent("SKIP_WAITING", null, activeChar); manageHtml(activeChar, grandBossId); - } - else - { + } else { activeChar.sendMessage("Wrong ID!"); } - } - else - { + } else { activeChar.sendMessage("Usage: //grandboss_skip Id"); } break; } - case "admin_grandboss_respawn": - { - if (st.hasMoreTokens()) - { + case "admin_grandboss_respawn": { + if (st.hasMoreTokens()) { final int grandBossId = Integer.parseInt(st.nextToken()); - switch (grandBossId) - { - case ANTHARAS: - { + switch (grandBossId) { + case ANTHARAS: { antharasAi().notifyEvent("RESPAWN_ANTHARAS", null, activeChar); manageHtml(activeChar, grandBossId); break; } - case BAIUM: - { + case BAIUM: { baiumAi().notifyEvent("RESPAWN_BAIUM", null, activeChar); manageHtml(activeChar, grandBossId); break; } - default: - { + default: { activeChar.sendMessage("Wrong ID!"); } } - } - else - { + } else { activeChar.sendMessage("Usage: //grandboss_respawn Id"); } break; } - case "admin_grandboss_minions": - { - if (st.hasMoreTokens()) - { + case "admin_grandboss_minions": { + if (st.hasMoreTokens()) { final int grandBossId = Integer.parseInt(st.nextToken()); - switch (grandBossId) - { - case ANTHARAS: - { + switch (grandBossId) { + case ANTHARAS: { antharasAi().notifyEvent("DESPAWN_MINIONS", null, activeChar); break; } - case BAIUM: - { + case BAIUM: { baiumAi().notifyEvent("DESPAWN_MINIONS", null, activeChar); break; } - default: - { + default: { activeChar.sendMessage("Wrong ID!"); } } - } - else - { + } else { activeChar.sendMessage("Usage: //grandboss_minions Id"); } break; } - case "admin_grandboss_abort": - { - if (st.hasMoreTokens()) - { + case "admin_grandboss_abort": { + if (st.hasMoreTokens()) { final int grandBossId = Integer.parseInt(st.nextToken()); - switch (grandBossId) - { - case ANTHARAS: - { + switch (grandBossId) { + case ANTHARAS: { antharasAi().notifyEvent("ABORT_FIGHT", null, activeChar); manageHtml(activeChar, grandBossId); break; } - case BAIUM: - { + case BAIUM: { baiumAi().notifyEvent("ABORT_FIGHT", null, activeChar); manageHtml(activeChar, grandBossId); break; } - default: - { + default: { activeChar.sendMessage("Wrong ID!"); } } - } - else - { + } else { activeChar.sendMessage("Usage: //grandboss_abort Id"); } } @@ -201,10 +162,8 @@ public class AdminGrandBoss implements IAdminCommandHandler return true; } - private void manageHtml(L2PcInstance activeChar, int grandBossId) - { - if (Arrays.asList(ANTHARAS, VALAKAS, BAIUM, QUEENANT, ORFEN, CORE).contains(grandBossId)) - { + private void manageHtml(L2PcInstance activeChar, int grandBossId) { + if (Arrays.asList(ANTHARAS, VALAKAS, BAIUM, QUEENANT, ORFEN, CORE).contains(grandBossId)) { final int bossStatus = GrandBossManager.getInstance().getBossStatus(grandBossId); L2NoRestartZone bossZone = null; String textColor = null; @@ -212,86 +171,68 @@ public class AdminGrandBoss implements IAdminCommandHandler String htmlPatch = null; int deadStatus = 0; - switch (grandBossId) - { - case ANTHARAS: - { + switch (grandBossId) { + case ANTHARAS: { bossZone = ZoneManager.getInstance().getZoneById(ANTHARAS_ZONE, L2NoRestartZone.class); htmlPatch = "data/html/admin/grandboss_antharas.htm"; break; } - case VALAKAS: - { + case VALAKAS: { htmlPatch = "data/html/admin/grandboss_valakas.htm"; break; } - case BAIUM: - { + case BAIUM: { bossZone = ZoneManager.getInstance().getZoneById(BAIUM_ZONE, L2NoRestartZone.class); htmlPatch = "data/html/admin/grandboss_baium.htm"; break; } - case QUEENANT: - { + case QUEENANT: { htmlPatch = "data/html/admin/grandboss_queenant.htm"; break; } - case ORFEN: - { + case ORFEN: { htmlPatch = "data/html/admin/grandboss_orfen.htm"; break; } - case CORE: - { + case CORE: { htmlPatch = "data/html/admin/grandboss_core.htm"; break; } } - if (Arrays.asList(ANTHARAS, VALAKAS, BAIUM).contains(grandBossId)) - { + if (Arrays.asList(ANTHARAS, VALAKAS, BAIUM).contains(grandBossId)) { deadStatus = 3; - switch (bossStatus) - { - case 0: - { + switch (bossStatus) { + case 0: { textColor = "00FF00"; // Green text = "Alive"; break; } - case 1: - { + case 1: { textColor = "FFFF00"; // Yellow text = "Waiting"; break; } - case 2: - { + case 2: { textColor = "FF9900"; // Orange text = "In Fight"; break; } - case 3: - { + case 3: { textColor = "FF0000"; // Red text = "Dead"; break; } } - } - else - { + } else { deadStatus = 1; - switch (bossStatus) - { - case 0: - { + switch (bossStatus) { + case 0: { textColor = "00FF00"; // Green text = "Alive"; break; } - case 1: - { + case 1: { textColor = "FF0000"; // Red text = "Dead"; break; @@ -309,26 +250,21 @@ public class AdminGrandBoss implements IAdminCommandHandler html.replace("%respawnTime%", bossStatus == deadStatus ? bossRespawn : "Already respawned!"); html.replace("%playersInside%", bossZone != null ? String.valueOf(bossZone.getPlayersInside().size()) : "Zone not found!"); activeChar.sendPacket(html); - } - else - { + } else { activeChar.sendMessage("Wrong ID!"); } } - private Quest antharasAi() - { + private Quest antharasAi() { return QuestManager.getInstance().getQuest(Antharas.class.getSimpleName()); } - private Quest baiumAi() - { + private Quest baiumAi() { return QuestManager.getInstance().getQuest(Baium.class.getSimpleName()); } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminHeal.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminHeal.java index f2cabc520a..bfb3f81e45 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminHeal.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminHeal.java @@ -34,32 +34,22 @@ import com.l2jserver.gameserver.network.SystemMessageId; * This class handles following admin commands: - heal = restores HP/MP/CP on target, name or radius * @version $Revision: 1.2.4.5 $ $Date: 2005/04/11 10:06:06 $ Small typo fix by Zoey76 24/02/2011 */ -public class AdminHeal implements IAdminCommandHandler -{ +public class AdminHeal implements IAdminCommandHandler { private static Logger _log = Logger.getLogger(AdminRes.class.getName()); - private static final String[] ADMIN_COMMANDS = - { + private static final String[] ADMIN_COMMANDS = { "admin_heal" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.equals("admin_heal")) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.equals("admin_heal")) { handleHeal(activeChar); - } - else if (command.startsWith("admin_heal")) - { - try - { + } else if (command.startsWith("admin_heal")) { + try { String healTarget = command.substring(11); handleHeal(activeChar, healTarget); - } - catch (StringIndexOutOfBoundsException e) - { - if (general().developer()) - { + } catch (StringIndexOutOfBoundsException e) { + if (general().developer()) { _log.warning("Heal error: " + e); } activeChar.sendMessage("Incorrect target/radius specified."); @@ -69,42 +59,31 @@ public class AdminHeal implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } - private void handleHeal(L2PcInstance activeChar) - { + private void handleHeal(L2PcInstance activeChar) { handleHeal(activeChar, null); } - private void handleHeal(L2PcInstance activeChar, String player) - { + private void handleHeal(L2PcInstance activeChar, String player) { L2Object obj = activeChar.getTarget(); - if (player != null) - { + if (player != null) { L2PcInstance plyr = L2World.getInstance().getPlayer(player); - if (plyr != null) - { + if (plyr != null) { obj = plyr; - } - else - { - try - { + } else { + try { int radius = Integer.parseInt(player); Collection<L2Object> objs = activeChar.getKnownList().getKnownObjects().values(); - for (L2Object object : objs) - { - if (object instanceof L2Character) - { + for (L2Object object : objs) { + if (object instanceof L2Character) { L2Character character = (L2Character) object; character.setCurrentHpMp(character.getMaxHp(), character.getMaxMp()); - if (object instanceof L2PcInstance) - { + if (object instanceof L2PcInstance) { character.setCurrentCp(character.getMaxCp()); } } @@ -112,31 +91,23 @@ public class AdminHeal implements IAdminCommandHandler activeChar.sendMessage("Healed within " + radius + " unit radius."); return; - } - catch (NumberFormatException nbe) - { + } catch (NumberFormatException nbe) { } } } - if (obj == null) - { + if (obj == null) { obj = activeChar; } - if (obj instanceof L2Character) - { + if (obj instanceof L2Character) { L2Character target = (L2Character) obj; target.setCurrentHpMp(target.getMaxHp(), target.getMaxMp()); - if (target instanceof L2PcInstance) - { + if (target instanceof L2PcInstance) { target.setCurrentCp(target.getMaxCp()); } - if (general().debug()) - { + if (general().debug()) { _log.fine("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") healed character " + target.getName()); } - } - else - { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminHellbound.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminHellbound.java index c3e0471864..cc13bc8abe 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminHellbound.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminHellbound.java @@ -29,60 +29,47 @@ import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; * Hellbound admin command. * @author DS, Gladicek */ -public class AdminHellbound implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminHellbound implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_hellbound_setlevel", "admin_hellbound" }; @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (activeChar == null) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (activeChar == null) { return false; } - if (command.startsWith(ADMIN_COMMANDS[0])) - { - try - { + if (command.startsWith(ADMIN_COMMANDS[0])) { + try { StringTokenizer st = new StringTokenizer(command, " "); st.nextToken(); final int level = Integer.parseInt(st.nextToken()); - if ((level < 0) || (level > 11)) - { + if ((level < 0) || (level > 11)) { throw new NumberFormatException(); } HellboundEngine.getInstance().setLevel(level); activeChar.sendMessage("Hellbound level set to " + level); return true; - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //hellbound_setlevel 0-11"); return false; } - } - else if (command.startsWith(ADMIN_COMMANDS[1])) - { + } else if (command.startsWith(ADMIN_COMMANDS[1])) { showMenu(activeChar); return true; } return false; } - private void showMenu(L2PcInstance activeChar) - { + private void showMenu(L2PcInstance activeChar) { final NpcHtmlMessage html = new NpcHtmlMessage(); html.setFile(activeChar.getHtmlPrefix(), "data/html/admin/hellbound.htm"); html.replace("%hbstage%", String.valueOf(HellboundEngine.getInstance().getLevel())); diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminHtml.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminHtml.java index 04d9931a16..86f1755057 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminHtml.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminHtml.java @@ -31,25 +31,19 @@ import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; /** * @author NosBit */ -public class AdminHtml implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminHtml implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_html", "admin_loadhtml" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { final StringTokenizer st = new StringTokenizer(command, " "); final String actualCommand = st.nextToken(); - switch (actualCommand.toLowerCase()) - { - case "admin_html": - { - if (!st.hasMoreTokens()) - { + switch (actualCommand.toLowerCase()) { + case "admin_html": { + if (!st.hasMoreTokens()) { activeChar.sendMessage("Usage: //html path"); return false; } @@ -58,10 +52,8 @@ public class AdminHtml implements IAdminCommandHandler showAdminHtml(activeChar, path); break; } - case "admin_loadhtml": - { - if (!st.hasMoreTokens()) - { + case "admin_loadhtml": { + if (!st.hasMoreTokens()) { activeChar.sendMessage("Usage: //loadhtml path"); return false; } @@ -79,8 +71,7 @@ public class AdminHtml implements IAdminCommandHandler * @param activeChar activeChar where html is shown * @param path relative path from directory data/html/admin/ to html */ - public static void showAdminHtml(L2PcInstance activeChar, String path) - { + public static void showAdminHtml(L2PcInstance activeChar, String path) { showHtml(activeChar, "data/html/admin/" + path, false); } @@ -90,33 +81,25 @@ public class AdminHtml implements IAdminCommandHandler * @param path relative path from Configuration.getInstance().server().getDatapackRoot() to html. * @param reload {@code true} will reload html and show it {@code false} will show it from cache. */ - public static void showHtml(L2PcInstance activeChar, String path, boolean reload) - { + public static void showHtml(L2PcInstance activeChar, String path, boolean reload) { String content = null; - if (!reload) - { + if (!reload) { content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), path); - } - else - { + } else { File file = new File(server().getDatapackRoot(), path); content = HtmCache.getInstance().loadFile(file); } final NpcHtmlMessage html = new NpcHtmlMessage(); - if (content != null) - { + if (content != null) { html.setHtml(content); - } - else - { + } else { html.setHtml("<html><body>My text is missing:<br>" + path + "</body></html>"); } activeChar.sendPacket(html); } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminInstance.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminInstance.java index 6c764dc582..3fd405233e 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminInstance.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminInstance.java @@ -30,10 +30,8 @@ import com.l2jserver.gameserver.model.entity.Instance; /** * @author evill33t, GodKratos */ -public class AdminInstance implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminInstance implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_setinstance", "admin_ghoston", "admin_ghostoff", @@ -43,55 +41,37 @@ public class AdminInstance implements IAdminCommandHandler }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { StringTokenizer st = new StringTokenizer(command); st.nextToken(); // create new instance - if (command.startsWith("admin_createinstance")) - { + if (command.startsWith("admin_createinstance")) { String[] parts = command.split(" "); - if (parts.length != 3) - { + if (parts.length != 3) { activeChar.sendMessage("Example: //createinstance <id> <templatefile> - ids => 300000 are reserved for dynamic instances"); - } - else - { - try - { + } else { + try { final int id = Integer.parseInt(parts[1]); - if ((id < 300000) && InstanceManager.getInstance().createInstanceFromTemplate(id, parts[2])) - { + if ((id < 300000) && InstanceManager.getInstance().createInstanceFromTemplate(id, parts[2])) { activeChar.sendMessage("Instance created."); - } - else - { + } else { activeChar.sendMessage("Failed to create instance."); } return true; - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Failed loading: " + parts[1] + " " + parts[2]); return false; } } - } - else if (command.startsWith("admin_listinstances")) - { - for (Instance temp : InstanceManager.getInstance().getInstances().values()) - { + } else if (command.startsWith("admin_listinstances")) { + for (Instance temp : InstanceManager.getInstance().getInstances().values()) { activeChar.sendMessage("Id: " + temp.getId() + " Name: " + temp.getName()); } - } - else if (command.startsWith("admin_setinstance")) - { - try - { + } else if (command.startsWith("admin_setinstance")) { + try { int val = Integer.parseInt(st.nextToken()); - if (InstanceManager.getInstance().getInstance(val) == null) - { + if (InstanceManager.getInstance().getInstance(val) == null) { activeChar.sendMessage("Instance " + val + " doesnt exist."); return false; } @@ -103,30 +83,22 @@ public class AdminInstance implements IAdminCommandHandler return false; } target.setInstanceId(val); - if (target instanceof L2PcInstance) - { + if (target instanceof L2PcInstance) { L2PcInstance player = (L2PcInstance) target; player.sendMessage("Admin set your instance to:" + val); player.teleToLocation(player.getLocation()); } activeChar.sendMessage("Moved " + target.getName() + " to instance " + target.getInstanceId() + "."); return true; - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Use //setinstance id"); } - } - else if (command.startsWith("admin_destroyinstance")) - { - try - { + } else if (command.startsWith("admin_destroyinstance")) { + try { int val = Integer.parseInt(st.nextToken()); InstanceManager.getInstance().destroyInstance(val); activeChar.sendMessage("Instance destroyed"); - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Use //destroyinstance id"); } } @@ -136,8 +108,7 @@ public class AdminInstance implements IAdminCommandHandler // you will see snapshots (knownlist echoes?) if you port // so kinda useless atm // TODO: enable broadcast packets for ghosts - else if (command.startsWith("admin_ghoston")) - { + else if (command.startsWith("admin_ghoston")) { activeChar.getAppearance().setGhostMode(true); activeChar.sendMessage("Ghost mode enabled"); activeChar.broadcastUserInfo(); @@ -145,8 +116,7 @@ public class AdminInstance implements IAdminCommandHandler activeChar.spawnMe(); } // ghost mode off - else if (command.startsWith("admin_ghostoff")) - { + else if (command.startsWith("admin_ghostoff")) { activeChar.getAppearance().setGhostMode(false); activeChar.sendMessage("Ghost mode disabled"); activeChar.broadcastUserInfo(); @@ -157,8 +127,7 @@ public class AdminInstance implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminInstanceZone.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminInstanceZone.java index 66fd995940..b4504b7608 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminInstanceZone.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminInstanceZone.java @@ -29,24 +29,19 @@ import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; import com.l2jserver.gameserver.util.GMAudit; import com.l2jserver.gameserver.util.StringUtil; -public class AdminInstanceZone implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminInstanceZone implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_instancezone", "admin_instancezone_clear" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { String target = (activeChar.getTarget() != null) ? activeChar.getTarget().getName() : "no-target"; GMAudit.auditGMAction(activeChar.getName(), command, target, ""); - if (command.startsWith("admin_instancezone_clear")) - { - try - { + if (command.startsWith("admin_instancezone_clear")) { + try { StringTokenizer st = new StringTokenizer(command, " "); st.nextToken(); @@ -58,52 +53,36 @@ public class AdminInstanceZone implements IAdminCommandHandler player.sendMessage("Admin cleared instance zone " + name + " for you"); return true; - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Failed clearing instance time: " + e.getMessage()); activeChar.sendMessage("Usage: //instancezone_clear <playername> [instanceId]"); return false; } - } - else if (command.startsWith("admin_instancezone")) - { + } else if (command.startsWith("admin_instancezone")) { StringTokenizer st = new StringTokenizer(command, " "); command = st.nextToken(); - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { L2PcInstance player = null; String playername = st.nextToken(); - try - { + try { player = L2World.getInstance().getPlayer(playername); - } - catch (Exception e) - { + } catch (Exception e) { } - if (player != null) - { + if (player != null) { display(player, activeChar); - } - else - { + } else { activeChar.sendMessage("The player " + playername + " is not online"); activeChar.sendMessage("Usage: //instancezone [playername]"); return false; } - } - else if (activeChar.getTarget() != null) - { - if (activeChar.getTarget() instanceof L2PcInstance) - { + } else if (activeChar.getTarget() != null) { + if (activeChar.getTarget() instanceof L2PcInstance) { display((L2PcInstance) activeChar.getTarget(), activeChar); } - } - else - { + } else { display(activeChar, activeChar); } } @@ -111,24 +90,22 @@ public class AdminInstanceZone implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } - private void display(L2PcInstance player, L2PcInstance activeChar) - { + private void display(L2PcInstance player, L2PcInstance activeChar) { Map<Integer, Long> instanceTimes = InstanceManager.getInstance().getAllInstanceTimes(player.getObjectId()); - final StringBuilder html = StringUtil.startAppend(500 + (instanceTimes.size() * 200), "<html><center><table width=260><tr>" + "<td width=40><button value=\"Main\" action=\"bypass -h admin_admin\" width=40 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" + "<td width=180><center>Character Instances</center></td>" + "<td width=40><button value=\"Back\" action=\"bypass -h admin_current_player\" width=40 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" + "</tr></table><br><font color=\"LEVEL\">Instances for ", player.getName(), "</font><center><br>" + "<table>" + "<tr><td width=150>Name</td><td width=50>Time</td><td width=70>Action</td></tr>"); + final StringBuilder html = StringUtil.startAppend(500 + (instanceTimes.size() * 200), "<html><center><table width=260><tr>" + "<td width=40><button value=\"Main\" action=\"bypass -h admin_admin\" width=40 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" + + "<td width=180><center>Character Instances</center></td>" + "<td width=40><button value=\"Back\" action=\"bypass -h admin_current_player\" width=40 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" + + "</tr></table><br><font color=\"LEVEL\">Instances for ", player.getName(), "</font><center><br>" + "<table>" + "<tr><td width=150>Name</td><td width=50>Time</td><td width=70>Action</td></tr>"); - for (int id : instanceTimes.keySet()) - { + for (int id : instanceTimes.keySet()) { int hours = 0; int minutes = 0; long remainingTime = (instanceTimes.get(id) - System.currentTimeMillis()) / 1000; - if (remainingTime > 0) - { + if (remainingTime > 0) { hours = (int) (remainingTime / 3600); minutes = (int) ((remainingTime % 3600) / 60); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminInvul.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminInvul.java index 9e5e70ae4e..a643693e6f 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminInvul.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminInvul.java @@ -30,29 +30,23 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * This class handles following admin commands: - invul = turns invulnerability on/off * @version $Revision: 1.2.4.4 $ $Date: 2007/07/31 10:06:02 $ */ -public class AdminInvul implements IAdminCommandHandler -{ +public class AdminInvul implements IAdminCommandHandler { private static Logger _log = Logger.getLogger(AdminInvul.class.getName()); - private static final String[] ADMIN_COMMANDS = - { + private static final String[] ADMIN_COMMANDS = { "admin_invul", "admin_setinvul" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { - if (command.equals("admin_invul")) - { + if (command.equals("admin_invul")) { handleInvul(activeChar); AdminHtml.showAdminHtml(activeChar, "gm_menu.htm"); } - if (command.equals("admin_setinvul")) - { + if (command.equals("admin_setinvul")) { L2Object target = activeChar.getTarget(); - if (target instanceof L2PcInstance) - { + if (target instanceof L2PcInstance) { handleInvul((L2PcInstance) target); } } @@ -60,29 +54,22 @@ public class AdminInvul implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } - private void handleInvul(L2PcInstance activeChar) - { + private void handleInvul(L2PcInstance activeChar) { String text; - if (activeChar.isInvul()) - { + if (activeChar.isInvul()) { activeChar.setIsInvul(false); text = activeChar.getName() + " is now mortal"; - if (general().debug()) - { + if (general().debug()) { _log.fine("GM: Gm removed invul mode from character " + activeChar.getName() + "(" + activeChar.getObjectId() + ")"); } - } - else - { + } else { activeChar.setIsInvul(true); text = activeChar.getName() + " is now invulnerable"; - if (general().debug()) - { + if (general().debug()) { _log.fine("GM: Gm activated invul mode for character " + activeChar.getName() + "(" + activeChar.getObjectId() + ")"); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminKick.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminKick.java index 849e06a121..0ca55f09c4 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminKick.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminKick.java @@ -24,39 +24,30 @@ import com.l2jserver.gameserver.handler.IAdminCommandHandler; import com.l2jserver.gameserver.model.L2World; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -public class AdminKick implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminKick implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_kick", "admin_kick_non_gm" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.startsWith("admin_kick")) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.startsWith("admin_kick")) { StringTokenizer st = new StringTokenizer(command); - if (st.countTokens() > 1) - { + if (st.countTokens() > 1) { st.nextToken(); String player = st.nextToken(); L2PcInstance plyr = L2World.getInstance().getPlayer(player); - if (plyr != null) - { + if (plyr != null) { plyr.logout(); activeChar.sendMessage("You kicked " + plyr.getName() + " from the game."); } } } - if (command.startsWith("admin_kick_non_gm")) - { + if (command.startsWith("admin_kick_non_gm")) { int counter = 0; - for (L2PcInstance player : L2World.getInstance().getPlayers()) - { - if (!player.isGM()) - { + for (L2PcInstance player : L2World.getInstance().getPlayers()) { + if (!player.isGM()) { counter++; player.logout(); } @@ -67,8 +58,7 @@ public class AdminKick implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminKill.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminKill.java index 14d41b2525..1e458babdd 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminKill.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminKill.java @@ -37,38 +37,28 @@ import com.l2jserver.gameserver.network.SystemMessageId; * that radius will be killed. * @version $Revision: 1.2.4.5 $ $Date: 2007/07/31 10:06:06 $ */ -public class AdminKill implements IAdminCommandHandler -{ +public class AdminKill implements IAdminCommandHandler { private static Logger _log = Logger.getLogger(AdminKill.class.getName()); - private static final String[] ADMIN_COMMANDS = - { + private static final String[] ADMIN_COMMANDS = { "admin_kill", "admin_kill_monster" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.startsWith("admin_kill")) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.startsWith("admin_kill")) { StringTokenizer st = new StringTokenizer(command, " "); st.nextToken(); // skip command - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { String firstParam = st.nextToken(); L2PcInstance plyr = L2World.getInstance().getPlayer(firstParam); - if (plyr != null) - { - if (st.hasMoreTokens()) - { - try - { + if (plyr != null) { + if (st.hasMoreTokens()) { + try { int radius = Integer.parseInt(st.nextToken()); - for (L2Character knownChar : plyr.getKnownList().getKnownCharactersInRadius(radius)) - { - if ((knownChar instanceof L2ControllableMobInstance) || (knownChar == activeChar)) - { + for (L2Character knownChar : plyr.getKnownList().getKnownCharactersInRadius(radius)) { + if ((knownChar instanceof L2ControllableMobInstance) || (knownChar == activeChar)) { continue; } @@ -77,25 +67,18 @@ public class AdminKill implements IAdminCommandHandler activeChar.sendMessage("Killed all characters within a " + radius + " unit radius."); return true; - } - catch (NumberFormatException e) - { + } catch (NumberFormatException e) { activeChar.sendMessage("Invalid radius."); return false; } } kill(activeChar, plyr); - } - else - { - try - { + } else { + try { int radius = Integer.parseInt(firstParam); - for (L2Character knownChar : activeChar.getKnownList().getKnownCharactersInRadius(radius)) - { - if ((knownChar instanceof L2ControllableMobInstance) || (knownChar == activeChar)) - { + for (L2Character knownChar : activeChar.getKnownList().getKnownCharactersInRadius(radius)) { + if ((knownChar instanceof L2ControllableMobInstance) || (knownChar == activeChar)) { continue; } kill(activeChar, knownChar); @@ -103,23 +86,16 @@ public class AdminKill implements IAdminCommandHandler activeChar.sendMessage("Killed all characters within a " + radius + " unit radius."); return true; - } - catch (NumberFormatException e) - { + } catch (NumberFormatException e) { activeChar.sendMessage("Usage: //kill <player_name | radius>"); return false; } } - } - else - { + } else { L2Object obj = activeChar.getTarget(); - if ((obj instanceof L2ControllableMobInstance) || !(obj instanceof L2Character)) - { + if ((obj instanceof L2ControllableMobInstance) || !(obj instanceof L2Character)) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); - } - else - { + } else { kill(activeChar, (L2Character) obj); } } @@ -127,45 +103,34 @@ public class AdminKill implements IAdminCommandHandler return true; } - private void kill(L2PcInstance activeChar, L2Character target) - { - if (target instanceof L2PcInstance) - { - if (!((L2PcInstance) target).isGM()) - { + private void kill(L2PcInstance activeChar, L2Character target) { + if (target instanceof L2PcInstance) { + if (!((L2PcInstance) target).isGM()) { target.stopAllEffects(); // e.g. invincibility effect } target.reduceCurrentHp(target.getMaxHp() + target.getMaxCp() + 1, activeChar, null); - } - else if (customs().championEnable() && target.isChampion()) - { + } else if (customs().championEnable() && target.isChampion()) { target.reduceCurrentHp((target.getMaxHp() * customs().getChampionHp()) + 1, activeChar, null); - } - else - { + } else { boolean targetIsInvul = false; - if (target.isInvul()) - { + if (target.isInvul()) { targetIsInvul = true; target.setIsInvul(false); } target.reduceCurrentHp(target.getMaxHp() + 1, activeChar, null); - if (targetIsInvul) - { + if (targetIsInvul) { target.setIsInvul(true); } } - if (general().debug()) - { + if (general().debug()) { _log.fine("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ")" + " killed character " + target.getObjectId()); } } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminLevel.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminLevel.java index 7ccbf106dd..4709f7a57d 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminLevel.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminLevel.java @@ -26,48 +26,35 @@ import com.l2jserver.gameserver.model.L2Object; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.SystemMessageId; -public class AdminLevel implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminLevel implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_add_level", "admin_set_level" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { L2Object targetChar = activeChar.getTarget(); StringTokenizer st = new StringTokenizer(command, " "); String actualCommand = st.nextToken(); // Get actual command String val = ""; - if (st.countTokens() >= 1) - { + if (st.countTokens() >= 1) { val = st.nextToken(); } - if (actualCommand.equalsIgnoreCase("admin_add_level")) - { - try - { - if (targetChar.isPlayer()) - { + if (actualCommand.equalsIgnoreCase("admin_add_level")) { + try { + if (targetChar.isPlayer()) { L2PcInstance targetPlayer = (L2PcInstance) targetChar; targetPlayer.addLevel(Integer.parseInt(val)); } - } - catch (NumberFormatException e) - { + } catch (NumberFormatException e) { activeChar.sendMessage("Wrong Number Format"); } - } - else if (actualCommand.equalsIgnoreCase("admin_set_level")) - { - try - { - if (!(targetChar instanceof L2PcInstance)) - { + } else if (actualCommand.equalsIgnoreCase("admin_set_level")) { + try { + if (!(targetChar instanceof L2PcInstance)) { activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT); return false; } @@ -75,17 +62,14 @@ public class AdminLevel implements IAdminCommandHandler int oldLevel = targetPlayer.getLevel(); int newLevel = Integer.parseInt(val); - if (newLevel < 1) - { + if (newLevel < 1) { newLevel = 1; } targetPlayer.setLevel(newLevel); targetPlayer.setExp(ExperienceData.getInstance().getExpForLevel(Math.min(newLevel, targetPlayer.getMaxExpLevel()))); targetPlayer.onLevelChange(newLevel > oldLevel); targetPlayer.broadcastInfo(); - } - catch (NumberFormatException e) - { + } catch (NumberFormatException e) { activeChar.sendMessage("Level require number as value!"); return false; } @@ -94,8 +78,7 @@ public class AdminLevel implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminLogin.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminLogin.java index 0fb2e2bd45..20bc7803d0 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminLogin.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminLogin.java @@ -33,10 +33,8 @@ import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; * This class handles the admin commands that acts on the login * @version $Revision: 1.2.2.1.2.4 $ $Date: 2007/07/31 10:05:56 $ */ -public class AdminLogin implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminLogin implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_server_gm_only", "admin_server_all", "admin_server_max_player", @@ -46,127 +44,89 @@ public class AdminLogin implements IAdminCommandHandler }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.equals("admin_server_gm_only")) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.equals("admin_server_gm_only")) { gmOnly(); activeChar.sendMessage("Server is now GM only"); showMainPage(activeChar); - } - else if (command.equals("admin_server_all")) - { + } else if (command.equals("admin_server_all")) { allowToAll(); activeChar.sendMessage("Server is not GM only anymore"); showMainPage(activeChar); - } - else if (command.startsWith("admin_server_max_player")) - { + } else if (command.startsWith("admin_server_max_player")) { StringTokenizer st = new StringTokenizer(command); - if (st.countTokens() > 1) - { + if (st.countTokens() > 1) { st.nextToken(); String number = st.nextToken(); - try - { + try { LoginServerThread.getInstance().setMaxPlayer(Integer.parseInt(number)); activeChar.sendMessage("maxPlayer set to " + number); showMainPage(activeChar); - } - catch (NumberFormatException e) - { + } catch (NumberFormatException e) { activeChar.sendMessage("Max players must be a number."); } - } - else - { + } else { activeChar.sendMessage("Format is server_max_player <max>"); } - } - else if (command.startsWith("admin_server_list_type")) - { + } else if (command.startsWith("admin_server_list_type")) { StringTokenizer st = new StringTokenizer(command); int tokens = st.countTokens(); - if (tokens > 1) - { + if (tokens > 1) { st.nextToken(); String[] modes = new String[tokens - 1]; - for (int i = 0; i < (tokens - 1); i++) - { + for (int i = 0; i < (tokens - 1); i++) { modes[i] = st.nextToken().trim(); } int newType = 0; - try - { + try { newType = Integer.parseInt(modes[0]); - } - catch (NumberFormatException e) - { + } catch (NumberFormatException e) { newType = ServerListTypeConverter.getServerTypeId(modes); } - if (general().getServerListType() != newType) - { + if (general().getServerListType() != newType) { general().setProperty("ServerListType", String.valueOf(newType)); LoginServerThread.getInstance().sendServerType(); activeChar.sendMessage("Server Type changed to " + getServerTypeName(newType)); showMainPage(activeChar); - } - else - { + } else { activeChar.sendMessage("Server Type is already " + getServerTypeName(newType)); showMainPage(activeChar); } - } - else - { + } else { activeChar.sendMessage("Format is server_list_type <normal/relax/test/nolabel/restricted/event/free>"); } - } - else if (command.startsWith("admin_server_list_age")) - { + } else if (command.startsWith("admin_server_list_age")) { StringTokenizer st = new StringTokenizer(command); - if (st.countTokens() > 1) - { + if (st.countTokens() > 1) { st.nextToken(); String mode = st.nextToken(); int age = 0; - try - { + try { age = Integer.parseInt(mode); - if (general().getServerListAge() != age) - { + if (general().getServerListAge() != age) { general().setProperty("ServerListAge", String.valueOf(age)); LoginServerThread.getInstance().sendServerStatus(ServerStatus.SERVER_AGE, age); activeChar.sendMessage("Server Age changed to " + age); showMainPage(activeChar); - } - else - { + } else { activeChar.sendMessage("Server Age is already " + age); showMainPage(activeChar); } - } - catch (NumberFormatException e) - { + } catch (NumberFormatException e) { activeChar.sendMessage("Age must be a number"); } - } - else - { + } else { activeChar.sendMessage("Format is server_list_age <number>"); } - } - else if (command.equals("admin_server_login")) - { + } else if (command.equals("admin_server_login")) { showMainPage(activeChar); } return true; } - private void showMainPage(L2PcInstance activeChar) - { + private void showMainPage(L2PcInstance activeChar) { final NpcHtmlMessage html = new NpcHtmlMessage(); html.setFile(activeChar.getHtmlPrefix(), "data/html/admin/login.htm"); html.replace("%server_name%", LoginServerThread.getInstance().getServerName()); @@ -177,22 +137,17 @@ public class AdminLogin implements IAdminCommandHandler activeChar.sendPacket(html); } - private String getServerTypeName(int serverType) - { + private String getServerTypeName(int serverType) { String nameType = ""; - for (int i = 0; i < 7; i++) - { + for (int i = 0; i < 7; i++) { int currentType = serverType & (int) Math.pow(2, i); - if (currentType > 0) - { - if (!nameType.isEmpty()) - { + if (currentType > 0) { + if (!nameType.isEmpty()) { nameType += "+"; } - switch (currentType) - { + switch (currentType) { case 0x01: nameType += "Normal"; break; @@ -220,21 +175,18 @@ public class AdminLogin implements IAdminCommandHandler return nameType; } - private void allowToAll() - { + private void allowToAll() { LoginServerThread.getInstance().setServerStatus(ServerStatus.STATUS_AUTO); general().setProperty("ServerGMOnly", "false"); } - private void gmOnly() - { + private void gmOnly() { LoginServerThread.getInstance().setServerStatus(ServerStatus.STATUS_GM_ONLY); general().setProperty("ServerGMOnly", "true"); } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminMammon.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminMammon.java index ea8b328140..c51693f70c 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminMammon.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminMammon.java @@ -30,10 +30,8 @@ import com.l2jserver.gameserver.network.SystemMessageId; * Admin Command Handler for Mammon NPCs * @author Tempy, Zoey76 */ -public class AdminMammon implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminMammon implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_mammon_find", "admin_mammon_respawn", }; @@ -41,92 +39,66 @@ public class AdminMammon implements IAdminCommandHandler private final boolean _isSealValidation = SevenSigns.getInstance().isSealValidationPeriod(); @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { int teleportIndex = -1; final AutoSpawnInstance blackSpawnInst = AutoSpawnHandler.getInstance().getAutoSpawnInstance(SevenSigns.MAMMON_BLACKSMITH_ID, false); final AutoSpawnInstance merchSpawnInst = AutoSpawnHandler.getInstance().getAutoSpawnInstance(SevenSigns.MAMMON_MERCHANT_ID, false); - if (command.startsWith("admin_mammon_find")) - { - try - { - if (command.length() > 17) - { + if (command.startsWith("admin_mammon_find")) { + try { + if (command.length() > 17) { teleportIndex = Integer.parseInt(command.substring(18)); } - } - catch (Exception NumberFormatException) - { + } catch (Exception NumberFormatException) { activeChar.sendMessage("Usage: //mammon_find [teleportIndex] (where 1 = Blacksmith, 2 = Merchant)"); return false; } - if (!_isSealValidation) - { + if (!_isSealValidation) { activeChar.sendPacket(SystemMessageId.SSQ_COMPETITION_UNDERWAY); return false; } - if (blackSpawnInst != null) - { + if (blackSpawnInst != null) { final L2Npc blackInst = blackSpawnInst.getNPCInstanceList().peek(); - if (blackInst != null) - { + if (blackInst != null) { activeChar.sendMessage("Blacksmith of Mammon: " + blackInst.getX() + " " + blackInst.getY() + " " + blackInst.getZ()); - if (teleportIndex == 1) - { + if (teleportIndex == 1) { activeChar.teleToLocation(blackInst.getLocation(), true); } } - } - else - { + } else { activeChar.sendMessage("Blacksmith of Mammon isn't registered for spawn."); } - if (merchSpawnInst != null) - { + if (merchSpawnInst != null) { final L2Npc merchInst = merchSpawnInst.getNPCInstanceList().peek(); - if (merchInst != null) - { + if (merchInst != null) { activeChar.sendMessage("Merchant of Mammon: " + merchInst.getX() + " " + merchInst.getY() + " " + merchInst.getZ()); - if (teleportIndex == 2) - { + if (teleportIndex == 2) { activeChar.teleToLocation(merchInst.getLocation(), true); } } - } - else - { + } else { activeChar.sendMessage("Merchant of Mammon isn't registered for spawn."); } - } - else if (command.startsWith("admin_mammon_respawn")) - { - if (!_isSealValidation) - { + } else if (command.startsWith("admin_mammon_respawn")) { + if (!_isSealValidation) { activeChar.sendPacket(SystemMessageId.SSQ_COMPETITION_UNDERWAY); return true; } - if (merchSpawnInst != null) - { + if (merchSpawnInst != null) { long merchRespawn = AutoSpawnHandler.getInstance().getTimeToNextSpawn(merchSpawnInst); activeChar.sendMessage("The Merchant of Mammon will respawn in " + (merchRespawn / 60000) + " minute(s)."); - } - else - { + } else { activeChar.sendMessage("Merchant of Mammon isn't registered for spawn."); } - if (blackSpawnInst != null) - { + if (blackSpawnInst != null) { long blackRespawn = AutoSpawnHandler.getInstance().getTimeToNextSpawn(blackSpawnInst); activeChar.sendMessage("The Blacksmith of Mammon will respawn in " + (blackRespawn / 60000) + " minute(s)."); - } - else - { + } else { activeChar.sendMessage("Blacksmith of Mammon isn't registered for spawn."); } } @@ -134,8 +106,7 @@ public class AdminMammon implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminManor.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminManor.java index 78031b8078..42bbdc1c8a 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminManor.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminManor.java @@ -30,11 +30,9 @@ import com.l2jserver.gameserver.util.Util; /** * @author malyelfik */ -public final class AdminManor implements IAdminCommandHandler -{ +public final class AdminManor implements IAdminCommandHandler { @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { final CastleManorManager manor = CastleManorManager.getInstance(); final NpcHtmlMessage msg = new NpcHtmlMessage(); msg.setFile(activeChar.getHtmlPrefix(), "data/html/admin/manor.htm"); @@ -42,8 +40,7 @@ public final class AdminManor implements IAdminCommandHandler msg.replace("%change%", manor.getNextModeChange()); final StringBuilder sb = new StringBuilder(3400); - for (Castle c : CastleManager.getInstance().getCastles()) - { + for (Castle c : CastleManager.getInstance().getCastles()) { StringUtil.append(sb, "<tr><td>Name:</td><td><font color=008000>" + c.getName() + "</font></td></tr>"); StringUtil.append(sb, "<tr><td>Current period cost:</td><td><font color=FF9900>", Util.formatAdena(manor.getManorCost(c.getResidenceId(), false)), " Adena</font></td></tr>"); StringUtil.append(sb, "<tr><td>Next period cost:</td><td><font color=FF9900>", Util.formatAdena(manor.getManorCost(c.getResidenceId(), true)), " Adena</font></td></tr>"); @@ -57,10 +54,8 @@ public final class AdminManor implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { - return new String[] - { + public String[] getAdminCommandList() { + return new String[] { "admin_manor" }; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminMenu.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminMenu.java index cd894cd601..a8745656a0 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminMenu.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminMenu.java @@ -39,12 +39,10 @@ import com.l2jserver.gameserver.network.SystemMessageId; * This class handles following admin commands: - handles every admin menu command * @version $Revision: 1.3.2.6.2.4 $ $Date: 2005/04/11 10:06:06 $ */ -public class AdminMenu implements IAdminCommandHandler -{ +public class AdminMenu implements IAdminCommandHandler { private static final Logger _log = Logger.getLogger(AdminMenu.class.getName()); - private static final String[] ADMIN_COMMANDS = - { + private static final String[] ADMIN_COMMANDS = { "admin_char_manage", "admin_teleport_character_to_menu", "admin_recall_char_menu", @@ -58,141 +56,97 @@ public class AdminMenu implements IAdminCommandHandler }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.equals("admin_char_manage")) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.equals("admin_char_manage")) { showMainPage(activeChar); - } - else if (command.startsWith("admin_teleport_character_to_menu")) - { + } else if (command.startsWith("admin_teleport_character_to_menu")) { String[] data = command.split(" "); - if (data.length == 5) - { + if (data.length == 5) { String playerName = data[1]; L2PcInstance player = L2World.getInstance().getPlayer(playerName); - if (player != null) - { + if (player != null) { teleportCharacter(player, new Location(Integer.parseInt(data[2]), Integer.parseInt(data[3]), Integer.parseInt(data[4])), activeChar, "Admin is teleporting you."); } } showMainPage(activeChar); - } - else if (command.startsWith("admin_recall_char_menu")) - { - try - { + } else if (command.startsWith("admin_recall_char_menu")) { + try { String targetName = command.substring(23); L2PcInstance player = L2World.getInstance().getPlayer(targetName); teleportCharacter(player, activeChar.getLocation(), activeChar, "Admin is teleporting you."); + } catch (StringIndexOutOfBoundsException e) { } - catch (StringIndexOutOfBoundsException e) - { - } - } - else if (command.startsWith("admin_recall_party_menu")) - { - try - { + } else if (command.startsWith("admin_recall_party_menu")) { + try { String targetName = command.substring(24); L2PcInstance player = L2World.getInstance().getPlayer(targetName); - if (player == null) - { + if (player == null) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return true; } - if (!player.isInParty()) - { + if (!player.isInParty()) { activeChar.sendMessage("Player is not in party."); teleportCharacter(player, activeChar.getLocation(), activeChar, "Admin is teleporting you."); return true; } - for (L2PcInstance pm : player.getParty().getMembers()) - { + for (L2PcInstance pm : player.getParty().getMembers()) { teleportCharacter(pm, activeChar.getLocation(), activeChar, "Your party is being teleported by an Admin."); } - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, "", e); } - } - else if (command.startsWith("admin_recall_clan_menu")) - { - try - { + } else if (command.startsWith("admin_recall_clan_menu")) { + try { String targetName = command.substring(23); L2PcInstance player = L2World.getInstance().getPlayer(targetName); - if (player == null) - { + if (player == null) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return true; } L2Clan clan = player.getClan(); - if (clan == null) - { + if (clan == null) { activeChar.sendMessage("Player is not in a clan."); teleportCharacter(player, activeChar.getLocation(), activeChar, "Admin is teleporting you."); return true; } - for (L2PcInstance member : clan.getOnlineMembers(0)) - { + for (L2PcInstance member : clan.getOnlineMembers(0)) { teleportCharacter(member, activeChar.getLocation(), activeChar, "Your clan is being teleported by an Admin."); } - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, "", e); } - } - else if (command.startsWith("admin_goto_char_menu")) - { - try - { + } else if (command.startsWith("admin_goto_char_menu")) { + try { String targetName = command.substring(21); L2PcInstance player = L2World.getInstance().getPlayer(targetName); activeChar.setInstanceId(player.getInstanceId()); teleportToCharacter(activeChar, player); + } catch (StringIndexOutOfBoundsException e) { } - catch (StringIndexOutOfBoundsException e) - { - } - } - else if (command.equals("admin_kill_menu")) - { + } else if (command.equals("admin_kill_menu")) { handleKill(activeChar); - } - else if (command.startsWith("admin_kick_menu")) - { + } else if (command.startsWith("admin_kick_menu")) { StringTokenizer st = new StringTokenizer(command); - if (st.countTokens() > 1) - { + if (st.countTokens() > 1) { st.nextToken(); String player = st.nextToken(); L2PcInstance plyr = L2World.getInstance().getPlayer(player); String text; - if (plyr != null) - { + if (plyr != null) { plyr.logout(); text = "You kicked " + plyr.getName() + " from the game."; - } - else - { + } else { text = "Player " + player + " was not found in the game."; } activeChar.sendMessage(text); } showMainPage(activeChar); - } - else if (command.startsWith("admin_ban_menu")) - { + } else if (command.startsWith("admin_ban_menu")) { StringTokenizer st = new StringTokenizer(command); - if (st.countTokens() > 1) - { + if (st.countTokens() > 1) { String subCommand = "admin_ban_char"; - if (!AdminData.getInstance().hasAccess(subCommand, activeChar.getAccessLevel())) - { + if (!AdminData.getInstance().hasAccess(subCommand, activeChar.getAccessLevel())) { activeChar.sendMessage("You don't have the access right to use this command!"); _log.warning("Character " + activeChar.getName() + " tryed to use admin command " + subCommand + ", but have no access to it!"); return false; @@ -201,15 +155,11 @@ public class AdminMenu implements IAdminCommandHandler ach.useAdminCommand(subCommand + command.substring(14), activeChar); } showMainPage(activeChar); - } - else if (command.startsWith("admin_unban_menu")) - { + } else if (command.startsWith("admin_unban_menu")) { StringTokenizer st = new StringTokenizer(command); - if (st.countTokens() > 1) - { + if (st.countTokens() > 1) { String subCommand = "admin_unban_char"; - if (!AdminData.getInstance().hasAccess(subCommand, activeChar.getAccessLevel())) - { + if (!AdminData.getInstance().hasAccess(subCommand, activeChar.getAccessLevel())) { activeChar.sendMessage("You don't have the access right to use this command!"); _log.warning("Character " + activeChar.getName() + " tryed to use admin command " + subCommand + ", but have no access to it!"); return false; @@ -223,81 +173,59 @@ public class AdminMenu implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } - private void handleKill(L2PcInstance activeChar) - { + private void handleKill(L2PcInstance activeChar) { handleKill(activeChar, null); } - private void handleKill(L2PcInstance activeChar, String player) - { + private void handleKill(L2PcInstance activeChar, String player) { L2Object obj = activeChar.getTarget(); L2Character target = (L2Character) obj; String filename = "main_menu.htm"; - if (player != null) - { + if (player != null) { L2PcInstance plyr = L2World.getInstance().getPlayer(player); - if (plyr != null) - { + if (plyr != null) { target = plyr; activeChar.sendMessage("You killed " + plyr.getName()); } } - if (target != null) - { - if (target instanceof L2PcInstance) - { + if (target != null) { + if (target instanceof L2PcInstance) { target.reduceCurrentHp(target.getMaxHp() + target.getMaxCp() + 1, activeChar, null); filename = "charmanage.htm"; - } - else if (customs().championEnable() && target.isChampion()) - { + } else if (customs().championEnable() && target.isChampion()) { target.reduceCurrentHp((target.getMaxHp() * customs().getChampionHp()) + 1, activeChar, null); - } - else - { + } else { target.reduceCurrentHp(target.getMaxHp() + 1, activeChar, null); } - } - else - { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); } AdminHtml.showAdminHtml(activeChar, filename); } - private void teleportCharacter(L2PcInstance player, Location loc, L2PcInstance activeChar, String message) - { - if (player != null) - { + private void teleportCharacter(L2PcInstance player, Location loc, L2PcInstance activeChar, String message) { + if (player != null) { player.sendMessage(message); player.teleToLocation(loc, true); } showMainPage(activeChar); } - private void teleportToCharacter(L2PcInstance activeChar, L2Object target) - { + private void teleportToCharacter(L2PcInstance activeChar, L2Object target) { L2PcInstance player = null; - if (target instanceof L2PcInstance) - { + if (target instanceof L2PcInstance) { player = (L2PcInstance) target; - } - else - { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return; } - if (player.getObjectId() == activeChar.getObjectId()) - { + if (player.getObjectId() == activeChar.getObjectId()) { player.sendPacket(SystemMessageId.CANNOT_USE_ON_YOURSELF); - } - else - { + } else { activeChar.setInstanceId(player.getInstanceId()); activeChar.teleToLocation(player.getLocation(), true); activeChar.sendMessage("You're teleporting yourself to character " + player.getName()); @@ -308,8 +236,7 @@ public class AdminMenu implements IAdminCommandHandler /** * @param activeChar */ - private void showMainPage(L2PcInstance activeChar) - { + private void showMainPage(L2PcInstance activeChar) { AdminHtml.showAdminHtml(activeChar, "charmanage.htm"); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminMessages.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminMessages.java index d43ff0ed90..5cb0028b68 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminMessages.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminMessages.java @@ -29,34 +29,24 @@ import com.l2jserver.gameserver.util.Util; * admin_msgx is an extended version that allows to set parameters. * @author Zoey76 */ -public class AdminMessages implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminMessages implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_msg", "admin_msgx" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.startsWith("admin_msg ")) - { - try - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.startsWith("admin_msg ")) { + try { activeChar.sendPacket(SystemMessage.getSystemMessage(Integer.parseInt(command.substring(10).trim()))); return true; - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Command format: //msg <SYSTEM_MSG_ID>"); } - } - else if (command.startsWith("admin_msgx ")) - { + } else if (command.startsWith("admin_msgx ")) { String[] tokens = command.split(" "); - if ((tokens.length <= 2) || !Util.isDigit(tokens[1])) - { + if ((tokens.length <= 2) || !Util.isDigit(tokens[1])) { activeChar.sendMessage("Command format: //msgx <SYSTEM_MSG_ID> [item:Id] [skill:Id] [npc:Id] [zone:x,y,x] [castle:Id] [str:'text']"); return false; } @@ -64,43 +54,28 @@ public class AdminMessages implements IAdminCommandHandler SystemMessage sm = SystemMessage.getSystemMessage(Integer.parseInt(tokens[1])); String val; int lastPos = 0; - for (int i = 2; i < tokens.length; i++) - { - try - { + for (int i = 2; i < tokens.length; i++) { + try { val = tokens[i]; - if (val.startsWith("item:")) - { + if (val.startsWith("item:")) { sm.addItemName(Integer.parseInt(val.substring(5))); - } - else if (val.startsWith("skill:")) - { + } else if (val.startsWith("skill:")) { sm.addSkillName(Integer.parseInt(val.substring(6))); - } - else if (val.startsWith("npc:")) - { + } else if (val.startsWith("npc:")) { sm.addNpcName(Integer.parseInt(val.substring(4))); - } - else if (val.startsWith("zone:")) - { + } else if (val.startsWith("zone:")) { int x = Integer.parseInt(val.substring(5, val.indexOf(","))); int y = Integer.parseInt(val.substring(val.indexOf(",") + 1, val.lastIndexOf(","))); int z = Integer.parseInt(val.substring(val.lastIndexOf(",") + 1, val.length())); sm.addZoneName(x, y, z); - } - else if (val.startsWith("castle:")) - { + } else if (val.startsWith("castle:")) { sm.addCastleId(Integer.parseInt(val.substring(7))); - } - else if (val.startsWith("str:")) - { + } else if (val.startsWith("str:")) { final int pos = command.indexOf("'", lastPos + 1); lastPos = command.indexOf("'", pos + 1); sm.addString(command.substring(pos + 1, lastPos)); } - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Exception: " + e.getMessage()); continue; } @@ -111,8 +86,7 @@ public class AdminMessages implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminMobGroup.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminMobGroup.java index 2f033e7554..00e4f2e9af 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminMobGroup.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminMobGroup.java @@ -34,10 +34,8 @@ import com.l2jserver.gameserver.util.Broadcast; /** * @author littlecrow Admin commands handler for controllable mobs */ -public class AdminMobGroup implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminMobGroup implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_mobmenu", "admin_mobgroup_list", "admin_mobgroup_create", @@ -58,79 +56,44 @@ public class AdminMobGroup implements IAdminCommandHandler }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.equals("admin_mobmenu")) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.equals("admin_mobmenu")) { showMainPage(activeChar, command); return true; - } - else if (command.equals("admin_mobgroup_list")) - { + } else if (command.equals("admin_mobgroup_list")) { showGroupList(activeChar); - } - else if (command.startsWith("admin_mobgroup_create")) - { + } else if (command.startsWith("admin_mobgroup_create")) { createGroup(command, activeChar); - } - else if (command.startsWith("admin_mobgroup_delete") || command.startsWith("admin_mobgroup_remove")) - { + } else if (command.startsWith("admin_mobgroup_delete") || command.startsWith("admin_mobgroup_remove")) { removeGroup(command, activeChar); - } - else if (command.startsWith("admin_mobgroup_spawn")) - { + } else if (command.startsWith("admin_mobgroup_spawn")) { spawnGroup(command, activeChar); - } - else if (command.startsWith("admin_mobgroup_unspawn")) - { + } else if (command.startsWith("admin_mobgroup_unspawn")) { unspawnGroup(command, activeChar); - } - else if (command.startsWith("admin_mobgroup_kill")) - { + } else if (command.startsWith("admin_mobgroup_kill")) { killGroup(command, activeChar); - } - else if (command.startsWith("admin_mobgroup_attackgrp")) - { + } else if (command.startsWith("admin_mobgroup_attackgrp")) { attackGrp(command, activeChar); - } - else if (command.startsWith("admin_mobgroup_attack")) - { - if (activeChar.getTarget() instanceof L2Character) - { + } else if (command.startsWith("admin_mobgroup_attack")) { + if (activeChar.getTarget() instanceof L2Character) { L2Character target = (L2Character) activeChar.getTarget(); attack(command, activeChar, target); } - } - else if (command.startsWith("admin_mobgroup_rnd")) - { + } else if (command.startsWith("admin_mobgroup_rnd")) { setNormal(command, activeChar); - } - else if (command.startsWith("admin_mobgroup_idle")) - { + } else if (command.startsWith("admin_mobgroup_idle")) { idle(command, activeChar); - } - else if (command.startsWith("admin_mobgroup_return")) - { + } else if (command.startsWith("admin_mobgroup_return")) { returnToChar(command, activeChar); - } - else if (command.startsWith("admin_mobgroup_follow")) - { + } else if (command.startsWith("admin_mobgroup_follow")) { follow(command, activeChar, activeChar); - } - else if (command.startsWith("admin_mobgroup_casting")) - { + } else if (command.startsWith("admin_mobgroup_casting")) { setCasting(command, activeChar); - } - else if (command.startsWith("admin_mobgroup_nomove")) - { + } else if (command.startsWith("admin_mobgroup_nomove")) { noMove(command, activeChar); - } - else if (command.startsWith("admin_mobgroup_invul")) - { + } else if (command.startsWith("admin_mobgroup_invul")) { invul(command, activeChar); - } - else if (command.startsWith("admin_mobgroup_teleport")) - { + } else if (command.startsWith("admin_mobgroup_teleport")) { teleportGroup(command, activeChar); } showMainPage(activeChar, command); @@ -141,148 +104,116 @@ public class AdminMobGroup implements IAdminCommandHandler * @param activeChar * @param command */ - private void showMainPage(L2PcInstance activeChar, String command) - { + private void showMainPage(L2PcInstance activeChar, String command) { String filename = "mobgroup.htm"; AdminHtml.showAdminHtml(activeChar, filename); } - private void returnToChar(String command, L2PcInstance activeChar) - { + private void returnToChar(String command, L2PcInstance activeChar) { int groupId; - try - { + try { groupId = Integer.parseInt(command.split(" ")[1]); - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Incorrect command arguments."); return; } MobGroup group = MobGroupTable.getInstance().getGroup(groupId); - if (group == null) - { + if (group == null) { activeChar.sendMessage("Invalid group specified."); return; } group.returnGroup(activeChar); } - private void idle(String command, L2PcInstance activeChar) - { + private void idle(String command, L2PcInstance activeChar) { int groupId; - try - { + try { groupId = Integer.parseInt(command.split(" ")[1]); - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Incorrect command arguments."); return; } MobGroup group = MobGroupTable.getInstance().getGroup(groupId); - if (group == null) - { + if (group == null) { activeChar.sendMessage("Invalid group specified."); return; } group.setIdleMode(); } - private void setNormal(String command, L2PcInstance activeChar) - { + private void setNormal(String command, L2PcInstance activeChar) { int groupId; - try - { + try { groupId = Integer.parseInt(command.split(" ")[1]); - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Incorrect command arguments."); return; } MobGroup group = MobGroupTable.getInstance().getGroup(groupId); - if (group == null) - { + if (group == null) { activeChar.sendMessage("Invalid group specified."); return; } group.setAttackRandom(); } - private void attack(String command, L2PcInstance activeChar, L2Character target) - { + private void attack(String command, L2PcInstance activeChar, L2Character target) { int groupId; - try - { + try { groupId = Integer.parseInt(command.split(" ")[1]); - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Incorrect command arguments."); return; } MobGroup group = MobGroupTable.getInstance().getGroup(groupId); - if (group == null) - { + if (group == null) { activeChar.sendMessage("Invalid group specified."); return; } group.setAttackTarget(target); } - private void follow(String command, L2PcInstance activeChar, L2Character target) - { + private void follow(String command, L2PcInstance activeChar, L2Character target) { int groupId; - try - { + try { groupId = Integer.parseInt(command.split(" ")[1]); - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Incorrect command arguments."); return; } MobGroup group = MobGroupTable.getInstance().getGroup(groupId); - if (group == null) - { + if (group == null) { activeChar.sendMessage("Invalid group specified."); return; } group.setFollowMode(target); } - private void createGroup(String command, L2PcInstance activeChar) - { + private void createGroup(String command, L2PcInstance activeChar) { int groupId; int templateId; int mobCount; - try - { + try { String[] cmdParams = command.split(" "); groupId = Integer.parseInt(cmdParams[1]); templateId = Integer.parseInt(cmdParams[2]); mobCount = Integer.parseInt(cmdParams[3]); - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //mobgroup_create <group> <npcid> <count>"); return; } - if (MobGroupTable.getInstance().getGroup(groupId) != null) - { + if (MobGroupTable.getInstance().getGroup(groupId) != null) { activeChar.sendMessage("Mob group " + groupId + " already exists."); return; } L2NpcTemplate template = NpcData.getInstance().getTemplate(templateId); - if (template == null) - { + if (template == null) { activeChar.sendMessage("Invalid NPC ID specified."); return; } @@ -293,24 +224,19 @@ public class AdminMobGroup implements IAdminCommandHandler activeChar.sendMessage("Mob group " + groupId + " created."); } - private void removeGroup(String command, L2PcInstance activeChar) - { + private void removeGroup(String command, L2PcInstance activeChar) { int groupId; - try - { + try { groupId = Integer.parseInt(command.split(" ")[1]); - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //mobgroup_remove <groupId>"); return; } MobGroup group = MobGroupTable.getInstance().getGroup(groupId); - if (group == null) - { + if (group == null) { activeChar.sendMessage("Invalid group specified."); return; } @@ -318,83 +244,66 @@ public class AdminMobGroup implements IAdminCommandHandler doAnimation(activeChar); group.unspawnGroup(); - if (MobGroupTable.getInstance().removeGroup(groupId)) - { + if (MobGroupTable.getInstance().removeGroup(groupId)) { activeChar.sendMessage("Mob group " + groupId + " unspawned and removed."); } } - private void spawnGroup(String command, L2PcInstance activeChar) - { + private void spawnGroup(String command, L2PcInstance activeChar) { int groupId; boolean topos = false; int posx = 0; int posy = 0; int posz = 0; - try - { + try { String[] cmdParams = command.split(" "); groupId = Integer.parseInt(cmdParams[1]); - try - { // we try to get a position + try { // we try to get a position posx = Integer.parseInt(cmdParams[2]); posy = Integer.parseInt(cmdParams[3]); posz = Integer.parseInt(cmdParams[4]); topos = true; - } - catch (Exception e) - { + } catch (Exception e) { // no position given } - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //mobgroup_spawn <group> [ x y z ]"); return; } MobGroup group = MobGroupTable.getInstance().getGroup(groupId); - if (group == null) - { + if (group == null) { activeChar.sendMessage("Invalid group specified."); return; } doAnimation(activeChar); - if (topos) - { + if (topos) { group.spawnGroup(posx, posy, posz); - } - else - { + } else { group.spawnGroup(activeChar); } activeChar.sendMessage("Mob group " + groupId + " spawned."); } - private void unspawnGroup(String command, L2PcInstance activeChar) - { + private void unspawnGroup(String command, L2PcInstance activeChar) { int groupId; - try - { + try { groupId = Integer.parseInt(command.split(" ")[1]); - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //mobgroup_unspawn <groupId>"); return; } MobGroup group = MobGroupTable.getInstance().getGroup(groupId); - if (group == null) - { + if (group == null) { activeChar.sendMessage("Invalid group specified."); return; } @@ -405,24 +314,19 @@ public class AdminMobGroup implements IAdminCommandHandler activeChar.sendMessage("Mob group " + groupId + " unspawned."); } - private void killGroup(String command, L2PcInstance activeChar) - { + private void killGroup(String command, L2PcInstance activeChar) { int groupId; - try - { + try { groupId = Integer.parseInt(command.split(" ")[1]); - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //mobgroup_kill <groupId>"); return; } MobGroup group = MobGroupTable.getInstance().getGroup(groupId); - if (group == null) - { + if (group == null) { activeChar.sendMessage("Invalid group specified."); return; } @@ -431,24 +335,19 @@ public class AdminMobGroup implements IAdminCommandHandler group.killGroup(activeChar); } - private void setCasting(String command, L2PcInstance activeChar) - { + private void setCasting(String command, L2PcInstance activeChar) { int groupId; - try - { + try { groupId = Integer.parseInt(command.split(" ")[1]); - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //mobgroup_casting <groupId>"); return; } MobGroup group = MobGroupTable.getInstance().getGroup(groupId); - if (group == null) - { + if (group == null) { activeChar.sendMessage("Invalid group specified."); return; } @@ -456,78 +355,61 @@ public class AdminMobGroup implements IAdminCommandHandler group.setCastMode(); } - private void noMove(String command, L2PcInstance activeChar) - { + private void noMove(String command, L2PcInstance activeChar) { int groupId; String enabled; - try - { + try { groupId = Integer.parseInt(command.split(" ")[1]); enabled = command.split(" ")[2]; - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //mobgroup_nomove <groupId> <on|off>"); return; } MobGroup group = MobGroupTable.getInstance().getGroup(groupId); - if (group == null) - { + if (group == null) { activeChar.sendMessage("Invalid group specified."); return; } - if (enabled.equalsIgnoreCase("on") || enabled.equalsIgnoreCase("true")) - { + if (enabled.equalsIgnoreCase("on") || enabled.equalsIgnoreCase("true")) { group.setNoMoveMode(true); - } - else if (enabled.equalsIgnoreCase("off") || enabled.equalsIgnoreCase("false")) - { + } else if (enabled.equalsIgnoreCase("off") || enabled.equalsIgnoreCase("false")) { group.setNoMoveMode(false); - } - else - { + } else { activeChar.sendMessage("Incorrect command arguments."); } } - private void doAnimation(L2PcInstance activeChar) - { + private void doAnimation(L2PcInstance activeChar) { Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, 1008, 1, 4000, 0), 1500); activeChar.sendPacket(new SetupGauge(0, 4000)); } - private void attackGrp(String command, L2PcInstance activeChar) - { + private void attackGrp(String command, L2PcInstance activeChar) { int groupId; int othGroupId; - try - { + try { groupId = Integer.parseInt(command.split(" ")[1]); othGroupId = Integer.parseInt(command.split(" ")[2]); - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //mobgroup_attackgrp <groupId> <TargetGroupId>"); return; } MobGroup group = MobGroupTable.getInstance().getGroup(groupId); - if (group == null) - { + if (group == null) { activeChar.sendMessage("Invalid group specified."); return; } MobGroup othGroup = MobGroupTable.getInstance().getGroup(othGroupId); - if (othGroup == null) - { + if (othGroup == null) { activeChar.sendMessage("Incorrect target group."); return; } @@ -535,75 +417,58 @@ public class AdminMobGroup implements IAdminCommandHandler group.setAttackGroup(othGroup); } - private void invul(String command, L2PcInstance activeChar) - { + private void invul(String command, L2PcInstance activeChar) { int groupId; String enabled; - try - { + try { groupId = Integer.parseInt(command.split(" ")[1]); enabled = command.split(" ")[2]; - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //mobgroup_invul <groupId> <on|off>"); return; } MobGroup group = MobGroupTable.getInstance().getGroup(groupId); - if (group == null) - { + if (group == null) { activeChar.sendMessage("Invalid group specified."); return; } - if (enabled.equalsIgnoreCase("on") || enabled.equalsIgnoreCase("true")) - { + if (enabled.equalsIgnoreCase("on") || enabled.equalsIgnoreCase("true")) { group.setInvul(true); - } - else if (enabled.equalsIgnoreCase("off") || enabled.equalsIgnoreCase("false")) - { + } else if (enabled.equalsIgnoreCase("off") || enabled.equalsIgnoreCase("false")) { group.setInvul(false); - } - else - { + } else { activeChar.sendMessage("Incorrect command arguments."); } } - private void teleportGroup(String command, L2PcInstance activeChar) - { + private void teleportGroup(String command, L2PcInstance activeChar) { int groupId; String targetPlayerStr = null; L2PcInstance targetPlayer = null; - try - { + try { groupId = Integer.parseInt(command.split(" ")[1]); targetPlayerStr = command.split(" ")[2]; - if (targetPlayerStr != null) - { + if (targetPlayerStr != null) { targetPlayer = L2World.getInstance().getPlayer(targetPlayerStr); } - if (targetPlayer == null) - { + if (targetPlayer == null) { targetPlayer = activeChar; } - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //mobgroup_teleport <groupId> [playerName]"); return; } MobGroup group = MobGroupTable.getInstance().getGroup(groupId); - if (group == null) - { + if (group == null) { activeChar.sendMessage("Invalid group specified."); return; } @@ -611,14 +476,12 @@ public class AdminMobGroup implements IAdminCommandHandler group.teleportGroup(activeChar); } - private void showGroupList(L2PcInstance activeChar) - { + private void showGroupList(L2PcInstance activeChar) { MobGroup[] mobGroupList = MobGroupTable.getInstance().getGroups(); activeChar.sendMessage("======= <Mob Groups> ======="); - for (MobGroup mobGroup : mobGroupList) - { + for (MobGroup mobGroup : mobGroupList) { activeChar.sendMessage(mobGroup.getGroupId() + ": " + mobGroup.getActiveMobCount() + " alive out of " + mobGroup.getMaxMobCount() + " of NPC ID " + mobGroup.getTemplate().getId() + " (" + mobGroup.getStatus() + ")"); } @@ -626,8 +489,7 @@ public class AdminMobGroup implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminMonsterRace.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminMonsterRace.java index 7349b0ea90..e827b535fa 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminMonsterRace.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminMonsterRace.java @@ -34,41 +34,34 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * This class handles following admin commands: - invul = turns invulnerability on/off * @version $Revision: 1.1.6.4 $ $Date: 2007/07/31 10:06:00 $ */ -public class AdminMonsterRace implements IAdminCommandHandler -{ +public class AdminMonsterRace implements IAdminCommandHandler { // private static Logger _log = Logger.getLogger(AdminMonsterRace.class.getName()); - private static final String[] ADMIN_COMMANDS = - { + private static final String[] ADMIN_COMMANDS = { "admin_mons" }; protected static int state = -1; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.equalsIgnoreCase("admin_mons")) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.equalsIgnoreCase("admin_mons")) { handleSendPacket(activeChar); } return true; } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } - private void handleSendPacket(L2PcInstance activeChar) - { + private void handleSendPacket(L2PcInstance activeChar) { /* * -1 0 to initialize the race 0 15322 to start race 13765 -1 in middle of race -1 0 to end the race 8003 to 8027 */ - int[][] codes = - { + int[][] codes = { { -1, 0 @@ -88,17 +81,14 @@ public class AdminMonsterRace implements IAdminCommandHandler }; MonsterRace race = MonsterRace.getInstance(); - if (state == -1) - { + if (state == -1) { state++; race.newRace(); race.newSpeeds(); MonRaceInfo spk = new MonRaceInfo(codes[state][0], codes[state][1], race.getMonsters(), race.getSpeeds()); activeChar.sendPacket(spk); activeChar.broadcastPacket(spk); - } - else if (state == 0) - { + } else if (state == 0) { state++; SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.MONSRACE_RACE_START); sm.addInt(0); @@ -118,21 +108,18 @@ public class AdminMonsterRace implements IAdminCommandHandler } - class RunRace implements Runnable - { + class RunRace implements Runnable { private final int[][] codes; private final L2PcInstance activeChar; - public RunRace(int[][] pCodes, L2PcInstance pActiveChar) - { + public RunRace(int[][] pCodes, L2PcInstance pActiveChar) { codes = pCodes; activeChar = pActiveChar; } @Override - public void run() - { + public void run() { // int[][] speeds1 = MonsterRace.getInstance().getSpeeds(); // MonsterRace.getInstance().newSpeeds(); // int[][] speeds2 = MonsterRace.getInstance().getSpeeds(); @@ -147,21 +134,17 @@ public class AdminMonsterRace implements IAdminCommandHandler } } - private static class RunEnd implements Runnable - { + private static class RunEnd implements Runnable { private final L2PcInstance activeChar; - public RunEnd(L2PcInstance pActiveChar) - { + public RunEnd(L2PcInstance pActiveChar) { activeChar = pActiveChar; } @Override - public void run() - { + public void run() { DeleteObject obj = null; - for (int i = 0; i < 8; i++) - { + for (int i = 0; i < 8; i++) { obj = new DeleteObject(MonsterRace.getInstance().getMonsters()[i]); activeChar.sendPacket(obj); activeChar.broadcastPacket(obj); diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPForge.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPForge.java index a0907deb13..1df407cf07 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPForge.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPForge.java @@ -42,81 +42,61 @@ import com.l2jserver.mmocore.NioNetStringBuffer; * This class handles commands for gm to forge packets * @author Maktakien, HorridoJoho */ -public final class AdminPForge implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public final class AdminPForge implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_forge", "admin_forge_values", "admin_forge_send" }; - private String[] getOpCodes(StringTokenizer st) - { + private String[] getOpCodes(StringTokenizer st) { Collection<String> opCodes = null; - while (st.hasMoreTokens()) - { + while (st.hasMoreTokens()) { String token = st.nextToken(); - if (";".equals(token)) - { + if (";".equals(token)) { break; } - if (opCodes == null) - { + if (opCodes == null) { opCodes = new LinkedList<>(); } opCodes.add(token); } - if (opCodes == null) - { + if (opCodes == null) { return null; } return opCodes.toArray(new String[opCodes.size()]); } - private boolean validateOpCodes(String[] opCodes) - { - if ((opCodes == null) || (opCodes.length == 0) || (opCodes.length > 3)) - { + private boolean validateOpCodes(String[] opCodes) { + if ((opCodes == null) || (opCodes.length == 0) || (opCodes.length > 3)) { return false; } - for (int i = 0; i < opCodes.length; ++i) - { + for (int i = 0; i < opCodes.length; ++i) { final String opCode = opCodes[i]; long opCodeLong; - try - { + try { opCodeLong = Long.parseLong(opCode); - } - catch (Exception e) - { - if (i > 0) - { + } catch (Exception e) { + if (i > 0) { return true; } return false; } - if (opCodeLong < 0) - { + if (opCodeLong < 0) { return false; } - if ((i == 0) && (opCodeLong > 255)) - { + if ((i == 0) && (opCodeLong > 255)) { return false; - } - else if ((i == 1) && (opCodeLong > 65535)) - { + } else if ((i == 1) && (opCodeLong > 65535)) { return false; - } - else if ((i == 2) && (opCodeLong > 4294967295L)) - { + } else if ((i == 2) && (opCodeLong > 4294967295L)) { return false; } } @@ -124,12 +104,9 @@ public final class AdminPForge implements IAdminCommandHandler return true; } - private boolean validateFormat(String format) - { - for (int chIdx = 0; chIdx < format.length(); ++chIdx) - { - switch (format.charAt(chIdx)) - { + private boolean validateFormat(String format) { + for (int chIdx = 0; chIdx < format.length(); ++chIdx) { + switch (format.charAt(chIdx)) { case 'b': case 'B': case 'x': @@ -168,10 +145,8 @@ public final class AdminPForge implements IAdminCommandHandler return true; } - private boolean validateMethod(String method) - { - switch (method) - { + private boolean validateMethod(String method) { + switch (method) { case "sc": case "sb": case "cs": @@ -181,46 +156,34 @@ public final class AdminPForge implements IAdminCommandHandler return false; } - private void showValuesUsage(L2PcInstance activeChar) - { + private void showValuesUsage(L2PcInstance activeChar) { activeChar.sendMessage("Usage: //forge_values opcode1[ opcode2[ opcode3]] ;[ format]"); showMainPage(activeChar); } - private void showSendUsage(L2PcInstance activeChar, String[] opCodes, String format) - { + private void showSendUsage(L2PcInstance activeChar, String[] opCodes, String format) { activeChar.sendMessage("Usage: //forge_send sc|sb|cs opcode1[;opcode2[;opcode3]][ format value1 ... valueN] "); - if (opCodes == null) - { + if (opCodes == null) { showMainPage(activeChar); - } - else - { + } else { showValuesPage(activeChar, opCodes, format); } } - private void showMainPage(L2PcInstance activeChar) - { + private void showMainPage(L2PcInstance activeChar) { AdminHtml.showAdminHtml(activeChar, "pforge/main.htm"); } - private void showValuesPage(L2PcInstance activeChar, String[] opCodes, String format) - { + private void showValuesPage(L2PcInstance activeChar, String[] opCodes, String format) { String sendBypass = null; String valuesHtml = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/admin/pforge/values.htm"); - if (opCodes.length == 3) - { + if (opCodes.length == 3) { valuesHtml = valuesHtml.replace("%opformat%", "chd"); sendBypass = opCodes[0] + ";" + opCodes[1] + ";" + opCodes[2]; - } - else if (opCodes.length == 2) - { + } else if (opCodes.length == 2) { valuesHtml = valuesHtml.replace("%opformat%", "ch"); sendBypass = opCodes[0] + ";" + opCodes[1]; - } - else - { + } else { valuesHtml = valuesHtml.replace("%opformat%", "c"); sendBypass = opCodes[0]; } @@ -229,33 +192,26 @@ public final class AdminPForge implements IAdminCommandHandler String editorsHtml = ""; - if (format == null) - { + if (format == null) { valuesHtml = valuesHtml.replace("%format%", ""); editorsHtml = ""; - } - else - { + } else { valuesHtml = valuesHtml.replace("%format%", format); sendBypass += " " + format; String editorTemplate = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/admin/pforge/inc/editor.htm"); - if (editorTemplate != null) - { + if (editorTemplate != null) { StringBuilder singleCharSequence = new StringBuilder(1); singleCharSequence.append(' '); - for (int chIdx = 0; chIdx < format.length(); ++chIdx) - { + for (int chIdx = 0; chIdx < format.length(); ++chIdx) { char ch = format.charAt(chIdx); singleCharSequence.setCharAt(0, ch); editorsHtml += editorTemplate.replace("%format%", singleCharSequence).replace("%editor_index%", String.valueOf(chIdx)); sendBypass += " $v" + chIdx; } - } - else - { + } else { editorsHtml = ""; } } @@ -266,39 +222,30 @@ public final class AdminPForge implements IAdminCommandHandler } @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.equals("admin_forge")) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.equals("admin_forge")) { showMainPage(activeChar); - } - else if (command.startsWith("admin_forge_values ")) - { - try - { + } else if (command.startsWith("admin_forge_values ")) { + try { StringTokenizer st = new StringTokenizer(command); st.nextToken(); // skip command token - if (!st.hasMoreTokens()) - { + if (!st.hasMoreTokens()) { showValuesUsage(activeChar); return false; } String[] opCodes = getOpCodes(st); - if (!validateOpCodes(opCodes)) - { + if (!validateOpCodes(opCodes)) { activeChar.sendMessage("Invalid op codes!"); showValuesUsage(activeChar); return false; } String format = null; - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { format = st.nextToken(); - if (!validateFormat(format)) - { + if (!validateFormat(format)) { activeChar.sendMessage("Format invalid!"); showValuesUsage(activeChar); return false; @@ -306,49 +253,39 @@ public final class AdminPForge implements IAdminCommandHandler } showValuesPage(activeChar, opCodes, format); - } - catch (Exception e) - { + } catch (Exception e) { e.printStackTrace(); showValuesUsage(activeChar); return false; } - } - else if (command.startsWith("admin_forge_send ")) - { - try - { + } else if (command.startsWith("admin_forge_send ")) { + try { StringTokenizer st = new StringTokenizer(command); st.nextToken(); // skip command token - if (!st.hasMoreTokens()) - { + if (!st.hasMoreTokens()) { showSendUsage(activeChar, null, null); return false; } String method = st.nextToken(); - if (!validateMethod(method)) - { + if (!validateMethod(method)) { activeChar.sendMessage("Invalid method!"); showSendUsage(activeChar, null, null); return false; } String[] opCodes = st.nextToken().split(";"); - if (!validateOpCodes(opCodes)) - { + if (!validateOpCodes(opCodes)) { activeChar.sendMessage("Invalid op codes!"); showSendUsage(activeChar, null, null); return false; } String format = null; - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { format = st.nextToken(); - if (!validateFormat(format)) - { + if (!validateFormat(format)) { activeChar.sendMessage("Format invalid!"); showSendUsage(activeChar, null, null); return false; @@ -357,45 +294,31 @@ public final class AdminPForge implements IAdminCommandHandler AdminForgePacket afp = null; ByteBuffer bb = null; - for (int i = 0; i < opCodes.length; ++i) - { + for (int i = 0; i < opCodes.length; ++i) { char type; - if (i == 0) - { + if (i == 0) { type = 'c'; - } - else if (i == 1) - { + } else if (i == 1) { type = 'h'; - } - else - { + } else { type = 'd'; } - if (method.equals("sc") || method.equals("sb")) - { - if (afp == null) - { + if (method.equals("sc") || method.equals("sb")) { + if (afp == null) { afp = new AdminForgePacket(); } afp.addPart((byte) type, opCodes[i]); - } - else - { - if (bb == null) - { + } else { + if (bb == null) { bb = ByteBuffer.allocate(32767); } write((byte) type, opCodes[i], bb); } } - if (format != null) - { - for (int i = 0; i < format.length(); ++i) - { - if (!st.hasMoreTokens()) - { + if (format != null) { + for (int i = 0; i < format.length(); ++i) { + if (!st.hasMoreTokens()) { activeChar.sendMessage("Not enough values!"); showSendUsage(activeChar, null, null); return false; @@ -404,19 +327,15 @@ public final class AdminPForge implements IAdminCommandHandler L2Object target = null; L2BoatInstance boat = null; String value = st.nextToken(); - switch (value) - { + switch (value) { case "$oid": value = String.valueOf(activeChar.getObjectId()); break; case "$boid": boat = activeChar.getBoat(); - if (boat != null) - { + if (boat != null) { value = String.valueOf(boat.getObjectId()); - } - else - { + } else { value = "0"; } break; @@ -443,127 +362,92 @@ public final class AdminPForge implements IAdminCommandHandler break; case "$tboid": target = activeChar.getTarget(); - if ((target != null) && (target instanceof L2Playable)) - { + if ((target != null) && (target instanceof L2Playable)) { boat = ((L2Playable) target).getActingPlayer().getBoat(); - if (boat != null) - { + if (boat != null) { value = String.valueOf(boat.getObjectId()); - } - else - { + } else { value = "0"; } } break; case "$ttitle": target = activeChar.getTarget(); - if ((target != null) && (target instanceof L2Character)) - { + if ((target != null) && (target instanceof L2Character)) { value = String.valueOf(((L2Character) target).getTitle()); - } - else - { + } else { value = ""; } break; case "$tname": target = activeChar.getTarget(); - if (target != null) - { + if (target != null) { value = String.valueOf(target.getName()); - } - else - { + } else { value = ""; } break; case "$tx": target = activeChar.getTarget(); - if (target != null) - { + if (target != null) { value = String.valueOf(target.getX()); - } - else - { + } else { value = "0"; } break; case "$ty": target = activeChar.getTarget(); - if (target != null) - { + if (target != null) { value = String.valueOf(target.getY()); - } - else - { + } else { value = "0"; } break; case "$tz": target = activeChar.getTarget(); - if (target != null) - { + if (target != null) { value = String.valueOf(target.getZ()); - } - else - { + } else { value = "0"; } break; case "$theading": target = activeChar.getTarget(); - if (target != null) - { + if (target != null) { value = String.valueOf(target.getHeading()); - } - else - { + } else { value = "0"; } break; } - if (method.equals("sc") || method.equals("sb")) - { - if (afp != null) - { + if (method.equals("sc") || method.equals("sb")) { + if (afp != null) { afp.addPart((byte) format.charAt(i), value); } - } - else - { + } else { write((byte) format.charAt(i), value, bb); } } } - if (method.equals("sc")) - { + if (method.equals("sc")) { activeChar.sendPacket(afp); - } - else if (method.equals("sb")) - { + } else if (method.equals("sb")) { activeChar.broadcastPacket(afp); - } - else if (bb != null) - { + } else if (bb != null) { bb.flip(); L2GameClientPacket p = (L2GameClientPacket) GameServer.gameServer.getL2GamePacketHandler().handlePacket(bb, activeChar.getClient()); - if (p != null) - { + if (p != null) { p.setBuffers(bb, activeChar.getClient(), new NioNetStringBuffer(2000)); - if (p.read()) - { + if (p.read()) { ThreadPoolManager.getInstance().executePacket(p); } } } showValuesPage(activeChar, opCodes, format); - } - catch (Exception e) - { + } catch (Exception e) { e.printStackTrace(); showSendUsage(activeChar, null, null); return false; @@ -573,45 +457,30 @@ public final class AdminPForge implements IAdminCommandHandler return true; } - private boolean write(byte b, String string, ByteBuffer buf) - { - if ((b == 'C') || (b == 'c')) - { + private boolean write(byte b, String string, ByteBuffer buf) { + if ((b == 'C') || (b == 'c')) { buf.put(Byte.decode(string)); return true; - } - else if ((b == 'D') || (b == 'd')) - { + } else if ((b == 'D') || (b == 'd')) { buf.putInt(Integer.decode(string)); return true; - } - else if ((b == 'H') || (b == 'h')) - { + } else if ((b == 'H') || (b == 'h')) { buf.putShort(Short.decode(string)); return true; - } - else if ((b == 'F') || (b == 'f')) - { + } else if ((b == 'F') || (b == 'f')) { buf.putDouble(Double.parseDouble(string)); return true; - } - else if ((b == 'S') || (b == 's')) - { + } else if ((b == 'S') || (b == 's')) { final int len = string.length(); - for (int i = 0; i < len; i++) - { + for (int i = 0; i < len; i++) { buf.putChar(string.charAt(i)); } buf.putChar('\000'); return true; - } - else if ((b == 'B') || (b == 'b') || (b == 'X') || (b == 'x')) - { + } else if ((b == 'B') || (b == 'b') || (b == 'X') || (b == 'x')) { buf.put(new BigInteger(string).toByteArray()); return true; - } - else if ((b == 'Q') || (b == 'q')) - { + } else if ((b == 'Q') || (b == 'q')) { buf.putLong(Long.decode(string)); return true; } @@ -619,8 +488,7 @@ public final class AdminPForge implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPathNode.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPathNode.java index 1d03106efa..d07813ee73 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPathNode.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPathNode.java @@ -27,10 +27,8 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.pathfinding.AbstractNodeLoc; import com.l2jserver.gameserver.pathfinding.PathFinding; -public class AdminPathNode implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminPathNode implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_pn_info", "admin_show_path", "admin_path_debug", @@ -39,56 +37,37 @@ public class AdminPathNode implements IAdminCommandHandler }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.equals("admin_pn_info")) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.equals("admin_pn_info")) { final String[] info = PathFinding.getInstance().getStat(); - if (info == null) - { + if (info == null) { activeChar.sendMessage("Not supported"); - } - else - { - for (String msg : info) - { + } else { + for (String msg : info) { activeChar.sendMessage(msg); } } - } - else if (command.equals("admin_show_path")) - { + } else if (command.equals("admin_show_path")) { - } - else if (command.equals("admin_path_debug")) - { + } else if (command.equals("admin_path_debug")) { - } - else if (command.equals("admin_show_pn")) - { + } else if (command.equals("admin_show_pn")) { - } - else if (command.equals("admin_find_path")) - { + } else if (command.equals("admin_find_path")) { if (geodata().getPathFinding() == 0) { activeChar.sendMessage("PathFinding is disabled."); return true; } - if (activeChar.getTarget() != null) - { + if (activeChar.getTarget() != null) { List<AbstractNodeLoc> path = PathFinding.getInstance().findPath(activeChar.getX(), activeChar.getY(), (short) activeChar.getZ(), activeChar.getTarget().getX(), activeChar.getTarget().getY(), (short) activeChar.getTarget().getZ(), activeChar.getInstanceId(), true); - if (path == null) - { + if (path == null) { activeChar.sendMessage("No Route!"); return true; } - for (AbstractNodeLoc a : path) - { + for (AbstractNodeLoc a : path) { activeChar.sendMessage("x:" + a.getX() + " y:" + a.getY() + " z:" + a.getZ()); } - } - else - { + } else { activeChar.sendMessage("No Target!"); } } @@ -96,8 +75,7 @@ public class AdminPathNode implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPcCondOverride.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPcCondOverride.java index d8bd3742ba..045ca1e0ef 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPcCondOverride.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPcCondOverride.java @@ -30,80 +30,58 @@ import com.l2jserver.gameserver.util.Util; * Handler provides ability to override server's conditions for admin. * @author UnAfraid */ -public class AdminPcCondOverride implements IAdminCommandHandler -{ - private static final String[] COMMANDS = - { +public class AdminPcCondOverride implements IAdminCommandHandler { + private static final String[] COMMANDS = { "admin_exceptions", "admin_set_exception", }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { StringTokenizer st = new StringTokenizer(command); - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { switch (st.nextToken()) // command { - case "admin_exceptions": - { + case "admin_exceptions": { final NpcHtmlMessage msg = new NpcHtmlMessage(0, 1); msg.setFile(activeChar.getHtmlPrefix(), "data/html/admin/cond_override.htm"); StringBuilder sb = new StringBuilder(); - for (PcCondOverride ex : PcCondOverride.values()) - { + for (PcCondOverride ex : PcCondOverride.values()) { sb.append("<tr><td fixwidth=\"180\">" + ex.getDescription() + ":</td><td><a action=\"bypass -h admin_set_exception " + ex.ordinal() + "\">" + (activeChar.canOverrideCond(ex) ? "Disable" : "Enable") + "</a></td></tr>"); } msg.replace("%cond_table%", sb.toString()); activeChar.sendPacket(msg); break; } - case "admin_set_exception": - { - if (st.hasMoreTokens()) - { + case "admin_set_exception": { + if (st.hasMoreTokens()) { String token = st.nextToken(); - if (Util.isDigit(token)) - { + if (Util.isDigit(token)) { PcCondOverride ex = PcCondOverride.getCondOverride(Integer.valueOf(token)); - if (ex != null) - { - if (activeChar.canOverrideCond(ex)) - { + if (ex != null) { + if (activeChar.canOverrideCond(ex)) { activeChar.removeOverridedCond(ex); activeChar.sendMessage("You've disabled " + ex.getDescription()); - } - else - { + } else { activeChar.addOverrideCond(ex); activeChar.sendMessage("You've enabled " + ex.getDescription()); } } - } - else - { - switch (token) - { - case "enable_all": - { - for (PcCondOverride ex : PcCondOverride.values()) - { - if (!activeChar.canOverrideCond(ex)) - { + } else { + switch (token) { + case "enable_all": { + for (PcCondOverride ex : PcCondOverride.values()) { + if (!activeChar.canOverrideCond(ex)) { activeChar.addOverrideCond(ex); } } activeChar.sendMessage("All condition exceptions have been enabled."); break; } - case "disable_all": - { - for (PcCondOverride ex : PcCondOverride.values()) - { - if (activeChar.canOverrideCond(ex)) - { + case "disable_all": { + for (PcCondOverride ex : PcCondOverride.values()) { + if (activeChar.canOverrideCond(ex)) { activeChar.removeOverridedCond(ex); } } @@ -122,8 +100,7 @@ public class AdminPcCondOverride implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPetition.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPetition.java index a333424f62..9d51e3c5b0 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPetition.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPetition.java @@ -28,10 +28,8 @@ import com.l2jserver.gameserver.network.SystemMessageId; * This class handles commands for GMs to respond to petitions. * @author Tempy */ -public class AdminPetition implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminPetition implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_view_petitions", "admin_view_petition", "admin_accept_petition", @@ -41,70 +39,48 @@ public class AdminPetition implements IAdminCommandHandler }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { int petitionId = -1; - try - { + try { petitionId = Integer.parseInt(command.split(" ")[1]); - } - catch (Exception e) - { + } catch (Exception e) { } - if (command.equals("admin_view_petitions")) - { + if (command.equals("admin_view_petitions")) { PetitionManager.getInstance().sendPendingPetitionList(activeChar); - } - else if (command.startsWith("admin_view_petition")) - { + } else if (command.startsWith("admin_view_petition")) { PetitionManager.getInstance().viewPetition(activeChar, petitionId); - } - else if (command.startsWith("admin_accept_petition")) - { - if (PetitionManager.getInstance().isPlayerInConsultation(activeChar)) - { + } else if (command.startsWith("admin_accept_petition")) { + if (PetitionManager.getInstance().isPlayerInConsultation(activeChar)) { activeChar.sendPacket(SystemMessageId.ONLY_ONE_ACTIVE_PETITION_AT_TIME); return true; } - if (PetitionManager.getInstance().isPetitionInProcess(petitionId)) - { + if (PetitionManager.getInstance().isPetitionInProcess(petitionId)) { activeChar.sendPacket(SystemMessageId.PETITION_UNDER_PROCESS); return true; } - if (!PetitionManager.getInstance().acceptPetition(activeChar, petitionId)) - { + if (!PetitionManager.getInstance().acceptPetition(activeChar, petitionId)) { activeChar.sendPacket(SystemMessageId.NOT_UNDER_PETITION_CONSULTATION); } - } - else if (command.startsWith("admin_reject_petition")) - { - if (!PetitionManager.getInstance().rejectPetition(activeChar, petitionId)) - { + } else if (command.startsWith("admin_reject_petition")) { + if (!PetitionManager.getInstance().rejectPetition(activeChar, petitionId)) { activeChar.sendPacket(SystemMessageId.FAILED_CANCEL_PETITION_TRY_LATER); } PetitionManager.getInstance().sendPendingPetitionList(activeChar); - } - else if (command.equals("admin_reset_petitions")) - { - if (PetitionManager.getInstance().isPetitionInProcess()) - { + } else if (command.equals("admin_reset_petitions")) { + if (PetitionManager.getInstance().isPetitionInProcess()) { activeChar.sendPacket(SystemMessageId.PETITION_UNDER_PROCESS); return false; } PetitionManager.getInstance().clearPendingPetitions(); PetitionManager.getInstance().sendPendingPetitionList(activeChar); - } - else if (command.startsWith("admin_force_peti")) - { - try - { + } else if (command.startsWith("admin_force_peti")) { + try { L2Object targetChar = activeChar.getTarget(); - if ((targetChar == null) || !(targetChar instanceof L2PcInstance)) - { + if ((targetChar == null) || !(targetChar instanceof L2PcInstance)) { activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT); return false; } @@ -114,9 +90,7 @@ public class AdminPetition implements IAdminCommandHandler petitionId = PetitionManager.getInstance().submitPetition(targetPlayer, val, 9); PetitionManager.getInstance().acceptPetition(activeChar, petitionId); - } - catch (StringIndexOutOfBoundsException e) - { + } catch (StringIndexOutOfBoundsException e) { activeChar.sendMessage("Usage: //force_peti text"); return false; } @@ -125,8 +99,7 @@ public class AdminPetition implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPledge.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPledge.java index 3c13f3e7ee..b45cf3e76d 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPledge.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPledge.java @@ -33,125 +33,90 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; /** * <B>Pledge Manipulation:</B><BR> * <LI>With target in a character without clan:<BR> - * //pledge create clanname <LI>With target in a clan leader:<BR> + * //pledge create clanname + * <LI>With target in a clan leader:<BR> * //pledge info<BR> * //pledge dismiss<BR> * //pledge setlevel level<BR> * //pledge rep reputation_points<BR> */ -public class AdminPledge implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminPledge implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_pledge" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { L2Object target = activeChar.getTarget(); L2PcInstance player = null; - if (target instanceof L2PcInstance) - { + if (target instanceof L2PcInstance) { player = (L2PcInstance) target; - } - else - { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); showMainPage(activeChar); return false; } String name = player.getName(); - if (command.startsWith("admin_pledge")) - { + if (command.startsWith("admin_pledge")) { String action = null; String parameter = null; StringTokenizer st = new StringTokenizer(command); - try - { + try { st.nextToken(); action = st.nextToken(); // create|info|dismiss|setlevel|rep parameter = st.nextToken(); // clanname|nothing|nothing|level|rep_points - } - catch (NoSuchElementException nse) - { + } catch (NoSuchElementException nse) { // TODO: Send some message. return false; } - if (action.equals("create")) - { + if (action.equals("create")) { long cet = player.getClanCreateExpiryTime(); player.setClanCreateExpiryTime(0); L2Clan clan = ClanTable.getInstance().createClan(player, parameter); - if (clan != null) - { + if (clan != null) { activeChar.sendMessage("Clan " + parameter + " created. Leader: " + player.getName()); - } - else - { + } else { player.setClanCreateExpiryTime(cet); activeChar.sendMessage("There was a problem while creating the clan."); } - } - else if (!player.isClanLeader()) - { + } else if (!player.isClanLeader()) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_IS_NOT_A_CLAN_LEADER); sm.addString(name); activeChar.sendPacket(sm); showMainPage(activeChar); return false; - } - else if (action.equals("dismiss")) - { + } else if (action.equals("dismiss")) { ClanTable.getInstance().destroyClan(player.getClanId()); L2Clan clan = player.getClan(); - if (clan == null) - { + if (clan == null) { activeChar.sendMessage("Clan disbanded."); - } - else - { + } else { activeChar.sendMessage("There was a problem while destroying the clan."); } - } - else if (action.equals("info")) - { + } else if (action.equals("info")) { activeChar.sendPacket(new GMViewPledgeInfo(player.getClan(), player)); - } - else if (parameter == null) - { + } else if (parameter == null) { activeChar.sendMessage("Usage: //pledge <setlevel|rep> <number>"); - } - else if (action.equals("setlevel")) - { + } else if (action.equals("setlevel")) { int level = Integer.parseInt(parameter); - if ((level >= 0) && (level < 12)) - { + if ((level >= 0) && (level < 12)) { player.getClan().changeLevel(level); activeChar.sendMessage("You set level " + level + " for clan " + player.getClan().getName()); - } - else - { + } else { activeChar.sendMessage("Level incorrect."); } - } - else if (action.startsWith("rep")) - { - try - { + } else if (action.startsWith("rep")) { + try { int points = Integer.parseInt(parameter); L2Clan clan = player.getClan(); - if (clan.getLevel() < 5) - { + if (clan.getLevel() < 5) { activeChar.sendMessage("Only clans of level 5 or above may receive reputation points."); showMainPage(activeChar); return false; } clan.addReputationScore(points, true); activeChar.sendMessage("You " + (points > 0 ? "add " : "remove ") + Math.abs(points) + " points " + (points > 0 ? "to " : "from ") + clan.getName() + "'s reputation. Their current score is " + clan.getReputationScore()); - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //pledge <rep> <number>"); } } @@ -161,13 +126,11 @@ public class AdminPledge implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } - private void showMainPage(L2PcInstance activeChar) - { + private void showMainPage(L2PcInstance activeChar) { AdminHtml.showAdminHtml(activeChar, "game_menu.htm"); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPolymorph.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPolymorph.java index 9412729d9e..e307751922 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPolymorph.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPolymorph.java @@ -32,10 +32,8 @@ import com.l2jserver.gameserver.util.Util; * Polymorph admin command implementation. * @author Zoey76 */ -public class AdminPolymorph implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminPolymorph implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_polymorph", "admin_unpolymorph", "admin_transform", @@ -44,45 +42,32 @@ public class AdminPolymorph implements IAdminCommandHandler }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.equals("admin_transform_menu")) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.equals("admin_transform_menu")) { AdminHtml.showAdminHtml(activeChar, "transform.htm"); return true; - } - else if (command.startsWith("admin_untransform")) - { + } else if (command.startsWith("admin_untransform")) { L2Object obj = activeChar.getTarget(); - if (obj instanceof L2Character) - { + if (obj instanceof L2Character) { ((L2Character) obj).stopTransformation(true); - } - else - { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); } - } - else if (command.startsWith("admin_transform")) - { + } else if (command.startsWith("admin_transform")) { final L2Object obj = activeChar.getTarget(); - if ((obj == null) || !obj.isPlayer()) - { + if ((obj == null) || !obj.isPlayer()) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return false; } final L2PcInstance player = obj.getActingPlayer(); - if (activeChar.isSitting()) - { + if (activeChar.isSitting()) { activeChar.sendPacket(SystemMessageId.CANNOT_TRANSFORM_WHILE_SITTING); return false; } - if (player.isTransformed() || player.isInStance()) - { - if (!command.contains(" ")) - { + if (player.isTransformed() || player.isInStance()) { + if (!command.contains(" ")) { player.untransform(); return true; } @@ -90,52 +75,41 @@ public class AdminPolymorph implements IAdminCommandHandler return false; } - if (player.isInWater()) - { + if (player.isInWater()) { activeChar.sendPacket(SystemMessageId.YOU_CANNOT_POLYMORPH_INTO_THE_DESIRED_FORM_IN_WATER); return false; } - if (player.isFlyingMounted() || player.isMounted()) - { + if (player.isFlyingMounted() || player.isMounted()) { activeChar.sendPacket(SystemMessageId.YOU_CANNOT_POLYMORPH_WHILE_RIDING_A_PET); return false; } final String[] parts = command.split(" "); - if ((parts.length != 2) || !Util.isDigit(parts[1])) - { + if ((parts.length != 2) || !Util.isDigit(parts[1])) { activeChar.sendMessage("Usage: //transform <id>"); return false; } final int id = Integer.parseInt(parts[1]); - if (!TransformData.getInstance().transformPlayer(id, player)) - { + if (!TransformData.getInstance().transformPlayer(id, player)) { player.sendMessage("Unknown transformation ID: " + id); return false; } } - if (command.startsWith("admin_polymorph")) - { + if (command.startsWith("admin_polymorph")) { final String[] parts = command.split(" "); - if ((parts.length < 2) || !Util.isDigit(parts[1])) - { + if ((parts.length < 2) || !Util.isDigit(parts[1])) { activeChar.sendMessage("Usage: //polymorph [type] <id>"); return false; } - if (parts.length > 2) - { + if (parts.length > 2) { doPolymorph(activeChar, activeChar.getTarget(), parts[2], parts[1]); - } - else - { + } else { doPolymorph(activeChar, activeChar.getTarget(), parts[1], "npc"); } - } - else if (command.equals("admin_unpolymorph")) - { + } else if (command.equals("admin_unpolymorph")) { doUnPolymorph(activeChar, activeChar.getTarget()); } @@ -143,8 +117,7 @@ public class AdminPolymorph implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } @@ -155,14 +128,11 @@ public class AdminPolymorph implements IAdminCommandHandler * @param id the polymorph ID * @param type the polymorph type */ - private static void doPolymorph(L2PcInstance activeChar, L2Object obj, String id, String type) - { - if (obj != null) - { + private static void doPolymorph(L2PcInstance activeChar, L2Object obj, String id, String type) { + if (obj != null) { obj.getPoly().setPolyInfo(type, id); // animation - if (obj instanceof L2Character) - { + if (obj instanceof L2Character) { L2Character Char = (L2Character) obj; MagicSkillUse msk = new MagicSkillUse(Char, 1008, 1, 4000, 0); Char.broadcastPacket(msk); @@ -173,9 +143,7 @@ public class AdminPolymorph implements IAdminCommandHandler obj.decayMe(); obj.spawnMe(obj.getX(), obj.getY(), obj.getZ()); activeChar.sendMessage("Polymorph succeed"); - } - else - { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); } } @@ -185,17 +153,13 @@ public class AdminPolymorph implements IAdminCommandHandler * @param activeChar the active Game Master * @param target the target */ - private static void doUnPolymorph(L2PcInstance activeChar, L2Object target) - { - if (target != null) - { + private static void doUnPolymorph(L2PcInstance activeChar, L2Object target) { + if (target != null) { target.getPoly().setPolyInfo(null, "1"); target.decayMe(); target.spawnMe(target.getX(), target.getY(), target.getZ()); activeChar.sendMessage("Unpolymorph succeed"); - } - else - { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPunishment.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPunishment.java index e53dfe4b71..df417202bc 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPunishment.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminPunishment.java @@ -44,12 +44,10 @@ import com.l2jserver.gameserver.util.Util; /** * @author UnAfraid */ -public class AdminPunishment implements IAdminCommandHandler -{ +public class AdminPunishment implements IAdminCommandHandler { private static final Logger _log = Logger.getLogger(AdminPunishment.class.getName()); - private static final String[] ADMIN_COMMANDS = - { + private static final String[] ADMIN_COMMANDS = { "admin_punishment", "admin_punishment_add", "admin_punishment_remove", @@ -66,77 +64,57 @@ public class AdminPunishment implements IAdminCommandHandler private static SimpleDateFormat DATE_FORMATTER = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss"); @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { final StringTokenizer st = new StringTokenizer(command, " "); - if (!st.hasMoreTokens()) - { + if (!st.hasMoreTokens()) { return false; } final String cmd = st.nextToken(); - switch (cmd) - { - case "admin_punishment": - { - if (!st.hasMoreTokens()) - { + switch (cmd) { + case "admin_punishment": { + if (!st.hasMoreTokens()) { String content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/admin/punishment.htm"); - if (content != null) - { + if (content != null) { content = content.replaceAll("%punishments%", Util.implode(PunishmentType.values(), ";")); content = content.replaceAll("%affects%", Util.implode(PunishmentAffect.values(), ";")); activeChar.sendPacket(new NpcHtmlMessage(0, 1, content)); - } - else - { + } else { _log.log(Level.WARNING, getClass().getSimpleName() + ": data/html/admin/punishment.htm is missing"); } - } - else - { + } else { final String subcmd = st.nextToken(); - switch (subcmd) - { - case "info": - { + switch (subcmd) { + case "info": { String key = st.hasMoreTokens() ? st.nextToken() : null; String af = st.hasMoreTokens() ? st.nextToken() : null; String name = key; - if ((key == null) || (af == null)) - { + if ((key == null) || (af == null)) { activeChar.sendMessage("Not enough data specified!"); break; } final PunishmentAffect affect = PunishmentAffect.getByName(af); - if (affect == null) - { + if (affect == null) { activeChar.sendMessage("Incorrect value specified for affect type!"); break; } // Swap the name of the character with it's id. - if (affect == PunishmentAffect.CHARACTER) - { + if (affect == PunishmentAffect.CHARACTER) { key = findCharId(key); } String content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/admin/punishment-info.htm"); - if (content != null) - { + if (content != null) { StringBuilder sb = new StringBuilder(); - for (PunishmentType type : PunishmentType.values()) - { - if (PunishmentManager.getInstance().hasPunishment(key, affect, type)) - { + for (PunishmentType type : PunishmentType.values()) { + if (PunishmentManager.getInstance().hasPunishment(key, affect, type)) { long expiration = PunishmentManager.getInstance().getPunishmentExpiration(key, affect, type); String expire = "never"; - if (expiration > 0) - { + if (expiration > 0) { // Synchronize date formatter since its not thread safe. - synchronized (DATE_FORMATTER) - { + synchronized (DATE_FORMATTER) { expire = DATE_FORMATTER.format(new Date(expiration)); } } @@ -149,46 +127,36 @@ public class AdminPunishment implements IAdminCommandHandler content = content.replaceAll("%affects%", Util.implode(PunishmentAffect.values(), ";")); content = content.replaceAll("%affect_type%", affect.name()); activeChar.sendPacket(new NpcHtmlMessage(0, 1, content)); - } - else - { + } else { _log.log(Level.WARNING, getClass().getSimpleName() + ": data/html/admin/punishment-info.htm is missing"); } break; } - case "player": - { + case "player": { L2PcInstance target = null; - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { final String playerName = st.nextToken(); - if (playerName.isEmpty() && ((activeChar.getTarget() == null) || !activeChar.getTarget().isPlayer())) - { + if (playerName.isEmpty() && ((activeChar.getTarget() == null) || !activeChar.getTarget().isPlayer())) { return useAdminCommand("admin_punishment", activeChar); } target = L2World.getInstance().getPlayer(playerName); } - if ((target == null) && ((activeChar.getTarget() == null) || !activeChar.getTarget().isPlayer())) - { + if ((target == null) && ((activeChar.getTarget() == null) || !activeChar.getTarget().isPlayer())) { activeChar.sendMessage("You must target player!"); break; } - if (target == null) - { + if (target == null) { target = activeChar.getTarget().getActingPlayer(); } String content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/admin/punishment-player.htm"); - if (content != null) - { + if (content != null) { content = content.replaceAll("%player_name%", target.getName()); content = content.replaceAll("%punishments%", Util.implode(PunishmentType.values(), ";")); content = content.replaceAll("%acc%", target.getAccountName()); content = content.replaceAll("%char%", target.getName()); content = content.replaceAll("%ip%", target.getIPAddress()); activeChar.sendPacket(new NpcHtmlMessage(0, 1, content)); - } - else - { + } else { _log.log(Level.WARNING, getClass().getSimpleName() + ": data/html/admin/punishment-player.htm is missing"); } break; @@ -197,8 +165,7 @@ public class AdminPunishment implements IAdminCommandHandler } break; } - case "admin_punishment_add": - { + case "admin_punishment_add": { // Add new punishment String key = st.hasMoreTokens() ? st.nextToken() : null; String af = st.hasMoreTokens() ? st.nextToken() : null; @@ -207,14 +174,11 @@ public class AdminPunishment implements IAdminCommandHandler String reason = st.hasMoreTokens() ? st.nextToken() : null; // Let's grab the other part of the reason if there is.. - if (reason != null) - { - while (st.hasMoreTokens()) - { + if (reason != null) { + while (st.hasMoreTokens()) { reason += " " + st.nextToken(); } - if (!reason.isEmpty()) - { + if (!reason.isEmpty()) { reason = reason.replaceAll("\\$", "\\\\\\$"); reason = reason.replaceAll("\r\n", "<br1>"); reason = reason.replace("<", "<"); @@ -224,52 +188,39 @@ public class AdminPunishment implements IAdminCommandHandler String name = key; - if ((key == null) || (af == null) || (t == null) || (exp == null) || (reason == null)) - { + if ((key == null) || (af == null) || (t == null) || (exp == null) || (reason == null)) { activeChar.sendMessage("Please fill all the fields!"); break; } - if (!Util.isDigit(exp) && !exp.equals("-1")) - { + if (!Util.isDigit(exp) && !exp.equals("-1")) { activeChar.sendMessage("Incorrect value specified for expiration time!"); break; } long expirationTime = Integer.parseInt(exp); - if (expirationTime > 0) - { + if (expirationTime > 0) { expirationTime = System.currentTimeMillis() + (expirationTime * 60 * 1000); } final PunishmentAffect affect = PunishmentAffect.getByName(af); final PunishmentType type = PunishmentType.getByName(t); - if ((affect == null) || (type == null)) - { + if ((affect == null) || (type == null)) { activeChar.sendMessage("Incorrect value specified for affect/punishment type!"); break; } // Swap the name of the character with it's id. - if (affect == PunishmentAffect.CHARACTER) - { + if (affect == PunishmentAffect.CHARACTER) { key = findCharId(key); - } - else if (affect == PunishmentAffect.IP) - { - try - { + } else if (affect == PunishmentAffect.IP) { + try { InetAddress addr = InetAddress.getByName(key); - if (addr.isLoopbackAddress()) - { + if (addr.isLoopbackAddress()) { throw new UnknownHostException("You cannot ban any local address!"); - } - else if (ip().getHosts().contains(addr.getHostAddress())) - { + } else if (ip().getHosts().contains(addr.getHostAddress())) { throw new UnknownHostException("You cannot ban your gameserver's address!"); } - } - catch (UnknownHostException e) - { + } catch (UnknownHostException e) { activeChar.sendMessage("You've entered an incorrect IP address!"); activeChar.sendMessage(e.getMessage()); break; @@ -277,8 +228,7 @@ public class AdminPunishment implements IAdminCommandHandler } // Check if we already put the same punishment on that guy ^^ - if (PunishmentManager.getInstance().hasPunishment(key, affect, type)) - { + if (PunishmentManager.getInstance().hasPunishment(key, affect, type)) { activeChar.sendMessage("Target is already affected by that punishment."); break; } @@ -289,36 +239,31 @@ public class AdminPunishment implements IAdminCommandHandler GMAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", cmd, affect.name(), name); return useAdminCommand("admin_punishment info " + name + " " + affect.name(), activeChar); } - case "admin_punishment_remove": - { + case "admin_punishment_remove": { // Remove punishment. String key = st.hasMoreTokens() ? st.nextToken() : null; String af = st.hasMoreTokens() ? st.nextToken() : null; String t = st.hasMoreTokens() ? st.nextToken() : null; String name = key; - if ((key == null) || (af == null) || (t == null)) - { + if ((key == null) || (af == null) || (t == null)) { activeChar.sendMessage("Not enough data specified!"); break; } final PunishmentAffect affect = PunishmentAffect.getByName(af); final PunishmentType type = PunishmentType.getByName(t); - if ((affect == null) || (type == null)) - { + if ((affect == null) || (type == null)) { activeChar.sendMessage("Incorrect value specified for affect/punishment type!"); break; } // Swap the name of the character with it's id. - if (affect == PunishmentAffect.CHARACTER) - { + if (affect == PunishmentAffect.CHARACTER) { key = findCharId(key); } - if (!PunishmentManager.getInstance().hasPunishment(key, affect, type)) - { + if (!PunishmentManager.getInstance().hasPunishment(key, affect, type)) { activeChar.sendMessage("Target is not affected by that punishment!"); break; } @@ -328,59 +273,43 @@ public class AdminPunishment implements IAdminCommandHandler GMAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", cmd, affect.name(), name); return useAdminCommand("admin_punishment info " + name + " " + affect.name(), activeChar); } - case "admin_ban_char": - { - if (st.hasMoreTokens()) - { + case "admin_ban_char": { + if (st.hasMoreTokens()) { return useAdminCommand(String.format("admin_punishment_add %s %s %s %s %s", st.nextToken(), PunishmentAffect.CHARACTER, PunishmentType.BAN, 0, "Banned by admin"), activeChar); } } - case "admin_unban_char": - { - if (st.hasMoreTokens()) - { + case "admin_unban_char": { + if (st.hasMoreTokens()) { return useAdminCommand(String.format("admin_punishment_remove %s %s %s", st.nextToken(), PunishmentAffect.CHARACTER, PunishmentType.BAN), activeChar); } } - case "admin_ban_acc": - { - if (st.hasMoreTokens()) - { + case "admin_ban_acc": { + if (st.hasMoreTokens()) { return useAdminCommand(String.format("admin_punishment_add %s %s %s %s %s", st.nextToken(), PunishmentAffect.ACCOUNT, PunishmentType.BAN, 0, "Banned by admin"), activeChar); } } - case "admin_unban_acc": - { - if (st.hasMoreTokens()) - { + case "admin_unban_acc": { + if (st.hasMoreTokens()) { return useAdminCommand(String.format("admin_punishment_remove %s %s %s", st.nextToken(), PunishmentAffect.ACCOUNT, PunishmentType.BAN), activeChar); } } - case "admin_ban_chat": - { - if (st.hasMoreTokens()) - { + case "admin_ban_chat": { + if (st.hasMoreTokens()) { return useAdminCommand(String.format("admin_punishment_add %s %s %s %s %s", st.nextToken(), PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN, 0, "Chat banned by admin"), activeChar); } } - case "admin_unban_chat": - { - if (st.hasMoreTokens()) - { + case "admin_unban_chat": { + if (st.hasMoreTokens()) { return useAdminCommand(String.format("admin_punishment_remove %s %s %s", st.nextToken(), PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN), activeChar); } } - case "admin_jail": - { - if (st.hasMoreTokens()) - { + case "admin_jail": { + if (st.hasMoreTokens()) { return useAdminCommand(String.format("admin_punishment_add %s %s %s %s %s", st.nextToken(), PunishmentAffect.CHARACTER, PunishmentType.JAIL, 0, "Jailed by admin"), activeChar); } } - case "admin_unjail": - { - if (st.hasMoreTokens()) - { + case "admin_unjail": { + if (st.hasMoreTokens()) { return useAdminCommand(String.format("admin_punishment_remove %s %s %s", st.nextToken(), PunishmentAffect.CHARACTER, PunishmentType.JAIL), activeChar); } } @@ -388,8 +317,7 @@ public class AdminPunishment implements IAdminCommandHandler return true; } - private static final String findCharId(String key) - { + private static final String findCharId(String key) { int charId = CharNameTable.getInstance().getIdByName(key); if (charId > 0) // Yeah its a char name! { @@ -399,8 +327,7 @@ public class AdminPunishment implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminQuest.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminQuest.java index cbbcfd7302..02bbaa1df3 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminQuest.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminQuest.java @@ -43,12 +43,10 @@ import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; import com.l2jserver.gameserver.scripting.ScriptEngineManager; import com.l2jserver.gameserver.util.Util; -public class AdminQuest implements IAdminCommandHandler -{ +public class AdminQuest implements IAdminCommandHandler { private static final Logger LOG = LoggerFactory.getLogger(AdminQuest.class); - private static final String[] ADMIN_COMMANDS = - { + private static final String[] ADMIN_COMMANDS = { "admin_quest_reload", "admin_script_load", "admin_script_unload", @@ -57,10 +55,8 @@ public class AdminQuest implements IAdminCommandHandler }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (activeChar == null) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (activeChar == null) { return false; } @@ -73,36 +69,23 @@ public class AdminQuest implements IAdminCommandHandler // Example: //quest_reload chests // Example: //quest_reload SagasSuperclass // Example: //quest_reload 12 - if (command.startsWith("admin_quest_reload")) - { + if (command.startsWith("admin_quest_reload")) { String[] parts = command.split(" "); - if (parts.length < 2) - { + if (parts.length < 2) { activeChar.sendMessage("Usage: //quest_reload <questFolder>.<questSubFolders...>.questName> or //quest_reload <id>"); - } - else - { + } else { // try the first param as id - try - { + try { int questId = Integer.parseInt(parts[1]); - if (QuestManager.getInstance().reload(questId)) - { + if (QuestManager.getInstance().reload(questId)) { activeChar.sendMessage("Quest Reloaded Successfully."); - } - else - { + } else { activeChar.sendMessage("Quest Reloaded Failed"); } - } - catch (NumberFormatException e) - { - if (QuestManager.getInstance().reload(parts[1])) - { + } catch (NumberFormatException e) { + if (QuestManager.getInstance().reload(parts[1])) { activeChar.sendMessage("Quest Reloaded Successfully."); - } - else - { + } else { activeChar.sendMessage("Quest Reloaded Failed"); } } @@ -114,106 +97,70 @@ public class AdminQuest implements IAdminCommandHandler // did not at all exist during server boot. Using script_load to re-load a previously // loaded script may cause unpredictable script flow, minor loss of data, and more. // This provides a way to load new scripts without having to reboot the server. - else if (command.startsWith("admin_script_load")) - { + else if (command.startsWith("admin_script_load")) { String[] parts = command.split(" "); - if (parts.length < 2) - { + if (parts.length < 2) { // activeChar.sendMessage("Example: //script_load <questFolder>/<questSubFolders...>/<filename>.<ext> "); activeChar.sendMessage("Example: //script_load quests/SagasSuperclass/__init__.py"); - } - else - { + } else { File file = new File(server().getScriptRoot(), "com/l2jserver/datapack/" + parts[1]); // Trying to reload by script name. - if (!file.exists()) - { + if (!file.exists()) { Quest quest = QuestManager.getInstance().getQuest(parts[1]); - if (quest != null) - { + if (quest != null) { file = new File(server().getScriptRoot(), "com/l2jserver/datapack/" + quest.getClass().getName().replaceAll("\\.", "/") + ".java"); } } // Reloading by full path - if (file.isFile()) - { - try - { + if (file.isFile()) { + try { ScriptEngineManager.getInstance().executeScript(file); // This part should be called only when the script is successfully loaded. activeChar.sendMessage("Script Successfully Loaded."); - } - catch (ScriptException ex) - { + } catch (ScriptException ex) { activeChar.sendMessage("Failed loading: " + parts[1]); LOG.error("Failed loading {}!", parts[1], ex); - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Failed loading: " + parts[1]); } - } - else - { + } else { activeChar.sendMessage("File Not Found: " + parts[1]); } } - } - else if (command.startsWith("admin_script_unload")) - { + } else if (command.startsWith("admin_script_unload")) { String[] parts = command.split(" "); - if (parts.length < 2) - { + if (parts.length < 2) { activeChar.sendMessage("Example: //script_unload questName/questId"); - } - else - { + } else { Quest q = Util.isDigit(parts[1]) ? QuestManager.getInstance().getQuest(Integer.parseInt(parts[1])) : QuestManager.getInstance().getQuest(parts[1]); - if (q != null) - { - if (q.unload()) - { + if (q != null) { + if (q.unload()) { activeChar.sendMessage("Script Successfully Unloaded [" + q.getName() + "/" + q.getId() + "]"); - } - else - { + } else { activeChar.sendMessage("Failed unloading [" + q.getName() + "/" + q.getId() + "]."); } - } - else - { + } else { activeChar.sendMessage("The quest [" + parts[1] + "] was not found!."); } } - } - else if (command.startsWith("admin_show_quests")) - { - if (activeChar.getTarget() == null) - { + } else if (command.startsWith("admin_show_quests")) { + if (activeChar.getTarget() == null) { activeChar.sendMessage("Get a target first."); - } - else if (!activeChar.getTarget().isCharacter()) - { + } else if (!activeChar.getTarget().isCharacter()) { activeChar.sendMessage("Invalid Target."); - } - else - { + } else { final L2Character character = (L2Character) activeChar.getTarget(); final StringBuilder sb = new StringBuilder(); final Set<String> questNames = new TreeSet<>(); - for (EventType type : EventType.values()) - { - for (AbstractEventListener listener : character.getListeners(type)) - { - if (listener.getOwner() instanceof Quest) - { + for (EventType type : EventType.values()) { + for (AbstractEventListener listener : character.getListeners(type)) { + if (listener.getOwner() instanceof Quest) { final Quest quest = (Quest) listener.getOwner(); - if (questNames.contains(quest.getName())) - { + if (questNames.contains(quest.getName())) { continue; } sb.append("<tr><td colspan=\"4\"><font color=\"LEVEL\"><a action=\"bypass -h admin_quest_info " + quest.getName() + "\">" + quest.getName() + "</a></font></td></tr>"); @@ -229,65 +176,52 @@ public class AdminQuest implements IAdminCommandHandler msg.replace("%questName%", ""); activeChar.sendPacket(msg); } - } - else if (command.startsWith("admin_quest_info ")) - { + } else if (command.startsWith("admin_quest_info ")) { final String questName = command.substring("admin_quest_info ".length()); final Quest quest = QuestManager.getInstance().getQuest(questName); String events = "", npcs = "", items = "", timers = ""; int counter = 0; - if (quest == null) - { + if (quest == null) { activeChar.sendMessage("Couldn't find quest or script with name " + questName + " !"); return false; } final Set<EventType> listenerTypes = new TreeSet<>(); - for (AbstractEventListener listener : quest.getListeners()) - { - if (!listenerTypes.contains(listener.getType())) - { + for (AbstractEventListener listener : quest.getListeners()) { + if (!listenerTypes.contains(listener.getType())) { events += ", " + listener.getType().name(); listenerTypes.add(listener.getType()); counter++; } - if (counter > 10) - { + if (counter > 10) { counter = 0; break; } } final Set<Integer> npcIds = new TreeSet<>(quest.getRegisteredIds(ListenerRegisterType.NPC)); - for (int npcId : npcIds) - { + for (int npcId : npcIds) { npcs += ", " + npcId; counter++; - if (counter > 50) - { + if (counter > 50) { counter = 0; break; } } - if (!events.isEmpty()) - { + if (!events.isEmpty()) { events = listenerTypes.size() + ": " + events.substring(2); } - if (!npcs.isEmpty()) - { + if (!npcs.isEmpty()) { npcs = npcIds.size() + ": " + npcs.substring(2); } - if (quest.getRegisteredItemIds() != null) - { - for (int itemId : quest.getRegisteredItemIds()) - { + if (quest.getRegisteredItemIds() != null) { + for (int itemId : quest.getRegisteredItemIds()) { items += ", " + itemId; counter++; - if (counter > 20) - { + if (counter > 20) { counter = 0; break; } @@ -295,15 +229,12 @@ public class AdminQuest implements IAdminCommandHandler items = quest.getRegisteredItemIds().length + ":" + items.substring(2); } - for (List<QuestTimer> list : quest.getQuestTimers().values()) - { - for (QuestTimer timer : list) - { + for (List<QuestTimer> list : quest.getQuestTimers().values()) { + for (QuestTimer timer : list) { timers += "<tr><td colspan=\"4\"><table width=270 border=0 bgcolor=131210><tr><td width=270><font color=\"LEVEL\">" + timer.getName() + ":</font> <font color=00FF00>Active: " + timer.getIsActive() + " Repeatable: " + timer.getIsRepeating() + " Player: " + timer.getPlayer() + " Npc: " + timer.getNpc() + "</font></td></tr></table></td></tr>"; counter++; - if (counter > 10) - { + if (counter > 10) { break; } } @@ -316,16 +247,13 @@ public class AdminQuest implements IAdminCommandHandler sb.append("<tr><td colspan=\"4\"><table width=270 border=0 bgcolor=131210><tr><td width=270><font color=\"LEVEL\">Path:</font> <font color=00FF00>" + quest.getClass().getName().substring(0, quest.getClass().getName().lastIndexOf('.')).replaceAll("\\.", "/") + "</font></td></tr></table></td></tr>"); sb.append("<tr><td colspan=\"4\"><table width=270 border=0 bgcolor=131210><tr><td width=270><font color=\"LEVEL\">Events:</font> <font color=00FF00>" + events + "</font></td></tr></table></td></tr>"); - if (!npcs.isEmpty()) - { + if (!npcs.isEmpty()) { sb.append("<tr><td colspan=\"4\"><table width=270 border=0 bgcolor=131210><tr><td width=270><font color=\"LEVEL\">NPCs:</font> <font color=00FF00>" + npcs + "</font></td></tr></table></td></tr>"); } - if (!items.isEmpty()) - { + if (!items.isEmpty()) { sb.append("<tr><td colspan=\"4\"><table width=270 border=0 bgcolor=131210><tr><td width=270><font color=\"LEVEL\">Items:</font> <font color=00FF00>" + items + "</font></td></tr></table></td></tr>"); } - if (!timers.isEmpty()) - { + if (!timers.isEmpty()) { sb.append("<tr><td colspan=\"4\"><table width=270 border=0 bgcolor=131210><tr><td width=270><font color=\"LEVEL\">Timers:</font> <font color=00FF00></font></td></tr></table></td></tr>"); sb.append(timers); } @@ -341,8 +269,7 @@ public class AdminQuest implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminReload.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminReload.java index 3ed7a069b6..266e7a5bb3 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminReload.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminReload.java @@ -52,32 +52,26 @@ import com.l2jserver.gameserver.util.Util; /** * @author NosBit */ -public class AdminReload implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminReload implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_reload" }; private static final String RELOAD_USAGE = "Usage: //reload <config|access|npc|quest [quest_id|quest_name]|walker|htm[l] [file|directory]|multisell|buylist|teleport|skill|item|door|effect|handler|enchant|creationpoint>"; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { final StringTokenizer st = new StringTokenizer(command, " "); final String actualCommand = st.nextToken(); - if (actualCommand.equalsIgnoreCase("admin_reload")) - { - if (!st.hasMoreTokens()) - { + if (actualCommand.equalsIgnoreCase("admin_reload")) { + if (!st.hasMoreTokens()) { AdminHtml.showAdminHtml(activeChar, "reload.htm"); activeChar.sendMessage(RELOAD_USAGE); return true; } final String type = st.nextToken(); - switch (type.toLowerCase()) - { + switch (type.toLowerCase()) { case "config": { if (st.hasMoreElements()) { final var configName = st.nextToken(); @@ -108,164 +102,132 @@ public class AdminReload implements IAdminCommandHandler } break; } - case "access": - { + case "access": { AdminData.getInstance().load(); AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded Access."); break; } - case "npc": - { + case "npc": { NpcData.getInstance().load(); AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded Npcs."); break; } - case "quest": - { - if (st.hasMoreElements()) - { + case "quest": { + if (st.hasMoreElements()) { String value = st.nextToken(); - if (!Util.isDigit(value)) - { + if (!Util.isDigit(value)) { QuestManager.getInstance().reload(value); AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded Quest Name:" + value + "."); - } - else - { + } else { final int questId = Integer.parseInt(value); QuestManager.getInstance().reload(questId); AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded Quest ID:" + questId + "."); } - } - else - { + } else { QuestManager.getInstance().reloadAllScripts(); activeChar.sendMessage("All scripts have been reloaded."); AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded Quests."); } break; } - case "walker": - { + case "walker": { WalkingManager.getInstance().load(); activeChar.sendMessage("All walkers have been reloaded"); AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded Walkers."); break; } case "htm": - case "html": - { - if (st.hasMoreElements()) - { + case "html": { + if (st.hasMoreElements()) { final String path = st.nextToken(); final File file = new File(server().getDatapackRoot(), "data/html/" + path); - if (file.exists()) - { + if (file.exists()) { HtmCache.getInstance().reload(file); AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded Htm File:" + file.getName() + "."); - } - else - { + } else { activeChar.sendMessage("File or Directory does not exist."); } - } - else - { + } else { HtmCache.getInstance().reload(); activeChar.sendMessage("Cache[HTML]: " + HtmCache.getInstance().getMemoryUsage() + " megabytes on " + HtmCache.getInstance().getLoadedFiles() + " files loaded"); AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded Htms."); } break; } - case "multisell": - { + case "multisell": { MultisellData.getInstance().load(); AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded Multisells."); break; } - case "buylist": - { + case "buylist": { BuyListData.getInstance().load(); AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded Buylists."); break; } - case "teleport": - { + case "teleport": { TeleportLocationTable.getInstance().reloadAll(); AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded Teleports."); break; } - case "skill": - { + case "skill": { SkillData.getInstance().reload(); AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded Skills."); break; } - case "item": - { + case "item": { ItemTable.getInstance().reload(); AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded Items."); break; } - case "door": - { + case "door": { DoorData.getInstance().load(); AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded Doors."); break; } - case "zone": - { + case "zone": { ZoneManager.getInstance().reload(); AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded Zones."); break; } - case "cw": - { + case "cw": { CursedWeaponsManager.getInstance().reload(); AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded Cursed Weapons."); break; } - case "crest": - { + case "crest": { CrestTable.getInstance().load(); AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded Crests."); break; } - case "effect": - { + case "effect": { final File file = new File(server().getScriptRoot(), "com/l2jserver/datapack/handlers/EffectMasterHandler.java"); ScriptEngineManager.getInstance().compileScript(file); AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded Effects."); break; } - case "handler": - { + case "handler": { final File file = new File(server().getScriptRoot(), "com/l2jserver/datapack/handlers/MasterHandler.java"); ScriptEngineManager.getInstance().compileScript(file); AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded Handlers."); break; } - case "enchant": - { + case "enchant": { EnchantItemGroupsData.getInstance().load(); EnchantItemData.getInstance().load(); AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded item enchanting data."); break; } - case "transform": - { + case "transform": { TransformData.getInstance().load(); AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded transform data."); break; } - case "creationpoint": - { + case "creationpoint": { PlayerCreationPointData.getInstance().load(); AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded creation points data."); break; } - default: - { + default: { activeChar.sendMessage(RELOAD_USAGE); return true; } @@ -276,8 +238,7 @@ public class AdminReload implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminRepairChar.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminRepairChar.java index 2c3ad9c635..11c2a0944d 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminRepairChar.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminRepairChar.java @@ -32,66 +32,53 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * This class handles following admin commands: - delete = deletes target * @version $Revision: 1.1.2.6.2.3 $ $Date: 2005/04/11 10:05:59 $ */ -public class AdminRepairChar implements IAdminCommandHandler -{ +public class AdminRepairChar implements IAdminCommandHandler { private static Logger _log = Logger.getLogger(AdminRepairChar.class.getName()); - private static final String[] ADMIN_COMMANDS = - { + private static final String[] ADMIN_COMMANDS = { "admin_restore", "admin_repair" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { handleRepair(command); return true; } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } - private void handleRepair(String command) - { + private void handleRepair(String command) { String[] parts = command.split(" "); - if (parts.length != 2) - { + if (parts.length != 2) { return; } final String playerName = parts[1]; String cmd = "UPDATE characters SET x=-84318, y=244579, z=-3730 WHERE char_name=?"; - try (Connection con = ConnectionFactory.getInstance().getConnection()) - { - try (PreparedStatement ps = con.prepareStatement(cmd)) - { + try (Connection con = ConnectionFactory.getInstance().getConnection()) { + try (PreparedStatement ps = con.prepareStatement(cmd)) { ps.setString(1, playerName); ps.execute(); } final int objId = CharNameTable.getInstance().getIdByName(playerName); - if (objId != 0) - { + if (objId != 0) { // Delete player's shortcuts. - try (PreparedStatement ps = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=?")) - { + try (PreparedStatement ps = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=?")) { ps.setInt(1, objId); ps.execute(); } // Move all items to the inventory. - try (PreparedStatement ps = con.prepareStatement("UPDATE items SET loc=\"INVENTORY\" WHERE owner_id=?")) - { + try (PreparedStatement ps = con.prepareStatement("UPDATE items SET loc=\"INVENTORY\" WHERE owner_id=?")) { ps.setInt(1, objId); ps.execute(); } } - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, "Could not repair char:", e); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminRes.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminRes.java index 8613be7fcd..af74db54d7 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminRes.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminRes.java @@ -35,32 +35,22 @@ import com.l2jserver.gameserver.taskmanager.DecayTaskManager; * This class handles following admin commands: - res = resurrects target L2Character * @version $Revision: 1.2.4.5 $ $Date: 2005/04/11 10:06:06 $ */ -public class AdminRes implements IAdminCommandHandler -{ +public class AdminRes implements IAdminCommandHandler { private static Logger _log = Logger.getLogger(AdminRes.class.getName()); - private static final String[] ADMIN_COMMANDS = - { + private static final String[] ADMIN_COMMANDS = { "admin_res", "admin_res_monster" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.startsWith("admin_res ")) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.startsWith("admin_res ")) { handleRes(activeChar, command.split(" ")[1]); - } - else if (command.equals("admin_res")) - { + } else if (command.equals("admin_res")) { handleRes(activeChar); - } - else if (command.startsWith("admin_res_monster ")) - { + } else if (command.startsWith("admin_res_monster ")) { handleNonPlayerRes(activeChar, command.split(" ")[1]); - } - else if (command.equals("admin_res_monster")) - { + } else if (command.equals("admin_res_monster")) { handleNonPlayerRes(activeChar); } @@ -68,107 +58,84 @@ public class AdminRes implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } - private void handleRes(L2PcInstance activeChar) - { + private void handleRes(L2PcInstance activeChar) { handleRes(activeChar, null); } - private void handleRes(L2PcInstance activeChar, String resParam) - { + private void handleRes(L2PcInstance activeChar, String resParam) { L2Object obj = activeChar.getTarget(); - if (resParam != null) - { + if (resParam != null) { // Check if a player name was specified as a param. L2PcInstance plyr = L2World.getInstance().getPlayer(resParam); - if (plyr != null) - { + if (plyr != null) { obj = plyr; - } - else - { + } else { // Otherwise, check if the param was a radius. - try - { + try { int radius = Integer.parseInt(resParam); - for (L2PcInstance knownPlayer : activeChar.getKnownList().getKnownPlayersInRadius(radius)) - { + for (L2PcInstance knownPlayer : activeChar.getKnownList().getKnownPlayersInRadius(radius)) { doResurrect(knownPlayer); } activeChar.sendMessage("Resurrected all players within a " + radius + " unit radius."); return; - } - catch (NumberFormatException e) - { + } catch (NumberFormatException e) { activeChar.sendMessage("Enter a valid player name or radius."); return; } } } - if (obj == null) - { + if (obj == null) { obj = activeChar; } - if (obj instanceof L2ControllableMobInstance) - { + if (obj instanceof L2ControllableMobInstance) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return; } doResurrect((L2Character) obj); - if (general().debug()) - { + if (general().debug()) { _log.fine("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") resurrected character " + obj.getObjectId()); } } - private void handleNonPlayerRes(L2PcInstance activeChar) - { + private void handleNonPlayerRes(L2PcInstance activeChar) { handleNonPlayerRes(activeChar, ""); } - private void handleNonPlayerRes(L2PcInstance activeChar, String radiusStr) - { + private void handleNonPlayerRes(L2PcInstance activeChar, String radiusStr) { L2Object obj = activeChar.getTarget(); - try - { + try { int radius = 0; - if (!radiusStr.isEmpty()) - { + if (!radiusStr.isEmpty()) { radius = Integer.parseInt(radiusStr); - for (L2Character knownChar : activeChar.getKnownList().getKnownCharactersInRadius(radius)) - { - if (!(knownChar instanceof L2PcInstance) && !(knownChar instanceof L2ControllableMobInstance)) - { + for (L2Character knownChar : activeChar.getKnownList().getKnownCharactersInRadius(radius)) { + if (!(knownChar instanceof L2PcInstance) && !(knownChar instanceof L2ControllableMobInstance)) { doResurrect(knownChar); } } activeChar.sendMessage("Resurrected all non-players within a " + radius + " unit radius."); } - } - catch (NumberFormatException e) - { + } catch (NumberFormatException e) { activeChar.sendMessage("Enter a valid radius."); return; } - if ((obj instanceof L2PcInstance) || (obj instanceof L2ControllableMobInstance)) - { + if ((obj instanceof L2PcInstance) || (obj instanceof L2ControllableMobInstance)) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return; } @@ -176,20 +143,15 @@ public class AdminRes implements IAdminCommandHandler doResurrect((L2Character) obj); } - private void doResurrect(L2Character targetChar) - { - if (!targetChar.isDead()) - { + private void doResurrect(L2Character targetChar) { + if (!targetChar.isDead()) { return; } // If the target is a player, then restore the XP lost on death. - if (targetChar instanceof L2PcInstance) - { + if (targetChar instanceof L2PcInstance) { targetChar.doRevive(100.0); - } - else - { + } else { DecayTaskManager.getInstance().cancel(targetChar); targetChar.doRevive(); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminRide.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminRide.java index 40e2b220af..d77e460d40 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminRide.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminRide.java @@ -26,10 +26,8 @@ import com.l2jserver.gameserver.network.SystemMessageId; /** * @author */ -public class AdminRide implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminRide implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_ride_horse", "admin_ride_bike", "admin_ride_wyvern", @@ -47,61 +45,42 @@ public class AdminRide implements IAdminCommandHandler private static final int JET_BIKE_TRANSFORMATION_ID = 20001; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { L2PcInstance player = getRideTarget(activeChar); - if (player == null) - { + if (player == null) { return false; } - if (command.startsWith("admin_ride")) - { - if (player.isMounted() || player.hasSummon()) - { + if (command.startsWith("admin_ride")) { + if (player.isMounted() || player.hasSummon()) { activeChar.sendMessage("Target already have a summon."); return false; } - if (command.startsWith("admin_ride_wyvern")) - { + if (command.startsWith("admin_ride_wyvern")) { _petRideId = 12621; - } - else if (command.startsWith("admin_ride_strider")) - { + } else if (command.startsWith("admin_ride_strider")) { _petRideId = 12526; - } - else if (command.startsWith("admin_ride_wolf")) - { + } else if (command.startsWith("admin_ride_wolf")) { _petRideId = 16041; - } - else if (command.startsWith("admin_ride_horse")) // handled using transformation + } else if (command.startsWith("admin_ride_horse")) // handled using transformation { - if (player.isTransformed() || player.isInStance()) - { + if (player.isTransformed() || player.isInStance()) { activeChar.sendPacket(SystemMessageId.YOU_ALREADY_POLYMORPHED_AND_CANNOT_POLYMORPH_AGAIN); - } - else - { + } else { TransformData.getInstance().transformPlayer(PURPLE_MANED_HORSE_TRANSFORMATION_ID, player); } return true; - } - else if (command.startsWith("admin_ride_bike")) // handled using transformation + } else if (command.startsWith("admin_ride_bike")) // handled using transformation { - if (player.isTransformed() || player.isInStance()) - { + if (player.isTransformed() || player.isInStance()) { activeChar.sendPacket(SystemMessageId.YOU_ALREADY_POLYMORPHED_AND_CANNOT_POLYMORPH_AGAIN); - } - else - { + } else { TransformData.getInstance().transformPlayer(JET_BIKE_TRANSFORMATION_ID, player); } return true; - } - else - { + } else { activeChar.sendMessage("Command '" + command + "' not recognized"); return false; } @@ -109,36 +88,26 @@ public class AdminRide implements IAdminCommandHandler player.mount(_petRideId, 0, false); return false; - } - else if (command.startsWith("admin_unride")) - { - if (player.getTransformationId() == PURPLE_MANED_HORSE_TRANSFORMATION_ID) - { + } else if (command.startsWith("admin_unride")) { + if (player.getTransformationId() == PURPLE_MANED_HORSE_TRANSFORMATION_ID) { player.untransform(); } - if (player.getTransformationId() == JET_BIKE_TRANSFORMATION_ID) - { + if (player.getTransformationId() == JET_BIKE_TRANSFORMATION_ID) { player.untransform(); - } - else - { + } else { player.dismount(); } } return true; } - private L2PcInstance getRideTarget(L2PcInstance activeChar) - { + private L2PcInstance getRideTarget(L2PcInstance activeChar) { L2PcInstance player = null; - if ((activeChar.getTarget() == null) || (activeChar.getTarget().getObjectId() == activeChar.getObjectId()) || !(activeChar.getTarget() instanceof L2PcInstance)) - { + if ((activeChar.getTarget() == null) || (activeChar.getTarget().getObjectId() == activeChar.getObjectId()) || !(activeChar.getTarget() instanceof L2PcInstance)) { player = activeChar; - } - else - { + } else { player = (L2PcInstance) activeChar.getTarget(); } @@ -146,8 +115,7 @@ public class AdminRide implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminScan.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminScan.java index f59d0ddb4b..e54abff684 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminScan.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminScan.java @@ -34,10 +34,8 @@ import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; /** * @author NosBit */ -public class AdminScan implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminScan implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_scan", "admin_deleteNpcByObjectId" }; @@ -45,23 +43,16 @@ public class AdminScan implements IAdminCommandHandler private static final int DEFAULT_RADIUS = 500; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { final StringTokenizer st = new StringTokenizer(command, " "); final String actualCommand = st.nextToken(); - switch (actualCommand.toLowerCase()) - { - case "admin_scan": - { + switch (actualCommand.toLowerCase()) { + case "admin_scan": { int radius = DEFAULT_RADIUS; - if (st.hasMoreElements()) - { - try - { + if (st.hasMoreElements()) { + try { radius = Integer.parseInt(st.nextToken()); - } - catch (NumberFormatException e) - { + } catch (NumberFormatException e) { activeChar.sendMessage("Usage: //scan [radius]"); return false; } @@ -70,22 +61,18 @@ public class AdminScan implements IAdminCommandHandler sendNpcList(activeChar, radius); break; } - case "admin_deletenpcbyobjectid": - { - if (!st.hasMoreElements()) - { + case "admin_deletenpcbyobjectid": { + if (!st.hasMoreElements()) { activeChar.sendMessage("Usage: //deletenpcbyobjectid <object_id>"); return false; } - try - { + try { int objectId = Integer.parseInt(st.nextToken()); final L2Object target = L2World.getInstance().findObject(objectId); final L2Npc npc = target instanceof L2Npc ? (L2Npc) target : null; - if (npc == null) - { + if (npc == null) { activeChar.sendMessage("NPC does not exist or object_id does not belong to an NPC"); return false; } @@ -93,24 +80,18 @@ public class AdminScan implements IAdminCommandHandler npc.deleteMe(); final L2Spawn spawn = npc.getSpawn(); - if (spawn != null) - { + if (spawn != null) { spawn.stopRespawn(); - if (RaidBossSpawnManager.getInstance().isDefined(spawn.getId())) - { + if (RaidBossSpawnManager.getInstance().isDefined(spawn.getId())) { RaidBossSpawnManager.getInstance().deleteSpawn(spawn, true); - } - else - { + } else { SpawnTable.getInstance().deleteSpawn(spawn, true); } } activeChar.sendMessage(npc.getName() + " have been deleted."); - } - catch (NumberFormatException e) - { + } catch (NumberFormatException e) { activeChar.sendMessage("object_id must be a number."); return false; } @@ -122,15 +103,12 @@ public class AdminScan implements IAdminCommandHandler return true; } - private void sendNpcList(L2PcInstance activeChar, int radius) - { + private void sendNpcList(L2PcInstance activeChar, int radius) { final NpcHtmlMessage html = new NpcHtmlMessage(); html.setFile(activeChar.getHtmlPrefix(), "data/html/admin/scan.htm"); final StringBuilder sb = new StringBuilder(); - for (L2Character character : activeChar.getKnownList().getKnownCharactersInRadius(radius)) - { - if (character instanceof L2Npc) - { + for (L2Character character : activeChar.getKnownList().getKnownCharactersInRadius(radius)) { + if (character instanceof L2Npc) { sb.append("<tr>"); sb.append("<td width=\"54\">" + character.getId() + "</td>"); sb.append("<td width=\"54\">" + character.getName() + "</td>"); @@ -145,8 +123,7 @@ public class AdminScan implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminShop.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminShop.java index 0e07a6d82b..5a9438591f 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminShop.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminShop.java @@ -35,64 +35,47 @@ import com.l2jserver.gameserver.network.serverpackets.ExBuySellList; * <li>buy id = shows shop with respective id</li> * </ul> */ -public class AdminShop implements IAdminCommandHandler -{ +public class AdminShop implements IAdminCommandHandler { private static final Logger _log = Logger.getLogger(AdminShop.class.getName()); - private static final String[] ADMIN_COMMANDS = - { + private static final String[] ADMIN_COMMANDS = { "admin_buy", "admin_gmshop" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.startsWith("admin_buy")) - { - try - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.startsWith("admin_buy")) { + try { handleBuyRequest(activeChar, command.substring(10)); - } - catch (IndexOutOfBoundsException e) - { + } catch (IndexOutOfBoundsException e) { activeChar.sendMessage("Please specify buylist."); } - } - else if (command.equals("admin_gmshop")) - { + } else if (command.equals("admin_gmshop")) { AdminHtml.showAdminHtml(activeChar, "gmshops.htm"); } return true; } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } - private void handleBuyRequest(L2PcInstance activeChar, String command) - { + private void handleBuyRequest(L2PcInstance activeChar, String command) { int val = -1; - try - { + try { val = Integer.parseInt(command); - } - catch (Exception e) - { + } catch (Exception e) { _log.warning("admin buylist failed:" + command); } L2BuyList buyList = BuyListData.getInstance().getBuyList(val); - if (buyList != null) - { + if (buyList != null) { activeChar.sendPacket(new BuyList(buyList, activeChar.getAdena(), 0)); activeChar.sendPacket(new ExBuySellList(activeChar, false)); - } - else - { + } else { _log.warning("no buylist with id:" + val); } activeChar.sendPacket(ActionFailed.STATIC_PACKET); diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminShowQuests.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminShowQuests.java index a7dc6b36be..1582bf7f6d 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminShowQuests.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminShowQuests.java @@ -40,121 +40,93 @@ import com.l2jserver.gameserver.network.serverpackets.QuestList; * TODO: Rework and cleanup. * @author Korvin, Zoey76 */ -public class AdminShowQuests implements IAdminCommandHandler -{ +public class AdminShowQuests implements IAdminCommandHandler { private static final Logger _log = Logger.getLogger(AdminShowQuests.class.getName()); - private static final String[] ADMIN_COMMANDS = - { + private static final String[] ADMIN_COMMANDS = { "admin_charquestmenu", "admin_setcharquest" }; - private static final String[] _states = - { + private static final String[] _states = { "CREATED", "STARTED", "COMPLETED" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { String[] cmdParams = command.split(" "); L2PcInstance target = null; L2Object targetObject = null; String[] val = new String[4]; val[0] = null; - if (cmdParams.length > 1) - { + if (cmdParams.length > 1) { target = L2World.getInstance().getPlayer(cmdParams[1]); - if (cmdParams.length > 2) - { - if (cmdParams[2].equals("0")) - { + if (cmdParams.length > 2) { + if (cmdParams[2].equals("0")) { val[0] = "var"; val[1] = "Start"; } - if (cmdParams[2].equals("1")) - { + if (cmdParams[2].equals("1")) { val[0] = "var"; val[1] = "Started"; } - if (cmdParams[2].equals("2")) - { + if (cmdParams[2].equals("2")) { val[0] = "var"; val[1] = "Completed"; } - if (cmdParams[2].equals("3")) - { + if (cmdParams[2].equals("3")) { val[0] = "full"; } - if (cmdParams[2].indexOf("_") != -1) - { + if (cmdParams[2].indexOf("_") != -1) { val[0] = "name"; val[1] = cmdParams[2]; } - if (cmdParams.length > 3) - { - if (cmdParams[3].equals("custom")) - { + if (cmdParams.length > 3) { + if (cmdParams[3].equals("custom")) { val[0] = "custom"; val[1] = cmdParams[2]; } } } - } - else - { + } else { targetObject = activeChar.getTarget(); - if ((targetObject != null) && targetObject.isPlayer()) - { + if ((targetObject != null) && targetObject.isPlayer()) { target = targetObject.getActingPlayer(); } } - if (target == null) - { + if (target == null) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return false; } - if (command.startsWith("admin_charquestmenu")) - { - if (val[0] != null) - { + if (command.startsWith("admin_charquestmenu")) { + if (val[0] != null) { showQuestMenu(target, activeChar, val); - } - else - { + } else { showFirstQuestMenu(target, activeChar); } - } - else if (command.startsWith("admin_setcharquest")) - { - if (cmdParams.length >= 5) - { + } else if (command.startsWith("admin_setcharquest")) { + if (cmdParams.length >= 5) { val[0] = cmdParams[2]; val[1] = cmdParams[3]; val[2] = cmdParams[4]; - if (cmdParams.length == 6) - { + if (cmdParams.length == 6) { val[3] = cmdParams[5]; } setQuestVar(target, activeChar, val); - } - else - { + } else { return false; } } return true; } - private static void showFirstQuestMenu(L2PcInstance target, L2PcInstance actor) - { + private static void showFirstQuestMenu(L2PcInstance target, L2PcInstance actor) { StringBuilder replyMSG = new StringBuilder("<html><body><table width=270><tr><td width=45><button value=\"Main\" action=\"bypass -h admin_admin\" width=45 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td width=180><center>Player: " + target.getName() + "</center></td><td width=45><button value=\"Back\" action=\"bypass -h admin_admin6\" width=45 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table>"); final NpcHtmlMessage adminReply = new NpcHtmlMessage(); @@ -172,11 +144,9 @@ public class AdminShowQuests implements IAdminCommandHandler actor.sendPacket(adminReply); } - private static void showQuestMenu(L2PcInstance target, L2PcInstance actor, String[] val) - { + private static void showQuestMenu(L2PcInstance target, L2PcInstance actor, String[] val) { // TODO(Zoey76): Refactor this into smaller methods and separate database access logic from HTML creation. - try (Connection con = ConnectionFactory.getInstance().getConnection()) - { + try (Connection con = ConnectionFactory.getInstance().getConnection()) { ResultSet rs; PreparedStatement req; int ID = target.getObjectId(); @@ -184,23 +154,19 @@ public class AdminShowQuests implements IAdminCommandHandler StringBuilder replyMSG = new StringBuilder("<html><body>"); final NpcHtmlMessage adminReply = new NpcHtmlMessage(); - switch (val[0]) - { - case "full": - { + switch (val[0]) { + case "full": { replyMSG.append("<table width=250><tr><td>Full Quest List for <font color=\"LEVEL\">" + target.getName() + "</font> (ID:" + ID + ")</td></tr>"); req = con.prepareStatement("SELECT DISTINCT name FROM character_quests WHERE charId='" + ID + "' AND var='<state>' ORDER by name"); req.execute(); rs = req.getResultSet(); - while (rs.next()) - { + while (rs.next()) { replyMSG.append("<tr><td><a action=\"bypass -h admin_charquestmenu " + target.getName() + " " + rs.getString(1) + "\">" + rs.getString(1) + "</a></td></tr>"); } replyMSG.append("</table></body></html>"); break; } - case "name": - { + case "name": { QuestState qs = target.getQuestState(val[1]); String state = (qs != null) ? _states[qs.getState()] : "CREATED"; replyMSG.append("Character: <font color=\"LEVEL\">" + target.getName() + "</font><br>Quest: <font color=\"LEVEL\">" + val[1] + "</font><br>State: <font color=\"LEVEL\">" + state + "</font><br><br>"); @@ -208,11 +174,9 @@ public class AdminShowQuests implements IAdminCommandHandler req = con.prepareStatement("SELECT var,value FROM character_quests WHERE charId='" + ID + "' and name='" + val[1] + "'"); req.execute(); rs = req.getResultSet(); - while (rs.next()) - { + while (rs.next()) { String var_name = rs.getString(1); - if (var_name.equals("<state>")) - { + if (var_name.equals("<state>")) { continue; } replyMSG.append("<tr><td>" + var_name + "</td><td>" + rs.getString(2) + "</td><td><edit var=\"var" + var_name + "\" width=80 height=15></td><td><button value=\"Set\" action=\"bypass -h admin_setcharquest " + target.getName() + " " + val[1] + " " + var_name + " $var" @@ -227,22 +191,19 @@ public class AdminShowQuests implements IAdminCommandHandler replyMSG.append("</center></body></html>"); break; } - case "var": - { + case "var": { replyMSG.append("Character: <font color=\"LEVEL\">" + target.getName() + "</font><br>Quests with state: <font color=\"LEVEL\">" + val[1] + "</font><br>"); replyMSG.append("<table width=250>"); req = con.prepareStatement("SELECT DISTINCT name FROM character_quests WHERE charId='" + ID + "' and var='<state>' and value='" + val[1] + "'"); req.execute(); rs = req.getResultSet(); - while (rs.next()) - { + while (rs.next()) { replyMSG.append("<tr><td><a action=\"bypass -h admin_charquestmenu " + target.getName() + " " + rs.getString(1) + "\">" + rs.getString(1) + "</a></td></tr>"); } replyMSG.append("</table></body></html>"); break; } - case "custom": - { + case "custom": { boolean exqdb = true; boolean exqch = true; int qnumber = Integer.parseInt(val[1]); @@ -251,40 +212,30 @@ public class AdminShowQuests implements IAdminCommandHandler QuestState qs = null; Quest quest = QuestManager.getInstance().getQuest(qnumber); - if (quest != null) - { + if (quest != null) { qname = quest.getName(); qs = target.getQuestState(qname); - } - else - { + } else { exqdb = false; } - if (qs != null) - { + if (qs != null) { state = _states[qs.getState()]; - } - else - { + } else { exqch = false; state = "N/A"; } - if (exqdb) - { - if (exqch) - { + if (exqdb) { + if (exqch) { replyMSG.append("Character: <font color=\"LEVEL\">" + target.getName() + "</font><br>Quest: <font color=\"LEVEL\">" + qname + "</font><br>State: <font color=\"LEVEL\">" + state + "</font><br><br>"); replyMSG.append("<center><table width=250><tr><td>Var</td><td>Value</td><td>New Value</td><td> </td></tr>"); req = con.prepareStatement("SELECT var,value FROM character_quests WHERE charId='" + ID + "' and name='" + qname + "'"); req.execute(); rs = req.getResultSet(); - while (rs.next()) - { + while (rs.next()) { String var_name = rs.getString(1); - if (var_name.equals("<state>")) - { + if (var_name.equals("<state>")) { continue; } replyMSG.append("<tr><td>" + var_name + "</td><td>" + rs.getString(2) + "</td><td><edit var=\"var" + var_name + "\" width=80 height=15></td><td><button value=\"Set\" action=\"bypass -h admin_setcharquest " + target.getName() + " " + qname + " " + var_name + " $var" @@ -297,9 +248,7 @@ public class AdminShowQuests implements IAdminCommandHandler replyMSG.append("</table><br><br><font color=\"ff0000\">Delete Quest from DB:</font><br><button value=\"Quest Delete\" action=\"bypass -h admin_setcharquest " + target.getName() + " " + qname + " state DELETE\" width=100 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); replyMSG.append("</center></body></html>"); - } - else - { + } else { replyMSG.append("Character: <font color=\"LEVEL\">" + target.getName() + "</font><br>Quest: <font color=\"LEVEL\">" + qname + "</font><br>State: <font color=\"LEVEL\">" + state + "</font><br><br>"); replyMSG.append("<center>Start this Quest for player:<br>"); replyMSG.append("<button value=\"Create Quest\" action=\"bypass -h admin_setcharquest " + target.getName() + " " + qnumber + " state CREATE\" width=100 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><br><br>"); @@ -307,9 +256,7 @@ public class AdminShowQuests implements IAdminCommandHandler replyMSG.append("<button value=\"Create & Complete\" action=\"bypass -h admin_setcharquest " + target.getName() + " " + qnumber + " state CC\" width=130 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><br><br>"); replyMSG.append("</center></body></html>"); } - } - else - { + } else { replyMSG.append("<center><font color=\"ee0000\">Quest with number </font><font color=\"LEVEL\">" + qnumber + "</font><font color=\"ee0000\"> doesn't exist!</font></center></body></html>"); } break; @@ -317,30 +264,23 @@ public class AdminShowQuests implements IAdminCommandHandler } adminReply.setHtml(replyMSG.toString()); actor.sendPacket(adminReply); - } - catch (Exception e) - { + } catch (Exception e) { actor.sendMessage("There was an error."); _log.warning(AdminShowQuests.class.getSimpleName() + ": " + e.getMessage()); } } - private static void setQuestVar(L2PcInstance target, L2PcInstance actor, String[] val) - { + private static void setQuestVar(L2PcInstance target, L2PcInstance actor, String[] val) { QuestState qs = target.getQuestState(val[0]); String[] outval = new String[3]; - if ("state".equals(val[1])) - { - switch (val[2]) - { - case "COMPLETED": - { + if ("state".equals(val[1])) { + switch (val[2]) { + case "COMPLETED": { qs.exitQuest("1".equals(val[3])); break; } - case "DELETE": - { + case "DELETE": { Quest.deleteQuestInDb(qs, true); qs.exitQuest(true); target.sendPacket(new QuestList()); @@ -349,8 +289,7 @@ public class AdminShowQuests implements IAdminCommandHandler actor.sendMessage("Removed quest " + qs.getQuest().getDescr() + " from " + target.getName() + "."); break; } - case "CREATE": - { + case "CREATE": { qs = QuestManager.getInstance().getQuest(Integer.parseInt(val[0])).newQuestState(target); qs.startQuest(); target.sendPacket(new QuestList()); @@ -358,8 +297,7 @@ public class AdminShowQuests implements IAdminCommandHandler val[0] = qs.getQuest().getName(); break; } - case "CC": - { + case "CC": { qs = QuestManager.getInstance().getQuest(Integer.parseInt(val[0])).newQuestState(target); qs.exitQuest(false); target.sendPacket(new QuestList()); @@ -368,15 +306,10 @@ public class AdminShowQuests implements IAdminCommandHandler break; } } - } - else - { - if (val[2].equals("delete")) - { + } else { + if (val[2].equals("delete")) { qs.unset(val[1]); - } - else - { + } else { qs.set(val[1], val[2]); } target.sendPacket(new QuestList()); @@ -388,8 +321,7 @@ public class AdminShowQuests implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminShutdown.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminShutdown.java index a64fea41b1..90d4bf494b 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminShutdown.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminShutdown.java @@ -33,62 +33,42 @@ import com.l2jserver.gameserver.util.Util; * This class handles following admin commands: - server_shutdown [sec] = shows menu or shuts down server in sec seconds * @version $Revision: 1.5.2.1.2.4 $ $Date: 2005/04/11 10:06:06 $ */ -public class AdminShutdown implements IAdminCommandHandler -{ +public class AdminShutdown implements IAdminCommandHandler { // private static Logger _log = Logger.getLogger(AdminShutdown.class.getName()); - private static final String[] ADMIN_COMMANDS = - { + private static final String[] ADMIN_COMMANDS = { "admin_server_shutdown", "admin_server_restart", "admin_server_abort" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.startsWith("admin_server_shutdown")) - { - try - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.startsWith("admin_server_shutdown")) { + try { final String val = command.substring(22); - if (Util.isDigit(val)) - { + if (Util.isDigit(val)) { serverShutdown(activeChar, Integer.valueOf(val), false); - } - else - { + } else { activeChar.sendMessage("Usage: //server_shutdown <seconds>"); sendHtmlForm(activeChar); } - } - catch (StringIndexOutOfBoundsException e) - { + } catch (StringIndexOutOfBoundsException e) { sendHtmlForm(activeChar); } - } - else if (command.startsWith("admin_server_restart")) - { - try - { + } else if (command.startsWith("admin_server_restart")) { + try { final String val = command.substring(21); - if (Util.isDigit(val)) - { + if (Util.isDigit(val)) { serverShutdown(activeChar, Integer.parseInt(val), true); - } - else - { + } else { activeChar.sendMessage("Usage: //server_restart <seconds>"); sendHtmlForm(activeChar); } - } - catch (StringIndexOutOfBoundsException e) - { + } catch (StringIndexOutOfBoundsException e) { sendHtmlForm(activeChar); } - } - else if (command.startsWith("admin_server_abort")) - { + } else if (command.startsWith("admin_server_abort")) { serverAbort(activeChar); } @@ -96,13 +76,11 @@ public class AdminShutdown implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } - private void sendHtmlForm(L2PcInstance activeChar) - { + private void sendHtmlForm(L2PcInstance activeChar) { final NpcHtmlMessage adminReply = new NpcHtmlMessage(); int t = GameTimeController.getInstance().getGameTime(); int h = t / 60; @@ -118,13 +96,11 @@ public class AdminShutdown implements IAdminCommandHandler activeChar.sendPacket(adminReply); } - private void serverShutdown(L2PcInstance activeChar, int seconds, boolean restart) - { + private void serverShutdown(L2PcInstance activeChar, int seconds, boolean restart) { Shutdown.getInstance().startShutdown(activeChar, seconds, restart); } - private void serverAbort(L2PcInstance activeChar) - { + private void serverAbort(L2PcInstance activeChar) { Shutdown.getInstance().abort(activeChar); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminSiege.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminSiege.java index 4ee2f87b51..64cb044ea6 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminSiege.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminSiege.java @@ -43,10 +43,8 @@ import com.l2jserver.gameserver.util.Util; * This class handles all siege commands. * @author Zoey76 (rework) */ -public class AdminSiege implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminSiege implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { // Castle commands "admin_siege", "admin_add_attacker", @@ -71,88 +69,67 @@ public class AdminSiege implements IAdminCommandHandler }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { StringTokenizer st = new StringTokenizer(command, " "); command = st.nextToken(); // Get actual command // Get castle Castle castle = null; ClanHall clanhall = null; - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { L2PcInstance player = null; - if ((activeChar.getTarget() != null) && activeChar.getTarget().isPlayer()) - { + if ((activeChar.getTarget() != null) && activeChar.getTarget().isPlayer()) { player = activeChar.getTarget().getActingPlayer(); } String val = st.nextToken(); - if (command.startsWith("admin_clanhall")) - { - if (Util.isDigit(val)) - { + if (command.startsWith("admin_clanhall")) { + if (Util.isDigit(val)) { clanhall = ClanHallManager.getInstance().getClanHallById(Integer.parseInt(val)); L2Clan clan = null; - switch (command) - { + switch (command) { case "admin_clanhallset": - if ((player == null) || (player.getClan() == null)) - { + if ((player == null) || (player.getClan() == null)) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return false; } - if (clanhall.getOwnerId() > 0) - { + if (clanhall.getOwnerId() > 0) { activeChar.sendMessage("This Clan Hall is not free!"); return false; } clan = player.getClan(); - if (clan.getHideoutId() > 0) - { + if (clan.getHideoutId() > 0) { activeChar.sendMessage("You have already a Clan Hall!"); return false; } - if (!clanhall.isSiegableHall()) - { + if (!clanhall.isSiegableHall()) { ClanHallManager.getInstance().setOwner(clanhall.getId(), clan); - if (AuctionManager.getInstance().getAuction(clanhall.getId()) != null) - { + if (AuctionManager.getInstance().getAuction(clanhall.getId()) != null) { AuctionManager.getInstance().getAuction(clanhall.getId()).deleteAuctionFromDB(); } - } - else - { + } else { clanhall.setOwner(clan); clan.setHideoutId(clanhall.getId()); } break; case "admin_clanhalldel": - if (!clanhall.isSiegableHall()) - { - if (!ClanHallManager.getInstance().isFree(clanhall.getId())) - { + if (!clanhall.isSiegableHall()) { + if (!ClanHallManager.getInstance().isFree(clanhall.getId())) { ClanHallManager.getInstance().setFree(clanhall.getId()); AuctionManager.getInstance().initNPC(clanhall.getId()); - } - else - { + } else { activeChar.sendMessage("This Clan Hall is already free!"); } - } - else - { + } else { final int oldOwner = clanhall.getOwnerId(); - if (oldOwner > 0) - { + if (oldOwner > 0) { clanhall.free(); clan = ClanTable.getInstance().getClan(oldOwner); - if (clan != null) - { + if (clan != null) { clan.setHideoutId(0); clan.broadcastClanStatus(); } @@ -167,55 +144,40 @@ public class AdminSiege implements IAdminCommandHandler break; case "admin_clanhallteleportself": final L2ClanHallZone zone = clanhall.getZone(); - if (zone != null) - { + if (zone != null) { activeChar.teleToLocation(zone.getSpawnLoc(), true); } break; default: - if (!clanhall.isSiegableHall()) - { + if (!clanhall.isSiegableHall()) { showClanHallPage(activeChar, clanhall); - } - else - { + } else { showSiegableHallPage(activeChar, (SiegableHall) clanhall); } break; } } - } - else - { + } else { castle = CastleManager.getInstance().getCastle(val); - switch (command) - { + switch (command) { case "admin_add_attacker": - if (player == null) - { + if (player == null) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); - } - else - { + } else { castle.getSiege().registerAttacker(player, true); } break; case "admin_add_defender": - if (player == null) - { + if (player == null) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); - } - else - { + } else { castle.getSiege().registerDefender(player, true); } break; case "admin_add_guard": - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { val = st.nextToken(); - if (Util.isDigit(val)) - { + if (Util.isDigit(val)) { castle.getSiege().getSiegeGuardManager().addSiegeGuard(activeChar, Integer.parseInt(val)); break; } @@ -236,81 +198,60 @@ public class AdminSiege implements IAdminCommandHandler activeChar.sendMessage("Not implemented yet."); break; case "admin_setcastle": - if ((player == null) || (player.getClan() == null)) - { + if ((player == null) || (player.getClan() == null)) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); - } - else - { + } else { castle.setOwner(player.getClan()); } break; case "admin_removecastle": final L2Clan clan = ClanTable.getInstance().getClan(castle.getOwnerId()); - if (clan != null) - { + if (clan != null) { castle.removeOwner(clan); - } - else - { + } else { activeChar.sendMessage("Unable to remove castle."); } break; case "admin_setsiegetime": - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { final Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(castle.getSiegeDate().getTimeInMillis()); val = st.nextToken(); - if ("month".equals(val)) - { + if ("month".equals(val)) { int month = cal.get(Calendar.MONTH) + Integer.parseInt(st.nextToken()); - if ((cal.getActualMinimum(Calendar.MONTH) > month) || (cal.getActualMaximum(Calendar.MONTH) < month)) - { + if ((cal.getActualMinimum(Calendar.MONTH) > month) || (cal.getActualMaximum(Calendar.MONTH) < month)) { activeChar.sendMessage("Unable to change Siege Date - Incorrect month value only " + cal.getActualMinimum(Calendar.MONTH) + "-" + cal.getActualMaximum(Calendar.MONTH) + " is accepted!"); return false; } cal.set(Calendar.MONTH, month); - } - else if ("day".equals(val)) - { + } else if ("day".equals(val)) { int day = Integer.parseInt(st.nextToken()); - if ((cal.getActualMinimum(Calendar.DAY_OF_MONTH) > day) || (cal.getActualMaximum(Calendar.DAY_OF_MONTH) < day)) - { + if ((cal.getActualMinimum(Calendar.DAY_OF_MONTH) > day) || (cal.getActualMaximum(Calendar.DAY_OF_MONTH) < day)) { activeChar.sendMessage("Unable to change Siege Date - Incorrect day value only " + cal.getActualMinimum(Calendar.DAY_OF_MONTH) + "-" + cal.getActualMaximum(Calendar.DAY_OF_MONTH) + " is accepted!"); return false; } cal.set(Calendar.DAY_OF_MONTH, day); - } - else if ("hour".equals(val)) - { + } else if ("hour".equals(val)) { int hour = Integer.parseInt(st.nextToken()); - if ((cal.getActualMinimum(Calendar.HOUR_OF_DAY) > hour) || (cal.getActualMaximum(Calendar.HOUR_OF_DAY) < hour)) - { + if ((cal.getActualMinimum(Calendar.HOUR_OF_DAY) > hour) || (cal.getActualMaximum(Calendar.HOUR_OF_DAY) < hour)) { activeChar.sendMessage("Unable to change Siege Date - Incorrect hour value only " + cal.getActualMinimum(Calendar.HOUR_OF_DAY) + "-" + cal.getActualMaximum(Calendar.HOUR_OF_DAY) + " is accepted!"); return false; } cal.set(Calendar.HOUR_OF_DAY, hour); - } - else if ("min".equals(val)) - { + } else if ("min".equals(val)) { int min = Integer.parseInt(st.nextToken()); - if ((cal.getActualMinimum(Calendar.MINUTE) > min) || (cal.getActualMaximum(Calendar.MINUTE) < min)) - { + if ((cal.getActualMinimum(Calendar.MINUTE) > min) || (cal.getActualMaximum(Calendar.MINUTE) < min)) { activeChar.sendMessage("Unable to change Siege Date - Incorrect minute value only " + cal.getActualMinimum(Calendar.MINUTE) + "-" + cal.getActualMaximum(Calendar.MINUTE) + " is accepted!"); return false; } cal.set(Calendar.MINUTE, min); } - if (cal.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) - { + if (cal.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) { activeChar.sendMessage("Unable to change Siege Date"); - } - else if (cal.getTimeInMillis() != castle.getSiegeDate().getTimeInMillis()) - { + } else if (cal.getTimeInMillis() != castle.getSiegeDate().getTimeInMillis()) { castle.getSiegeDate().setTimeInMillis(cal.getTimeInMillis()); castle.getSiege().saveSiegeDate(); activeChar.sendMessage("Castle siege time for castle " + castle.getName() + " has been changed."); @@ -329,9 +270,7 @@ public class AdminSiege implements IAdminCommandHandler break; } } - } - else - { + } else { showCastleSelectPage(activeChar); } return true; @@ -341,22 +280,18 @@ public class AdminSiege implements IAdminCommandHandler * Show castle select page. * @param activeChar the active char */ - private void showCastleSelectPage(L2PcInstance activeChar) - { + private void showCastleSelectPage(L2PcInstance activeChar) { int i = 0; final NpcHtmlMessage adminReply = new NpcHtmlMessage(); adminReply.setFile(activeChar.getHtmlPrefix(), "data/html/admin/castles.htm"); final StringBuilder cList = new StringBuilder(500); - for (Castle castle : CastleManager.getInstance().getCastles()) - { - if (castle != null) - { + for (Castle castle : CastleManager.getInstance().getCastles()) { + if (castle != null) { String name = castle.getName(); StringUtil.append(cList, "<td fixwidth=90><a action=\"bypass -h admin_siege ", name, "\">", name, "</a></td>"); i++; } - if (i > 2) - { + if (i > 2) { cList.append("</tr><tr>"); i = 0; } @@ -364,15 +299,12 @@ public class AdminSiege implements IAdminCommandHandler adminReply.replace("%castles%", cList.toString()); cList.setLength(0); i = 0; - for (SiegableHall hall : ClanHallSiegeManager.getInstance().getConquerableHalls().values()) - { - if (hall != null) - { + for (SiegableHall hall : ClanHallSiegeManager.getInstance().getConquerableHalls().values()) { + if (hall != null) { StringUtil.append(cList, "<td fixwidth=90><a action=\"bypass -h admin_chsiege_siegablehall ", String.valueOf(hall.getId()), "\">", hall.getName(), "</a></td>"); i++; } - if (i > 1) - { + if (i > 1) { cList.append("</tr><tr>"); i = 0; } @@ -380,15 +312,12 @@ public class AdminSiege implements IAdminCommandHandler adminReply.replace("%siegableHalls%", cList.toString()); cList.setLength(0); i = 0; - for (ClanHall clanhall : ClanHallManager.getInstance().getClanHalls().values()) - { - if (clanhall != null) - { + for (ClanHall clanhall : ClanHallManager.getInstance().getClanHalls().values()) { + if (clanhall != null) { StringUtil.append(cList, "<td fixwidth=134><a action=\"bypass -h admin_clanhall ", String.valueOf(clanhall.getId()), "\">", clanhall.getName(), "</a></td>"); i++; } - if (i > 1) - { + if (i > 1) { cList.append("</tr><tr>"); i = 0; } @@ -396,15 +325,12 @@ public class AdminSiege implements IAdminCommandHandler adminReply.replace("%clanhalls%", cList.toString()); cList.setLength(0); i = 0; - for (ClanHall clanhall : ClanHallManager.getInstance().getFreeClanHalls().values()) - { - if (clanhall != null) - { + for (ClanHall clanhall : ClanHallManager.getInstance().getFreeClanHalls().values()) { + if (clanhall != null) { StringUtil.append(cList, "<td fixwidth=134><a action=\"bypass -h admin_clanhall ", String.valueOf(clanhall.getId()), "\">", clanhall.getName(), "</a></td>"); i++; } - if (i > 1) - { + if (i > 1) { cList.append("</tr><tr>"); i = 0; } @@ -418,8 +344,7 @@ public class AdminSiege implements IAdminCommandHandler * @param activeChar the active char * @param castleName the castle name */ - private void showSiegePage(L2PcInstance activeChar, String castleName) - { + private void showSiegePage(L2PcInstance activeChar, String castleName) { final NpcHtmlMessage adminReply = new NpcHtmlMessage(); adminReply.setFile(activeChar.getHtmlPrefix(), "data/html/admin/castle.htm"); adminReply.replace("%castleName%", castleName); @@ -431,38 +356,30 @@ public class AdminSiege implements IAdminCommandHandler * @param activeChar the active char * @param castle the castle */ - private void showSiegeTimePage(L2PcInstance activeChar, Castle castle) - { + private void showSiegeTimePage(L2PcInstance activeChar, Castle castle) { final NpcHtmlMessage adminReply = new NpcHtmlMessage(); adminReply.setFile(activeChar.getHtmlPrefix(), "data/html/admin/castlesiegetime.htm"); adminReply.replace("%castleName%", castle.getName()); adminReply.replace("%time%", castle.getSiegeDate().getTime().toString()); final Calendar newDay = Calendar.getInstance(); boolean isSunday = false; - if (newDay.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) - { + if (newDay.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) { isSunday = true; - } - else - { + } else { newDay.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); } - if (!SevenSigns.getInstance().isDateInSealValidPeriod(newDay)) - { + if (!SevenSigns.getInstance().isDateInSealValidPeriod(newDay)) { newDay.add(Calendar.DAY_OF_MONTH, 7); } - if (isSunday) - { + if (isSunday) { adminReply.replace("%sundaylink%", String.valueOf(newDay.get(Calendar.DAY_OF_YEAR))); adminReply.replace("%sunday%", String.valueOf(newDay.get(Calendar.MONTH) + "/" + String.valueOf(newDay.get(Calendar.DAY_OF_MONTH)))); newDay.add(Calendar.DAY_OF_MONTH, 13); adminReply.replace("%saturdaylink%", String.valueOf(newDay.get(Calendar.DAY_OF_YEAR))); adminReply.replace("%saturday%", String.valueOf(newDay.get(Calendar.MONTH) + "/" + String.valueOf(newDay.get(Calendar.DAY_OF_MONTH)))); - } - else - { + } else { adminReply.replace("%saturdaylink%", String.valueOf(newDay.get(Calendar.DAY_OF_YEAR))); adminReply.replace("%saturday%", String.valueOf(newDay.get(Calendar.MONTH) + "/" + String.valueOf(newDay.get(Calendar.DAY_OF_MONTH)))); newDay.add(Calendar.DAY_OF_MONTH, 1); @@ -477,8 +394,7 @@ public class AdminSiege implements IAdminCommandHandler * @param activeChar the active char * @param clanhall the clan hall */ - private void showClanHallPage(L2PcInstance activeChar, ClanHall clanhall) - { + private void showClanHallPage(L2PcInstance activeChar, ClanHall clanhall) { final NpcHtmlMessage adminReply = new NpcHtmlMessage(); adminReply.setFile(activeChar.getHtmlPrefix(), "data/html/admin/clanhall.htm"); adminReply.replace("%clanhallName%", clanhall.getName()); @@ -493,27 +409,22 @@ public class AdminSiege implements IAdminCommandHandler * @param activeChar the active char * @param hall the siegable hall */ - private void showSiegableHallPage(L2PcInstance activeChar, SiegableHall hall) - { + private void showSiegableHallPage(L2PcInstance activeChar, SiegableHall hall) { final NpcHtmlMessage msg = new NpcHtmlMessage(); msg.setFile(null, "data/html/admin/siegablehall.htm"); msg.replace("%clanhallId%", String.valueOf(hall.getId())); msg.replace("%clanhallName%", hall.getName()); - if (hall.getOwnerId() > 0) - { + if (hall.getOwnerId() > 0) { final L2Clan owner = ClanTable.getInstance().getClan(hall.getOwnerId()); msg.replace("%clanhallOwner%", (owner != null) ? owner.getName() : "No Owner"); - } - else - { + } else { msg.replace("%clanhallOwner%", "No Owner"); } activeChar.sendPacket(msg); } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminSkill.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminSkill.java index 984c217830..df6126d216 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminSkill.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminSkill.java @@ -60,12 +60,10 @@ import com.l2jserver.gameserver.util.StringUtil; * </ul> * @version 2012/02/26 Small fixes by Zoey76 05/03/2011 */ -public class AdminSkill implements IAdminCommandHandler -{ +public class AdminSkill implements IAdminCommandHandler { private static Logger _log = Logger.getLogger(AdminSkill.class.getName()); - private static final String[] ADMIN_COMMANDS = - { + private static final String[] ADMIN_COMMANDS = { "admin_show_skills", "admin_remove_skills", "admin_skill_list", @@ -86,119 +84,72 @@ public class AdminSkill implements IAdminCommandHandler private static Skill[] adminSkills; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.equals("admin_show_skills")) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.equals("admin_show_skills")) { showMainPage(activeChar); - } - else if (command.startsWith("admin_remove_skills")) - { - try - { + } else if (command.startsWith("admin_remove_skills")) { + try { String val = command.substring(20); removeSkillsPage(activeChar, Integer.parseInt(val)); + } catch (StringIndexOutOfBoundsException e) { } - catch (StringIndexOutOfBoundsException e) - { - } - } - else if (command.startsWith("admin_skill_list")) - { + } else if (command.startsWith("admin_skill_list")) { AdminHtml.showAdminHtml(activeChar, "skills.htm"); - } - else if (command.startsWith("admin_skill_index")) - { - try - { + } else if (command.startsWith("admin_skill_index")) { + try { String val = command.substring(18); AdminHtml.showAdminHtml(activeChar, "skills/" + val + ".htm"); + } catch (StringIndexOutOfBoundsException e) { } - catch (StringIndexOutOfBoundsException e) - { - } - } - else if (command.startsWith("admin_add_skill")) - { - try - { + } else if (command.startsWith("admin_add_skill")) { + try { String val = command.substring(15); adminAddSkill(activeChar, val); - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //add_skill <skill_id> <level>"); } - } - else if (command.startsWith("admin_remove_skill")) - { - try - { + } else if (command.startsWith("admin_remove_skill")) { + try { String id = command.substring(19); int idval = Integer.parseInt(id); adminRemoveSkill(activeChar, idval); - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //remove_skill <skill_id>"); } - } - else if (command.equals("admin_get_skills")) - { + } else if (command.equals("admin_get_skills")) { adminGetSkills(activeChar); - } - else if (command.equals("admin_reset_skills")) - { + } else if (command.equals("admin_reset_skills")) { adminResetSkills(activeChar); - } - else if (command.equals("admin_give_all_skills")) - { + } else if (command.equals("admin_give_all_skills")) { adminGiveAllSkills(activeChar, false); - } - else if (command.equals("admin_give_all_skills_fs")) - { + } else if (command.equals("admin_give_all_skills_fs")) { adminGiveAllSkills(activeChar, true); - } - else if (command.equals("admin_give_clan_skills")) - { + } else if (command.equals("admin_give_clan_skills")) { adminGiveClanSkills(activeChar, false); - } - else if (command.equals("admin_give_all_clan_skills")) - { + } else if (command.equals("admin_give_all_clan_skills")) { adminGiveClanSkills(activeChar, true); - } - else if (command.equals("admin_remove_all_skills")) - { + } else if (command.equals("admin_remove_all_skills")) { final L2Object target = activeChar.getTarget(); - if ((target == null) || !target.isPlayer()) - { + if ((target == null) || !target.isPlayer()) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return false; } final L2PcInstance player = target.getActingPlayer(); - for (Skill skill : player.getAllSkills()) - { + for (Skill skill : player.getAllSkills()) { player.removeSkill(skill); } activeChar.sendMessage("You have removed all skills from " + player.getName() + "."); player.sendMessage("Admin removed all skills from you."); player.sendSkillList(); player.broadcastUserInfo(); - } - else if (command.startsWith("admin_add_clan_skill")) - { - try - { + } else if (command.startsWith("admin_add_clan_skill")) { + try { String[] val = command.split(" "); adminAddClanSkill(activeChar, Integer.parseInt(val[1]), Integer.parseInt(val[2])); - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //add_clan_skill <skill_id> <level>"); } - } - else if (command.startsWith("admin_setskill")) - { + } else if (command.startsWith("admin_setskill")) { String[] split = command.split(" "); int id = Integer.parseInt(split[1]); int lvl = Integer.parseInt(split[2]); @@ -215,11 +166,9 @@ public class AdminSkill implements IAdminCommandHandler * @param activeChar the active char * @param includedByFs if {@code true} Forgotten Scroll skills will be delivered. */ - private void adminGiveAllSkills(L2PcInstance activeChar, boolean includedByFs) - { + private void adminGiveAllSkills(L2PcInstance activeChar, boolean includedByFs) { final L2Object target = activeChar.getTarget(); - if ((target == null) || !target.isPlayer()) - { + if ((target == null) || !target.isPlayer()) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return; } @@ -235,11 +184,9 @@ public class AdminSkill implements IAdminCommandHandler * @param activeChar the active char, probably a Game Master. * @param includeSquad if Squad skills is included */ - private void adminGiveClanSkills(L2PcInstance activeChar, boolean includeSquad) - { + private void adminGiveClanSkills(L2PcInstance activeChar, boolean includeSquad) { final L2Object target = activeChar.getTarget(); - if ((target == null) || !target.isPlayer()) - { + if ((target == null) || !target.isPlayer()) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return; } @@ -247,29 +194,25 @@ public class AdminSkill implements IAdminCommandHandler final L2PcInstance player = target.getActingPlayer(); final L2Clan clan = player.getClan(); - if (clan == null) - { + if (clan == null) { activeChar.sendPacket(SystemMessageId.TARGET_MUST_BE_IN_CLAN); return; } - if (!player.isClanLeader()) - { + if (!player.isClanLeader()) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_IS_NOT_A_CLAN_LEADER); sm.addString(player.getName()); activeChar.sendPacket(sm); } final Map<Integer, L2SkillLearn> skills = SkillTreesData.getInstance().getMaxPledgeSkills(clan, includeSquad); - for (L2SkillLearn s : skills.values()) - { + for (L2SkillLearn s : skills.values()) { clan.addNewSkill(SkillData.getInstance().getSkill(s.getSkillId(), s.getSkillLevel())); } // Notify target and active char clan.broadcastToOnlineMembers(new PledgeSkillList(clan)); - for (L2PcInstance member : clan.getOnlineMembers(0)) - { + for (L2PcInstance member : clan.getOnlineMembers(0)) { member.sendSkillList(); } @@ -282,11 +225,9 @@ public class AdminSkill implements IAdminCommandHandler * @param activeChar the active Game Master. * @param page */ - private void removeSkillsPage(L2PcInstance activeChar, int page) - { + private void removeSkillsPage(L2PcInstance activeChar, int page) { final L2Object target = activeChar.getTarget(); - if ((target == null) || !target.isPlayer()) - { + if ((target == null) || !target.isPlayer()) { activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT); return; } @@ -296,40 +237,41 @@ public class AdminSkill implements IAdminCommandHandler int maxSkillsPerPage = 10; int maxPages = skills.length / maxSkillsPerPage; - if (skills.length > (maxSkillsPerPage * maxPages)) - { + if (skills.length > (maxSkillsPerPage * maxPages)) { maxPages++; } - if (page > maxPages) - { + if (page > maxPages) { page = maxPages; } int skillsStart = maxSkillsPerPage * page; int skillsEnd = skills.length; - if ((skillsEnd - skillsStart) > maxSkillsPerPage) - { + if ((skillsEnd - skillsStart) > maxSkillsPerPage) { skillsEnd = skillsStart + maxSkillsPerPage; } final NpcHtmlMessage adminReply = new NpcHtmlMessage(); - final StringBuilder replyMSG = StringUtil.startAppend(500 + (maxPages * 50) + (((skillsEnd - skillsStart) + 1) * 50), "<html><body>" + "<table width=260><tr>" + "<td width=40><button value=\"Main\" action=\"bypass -h admin_admin\" width=40 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" + "<td width=180><center>Character Selection Menu</center></td>" + "<td width=40><button value=\"Back\" action=\"bypass -h admin_show_skills\" width=40 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" + "</tr></table>" + "<br><br>" + "<center>Editing <font color=\"LEVEL\">", player.getName(), "</font></center>" + "<br><table width=270><tr><td>Lv: ", String.valueOf(player.getLevel()), " ", ClassListData.getInstance().getClass(player.getClassId()).getClientCode(), "</td></tr></table>" + "<br><table width=270><tr><td>Note: Dont forget that modifying players skills can</td></tr>" + "<tr><td>ruin the game...</td></tr></table>" + "<br><center>Click on the skill you wish to remove:</center>" + "<br>" + "<center><table width=270><tr>"); + final StringBuilder replyMSG = StringUtil.startAppend(500 + (maxPages * 50) + (((skillsEnd - skillsStart) + 1) * 50), "<html><body>" + "<table width=260><tr>" + + "<td width=40><button value=\"Main\" action=\"bypass -h admin_admin\" width=40 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" + "<td width=180><center>Character Selection Menu</center></td>" + + "<td width=40><button value=\"Back\" action=\"bypass -h admin_show_skills\" width=40 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" + "</tr></table>" + "<br><br>" + + "<center>Editing <font color=\"LEVEL\">", player.getName(), "</font></center>" + "<br><table width=270><tr><td>Lv: ", String.valueOf(player.getLevel()), " ", ClassListData.getInstance().getClass(player.getClassId()).getClientCode(), "</td></tr></table>" + + "<br><table width=270><tr><td>Note: Dont forget that modifying players skills can</td></tr>" + "<tr><td>ruin the game...</td></tr></table>" + "<br><center>Click on the skill you wish to remove:</center>" + "<br>" + "<center><table width=270><tr>"); - for (int x = 0; x < maxPages; x++) - { + for (int x = 0; x < maxPages; x++) { int pagenr = x + 1; StringUtil.append(replyMSG, "<td><a action=\"bypass -h admin_remove_skills ", String.valueOf(x), "\">Page ", String.valueOf(pagenr), "</a></td>"); } replyMSG.append("</tr></table></center>" + "<br><table width=270>" + "<tr><td width=80>Name:</td><td width=60>Level:</td><td width=40>Id:</td></tr>"); - for (int i = skillsStart; i < skillsEnd; i++) - { + for (int i = skillsStart; i < skillsEnd; i++) { StringUtil.append(replyMSG, "<tr><td width=80><a action=\"bypass -h admin_remove_skill ", String.valueOf(skills[i].getId()), "\">", skills[i].getName(), "</a></td><td width=60>", String.valueOf(skills[i].getLevel()), "</td><td width=40>", String.valueOf(skills[i].getId()), "</td></tr>"); } - replyMSG.append("</table>" + "<br><center><table>" + "Remove skill by ID :" + "<tr><td>Id: </td>" + "<td><edit var=\"id_to_remove\" width=110></td></tr>" + "</table></center>" + "<center><button value=\"Remove skill\" action=\"bypass -h admin_remove_skill $id_to_remove\" width=110 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center>" + "<br><center><button value=\"Back\" action=\"bypass -h admin_current_player\" width=40 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center>" + "</body></html>"); + replyMSG.append("</table>" + "<br><center><table>" + "Remove skill by ID :" + "<tr><td>Id: </td>" + "<td><edit var=\"id_to_remove\" width=110></td></tr>" + "</table></center>" + + "<center><button value=\"Remove skill\" action=\"bypass -h admin_remove_skill $id_to_remove\" width=110 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center>" + + "<br><center><button value=\"Back\" action=\"bypass -h admin_current_player\" width=40 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center>" + "</body></html>"); adminReply.setHtml(replyMSG.toString()); activeChar.sendPacket(adminReply); } @@ -337,11 +279,9 @@ public class AdminSkill implements IAdminCommandHandler /** * @param activeChar the active Game Master. */ - private void showMainPage(L2PcInstance activeChar) - { + private void showMainPage(L2PcInstance activeChar) { final L2Object target = activeChar.getTarget(); - if ((target == null) || !target.isPlayer()) - { + if ((target == null) || !target.isPlayer()) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return; } @@ -357,29 +297,22 @@ public class AdminSkill implements IAdminCommandHandler /** * @param activeChar the active Game Master. */ - private void adminGetSkills(L2PcInstance activeChar) - { + private void adminGetSkills(L2PcInstance activeChar) { final L2Object target = activeChar.getTarget(); - if ((target == null) || !target.isPlayer()) - { + if ((target == null) || !target.isPlayer()) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return; } final L2PcInstance player = target.getActingPlayer(); - if (player.getName().equals(activeChar.getName())) - { + if (player.getName().equals(activeChar.getName())) { player.sendPacket(SystemMessageId.CANNOT_USE_ON_YOURSELF); - } - else - { + } else { Skill[] skills = player.getAllSkills().toArray(new Skill[player.getAllSkills().size()]); adminSkills = activeChar.getAllSkills().toArray(new Skill[activeChar.getAllSkills().size()]); - for (Skill skill : adminSkills) - { + for (Skill skill : adminSkills) { activeChar.removeSkill(skill); } - for (Skill skill : skills) - { + for (Skill skill : skills) { activeChar.addSkill(skill, true); } activeChar.sendMessage("You now have all the skills of " + player.getName() + "."); @@ -391,36 +324,27 @@ public class AdminSkill implements IAdminCommandHandler /** * @param activeChar the active Game Master. */ - private void adminResetSkills(L2PcInstance activeChar) - { + private void adminResetSkills(L2PcInstance activeChar) { final L2Object target = activeChar.getTarget(); - if ((target == null) || !target.isPlayer()) - { + if ((target == null) || !target.isPlayer()) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return; } final L2PcInstance player = target.getActingPlayer(); - if (adminSkills == null) - { + if (adminSkills == null) { activeChar.sendMessage("You must get the skills of someone in order to do this."); - } - else - { + } else { Skill[] skills = player.getAllSkills().toArray(new Skill[player.getAllSkills().size()]); - for (Skill skill : skills) - { + for (Skill skill : skills) { player.removeSkill(skill); } - for (Skill skill : activeChar.getAllSkills()) - { + for (Skill skill : activeChar.getAllSkills()) { player.addSkill(skill, true); } - for (Skill skill : skills) - { + for (Skill skill : skills) { activeChar.removeSkill(skill); } - for (Skill skill : adminSkills) - { + for (Skill skill : adminSkills) { activeChar.addSkill(skill, true); } player.sendMessage("[GM]" + activeChar.getName() + " updated your skills."); @@ -436,38 +360,29 @@ public class AdminSkill implements IAdminCommandHandler * @param activeChar the active Game Master. * @param val */ - private void adminAddSkill(L2PcInstance activeChar, String val) - { + private void adminAddSkill(L2PcInstance activeChar, String val) { final L2Object target = activeChar.getTarget(); - if ((target == null) || !target.isPlayer()) - { + if ((target == null) || !target.isPlayer()) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); showMainPage(activeChar); return; } final L2PcInstance player = target.getActingPlayer(); final StringTokenizer st = new StringTokenizer(val); - if (st.countTokens() != 2) - { + if (st.countTokens() != 2) { showMainPage(activeChar); - } - else - { + } else { Skill skill = null; - try - { + try { String id = st.nextToken(); String level = st.nextToken(); int idval = Integer.parseInt(id); int levelval = Integer.parseInt(level); skill = SkillData.getInstance().getSkill(idval, levelval); - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, "", e); } - if (skill != null) - { + if (skill != null) { String name = skill.getName(); // Player's info. player.sendMessage("Admin gave you the skill " + name + "."); @@ -475,14 +390,11 @@ public class AdminSkill implements IAdminCommandHandler player.sendSkillList(); // Admin info. activeChar.sendMessage("You gave the skill " + name + " to " + player.getName() + "."); - if (general().debug()) - { + if (general().debug()) { _log.fine("[GM]" + activeChar.getName() + " gave skill " + name + " to " + player.getName() + "."); } activeChar.sendSkillList(); - } - else - { + } else { activeChar.sendMessage("Error: there is no such skill."); } showMainPage(activeChar); // Back to start @@ -493,31 +405,25 @@ public class AdminSkill implements IAdminCommandHandler * @param activeChar the active Game Master. * @param idval */ - private void adminRemoveSkill(L2PcInstance activeChar, int idval) - { + private void adminRemoveSkill(L2PcInstance activeChar, int idval) { final L2Object target = activeChar.getTarget(); - if ((target == null) || !target.isPlayer()) - { + if ((target == null) || !target.isPlayer()) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return; } final L2PcInstance player = target.getActingPlayer(); Skill skill = SkillData.getInstance().getSkill(idval, player.getSkillLevel(idval)); - if (skill != null) - { + if (skill != null) { String skillname = skill.getName(); player.sendMessage("Admin removed the skill " + skillname + " from your skills list."); player.removeSkill(skill); // Admin information activeChar.sendMessage("You removed the skill " + skillname + " from " + player.getName() + "."); - if (general().debug()) - { + if (general().debug()) { _log.fine("[GM]" + activeChar.getName() + " removed skill " + skillname + " from " + player.getName() + "."); } activeChar.sendSkillList(); - } - else - { + } else { activeChar.sendMessage("Error: there is no such skill."); } removeSkillsPage(activeChar, 0); // Back to previous page @@ -528,34 +434,29 @@ public class AdminSkill implements IAdminCommandHandler * @param id * @param level */ - private void adminAddClanSkill(L2PcInstance activeChar, int id, int level) - { + private void adminAddClanSkill(L2PcInstance activeChar, int id, int level) { final L2Object target = activeChar.getTarget(); - if ((target == null) || !target.isPlayer()) - { + if ((target == null) || !target.isPlayer()) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); showMainPage(activeChar); return; } final L2PcInstance player = target.getActingPlayer(); - if (!player.isClanLeader()) - { + if (!player.isClanLeader()) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_IS_NOT_A_CLAN_LEADER); sm.addString(player.getName()); activeChar.sendPacket(sm); showMainPage(activeChar); return; } - if ((id < 370) || (id > 391) || (level < 1) || (level > 3)) - { + if ((id < 370) || (id > 391) || (level < 1) || (level > 3)) { activeChar.sendMessage("Usage: //add_clan_skill <skill_id> <level>"); showMainPage(activeChar); return; } final Skill skill = SkillData.getInstance().getSkill(id, level); - if (skill == null) - { + if (skill == null) { activeChar.sendMessage("Error: there is no such skill."); return; } @@ -570,8 +471,7 @@ public class AdminSkill implements IAdminCommandHandler activeChar.sendMessage("You gave the Clan Skill: " + skillname + " to the clan " + clan.getName() + "."); clan.broadcastToOnlineMembers(new PledgeSkillList(clan)); - for (L2PcInstance member : clan.getOnlineMembers(0)) - { + for (L2PcInstance member : clan.getOnlineMembers(0)) { member.sendSkillList(); } @@ -579,8 +479,7 @@ public class AdminSkill implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminSpawn.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminSpawn.java index ce0861557a..f2032b744e 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminSpawn.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminSpawn.java @@ -54,12 +54,10 @@ import com.l2jserver.gameserver.util.StringUtil; * This class handles following admin commands: - show_spawns = shows menu - spawn_index lvl = shows menu for monsters with respective level - spawn_monster id = spawns monster id on target * @version $Revision: 1.2.2.5.2.5 $ $Date: 2005/04/11 10:06:06 $ */ -public class AdminSpawn implements IAdminCommandHandler -{ +public class AdminSpawn implements IAdminCommandHandler { private static final Logger _log = Logger.getLogger(AdminSpawn.class.getName()); - private static final String[] ADMIN_COMMANDS = - { + private static final String[] ADMIN_COMMANDS = { "admin_show_spawns", "admin_spawn", "admin_spawn_monster", @@ -81,116 +79,78 @@ public class AdminSpawn implements IAdminCommandHandler }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.equals("admin_show_spawns")) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.equals("admin_show_spawns")) { AdminHtml.showAdminHtml(activeChar, "spawns.htm"); - } - else if (command.equalsIgnoreCase("admin_spawn_debug_menu")) - { + } else if (command.equalsIgnoreCase("admin_spawn_debug_menu")) { AdminHtml.showAdminHtml(activeChar, "spawns_debug.htm"); - } - else if (command.startsWith("admin_spawn_debug_print")) - { + } else if (command.startsWith("admin_spawn_debug_print")) { StringTokenizer st = new StringTokenizer(command, " "); L2Object target = activeChar.getTarget(); - if (target instanceof L2Npc) - { - try - { + if (target instanceof L2Npc) { + try { st.nextToken(); int type = Integer.parseInt(st.nextToken()); printSpawn((L2Npc) target, type); - if (command.contains("_menu")) - { + if (command.contains("_menu")) { AdminHtml.showAdminHtml(activeChar, "spawns_debug.htm"); } + } catch (Exception e) { } - catch (Exception e) - { - } - } - else - { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); } - } - else if (command.startsWith("admin_spawn_index")) - { + } else if (command.startsWith("admin_spawn_index")) { StringTokenizer st = new StringTokenizer(command, " "); - try - { + try { st.nextToken(); int level = Integer.parseInt(st.nextToken()); int from = 0; - try - { + try { from = Integer.parseInt(st.nextToken()); - } - catch (NoSuchElementException nsee) - { + } catch (NoSuchElementException nsee) { } showMonsters(activeChar, level, from); - } - catch (Exception e) - { + } catch (Exception e) { AdminHtml.showAdminHtml(activeChar, "spawns.htm"); } - } - else if (command.equals("admin_show_npcs")) - { + } else if (command.equals("admin_show_npcs")) { AdminHtml.showAdminHtml(activeChar, "npcs.htm"); - } - else if (command.startsWith("admin_npc_index")) - { + } else if (command.startsWith("admin_npc_index")) { StringTokenizer st = new StringTokenizer(command, " "); - try - { + try { st.nextToken(); String letter = st.nextToken(); int from = 0; - try - { + try { from = Integer.parseInt(st.nextToken()); - } - catch (NoSuchElementException nsee) - { + } catch (NoSuchElementException nsee) { } showNpcs(activeChar, letter, from); - } - catch (Exception e) - { + } catch (Exception e) { AdminHtml.showAdminHtml(activeChar, "npcs.htm"); } - } - else if (command.startsWith("admin_instance_spawns")) - { + } else if (command.startsWith("admin_instance_spawns")) { StringTokenizer st = new StringTokenizer(command, " "); - try - { + try { st.nextToken(); int instance = Integer.parseInt(st.nextToken()); - if (instance >= 300000) - { - final StringBuilder html = StringUtil.startAppend(500 + 1000, "<html><table width=\"100%\"><tr><td width=45><button value=\"Main\" action=\"bypass -h admin_admin\" width=45 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td width=180><center>", "<font color=\"LEVEL\">Spawns for " + String.valueOf(instance) + "</font>", "</td><td width=45><button value=\"Back\" action=\"bypass -h admin_current_player\" width=45 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table><br>", "<table width=\"100%\"><tr><td width=200>NpcName</td><td width=70>Action</td></tr>"); + if (instance >= 300000) { + final StringBuilder html = StringUtil.startAppend(500 + + 1000, "<html><table width=\"100%\"><tr><td width=45><button value=\"Main\" action=\"bypass -h admin_admin\" width=45 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td width=180><center>", "<font color=\"LEVEL\">Spawns for " + + String.valueOf(instance) + + "</font>", "</td><td width=45><button value=\"Back\" action=\"bypass -h admin_current_player\" width=45 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table><br>", "<table width=\"100%\"><tr><td width=200>NpcName</td><td width=70>Action</td></tr>"); int counter = 0; int skiped = 0; Instance inst = InstanceManager.getInstance().getInstance(instance); - if (inst != null) - { - for (L2Npc npc : inst.getNpcs()) - { - if (!npc.isDead()) - { + if (inst != null) { + for (L2Npc npc : inst.getNpcs()) { + if (!npc.isDead()) { // Only 50 because of client html limitation - if (counter < 50) - { + if (counter < 50) { StringUtil.append(html, "<tr><td>" + npc.getName() + "</td><td>", "<a action=\"bypass -h admin_move_to " + npc.getX() + " " + npc.getY() + " " + npc.getZ() + "\">Go</a>", "</td></tr>"); counter++; - } - else - { + } else { skiped++; } } @@ -199,40 +159,26 @@ public class AdminSpawn implements IAdminCommandHandler final NpcHtmlMessage ms = new NpcHtmlMessage(); ms.setHtml(html.toString()); activeChar.sendPacket(ms); - } - else - { + } else { activeChar.sendMessage("Cannot find instance " + instance); } - } - else - { + } else { activeChar.sendMessage("Invalid instance number."); } - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage //instance_spawns <instance_number>"); } - } - else if (command.startsWith("admin_unspawnall")) - { + } else if (command.startsWith("admin_unspawnall")) { Broadcast.toAllOnlinePlayers(SystemMessage.getSystemMessage(SystemMessageId.NPC_SERVER_NOT_OPERATING)); RaidBossSpawnManager.getInstance().cleanUp(); DayNightSpawnManager.getInstance().cleanUp(); L2World.getInstance().deleteVisibleNpcSpawns(); AdminData.getInstance().broadcastMessageToGMs("NPC Unspawn completed!"); - } - else if (command.startsWith("admin_spawnday")) - { + } else if (command.startsWith("admin_spawnday")) { DayNightSpawnManager.getInstance().spawnDayCreatures(); - } - else if (command.startsWith("admin_spawnnight")) - { + } else if (command.startsWith("admin_spawnnight")) { DayNightSpawnManager.getInstance().spawnNightCreatures(); - } - else if (command.startsWith("admin_respawnall") || command.startsWith("admin_spawn_reload")) - { + } else if (command.startsWith("admin_respawnall") || command.startsWith("admin_spawn_reload")) { // make sure all spawns are deleted RaidBossSpawnManager.getInstance().cleanUp(); DayNightSpawnManager.getInstance().cleanUp(); @@ -245,71 +191,49 @@ public class AdminSpawn implements IAdminCommandHandler SevenSigns.getInstance().spawnSevenSignsNPC(); QuestManager.getInstance().reloadAllScripts(); AdminData.getInstance().broadcastMessageToGMs("NPC Respawn completed!"); - } - else if (command.startsWith("admin_spawn_monster") || command.startsWith("admin_spawn")) - { + } else if (command.startsWith("admin_spawn_monster") || command.startsWith("admin_spawn")) { StringTokenizer st = new StringTokenizer(command, " "); - try - { + try { String cmd = st.nextToken(); String id = st.nextToken(); int respawnTime = 0; int mobCount = 1; - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { mobCount = Integer.parseInt(st.nextToken()); } - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { respawnTime = Integer.parseInt(st.nextToken()); } - if (cmd.equalsIgnoreCase("admin_spawn_once")) - { + if (cmd.equalsIgnoreCase("admin_spawn_once")) { spawnMonster(activeChar, id, respawnTime, mobCount, false); - } - else - { + } else { spawnMonster(activeChar, id, respawnTime, mobCount, true); } - } - catch (Exception e) - { // Case of wrong or missing monster data + } catch (Exception e) { // Case of wrong or missing monster data AdminHtml.showAdminHtml(activeChar, "spawns.htm"); } - } - else if (command.startsWith("admin_list_spawns") || command.startsWith("admin_list_positions")) - { + } else if (command.startsWith("admin_list_spawns") || command.startsWith("admin_list_positions")) { int npcId = 0; int teleportIndex = -1; - try - { // admin_list_spawns x[xxxx] x[xx] + try { // admin_list_spawns x[xxxx] x[xx] String[] params = command.split(" "); Pattern pattern = Pattern.compile("[0-9]*"); Matcher regexp = pattern.matcher(params[1]); - if (regexp.matches()) - { + if (regexp.matches()) { npcId = Integer.parseInt(params[1]); - } - else - { + } else { params[1] = params[1].replace('_', ' '); npcId = NpcData.getInstance().getTemplateByName(params[1]).getId(); } - if (params.length > 2) - { + if (params.length > 2) { teleportIndex = Integer.parseInt(params[2]); } - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Command format is //list_spawns <npcId|npc_name> [tele_index]"); } - if (command.startsWith("admin_list_positions")) - { + if (command.startsWith("admin_list_positions")) { findNPCInstances(activeChar, npcId, teleportIndex, true); - } - else - { + } else { findNPCInstances(activeChar, npcId, teleportIndex, false); } } @@ -317,8 +241,7 @@ public class AdminSpawn implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } @@ -329,55 +252,40 @@ public class AdminSpawn implements IAdminCommandHandler * @param teleportIndex * @param showposition */ - private void findNPCInstances(L2PcInstance activeChar, int npcId, int teleportIndex, boolean showposition) - { + private void findNPCInstances(L2PcInstance activeChar, int npcId, int teleportIndex, boolean showposition) { int index = 0; - for (L2Spawn spawn : SpawnTable.getInstance().getSpawns(npcId)) - { + for (L2Spawn spawn : SpawnTable.getInstance().getSpawns(npcId)) { index++; L2Npc npc = spawn.getLastSpawn(); - if (teleportIndex > -1) - { - if (teleportIndex == index) - { - if (showposition && (npc != null)) - { + if (teleportIndex > -1) { + if (teleportIndex == index) { + if (showposition && (npc != null)) { activeChar.teleToLocation(npc.getLocation(), true); - } - else - { + } else { activeChar.teleToLocation(spawn.getLocation(), true); } } - } - else - { - if (showposition && (npc != null)) - { + } else { + if (showposition && (npc != null)) { activeChar.sendMessage(index + " - " + spawn.getTemplate().getName() + " (" + spawn + "): " + npc.getX() + " " + npc.getY() + " " + npc.getZ()); - } - else - { + } else { activeChar.sendMessage(index + " - " + spawn.getTemplate().getName() + " (" + spawn + "): " + spawn.getX() + " " + spawn.getY() + " " + spawn.getZ()); } } } - if (index == 0) - { + if (index == 0) { activeChar.sendMessage(getClass().getSimpleName() + ": No current spawns found."); } } - private void printSpawn(L2Npc target, int type) - { + private void printSpawn(L2Npc target, int type) { int i = target.getId(); int x = target.getSpawn().getX(); int y = target.getSpawn().getY(); int z = target.getSpawn().getZ(); int h = target.getSpawn().getHeading(); - switch (type) - { + switch (type) { default: case 0: _log.info("('',1," + i + "," + x + "," + y + "," + z + ",0,0," + h + ",60,0,0),"); @@ -391,31 +299,24 @@ public class AdminSpawn implements IAdminCommandHandler } } - private void spawnMonster(L2PcInstance activeChar, String monsterId, int respawnTime, int mobCount, boolean permanent) - { + private void spawnMonster(L2PcInstance activeChar, String monsterId, int respawnTime, int mobCount, boolean permanent) { L2Object target = activeChar.getTarget(); - if (target == null) - { + if (target == null) { target = activeChar; } L2NpcTemplate template; - if (monsterId.matches("[0-9]*")) - { + if (monsterId.matches("[0-9]*")) { // First parameter was an ID number template = NpcData.getInstance().getTemplate(Integer.parseInt(monsterId)); - } - else - { + } else { // First parameter wasn't just numbers so go by name not ID template = NpcData.getInstance().getTemplateByName(monsterId.replace('_', ' ')); } - try - { + try { final L2Spawn spawn = new L2Spawn(template); - if (general().saveGmSpawnOnCustom()) - { + if (general().saveGmSpawnOnCustom()) { spawn.setCustom(true); } spawn.setX(target.getX()); @@ -424,90 +325,68 @@ public class AdminSpawn implements IAdminCommandHandler spawn.setAmount(mobCount); spawn.setHeading(activeChar.getHeading()); spawn.setRespawnDelay(respawnTime); - if (activeChar.getInstanceId() > 0) - { + if (activeChar.getInstanceId() > 0) { spawn.setInstanceId(activeChar.getInstanceId()); permanent = false; - } - else - { + } else { spawn.setInstanceId(0); } // TODO add checks for GrandBossSpawnManager - if (RaidBossSpawnManager.getInstance().isDefined(spawn.getId())) - { + if (RaidBossSpawnManager.getInstance().isDefined(spawn.getId())) { activeChar.sendMessage("You cannot spawn another instance of " + template.getName() + "."); - } - else - { - if (template.isType("L2RaidBoss")) - { + } else { + if (template.isType("L2RaidBoss")) { spawn.setRespawnMinDelay(43200); spawn.setRespawnMaxDelay(129600); RaidBossSpawnManager.getInstance().addNewSpawn(spawn, 0, template.getBaseHpMax(), template.getBaseMpMax(), permanent); - } - else - { + } else { SpawnTable.getInstance().addNewSpawn(spawn, permanent); spawn.init(); } - if (!permanent) - { + if (!permanent) { spawn.stopRespawn(); } activeChar.sendMessage("Created " + template.getName() + " on " + target.getObjectId()); } - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendPacket(SystemMessageId.TARGET_CANT_FOUND); } } - private void showMonsters(L2PcInstance activeChar, int level, int from) - { + private void showMonsters(L2PcInstance activeChar, int level, int from) { final List<L2NpcTemplate> mobs = NpcData.getInstance().getAllMonstersOfLevel(level); final int mobsCount = mobs.size(); final StringBuilder tb = StringUtil.startAppend(500 + (mobsCount * 80), "<html><title>Spawn Monster:</title><body><p> Level : ", Integer.toString(level), "<br>Total Npc's : ", Integer.toString(mobsCount), "<br>"); // Loop int i = from; - for (int j = 0; (i < mobsCount) && (j < 50); i++, j++) - { + for (int j = 0; (i < mobsCount) && (j < 50); i++, j++) { StringUtil.append(tb, "<a action=\"bypass -h admin_spawn_monster ", Integer.toString(mobs.get(i).getId()), "\">", mobs.get(i).getName(), "</a><br1>"); } - if (i == mobsCount) - { + if (i == mobsCount) { tb.append("<br><center><button value=\"Back\" action=\"bypass -h admin_show_spawns\" width=40 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center></body></html>"); - } - else - { + } else { StringUtil.append(tb, "<br><center><button value=\"Next\" action=\"bypass -h admin_spawn_index ", Integer.toString(level), " ", Integer.toString(i), "\" width=40 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><button value=\"Back\" action=\"bypass -h admin_show_spawns\" width=40 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center></body></html>"); } activeChar.sendPacket(new NpcHtmlMessage(tb.toString())); } - private void showNpcs(L2PcInstance activeChar, String starting, int from) - { + private void showNpcs(L2PcInstance activeChar, String starting, int from) { final List<L2NpcTemplate> mobs = NpcData.getInstance().getAllNpcStartingWith(starting); final int mobsCount = mobs.size(); final StringBuilder tb = StringUtil.startAppend(500 + (mobsCount * 80), "<html><title>Spawn Monster:</title><body><p> There are ", Integer.toString(mobsCount), " Npcs whose name starts with ", starting, ":<br>"); // Loop int i = from; - for (int j = 0; (i < mobsCount) && (j < 50); i++, j++) - { + for (int j = 0; (i < mobsCount) && (j < 50); i++, j++) { StringUtil.append(tb, "<a action=\"bypass -h admin_spawn_monster ", Integer.toString(mobs.get(i).getId()), "\">", mobs.get(i).getName(), "</a><br1>"); } - if (i == mobsCount) - { + if (i == mobsCount) { tb.append("<br><center><button value=\"Back\" action=\"bypass -h admin_show_npcs\" width=40 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center></body></html>"); - } - else - { + } else { StringUtil.append(tb, "<br><center><button value=\"Next\" action=\"bypass -h admin_npc_index ", starting, " ", Integer.toString(i), "\" width=40 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><button value=\"Back\" action=\"bypass -h admin_show_npcs\" width=40 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center></body></html>"); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminSummon.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminSummon.java index 0619522eab..9cf9eb96c1 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminSummon.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminSummon.java @@ -28,60 +28,47 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; /** * @author poltomb */ -public class AdminSummon implements IAdminCommandHandler -{ +public class AdminSummon implements IAdminCommandHandler { private static final Logger _log = Logger.getLogger(AdminSummon.class.getName()); - public static final String[] ADMIN_COMMANDS = - { + public static final String[] ADMIN_COMMANDS = { "admin_summon" }; @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { int id; int count = 1; String[] data = command.split(" "); - try - { + try { id = Integer.parseInt(data[1]); - if (data.length > 2) - { + if (data.length > 2) { count = Integer.parseInt(data[2]); } - } - catch (NumberFormatException nfe) - { + } catch (NumberFormatException nfe) { activeChar.sendMessage("Incorrect format for command 'summon'"); return false; } String subCommand; - if (id < 1000000) - { + if (id < 1000000) { subCommand = "admin_create_item"; - if (!AdminData.getInstance().hasAccess(subCommand, activeChar.getAccessLevel())) - { + if (!AdminData.getInstance().hasAccess(subCommand, activeChar.getAccessLevel())) { activeChar.sendMessage("You don't have the access right to use this command!"); _log.warning("Character " + activeChar.getName() + " tryed to use admin command " + subCommand + ", but have no access to it!"); return false; } IAdminCommandHandler ach = AdminCommandHandler.getInstance().getHandler(subCommand); ach.useAdminCommand(subCommand + " " + id + " " + count, activeChar); - } - else - { + } else { subCommand = "admin_spawn_once"; - if (!AdminData.getInstance().hasAccess(subCommand, activeChar.getAccessLevel())) - { + if (!AdminData.getInstance().hasAccess(subCommand, activeChar.getAccessLevel())) { activeChar.sendMessage("You don't have the access right to use this command!"); _log.warning("Character " + activeChar.getName() + " tryed to use admin command " + subCommand + ", but have no access to it!"); return false; diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminTarget.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminTarget.java index 28608962c5..80ae3ccb07 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminTarget.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminTarget.java @@ -26,46 +26,34 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * This class handles following admin commands: - target name = sets player with respective name as target * @version $Revision: 1.2.4.3 $ $Date: 2005/04/11 10:05:56 $ */ -public class AdminTarget implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminTarget implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_target" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.startsWith("admin_target")) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.startsWith("admin_target")) { handleTarget(command, activeChar); } return true; } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } - private void handleTarget(String command, L2PcInstance activeChar) - { - try - { + private void handleTarget(String command, L2PcInstance activeChar) { + try { String targetName = command.substring(13); L2PcInstance player = L2World.getInstance().getPlayer(targetName); - if (player != null) - { + if (player != null) { player.onAction(activeChar); - } - else - { + } else { activeChar.sendMessage("Player " + targetName + " not found"); } - } - catch (IndexOutOfBoundsException e) - { + } catch (IndexOutOfBoundsException e) { activeChar.sendMessage("Please specify correct name."); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminTargetSay.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminTargetSay.java index 544d7e694c..9e58c5cf82 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminTargetSay.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminTargetSay.java @@ -31,23 +31,17 @@ import com.l2jserver.gameserver.network.serverpackets.CreatureSay; * This class handles following admin commands: - targetsay <message> = makes talk a L2Character * @author nonom */ -public class AdminTargetSay implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminTargetSay implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_targetsay" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.startsWith("admin_targetsay")) - { - try - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.startsWith("admin_targetsay")) { + try { final L2Object obj = activeChar.getTarget(); - if ((obj instanceof L2StaticObjectInstance) || !(obj instanceof L2Character)) - { + if ((obj instanceof L2StaticObjectInstance) || !(obj instanceof L2Character)) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return false; } @@ -55,9 +49,7 @@ public class AdminTargetSay implements IAdminCommandHandler final String message = command.substring(16); final L2Character target = (L2Character) obj; target.broadcastPacket(new CreatureSay(target.getObjectId(), (target.isPlayer() ? Say2.ALL : Say2.NPC_ALL), target.getName(), message)); - } - catch (StringIndexOutOfBoundsException e) - { + } catch (StringIndexOutOfBoundsException e) { activeChar.sendMessage("Usage: //targetsay <text>"); return false; } @@ -66,8 +58,7 @@ public class AdminTargetSay implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminTeleport.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminTeleport.java index 7a331144a1..2577aa9a4e 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminTeleport.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminTeleport.java @@ -49,12 +49,10 @@ import com.l2jserver.gameserver.util.StringUtil; * This class handles following admin commands: - show_moves - show_teleport - teleport_to_character - move_to - teleport_character * @version $Revision: 1.3.2.6.2.4 $ $Date: 2005/04/11 10:06:06 $ con.close() change and small typo fix by Zoey76 24/02/2011 */ -public class AdminTeleport implements IAdminCommandHandler -{ +public class AdminTeleport implements IAdminCommandHandler { private static final Logger _log = Logger.getLogger(AdminTeleport.class.getName()); - private static final String[] ADMIN_COMMANDS = - { + private static final String[] ADMIN_COMMANDS = { "admin_show_moves", "admin_show_moves_other", "admin_show_teleport", @@ -80,211 +78,136 @@ public class AdminTeleport implements IAdminCommandHandler }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.equals("admin_teleto")) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.equals("admin_teleto")) { activeChar.setTeleMode(1); } - if (command.equals("admin_instant_move")) - { + if (command.equals("admin_instant_move")) { activeChar.sendMessage("Instant move ready. Click where you want to go."); activeChar.setTeleMode(1); } - if (command.equals("admin_teleto r")) - { + if (command.equals("admin_teleto r")) { activeChar.setTeleMode(2); } - if (command.equals("admin_teleto end")) - { + if (command.equals("admin_teleto end")) { activeChar.setTeleMode(0); } - if (command.equals("admin_show_moves")) - { + if (command.equals("admin_show_moves")) { AdminHtml.showAdminHtml(activeChar, "teleports.htm"); } - if (command.equals("admin_show_moves_other")) - { + if (command.equals("admin_show_moves_other")) { AdminHtml.showAdminHtml(activeChar, "tele/other.html"); - } - else if (command.equals("admin_show_teleport")) - { + } else if (command.equals("admin_show_teleport")) { showTeleportCharWindow(activeChar); - } - else if (command.equals("admin_recall_npc")) - { + } else if (command.equals("admin_recall_npc")) { recallNPC(activeChar); - } - else if (command.equals("admin_teleport_to_character")) - { + } else if (command.equals("admin_teleport_to_character")) { teleportToCharacter(activeChar, activeChar.getTarget()); - } - else if (command.startsWith("admin_walk")) - { - try - { + } else if (command.startsWith("admin_walk")) { + try { String val = command.substring(11); StringTokenizer st = new StringTokenizer(val); int x = Integer.parseInt(st.nextToken()); int y = Integer.parseInt(st.nextToken()); int z = Integer.parseInt(st.nextToken()); activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(x, y, z, 0)); - } - catch (Exception e) - { - if (general().debug()) - { + } catch (Exception e) { + if (general().debug()) { _log.info("admin_walk: " + e); } } - } - else if (command.startsWith("admin_move_to")) - { - try - { + } else if (command.startsWith("admin_move_to")) { + try { String val = command.substring(14); teleportTo(activeChar, val); - } - catch (StringIndexOutOfBoundsException e) - { + } catch (StringIndexOutOfBoundsException e) { // Case of empty or missing coordinates AdminHtml.showAdminHtml(activeChar, "teleports.htm"); - } - catch (NumberFormatException nfe) - { + } catch (NumberFormatException nfe) { activeChar.sendMessage("Usage: //move_to <x> <y> <z>"); AdminHtml.showAdminHtml(activeChar, "teleports.htm"); } - } - else if (command.startsWith("admin_teleport_character")) - { - try - { + } else if (command.startsWith("admin_teleport_character")) { + try { String val = command.substring(25); teleportCharacter(activeChar, val); - } - catch (StringIndexOutOfBoundsException e) - { + } catch (StringIndexOutOfBoundsException e) { // Case of empty coordinates activeChar.sendMessage("Wrong or no Coordinates given."); showTeleportCharWindow(activeChar); // back to character teleport } - } - else if (command.startsWith("admin_teleportto ")) - { - try - { + } else if (command.startsWith("admin_teleportto ")) { + try { String targetName = command.substring(17); L2PcInstance player = L2World.getInstance().getPlayer(targetName); teleportToCharacter(activeChar, player); + } catch (StringIndexOutOfBoundsException e) { } - catch (StringIndexOutOfBoundsException e) - { - } - } - else if (command.startsWith("admin_recall ")) - { - try - { + } else if (command.startsWith("admin_recall ")) { + try { String[] param = command.split(" "); - if (param.length != 2) - { + if (param.length != 2) { activeChar.sendMessage("Usage: //recall <playername>"); return false; } String targetName = param[1]; L2PcInstance player = L2World.getInstance().getPlayer(targetName); - if (player != null) - { + if (player != null) { teleportCharacter(player, activeChar.getLocation(), activeChar); - } - else - { + } else { changeCharacterPosition(activeChar, targetName); } + } catch (StringIndexOutOfBoundsException e) { } - catch (StringIndexOutOfBoundsException e) - { - } - } - else if (command.equals("admin_tele")) - { + } else if (command.equals("admin_tele")) { showTeleportWindow(activeChar); - } - else if (command.startsWith("admin_go")) - { + } else if (command.startsWith("admin_go")) { int intVal = 150; int x = activeChar.getX(), y = activeChar.getY(), z = activeChar.getZ(); - try - { + try { String val = command.substring(8); StringTokenizer st = new StringTokenizer(val); String dir = st.nextToken(); - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { intVal = Integer.parseInt(st.nextToken()); } - if (dir.equals("east")) - { + if (dir.equals("east")) { x += intVal; - } - else if (dir.equals("west")) - { + } else if (dir.equals("west")) { x -= intVal; - } - else if (dir.equals("north")) - { + } else if (dir.equals("north")) { y -= intVal; - } - else if (dir.equals("south")) - { + } else if (dir.equals("south")) { y += intVal; - } - else if (dir.equals("up")) - { + } else if (dir.equals("up")) { z += intVal; - } - else if (dir.equals("down")) - { + } else if (dir.equals("down")) { z -= intVal; } activeChar.teleToLocation(new Location(x, y, z)); showTeleportWindow(activeChar); - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Usage: //go<north|south|east|west|up|down> [offset] (default 150)"); } - } - else if (command.startsWith("admin_sendhome")) - { + } else if (command.startsWith("admin_sendhome")) { StringTokenizer st = new StringTokenizer(command, " "); st.nextToken(); // Skip command. - if (st.countTokens() > 1) - { + if (st.countTokens() > 1) { activeChar.sendMessage("Usage: //sendhome <playername>"); - } - else if (st.countTokens() == 1) - { + } else if (st.countTokens() == 1) { final String name = st.nextToken(); final L2PcInstance player = L2World.getInstance().getPlayer(name); - if (player == null) - { + if (player == null) { activeChar.sendPacket(SystemMessageId.TARGET_IS_NOT_FOUND_IN_THE_GAME); return false; } teleportHome(player); - } - else - { + } else { final L2Object target = activeChar.getTarget(); - if (target instanceof L2PcInstance) - { + if (target instanceof L2PcInstance) { teleportHome(target.getActingPlayer()); - } - else - { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); } } @@ -293,8 +216,7 @@ public class AdminTeleport implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } @@ -302,11 +224,9 @@ public class AdminTeleport implements IAdminCommandHandler * This method sends a player to it's home town. * @param player the player to teleport. */ - private void teleportHome(L2PcInstance player) - { + private void teleportHome(L2PcInstance player) { String regionName; - switch (player.getRace()) - { + switch (player.getRace()) { case ELF: regionName = "elf_town"; break; @@ -332,10 +252,8 @@ public class AdminTeleport implements IAdminCommandHandler player.setIsIn7sDungeon(false); } - private void teleportTo(L2PcInstance activeChar, String Coords) - { - try - { + private void teleportTo(L2PcInstance activeChar, String Coords) { + try { StringTokenizer st = new StringTokenizer(Coords); String x1 = st.nextToken(); int x = Integer.parseInt(x1); @@ -348,60 +266,48 @@ public class AdminTeleport implements IAdminCommandHandler activeChar.teleToLocation(x, y, z); activeChar.sendMessage("You have been teleported to " + Coords); - } - catch (NoSuchElementException nsee) - { + } catch (NoSuchElementException nsee) { activeChar.sendMessage("Wrong or no Coordinates given."); } } - private void showTeleportWindow(L2PcInstance activeChar) - { + private void showTeleportWindow(L2PcInstance activeChar) { AdminHtml.showAdminHtml(activeChar, "move.htm"); } - private void showTeleportCharWindow(L2PcInstance activeChar) - { + private void showTeleportCharWindow(L2PcInstance activeChar) { L2Object target = activeChar.getTarget(); L2PcInstance player = null; - if (target instanceof L2PcInstance) - { + if (target instanceof L2PcInstance) { player = (L2PcInstance) target; - } - else - { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return; } final NpcHtmlMessage adminReply = new NpcHtmlMessage(); - final String replyMSG = StringUtil.concat("<html><title>Teleport Character</title>" + "<body>" + "The character you will teleport is ", player.getName(), "." + "<br>" + "Co-ordinate x" + "<edit var=\"char_cord_x\" width=110>" + "Co-ordinate y" + "<edit var=\"char_cord_y\" width=110>" + "Co-ordinate z" + "<edit var=\"char_cord_z\" width=110>" + "<button value=\"Teleport\" action=\"bypass -h admin_teleport_character $char_cord_x $char_cord_y $char_cord_z\" width=60 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<button value=\"Teleport near you\" action=\"bypass -h admin_teleport_character ", String.valueOf(activeChar.getX()), " ", String.valueOf(activeChar.getY()), " ", String.valueOf(activeChar.getZ()), "\" width=115 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<center><button value=\"Back\" action=\"bypass -h admin_current_player\" width=40 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center>" + "</body></html>"); + final String replyMSG = StringUtil.concat("<html><title>Teleport Character</title>" + "<body>" + "The character you will teleport is ", player.getName(), "." + "<br>" + "Co-ordinate x" + "<edit var=\"char_cord_x\" width=110>" + "Co-ordinate y" + "<edit var=\"char_cord_y\" width=110>" + + "Co-ordinate z" + "<edit var=\"char_cord_z\" width=110>" + "<button value=\"Teleport\" action=\"bypass -h admin_teleport_character $char_cord_x $char_cord_y $char_cord_z\" width=60 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + + "<button value=\"Teleport near you\" action=\"bypass -h admin_teleport_character ", String.valueOf(activeChar.getX()), " ", String.valueOf(activeChar.getY()), " ", String.valueOf(activeChar.getZ()), "\" width=115 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + + "<center><button value=\"Back\" action=\"bypass -h admin_current_player\" width=40 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center>" + "</body></html>"); adminReply.setHtml(replyMSG); activeChar.sendPacket(adminReply); } - private void teleportCharacter(L2PcInstance activeChar, String Cords) - { + private void teleportCharacter(L2PcInstance activeChar, String Cords) { L2Object target = activeChar.getTarget(); L2PcInstance player = null; - if (target instanceof L2PcInstance) - { + if (target instanceof L2PcInstance) { player = (L2PcInstance) target; - } - else - { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return; } - if (player.getObjectId() == activeChar.getObjectId()) - { + if (player.getObjectId() == activeChar.getObjectId()) { player.sendPacket(SystemMessageId.CANNOT_USE_ON_YOURSELF); - } - else - { - try - { + } else { + try { StringTokenizer st = new StringTokenizer(Cords); String x1 = st.nextToken(); int x = Integer.parseInt(x1); @@ -410,9 +316,7 @@ public class AdminTeleport implements IAdminCommandHandler String z1 = st.nextToken(); int z = Integer.parseInt(z1); teleportCharacter(player, new Location(x, y, z), null); - } - catch (NoSuchElementException nsee) - { + } catch (NoSuchElementException nsee) { } } } @@ -422,25 +326,17 @@ public class AdminTeleport implements IAdminCommandHandler * @param loc * @param activeChar */ - private void teleportCharacter(L2PcInstance player, Location loc, L2PcInstance activeChar) - { - if (player != null) - { + private void teleportCharacter(L2PcInstance player, Location loc, L2PcInstance activeChar) { + if (player != null) { // Check for jail - if (player.isJailed()) - { + if (player.isJailed()) { activeChar.sendMessage("Sorry, player " + player.getName() + " is in Jail."); - } - else - { + } else { // Set player to same instance as GM teleporting. - if ((activeChar != null) && (activeChar.getInstanceId() >= 0)) - { + if ((activeChar != null) && (activeChar.getInstanceId() >= 0)) { player.setInstanceId(activeChar.getInstanceId()); activeChar.sendMessage("You have recalled " + player.getName()); - } - else - { + } else { player.setInstanceId(0); } player.sendMessage("Admin is teleporting you."); @@ -450,31 +346,23 @@ public class AdminTeleport implements IAdminCommandHandler } } - private void teleportToCharacter(L2PcInstance activeChar, L2Object target) - { - if (target == null) - { + private void teleportToCharacter(L2PcInstance activeChar, L2Object target) { + if (target == null) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return; } L2PcInstance player = null; - if (target instanceof L2PcInstance) - { + if (target instanceof L2PcInstance) { player = (L2PcInstance) target; - } - else - { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return; } - if (player.getObjectId() == activeChar.getObjectId()) - { + if (player.getObjectId() == activeChar.getObjectId()) { player.sendPacket(SystemMessageId.CANNOT_USE_ON_YOURSELF); - } - else - { + } else { // move to targets instance activeChar.setInstanceId(target.getInstanceId()); @@ -489,14 +377,12 @@ public class AdminTeleport implements IAdminCommandHandler } } - private void changeCharacterPosition(L2PcInstance activeChar, String name) - { + private void changeCharacterPosition(L2PcInstance activeChar, String name) { final int x = activeChar.getX(); final int y = activeChar.getY(); final int z = activeChar.getZ(); try (Connection con = ConnectionFactory.getInstance().getConnection(); - PreparedStatement ps = con.prepareStatement("UPDATE characters SET x=?, y=?, z=? WHERE char_name=?")) - { + PreparedStatement ps = con.prepareStatement("UPDATE characters SET x=?, y=?, z=? WHERE char_name=?")) { ps.setInt(1, x); ps.setInt(2, y); ps.setInt(3, z); @@ -504,30 +390,22 @@ public class AdminTeleport implements IAdminCommandHandler ps.execute(); int count = ps.getUpdateCount(); - if (count == 0) - { + if (count == 0) { activeChar.sendMessage("Character not found or position unaltered."); - } - else - { + } else { activeChar.sendMessage("Player's [" + name + "] position is now set to (" + x + "," + y + "," + z + ")."); } - } - catch (SQLException se) - { + } catch (SQLException se) { activeChar.sendMessage("SQLException while changing offline character's position"); } } - private void recallNPC(L2PcInstance activeChar) - { + private void recallNPC(L2PcInstance activeChar) { L2Object obj = activeChar.getTarget(); - if ((obj instanceof L2Npc) && !((L2Npc) obj).isMinion() && !(obj instanceof L2RaidBossInstance) && !(obj instanceof L2GrandBossInstance)) - { + if ((obj instanceof L2Npc) && !((L2Npc) obj).isMinion() && !(obj instanceof L2RaidBossInstance) && !(obj instanceof L2GrandBossInstance)) { L2Npc target = (L2Npc) obj; L2Spawn spawn = target.getSpawn(); - if (spawn == null) - { + if (spawn == null) { activeChar.sendMessage("Incorrect monster spawn."); _log.warning("ERROR: NPC " + target.getObjectId() + " has a 'null' spawn."); return; @@ -538,11 +416,9 @@ public class AdminTeleport implements IAdminCommandHandler spawn.stopRespawn(); SpawnTable.getInstance().deleteSpawn(spawn, true); - try - { + try { spawn = new L2Spawn(target.getTemplate().getId()); - if (general().saveGmSpawnOnCustom()) - { + if (general().saveGmSpawnOnCustom()) { spawn.setCustom(true); } spawn.setX(activeChar.getX()); @@ -551,12 +427,9 @@ public class AdminTeleport implements IAdminCommandHandler spawn.setAmount(1); spawn.setHeading(activeChar.getHeading()); spawn.setRespawnDelay(respawnTime); - if (activeChar.getInstanceId() >= 0) - { + if (activeChar.getInstanceId() >= 0) { spawn.setInstanceId(activeChar.getInstanceId()); - } - else - { + } else { spawn.setInstanceId(0); } SpawnTable.getInstance().addNewSpawn(spawn, true); @@ -564,36 +437,28 @@ public class AdminTeleport implements IAdminCommandHandler activeChar.sendMessage("Created " + target.getTemplate().getName() + " on " + target.getObjectId() + "."); - if (general().debug()) - { + if (general().debug()) { _log.fine("Spawn at X=" + spawn.getX() + " Y=" + spawn.getY() + " Z=" + spawn.getZ()); _log.warning("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") moved NPC " + target.getObjectId()); } - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Target is not in game."); } - } - else if (obj instanceof L2RaidBossInstance) - { + } else if (obj instanceof L2RaidBossInstance) { L2RaidBossInstance target = (L2RaidBossInstance) obj; L2Spawn spawn = target.getSpawn(); double curHP = target.getCurrentHp(); double curMP = target.getCurrentMp(); - if (spawn == null) - { + if (spawn == null) { activeChar.sendMessage("Incorrect raid spawn."); _log.warning("ERROR: NPC Id" + target.getId() + " has a 'null' spawn."); return; } RaidBossSpawnManager.getInstance().deleteSpawn(spawn, true); - try - { + try { final L2Spawn spawnDat = new L2Spawn(target.getId()); - if (general().saveGmSpawnOnCustom()) - { + if (general().saveGmSpawnOnCustom()) { spawn.setCustom(true); } spawnDat.setX(activeChar.getX()); @@ -605,14 +470,10 @@ public class AdminTeleport implements IAdminCommandHandler spawnDat.setRespawnMaxDelay(129600); RaidBossSpawnManager.getInstance().addNewSpawn(spawnDat, 0, curHP, curMP, true); - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendPacket(SystemMessageId.TARGET_CANT_FOUND); } - } - else - { + } else { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminTerritoryWar.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminTerritoryWar.java index aecbefed11..7d070d0069 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminTerritoryWar.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminTerritoryWar.java @@ -36,10 +36,8 @@ import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; * Admin comand handler for Territory War System This class handles following admin commands: * @author Gigiikun */ -public class AdminTerritoryWar implements IAdminCommandHandler -{ - private static final String[] _adminCommands = - { +public class AdminTerritoryWar implements IAdminCommandHandler { + private static final String[] _adminCommands = { "admin_territory_war", "admin_territory_war_time", "admin_territory_war_start", @@ -48,118 +46,87 @@ public class AdminTerritoryWar implements IAdminCommandHandler }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { StringTokenizer st = new StringTokenizer(command); command = st.nextToken(); - if (command.equals("admin_territory_war")) - { + if (command.equals("admin_territory_war")) { showMainPage(activeChar); - } - else if (command.equalsIgnoreCase("admin_territory_war_time")) - { - if (st.hasMoreTokens()) - { + } else if (command.equalsIgnoreCase("admin_territory_war_time")) { + if (st.hasMoreTokens()) { final Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(TerritoryWarManager.getInstance().getTWStartTimeInMillis()); final String val = st.nextToken(); - if ("month".equals(val)) - { + if ("month".equals(val)) { int month = cal.get(Calendar.MONTH) + Integer.parseInt(st.nextToken()); - if ((cal.getActualMinimum(Calendar.MONTH) > month) || (cal.getActualMaximum(Calendar.MONTH) < month)) - { + if ((cal.getActualMinimum(Calendar.MONTH) > month) || (cal.getActualMaximum(Calendar.MONTH) < month)) { activeChar.sendMessage("Unable to change Siege Date - Incorrect month value only " + cal.getActualMinimum(Calendar.MONTH) + "-" + cal.getActualMaximum(Calendar.MONTH) + " is accepted!"); return false; } cal.set(Calendar.MONTH, month); - } - else if ("day".equals(val)) - { + } else if ("day".equals(val)) { int day = Integer.parseInt(st.nextToken()); - if ((cal.getActualMinimum(Calendar.DAY_OF_MONTH) > day) || (cal.getActualMaximum(Calendar.DAY_OF_MONTH) < day)) - { + if ((cal.getActualMinimum(Calendar.DAY_OF_MONTH) > day) || (cal.getActualMaximum(Calendar.DAY_OF_MONTH) < day)) { activeChar.sendMessage("Unable to change Siege Date - Incorrect day value only " + cal.getActualMinimum(Calendar.DAY_OF_MONTH) + "-" + cal.getActualMaximum(Calendar.DAY_OF_MONTH) + " is accepted!"); return false; } cal.set(Calendar.DAY_OF_MONTH, day); - } - else if ("hour".equals(val)) - { + } else if ("hour".equals(val)) { int hour = Integer.parseInt(st.nextToken()); - if ((cal.getActualMinimum(Calendar.HOUR_OF_DAY) > hour) || (cal.getActualMaximum(Calendar.HOUR_OF_DAY) < hour)) - { + if ((cal.getActualMinimum(Calendar.HOUR_OF_DAY) > hour) || (cal.getActualMaximum(Calendar.HOUR_OF_DAY) < hour)) { activeChar.sendMessage("Unable to change Siege Date - Incorrect hour value only " + cal.getActualMinimum(Calendar.HOUR_OF_DAY) + "-" + cal.getActualMaximum(Calendar.HOUR_OF_DAY) + " is accepted!"); return false; } cal.set(Calendar.HOUR_OF_DAY, hour); - } - else if ("min".equals(val)) - { + } else if ("min".equals(val)) { int min = Integer.parseInt(st.nextToken()); - if ((cal.getActualMinimum(Calendar.MINUTE) > min) || (cal.getActualMaximum(Calendar.MINUTE) < min)) - { + if ((cal.getActualMinimum(Calendar.MINUTE) > min) || (cal.getActualMaximum(Calendar.MINUTE) < min)) { activeChar.sendMessage("Unable to change Siege Date - Incorrect minute value only " + cal.getActualMinimum(Calendar.MINUTE) + "-" + cal.getActualMaximum(Calendar.MINUTE) + " is accepted!"); return false; } cal.set(Calendar.MINUTE, min); } - if (cal.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) - { + if (cal.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) { activeChar.sendMessage("Unable to change TW Date!"); - } - else if (cal.getTimeInMillis() != TerritoryWarManager.getInstance().getTWStartTimeInMillis()) - { + } else if (cal.getTimeInMillis() != TerritoryWarManager.getInstance().getTWStartTimeInMillis()) { TerritoryWarManager.getInstance().setTWStartTimeInMillis(cal.getTimeInMillis()); GlobalVariablesManager.getInstance().set(TerritoryWarManager.GLOBAL_VARIABLE, cal.getTimeInMillis()); } } showSiegeTimePage(activeChar); - } - else if (command.equalsIgnoreCase("admin_territory_war_start")) - { + } else if (command.equalsIgnoreCase("admin_territory_war_start")) { TerritoryWarManager.getInstance().setTWStartTimeInMillis(System.currentTimeMillis()); - } - else if (command.equalsIgnoreCase("admin_territory_war_end")) - { + } else if (command.equalsIgnoreCase("admin_territory_war_end")) { TerritoryWarManager.getInstance().setTWStartTimeInMillis(System.currentTimeMillis() - MINUTES.toMillis(territoryWar().getWarLength())); - } - else if (command.equalsIgnoreCase("admin_territory_wards_list")) - { + } else if (command.equalsIgnoreCase("admin_territory_wards_list")) { // build beginning of html page final NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0, 1); StringBuilder sb = new StringBuilder(); sb.append("<html><title>Territory War</title><body><br><center><font color=\"LEVEL\">Active Wards List:</font></center>"); // get,build & send current Wards list - if (TerritoryWarManager.getInstance().isTWInProgress()) - { + if (TerritoryWarManager.getInstance().isTWInProgress()) { List<TerritoryWard> territoryWardList = TerritoryWarManager.getInstance().getAllTerritoryWards(); - for (TerritoryWard ward : territoryWardList) - { - if (ward.getNpc() != null) - { + for (TerritoryWard ward : territoryWardList) { + if (ward.getNpc() != null) { sb.append("<table width=270><tr>"); sb.append("<td width=135 ALIGN=\"LEFT\">" + ward.getNpc().getName() + "</td>"); sb.append("<td width=135 ALIGN=\"RIGHT\"><button value=\"TeleTo\" action=\"bypass -h admin_move_to " + ward.getNpc().getX() + " " + ward.getNpc().getY() + " " + ward.getNpc().getZ() + "\" width=50 height=20 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></td>"); sb.append("</tr></table>"); - } - else if (ward.getPlayer() != null) - { + } else if (ward.getPlayer() != null) { sb.append("<table width=270><tr>"); sb.append("<td width=135 ALIGN=\"LEFT\">" + ward.getPlayer().getActiveWeaponInstance().getItemName() + " - " + ward.getPlayer().getName() + "</td>"); - sb.append("<td width=135 ALIGN=\"RIGHT\"><button value=\"TeleTo\" action=\"bypass -h admin_move_to " + ward.getPlayer().getX() + " " + ward.getPlayer().getY() + " " + ward.getPlayer().getZ() + "\" width=50 height=20 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></td>"); + sb.append("<td width=135 ALIGN=\"RIGHT\"><button value=\"TeleTo\" action=\"bypass -h admin_move_to " + ward.getPlayer().getX() + " " + ward.getPlayer().getY() + " " + ward.getPlayer().getZ() + + "\" width=50 height=20 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></td>"); sb.append("</tr></table>"); } } sb.append("<br><center><button value=\"Back\" action=\"bypass -h admin_territory_war\" width=50 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center></body></html>"); npcHtmlMessage.setHtml(sb.toString()); activeChar.sendPacket(npcHtmlMessage); - } - else - { + } else { sb.append("<br><br><center>The Ward List is empty!<br>TW has probably NOT started!"); sb.append("<br><button value=\"Back\" action=\"bypass -h admin_territory_war\" width=50 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center></body></html>"); npcHtmlMessage.setHtml(sb.toString()); @@ -170,21 +137,18 @@ public class AdminTerritoryWar implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return _adminCommands; } - private void showSiegeTimePage(L2PcInstance activeChar) - { + private void showSiegeTimePage(L2PcInstance activeChar) { final NpcHtmlMessage adminReply = new NpcHtmlMessage(); adminReply.setFile(activeChar.getHtmlPrefix(), "data/html/admin/territorywartime.htm"); adminReply.replace("%time%", TerritoryWarManager.getInstance().getTWStart().getTime().toString()); activeChar.sendPacket(adminReply); } - private void showMainPage(L2PcInstance activeChar) - { + private void showMainPage(L2PcInstance activeChar) { AdminHtml.showAdminHtml(activeChar, "territorywar.htm"); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminTest.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminTest.java index fa89f5190d..98d040584e 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminTest.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminTest.java @@ -35,92 +35,64 @@ import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse; /** * @version $Revision: 1.2 $ $Date: 2004/06/27 08:12:59 $ */ -public class AdminTest implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminTest implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_stats", "admin_skill_test", "admin_known" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.equals("admin_stats")) - { - for (String line : ThreadPoolManager.getInstance().getStats()) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.equals("admin_stats")) { + for (String line : ThreadPoolManager.getInstance().getStats()) { activeChar.sendMessage(line); } - } - else if (command.startsWith("admin_skill_test")) - { - try - { + } else if (command.startsWith("admin_skill_test")) { + try { StringTokenizer st = new StringTokenizer(command); st.nextToken(); int id = Integer.parseInt(st.nextToken()); - if (command.startsWith("admin_skill_test")) - { + if (command.startsWith("admin_skill_test")) { adminTestSkill(activeChar, id, true); - } - else - { + } else { adminTestSkill(activeChar, id, false); } - } - catch (NumberFormatException e) - { + } catch (NumberFormatException e) { activeChar.sendMessage("Command format is //skill_test <ID>"); - } - catch (NoSuchElementException nsee) - { + } catch (NoSuchElementException nsee) { activeChar.sendMessage("Command format is //skill_test <ID>"); } - } - else if (command.equals("admin_known on")) - { + } else if (command.equals("admin_known on")) { general().setProperty("CheckKnownList", "true"); - } - else if (command.equals("admin_known off")) - { + } else if (command.equals("admin_known off")) { general().setProperty("CheckKnownList", "false"); } return true; } - private void adminTestSkill(L2PcInstance activeChar, int id, boolean msu) - { + private void adminTestSkill(L2PcInstance activeChar, int id, boolean msu) { L2Character caster; L2Object target = activeChar.getTarget(); - if (!(target instanceof L2Character)) - { + if (!(target instanceof L2Character)) { caster = activeChar; - } - else - { + } else { caster = (L2Character) target; } Skill _skill = SkillData.getInstance().getSkill(id, 1); - if (_skill != null) - { + if (_skill != null) { caster.setTarget(activeChar); - if (msu) - { + if (msu) { caster.broadcastPacket(new MagicSkillUse(caster, activeChar, id, 1, _skill.getHitTime(), _skill.getReuseDelay())); - } - else - { + } else { caster.doCast(_skill); } } } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminTvTEvent.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminTvTEvent.java index 90a5891a35..efd7b70245 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminTvTEvent.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminTvTEvent.java @@ -30,44 +30,34 @@ import com.l2jserver.gameserver.model.entity.TvTManager; /** * @author HorridoJoho */ -public class AdminTvTEvent implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminTvTEvent implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_tvt_add", "admin_tvt_remove", "admin_tvt_advance" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (command.equals("admin_tvt_add")) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (command.equals("admin_tvt_add")) { L2Object target = activeChar.getTarget(); - if (!(target instanceof L2PcInstance)) - { + if (!(target instanceof L2PcInstance)) { activeChar.sendMessage("You should select a player!"); return true; } add(activeChar, (L2PcInstance) target); - } - else if (command.equals("admin_tvt_remove")) - { + } else if (command.equals("admin_tvt_remove")) { L2Object target = activeChar.getTarget(); - if (!(target instanceof L2PcInstance)) - { + if (!(target instanceof L2PcInstance)) { activeChar.sendMessage("You should select a player!"); return true; } remove(activeChar, (L2PcInstance) target); - } - else if (command.equals("admin_tvt_advance")) - { + } else if (command.equals("admin_tvt_advance")) { TvTManager.getInstance().skipDelay(); } @@ -75,35 +65,28 @@ public class AdminTvTEvent implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } - private void add(L2PcInstance activeChar, L2PcInstance playerInstance) - { - if (playerInstance.isOnEvent()) - { + private void add(L2PcInstance activeChar, L2PcInstance playerInstance) { + if (playerInstance.isOnEvent()) { activeChar.sendMessage("Player already participated in the event!"); return; } - if (!TvTEvent.addParticipant(playerInstance)) - { + if (!TvTEvent.addParticipant(playerInstance)) { activeChar.sendMessage("Player instance could not be added, it seems to be null!"); return; } - if (TvTEvent.isStarted()) - { + if (TvTEvent.isStarted()) { new TvTEventTeleporter(playerInstance, TvTEvent.getParticipantTeamCoordinates(playerInstance.getObjectId()), true, false); } } - private void remove(L2PcInstance activeChar, L2PcInstance playerInstance) - { - if (!TvTEvent.removeParticipant(playerInstance.getObjectId())) - { + private void remove(L2PcInstance activeChar, L2PcInstance playerInstance) { + if (!TvTEvent.removeParticipant(playerInstance.getObjectId())) { activeChar.sendMessage("Player is not part of the event!"); return; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminUnblockIp.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminUnblockIp.java index 4361a01204..99133a60a4 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminUnblockIp.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminUnblockIp.java @@ -30,31 +30,23 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * </ul> * @version $Revision: 1.3.2.6.2.4 $ $Date: 2005/04/11 10:06:06 $ */ -public class AdminUnblockIp implements IAdminCommandHandler -{ +public class AdminUnblockIp implements IAdminCommandHandler { private static final Logger _log = Logger.getLogger(AdminUnblockIp.class.getName()); - private static final String[] ADMIN_COMMANDS = - { + private static final String[] ADMIN_COMMANDS = { "admin_unblockip" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { - if (command.startsWith("admin_unblockip ")) - { - try - { + if (command.startsWith("admin_unblockip ")) { + try { String ipAddress = command.substring(16); - if (unblockIp(ipAddress, activeChar)) - { + if (unblockIp(ipAddress, activeChar)) { activeChar.sendMessage("Removed IP " + ipAddress + " from blocklist!"); } - } - catch (StringIndexOutOfBoundsException e) - { + } catch (StringIndexOutOfBoundsException e) { activeChar.sendMessage("Usage: //unblockip <ip>"); } } @@ -63,13 +55,11 @@ public class AdminUnblockIp implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } - private boolean unblockIp(String ipAddress, L2PcInstance activeChar) - { + private boolean unblockIp(String ipAddress, L2PcInstance activeChar) { // LoginServerThread.getInstance().unBlockip(ipAddress); _log.warning("IP removed by GM " + activeChar.getName()); return true; diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminVitality.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminVitality.java index 0c317bc4fa..d4c264bf39 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminVitality.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminVitality.java @@ -29,11 +29,9 @@ import com.l2jserver.gameserver.model.actor.stat.PcStat; /** * @author Psychokiller1888 */ -public class AdminVitality implements IAdminCommandHandler -{ +public class AdminVitality implements IAdminCommandHandler { - private static final String[] ADMIN_COMMANDS = - { + private static final String[] ADMIN_COMMANDS = { "admin_set_vitality", "admin_set_vitality_level", "admin_full_vitality", @@ -42,15 +40,12 @@ public class AdminVitality implements IAdminCommandHandler }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (activeChar == null) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (activeChar == null) { return false; } - if (!vitality().enabled()) - { + if (!vitality().enabled()) { activeChar.sendMessage("Vitality is not enabled on the server!"); return false; } @@ -61,66 +56,44 @@ public class AdminVitality implements IAdminCommandHandler StringTokenizer st = new StringTokenizer(command, " "); String cmd = st.nextToken(); - if (activeChar.getTarget() instanceof L2PcInstance) - { + if (activeChar.getTarget() instanceof L2PcInstance) { L2PcInstance target; target = (L2PcInstance) activeChar.getTarget(); - if (cmd.equals("admin_set_vitality")) - { - try - { + if (cmd.equals("admin_set_vitality")) { + try { vitality = Integer.parseInt(st.nextToken()); - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Incorrect vitality"); } target.setVitalityPoints(vitality, true); target.sendMessage("Admin set your Vitality points to " + vitality); - } - else if (cmd.equals("admin_set_vitality_level")) - { - try - { + } else if (cmd.equals("admin_set_vitality_level")) { + try { level = Integer.parseInt(st.nextToken()); - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("Incorrect vitality level (0-4)"); } - if ((level >= 0) && (level <= 4)) - { - if (level == 0) - { + if ((level >= 0) && (level <= 4)) { + if (level == 0) { vitality = PcStat.MIN_VITALITY_POINTS; - } - else - { + } else { vitality = PcStat.VITALITY_LEVELS[level - 1]; } target.setVitalityPoints(vitality, true); target.sendMessage("Admin set your Vitality level to " + level); - } - else - { + } else { activeChar.sendMessage("Incorrect vitality level (0-4)"); } - } - else if (cmd.equals("admin_full_vitality")) - { + } else if (cmd.equals("admin_full_vitality")) { target.setVitalityPoints(PcStat.MAX_VITALITY_POINTS, true); target.sendMessage("Admin completly recharged your Vitality"); - } - else if (cmd.equals("admin_empty_vitality")) - { + } else if (cmd.equals("admin_empty_vitality")) { target.setVitalityPoints(PcStat.MIN_VITALITY_POINTS, true); target.sendMessage("Admin completly emptied your Vitality"); - } - else if (cmd.equals("admin_get_vitality")) - { + } else if (cmd.equals("admin_get_vitality")) { level = target.getVitalityLevel(); vitality = target.getVitalityPoints(); @@ -134,13 +107,11 @@ public class AdminVitality implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } - public static void main(String[] args) - { + public static void main(String[] args) { new AdminVitality(); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminZone.java b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminZone.java index d8d76e6785..6f704979b3 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminZone.java +++ b/src/main/java/com/l2jserver/datapack/handlers/admincommandhandlers/AdminZone.java @@ -38,20 +38,16 @@ import com.l2jserver.gameserver.util.StringUtil; /** * Small typo fix by Zoey76 24/02/2011 */ -public class AdminZone implements IAdminCommandHandler -{ - private static final String[] ADMIN_COMMANDS = - { +public class AdminZone implements IAdminCommandHandler { + private static final String[] ADMIN_COMMANDS = { "admin_zone_check", "admin_zone_visual", "admin_zone_visual_clear" }; @Override - public boolean useAdminCommand(String command, L2PcInstance activeChar) - { - if (activeChar == null) - { + public boolean useAdminCommand(String command, L2PcInstance activeChar) { + if (activeChar == null) { return false; } @@ -61,8 +57,7 @@ public class AdminZone implements IAdminCommandHandler // String val = ""; // if (st.countTokens() >= 1) {val = st.nextToken();} - if (actualCommand.equalsIgnoreCase("admin_zone_check")) - { + if (actualCommand.equalsIgnoreCase("admin_zone_check")) { showHtml(activeChar); activeChar.sendMessage("MapRegion: x:" + MapRegionManager.getInstance().getMapRegionX(activeChar.getX()) + " y:" + MapRegionManager.getInstance().getMapRegionY(activeChar.getY()) + " (" + MapRegionManager.getInstance().getMapRegionLocId(activeChar) + ")"); getGeoRegionXY(activeChar); @@ -81,38 +76,28 @@ public class AdminZone implements IAdminCommandHandler loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.TOWN); activeChar.sendMessage("TeleToLocation (Town): x:" + loc.getX() + " y:" + loc.getY() + " z:" + loc.getZ()); - } - else if (actualCommand.equalsIgnoreCase("admin_zone_visual")) - { + } else if (actualCommand.equalsIgnoreCase("admin_zone_visual")) { String next = st.nextToken(); - if (next.equalsIgnoreCase("all")) - { - for (L2ZoneType zone : ZoneManager.getInstance().getZones(activeChar)) - { + if (next.equalsIgnoreCase("all")) { + for (L2ZoneType zone : ZoneManager.getInstance().getZones(activeChar)) { zone.visualizeZone(activeChar.getZ()); } - for (NpcSpawnTerritory territory : ZoneManager.getInstance().getSpawnTerritories(activeChar)) - { + for (NpcSpawnTerritory territory : ZoneManager.getInstance().getSpawnTerritories(activeChar)) { territory.visualizeZone(activeChar.getZ()); } showHtml(activeChar); - } - else - { + } else { int zoneId = Integer.parseInt(next); ZoneManager.getInstance().getZoneById(zoneId).visualizeZone(activeChar.getZ()); } - } - else if (actualCommand.equalsIgnoreCase("admin_zone_visual_clear")) - { + } else if (actualCommand.equalsIgnoreCase("admin_zone_visual_clear")) { ZoneManager.getInstance().clearDebugItems(); showHtml(activeChar); } return true; } - private static void showHtml(L2PcInstance activeChar) - { + private static void showHtml(L2PcInstance activeChar) { final String htmContent = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/admin/zone.htm"); final NpcHtmlMessage adminReply = new NpcHtmlMessage(); adminReply.setHtml(htmContent); @@ -134,35 +119,27 @@ public class AdminZone implements IAdminCommandHandler adminReply.replace("%SCRIPT%", (activeChar.isInsideZone(ZoneId.SCRIPT) ? "<font color=\"LEVEL\">YES</font>" : "NO")); StringBuilder zones = new StringBuilder(100); L2WorldRegion region = L2World.getInstance().getRegion(activeChar.getX(), activeChar.getY()); - for (L2ZoneType zone : region.getZones()) - { - if (zone.isCharacterInZone(activeChar)) - { - if (zone.getName() != null) - { + for (L2ZoneType zone : region.getZones()) { + if (zone.isCharacterInZone(activeChar)) { + if (zone.getName() != null) { StringUtil.append(zones, zone.getName() + "<br1>"); - if (zone.getId() < 300000) - { + if (zone.getId() < 300000) { StringUtil.append(zones, "(", String.valueOf(zone.getId()), ")"); } - } - else - { + } else { StringUtil.append(zones, String.valueOf(zone.getId())); } StringUtil.append(zones, " "); } } - for (NpcSpawnTerritory territory : ZoneManager.getInstance().getSpawnTerritories(activeChar)) - { + for (NpcSpawnTerritory territory : ZoneManager.getInstance().getSpawnTerritories(activeChar)) { StringUtil.append(zones, territory.getName() + "<br1>"); } adminReply.replace("%ZLIST%", zones.toString()); activeChar.sendPacket(adminReply); } - private static void getGeoRegionXY(L2PcInstance activeChar) - { + private static void getGeoRegionXY(L2PcInstance activeChar) { int worldX = activeChar.getX(); int worldY = activeChar.getY(); int geoX = ((((worldX - (-327680)) >> 4) >> 11) + 10); @@ -171,8 +148,7 @@ public class AdminZone implements IAdminCommandHandler } @Override - public String[] getAdminCommandList() - { + public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Augment.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Augment.java index 8b321e0db6..99772e6c26 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Augment.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Augment.java @@ -26,25 +26,19 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.serverpackets.ExShowVariationCancelWindow; import com.l2jserver.gameserver.network.serverpackets.ExShowVariationMakeWindow; -public class Augment implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class Augment implements IBypassHandler { + private static final String[] COMMANDS = { "Augment" }; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { - if (!target.isNpc()) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { + if (!target.isNpc()) { return false; } - try - { - switch (Integer.parseInt(command.substring(8, 9).trim())) - { + try { + switch (Integer.parseInt(command.substring(8, 9).trim())) { case 1: activeChar.sendPacket(ExShowVariationMakeWindow.STATIC_PACKET); return true; @@ -52,17 +46,14 @@ public class Augment implements IBypassHandler activeChar.sendPacket(ExShowVariationCancelWindow.STATIC_PACKET); return true; } - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, "Exception in " + getClass().getSimpleName(), e); } return false; } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Buy.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Buy.java index 0883a14179..e7fcc27ee1 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Buy.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Buy.java @@ -26,44 +26,35 @@ import com.l2jserver.gameserver.model.actor.L2Character; import com.l2jserver.gameserver.model.actor.instance.L2MerchantInstance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -public class Buy implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class Buy implements IBypassHandler { + private static final String[] COMMANDS = { "Buy" }; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { - if (!(target instanceof L2MerchantInstance)) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { + if (!(target instanceof L2MerchantInstance)) { return false; } - try - { + try { StringTokenizer st = new StringTokenizer(command, " "); st.nextToken(); - if (st.countTokens() < 1) - { + if (st.countTokens() < 1) { return false; } ((L2MerchantInstance) target).showBuyWindow(activeChar, Integer.parseInt(st.nextToken())); return true; - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, "Exception in " + getClass().getSimpleName(), e); } return false; } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/BuyShadowItem.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/BuyShadowItem.java index b67eb664ec..6a30d2a745 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/BuyShadowItem.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/BuyShadowItem.java @@ -25,36 +25,25 @@ import com.l2jserver.gameserver.model.actor.instance.L2MerchantInstance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; -public class BuyShadowItem implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class BuyShadowItem implements IBypassHandler { + private static final String[] COMMANDS = { "BuyShadowItem" }; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { - if (!(target instanceof L2MerchantInstance)) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { + if (!(target instanceof L2MerchantInstance)) { return false; } final NpcHtmlMessage html = new NpcHtmlMessage(((L2Npc) target).getObjectId()); - if (activeChar.getLevel() < 40) - { + if (activeChar.getLevel() < 40) { html.setFile(activeChar.getHtmlPrefix(), "data/html/common/shadow_item-lowlevel.htm"); - } - else if ((activeChar.getLevel() >= 40) && (activeChar.getLevel() < 46)) - { + } else if ((activeChar.getLevel() >= 40) && (activeChar.getLevel() < 46)) { html.setFile(activeChar.getHtmlPrefix(), "data/html/common/shadow_item_d.htm"); - } - else if ((activeChar.getLevel() >= 46) && (activeChar.getLevel() < 52)) - { + } else if ((activeChar.getLevel() >= 46) && (activeChar.getLevel() < 52)) { html.setFile(activeChar.getHtmlPrefix(), "data/html/common/shadow_item_c.htm"); - } - else if (activeChar.getLevel() >= 52) - { + } else if (activeChar.getLevel() >= 52) { html.setFile(activeChar.getHtmlPrefix(), "data/html/common/shadow_item_b.htm"); } html.replace("%objectId%", String.valueOf(((L2Npc) target).getObjectId())); @@ -64,8 +53,7 @@ public class BuyShadowItem implements IBypassHandler } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/ChatLink.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/ChatLink.java index 0327e9cad3..6cdfef16dd 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/ChatLink.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/ChatLink.java @@ -26,46 +26,35 @@ import com.l2jserver.gameserver.model.events.EventDispatcher; import com.l2jserver.gameserver.model.events.EventType; import com.l2jserver.gameserver.model.events.impl.character.npc.OnNpcFirstTalk; -public class ChatLink implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class ChatLink implements IBypassHandler { + private static final String[] COMMANDS = { "Chat" }; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { - if (!target.isNpc()) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { + if (!target.isNpc()) { return false; } int val = 0; - try - { + try { val = Integer.parseInt(command.substring(5)); - } - catch (Exception ioobe) - { + } catch (Exception ioobe) { } final L2Npc npc = (L2Npc) target; - if ((val == 0) && npc.hasListener(EventType.ON_NPC_FIRST_TALK)) - { + if ((val == 0) && npc.hasListener(EventType.ON_NPC_FIRST_TALK)) { EventDispatcher.getInstance().notifyEventAsync(new OnNpcFirstTalk(npc, activeChar), npc); - } - else - { + } else { npc.showChatWindow(activeChar, val); } return false; } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/ClanWarehouse.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/ClanWarehouse.java index 6c35f4d019..2d282ba62b 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/ClanWarehouse.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/ClanWarehouse.java @@ -39,83 +39,64 @@ import com.l2jserver.gameserver.network.serverpackets.SortedWareHouseWithdrawalL import com.l2jserver.gameserver.network.serverpackets.WareHouseDepositList; import com.l2jserver.gameserver.network.serverpackets.WareHouseWithdrawalList; -public class ClanWarehouse implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class ClanWarehouse implements IBypassHandler { + private static final String[] COMMANDS = { "withdrawc", "withdrawsortedc", "depositc" }; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { - if (!(target instanceof L2WarehouseInstance) && !(target instanceof L2ClanHallManagerInstance)) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { + if (!(target instanceof L2WarehouseInstance) && !(target instanceof L2ClanHallManagerInstance)) { return false; } - if (activeChar.isEnchanting()) - { + if (activeChar.isEnchanting()) { return false; } - if (activeChar.getClan() == null) - { + if (activeChar.getClan() == null) { activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_THE_RIGHT_TO_USE_CLAN_WAREHOUSE); return false; } - if (activeChar.getClan().getLevel() == 0) - { + if (activeChar.getClan().getLevel() == 0) { activeChar.sendPacket(SystemMessageId.ONLY_LEVEL_1_CLAN_OR_HIGHER_CAN_USE_WAREHOUSE); return false; } - try - { + try { if (command.toLowerCase().startsWith(COMMANDS[0])) // WithdrawC { - if (customs().enableWarehouseSortingClan()) - { + if (customs().enableWarehouseSortingClan()) { final NpcHtmlMessage msg = new NpcHtmlMessage(((L2Npc) target).getObjectId()); msg.setFile(activeChar.getHtmlPrefix(), "data/html/mods/WhSortedC.htm"); msg.replace("%objectId%", String.valueOf(((L2Npc) target).getObjectId())); activeChar.sendPacket(msg); - } - else - { + } else { showWithdrawWindow(activeChar, null, (byte) 0); } return true; - } - else if (command.toLowerCase().startsWith(COMMANDS[1])) // WithdrawSortedC + } else if (command.toLowerCase().startsWith(COMMANDS[1])) // WithdrawSortedC { final String param[] = command.split(" "); - if (param.length > 2) - { + if (param.length > 2) { showWithdrawWindow(activeChar, WarehouseListType.valueOf(param[1]), SortedWareHouseWithdrawalList.getOrder(param[2])); - } - else if (param.length > 1) - { + } else if (param.length > 1) { showWithdrawWindow(activeChar, WarehouseListType.valueOf(param[1]), SortedWareHouseWithdrawalList.A2Z); - } - else - { + } else { showWithdrawWindow(activeChar, WarehouseListType.ALL, SortedWareHouseWithdrawalList.A2Z); } return true; - } - else if (command.toLowerCase().startsWith(COMMANDS[2])) // DepositC + } else if (command.toLowerCase().startsWith(COMMANDS[2])) // DepositC { activeChar.sendPacket(ActionFailed.STATIC_PACKET); activeChar.setActiveWarehouse(activeChar.getClan().getWarehouse()); activeChar.setInventoryBlockingStatus(true); - if (general().debug()) - { + if (general().debug()) { _log.fine("Source: L2WarehouseInstance.java; Player: " + activeChar.getName() + "; Command: showDepositWindowClan; Message: Showing items to deposit."); } @@ -124,57 +105,45 @@ public class ClanWarehouse implements IBypassHandler } return false; - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, "Exception in " + getClass().getSimpleName(), e); } return false; } - private static final void showWithdrawWindow(L2PcInstance player, WarehouseListType itemtype, byte sortorder) - { + private static final void showWithdrawWindow(L2PcInstance player, WarehouseListType itemtype, byte sortorder) { player.sendPacket(ActionFailed.STATIC_PACKET); - if (!player.hasClanPrivilege(ClanPrivilege.CL_VIEW_WAREHOUSE)) - { + if (!player.hasClanPrivilege(ClanPrivilege.CL_VIEW_WAREHOUSE)) { player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_THE_RIGHT_TO_USE_CLAN_WAREHOUSE); return; } player.setActiveWarehouse(player.getClan().getWarehouse()); - if (player.getActiveWarehouse().getSize() == 0) - { + if (player.getActiveWarehouse().getSize() == 0) { player.sendPacket(SystemMessageId.NO_ITEM_DEPOSITED_IN_WH); return; } - for (L2ItemInstance i : player.getActiveWarehouse().getItems()) - { - if (i.isTimeLimitedItem() && (i.getRemainingTime() <= 0)) - { + for (L2ItemInstance i : player.getActiveWarehouse().getItems()) { + if (i.isTimeLimitedItem() && (i.getRemainingTime() <= 0)) { player.getActiveWarehouse().destroyItem("L2ItemInstance", i, player, null); } } - if (itemtype != null) - { + if (itemtype != null) { player.sendPacket(new SortedWareHouseWithdrawalList(player, WareHouseWithdrawalList.CLAN, itemtype, sortorder)); - } - else - { + } else { player.sendPacket(new WareHouseWithdrawalList(player, WareHouseWithdrawalList.CLAN)); } - if (general().debug()) - { + if (general().debug()) { _log.fine("Source: L2WarehouseInstance.java; Player: " + player.getName() + "; Command: showRetrieveWindowClan; Message: Showing stored items."); } } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/EventEngine.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/EventEngine.java index ab303afc29..54fea3d1a7 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/EventEngine.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/EventEngine.java @@ -25,45 +25,34 @@ import com.l2jserver.gameserver.model.actor.L2Character; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.entity.L2Event; -public class EventEngine implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class EventEngine implements IBypassHandler { + private static final String[] COMMANDS = { "event_participate", "event_unregister" }; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { - if (!target.isNpc()) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { + if (!target.isNpc()) { return false; } - try - { - if (command.equalsIgnoreCase("event_participate")) - { + try { + if (command.equalsIgnoreCase("event_participate")) { L2Event.registerPlayer(activeChar); return true; - } - else if (command.equalsIgnoreCase("event_unregister")) - { + } else if (command.equalsIgnoreCase("event_unregister")) { L2Event.removeAndResetPlayer(activeChar); return true; } - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, "Exception in " + getClass().getSimpleName(), e); } return false; } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Festival.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Festival.java index ca2a8c950e..2e0c2cb042 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Festival.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Festival.java @@ -39,28 +39,22 @@ import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; import com.l2jserver.gameserver.network.serverpackets.SystemMessage; import com.l2jserver.gameserver.util.StringUtil; -public class Festival implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class Festival implements IBypassHandler { + private static final String[] COMMANDS = { "festival", "festivaldesc" }; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { - if (!(target instanceof L2FestivalGuideInstance)) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { + if (!(target instanceof L2FestivalGuideInstance)) { return false; } final L2FestivalGuideInstance npc = (L2FestivalGuideInstance) target; - try - { + try { final int val; - if (command.toLowerCase().startsWith(COMMANDS[1])) - { + if (command.toLowerCase().startsWith(COMMANDS[1])) { val = Integer.parseInt(command.substring(13)); npc.showChatWindow(activeChar, val, null, true); return true; @@ -68,26 +62,22 @@ public class Festival implements IBypassHandler final L2Party party; val = Integer.parseInt(command.substring(9, 10)); - switch (val) - { + switch (val) { case 1: // Become a Participant // Check if the festival period is active, if not then don't allow registration. - if (SevenSigns.getInstance().isSealValidationPeriod()) - { + if (SevenSigns.getInstance().isSealValidationPeriod()) { npc.showChatWindow(activeChar, 2, "a", false); return true; } // Check if a festival is in progress, then don't allow registration yet. - if (SevenSignsFestival.getInstance().isFestivalInitialized()) - { + if (SevenSignsFestival.getInstance().isFestivalInitialized()) { activeChar.sendMessage("You cannot sign up while a festival is in progress."); return true; } // Check if the player is in a formed party already. - if (!activeChar.isInParty()) - { + if (!activeChar.isInParty()) { npc.showChatWindow(activeChar, 2, "b", false); return true; } @@ -95,29 +85,25 @@ public class Festival implements IBypassHandler party = activeChar.getParty(); // Check if the player is the party leader. - if (!party.isLeader(activeChar)) - { + if (!party.isLeader(activeChar)) { npc.showChatWindow(activeChar, 2, "c", false); return true; } // Check to see if the party has at least 5 members. - if (party.getMemberCount() < sevenSings().getFestivalMinPlayer()) - { + if (party.getMemberCount() < sevenSings().getFestivalMinPlayer()) { npc.showChatWindow(activeChar, 2, "b", false); return true; } // Check if all the party members are in the required level range. - if (party.getLevel() > SevenSignsFestival.getMaxLevelForFestival(npc.getFestivalType())) - { + if (party.getLevel() > SevenSignsFestival.getMaxLevelForFestival(npc.getFestivalType())) { npc.showChatWindow(activeChar, 2, "d", false); return true; } // Check to see if the player has already signed up - if (activeChar.isFestivalParticipant()) - { + if (activeChar.isFestivalParticipant()) { SevenSignsFestival.getInstance().setParticipants(npc.getFestivalOracle(), npc.getFestivalType(), party); npc.showChatWindow(activeChar, 2, "f", false); return true; @@ -128,13 +114,11 @@ public class Festival implements IBypassHandler case 2: // Seal Stones final int stoneType = Integer.parseInt(command.substring(11)); final int stoneCount = npc.getStoneCount(stoneType); - if (stoneCount <= 0) - { + if (stoneCount <= 0) { return false; } - if (!activeChar.destroyItemByItemId("SevenSigns", stoneType, stoneCount, npc, true)) - { + if (!activeChar.destroyItemByItemId("SevenSigns", stoneType, stoneCount, npc, true)) { return false; } @@ -145,22 +129,19 @@ public class Festival implements IBypassHandler break; case 3: // Score Registration // Check if the festival period is active, if not then don't register the score. - if (SevenSigns.getInstance().isSealValidationPeriod()) - { + if (SevenSigns.getInstance().isSealValidationPeriod()) { npc.showChatWindow(activeChar, 3, "a", false); return true; } // Check if a festival is in progress, if it is don't register the score. - if (SevenSignsFestival.getInstance().isFestivalInProgress()) - { + if (SevenSignsFestival.getInstance().isFestivalInProgress()) { activeChar.sendMessage("You cannot register a score while a festival is in progress."); return true; } // Check if the player is in a party. - if (!activeChar.isInParty()) - { + if (!activeChar.isInParty()) { npc.showChatWindow(activeChar, 3, "b", false); return true; } @@ -168,15 +149,13 @@ public class Festival implements IBypassHandler final List<Integer> prevParticipants = SevenSignsFestival.getInstance().getPreviousParticipants(npc.getFestivalOracle(), npc.getFestivalType()); // Check if there are any past participants. - if ((prevParticipants == null) || prevParticipants.isEmpty() || !prevParticipants.contains(activeChar.getObjectId())) - { + if ((prevParticipants == null) || prevParticipants.isEmpty() || !prevParticipants.contains(activeChar.getObjectId())) { npc.showChatWindow(activeChar, 3, "b", false); return true; } // Check if this player was the party leader in the festival. - if (activeChar.getObjectId() != prevParticipants.get(0)) - { + if (activeChar.getObjectId() != prevParticipants.get(0)) { npc.showChatWindow(activeChar, 3, "b", false); return true; } @@ -184,15 +163,13 @@ public class Festival implements IBypassHandler final L2ItemInstance bloodOfferings = activeChar.getInventory().getItemByItemId(SevenSignsFestival.FESTIVAL_OFFERING_ID); // Check if the player collected any blood offerings during the festival. - if (bloodOfferings == null) - { + if (bloodOfferings == null) { activeChar.sendMessage("You do not have any blood offerings to contribute."); return true; } final long offeringScore = bloodOfferings.getCount() * SevenSignsFestival.FESTIVAL_OFFERING_VALUE; - if (!activeChar.destroyItem("SevenSigns", bloodOfferings, npc, false)) - { + if (!activeChar.destroyItem("SevenSigns", bloodOfferings, npc, false)) { return true; } @@ -201,12 +178,9 @@ public class Festival implements IBypassHandler sm.addLong(offeringScore); activeChar.sendPacket(sm); - if (isHighestScore) - { + if (isHighestScore) { npc.showChatWindow(activeChar, 3, "c", false); - } - else - { + } else { npc.showChatWindow(activeChar, 3, "d", false); } break; @@ -222,47 +196,34 @@ public class Festival implements IBypassHandler int overallScore = 0; // If no data is returned, assume there is no record, or all scores are 0. - if (overallData != null) - { + if (overallData != null) { overallScore = overallData.getInt("score"); } StringUtil.append(strBuffer, SevenSignsFestival.getFestivalName(npc.getFestivalType()), " festival.<br>"); - if (dawnScore > 0) - { + if (dawnScore > 0) { StringUtil.append(strBuffer, "Dawn: ", calculateDate(dawnData.getString("date")), ". Score ", String.valueOf(dawnScore), "<br>", dawnData.getString("members"), "<br>"); - } - else - { + } else { strBuffer.append("Dawn: No record exists. Score 0<br>"); } - if (duskScore > 0) - { + if (duskScore > 0) { StringUtil.append(strBuffer, "Dusk: ", calculateDate(duskData.getString("date")), ". Score ", String.valueOf(duskScore), "<br>", duskData.getString("members"), "<br>"); - } - else - { + } else { strBuffer.append("Dusk: No record exists. Score 0<br>"); } - if ((overallScore > 0) && (overallData != null)) - { + if ((overallScore > 0) && (overallData != null)) { final String cabalStr; - if (overallData.getString("cabal").equals("dawn")) - { + if (overallData.getString("cabal").equals("dawn")) { cabalStr = "Children of Dawn"; - } - else - { + } else { cabalStr = "Children of Dusk"; } StringUtil.append(strBuffer, "Consecutive top scores: ", calculateDate(overallData.getString("date")), ". Score ", String.valueOf(overallScore), "<br>Affilated side: ", cabalStr, "<br>", overallData.getString("members"), "<br>"); - } - else - { + } else { strBuffer.append("Consecutive top scores: No record exists. Score 0<br>"); } @@ -273,68 +234,51 @@ public class Festival implements IBypassHandler activeChar.sendPacket(html); break; case 8: // Increase the Festival Challenge - if (!activeChar.isInParty()) - { + if (!activeChar.isInParty()) { return true; } - if (!SevenSignsFestival.getInstance().isFestivalInProgress()) - { + if (!SevenSignsFestival.getInstance().isFestivalInProgress()) { return true; } party = activeChar.getParty(); - if (!party.isLeader(activeChar)) - { + if (!party.isLeader(activeChar)) { npc.showChatWindow(activeChar, 8, "a", false); return true; } - if (SevenSignsFestival.getInstance().increaseChallenge(npc.getFestivalOracle(), npc.getFestivalType())) - { + if (SevenSignsFestival.getInstance().increaseChallenge(npc.getFestivalOracle(), npc.getFestivalType())) { npc.showChatWindow(activeChar, 8, "b", false); - } - else - { + } else { npc.showChatWindow(activeChar, 8, "c", false); } break; case 9: // Leave the Festival - if (!activeChar.isInParty()) - { + if (!activeChar.isInParty()) { return true; } party = activeChar.getParty(); - if (party.isLeader(activeChar)) - { + if (party.isLeader(activeChar)) { SevenSignsFestival.getInstance().updateParticipants(activeChar, null); - } - else - { - if (party.getMemberCount() > sevenSings().getFestivalMinPlayer()) - { + } else { + if (party.getMemberCount() > sevenSings().getFestivalMinPlayer()) { party.removePartyMember(activeChar, messageType.Expelled); - } - else - { + } else { activeChar.sendMessage("Only the party leader can leave a festival when a party has minimum number of members."); } } break; case 0: // Distribute Accumulated Bonus - if (!SevenSigns.getInstance().isSealValidationPeriod()) - { + if (!SevenSigns.getInstance().isSealValidationPeriod()) { activeChar.sendMessage("Bonuses cannot be paid during the competition period."); return true; } - if (SevenSignsFestival.getInstance().distribAccumulatedBonus(activeChar) > 0) - { + if (SevenSignsFestival.getInstance().distribAccumulatedBonus(activeChar) > 0) { npc.showChatWindow(activeChar, 0, "a", false); - } - else - { + } else { npc.showChatWindow(activeChar, 0, "b", false); } break; @@ -342,16 +286,13 @@ public class Festival implements IBypassHandler npc.showChatWindow(activeChar, val, null, false); } return true; - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, "Exception in " + getClass().getSimpleName(), e); } return false; } - private final String calculateDate(String milliFromEpoch) - { + private final String calculateDate(String milliFromEpoch) { long numMillis = Long.valueOf(milliFromEpoch); Calendar calCalc = Calendar.getInstance(); calCalc.setTimeInMillis(numMillis); @@ -359,8 +300,7 @@ public class Festival implements IBypassHandler } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Freight.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Freight.java index 162db5d199..32f761959b 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Freight.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Freight.java @@ -30,53 +30,37 @@ import com.l2jserver.gameserver.network.serverpackets.WareHouseWithdrawalList; /** * @author UnAfraid */ -public class Freight implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class Freight implements IBypassHandler { + private static final String[] COMMANDS = { "package_withdraw", "package_deposit" }; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { - if (!target.isNpc()) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { + if (!target.isNpc()) { return false; } - if (command.equalsIgnoreCase(COMMANDS[0])) - { + if (command.equalsIgnoreCase(COMMANDS[0])) { PcFreight freight = activeChar.getFreight(); - if (freight != null) - { - if (freight.getSize() > 0) - { + if (freight != null) { + if (freight.getSize() > 0) { activeChar.setActiveWarehouse(freight); - for (L2ItemInstance i : activeChar.getActiveWarehouse().getItems()) - { - if (i.isTimeLimitedItem() && (i.getRemainingTime() <= 0)) - { + for (L2ItemInstance i : activeChar.getActiveWarehouse().getItems()) { + if (i.isTimeLimitedItem() && (i.getRemainingTime() <= 0)) { activeChar.getActiveWarehouse().destroyItem("L2ItemInstance", i, activeChar, null); } } activeChar.sendPacket(new WareHouseWithdrawalList(activeChar, WareHouseWithdrawalList.FREIGHT)); - } - else - { + } else { activeChar.sendPacket(SystemMessageId.NO_ITEM_DEPOSITED_IN_WH); } } - } - else if (command.equalsIgnoreCase(COMMANDS[1])) - { - if (activeChar.getAccountChars().size() < 1) - { + } else if (command.equalsIgnoreCase(COMMANDS[1])) { + if (activeChar.getAccountChars().size() < 1) { activeChar.sendPacket(SystemMessageId.CHARACTER_DOES_NOT_EXIST); - } - else - { + } else { activeChar.sendPacket(new PackageToList(activeChar.getAccountChars())); } } @@ -84,8 +68,7 @@ public class Freight implements IBypassHandler } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/ItemAuctionLink.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/ItemAuctionLink.java index 4fa7881e7b..b038eb9748 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/ItemAuctionLink.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/ItemAuctionLink.java @@ -34,96 +34,74 @@ import com.l2jserver.gameserver.model.itemauction.ItemAuctionInstance; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.ExItemAuctionInfoPacket; -public class ItemAuctionLink implements IBypassHandler -{ +public class ItemAuctionLink implements IBypassHandler { private static final SimpleDateFormat fmt = new SimpleDateFormat("HH:mm:ss dd.MM.yyyy"); - private static final String[] COMMANDS = - { + private static final String[] COMMANDS = { "ItemAuction" }; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { - if (!target.isNpc()) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { + if (!target.isNpc()) { return false; } - if (!general().itemAuctionEnabled()) - { + if (!general().itemAuctionEnabled()) { activeChar.sendPacket(SystemMessageId.NO_AUCTION_PERIOD); return true; } final ItemAuctionInstance au = ItemAuctionManager.getInstance().getManagerInstance(target.getId()); - if (au == null) - { + if (au == null) { return false; } - try - { + try { StringTokenizer st = new StringTokenizer(command); st.nextToken(); // bypass "ItemAuction" - if (!st.hasMoreTokens()) - { + if (!st.hasMoreTokens()) { return false; } String cmd = st.nextToken(); - if ("show".equalsIgnoreCase(cmd)) - { - if (!activeChar.getFloodProtectors().getItemAuction().tryPerformAction("RequestInfoItemAuction")) - { + if ("show".equalsIgnoreCase(cmd)) { + if (!activeChar.getFloodProtectors().getItemAuction().tryPerformAction("RequestInfoItemAuction")) { return false; } - if (activeChar.isItemAuctionPolling()) - { + if (activeChar.isItemAuctionPolling()) { return false; } final ItemAuction currentAuction = au.getCurrentAuction(); final ItemAuction nextAuction = au.getNextAuction(); - if (currentAuction == null) - { + if (currentAuction == null) { activeChar.sendPacket(SystemMessageId.NO_AUCTION_PERIOD); - if (nextAuction != null) - { + if (nextAuction != null) { activeChar.sendMessage("The next auction will begin on the " + fmt.format(new Date(nextAuction.getStartingTime())) + "."); } return true; } activeChar.sendPacket(new ExItemAuctionInfoPacket(false, currentAuction, nextAuction)); - } - else if ("cancel".equalsIgnoreCase(cmd)) - { + } else if ("cancel".equalsIgnoreCase(cmd)) { final ItemAuction[] auctions = au.getAuctionsByBidder(activeChar.getObjectId()); boolean returned = false; - for (final ItemAuction auction : auctions) - { - if (auction.cancelBid(activeChar)) - { + for (final ItemAuction auction : auctions) { + if (auction.cancelBid(activeChar)) { returned = true; } } - if (!returned) - { + if (!returned) { activeChar.sendPacket(SystemMessageId.NO_OFFERINGS_OWN_OR_MADE_BID_FOR); } - } - else - { + } else { return false; } - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, "Exception in " + getClass().getSimpleName(), e); } @@ -131,8 +109,7 @@ public class ItemAuctionLink implements IBypassHandler } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Link.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Link.java index 854aa72ca5..d0f7ae5172 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Link.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Link.java @@ -23,25 +23,20 @@ import com.l2jserver.gameserver.model.actor.L2Character; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; -public class Link implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class Link implements IBypassHandler { + private static final String[] COMMANDS = { "Link" }; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { String htmlPath = command.substring(4).trim(); - if (htmlPath.isEmpty()) - { + if (htmlPath.isEmpty()) { _log.warning("Player " + activeChar.getName() + " sent empty link html!"); return false; } - if (htmlPath.contains("..")) - { + if (htmlPath.contains("..")) { _log.warning("Player " + activeChar.getName() + " sent invalid link html: " + htmlPath); return false; } @@ -55,8 +50,7 @@ public class Link implements IBypassHandler } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Loto.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Loto.java index 24970f1644..fe64202852 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Loto.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Loto.java @@ -35,37 +35,26 @@ import com.l2jserver.gameserver.network.serverpackets.InventoryUpdate; import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; import com.l2jserver.gameserver.network.serverpackets.SystemMessage; -public class Loto implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class Loto implements IBypassHandler { + private static final String[] COMMANDS = { "Loto" }; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { - if (!target.isNpc()) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { + if (!target.isNpc()) { return false; } int val = 0; - try - { + try { val = Integer.parseInt(command.substring(5)); + } catch (IndexOutOfBoundsException ioobe) { + } catch (NumberFormatException nfe) { } - catch (IndexOutOfBoundsException ioobe) - { - } - catch (NumberFormatException nfe) - { - } - if (val == 0) - { + if (val == 0) { // new loto ticket - for (int i = 0; i < 5; i++) - { + for (int i = 0; i < 5; i++) { activeChar.setLoto(i, 0); } } @@ -79,8 +68,9 @@ public class Loto implements IBypassHandler * <BR> * <B><U> Actions</U> :</B><BR> * <BR> - * <li>Get the text of the selected HTML file in function of the npcId and of the page number</li> <li>Send a Server->Client NpcHtmlMessage containing the text of the L2NpcInstance to the L2PcInstance</li> <li>Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the - * client wait another packet</li><BR> + * <li>Get the text of the selected HTML file in function of the npcId and of the page number</li> + * <li>Send a Server->Client NpcHtmlMessage containing the text of the L2NpcInstance to the L2PcInstance</li> + * <li>Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet</li><BR> * @param player The L2PcInstance that talk with the L2NpcInstance * @param npc L2Npc loto instance * @param val The number of the page of the L2NpcInstance to display @@ -92,8 +82,7 @@ public class Loto implements IBypassHandler // 23 - current lottery jackpot // 24 - Previous winning numbers/Prize claim // >24 - check lottery ticket by item object id - public static final void showLotoWindow(L2PcInstance player, L2Npc npc, int val) - { + public static final void showLotoWindow(L2PcInstance player, L2Npc npc, int val) { int npcId = npc.getTemplate().getId(); String filename; SystemMessage sm; @@ -103,17 +92,14 @@ public class Loto implements IBypassHandler { filename = (npc.getHtmlPath(npcId, 1)); html.setFile(player.getHtmlPrefix(), filename); - } - else if ((val >= 1) && (val <= 21)) // 1-20 - buttons, 21 - second buy lottery ticket window + } else if ((val >= 1) && (val <= 21)) // 1-20 - buttons, 21 - second buy lottery ticket window { - if (!Lottery.getInstance().isStarted()) - { + if (!Lottery.getInstance().isStarted()) { // tickets can't be sold player.sendPacket(SystemMessageId.NO_LOTTERY_TICKETS_CURRENT_SOLD); return; } - if (!Lottery.getInstance().isSellableTickets()) - { + if (!Lottery.getInstance().isSellableTickets()) { // tickets can't be sold player.sendPacket(SystemMessageId.NO_LOTTERY_TICKETS_AVAILABLE); return; @@ -125,27 +111,20 @@ public class Loto implements IBypassHandler int count = 0; int found = 0; // counting buttons and unsetting button if found - for (int i = 0; i < 5; i++) - { - if (player.getLoto(i) == val) - { + for (int i = 0; i < 5; i++) { + if (player.getLoto(i) == val) { // unsetting button player.setLoto(i, 0); found = 1; - } - else if (player.getLoto(i) > 0) - { + } else if (player.getLoto(i) > 0) { count++; } } // if not rearched limit 5 and not unseted value - if ((count < 5) && (found == 0) && (val <= 20)) - { - for (int i = 0; i < 5; i++) - { - if (player.getLoto(i) == 0) - { + if ((count < 5) && (found == 0) && (val <= 20)) { + for (int i = 0; i < 5; i++) { + if (player.getLoto(i) == 0) { player.setLoto(i, val); break; } @@ -154,14 +133,11 @@ public class Loto implements IBypassHandler // setting pusshed buttons count = 0; - for (int i = 0; i < 5; i++) - { - if (player.getLoto(i) > 0) - { + for (int i = 0; i < 5; i++) { + if (player.getLoto(i) > 0) { count++; String button = String.valueOf(player.getLoto(i)); - if (player.getLoto(i) < 10) - { + if (player.getLoto(i) < 10) { button = "0" + button; } String search = "fore=\"L2UI.lottoNum" + button + "\" back=\"L2UI.lottoNum" + button + "a_check\""; @@ -170,23 +146,19 @@ public class Loto implements IBypassHandler } } - if (count == 5) - { + if (count == 5) { String search = "0\">Return"; String replace = "22\">Your lucky numbers have been selected above."; html.replace(search, replace); } - } - else if (val == 22) // 22 - selected ticket with 5 numbers + } else if (val == 22) // 22 - selected ticket with 5 numbers { - if (!Lottery.getInstance().isStarted()) - { + if (!Lottery.getInstance().isStarted()) { // tickets can't be sold player.sendPacket(SystemMessageId.NO_LOTTERY_TICKETS_CURRENT_SOLD); return; } - if (!Lottery.getInstance().isSellableTickets()) - { + if (!Lottery.getInstance().isSellableTickets()) { // tickets can't be sold player.sendPacket(SystemMessageId.NO_LOTTERY_TICKETS_AVAILABLE); return; @@ -197,30 +169,23 @@ public class Loto implements IBypassHandler int enchant = 0; int type2 = 0; - for (int i = 0; i < 5; i++) - { - if (player.getLoto(i) == 0) - { + for (int i = 0; i < 5; i++) { + if (player.getLoto(i) == 0) { return; } - if (player.getLoto(i) < 17) - { + if (player.getLoto(i) < 17) { enchant += Math.pow(2, player.getLoto(i) - 1); - } - else - { + } else { type2 += Math.pow(2, player.getLoto(i) - 17); } } - if (player.getAdena() < price) - { + if (player.getAdena() < price) { sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_NOT_ENOUGH_ADENA); player.sendPacket(sm); return; } - if (!player.reduceAdena("Loto", price, npc, true)) - { + if (!player.reduceAdena("Loto", price, npc, true)) { return; } Lottery.getInstance().increasePrize(price); @@ -244,38 +209,30 @@ public class Loto implements IBypassHandler filename = (npc.getHtmlPath(npcId, 6)); html.setFile(player.getHtmlPrefix(), filename); - } - else if (val == 23) // 23 - current lottery jackpot + } else if (val == 23) // 23 - current lottery jackpot { filename = (npc.getHtmlPath(npcId, 3)); html.setFile(player.getHtmlPrefix(), filename); - } - else if (val == 24) // 24 - Previous winning numbers/Prize claim + } else if (val == 24) // 24 - Previous winning numbers/Prize claim { filename = (npc.getHtmlPath(npcId, 4)); html.setFile(player.getHtmlPrefix(), filename); int lotonumber = Lottery.getInstance().getId(); String message = ""; - for (L2ItemInstance item : player.getInventory().getItems()) - { - if (item == null) - { + for (L2ItemInstance item : player.getInventory().getItems()) { + if (item == null) { continue; } - if ((item.getId() == 4442) && (item.getCustomType1() < lotonumber)) - { + if ((item.getId() == 4442) && (item.getCustomType1() < lotonumber)) { message = message + "<a action=\"bypass -h npc_%objectId%_Loto " + item.getObjectId() + "\">" + item.getCustomType1() + " Event Number "; int[] numbers = Lottery.getInstance().decodeNumbers(item.getEnchantLevel(), item.getCustomType2()); - for (int i = 0; i < 5; i++) - { + for (int i = 0; i < 5; i++) { message += numbers[i] + " "; } long[] check = Lottery.getInstance().checkTicket(item); - if (check[0] > 0) - { - switch ((int) check[0]) - { + if (check[0] > 0) { + switch ((int) check[0]) { case 1: message += "- 1st Prize"; break; @@ -294,23 +251,19 @@ public class Loto implements IBypassHandler message += "</a><br>"; } } - if (message.isEmpty()) - { + if (message.isEmpty()) { message += "There has been no winning lottery ticket.<br>"; } html.replace("%result%", message); - } - else if (val == 25) // 25 - lottery instructions + } else if (val == 25) // 25 - lottery instructions { filename = (npc.getHtmlPath(npcId, 2)); html.setFile(player.getHtmlPrefix(), filename); - } - else if (val > 25) // >25 - check lottery ticket by item object id + } else if (val > 25) // >25 - check lottery ticket by item object id { int lotonumber = Lottery.getInstance().getId(); L2ItemInstance item = player.getInventory().getItemByObjectId(val); - if ((item == null) || (item.getId() != 4442) || (item.getCustomType1() >= lotonumber)) - { + if ((item == null) || (item.getId() != 4442) || (item.getCustomType1() >= lotonumber)) { return; } long[] check = Lottery.getInstance().checkTicket(item); @@ -320,8 +273,7 @@ public class Loto implements IBypassHandler player.sendPacket(sm); long adena = check[1]; - if (adena > 0) - { + if (adena > 0) { player.addAdena("Loto", adena, npc, true); } player.destroyItem("Loto", item, npc, false); @@ -330,7 +282,7 @@ public class Loto implements IBypassHandler html.replace("%objectId%", String.valueOf(npc.getObjectId())); html.replace("%race%", "" + Lottery.getInstance().getId()); html.replace("%adena%", "" + Lottery.getInstance().getPrize()); - html.replace("%ticket_price%", "" +general().getLotteryTicketPrice()); + html.replace("%ticket_price%", "" + general().getLotteryTicketPrice()); html.replace("%prize5%", "" + (general().getLottery5NumberRate() * 100)); html.replace("%prize4%", "" + (general().getLottery4NumberRate() * 100)); html.replace("%prize3%", "" + (general().getLottery3NumberRate() * 100)); @@ -343,8 +295,7 @@ public class Loto implements IBypassHandler } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Multisell.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Multisell.java index a58476a9cc..59811c7d9e 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Multisell.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Multisell.java @@ -26,49 +26,40 @@ import com.l2jserver.gameserver.model.actor.L2Character; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -public class Multisell implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class Multisell implements IBypassHandler { + private static final String[] COMMANDS = { "multisell", "exc_multisell" }; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { - if (!target.isNpc()) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { + if (!target.isNpc()) { return false; } - try - { + try { int listId; if (command.toLowerCase().startsWith(COMMANDS[0])) // multisell { listId = Integer.parseInt(command.substring(9).trim()); MultisellData.getInstance().separateAndSend(listId, activeChar, (L2Npc) target, false); return true; - } - else if (command.toLowerCase().startsWith(COMMANDS[1])) // exc_multisell + } else if (command.toLowerCase().startsWith(COMMANDS[1])) // exc_multisell { listId = Integer.parseInt(command.substring(13).trim()); MultisellData.getInstance().separateAndSend(listId, activeChar, (L2Npc) target, true); return true; } return false; - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, "Exception in " + getClass().getSimpleName(), e); } return false; } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/NpcViewMod.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/NpcViewMod.java index 8a95d1d161..84b9d125d3 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/NpcViewMod.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/NpcViewMod.java @@ -70,12 +70,10 @@ public class NpcViewMod implements IBypassHandler { if (st.hasMoreElements()) { try { target = L2World.getInstance().findObject(Integer.parseInt(st.nextToken())); - } - catch (NumberFormatException e) { + } catch (NumberFormatException e) { return false; } - } - else { + } else { target = activeChar.getTarget(); } @@ -103,11 +101,9 @@ public class NpcViewMod implements IBypassHandler { } final int page = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; sendNpcDropList(activeChar, npc, dropListScope, page); - } - catch (NumberFormatException e) { + } catch (NumberFormatException e) { return false; - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { _log.warning("Bypass[NpcViewMod] unknown drop list scope: " + dropListScopeString); return false; } @@ -133,8 +129,7 @@ public class NpcViewMod implements IBypassHandler { final L2Spawn npcSpawn = npc.getSpawn(); if ((npcSpawn == null) || (npcSpawn.getRespawnMinDelay() == 0)) { html.replace("%respawn%", "None"); - } - else { + } else { TimeUnit timeUnit = TimeUnit.MILLISECONDS; long min = Long.MAX_VALUE; for (TimeUnit tu : TimeUnit.values()) { @@ -152,8 +147,7 @@ public class NpcViewMod implements IBypassHandler { final String timeUnitName = timeUnit.name().charAt(0) + timeUnit.name().toLowerCase().substring(1); if (npcSpawn.hasRespawnRandom()) { html.replace("%respawn%", minRespawnDelay + "-" + maxRespawnDelay + " " + timeUnitName); - } - else { + } else { html.replace("%respawn%", minRespawnDelay + " " + timeUnitName); } } @@ -252,15 +246,13 @@ public class NpcViewMod implements IBypassHandler { final IDropItem dropItem = dropList.get(i); if (dropItem instanceof GeneralDropItem) { addGeneralDropItem(activeChar, npc, amountFormat, chanceFormat, sb, (GeneralDropItem) dropItem); - } - else if (dropItem instanceof GroupedGeneralDropItem) { + } else if (dropItem instanceof GroupedGeneralDropItem) { final GroupedGeneralDropItem generalGroupedDropItem = (GroupedGeneralDropItem) dropItem; if (generalGroupedDropItem.getItems().size() == 1) { final GeneralDropItem generalDropItem = generalGroupedDropItem.getItems().get(0); addGeneralDropItem(activeChar, npc, amountFormat, chanceFormat, sb, new GeneralDropItem(generalDropItem.getItemId(), generalDropItem.getMin(), generalDropItem.getMax(), (generalDropItem.getChance() * generalGroupedDropItem.getChance()) / 100, generalDropItem.getAmountStrategy(), generalDropItem.getChanceStrategy(), generalGroupedDropItem.getPreciseStrategy(), generalGroupedDropItem.getKillerChanceModifierStrategy(), generalDropItem.getDropCalculationStrategy())); - } - else { + } else { GroupedGeneralDropItem normalized = generalGroupedDropItem.normalizeMe(npc, activeChar); sb.append("<table width=332 cellpadding=2 cellspacing=0 background=\"L2UI_CT1.Windows.Windows_DF_TooltipBG\">"); sb.append("<tr><td width=32 valign=top><img src=\"L2UI_CT1.ICON_DF_premiumItem\" width=32 height=32></td>"); @@ -289,8 +281,7 @@ public class NpcViewMod implements IBypassHandler { final long max = minMax._max; if (min == max) { sb.append(amountFormat.format(min)); - } - else { + } else { sb.append(amountFormat.format(min)); sb.append(" - "); sb.append(amountFormat.format(max)); @@ -311,8 +302,7 @@ public class NpcViewMod implements IBypassHandler { if (leftHeight >= (rightHeight + height)) { rightSb.append(sb); rightHeight += height; - } - else { + } else { leftSb.append(sb); leftHeight += height; } @@ -363,8 +353,7 @@ public class NpcViewMod implements IBypassHandler { final long max = minMax._max; if (min == max) { sb.append(amountFormat.format(min)); - } - else { + } else { sb.append(amountFormat.format(min)); sb.append(" - "); sb.append(amountFormat.format(max)); diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Observation.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Observation.java index ae3b3dcde9..82486c6eec 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Observation.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Observation.java @@ -31,17 +31,14 @@ import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.ActionFailed; import com.l2jserver.gameserver.network.serverpackets.ItemList; -public class Observation implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class Observation implements IBypassHandler { + private static final String[] COMMANDS = { "observesiege", "observeoracle", "observe" }; - private static final int[][] LOCATIONS = new int[][] - { + private static final int[][] LOCATIONS = new int[][] { //@formatter:off // Gludio {-18347, 114000, -2360, 500}, @@ -90,38 +87,30 @@ public class Observation implements IBypassHandler }; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { - if (!(target instanceof L2ObservationInstance)) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { + if (!(target instanceof L2ObservationInstance)) { return false; } - if (activeChar.hasSummon()) - { + if (activeChar.hasSummon()) { activeChar.sendPacket(SystemMessageId.NO_OBSERVE_WITH_PET); return false; } - if (activeChar.isOnEvent()) - { + if (activeChar.isOnEvent()) { activeChar.sendMessage("Cannot use while current Event"); return false; } String _command = command.split(" ")[0].toLowerCase(); final int param; - try - { + try { param = Integer.parseInt(command.split(" ")[1]); - } - catch (NumberFormatException nfe) - { + } catch (NumberFormatException nfe) { _log.log(Level.WARNING, "Exception in " + getClass().getSimpleName(), nfe); return false; } - if ((param < 0) || (param > (LOCATIONS.length - 1))) - { + if ((param < 0) || (param > (LOCATIONS.length - 1))) { return false; } final int[] locCost = LOCATIONS[param]; @@ -129,16 +118,11 @@ public class Observation implements IBypassHandler Location loc = new Location(locCost[0], locCost[1], locCost[2]); final long cost = locCost[3]; - switch (_command) - { - case "observesiege": - { - if (SiegeManager.getInstance().getSiege(loc) != null) - { + switch (_command) { + case "observesiege": { + if (SiegeManager.getInstance().getSiege(loc) != null) { doObserve(activeChar, (L2Npc) target, loc, cost); - } - else - { + } else { activeChar.sendPacket(SystemMessageId.ONLY_VIEW_SIEGE); } return true; @@ -157,10 +141,8 @@ public class Observation implements IBypassHandler return false; } - private static final void doObserve(final L2PcInstance player, final L2Npc npc, final Location pos, final long cost) - { - if (player.reduceAdena("Broadcast", cost, npc, true)) - { + private static final void doObserve(final L2PcInstance player, final L2Npc npc, final Location pos, final long cost) { + if (player.reduceAdena("Broadcast", cost, npc, true)) { // enter mode player.enterObserverMode(pos); player.sendPacket(new ItemList(player, false)); @@ -169,8 +151,7 @@ public class Observation implements IBypassHandler } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/OlympiadManagerLink.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/OlympiadManagerLink.java index 86c8cb27d8..2e36338598 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/OlympiadManagerLink.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/OlympiadManagerLink.java @@ -50,10 +50,8 @@ import com.l2jserver.gameserver.util.Util; /** * @author DS */ -public class OlympiadManagerLink implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class OlympiadManagerLink implements IBypassHandler { + private static final String[] COMMANDS = { "olympiaddesc", "olympiadnoble", "olybuff", @@ -64,8 +62,7 @@ public class OlympiadManagerLink implements IBypassHandler private static final String MORE_THAN = "More than " + String.valueOf(olympiad().getRegistrationDisplayNumber()); private static final int GATE_PASS = olympiad().getCompetitionRewardItem(); - private static final int[] BUFFS = - { + private static final int[] BUFFS = { 4357, // Haste Lv2 4342, // Wind Walk Lv2 4356, // Empower Lv3 @@ -79,39 +76,30 @@ public class OlympiadManagerLink implements IBypassHandler }; @Override - public final boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { - if (!(target instanceof L2OlympiadManagerInstance)) - { + public final boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { + if (!(target instanceof L2OlympiadManagerInstance)) { return false; } - try - { - if (command.toLowerCase().startsWith("olympiaddesc")) - { + try { + if (command.toLowerCase().startsWith("olympiaddesc")) { int val = Integer.parseInt(command.substring(13, 14)); String suffix = command.substring(14); ((L2OlympiadManagerInstance) target).showChatWindow(activeChar, val, suffix); - } - else if (command.toLowerCase().startsWith("olympiadnoble")) - { + } else if (command.toLowerCase().startsWith("olympiadnoble")) { final NpcHtmlMessage html = new NpcHtmlMessage(target.getObjectId()); - if (activeChar.isCursedWeaponEquipped()) - { + if (activeChar.isCursedWeaponEquipped()) { html.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "noble_cursed_weapon.htm"); activeChar.sendPacket(html); return false; } - if (activeChar.getClassIndex() != 0) - { + if (activeChar.getClassIndex() != 0) { html.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "noble_sub.htm"); html.replace("%objectId%", String.valueOf(target.getObjectId())); activeChar.sendPacket(html); return false; } - if (!activeChar.isNoble() || (activeChar.getClassId().level() < 3)) - { + if (!activeChar.isNoble() || (activeChar.getClassId().level() < 3)) { html.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "noble_thirdclass.htm"); html.replace("%objectId%", String.valueOf(target.getObjectId())); activeChar.sendPacket(html); @@ -120,20 +108,16 @@ public class OlympiadManagerLink implements IBypassHandler int passes; int val = Integer.parseInt(command.substring(14)); - switch (val) - { + switch (val) { case 0: // H5 match selection - if (!OlympiadManager.getInstance().isRegistered(activeChar)) - { + if (!OlympiadManager.getInstance().isRegistered(activeChar)) { html.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "noble_desc2a.htm"); html.replace("%objectId%", String.valueOf(target.getObjectId())); html.replace("%olympiad_period%", String.valueOf(Olympiad.getInstance().getPeriod())); html.replace("%olympiad_cycle%", String.valueOf(Olympiad.getInstance().getCurrentCycle())); html.replace("%olympiad_opponent%", String.valueOf(OlympiadManager.getInstance().getCountOpponents())); activeChar.sendPacket(html); - } - else - { + } else { html.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "noble_unregister.htm"); html.replace("%objectId%", String.valueOf(target.getObjectId())); activeChar.sendPacket(html); @@ -147,25 +131,19 @@ public class OlympiadManagerLink implements IBypassHandler final int teams = OlympiadManager.getInstance().getRegisteredTeamsBased().size(); final Collection<List<Integer>> allClassed = OlympiadManager.getInstance().getRegisteredClassBased().values(); int classed = 0; - if (!allClassed.isEmpty()) - { - for (List<Integer> cls : allClassed) - { - if (cls != null) - { + if (!allClassed.isEmpty()) { + for (List<Integer> cls : allClassed) { + if (cls != null) { classed += cls.size(); } } } html.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "noble_registered.htm"); - if (olympiad().getRegistrationDisplayNumber() > 0) - { + if (olympiad().getRegistrationDisplayNumber() > 0) { html.replace("%listClassed%", classed < olympiad().getRegistrationDisplayNumber() ? FEWER_THAN : MORE_THAN); html.replace("%listNonClassedTeam%", teams < olympiad().getRegistrationDisplayNumber() ? FEWER_THAN : MORE_THAN); html.replace("%listNonClassed%", nonClassed < olympiad().getRegistrationDisplayNumber() ? FEWER_THAN : MORE_THAN); - } - else - { + } else { html.replace("%listClassed%", String.valueOf(classed)); html.replace("%listNonClassedTeam%", String.valueOf(teams)); html.replace("%listNonClassed%", String.valueOf(nonClassed)); @@ -188,14 +166,11 @@ public class OlympiadManagerLink implements IBypassHandler break; case 6: // request tokens reward passes = Olympiad.getInstance().getNoblessePasses(activeChar, false); - if (passes > 0) - { + if (passes > 0) { html.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "noble_settle.htm"); html.replace("%objectId%", String.valueOf(target.getObjectId())); activeChar.sendPacket(html); - } - else - { + } else { html.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "noble_nopoints2.htm"); html.replace("%objectId%", String.valueOf(target.getObjectId())); activeChar.sendPacket(html); @@ -216,8 +191,7 @@ public class OlympiadManagerLink implements IBypassHandler break; case 10: // give tokens to player passes = Olympiad.getInstance().getNoblessePasses(activeChar, true); - if (passes > 0) - { + if (passes > 0) { L2ItemInstance item = activeChar.getInventory().addItem("Olympiad", GATE_PASS, passes, activeChar, target); InventoryUpdate iu = new InventoryUpdate(); @@ -237,43 +211,35 @@ public class OlympiadManagerLink implements IBypassHandler _log.warning("Olympiad System: Couldnt send packet for request " + val); break; } - } - else if (command.toLowerCase().startsWith("olybuff")) - { + } else if (command.toLowerCase().startsWith("olybuff")) { int buffCount = activeChar.getOlympiadBuffCount(); - if (buffCount <= 0) - { + if (buffCount <= 0) { return false; } final NpcHtmlMessage html = new NpcHtmlMessage(target.getObjectId()); String[] params = command.split(" "); - if (!Util.isDigit(params[1])) - { + if (!Util.isDigit(params[1])) { _log.warning("Olympiad Buffer Warning: npcId = " + target.getId() + " has invalid buffGroup set in the bypass for the buff selected: " + params[1]); return false; } final int index = Integer.parseInt(params[1]); - if ((index < 0) || (index > BUFFS.length)) - { + if ((index < 0) || (index > BUFFS.length)) { _log.warning("Olympiad Buffer Warning: npcId = " + target.getId() + " has invalid index sent in the bypass: " + index); return false; } final NpcBufferData npcBuffGroupInfo = NpcBufferTable.getInstance().getSkillInfo(target.getId(), BUFFS[index]); - if (npcBuffGroupInfo == null) - { + if (npcBuffGroupInfo == null) { _log.warning("Olympiad Buffer Warning: npcId = " + target.getId() + " Location: " + target.getX() + ", " + target.getY() + ", " + target.getZ() + " Player: " + activeChar.getName() + " has tried to use skill group (" + params[1] + ") not assigned to the NPC Buffer!"); return false; } - if (buffCount > 0) - { + if (buffCount > 0) { final Skill skill = npcBuffGroupInfo.getSkill().getSkill(); - if (skill != null) - { + if (skill != null) { target.setTarget(activeChar); activeChar.setOlympiadBuffCount(--buffCount); @@ -281,57 +247,46 @@ public class OlympiadManagerLink implements IBypassHandler target.broadcastPacket(new MagicSkillUse(target, activeChar, skill.getId(), skill.getLevel(), 0, 0)); skill.applyEffects(activeChar, activeChar); final L2Summon summon = activeChar.getSummon(); - if (summon != null) - { + if (summon != null) { target.broadcastPacket(new MagicSkillUse(target, summon, skill.getId(), skill.getLevel(), 0, 0)); skill.applyEffects(summon, summon); } } } - if (buffCount > 0) - { + if (buffCount > 0) { html.setFile(activeChar.getHtmlPrefix(), buffCount == olympiad().getMaxBuffs() ? Olympiad.OLYMPIAD_HTML_PATH + "olympiad_buffs.htm" : Olympiad.OLYMPIAD_HTML_PATH + "olympiad_5buffs.htm"); html.replace("%objectId%", String.valueOf(target.getObjectId())); activeChar.sendPacket(html); - } - else - { + } else { html.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "olympiad_nobuffs.htm"); html.replace("%objectId%", String.valueOf(target.getObjectId())); activeChar.sendPacket(html); target.decayMe(); } - } - else if (command.toLowerCase().startsWith("olympiad")) - { + } else if (command.toLowerCase().startsWith("olympiad")) { int val = Integer.parseInt(command.substring(9, 10)); final NpcHtmlMessage reply = new NpcHtmlMessage(target.getObjectId()); - switch (val) - { + switch (val) { case 2: // show rank for a specific class // for example >> Olympiad 1_88 int classId = Integer.parseInt(command.substring(11)); - if (((classId >= 88) && (classId <= 118)) || ((classId >= 131) && (classId <= 134)) || (classId == 136)) - { + if (((classId >= 88) && (classId <= 118)) || ((classId >= 131) && (classId <= 134)) || (classId == 136)) { List<String> names = Olympiad.getInstance().getClassLeaderBoard(classId); reply.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "olympiad_ranking.htm"); int index = 1; - for (String name : names) - { + for (String name : names) { reply.replace("%place" + index + "%", String.valueOf(index)); reply.replace("%rank" + index + "%", name); index++; - if (index > 10) - { + if (index > 10) { break; } } - for (; index <= 10; index++) - { + for (; index <= 10; index++) { reply.replace("%place" + index + "%", ""); reply.replace("%rank" + index + "%", ""); } @@ -344,13 +299,10 @@ public class OlympiadManagerLink implements IBypassHandler activeChar.sendPacket(new ExHeroList()); break; case 5: // Hero Certification - if (Hero.getInstance().isUnclaimedHero(activeChar.getObjectId())) - { + if (Hero.getInstance().isUnclaimedHero(activeChar.getObjectId())) { Hero.getInstance().claimHero(activeChar); reply.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "hero_receive.htm"); - } - else - { + } else { reply.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "hero_notreceive.htm"); } activeChar.sendPacket(reply); @@ -360,9 +312,7 @@ public class OlympiadManagerLink implements IBypassHandler break; } } - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, "Exception in " + getClass().getSimpleName(), e); } @@ -370,8 +320,7 @@ public class OlympiadManagerLink implements IBypassHandler } @Override - public final String[] getBypassList() - { + public final String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/OlympiadObservation.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/OlympiadObservation.java index 803b3a43e5..7ed28d59d4 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/OlympiadObservation.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/OlympiadObservation.java @@ -35,82 +35,66 @@ import com.l2jserver.gameserver.network.serverpackets.ExOlympiadMatchList; /** * @author DS */ -public class OlympiadObservation implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class OlympiadObservation implements IBypassHandler { + private static final String[] COMMANDS = { "watchmatch", "arenachange" }; @Override - public final boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { - try - { + public final boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { + try { final L2Npc olymanager = activeChar.getLastFolkNPC(); if (command.startsWith(COMMANDS[0])) // list { - if (!Olympiad.getInstance().inCompPeriod()) - { + if (!Olympiad.getInstance().inCompPeriod()) { activeChar.sendPacket(SystemMessageId.THE_OLYMPIAD_GAME_IS_NOT_CURRENTLY_IN_PROGRESS); return false; } activeChar.sendPacket(new ExOlympiadMatchList()); - } - else - { - if ((olymanager == null) || !(olymanager instanceof L2OlympiadManagerInstance)) - { + } else { + if ((olymanager == null) || !(olymanager instanceof L2OlympiadManagerInstance)) { return false; } - if (!activeChar.inObserverMode() && !activeChar.isInsideRadius(olymanager, 300, false, false)) - { + if (!activeChar.inObserverMode() && !activeChar.isInsideRadius(olymanager, 300, false, false)) { return false; } - if (OlympiadManager.getInstance().isRegisteredInComp(activeChar)) - { + if (OlympiadManager.getInstance().isRegisteredInComp(activeChar)) { activeChar.sendPacket(SystemMessageId.WHILE_YOU_ARE_ON_THE_WAITING_LIST_YOU_ARE_NOT_ALLOWED_TO_WATCH_THE_GAME); return false; } - if (!Olympiad.getInstance().inCompPeriod()) - { + if (!Olympiad.getInstance().inCompPeriod()) { activeChar.sendPacket(SystemMessageId.THE_OLYMPIAD_GAME_IS_NOT_CURRENTLY_IN_PROGRESS); return false; } - if (activeChar.isOnEvent()) - { + if (activeChar.isOnEvent()) { activeChar.sendMessage("You can not observe games while registered on an event"); return false; } final int arenaId = Integer.parseInt(command.substring(12).trim()); final OlympiadGameTask nextArena = OlympiadGameManager.getInstance().getOlympiadTask(arenaId); - if (nextArena != null) - { + if (nextArena != null) { activeChar.enterOlympiadObserverMode(nextArena.getZone().getSpectatorSpawns().get(0), arenaId); activeChar.setInstanceId(OlympiadGameManager.getInstance().getOlympiadTask(arenaId).getZone().getInstanceId()); } } return true; - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, "Exception in " + getClass().getSimpleName(), e); } return false; } @Override - public final String[] getBypassList() - { + public final String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/PlayerHelp.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/PlayerHelp.java index 879cea16d5..abde136655 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/PlayerHelp.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/PlayerHelp.java @@ -26,26 +26,20 @@ import com.l2jserver.gameserver.model.actor.L2Character; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; -public class PlayerHelp implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class PlayerHelp implements IBypassHandler { + private static final String[] COMMANDS = { "player_help" }; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { - try - { - if (command.length() < 13) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { + try { + if (command.length() < 13) { return false; } final String path = command.substring(12); - if (path.indexOf("..") != -1) - { + if (path.indexOf("..") != -1) { return false; } @@ -53,29 +47,23 @@ public class PlayerHelp implements IBypassHandler final String[] cmd = st.nextToken().split("#"); final NpcHtmlMessage html; - if (cmd.length > 1) - { + if (cmd.length > 1) { final int itemId = Integer.parseInt(cmd[1]); html = new NpcHtmlMessage(0, itemId); - } - else - { + } else { html = new NpcHtmlMessage(); } html.setFile(activeChar.getHtmlPrefix(), "data/html/help/" + cmd[0]); activeChar.sendPacket(html); - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, "Exception in " + getClass().getSimpleName(), e); } return true; } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/PrivateWarehouse.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/PrivateWarehouse.java index 9ae8908f09..3728dfc8e8 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/PrivateWarehouse.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/PrivateWarehouse.java @@ -35,64 +35,48 @@ import com.l2jserver.gameserver.network.serverpackets.SortedWareHouseWithdrawalL import com.l2jserver.gameserver.network.serverpackets.WareHouseDepositList; import com.l2jserver.gameserver.network.serverpackets.WareHouseWithdrawalList; -public class PrivateWarehouse implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class PrivateWarehouse implements IBypassHandler { + private static final String[] COMMANDS = { "withdrawp", "withdrawsortedp", "depositp" }; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { - if (!target.isNpc()) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { + if (!target.isNpc()) { return false; } - if (activeChar.isEnchanting()) - { + if (activeChar.isEnchanting()) { return false; } - try - { + try { if (command.toLowerCase().startsWith(COMMANDS[0])) // WithdrawP { - if (customs().enableWarehouseSortingPrivate()) - { + if (customs().enableWarehouseSortingPrivate()) { final NpcHtmlMessage msg = new NpcHtmlMessage(((L2Npc) target).getObjectId()); msg.setFile(activeChar.getHtmlPrefix(), "data/html/mods/WhSortedP.htm"); msg.replace("%objectId%", String.valueOf(((L2Npc) target).getObjectId())); activeChar.sendPacket(msg); - } - else - { + } else { showWithdrawWindow(activeChar, null, (byte) 0); } return true; - } - else if (command.toLowerCase().startsWith(COMMANDS[1])) // WithdrawSortedP + } else if (command.toLowerCase().startsWith(COMMANDS[1])) // WithdrawSortedP { final String param[] = command.split(" "); - if (param.length > 2) - { + if (param.length > 2) { showWithdrawWindow(activeChar, WarehouseListType.valueOf(param[1]), SortedWareHouseWithdrawalList.getOrder(param[2])); - } - else if (param.length > 1) - { + } else if (param.length > 1) { showWithdrawWindow(activeChar, WarehouseListType.valueOf(param[1]), SortedWareHouseWithdrawalList.A2Z); - } - else - { + } else { showWithdrawWindow(activeChar, WarehouseListType.ALL, SortedWareHouseWithdrawalList.A2Z); } return true; - } - else if (command.toLowerCase().startsWith(COMMANDS[2])) // DepositP + } else if (command.toLowerCase().startsWith(COMMANDS[2])) // DepositP { activeChar.sendPacket(ActionFailed.STATIC_PACKET); activeChar.setActiveWarehouse(activeChar.getWarehouse()); @@ -102,43 +86,34 @@ public class PrivateWarehouse implements IBypassHandler } return false; - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, "Exception in " + getClass().getSimpleName(), e); } return false; } - private static final void showWithdrawWindow(L2PcInstance player, WarehouseListType itemtype, byte sortorder) - { + private static final void showWithdrawWindow(L2PcInstance player, WarehouseListType itemtype, byte sortorder) { player.sendPacket(ActionFailed.STATIC_PACKET); player.setActiveWarehouse(player.getWarehouse()); - if (player.getActiveWarehouse().getSize() == 0) - { + if (player.getActiveWarehouse().getSize() == 0) { player.sendPacket(SystemMessageId.NO_ITEM_DEPOSITED_IN_WH); return; } - if (itemtype != null) - { + if (itemtype != null) { player.sendPacket(new SortedWareHouseWithdrawalList(player, WareHouseWithdrawalList.PRIVATE, itemtype, sortorder)); - } - else - { + } else { player.sendPacket(new WareHouseWithdrawalList(player, WareHouseWithdrawalList.PRIVATE)); } - if (general().debug()) - { + if (general().debug()) { _log.fine("Source: L2WarehouseInstance.java; Player: " + player.getName() + "; Command: showRetrieveWindow; Message: Showing stored items."); } } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/QuestLink.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/QuestLink.java index 8a741274bc..0fe3c71507 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/QuestLink.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/QuestLink.java @@ -41,40 +41,28 @@ import com.l2jserver.gameserver.network.serverpackets.ActionFailed; import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; import com.l2jserver.gameserver.util.StringUtil; -public class QuestLink implements IBypassHandler -{ +public class QuestLink implements IBypassHandler { private static final int MAX_QUEST_COUNT = 40; private static final int TO_LEAD_AND_BE_LED = 118; private static final int THE_LEADER_AND_THE_FOLLOWER = 123; - private static final String[] COMMANDS = - { + private static final String[] COMMANDS = { "Quest" }; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { String quest = ""; - try - { + try { quest = command.substring(5).trim(); + } catch (IndexOutOfBoundsException ioobe) { } - catch (IndexOutOfBoundsException ioobe) - { - } - if (quest.length() == 0) - { + if (quest.length() == 0) { showQuestWindow(activeChar, (L2Npc) target); - } - else - { + } else { int questNameEnd = quest.indexOf(" "); - if (questNameEnd == -1) - { + if (questNameEnd == -1) { showQuestWindow(activeChar, (L2Npc) target, quest); - } - else - { + } else { activeChar.processQuestEvent(quest.substring(0, questNameEnd), quest.substring(questNameEnd).trim()); } } @@ -89,76 +77,56 @@ public class QuestLink implements IBypassHandler * @param npc The table containing quests of the L2NpcInstance * @param quests the quest available */ - private static void showQuestChooseWindow(L2PcInstance player, L2Npc npc, Quest[] quests) - { + private static void showQuestChooseWindow(L2PcInstance player, L2Npc npc, Quest[] quests) { final StringBuilder sb = StringUtil.startAppend(150, "<html><body>"); String state = ""; String color = ""; int questId = -1; - for (Quest quest : quests) - { - if (quest == null) - { + for (Quest quest : quests) { + if (quest == null) { continue; } final QuestState qs = player.getQuestState(quest.getName()); - if ((qs == null) || qs.isCreated()) - { + if ((qs == null) || qs.isCreated()) { state = quest.isCustomQuest() ? "" : "01"; - if (quest.canStartQuest(player)) - { + if (quest.canStartQuest(player)) { color = "bbaa88"; - } - else - { + } else { color = "a62f31"; } - } - else if (qs.isStarted()) - { + } else if (qs.isStarted()) { state = quest.isCustomQuest() ? " (In Progress)" : "02"; color = "ffdd66"; - } - else if (qs.isCompleted()) - { + } else if (qs.isCompleted()) { state = quest.isCustomQuest() ? " (Done)" : "03"; color = "787878"; } StringUtil.append(sb, "<a action=\"bypass -h npc_", String.valueOf(npc.getObjectId()), "_Quest ", quest.getName(), "\">"); StringUtil.append(sb, "<font color=\"" + color + "\">["); - if (quest.isCustomQuest()) - { + if (quest.isCustomQuest()) { StringUtil.append(sb, quest.getDescr(), state); - } - else - { + } else { questId = quest.getId(); - if (questId > 10000) - { + if (questId > 10000) { questId -= 5000; - } - else if (questId == 146) - { + } else if (questId == 146) { questId = 640; } StringUtil.append(sb, "<fstring>", String.valueOf(questId), state, "</fstring>"); } sb.append("]</font></a><br>"); - if ((player.getApprentice() > 0) && (L2World.getInstance().getPlayer(player.getApprentice()) != null)) - { - if (questId == TO_LEAD_AND_BE_LED) - { + if ((player.getApprentice() > 0) && (L2World.getInstance().getPlayer(player.getApprentice()) != null)) { + if (questId == TO_LEAD_AND_BE_LED) { sb.append("<a action=\"bypass -h Quest Q00118_ToLeadAndBeLed sponsor\"><font color=\"").append(color) // - .append("\">[<fstring>").append(questId).append(state).append("</fstring> (Sponsor)]</font></a><br>"); + .append("\">[<fstring>").append(questId).append(state).append("</fstring> (Sponsor)]</font></a><br>"); } - if (questId == THE_LEADER_AND_THE_FOLLOWER) - { + if (questId == THE_LEADER_AND_THE_FOLLOWER) { sb.append("<a action=\"bypass -h Quest Q00123_TheLeaderAndTheFollower sponsor\"><font color=\"").append(color) // - .append("\">[<fstring>").append(questId).append(state).append("</fstring> (Sponsor)]</font></a><br>"); + .append("\">[<fstring>").append(questId).append(state).append("</fstring> (Sponsor)]</font></a><br>"); } } } @@ -180,8 +148,7 @@ public class QuestLink implements IBypassHandler * @param npc the L2NpcInstance that chats with the {@code player} * @param questId the Id of the quest to display the message */ - private static void showQuestWindow(L2PcInstance player, L2Npc npc, String questId) - { + private static void showQuestWindow(L2PcInstance player, L2Npc npc, String questId) { String content = null; final Quest q = QuestManager.getInstance().getQuest(questId); @@ -189,21 +156,16 @@ public class QuestLink implements IBypassHandler // Get the state of the selected quest final QuestState qs = player.getQuestState(questId); - if (q != null) - { - if (((q.getId() >= 1) && (q.getId() < 20000)) && ((player.getWeightPenalty() >= 3) || !player.isInventoryUnder90(true))) - { + if (q != null) { + if (((q.getId() >= 1) && (q.getId() < 20000)) && ((player.getWeightPenalty() >= 3) || !player.isInventoryUnder90(true))) { player.sendPacket(SystemMessageId.INVENTORY_LESS_THAN_80_PERCENT); return; } - if (qs == null) - { - if ((q.getId() >= 1) && (q.getId() < 20000)) - { + if (qs == null) { + if ((q.getId() >= 1) && (q.getId() < 20000)) { // Too many ongoing quests. - if (player.getAllActiveQuests().size() >= MAX_QUEST_COUNT) - { + if (player.getAllActiveQuests().size() >= MAX_QUEST_COUNT) { final NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId()); html.setFile(player.getHtmlPrefix(), "data/html/fullquest.html"); player.sendPacket(html); @@ -213,15 +175,12 @@ public class QuestLink implements IBypassHandler } q.notifyTalk(npc, player); - } - else - { + } else { content = Quest.getNoQuestMsg(player); // no quests found } // Send a Server->Client packet NpcHtmlMessage to the L2PcInstance in order to display the message of the L2NpcInstance - if (content != null) - { + if (content != null) { npc.insertObjectIdAndShowChatWindow(player, content); } @@ -234,30 +193,24 @@ public class QuestLink implements IBypassHandler * @param npcId The Identifier of the NPC * @return a table containing all QuestState from the table _quests in which the L2PcInstance must talk to the NPC. */ - private static List<QuestState> getQuestsForTalk(L2PcInstance player, int npcId) - { + private static List<QuestState> getQuestsForTalk(L2PcInstance player, int npcId) { // Create a QuestState table that will contain all QuestState to modify final List<QuestState> states = new ArrayList<>(); final L2NpcTemplate template = NpcData.getInstance().getTemplate(npcId); - if (template == null) - { + if (template == null) { _log.log(Level.WARNING, QuestLink.class.getSimpleName() + ": " + player.getName() + " requested quests for talk on non existing npc " + npcId); return states; } // Go through the QuestState of the L2PcInstance quests - for (AbstractEventListener listener : template.getListeners(EventType.ON_NPC_TALK)) - { - if (listener.getOwner() instanceof Quest) - { + for (AbstractEventListener listener : template.getListeners(EventType.ON_NPC_TALK)) { + if (listener.getOwner() instanceof Quest) { final Quest quest = (Quest) listener.getOwner(); - if (quest.isVisibleInQuestWindow()) - { + if (quest.isVisibleInQuestWindow()) { // Copy the current L2PcInstance QuestState in the QuestState table final QuestState st = player.getQuestState(quest.getName()); - if (st != null) - { + if (st != null) { states.add(st); } } @@ -273,40 +226,30 @@ public class QuestLink implements IBypassHandler * @param player the L2PcInstance that talk with the {@code npc}. * @param npc the L2NpcInstance that chats with the {@code player}. */ - public static void showQuestWindow(L2PcInstance player, L2Npc npc) - { + public static void showQuestWindow(L2PcInstance player, L2Npc npc) { boolean conditionMeet = false; final Set<Quest> options = new HashSet<>(); - for (QuestState state : getQuestsForTalk(player, npc.getId())) - { + for (QuestState state : getQuestsForTalk(player, npc.getId())) { final Quest quest = state.getQuest(); - if (quest == null) - { + if (quest == null) { _log.log(Level.WARNING, player + " Requested incorrect quest state for non existing quest: " + state.getQuestName()); continue; } - if ((quest.getId() > 0) && (quest.getId() < 20000)) - { + if ((quest.getId() > 0) && (quest.getId() < 20000)) { options.add(quest); - if (quest.canStartQuest(player)) - { + if (quest.canStartQuest(player)) { conditionMeet = true; } } } - for (AbstractEventListener listener : npc.getListeners(EventType.ON_NPC_QUEST_START)) - { - if (listener.getOwner() instanceof Quest) - { + for (AbstractEventListener listener : npc.getListeners(EventType.ON_NPC_QUEST_START)) { + if (listener.getOwner() instanceof Quest) { final Quest quest = (Quest) listener.getOwner(); - if (quest.isVisibleInQuestWindow()) - { - if ((quest.getId() > 0) && (quest.getId() < 20000)) - { + if (quest.isVisibleInQuestWindow()) { + if ((quest.getId() > 0) && (quest.getId() < 20000)) { options.add(quest); - if (quest.canStartQuest(player)) - { + if (quest.canStartQuest(player)) { conditionMeet = true; } } @@ -314,27 +257,19 @@ public class QuestLink implements IBypassHandler } } - if (!conditionMeet) - { + if (!conditionMeet) { showQuestWindow(player, npc, ""); - } - else if ((options.size() > 1) || ((player.getApprentice() > 0) && (L2World.getInstance().getPlayer(player.getApprentice()) != null) && options.stream().anyMatch(q -> q.getId() == TO_LEAD_AND_BE_LED))) - { + } else if ((options.size() > 1) || ((player.getApprentice() > 0) && (L2World.getInstance().getPlayer(player.getApprentice()) != null) && options.stream().anyMatch(q -> q.getId() == TO_LEAD_AND_BE_LED))) { showQuestChooseWindow(player, npc, options.toArray(new Quest[options.size()])); - } - else if (options.size() == 1) - { + } else if (options.size() == 1) { showQuestWindow(player, npc, options.stream().findFirst().get().getName()); - } - else - { + } else { showQuestWindow(player, npc, ""); } } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/QuestList.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/QuestList.java index 7723966759..98c77d8f44 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/QuestList.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/QuestList.java @@ -24,18 +24,14 @@ import com.l2jserver.gameserver.model.actor.instance.L2AdventurerInstance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.serverpackets.ExShowQuestInfo; -public class QuestList implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class QuestList implements IBypassHandler { + private static final String[] COMMANDS = { "questlist" }; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { - if (!(target instanceof L2AdventurerInstance)) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { + if (!(target instanceof L2AdventurerInstance)) { return false; } @@ -44,8 +40,7 @@ public class QuestList implements IBypassHandler } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/ReceivePremium.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/ReceivePremium.java index a5da55952e..63bd47665a 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/ReceivePremium.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/ReceivePremium.java @@ -24,23 +24,18 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.ExGetPremiumItemList; -public class ReceivePremium implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class ReceivePremium implements IBypassHandler { + private static final String[] COMMANDS = { "ReceivePremium" }; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { - if (!target.isNpc()) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { + if (!target.isNpc()) { return false; } - if (activeChar.getPremiumItemList().isEmpty()) - { + if (activeChar.getPremiumItemList().isEmpty()) { activeChar.sendPacket(SystemMessageId.THERE_ARE_NO_MORE_VITAMIN_ITEMS_TO_BE_FOUND); return false; } @@ -51,8 +46,7 @@ public class ReceivePremium implements IBypassHandler } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/ReleaseAttribute.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/ReleaseAttribute.java index aca2bca91a..e700198d21 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/ReleaseAttribute.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/ReleaseAttribute.java @@ -23,18 +23,14 @@ import com.l2jserver.gameserver.model.actor.L2Character; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.serverpackets.ExShowBaseAttributeCancelWindow; -public class ReleaseAttribute implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class ReleaseAttribute implements IBypassHandler { + private static final String[] COMMANDS = { "ReleaseAttribute" }; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { - if (!target.isNpc()) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { + if (!target.isNpc()) { return false; } @@ -43,8 +39,7 @@ public class ReleaseAttribute implements IBypassHandler } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/RentPet.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/RentPet.java index 57ac3ade8d..e1810fea4c 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/RentPet.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/RentPet.java @@ -31,106 +31,88 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; import com.l2jserver.gameserver.network.serverpackets.SetupGauge; -public class RentPet implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class RentPet implements IBypassHandler { + private static final String[] COMMANDS = { "RentPet" }; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { - if (!(target instanceof L2MerchantInstance)) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { + if (!(target instanceof L2MerchantInstance)) { return false; } - if (!general().allowRentPet()) - { + if (!general().allowRentPet()) { return false; } - if (!npc().getPetRentNPCs().contains(target.getId())) - { + if (!npc().getPetRentNPCs().contains(target.getId())) { return false; } - try - { + try { StringTokenizer st = new StringTokenizer(command, " "); st.nextToken(); - if (st.countTokens() < 1) - { + if (st.countTokens() < 1) { final NpcHtmlMessage msg = new NpcHtmlMessage(((L2Npc) target).getObjectId()); - msg.setHtml("<html><body>Pet Manager:<br>" + "You can rent a wyvern or strider for adena.<br>My prices:<br1>" + "<table border=0><tr><td>Ride</td></tr>" + "<tr><td>Wyvern</td><td>Strider</td></tr>" + "<tr><td><a action=\"bypass -h npc_%objectId%_RentPet 1\">30 sec/1800 adena</a></td><td><a action=\"bypass -h npc_%objectId%_RentPet 11\">30 sec/900 adena</a></td></tr>" + "<tr><td><a action=\"bypass -h npc_%objectId%_RentPet 2\">1 min/7200 adena</a></td><td><a action=\"bypass -h npc_%objectId%_RentPet 12\">1 min/3600 adena</a></td></tr>" + "<tr><td><a action=\"bypass -h npc_%objectId%_RentPet 3\">10 min/720000 adena</a></td><td><a action=\"bypass -h npc_%objectId%_RentPet 13\">10 min/360000 adena</a></td></tr>" + "<tr><td><a action=\"bypass -h npc_%objectId%_RentPet 4\">30 min/6480000 adena</a></td><td><a action=\"bypass -h npc_%objectId%_RentPet 14\">30 min/3240000 adena</a></td></tr>" + "</table>" + "</body></html>"); + msg.setHtml("<html><body>Pet Manager:<br>" + "You can rent a wyvern or strider for adena.<br>My prices:<br1>" + "<table border=0><tr><td>Ride</td></tr>" + "<tr><td>Wyvern</td><td>Strider</td></tr>" + + "<tr><td><a action=\"bypass -h npc_%objectId%_RentPet 1\">30 sec/1800 adena</a></td><td><a action=\"bypass -h npc_%objectId%_RentPet 11\">30 sec/900 adena</a></td></tr>" + + "<tr><td><a action=\"bypass -h npc_%objectId%_RentPet 2\">1 min/7200 adena</a></td><td><a action=\"bypass -h npc_%objectId%_RentPet 12\">1 min/3600 adena</a></td></tr>" + + "<tr><td><a action=\"bypass -h npc_%objectId%_RentPet 3\">10 min/720000 adena</a></td><td><a action=\"bypass -h npc_%objectId%_RentPet 13\">10 min/360000 adena</a></td></tr>" + + "<tr><td><a action=\"bypass -h npc_%objectId%_RentPet 4\">30 min/6480000 adena</a></td><td><a action=\"bypass -h npc_%objectId%_RentPet 14\">30 min/3240000 adena</a></td></tr>" + "</table>" + "</body></html>"); msg.replace("%objectId%", String.valueOf(((L2Npc) target).getObjectId())); activeChar.sendPacket(msg); - } - else - { + } else { tryRentPet(activeChar, Integer.parseInt(st.nextToken())); } return true; - } - catch (Exception e) - { + } catch (Exception e) { _log.info("Exception in " + getClass().getSimpleName()); } return false; } - public static final void tryRentPet(L2PcInstance player, int val) - { - if ((player == null) || player.hasSummon() || player.isMounted() || player.isRentedPet() || player.isTransformed() || player.isCursedWeaponEquipped()) - { + public static final void tryRentPet(L2PcInstance player, int val) { + if ((player == null) || player.hasSummon() || player.isMounted() || player.isRentedPet() || player.isTransformed() || player.isCursedWeaponEquipped()) { return; } - if (!player.disarmWeapons()) - { + if (!player.disarmWeapons()) { return; } int petId; double price = 1; - int cost[] = - { + int cost[] = { 1800, 7200, 720000, 6480000 }; - int ridetime[] = - { + int ridetime[] = { 30, 60, 600, 1800 }; - if (val > 10) - { + if (val > 10) { petId = 12526; val -= 10; price /= 2; - } - else - { + } else { petId = 12621; } - if ((val < 1) || (val > 4)) - { + if ((val < 1) || (val > 4)) { return; } price *= cost[val - 1]; int time = ridetime[val - 1]; - if (!player.reduceAdena("Rent", (long) price, player.getLastFolkNPC(), true)) - { + if (!player.reduceAdena("Rent", (long) price, player.getLastFolkNPC(), true)) { return; } @@ -141,8 +123,7 @@ public class RentPet implements IBypassHandler } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Rift.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Rift.java index a0e56bf453..0b59dc845c 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Rift.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Rift.java @@ -26,61 +26,45 @@ import com.l2jserver.gameserver.model.actor.L2Character; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -public class Rift implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class Rift implements IBypassHandler { + private static final String[] COMMANDS = { "enterrift", "changeriftroom", "exitrift" }; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { - if (!target.isNpc()) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { + if (!target.isNpc()) { return false; } if (command.toLowerCase().startsWith(COMMANDS[0])) // EnterRift { - try - { + try { Byte b1 = Byte.parseByte(command.substring(10)); // Selected Area: Recruit, Soldier etc DimensionalRiftManager.getInstance().start(activeChar, b1, (L2Npc) target); return true; - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, "Exception in " + getClass().getSimpleName(), e); } - } - else - { + } else { final boolean inRift = activeChar.isInParty() && activeChar.getParty().isInDimensionalRift(); if (command.toLowerCase().startsWith(COMMANDS[1])) // ChangeRiftRoom { - if (inRift) - { + if (inRift) { activeChar.getParty().getDimensionalRift().manualTeleport(activeChar, (L2Npc) target); - } - else - { + } else { DimensionalRiftManager.getInstance().handleCheat(activeChar, (L2Npc) target); } return true; - } - else if (command.toLowerCase().startsWith(COMMANDS[2])) // ExitRift + } else if (command.toLowerCase().startsWith(COMMANDS[2])) // ExitRift { - if (inRift) - { + if (inRift) { activeChar.getParty().getDimensionalRift().manualExitRift(activeChar, (L2Npc) target); - } - else - { + } else { DimensionalRiftManager.getInstance().handleCheat(activeChar, (L2Npc) target); } @@ -91,8 +75,7 @@ public class Rift implements IBypassHandler } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/SkillList.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/SkillList.java index 2c4f45eb0b..7fbf1d5954 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/SkillList.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/SkillList.java @@ -33,39 +33,28 @@ import com.l2jserver.gameserver.model.base.ClassId; import com.l2jserver.gameserver.network.serverpackets.ActionFailed; import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; -public class SkillList implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class SkillList implements IBypassHandler { + private static final String[] COMMANDS = { "SkillList" }; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { - if (!(target instanceof L2NpcInstance)) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { + if (!(target instanceof L2NpcInstance)) { return false; } - if (character().skillLearn()) - { - try - { + if (character().skillLearn()) { + try { String id = command.substring(9).trim(); - if (id.length() != 0) - { + if (id.length() != 0) { L2NpcInstance.showSkillList(activeChar, (L2Npc) target, ClassId.getClassId(Integer.parseInt(id))); - } - else - { + } else { boolean own_class = false; final List<ClassId> classesToTeach = ((L2NpcInstance) target).getClassesToTeach(); - for (ClassId cid : classesToTeach) - { - if (cid.equalsOrChildOf(activeChar.getClassId())) - { + for (ClassId cid : classesToTeach) { + if (cid.equalsOrChildOf(activeChar.getClassId())) { own_class = true; break; } @@ -73,29 +62,23 @@ public class SkillList implements IBypassHandler String text = "<html><body><center>Skill learning:</center><br>"; - if (!own_class) - { + if (!own_class) { String charType = activeChar.getClassId().isMage() ? "fighter" : "mage"; text += "Skills of your class are the easiest to learn.<br>" + "Skills of another class of your race are a little harder.<br>" + "Skills for classes of another race are extremely difficult.<br>" + "But the hardest of all to learn are the " + charType + "skills!<br>"; } // make a list of classes - if (!classesToTeach.isEmpty()) - { + if (!classesToTeach.isEmpty()) { int count = 0; ClassId classCheck = activeChar.getClassId(); - while ((count == 0) && (classCheck != null)) - { - for (ClassId cid : classesToTeach) - { - if (cid.level() > classCheck.level()) - { + while ((count == 0) && (classCheck != null)) { + for (ClassId cid : classesToTeach) { + if (cid.level() > classCheck.level()) { continue; } - if (SkillTreesData.getInstance().getAvailableSkills(activeChar, cid, false, false).isEmpty()) - { + if (SkillTreesData.getInstance().getAvailableSkills(activeChar, cid, false, false).isEmpty()) { continue; } @@ -105,9 +88,7 @@ public class SkillList implements IBypassHandler classCheck = classCheck.getParent(); } classCheck = null; - } - else - { + } else { text += "No Skills.<br>"; } text += "</body></html>"; @@ -119,22 +100,17 @@ public class SkillList implements IBypassHandler activeChar.sendPacket(ActionFailed.STATIC_PACKET); } - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, "Exception in " + getClass().getSimpleName(), e); } - } - else - { + } else { L2NpcInstance.showSkillList(activeChar, (L2Npc) target, activeChar.getClassId()); } return true; } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/SupportBlessing.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/SupportBlessing.java index 0ffa16aa3e..4ee57cdac8 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/SupportBlessing.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/SupportBlessing.java @@ -24,26 +24,21 @@ import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.skills.CommonSkill; -public class SupportBlessing implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class SupportBlessing implements IBypassHandler { + private static final String[] COMMANDS = { "GiveBlessing" }; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { - if (!target.isNpc()) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { + if (!target.isNpc()) { return false; } final L2Npc npc = (L2Npc) target; // If the player is too high level, display a message and return - if ((activeChar.getLevel() > 39) || (activeChar.getClassId().level() >= 2)) - { + if ((activeChar.getLevel() > 39) || (activeChar.getClassId().level() >= 2)) { npc.showChatWindow(activeChar, "data/html/default/SupportBlessingHighLevel.htm"); return true; } @@ -53,8 +48,7 @@ public class SupportBlessing implements IBypassHandler } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/SupportMagic.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/SupportMagic.java index e39d88c3b5..0f6172fa6e 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/SupportMagic.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/SupportMagic.java @@ -25,10 +25,8 @@ import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.holders.SkillHolder; -public class SupportMagic implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class SupportMagic implements IBypassHandler { + private static final String[] COMMANDS = { "supportmagicservitor", "supportmagic" }; @@ -37,8 +35,7 @@ public class SupportMagic implements IBypassHandler private static final SkillHolder HASTE_1 = new SkillHolder(4327, 1); private static final SkillHolder HASTE_2 = new SkillHolder(5632, 1); private static final SkillHolder CUBIC = new SkillHolder(4338, 1); - private static final SkillHolder[] FIGHTER_BUFFS = - { + private static final SkillHolder[] FIGHTER_BUFFS = { new SkillHolder(4322, 1), // Wind Walk new SkillHolder(4323, 1), // Shield new SkillHolder(5637, 1), // Magic Barrier @@ -46,8 +43,7 @@ public class SupportMagic implements IBypassHandler new SkillHolder(4325, 1), // Vampiric Rage new SkillHolder(4326, 1), // Regeneration }; - private static final SkillHolder[] MAGE_BUFFS = - { + private static final SkillHolder[] MAGE_BUFFS = { new SkillHolder(4322, 1), // Wind Walk new SkillHolder(4323, 1), // Shield new SkillHolder(5637, 1), // Magic Barrier @@ -56,8 +52,7 @@ public class SupportMagic implements IBypassHandler new SkillHolder(4330, 1), // Concentration new SkillHolder(4331, 1), // Empower }; - private static final SkillHolder[] SUMMON_BUFFS = - { + private static final SkillHolder[] SUMMON_BUFFS = { new SkillHolder(4322, 1), // Wind Walk new SkillHolder(4323, 1), // Shield new SkillHolder(5637, 1), // Magic Barrier @@ -78,102 +73,72 @@ public class SupportMagic implements IBypassHandler private static final int HASTE_LEVEL_2 = 40; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { - if (!target.isNpc() || activeChar.isCursedWeaponEquipped()) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { + if (!target.isNpc() || activeChar.isCursedWeaponEquipped()) { return false; } - if (command.equalsIgnoreCase(COMMANDS[0])) - { + if (command.equalsIgnoreCase(COMMANDS[0])) { makeSupportMagic(activeChar, (L2Npc) target, true); - } - else if (command.equalsIgnoreCase(COMMANDS[1])) - { + } else if (command.equalsIgnoreCase(COMMANDS[1])) { makeSupportMagic(activeChar, (L2Npc) target, false); } return true; } - private static void makeSupportMagic(L2PcInstance player, L2Npc npc, boolean isSummon) - { + private static void makeSupportMagic(L2PcInstance player, L2Npc npc, boolean isSummon) { final int level = player.getLevel(); - if (isSummon && !player.hasServitor()) - { + if (isSummon && !player.hasServitor()) { npc.showChatWindow(player, "data/html/default/SupportMagicNoSummon.htm"); return; - } - else if (level > HIGHEST_LEVEL) - { + } else if (level > HIGHEST_LEVEL) { npc.showChatWindow(player, "data/html/default/SupportMagicHighLevel.htm"); return; - } - else if (level < LOWEST_LEVEL) - { + } else if (level < LOWEST_LEVEL) { npc.showChatWindow(player, "data/html/default/SupportMagicLowLevel.htm"); return; - } - else if (player.getClassId().level() == 3) - { + } else if (player.getClassId().level() == 3) { player.sendMessage("Only adventurers who have not completed their 3rd class transfer may receive these buffs."); // Custom message return; } - if (isSummon) - { + if (isSummon) { npc.setTarget(player.getSummon()); - for (SkillHolder skill : SUMMON_BUFFS) - { + for (SkillHolder skill : SUMMON_BUFFS) { npc.doCast(skill.getSkill()); } - if (level >= HASTE_LEVEL_2) - { + if (level >= HASTE_LEVEL_2) { npc.doCast(HASTE_2.getSkill()); - } - else - { + } else { npc.doCast(HASTE_1.getSkill()); } - } - else - { + } else { npc.setTarget(player); - if (player.isInCategory(CategoryType.BEGINNER_MAGE)) - { - for (SkillHolder skill : MAGE_BUFFS) - { + if (player.isInCategory(CategoryType.BEGINNER_MAGE)) { + for (SkillHolder skill : MAGE_BUFFS) { npc.doCast(skill.getSkill()); } - } - else - { - for (SkillHolder skill : FIGHTER_BUFFS) - { + } else { + for (SkillHolder skill : FIGHTER_BUFFS) { npc.doCast(skill.getSkill()); } - if (level >= HASTE_LEVEL_2) - { + if (level >= HASTE_LEVEL_2) { npc.doCast(HASTE_2.getSkill()); - } - else - { + } else { npc.doCast(HASTE_1.getSkill()); } } - if ((level >= CUBIC_LOWEST) && (level <= CUBIC_HIGHEST)) - { + if ((level >= CUBIC_LOWEST) && (level <= CUBIC_HIGHEST)) { player.doSimultaneousCast(CUBIC.getSkill()); } } } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/TerritoryStatus.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/TerritoryStatus.java index c3998639eb..8ce7570df5 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/TerritoryStatus.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/TerritoryStatus.java @@ -26,33 +26,26 @@ import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; -public class TerritoryStatus implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class TerritoryStatus implements IBypassHandler { + private static final String[] COMMANDS = { "TerritoryStatus" }; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { - if (!target.isNpc()) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { + if (!target.isNpc()) { return false; } final L2Npc npc = (L2Npc) target; final NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId()); { - if (npc.getCastle().getOwnerId() > 0) - { + if (npc.getCastle().getOwnerId() > 0) { html.setFile(activeChar.getHtmlPrefix(), "data/html/territorystatus.htm"); L2Clan clan = ClanTable.getInstance().getClan(npc.getCastle().getOwnerId()); html.replace("%clanname%", clan.getName()); html.replace("%clanleadername%", clan.getLeaderName()); - } - else - { + } else { html.setFile(activeChar.getHtmlPrefix(), "data/html/territorynoclan.htm"); } } @@ -60,12 +53,9 @@ public class TerritoryStatus implements IBypassHandler html.replace("%taxpercent%", "" + npc.getCastle().getTaxPercent()); html.replace("%objectId%", String.valueOf(npc.getObjectId())); { - if (npc.getCastle().getResidenceId() > 6) - { + if (npc.getCastle().getResidenceId() > 6) { html.replace("%territory%", "The Kingdom of Elmore"); - } - else - { + } else { html.replace("%territory%", "The Kingdom of Aden"); } } @@ -74,8 +64,7 @@ public class TerritoryStatus implements IBypassHandler } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/TutorialClose.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/TutorialClose.java index 4b1aa880df..d69c63c7bd 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/TutorialClose.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/TutorialClose.java @@ -26,23 +26,19 @@ import com.l2jserver.gameserver.network.serverpackets.TutorialCloseHtml; /** * @author UnAfraid */ -public class TutorialClose implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class TutorialClose implements IBypassHandler { + private static final String[] COMMANDS = { "tutorial_close", }; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { activeChar.sendPacket(TutorialCloseHtml.STATIC_PACKET); return false; } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/VoiceCommand.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/VoiceCommand.java index dc94661c54..2ab48345ed 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/VoiceCommand.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/VoiceCommand.java @@ -27,37 +27,28 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; /** * @author DS */ -public class VoiceCommand implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class VoiceCommand implements IBypassHandler { + private static final String[] COMMANDS = { "voice" }; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { // only voice commands allowed - if ((command.length() > 7) && (command.charAt(6) == '.')) - { + if ((command.length() > 7) && (command.charAt(6) == '.')) { final String vc, vparams; int endOfCommand = command.indexOf(" ", 7); - if (endOfCommand > 0) - { + if (endOfCommand > 0) { vc = command.substring(7, endOfCommand).trim(); vparams = command.substring(endOfCommand).trim(); - } - else - { + } else { vc = command.substring(7).trim(); vparams = null; } - if (vc.length() > 0) - { + if (vc.length() > 0) { IVoicedCommandHandler vch = VoicedCommandHandler.getInstance().getHandler(vc); - if (vch != null) - { + if (vch != null) { return vch.useVoicedCommand(vc, activeChar, vparams); } } @@ -67,8 +58,7 @@ public class VoiceCommand implements IBypassHandler } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Wear.java b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Wear.java index 65926b9df4..3ca96a0818 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Wear.java +++ b/src/main/java/com/l2jserver/datapack/handlers/bypasshandlers/Wear.java @@ -31,51 +31,40 @@ import com.l2jserver.gameserver.model.buylist.L2BuyList; import com.l2jserver.gameserver.network.serverpackets.ActionFailed; import com.l2jserver.gameserver.network.serverpackets.ShopPreviewList; -public class Wear implements IBypassHandler -{ - private static final String[] COMMANDS = - { +public class Wear implements IBypassHandler { + private static final String[] COMMANDS = { "Wear" }; @Override - public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) - { - if (!target.isNpc()) - { + public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) { + if (!target.isNpc()) { return false; } - if (!general().allowWear()) - { + if (!general().allowWear()) { return false; } - try - { + try { StringTokenizer st = new StringTokenizer(command, " "); st.nextToken(); - if (st.countTokens() < 1) - { + if (st.countTokens() < 1) { return false; } showWearWindow(activeChar, Integer.parseInt(st.nextToken())); return true; - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, "Exception in " + getClass().getSimpleName(), e); } return false; } - private static final void showWearWindow(L2PcInstance player, int val) - { + private static final void showWearWindow(L2PcInstance player, int val) { final L2BuyList buyList = BuyListData.getInstance().getBuyList(val); - if (buyList == null) - { + if (buyList == null) { _log.warning("BuyList not found! BuyListId:" + val); player.sendPacket(ActionFailed.STATIC_PACKET); return; @@ -87,8 +76,7 @@ public class Wear implements IBypassHandler } @Override - public String[] getBypassList() - { + public String[] getBypassList() { return COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatAll.java b/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatAll.java index db791d2fa4..287d6643a7 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatAll.java +++ b/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatAll.java @@ -36,58 +36,44 @@ import com.l2jserver.gameserver.network.serverpackets.CreatureSay; * A chat handler * @author durgus */ -public class ChatAll implements IChatHandler -{ +public class ChatAll implements IChatHandler { private static Logger _log = Logger.getLogger(ChatAll.class.getName()); - private static final int[] COMMAND_IDS = - { + private static final int[] COMMAND_IDS = { 0 }; @Override - public void handleChat(int type, L2PcInstance activeChar, String params, String text) - { + public void handleChat(int type, L2PcInstance activeChar, String params, String text) { boolean vcd_used = false; - if (text.startsWith(".")) - { + if (text.startsWith(".")) { StringTokenizer st = new StringTokenizer(text); IVoicedCommandHandler vch; String command = ""; - if (st.countTokens() > 1) - { + if (st.countTokens() > 1) { command = st.nextToken().substring(1); params = text.substring(command.length() + 2); vch = VoicedCommandHandler.getInstance().getHandler(command); - } - else - { + } else { command = text.substring(1); - if (general().debug()) - { + if (general().debug()) { _log.info("Command: " + command); } vch = VoicedCommandHandler.getInstance().getHandler(command); } - if (vch != null) - { + if (vch != null) { vch.useVoicedCommand(command, activeChar, params); vcd_used = true; - } - else - { - if (general().debug()) - { + } else { + if (general().debug()) { _log.warning("No handler registered for bypass '" + command + "'"); } vcd_used = false; } } - if (!vcd_used) - { - if (activeChar.isChatBanned() && general().getBanChatChannels().contains(type)) - { + if (!vcd_used) { + if (activeChar.isChatBanned() && general().getBanChatChannels().contains(type)) { activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); return; } @@ -95,18 +81,13 @@ public class ChatAll implements IChatHandler /** * Match the character "." literally (Exactly 1 time) Match any character that is NOT a . character. Between one and unlimited times as possible, giving back as needed (greedy) */ - if (text.matches("\\.{1}[^\\.]+")) - { + if (text.matches("\\.{1}[^\\.]+")) { activeChar.sendPacket(SystemMessageId.INCORRECT_SYNTAX); - } - else - { + } else { CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getAppearance().getVisibleName(), text); Collection<L2PcInstance> plrs = activeChar.getKnownList().getKnownPlayers().values(); - for (L2PcInstance player : plrs) - { - if ((player != null) && activeChar.isInsideRadius(player, 1250, false, true) && !BlockList.isBlocked(player, activeChar)) - { + for (L2PcInstance player : plrs) { + if ((player != null) && activeChar.isInsideRadius(player, 1250, false, true) && !BlockList.isBlocked(player, activeChar)) { player.sendPacket(cs); } } @@ -117,8 +98,7 @@ public class ChatAll implements IChatHandler } @Override - public int[] getChatTypeList() - { + public int[] getChatTypeList() { return COMMAND_IDS; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatAlliance.java b/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatAlliance.java index 9e53e7d209..c394f12dd2 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatAlliance.java +++ b/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatAlliance.java @@ -25,20 +25,15 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.CreatureSay; -public class ChatAlliance implements IChatHandler -{ - private static final int[] COMMAND_IDS = - { +public class ChatAlliance implements IChatHandler { + private static final int[] COMMAND_IDS = { 9 }; @Override - public void handleChat(int type, L2PcInstance activeChar, String target, String text) - { - if (activeChar.getClan() != null) - { - if (activeChar.isChatBanned() && general().getBanChatChannels().contains(type)) - { + public void handleChat(int type, L2PcInstance activeChar, String target, String text) { + if (activeChar.getClan() != null) { + if (activeChar.isChatBanned() && general().getBanChatChannels().contains(type)) { activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); return; } @@ -49,8 +44,7 @@ public class ChatAlliance implements IChatHandler } @Override - public int[] getChatTypeList() - { + public int[] getChatTypeList() { return COMMAND_IDS; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatBattlefield.java b/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatBattlefield.java index dd1c294c31..33e3258000 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatBattlefield.java +++ b/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatBattlefield.java @@ -31,29 +31,22 @@ import com.l2jserver.gameserver.network.serverpackets.CreatureSay; * A chat handler * @author Gigiikun */ -public class ChatBattlefield implements IChatHandler -{ - private static final int[] COMMAND_IDS = - { +public class ChatBattlefield implements IChatHandler { + private static final int[] COMMAND_IDS = { 20 }; @Override - public void handleChat(int type, L2PcInstance activeChar, String target, String text) - { - if (TerritoryWarManager.getInstance().isTWChannelOpen() && (activeChar.getSiegeSide() > 0)) - { - if (activeChar.isChatBanned() && general().getBanChatChannels().contains(type)) - { + public void handleChat(int type, L2PcInstance activeChar, String target, String text) { + if (TerritoryWarManager.getInstance().isTWChannelOpen() && (activeChar.getSiegeSide() > 0)) { + if (activeChar.isChatBanned() && general().getBanChatChannels().contains(type)) { activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); return; } final CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text); - for (L2PcInstance player : L2World.getInstance().getPlayers()) - { - if (player.getSiegeSide() == activeChar.getSiegeSide()) - { + for (L2PcInstance player : L2World.getInstance().getPlayers()) { + if (player.getSiegeSide() == activeChar.getSiegeSide()) { player.sendPacket(cs); } } @@ -61,8 +54,7 @@ public class ChatBattlefield implements IChatHandler } @Override - public int[] getChatTypeList() - { + public int[] getChatTypeList() { return COMMAND_IDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatClan.java b/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatClan.java index aabb9cb8a2..97c5fb54d5 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatClan.java +++ b/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatClan.java @@ -29,20 +29,15 @@ import com.l2jserver.gameserver.network.serverpackets.CreatureSay; * A chat handler * @author durgus */ -public class ChatClan implements IChatHandler -{ - private static final int[] COMMAND_IDS = - { +public class ChatClan implements IChatHandler { + private static final int[] COMMAND_IDS = { 4 }; @Override - public void handleChat(int type, L2PcInstance activeChar, String target, String text) - { - if (activeChar.getClan() != null) - { - if (activeChar.isChatBanned() && general().getBanChatChannels().contains(type)) - { + public void handleChat(int type, L2PcInstance activeChar, String target, String text) { + if (activeChar.getClan() != null) { + if (activeChar.isChatBanned() && general().getBanChatChannels().contains(type)) { activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); return; } @@ -53,8 +48,7 @@ public class ChatClan implements IChatHandler } @Override - public int[] getChatTypeList() - { + public int[] getChatTypeList() { return COMMAND_IDS; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatHeroVoice.java b/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatHeroVoice.java index 832e8b29f1..eaf09a6bbc 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatHeroVoice.java +++ b/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatHeroVoice.java @@ -32,35 +32,27 @@ import com.l2jserver.gameserver.network.serverpackets.CreatureSay; * Hero chat handler. * @author durgus */ -public class ChatHeroVoice implements IChatHandler -{ - private static final int[] COMMAND_IDS = - { +public class ChatHeroVoice implements IChatHandler { + private static final int[] COMMAND_IDS = { 17 }; @Override - public void handleChat(int type, L2PcInstance activeChar, String target, String text) - { - if (activeChar.isHero() || activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS)) - { - if (activeChar.isChatBanned() && general().getBanChatChannels().contains(type)) - { + public void handleChat(int type, L2PcInstance activeChar, String target, String text) { + if (activeChar.isHero() || activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS)) { + if (activeChar.isChatBanned() && general().getBanChatChannels().contains(type)) { activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); return; } - if (!activeChar.getFloodProtectors().getHeroVoice().tryPerformAction("hero voice")) - { + if (!activeChar.getFloodProtectors().getHeroVoice().tryPerformAction("hero voice")) { activeChar.sendMessage("Action failed. Heroes are only able to speak in the global channel once every 10 seconds."); return; } CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text); - for (L2PcInstance player : L2World.getInstance().getPlayers()) - { - if ((player != null) && !BlockList.isBlocked(player, activeChar)) - { + for (L2PcInstance player : L2World.getInstance().getPlayers()) { + if ((player != null) && !BlockList.isBlocked(player, activeChar)) { player.sendPacket(cs); } } @@ -68,8 +60,7 @@ public class ChatHeroVoice implements IChatHandler } @Override - public int[] getChatTypeList() - { + public int[] getChatTypeList() { return COMMAND_IDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatParty.java b/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatParty.java index a94aa09322..fe9db9a087 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatParty.java +++ b/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatParty.java @@ -29,20 +29,15 @@ import com.l2jserver.gameserver.network.serverpackets.CreatureSay; * A chat handler * @author durgus */ -public class ChatParty implements IChatHandler -{ - private static final int[] COMMAND_IDS = - { +public class ChatParty implements IChatHandler { + private static final int[] COMMAND_IDS = { 3 }; @Override - public void handleChat(int type, L2PcInstance activeChar, String target, String text) - { - if (activeChar.isInParty()) - { - if (activeChar.isChatBanned() && general().getBanChatChannels().contains(type)) - { + public void handleChat(int type, L2PcInstance activeChar, String target, String text) { + if (activeChar.isInParty()) { + if (activeChar.isChatBanned() && general().getBanChatChannels().contains(type)) { activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); return; } @@ -53,8 +48,7 @@ public class ChatParty implements IChatHandler } @Override - public int[] getChatTypeList() - { + public int[] getChatTypeList() { return COMMAND_IDS; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatPartyMatchRoom.java b/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatPartyMatchRoom.java index 8a7f28381a..0e7f8c3584 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatPartyMatchRoom.java +++ b/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatPartyMatchRoom.java @@ -31,30 +31,23 @@ import com.l2jserver.gameserver.network.serverpackets.CreatureSay; * A chat handler * @author Gnacik */ -public class ChatPartyMatchRoom implements IChatHandler -{ - private static final int[] COMMAND_IDS = - { +public class ChatPartyMatchRoom implements IChatHandler { + private static final int[] COMMAND_IDS = { 14 }; @Override - public void handleChat(int type, L2PcInstance activeChar, String target, String text) - { - if (activeChar.isInPartyMatchRoom()) - { + public void handleChat(int type, L2PcInstance activeChar, String target, String text) { + if (activeChar.isInPartyMatchRoom()) { PartyMatchRoom _room = PartyMatchRoomList.getInstance().getPlayerRoom(activeChar); - if (_room != null) - { - if (activeChar.isChatBanned() && general().getBanChatChannels().contains(type)) - { + if (_room != null) { + if (activeChar.isChatBanned() && general().getBanChatChannels().contains(type)) { activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); return; } CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text); - for (L2PcInstance _member : _room.getPartyMembers()) - { + for (L2PcInstance _member : _room.getPartyMembers()) { _member.sendPacket(cs); } } @@ -62,8 +55,7 @@ public class ChatPartyMatchRoom implements IChatHandler } @Override - public int[] getChatTypeList() - { + public int[] getChatTypeList() { return COMMAND_IDS; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatPartyRoomAll.java b/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatPartyRoomAll.java index c43c7c2855..f70acc80f9 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatPartyRoomAll.java +++ b/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatPartyRoomAll.java @@ -29,22 +29,16 @@ import com.l2jserver.gameserver.network.serverpackets.CreatureSay; * A chat handler * @author durgus */ -public class ChatPartyRoomAll implements IChatHandler -{ - private static final int[] COMMAND_IDS = - { +public class ChatPartyRoomAll implements IChatHandler { + private static final int[] COMMAND_IDS = { 16 }; @Override - public void handleChat(int type, L2PcInstance activeChar, String target, String text) - { - if (activeChar.isInParty()) - { - if (activeChar.getParty().isInCommandChannel() && activeChar.getParty().isLeader(activeChar)) - { - if (activeChar.isChatBanned() && general().getBanChatChannels().contains(type)) - { + public void handleChat(int type, L2PcInstance activeChar, String target, String text) { + if (activeChar.isInParty()) { + if (activeChar.getParty().isInCommandChannel() && activeChar.getParty().isLeader(activeChar)) { + if (activeChar.isChatBanned() && general().getBanChatChannels().contains(type)) { activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); return; } @@ -56,8 +50,7 @@ public class ChatPartyRoomAll implements IChatHandler } @Override - public int[] getChatTypeList() - { + public int[] getChatTypeList() { return COMMAND_IDS; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatPartyRoomCommander.java b/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatPartyRoomCommander.java index 66a3296d02..44b2f5239e 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatPartyRoomCommander.java +++ b/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatPartyRoomCommander.java @@ -29,22 +29,16 @@ import com.l2jserver.gameserver.network.serverpackets.CreatureSay; * A chat handler * @author durgus */ -public class ChatPartyRoomCommander implements IChatHandler -{ - private static final int[] COMMAND_IDS = - { +public class ChatPartyRoomCommander implements IChatHandler { + private static final int[] COMMAND_IDS = { 15 }; @Override - public void handleChat(int type, L2PcInstance activeChar, String target, String text) - { - if (activeChar.isInParty()) - { - if (activeChar.getParty().isInCommandChannel() && activeChar.getParty().getCommandChannel().getLeader().equals(activeChar)) - { - if (activeChar.isChatBanned() && general().getBanChatChannels().contains(type)) - { + public void handleChat(int type, L2PcInstance activeChar, String target, String text) { + if (activeChar.isInParty()) { + if (activeChar.getParty().isInCommandChannel() && activeChar.getParty().getCommandChannel().getLeader().equals(activeChar)) { + if (activeChar.isChatBanned() && general().getBanChatChannels().contains(type)) { activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); return; } @@ -56,8 +50,7 @@ public class ChatPartyRoomCommander implements IChatHandler } @Override - public int[] getChatTypeList() - { + public int[] getChatTypeList() { return COMMAND_IDS; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatPetition.java b/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatPetition.java index 94bf37504d..780ce6d727 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatPetition.java +++ b/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatPetition.java @@ -29,25 +29,20 @@ import com.l2jserver.gameserver.network.SystemMessageId; * A chat handler * @author durgus */ -public class ChatPetition implements IChatHandler -{ - private static final int[] COMMAND_IDS = - { +public class ChatPetition implements IChatHandler { + private static final int[] COMMAND_IDS = { 6, 7 }; @Override - public void handleChat(int type, L2PcInstance activeChar, String target, String text) - { - if (activeChar.isChatBanned() && general().getBanChatChannels().contains(type)) - { + public void handleChat(int type, L2PcInstance activeChar, String target, String text) { + if (activeChar.isChatBanned() && general().getBanChatChannels().contains(type)) { activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); return; } - if (!PetitionManager.getInstance().isPlayerInConsultation(activeChar)) - { + if (!PetitionManager.getInstance().isPlayerInConsultation(activeChar)) { activeChar.sendPacket(SystemMessageId.YOU_ARE_NOT_IN_PETITION_CHAT); return; } @@ -56,8 +51,7 @@ public class ChatPetition implements IChatHandler } @Override - public int[] getChatTypeList() - { + public int[] getChatTypeList() { return COMMAND_IDS; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatShout.java b/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatShout.java index 31f83aa3e5..1c96358f3b 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatShout.java +++ b/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatShout.java @@ -33,10 +33,8 @@ import com.l2jserver.gameserver.network.serverpackets.CreatureSay; * Shout chat handler. * @author durgus */ -public class ChatShout implements IChatHandler -{ - private static final int[] COMMAND_IDS = - { +public class ChatShout implements IChatHandler { + private static final int[] COMMAND_IDS = { 1 }; @@ -44,38 +42,28 @@ public class ChatShout implements IChatHandler * Handle chat type 'shout' */ @Override - public void handleChat(int type, L2PcInstance activeChar, String target, String text) - { - if (activeChar.isChatBanned() && general().getBanChatChannels().contains(type)) - { + public void handleChat(int type, L2PcInstance activeChar, String target, String text) { + if (activeChar.isChatBanned() && general().getBanChatChannels().contains(type)) { activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); return; } final CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text); - if (general().getGlobalChat().equalsIgnoreCase("on") || (general().getGlobalChat().equalsIgnoreCase("gm") && activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS))) - { + if (general().getGlobalChat().equalsIgnoreCase("on") || (general().getGlobalChat().equalsIgnoreCase("gm") && activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS))) { int region = MapRegionManager.getInstance().getMapRegionLocId(activeChar); - for (L2PcInstance player : L2World.getInstance().getPlayers()) - { - if ((region == MapRegionManager.getInstance().getMapRegionLocId(player)) && !BlockList.isBlocked(player, activeChar) && (player.getInstanceId() == activeChar.getInstanceId())) - { + for (L2PcInstance player : L2World.getInstance().getPlayers()) { + if ((region == MapRegionManager.getInstance().getMapRegionLocId(player)) && !BlockList.isBlocked(player, activeChar) && (player.getInstanceId() == activeChar.getInstanceId())) { player.sendPacket(cs); } } - } - else if (general().getGlobalChat().equalsIgnoreCase("global")) - { - if (!activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS) && !activeChar.getFloodProtectors().getGlobalChat().tryPerformAction("global chat")) - { + } else if (general().getGlobalChat().equalsIgnoreCase("global")) { + if (!activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS) && !activeChar.getFloodProtectors().getGlobalChat().tryPerformAction("global chat")) { activeChar.sendMessage("Do not spam shout channel."); return; } - for (L2PcInstance player : L2World.getInstance().getPlayers()) - { - if (!BlockList.isBlocked(player, activeChar)) - { + for (L2PcInstance player : L2World.getInstance().getPlayers()) { + if (!BlockList.isBlocked(player, activeChar)) { player.sendPacket(cs); } } @@ -86,8 +74,7 @@ public class ChatShout implements IChatHandler * Returns the chat types registered to this handler. */ @Override - public int[] getChatTypeList() - { + public int[] getChatTypeList() { return COMMAND_IDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatTell.java b/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatTell.java index 6420b64b3f..aae47d54ba 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatTell.java +++ b/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatTell.java @@ -33,10 +33,8 @@ import com.l2jserver.gameserver.network.serverpackets.CreatureSay; * Tell chat handler. * @author durgus */ -public class ChatTell implements IChatHandler -{ - private static final int[] COMMAND_IDS = - { +public class ChatTell implements IChatHandler { + private static final int[] COMMAND_IDS = { 2 }; @@ -44,23 +42,19 @@ public class ChatTell implements IChatHandler * Handle chat type 'tell' */ @Override - public void handleChat(int type, L2PcInstance activeChar, String target, String text) - { - if (activeChar.isChatBanned() && general().getBanChatChannels().contains(type)) - { + public void handleChat(int type, L2PcInstance activeChar, String target, String text) { + if (activeChar.isChatBanned() && general().getBanChatChannels().contains(type)) { activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); return; } - if (general().jailDisableChat() && activeChar.isJailed() && !activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS)) - { + if (general().jailDisableChat() && activeChar.isJailed() && !activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS)) { activeChar.sendPacket(SystemMessageId.CHATTING_PROHIBITED); return; } // Return if no target is set - if (target == null) - { + if (target == null) { return; } @@ -69,41 +63,31 @@ public class ChatTell implements IChatHandler receiver = L2World.getInstance().getPlayer(target); - if ((receiver != null) && !receiver.isSilenceMode(activeChar.getObjectId())) - { - if (general().jailDisableChat() && receiver.isJailed() && !activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS)) - { + if ((receiver != null) && !receiver.isSilenceMode(activeChar.getObjectId())) { + if (general().jailDisableChat() && receiver.isJailed() && !activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS)) { activeChar.sendMessage("Player is in jail."); return; } - if (receiver.isChatBanned()) - { + if (receiver.isChatBanned()) { activeChar.sendPacket(SystemMessageId.THE_PERSON_IS_IN_MESSAGE_REFUSAL_MODE); return; } - if ((receiver.getClient() == null) || receiver.getClient().isDetached()) - { + if ((receiver.getClient() == null) || receiver.getClient().isDetached()) { activeChar.sendMessage("Player is in offline mode."); return; } - if (!BlockList.isBlocked(receiver, activeChar)) - { + if (!BlockList.isBlocked(receiver, activeChar)) { // Allow receiver to send PMs to this char, which is in silence mode. - if (character().silenceModeExclude() && activeChar.isSilenceMode()) - { + if (character().silenceModeExclude() && activeChar.isSilenceMode()) { activeChar.addSilenceModeExcluded(receiver.getObjectId()); } receiver.sendPacket(cs); activeChar.sendPacket(new CreatureSay(activeChar.getObjectId(), type, "->" + receiver.getName(), text)); - } - else - { + } else { activeChar.sendPacket(SystemMessageId.THE_PERSON_IS_IN_MESSAGE_REFUSAL_MODE); } - } - else - { + } else { activeChar.sendPacket(SystemMessageId.TARGET_IS_NOT_FOUND_IN_THE_GAME); } } @@ -112,8 +96,7 @@ public class ChatTell implements IChatHandler * Returns the chat types registered to this handler. */ @Override - public int[] getChatTypeList() - { + public int[] getChatTypeList() { return COMMAND_IDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatTrade.java b/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatTrade.java index 6091e5fda6..a3bb323c2e 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatTrade.java +++ b/src/main/java/com/l2jserver/datapack/handlers/chathandlers/ChatTrade.java @@ -33,10 +33,8 @@ import com.l2jserver.gameserver.network.serverpackets.CreatureSay; * Trade chat handler. * @author durgus */ -public class ChatTrade implements IChatHandler -{ - private static final int[] COMMAND_IDS = - { +public class ChatTrade implements IChatHandler { + private static final int[] COMMAND_IDS = { 8 }; @@ -44,38 +42,28 @@ public class ChatTrade implements IChatHandler * Handle chat type 'trade' */ @Override - public void handleChat(int type, L2PcInstance activeChar, String target, String text) - { - if (activeChar.isChatBanned() && general().getBanChatChannels().contains(type)) - { + public void handleChat(int type, L2PcInstance activeChar, String target, String text) { + if (activeChar.isChatBanned() && general().getBanChatChannels().contains(type)) { activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); return; } final CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text); - if (general().getTradeChat().equalsIgnoreCase("on") || (general().getTradeChat().equalsIgnoreCase("gm") && activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS))) - { + if (general().getTradeChat().equalsIgnoreCase("on") || (general().getTradeChat().equalsIgnoreCase("gm") && activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS))) { int region = MapRegionManager.getInstance().getMapRegionLocId(activeChar); - for (L2PcInstance player : L2World.getInstance().getPlayers()) - { - if ((region == MapRegionManager.getInstance().getMapRegionLocId(player)) && !BlockList.isBlocked(player, activeChar) && (player.getInstanceId() == activeChar.getInstanceId())) - { + for (L2PcInstance player : L2World.getInstance().getPlayers()) { + if ((region == MapRegionManager.getInstance().getMapRegionLocId(player)) && !BlockList.isBlocked(player, activeChar) && (player.getInstanceId() == activeChar.getInstanceId())) { player.sendPacket(cs); } } - } - else if (general().getTradeChat().equalsIgnoreCase("global")) - { - if (!activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS) && !activeChar.getFloodProtectors().getGlobalChat().tryPerformAction("global chat")) - { + } else if (general().getTradeChat().equalsIgnoreCase("global")) { + if (!activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS) && !activeChar.getFloodProtectors().getGlobalChat().tryPerformAction("global chat")) { activeChar.sendMessage("Do not spam trade channel."); return; } - for (L2PcInstance player : L2World.getInstance().getPlayers()) - { - if (!BlockList.isBlocked(player, activeChar)) - { + for (L2PcInstance player : L2World.getInstance().getPlayers()) { + if (!BlockList.isBlocked(player, activeChar)) { player.sendPacket(cs); } } @@ -86,8 +74,7 @@ public class ChatTrade implements IChatHandler * Returns the chat types registered to this handler. */ @Override - public int[] getChatTypeList() - { + public int[] getChatTypeList() { return COMMAND_IDS; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/communityboard/ClanBoard.java b/src/main/java/com/l2jserver/datapack/handlers/communityboard/ClanBoard.java index ec07240822..01385fdd5f 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/communityboard/ClanBoard.java +++ b/src/main/java/com/l2jserver/datapack/handlers/communityboard/ClanBoard.java @@ -31,147 +31,101 @@ import com.l2jserver.gameserver.util.Util; * Clan board. * @author Zoey76 */ -public class ClanBoard implements IWriteBoardHandler -{ - private static final String[] COMMANDS = - { +public class ClanBoard implements IWriteBoardHandler { + private static final String[] COMMANDS = { "_bbsclan", "_bbsclan_list", "_bbsclan_clanhome" }; @Override - public String[] getCommunityBoardCommands() - { + public String[] getCommunityBoardCommands() { return COMMANDS; } @Override - public boolean parseCommunityBoardCommand(String command, L2PcInstance activeChar) - { - if (command.equals("_bbsclan")) - { + public boolean parseCommunityBoardCommand(String command, L2PcInstance activeChar) { + if (command.equals("_bbsclan")) { CommunityBoardHandler.getInstance().addBypass(activeChar, "Clan", command); - if ((activeChar.getClan() == null) || (activeChar.getClan().getLevel() < 2)) - { + if ((activeChar.getClan() == null) || (activeChar.getClan().getLevel() < 2)) { clanList(activeChar, 1); - } - else - { + } else { clanHome(activeChar); } - } - else if (command.startsWith("_bbsclan_clanlist")) - { + } else if (command.startsWith("_bbsclan_clanlist")) { CommunityBoardHandler.getInstance().addBypass(activeChar, "Clan List", command); - if (command.equals("_bbsclan_clanlist")) - { + if (command.equals("_bbsclan_clanlist")) { clanList(activeChar, 1); - } - else if (command.startsWith("_bbsclan_clanlist;")) - { - try - { + } else if (command.startsWith("_bbsclan_clanlist;")) { + try { clanList(activeChar, Integer.parseInt(command.split(";")[1])); - } - catch (Exception e) - { + } catch (Exception e) { clanList(activeChar, 1); LOG.warning(ClanBoard.class.getSimpleName() + ": Player " + activeChar + " send invalid clan list bypass " + command + "!"); } } - } - else if (command.startsWith("_bbsclan_clanhome")) - { + } else if (command.startsWith("_bbsclan_clanhome")) { CommunityBoardHandler.getInstance().addBypass(activeChar, "Clan Home", command); - if (command.equals("_bbsclan_clanhome")) - { + if (command.equals("_bbsclan_clanhome")) { clanHome(activeChar); - } - else if (command.startsWith("_bbsclan_clanhome;")) - { - try - { + } else if (command.startsWith("_bbsclan_clanhome;")) { + try { clanHome(activeChar, Integer.parseInt(command.split(";")[1])); - } - catch (Exception e) - { + } catch (Exception e) { clanHome(activeChar); LOG.warning(ClanBoard.class.getSimpleName() + ": Player " + activeChar + " send invalid clan home bypass " + command + "!"); } } - } - else if (command.startsWith("_bbsclan_clannotice_edit;")) - { + } else if (command.startsWith("_bbsclan_clannotice_edit;")) { CommunityBoardHandler.getInstance().addBypass(activeChar, "Clan Edit", command); clanNotice(activeChar, activeChar.getClanId()); - } - else if (command.startsWith("_bbsclan_clannotice_enable")) - { + } else if (command.startsWith("_bbsclan_clannotice_enable")) { CommunityBoardHandler.getInstance().addBypass(activeChar, "Clan Notice Enable", command); - if (activeChar.getClan() != null) - { + if (activeChar.getClan() != null) { activeChar.getClan().setNoticeEnabled(true); } clanNotice(activeChar, activeChar.getClanId()); - } - else if (command.startsWith("_bbsclan_clannotice_disable")) - { + } else if (command.startsWith("_bbsclan_clannotice_disable")) { CommunityBoardHandler.getInstance().addBypass(activeChar, "Clan Notice Disable", command); - if (activeChar.getClan() != null) - { + if (activeChar.getClan() != null) { activeChar.getClan().setNoticeEnabled(false); } clanNotice(activeChar, activeChar.getClanId()); - } - else - { + } else { CommunityBoardHandler.separateAndSend("<html><body><br><br><center>Command " + command + " need development.</center><br><br></body></html>", activeChar); } return true; } - private void clanNotice(L2PcInstance activeChar, int clanId) - { + private void clanNotice(L2PcInstance activeChar, int clanId) { final L2Clan cl = ClanTable.getInstance().getClan(clanId); - if (cl != null) - { - if (cl.getLevel() < 2) - { + if (cl != null) { + if (cl.getLevel() < 2) { activeChar.sendPacket(SystemMessageId.NO_CB_IN_MY_CLAN); parseCommunityBoardCommand("_bbsclan_clanlist", activeChar); - } - else - { + } else { final StringBuilder html = StringUtil.startAppend(2000, "<html><body><br><br><table border=0 width=610><tr><td width=10></td><td width=600 align=left><a action=\"bypass _bbshome\">HOME</a> > <a action=\"bypass _bbsclan_clanlist\"> CLAN COMMUNITY </a> > <a action=\"bypass _bbsclan_clanhome;", String.valueOf(clanId), "\"> &$802; </a></td></tr></table>"); - if (activeChar.isClanLeader()) - { + if (activeChar.isClanLeader()) { StringUtil.append(html, "<br><br><center><table width=610 border=0 cellspacing=0 cellpadding=0><tr><td fixwidth=610><font color=\"AAAAAA\">The Clan Notice function allows the clan leader to send messages through a pop-up window to clan members at login.</font> </td></tr><tr><td height=20></td></tr>"); - if (activeChar.getClan().isNoticeEnabled()) - { + if (activeChar.getClan().isNoticeEnabled()) { StringUtil.append(html, "<tr><td fixwidth=610> Clan Notice Function: on / <a action=\"bypass _bbsclan_clannotice_disable\">off</a>"); - } - else - { + } else { StringUtil.append(html, "<tr><td fixwidth=610> Clan Notice Function: <a action=\"bypass _bbsclan_clannotice_enable\">on</a> / off"); } StringUtil.append(html, "</td></tr></table><img src=\"L2UI.Squaregray\" width=\"610\" height=\"1\"><br> <br><table width=610 border=0 cellspacing=2 cellpadding=0><tr><td>Edit Notice: </td></tr><tr><td height=5></td></tr><tr><td><MultiEdit var =\"Content\" width=610 height=100></td></tr></table><br><table width=610 border=0 cellspacing=0 cellpadding=0><tr><td height=5></td></tr><tr><td align=center FIXWIDTH=65><button value=\"&$140;\" action=\"Write Notice Set _ Content Content Content\" back=\"l2ui_ch3.smallbutton2_down\" width=65 height=20 fore=\"l2ui_ch3.smallbutton2\" ></td><td align=center FIXWIDTH=45></td><td align=center FIXWIDTH=500></td></tr></table></center></body></html>"); Util.sendCBHtml(activeChar, html.toString(), activeChar.getClan().getNotice()); - } - else - { + } else { StringUtil.append(html, "<img src=\"L2UI.squareblank\" width=\"1\" height=\"10\"><center><table border=0 cellspacing=0 cellpadding=0><tr><td>You are not your clan's leader, and therefore cannot change the clan notice</td></tr></table>"); - if (activeChar.getClan().isNoticeEnabled()) - { + if (activeChar.getClan().isNoticeEnabled()) { StringUtil.append(html, "<table border=0 cellspacing=0 cellpadding=0><tr><td>The current clan notice:</td></tr><tr><td fixwidth=5></td><td FIXWIDTH=600 align=left>" + activeChar.getClan().getNotice() + "</td><td fixqqwidth=5></td></tr></table>"); } StringUtil.append(html, "</center></body></html>"); @@ -181,10 +135,8 @@ public class ClanBoard implements IWriteBoardHandler } } - private void clanList(L2PcInstance activeChar, int index) - { - if (index < 1) - { + private void clanList(L2PcInstance activeChar, int index) { + if (index < 1) { index = 1; } @@ -192,102 +144,82 @@ public class ClanBoard implements IWriteBoardHandler final StringBuilder html = StringUtil.startAppend(2000, "<html><body><br><br><center><br1><br1><table border=0 cellspacing=0 cellpadding=0><tr><td FIXWIDTH=15> </td><td width=610 height=30 align=left><a action=\"bypass _bbsclan_clanlist\"> CLAN COMMUNITY </a></td></tr></table><table border=0 cellspacing=0 cellpadding=0 width=610 bgcolor=434343><tr><td height=10></td></tr><tr><td fixWIDTH=5></td><td fixWIDTH=600><a action=\"bypass _bbsclan_clanhome;", String.valueOf((activeChar.getClan() != null) ? activeChar.getClan().getId() : 0), "\">[GO TO MY CLAN]</a> </td><td fixWIDTH=5></td></tr><tr><td height=10></td></tr></table><br><table border=0 cellspacing=0 cellpadding=2 bgcolor=5A5A5A width=610><tr><td FIXWIDTH=5></td><td FIXWIDTH=200 align=center>CLAN NAME</td><td FIXWIDTH=200 align=center>CLAN LEADER</td><td FIXWIDTH=100 align=center>CLAN LEVEL</td><td FIXWIDTH=100 align=center>CLAN MEMBERS</td><td FIXWIDTH=5></td></tr></table><img src=\"L2UI.Squareblank\" width=\"1\" height=\"5\">"); int i = 0; - for (L2Clan cl : ClanTable.getInstance().getClans()) - { - if (i > ((index + 1) * 7)) - { + for (L2Clan cl : ClanTable.getInstance().getClans()) { + if (i > ((index + 1) * 7)) { break; } - if (i++ >= ((index - 1) * 7)) - { + if (i++ >= ((index - 1) * 7)) { StringUtil.append(html, "<img src=\"L2UI.SquareBlank\" width=\"610\" height=\"3\"><table border=0 cellspacing=0 cellpadding=0 width=610><tr> <td FIXWIDTH=5></td><td FIXWIDTH=200 align=center><a action=\"bypass _bbsclan_clanhome;", String.valueOf(cl.getId()), "\">", cl.getName(), "</a></td><td FIXWIDTH=200 align=center>", cl.getLeaderName(), "</td><td FIXWIDTH=100 align=center>", String.valueOf(cl.getLevel()), "</td><td FIXWIDTH=100 align=center>", String.valueOf(cl.getMembersCount()), "</td><td FIXWIDTH=5></td></tr><tr><td height=5></td></tr></table><img src=\"L2UI.SquareBlank\" width=\"610\" height=\"3\"><img src=\"L2UI.SquareGray\" width=\"610\" height=\"1\">"); } } html.append("<img src=\"L2UI.SquareBlank\" width=\"610\" height=\"2\"><table cellpadding=0 cellspacing=2 border=0><tr>"); - if (index == 1) - { + if (index == 1) { html.append("<td><button action=\"\" back=\"l2ui_ch3.prev1_down\" fore=\"l2ui_ch3.prev1\" width=16 height=16 ></td>"); - } - else - { + } else { StringUtil.append(html, "<td><button action=\"_bbsclan_clanlist;", String.valueOf(index - 1), "\" back=\"l2ui_ch3.prev1_down\" fore=\"l2ui_ch3.prev1\" width=16 height=16 ></td>"); } i = 0; int nbp = ClanTable.getInstance().getClanCount() / 8; - if ((nbp * 8) != ClanTable.getInstance().getClanCount()) - { + if ((nbp * 8) != ClanTable.getInstance().getClanCount()) { nbp++; } - for (i = 1; i <= nbp; i++) - { - if (i == index) - { + for (i = 1; i <= nbp; i++) { + if (i == index) { StringUtil.append(html, "<td> ", String.valueOf(i), " </td>"); - } - else - { + } else { StringUtil.append(html, "<td><a action=\"bypass _bbsclan_clanlist;", String.valueOf(i), "\"> ", String.valueOf(i), " </a></td>"); } } - if (index == nbp) - { + if (index == nbp) { html.append("<td><button action=\"\" back=\"l2ui_ch3.next1_down\" fore=\"l2ui_ch3.next1\" width=16 height=16 ></td>"); - } - else - { + } else { StringUtil.append(html, "<td><button action=\"bypass _bbsclan_clanlist;", String.valueOf(index + 1), "\" back=\"l2ui_ch3.next1_down\" fore=\"l2ui_ch3.next1\" width=16 height=16 ></td>"); } - html.append("</tr></table><table border=0 cellspacing=0 cellpadding=0><tr><td width=610><img src=\"sek.cbui141\" width=\"610\" height=\"1\"></td></tr></table><table border=0><tr><td><combobox width=65 var=keyword list=\"Name;Ruler\"></td><td><edit var = \"Search\" width=130 height=11 length=\"16\"></td>" + - // TODO: search (Write in BBS) - "<td><button value=\"&$420;\" action=\"Write 5 -1 0 Search keyword keyword\" back=\"l2ui_ch3.smallbutton2_down\" width=65 height=20 fore=\"l2ui_ch3.smallbutton2\"> </td> </tr></table><br><br></center></body></html>"); + html.append("</tr></table><table border=0 cellspacing=0 cellpadding=0><tr><td width=610><img src=\"sek.cbui141\" width=\"610\" height=\"1\"></td></tr></table><table border=0><tr><td><combobox width=65 var=keyword list=\"Name;Ruler\"></td><td><edit var = \"Search\" width=130 height=11 length=\"16\"></td>" + + + // TODO: search (Write in BBS) + "<td><button value=\"&$420;\" action=\"Write 5 -1 0 Search keyword keyword\" back=\"l2ui_ch3.smallbutton2_down\" width=65 height=20 fore=\"l2ui_ch3.smallbutton2\"> </td> </tr></table><br><br></center></body></html>"); CommunityBoardHandler.separateAndSend(html.toString(), activeChar); } - private void clanHome(L2PcInstance activeChar) - { + private void clanHome(L2PcInstance activeChar) { clanHome(activeChar, activeChar.getClan().getId()); } - private void clanHome(L2PcInstance activeChar, int clanId) - { + private void clanHome(L2PcInstance activeChar, int clanId) { L2Clan cl = ClanTable.getInstance().getClan(clanId); - if (cl != null) - { - if (cl.getLevel() < 2) - { + if (cl != null) { + if (cl.getLevel() < 2) { activeChar.sendPacket(SystemMessageId.NO_CB_IN_MY_CLAN); parseCommunityBoardCommand("_bbsclan_clanlist", activeChar); - } - else - { - final String html = StringUtil.concat("<html><body><center><br><br><br1><br1><table border=0 cellspacing=0 cellpadding=0><tr><td FIXWIDTH=15> </td><td width=610 height=30 align=left><a action=\"bypass _bbshome\">HOME</a> > <a action=\"bypass _bbsclan_clanlist\"> CLAN COMMUNITY </a> > <a action=\"bypass _bbsclan_clanhome;", String.valueOf(clanId), "\"> &$802; </a></td></tr></table><table border=0 cellspacing=0 cellpadding=0 width=610 bgcolor=434343><tr><td height=10></td></tr><tr><td fixWIDTH=5></td><td fixwidth=600><a action=\"bypass _bbsclan_clanhome;", String.valueOf(clanId), ";announce\">[CLAN ANNOUNCEMENT]</a> <a action=\"bypass _bbsclan_clanhome;", String.valueOf(clanId), ";cbb\">[CLAN BULLETIN BOARD]</a><a action=\"bypass _bbsclan_clanhome;", String.valueOf(clanId), ";cmail\">[CLAN MAIL]</a> <a action=\"bypass _bbsclan_clannotice_edit;", String.valueOf(clanId), ";cnotice\">[CLAN NOTICE]</a> </td><td fixWIDTH=5></td></tr><tr><td height=10></td></tr></table><table border=0 cellspacing=0 cellpadding=0 width=610><tr><td height=10></td></tr><tr><td fixWIDTH=5></td><td fixwidth=290 valign=top></td><td fixWIDTH=5></td><td fixWIDTH=5 align=center valign=top><img src=\"l2ui.squaregray\" width=2 height=128></td><td fixWIDTH=5></td><td fixwidth=295><table border=0 cellspacing=0 cellpadding=0 width=295><tr><td fixWIDTH=100 align=left>CLAN NAME</td><td fixWIDTH=195 align=left>", cl.getName(), "</td></tr><tr><td height=7></td></tr><tr><td fixWIDTH=100 align=left>CLAN LEVEL</td><td fixWIDTH=195 align=left height=16>", String.valueOf(cl.getLevel()), "</td></tr><tr><td height=7></td></tr><tr><td fixWIDTH=100 align=left>CLAN MEMBERS</td><td fixWIDTH=195 align=left height=16>", String.valueOf(cl.getMembersCount()), "</td></tr><tr><td height=7></td></tr><tr><td fixWIDTH=100 align=left>CLAN LEADER</td><td fixWIDTH=195 align=left height=16>", cl.getLeaderName(), "</td></tr><tr><td height=7></td></tr>" + - // ADMINISTRATOR ?? - /* - * html.append("<tr>"); html.append("<td fixWIDTH=100 align=left>ADMINISTRATOR</td>"); html.append("<td fixWIDTH=195 align=left height=16>"+cl.getLeaderName()+"</td>"); html.append("</tr>"); - */ - "<tr><td height=7></td></tr><tr><td fixWIDTH=100 align=left>ALLIANCE</td><td fixWIDTH=195 align=left height=16>", (cl.getAllyName() != null) ? cl.getAllyName() : "", "</td></tr></table></td><td fixWIDTH=5></td></tr><tr><td height=10></td></tr></table>" + + } else { + final String html = StringUtil.concat("<html><body><center><br><br><br1><br1><table border=0 cellspacing=0 cellpadding=0><tr><td FIXWIDTH=15> </td><td width=610 height=30 align=left><a action=\"bypass _bbshome\">HOME</a> > <a action=\"bypass _bbsclan_clanlist\"> CLAN COMMUNITY </a> > <a action=\"bypass _bbsclan_clanhome;", String.valueOf(clanId), "\"> &$802; </a></td></tr></table><table border=0 cellspacing=0 cellpadding=0 width=610 bgcolor=434343><tr><td height=10></td></tr><tr><td fixWIDTH=5></td><td fixwidth=600><a action=\"bypass _bbsclan_clanhome;", String.valueOf(clanId), ";announce\">[CLAN ANNOUNCEMENT]</a> <a action=\"bypass _bbsclan_clanhome;", String.valueOf(clanId), ";cbb\">[CLAN BULLETIN BOARD]</a><a action=\"bypass _bbsclan_clanhome;", String.valueOf(clanId), ";cmail\">[CLAN MAIL]</a> <a action=\"bypass _bbsclan_clannotice_edit;", String.valueOf(clanId), ";cnotice\">[CLAN NOTICE]</a> </td><td fixWIDTH=5></td></tr><tr><td height=10></td></tr></table><table border=0 cellspacing=0 cellpadding=0 width=610><tr><td height=10></td></tr><tr><td fixWIDTH=5></td><td fixwidth=290 valign=top></td><td fixWIDTH=5></td><td fixWIDTH=5 align=center valign=top><img src=\"l2ui.squaregray\" width=2 height=128></td><td fixWIDTH=5></td><td fixwidth=295><table border=0 cellspacing=0 cellpadding=0 width=295><tr><td fixWIDTH=100 align=left>CLAN NAME</td><td fixWIDTH=195 align=left>", cl.getName(), "</td></tr><tr><td height=7></td></tr><tr><td fixWIDTH=100 align=left>CLAN LEVEL</td><td fixWIDTH=195 align=left height=16>", String.valueOf(cl.getLevel()), "</td></tr><tr><td height=7></td></tr><tr><td fixWIDTH=100 align=left>CLAN MEMBERS</td><td fixWIDTH=195 align=left height=16>", String.valueOf(cl.getMembersCount()), "</td></tr><tr><td height=7></td></tr><tr><td fixWIDTH=100 align=left>CLAN LEADER</td><td fixWIDTH=195 align=left height=16>", cl.getLeaderName(), "</td></tr><tr><td height=7></td></tr>" + + + // ADMINISTRATOR ?? + /* + * html.append("<tr>"); html.append("<td fixWIDTH=100 align=left>ADMINISTRATOR</td>"); html.append("<td fixWIDTH=195 align=left height=16>"+cl.getLeaderName()+"</td>"); html.append("</tr>"); + */ + "<tr><td height=7></td></tr><tr><td fixWIDTH=100 align=left>ALLIANCE</td><td fixWIDTH=195 align=left height=16>", (cl.getAllyName() != null) ? cl.getAllyName() : "", "</td></tr></table></td><td fixWIDTH=5></td></tr><tr><td height=10></td></tr></table>" + // TODO: the BB for clan :) - // html.append("<table border=0 cellspacing=0 cellpadding=0 width=610 bgcolor=333333>"); - "<img src=\"L2UI.squareblank\" width=\"1\" height=\"5\"><img src=\"L2UI.squaregray\" width=\"610\" height=\"1\"><br></center><br> <br></body></html>"); + // html.append("<table border=0 cellspacing=0 cellpadding=0 width=610 bgcolor=333333>"); + "<img src=\"L2UI.squareblank\" width=\"1\" height=\"5\"><img src=\"L2UI.squaregray\" width=\"610\" height=\"1\"><br></center><br> <br></body></html>"); CommunityBoardHandler.separateAndSend(html, activeChar); } } } @Override - public boolean writeCommunityBoardCommand(L2PcInstance activeChar, String arg1, String arg2, String arg3, String arg4, String arg5) - { + public boolean writeCommunityBoardCommand(L2PcInstance activeChar, String arg1, String arg2, String arg3, String arg4, String arg5) { // the only Write bypass that comes to this handler is "Write Notice Set _ Content Content Content"; // arg1 = Set, arg2 = _ final L2Clan clan = activeChar.getClan(); - if ((clan != null) && activeChar.isClanLeader()) - { + if ((clan != null) && activeChar.isClanLeader()) { clan.setNotice(arg3); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/communityboard/FavoriteBoard.java b/src/main/java/com/l2jserver/datapack/handlers/communityboard/FavoriteBoard.java index ce5518c7f3..daf3964403 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/communityboard/FavoriteBoard.java +++ b/src/main/java/com/l2jserver/datapack/handlers/communityboard/FavoriteBoard.java @@ -34,43 +34,35 @@ import com.l2jserver.gameserver.util.Util; * Favorite board. * @author Zoey76 */ -public class FavoriteBoard implements IParseBoardHandler -{ +public class FavoriteBoard implements IParseBoardHandler { // SQL Queries private static final String SELECT_FAVORITES = "SELECT * FROM `bbs_favorites` WHERE `playerId`=? ORDER BY `favAddDate` DESC"; private static final String DELETE_FAVORITE = "DELETE FROM `bbs_favorites` WHERE `playerId`=? AND `favId`=?"; private static final String ADD_FAVORITE = "REPLACE INTO `bbs_favorites`(`playerId`, `favTitle`, `favBypass`) VALUES(?, ?, ?)"; - private static final String[] COMMANDS = - { + private static final String[] COMMANDS = { "_bbsgetfav", "bbs_add_fav", "_bbsdelfav_" }; @Override - public String[] getCommunityBoardCommands() - { + public String[] getCommunityBoardCommands() { return COMMANDS; } @Override - public boolean parseCommunityBoardCommand(String command, L2PcInstance activeChar) - { + public boolean parseCommunityBoardCommand(String command, L2PcInstance activeChar) { // None of this commands can be added to favorites. - if (command.startsWith("_bbsgetfav")) - { + if (command.startsWith("_bbsgetfav")) { // Load Favorite links final String list = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/favorite_list.html"); final StringBuilder sb = new StringBuilder(); try (Connection con = ConnectionFactory.getInstance().getConnection(); - PreparedStatement ps = con.prepareStatement(SELECT_FAVORITES)) - { + PreparedStatement ps = con.prepareStatement(SELECT_FAVORITES)) { ps.setInt(1, activeChar.getObjectId()); - try (ResultSet rs = ps.executeQuery()) - { - while (rs.next()) - { + try (ResultSet rs = ps.executeQuery()) { + while (rs.next()) { String link = list.replaceAll("%fav_bypass%", String.valueOf(rs.getString("favBypass"))); link = link.replaceAll("%fav_title%", rs.getString("favTitle")); final SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -82,60 +74,45 @@ public class FavoriteBoard implements IParseBoardHandler String html = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/favorite.html"); html = html.replaceAll("%fav_list%", sb.toString()); CommunityBoardHandler.separateAndSend(html, activeChar); - } - catch (Exception e) - { + } catch (Exception e) { LOG.warning(FavoriteBoard.class.getSimpleName() + ": Couldn't load favorite links for player " + activeChar.getName()); } - } - else if (command.startsWith("bbs_add_fav")) - { + } else if (command.startsWith("bbs_add_fav")) { final String bypass = CommunityBoardHandler.getInstance().removeBypass(activeChar); - if (bypass != null) - { + if (bypass != null) { final String[] parts = bypass.split("&", 2); - if (parts.length != 2) - { + if (parts.length != 2) { LOG.warning(FavoriteBoard.class.getSimpleName() + ": Couldn't add favorite link, " + bypass + " it's not a valid bypass!"); return false; } try (Connection con = ConnectionFactory.getInstance().getConnection(); - PreparedStatement ps = con.prepareStatement(ADD_FAVORITE)) - { + PreparedStatement ps = con.prepareStatement(ADD_FAVORITE)) { ps.setInt(1, activeChar.getObjectId()); ps.setString(2, parts[0].trim()); ps.setString(3, parts[1].trim()); ps.execute(); // Callback parseCommunityBoardCommand("_bbsgetfav", activeChar); - } - catch (Exception e) - { + } catch (Exception e) { LOG.warning(FavoriteBoard.class.getSimpleName() + ": Couldn't add favorite link " + bypass + " for player " + activeChar.getName()); } } - } - else if (command.startsWith("_bbsdelfav_")) - { + } else if (command.startsWith("_bbsdelfav_")) { final String favId = command.replaceAll("_bbsdelfav_", ""); - if (!Util.isDigit(favId)) - { + if (!Util.isDigit(favId)) { LOG.warning(FavoriteBoard.class.getSimpleName() + ": Couldn't delete favorite link, " + favId + " it's not a valid ID!"); return false; } try (Connection con = ConnectionFactory.getInstance().getConnection(); - PreparedStatement ps = con.prepareStatement(DELETE_FAVORITE)) - { + PreparedStatement ps = con.prepareStatement(DELETE_FAVORITE)) { ps.setInt(1, activeChar.getObjectId()); ps.setInt(2, Integer.parseInt(favId)); ps.execute(); // Callback parseCommunityBoardCommand("_bbsgetfav", activeChar); - } - catch (Exception e) - { + } catch (Exception e) { LOG.warning(FavoriteBoard.class.getSimpleName() + ": Couldn't delete favorite link ID " + favId + " for player " + activeChar.getName()); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/communityboard/FriendsBoard.java b/src/main/java/com/l2jserver/datapack/handlers/communityboard/FriendsBoard.java index 35236fa891..6e0163d1ca 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/communityboard/FriendsBoard.java +++ b/src/main/java/com/l2jserver/datapack/handlers/communityboard/FriendsBoard.java @@ -27,41 +27,32 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Friends board. * @author Zoey76 */ -public class FriendsBoard implements IParseBoardHandler -{ - private static final String[] COMMANDS = - { +public class FriendsBoard implements IParseBoardHandler { + private static final String[] COMMANDS = { "_friendlist", "_friendblocklist" }; @Override - public String[] getCommunityBoardCommands() - { + public String[] getCommunityBoardCommands() { return COMMANDS; } @Override - public boolean parseCommunityBoardCommand(String command, L2PcInstance activeChar) - { - if (command.equals("_friendlist")) - { + public boolean parseCommunityBoardCommand(String command, L2PcInstance activeChar) { + if (command.equals("_friendlist")) { CommunityBoardHandler.getInstance().addBypass(activeChar, "Friends List", command); final String html = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/friends_list.html"); CommunityBoardHandler.separateAndSend(html, activeChar); - } - else if (command.equals("_friendblocklist")) - { + } else if (command.equals("_friendblocklist")) { CommunityBoardHandler.getInstance().addBypass(activeChar, "Ignore list", command); final String html = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/friends_block_list.html"); CommunityBoardHandler.separateAndSend(html, activeChar); - } - else - { + } else { } return true; diff --git a/src/main/java/com/l2jserver/datapack/handlers/communityboard/HomeBoard.java b/src/main/java/com/l2jserver/datapack/handlers/communityboard/HomeBoard.java index 44694b9358..e4b0336663 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/communityboard/HomeBoard.java +++ b/src/main/java/com/l2jserver/datapack/handlers/communityboard/HomeBoard.java @@ -33,28 +33,23 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Home board. * @author Zoey76 */ -public final class HomeBoard implements IParseBoardHandler -{ +public final class HomeBoard implements IParseBoardHandler { // SQL Queries private static final String COUNT_FAVORITES = "SELECT COUNT(*) AS favorites FROM `bbs_favorites` WHERE `playerId`=?"; - private static final String[] COMMANDS = - { + private static final String[] COMMANDS = { "_bbshome", "_bbstop" }; @Override - public String[] getCommunityBoardCommands() - { + public String[] getCommunityBoardCommands() { return COMMANDS; } @Override - public boolean parseCommunityBoardCommand(String command, L2PcInstance activeChar) - { - if (command.equals("_bbshome") || command.equals("_bbstop")) - { + public boolean parseCommunityBoardCommand(String command, L2PcInstance activeChar) { + if (command.equals("_bbshome") || command.equals("_bbstop")) { CommunityBoardHandler.getInstance().addBypass(activeChar, "Home", command); String html = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/home.html"); @@ -62,12 +57,9 @@ public final class HomeBoard implements IParseBoardHandler html = html.replaceAll("%region_count%", Integer.toString(getRegionCount(activeChar))); html = html.replaceAll("%clan_count%", Integer.toString(ClanTable.getInstance().getClanCount())); CommunityBoardHandler.separateAndSend(html, activeChar); - } - else if (command.startsWith("_bbstop;")) - { + } else if (command.startsWith("_bbstop;")) { final String path = command.replace("_bbstop;", ""); - if ((path.length() > 0) && path.endsWith(".html")) - { + if ((path.length() > 0) && path.endsWith(".html")) { final String html = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/" + path); CommunityBoardHandler.separateAndSend(html, activeChar); } @@ -80,23 +72,17 @@ public final class HomeBoard implements IParseBoardHandler * @param player the player * @return the favorite links count */ - private static int getFavoriteCount(L2PcInstance player) - { + private static int getFavoriteCount(L2PcInstance player) { int count = 0; try (Connection con = ConnectionFactory.getInstance().getConnection(); - PreparedStatement ps = con.prepareStatement(COUNT_FAVORITES)) - { + PreparedStatement ps = con.prepareStatement(COUNT_FAVORITES)) { ps.setInt(1, player.getObjectId()); - try (ResultSet rs = ps.executeQuery()) - { - if (rs.next()) - { + try (ResultSet rs = ps.executeQuery()) { + if (rs.next()) { count = rs.getInt("favorites"); } } - } - catch (Exception e) - { + } catch (Exception e) { LOG.warning(FavoriteBoard.class.getSimpleName() + ": Coudn't load favorites count for player " + player.getName()); } return count; @@ -107,8 +93,7 @@ public final class HomeBoard implements IParseBoardHandler * @param player the player * @return the registered regions count */ - private static int getRegionCount(L2PcInstance player) - { + private static int getRegionCount(L2PcInstance player) { return 0; // TODO: Implement. } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/communityboard/HomepageBoard.java b/src/main/java/com/l2jserver/datapack/handlers/communityboard/HomepageBoard.java index 387922fa3c..c7a221e81a 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/communityboard/HomepageBoard.java +++ b/src/main/java/com/l2jserver/datapack/handlers/communityboard/HomepageBoard.java @@ -27,22 +27,18 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Homepage board. * @author Zoey76 */ -public class HomepageBoard implements IParseBoardHandler -{ - private static final String[] COMMANDS = - { +public class HomepageBoard implements IParseBoardHandler { + private static final String[] COMMANDS = { "_bbslink" }; @Override - public String[] getCommunityBoardCommands() - { + public String[] getCommunityBoardCommands() { return COMMANDS; } @Override - public boolean parseCommunityBoardCommand(String command, L2PcInstance activeChar) - { + public boolean parseCommunityBoardCommand(String command, L2PcInstance activeChar) { CommunityBoardHandler.separateAndSend(HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/homepage.html"), activeChar); return true; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/communityboard/MailBoard.java b/src/main/java/com/l2jserver/datapack/handlers/communityboard/MailBoard.java index 259e3aa2e5..cf50510bd9 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/communityboard/MailBoard.java +++ b/src/main/java/com/l2jserver/datapack/handlers/communityboard/MailBoard.java @@ -27,22 +27,18 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Mail board. * @author Zoey76 */ -public class MailBoard implements IWriteBoardHandler -{ - private static final String[] COMMANDS = - { +public class MailBoard implements IWriteBoardHandler { + private static final String[] COMMANDS = { "_maillist" }; @Override - public String[] getCommunityBoardCommands() - { + public String[] getCommunityBoardCommands() { return COMMANDS; } @Override - public boolean parseCommunityBoardCommand(String command, L2PcInstance activeChar) - { + public boolean parseCommunityBoardCommand(String command, L2PcInstance activeChar) { CommunityBoardHandler.getInstance().addBypass(activeChar, "Mail Command", command); final String html = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/mail.html"); @@ -51,8 +47,7 @@ public class MailBoard implements IWriteBoardHandler } @Override - public boolean writeCommunityBoardCommand(L2PcInstance activeChar, String arg1, String arg2, String arg3, String arg4, String arg5) - { + public boolean writeCommunityBoardCommand(L2PcInstance activeChar, String arg1, String arg2, String arg3, String arg4, String arg5) { // TODO: Implement. return false; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/communityboard/MemoBoard.java b/src/main/java/com/l2jserver/datapack/handlers/communityboard/MemoBoard.java index 23dfff5c9b..92c8076b81 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/communityboard/MemoBoard.java +++ b/src/main/java/com/l2jserver/datapack/handlers/communityboard/MemoBoard.java @@ -27,23 +27,19 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Memo board. * @author Zoey76 */ -public class MemoBoard implements IWriteBoardHandler -{ - private static final String[] COMMANDS = - { +public class MemoBoard implements IWriteBoardHandler { + private static final String[] COMMANDS = { "_bbsmemo", "_bbstopics" }; @Override - public String[] getCommunityBoardCommands() - { + public String[] getCommunityBoardCommands() { return COMMANDS; } @Override - public boolean parseCommunityBoardCommand(String command, L2PcInstance activeChar) - { + public boolean parseCommunityBoardCommand(String command, L2PcInstance activeChar) { CommunityBoardHandler.getInstance().addBypass(activeChar, "Memo Command", command); final String html = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/memo.html"); @@ -52,8 +48,7 @@ public class MemoBoard implements IWriteBoardHandler } @Override - public boolean writeCommunityBoardCommand(L2PcInstance activeChar, String arg1, String arg2, String arg3, String arg4, String arg5) - { + public boolean writeCommunityBoardCommand(L2PcInstance activeChar, String arg1, String arg2, String arg3, String arg4, String arg5) { // TODO: Implement. return false; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/communityboard/RegionBoard.java b/src/main/java/com/l2jserver/datapack/handlers/communityboard/RegionBoard.java index 6590dd46ee..c5202b1a22 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/communityboard/RegionBoard.java +++ b/src/main/java/com/l2jserver/datapack/handlers/communityboard/RegionBoard.java @@ -34,35 +34,29 @@ import com.l2jserver.gameserver.util.Util; * Region board. * @author Zoey76 */ -public class RegionBoard implements IWriteBoardHandler -{ +public class RegionBoard implements IWriteBoardHandler { // Region data // @formatter:off private static final int[] REGIONS = { 1049, 1052, 1053, 1057, 1060, 1059, 1248, 1247, 1056 }; // @formatter:on - private static final String[] COMMANDS = - { + private static final String[] COMMANDS = { "_bbsloc" }; @Override - public String[] getCommunityBoardCommands() - { + public String[] getCommunityBoardCommands() { return COMMANDS; } @Override - public boolean parseCommunityBoardCommand(String command, L2PcInstance activeChar) - { - if (command.equals("_bbsloc")) - { + public boolean parseCommunityBoardCommand(String command, L2PcInstance activeChar) { + if (command.equals("_bbsloc")) { CommunityBoardHandler.getInstance().addBypass(activeChar, "Region", command); final String list = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/region_list.html"); final StringBuilder sb = new StringBuilder(); final List<Castle> castles = CastleManager.getInstance().getCastles(); - for (int i = 0; i < REGIONS.length; i++) - { + for (int i = 0; i < REGIONS.length; i++) { final Castle castle = castles.get(i); final L2Clan clan = ClanTable.getInstance().getClan(castle.getOwnerId()); String link = list.replaceAll("%region_id%", String.valueOf(i)); @@ -76,14 +70,11 @@ public class RegionBoard implements IWriteBoardHandler String html = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/region.html"); html = html.replace("%region_list%", sb.toString()); CommunityBoardHandler.separateAndSend(html, activeChar); - } - else if (command.startsWith("_bbsloc;")) - { + } else if (command.startsWith("_bbsloc;")) { CommunityBoardHandler.getInstance().addBypass(activeChar, "Region>", command); final String id = command.replace("_bbsloc;", ""); - if (!Util.isDigit(id)) - { + if (!Util.isDigit(id)) { LOG.warning(RegionBoard.class.getSimpleName() + ": Player " + activeChar + " sent and invalid region bypass " + command + "!"); return false; } @@ -94,8 +85,7 @@ public class RegionBoard implements IWriteBoardHandler } @Override - public boolean writeCommunityBoardCommand(L2PcInstance activeChar, String arg1, String arg2, String arg3, String arg4, String arg5) - { + public boolean writeCommunityBoardCommand(L2PcInstance activeChar, String arg1, String arg2, String arg3, String arg4, String arg5) { // TODO: Implement. return false; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/custom/CustomAnnouncePkPvP.java b/src/main/java/com/l2jserver/datapack/handlers/custom/CustomAnnouncePkPvP.java index d31b1b0c88..69c46db410 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/custom/CustomAnnouncePkPvP.java +++ b/src/main/java/com/l2jserver/datapack/handlers/custom/CustomAnnouncePkPvP.java @@ -32,40 +32,31 @@ import com.l2jserver.gameserver.util.Broadcast; /** * @author Zealar */ -public class CustomAnnouncePkPvP -{ +public class CustomAnnouncePkPvP { - public CustomAnnouncePkPvP() - { - if (customs().announcePkPvP()) - { + public CustomAnnouncePkPvP() { + if (customs().announcePkPvP()) { Containers.Players().addListener(new ConsumerEventListener(Containers.Players(), EventType.ON_PLAYER_PVP_KILL, (OnPlayerPvPKill event) -> OnPlayerPvPKill(event), this)); } } - private Object OnPlayerPvPKill(OnPlayerPvPKill event) - { + private Object OnPlayerPvPKill(OnPlayerPvPKill event) { L2PcInstance pk = event.getActiveChar(); - if (pk.isGM()) - { + if (pk.isGM()) { return null; } L2PcInstance player = event.getTarget(); String msg = customs().getAnnouncePvpMsg(); - if (player.getPvpFlag() == 0) - { + if (player.getPvpFlag() == 0) { msg = customs().getAnnouncePkMsg(); } msg = msg.replace("$killer", pk.getName()).replace("$target", player.getName()); - if (customs().announcePkPvPNormalMessage()) - { + if (customs().announcePkPvPNormalMessage()) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1); sm.addString(msg); Broadcast.toAllOnlinePlayers(sm); - } - else - { + } else { Broadcast.toAllOnlinePlayers(msg, false); } return null; diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/consume/ConsumeChameleonRest.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/consume/ConsumeChameleonRest.java index c6c92f31d7..da3b564c7e 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/consume/ConsumeChameleonRest.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/consume/ConsumeChameleonRest.java @@ -31,12 +31,10 @@ import com.l2jserver.gameserver.network.SystemMessageId; /** * Chameleon Rest effect implementation. */ -public final class ConsumeChameleonRest extends AbstractEffect -{ +public final class ConsumeChameleonRest extends AbstractEffect { private final double _power; - public ConsumeChameleonRest(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public ConsumeChameleonRest(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getDouble("power", 0); @@ -44,37 +42,30 @@ public final class ConsumeChameleonRest extends AbstractEffect } @Override - public int getEffectFlags() - { + public int getEffectFlags() { return (EffectFlag.SILENT_MOVE.getMask() | EffectFlag.RELAXING.getMask()); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.RELAXING; } @Override - public boolean onActionTime(BuffInfo info) - { - if (info.getEffected().isDead()) - { + public boolean onActionTime(BuffInfo info) { + if (info.getEffected().isDead()) { return false; } final L2Character target = info.getEffected(); - if (target.isPlayer()) - { - if (!target.getActingPlayer().isSitting()) - { + if (target.isPlayer()) { + if (!target.getActingPlayer().isSitting()) { return false; } } final double manaDam = _power * getTicksMultiplier(); - if ((manaDam < 0) && ((target.getCurrentMp() + manaDam) <= 0)) - { + if ((manaDam < 0) && ((target.getCurrentMp() + manaDam) <= 0)) { target.sendPacket(SystemMessageId.SKILL_REMOVED_DUE_LACK_MP); return false; } @@ -84,14 +75,10 @@ public final class ConsumeChameleonRest extends AbstractEffect } @Override - public void onStart(BuffInfo info) - { - if (info.getEffected().isPlayer()) - { + public void onStart(BuffInfo info) { + if (info.getEffected().isPlayer()) { info.getEffected().getActingPlayer().sitDown(false); - } - else - { + } else { info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_REST); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/consume/ConsumeFakeDeath.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/consume/ConsumeFakeDeath.java index 3ce63dd9c5..50c7c17703 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/consume/ConsumeFakeDeath.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/consume/ConsumeFakeDeath.java @@ -32,12 +32,10 @@ import com.l2jserver.gameserver.network.serverpackets.Revive; * Consume Fake Death effect implementation. * @author mkizub */ -public final class ConsumeFakeDeath extends AbstractEffect -{ +public final class ConsumeFakeDeath extends AbstractEffect { private final double _power; - public ConsumeFakeDeath(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public ConsumeFakeDeath(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getDouble("power", 0); @@ -45,24 +43,20 @@ public final class ConsumeFakeDeath extends AbstractEffect } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.FAKE_DEATH; } @Override - public boolean onActionTime(BuffInfo info) - { - if (info.getEffected().isDead()) - { + public boolean onActionTime(BuffInfo info) { + if (info.getEffected().isDead()) { return false; } final L2Character target = info.getEffected(); final double manaDam = _power * getTicksMultiplier(); - if ((manaDam < 0) && ((target.getCurrentMp() + manaDam) <= 0)) - { + if ((manaDam < 0) && ((target.getCurrentMp() + manaDam) <= 0)) { target.sendPacket(SystemMessageId.SKILL_REMOVED_DUE_LACK_MP); return false; } @@ -72,10 +66,8 @@ public final class ConsumeFakeDeath extends AbstractEffect } @Override - public void onExit(BuffInfo info) - { - if (info.getEffected().isPlayer()) - { + public void onExit(BuffInfo info) { + if (info.getEffected().isPlayer()) { info.getEffected().getActingPlayer().setIsFakeDeath(false); info.getEffected().getActingPlayer().setRecentFakeDeath(true); } @@ -85,8 +77,7 @@ public final class ConsumeFakeDeath extends AbstractEffect } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { info.getEffected().startFakeDeath(); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/consume/ConsumeHp.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/consume/ConsumeHp.java index d2aaccb78b..e94d514d91 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/consume/ConsumeHp.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/consume/ConsumeHp.java @@ -30,12 +30,10 @@ import com.l2jserver.gameserver.network.SystemMessageId; * @author Adry_85 * @since 2.6.0.0 */ -public final class ConsumeHp extends AbstractEffect -{ +public final class ConsumeHp extends AbstractEffect { private final double _power; - public ConsumeHp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public ConsumeHp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getDouble("power", 0); @@ -43,18 +41,15 @@ public final class ConsumeHp extends AbstractEffect } @Override - public boolean onActionTime(BuffInfo info) - { - if (info.getEffected().isDead()) - { + public boolean onActionTime(BuffInfo info) { + if (info.getEffected().isDead()) { return false; } final L2Character target = info.getEffected(); final double consume = _power * getTicksMultiplier(); double hp = target.getCurrentHp(); - if ((consume < 0) && ((hp + consume) <= 0)) - { + if ((consume < 0) && ((hp + consume) <= 0)) { target.sendPacket(SystemMessageId.SKILL_REMOVED_DUE_LACK_HP); return false; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/consume/ConsumeMp.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/consume/ConsumeMp.java index 5943364129..64e86882a4 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/consume/ConsumeMp.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/consume/ConsumeMp.java @@ -30,12 +30,10 @@ import com.l2jserver.gameserver.network.SystemMessageId; * @author Adry_85 * @since 2.6.0.0 */ -public final class ConsumeMp extends AbstractEffect -{ +public final class ConsumeMp extends AbstractEffect { private final double _power; - public ConsumeMp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public ConsumeMp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getDouble("power", 0); @@ -43,18 +41,15 @@ public final class ConsumeMp extends AbstractEffect } @Override - public boolean onActionTime(BuffInfo info) - { - if (info.getEffected().isDead()) - { + public boolean onActionTime(BuffInfo info) { + if (info.getEffected().isDead()) { return false; } final L2Character target = info.getEffected(); final double consume = _power * getTicksMultiplier(); double mp = target.getCurrentMp(); - if ((consume < 0) && ((mp + consume) <= 0)) - { + if ((consume < 0) && ((mp + consume) <= 0)) { target.sendPacket(SystemMessageId.SKILL_REMOVED_DUE_LACK_MP); return false; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/consume/ConsumeMpByLevel.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/consume/ConsumeMpByLevel.java index a35e31d4ac..9084194203 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/consume/ConsumeMpByLevel.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/consume/ConsumeMpByLevel.java @@ -28,12 +28,10 @@ import com.l2jserver.gameserver.network.SystemMessageId; /** * Consume Mp By Level effect implementation. */ -public final class ConsumeMpByLevel extends AbstractEffect -{ +public final class ConsumeMpByLevel extends AbstractEffect { private final double _power; - public ConsumeMpByLevel(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public ConsumeMpByLevel(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getDouble("power", 0); @@ -41,18 +39,15 @@ public final class ConsumeMpByLevel extends AbstractEffect } @Override - public boolean onActionTime(BuffInfo info) - { - if (info.getEffected().isDead()) - { + public boolean onActionTime(BuffInfo info) { + if (info.getEffected().isDead()) { return false; } final L2Character target = info.getEffected(); double mp = target.getCurrentMp(); final double consume = _power * getTicksMultiplier() * ((target.getLevel() - 1) / 7.5); - if ((consume < 0) && ((mp + consume) <= 0)) - { + if ((consume < 0) && ((mp + consume) <= 0)) { target.sendPacket(SystemMessageId.SKILL_REMOVED_DUE_LACK_MP); return false; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/consume/ConsumeRest.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/consume/ConsumeRest.java index b7e23fe8e3..8843338bba 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/consume/ConsumeRest.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/consume/ConsumeRest.java @@ -31,12 +31,10 @@ import com.l2jserver.gameserver.network.SystemMessageId; /** * Consume Rest effect implementation. */ -public final class ConsumeRest extends AbstractEffect -{ +public final class ConsumeRest extends AbstractEffect { private final double _power; - public ConsumeRest(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public ConsumeRest(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getDouble("power", 0); @@ -44,44 +42,36 @@ public final class ConsumeRest extends AbstractEffect } @Override - public int getEffectFlags() - { + public int getEffectFlags() { return EffectFlag.RELAXING.getMask(); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.RELAXING; } @Override - public boolean onActionTime(BuffInfo info) - { - if (info.getEffected().isDead()) - { + public boolean onActionTime(BuffInfo info) { + if (info.getEffected().isDead()) { return false; } final L2Character target = info.getEffected(); - if (target.isPlayer()) - { - if (!target.getActingPlayer().isSitting()) - { + if (target.isPlayer()) { + if (!target.getActingPlayer().isSitting()) { return false; } } - if ((target.getCurrentHp() + 1) > target.getMaxRecoverableHp()) - { + if ((target.getCurrentHp() + 1) > target.getMaxRecoverableHp()) { target.sendPacket(SystemMessageId.SKILL_DEACTIVATED_HP_FULL); return false; } final double consume = _power * getTicksMultiplier(); double mp = target.getCurrentMp(); - if ((consume < 0) && ((mp + consume) <= 0)) - { + if ((consume < 0) && ((mp + consume) <= 0)) { target.sendPacket(SystemMessageId.SKILL_REMOVED_DUE_LACK_MP); return false; } @@ -91,14 +81,10 @@ public final class ConsumeRest extends AbstractEffect } @Override - public void onStart(BuffInfo info) - { - if (info.getEffected().isPlayer()) - { + public void onStart(BuffInfo info) { + if (info.getEffected().isPlayer()) { info.getEffected().getActingPlayer().sitDown(false); - } - else - { + } else { info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_REST); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/BlockAction.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/BlockAction.java index a2ae8130e1..1356ccc2d9 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/BlockAction.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/BlockAction.java @@ -35,56 +35,45 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Block Action effect implementation. * @author BiggBoss */ -public final class BlockAction extends AbstractEffect -{ +public final class BlockAction extends AbstractEffect { private final Set<Integer> _blockedActions = new HashSet<>(); - public BlockAction(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public BlockAction(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); final String[] actions = params.getString("blockedActions").split(","); - for (String action : actions) - { + for (String action : actions) { _blockedActions.add(Integer.parseInt(action)); } } @Override - public boolean canStart(BuffInfo info) - { + public boolean canStart(BuffInfo info) { return (info.getEffected() != null) && info.getEffected().isPlayer(); } @Override - public boolean checkCondition(Object id) - { + public boolean checkCondition(Object id) { return !_blockedActions.contains(id); } @Override - public void onExit(BuffInfo info) - { - if (_blockedActions.contains(BotReportTable.PARTY_ACTION_BLOCK_ID)) - { + public void onExit(BuffInfo info) { + if (_blockedActions.contains(BotReportTable.PARTY_ACTION_BLOCK_ID)) { PunishmentManager.getInstance().stopPunishment(info.getEffected().getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.PARTY_BAN); } - if (_blockedActions.contains(BotReportTable.CHAT_BLOCK_ID)) - { + if (_blockedActions.contains(BotReportTable.CHAT_BLOCK_ID)) { PunishmentManager.getInstance().stopPunishment(info.getEffected().getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN); } } @Override - public void onStart(BuffInfo info) - { - if (_blockedActions.contains(BotReportTable.PARTY_ACTION_BLOCK_ID)) - { + public void onStart(BuffInfo info) { + if (_blockedActions.contains(BotReportTable.PARTY_ACTION_BLOCK_ID)) { PunishmentManager.getInstance().startPunishment(new PunishmentTask(0, info.getEffected().getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.PARTY_BAN, 0, "block action debuff", "system", true)); } - if (_blockedActions.contains(BotReportTable.CHAT_BLOCK_ID)) - { + if (_blockedActions.contains(BotReportTable.CHAT_BLOCK_ID)) { PunishmentManager.getInstance().startPunishment(new PunishmentTask(0, info.getEffected().getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN, 0, "block action debuff", "system", true)); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Buff.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Buff.java index d778bdf8e9..56f59eb634 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Buff.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Buff.java @@ -28,22 +28,18 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Buff effect implementation. * @author mkizub */ -public class Buff extends AbstractEffect -{ - public Buff(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public class Buff extends AbstractEffect { + public Buff(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.BUFF; } @Override - public boolean onActionTime(BuffInfo info) - { + public boolean onActionTime(BuffInfo info) { return info.getSkill().isPassive() || info.getSkill().isToggle(); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Debuff.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Debuff.java index 92d35c311a..e48f62064b 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Debuff.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Debuff.java @@ -26,16 +26,13 @@ import com.l2jserver.gameserver.model.effects.L2EffectType; /** * Debuff effect implementation. */ -public final class Debuff extends AbstractEffect -{ - public Debuff(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class Debuff extends AbstractEffect { + public Debuff(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.DEBUFF; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Detection.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Detection.java index 796f158ea8..71b3f956bb 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Detection.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Detection.java @@ -29,42 +29,33 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Detection effect implementation. * @author UnAfraid */ -public final class Detection extends AbstractEffect -{ - public Detection(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class Detection extends AbstractEffect { + public Detection(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (!info.getEffector().isPlayer() || !info.getEffected().isPlayer()) - { + public void onStart(BuffInfo info) { + if (!info.getEffector().isPlayer() || !info.getEffected().isPlayer()) { return; } final L2PcInstance player = info.getEffector().getActingPlayer(); final L2PcInstance target = info.getEffected().getActingPlayer(); - if (target.isInvisible()) - { - if (player.isInPartyWith(target)) - { + if (target.isInvisible()) { + if (player.isInPartyWith(target)) { return; } - if (player.isInClanWith(target)) - { + if (player.isInClanWith(target)) { return; } - if (player.isInAllyWith(target)) - { + if (player.isInAllyWith(target)) { return; } // Remove Hide. diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Flag.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Flag.java index 31d2d77d65..3e53321def 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Flag.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Flag.java @@ -27,28 +27,23 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Flag effect implementation. * @author BiggBoss */ -public final class Flag extends AbstractEffect -{ - public Flag(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class Flag extends AbstractEffect { + public Flag(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean canStart(BuffInfo info) - { + public boolean canStart(BuffInfo info) { return (info.getEffected() != null) && info.getEffected().isPlayer(); } @Override - public void onExit(BuffInfo info) - { + public void onExit(BuffInfo info) { info.getEffected().getActingPlayer().updatePvPFlag(0); } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { info.getEffected().updatePvPFlag(1); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Grow.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Grow.java index 1eb9e8846c..616f1d5641 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Grow.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Grow.java @@ -28,34 +28,27 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; /** * Grow effect implementation. */ -public final class Grow extends AbstractEffect -{ - public Grow(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class Grow extends AbstractEffect { + public Grow(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.BUFF; } @Override - public void onExit(BuffInfo info) - { - if (info.getEffected().isNpc()) - { + public void onExit(BuffInfo info) { + if (info.getEffected().isNpc()) { L2Npc npc = (L2Npc) info.getEffected(); npc.setCollisionRadius(npc.getTemplate().getfCollisionRadius()); } } @Override - public void onStart(BuffInfo info) - { - if (info.getEffected().isNpc()) - { + public void onStart(BuffInfo info) { + if (info.getEffected().isNpc()) { L2Npc npc = (L2Npc) info.getEffected(); npc.setCollisionRadius(npc.getTemplate().getCollisionRadiusGrown()); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/ImmobileBuff.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/ImmobileBuff.java index f4234a2e9a..33f19efe8d 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/ImmobileBuff.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/ImmobileBuff.java @@ -27,28 +27,23 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Immobile Buff effect implementation. * @author mkizub */ -public final class ImmobileBuff extends Buff -{ - public ImmobileBuff(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class ImmobileBuff extends Buff { + public ImmobileBuff(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.BUFF; } @Override - public void onExit(BuffInfo info) - { + public void onExit(BuffInfo info) { info.getEffected().setIsImmobilized(false); } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { info.getEffected().setIsImmobilized(true); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/ImmobilePetBuff.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/ImmobilePetBuff.java index acfdd9d46a..2edaa81937 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/ImmobilePetBuff.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/ImmobilePetBuff.java @@ -29,30 +29,24 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Immobile Pet Buff effect implementation. * @author demonia */ -public final class ImmobilePetBuff extends AbstractEffect -{ - public ImmobilePetBuff(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class ImmobilePetBuff extends AbstractEffect { + public ImmobilePetBuff(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.BUFF; } @Override - public void onExit(BuffInfo info) - { + public void onExit(BuffInfo info) { info.getEffected().setIsImmobilized(false); } @Override - public void onStart(BuffInfo info) - { - if (info.getEffected().isSummon() && info.getEffector().isPlayer() && (((L2Summon) info.getEffected()).getOwner() == info.getEffector())) - { + public void onStart(BuffInfo info) { + if (info.getEffected().isSummon() && info.getEffector().isPlayer() && (((L2Summon) info.getEffected()).getOwner() == info.getEffector())) { info.getEffected().setIsImmobilized(true); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Mute.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Mute.java index ad2a236ebe..1b6cca6deb 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Mute.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Mute.java @@ -29,28 +29,23 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; /** * Mute effect implementation. */ -public final class Mute extends AbstractEffect -{ - public Mute(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class Mute extends AbstractEffect { + public Mute(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public int getEffectFlags() - { + public int getEffectFlags() { return EffectFlag.MUTED.getMask(); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.MUTE; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { info.getEffected().abortCast(); info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_MUTED); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/OpenChest.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/OpenChest.java index f0f9dfea72..b393d81f12 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/OpenChest.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/OpenChest.java @@ -30,43 +30,34 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Open Chest effect implementation. * @author Adry_85 */ -public final class OpenChest extends AbstractEffect -{ - public OpenChest(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class OpenChest extends AbstractEffect { + public OpenChest(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (!(info.getEffected() instanceof L2ChestInstance)) - { + public void onStart(BuffInfo info) { + if (!(info.getEffected() instanceof L2ChestInstance)) { return; } final L2PcInstance player = info.getEffector().getActingPlayer(); final L2ChestInstance chest = (L2ChestInstance) info.getEffected(); - if (chest.isDead() || (player.getInstanceId() != chest.getInstanceId())) - { + if (chest.isDead() || (player.getInstanceId() != chest.getInstanceId())) { return; } - if (((player.getLevel() <= 77) && (Math.abs(chest.getLevel() - player.getLevel()) <= 6)) || ((player.getLevel() >= 78) && (Math.abs(chest.getLevel() - player.getLevel()) <= 5))) - { + if (((player.getLevel() <= 77) && (Math.abs(chest.getLevel() - player.getLevel()) <= 6)) || ((player.getLevel() >= 78) && (Math.abs(chest.getLevel() - player.getLevel()) <= 5))) { player.broadcastSocialAction(3); chest.setSpecialDrop(); chest.setMustRewardExpSp(false); chest.reduceCurrentHp(chest.getMaxHp(), player, info.getSkill()); - } - else - { + } else { player.broadcastSocialAction(13); chest.addDamageHate(player, 0, 1); chest.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player); diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/OpenDoor.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/OpenDoor.java index c8ba1f4a78..ea280b2a1e 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/OpenDoor.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/OpenDoor.java @@ -33,13 +33,11 @@ import com.l2jserver.gameserver.network.SystemMessageId; * Open Door effect implementation. * @author Adry_85 */ -public final class OpenDoor extends AbstractEffect -{ +public final class OpenDoor extends AbstractEffect { private final int _chance; private final boolean _isItem; - public OpenDoor(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public OpenDoor(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _chance = params.getInt("chance", 0); @@ -47,57 +45,46 @@ public final class OpenDoor extends AbstractEffect } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (!info.getEffected().isDoor()) - { + public void onStart(BuffInfo info) { + if (!info.getEffected().isDoor()) { return; } final L2Character effector = info.getEffector(); L2DoorInstance door = (L2DoorInstance) info.getEffected(); // Check if door in the different instance - if (effector.getInstanceId() != door.getInstanceId()) - { + if (effector.getInstanceId() != door.getInstanceId()) { // Search for the instance final Instance inst = InstanceManager.getInstance().getInstance(effector.getInstanceId()); - if (inst == null) - { + if (inst == null) { // Instance not found return; } final L2DoorInstance instanceDoor = inst.getDoor(door.getId()); - if (instanceDoor != null) - { + if (instanceDoor != null) { // Door found door = instanceDoor; } // Checking instance again - if (effector.getInstanceId() != door.getInstanceId()) - { + if (effector.getInstanceId() != door.getInstanceId()) { return; } } - if ((!door.isOpenableBySkill() && !_isItem) || (door.getFort() != null)) - { + if ((!door.isOpenableBySkill() && !_isItem) || (door.getFort() != null)) { effector.sendPacket(SystemMessageId.UNABLE_TO_UNLOCK_DOOR); return; } - if ((Rnd.get(100) < _chance) && !door.getOpen()) - { + if ((Rnd.get(100) < _chance) && !door.getOpen()) { door.openMe(); - } - else - { + } else { effector.sendPacket(SystemMessageId.FAILED_TO_UNLOCK_DOOR); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Paralyze.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Paralyze.java index b37367a230..3c22c9504a 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Paralyze.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Paralyze.java @@ -30,37 +30,30 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; /** * Paralyze effect implementation. */ -public final class Paralyze extends AbstractEffect -{ - public Paralyze(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class Paralyze extends AbstractEffect { + public Paralyze(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public int getEffectFlags() - { + public int getEffectFlags() { return EffectFlag.PARALYZED.getMask(); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.PARALYZE; } @Override - public void onExit(BuffInfo info) - { - if (!info.getEffected().isPlayer()) - { + public void onExit(BuffInfo info) { + if (!info.getEffected().isPlayer()) { info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_THINK); } } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, info.getEffector()); info.getEffected().startParalyze(); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Recovery.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Recovery.java index e028f060b7..4454a28d34 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Recovery.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Recovery.java @@ -27,24 +27,19 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Recovery effect implementation. * @author Kerberos */ -public final class Recovery extends AbstractEffect -{ - public Recovery(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class Recovery extends AbstractEffect { + public Recovery(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (info.getEffected().isPlayer()) - { + public void onStart(BuffInfo info) { + if (info.getEffected().isPlayer()) { info.getEffected().getActingPlayer().reduceDeathPenaltyBuffLevel(); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Root.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Root.java index 3a0a99b161..9e64975776 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Root.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Root.java @@ -30,37 +30,30 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Root effect implementation. * @author mkizub */ -public final class Root extends AbstractEffect -{ - public Root(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class Root extends AbstractEffect { + public Root(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public int getEffectFlags() - { + public int getEffectFlags() { return EffectFlag.ROOTED.getMask(); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.ROOT; } @Override - public void onExit(BuffInfo info) - { - if (!info.getEffected().isPlayer()) - { + public void onExit(BuffInfo info) { + if (!info.getEffected().isPlayer()) { info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_THINK); } } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { info.getEffected().stopMove(null); info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_ROOTED); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/SilentMove.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/SilentMove.java index 35f6eaac84..5a65429240 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/SilentMove.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/SilentMove.java @@ -26,16 +26,13 @@ import com.l2jserver.gameserver.model.effects.EffectFlag; /** * Silent Move effect implementation. */ -public final class SilentMove extends AbstractEffect -{ - public SilentMove(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class SilentMove extends AbstractEffect { + public SilentMove(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public int getEffectFlags() - { + public int getEffectFlags() { return EffectFlag.SILENT_MOVE.getMask(); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Sleep.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Sleep.java index f16b0855c8..1e5e51fe20 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Sleep.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Sleep.java @@ -30,37 +30,30 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Sleep effect implementation. * @author mkizub */ -public final class Sleep extends AbstractEffect -{ - public Sleep(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class Sleep extends AbstractEffect { + public Sleep(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public int getEffectFlags() - { + public int getEffectFlags() { return EffectFlag.SLEEP.getMask(); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.SLEEP; } @Override - public void onExit(BuffInfo info) - { - if (!info.getEffected().isPlayer()) - { + public void onExit(BuffInfo info) { + if (!info.getEffected().isPlayer()) { info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_THINK); } } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { info.getEffected().abortAttack(); info.getEffected().abortCast(); info.getEffected().stopMove(null); diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Stun.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Stun.java index 7e5934dd88..430888df30 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Stun.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/Stun.java @@ -29,34 +29,28 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Stun effect implementation. * @author mkizub */ -public final class Stun extends AbstractEffect -{ - public Stun(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class Stun extends AbstractEffect { + public Stun(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public int getEffectFlags() - { + public int getEffectFlags() { return EffectFlag.STUNNED.getMask(); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.STUN; } @Override - public void onExit(BuffInfo info) - { + public void onExit(BuffInfo info) { info.getEffected().stopStunning(false); } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { info.getEffected().startStunning(); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/ThrowUp.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/ThrowUp.java index 9b2cfca60d..e78f645eb0 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/ThrowUp.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/custom/ThrowUp.java @@ -33,32 +33,27 @@ import com.l2jserver.gameserver.network.serverpackets.ValidateLocation; /** * Throw Up effect implementation. */ -public final class ThrowUp extends AbstractEffect -{ +public final class ThrowUp extends AbstractEffect { private final int _flyRadius; - public ThrowUp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public ThrowUp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _flyRadius = params.getInt("flyRadius", 0); } @Override - public int getEffectFlags() - { + public int getEffectFlags() { return EffectFlag.STUNNED.getMask(); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { L2Character target = info.getEffected(); L2Character activeChar = info.getEffector(); @@ -72,8 +67,7 @@ public final class ThrowUp extends AbstractEffect double dy = activeChar.getY() - curY; double dz = activeChar.getZ() - curZ; double distance = Math.hypot(dx, dy); - if (distance > 2000) - { + if (distance > 2000) { _log.info("EffectThrow was going to use invalid coordinates for characters, getEffected: " + curX + "," + curY + " and getEffector: " + activeChar.getX() + "," + activeChar.getY()); return; } @@ -82,14 +76,12 @@ public final class ThrowUp extends AbstractEffect // approximation for moving futher when z coordinates are different // TODO: handle Z axis movement better offset += Math.abs(dz); - if (offset < 5) - { + if (offset < 5) { offset = 5; } // If no distance - if (distance < 1) - { + if (distance < 1) { return; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/AddHate.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/AddHate.java index 40377def3d..c72b490498 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/AddHate.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/AddHate.java @@ -28,38 +28,30 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Add Hate effect implementation. * @author Adry_85 */ -public final class AddHate extends AbstractEffect -{ +public final class AddHate extends AbstractEffect { private final double _power; - public AddHate(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public AddHate(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getDouble("power", 0); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (!info.getEffected().isAttackable()) - { + public void onStart(BuffInfo info) { + if (!info.getEffected().isAttackable()) { return; } final double val = _power; - if (val > 0) - { + if (val > 0) { ((L2Attackable) info.getEffected()).addDamageHate(info.getEffector(), 0, (int) val); - } - else if (val < 0) - { + } else if (val < 0) { ((L2Attackable) info.getEffected()).reduceHate(info.getEffector(), (int) -val); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Backstab.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Backstab.java index 3d4fcd0a14..b128a3abf0 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Backstab.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Backstab.java @@ -33,14 +33,12 @@ import com.l2jserver.gameserver.model.stats.Formulas; * Backstab effect implementation. * @author Adry_85 */ -public final class Backstab extends AbstractEffect -{ +public final class Backstab extends AbstractEffect { private final double _power; private final int _blowChance; private final int _criticalChance; - public Backstab(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public Backstab(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getDouble("power", 0); @@ -49,28 +47,23 @@ public final class Backstab extends AbstractEffect } @Override - public boolean calcSuccess(BuffInfo info) - { + public boolean calcSuccess(BuffInfo info) { return !info.getEffector().isInFrontOf(info.getEffected()) && !Formulas.calcPhysicalSkillEvasion(info.getEffector(), info.getEffected(), info.getSkill()) && Formulas.calcBlowSuccess(info.getEffector(), info.getEffected(), info.getSkill(), _blowChance); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.PHYSICAL_ATTACK; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (info.getEffector().isAlikeDead()) - { + public void onStart(BuffInfo info) { + if (info.getEffector().isAlikeDead()) { return; } @@ -82,8 +75,7 @@ public final class Backstab extends AbstractEffect double damage = Formulas.calcBackstabDamage(activeChar, target, skill, shld, ss, _power); // Crit rate base crit rate for skill, modified with STR bonus - if (Formulas.calcSkillCrit(activeChar, target, _criticalChance)) - { + if (Formulas.calcSkillCrit(activeChar, target, _criticalChance)) { damage *= 2; } @@ -91,14 +83,12 @@ public final class Backstab extends AbstractEffect target.notifyDamageReceived(damage, activeChar, skill, true, false, false); // Manage attack or cast break of the target (calculating rate, sending message...) - if (!target.isRaid() && Formulas.calcAtkBreak(target, damage)) - { + if (!target.isRaid() && Formulas.calcAtkBreak(target, damage)) { target.breakAttack(); target.breakCast(); } - if (activeChar.isPlayer()) - { + if (activeChar.isPlayer()) { L2PcInstance activePlayer = activeChar.getActingPlayer(); activePlayer.sendDamageMessage(target, (int) damage, false, true, false); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Blink.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Blink.java index 9314ebffc6..81bbfba063 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Blink.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Blink.java @@ -43,13 +43,11 @@ import com.l2jserver.gameserver.util.Util; * By the way, if flyCourse = 360 or 0, player will be moved in in front of him. <br> * @author DrHouse */ -public final class Blink extends AbstractEffect -{ +public final class Blink extends AbstractEffect { private final int _flyCourse; private final int _flyRadius; - public Blink(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public Blink(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _flyCourse = params.getInt("flyCourse", 0); @@ -57,14 +55,12 @@ public final class Blink extends AbstractEffect } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2Character effected = info.getEffected(); final double angle = Util.convertHeadingToDegree(effected.getHeading()); final double radian = Math.toRadians(angle); diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Bluff.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Bluff.java index 042f03b19c..8efac96539 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Bluff.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Bluff.java @@ -31,36 +31,30 @@ import com.l2jserver.gameserver.network.serverpackets.StopRotation; * Bluff effect implementation. * @author decad */ -public final class Bluff extends AbstractEffect -{ +public final class Bluff extends AbstractEffect { private final int _chance; - public Bluff(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public Bluff(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _chance = params.getInt("chance", 100); } @Override - public boolean calcSuccess(BuffInfo info) - { + public boolean calcSuccess(BuffInfo info) { return Formulas.calcProbability(_chance, info.getEffector(), info.getEffected(), info.getSkill()); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2Character effected = info.getEffected(); // Headquarters NPC should not rotate - if ((effected.getId() == 35062) || effected.isRaid() || effected.isRaidMinion()) - { + if ((effected.getId() == 35062) || effected.isRaid() || effected.isRaidMinion()) { return; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/CallParty.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/CallParty.java index dd6971b434..d4a2cbe0d3 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/CallParty.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/CallParty.java @@ -28,33 +28,25 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Call Party effect implementation. * @author Adry_85 */ -public final class CallParty extends AbstractEffect -{ - public CallParty(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class CallParty extends AbstractEffect { + public CallParty(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (!info.getEffector().isInParty()) - { + public void onStart(BuffInfo info) { + if (!info.getEffector().isInParty()) { return; } - for (L2PcInstance partyMember : info.getEffector().getParty().getMembers()) - { - if (info.getEffector().getActingPlayer().canSummonTarget(partyMember)) - { - if (info.getEffector() != partyMember) - { + for (L2PcInstance partyMember : info.getEffector().getParty().getMembers()) { + if (info.getEffector().getActingPlayer().canSummonTarget(partyMember)) { + if (info.getEffector() != partyMember) { partyMember.teleToLocation(info.getEffector().getLocation(), true); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/CallPc.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/CallPc.java index 9839ef7a1a..2434c52329 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/CallPc.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/CallPc.java @@ -31,13 +31,11 @@ import com.l2jserver.gameserver.network.serverpackets.ConfirmDlg; * Call Pc effect implementation. * @author Adry_85 */ -public final class CallPc extends AbstractEffect -{ +public final class CallPc extends AbstractEffect { private final int _itemId; private final int _itemCount; - public CallPc(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public CallPc(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _itemId = params.getInt("itemId", 0); @@ -45,23 +43,19 @@ public final class CallPc extends AbstractEffect } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (info.getEffected() == info.getEffector()) - { + public void onStart(BuffInfo info) { + if (info.getEffected() == info.getEffector()) { return; } L2PcInstance target = info.getEffected().getActingPlayer(); L2PcInstance activeChar = info.getEffector().getActingPlayer(); - if (activeChar.canSummonTarget(target)) - { + if (activeChar.canSummonTarget(target)) { target.addScript(new SummonRequestHolder(activeChar, _itemId, _itemCount)); final ConfirmDlg confirm = new ConfirmDlg(SystemMessageId.C1_WISHES_TO_SUMMON_YOU_FROM_S2_DO_YOU_ACCEPT.getId()); confirm.addCharName(activeChar); diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/CallSkill.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/CallSkill.java index abbefac39b..2f782d12e2 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/CallSkill.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/CallSkill.java @@ -28,26 +28,22 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Call Skill effect implementation. * @author NosBit */ -public final class CallSkill extends AbstractEffect -{ +public final class CallSkill extends AbstractEffect { private final SkillHolder _skill; - public CallSkill(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public CallSkill(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _skill = new SkillHolder(params.getInt("skillId"), params.getInt("skillLevel", 1)); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { info.getEffector().makeTriggerCast(_skill.getSkill(), info.getEffected(), true); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ChangeFace.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ChangeFace.java index f958d345a9..6d1d36aa66 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ChangeFace.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ChangeFace.java @@ -28,28 +28,23 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Change Face effect implementation. * @author Zoey76 */ -public final class ChangeFace extends AbstractEffect -{ +public final class ChangeFace extends AbstractEffect { private final int _value; - public ChangeFace(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public ChangeFace(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _value = params.getInt("value", 0); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if ((info.getEffector() == null) || (info.getEffected() == null) || !info.getEffector().isPlayer() || !info.getEffected().isPlayer() || info.getEffected().isAlikeDead()) - { + public void onStart(BuffInfo info) { + if ((info.getEffector() == null) || (info.getEffected() == null) || !info.getEffector().isPlayer() || !info.getEffected().isPlayer() || info.getEffected().isAlikeDead()) { return; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ChangeHairColor.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ChangeHairColor.java index 5fa0c1fde1..fa5f846a68 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ChangeHairColor.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ChangeHairColor.java @@ -28,28 +28,23 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Change Hair Color effect implementation. * @author Zoey76 */ -public final class ChangeHairColor extends AbstractEffect -{ +public final class ChangeHairColor extends AbstractEffect { private final int _value; - public ChangeHairColor(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public ChangeHairColor(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _value = params.getInt("value", 0); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if ((info.getEffector() == null) || (info.getEffected() == null) || !info.getEffector().isPlayer() || !info.getEffected().isPlayer() || info.getEffected().isAlikeDead()) - { + public void onStart(BuffInfo info) { + if ((info.getEffector() == null) || (info.getEffected() == null) || !info.getEffector().isPlayer() || !info.getEffected().isPlayer() || info.getEffected().isAlikeDead()) { return; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ChangeHairStyle.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ChangeHairStyle.java index 3e5158e10a..ce25db4c9f 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ChangeHairStyle.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ChangeHairStyle.java @@ -28,28 +28,23 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Change Hair Style effect implementation. * @author Zoey76 */ -public final class ChangeHairStyle extends AbstractEffect -{ +public final class ChangeHairStyle extends AbstractEffect { private final int _value; - public ChangeHairStyle(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public ChangeHairStyle(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _value = params.getInt("value", 0); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if ((info.getEffector() == null) || (info.getEffected() == null) || !info.getEffector().isPlayer() || !info.getEffected().isPlayer() || info.getEffected().isAlikeDead()) - { + public void onStart(BuffInfo info) { + if ((info.getEffector() == null) || (info.getEffected() == null) || !info.getEffector().isPlayer() || !info.getEffected().isPlayer() || info.getEffected().isAlikeDead()) { return; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ClanGate.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ClanGate.java index 208584773a..da9161b896 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ClanGate.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ClanGate.java @@ -30,21 +30,16 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Clan Gate effect implementation. * @author ZaKaX */ -public final class ClanGate extends AbstractEffect -{ - public ClanGate(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class ClanGate extends AbstractEffect { + public ClanGate(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public void onStart(BuffInfo info) - { - if (info.getEffected().isPlayer()) - { + public void onStart(BuffInfo info) { + if (info.getEffected().isPlayer()) { final L2Clan clan = info.getEffected().getActingPlayer().getClan(); - if (clan != null) - { + if (clan != null) { SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.COURT_MAGICIAN_CREATED_PORTAL); clan.broadcastToOtherOnlineMembers(msg, info.getEffected().getActingPlayer()); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Confuse.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Confuse.java index f7bf9ff4a3..f138a0161e 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Confuse.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Confuse.java @@ -37,62 +37,51 @@ import com.l2jserver.gameserver.model.stats.Formulas; * Confuse effect implementation. * @author littlecrow */ -public final class Confuse extends AbstractEffect -{ +public final class Confuse extends AbstractEffect { private final int _chance; - public Confuse(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public Confuse(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _chance = params.getInt("chance", 100); } @Override - public boolean calcSuccess(BuffInfo info) - { + public boolean calcSuccess(BuffInfo info) { return Formulas.calcProbability(_chance, info.getEffector(), info.getEffected(), info.getSkill()); } @Override - public int getEffectFlags() - { + public int getEffectFlags() { return EffectFlag.CONFUSED.getMask(); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onExit(BuffInfo info) - { - if (!info.getEffected().isPlayer()) - { + public void onExit(BuffInfo info) { + if (!info.getEffected().isPlayer()) { info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_THINK); } } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_CONFUSED); final List<L2Character> targetList = new ArrayList<>(); // Getting the possible targets - for (L2Object obj : info.getEffected().getKnownList().getKnownObjects().values()) - { - if (((info.getEffected().isMonster() && obj.isAttackable()) || (obj instanceof L2Character)) && (obj != info.getEffected())) - { + for (L2Object obj : info.getEffected().getKnownList().getKnownObjects().values()) { + if (((info.getEffected().isMonster() && obj.isAttackable()) || (obj instanceof L2Character)) && (obj != info.getEffected())) { targetList.add((L2Character) obj); } } // if there is no target, exit function - if (!targetList.isEmpty()) - { + if (!targetList.isEmpty()) { // Choosing randomly a new target final L2Character target = targetList.get(Rnd.nextInt(targetList.size())); // Attacking the target diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ConsumeBody.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ConsumeBody.java index c9cb53504b..413a171a75 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ConsumeBody.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ConsumeBody.java @@ -28,24 +28,19 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Consume Body effect implementation. * @author Zoey76 */ -public final class ConsumeBody extends AbstractEffect -{ - public ConsumeBody(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class ConsumeBody extends AbstractEffect { + public ConsumeBody(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if ((info.getEffector() == null) || (info.getEffected() == null) || !info.getEffected().isNpc() || !info.getEffected().isDead()) - { + public void onStart(BuffInfo info) { + if ((info.getEffector() == null) || (info.getEffected() == null) || !info.getEffected().isNpc() || !info.getEffected().isDead()) { return; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ConvertItem.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ConvertItem.java index 45743828c7..92060d263d 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ConvertItem.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ConvertItem.java @@ -35,53 +35,43 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Convert Item effect implementation. * @author Zoey76 */ -public final class ConvertItem extends AbstractEffect -{ - public ConvertItem(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class ConvertItem extends AbstractEffect { + public ConvertItem(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if ((info.getEffector() == null) || (info.getEffected() == null) || info.getEffected().isAlikeDead() || !info.getEffected().isPlayer()) - { + public void onStart(BuffInfo info) { + if ((info.getEffector() == null) || (info.getEffected() == null) || info.getEffected().isAlikeDead() || !info.getEffected().isPlayer()) { return; } final L2PcInstance player = info.getEffected().getActingPlayer(); - if (player.isEnchanting()) - { + if (player.isEnchanting()) { return; } final L2Weapon weaponItem = player.getActiveWeaponItem(); - if (weaponItem == null) - { + if (weaponItem == null) { return; } L2ItemInstance wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND); - if (wpn == null) - { + if (wpn == null) { wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND); } - if ((wpn == null) || wpn.isAugmented() || (weaponItem.getChangeWeaponId() == 0)) - { + if ((wpn == null) || wpn.isAugmented() || (weaponItem.getChangeWeaponId() == 0)) { return; } final int newItemId = weaponItem.getChangeWeaponId(); - if (newItemId == -1) - { + if (newItemId == -1) { return; } @@ -89,73 +79,59 @@ public final class ConvertItem extends AbstractEffect final Elementals elementals = wpn.getElementals() == null ? null : wpn.getElementals()[0]; final L2ItemInstance[] unequiped = player.getInventory().unEquipItemInBodySlotAndRecord(wpn.getItem().getBodyPart()); final InventoryUpdate iu = new InventoryUpdate(); - for (L2ItemInstance item : unequiped) - { + for (L2ItemInstance item : unequiped) { iu.addModifiedItem(item); } player.sendPacket(iu); - if (unequiped.length <= 0) - { + if (unequiped.length <= 0) { return; } byte count = 0; - for (L2ItemInstance item : unequiped) - { - if (!(item.getItem() instanceof L2Weapon)) - { + for (L2ItemInstance item : unequiped) { + if (!(item.getItem() instanceof L2Weapon)) { count++; continue; } final SystemMessage sm; - if (item.getEnchantLevel() > 0) - { + if (item.getEnchantLevel() > 0) { sm = SystemMessage.getSystemMessage(SystemMessageId.EQUIPMENT_S1_S2_REMOVED); sm.addInt(item.getEnchantLevel()); sm.addItemName(item); - } - else - { + } else { sm = SystemMessage.getSystemMessage(SystemMessageId.S1_DISARMED); sm.addItemName(item); } player.sendPacket(sm); } - if (count == unequiped.length) - { + if (count == unequiped.length) { return; } final L2ItemInstance destroyItem = player.getInventory().destroyItem("ChangeWeapon", wpn, player, null); - if (destroyItem == null) - { + if (destroyItem == null) { return; } final L2ItemInstance newItem = player.getInventory().addItem("ChangeWeapon", newItemId, 1, player, destroyItem); - if (newItem == null) - { + if (newItem == null) { return; } - if ((elementals != null) && (elementals.getElement() != -1) && (elementals.getValue() != -1)) - { + if ((elementals != null) && (elementals.getElement() != -1) && (elementals.getValue() != -1)) { newItem.setElementAttr(elementals.getElement(), elementals.getValue()); } newItem.setEnchantLevel(enchantLevel); player.getInventory().equipItem(newItem); final SystemMessage msg; - if (newItem.getEnchantLevel() > 0) - { + if (newItem.getEnchantLevel() > 0) { msg = SystemMessage.getSystemMessage(SystemMessageId.S1_S2_EQUIPPED); msg.addInt(newItem.getEnchantLevel()); msg.addItemName(newItem); - } - else - { + } else { msg = SystemMessage.getSystemMessage(SystemMessageId.S1_EQUIPPED); msg.addItemName(newItem); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Cp.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Cp.java index 563fdba87f..51380cb79c 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Cp.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Cp.java @@ -33,13 +33,11 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * @author Adry_85 * @since 2.6.0.0 */ -public final class Cp extends AbstractEffect -{ +public final class Cp extends AbstractEffect { private final double _amount; private final EffectCalculationType _mode; - public Cp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public Cp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _amount = params.getDouble("amount", 0); @@ -47,65 +45,50 @@ public final class Cp extends AbstractEffect } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.CP; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2Character target = info.getEffected(); final L2Character activeChar = info.getEffector(); - if ((target == null) || target.isDead() || !target.isPlayer()) - { + if ((target == null) || target.isDead() || !target.isPlayer()) { return; } double amount = 0; - switch (_mode) - { - case DIFF: - { + switch (_mode) { + case DIFF: { amount = Math.min(_amount, target.getMaxRecoverableCp() - target.getCurrentCp()); break; } - case PER: - { - if (_amount < 0) - { + case PER: { + if (_amount < 0) { amount = (target.getCurrentCp() * _amount) / 100; - } - else - { + } else { amount = Math.min((target.getMaxCp() * _amount) / 100.0, target.getMaxRecoverableCp() - target.getCurrentCp()); } break; } } - if (amount != 0) - { + if (amount != 0) { target.setCurrentCp(amount + target.getCurrentCp()); } - if (amount >= 0) - { - if ((activeChar != null) && (activeChar != target)) - { + if (amount >= 0) { + if ((activeChar != null) && (activeChar != target)) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S2_CP_HAS_BEEN_RESTORED_BY_C1); sm.addCharName(activeChar); sm.addInt((int) amount); target.sendPacket(sm); - } - else - { + } else { target.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.S1_CP_HAS_BEEN_RESTORED).addInt((int) amount)); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DeathLink.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DeathLink.java index b593bd23a8..fbbf5f594e 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DeathLink.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DeathLink.java @@ -34,38 +34,32 @@ import com.l2jserver.gameserver.model.stats.Stats; * Death Link effect implementation. * @author Adry_85 */ -public final class DeathLink extends AbstractEffect -{ +public final class DeathLink extends AbstractEffect { private final double _power; - public DeathLink(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public DeathLink(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getDouble("power", 0); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.MAGICAL_ATTACK; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2Character target = info.getEffected(); final L2Character activeChar = info.getEffector(); final Skill skill = info.getSkill(); - if (activeChar.isAlikeDead()) - { + if (activeChar.isAlikeDead()) { return; } @@ -74,8 +68,7 @@ public final class DeathLink extends AbstractEffect double power = _power * (-((activeChar.getCurrentHp() * 2) / activeChar.getMaxHp()) + 2); - if (target.isPlayer() && target.getActingPlayer().isFakeDeath()) - { + if (target.isPlayer() && target.getActingPlayer().isFakeDeath()) { target.stopFakeDeath(true); } @@ -83,23 +76,18 @@ public final class DeathLink extends AbstractEffect final byte shld = Formulas.calcShldUse(activeChar, target, skill); double damage = Formulas.calcMagicDam(activeChar, target, skill, shld, sps, bss, mcrit, power); - if (damage > 0) - { + if (damage > 0) { // Manage attack or cast break of the target (calculating rate, sending message...) - if (!target.isRaid() && Formulas.calcAtkBreak(target, damage)) - { + if (!target.isRaid() && Formulas.calcAtkBreak(target, damage)) { target.breakAttack(); target.breakCast(); } // Shield Deflect Magic: Reflect all damage on caster. - if (target.getStat().calcStat(Stats.VENGEANCE_SKILL_MAGIC_DAMAGE, 0, target, skill) > Rnd.get(100)) - { + if (target.getStat().calcStat(Stats.VENGEANCE_SKILL_MAGIC_DAMAGE, 0, target, skill) > Rnd.get(100)) { activeChar.reduceCurrentHp(damage, target, skill); activeChar.notifyDamageReceived(damage, target, skill, mcrit, false, true); - } - else - { + } else { target.reduceCurrentHp(damage, activeChar, skill); target.notifyDamageReceived(damage, activeChar, skill, mcrit, false, false); activeChar.sendDamageMessage(target, (int) damage, mcrit, false, false); diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DeleteHate.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DeleteHate.java index 966772afc4..e250022ff5 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DeleteHate.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DeleteHate.java @@ -31,40 +31,33 @@ import com.l2jserver.gameserver.model.stats.Formulas; * Delete Hate effect implementation. * @author Adry_85 */ -public final class DeleteHate extends AbstractEffect -{ +public final class DeleteHate extends AbstractEffect { private final int _chance; - public DeleteHate(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public DeleteHate(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _chance = params.getInt("chance", 100); } @Override - public boolean calcSuccess(BuffInfo info) - { + public boolean calcSuccess(BuffInfo info) { return Formulas.calcProbability(_chance, info.getEffector(), info.getEffected(), info.getSkill()); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.HATE; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (!info.getEffected().isAttackable()) - { + public void onStart(BuffInfo info) { + if (!info.getEffected().isAttackable()) { return; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DeleteHateOfMe.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DeleteHateOfMe.java index 61a5119851..87574f1674 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DeleteHateOfMe.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DeleteHateOfMe.java @@ -31,40 +31,33 @@ import com.l2jserver.gameserver.model.stats.Formulas; * Delete Hate Of Me effect implementation. * @author Adry_85 */ -public final class DeleteHateOfMe extends AbstractEffect -{ +public final class DeleteHateOfMe extends AbstractEffect { private final int _chance; - public DeleteHateOfMe(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public DeleteHateOfMe(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _chance = params.getInt("chance", 100); } @Override - public boolean calcSuccess(BuffInfo info) - { + public boolean calcSuccess(BuffInfo info) { return Formulas.calcProbability(_chance, info.getEffector(), info.getEffected(), info.getSkill()); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.HATE; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (!info.getEffected().isAttackable()) - { + public void onStart(BuffInfo info) { + if (!info.getEffected().isAttackable()) { return; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DetectHiddenObjects.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DetectHiddenObjects.java index cca12f3d7e..1f58e2664d 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DetectHiddenObjects.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DetectHiddenObjects.java @@ -28,30 +28,24 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Detect Hidden Objects effect implementation. * @author UnAfraid */ -public final class DetectHiddenObjects extends AbstractEffect -{ - public DetectHiddenObjects(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class DetectHiddenObjects extends AbstractEffect { + public DetectHiddenObjects(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (!info.getEffected().isDoor()) - { + public void onStart(BuffInfo info) { + if (!info.getEffected().isDoor()) { return; } final L2DoorInstance door = (L2DoorInstance) info.getEffected(); - if (door.getTemplate().isStealth()) - { + if (door.getTemplate().isStealth()) { door.setMeshIndex(1); door.setTargetable(door.getTemplate().getOpenType() != 0); door.broadcastStatusUpdate(); diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DispelAll.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DispelAll.java index 4e38d99565..393ba6440e 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DispelAll.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DispelAll.java @@ -28,28 +28,23 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Dispel All effect implementation. * @author UnAfraid */ -public final class DispelAll extends AbstractEffect -{ - public DispelAll(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class DispelAll extends AbstractEffect { + public DispelAll(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.DISPEL; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { info.getEffected().stopAllEffects(); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DispelByCategory.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DispelByCategory.java index 3ec1a319fa..ffbee9c1e9 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DispelByCategory.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DispelByCategory.java @@ -32,14 +32,12 @@ import com.l2jserver.gameserver.model.stats.Formulas; * Dispel By Category effect implementation. * @author DS, Adry_85 */ -public final class DispelByCategory extends AbstractEffect -{ +public final class DispelByCategory extends AbstractEffect { private final DispelCategory _slot; private final int _rate; private final int _max; - public DispelByCategory(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public DispelByCategory(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _slot = params.getEnum("slot", DispelCategory.class, DispelCategory.BUFF); @@ -48,28 +46,23 @@ public final class DispelByCategory extends AbstractEffect } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.DISPEL; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (info.getEffected().isDead()) - { + public void onStart(BuffInfo info) { + if (info.getEffected().isDead()) { return; } final List<BuffInfo> canceled = Formulas.calcCancelEffects(info.getEffector(), info.getEffected(), info.getSkill(), _slot, _rate, _max); - for (BuffInfo can : canceled) - { + for (BuffInfo can : canceled) { info.getEffected().getEffectList().stopSkillEffects(true, can.getSkill()); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DispelBySlot.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DispelBySlot.java index 32ffc6d8ed..b924eb84c7 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DispelBySlot.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DispelBySlot.java @@ -36,48 +36,38 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Dispel By Slot effect implementation. * @author Gnacik, Zoey76, Adry_85 */ -public final class DispelBySlot extends AbstractEffect -{ +public final class DispelBySlot extends AbstractEffect { private final String _dispel; private final Map<AbnormalType, Short> _dispelAbnormals; - public DispelBySlot(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public DispelBySlot(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _dispel = params.getString("dispel", null); - if ((_dispel != null) && !_dispel.isEmpty()) - { + if ((_dispel != null) && !_dispel.isEmpty()) { _dispelAbnormals = new EnumMap<>(AbnormalType.class); - for (String ngtStack : _dispel.split(";")) - { + for (String ngtStack : _dispel.split(";")) { String[] ngt = ngtStack.split(","); _dispelAbnormals.put(AbnormalType.valueOf(ngt[0]), Short.parseShort(ngt[1])); } - } - else - { + } else { _dispelAbnormals = Collections.<AbnormalType, Short> emptyMap(); } } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.DISPEL; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (_dispelAbnormals.isEmpty()) - { + public void onStart(BuffInfo info) { + if (_dispelAbnormals.isEmpty()) { return; } @@ -86,26 +76,21 @@ public final class DispelBySlot extends AbstractEffect // There is no need to iterate over all buffs, // Just iterate once over all slots to dispel and get the buff with that abnormal if exists, // Operation of O(n) for the amount of slots to dispel (which is usually small) and O(1) to get the buff. - for (Entry<AbnormalType, Short> entry : _dispelAbnormals.entrySet()) - { + for (Entry<AbnormalType, Short> entry : _dispelAbnormals.entrySet()) { // Dispel transformations (buff and by GM) - if ((entry.getKey() == AbnormalType.TRANSFORM)) - { - if (effected.isTransformed() || (effected.isPlayer() || (entry.getValue() == effected.getActingPlayer().getTransformationId()) || (entry.getValue() < 0))) - { + if ((entry.getKey() == AbnormalType.TRANSFORM)) { + if (effected.isTransformed() || (effected.isPlayer() || (entry.getValue() == effected.getActingPlayer().getTransformationId()) || (entry.getValue() < 0))) { info.getEffected().stopTransformation(true); continue; } } final BuffInfo toDispel = effectList.getBuffInfoByAbnormalType(entry.getKey()); - if (toDispel == null) - { + if (toDispel == null) { continue; } - if ((entry.getKey() == toDispel.getSkill().getAbnormalType()) && ((entry.getValue() < 0) || (entry.getValue() >= toDispel.getSkill().getAbnormalLvl()))) - { + if ((entry.getKey() == toDispel.getSkill().getAbnormalType()) && ((entry.getValue() < 0) || (entry.getValue() >= toDispel.getSkill().getAbnormalLvl()))) { effectList.stopSkillEffects(true, entry.getKey()); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DispelBySlotProbability.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DispelBySlotProbability.java index a2cf106ca6..49bc89ee2d 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DispelBySlotProbability.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/DispelBySlotProbability.java @@ -37,50 +37,40 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Dispel By Slot Probability effect implementation. * @author Adry_85, Zoey76 */ -public final class DispelBySlotProbability extends AbstractEffect -{ +public final class DispelBySlotProbability extends AbstractEffect { private final String _dispel; private final Map<AbnormalType, Short> _dispelAbnormals; private final int _rate; - public DispelBySlotProbability(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public DispelBySlotProbability(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _dispel = params.getString("dispel", null); _rate = params.getInt("rate", 0); - if ((_dispel != null) && !_dispel.isEmpty()) - { + if ((_dispel != null) && !_dispel.isEmpty()) { _dispelAbnormals = new EnumMap<>(AbnormalType.class); - for (String ngtStack : _dispel.split(";")) - { + for (String ngtStack : _dispel.split(";")) { String[] ngt = ngtStack.split(","); _dispelAbnormals.put(AbnormalType.valueOf(ngt[0]), (ngt.length > 1) ? Short.parseShort(ngt[1]) : Short.MAX_VALUE); } - } - else - { + } else { _dispelAbnormals = Collections.<AbnormalType, Short> emptyMap(); } } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.DISPEL; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (_dispelAbnormals.isEmpty()) - { + public void onStart(BuffInfo info) { + if (_dispelAbnormals.isEmpty()) { return; } @@ -89,27 +79,21 @@ public final class DispelBySlotProbability extends AbstractEffect // There is no need to iterate over all buffs, // Just iterate once over all slots to dispel and get the buff with that abnormal if exists, // Operation of O(n) for the amount of slots to dispel (which is usually small) and O(1) to get the buff. - for (Entry<AbnormalType, Short> entry : _dispelAbnormals.entrySet()) - { - if ((Rnd.get(100) < _rate)) - { + for (Entry<AbnormalType, Short> entry : _dispelAbnormals.entrySet()) { + if ((Rnd.get(100) < _rate)) { // Dispel transformations (buff and by GM) - if ((entry.getKey() == AbnormalType.TRANSFORM)) - { - if (effected.isTransformed() || (effected.isPlayer() || (entry.getValue() == effected.getActingPlayer().getTransformationId()) || (entry.getValue() < 0))) - { + if ((entry.getKey() == AbnormalType.TRANSFORM)) { + if (effected.isTransformed() || (effected.isPlayer() || (entry.getValue() == effected.getActingPlayer().getTransformationId()) || (entry.getValue() < 0))) { info.getEffected().stopTransformation(true); } } final BuffInfo toDispel = effectList.getBuffInfoByAbnormalType(entry.getKey()); - if (toDispel == null) - { + if (toDispel == null) { continue; } - if ((toDispel.getSkill().getAbnormalType() == entry.getKey()) && (entry.getValue() >= toDispel.getSkill().getAbnormalLvl())) - { + if ((toDispel.getSkill().getAbnormalType() == entry.getKey()) && (entry.getValue() >= toDispel.getSkill().getAbnormalLvl())) { effectList.stopSkillEffects(true, entry.getKey()); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/EnergyAttack.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/EnergyAttack.java index d3f6fcee90..1cf2f333a0 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/EnergyAttack.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/EnergyAttack.java @@ -36,14 +36,12 @@ import com.l2jserver.gameserver.model.stats.Stats; * Energy Attack effect implementation. * @author NosBit */ -public final class EnergyAttack extends AbstractEffect -{ +public final class EnergyAttack extends AbstractEffect { private final double _power; private final int _criticalChance; private final boolean _ignoreShieldDefence; - public EnergyAttack(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public EnergyAttack(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getDouble("power", 0); @@ -52,30 +50,25 @@ public final class EnergyAttack extends AbstractEffect } @Override - public boolean calcSuccess(BuffInfo info) - { + public boolean calcSuccess(BuffInfo info) { // TODO: Verify this on retail return !Formulas.calcPhysicalSkillEvasion(info.getEffector(), info.getEffected(), info.getSkill()); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.PHYSICAL_ATTACK; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2PcInstance attacker = info.getEffector() instanceof L2PcInstance ? (L2PcInstance) info.getEffector() : null; - if (attacker == null) - { + if (attacker == null) { return; } @@ -85,22 +78,17 @@ public final class EnergyAttack extends AbstractEffect double attack = attacker.getPAtk(target); double defence = target.getPDef(attacker); - if (!_ignoreShieldDefence) - { + if (!_ignoreShieldDefence) { byte shield = Formulas.calcShldUse(attacker, target, skill, true); - switch (shield) - { - case Formulas.SHIELD_DEFENSE_FAILED: - { + switch (shield) { + case Formulas.SHIELD_DEFENSE_FAILED: { break; } - case Formulas.SHIELD_DEFENSE_SUCCEED: - { + case Formulas.SHIELD_DEFENSE_SUCCEED: { defence += target.getShldDef(); break; } - case Formulas.SHIELD_DEFENSE_PERFECT_BLOCK: - { + case Formulas.SHIELD_DEFENSE_PERFECT_BLOCK: { defence = -1; break; } @@ -110,8 +98,7 @@ public final class EnergyAttack extends AbstractEffect double damage = 1; boolean critical = false; - if (defence != -1) - { + if (defence != -1) { double damageMultiplier = Formulas.calcWeaponTraitBonus(attacker, target) * Formulas.calcAttributeBonus(attacker, target, skill) * Formulas.calcGeneralTraitBonus(attacker, target, skill.getTraitType(), true); boolean ss = info.getSkill().useSoulShot() && attacker.isChargedShot(ShotType.SOULSHOTS); @@ -119,12 +106,9 @@ public final class EnergyAttack extends AbstractEffect double weaponTypeBoost; L2Weapon weapon = attacker.getActiveWeaponItem(); - if ((weapon != null) && ((weapon.getItemType() == WeaponType.BOW) || (weapon.getItemType() == WeaponType.CROSSBOW))) - { + if ((weapon != null) && ((weapon.getItemType() == WeaponType.BOW) || (weapon.getItemType() == WeaponType.CROSSBOW))) { weaponTypeBoost = 70; - } - else - { + } else { weaponTypeBoost = 77; } @@ -139,26 +123,22 @@ public final class EnergyAttack extends AbstractEffect damage = attack / defence; damage *= damageMultiplier; - if (target instanceof L2PcInstance) - { + if (target instanceof L2PcInstance) { damage *= attacker.getStat().calcStat(Stats.PVP_PHYS_SKILL_DMG, 1.0); damage *= target.getStat().calcStat(Stats.PVP_PHYS_SKILL_DEF, 1.0); damage = attacker.getStat().calcStat(Stats.PHYSICAL_SKILL_POWER, damage); } - if (_criticalChance > 0) - { + if (_criticalChance > 0) { critical = Formulas.calcSkillCrit(attacker, target, _criticalChance); } - if (critical) - { + if (critical) { damage *= 2; } } - if (damage > 0) - { + if (damage > 0) { attacker.sendDamageMessage(target, (int) damage, false, critical, false); target.reduceCurrentHp(damage, attacker, skill); target.notifyDamageReceived(damage, attacker, skill, critical, false, false); diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Escape.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Escape.java index abaf8786ee..f79e938753 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Escape.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Escape.java @@ -30,34 +30,28 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Escape effect implementation. * @author Adry_85 */ -public final class Escape extends AbstractEffect -{ +public final class Escape extends AbstractEffect { private final TeleportWhereType _escapeType; - public Escape(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public Escape(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _escapeType = params.getEnum("escapeType", TeleportWhereType.class, null); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.TELEPORT; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (_escapeType == null) - { + public void onStart(BuffInfo info) { + if (_escapeType == null) { return; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/FatalBlow.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/FatalBlow.java index 3c7f72f880..dbbeae43cf 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/FatalBlow.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/FatalBlow.java @@ -33,14 +33,12 @@ import com.l2jserver.gameserver.model.stats.Formulas; * Fatal Blow effect implementation. * @author Adry_85 */ -public final class FatalBlow extends AbstractEffect -{ +public final class FatalBlow extends AbstractEffect { private final double _power; private final int _blowChance; private final int _criticalChance; - public FatalBlow(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public FatalBlow(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getDouble("power", 0); @@ -49,32 +47,27 @@ public final class FatalBlow extends AbstractEffect } @Override - public boolean calcSuccess(BuffInfo info) - { + public boolean calcSuccess(BuffInfo info) { return !Formulas.calcPhysicalSkillEvasion(info.getEffector(), info.getEffected(), info.getSkill()) && Formulas.calcBlowSuccess(info.getEffector(), info.getEffected(), info.getSkill(), _blowChance); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.PHYSICAL_ATTACK; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { L2Character target = info.getEffected(); L2Character activeChar = info.getEffector(); Skill skill = info.getSkill(); - if (activeChar.isAlikeDead()) - { + if (activeChar.isAlikeDead()) { return; } @@ -83,13 +76,11 @@ public final class FatalBlow extends AbstractEffect double damage = Formulas.calcBlowDamage(activeChar, target, skill, shld, ss, _power); boolean crit = false; - if (_criticalChance > 0) - { + if (_criticalChance > 0) { crit = Formulas.calcSkillCrit(activeChar, target, _criticalChance); } - if (crit) - { + if (crit) { damage *= 2; } @@ -97,14 +88,12 @@ public final class FatalBlow extends AbstractEffect target.notifyDamageReceived(damage, activeChar, skill, crit, false, false); // Manage attack or cast break of the target (calculating rate, sending message...) - if (!target.isRaid() && Formulas.calcAtkBreak(target, damage)) - { + if (!target.isRaid() && Formulas.calcAtkBreak(target, damage)) { target.breakAttack(); target.breakCast(); } - if (activeChar.isPlayer()) - { + if (activeChar.isPlayer()) { L2PcInstance activePlayer = activeChar.getActingPlayer(); activePlayer.sendDamageMessage(target, (int) damage, false, crit, false); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Fishing.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Fishing.java index dd0ae2b850..b3ea0e3bb5 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Fishing.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Fishing.java @@ -47,53 +47,42 @@ import com.l2jserver.gameserver.util.Util; * Fishing effect implementation. * @author UnAfraid */ -public final class Fishing extends AbstractEffect -{ +public final class Fishing extends AbstractEffect { private static final int MIN_BAIT_DISTANCE = 90; private static final int MAX_BAIT_DISTANCE = 250; - public Fishing(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public Fishing(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.FISHING_START; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2Character activeChar = info.getEffector(); - if (!activeChar.isPlayer()) - { + if (!activeChar.isPlayer()) { return; } final L2PcInstance player = activeChar.getActingPlayer(); - if (!general().allowFishing() && !player.canOverrideCond(PcCondOverride.SKILL_CONDITIONS)) - { + if (!general().allowFishing() && !player.canOverrideCond(PcCondOverride.SKILL_CONDITIONS)) { player.sendMessage("Fishing is disabled!"); return; } - if (player.isFishing()) - { - if (player.getFishCombat() != null) - { + if (player.isFishing()) { + if (player.getFishCombat() != null) { player.getFishCombat().doDie(false); - } - else - { + } else { player.endFishing(false); } @@ -103,36 +92,30 @@ public final class Fishing extends AbstractEffect // check for equiped fishing rod L2Weapon equipedWeapon = player.getActiveWeaponItem(); - if (((equipedWeapon == null) || (equipedWeapon.getItemType() != WeaponType.FISHINGROD))) - { + if (((equipedWeapon == null) || (equipedWeapon.getItemType() != WeaponType.FISHINGROD))) { player.sendPacket(SystemMessageId.FISHING_POLE_NOT_EQUIPPED); return; } // check for equiped lure L2ItemInstance equipedLeftHand = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND); - if ((equipedLeftHand == null) || (equipedLeftHand.getItemType() != EtcItemType.LURE)) - { + if ((equipedLeftHand == null) || (equipedLeftHand.getItemType() != EtcItemType.LURE)) { player.sendPacket(SystemMessageId.BAIT_ON_HOOK_BEFORE_FISHING); return; } - if (!player.isGM()) - { - if (player.isInBoat()) - { + if (!player.isGM()) { + if (player.isInBoat()) { player.sendPacket(SystemMessageId.CANNOT_FISH_ON_BOAT); return; } - if (player.isInCraftMode() || player.isInStoreMode()) - { + if (player.isInCraftMode() || player.isInStoreMode()) { player.sendPacket(SystemMessageId.CANNOT_FISH_WHILE_USING_RECIPE_BOOK); return; } - if (player.isInsideZone(ZoneId.WATER)) - { + if (player.isInsideZone(ZoneId.WATER)) { player.sendPacket(SystemMessageId.CANNOT_FISH_UNDER_WATER); return; } @@ -150,74 +133,56 @@ public final class Fishing extends AbstractEffect // search for fishing and water zone L2FishingZone fishingZone = null; L2WaterZone waterZone = null; - for (final L2ZoneType zone : ZoneManager.getInstance().getZones(baitX, baitY)) - { - if (zone instanceof L2FishingZone) - { + for (final L2ZoneType zone : ZoneManager.getInstance().getZones(baitX, baitY)) { + if (zone instanceof L2FishingZone) { fishingZone = (L2FishingZone) zone; - } - else if (zone instanceof L2WaterZone) - { + } else if (zone instanceof L2WaterZone) { waterZone = (L2WaterZone) zone; } - if ((fishingZone != null) && (waterZone != null)) - { + if ((fishingZone != null) && (waterZone != null)) { break; } } int baitZ = computeBaitZ(player, baitX, baitY, fishingZone, waterZone); - if (baitZ == Integer.MIN_VALUE) - { - for (distance = MAX_BAIT_DISTANCE; distance >= MIN_BAIT_DISTANCE; --distance) - { + if (baitZ == Integer.MIN_VALUE) { + for (distance = MAX_BAIT_DISTANCE; distance >= MIN_BAIT_DISTANCE; --distance) { baitX = (int) (player.getX() + (cos * distance)); baitY = (int) (player.getY() + (sin * distance)); // search for fishing and water zone again fishingZone = null; waterZone = null; - for (final L2ZoneType zone : ZoneManager.getInstance().getZones(baitX, baitY)) - { - if (zone instanceof L2FishingZone) - { + for (final L2ZoneType zone : ZoneManager.getInstance().getZones(baitX, baitY)) { + if (zone instanceof L2FishingZone) { fishingZone = (L2FishingZone) zone; - } - else if (zone instanceof L2WaterZone) - { + } else if (zone instanceof L2WaterZone) { waterZone = (L2WaterZone) zone; } - if ((fishingZone != null) && (waterZone != null)) - { + if ((fishingZone != null) && (waterZone != null)) { break; } } baitZ = computeBaitZ(player, baitX, baitY, fishingZone, waterZone); - if (baitZ != Integer.MIN_VALUE) - { + if (baitZ != Integer.MIN_VALUE) { break; } } - if (baitZ == Integer.MIN_VALUE) - { - if (player.isGM()) - { + if (baitZ == Integer.MIN_VALUE) { + if (player.isGM()) { baitZ = player.getZ(); - } - else - { + } else { player.sendPacket(SystemMessageId.CANNOT_FISH_HERE); return; } } } - if (!player.destroyItem("Fishing", equipedLeftHand, 1, null, false)) - { + if (!player.destroyItem("Fishing", equipedLeftHand, 1, null, false)) { player.sendPacket(SystemMessageId.NOT_ENOUGH_BAIT); return; } @@ -235,35 +200,28 @@ public final class Fishing extends AbstractEffect * @param waterZone the water zone * @return the bait z or {@link Integer#MIN_VALUE} when you cannot fish here */ - private static int computeBaitZ(final L2PcInstance player, final int baitX, final int baitY, final L2FishingZone fishingZone, final L2WaterZone waterZone) - { - if ((fishingZone == null)) - { + private static int computeBaitZ(final L2PcInstance player, final int baitX, final int baitY, final L2FishingZone fishingZone, final L2WaterZone waterZone) { + if ((fishingZone == null)) { return Integer.MIN_VALUE; } - if ((waterZone == null)) - { + if ((waterZone == null)) { return Integer.MIN_VALUE; } // always use water zone, fishing zone high z is high in the air... int baitZ = waterZone.getWaterZ(); - if (!GeoData.getInstance().canSeeTarget(player.getX(), player.getY(), player.getZ(), baitX, baitY, baitZ)) - { + if (!GeoData.getInstance().canSeeTarget(player.getX(), player.getY(), player.getZ(), baitX, baitY, baitZ)) { return Integer.MIN_VALUE; } - if (GeoData.getInstance().hasGeo(baitX, baitY)) - { - if (GeoData.getInstance().getHeight(baitX, baitY, baitZ) > baitZ) - { + if (GeoData.getInstance().hasGeo(baitX, baitY)) { + if (GeoData.getInstance().getHeight(baitX, baitY, baitZ) > baitZ) { return Integer.MIN_VALUE; } - if (GeoData.getInstance().getHeight(baitX, baitY, player.getZ()) > baitZ) - { + if (GeoData.getInstance().getHeight(baitX, baitY, player.getZ()) > baitZ) { return Integer.MIN_VALUE; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/FlySelf.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/FlySelf.java index 06d251d2a7..c40b74400f 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/FlySelf.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/FlySelf.java @@ -32,28 +32,23 @@ import com.l2jserver.gameserver.network.serverpackets.ValidateLocation; /** * Fly Self effect implementation. */ -public final class FlySelf extends AbstractEffect -{ +public final class FlySelf extends AbstractEffect { private final int _flyRadius; - public FlySelf(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public FlySelf(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _flyRadius = params.getInt("flyRadius", 0); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (info.getEffected().isMovementDisabled()) - { + public void onStart(BuffInfo info) { + if (info.getEffected().isMovementDisabled()) { return; } @@ -70,8 +65,7 @@ public final class FlySelf extends AbstractEffect double dy = target.getY() - curY; double dz = target.getZ() - curZ; double distance = Math.hypot(dx, dy); - if (distance > 2000) - { + if (distance > 2000) { _log.info("EffectEnemyCharge was going to use invalid coordinates for characters, getEffector: " + curX + "," + curY + " and getEffected: " + target.getX() + "," + target.getY()); return; } @@ -81,14 +75,12 @@ public final class FlySelf extends AbstractEffect // approximation for moving closer when z coordinates are different // TODO: handle Z axis movement better offset -= Math.abs(dz); - if (offset < 5) - { + if (offset < 5) { offset = 5; } // If no distance - if ((distance < 1) || ((distance - offset) <= 0)) - { + if ((distance < 1) || ((distance - offset) <= 0)) { return; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/FocusEnergy.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/FocusEnergy.java index 35ec94b093..10af9d3704 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/FocusEnergy.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/FocusEnergy.java @@ -27,28 +27,23 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Focus Energy effect implementation. * @author DS */ -public final class FocusEnergy extends AbstractEffect -{ +public final class FocusEnergy extends AbstractEffect { private final int _charge; - public FocusEnergy(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public FocusEnergy(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _charge = params.getInt("charge", 0); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (!info.getEffected().isPlayer()) - { + public void onStart(BuffInfo info) { + if (!info.getEffected().isPlayer()) { return; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/FocusMaxEnergy.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/FocusMaxEnergy.java index 8ca8a3adc5..c3d835b1f5 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/FocusMaxEnergy.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/FocusMaxEnergy.java @@ -28,29 +28,23 @@ import com.l2jserver.gameserver.model.skills.Skill; * Focus Max Energy effect implementation. * @author Adry_85 */ -public final class FocusMaxEnergy extends AbstractEffect -{ - public FocusMaxEnergy(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class FocusMaxEnergy extends AbstractEffect { + public FocusMaxEnergy(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (info.getEffected().isPlayer()) - { + public void onStart(BuffInfo info) { + if (info.getEffected().isPlayer()) { final Skill sonicMastery = info.getEffected().getSkills().get(992); final Skill focusMastery = info.getEffected().getSkills().get(993); int maxCharge = (sonicMastery != null) ? sonicMastery.getLevel() : (focusMastery != null) ? focusMastery.getLevel() : 0; - if (maxCharge != 0) - { + if (maxCharge != 0) { int count = maxCharge - info.getEffected().getActingPlayer().getCharges(); info.getEffected().getActingPlayer().increaseCharges(count, maxCharge); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/FocusSouls.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/FocusSouls.java index aba1def148..de027d81fe 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/FocusSouls.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/FocusSouls.java @@ -30,43 +30,34 @@ import com.l2jserver.gameserver.network.SystemMessageId; * Focus Souls effect implementation. * @author nBd, Adry_85 */ -public final class FocusSouls extends AbstractEffect -{ +public final class FocusSouls extends AbstractEffect { private final int _charge; - public FocusSouls(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public FocusSouls(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _charge = params.getInt("charge", 0); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (!info.getEffected().isPlayer() || info.getEffected().isAlikeDead()) - { + public void onStart(BuffInfo info) { + if (!info.getEffected().isPlayer() || info.getEffected().isAlikeDead()) { return; } final L2PcInstance target = info.getEffected().getActingPlayer(); final int maxSouls = (int) target.calcStat(Stats.MAX_SOULS, 0, null, null); - if (maxSouls > 0) - { + if (maxSouls > 0) { int amount = _charge; - if ((target.getChargedSouls() < maxSouls)) - { + if ((target.getChargedSouls() < maxSouls)) { int count = ((target.getChargedSouls() + amount) <= maxSouls) ? amount : (maxSouls - target.getChargedSouls()); target.increaseSouls(count); - } - else - { + } else { target.sendPacket(SystemMessageId.SOUL_CANNOT_BE_INCREASED_ANYMORE); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/FoodForPet.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/FoodForPet.java index 3f1eba5b8b..d4219f9a44 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/FoodForPet.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/FoodForPet.java @@ -34,14 +34,12 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * @author Adry_85 * @since 2.6.0.0 */ -public final class FoodForPet extends AbstractEffect -{ +public final class FoodForPet extends AbstractEffect { private final int _normal; private final int _ride; private final int _wyvern; - public FoodForPet(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public FoodForPet(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _normal = params.getInt("normal", 0); @@ -50,30 +48,22 @@ public final class FoodForPet extends AbstractEffect } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2Character activeChar = info.getEffector(); - if (activeChar.isPet()) - { + if (activeChar.isPet()) { final L2PetInstance pet = (L2PetInstance) activeChar; pet.setCurrentFed(pet.getCurrentFed() + (_normal * rates().getPetFoodRate())); - } - else if (activeChar.isPlayer()) - { + } else if (activeChar.isPlayer()) { final L2PcInstance player = activeChar.getActingPlayer(); - if (player.getMountType() == MountType.WYVERN) - { + if (player.getMountType() == MountType.WYVERN) { player.setCurrentFeed(player.getCurrentFeed() + _wyvern); - } - else - { + } else { player.setCurrentFeed(player.getCurrentFeed() + _ride); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/GetAgro.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/GetAgro.java index bc1a79f0e9..f47122a2a5 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/GetAgro.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/GetAgro.java @@ -30,30 +30,24 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Get Agro effect implementation. * @author Adry_85 */ -public final class GetAgro extends AbstractEffect -{ - public GetAgro(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class GetAgro extends AbstractEffect { + public GetAgro(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.AGGRESSION; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if ((info.getEffected() instanceof L2Attackable) && info.getEffected().hasAI() && (((L2Attackable) info.getEffected()).getMostHated() != info.getEffector())) - { + public void onStart(BuffInfo info) { + if ((info.getEffected() instanceof L2Attackable) && info.getEffected().hasAI() && (((L2Attackable) info.getEffected()).getMostHated() != info.getEffector())) { info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, info.getEffector()); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/GiveRecommendation.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/GiveRecommendation.java index 57483db3d9..102e15c0e3 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/GiveRecommendation.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/GiveRecommendation.java @@ -32,42 +32,34 @@ import com.l2jserver.gameserver.network.serverpackets.UserInfo; * Give Recommendation effect implementation. * @author NosBit */ -public final class GiveRecommendation extends AbstractEffect -{ +public final class GiveRecommendation extends AbstractEffect { private final int _amount; - public GiveRecommendation(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public GiveRecommendation(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _amount = params.getInt("amount", 0); - if (_amount == 0) - { + if (_amount == 0) { _log.warning(getClass().getSimpleName() + ": amount parameter is missing or set to 0. id:" + set.getInt("id", -1)); } } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { L2PcInstance target = info.getEffected() instanceof L2PcInstance ? (L2PcInstance) info.getEffected() : null; - if (target != null) - { + if (target != null) { int recommendationsGiven = _amount; - if ((target.getRecomHave() + _amount) >= 255) - { + if ((target.getRecomHave() + _amount) >= 255) { recommendationsGiven = 255 - target.getRecomHave(); } - if (recommendationsGiven > 0) - { + if (recommendationsGiven > 0) { target.setRecomHave(target.getRecomHave() + recommendationsGiven); SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_OBTAINED_S1_RECOMMENDATIONS); @@ -75,12 +67,9 @@ public final class GiveRecommendation extends AbstractEffect target.sendPacket(sm); target.sendPacket(new UserInfo(target)); target.sendPacket(new ExVoteSystemInfo(target)); - } - else - { + } else { L2PcInstance player = info.getEffector() instanceof L2PcInstance ? (L2PcInstance) info.getEffector() : null; - if (player != null) - { + if (player != null) { player.sendPacket(SystemMessageId.NOTHING_HAPPENED); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/GiveSp.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/GiveSp.java index 14e2cfc633..a3f0282ca8 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/GiveSp.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/GiveSp.java @@ -27,28 +27,23 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Give SP effect implementation. * @author Adry_85 */ -public final class GiveSp extends AbstractEffect -{ +public final class GiveSp extends AbstractEffect { private final int _sp; - public GiveSp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public GiveSp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _sp = params.getInt("sp", 0); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if ((info.getEffector() == null) || (info.getEffected() == null) || !info.getEffector().isPlayer() || !info.getEffected().isPlayer() || info.getEffected().isAlikeDead()) - { + public void onStart(BuffInfo info) { + if ((info.getEffector() == null) || (info.getEffected() == null) || !info.getEffector().isPlayer() || !info.getEffected().isPlayer() || info.getEffected().isAlikeDead()) { return; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Harvesting.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Harvesting.java index 4f46b0004e..929387879f 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Harvesting.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Harvesting.java @@ -33,52 +33,39 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Harvesting effect implementation. * @author l3x, Zoey76 */ -public final class Harvesting extends AbstractEffect -{ - public Harvesting(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class Harvesting extends AbstractEffect { + public Harvesting(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if ((info.getEffector() == null) || (info.getEffected() == null) || !info.getEffector().isPlayer() || !info.getEffected().isMonster() || !info.getEffected().isDead()) - { + public void onStart(BuffInfo info) { + if ((info.getEffector() == null) || (info.getEffected() == null) || !info.getEffector().isPlayer() || !info.getEffected().isMonster() || !info.getEffected().isDead()) { return; } final L2PcInstance player = info.getEffector().getActingPlayer(); final L2MonsterInstance monster = (L2MonsterInstance) info.getEffected(); - if (player.getObjectId() != monster.getSeederId()) - { + if (player.getObjectId() != monster.getSeederId()) { player.sendPacket(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_HARVEST); - } - else if (monster.isSeeded()) - { - if (calcSuccess(player, monster)) - { + } else if (monster.isSeeded()) { + if (calcSuccess(player, monster)) { final ItemHolder item = monster.takeHarvest(); - if (item != null) - { + if (item != null) { // Add item player.getInventory().addItem("Harvesting", item.getId(), item.getCount(), player, monster); // Send system msg SystemMessage sm = null; - if (item.getCount() == 1) - { + if (item.getCount() == 1) { sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_PICKED_UP_S1); sm.addItemName(item.getId()); - } - else - { + } else { sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_PICKED_UP_S1_S2); sm.addItemName(item.getId()); sm.addLong(item.getCount()); @@ -86,16 +73,12 @@ public final class Harvesting extends AbstractEffect player.sendPacket(sm); // Send msg to party - if (player.isInParty()) - { - if (item.getCount() == 1) - { + if (player.isInParty()) { + if (item.getCount() == 1) { sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HARVESTED_S2S); sm.addString(player.getName()); sm.addItemName(item.getId()); - } - else - { + } else { sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HARVESTED_S3_S2S); sm.addString(player.getName()); sm.addLong(item.getCount()); @@ -104,40 +87,32 @@ public final class Harvesting extends AbstractEffect player.getParty().broadcastToPartyMembers(player, sm); } } - } - else - { + } else { player.sendPacket(SystemMessageId.THE_HARVEST_HAS_FAILED); } - } - else - { + } else { player.sendPacket(SystemMessageId.THE_HARVEST_FAILED_BECAUSE_THE_SEED_WAS_NOT_SOWN); } } - private static boolean calcSuccess(L2PcInstance activeChar, L2MonsterInstance target) - { + private static boolean calcSuccess(L2PcInstance activeChar, L2MonsterInstance target) { final int levelPlayer = activeChar.getLevel(); final int levelTarget = target.getLevel(); int diff = (levelPlayer - levelTarget); - if (diff < 0) - { + if (diff < 0) { diff = -diff; } // apply penalty, target <=> player levels // 5% penalty for each level int basicSuccess = 100; - if (diff > 5) - { + if (diff > 5) { basicSuccess -= (diff - 5) * 5; } // success rate can't be less than 1% - if (basicSuccess < 1) - { + if (basicSuccess < 1) { basicSuccess = 1; } return Rnd.nextInt(99) < basicSuccess; diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/HeadquarterCreate.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/HeadquarterCreate.java index cda4b6b88e..b95c416ad1 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/HeadquarterCreate.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/HeadquarterCreate.java @@ -36,30 +36,25 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Headquarter Create effect implementation. * @author Adry_85 */ -public final class HeadquarterCreate extends AbstractEffect -{ +public final class HeadquarterCreate extends AbstractEffect { private static final int HQ_NPC_ID = 35062; private final boolean _isAdvanced; - public HeadquarterCreate(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public HeadquarterCreate(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _isAdvanced = params.getBoolean("isAdvanced", false); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2PcInstance player = info.getEffector().getActingPlayer(); - if (!player.isClanLeader()) - { + if (!player.isClanLeader()) { return; } @@ -71,16 +66,11 @@ public final class HeadquarterCreate extends AbstractEffect final Castle castle = CastleManager.getInstance().getCastle(player); final Fort fort = FortManager.getInstance().getFort(player); final SiegableHall hall = ClanHallSiegeManager.getInstance().getNearbyClanHall(player); - if (castle != null) - { + if (castle != null) { castle.getSiege().getFlag(player.getClan()).add(flag); - } - else if (fort != null) - { + } else if (fort != null) { fort.getSiege().getFlag(player.getClan()).add(flag); - } - else - { + } else { hall.getSiege().getFlag(player.getClan()).add(flag); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Heal.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Heal.java index 13495af7ae..8ba525171c 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Heal.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Heal.java @@ -37,37 +37,31 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Heal effect implementation. * @author UnAfraid */ -public final class Heal extends AbstractEffect -{ +public final class Heal extends AbstractEffect { private final double _power; - public Heal(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public Heal(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getDouble("power", 0); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.HP; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2Character target = info.getEffected(); final L2Character activeChar = info.getEffector(); final Skill skill = info.getSkill(); - if ((target == null) || target.isDead() || target.isDoor() || target.isInvul()) - { + if ((target == null) || target.isDead() || target.isDoor() || target.isInvul()) { return; } @@ -77,65 +71,49 @@ public final class Heal extends AbstractEffect boolean sps = skill.isMagic() && activeChar.isChargedShot(ShotType.SPIRITSHOTS); boolean bss = skill.isMagic() && activeChar.isChargedShot(ShotType.BLESSED_SPIRITSHOTS); - if (((sps || bss) && (activeChar.isPlayer() && activeChar.getActingPlayer().isMageClass())) || activeChar.isSummon()) - { + if (((sps || bss) && (activeChar.isPlayer() && activeChar.getActingPlayer().isMageClass())) || activeChar.isSummon()) { staticShotBonus = skill.getMpConsume2(); // static bonus for spiritshots mAtkMul = bss ? 4 : 2; staticShotBonus *= bss ? 2.4 : 1.0; - } - else if ((sps || bss) && activeChar.isNpc()) - { + } else if ((sps || bss) && activeChar.isNpc()) { staticShotBonus = 2.4 * skill.getMpConsume2(); // always blessed spiritshots mAtkMul = 4; - } - else - { + } else { // no static bonus // grade dynamic bonus final L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance(); - if (weaponInst != null) - { + if (weaponInst != null) { mAtkMul = weaponInst.getItem().getItemGrade() == CrystalType.S84 ? 4 : weaponInst.getItem().getItemGrade() == CrystalType.S80 ? 2 : 1; } // shot dynamic bonus mAtkMul = bss ? mAtkMul * 4 : mAtkMul + 1; } - if (!skill.isStatic()) - { + if (!skill.isStatic()) { amount += staticShotBonus + Math.sqrt(mAtkMul * activeChar.getMAtk(activeChar, null)); amount = target.calcStat(Stats.HEAL_EFFECT, amount, null, null); // Heal critic, since CT2.3 Gracia Final - if (skill.isMagic() && Formulas.calcMCrit(activeChar.getMCriticalHit(target, skill))) - { + if (skill.isMagic() && Formulas.calcMCrit(activeChar.getMCriticalHit(target, skill))) { amount *= 3; } } // Prevents overheal and negative amount amount = Math.max(Math.min(amount, target.getMaxRecoverableHp() - target.getCurrentHp()), 0); - if (amount != 0) - { + if (amount != 0) { target.setCurrentHp(amount + target.getCurrentHp()); } - if (target.isPlayer()) - { - if (skill.getId() == 4051) - { + if (target.isPlayer()) { + if (skill.getId() == 4051) { target.sendPacket(SystemMessageId.REJUVENATING_HP); - } - else - { - if (activeChar.isPlayer() && (activeChar != target)) - { + } else { + if (activeChar.isPlayer() && (activeChar != target)) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S2_HP_HAS_BEEN_RESTORED_BY_C1); sm.addString(activeChar.getName()); sm.addInt((int) amount); target.sendPacket(sm); - } - else - { + } else { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HP_HAS_BEEN_RESTORED); sm.addInt((int) amount); target.sendPacket(sm); diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Hp.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Hp.java index 4f8cc9c99e..7a05d1598d 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Hp.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Hp.java @@ -33,13 +33,11 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * @author Adry_85 * @since 2.6.0.0 */ -public final class Hp extends AbstractEffect -{ +public final class Hp extends AbstractEffect { private final double _amount; private final EffectCalculationType _mode; - public Hp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public Hp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _amount = params.getDouble("amount", 0); @@ -47,65 +45,50 @@ public final class Hp extends AbstractEffect } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.HP; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2Character target = info.getEffected(); final L2Character activeChar = info.getEffector(); - if ((target == null) || target.isDead() || target.isDoor() || target.isInvul() || target.isHpBlocked()) - { + if ((target == null) || target.isDead() || target.isDoor() || target.isInvul() || target.isHpBlocked()) { return; } double amount = 0; - switch (_mode) - { - case DIFF: - { + switch (_mode) { + case DIFF: { amount = Math.min(_amount, target.getMaxRecoverableHp() - target.getCurrentHp()); break; } - case PER: - { - if (_amount < 0) - { + case PER: { + if (_amount < 0) { amount = (target.getCurrentHp() * _amount) / 100; - } - else - { + } else { amount = Math.min((target.getMaxHp() * _amount) / 100.0, target.getMaxRecoverableHp() - target.getCurrentHp()); } break; } } - if (amount != 0) - { + if (amount != 0) { target.setCurrentHp(amount + target.getCurrentHp()); } - if (amount >= 0) - { - if ((activeChar != null) && (activeChar != target)) - { + if (amount >= 0) { + if ((activeChar != null) && (activeChar != target)) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S2_HP_HAS_BEEN_RESTORED_BY_C1); sm.addCharName(activeChar); sm.addInt((int) amount); target.sendPacket(sm); - } - else - { + } else { target.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.S1_HP_HAS_BEEN_RESTORED).addInt((int) amount)); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/HpByLevel.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/HpByLevel.java index e886857f55..3e6639899d 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/HpByLevel.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/HpByLevel.java @@ -31,34 +31,28 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Hp By Level effect implementation. * @author Zoey76 */ -public final class HpByLevel extends AbstractEffect -{ +public final class HpByLevel extends AbstractEffect { private final double _power; - public HpByLevel(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public HpByLevel(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getDouble("power", 0); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.BUFF; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (info.getEffector() == null) - { + public void onStart(BuffInfo info) { + if (info.getEffector() == null) { return; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/HpDrain.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/HpDrain.java index db938ce8da..1d62715cbb 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/HpDrain.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/HpDrain.java @@ -32,13 +32,11 @@ import com.l2jserver.gameserver.model.stats.Formulas; * HP Drain effect implementation. * @author Adry_85 */ -public final class HpDrain extends AbstractEffect -{ +public final class HpDrain extends AbstractEffect { private final double _power; private final double _drain; - public HpDrain(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public HpDrain(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getDouble("power", 0); @@ -46,27 +44,23 @@ public final class HpDrain extends AbstractEffect } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.HP_DRAIN; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2Character target = info.getEffected(); final L2Character activeChar = info.getEffector(); final Skill skill = info.getSkill(); // TODO: Unhardcode Cubic Skill to avoid double damage - if (activeChar.isAlikeDead() || (skill.getId() == 4050)) - { + if (activeChar.isAlikeDead() || (skill.getId() == 4050)) { return; } @@ -80,16 +74,11 @@ public final class HpDrain extends AbstractEffect double cp = target.getCurrentCp(); double hp = target.getCurrentHp(); - if (cp > 0) - { + if (cp > 0) { drain = (damage < cp) ? 0 : (damage - cp); - } - else if (damage > hp) - { + } else if (damage > hp) { drain = hp; - } - else - { + } else { drain = damage; } @@ -97,11 +86,9 @@ public final class HpDrain extends AbstractEffect final double hpFinal = ((activeChar.getCurrentHp() + hpAdd) > activeChar.getMaxHp() ? activeChar.getMaxHp() : (activeChar.getCurrentHp() + hpAdd)); activeChar.setCurrentHp(hpFinal); - if (damage > 0) - { + if (damage > 0) { // Manage attack or cast break of the target (calculating rate, sending message...) - if (!target.isRaid() && Formulas.calcAtkBreak(target, damage)) - { + if (!target.isRaid() && Formulas.calcAtkBreak(target, damage)) { target.breakAttack(); target.breakCast(); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/HpPerMax.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/HpPerMax.java index fc2f96a5d7..c25450edb1 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/HpPerMax.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/HpPerMax.java @@ -31,35 +31,29 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Hp Per Max effect implementation. * @author UnAfraid */ -public final class HpPerMax extends AbstractEffect -{ +public final class HpPerMax extends AbstractEffect { private final int _power; - public HpPerMax(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public HpPerMax(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getInt("power", 0); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.HP; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { L2Character target = info.getEffected(); - if ((target == null) || target.isDead() || target.isDoor()) - { + if ((target == null) || target.isDead() || target.isDoor()) { return; } @@ -70,18 +64,14 @@ public final class HpPerMax extends AbstractEffect amount = full ? target.getMaxHp() : (target.getMaxHp() * power) / 100.0; // Prevents overheal and negative amount amount = Math.max(Math.min(amount, target.getMaxRecoverableHp() - target.getCurrentHp()), 0); - if (amount != 0) - { + if (amount != 0) { target.setCurrentHp(amount + target.getCurrentHp()); } SystemMessage sm; - if (info.getEffector().getObjectId() != target.getObjectId()) - { + if (info.getEffector().getObjectId() != target.getObjectId()) { sm = SystemMessage.getSystemMessage(SystemMessageId.S2_HP_HAS_BEEN_RESTORED_BY_C1); sm.addCharName(info.getEffector()); - } - else - { + } else { sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HP_HAS_BEEN_RESTORED); } sm.addInt((int) amount); diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Lethal.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Lethal.java index a5ea084d13..7af3075599 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Lethal.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Lethal.java @@ -32,13 +32,11 @@ import com.l2jserver.gameserver.network.SystemMessageId; * Lethal effect implementation. * @author Adry_85 */ -public final class Lethal extends AbstractEffect -{ +public final class Lethal extends AbstractEffect { private final double _fullLethal; private final double _halfLethal; - public Lethal(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public Lethal(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _fullLethal = params.getDouble("fullLethal", .0); @@ -46,65 +44,54 @@ public final class Lethal extends AbstractEffect } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2Character target = info.getEffected(); final L2Character activeChar = info.getEffector(); final Skill skill = info.getSkill(); - if (activeChar.isPlayer() && !activeChar.getAccessLevel().canGiveDamage()) - { + if (activeChar.isPlayer() && !activeChar.getAccessLevel().canGiveDamage()) { return; } - if (skill.getMagicLevel() < (target.getLevel() - 6)) - { + if (skill.getMagicLevel() < (target.getLevel() - 6)) { return; } - if (!target.isLethalable() || target.isInvul()) - { + if (!target.isLethalable() || target.isInvul()) { return; } double chanceMultiplier = Formulas.calcAttributeBonus(activeChar, target, skill) * Formulas.calcGeneralTraitBonus(activeChar, target, skill.getTraitType(), false); // Lethal Strike - if (Rnd.get(100) < (_fullLethal * chanceMultiplier)) - { + if (Rnd.get(100) < (_fullLethal * chanceMultiplier)) { // for Players CP and HP is set to 1. - if (target.isPlayer()) - { + if (target.isPlayer()) { target.notifyDamageReceived(target.getCurrentHp() - 1, activeChar, skill, true, false, false); target.setCurrentCp(1); target.setCurrentHp(1); target.sendPacket(SystemMessageId.LETHAL_STRIKE); } // for Monsters HP is set to 1. - else if (target.isMonster() || target.isSummon()) - { + else if (target.isMonster() || target.isSummon()) { target.notifyDamageReceived(target.getCurrentHp() - 1, activeChar, skill, true, false, false); target.setCurrentHp(1); } activeChar.sendPacket(SystemMessageId.LETHAL_STRIKE_SUCCESSFUL); } // Half-Kill - else if (Rnd.get(100) < (_halfLethal * chanceMultiplier)) - { + else if (Rnd.get(100) < (_halfLethal * chanceMultiplier)) { // for Players CP is set to 1. - if (target.isPlayer()) - { + if (target.isPlayer()) { target.setCurrentCp(1); target.sendPacket(SystemMessageId.HALF_KILL); target.sendPacket(SystemMessageId.CP_DISAPPEARS_WHEN_HIT_WITH_A_HALF_KILL_SKILL); } // for Monsters HP is set to 50%. - else if (target.isMonster() || target.isSummon()) - { + else if (target.isMonster() || target.isSummon()) { target.notifyDamageReceived(target.getCurrentHp() * 0.5, activeChar, skill, true, false, false); target.setCurrentHp(target.getCurrentHp() * 0.5); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/MagicalAttack.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/MagicalAttack.java index c1bb2625b0..851cf50780 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/MagicalAttack.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/MagicalAttack.java @@ -34,44 +34,37 @@ import com.l2jserver.gameserver.model.stats.Stats; * Magical Attack effect implementation. * @author Adry_85 */ -public final class MagicalAttack extends AbstractEffect -{ +public final class MagicalAttack extends AbstractEffect { private final double _power; - public MagicalAttack(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public MagicalAttack(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getDouble("power", 0); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.MAGICAL_ATTACK; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2Character target = info.getEffected(); final L2Character activeChar = info.getEffector(); final Skill skill = info.getSkill(); // TODO: Unhardcode Cubic Skill to avoid double damage - if (activeChar.isAlikeDead() || (skill.getId() == 4049)) - { + if (activeChar.isAlikeDead() || (skill.getId() == 4049)) { return; } - if (target.isPlayer() && target.getActingPlayer().isFakeDeath()) - { + if (target.isPlayer() && target.getActingPlayer().isFakeDeath()) { target.stopFakeDeath(true); } @@ -81,23 +74,18 @@ public final class MagicalAttack extends AbstractEffect final byte shld = Formulas.calcShldUse(activeChar, target, skill); double damage = Formulas.calcMagicDam(activeChar, target, skill, shld, sps, bss, mcrit, _power); - if (damage > 0) - { + if (damage > 0) { // Manage attack or cast break of the target (calculating rate, sending message...) - if (!target.isRaid() && Formulas.calcAtkBreak(target, damage)) - { + if (!target.isRaid() && Formulas.calcAtkBreak(target, damage)) { target.breakAttack(); target.breakCast(); } // Shield Deflect Magic: Reflect all damage on caster. - if (target.getStat().calcStat(Stats.VENGEANCE_SKILL_MAGIC_DAMAGE, 0, target, skill) > Rnd.get(100)) - { + if (target.getStat().calcStat(Stats.VENGEANCE_SKILL_MAGIC_DAMAGE, 0, target, skill) > Rnd.get(100)) { activeChar.reduceCurrentHp(damage, target, skill); activeChar.notifyDamageReceived(damage, target, skill, mcrit, false, true); - } - else - { + } else { target.reduceCurrentHp(damage, activeChar, skill); target.notifyDamageReceived(damage, activeChar, skill, mcrit, false, false); activeChar.sendDamageMessage(target, (int) damage, mcrit, false, false); diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/MagicalAttackByAbnormal.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/MagicalAttackByAbnormal.java index aa17269e34..12107d9680 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/MagicalAttackByAbnormal.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/MagicalAttackByAbnormal.java @@ -34,42 +34,35 @@ import com.l2jserver.gameserver.model.stats.Stats; * Magical Attack By Abnormal effect implementation. * @author Adry_85 */ -public final class MagicalAttackByAbnormal extends AbstractEffect -{ +public final class MagicalAttackByAbnormal extends AbstractEffect { private final double _power; - public MagicalAttackByAbnormal(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public MagicalAttackByAbnormal(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getDouble("power", 0); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.MAGICAL_ATTACK; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (info.getEffector().isAlikeDead()) - { + public void onStart(BuffInfo info) { + if (info.getEffector().isAlikeDead()) { return; } final L2Character target = info.getEffected(); final L2Character activeChar = info.getEffector(); final Skill skill = info.getSkill(); - if (target.isPlayer() && target.getActingPlayer().isFakeDeath()) - { + if (target.isPlayer() && target.getActingPlayer().isFakeDeath()) { target.stopFakeDeath(true); } @@ -82,23 +75,18 @@ public final class MagicalAttackByAbnormal extends AbstractEffect // each buff increase +30% damage *= (((target.getBuffCount() * 0.3) + 1.3) / 4); - if (damage > 0) - { + if (damage > 0) { // Manage attack or cast break of the target (calculating rate, sending message...) - if (!target.isRaid() && Formulas.calcAtkBreak(target, damage)) - { + if (!target.isRaid() && Formulas.calcAtkBreak(target, damage)) { target.breakAttack(); target.breakCast(); } // Shield Deflect Magic: Reflect all damage on caster. - if (target.getStat().calcStat(Stats.VENGEANCE_SKILL_MAGIC_DAMAGE, 0, target, skill) > Rnd.get(100)) - { + if (target.getStat().calcStat(Stats.VENGEANCE_SKILL_MAGIC_DAMAGE, 0, target, skill) > Rnd.get(100)) { activeChar.reduceCurrentHp(damage, target, skill); activeChar.notifyDamageReceived(damage, target, skill, mcrit, false, true); - } - else - { + } else { target.reduceCurrentHp(damage, activeChar, skill); target.notifyDamageReceived(damage, activeChar, skill, mcrit, false, false); activeChar.sendDamageMessage(target, (int) damage, mcrit, false, false); diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/MagicalAttackMp.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/MagicalAttackMp.java index c72da95b22..bf211cd071 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/MagicalAttackMp.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/MagicalAttackMp.java @@ -34,32 +34,25 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Magical Attack MP effect. * @author Adry_85 */ -public final class MagicalAttackMp extends AbstractEffect -{ +public final class MagicalAttackMp extends AbstractEffect { private final double _power; - public MagicalAttackMp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public MagicalAttackMp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getDouble("power", 0); } @Override - public boolean calcSuccess(BuffInfo info) - { - if (info.getEffected().isInvul() || info.getEffected().isMpBlocked()) - { + public boolean calcSuccess(BuffInfo info) { + if (info.getEffected().isInvul() || info.getEffected().isMpBlocked()) { return false; } - if (!Formulas.calcMagicAffected(info.getEffector(), info.getEffected(), info.getSkill())) - { - if (info.getEffector().isPlayer()) - { + if (!Formulas.calcMagicAffected(info.getEffector(), info.getEffected(), info.getSkill())) { + if (info.getEffector().isPlayer()) { info.getEffector().sendPacket(SystemMessageId.ATTACK_FAILED); } - if (info.getEffected().isPlayer()) - { + if (info.getEffected().isPlayer()) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_RESISTED_C2_DRAIN2); sm.addCharName(info.getEffected()); sm.addCharName(info.getEffector()); @@ -71,22 +64,18 @@ public final class MagicalAttackMp extends AbstractEffect } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.MAGICAL_ATTACK; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (info.getEffector().isAlikeDead()) - { + public void onStart(BuffInfo info) { + if (info.getEffector().isAlikeDead()) { return; } @@ -101,8 +90,7 @@ public final class MagicalAttackMp extends AbstractEffect double damage = Formulas.calcManaDam(activeChar, target, skill, shld, sps, bss, mcrit, _power); double mp = (damage > target.getCurrentMp() ? target.getCurrentMp() : damage); - if (damage > 0) - { + if (damage > 0) { target.stopEffectsOnDamage(true); target.setCurrentMp(target.getCurrentMp() - mp); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/MagicalSoulAttack.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/MagicalSoulAttack.java index b7ec4b0f0c..e9ced09a58 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/MagicalSoulAttack.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/MagicalSoulAttack.java @@ -34,34 +34,28 @@ import com.l2jserver.gameserver.model.stats.Stats; * Magical Soul Attack effect implementation. * @author Adry_85 */ -public final class MagicalSoulAttack extends AbstractEffect -{ +public final class MagicalSoulAttack extends AbstractEffect { private final double _power; - public MagicalSoulAttack(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public MagicalSoulAttack(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getDouble("power", 0); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.MAGICAL_ATTACK; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (info.getEffector().isAlikeDead()) - { + public void onStart(BuffInfo info) { + if (info.getEffector().isAlikeDead()) { return; } @@ -69,8 +63,7 @@ public final class MagicalSoulAttack extends AbstractEffect final L2Character activeChar = info.getEffector(); final Skill skill = info.getSkill(); - if (target.isPlayer() && target.getActingPlayer().isFakeDeath()) - { + if (target.isPlayer() && target.getActingPlayer().isFakeDeath()) { target.stopFakeDeath(true); } @@ -80,29 +73,23 @@ public final class MagicalSoulAttack extends AbstractEffect final byte shld = Formulas.calcShldUse(activeChar, target, skill); double damage = Formulas.calcMagicDam(activeChar, target, skill, shld, sps, bss, mcrit, _power); - if ((skill.getMaxSoulConsumeCount() > 0) && activeChar.isPlayer()) - { + if ((skill.getMaxSoulConsumeCount() > 0) && activeChar.isPlayer()) { // Souls Formula (each soul increase +4%) damage *= 1 + (info.getCharges() * 0.04); } - if (damage > 0) - { + if (damage > 0) { // Manage attack or cast break of the target (calculating rate, sending message...) - if (!target.isRaid() && Formulas.calcAtkBreak(target, damage)) - { + if (!target.isRaid() && Formulas.calcAtkBreak(target, damage)) { target.breakAttack(); target.breakCast(); } // Shield Deflect Magic: Reflect all damage on caster. - if (target.getStat().calcStat(Stats.VENGEANCE_SKILL_MAGIC_DAMAGE, 0, target, skill) > Rnd.get(100)) - { + if (target.getStat().calcStat(Stats.VENGEANCE_SKILL_MAGIC_DAMAGE, 0, target, skill) > Rnd.get(100)) { activeChar.reduceCurrentHp(damage, target, skill); activeChar.notifyDamageReceived(damage, target, skill, mcrit, false, true); - } - else - { + } else { target.reduceCurrentHp(damage, activeChar, skill); target.notifyDamageReceived(damage, activeChar, skill, mcrit, false, false); activeChar.sendDamageMessage(target, (int) damage, mcrit, false, false); diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ManaHealByLevel.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ManaHealByLevel.java index 93396e24cb..1b46f417ca 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ManaHealByLevel.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/ManaHealByLevel.java @@ -32,35 +32,29 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Mana Heal By Level effect implementation. * @author UnAfraid */ -public final class ManaHealByLevel extends AbstractEffect -{ +public final class ManaHealByLevel extends AbstractEffect { private final double _power; - public ManaHealByLevel(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public ManaHealByLevel(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getDouble("power", 0); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.MANAHEAL_BY_LEVEL; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { L2Character target = info.getEffected(); - if ((target == null) || target.isDead() || target.isDoor() || target.isInvul() || target.isMpBlocked()) - { + if ((target == null) || target.isDead() || target.isDoor() || target.isInvul() || target.isMpBlocked()) { return; } @@ -69,62 +63,40 @@ public final class ManaHealByLevel extends AbstractEffect // recharged mp influenced by difference between target level and skill level // if target is within 5 levels or lower then skill level there's no penalty. amount = target.calcStat(Stats.MANA_CHARGE, amount, null, null); - if (target.getLevel() > info.getSkill().getMagicLevel()) - { + if (target.getLevel() > info.getSkill().getMagicLevel()) { int lvlDiff = target.getLevel() - info.getSkill().getMagicLevel(); // if target is too high compared to skill level, the amount of recharged mp gradually decreases. - if (lvlDiff == 6) - { + if (lvlDiff == 6) { amount *= 0.9; // only 90% effective - } - else if (lvlDiff == 7) - { + } else if (lvlDiff == 7) { amount *= 0.8; // 80% - } - else if (lvlDiff == 8) - { + } else if (lvlDiff == 8) { amount *= 0.7; // 70% - } - else if (lvlDiff == 9) - { + } else if (lvlDiff == 9) { amount *= 0.6; // 60% - } - else if (lvlDiff == 10) - { + } else if (lvlDiff == 10) { amount *= 0.5; // 50% - } - else if (lvlDiff == 11) - { + } else if (lvlDiff == 11) { amount *= 0.4; // 40% - } - else if (lvlDiff == 12) - { + } else if (lvlDiff == 12) { amount *= 0.3; // 30% - } - else if (lvlDiff == 13) - { + } else if (lvlDiff == 13) { amount *= 0.2; // 20% - } - else if (lvlDiff == 14) - { + } else if (lvlDiff == 14) { amount *= 0.1; // 10% - } - else if (lvlDiff >= 15) - { + } else if (lvlDiff >= 15) { amount = 0; // 0mp recharged } } // Prevents overheal and negative amount amount = Math.max(Math.min(amount, target.getMaxRecoverableMp() - target.getCurrentMp()), 0); - if (amount != 0) - { + if (amount != 0) { target.setCurrentMp(amount + target.getCurrentMp()); } final SystemMessage sm = SystemMessage.getSystemMessage(info.getEffector().getObjectId() != target.getObjectId() ? SystemMessageId.S2_MP_HAS_BEEN_RESTORED_BY_C1 : SystemMessageId.S1_MP_HAS_BEEN_RESTORED); - if (info.getEffector().getObjectId() != target.getObjectId()) - { + if (info.getEffector().getObjectId() != target.getObjectId()) { sm.addCharName(info.getEffector()); } sm.addInt((int) amount); diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Mp.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Mp.java index 033d329343..5cb4cc26c8 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Mp.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Mp.java @@ -34,13 +34,11 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * @author Adry_85 * @since 2.6.0.0 */ -public final class Mp extends AbstractEffect -{ +public final class Mp extends AbstractEffect { private final double _amount; private final EffectCalculationType _mode; - public Mp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public Mp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _amount = params.getDouble("amount", 0); @@ -48,35 +46,26 @@ public final class Mp extends AbstractEffect } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2Character target = info.getEffected(); final L2Character activeChar = info.getEffector(); - if ((target == null) || target.isDead() || target.isDoor() || target.isInvul() || target.isMpBlocked()) - { + if ((target == null) || target.isDead() || target.isDoor() || target.isInvul() || target.isMpBlocked()) { return; } double amount = 0; - switch (_mode) - { - case DIFF: - { - if (_amount < 0) - { + switch (_mode) { + case DIFF: { + if (_amount < 0) { amount = _amount; - } - else - { + } else { final Skill skill = info.getSkill(); - if (!skill.isStatic()) - { + if (!skill.isStatic()) { amount = target.calcStat(Stats.MANA_CHARGE, _amount, null, null); } @@ -84,42 +73,31 @@ public final class Mp extends AbstractEffect } break; } - case PER: - { - if (_amount < 0) - { + case PER: { + if (_amount < 0) { amount = (target.getCurrentMp() * _amount) / 100; - } - else - { + } else { amount = Math.min((target.getMaxMp() * _amount) / 100.0, target.getMaxRecoverableMp() - target.getCurrentMp()); } break; } } - if (amount >= 0) - { - if (amount != 0) - { + if (amount >= 0) { + if (amount != 0) { target.setCurrentMp(amount + target.getCurrentMp()); } SystemMessage sm; - if ((activeChar != null) && (activeChar != target)) - { + if ((activeChar != null) && (activeChar != target)) { sm = SystemMessage.getSystemMessage(SystemMessageId.S2_MP_HAS_BEEN_RESTORED_BY_C1); sm.addCharName(info.getEffector()); sm.addInt((int) amount); target.sendPacket(sm); - } - else - { + } else { target.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.S1_MP_HAS_BEEN_RESTORED).addInt((int) amount)); } - } - else - { + } else { target.reduceCurrentMp(Math.abs(amount)); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/MpPerMax.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/MpPerMax.java index e354e29e28..d9bb8c369d 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/MpPerMax.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/MpPerMax.java @@ -31,35 +31,29 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Mp Per Max effect implementation. * @author UnAfraid */ -public final class MpPerMax extends AbstractEffect -{ +public final class MpPerMax extends AbstractEffect { private final double _power; - public MpPerMax(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public MpPerMax(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getDouble("power", 0); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.MANAHEAL_PERCENT; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { L2Character target = info.getEffected(); - if ((target == null) || target.isDead() || target.isDoor()) - { + if ((target == null) || target.isDead() || target.isDoor()) { return; } @@ -70,18 +64,14 @@ public final class MpPerMax extends AbstractEffect amount = full ? target.getMaxMp() : (target.getMaxMp() * power) / 100.0; // Prevents overheal and negative amount amount = Math.max(Math.min(amount, target.getMaxRecoverableMp() - target.getCurrentMp()), 0); - if (amount != 0) - { + if (amount != 0) { target.setCurrentMp(amount + target.getCurrentMp()); } SystemMessage sm; - if (info.getEffector().getObjectId() != target.getObjectId()) - { + if (info.getEffector().getObjectId() != target.getObjectId()) { sm = SystemMessage.getSystemMessage(SystemMessageId.S2_MP_HAS_BEEN_RESTORED_BY_C1); sm.addCharName(info.getEffector()); - } - else - { + } else { sm = SystemMessage.getSystemMessage(SystemMessageId.S1_MP_HAS_BEEN_RESTORED); } sm.addInt((int) amount); diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/OpenCommonRecipeBook.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/OpenCommonRecipeBook.java index 395bd33a70..a2eab1c40c 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/OpenCommonRecipeBook.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/OpenCommonRecipeBook.java @@ -31,30 +31,24 @@ import com.l2jserver.gameserver.network.SystemMessageId; * Open Common Recipe Book effect implementation. * @author Adry_85 */ -public final class OpenCommonRecipeBook extends AbstractEffect -{ - public OpenCommonRecipeBook(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class OpenCommonRecipeBook extends AbstractEffect { + public OpenCommonRecipeBook(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (!info.getEffector().isPlayer()) - { + public void onStart(BuffInfo info) { + if (!info.getEffector().isPlayer()) { return; } L2PcInstance player = info.getEffector().getActingPlayer(); - if (player.getPrivateStoreType() != PrivateStoreType.NONE) - { + if (player.getPrivateStoreType() != PrivateStoreType.NONE) { player.sendPacket(SystemMessageId.CANNOT_CREATED_WHILE_ENGAGED_IN_TRADING); return; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/OpenDwarfRecipeBook.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/OpenDwarfRecipeBook.java index f0389f01bf..e532ac89c1 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/OpenDwarfRecipeBook.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/OpenDwarfRecipeBook.java @@ -31,30 +31,24 @@ import com.l2jserver.gameserver.network.SystemMessageId; * Open Dwarf Recipe Book effect implementation. * @author Adry_85 */ -public final class OpenDwarfRecipeBook extends AbstractEffect -{ - public OpenDwarfRecipeBook(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class OpenDwarfRecipeBook extends AbstractEffect { + public OpenDwarfRecipeBook(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (!info.getEffector().isPlayer()) - { + public void onStart(BuffInfo info) { + if (!info.getEffector().isPlayer()) { return; } L2PcInstance player = info.getEffector().getActingPlayer(); - if (player.getPrivateStoreType() != PrivateStoreType.NONE) - { + if (player.getPrivateStoreType() != PrivateStoreType.NONE) { player.sendPacket(SystemMessageId.CANNOT_CREATED_WHILE_ENGAGED_IN_TRADING); return; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/OutpostCreate.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/OutpostCreate.java index c627d8d206..2f46653b93 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/OutpostCreate.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/OutpostCreate.java @@ -31,32 +31,26 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Outpost Create effect implementation. * @author UnAfraid */ -public final class OutpostCreate extends AbstractEffect -{ +public final class OutpostCreate extends AbstractEffect { private static final int HQ_NPC_ID = 36590; - public OutpostCreate(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public OutpostCreate(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2PcInstance player = info.getEffector().getActingPlayer(); - if (!player.isClanLeader()) - { + if (!player.isClanLeader()) { return; } - if (TerritoryWarManager.getInstance().isTWInProgress()) - { + if (TerritoryWarManager.getInstance().isTWInProgress()) { // Spawn a new flag final L2SiegeFlagInstance flag = new L2SiegeFlagInstance(player, NpcData.getInstance().getTemplate(HQ_NPC_ID), true, true); flag.setTitle(player.getClan().getName()); diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/OutpostDestroy.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/OutpostDestroy.java index 7d70ac9878..106c77d641 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/OutpostDestroy.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/OutpostDestroy.java @@ -30,33 +30,26 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Outpost Destroy effect implementation. * @author UnAfraid */ -public final class OutpostDestroy extends AbstractEffect -{ - public OutpostDestroy(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class OutpostDestroy extends AbstractEffect { + public OutpostDestroy(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2PcInstance player = info.getEffector().getActingPlayer(); - if (!player.isClanLeader()) - { + if (!player.isClanLeader()) { return; } - if (TerritoryWarManager.getInstance().isTWInProgress()) - { + if (TerritoryWarManager.getInstance().isTWInProgress()) { final L2SiegeFlagInstance flag = TerritoryWarManager.getInstance().getHQForClan(player.getClan()); - if (flag != null) - { + if (flag != null) { flag.deleteMe(); } TerritoryWarManager.getInstance().setHQForClan(player.getClan(), null); diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/PhysicalAttack.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/PhysicalAttack.java index 2e9152b4f7..ad78b6b768 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/PhysicalAttack.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/PhysicalAttack.java @@ -33,14 +33,12 @@ import com.l2jserver.gameserver.network.SystemMessageId; * Physical Attack effect implementation. * @author Adry_85 */ -public final class PhysicalAttack extends AbstractEffect -{ +public final class PhysicalAttack extends AbstractEffect { private final double _power; private final int _criticalChance; private final boolean _ignoreShieldDefence; - public PhysicalAttack(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public PhysicalAttack(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getDouble("power", 0); @@ -49,37 +47,31 @@ public final class PhysicalAttack extends AbstractEffect } @Override - public boolean calcSuccess(BuffInfo info) - { + public boolean calcSuccess(BuffInfo info) { return !Formulas.calcPhysicalSkillEvasion(info.getEffector(), info.getEffected(), info.getSkill()); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.PHYSICAL_ATTACK; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { L2Character target = info.getEffected(); L2Character activeChar = info.getEffector(); Skill skill = info.getSkill(); - if (activeChar.isAlikeDead()) - { + if (activeChar.isAlikeDead()) { return; } - if (target.isPlayer() && target.getActingPlayer().isFakeDeath()) - { + if (target.isPlayer() && target.getActingPlayer().isFakeDeath()) { target.stopFakeDeath(true); } @@ -87,36 +79,30 @@ public final class PhysicalAttack extends AbstractEffect byte shield = 0; boolean ss = skill.isPhysical() && activeChar.isChargedShot(ShotType.SOULSHOTS); - if (!_ignoreShieldDefence) - { + if (!_ignoreShieldDefence) { shield = Formulas.calcShldUse(activeChar, target, skill, true); } // Physical damage critical rate is only affected by STR. boolean crit = false; - if (_criticalChance > 0) - { + if (_criticalChance > 0) { crit = Formulas.calcSkillCrit(activeChar, target, _criticalChance); } damage = Formulas.calcSkillPhysDam(activeChar, target, skill, shield, false, ss, _power); - if (crit) - { + if (crit) { damage *= 2; } - if (damage > 0) - { + if (damage > 0) { activeChar.sendDamageMessage(target, (int) damage, false, crit, false); target.reduceCurrentHp(damage, activeChar, skill); target.notifyDamageReceived(damage, activeChar, skill, crit, false, false); // Check if damage should be reflected Formulas.calcDamageReflected(activeChar, target, skill, crit); - } - else - { + } else { activeChar.sendPacket(SystemMessageId.ATTACK_FAILED); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/PhysicalAttackHpLink.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/PhysicalAttackHpLink.java index faa82096e7..f59dd3ec1d 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/PhysicalAttackHpLink.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/PhysicalAttackHpLink.java @@ -34,49 +34,41 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Physical Attack HP Link effect implementation. * @author Adry_85 */ -public final class PhysicalAttackHpLink extends AbstractEffect -{ +public final class PhysicalAttackHpLink extends AbstractEffect { private final double _power; - public PhysicalAttackHpLink(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public PhysicalAttackHpLink(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getDouble("power", 0); } @Override - public boolean calcSuccess(BuffInfo info) - { + public boolean calcSuccess(BuffInfo info) { return !Formulas.calcPhysicalSkillEvasion(info.getEffector(), info.getEffected(), info.getSkill()); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.PHYSICAL_ATTACK; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2Character target = info.getEffected(); final L2Character activeChar = info.getEffector(); final Skill skill = info.getSkill(); - if (activeChar.isAlikeDead()) - { + if (activeChar.isAlikeDead()) { return; } - if (activeChar.isMovementDisabled()) - { + if (activeChar.isMovementDisabled()) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED); sm.addSkillName(skill); activeChar.sendPacket(sm); @@ -91,17 +83,14 @@ public final class PhysicalAttackHpLink extends AbstractEffect damage = Formulas.calcSkillPhysDam(activeChar, target, skill, shld, false, ss, power); - if (damage > 0) - { + if (damage > 0) { activeChar.sendDamageMessage(target, (int) damage, false, false, false); target.reduceCurrentHp(damage, activeChar, skill); target.notifyDamageReceived(damage, activeChar, skill, false, false, false); // Check if damage should be reflected. Formulas.calcDamageReflected(activeChar, target, skill, false); - } - else - { + } else { activeChar.sendPacket(SystemMessageId.ATTACK_FAILED); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/PhysicalSoulAttack.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/PhysicalSoulAttack.java index 18c160abba..c9ab1753b7 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/PhysicalSoulAttack.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/PhysicalSoulAttack.java @@ -33,14 +33,12 @@ import com.l2jserver.gameserver.network.SystemMessageId; * Physical Soul Attack effect implementation. * @author Adry_85 */ -public final class PhysicalSoulAttack extends AbstractEffect -{ +public final class PhysicalSoulAttack extends AbstractEffect { private final double _power; private final int _criticalChance; private final boolean _ignoreShieldDefence; - public PhysicalSoulAttack(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public PhysicalSoulAttack(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getDouble("power", 0); @@ -49,37 +47,31 @@ public final class PhysicalSoulAttack extends AbstractEffect } @Override - public boolean calcSuccess(BuffInfo info) - { + public boolean calcSuccess(BuffInfo info) { return !Formulas.calcPhysicalSkillEvasion(info.getEffector(), info.getEffected(), info.getSkill()); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.PHYSICAL_ATTACK; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { L2Character target = info.getEffected(); L2Character activeChar = info.getEffector(); Skill skill = info.getSkill(); - if (activeChar.isAlikeDead()) - { + if (activeChar.isAlikeDead()) { return; } - if (target.isPlayer() && target.getActingPlayer().isFakeDeath()) - { + if (target.isPlayer() && target.getActingPlayer().isFakeDeath()) { target.stopFakeDeath(true); } @@ -87,41 +79,34 @@ public final class PhysicalSoulAttack extends AbstractEffect boolean ss = skill.isPhysical() && activeChar.isChargedShot(ShotType.SOULSHOTS); byte shield = 0; - if (!_ignoreShieldDefence) - { + if (!_ignoreShieldDefence) { shield = Formulas.calcShldUse(activeChar, target, skill, true); } // Physical damage critical rate is only affected by STR. boolean crit = false; - if (_criticalChance > 0) - { + if (_criticalChance > 0) { crit = Formulas.calcSkillCrit(activeChar, target, _criticalChance); } damage = Formulas.calcSkillPhysDam(activeChar, target, skill, shield, false, ss, _power); - if ((skill.getMaxSoulConsumeCount() > 0) && activeChar.isPlayer()) - { + if ((skill.getMaxSoulConsumeCount() > 0) && activeChar.isPlayer()) { // Souls Formula (each soul increase +4%) damage *= 1 + (info.getCharges() * 0.04); } - if (crit) - { + if (crit) { damage *= 2; } - if (damage > 0) - { + if (damage > 0) { activeChar.sendDamageMessage(target, (int) damage, false, crit, false); target.reduceCurrentHp(damage, activeChar, skill); target.notifyDamageReceived(damage, activeChar, skill, crit, false, false); // Check if damage should be reflected Formulas.calcDamageReflected(activeChar, target, skill, crit); - } - else - { + } else { activeChar.sendPacket(SystemMessageId.ATTACK_FAILED); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Pumping.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Pumping.java index aa01b55a8b..8533431a13 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Pumping.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Pumping.java @@ -39,46 +39,38 @@ import com.l2jserver.gameserver.network.serverpackets.ActionFailed; * Pumping effect implementation. * @author UnAfraid */ -public final class Pumping extends AbstractEffect -{ +public final class Pumping extends AbstractEffect { private final double _power; - public Pumping(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public Pumping(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); - if (params.getString("power", null) == null) - { + if (params.getString("power", null) == null) { throw new IllegalArgumentException(getClass().getSimpleName() + ": effect without power!"); } _power = params.getDouble("power"); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.FISHING; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2Character activeChar = info.getEffector(); - if (!activeChar.isPlayer()) - { + if (!activeChar.isPlayer()) { return; } final L2PcInstance player = activeChar.getActingPlayer(); final L2Fishing fish = player.getFishCombat(); - if (fish == null) - { + if (fish == null) { // Pumping skill is available only while fishing player.sendPacket(SystemMessageId.CAN_USE_PUMPING_ONLY_WHILE_FISHING); player.sendPacket(ActionFailed.STATIC_PACKET); @@ -86,14 +78,12 @@ public final class Pumping extends AbstractEffect } final L2Weapon weaponItem = player.getActiveWeaponItem(); final L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance(); - if ((weaponInst == null) || (weaponItem == null)) - { + if ((weaponInst == null) || (weaponItem == null)) { return; } int SS = 1; int pen = 0; - if (activeChar.isChargedShot(ShotType.FISH_SOULSHOTS)) - { + if (activeChar.isChargedShot(ShotType.FISH_SOULSHOTS)) { SS = 2; } final L2FishingRod fishingRod = FishingRodsData.getInstance().getFishingRod(weaponItem.getId()); @@ -106,8 +96,7 @@ public final class Pumping extends AbstractEffect pen = (int) (dmg * 0.05); dmg = dmg - pen; } - if (SS > 1) - { + if (SS > 1) { weaponInst.setChargedShot(ShotType.FISH_SOULSHOTS, false); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/RandomizeHate.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/RandomizeHate.java index a9ef782482..bc68d18ded 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/RandomizeHate.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/RandomizeHate.java @@ -33,41 +33,34 @@ import com.l2jserver.gameserver.model.stats.Formulas; /** * Randomize Hate effect implementation. */ -public final class RandomizeHate extends AbstractEffect -{ +public final class RandomizeHate extends AbstractEffect { private final int _chance; - public RandomizeHate(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public RandomizeHate(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _chance = params.getInt("chance", 100); } @Override - public boolean calcSuccess(BuffInfo info) - { + public boolean calcSuccess(BuffInfo info) { return Formulas.calcProbability(_chance, info.getEffector(), info.getEffected(), info.getSkill()); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if ((info.getEffected() == null) || (info.getEffected() == info.getEffector()) || !info.getEffected().isAttackable()) - { + public void onStart(BuffInfo info) { + if ((info.getEffected() == null) || (info.getEffected() == info.getEffector()) || !info.getEffected().isAttackable()) { return; } final L2Attackable effectedMob = (L2Attackable) info.getEffected(); final List<L2Character> aggroList = effectedMob.getAggroList().keySet().stream().filter(c -> c != info.getEffector()).collect(Collectors.toList()); - if (aggroList.isEmpty()) - { + if (aggroList.isEmpty()) { return; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/RebalanceHP.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/RebalanceHP.java index c2dabb91f4..500ec9c3d8 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/RebalanceHP.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/RebalanceHP.java @@ -34,30 +34,24 @@ import com.l2jserver.gameserver.util.Util; * Rebalance HP effect implementation. * @author Adry_85, earendil */ -public final class RebalanceHP extends AbstractEffect -{ - public RebalanceHP(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class RebalanceHP extends AbstractEffect { + public RebalanceHP(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.REBALANCE_HP; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (!info.getEffector().isPlayer() || !info.getEffector().isInParty()) - { + public void onStart(BuffInfo info) { + if (!info.getEffector().isPlayer() || !info.getEffector().isInParty()) { return; } @@ -66,37 +60,29 @@ public final class RebalanceHP extends AbstractEffect final L2Party party = info.getEffector().getParty(); final Skill skill = info.getSkill(); final L2Character effector = info.getEffector(); - for (L2PcInstance member : party.getMembers()) - { - if (!member.isDead() && Util.checkIfInRange(skill.getAffectRange(), effector, member, true)) - { + for (L2PcInstance member : party.getMembers()) { + if (!member.isDead() && Util.checkIfInRange(skill.getAffectRange(), effector, member, true)) { fullHP += member.getMaxHp(); currentHPs += member.getCurrentHp(); } final L2Summon summon = member.getSummon(); - if ((summon != null) && (!summon.isDead() && Util.checkIfInRange(skill.getAffectRange(), effector, summon, true))) - { + if ((summon != null) && (!summon.isDead() && Util.checkIfInRange(skill.getAffectRange(), effector, summon, true))) { fullHP += summon.getMaxHp(); currentHPs += summon.getCurrentHp(); } } double percentHP = currentHPs / fullHP; - for (L2PcInstance member : party.getMembers()) - { - if (!member.isDead() && Util.checkIfInRange(skill.getAffectRange(), effector, member, true)) - { + for (L2PcInstance member : party.getMembers()) { + if (!member.isDead() && Util.checkIfInRange(skill.getAffectRange(), effector, member, true)) { double newHP = member.getMaxHp() * percentHP; if (newHP > member.getCurrentHp()) // The target gets healed { // The heal will be blocked if the current hp passes the limit - if (member.getCurrentHp() > member.getMaxRecoverableHp()) - { + if (member.getCurrentHp() > member.getMaxRecoverableHp()) { newHP = member.getCurrentHp(); - } - else if (newHP > member.getMaxRecoverableHp()) - { + } else if (newHP > member.getMaxRecoverableHp()) { newHP = member.getMaxRecoverableHp(); } } @@ -105,18 +91,14 @@ public final class RebalanceHP extends AbstractEffect } final L2Summon summon = member.getSummon(); - if ((summon != null) && (!summon.isDead() && Util.checkIfInRange(skill.getAffectRange(), effector, summon, true))) - { + if ((summon != null) && (!summon.isDead() && Util.checkIfInRange(skill.getAffectRange(), effector, summon, true))) { double newHP = summon.getMaxHp() * percentHP; if (newHP > summon.getCurrentHp()) // The target gets healed { // The heal will be blocked if the current hp passes the limit - if (summon.getCurrentHp() > summon.getMaxRecoverableHp()) - { + if (summon.getCurrentHp() > summon.getMaxRecoverableHp()) { newHP = summon.getCurrentHp(); - } - else if (newHP > summon.getMaxRecoverableHp()) - { + } else if (newHP > summon.getMaxRecoverableHp()) { newHP = summon.getMaxRecoverableHp(); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Reeling.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Reeling.java index a3a0cd1d4e..069bcf4b94 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Reeling.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Reeling.java @@ -39,46 +39,38 @@ import com.l2jserver.gameserver.network.serverpackets.ActionFailed; * Reeling effect implementation. * @author UnAfraid */ -public final class Reeling extends AbstractEffect -{ +public final class Reeling extends AbstractEffect { private final double _power; - public Reeling(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public Reeling(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); - if (params.getString("power", null) == null) - { + if (params.getString("power", null) == null) { throw new IllegalArgumentException(getClass().getSimpleName() + ": effect without power!"); } _power = params.getDouble("power"); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.FISHING; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2Character activeChar = info.getEffector(); - if (!activeChar.isPlayer()) - { + if (!activeChar.isPlayer()) { return; } final L2PcInstance player = activeChar.getActingPlayer(); final L2Fishing fish = player.getFishCombat(); - if (fish == null) - { + if (fish == null) { // Reeling skill is available only while fishing player.sendPacket(SystemMessageId.CAN_USE_REELING_ONLY_WHILE_FISHING); player.sendPacket(ActionFailed.STATIC_PACKET); @@ -86,14 +78,12 @@ public final class Reeling extends AbstractEffect } final L2Weapon weaponItem = player.getActiveWeaponItem(); final L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance(); - if ((weaponInst == null) || (weaponItem == null)) - { + if ((weaponInst == null) || (weaponItem == null)) { return; } int SS = 1; int pen = 0; - if (activeChar.isChargedShot(ShotType.FISH_SOULSHOTS)) - { + if (activeChar.isChargedShot(ShotType.FISH_SOULSHOTS)) { SS = 2; } final L2FishingRod fishingRod = FishingRodsData.getInstance().getFishingRod(weaponItem.getId()); @@ -106,8 +96,7 @@ public final class Reeling extends AbstractEffect pen = (int) (dmg * 0.05); dmg = dmg - pen; } - if (SS > 1) - { + if (SS > 1) { weaponInst.setChargedShot(ShotType.FISH_SOULSHOTS, false); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/RefuelAirship.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/RefuelAirship.java index 951eec71ee..e7b9231f52 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/RefuelAirship.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/RefuelAirship.java @@ -29,32 +29,27 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Refuel Airship effect implementation. * @author Adry_85 */ -public final class RefuelAirship extends AbstractEffect -{ +public final class RefuelAirship extends AbstractEffect { private final int _value; - public RefuelAirship(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public RefuelAirship(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _value = params.getInt("value", 0); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.REFUEL_AIRSHIP; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2AirShipInstance ship = info.getEffector().getActingPlayer().getAirShip(); ship.setFuel(ship.getFuel() + _value); ship.updateAbnormalEffect(); diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Restoration.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Restoration.java index 2abe792ec5..69d8e91ea2 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Restoration.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Restoration.java @@ -29,13 +29,11 @@ import com.l2jserver.gameserver.network.serverpackets.PetItemList; * Restoration effect implementation. * @author Zoey76 */ -public final class Restoration extends AbstractEffect -{ +public final class Restoration extends AbstractEffect { private final int _itemId; private final int _itemCount; - public Restoration(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public Restoration(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _itemId = params.getInt("itemId", 0); @@ -43,32 +41,25 @@ public final class Restoration extends AbstractEffect } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if ((info.getEffected() == null) || !info.getEffected().isPlayable()) - { + public void onStart(BuffInfo info) { + if ((info.getEffected() == null) || !info.getEffected().isPlayable()) { return; } - if ((_itemId <= 0) || (_itemCount <= 0)) - { + if ((_itemId <= 0) || (_itemCount <= 0)) { info.getEffected().sendPacket(SystemMessageId.NOTHING_INSIDE_THAT); _log.warning(Restoration.class.getSimpleName() + " effect with wrong item Id/count: " + _itemId + "/" + _itemCount + "!"); return; } - if (info.getEffected().isPlayer()) - { + if (info.getEffected().isPlayer()) { info.getEffected().getActingPlayer().addItem("Skill", _itemId, _itemCount, info.getEffector(), true); - } - else if (info.getEffected().isPet()) - { + } else if (info.getEffected().isPet()) { info.getEffected().getInventory().addItem("Skill", _itemId, _itemCount, info.getEffected().getActingPlayer(), info.getEffector()); info.getEffected().getActingPlayer().sendPacket(new PetItemList(info.getEffected().getInventory().getItems())); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/RestorationRandom.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/RestorationRandom.java index 3af6d98656..4d0aca8728 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/RestorationRandom.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/RestorationRandom.java @@ -40,35 +40,28 @@ import com.l2jserver.gameserver.network.SystemMessageId; * This effect has been unhardcoded in order to work on targets as well. * @author Zoey76 */ -public final class RestorationRandom extends AbstractEffect -{ - public RestorationRandom(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class RestorationRandom extends AbstractEffect { + public RestorationRandom(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if ((info.getEffector() == null) || (info.getEffected() == null) || !info.getEffector().isPlayer() || !info.getEffected().isPlayer()) - { + public void onStart(BuffInfo info) { + if ((info.getEffector() == null) || (info.getEffected() == null) || !info.getEffector().isPlayer() || !info.getEffected().isPlayer()) { return; } final L2ExtractableSkill exSkill = info.getSkill().getExtractableSkill(); - if (exSkill == null) - { + if (exSkill == null) { return; } - if (exSkill.getProductItems().isEmpty()) - { + if (exSkill.getProductItems().isEmpty()) { _log.warning("Extractable Skill with no data, probably wrong/empty table in Skill Id: " + info.getSkill().getId()); return; } @@ -87,11 +80,9 @@ public final class RestorationRandom extends AbstractEffect // If you get chance equal 45% you fall into the second zone 30-80. // Meaning you get the second production list. // Calculate extraction - for (L2ExtractableProductItem expi : exSkill.getProductItems()) - { + for (L2ExtractableProductItem expi : exSkill.getProductItems()) { chance = expi.getChance(); - if ((rndNum >= chanceFrom) && (rndNum <= (chance + chanceFrom))) - { + if ((rndNum >= chanceFrom) && (rndNum <= (chance + chanceFrom))) { creationList.addAll(expi.getItems()); break; } @@ -99,16 +90,13 @@ public final class RestorationRandom extends AbstractEffect } final L2PcInstance player = info.getEffected().getActingPlayer(); - if (creationList.isEmpty()) - { + if (creationList.isEmpty()) { player.sendPacket(SystemMessageId.NOTHING_INSIDE_THAT); return; } - for (ItemHolder item : creationList) - { - if ((item.getId() <= 0) || (item.getCount() <= 0)) - { + for (ItemHolder item : creationList) { + if ((item.getId() <= 0) || (item.getCount() <= 0)) { continue; } player.addItem("Extract", item.getId(), (long) (item.getCount() * rates().getRateExtractable()), info.getEffector(), true); diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Resurrection.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Resurrection.java index df4dc8042a..7ffa91412f 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Resurrection.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Resurrection.java @@ -31,44 +31,35 @@ import com.l2jserver.gameserver.taskmanager.DecayTaskManager; * Resurrection effect implementation. * @author Adry_85 */ -public final class Resurrection extends AbstractEffect -{ +public final class Resurrection extends AbstractEffect { private final int _power; - public Resurrection(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public Resurrection(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getInt("power", 0); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.RESURRECTION; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { L2Character target = info.getEffected(); L2Character activeChar = info.getEffector(); - if (activeChar.isPlayer()) - { - if (target.getActingPlayer() != null) - { + if (activeChar.isPlayer()) { + if (target.getActingPlayer() != null) { target.getActingPlayer().reviveRequest(activeChar.getActingPlayer(), info.getSkill(), target.isPet(), _power, 0); } - } - else - { + } else { DecayTaskManager.getInstance().cancel(target); target.doRevive(Formulas.calculateSkillResurrectRestorePercent(_power, activeChar)); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/RunAway.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/RunAway.java index 2c302758e7..9b82923a05 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/RunAway.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/RunAway.java @@ -30,13 +30,11 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Run Away effect implementation. * @author Zoey76 */ -public final class RunAway extends AbstractEffect -{ +public final class RunAway extends AbstractEffect { private final int _power; private final int _time; - public RunAway(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public RunAway(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getInt("power", 0); @@ -45,26 +43,21 @@ public final class RunAway extends AbstractEffect } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (!info.getEffected().isAttackable()) - { + public void onStart(BuffInfo info) { + if (!info.getEffected().isAttackable()) { return; } - if (Rnd.get(100) > _power) - { + if (Rnd.get(100) > _power) { return; } - if (info.getEffected().isCastingNow() && info.getEffected().canAbortCast()) - { + if (info.getEffected().isCastingNow() && info.getEffected().canAbortCast()) { info.getEffected().abortCast(); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SetSkill.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SetSkill.java index d512ccce14..f5142489ba 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SetSkill.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SetSkill.java @@ -29,13 +29,11 @@ import com.l2jserver.gameserver.model.skills.Skill; * Set Skill effect implementation. * @author Zoey76 */ -public final class SetSkill extends AbstractEffect -{ +public final class SetSkill extends AbstractEffect { private final int _skillId; private final int _skillLvl; - public SetSkill(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public SetSkill(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _skillId = params.getInt("skillId", 0); @@ -43,22 +41,18 @@ public final class SetSkill extends AbstractEffect } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if ((info.getEffected() == null) || !info.getEffected().isPlayer()) - { + public void onStart(BuffInfo info) { + if ((info.getEffected() == null) || !info.getEffected().isPlayer()) { return; } final Skill skill = SkillData.getInstance().getSkill(_skillId, _skillLvl); - if (skill == null) - { + if (skill == null) { return; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SkillTurning.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SkillTurning.java index 9146e41d70..aa7426e0ba 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SkillTurning.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SkillTurning.java @@ -27,34 +27,28 @@ import com.l2jserver.gameserver.model.stats.Formulas; /** * Skill Turning effect implementation. */ -public final class SkillTurning extends AbstractEffect -{ +public final class SkillTurning extends AbstractEffect { private final int _chance; - public SkillTurning(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public SkillTurning(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _chance = params.getInt("chance", 100); } @Override - public boolean calcSuccess(BuffInfo info) - { + public boolean calcSuccess(BuffInfo info) { return Formulas.calcProbability(_chance, info.getEffector(), info.getEffected(), info.getSkill()); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if ((info.getEffected() == null) || (info.getEffected() == info.getEffector()) || info.getEffected().isRaid()) - { + public void onStart(BuffInfo info) { + if ((info.getEffected() == null) || (info.getEffected() == info.getEffector()) || info.getEffected().isRaid()) { return; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SoulBlow.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SoulBlow.java index 41dfe369bc..040bd87b7d 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SoulBlow.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SoulBlow.java @@ -32,13 +32,11 @@ import com.l2jserver.gameserver.model.stats.Formulas; * Soul Blow effect implementation. * @author Adry_85 */ -public final class SoulBlow extends AbstractEffect -{ +public final class SoulBlow extends AbstractEffect { private final double _power; private final int _blowChance; - public SoulBlow(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public SoulBlow(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getDouble("power", 0); @@ -49,39 +47,33 @@ public final class SoulBlow extends AbstractEffect * If is not evaded and blow lands. */ @Override - public boolean calcSuccess(BuffInfo info) - { + public boolean calcSuccess(BuffInfo info) { return !Formulas.calcPhysicalSkillEvasion(info.getEffector(), info.getEffected(), info.getSkill()) && Formulas.calcBlowSuccess(info.getEffector(), info.getEffected(), info.getSkill(), _blowChance); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.PHYSICAL_ATTACK; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { L2Character target = info.getEffected(); L2Character activeChar = info.getEffector(); - if (activeChar.isAlikeDead()) - { + if (activeChar.isAlikeDead()) { return; } boolean ss = info.getSkill().useSoulShot() && activeChar.isChargedShot(ShotType.SOULSHOTS); byte shld = Formulas.calcShldUse(activeChar, target, info.getSkill()); double damage = Formulas.calcBlowDamage(activeChar, target, info.getSkill(), shld, ss, _power); - if ((info.getSkill().getMaxSoulConsumeCount() > 0) && activeChar.isPlayer()) - { + if ((info.getSkill().getMaxSoulConsumeCount() > 0) && activeChar.isPlayer()) { // Souls Formula (each soul increase +4%) damage *= 1 + (info.getCharges() * 0.04); } @@ -90,14 +82,12 @@ public final class SoulBlow extends AbstractEffect target.notifyDamageReceived(damage, activeChar, info.getSkill(), false, false, false); // Manage attack or cast break of the target (calculating rate, sending message...) - if (!target.isRaid() && Formulas.calcAtkBreak(target, damage)) - { + if (!target.isRaid() && Formulas.calcAtkBreak(target, damage)) { target.breakAttack(); target.breakCast(); } - if (activeChar.isPlayer()) - { + if (activeChar.isPlayer()) { L2PcInstance activePlayer = activeChar.getActingPlayer(); activePlayer.sendDamageMessage(target, (int) damage, false, true, false); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Sow.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Sow.java index 7834f8c370..cb3eabe507 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Sow.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Sow.java @@ -36,60 +36,47 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Sow effect implementation. * @author Adry_85, l3x */ -public final class Sow extends AbstractEffect -{ - public Sow(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class Sow extends AbstractEffect { + public Sow(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (!info.getEffector().isPlayer() || !info.getEffected().isMonster()) - { + public void onStart(BuffInfo info) { + if (!info.getEffector().isPlayer() || !info.getEffected().isMonster()) { return; } final L2PcInstance player = info.getEffector().getActingPlayer(); final L2MonsterInstance target = (L2MonsterInstance) info.getEffected(); - if (target.isDead() || (!target.getTemplate().canBeSown()) || target.isSeeded() || (target.getSeederId() != player.getObjectId())) - { + if (target.isDead() || (!target.getTemplate().canBeSown()) || target.isSeeded() || (target.getSeederId() != player.getObjectId())) { return; } // Consuming used seed final L2Seed seed = target.getSeed(); - if (!player.destroyItemByItemId("Consume", seed.getSeedId(), 1, target, false)) - { + if (!player.destroyItemByItemId("Consume", seed.getSeedId(), 1, target, false)) { return; } final SystemMessage sm; - if (calcSuccess(player, target, seed)) - { + if (calcSuccess(player, target, seed)) { player.sendPacket(Sound.ITEMSOUND_QUEST_ITEMGET.getPacket()); target.setSeeded(player.getActingPlayer()); sm = SystemMessage.getSystemMessage(SystemMessageId.THE_SEED_WAS_SUCCESSFULLY_SOWN); - } - else - { + } else { sm = SystemMessage.getSystemMessage(SystemMessageId.THE_SEED_WAS_NOT_SOWN); } - if (player.isInParty()) - { + if (player.isInParty()) { player.getParty().broadcastPacket(sm); - } - else - { + } else { player.sendPacket(sm); } @@ -97,8 +84,7 @@ public final class Sow extends AbstractEffect target.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); } - private static boolean calcSuccess(L2Character activeChar, L2Character target, L2Seed seed) - { + private static boolean calcSuccess(L2Character activeChar, L2Character target, L2Seed seed) { // TODO: check all the chances final int minlevelSeed = seed.getLevel() - 5; final int maxlevelSeed = seed.getLevel() + 5; @@ -107,24 +93,20 @@ public final class Sow extends AbstractEffect int basicSuccess = seed.isAlternative() ? 20 : 90; // seed level - if (levelTarget < minlevelSeed) - { + if (levelTarget < minlevelSeed) { basicSuccess -= 5 * (minlevelSeed - levelTarget); } - if (levelTarget > maxlevelSeed) - { + if (levelTarget > maxlevelSeed) { basicSuccess -= 5 * (levelTarget - maxlevelSeed); } // 5% decrease in chance if player level // is more than +/- 5 levels to _target's_ level int diff = (levelPlayer - levelTarget); - if (diff < 0) - { + if (diff < 0) { diff = -diff; } - if (diff > 5) - { + if (diff > 5) { basicSuccess -= 5 * (diff - 5); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Spoil.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Spoil.java index 2e9b81e4da..41099fbf77 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Spoil.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Spoil.java @@ -31,37 +31,30 @@ import com.l2jserver.gameserver.network.SystemMessageId; * Spoil effect implementation. * @author _drunk_, Ahmed, Zoey76 */ -public final class Spoil extends AbstractEffect -{ - public Spoil(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class Spoil extends AbstractEffect { + public Spoil(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean calcSuccess(BuffInfo info) - { + public boolean calcSuccess(BuffInfo info) { return Formulas.calcMagicSuccess(info.getEffector(), info.getEffected(), info.getSkill()); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (!info.getEffected().isMonster() || info.getEffected().isDead()) - { + public void onStart(BuffInfo info) { + if (!info.getEffected().isMonster() || info.getEffected().isDead()) { info.getEffector().sendPacket(SystemMessageId.INCORRECT_TARGET); return; } final L2MonsterInstance target = (L2MonsterInstance) info.getEffected(); - if (target.isSpoiled()) - { + if (target.isSpoiled()) { info.getEffector().sendPacket(SystemMessageId.ALREADY_SPOILED); return; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/StaticDamage.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/StaticDamage.java index 60dd4408ae..898a1e6943 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/StaticDamage.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/StaticDamage.java @@ -27,36 +27,30 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Static Damage effect implementation. * @author Adry_85 */ -public final class StaticDamage extends AbstractEffect -{ +public final class StaticDamage extends AbstractEffect { private final int _power; - public StaticDamage(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public StaticDamage(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getInt("power", 0); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (info.getEffector().isAlikeDead()) - { + public void onStart(BuffInfo info) { + if (info.getEffector().isAlikeDead()) { return; } info.getEffected().reduceCurrentHp(_power, info.getEffector(), info.getSkill()); info.getEffected().notifyDamageReceived(_power, info.getEffector(), info.getSkill(), false, false, false); - if (info.getEffector().isPlayer()) - { + if (info.getEffector().isPlayer()) { info.getEffector().sendDamageMessage(info.getEffected(), _power, false, false, false); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/StealAbnormal.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/StealAbnormal.java index 58fbcaab52..162e4c060b 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/StealAbnormal.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/StealAbnormal.java @@ -33,14 +33,12 @@ import com.l2jserver.gameserver.model.stats.Formulas; * Steal Abnormal effect implementation. * @author Adry_85, Zoey76 */ -public final class StealAbnormal extends AbstractEffect -{ +public final class StealAbnormal extends AbstractEffect { private final DispelCategory _slot; private final int _rate; private final int _max; - public StealAbnormal(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public StealAbnormal(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _slot = params.getEnum("slot", DispelCategory.class, DispelCategory.BUFF); @@ -49,30 +47,24 @@ public final class StealAbnormal extends AbstractEffect } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.STEAL_ABNORMAL; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if ((info.getEffected() != null) && info.getEffected().isPlayer() && (info.getEffector() != info.getEffected())) - { + public void onStart(BuffInfo info) { + if ((info.getEffected() != null) && info.getEffected().isPlayer() && (info.getEffector() != info.getEffected())) { final List<BuffInfo> toSteal = Formulas.calcStealEffects(info.getEffector(), info.getEffected(), info.getSkill(), _slot, _rate, _max); - if (toSteal.isEmpty()) - { + if (toSteal.isEmpty()) { return; } - for (BuffInfo infoToSteal : toSteal) - { + for (BuffInfo infoToSteal : toSteal) { // Invert effected and effector. final BuffInfo stolen = new BuffInfo(info.getEffected(), info.getEffector(), infoToSteal.getSkill()); stolen.setAbnormalTime(infoToSteal.getTime()); // Copy the remaining time. diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Summon.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Summon.java index 6ffaa59ec6..a96be58e32 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Summon.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Summon.java @@ -36,20 +36,17 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Summon effect implementation. * @author UnAfraid */ -public final class Summon extends AbstractEffect -{ +public final class Summon extends AbstractEffect { private final int _npcId; private final float _expMultiplier; private final ItemHolder _consumeItem; private final int _lifeTime; private final int _consumeItemInterval; - public Summon(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public Summon(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); - if (params.isEmpty()) - { + if (params.isEmpty()) { throw new IllegalArgumentException("Summon effect without parameters!"); } @@ -61,16 +58,13 @@ public final class Summon extends AbstractEffect } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (!info.getEffected().isPlayer() || info.getEffected().hasSummon()) - { + public void onStart(BuffInfo info) { + if (!info.getEffected().isPlayer() || info.getEffected().hasSummon()) { return; } @@ -87,13 +81,10 @@ public final class Summon extends AbstractEffect summon.setItemConsume(_consumeItem); summon.setItemConsumeInterval(consumeItemInterval); - if (summon.getLevel() >= character().getMaxPetLevel()) - { + if (summon.getLevel() >= character().getMaxPetLevel()) { summon.getStat().setExp(ExperienceData.getInstance().getExpForLevel(character().getMaxPetLevel() - 1)); _log.warning(Summon.class.getSimpleName() + ": (" + summon.getName() + ") NpcID: " + summon.getId() + " has a level above " + character().getMaxPetLevel() + ". Please rectify."); - } - else - { + } else { summon.getStat().setExp(ExperienceData.getInstance().getExpForLevel(summon.getLevel() % character().getMaxPetLevel())); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SummonAgathion.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SummonAgathion.java index 379b3696ac..4a3bb4ad70 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SummonAgathion.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SummonAgathion.java @@ -28,16 +28,13 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Summon Agathion effect implementation. * @author Zoey76 */ -public final class SummonAgathion extends AbstractEffect -{ +public final class SummonAgathion extends AbstractEffect { private final int _npcId; - public SummonAgathion(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public SummonAgathion(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); - if (params.isEmpty()) - { + if (params.isEmpty()) { _log.warning(getClass().getSimpleName() + ": must have parameters."); } @@ -45,16 +42,13 @@ public final class SummonAgathion extends AbstractEffect } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if ((info.getEffected() == null) || !info.getEffected().isPlayer()) - { + public void onStart(BuffInfo info) { + if ((info.getEffected() == null) || !info.getEffected().isPlayer()) { return; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SummonCubic.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SummonCubic.java index a1a00c31e4..6c48520581 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SummonCubic.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SummonCubic.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Summon Cubic effect implementation. * @author Zoey76 */ -public final class SummonCubic extends AbstractEffect -{ +public final class SummonCubic extends AbstractEffect { /** Cubic ID. */ private final int _cubicId; /** Cubic power. */ @@ -45,8 +44,7 @@ public final class SummonCubic extends AbstractEffect /** Cubic activation chance. */ private final int _cubicSkillChance; - public SummonCubic(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public SummonCubic(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _cubicId = params.getInt("cubicId", -1); @@ -59,28 +57,23 @@ public final class SummonCubic extends AbstractEffect } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if ((info.getEffected() == null) || !info.getEffected().isPlayer() || info.getEffected().isAlikeDead() || info.getEffected().getActingPlayer().inObserverMode()) - { + public void onStart(BuffInfo info) { + if ((info.getEffected() == null) || !info.getEffected().isPlayer() || info.getEffected().isAlikeDead() || info.getEffected().getActingPlayer().inObserverMode()) { return; } - if (_cubicId < 0) - { + if (_cubicId < 0) { _log.warning(SummonCubic.class.getSimpleName() + ": Invalid Cubic ID:" + _cubicId + " in skill ID: " + info.getSkill().getId()); return; } final L2PcInstance player = info.getEffected().getActingPlayer(); - if (player.inObserverMode() || player.isMounted()) - { + if (player.inObserverMode() || player.isMounted()) { return; } @@ -90,28 +83,23 @@ public final class SummonCubic extends AbstractEffect // 12 at 130 (+30 Power) // Because 12 is max 5115-5117 skills int _cubicSkillLevel = info.getSkill().getLevel(); - if (_cubicSkillLevel > 100) - { + if (_cubicSkillLevel > 100) { _cubicSkillLevel = ((info.getSkill().getLevel() - 100) / 7) + 8; } // If cubic is already present, it's replaced. final L2CubicInstance cubic = player.getCubicById(_cubicId); - if (cubic != null) - { + if (cubic != null) { cubic.stopAction(); cubic.cancelDisappear(); player.getCubics().remove(_cubicId); - } - else - { + } else { // If maximum amount is reached, random cubic is removed. // Players with no mastery can have only one cubic. final int allowedCubicCount = info.getEffected().getActingPlayer().getStat().getMaxCubicCount(); final int currentCubicCount = player.getCubics().size(); // Extra cubics are removed, one by one, randomly. - for (int i = 0; i <= (currentCubicCount - allowedCubicCount); i++) - { + for (int i = 0; i <= (currentCubicCount - allowedCubicCount); i++) { final int removedCubicId = (int) player.getCubics().keySet().toArray()[Rnd.get(currentCubicCount)]; final L2CubicInstance removedCubic = player.getCubicById(removedCubicId); removedCubic.stopAction(); diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SummonNpc.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SummonNpc.java index 5cce107db3..741120826c 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SummonNpc.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SummonNpc.java @@ -38,16 +38,14 @@ import com.l2jserver.gameserver.model.skills.targets.L2TargetType; * Summon Npc effect implementation. * @author Zoey76 */ -public final class SummonNpc extends AbstractEffect -{ +public final class SummonNpc extends AbstractEffect { private int _despawnDelay; private final int _npcId; private final int _npcCount; private final boolean _randomOffset; private final boolean _isSummonSpawn; - public SummonNpc(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public SummonNpc(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _despawnDelay = params.getInt("despawnDelay", 20000); @@ -58,48 +56,39 @@ public final class SummonNpc extends AbstractEffect } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.SUMMON_NPC; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if ((info.getEffected() == null) || !info.getEffected().isPlayer() || info.getEffected().isAlikeDead() || info.getEffected().getActingPlayer().inObserverMode()) - { + public void onStart(BuffInfo info) { + if ((info.getEffected() == null) || !info.getEffected().isPlayer() || info.getEffected().isAlikeDead() || info.getEffected().getActingPlayer().inObserverMode()) { return; } - if ((_npcId <= 0) || (_npcCount <= 0)) - { + if ((_npcId <= 0) || (_npcCount <= 0)) { _log.warning(SummonNpc.class.getSimpleName() + ": Invalid NPC ID or count skill ID: " + info.getSkill().getId()); return; } final L2PcInstance player = info.getEffected().getActingPlayer(); - if (player.isMounted()) - { + if (player.isMounted()) { return; } final L2NpcTemplate npcTemplate = NpcData.getInstance().getTemplate(_npcId); - if (npcTemplate == null) - { + if (npcTemplate == null) { _log.warning(SummonNpc.class.getSimpleName() + ": Spawn of the nonexisting NPC ID: " + _npcId + ", skill ID:" + info.getSkill().getId()); return; } - switch (npcTemplate.getType()) - { - case "L2Decoy": - { + switch (npcTemplate.getType()) { + case "L2Decoy": { final L2DecoyInstance decoy = new L2DecoyInstance(npcTemplate, player, _despawnDelay); decoy.setCurrentHp(decoy.getMaxHp()); decoy.setCurrentMp(decoy.getMaxMp()); @@ -119,11 +108,9 @@ public final class SummonNpc extends AbstractEffect int y = player.getY(); int z = player.getZ(); - if (info.getSkill().getTargetType() == L2TargetType.GROUND) - { + if (info.getSkill().getTargetType() == L2TargetType.GROUND) { final Location wordPosition = player.getActingPlayer().getCurrentSkillWorldPosition(); - if (wordPosition != null) - { + if (wordPosition != null) { x = wordPosition.getX(); y = wordPosition.getY(); z = wordPosition.getZ(); @@ -134,29 +121,23 @@ public final class SummonNpc extends AbstractEffect effectPoint.setSummoner(player); effectPoint.spawnMe(x, y, z); _despawnDelay = NpcData.getInstance().getTemplate(_npcId).getParameters().getInt("despawn_time") * 1000; - if (_despawnDelay > 0) - { + if (_despawnDelay > 0) { effectPoint.scheduleDespawn(_despawnDelay); } break; } - default: - { + default: { L2Spawn spawn; - try - { + try { spawn = new L2Spawn(_npcId); - } - catch (Exception e) - { + } catch (Exception e) { _log.warning(SummonNpc.class.getSimpleName() + ": " + e.getMessage()); return; } int x = player.getX(); int y = player.getY(); - if (_randomOffset) - { + if (_randomOffset) { x += (Rnd.nextBoolean() ? Rnd.get(20, 50) : Rnd.get(-50, -20)); y += (Rnd.nextBoolean() ? Rnd.get(20, 50) : Rnd.get(-50, -20)); } @@ -171,8 +152,7 @@ public final class SummonNpc extends AbstractEffect npc.setSummoner(player); npc.setName(npcTemplate.getName()); npc.setTitle(npcTemplate.getName()); - if (_despawnDelay > 0) - { + if (_despawnDelay > 0) { npc.scheduleDespawn(_despawnDelay); } npc.setIsRunning(false); // TODO: Fix broadcast info. diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SummonPet.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SummonPet.java index 9280b3ac77..c7f411c12f 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SummonPet.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SummonPet.java @@ -39,52 +39,43 @@ import com.l2jserver.gameserver.network.serverpackets.PetItemList; * Summon Pet effect implementation. * @author UnAfraid */ -public final class SummonPet extends AbstractEffect -{ - public SummonPet(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class SummonPet extends AbstractEffect { + public SummonPet(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if ((info.getEffector() == null) || (info.getEffected() == null) || !info.getEffector().isPlayer() || !info.getEffected().isPlayer() || info.getEffected().isAlikeDead()) - { + public void onStart(BuffInfo info) { + if ((info.getEffector() == null) || (info.getEffected() == null) || !info.getEffector().isPlayer() || !info.getEffected().isPlayer() || info.getEffected().isAlikeDead()) { return; } final L2PcInstance player = info.getEffector().getActingPlayer(); - if ((player.hasSummon() || player.isMounted())) - { + if ((player.hasSummon() || player.isMounted())) { player.sendPacket(SystemMessageId.YOU_ALREADY_HAVE_A_PET); return; } final PetItemHolder holder = player.removeScript(PetItemHolder.class); - if (holder == null) - { + if (holder == null) { _log.log(Level.WARNING, "Summoning pet without attaching PetItemHandler!", new Throwable()); return; } final L2ItemInstance item = holder.getItem(); - if (player.getInventory().getItemByObjectId(item.getObjectId()) != item) - { + if (player.getInventory().getItemByObjectId(item.getObjectId()) != item) { _log.log(Level.WARNING, "Player: " + player + " is trying to summon pet from item that he doesn't owns."); return; } final L2PetData petData = PetDataTable.getInstance().getPetDataByItemId(item.getId()); - if ((petData == null) || (petData.getNpcId() == -1)) - { + if ((petData == null) || (petData.getNpcId() == -1)) { return; } @@ -92,8 +83,7 @@ public final class SummonPet extends AbstractEffect final L2PetInstance pet = L2PetInstance.spawnPet(npcTemplate, player, item); pet.setShowSummonAnimation(true); - if (!pet.isRespawned()) - { + if (!pet.isRespawned()) { pet.setCurrentHp(pet.getMaxHp()); pet.setCurrentMp(pet.getMaxMp()); pet.getStat().setExp(pet.getExpForThisLevel()); @@ -102,8 +92,7 @@ public final class SummonPet extends AbstractEffect pet.setRunning(); - if (!pet.isRespawned()) - { + if (!pet.isRespawned()) { pet.storeMe(); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SummonTrap.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SummonTrap.java index c4ed5ed4d9..6f87777f62 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SummonTrap.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/SummonTrap.java @@ -31,13 +31,11 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Summon Trap effect implementation. * @author Zoey76 */ -public final class SummonTrap extends AbstractEffect -{ +public final class SummonTrap extends AbstractEffect { private final int _despawnTime; private final int _npcId; - public SummonTrap(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public SummonTrap(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _despawnTime = params.getInt("despawnTime", 0); @@ -45,40 +43,33 @@ public final class SummonTrap extends AbstractEffect } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if ((info.getEffected() == null) || !info.getEffected().isPlayer() || info.getEffected().isAlikeDead() || info.getEffected().getActingPlayer().inObserverMode()) - { + public void onStart(BuffInfo info) { + if ((info.getEffected() == null) || !info.getEffected().isPlayer() || info.getEffected().isAlikeDead() || info.getEffected().getActingPlayer().inObserverMode()) { return; } - if (_npcId <= 0) - { + if (_npcId <= 0) { _log.warning(SummonTrap.class.getSimpleName() + ": Invalid NPC ID:" + _npcId + " in skill ID: " + info.getSkill().getId()); return; } final L2PcInstance player = info.getEffected().getActingPlayer(); - if (player.inObserverMode() || player.isMounted()) - { + if (player.inObserverMode() || player.isMounted()) { return; } // Unsummon previous trap - if (player.getTrap() != null) - { + if (player.getTrap() != null) { player.getTrap().unSummon(); } final L2NpcTemplate npcTemplate = NpcData.getInstance().getTemplate(_npcId); - if (npcTemplate == null) - { + if (npcTemplate == null) { _log.warning(SummonTrap.class.getSimpleName() + ": Spawn of the non-existing Trap ID: " + _npcId + " in skill ID:" + info.getSkill().getId()); return; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Sweeper.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Sweeper.java index 21754c079f..bfdd9302f1 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Sweeper.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Sweeper.java @@ -32,50 +32,38 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Sweeper effect implementation. * @author Zoey76 */ -public final class Sweeper extends AbstractEffect -{ - public Sweeper(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class Sweeper extends AbstractEffect { + public Sweeper(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if ((info.getEffector() == null) || (info.getEffected() == null) || !info.getEffector().isPlayer() || !info.getEffected().isAttackable()) - { + public void onStart(BuffInfo info) { + if ((info.getEffector() == null) || (info.getEffected() == null) || !info.getEffector().isPlayer() || !info.getEffected().isAttackable()) { return; } final L2PcInstance player = info.getEffector().getActingPlayer(); final L2Attackable monster = (L2Attackable) info.getEffected(); - if (!monster.checkSpoilOwner(player, false)) - { + if (!monster.checkSpoilOwner(player, false)) { return; } - if (!player.getInventory().checkInventorySlotsAndWeight(monster.getSpoilLootItems(), false, false)) - { + if (!player.getInventory().checkInventorySlotsAndWeight(monster.getSpoilLootItems(), false, false)) { return; } final Collection<ItemHolder> items = monster.takeSweep(); - if (items != null) - { - for (ItemHolder item : items) - { - if (player.isInParty()) - { + if (items != null) { + for (ItemHolder item : items) { + if (player.isInParty()) { player.getParty().distributeItem(player, item, true, monster); - } - else - { + } else { player.addItem("Sweeper", item, info.getEffected(), true); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TakeCastle.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TakeCastle.java index 2811e19a96..60420bedfe 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TakeCastle.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TakeCastle.java @@ -29,24 +29,19 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Take Castle effect implementation. * @author Adry_85 */ -public final class TakeCastle extends AbstractEffect -{ - public TakeCastle(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class TakeCastle extends AbstractEffect { + public TakeCastle(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (!info.getEffector().isPlayer()) - { + public void onStart(BuffInfo info) { + if (!info.getEffector().isPlayer()) { return; } Castle castle = CastleManager.getInstance().getCastle(info.getEffector()); diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TakeFort.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TakeFort.java index dabacb49b3..6ee0da88d6 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TakeFort.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TakeFort.java @@ -29,30 +29,24 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Take Fort effect implementation. * @author Adry_85 */ -public final class TakeFort extends AbstractEffect -{ - public TakeFort(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class TakeFort extends AbstractEffect { + public TakeFort(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (!info.getEffector().isPlayer()) - { + public void onStart(BuffInfo info) { + if (!info.getEffector().isPlayer()) { return; } final Fort fort = FortManager.getInstance().getFort(info.getEffector().getActingPlayer()); - if (fort != null) - { + if (fort != null) { fort.endOfSiege(info.getEffector().getActingPlayer().getClan()); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TakeFortStart.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TakeFortStart.java index 987acb4e89..8276b31be2 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TakeFortStart.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TakeFortStart.java @@ -33,29 +33,23 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Take Fort Start effect implementation. * @author UnAfraid */ -public final class TakeFortStart extends AbstractEffect -{ - public TakeFortStart(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class TakeFortStart extends AbstractEffect { + public TakeFortStart(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (info.getEffector().isPlayer()) - { + public void onStart(BuffInfo info) { + if (info.getEffector().isPlayer()) { final L2PcInstance player = info.getEffector().getActingPlayer(); final Fort fort = FortManager.getInstance().getFort(player); final L2Clan clan = player.getClan(); - if ((fort != null) && (clan != null)) - { + if ((fort != null) && (clan != null)) { fort.getSiege().announceToPlayer(SystemMessage.getSystemMessage(SystemMessageId.S1_TRYING_RAISE_FLAG), clan.getName()); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TakeTerritoryFlag.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TakeTerritoryFlag.java index 9035394c2c..4f3a00f03a 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TakeTerritoryFlag.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TakeTerritoryFlag.java @@ -31,32 +31,26 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Take Territory Flag effect implementation. * @author UnAfraid */ -public final class TakeTerritoryFlag extends AbstractEffect -{ +public final class TakeTerritoryFlag extends AbstractEffect { private static final int FLAG_NPC_ID = 35062; - public TakeTerritoryFlag(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public TakeTerritoryFlag(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2PcInstance player = info.getEffector().getActingPlayer(); - if (!player.isClanLeader()) - { + if (!player.isClanLeader()) { return; } - if (TerritoryWarManager.getInstance().isTWInProgress()) - { + if (TerritoryWarManager.getInstance().isTWInProgress()) { // Spawn a new flag final L2SiegeFlagInstance flag = new L2SiegeFlagInstance(player, NpcData.getInstance().getTemplate(FLAG_NPC_ID), false, false); flag.setTitle(player.getClan().getName()); diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TargetCancel.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TargetCancel.java index 64d48eb564..ac234243d1 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TargetCancel.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TargetCancel.java @@ -29,32 +29,27 @@ import com.l2jserver.gameserver.model.stats.Formulas; * Target Cancel effect implementation. * @author -Nemesiss-, Adry_85 */ -public final class TargetCancel extends AbstractEffect -{ +public final class TargetCancel extends AbstractEffect { private final int _chance; - public TargetCancel(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public TargetCancel(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _chance = params.getInt("chance", 100); } @Override - public boolean calcSuccess(BuffInfo info) - { + public boolean calcSuccess(BuffInfo info) { return Formulas.calcProbability(_chance, info.getEffector(), info.getEffected(), info.getSkill()); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { info.getEffected().setTarget(null); info.getEffected().abortAttack(); info.getEffected().abortCast(); diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TargetMeProbability.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TargetMeProbability.java index 36d8798902..f5dbcc3975 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TargetMeProbability.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TargetMeProbability.java @@ -29,40 +29,32 @@ import com.l2jserver.gameserver.model.stats.Formulas; * Target Me Probability effect implementation. * @author Adry_85 */ -public final class TargetMeProbability extends AbstractEffect -{ +public final class TargetMeProbability extends AbstractEffect { private final int _chance; - public TargetMeProbability(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public TargetMeProbability(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _chance = params.getInt("chance", 100); } @Override - public boolean calcSuccess(BuffInfo info) - { + public boolean calcSuccess(BuffInfo info) { return Formulas.calcProbability(_chance, info.getEffector(), info.getEffected(), info.getSkill()); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (info.getEffected().isPlayable()) - { - if (info.getEffected().getTarget() != info.getEffector()) - { + public void onStart(BuffInfo info) { + if (info.getEffected().isPlayable()) { + if (info.getEffected().getTarget() != info.getEffector()) { L2PcInstance effector = info.getEffector().getActingPlayer(); // If effector is null, then its not a player, but NPC. If its not null, then it should check if the skill is pvp skill. - if ((effector == null) || effector.checkPvpSkill(info.getEffected(), info.getSkill())) - { + if ((effector == null) || effector.checkPvpSkill(info.getEffected(), info.getSkill())) { // Target is different info.getEffected().setTarget(info.getEffector()); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Teleport.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Teleport.java index d06f95606d..24290e351e 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Teleport.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Teleport.java @@ -29,32 +29,27 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Teleport effect implementation. * @author Adry_85 */ -public final class Teleport extends AbstractEffect -{ +public final class Teleport extends AbstractEffect { private final Location _loc; - public Teleport(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public Teleport(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _loc = new Location(params.getInt("x", 0), params.getInt("y", 0), params.getInt("z", 0)); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.TELEPORT; } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { info.getEffected().teleToLocation(_loc, true); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TeleportToTarget.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TeleportToTarget.java index f15e72806b..b02c0fccac 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TeleportToTarget.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TeleportToTarget.java @@ -35,26 +35,21 @@ import com.l2jserver.gameserver.util.Util; * Teleport To Target effect implementation. * @author Didldak, Adry_85 */ -public final class TeleportToTarget extends AbstractEffect -{ - public TeleportToTarget(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class TeleportToTarget extends AbstractEffect { + public TeleportToTarget(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { L2Character activeChar = info.getEffector(); L2Character target = info.getEffected(); - if (target == null) - { + if (target == null) { return; } @@ -63,8 +58,7 @@ public final class TeleportToTarget extends AbstractEffect double ph = Util.convertHeadingToDegree(target.getHeading()); ph += 180; - if (ph > 360) - { + if (ph > 360) { ph -= 360; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TransferHate.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TransferHate.java index 539abcc8d2..c46cfa505f 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TransferHate.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TransferHate.java @@ -31,48 +31,39 @@ import com.l2jserver.gameserver.util.Util; * Transfer Hate effect implementation. * @author Adry_85 */ -public final class TransferHate extends AbstractEffect -{ +public final class TransferHate extends AbstractEffect { private final int _chance; - public TransferHate(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public TransferHate(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _chance = params.getInt("chance", 100); } @Override - public boolean calcSuccess(BuffInfo info) - { + public boolean calcSuccess(BuffInfo info) { return Formulas.calcProbability(_chance, info.getEffector(), info.getEffected(), info.getSkill()); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (!Util.checkIfInRange(info.getSkill().getEffectRange(), info.getEffector(), info.getEffected(), true)) - { + public void onStart(BuffInfo info) { + if (!Util.checkIfInRange(info.getSkill().getEffectRange(), info.getEffector(), info.getEffected(), true)) { return; } - for (L2Character obj : info.getEffector().getKnownList().getKnownCharactersInRadius(info.getSkill().getAffectRange())) - { - if ((obj == null) || !obj.isAttackable() || obj.isDead()) - { + for (L2Character obj : info.getEffector().getKnownList().getKnownCharactersInRadius(info.getSkill().getAffectRange())) { + if ((obj == null) || !obj.isAttackable() || obj.isDead()) { continue; } final L2Attackable hater = ((L2Attackable) obj); final long hate = hater.getHating(info.getEffector()); - if (hate <= 0) - { + if (hate <= 0) { continue; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TrapDetect.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TrapDetect.java index cb2a67b18b..b3c4037b36 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TrapDetect.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TrapDetect.java @@ -28,16 +28,13 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Trap Detect effect implementation. * @author UnAfraid */ -public final class TrapDetect extends AbstractEffect -{ +public final class TrapDetect extends AbstractEffect { private final int _power; - public TrapDetect(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public TrapDetect(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); - if (params.isEmpty()) - { + if (params.isEmpty()) { throw new IllegalArgumentException(getClass().getSimpleName() + ": effect without power!"); } @@ -45,22 +42,18 @@ public final class TrapDetect extends AbstractEffect } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if (!info.getEffected().isTrap() || info.getEffected().isAlikeDead()) - { + public void onStart(BuffInfo info) { + if (!info.getEffected().isTrap() || info.getEffected().isAlikeDead()) { return; } final L2TrapInstance trap = (L2TrapInstance) info.getEffected(); - if (trap.getLevel() <= _power) - { + if (trap.getLevel() <= _power) { trap.setDetected(info.getEffector()); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TrapRemove.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TrapRemove.java index 6f760a98bb..adaf9da62b 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TrapRemove.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/TrapRemove.java @@ -33,16 +33,13 @@ import com.l2jserver.gameserver.network.SystemMessageId; * Trap Remove effect implementation. * @author UnAfraid */ -public final class TrapRemove extends AbstractEffect -{ +public final class TrapRemove extends AbstractEffect { private final int _power; - public TrapRemove(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public TrapRemove(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); - if (params.isEmpty()) - { + if (params.isEmpty()) { throw new IllegalArgumentException(getClass().getSimpleName() + ": effect without power!"); } @@ -50,37 +47,30 @@ public final class TrapRemove extends AbstractEffect } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2Character target = info.getEffected(); - if (!target.isTrap()) - { + if (!target.isTrap()) { return; } - if (target.isAlikeDead()) - { + if (target.isAlikeDead()) { return; } final L2TrapInstance trap = (L2TrapInstance) target; - if (!trap.canBeSeen(info.getEffector())) - { - if (info.getEffector().isPlayer()) - { + if (!trap.canBeSeen(info.getEffector())) { + if (info.getEffector().isPlayer()) { info.getEffector().sendPacket(SystemMessageId.INCORRECT_TARGET); } return; } - if (trap.getLevel() > _power) - { + if (trap.getLevel() > _power) { return; } @@ -88,8 +78,7 @@ public final class TrapRemove extends AbstractEffect EventDispatcher.getInstance().notifyEventAsync(new OnTrapAction(trap, info.getEffector(), TrapAction.TRAP_DISARMED), trap); trap.unSummon(); - if (info.getEffector().isPlayer()) - { + if (info.getEffector().isPlayer()) { info.getEffector().sendPacket(SystemMessageId.A_TRAP_DEVICE_HAS_BEEN_STOPPED); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Unsummon.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Unsummon.java index c1530a6ed2..0fcb22a073 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Unsummon.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/Unsummon.java @@ -32,26 +32,21 @@ import com.l2jserver.gameserver.network.SystemMessageId; * Unsummon effect implementation. * @author Adry_85 */ -public final class Unsummon extends AbstractEffect -{ +public final class Unsummon extends AbstractEffect { private final int _chance; - public Unsummon(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public Unsummon(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _chance = params.getInt("chance", 100); } @Override - public boolean calcSuccess(BuffInfo info) - { + public boolean calcSuccess(BuffInfo info) { int magicLevel = info.getSkill().getMagicLevel(); - if ((magicLevel <= 0) || ((info.getEffected().getLevel() - 9) <= magicLevel)) - { + if ((magicLevel <= 0) || ((info.getEffected().getLevel() - 9) <= magicLevel)) { double chance = _chance * Formulas.calcAttributeBonus(info.getEffector(), info.getEffected(), info.getSkill()) * Formulas.calcGeneralTraitBonus(info.getEffector(), info.getEffected(), info.getSkill().getTraitType(), false); - if (chance > (Rnd.nextDouble() * 100)) - { + if (chance > (Rnd.nextDouble() * 100)) { return true; } } @@ -59,17 +54,14 @@ public final class Unsummon extends AbstractEffect } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2Summon summon = info.getEffected().getSummon(); - if (summon != null) - { + if (summon != null) { final L2PcInstance summonOwner = summon.getOwner(); summon.abortAttack(); diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/UnsummonAgathion.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/UnsummonAgathion.java index 619c07601a..2b3a707419 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/UnsummonAgathion.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/UnsummonAgathion.java @@ -28,25 +28,20 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Unsummon Agathion effect implementation. * @author Zoey76 */ -public final class UnsummonAgathion extends AbstractEffect -{ - public UnsummonAgathion(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class UnsummonAgathion extends AbstractEffect { + public UnsummonAgathion(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2PcInstance player = info.getEffector().getActingPlayer(); - if (player != null) - { + if (player != null) { player.setAgathionId(0); player.broadcastUserInfo(); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/VitalityPointUp.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/VitalityPointUp.java index 812d9ec314..fb44dcc0a6 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/VitalityPointUp.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/VitalityPointUp.java @@ -28,28 +28,23 @@ import com.l2jserver.gameserver.network.serverpackets.UserInfo; * Vitality Point Up effect implementation. * @author Adry_85 */ -public final class VitalityPointUp extends AbstractEffect -{ +public final class VitalityPointUp extends AbstractEffect { private final float _value; - public VitalityPointUp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public VitalityPointUp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _value = params.getFloat("value", 0); } @Override - public boolean isInstant() - { + public boolean isInstant() { return true; } @Override - public void onStart(BuffInfo info) - { - if ((info.getEffected() != null) && info.getEffected().isPlayer()) - { + public void onStart(BuffInfo info) { + if ((info.getEffected() != null) && info.getEffected().isPlayer()) { info.getEffected().getActingPlayer().updateVitalityPoints(_value, false, false); info.getEffected().getActingPlayer().sendPacket(new UserInfo(info.getEffected().getActingPlayer())); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/AttackTrait.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/AttackTrait.java index 906b3c0950..32fa18e092 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/AttackTrait.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/AttackTrait.java @@ -33,34 +33,27 @@ import com.l2jserver.gameserver.model.stats.TraitType; * Attack Trait effect implementation. * @author NosBit */ -public final class AttackTrait extends AbstractEffect -{ +public final class AttackTrait extends AbstractEffect { private final Map<TraitType, Float> _attackTraits = new HashMap<>(); - public AttackTrait(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public AttackTrait(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); - if (params.isEmpty()) - { + if (params.isEmpty()) { _log.warning(getClass().getSimpleName() + ": this effect must have parameters!"); return; } - for (Entry<String, Object> param : params.getSet().entrySet()) - { + for (Entry<String, Object> param : params.getSet().entrySet()) { _attackTraits.put(TraitType.valueOf(param.getKey()), (Float.parseFloat((String) param.getValue()) + 100) / 100); } } @Override - public void onExit(BuffInfo info) - { + public void onExit(BuffInfo info) { final CharStat charStat = info.getEffected().getStat(); - synchronized (charStat.getAttackTraits()) - { - for (Entry<TraitType, Float> trait : _attackTraits.entrySet()) - { + synchronized (charStat.getAttackTraits()) { + for (Entry<TraitType, Float> trait : _attackTraits.entrySet()) { charStat.getAttackTraits()[trait.getKey().getId()] /= trait.getValue(); charStat.getAttackTraitsCount()[trait.getKey().getId()]--; } @@ -68,13 +61,10 @@ public final class AttackTrait extends AbstractEffect } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final CharStat charStat = info.getEffected().getStat(); - synchronized (charStat.getAttackTraits()) - { - for (Entry<TraitType, Float> trait : _attackTraits.entrySet()) - { + synchronized (charStat.getAttackTraits()) { + for (Entry<TraitType, Float> trait : _attackTraits.entrySet()) { charStat.getAttackTraits()[trait.getKey().getId()] *= trait.getValue(); charStat.getAttackTraitsCount()[trait.getKey().getId()]++; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Betray.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Betray.java index 9e0779e6c3..50c528767e 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Betray.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Betray.java @@ -30,40 +30,33 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Betray effect implementation. * @author decad */ -public final class Betray extends AbstractEffect -{ - public Betray(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class Betray extends AbstractEffect { + public Betray(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean canStart(BuffInfo info) - { + public boolean canStart(BuffInfo info) { return info.getEffector().isPlayer() && info.getEffected().isSummon(); } @Override - public int getEffectFlags() - { + public int getEffectFlags() { return EffectFlag.BETRAYED.getMask(); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.DEBUFF; } @Override - public void onExit(BuffInfo info) - { + public void onExit(BuffInfo info) { info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, info.getEffected().getActingPlayer()); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockBuff.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockBuff.java index 23edab201f..a8d971375c 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockBuff.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockBuff.java @@ -26,16 +26,13 @@ import com.l2jserver.gameserver.model.effects.EffectFlag; /** * @author Zealar */ -public final class BlockBuff extends AbstractEffect -{ - public BlockBuff(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class BlockBuff extends AbstractEffect { + public BlockBuff(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public int getEffectFlags() - { + public int getEffectFlags() { return EffectFlag.BLOCK_BUFF.getMask(); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockBuffSlot.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockBuffSlot.java index 752d39eff7..b1142969b9 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockBuffSlot.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockBuffSlot.java @@ -32,38 +32,30 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Block Buff Slot effect implementation. * @author Zoey76 */ -public final class BlockBuffSlot extends AbstractEffect -{ +public final class BlockBuffSlot extends AbstractEffect { private final Set<AbnormalType> _blockBuffSlots; - public BlockBuffSlot(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public BlockBuffSlot(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); String blockBuffSlots = params.getString("slot", null); - if ((blockBuffSlots != null) && !blockBuffSlots.isEmpty()) - { + if ((blockBuffSlots != null) && !blockBuffSlots.isEmpty()) { _blockBuffSlots = new HashSet<>(); - for (String slot : blockBuffSlots.split(";")) - { + for (String slot : blockBuffSlots.split(";")) { _blockBuffSlots.add(AbnormalType.valueOf(slot)); } - } - else - { + } else { _blockBuffSlots = Collections.<AbnormalType> emptySet(); } } @Override - public void onExit(BuffInfo info) - { + public void onExit(BuffInfo info) { info.getEffected().getEffectList().removeBlockedBuffSlots(_blockBuffSlots); } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { info.getEffected().getEffectList().addBlockedBuffSlots(_blockBuffSlots); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockChat.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockChat.java index 5884a6e2be..3ac5487da1 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockChat.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockChat.java @@ -32,34 +32,28 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Block Chat effect implementation. * @author BiggBoss */ -public final class BlockChat extends AbstractEffect -{ - public BlockChat(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class BlockChat extends AbstractEffect { + public BlockChat(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean canStart(BuffInfo info) - { + public boolean canStart(BuffInfo info) { return (info.getEffected() != null) && info.getEffected().isPlayer(); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.CHAT_BLOCK; } @Override - public void onExit(BuffInfo info) - { + public void onExit(BuffInfo info) { PunishmentManager.getInstance().stopPunishment(info.getEffected().getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN); } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { PunishmentManager.getInstance().startPunishment(new PunishmentTask(0, info.getEffected().getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN, 0, "Chat banned bot report", "system", true)); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockDamage.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockDamage.java index 0b0babc191..9558fa0c33 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockDamage.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockDamage.java @@ -26,25 +26,21 @@ import com.l2jserver.gameserver.model.effects.EffectFlag; /** * @author Zealar */ -public final class BlockDamage extends AbstractEffect -{ - public enum BlockType - { +public final class BlockDamage extends AbstractEffect { + public enum BlockType { HP, MP } private final BlockType _type; - public BlockDamage(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + 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() - { + public int getEffectFlags() { return _type == BlockType.HP ? EffectFlag.BLOCK_HP.getMask() : EffectFlag.BLOCK_MP.getMask(); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockDebuff.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockDebuff.java index 31b808ff3c..204a98cee2 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockDebuff.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockDebuff.java @@ -26,16 +26,13 @@ import com.l2jserver.gameserver.model.effects.EffectFlag; /** * @author Zealar */ -public final class BlockDebuff extends AbstractEffect -{ - public BlockDebuff(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +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() - { + public int getEffectFlags() { return EffectFlag.BLOCK_DEBUFF.getMask(); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockParty.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockParty.java index 8fb2212799..614547b929 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockParty.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockParty.java @@ -31,28 +31,23 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Block Party effect implementation. * @author BiggBoss */ -public final class BlockParty extends AbstractEffect -{ - public BlockParty(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class BlockParty extends AbstractEffect { + public BlockParty(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean canStart(BuffInfo info) - { + public boolean canStart(BuffInfo info) { return (info.getEffected() != null) && info.getEffected().isPlayer(); } @Override - public void onExit(BuffInfo info) - { + public void onExit(BuffInfo info) { PunishmentManager.getInstance().stopPunishment(info.getEffected().getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.PARTY_BAN); } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { PunishmentManager.getInstance().startPunishment(new PunishmentTask(0, info.getEffected().getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.PARTY_BAN, 0, "Party banned by bot report", "system", true)); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockResurrection.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockResurrection.java index 93d2a00a25..5b88dfe5f8 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockResurrection.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BlockResurrection.java @@ -27,16 +27,13 @@ import com.l2jserver.gameserver.model.effects.EffectFlag; * Block Resurrection effect implementation. * @author UnAfraid */ -public final class BlockResurrection extends AbstractEffect -{ - public BlockResurrection(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class BlockResurrection extends AbstractEffect { + public BlockResurrection(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public int getEffectFlags() - { + public int getEffectFlags() { return EffectFlag.BLOCK_RESURRECTION.getMask(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/ChangeFishingMastery.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/ChangeFishingMastery.java index 92c4d8f50d..5ec9da3591 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/ChangeFishingMastery.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/ChangeFishingMastery.java @@ -26,10 +26,8 @@ import com.l2jserver.gameserver.model.effects.AbstractEffect; * Change Fishing Mastery dummy effect implementation. * @author Zoey76 */ -public final class ChangeFishingMastery extends AbstractEffect -{ - public ChangeFishingMastery(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class ChangeFishingMastery extends AbstractEffect { + public ChangeFishingMastery(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/CrystalGradeModify.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/CrystalGradeModify.java index 4f29d05de4..dff7063043 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/CrystalGradeModify.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/CrystalGradeModify.java @@ -28,40 +28,33 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Crystal Grade Modify effect implementation. * @author Zoey76 */ -public final class CrystalGradeModify extends AbstractEffect -{ +public final class CrystalGradeModify extends AbstractEffect { private final int _grade; - public CrystalGradeModify(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public CrystalGradeModify(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _grade = params.getInt("grade", 0); } @Override - public boolean canStart(BuffInfo info) - { + public boolean canStart(BuffInfo info) { return info.getEffected().isPlayer(); } @Override - public void onExit(BuffInfo info) - { + public void onExit(BuffInfo info) { final L2PcInstance player = info.getEffected().getActingPlayer(); - if (player != null) - { + if (player != null) { player.setExpertisePenaltyBonus(0); player.refreshExpertisePenalty(); } } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2PcInstance player = info.getEffected().getActingPlayer(); - if (player != null) - { + if (player != null) { player.setExpertisePenaltyBonus(_grade); player.refreshExpertisePenalty(); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/CubicMastery.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/CubicMastery.java index e8b4d240cb..98024a977a 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/CubicMastery.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/CubicMastery.java @@ -27,38 +27,32 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Cubic Mastery effect implementation. * @author Zoey76 */ -public final class CubicMastery extends AbstractEffect -{ +public final class CubicMastery extends AbstractEffect { private final int _cubicCount; - public CubicMastery(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public CubicMastery(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _cubicCount = params.getInt("cubicCount", 1); } @Override - public boolean canStart(BuffInfo info) - { + public boolean canStart(BuffInfo info) { return (info.getEffector() != null) && (info.getEffected() != null) && info.getEffected().isPlayer(); } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { info.getEffected().getActingPlayer().getStat().setMaxCubicCount(_cubicCount); } @Override - public boolean onActionTime(BuffInfo info) - { + public boolean onActionTime(BuffInfo info) { return info.getSkill().isPassive(); } @Override - public void onExit(BuffInfo info) - { + public void onExit(BuffInfo info) { info.getEffected().getActingPlayer().getStat().setMaxCubicCount(1); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/DefenceTrait.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/DefenceTrait.java index bdaff70fd6..87d0962512 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/DefenceTrait.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/DefenceTrait.java @@ -33,58 +33,42 @@ import com.l2jserver.gameserver.model.stats.TraitType; * Defence Trait effect implementation. * @author NosBit */ -public final class DefenceTrait extends AbstractEffect -{ +public final class DefenceTrait extends AbstractEffect { private final Map<TraitType, Float> _defenceTraits = new HashMap<>(); - public DefenceTrait(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public DefenceTrait(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); - if (params.isEmpty()) - { + if (params.isEmpty()) { _log.warning(getClass().getSimpleName() + ": must have parameters."); return; } - for (Entry<String, Object> param : params.getSet().entrySet()) - { - try - { + for (Entry<String, Object> param : params.getSet().entrySet()) { + try { final TraitType traitType = TraitType.valueOf(param.getKey()); final float value = Float.parseFloat((String) param.getValue()); - if (value == 0) - { + if (value == 0) { continue; } _defenceTraits.put(traitType, (value + 100) / 100); - } - catch (NumberFormatException e) - { + } catch (NumberFormatException e) { _log.warning(getClass().getSimpleName() + ": value of " + param.getKey() + " must be float value " + param.getValue() + " found."); - } - catch (Exception e) - { + } catch (Exception e) { _log.warning(getClass().getSimpleName() + ": value of L2TraitType enum required but found: " + param.getValue()); } } } @Override - public void onExit(BuffInfo info) - { + public void onExit(BuffInfo info) { final CharStat charStat = info.getEffected().getStat(); - synchronized (charStat.getDefenceTraits()) - { - for (Entry<TraitType, Float> trait : _defenceTraits.entrySet()) - { - if (trait.getValue() < 2.0f) - { + synchronized (charStat.getDefenceTraits()) { + for (Entry<TraitType, Float> trait : _defenceTraits.entrySet()) { + if (trait.getValue() < 2.0f) { charStat.getDefenceTraits()[trait.getKey().getId()] /= trait.getValue(); charStat.getDefenceTraitsCount()[trait.getKey().getId()]--; - } - else - { + } else { charStat.getTraitsInvul()[trait.getKey().getId()]--; } } @@ -92,20 +76,14 @@ public final class DefenceTrait extends AbstractEffect } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final CharStat charStat = info.getEffected().getStat(); - synchronized (charStat.getDefenceTraits()) - { - for (Entry<TraitType, Float> trait : _defenceTraits.entrySet()) - { - if (trait.getValue() < 2.0f) - { + synchronized (charStat.getDefenceTraits()) { + for (Entry<TraitType, Float> trait : _defenceTraits.entrySet()) { + if (trait.getValue() < 2.0f) { charStat.getDefenceTraits()[trait.getKey().getId()] *= trait.getValue(); charStat.getDefenceTraitsCount()[trait.getKey().getId()]++; - } - else - { + } else { charStat.getTraitsInvul()[trait.getKey().getId()]++; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Disarm.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Disarm.java index 3f5f8207a3..95bbda2adb 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Disarm.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Disarm.java @@ -28,28 +28,23 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Disarm effect implementation. * @author nBd */ -public final class Disarm extends AbstractEffect -{ - public Disarm(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class Disarm extends AbstractEffect { + public Disarm(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean canStart(BuffInfo info) - { + public boolean canStart(BuffInfo info) { return info.getEffected().isPlayer(); } @Override - public int getEffectFlags() - { + public int getEffectFlags() { return EffectFlag.DISARMED.getMask(); } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { info.getEffected().getActingPlayer().disarmWeapons(); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/EnableCloak.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/EnableCloak.java index 758ea24463..e7af226b3b 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/EnableCloak.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/EnableCloak.java @@ -27,34 +27,28 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Enable Cloak effect implementation. * @author Adry_85 */ -public final class EnableCloak extends AbstractEffect -{ - public EnableCloak(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class EnableCloak extends AbstractEffect { + public EnableCloak(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean canStart(BuffInfo info) - { + public boolean canStart(BuffInfo info) { return (info.getEffector() != null) && (info.getEffected() != null) && info.getEffected().isPlayer(); } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { info.getEffected().getActingPlayer().getStat().setCloakSlotStatus(true); } @Override - public boolean onActionTime(BuffInfo info) - { + public boolean onActionTime(BuffInfo info) { return info.getSkill().isPassive(); } @Override - public void onExit(BuffInfo info) - { + public void onExit(BuffInfo info) { info.getEffected().getActingPlayer().getStat().setCloakSlotStatus(false); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Fear.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Fear.java index ce1db3c756..aa480245b8 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Fear.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Fear.java @@ -34,52 +34,42 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Fear effect implementation. * @author littlecrow */ -public final class Fear extends AbstractEffect -{ - public Fear(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class Fear extends AbstractEffect { + public Fear(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean canStart(BuffInfo info) - { - return info.getEffected().isPlayer() || info.getEffected().isSummon() - || (info.getEffected().isAttackable() && // - !((info.getEffected() instanceof L2DefenderInstance) || (info.getEffected() instanceof L2FortCommanderInstance) || // - (info.getEffected() instanceof L2SiegeFlagInstance) || (info.getEffected().getTemplate().getRace() == Race.SIEGE_WEAPON))); + public boolean canStart(BuffInfo info) { + return info.getEffected().isPlayer() || info.getEffected().isSummon() || (info.getEffected().isAttackable() && // + !((info.getEffected() instanceof L2DefenderInstance) || (info.getEffected() instanceof L2FortCommanderInstance) || // + (info.getEffected() instanceof L2SiegeFlagInstance) || (info.getEffected().getTemplate().getRace() == Race.SIEGE_WEAPON))); } @Override - public int getEffectFlags() - { + public int getEffectFlags() { return EffectFlag.FEAR.getMask(); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.FEAR; } @Override - public int getTicks() - { + public int getTicks() { return 5; } @Override - public boolean onActionTime(BuffInfo info) - { + public boolean onActionTime(BuffInfo info) { info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_AFRAID, info.getEffector(), false); return false; } @Override - public void onStart(BuffInfo info) - { - if (info.getEffected().isCastingNow() && info.getEffected().canAbortCast()) - { + public void onStart(BuffInfo info) { + if (info.getEffected().isCastingNow() && info.getEffected().canAbortCast()) { info.getEffected().abortCast(); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Hide.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Hide.java index 11b158dde4..d519614d92 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Hide.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Hide.java @@ -30,43 +30,33 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Hide effect implementation. * @author ZaKaX, nBd */ -public final class Hide extends AbstractEffect -{ - public Hide(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class Hide extends AbstractEffect { + public Hide(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public void onExit(BuffInfo info) - { - if (info.getEffected().isPlayer()) - { + public void onExit(BuffInfo info) { + if (info.getEffected().isPlayer()) { L2PcInstance activeChar = info.getEffected().getActingPlayer(); - if (!activeChar.inObserverMode()) - { + if (!activeChar.inObserverMode()) { activeChar.setInvisible(false); } } } @Override - public void onStart(BuffInfo info) - { - if (info.getEffected().isPlayer()) - { + public void onStart(BuffInfo info) { + if (info.getEffected().isPlayer()) { L2PcInstance activeChar = info.getEffected().getActingPlayer(); activeChar.setInvisible(true); - if ((activeChar.getAI().getNextIntention() != null) && (activeChar.getAI().getNextIntention().getCtrlIntention() == CtrlIntention.AI_INTENTION_ATTACK)) - { + if ((activeChar.getAI().getNextIntention() != null) && (activeChar.getAI().getNextIntention().getCtrlIntention() == CtrlIntention.AI_INTENTION_ATTACK)) { activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); } - for (L2Character target : activeChar.getKnownList().getKnownCharacters()) - { - if ((target != null) && (target.getTarget() == activeChar)) - { + for (L2Character target : activeChar.getKnownList().getKnownCharacters()) { + if ((target != null) && (target.getTarget() == activeChar)) { target.setTarget(null); target.abortAttack(); target.abortCast(); diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Lucky.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Lucky.java index 1572da0516..e1a6dc028d 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Lucky.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Lucky.java @@ -27,22 +27,18 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Lucky effect implementation. * @author Zoey76 */ -public final class Lucky extends AbstractEffect -{ - public Lucky(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class Lucky extends AbstractEffect { + public Lucky(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean canStart(BuffInfo info) - { + public boolean canStart(BuffInfo info) { return (info.getEffector() != null) && (info.getEffected() != null) && info.getEffected().isPlayer(); } @Override - public boolean onActionTime(BuffInfo info) - { + public boolean onActionTime(BuffInfo info) { return info.getSkill().isPassive(); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/MaxCp.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/MaxCp.java index 95150a71c3..32a3d377cf 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/MaxCp.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/MaxCp.java @@ -34,64 +34,51 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; /** * @author Zealar */ -public final class MaxCp extends AbstractEffect -{ +public final class MaxCp extends AbstractEffect { private final double _power; private final EffectCalculationType _type; private final boolean _heal; - public MaxCp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public MaxCp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _type = params.getEnum("type", EffectCalculationType.class, EffectCalculationType.DIFF); - switch (_type) - { - case DIFF: - { + switch (_type) { + case DIFF: { _power = params.getDouble("power", 0); break; } - default: - { + default: { _power = 1 + (params.getDouble("power", 0) / 100.0); } } _heal = params.getBoolean("heal", false); - if (params.isEmpty()) - { + if (params.isEmpty()) { _log.warning(getClass().getSimpleName() + ": must have parameters."); } } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2Character effected = info.getEffected(); final CharStat charStat = effected.getStat(); final double currentCp = effected.getCurrentCp(); double amount = _power; - synchronized (charStat) - { - switch (_type) - { - case DIFF: - { + synchronized (charStat) { + switch (_type) { + case DIFF: { charStat.getActiveChar().addStatFunc(new FuncAdd(Stats.MAX_CP, 1, this, _power, null)); - if (_heal) - { + if (_heal) { effected.setCurrentCp((currentCp + _power)); } break; } - case PER: - { + case PER: { final double maxCp = effected.getMaxCp(); charStat.getActiveChar().addStatFunc(new FuncMul(Stats.MAX_CP, 1, this, _power, null)); - if (_heal) - { + if (_heal) { amount = (_power - 1) * maxCp; effected.setCurrentCp(currentCp + amount); } @@ -99,18 +86,15 @@ public final class MaxCp extends AbstractEffect } } } - if (_heal) - { + if (_heal) { effected.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.S1_CP_HAS_BEEN_RESTORED).addInt((int) amount)); } } @Override - public void onExit(BuffInfo info) - { + public void onExit(BuffInfo info) { final CharStat charStat = info.getEffected().getStat(); - synchronized (charStat) - { + synchronized (charStat) { charStat.getActiveChar().removeStatsOwner(this); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/MaxHp.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/MaxHp.java index db22ff59e1..41914dd231 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/MaxHp.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/MaxHp.java @@ -34,65 +34,52 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; /** * @author Zealar */ -public final class MaxHp extends AbstractEffect -{ +public final class MaxHp extends AbstractEffect { private final double _power; private final EffectCalculationType _type; private final boolean _heal; - public MaxHp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public MaxHp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _type = params.getEnum("type", EffectCalculationType.class, EffectCalculationType.DIFF); - switch (_type) - { - case DIFF: - { + switch (_type) { + case DIFF: { _power = params.getDouble("power", 0); break; } - default: - { + default: { _power = 1 + (params.getDouble("power", 0) / 100.0); } } _heal = params.getBoolean("heal", false); - if (params.isEmpty()) - { + if (params.isEmpty()) { _log.warning(getClass().getSimpleName() + ": must have parameters."); } } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2Character effected = info.getEffected(); final CharStat charStat = effected.getStat(); final double currentHp = effected.getCurrentHp(); double amount = _power; - synchronized (charStat) - { - switch (_type) - { - case DIFF: - { + synchronized (charStat) { + switch (_type) { + case DIFF: { charStat.getActiveChar().addStatFunc(new FuncAdd(Stats.MAX_HP, 1, this, _power, null)); - if (_heal) - { + if (_heal) { effected.setCurrentHp((currentHp + _power)); } break; } - case PER: - { + case PER: { final double maxHp = effected.getMaxHp(); charStat.getActiveChar().addStatFunc(new FuncMul(Stats.MAX_HP, 1, this, _power, null)); - if (_heal) - { + if (_heal) { amount = (_power - 1) * maxHp; effected.setCurrentHp(currentHp + amount); } @@ -100,18 +87,15 @@ public final class MaxHp extends AbstractEffect } } } - if (_heal) - { + if (_heal) { effected.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.S1_HP_HAS_BEEN_RESTORED).addInt((int) amount)); } } @Override - public void onExit(BuffInfo info) - { + public void onExit(BuffInfo info) { final CharStat charStat = info.getEffected().getStat(); - synchronized (charStat) - { + synchronized (charStat) { charStat.getActiveChar().removeStatsOwner(this); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/MaxMp.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/MaxMp.java index a425defaa3..6969ba913d 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/MaxMp.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/MaxMp.java @@ -36,64 +36,51 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * @author Adry_85 * @since 2.6.0.0 */ -public final class MaxMp extends AbstractEffect -{ +public final class MaxMp extends AbstractEffect { private final double _power; private final EffectCalculationType _type; private final boolean _heal; - public MaxMp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public MaxMp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _type = params.getEnum("type", EffectCalculationType.class, EffectCalculationType.DIFF); - switch (_type) - { - case DIFF: - { + switch (_type) { + case DIFF: { _power = params.getDouble("power", 0); break; } - default: - { + default: { _power = 1 + (params.getDouble("power", 0) / 100.0); } } _heal = params.getBoolean("heal", false); - if (params.isEmpty()) - { + if (params.isEmpty()) { _log.warning(getClass().getSimpleName() + ": must have parameters."); } } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2Character effected = info.getEffected(); final CharStat charStat = effected.getStat(); final double currentMp = effected.getCurrentMp(); double amount = _power; - synchronized (charStat) - { - switch (_type) - { - case DIFF: - { + synchronized (charStat) { + switch (_type) { + case DIFF: { charStat.getActiveChar().addStatFunc(new FuncAdd(Stats.MAX_MP, 1, this, _power, null)); - if (_heal) - { + if (_heal) { effected.setCurrentMp((currentMp + _power)); } break; } - case PER: - { + case PER: { final double maxMp = effected.getMaxMp(); charStat.getActiveChar().addStatFunc(new FuncMul(Stats.MAX_MP, 1, this, _power, null)); - if (_heal) - { + if (_heal) { amount = (_power - 1) * maxMp; effected.setCurrentMp(currentMp + amount); } @@ -101,18 +88,15 @@ public final class MaxMp extends AbstractEffect } } } - if (_heal) - { + if (_heal) { effected.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.S1_MP_HAS_BEEN_RESTORED).addInt((int) amount)); } } @Override - public void onExit(BuffInfo info) - { + public void onExit(BuffInfo info) { final CharStat charStat = info.getEffected().getStat(); - synchronized (charStat) - { + synchronized (charStat) { charStat.getActiveChar().removeStatsOwner(this); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/NoblesseBless.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/NoblesseBless.java index eaeb79124f..6041dd2264 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/NoblesseBless.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/NoblesseBless.java @@ -29,28 +29,23 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Noblesse Blessing effect implementation. * @author earendil */ -public final class NoblesseBless extends AbstractEffect -{ - public NoblesseBless(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class NoblesseBless extends AbstractEffect { + public NoblesseBless(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean canStart(BuffInfo info) - { + public boolean canStart(BuffInfo info) { return (info.getEffector() != null) && (info.getEffected() != null) && info.getEffected().isPlayable(); } @Override - public int getEffectFlags() - { + public int getEffectFlags() { return EffectFlag.NOBLESS_BLESSING.getMask(); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.NOBLESSE_BLESSING; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Passive.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Passive.java index 55b5a964cd..1bdf6fb806 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Passive.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Passive.java @@ -28,29 +28,24 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Passive effect implementation. * @author Adry_85 */ -public final class Passive extends AbstractEffect -{ - public Passive(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class Passive extends AbstractEffect { + public Passive(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public void onExit(BuffInfo info) - { + public void onExit(BuffInfo info) { info.getEffected().enableAllSkills(); info.getEffected().setIsImmobilized(false); } @Override - public boolean canStart(BuffInfo info) - { + public boolean canStart(BuffInfo info) { return info.getEffected().isAttackable(); } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { L2Attackable target = (L2Attackable) info.getEffected(); target.abortAttack(); target.abortCast(); diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/PhysicalAttackMute.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/PhysicalAttackMute.java index b8ba60b8fd..1b3260a9aa 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/PhysicalAttackMute.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/PhysicalAttackMute.java @@ -28,22 +28,18 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Physical Attack Mute effect implementation. * @author -Rnn- */ -public final class PhysicalAttackMute extends AbstractEffect -{ - public PhysicalAttackMute(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class PhysicalAttackMute extends AbstractEffect { + public PhysicalAttackMute(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public int getEffectFlags() - { + public int getEffectFlags() { return EffectFlag.PSYCHICAL_ATTACK_MUTED.getMask(); } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { info.getEffected().startPhysicalAttackMuted(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/PhysicalMute.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/PhysicalMute.java index d2a169648f..e40f525bc7 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/PhysicalMute.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/PhysicalMute.java @@ -29,22 +29,18 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Physical Mute effect implementation. * @author -Nemesiss- */ -public final class PhysicalMute extends AbstractEffect -{ - public PhysicalMute(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class PhysicalMute extends AbstractEffect { + public PhysicalMute(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public int getEffectFlags() - { + public int getEffectFlags() { return EffectFlag.PSYCHICAL_MUTED.getMask(); } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_MUTED); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/ProtectionBlessing.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/ProtectionBlessing.java index 7af50e9fd8..5de36b627d 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/ProtectionBlessing.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/ProtectionBlessing.java @@ -28,22 +28,18 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Protection Blessing effect implementation. * @author kerberos_20 */ -public final class ProtectionBlessing extends AbstractEffect -{ - public ProtectionBlessing(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class ProtectionBlessing extends AbstractEffect { + public ProtectionBlessing(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public boolean canStart(BuffInfo info) - { + public boolean canStart(BuffInfo info) { return (info.getEffector() != null) && (info.getEffected() != null) && info.getEffected().isPlayer(); } @Override - public int getEffectFlags() - { + public int getEffectFlags() { return EffectFlag.PROTECTION_BLESSING.getMask(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/ResistSkill.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/ResistSkill.java index 048d750d08..427ea6c14b 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/ResistSkill.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/ResistSkill.java @@ -33,56 +33,46 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Resist Skill effect implementaion. * @author UnAfraid */ -public final class ResistSkill extends AbstractEffect -{ +public final class ResistSkill extends AbstractEffect { private final List<SkillHolder> _skills = new ArrayList<>(); - public ResistSkill(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public ResistSkill(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); - for (int i = 1;; i++) - { + for (int i = 1;; i++) { int skillId = params.getInt("skillId" + i, 0); int skillLvl = params.getInt("skillLvl" + i, 0); - if (skillId == 0) - { + if (skillId == 0) { break; } _skills.add(new SkillHolder(skillId, skillLvl)); } - if (_skills.isEmpty()) - { + if (_skills.isEmpty()) { throw new IllegalArgumentException(getClass().getSimpleName() + ": Without parameters!"); } } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { final L2Character effected = info.getEffected(); - for (SkillHolder holder : _skills) - { + for (SkillHolder holder : _skills) { effected.addInvulAgainst(holder); effected.sendDebugMessage("Applying invul against " + holder.getSkill()); } } @Override - public void onExit(BuffInfo info) - { + public void onExit(BuffInfo info) { final L2Character effected = info.getEffected(); - for (SkillHolder holder : _skills) - { + for (SkillHolder holder : _skills) { info.getEffected().removeInvulAgainst(holder); effected.sendDebugMessage("Removing invul against " + holder.getSkill()); } } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.BUFF; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/ResurrectionSpecial.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/ResurrectionSpecial.java index f654755152..3ae84c1064 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/ResurrectionSpecial.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/ResurrectionSpecial.java @@ -32,13 +32,11 @@ import com.l2jserver.gameserver.model.skills.Skill; * Resurrection Special effect implementation. * @author Zealar */ -public final class ResurrectionSpecial extends AbstractEffect -{ +public final class ResurrectionSpecial extends AbstractEffect { private final int _resPower; private final int _resRecovery; - public ResurrectionSpecial(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public ResurrectionSpecial(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _resPower = params.getInt("resPower", 0); @@ -46,35 +44,29 @@ public final class ResurrectionSpecial extends AbstractEffect } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.RESURRECTION_SPECIAL; } @Override - public int getEffectFlags() - { + public int getEffectFlags() { return EffectFlag.RESURRECTION_SPECIAL.getMask(); } @Override - public void onExit(BuffInfo info) - { - if (!info.getEffected().isPlayer() && !info.getEffected().isPet()) - { + public void onExit(BuffInfo info) { + if (!info.getEffected().isPlayer() && !info.getEffected().isPet()) { return; } L2PcInstance caster = info.getEffector().getActingPlayer(); Skill skill = info.getSkill(); - if (info.getEffected().isPlayer()) - { + if (info.getEffected().isPlayer()) { info.getEffected().getActingPlayer().reviveRequest(caster, skill, false, _resPower, _resRecovery); return; } - if (info.getEffected().isPet()) - { + if (info.getEffected().isPet()) { L2PetInstance pet = (L2PetInstance) info.getEffected(); info.getEffected().getActingPlayer().reviveRequest(pet.getActingPlayer(), skill, true, _resPower, _resRecovery); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/ServitorShare.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/ServitorShare.java index d6d418f31a..dbae1dab59 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/ServitorShare.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/ServitorShare.java @@ -33,55 +33,44 @@ import com.l2jserver.gameserver.model.stats.Stats; * Servitor Share effect implementation. Have effect only on servitor's but not on pets Important: Only one effect can be used on char per time. * @author Zealar */ -public final class ServitorShare extends AbstractEffect -{ +public final class ServitorShare extends AbstractEffect { private final Map<Stats, Double> stats = new HashMap<>(9); - public ServitorShare(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public ServitorShare(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); - for (String key : params.getSet().keySet()) - { + for (String key : params.getSet().keySet()) { stats.put(Stats.valueOfXml(key), params.getDouble(key, 1.)); } } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { super.onStart(info); info.getEffected().getActingPlayer().setServitorShare(stats); - if (info.getEffected().getActingPlayer().getSummon() != null) - { + if (info.getEffected().getActingPlayer().getSummon() != null) { info.getEffected().getActingPlayer().getSummon().broadcastInfo(); info.getEffected().getActingPlayer().getSummon().getStatus().startHpMpRegeneration(); } } @Override - public int getEffectFlags() - { + public int getEffectFlags() { return EffectFlag.SERVITOR_SHARE.getMask(); } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.BUFF; } @Override - public void onExit(BuffInfo info) - { + public void onExit(BuffInfo info) { info.getEffected().getActingPlayer().setServitorShare(null); - if (info.getEffected().getSummon() != null) - { - if (info.getEffected().getSummon().getCurrentHp() > info.getEffected().getSummon().getMaxHp()) - { + if (info.getEffected().getSummon() != null) { + if (info.getEffected().getSummon().getCurrentHp() > info.getEffected().getSummon().getMaxHp()) { info.getEffected().getSummon().setCurrentHp(info.getEffected().getSummon().getMaxHp()); } - if (info.getEffected().getSummon().getCurrentMp() > info.getEffected().getSummon().getMaxMp()) - { + if (info.getEffected().getSummon().getCurrentMp() > info.getEffected().getSummon().getMaxMp()) { info.getEffected().getSummon().setCurrentMp(info.getEffected().getSummon().getMaxMp()); } info.getEffected().getSummon().broadcastInfo(); diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/SingleTarget.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/SingleTarget.java index cd3c0a0584..a476c2d6f4 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/SingleTarget.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/SingleTarget.java @@ -26,16 +26,13 @@ import com.l2jserver.gameserver.model.effects.EffectFlag; /** * @author Zealar */ -public final class SingleTarget extends AbstractEffect -{ - public SingleTarget(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class SingleTarget extends AbstractEffect { + public SingleTarget(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public int getEffectFlags() - { + public int getEffectFlags() { return EffectFlag.SINGLE_TARGET.getMask(); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/SoulEating.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/SoulEating.java index 9a9b2e436a..18cb9b7819 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/SoulEating.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/SoulEating.java @@ -36,42 +36,34 @@ import com.l2jserver.gameserver.network.serverpackets.ExSpawnEmitter; * Soul Eating effect implementation. * @author UnAfraid */ -public final class SoulEating extends AbstractEffect -{ +public final class SoulEating extends AbstractEffect { private final int _expNeeded; - public SoulEating(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public SoulEating(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _expNeeded = params.getInt("expNeeded"); } @Override - public void onExit(BuffInfo info) - { - if (info.getEffected().isPlayer()) - { + public void onExit(BuffInfo info) { + if (info.getEffected().isPlayer()) { info.getEffected().removeListenerIf(EventType.ON_PLAYABLE_EXP_CHANGED, listener -> listener.getOwner() == this); } } - public void onExperienceReceived(L2Playable playable, long exp) - { + public void onExperienceReceived(L2Playable playable, long exp) { // TODO: Verify logic. - if (playable.isPlayer() && (exp >= _expNeeded)) - { + if (playable.isPlayer() && (exp >= _expNeeded)) { final L2PcInstance player = playable.getActingPlayer(); final int maxSouls = (int) player.calcStat(Stats.MAX_SOULS, 0, null, null); - if (player.getChargedSouls() >= maxSouls) - { + if (player.getChargedSouls() >= maxSouls) { playable.sendPacket(SystemMessageId.SOUL_CANNOT_BE_ABSORBED_ANYMORE); return; } player.increaseSouls(1); - if ((player.getTarget() != null) && player.getTarget().isNpc()) - { + if ((player.getTarget() != null) && player.getTarget().isNpc()) { final L2Npc npc = (L2Npc) playable.getTarget(); player.broadcastPacket(new ExSpawnEmitter(player, npc), 500); } @@ -79,10 +71,8 @@ public final class SoulEating extends AbstractEffect } @Override - public void onStart(BuffInfo info) - { - if (info.getEffected().isPlayer()) - { + public void onStart(BuffInfo info) { + if (info.getEffected().isPlayer()) { info.getEffected().addListener(new ConsumerEventListener(info.getEffected(), EventType.ON_PLAYABLE_EXP_CHANGED, (OnPlayableExpChanged event) -> onExperienceReceived(event.getActiveChar(), (event.getNewExp() - event.getOldExp())), this)); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TalismanSlot.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TalismanSlot.java index 22440a7118..a9aadc4625 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TalismanSlot.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TalismanSlot.java @@ -27,38 +27,32 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Talisman Slot effect implementation. * @author Adry_85 */ -public final class TalismanSlot extends AbstractEffect -{ +public final class TalismanSlot extends AbstractEffect { private final int _slots; - public TalismanSlot(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public TalismanSlot(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _slots = params.getInt("slots", 0); } @Override - public boolean canStart(BuffInfo info) - { + public boolean canStart(BuffInfo info) { return (info.getEffector() != null) && (info.getEffected() != null) && info.getEffected().isPlayer(); } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { info.getEffected().getActingPlayer().getStat().addTalismanSlots(_slots); } @Override - public boolean onActionTime(BuffInfo info) - { + public boolean onActionTime(BuffInfo info) { return info.getSkill().isPassive(); } @Override - public void onExit(BuffInfo info) - { + public void onExit(BuffInfo info) { info.getEffected().getActingPlayer().getStat().addTalismanSlots(-_slots); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TargetMe.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TargetMe.java index 11dd904ed4..04014aec87 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TargetMe.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TargetMe.java @@ -29,33 +29,25 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Target Me effect implementation. * @author -Nemesiss- */ -public final class TargetMe extends AbstractEffect -{ - public TargetMe(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class TargetMe extends AbstractEffect { + public TargetMe(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public void onExit(BuffInfo info) - { - if (info.getEffected().isPlayable()) - { + public void onExit(BuffInfo info) { + if (info.getEffected().isPlayable()) { ((L2Playable) info.getEffected()).setLockedTarget(null); } } @Override - public void onStart(BuffInfo info) - { - if (info.getEffected().isPlayable()) - { - if (info.getEffected().getTarget() != info.getEffector()) - { + public void onStart(BuffInfo info) { + if (info.getEffected().isPlayable()) { + if (info.getEffected().getTarget() != info.getEffector()) { L2PcInstance effector = info.getEffector().getActingPlayer(); // If effector is null, then its not a player, but NPC. If its not null, then it should check if the skill is pvp skill. - if ((effector == null) || effector.checkPvpSkill(info.getEffected(), info.getSkill())) - { + if ((effector == null) || effector.checkPvpSkill(info.getEffected(), info.getSkill())) { // Target is different info.getEffected().setTarget(info.getEffector()); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TransferDamage.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TransferDamage.java index d1c0f8eafe..8b78e2c63e 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TransferDamage.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TransferDamage.java @@ -28,27 +28,21 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Transfer Damage effect implementation. * @author UnAfraid */ -public final class TransferDamage extends AbstractEffect -{ - public TransferDamage(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { +public final class TransferDamage extends AbstractEffect { + public TransferDamage(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @Override - public void onExit(BuffInfo info) - { - if (info.getEffected().isPlayable() && info.getEffector().isPlayer()) - { + public void onExit(BuffInfo info) { + if (info.getEffected().isPlayable() && info.getEffector().isPlayer()) { ((L2Playable) info.getEffected()).setTransferDamageTo(null); } } @Override - public void onStart(BuffInfo info) - { - if (info.getEffected().isPlayable() && info.getEffector().isPlayer()) - { + public void onStart(BuffInfo info) { + if (info.getEffected().isPlayable() && info.getEffector().isPlayer()) { ((L2Playable) info.getEffected()).setTransferDamageTo(info.getEffector().getActingPlayer()); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Transformation.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Transformation.java index 3d69518a51..8482677243 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Transformation.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/Transformation.java @@ -28,32 +28,27 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * Transformation effect implementation. * @author nBd */ -public final class Transformation extends AbstractEffect -{ +public final class Transformation extends AbstractEffect { private final int _id; - public Transformation(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public Transformation(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _id = params.getInt("id", 0); } @Override - public boolean canStart(BuffInfo info) - { + public boolean canStart(BuffInfo info) { return info.getEffected().isPlayer(); } @Override - public void onExit(BuffInfo info) - { + public void onExit(BuffInfo info) { info.getEffected().stopTransformation(false); } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { TransformData.getInstance().transformPlayer(_id, info.getEffected().getActingPlayer()); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TriggerSkillByAttack.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TriggerSkillByAttack.java index 1162fabf7b..ef1137ebea 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TriggerSkillByAttack.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TriggerSkillByAttack.java @@ -41,8 +41,7 @@ import com.l2jserver.gameserver.util.Util; * Trigger Skill By Attack effect implementation. * @author Zealar */ -public final class TriggerSkillByAttack extends AbstractEffect -{ +public final class TriggerSkillByAttack extends AbstractEffect { private final int _minAttackerLevel; private final int _maxAttackerLevel; private final int _minDamage; @@ -60,8 +59,7 @@ public final class TriggerSkillByAttack extends AbstractEffect * @param params */ - public TriggerSkillByAttack(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public TriggerSkillByAttack(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _minAttackerLevel = params.getInt("minAttackerLevel", 1); @@ -73,62 +71,48 @@ public final class TriggerSkillByAttack extends AbstractEffect _attackerType = params.getEnum("attackerType", InstanceType.class, InstanceType.L2Character); _isCritical = params.getBoolean("isCritical", false); - if (params.getString("allowWeapons").equalsIgnoreCase("ALL")) - { + if (params.getString("allowWeapons").equalsIgnoreCase("ALL")) { _allowWeapons = 0; - } - else - { - for (String s : params.getString("allowWeapons").split(",")) - { + } else { + for (String s : params.getString("allowWeapons").split(",")) { _allowWeapons |= WeaponType.valueOf(s).mask(); } } } - public void onAttackEvent(OnCreatureDamageDealt event) - { - if ((event.getSkill() != null) || event.isDamageOverTime() || event.isReflect() || (_chance == 0) || ((_skill.getSkillId() == 0) || (_skill.getSkillLvl() == 0))) - { + public void onAttackEvent(OnCreatureDamageDealt event) { + if ((event.getSkill() != null) || event.isDamageOverTime() || event.isReflect() || (_chance == 0) || ((_skill.getSkillId() == 0) || (_skill.getSkillLvl() == 0))) { return; } - if (((_targetType == L2TargetType.SELF) && (_skill.getSkill().getCastRange() > 0)) && (Util.calculateDistance(event.getAttacker(), event.getTarget(), true, false) > _skill.getSkill().getCastRange())) - { + if (((_targetType == L2TargetType.SELF) && (_skill.getSkill().getCastRange() > 0)) && (Util.calculateDistance(event.getAttacker(), event.getTarget(), true, false) > _skill.getSkill().getCastRange())) { return; } - if (_isCritical != event.isCritical()) - { + if (_isCritical != event.isCritical()) { return; } final ITargetTypeHandler targetHandler = TargetHandler.getInstance().getHandler(_targetType); - if (targetHandler == null) - { + if (targetHandler == null) { _log.warning("Handler for target type: " + _targetType + " does not exist."); return; } - if (event.getAttacker() == event.getTarget()) - { + if (event.getAttacker() == event.getTarget()) { return; } - if ((event.getAttacker().getLevel() < _minAttackerLevel) || (event.getAttacker().getLevel() > _maxAttackerLevel)) - { + if ((event.getAttacker().getLevel() < _minAttackerLevel) || (event.getAttacker().getLevel() > _maxAttackerLevel)) { return; } - if ((event.getDamage() < _minDamage) || (Rnd.get(100) > _chance) || !event.getAttacker().getInstanceType().isType(_attackerType)) - { + if ((event.getDamage() < _minDamage) || (Rnd.get(100) > _chance) || !event.getAttacker().getInstanceType().isType(_attackerType)) { return; } - if (_allowWeapons > 0) - { - if ((event.getAttacker().getActiveWeaponItem() == null) || ((event.getAttacker().getActiveWeaponItem().getItemType().mask() & _allowWeapons) == 0)) - { + if (_allowWeapons > 0) { + if ((event.getAttacker().getActiveWeaponItem() == null) || ((event.getAttacker().getActiveWeaponItem().getItemType().mask() & _allowWeapons) == 0)) { return; } } @@ -136,30 +120,25 @@ public final class TriggerSkillByAttack extends AbstractEffect final Skill triggerSkill = _skill.getSkill(); final L2Object[] targets = targetHandler.getTargetList(triggerSkill, event.getAttacker(), false, event.getTarget()); - for (L2Object triggerTarget : targets) - { - if ((triggerTarget == null) || !triggerTarget.isCharacter()) - { + for (L2Object triggerTarget : targets) { + if ((triggerTarget == null) || !triggerTarget.isCharacter()) { continue; } final L2Character targetChar = (L2Character) triggerTarget; - if (!targetChar.isInvul()) - { + if (!targetChar.isInvul()) { event.getAttacker().makeTriggerCast(triggerSkill, targetChar); } } } @Override - public void onExit(BuffInfo info) - { + public void onExit(BuffInfo info) { info.getEffected().removeListenerIf(EventType.ON_CREATURE_DAMAGE_DEALT, listener -> listener.getOwner() == this); } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { info.getEffected().addListener(new ConsumerEventListener(info.getEffected(), EventType.ON_CREATURE_DAMAGE_DEALT, (OnCreatureDamageDealt event) -> onAttackEvent(event), this)); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TriggerSkillByAvoid.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TriggerSkillByAvoid.java index 2dc7f36b01..08f434a15d 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TriggerSkillByAvoid.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TriggerSkillByAvoid.java @@ -39,8 +39,7 @@ import com.l2jserver.gameserver.util.Util; * Trigger Skill By Avoid effect implementation. * @author Zealar */ -public final class TriggerSkillByAvoid extends AbstractEffect -{ +public final class TriggerSkillByAvoid extends AbstractEffect { private final int _chance; private final SkillHolder _skill; private final L2TargetType _targetType; @@ -51,8 +50,7 @@ public final class TriggerSkillByAvoid extends AbstractEffect * @param set * @param params */ - public TriggerSkillByAvoid(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public TriggerSkillByAvoid(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _chance = params.getInt("chance", 100); @@ -60,57 +58,47 @@ public final class TriggerSkillByAvoid extends AbstractEffect _targetType = params.getEnum("targetType", L2TargetType.class, L2TargetType.ONE); } - public void onAvoidEvent(OnCreatureAttackAvoid event) - { - if (event.isDamageOverTime() || (_chance == 0) || ((_skill.getSkillId() == 0) || (_skill.getSkillLvl() == 0))) - { + public void onAvoidEvent(OnCreatureAttackAvoid event) { + if (event.isDamageOverTime() || (_chance == 0) || ((_skill.getSkillId() == 0) || (_skill.getSkillLvl() == 0))) { return; } - if (((_targetType == L2TargetType.SELF) && (_skill.getSkill().getCastRange() > 0)) && (Util.calculateDistance(event.getAttacker(), event.getTarget(), true, false) > _skill.getSkill().getCastRange())) - { + if (((_targetType == L2TargetType.SELF) && (_skill.getSkill().getCastRange() > 0)) && (Util.calculateDistance(event.getAttacker(), event.getTarget(), true, false) > _skill.getSkill().getCastRange())) { return; } final ITargetTypeHandler targetHandler = TargetHandler.getInstance().getHandler(_targetType); - if (targetHandler == null) - { + if (targetHandler == null) { _log.warning("Handler for target type: " + _targetType + " does not exist."); return; } - if (Rnd.get(100) > _chance) - { + if (Rnd.get(100) > _chance) { return; } final Skill triggerSkill = _skill.getSkill(); final L2Object[] targets = targetHandler.getTargetList(triggerSkill, event.getTarget(), false, event.getAttacker()); - for (L2Object triggerTarget : targets) - { - if ((triggerTarget == null) || !triggerTarget.isCharacter()) - { + for (L2Object triggerTarget : targets) { + if ((triggerTarget == null) || !triggerTarget.isCharacter()) { continue; } final L2Character targetChar = (L2Character) triggerTarget; - if (!targetChar.isInvul()) - { + if (!targetChar.isInvul()) { event.getTarget().makeTriggerCast(triggerSkill, targetChar); } } } @Override - public void onExit(BuffInfo info) - { + public void onExit(BuffInfo info) { info.getEffected().removeListenerIf(EventType.ON_CREATURE_ATTACK_AVOID, listener -> listener.getOwner() == this); } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { info.getEffected().addListener(new ConsumerEventListener(info.getEffected(), EventType.ON_CREATURE_ATTACK_AVOID, (OnCreatureAttackAvoid event) -> onAvoidEvent(event), this)); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TriggerSkillByDamage.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TriggerSkillByDamage.java index deb8a29090..6f39ee932e 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TriggerSkillByDamage.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TriggerSkillByDamage.java @@ -40,8 +40,7 @@ import com.l2jserver.gameserver.util.Util; * Trigger Skill By Damage effect implementation. * @author UnAfraid */ -public final class TriggerSkillByDamage extends AbstractEffect -{ +public final class TriggerSkillByDamage extends AbstractEffect { private final int _minAttackerLevel; private final int _maxAttackerLevel; private final int _minDamage; @@ -50,8 +49,7 @@ public final class TriggerSkillByDamage extends AbstractEffect private final L2TargetType _targetType; private final InstanceType _attackerType; - public TriggerSkillByDamage(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public TriggerSkillByDamage(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _minAttackerLevel = params.getInt("minAttackerLevel", 1); @@ -63,66 +61,54 @@ public final class TriggerSkillByDamage extends AbstractEffect _attackerType = params.getEnum("attackerType", InstanceType.class, InstanceType.L2Character); } - public void onDamageReceivedEvent(OnCreatureDamageReceived event) - { - if (event.isDamageOverTime() || (_chance == 0) || (_skill.getSkillLvl() == 0)) - { + public void onDamageReceivedEvent(OnCreatureDamageReceived event) { + if (event.isDamageOverTime() || (_chance == 0) || (_skill.getSkillLvl() == 0)) { return; } - if (((_targetType == L2TargetType.SELF) && (_skill.getSkill().getCastRange() > 0)) && (Util.calculateDistance(event.getAttacker(), event.getTarget(), true, false) > _skill.getSkill().getCastRange())) - { + if (((_targetType == L2TargetType.SELF) && (_skill.getSkill().getCastRange() > 0)) && (Util.calculateDistance(event.getAttacker(), event.getTarget(), true, false) > _skill.getSkill().getCastRange())) { return; } final ITargetTypeHandler targetHandler = TargetHandler.getInstance().getHandler(_targetType); - if (targetHandler == null) - { + if (targetHandler == null) { _log.warning("Handler for target type: " + _targetType + " does not exist."); return; } - if (event.getAttacker() == event.getTarget()) - { + if (event.getAttacker() == event.getTarget()) { return; } - if ((event.getAttacker().getLevel() < _minAttackerLevel) || (event.getAttacker().getLevel() > _maxAttackerLevel)) - { + if ((event.getAttacker().getLevel() < _minAttackerLevel) || (event.getAttacker().getLevel() > _maxAttackerLevel)) { return; } - if ((event.getDamage() < _minDamage) || (Rnd.get(100) > _chance) || !event.getAttacker().getInstanceType().isType(_attackerType)) - { + if ((event.getDamage() < _minDamage) || (Rnd.get(100) > _chance) || !event.getAttacker().getInstanceType().isType(_attackerType)) { return; } final Skill triggerSkill = _skill.getSkill(); final L2Object[] targets = targetHandler.getTargetList(triggerSkill, event.getTarget(), false, event.getAttacker()); - for (L2Object triggerTarget : targets) - { - if ((triggerTarget == null) || !triggerTarget.isCharacter()) - { + for (L2Object triggerTarget : targets) { + if ((triggerTarget == null) || !triggerTarget.isCharacter()) { continue; } final L2Character targetChar = (L2Character) triggerTarget; - if (!targetChar.isInvul()) - { + if (!targetChar.isInvul()) { event.getTarget().makeTriggerCast(triggerSkill, targetChar); } } } @Override - public void onExit(BuffInfo info) - { + public void onExit(BuffInfo info) { info.getEffected().removeListenerIf(EventType.ON_CREATURE_DAMAGE_RECEIVED, listener -> listener.getOwner() == this); } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { info.getEffected().addListener(new ConsumerEventListener(info.getEffected(), EventType.ON_CREATURE_DAMAGE_RECEIVED, (OnCreatureDamageReceived event) -> onDamageReceivedEvent(event), this)); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TriggerSkillBySkill.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TriggerSkillBySkill.java index 26ac32b654..06a2378746 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TriggerSkillBySkill.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/TriggerSkillBySkill.java @@ -38,8 +38,7 @@ import com.l2jserver.gameserver.model.skills.targets.L2TargetType; * Trigger Skill By Skill effect implementation. * @author Zealar */ -public final class TriggerSkillBySkill extends AbstractEffect -{ +public final class TriggerSkillBySkill extends AbstractEffect { private final int _castSkillId; private final int _chance; private final SkillHolder _skill; @@ -52,8 +51,7 @@ public final class TriggerSkillBySkill extends AbstractEffect * @param params */ - public TriggerSkillBySkill(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public TriggerSkillBySkill(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _castSkillId = params.getInt("castSkillId", 0); @@ -62,57 +60,47 @@ public final class TriggerSkillBySkill extends AbstractEffect _targetType = params.getEnum("targetType", L2TargetType.class, L2TargetType.ONE); } - public void onSkillUseEvent(OnCreatureSkillUse event) - { - if ((_chance == 0) || ((_skill.getSkillId() == 0) || (_skill.getSkillLvl() == 0) || (_castSkillId == 0))) - { + public void onSkillUseEvent(OnCreatureSkillUse event) { + if ((_chance == 0) || ((_skill.getSkillId() == 0) || (_skill.getSkillLvl() == 0) || (_castSkillId == 0))) { return; } - if (_castSkillId != event.getSkill().getId()) - { + if (_castSkillId != event.getSkill().getId()) { return; } final ITargetTypeHandler targetHandler = TargetHandler.getInstance().getHandler(_targetType); - if (targetHandler == null) - { + if (targetHandler == null) { _log.warning("Handler for target type: " + _targetType + " does not exist."); return; } - if (Rnd.get(100) > _chance) - { + if (Rnd.get(100) > _chance) { return; } final Skill triggerSkill = _skill.getSkill(); final L2Object[] targets = targetHandler.getTargetList(triggerSkill, event.getCaster(), false, event.getTarget()); - for (L2Object triggerTarget : targets) - { - if ((triggerTarget == null) || !triggerTarget.isCharacter()) - { + for (L2Object triggerTarget : targets) { + if ((triggerTarget == null) || !triggerTarget.isCharacter()) { continue; } final L2Character targetChar = (L2Character) triggerTarget; - if (!targetChar.isInvul()) - { + if (!targetChar.isInvul()) { event.getCaster().makeTriggerCast(triggerSkill, targetChar); } } } @Override - public void onExit(BuffInfo info) - { + public void onExit(BuffInfo info) { info.getEffected().removeListenerIf(EventType.ON_CREATURE_SKILL_USE, listener -> listener.getOwner() == this); } @Override - public void onStart(BuffInfo info) - { + public void onStart(BuffInfo info) { info.getEffected().addListener(new ConsumerEventListener(info.getEffected(), EventType.ON_CREATURE_SKILL_USE, (OnCreatureSkillUse event) -> onSkillUseEvent(event), this)); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/ticks/TickHp.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/ticks/TickHp.java index 0874211c35..bd2b71210d 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/ticks/TickHp.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/ticks/TickHp.java @@ -33,13 +33,11 @@ import com.l2jserver.gameserver.network.serverpackets.ExRegenMax; * @author Adry_85 * @since 2.6.0.0 */ -public final class TickHp extends AbstractEffect -{ +public final class TickHp extends AbstractEffect { private final double _power; private final EffectCalculationType _mode; - public TickHp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public TickHp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getDouble("power", 0); @@ -48,54 +46,43 @@ public final class TickHp extends AbstractEffect } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.DMG_OVER_TIME; } @Override - public boolean onActionTime(BuffInfo info) - { - if (info.getEffected().isDead()) - { + public boolean onActionTime(BuffInfo info) { + if (info.getEffected().isDead()) { return false; } final L2Character target = info.getEffected(); double power = 0; double hp = target.getCurrentHp(); - switch (_mode) - { - case DIFF: - { + switch (_mode) { + case DIFF: { power = _power * getTicksMultiplier(); break; } - case PER: - { + case PER: { power = hp * _power * getTicksMultiplier(); break; } } - if (power < 0) - { + if (power < 0) { power = Math.abs(power); - if (power >= (target.getCurrentHp() - 1)) - { + if (power >= (target.getCurrentHp() - 1)) { power = target.getCurrentHp() - 1; } info.getEffected().reduceCurrentHpByDOT(power, info.getEffector(), info.getSkill()); info.getEffected().notifyDamageReceived(power, info.getEffector(), info.getSkill(), false, true, false); - } - else - { + } else { final double maxHp = target.getMaxRecoverableHp(); // Not needed to set the HP and send update packet if player is already at max HP - if (hp > maxHp) - { + if (hp > maxHp) { return true; } @@ -105,10 +92,8 @@ public final class TickHp extends AbstractEffect } @Override - public void onStart(BuffInfo info) - { - if (info.getEffected().isPlayer() && (getTicks() > 0) && (info.getSkill().getAbnormalType() == AbnormalType.HP_RECOVER)) - { + public void onStart(BuffInfo info) { + if (info.getEffected().isPlayer() && (getTicks() > 0) && (info.getSkill().getAbnormalType() == AbnormalType.HP_RECOVER)) { info.getEffected().sendPacket(new ExRegenMax(info.getAbnormalTime(), getTicks(), _power)); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/ticks/TickHpFatal.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/ticks/TickHpFatal.java index 980f255462..5995dc11bf 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/ticks/TickHpFatal.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/ticks/TickHpFatal.java @@ -31,13 +31,11 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * @author Adry_85 * @since 2.6.0.0 */ -public final class TickHpFatal extends AbstractEffect -{ +public final class TickHpFatal extends AbstractEffect { private final double _power; private final EffectCalculationType _mode; - public TickHpFatal(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public TickHpFatal(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getDouble("power", 0); @@ -46,30 +44,24 @@ public final class TickHpFatal extends AbstractEffect } @Override - public L2EffectType getEffectType() - { + public L2EffectType getEffectType() { return L2EffectType.DMG_OVER_TIME; } @Override - public boolean onActionTime(BuffInfo info) - { - if (info.getEffected().isDead()) - { + public boolean onActionTime(BuffInfo info) { + if (info.getEffected().isDead()) { return false; } final L2Character target = info.getEffected(); double damage = 0; - switch (_mode) - { - case DIFF: - { + switch (_mode) { + case DIFF: { damage = _power * getTicksMultiplier(); break; } - case PER: - { + case PER: { damage = target.getCurrentHp() * _power * getTicksMultiplier(); break; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/ticks/TickMp.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/ticks/TickMp.java index 760c3d3faf..d86ec26531 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/ticks/TickMp.java +++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/ticks/TickMp.java @@ -30,13 +30,11 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; * @author Adry_85 * @since 2.6.0.0 */ -public final class TickMp extends AbstractEffect -{ +public final class TickMp extends AbstractEffect { private final double _power; private final EffectCalculationType _mode; - public TickMp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) - { + public TickMp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _power = params.getDouble("power", 0); @@ -45,41 +43,32 @@ public final class TickMp extends AbstractEffect } @Override - public boolean onActionTime(BuffInfo info) - { - if (info.getEffected().isDead()) - { + public boolean onActionTime(BuffInfo info) { + if (info.getEffected().isDead()) { return false; } final L2Character target = info.getEffected(); double power = 0; double mp = target.getCurrentMp(); - switch (_mode) - { - case DIFF: - { + switch (_mode) { + case DIFF: { power = _power * getTicksMultiplier(); break; } - case PER: - { + case PER: { power = mp * _power * getTicksMultiplier(); break; } } - if (power < 0) - { + if (power < 0) { target.reduceCurrentMp(Math.abs(power)); - } - else - { + } else { double maxMp = target.getMaxRecoverableMp(); // Not needed to set the MP and send update packet if player is already at max MP - if (mp >= maxMp) - { + if (mp >= maxMp) { return true; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/BeastSoulShot.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/BeastSoulShot.java index dc458880f5..9ebfba8069 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/BeastSoulShot.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/BeastSoulShot.java @@ -35,26 +35,21 @@ import com.l2jserver.gameserver.util.Broadcast; * Beast SoulShot Handler * @author Tempy */ -public class BeastSoulShot implements IItemHandler -{ +public class BeastSoulShot implements IItemHandler { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!playable.isPlayer()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } final L2PcInstance activeOwner = playable.getActingPlayer(); - if (!activeOwner.hasSummon()) - { + if (!activeOwner.hasSummon()) { activeOwner.sendPacket(SystemMessageId.PETS_ARE_NOT_AVAILABLE_AT_THIS_TIME); return false; } - if (activeOwner.getSummon().isDead()) - { + if (activeOwner.getSummon().isDead()) { activeOwner.sendPacket(SystemMessageId.SOULSHOTS_AND_SPIRITSHOTS_ARE_NOT_AVAILABLE_FOR_A_DEAD_PET); return false; } @@ -64,33 +59,27 @@ public class BeastSoulShot implements IItemHandler final long shotCount = item.getCount(); final SkillHolder[] skills = item.getItem().getSkills(); - if (skills == null) - { + if (skills == null) { _log.log(Level.WARNING, getClass().getSimpleName() + ": is missing skills!"); return false; } - if (shotCount < shotConsumption) - { + if (shotCount < shotConsumption) { // Not enough Soulshots to use. - if (!activeOwner.disableAutoShot(itemId)) - { + if (!activeOwner.disableAutoShot(itemId)) { activeOwner.sendPacket(SystemMessageId.NOT_ENOUGH_SOULSHOTS_FOR_PET); } return false; } - if (activeOwner.getSummon().isChargedShot(ShotType.SOULSHOTS)) - { + if (activeOwner.getSummon().isChargedShot(ShotType.SOULSHOTS)) { // SoulShots are already active. return false; } // If the player doesn't have enough beast soulshot remaining, remove any auto soulshot task. - if (!activeOwner.destroyItemWithoutTrace("Consume", item.getObjectId(), shotConsumption, null, false)) - { - if (!activeOwner.disableAutoShot(itemId)) - { + if (!activeOwner.destroyItemWithoutTrace("Consume", item.getObjectId(), shotConsumption, null, false)) { + if (!activeOwner.disableAutoShot(itemId)) { activeOwner.sendPacket(SystemMessageId.NOT_ENOUGH_SOULSHOTS_FOR_PET); } return false; diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/BeastSpiritShot.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/BeastSpiritShot.java index cf835cf2be..2c24bd424d 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/BeastSpiritShot.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/BeastSpiritShot.java @@ -35,26 +35,21 @@ import com.l2jserver.gameserver.util.Broadcast; * Beast SpiritShot Handler * @author Tempy */ -public class BeastSpiritShot implements IItemHandler -{ +public class BeastSpiritShot implements IItemHandler { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!playable.isPlayer()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } final L2PcInstance activeOwner = playable.getActingPlayer(); - if (!activeOwner.hasSummon()) - { + if (!activeOwner.hasSummon()) { activeOwner.sendPacket(SystemMessageId.PETS_ARE_NOT_AVAILABLE_AT_THIS_TIME); return false; } - if (activeOwner.getSummon().isDead()) - { + if (activeOwner.getSummon().isDead()) { activeOwner.sendPacket(SystemMessageId.SOULSHOTS_AND_SPIRITSHOTS_ARE_NOT_AVAILABLE_FOR_A_DEAD_PET); return false; } @@ -64,33 +59,27 @@ public class BeastSpiritShot implements IItemHandler final short shotConsumption = activeOwner.getSummon().getSpiritShotsPerHit(); final SkillHolder[] skills = item.getItem().getSkills(); - if (skills == null) - { + if (skills == null) { _log.log(Level.WARNING, getClass().getSimpleName() + ": is missing skills!"); return false; } long shotCount = item.getCount(); - if (shotCount < shotConsumption) - { + if (shotCount < shotConsumption) { // Not enough SpiritShots to use. - if (!activeOwner.disableAutoShot(itemId)) - { + if (!activeOwner.disableAutoShot(itemId)) { activeOwner.sendPacket(SystemMessageId.NOT_ENOUGH_SPIRITHOTS_FOR_PET); } return false; } - if (activeOwner.getSummon().isChargedShot(isBlessed ? ShotType.BLESSED_SPIRITSHOTS : ShotType.SPIRITSHOTS)) - { + if (activeOwner.getSummon().isChargedShot(isBlessed ? ShotType.BLESSED_SPIRITSHOTS : ShotType.SPIRITSHOTS)) { // shots are already active. return false; } - if (!activeOwner.destroyItemWithoutTrace("Consume", item.getObjectId(), shotConsumption, null, false)) - { - if (!activeOwner.disableAutoShot(itemId)) - { + if (!activeOwner.destroyItemWithoutTrace("Consume", item.getObjectId(), shotConsumption, null, false)) { + if (!activeOwner.disableAutoShot(itemId)) { activeOwner.sendPacket(SystemMessageId.NOT_ENOUGH_SPIRITHOTS_FOR_PET); } return false; diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/BlessedSpiritShot.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/BlessedSpiritShot.java index 68c3a35640..c8f18207bb 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/BlessedSpiritShot.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/BlessedSpiritShot.java @@ -33,13 +33,10 @@ import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse; import com.l2jserver.gameserver.network.serverpackets.SystemMessage; import com.l2jserver.gameserver.util.Broadcast; -public class BlessedSpiritShot implements IItemHandler -{ +public class BlessedSpiritShot implements IItemHandler { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!playable.isPlayer()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } @@ -51,35 +48,29 @@ public class BlessedSpiritShot implements IItemHandler int itemId = item.getId(); - if (skills == null) - { + if (skills == null) { _log.log(Level.WARNING, getClass().getSimpleName() + ": is missing skills!"); return false; } // Check if Blessed SpiritShot can be used - if ((weaponInst == null) || (weaponItem == null) || (weaponItem.getSpiritShotCount() == 0)) - { - if (!activeChar.getAutoSoulShot().contains(itemId)) - { + if ((weaponInst == null) || (weaponItem == null) || (weaponItem.getSpiritShotCount() == 0)) { + if (!activeChar.getAutoSoulShot().contains(itemId)) { activeChar.sendPacket(SystemMessageId.CANNOT_USE_SPIRITSHOTS); } return false; } // Check if Blessed SpiritShot is already active (it can be charged over SpiritShot) - if (activeChar.isChargedShot(ShotType.BLESSED_SPIRITSHOTS)) - { + if (activeChar.isChargedShot(ShotType.BLESSED_SPIRITSHOTS)) { return false; } // Check for correct grade boolean gradeCheck = item.isEtcItem() && (item.getEtcItem().getDefaultAction() == ActionType.SPIRITSHOT) && (weaponInst.getItem().getItemGradeSPlus() == item.getItem().getItemGradeSPlus()); - if (!gradeCheck) - { - if (!activeChar.getAutoSoulShot().contains(itemId)) - { + if (!gradeCheck) { + if (!activeChar.getAutoSoulShot().contains(itemId)) { activeChar.sendPacket(SystemMessageId.SPIRITSHOTS_GRADE_MISMATCH); } @@ -87,10 +78,8 @@ public class BlessedSpiritShot implements IItemHandler } // Consume Blessed SpiritShot if player has enough of them - if (!activeChar.destroyItemWithoutTrace("Consume", item.getObjectId(), weaponItem.getSpiritShotCount(), null, false)) - { - if (!activeChar.disableAutoShot(itemId)) - { + if (!activeChar.destroyItemWithoutTrace("Consume", item.getObjectId(), weaponItem.getSpiritShotCount(), null, false)) { + if (!activeChar.disableAutoShot(itemId)) { activeChar.sendPacket(SystemMessageId.NOT_ENOUGH_SPIRITSHOTS); } return false; diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Book.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Book.java index 79b18c602f..70a160c9af 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Book.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Book.java @@ -27,13 +27,10 @@ import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.ActionFailed; import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; -public class Book implements IItemHandler -{ +public class Book implements IItemHandler { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!playable.isPlayer()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } @@ -44,14 +41,11 @@ public class Book implements IItemHandler String filename = "data/html/help/" + itemId + ".htm"; String content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), filename); - if (content == null) - { + if (content == null) { final NpcHtmlMessage html = new NpcHtmlMessage(0, item.getId()); html.setHtml("<html><body>My Text is missing:<br>" + filename + "</body></html>"); activeChar.sendPacket(html); - } - else - { + } else { final NpcHtmlMessage itemReply = new NpcHtmlMessage(0, item.getId()); itemReply.setHtml(content); activeChar.sendPacket(itemReply); diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Bypass.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Bypass.java index 17588f9a26..f57316662b 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Bypass.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Bypass.java @@ -28,13 +28,10 @@ import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; /** * @author JIV */ -public class Bypass implements IItemHandler -{ +public class Bypass implements IItemHandler { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!(playable instanceof L2PcInstance)) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!(playable instanceof L2PcInstance)) { return false; } L2PcInstance activeChar = (L2PcInstance) playable; @@ -43,13 +40,10 @@ public class Bypass implements IItemHandler String filename = "data/html/item/" + itemId + ".htm"; String content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), filename); final NpcHtmlMessage html = new NpcHtmlMessage(0, item.getId()); - if (content == null) - { + if (content == null) { html.setHtml("<html><body>My Text is missing:<br>" + filename + "</body></html>"); activeChar.sendPacket(html); - } - else - { + } else { html.setHtml(content); html.replace("%itemId%", String.valueOf(item.getObjectId())); activeChar.sendPacket(html); diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Calculator.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Calculator.java index 9bdfa3e38a..488480fb8d 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Calculator.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Calculator.java @@ -27,13 +27,10 @@ import com.l2jserver.gameserver.network.serverpackets.ShowCalculator; /** * @author Zoey76 */ -public class Calculator implements IItemHandler -{ +public class Calculator implements IItemHandler { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!playable.isPlayer()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/CharmOfCourage.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/CharmOfCourage.java index d1770346ce..5f9187d4d7 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/CharmOfCourage.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/CharmOfCourage.java @@ -30,14 +30,11 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Charm Of Courage Handler * @author Zealar */ -public class CharmOfCourage implements IItemHandler -{ +public class CharmOfCourage implements IItemHandler { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { - if (!playable.isPlayer()) - { + if (!playable.isPlayer()) { return false; } @@ -46,41 +43,28 @@ public class CharmOfCourage implements IItemHandler int level = activeChar.getLevel(); final int itemLevel = item.getItem().getItemGrade().getId(); - if (level < 20) - { + if (level < 20) { level = 0; - } - else if (level < 40) - { + } else if (level < 40) { level = 1; - } - else if (level < 52) - { + } else if (level < 52) { level = 2; - } - else if (level < 61) - { + } else if (level < 61) { level = 3; - } - else if (level < 76) - { + } else if (level < 76) { level = 4; - } - else - { + } else { level = 5; } - if (itemLevel < level) - { + if (itemLevel < level) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED); sm.addItemName(item.getId()); activeChar.sendPacket(sm); return false; } - if (activeChar.destroyItemWithoutTrace("Consume", item.getObjectId(), 1, null, false)) - { + if (activeChar.destroyItemWithoutTrace("Consume", item.getObjectId(), 1, null, false)) { activeChar.setCharmOfCourage(true); activeChar.sendPacket(new EtcStatusUpdate(activeChar)); return true; diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Disguise.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Disguise.java index 78560140d4..da02e51af9 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Disguise.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Disguise.java @@ -28,13 +28,10 @@ import com.l2jserver.gameserver.network.SystemMessageId; /** * This class provides handling for items that should display a map when double clicked. */ -public class Disguise implements IItemHandler -{ +public class Disguise implements IItemHandler { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!playable.isPlayer()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } @@ -42,10 +39,8 @@ public class Disguise implements IItemHandler L2PcInstance activeChar = playable.getActingPlayer(); int regId = TerritoryWarManager.getInstance().getRegisteredTerritoryId(activeChar); - if ((regId > 0) && (regId == (item.getId() - 13596))) - { - if ((activeChar.getClan() != null) && (activeChar.getClan().getCastleId() > 0)) - { + if ((regId > 0) && (regId == (item.getId() - 13596))) { + if ((activeChar.getClan() != null) && (activeChar.getClan().getCastleId() > 0)) { activeChar.sendPacket(SystemMessageId.TERRITORY_OWNING_CLAN_CANNOT_USE_DISGUISE_SCROLL); return false; } @@ -53,14 +48,10 @@ public class Disguise implements IItemHandler activeChar.broadcastUserInfo(); playable.destroyItem("Consume", item.getObjectId(), 1, null, false); return true; - } - else if (regId > 0) - { + } else if (regId > 0) { activeChar.sendPacket(SystemMessageId.THE_DISGUISE_SCROLL_MEANT_FOR_DIFFERENT_TERRITORY); return false; - } - else - { + } else { activeChar.sendPacket(SystemMessageId.TERRITORY_WAR_SCROLL_CAN_NOT_USED_NOW); return false; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Elixir.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Elixir.java index 1b7e377faf..fcfdd2d977 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Elixir.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Elixir.java @@ -22,13 +22,10 @@ import com.l2jserver.gameserver.model.actor.L2Playable; import com.l2jserver.gameserver.model.items.instance.L2ItemInstance; import com.l2jserver.gameserver.network.SystemMessageId; -public class Elixir extends ItemSkills -{ +public class Elixir extends ItemSkills { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!playable.isPlayer()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/EnchantAttribute.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/EnchantAttribute.java index 9ec5beffd5..005d489ca5 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/EnchantAttribute.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/EnchantAttribute.java @@ -25,25 +25,20 @@ import com.l2jserver.gameserver.model.items.instance.L2ItemInstance; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.ExChooseInventoryAttributeItem; -public class EnchantAttribute implements IItemHandler -{ +public class EnchantAttribute implements IItemHandler { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!playable.isPlayer()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } final L2PcInstance activeChar = playable.getActingPlayer(); - if (activeChar.isCastingNow()) - { + if (activeChar.isCastingNow()) { return false; } - if (activeChar.isEnchanting()) - { + if (activeChar.isEnchanting()) { activeChar.sendPacket(SystemMessageId.ENCHANTMENT_ALREADY_IN_PROGRESS); return false; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/EnchantScrolls.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/EnchantScrolls.java index e6e9bd98e8..6f7ac3b642 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/EnchantScrolls.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/EnchantScrolls.java @@ -25,25 +25,20 @@ import com.l2jserver.gameserver.model.items.instance.L2ItemInstance; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.ChooseInventoryItem; -public class EnchantScrolls implements IItemHandler -{ +public class EnchantScrolls implements IItemHandler { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!playable.isPlayer()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } final L2PcInstance activeChar = playable.getActingPlayer(); - if (activeChar.isCastingNow()) - { + if (activeChar.isCastingNow()) { return false; } - if (activeChar.isEnchanting()) - { + if (activeChar.isEnchanting()) { activeChar.sendPacket(SystemMessageId.ENCHANTMENT_ALREADY_IN_PROGRESS); return false; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/EventItem.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/EventItem.java index e437f89da6..ed0dd20067 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/EventItem.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/EventItem.java @@ -29,13 +29,10 @@ import com.l2jserver.gameserver.model.skills.Skill; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.SystemMessage; -public class EventItem implements IItemHandler -{ +public class EventItem implements IItemHandler { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!playable.isPlayer()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } @@ -45,8 +42,7 @@ public class EventItem implements IItemHandler final L2PcInstance activeChar = playable.getActingPlayer(); final int itemId = item.getId(); - switch (itemId) - { + switch (itemId) { case 13787: // Handy's Block Checker Bond used = useBlockCheckerItem(activeChar, item); break; @@ -59,11 +55,9 @@ public class EventItem implements IItemHandler return used; } - private final boolean useBlockCheckerItem(final L2PcInstance castor, L2ItemInstance item) - { + private final boolean useBlockCheckerItem(final L2PcInstance castor, L2ItemInstance item) { final int blockCheckerArena = castor.getBlockCheckerArena(); - if (blockCheckerArena == -1) - { + if (blockCheckerArena == -1) { SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED); msg.addItemName(item); castor.sendPacket(msg); @@ -71,27 +65,22 @@ public class EventItem implements IItemHandler } final Skill sk = item.getEtcItem().getSkills()[0].getSkill(); - if (sk == null) - { + if (sk == null) { return false; } - if (!castor.destroyItem("Consume", item, 1, castor, true)) - { + if (!castor.destroyItem("Consume", item, 1, castor, true)) { return false; } final L2BlockInstance block = (L2BlockInstance) castor.getTarget(); final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(blockCheckerArena); - if (holder != null) - { + if (holder != null) { final int team = holder.getPlayerTeam(castor); - for (final L2PcInstance pc : block.getKnownList().getKnownPlayersInRadius(sk.getEffectRange())) - { + for (final L2PcInstance pc : block.getKnownList().getKnownPlayersInRadius(sk.getEffectRange())) { final int enemyTeam = holder.getPlayerTeam(pc); - if ((enemyTeam != -1) && (enemyTeam != team)) - { + if ((enemyTeam != -1) && (enemyTeam != team)) { sk.applyEffects(castor, pc); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/ExtractableItems.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/ExtractableItems.java index d1faae673e..0a5c9c4c2b 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/ExtractableItems.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/ExtractableItems.java @@ -35,13 +35,10 @@ import com.l2jserver.gameserver.network.SystemMessageId; * Extractable Items handler. * @author HorridoJoho */ -public class ExtractableItems implements IItemHandler -{ +public class ExtractableItems implements IItemHandler { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!playable.isPlayer()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } @@ -49,40 +46,31 @@ public class ExtractableItems implements IItemHandler final L2PcInstance activeChar = playable.getActingPlayer(); final L2EtcItem etcitem = (L2EtcItem) item.getItem(); final List<L2ExtractableProduct> exitem = etcitem.getExtractableItems(); - if (exitem == null) - { + if (exitem == null) { _log.info("No extractable data defined for " + etcitem); return false; } // destroy item - if (!activeChar.destroyItem("Extract", item.getObjectId(), 1, activeChar, true)) - { + if (!activeChar.destroyItem("Extract", item.getObjectId(), 1, activeChar, true)) { return false; } boolean created = false; - for (L2ExtractableProduct expi : exitem) - { - if (Rnd.get(100000) <= expi.getChance()) - { + for (L2ExtractableProduct expi : exitem) { + if (Rnd.get(100000) <= expi.getChance()) { final int min = (int) (expi.getMin() * rates().getRateExtractable()); final int max = (int) (expi.getMax() * rates().getRateExtractable()); int createItemAmount = (max == min) ? min : (Rnd.get((max - min) + 1) + min); - if (createItemAmount == 0) - { + if (createItemAmount == 0) { continue; } - if (item.isStackable() || (createItemAmount == 1)) - { + if (item.isStackable() || (createItemAmount == 1)) { activeChar.addItem("Extract", expi.getId(), createItemAmount, activeChar, true); - } - else - { - while (createItemAmount > 0) - { + } else { + while (createItemAmount > 0) { activeChar.addItem("Extract", expi.getId(), 1, activeChar, true); createItemAmount--; } @@ -91,8 +79,7 @@ public class ExtractableItems implements IItemHandler } } - if (!created) - { + if (!created) { activeChar.sendPacket(SystemMessageId.NOTHING_INSIDE_THAT); } return true; diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/FishShots.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/FishShots.java index e8cc7dcc0c..9ee33bc685 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/FishShots.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/FishShots.java @@ -37,13 +37,10 @@ import com.l2jserver.gameserver.util.Broadcast; /** * @author -Nemesiss- */ -public class FishShots implements IItemHandler -{ +public class FishShots implements IItemHandler { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!playable.isPlayer()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } @@ -52,35 +49,30 @@ public class FishShots implements IItemHandler final L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance(); final L2Weapon weaponItem = activeChar.getActiveWeaponItem(); - if ((weaponInst == null) || (weaponItem.getItemType() != WeaponType.FISHINGROD)) - { + if ((weaponInst == null) || (weaponItem.getItemType() != WeaponType.FISHINGROD)) { return false; } - if (activeChar.isChargedShot(ShotType.FISH_SOULSHOTS)) - { + if (activeChar.isChargedShot(ShotType.FISH_SOULSHOTS)) { return false; } final long count = item.getCount(); final SkillHolder[] skills = item.getItem().getSkills(); - if (skills == null) - { + if (skills == null) { _log.log(Level.WARNING, getClass().getSimpleName() + ": is missing skills!"); return false; } boolean gradeCheck = item.isEtcItem() && (item.getEtcItem().getDefaultAction() == ActionType.FISHINGSHOT) && (weaponInst.getItem().getItemGradeSPlus() == item.getItem().getItemGradeSPlus()); - if (!gradeCheck) - { + if (!gradeCheck) { activeChar.sendPacket(SystemMessageId.WRONG_FISHINGSHOT_GRADE); return false; } - if (count < 1) - { + if (count < 1) { return false; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Harvester.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Harvester.java index 4120f2c32f..9d84173248 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Harvester.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Harvester.java @@ -33,39 +33,31 @@ import com.l2jserver.gameserver.network.serverpackets.ActionFailed; /** * @author l3x */ -public final class Harvester implements IItemHandler -{ +public final class Harvester implements IItemHandler { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!general().allowManor()) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!general().allowManor()) { return false; - } - else if (!playable.isPlayer()) - { + } else if (!playable.isPlayer()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } final SkillHolder[] skills = item.getItem().getSkills(); - if (skills == null) - { + if (skills == null) { _log.warning(getClass().getSimpleName() + ": is missing skills!"); return false; } final L2PcInstance activeChar = playable.getActingPlayer(); final L2Object target = activeChar.getTarget(); - if ((target == null) || !target.isMonster() || !((L2Character) target).isDead()) - { + if ((target == null) || !target.isMonster() || !((L2Character) target).isDead()) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); activeChar.sendPacket(ActionFailed.STATIC_PACKET); return false; } - for (SkillHolder sk : skills) - { + for (SkillHolder sk : skills) { activeChar.useMagic(sk.getSkill(), false, false); } return true; diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/ItemSkills.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/ItemSkills.java index 0588df2cb8..c65fed80f2 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/ItemSkills.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/ItemSkills.java @@ -26,14 +26,11 @@ import com.l2jserver.gameserver.network.SystemMessageId; /** * Item skills not allowed on Olympiad. */ -public class ItemSkills extends ItemSkillsTemplate -{ +public class ItemSkills extends ItemSkillsTemplate { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { final L2PcInstance activeChar = playable.getActingPlayer(); - if ((activeChar != null) && activeChar.isInOlympiadMode()) - { + if ((activeChar != null) && activeChar.isInOlympiadMode()) { activeChar.sendPacket(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT); return false; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/ItemSkillsTemplate.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/ItemSkillsTemplate.java index c21e48cc16..adbded2853 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/ItemSkillsTemplate.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/ItemSkillsTemplate.java @@ -33,113 +33,90 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Template for item skills handler. * @author Zoey76 */ -public class ItemSkillsTemplate implements IItemHandler -{ +public class ItemSkillsTemplate implements IItemHandler { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer() && !playable.isPet()) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!playable.isPlayer() && !playable.isPet()) { return false; } - if (!TvTEvent.onScrollUse(playable.getObjectId())) - { + if (!TvTEvent.onScrollUse(playable.getObjectId())) { playable.sendPacket(ActionFailed.STATIC_PACKET); return false; } // Pets can use items only when they are tradable. - if (playable.isPet() && !item.isTradeable()) - { + if (playable.isPet() && !item.isTradeable()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } // Verify that item is not under reuse. - if (!checkReuse(playable, null, item)) - { + if (!checkReuse(playable, null, item)) { return false; } final SkillHolder[] skills = item.getEtcItem().getSkills(); - if (skills == null) - { + if (skills == null) { _log.info("Item " + item + " does not have registered any skill for handler."); return false; } boolean hasConsumeSkill = false; - for (SkillHolder skillInfo : skills) - { - if (skillInfo == null) - { + for (SkillHolder skillInfo : skills) { + if (skillInfo == null) { continue; } Skill itemSkill = skillInfo.getSkill(); - if (itemSkill != null) - { - if (itemSkill.getItemConsumeId() > 0) - { + if (itemSkill != null) { + if (itemSkill.getItemConsumeId() > 0) { hasConsumeSkill = true; } - if (!itemSkill.checkCondition(playable, playable.getTarget(), false)) - { + if (!itemSkill.checkCondition(playable, playable.getTarget(), false)) { return false; } - if (playable.isSkillDisabled(itemSkill)) - { + if (playable.isSkillDisabled(itemSkill)) { return false; } // Verify that skill is not under reuse. - if (!checkReuse(playable, itemSkill, item)) - { + if (!checkReuse(playable, itemSkill, item)) { return false; } - if (!item.isPotion() && !item.isElixir() && !item.isScroll() && playable.isCastingNow()) - { + if (!item.isPotion() && !item.isElixir() && !item.isScroll() && playable.isCastingNow()) { return false; } // Send message to the master. - if (playable.isPet()) - { + if (playable.isPet()) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.PET_USES_S1); sm.addSkillName(itemSkill); playable.sendPacket(sm); } - if (itemSkill.isSimultaneousCast() || ((item.getItem().hasImmediateEffect() || item.getItem().hasExImmediateEffect()) && itemSkill.isStatic())) - { + if (itemSkill.isSimultaneousCast() || ((item.getItem().hasImmediateEffect() || item.getItem().hasExImmediateEffect()) && itemSkill.isStatic())) { playable.doSimultaneousCast(itemSkill); - } - else - { + } else { playable.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); - if (!playable.useMagic(itemSkill, forceUse, false)) - { + if (!playable.useMagic(itemSkill, forceUse, false)) { return false; } } - if (itemSkill.getReuseDelay() > 0) - { + if (itemSkill.getReuseDelay() > 0) { playable.addTimeStamp(itemSkill, itemSkill.getReuseDelay()); } } } - if (checkConsume(item, hasConsumeSkill)) - { - if (!playable.destroyItem("Consume", item.getObjectId(), 1, playable, false)) - { + if (checkConsume(item, hasConsumeSkill)) { + if (!playable.destroyItem("Consume", item.getObjectId(), 1, playable, false)) { playable.sendPacket(SystemMessageId.NOT_ENOUGH_ITEMS); return false; } @@ -153,16 +130,12 @@ public class ItemSkillsTemplate implements IItemHandler * @param hasConsumeSkill * @return {@code true} check if item use consume item, {@code false} otherwise */ - private boolean checkConsume(L2ItemInstance item, boolean hasConsumeSkill) - { + private boolean checkConsume(L2ItemInstance item, boolean hasConsumeSkill) { - switch (item.getItem().getDefaultAction()) - { + switch (item.getItem().getDefaultAction()) { case CAPSULE: - case SKILL_REDUCE: - { - if (!hasConsumeSkill && item.getItem().hasImmediateEffect()) - { + case SKILL_REDUCE: { + if (!hasConsumeSkill && item.getItem().hasImmediateEffect()) { return true; } } @@ -176,54 +149,37 @@ public class ItemSkillsTemplate implements IItemHandler * @param item the item being used * @return {@code true} if the the item or skill to check is available, {@code false} otherwise */ - private boolean checkReuse(L2Playable playable, Skill skill, L2ItemInstance item) - { + private boolean checkReuse(L2Playable playable, Skill skill, L2ItemInstance item) { final long remainingTime = (skill != null) ? playable.getSkillRemainingReuseTime(skill.getReuseHashCode()) : playable.getItemRemainingReuseTime(item.getObjectId()); final boolean isAvailable = remainingTime <= 0; - if (playable.isPlayer()) - { - if (!isAvailable) - { + if (playable.isPlayer()) { + if (!isAvailable) { final int hours = (int) (remainingTime / 3600000L); final int minutes = (int) (remainingTime % 3600000L) / 60000; final int seconds = (int) ((remainingTime / 1000) % 60); SystemMessage sm = null; - if (hours > 0) - { + if (hours > 0) { sm = SystemMessage.getSystemMessage(SystemMessageId.S2_HOURS_S3_MINUTES_S4_SECONDS_REMAINING_FOR_REUSE_S1); - if ((skill == null) || skill.isStatic()) - { + if ((skill == null) || skill.isStatic()) { sm.addItemName(item); - } - else - { + } else { sm.addSkillName(skill); } sm.addInt(hours); sm.addInt(minutes); - } - else if (minutes > 0) - { + } else if (minutes > 0) { sm = SystemMessage.getSystemMessage(SystemMessageId.S2_MINUTES_S3_SECONDS_REMAINING_FOR_REUSE_S1); - if ((skill == null) || skill.isStatic()) - { + if ((skill == null) || skill.isStatic()) { sm.addItemName(item); - } - else - { + } else { sm.addSkillName(skill); } sm.addInt(minutes); - } - else - { + } else { sm = SystemMessage.getSystemMessage(SystemMessageId.S2_SECONDS_REMAINING_FOR_REUSE_S1); - if ((skill == null) || skill.isStatic()) - { + if ((skill == null) || skill.isStatic()) { sm.addItemName(item); - } - else - { + } else { sm.addSkillName(skill); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/ManaPotion.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/ManaPotion.java index 7a50b4cb84..4a3ed6d5ef 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/ManaPotion.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/ManaPotion.java @@ -24,13 +24,10 @@ import com.l2jserver.gameserver.model.actor.L2Playable; import com.l2jserver.gameserver.model.items.instance.L2ItemInstance; import com.l2jserver.gameserver.network.SystemMessageId; -public class ManaPotion extends ItemSkills -{ +public class ManaPotion extends ItemSkills { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!customs().enableManaPotionSupport()) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!customs().enableManaPotionSupport()) { playable.sendPacket(SystemMessageId.NOTHING_HAPPENED); return false; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Maps.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Maps.java index 5e241dc2be..cf03e108f8 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Maps.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Maps.java @@ -27,13 +27,10 @@ import com.l2jserver.gameserver.network.serverpackets.ShowMiniMap; /** * This class provides handling for items that should display a map when double clicked. */ -public class Maps implements IItemHandler -{ +public class Maps implements IItemHandler { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!playable.isPlayer()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/MercTicket.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/MercTicket.java index 0a2e9b5c49..cc64ef3182 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/MercTicket.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/MercTicket.java @@ -28,17 +28,14 @@ import com.l2jserver.gameserver.model.entity.Castle; import com.l2jserver.gameserver.model.items.instance.L2ItemInstance; import com.l2jserver.gameserver.network.SystemMessageId; -public class MercTicket implements IItemHandler -{ +public class MercTicket implements IItemHandler { /** * handler for using mercenary tickets. Things to do: 1) Check constraints: 1.a) Tickets may only be used in a castle 1.b) Only specific tickets may be used in each castle (different tickets for each castle) 1.c) only the owner of that castle may use them 1.d) tickets cannot be used during siege * 1.e) Check if max number of tickets has been reached 1.f) Check if max number of tickets from this ticket's TYPE has been reached 2) If allowed, call the MercTicketManager to add the item and spawn in the world 3) Remove the item from the person's inventory */ @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!playable.isPlayer()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } @@ -47,76 +44,58 @@ public class MercTicket implements IItemHandler L2PcInstance activeChar = (L2PcInstance) playable; Castle castle = CastleManager.getInstance().getCastle(activeChar); int castleId = -1; - if (castle != null) - { + if (castle != null) { castleId = castle.getResidenceId(); } // add check that certain tickets can only be placed in certain castles - if (MercTicketManager.getInstance().getTicketCastleId(itemId) != castleId) - { + if (MercTicketManager.getInstance().getTicketCastleId(itemId) != castleId) { activeChar.sendPacket(SystemMessageId.MERCENARIES_CANNOT_BE_POSITIONED_HERE); return false; - } - else if (!activeChar.isCastleLord(castleId)) - { + } else if (!activeChar.isCastleLord(castleId)) { activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_AUTHORITY_TO_POSITION_MERCENARIES); return false; - } - else if ((castle != null) && castle.getSiege().isInProgress()) - { + } else if ((castle != null) && castle.getSiege().isInProgress()) { activeChar.sendPacket(SystemMessageId.THIS_MERCENARY_CANNOT_BE_POSITIONED_ANYMORE); return false; } // Checking Seven Signs Quest Period - if (SevenSigns.getInstance().getCurrentPeriod() != SevenSigns.PERIOD_SEAL_VALIDATION) - { + if (SevenSigns.getInstance().getCurrentPeriod() != SevenSigns.PERIOD_SEAL_VALIDATION) { // _log.warning("Someone has tried to spawn a guardian during Quest Event Period of The Seven Signs."); activeChar.sendPacket(SystemMessageId.THIS_MERCENARY_CANNOT_BE_POSITIONED_ANYMORE); return false; } // Checking the Seal of Strife status - switch (SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_STRIFE)) - { - case SevenSigns.CABAL_NULL: - { - if (SevenSigns.getInstance().checkIsDawnPostingTicket(itemId)) - { + switch (SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_STRIFE)) { + case SevenSigns.CABAL_NULL: { + if (SevenSigns.getInstance().checkIsDawnPostingTicket(itemId)) { // _log.warning("Someone has tried to spawn a Dawn Mercenary though the Seal of Strife is not controlled by anyone."); activeChar.sendPacket(SystemMessageId.THIS_MERCENARY_CANNOT_BE_POSITIONED_ANYMORE); return false; } break; } - case SevenSigns.CABAL_DUSK: - { - if (!SevenSigns.getInstance().checkIsRookiePostingTicket(itemId)) - { + case SevenSigns.CABAL_DUSK: { + if (!SevenSigns.getInstance().checkIsRookiePostingTicket(itemId)) { // _log.warning("Someone has tried to spawn a non-Rookie Mercenary though the Seal of Strife is controlled by Revolutionaries of Dusk."); activeChar.sendPacket(SystemMessageId.THIS_MERCENARY_CANNOT_BE_POSITIONED_ANYMORE); return false; } break; } - case SevenSigns.CABAL_DAWN: - { + case SevenSigns.CABAL_DAWN: { break; } } - if (MercTicketManager.getInstance().isAtCasleLimit(item.getId())) - { + if (MercTicketManager.getInstance().isAtCasleLimit(item.getId())) { activeChar.sendPacket(SystemMessageId.THIS_MERCENARY_CANNOT_BE_POSITIONED_ANYMORE); return false; - } - else if (MercTicketManager.getInstance().isAtTypeLimit(item.getId())) - { + } else if (MercTicketManager.getInstance().isAtTypeLimit(item.getId())) { activeChar.sendPacket(SystemMessageId.THIS_MERCENARY_CANNOT_BE_POSITIONED_ANYMORE); return false; - } - else if (MercTicketManager.getInstance().isTooCloseToAnotherTicket(activeChar.getX(), activeChar.getY(), activeChar.getZ())) - { + } else if (MercTicketManager.getInstance().isTooCloseToAnotherTicket(activeChar.getX(), activeChar.getY(), activeChar.getZ())) { activeChar.sendPacket(SystemMessageId.POSITIONING_CANNOT_BE_DONE_BECAUSE_DISTANCE_BETWEEN_MERCENARIES_TOO_SHORT); return false; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/NicknameColor.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/NicknameColor.java index 5fb5c3fbf2..41e0e83152 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/NicknameColor.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/NicknameColor.java @@ -24,13 +24,10 @@ import com.l2jserver.gameserver.model.items.instance.L2ItemInstance; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.ExRequestChangeNicknameColor; -public class NicknameColor implements IItemHandler -{ +public class NicknameColor implements IItemHandler { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!playable.isPlayer()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/PetFood.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/PetFood.java index 8050f608f8..36f48e6a08 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/PetFood.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/PetFood.java @@ -36,58 +36,43 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; /** * @author Kerberos, Zoey76 */ -public class PetFood implements IItemHandler -{ +public class PetFood implements IItemHandler { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (playable.isPet() && !((L2PetInstance) playable).canEatFoodId(item.getId())) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (playable.isPet() && !((L2PetInstance) playable).canEatFoodId(item.getId())) { playable.sendPacket(SystemMessageId.PET_CANNOT_USE_ITEM); return false; } final SkillHolder[] skills = item.getItem().getSkills(); - if (skills != null) - { - for (SkillHolder sk : skills) - { + if (skills != null) { + for (SkillHolder sk : skills) { useFood(playable, sk.getSkillId(), sk.getSkillLvl(), item); } } return true; } - public boolean useFood(L2Playable activeChar, int skillId, int skillLevel, L2ItemInstance item) - { + public boolean useFood(L2Playable activeChar, int skillId, int skillLevel, L2ItemInstance item) { final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); - if (skill != null) - { - if (activeChar.isPet()) - { + if (skill != null) { + if (activeChar.isPet()) { final L2PetInstance pet = (L2PetInstance) activeChar; - if (pet.destroyItem("Consume", item.getObjectId(), 1, null, false)) - { + if (pet.destroyItem("Consume", item.getObjectId(), 1, null, false)) { pet.broadcastPacket(new MagicSkillUse(pet, pet, skillId, skillLevel, 0, 0)); skill.applyEffects(pet, pet); pet.broadcastStatusUpdate(); - if (pet.isHungry()) - { + if (pet.isHungry()) { pet.sendPacket(SystemMessageId.YOUR_PET_ATE_A_LITTLE_BUT_IS_STILL_HUNGRY); } return true; } - } - else if (activeChar.isPlayer()) - { + } else if (activeChar.isPlayer()) { final L2PcInstance player = activeChar.getActingPlayer(); - if (player.isMounted()) - { + if (player.isMounted()) { final List<Integer> foodIds = PetDataTable.getInstance().getPetData(player.getMountNpcId()).getFood(); - if (foodIds.contains(Integer.valueOf(item.getId()))) - { - if (player.destroyItem("Consume", item.getObjectId(), 1, null, false)) - { + if (foodIds.contains(Integer.valueOf(item.getId()))) { + if (player.destroyItem("Consume", item.getObjectId(), 1, null, false)) { player.broadcastPacket(new MagicSkillUse(player, player, skillId, skillLevel, 0, 0)); skill.applyEffects(player, player); return true; diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Recipes.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Recipes.java index aefdaceb86..ccc5cae904 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Recipes.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Recipes.java @@ -30,32 +30,26 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; /** * @author Zoey76 */ -public class Recipes implements IItemHandler -{ +public class Recipes implements IItemHandler { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!playable.isPlayer()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } final L2PcInstance activeChar = playable.getActingPlayer(); - if (activeChar.isInCraftMode()) - { + if (activeChar.isInCraftMode()) { activeChar.sendPacket(SystemMessageId.CANT_ALTER_RECIPEBOOK_WHILE_CRAFTING); return false; } final L2RecipeList rp = RecipeData.getInstance().getRecipeByItemId(item.getId()); - if (rp == null) - { + if (rp == null) { return false; } - if (activeChar.hasRecipeList(rp.getId())) - { + if (activeChar.hasRecipeList(rp.getId())) { activeChar.sendPacket(SystemMessageId.RECIPE_ALREADY_REGISTERED); return false; } @@ -63,45 +57,36 @@ public class Recipes implements IItemHandler boolean canCraft = false; boolean recipeLevel = false; boolean recipeLimit = false; - if (rp.isDwarvenRecipe()) - { + if (rp.isDwarvenRecipe()) { canCraft = activeChar.hasDwarvenCraft(); recipeLevel = (rp.getLevel() > activeChar.getDwarvenCraft()); recipeLimit = (activeChar.getDwarvenRecipeBook().length >= activeChar.getDwarfRecipeLimit()); - } - else - { + } else { canCraft = activeChar.hasCommonCraft(); recipeLevel = (rp.getLevel() > activeChar.getCommonCraft()); recipeLimit = (activeChar.getCommonRecipeBook().length >= activeChar.getCommonRecipeLimit()); } - if (!canCraft) - { + if (!canCraft) { activeChar.sendPacket(SystemMessageId.CANT_REGISTER_NO_ABILITY_TO_CRAFT); return false; } - if (recipeLevel) - { + if (recipeLevel) { activeChar.sendPacket(SystemMessageId.CREATE_LVL_TOO_LOW_TO_REGISTER); return false; } - if (recipeLimit) - { + if (recipeLimit) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.UP_TO_S1_RECIPES_CAN_REGISTER); sm.addInt(rp.isDwarvenRecipe() ? activeChar.getDwarfRecipeLimit() : activeChar.getCommonRecipeLimit()); activeChar.sendPacket(sm); return false; } - if (rp.isDwarvenRecipe()) - { + if (rp.isDwarvenRecipe()) { activeChar.registerDwarvenRecipeList(rp, true); - } - else - { + } else { activeChar.registerCommonRecipeList(rp, true); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/RollingDice.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/RollingDice.java index 06aed8047d..ddd0178556 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/RollingDice.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/RollingDice.java @@ -29,13 +29,10 @@ import com.l2jserver.gameserver.network.serverpackets.Dice; import com.l2jserver.gameserver.network.serverpackets.SystemMessage; import com.l2jserver.gameserver.util.Broadcast; -public class RollingDice implements IItemHandler -{ +public class RollingDice implements IItemHandler { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!playable.isPlayer()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } @@ -43,15 +40,13 @@ public class RollingDice implements IItemHandler L2PcInstance activeChar = playable.getActingPlayer(); int itemId = item.getId(); - if (activeChar.isInOlympiadMode()) - { + if (activeChar.isInOlympiadMode()) { activeChar.sendPacket(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT); return false; } int number = rollDice(activeChar); - if (number == 0) - { + if (number == 0) { activeChar.sendPacket(SystemMessageId.YOU_MAY_NOT_THROW_THE_DICE_AT_THIS_TIME_TRY_AGAIN_LATER); return false; } @@ -63,11 +58,9 @@ public class RollingDice implements IItemHandler sm.addInt(number); activeChar.sendPacket(sm); - if (activeChar.isInsideZone(ZoneId.PEACE)) - { + if (activeChar.isInsideZone(ZoneId.PEACE)) { Broadcast.toKnownPlayers(activeChar, sm); - } - else if (activeChar.isInParty()) // TODO: Verify this! + } else if (activeChar.isInParty()) // TODO: Verify this! { activeChar.getParty().broadcastToPartyMembers(activeChar, sm); } @@ -79,11 +72,9 @@ public class RollingDice implements IItemHandler * @param player * @return */ - private int rollDice(L2PcInstance player) - { + private int rollDice(L2PcInstance player) { // Check if the dice is ready - if (!player.getFloodProtectors().getRollDice().tryPerformAction("roll dice")) - { + if (!player.getFloodProtectors().getRollDice().tryPerformAction("roll dice")) { return 0; } return Rnd.get(1, 6); diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Seed.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Seed.java index 4112f25d36..86f4063127 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Seed.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/Seed.java @@ -37,55 +37,41 @@ import com.l2jserver.gameserver.network.serverpackets.ActionFailed; /** * @author l3x */ -public class Seed implements IItemHandler -{ +public class Seed implements IItemHandler { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!general().allowManor()) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!general().allowManor()) { return false; - } - else if (!playable.isPlayer()) - { + } else if (!playable.isPlayer()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } final L2Object tgt = playable.getTarget(); - if (tgt == null) - { + if (tgt == null) { return false; } - if (!tgt.isNpc()) - { + if (!tgt.isNpc()) { playable.sendPacket(SystemMessageId.INCORRECT_TARGET); return false; - } - else if (!tgt.isMonster() || ((L2MonsterInstance) tgt).isRaid() || (tgt instanceof L2ChestInstance)) - { + } else if (!tgt.isMonster() || ((L2MonsterInstance) tgt).isRaid() || (tgt instanceof L2ChestInstance)) { playable.sendPacket(SystemMessageId.THE_TARGET_IS_UNAVAILABLE_FOR_SEEDING); return false; } final L2MonsterInstance target = (L2MonsterInstance) tgt; - if (target.isDead()) - { + if (target.isDead()) { playable.sendPacket(SystemMessageId.INCORRECT_TARGET); return false; - } - else if (target.isSeeded()) - { + } else if (target.isSeeded()) { playable.sendPacket(ActionFailed.STATIC_PACKET); return false; } final L2Seed seed = CastleManorManager.getInstance().getSeed(item.getId()); - if (seed == null) - { + if (seed == null) { return false; - } - else if (seed.getCastleId() != MapRegionManager.getInstance().getAreaCastle(playable)) // TODO: replace me with tax zone + } else if (seed.getCastleId() != MapRegionManager.getInstance().getAreaCastle(playable)) // TODO: replace me with tax zone { playable.sendPacket(SystemMessageId.THIS_SEED_MAY_NOT_BE_SOWN_HERE); return false; @@ -95,10 +81,8 @@ public class Seed implements IItemHandler target.setSeeded(seed, activeChar); final SkillHolder[] skills = item.getItem().getSkills(); - if (skills != null) - { - for (SkillHolder sk : skills) - { + if (skills != null) { + for (SkillHolder sk : skills) { activeChar.useMagic(sk.getSkill(), false, false); } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/SevenSignsRecord.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/SevenSignsRecord.java index d34a64ae73..aedc7e5810 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/SevenSignsRecord.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/SevenSignsRecord.java @@ -28,13 +28,10 @@ import com.l2jserver.gameserver.network.serverpackets.SSQStatus; * Item Handler for Seven Signs Record * @author Tempy */ -public class SevenSignsRecord implements IItemHandler -{ +public class SevenSignsRecord implements IItemHandler { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!playable.isPlayer()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/SoulShots.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/SoulShots.java index 02c282103c..e5fbc70e2e 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/SoulShots.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/SoulShots.java @@ -34,13 +34,10 @@ import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse; import com.l2jserver.gameserver.network.serverpackets.SystemMessage; import com.l2jserver.gameserver.util.Broadcast; -public class SoulShots implements IItemHandler -{ +public class SoulShots implements IItemHandler { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!playable.isPlayer()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } @@ -52,17 +49,14 @@ public class SoulShots implements IItemHandler int itemId = item.getId(); - if (skills == null) - { + if (skills == null) { _log.log(Level.WARNING, getClass().getSimpleName() + ": is missing skills!"); return false; } // Check if Soul shot can be used - if ((weaponInst == null) || (weaponItem.getSoulShotCount() == 0)) - { - if (!activeChar.getAutoSoulShot().contains(itemId)) - { + if ((weaponInst == null) || (weaponItem.getSoulShotCount() == 0)) { + if (!activeChar.getAutoSoulShot().contains(itemId)) { activeChar.sendPacket(SystemMessageId.CANNOT_USE_SOULSHOTS); } return false; @@ -70,44 +64,35 @@ public class SoulShots implements IItemHandler boolean gradeCheck = item.isEtcItem() && (item.getEtcItem().getDefaultAction() == ActionType.SOULSHOT) && (weaponInst.getItem().getItemGradeSPlus() == item.getItem().getItemGradeSPlus()); - if (!gradeCheck) - { - if (!activeChar.getAutoSoulShot().contains(itemId)) - { + if (!gradeCheck) { + if (!activeChar.getAutoSoulShot().contains(itemId)) { activeChar.sendPacket(SystemMessageId.SOULSHOTS_GRADE_MISMATCH); } return false; } activeChar.soulShotLock.lock(); - try - { + try { // Check if Soul shot is already active - if (activeChar.isChargedShot(ShotType.SOULSHOTS)) - { + if (activeChar.isChargedShot(ShotType.SOULSHOTS)) { return false; } // Consume Soul shots if player has enough of them int SSCount = weaponItem.getSoulShotCount(); - if ((weaponItem.getReducedSoulShot() > 0) && (Rnd.get(100) < weaponItem.getReducedSoulShotChance())) - { + if ((weaponItem.getReducedSoulShot() > 0) && (Rnd.get(100) < weaponItem.getReducedSoulShotChance())) { SSCount = weaponItem.getReducedSoulShot(); } - if (!activeChar.destroyItemWithoutTrace("Consume", item.getObjectId(), SSCount, null, false)) - { - if (!activeChar.disableAutoShot(itemId)) - { + if (!activeChar.destroyItemWithoutTrace("Consume", item.getObjectId(), SSCount, null, false)) { + if (!activeChar.disableAutoShot(itemId)) { activeChar.sendPacket(SystemMessageId.NOT_ENOUGH_SOULSHOTS); } return false; } // Charge soul shot weaponInst.setChargedShot(ShotType.SOULSHOTS, true); - } - finally - { + } finally { activeChar.soulShotLock.unlock(); } diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/SpecialXMas.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/SpecialXMas.java index c17ec32a47..53303230e0 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/SpecialXMas.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/SpecialXMas.java @@ -27,13 +27,10 @@ import com.l2jserver.gameserver.network.serverpackets.ShowXMasSeal; /** * @author devScarlet, mrTJO */ -public class SpecialXMas implements IItemHandler -{ +public class SpecialXMas implements IItemHandler { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!playable.isPlayer()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/SpiritShot.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/SpiritShot.java index 612e20f0f4..8faf5ac90c 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/SpiritShot.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/SpiritShot.java @@ -33,13 +33,10 @@ import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse; import com.l2jserver.gameserver.network.serverpackets.SystemMessage; import com.l2jserver.gameserver.util.Broadcast; -public class SpiritShot implements IItemHandler -{ +public class SpiritShot implements IItemHandler { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!playable.isPlayer()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } @@ -51,34 +48,28 @@ public class SpiritShot implements IItemHandler int itemId = item.getId(); - if (skills == null) - { + if (skills == null) { _log.log(Level.WARNING, getClass().getSimpleName() + ": is missing skills!"); return false; } // Check if Spirit shot can be used - if ((weaponInst == null) || (weaponItem.getSpiritShotCount() == 0)) - { - if (!activeChar.getAutoSoulShot().contains(itemId)) - { + if ((weaponInst == null) || (weaponItem.getSpiritShotCount() == 0)) { + if (!activeChar.getAutoSoulShot().contains(itemId)) { activeChar.sendPacket(SystemMessageId.CANNOT_USE_SPIRITSHOTS); } return false; } // Check if Spirit shot is already active - if (activeChar.isChargedShot(ShotType.SPIRITSHOTS)) - { + if (activeChar.isChargedShot(ShotType.SPIRITSHOTS)) { return false; } boolean gradeCheck = item.isEtcItem() && (item.getEtcItem().getDefaultAction() == ActionType.SPIRITSHOT) && (weaponInst.getItem().getItemGradeSPlus() == item.getItem().getItemGradeSPlus()); - if (!gradeCheck) - { - if (!activeChar.getAutoSoulShot().contains(itemId)) - { + if (!gradeCheck) { + if (!activeChar.getAutoSoulShot().contains(itemId)) { activeChar.sendPacket(SystemMessageId.SPIRITSHOTS_GRADE_MISMATCH); } @@ -86,10 +77,8 @@ public class SpiritShot implements IItemHandler } // Consume Spirit shot if player has enough of them - if (!activeChar.destroyItemWithoutTrace("Consume", item.getObjectId(), weaponItem.getSpiritShotCount(), null, false)) - { - if (!activeChar.disableAutoShot(itemId)) - { + if (!activeChar.destroyItemWithoutTrace("Consume", item.getObjectId(), weaponItem.getSpiritShotCount(), null, false)) { + if (!activeChar.disableAutoShot(itemId)) { activeChar.sendPacket(SystemMessageId.NOT_ENOUGH_SPIRITSHOTS); } return false; diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/SummonItems.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/SummonItems.java index 483a200bb9..45080869c1 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/SummonItems.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/SummonItems.java @@ -30,49 +30,40 @@ import com.l2jserver.gameserver.network.SystemMessageId; /** * @author HorridoJoho, UnAfraid */ -public class SummonItems extends ItemSkillsTemplate -{ +public class SummonItems extends ItemSkillsTemplate { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!playable.isPlayer()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } - if (!TvTEvent.onItemSummon(playable.getObjectId())) - { + if (!TvTEvent.onItemSummon(playable.getObjectId())) { return false; } final L2PcInstance activeChar = playable.getActingPlayer(); - if (!activeChar.getFloodProtectors().getItemPetSummon().tryPerformAction("summon items") || (activeChar.getBlockCheckerArena() != -1) || activeChar.inObserverMode() || activeChar.isAllSkillsDisabled() || activeChar.isCastingNow()) - { + if (!activeChar.getFloodProtectors().getItemPetSummon().tryPerformAction("summon items") || (activeChar.getBlockCheckerArena() != -1) || activeChar.inObserverMode() || activeChar.isAllSkillsDisabled() || activeChar.isCastingNow()) { return false; } - if (activeChar.isSitting()) - { + if (activeChar.isSitting()) { activeChar.sendPacket(SystemMessageId.CANT_MOVE_SITTING); return false; } - if (activeChar.hasSummon() || activeChar.isMounted()) - { + if (activeChar.hasSummon() || activeChar.isMounted()) { activeChar.sendPacket(SystemMessageId.YOU_ALREADY_HAVE_A_PET); return false; } - if (activeChar.isAttackingNow()) - { + if (activeChar.isAttackingNow()) { activeChar.sendPacket(SystemMessageId.YOU_CANNOT_SUMMON_IN_COMBAT); return false; } final L2PetData petData = PetDataTable.getInstance().getPetDataByItemId(item.getId()); - if ((petData == null) || (petData.getNpcId() == -1)) - { + if ((petData == null) || (petData.getNpcId() == -1)) { return false; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/TeleportBookmark.java b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/TeleportBookmark.java index 704759530d..380dc2defc 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/TeleportBookmark.java +++ b/src/main/java/com/l2jserver/datapack/handlers/itemhandlers/TeleportBookmark.java @@ -29,21 +29,17 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Teleport Bookmark Slot Handler * @author ShanSoft */ -public class TeleportBookmark implements IItemHandler -{ +public class TeleportBookmark implements IItemHandler { @Override - public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { + public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse) { + if (!playable.isPlayer()) { playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS); return false; } L2PcInstance player = playable.getActingPlayer(); - if (player.getBookMarkSlot() >= 9) - { + if (player.getBookMarkSlot() >= 9) { player.sendPacket(SystemMessageId.YOUR_NUMBER_OF_MY_TELEPORTS_SLOTS_HAS_REACHED_ITS_MAXIMUM_LIMIT); return false; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/punishmenthandlers/BanHandler.java b/src/main/java/com/l2jserver/datapack/handlers/punishmenthandlers/BanHandler.java index b9c3401ffc..2f2445bcd9 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/punishmenthandlers/BanHandler.java +++ b/src/main/java/com/l2jserver/datapack/handlers/punishmenthandlers/BanHandler.java @@ -30,48 +30,35 @@ import com.l2jserver.gameserver.network.L2GameClient; * This class handles ban punishment. * @author UnAfraid */ -public class BanHandler implements IPunishmentHandler -{ +public class BanHandler implements IPunishmentHandler { @Override - public void onStart(PunishmentTask task) - { - switch (task.getAffect()) - { - case CHARACTER: - { + public void onStart(PunishmentTask task) { + switch (task.getAffect()) { + case CHARACTER: { int objectId = Integer.parseInt(String.valueOf(task.getKey())); final L2PcInstance player = L2World.getInstance().getPlayer(objectId); - if (player != null) - { + if (player != null) { applyToPlayer(player); } break; } - case ACCOUNT: - { + case ACCOUNT: { String account = String.valueOf(task.getKey()); final L2GameClient client = LoginServerThread.getInstance().getClient(account); - if (client != null) - { + if (client != null) { final L2PcInstance player = client.getActiveChar(); - if (player != null) - { + if (player != null) { applyToPlayer(player); - } - else - { + } else { client.closeNow(); } } break; } - case IP: - { + case IP: { String ip = String.valueOf(task.getKey()); - for (L2PcInstance player : L2World.getInstance().getPlayers()) - { - if (player.getIPAddress().equals(ip)) - { + for (L2PcInstance player : L2World.getInstance().getPlayers()) { + if (player.getIPAddress().equals(ip)) { applyToPlayer(player); } } @@ -81,8 +68,7 @@ public class BanHandler implements IPunishmentHandler } @Override - public void onEnd(PunishmentTask task) - { + public void onEnd(PunishmentTask task) { } @@ -90,14 +76,12 @@ public class BanHandler implements IPunishmentHandler * Applies all punishment effects from the player. * @param player */ - private static void applyToPlayer(L2PcInstance player) - { + private static void applyToPlayer(L2PcInstance player) { player.logout(); } @Override - public PunishmentType getType() - { + public PunishmentType getType() { return PunishmentType.BAN; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/punishmenthandlers/ChatBanHandler.java b/src/main/java/com/l2jserver/datapack/handlers/punishmenthandlers/ChatBanHandler.java index e979523958..1992ea0187 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/punishmenthandlers/ChatBanHandler.java +++ b/src/main/java/com/l2jserver/datapack/handlers/punishmenthandlers/ChatBanHandler.java @@ -31,44 +31,33 @@ import com.l2jserver.gameserver.network.serverpackets.EtcStatusUpdate; * This class handles chat ban punishment. * @author UnAfraid */ -public class ChatBanHandler implements IPunishmentHandler -{ +public class ChatBanHandler implements IPunishmentHandler { @Override - public void onStart(PunishmentTask task) - { - switch (task.getAffect()) - { - case CHARACTER: - { + public void onStart(PunishmentTask task) { + switch (task.getAffect()) { + case CHARACTER: { int objectId = Integer.parseInt(String.valueOf(task.getKey())); final L2PcInstance player = L2World.getInstance().getPlayer(objectId); - if (player != null) - { + if (player != null) { applyToPlayer(task, player); } break; } - case ACCOUNT: - { + case ACCOUNT: { String account = String.valueOf(task.getKey()); final L2GameClient client = LoginServerThread.getInstance().getClient(account); - if (client != null) - { + if (client != null) { final L2PcInstance player = client.getActiveChar(); - if (player != null) - { + if (player != null) { applyToPlayer(task, player); } } break; } - case IP: - { + case IP: { String ip = String.valueOf(task.getKey()); - for (L2PcInstance player : L2World.getInstance().getPlayers()) - { - if (player.getIPAddress().equals(ip)) - { + for (L2PcInstance player : L2World.getInstance().getPlayers()) { + if (player.getIPAddress().equals(ip)) { applyToPlayer(task, player); } } @@ -78,41 +67,31 @@ public class ChatBanHandler implements IPunishmentHandler } @Override - public void onEnd(PunishmentTask task) - { - switch (task.getAffect()) - { - case CHARACTER: - { + public void onEnd(PunishmentTask task) { + switch (task.getAffect()) { + case CHARACTER: { int objectId = Integer.parseInt(String.valueOf(task.getKey())); final L2PcInstance player = L2World.getInstance().getPlayer(objectId); - if (player != null) - { + if (player != null) { removeFromPlayer(player); } break; } - case ACCOUNT: - { + case ACCOUNT: { String account = String.valueOf(task.getKey()); final L2GameClient client = LoginServerThread.getInstance().getClient(account); - if (client != null) - { + if (client != null) { final L2PcInstance player = client.getActiveChar(); - if (player != null) - { + if (player != null) { removeFromPlayer(player); } } break; } - case IP: - { + case IP: { String ip = String.valueOf(task.getKey()); - for (L2PcInstance player : L2World.getInstance().getPlayers()) - { - if (player.getIPAddress().equals(ip)) - { + for (L2PcInstance player : L2World.getInstance().getPlayers()) { + if (player.getIPAddress().equals(ip)) { removeFromPlayer(player); } } @@ -126,15 +105,11 @@ public class ChatBanHandler implements IPunishmentHandler * @param task * @param player */ - private static void applyToPlayer(PunishmentTask task, L2PcInstance player) - { + private static void applyToPlayer(PunishmentTask task, L2PcInstance player) { long delay = ((task.getExpirationTime() - System.currentTimeMillis()) / 1000); - if (delay > 0) - { + if (delay > 0) { player.sendMessage("You've been chat banned for " + (delay > 60 ? ((delay / 60) + " minutes.") : delay + " seconds.")); - } - else - { + } else { player.sendMessage("You've been chat banned forever."); } player.sendPacket(new EtcStatusUpdate(player)); @@ -144,15 +119,13 @@ public class ChatBanHandler implements IPunishmentHandler * Removes any punishment effects from the player. * @param player */ - private static void removeFromPlayer(L2PcInstance player) - { + private static void removeFromPlayer(L2PcInstance player) { player.sendMessage("Your Chat ban has been lifted"); player.sendPacket(new EtcStatusUpdate(player)); } @Override - public PunishmentType getType() - { + public PunishmentType getType() { return PunishmentType.CHAT_BAN; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/punishmenthandlers/JailHandler.java b/src/main/java/com/l2jserver/datapack/handlers/punishmenthandlers/JailHandler.java index baa1f5b70f..b32db1b2a1 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/punishmenthandlers/JailHandler.java +++ b/src/main/java/com/l2jserver/datapack/handlers/punishmenthandlers/JailHandler.java @@ -42,63 +42,47 @@ import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; * This class handles jail punishment. * @author UnAfraid */ -public class JailHandler implements IPunishmentHandler -{ - public JailHandler() - { +public class JailHandler implements IPunishmentHandler { + public JailHandler() { // Register global listener Containers.Global().addListener(new ConsumerEventListener(Containers.Global(), EventType.ON_PLAYER_LOGIN, (OnPlayerLogin event) -> onPlayerLogin(event), this)); } - public void onPlayerLogin(OnPlayerLogin event) - { + public void onPlayerLogin(OnPlayerLogin event) { final L2PcInstance activeChar = event.getActiveChar(); - if (activeChar.isJailed() && !activeChar.isInsideZone(ZoneId.JAIL)) - { + if (activeChar.isJailed() && !activeChar.isInsideZone(ZoneId.JAIL)) { applyToPlayer(null, activeChar); - } - else if (!activeChar.isJailed() && activeChar.isInsideZone(ZoneId.JAIL) && !activeChar.isGM()) - { + } else if (!activeChar.isJailed() && activeChar.isInsideZone(ZoneId.JAIL) && !activeChar.isGM()) { removeFromPlayer(activeChar); } } @Override - public void onStart(PunishmentTask task) - { - switch (task.getAffect()) - { - case CHARACTER: - { + public void onStart(PunishmentTask task) { + switch (task.getAffect()) { + case CHARACTER: { int objectId = Integer.parseInt(String.valueOf(task.getKey())); final L2PcInstance player = L2World.getInstance().getPlayer(objectId); - if (player != null) - { + if (player != null) { applyToPlayer(task, player); } break; } - case ACCOUNT: - { + case ACCOUNT: { String account = String.valueOf(task.getKey()); final L2GameClient client = LoginServerThread.getInstance().getClient(account); - if (client != null) - { + if (client != null) { final L2PcInstance player = client.getActiveChar(); - if (player != null) - { + if (player != null) { applyToPlayer(task, player); } } break; } - case IP: - { + case IP: { String ip = String.valueOf(task.getKey()); - for (L2PcInstance player : L2World.getInstance().getPlayers()) - { - if (player.getIPAddress().equals(ip)) - { + for (L2PcInstance player : L2World.getInstance().getPlayers()) { + if (player.getIPAddress().equals(ip)) { applyToPlayer(task, player); } } @@ -108,41 +92,31 @@ public class JailHandler implements IPunishmentHandler } @Override - public void onEnd(PunishmentTask task) - { - switch (task.getAffect()) - { - case CHARACTER: - { + public void onEnd(PunishmentTask task) { + switch (task.getAffect()) { + case CHARACTER: { int objectId = Integer.parseInt(String.valueOf(task.getKey())); final L2PcInstance player = L2World.getInstance().getPlayer(objectId); - if (player != null) - { + if (player != null) { removeFromPlayer(player); } break; } - case ACCOUNT: - { + case ACCOUNT: { String account = String.valueOf(task.getKey()); final L2GameClient client = LoginServerThread.getInstance().getClient(account); - if (client != null) - { + if (client != null) { final L2PcInstance player = client.getActiveChar(); - if (player != null) - { + if (player != null) { removeFromPlayer(player); } } break; } - case IP: - { + case IP: { String ip = String.valueOf(task.getKey()); - for (L2PcInstance player : L2World.getInstance().getPlayers()) - { - if (player.getIPAddress().equals(ip)) - { + for (L2PcInstance player : L2World.getInstance().getPlayers()) { + if (player.getIPAddress().equals(ip)) { removeFromPlayer(player); } } @@ -156,18 +130,15 @@ public class JailHandler implements IPunishmentHandler * @param task * @param player */ - private static void applyToPlayer(PunishmentTask task, L2PcInstance player) - { + private static void applyToPlayer(PunishmentTask task, L2PcInstance player) { player.setInstanceId(0); player.setIsIn7sDungeon(false); - if (!TvTEvent.isInactive() && TvTEvent.isPlayerParticipant(player.getObjectId())) - { + if (!TvTEvent.isInactive() && TvTEvent.isPlayerParticipant(player.getObjectId())) { TvTEvent.removeParticipant(player.getObjectId()); } - if (OlympiadManager.getInstance().isRegisteredInComp(player)) - { + if (OlympiadManager.getInstance().isRegisteredInComp(player)) { OlympiadManager.getInstance().removeDisconnectedCompetitor(player); } @@ -176,26 +147,19 @@ public class JailHandler implements IPunishmentHandler // Open a Html message to inform the player final NpcHtmlMessage msg = new NpcHtmlMessage(); String content = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), "data/html/jail_in.htm"); - if (content != null) - { + if (content != null) { content = content.replaceAll("%reason%", task != null ? task.getReason() : ""); content = content.replaceAll("%punishedBy%", task != null ? task.getPunishedBy() : ""); msg.setHtml(content); - } - else - { + } else { msg.setHtml("<html><body>You have been put in jail by an admin.</body></html>"); } player.sendPacket(msg); - if (task != null) - { + if (task != null) { long delay = ((task.getExpirationTime() - System.currentTimeMillis()) / 1000); - if (delay > 0) - { + if (delay > 0) { player.sendMessage("You've been jailed for " + (delay > 60 ? ((delay / 60) + " minutes.") : delay + " seconds.")); - } - else - { + } else { player.sendMessage("You've been jailed forever."); } } @@ -205,27 +169,22 @@ public class JailHandler implements IPunishmentHandler * Removes any punishment effects from the player. * @param player */ - private static void removeFromPlayer(L2PcInstance player) - { + private static void removeFromPlayer(L2PcInstance player) { ThreadPoolManager.getInstance().scheduleGeneral(new TeleportTask(player, L2JailZone.getLocationOut()), 2000); // Open a Html message to inform the player final NpcHtmlMessage msg = new NpcHtmlMessage(); String content = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), "data/html/jail_out.htm"); - if (content != null) - { + if (content != null) { msg.setHtml(content); - } - else - { + } else { msg.setHtml("<html><body>You are free for now, respect server rules!</body></html>"); } player.sendPacket(msg); } @Override - public PunishmentType getType() - { + public PunishmentType getType() { return PunishmentType.JAIL; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Area.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Area.java index 5e2df84f3e..765be1aa3d 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Area.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Area.java @@ -34,14 +34,11 @@ import com.l2jserver.gameserver.util.Util; /** * @author UnAfraid */ -public class Area implements ITargetTypeHandler -{ +public class Area implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { List<L2Character> targetList = new ArrayList<>(); - if ((target == null) || (((target == activeChar) || target.isAlikeDead()) && (skill.getCastRange() >= 0)) || (!(target.isAttackable() || target.isPlayable()))) - { + if ((target == null) || (((target == activeChar) || target.isAlikeDead()) && (skill.getCastRange() >= 0)) || (!(target.isAttackable() || target.isPlayable()))) { activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT); return EMPTY_TARGET_LIST; } @@ -49,52 +46,40 @@ public class Area implements ITargetTypeHandler final L2Character origin; final boolean srcInArena = (activeChar.isInsideZone(ZoneId.PVP) && !activeChar.isInsideZone(ZoneId.SIEGE)); - if (skill.getCastRange() >= 0) - { - if (!Skill.checkForAreaOffensiveSkills(activeChar, target, skill, srcInArena)) - { + if (skill.getCastRange() >= 0) { + if (!Skill.checkForAreaOffensiveSkills(activeChar, target, skill, srcInArena)) { return EMPTY_TARGET_LIST; } - if (onlyFirst) - { - return new L2Character[] - { + if (onlyFirst) { + return new L2Character[] { target }; } origin = target; targetList.add(origin); // Add target to target list - } - else - { + } else { origin = activeChar; } int maxTargets = skill.getAffectLimit(); final Collection<L2Character> objs = activeChar.getKnownList().getKnownCharacters(); - for (L2Character obj : objs) - { - if (!(obj.isAttackable() || obj.isPlayable())) - { + for (L2Character obj : objs) { + if (!(obj.isAttackable() || obj.isPlayable())) { continue; } - if (obj == origin) - { + if (obj == origin) { continue; } - if (Util.checkIfInRange(skill.getAffectRange(), origin, obj, true)) - { - if (!Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena)) - { + if (Util.checkIfInRange(skill.getAffectRange(), origin, obj, true)) { + if (!Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena)) { continue; } - if ((maxTargets > 0) && (targetList.size() >= maxTargets)) - { + if ((maxTargets > 0) && (targetList.size() >= maxTargets)) { break; } @@ -102,8 +87,7 @@ public class Area implements ITargetTypeHandler } } - if (targetList.isEmpty()) - { + if (targetList.isEmpty()) { return EMPTY_TARGET_LIST; } @@ -111,8 +95,7 @@ public class Area implements ITargetTypeHandler } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.AREA; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/AreaCorpseMob.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/AreaCorpseMob.java index b0312343ee..0a7bfd0b7b 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/AreaCorpseMob.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/AreaCorpseMob.java @@ -34,21 +34,16 @@ import com.l2jserver.gameserver.util.Util; /** * @author UnAfraid */ -public class AreaCorpseMob implements ITargetTypeHandler -{ +public class AreaCorpseMob implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { - if ((target == null) || !target.isAttackable() || !target.isDead()) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { + if ((target == null) || !target.isAttackable() || !target.isDead()) { activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT); return EMPTY_TARGET_LIST; } - if (onlyFirst) - { - return new L2Character[] - { + if (onlyFirst) { + return new L2Character[] { target }; } @@ -58,31 +53,26 @@ public class AreaCorpseMob implements ITargetTypeHandler final boolean srcInArena = activeChar.isInsideZone(ZoneId.PVP) && !activeChar.isInsideZone(ZoneId.SIEGE); final Collection<L2Character> objs = activeChar.getKnownList().getKnownCharacters(); - for (L2Character obj : objs) - { - if (!(obj.isAttackable() || obj.isPlayable()) || !Util.checkIfInRange(skill.getAffectRange(), target, obj, true)) - { + for (L2Character obj : objs) { + if (!(obj.isAttackable() || obj.isPlayable()) || !Util.checkIfInRange(skill.getAffectRange(), target, obj, true)) { continue; } - if (!Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena)) - { + if (!Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena)) { continue; } targetList.add(obj); } - if (targetList.isEmpty()) - { + if (targetList.isEmpty()) { return EMPTY_TARGET_LIST; } return targetList.toArray(new L2Character[targetList.size()]); } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.AREA_CORPSE_MOB; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/AreaFriendly.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/AreaFriendly.java index 1c8617bc15..a1b0e2d68f 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/AreaFriendly.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/AreaFriendly.java @@ -38,53 +38,42 @@ import com.l2jserver.gameserver.network.SystemMessageId; * Area Friendly target handler implementation. * @author Adry_85, Zoey76 */ -public class AreaFriendly implements ITargetTypeHandler -{ +public class AreaFriendly implements ITargetTypeHandler { private static final CharComparator CHAR_COMPARATOR = new CharComparator(); @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { L2PcInstance player = activeChar.getActingPlayer(); - if (!checkTarget(player, target) && (skill.getCastRange() >= 0)) - { + if (!checkTarget(player, target) && (skill.getCastRange() >= 0)) { player.sendPacket(SystemMessageId.TARGET_IS_INCORRECT); return EMPTY_TARGET_LIST; } - if (onlyFirst) - { - return new L2Character[] - { + if (onlyFirst) { + return new L2Character[] { target }; } - if (player.getActingPlayer().isInOlympiadMode()) - { - return new L2Character[] - { + if (player.getActingPlayer().isInOlympiadMode()) { + return new L2Character[] { player }; } final List<L2Character> targetList = new LinkedList<>(); - if (target != null) - { + if (target != null) { // Add target to target list. targetList.add(target); final int maxTargets = skill.getAffectLimit(); - for (L2Character obj : target.getKnownList().getKnownCharactersInRadius(skill.getAffectRange())) - { - if ((maxTargets > 0) && (targetList.size() >= maxTargets)) - { + for (L2Character obj : target.getKnownList().getKnownCharactersInRadius(skill.getAffectRange())) { + if ((maxTargets > 0) && (targetList.size() >= maxTargets)) { break; } - if (!checkTarget(player, obj) || (obj == activeChar)) - { + if (!checkTarget(player, obj) || (obj == activeChar)) { continue; } @@ -95,91 +84,74 @@ public class AreaFriendly implements ITargetTypeHandler Collections.sort(targetList, CHAR_COMPARATOR); } - if (targetList.isEmpty()) - { + if (targetList.isEmpty()) { return EMPTY_TARGET_LIST; } return targetList.toArray(new L2Character[targetList.size()]); } - private boolean checkTarget(L2PcInstance activeChar, L2Character target) - { - if (!GeoData.getInstance().canSeeTarget(activeChar, target)) - { + private boolean checkTarget(L2PcInstance activeChar, L2Character target) { + if (!GeoData.getInstance().canSeeTarget(activeChar, target)) { return false; } - if ((target == null) || target.isAlikeDead() || target.isDoor() || (target instanceof L2SiegeFlagInstance) || target.isMonster()) - { + if ((target == null) || target.isAlikeDead() || target.isDoor() || (target instanceof L2SiegeFlagInstance) || target.isMonster()) { return false; } // GMs and hidden creatures. - if (target.isInvisible()) - { + if (target.isInvisible()) { return false; } - if (target.isPlayable()) - { + if (target.isPlayable()) { L2PcInstance targetPlayer = target.getActingPlayer(); - if (activeChar == targetPlayer) - { + if (activeChar == targetPlayer) { return true; } - if (targetPlayer.inObserverMode() || targetPlayer.isInOlympiadMode()) - { + if (targetPlayer.inObserverMode() || targetPlayer.isInOlympiadMode()) { return false; } - if (activeChar.isInDuelWith(target)) - { + if (activeChar.isInDuelWith(target)) { return false; } - if (activeChar.isInPartyWith(target)) - { + if (activeChar.isInPartyWith(target)) { return true; } // Only siege allies. - if (activeChar.isInSiege() && !activeChar.isOnSameSiegeSideWith(targetPlayer)) - { + if (activeChar.isInSiege() && !activeChar.isOnSameSiegeSideWith(targetPlayer)) { return false; } - if (target.isInsideZone(ZoneId.PVP)) - { + if (target.isInsideZone(ZoneId.PVP)) { return false; } - if (activeChar.isInClanWith(target) || activeChar.isInAllyWith(target) || activeChar.isInCommandChannelWith(target)) - { + if (activeChar.isInClanWith(target) || activeChar.isInAllyWith(target) || activeChar.isInCommandChannelWith(target)) { return true; } - if ((targetPlayer.getPvpFlag() > 0) || (targetPlayer.getKarma() > 0)) - { + if ((targetPlayer.getPvpFlag() > 0) || (targetPlayer.getKarma() > 0)) { return false; } } return true; } - public static class CharComparator implements Comparator<L2Character> - { + public static class CharComparator implements Comparator<L2Character> { @Override - public int compare(L2Character char1, L2Character char2) - { + public int compare(L2Character char1, L2Character char2) { return Double.compare((char1.getCurrentHp() / char1.getMaxHp()), (char2.getCurrentHp() / char2.getMaxHp())); } } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.AREA_FRIENDLY; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/AreaSummon.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/AreaSummon.java index 28202b7c61..f3b0456754 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/AreaSummon.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/AreaSummon.java @@ -33,22 +33,17 @@ import com.l2jserver.gameserver.util.Util; /** * @author UnAfraid */ -public class AreaSummon implements ITargetTypeHandler -{ +public class AreaSummon implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { List<L2Character> targetList = new ArrayList<>(); target = activeChar.getSummon(); - if ((target == null) || !target.isServitor() || target.isDead()) - { + if ((target == null) || !target.isServitor() || target.isDead()) { return EMPTY_TARGET_LIST; } - if (onlyFirst) - { - return new L2Character[] - { + if (onlyFirst) { + return new L2Character[] { target }; } @@ -57,38 +52,31 @@ public class AreaSummon implements ITargetTypeHandler final Collection<L2Character> objs = target.getKnownList().getKnownCharacters(); int maxTargets = skill.getAffectLimit(); - for (L2Character obj : objs) - { - if ((obj == null) || (obj == target) || (obj == activeChar)) - { + for (L2Character obj : objs) { + if ((obj == null) || (obj == target) || (obj == activeChar)) { continue; } - if (!Util.checkIfInRange(skill.getAffectRange(), target, obj, true)) - { + if (!Util.checkIfInRange(skill.getAffectRange(), target, obj, true)) { continue; } - if (!(obj.isAttackable() || obj.isPlayable())) - { + if (!(obj.isAttackable() || obj.isPlayable())) { continue; } - if (!Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena)) - { + if (!Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena)) { continue; } - if ((maxTargets > 0) && (targetList.size() >= maxTargets)) - { + if ((maxTargets > 0) && (targetList.size() >= maxTargets)) { break; } targetList.add(obj); } - if (targetList.isEmpty()) - { + if (targetList.isEmpty()) { return EMPTY_TARGET_LIST; } @@ -96,8 +84,7 @@ public class AreaSummon implements ITargetTypeHandler } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.AREA_SUMMON; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Aura.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Aura.java index 66e5e7d598..fc13d2964c 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Aura.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Aura.java @@ -33,41 +33,31 @@ import com.l2jserver.gameserver.model.zone.ZoneId; * Aura target handler. * @author UnAfraid */ -public class Aura implements ITargetTypeHandler -{ +public class Aura implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { final List<L2Character> targetList = new ArrayList<>(); final boolean srcInArena = (activeChar.isInsideZone(ZoneId.PVP) && !activeChar.isInsideZone(ZoneId.SIEGE)); - for (L2Character obj : activeChar.getKnownList().getKnownCharactersInRadius(skill.getAffectRange())) - { - if (obj.isDoor() || obj.isAttackable() || obj.isPlayable() || obj.isTrap()) - { + for (L2Character obj : activeChar.getKnownList().getKnownCharactersInRadius(skill.getAffectRange())) { + if (obj.isDoor() || obj.isAttackable() || obj.isPlayable() || obj.isTrap()) { // Stealth door targeting. - if (obj.isDoor()) - { + if (obj.isDoor()) { final L2DoorInstance door = (L2DoorInstance) obj; - if (!door.getTemplate().isStealth()) - { + if (!door.getTemplate().isStealth()) { continue; } } - if (!Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena)) - { + if (!Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena)) { continue; } - if (activeChar.isPlayable() && obj.isAttackable() && !skill.isBad()) - { + if (activeChar.isPlayable() && obj.isAttackable() && !skill.isBad()) { continue; } - if (onlyFirst) - { - return new L2Character[] - { + if (onlyFirst) { + return new L2Character[] { obj }; } @@ -79,8 +69,7 @@ public class Aura implements ITargetTypeHandler } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.AURA; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/AuraCorpseMob.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/AuraCorpseMob.java index 2e88ad8c6e..cdf39251c7 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/AuraCorpseMob.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/AuraCorpseMob.java @@ -31,29 +31,22 @@ import com.l2jserver.gameserver.model.skills.targets.L2TargetType; /** * @author UnAfraid */ -public class AuraCorpseMob implements ITargetTypeHandler -{ +public class AuraCorpseMob implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { List<L2Character> targetList = new ArrayList<>(); // Go through the L2Character _knownList final Collection<L2Character> objs = activeChar.getKnownList().getKnownCharactersInRadius(skill.getAffectRange()); int maxTargets = skill.getAffectLimit(); - for (L2Character obj : objs) - { - if (obj.isAttackable() && obj.isDead()) - { - if (onlyFirst) - { - return new L2Character[] - { + for (L2Character obj : objs) { + if (obj.isAttackable() && obj.isDead()) { + if (onlyFirst) { + return new L2Character[] { obj }; } - if ((maxTargets > 0) && (targetList.size() >= maxTargets)) - { + if ((maxTargets > 0) && (targetList.size() >= maxTargets)) { break; } @@ -64,8 +57,7 @@ public class AuraCorpseMob implements ITargetTypeHandler } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.AURA_CORPSE_MOB; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/AuraFriendly.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/AuraFriendly.java index d9a39264ec..63ce1e4d79 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/AuraFriendly.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/AuraFriendly.java @@ -35,75 +35,60 @@ import com.l2jserver.gameserver.model.zone.ZoneId; * Aura Friendly target handler implementation. * @author Sahar */ -public class AuraFriendly implements ITargetTypeHandler -{ +public class AuraFriendly implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { List<L2Character> targetList = new ArrayList<>(); L2PcInstance player = activeChar.getActingPlayer(); int maxTargets = skill.getAffectLimit(); - for (L2Character obj : player.getKnownList().getKnownCharactersInRadius(skill.getAffectRange())) - { - if ((obj == activeChar) || !checkTarget(player, obj)) - { + for (L2Character obj : player.getKnownList().getKnownCharactersInRadius(skill.getAffectRange())) { + if ((obj == activeChar) || !checkTarget(player, obj)) { continue; } - if ((maxTargets > 0) && (targetList.size() >= maxTargets)) - { + if ((maxTargets > 0) && (targetList.size() >= maxTargets)) { break; } targetList.add(obj); } - if (targetList.isEmpty()) - { + if (targetList.isEmpty()) { return EMPTY_TARGET_LIST; } return targetList.toArray(new L2Character[targetList.size()]); } - private boolean checkTarget(L2PcInstance activeChar, L2Character target) - { - if ((target == null) || !GeoData.getInstance().canSeeTarget(activeChar, target)) - { + private boolean checkTarget(L2PcInstance activeChar, L2Character target) { + if ((target == null) || !GeoData.getInstance().canSeeTarget(activeChar, target)) { return false; } - if (target.isAlikeDead() || target.isDoor() || (target instanceof L2SiegeFlagInstance) || target.isMonster()) - { + if (target.isAlikeDead() || target.isDoor() || (target instanceof L2SiegeFlagInstance) || target.isMonster()) { return false; } - if (target.isPlayable()) - { + if (target.isPlayable()) { L2PcInstance targetPlayer = target.getActingPlayer(); - if (activeChar.isInDuelWith(target)) - { + if (activeChar.isInDuelWith(target)) { return false; } - if (activeChar.isInPartyWith(target)) - { + if (activeChar.isInPartyWith(target)) { return true; } - if (target.isInsideZone(ZoneId.PVP)) - { + if (target.isInsideZone(ZoneId.PVP)) { return false; } - if (activeChar.isInClanWith(target) || activeChar.isInAllyWith(target) || activeChar.isInCommandChannelWith(target)) - { + if (activeChar.isInClanWith(target) || activeChar.isInAllyWith(target) || activeChar.isInCommandChannelWith(target)) { return true; } - if ((targetPlayer.getPvpFlag() > 0) || (targetPlayer.getKarma() > 0)) - { + if ((targetPlayer.getPvpFlag() > 0) || (targetPlayer.getKarma() > 0)) { return false; } } @@ -112,8 +97,7 @@ public class AuraFriendly implements ITargetTypeHandler } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.AURA_FRIENDLY; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/AuraUndeadEnemy.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/AuraUndeadEnemy.java index f4321dbed5..05f0218caa 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/AuraUndeadEnemy.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/AuraUndeadEnemy.java @@ -32,27 +32,20 @@ import com.l2jserver.gameserver.model.skills.targets.L2TargetType; * @author Adry_85 * @since 2.6.0.0 */ -public class AuraUndeadEnemy implements ITargetTypeHandler -{ +public class AuraUndeadEnemy implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { List<L2Character> targetList = new ArrayList<>(); int maxTargets = skill.getAffectLimit(); - for (L2Character obj : activeChar.getKnownList().getKnownCharactersInRadius(skill.getAffectRange())) - { - if (obj.isAttackable() && obj.isUndead()) - { - if (onlyFirst) - { - return new L2Character[] - { + for (L2Character obj : activeChar.getKnownList().getKnownCharactersInRadius(skill.getAffectRange())) { + if (obj.isAttackable() && obj.isUndead()) { + if (onlyFirst) { + return new L2Character[] { obj }; } - if ((maxTargets > 0) && (targetList.size() >= maxTargets)) - { + if ((maxTargets > 0) && (targetList.size() >= maxTargets)) { break; } @@ -63,8 +56,7 @@ public class AuraUndeadEnemy implements ITargetTypeHandler } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.AURA_UNDEAD_ENEMY; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/BehindArea.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/BehindArea.java index 3a0cfc64fe..baca64303d 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/BehindArea.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/BehindArea.java @@ -34,14 +34,11 @@ import com.l2jserver.gameserver.util.Util; /** * @author UnAfraid */ -public class BehindArea implements ITargetTypeHandler -{ +public class BehindArea implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { List<L2Character> targetList = new ArrayList<>(); - if ((target == null) || (((target == activeChar) || target.isAlikeDead()) && (skill.getCastRange() >= 0)) || (!(target.isAttackable() || target.isPlayable()))) - { + if ((target == null) || (((target == activeChar) || target.isAlikeDead()) && (skill.getCastRange() >= 0)) || (!(target.isAttackable() || target.isPlayable()))) { activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT); return EMPTY_TARGET_LIST; } @@ -49,57 +46,44 @@ public class BehindArea implements ITargetTypeHandler final L2Character origin; final boolean srcInArena = (activeChar.isInsideZone(ZoneId.PVP) && !activeChar.isInsideZone(ZoneId.SIEGE)); - if (skill.getCastRange() >= 0) - { - if (!Skill.checkForAreaOffensiveSkills(activeChar, target, skill, srcInArena)) - { + if (skill.getCastRange() >= 0) { + if (!Skill.checkForAreaOffensiveSkills(activeChar, target, skill, srcInArena)) { return EMPTY_TARGET_LIST; } - if (onlyFirst) - { - return new L2Character[] - { + if (onlyFirst) { + return new L2Character[] { target }; } origin = target; targetList.add(origin); // Add target to target list - } - else - { + } else { origin = activeChar; } final Collection<L2Character> objs = activeChar.getKnownList().getKnownCharacters(); int maxTargets = skill.getAffectLimit(); - for (L2Character obj : objs) - { - if (!(obj.isAttackable() || obj.isPlayable())) - { + for (L2Character obj : objs) { + if (!(obj.isAttackable() || obj.isPlayable())) { continue; } - if (obj == origin) - { + if (obj == origin) { continue; } - if (Util.checkIfInRange(skill.getAffectRange(), origin, obj, true)) - { - if (!obj.isBehind(activeChar)) - { + if (Util.checkIfInRange(skill.getAffectRange(), origin, obj, true)) { + if (!obj.isBehind(activeChar)) { continue; } - if (!Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena)) - { + if (!Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena)) { continue; } - if ((maxTargets > 0) && (targetList.size() >= maxTargets)) - { + if ((maxTargets > 0) && (targetList.size() >= maxTargets)) { break; } @@ -107,8 +91,7 @@ public class BehindArea implements ITargetTypeHandler } } - if (targetList.isEmpty()) - { + if (targetList.isEmpty()) { return EMPTY_TARGET_LIST; } @@ -116,8 +99,7 @@ public class BehindArea implements ITargetTypeHandler } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.BEHIND_AREA; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/BehindAura.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/BehindAura.java index bdbeb9ef0e..aa23731a0d 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/BehindAura.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/BehindAura.java @@ -32,40 +32,31 @@ import com.l2jserver.gameserver.model.zone.ZoneId; /** * @author UnAfraid */ -public class BehindAura implements ITargetTypeHandler -{ +public class BehindAura implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { List<L2Character> targetList = new ArrayList<>(); final boolean srcInArena = (activeChar.isInsideZone(ZoneId.PVP) && !activeChar.isInsideZone(ZoneId.SIEGE)); final Collection<L2Character> objs = activeChar.getKnownList().getKnownCharactersInRadius(skill.getAffectRange()); int maxTargets = skill.getAffectLimit(); - for (L2Character obj : objs) - { - if (obj.isAttackable() || obj.isPlayable()) - { + for (L2Character obj : objs) { + if (obj.isAttackable() || obj.isPlayable()) { - if (!obj.isBehind(activeChar)) - { + if (!obj.isBehind(activeChar)) { continue; } - if (!Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena)) - { + if (!Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena)) { continue; } - if (onlyFirst) - { - return new L2Character[] - { + if (onlyFirst) { + return new L2Character[] { obj }; } - if ((maxTargets > 0) && (targetList.size() >= maxTargets)) - { + if ((maxTargets > 0) && (targetList.size() >= maxTargets)) { break; } @@ -76,8 +67,7 @@ public class BehindAura implements ITargetTypeHandler } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.BEHIND_AURA; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Clan.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Clan.java index 7081a5959f..e7d462b69c 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Clan.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Clan.java @@ -37,34 +37,26 @@ import com.l2jserver.gameserver.util.Util; /** * @author UnAfraid */ -public class Clan implements ITargetTypeHandler -{ +public class Clan implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { List<L2Character> targetList = new ArrayList<>(); - if (activeChar.isPlayable()) - { + if (activeChar.isPlayable()) { final L2PcInstance player = activeChar.getActingPlayer(); - if (player == null) - { + if (player == null) { return EMPTY_TARGET_LIST; } - if (player.isInOlympiadMode()) - { - return new L2Character[] - { + if (player.isInOlympiadMode()) { + return new L2Character[] { player }; } - if (onlyFirst) - { - return new L2Character[] - { + if (onlyFirst) { + return new L2Character[] { player }; } @@ -74,60 +66,47 @@ public class Clan implements ITargetTypeHandler final int radius = skill.getAffectRange(); final L2Clan clan = player.getClan(); - if (Skill.addSummon(activeChar, player, radius, false)) - { + if (Skill.addSummon(activeChar, player, radius, false)) { targetList.add(player.getSummon()); } - if (clan != null) - { + if (clan != null) { L2PcInstance obj; - for (L2ClanMember member : clan.getMembers()) - { + for (L2ClanMember member : clan.getMembers()) { obj = member.getPlayerInstance(); - if ((obj == null) || (obj == player)) - { + if ((obj == null) || (obj == player)) { continue; } - if (player.isInDuel()) - { - if (player.getDuelId() != obj.getDuelId()) - { + if (player.isInDuel()) { + if (player.getDuelId() != obj.getDuelId()) { continue; } - if (player.isInParty() && obj.isInParty() && (player.getParty().getLeaderObjectId() != obj.getParty().getLeaderObjectId())) - { + if (player.isInParty() && obj.isInParty() && (player.getParty().getLeaderObjectId() != obj.getParty().getLeaderObjectId())) { continue; } } // Don't add this target if this is a Pc->Pc pvp casting and pvp condition not met - if (!player.checkPvpSkill(obj, skill)) - { + if (!player.checkPvpSkill(obj, skill)) { continue; } - if (!TvTEvent.checkForTvTSkill(player, obj, skill)) - { + if (!TvTEvent.checkForTvTSkill(player, obj, skill)) { continue; } - if (!onlyFirst && Skill.addSummon(activeChar, obj, radius, false)) - { + if (!onlyFirst && Skill.addSummon(activeChar, obj, radius, false)) { targetList.add(obj.getSummon()); } - if (!Skill.addCharacter(activeChar, obj, radius, false)) - { + if (!Skill.addCharacter(activeChar, obj, radius, false)) { continue; } - if (onlyFirst) - { - return new L2Character[] - { + if (onlyFirst) { + return new L2Character[] { obj }; } @@ -135,15 +114,11 @@ public class Clan implements ITargetTypeHandler targetList.add(obj); } } - } - else if (activeChar.isNpc()) - { + } else if (activeChar.isNpc()) { // for buff purposes, returns friendly mobs nearby and mob itself final L2Npc npc = (L2Npc) activeChar; - if ((npc.getTemplate().getClans() == null) || npc.getTemplate().getClans().isEmpty()) - { - return new L2Character[] - { + if ((npc.getTemplate().getClans() == null) || npc.getTemplate().getClans().isEmpty()) { + return new L2Character[] { activeChar }; } @@ -152,17 +127,13 @@ public class Clan implements ITargetTypeHandler final Collection<L2Object> objs = activeChar.getKnownList().getKnownObjects().values(); int maxTargets = skill.getAffectLimit(); - for (L2Object newTarget : objs) - { - if (newTarget.isNpc() && npc.isInMyClan((L2Npc) newTarget)) - { - if (!Util.checkIfInRange(skill.getCastRange(), activeChar, newTarget, true)) - { + for (L2Object newTarget : objs) { + if (newTarget.isNpc() && npc.isInMyClan((L2Npc) newTarget)) { + if (!Util.checkIfInRange(skill.getCastRange(), activeChar, newTarget, true)) { continue; } - if ((maxTargets > 0) && (targetList.size() >= maxTargets)) - { + if ((maxTargets > 0) && (targetList.size() >= maxTargets)) { break; } @@ -175,8 +146,7 @@ public class Clan implements ITargetTypeHandler } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.CLAN; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/ClanMember.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/ClanMember.java index 6768e0a9bb..f3df35eca9 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/ClanMember.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/ClanMember.java @@ -33,55 +33,42 @@ import com.l2jserver.gameserver.util.Util; /** * @author UnAfraid */ -public class ClanMember implements ITargetTypeHandler -{ +public class ClanMember implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { List<L2Character> targetList = new ArrayList<>(); - if (activeChar.isNpc()) - { + if (activeChar.isNpc()) { // for buff purposes, returns friendly mobs nearby and mob itself final L2Npc npc = (L2Npc) activeChar; - if ((npc.getTemplate().getClans() == null) || npc.getTemplate().getClans().isEmpty()) - { - return new L2Character[] - { + if ((npc.getTemplate().getClans() == null) || npc.getTemplate().getClans().isEmpty()) { + return new L2Character[] { activeChar }; } final Collection<L2Object> objs = activeChar.getKnownList().getKnownObjects().values(); - for (L2Object newTarget : objs) - { - if (newTarget.isNpc() && npc.isInMyClan((L2Npc) newTarget)) - { - if (!Util.checkIfInRange(skill.getCastRange(), activeChar, newTarget, true)) - { + for (L2Object newTarget : objs) { + if (newTarget.isNpc() && npc.isInMyClan((L2Npc) newTarget)) { + if (!Util.checkIfInRange(skill.getCastRange(), activeChar, newTarget, true)) { continue; } - if (((L2Npc) newTarget).isAffectedBySkill(skill.getId())) - { + if (((L2Npc) newTarget).isAffectedBySkill(skill.getId())) { continue; } targetList.add((L2Npc) newTarget); break; } } - if (targetList.isEmpty()) - { + if (targetList.isEmpty()) { targetList.add(npc); } - } - else - { + } else { return EMPTY_TARGET_LIST; } return targetList.toArray(new L2Character[targetList.size()]); } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.CLAN_MEMBER; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/CommandChannel.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/CommandChannel.java index 140d4b789e..66a25e6969 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/CommandChannel.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/CommandChannel.java @@ -32,15 +32,12 @@ import com.l2jserver.gameserver.model.skills.targets.L2TargetType; /** * @author UnAfraid */ -public class CommandChannel implements ITargetTypeHandler -{ +public class CommandChannel implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { final List<L2Character> targetList = new ArrayList<>(); final L2PcInstance player = activeChar.getActingPlayer(); - if (player == null) - { + if (player == null) { return EMPTY_TARGET_LIST; } @@ -50,14 +47,12 @@ public class CommandChannel implements ITargetTypeHandler final L2Party party = player.getParty(); final boolean hasChannel = (party != null) && party.isInCommandChannel(); - if (Skill.addSummon(activeChar, player, radius, false)) - { + if (Skill.addSummon(activeChar, player, radius, false)) { targetList.add(player.getSummon()); } // if player in not in party - if (party == null) - { + if (party == null) { return targetList.toArray(new L2Character[targetList.size()]); } @@ -65,18 +60,14 @@ public class CommandChannel implements ITargetTypeHandler int maxTargets = skill.getAffectLimit(); final List<L2PcInstance> members = hasChannel ? party.getCommandChannel().getMembers() : party.getMembers(); - for (L2PcInstance member : members) - { - if (activeChar == member) - { + for (L2PcInstance member : members) { + if (activeChar == member) { continue; } - if (Skill.addCharacter(activeChar, member, radius, false)) - { + if (Skill.addCharacter(activeChar, member, radius, false)) { targetList.add(member); - if (targetList.size() >= maxTargets) - { + if (targetList.size() >= maxTargets) { break; } } @@ -86,8 +77,7 @@ public class CommandChannel implements ITargetTypeHandler } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.COMMAND_CHANNEL; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/CorpseClan.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/CorpseClan.java index 24da055c3e..1abb48a1fe 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/CorpseClan.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/CorpseClan.java @@ -38,100 +38,77 @@ import com.l2jserver.gameserver.util.Util; /** * @author UnAfraid */ -public class CorpseClan implements ITargetTypeHandler -{ +public class CorpseClan implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { List<L2Object> targetList = new ArrayList<>(); - if (activeChar.isPlayable()) - { + if (activeChar.isPlayable()) { final L2PcInstance player = activeChar.getActingPlayer(); - if (player == null) - { + if (player == null) { return EMPTY_TARGET_LIST; } - if (player.isInOlympiadMode()) - { - return new L2Object[] - { + if (player.isInOlympiadMode()) { + return new L2Object[] { player }; } final L2Clan clan = player.getClan(); - if (clan != null) - { + if (clan != null) { final int radius = skill.getAffectRange(); final int maxTargets = skill.getAffectLimit(); - for (L2ClanMember member : clan.getMembers()) - { + for (L2ClanMember member : clan.getMembers()) { final L2PcInstance obj = member.getPlayerInstance(); - if ((obj == null) || (obj == player)) - { + if ((obj == null) || (obj == player)) { continue; } - if (player.isInDuel()) - { - if (player.getDuelId() != obj.getDuelId()) - { + if (player.isInDuel()) { + if (player.getDuelId() != obj.getDuelId()) { continue; } - if (player.isInParty() && obj.isInParty() && (player.getParty().getLeaderObjectId() != obj.getParty().getLeaderObjectId())) - { + if (player.isInParty() && obj.isInParty() && (player.getParty().getLeaderObjectId() != obj.getParty().getLeaderObjectId())) { continue; } } // Don't add this target if this is a Pc->Pc pvp casting and pvp condition not met - if (!player.checkPvpSkill(obj, skill)) - { + if (!player.checkPvpSkill(obj, skill)) { continue; } - if (!TvTEvent.checkForTvTSkill(player, obj, skill)) - { + if (!TvTEvent.checkForTvTSkill(player, obj, skill)) { continue; } - if (!Skill.addCharacter(activeChar, obj, radius, true)) - { + if (!Skill.addCharacter(activeChar, obj, radius, true)) { continue; } // check target is not in a active siege zone - if (obj.isInsideZone(ZoneId.SIEGE) && !obj.isInSiege()) - { + if (obj.isInsideZone(ZoneId.SIEGE) && !obj.isInSiege()) { continue; } - if (onlyFirst) - { - return new L2Object[] - { + if (onlyFirst) { + return new L2Object[] { obj }; } - if ((maxTargets > 0) && (targetList.size() >= maxTargets)) - { + if ((maxTargets > 0) && (targetList.size() >= maxTargets)) { break; } targetList.add(obj); } } - } - else if (activeChar.isNpc()) - { + } else if (activeChar.isNpc()) { // for buff purposes, returns friendly mobs nearby and mob itself final L2Npc npc = (L2Npc) activeChar; - if ((npc.getTemplate().getClans() == null) || npc.getTemplate().getClans().isEmpty()) - { - return new L2Object[] - { + if ((npc.getTemplate().getClans() == null) || npc.getTemplate().getClans().isEmpty()) { + return new L2Object[] { activeChar }; } @@ -140,17 +117,13 @@ public class CorpseClan implements ITargetTypeHandler final Collection<L2Object> objs = activeChar.getKnownList().getKnownObjects().values(); int maxTargets = skill.getAffectLimit(); - for (L2Object newTarget : objs) - { - if (newTarget.isNpc() && npc.isInMyClan((L2Npc) newTarget)) - { - if (!Util.checkIfInRange(skill.getCastRange(), activeChar, newTarget, true)) - { + for (L2Object newTarget : objs) { + if (newTarget.isNpc() && npc.isInMyClan((L2Npc) newTarget)) { + if (!Util.checkIfInRange(skill.getCastRange(), activeChar, newTarget, true)) { continue; } - if (targetList.size() >= maxTargets) - { + if (targetList.size() >= maxTargets) { break; } @@ -163,8 +136,7 @@ public class CorpseClan implements ITargetTypeHandler } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.CORPSE_CLAN; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/CorpseMob.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/CorpseMob.java index 8bf2fe6e0e..96bad579f5 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/CorpseMob.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/CorpseMob.java @@ -33,36 +33,29 @@ import com.l2jserver.gameserver.network.SystemMessageId; * Corpse Mob target handler. * @author UnAfraid, Zoey76 */ -public class CorpseMob implements ITargetTypeHandler -{ +public class CorpseMob implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { - if ((target == null) || !target.isAttackable() || !target.isDead()) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { + if ((target == null) || !target.isAttackable() || !target.isDead()) { activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT); return EMPTY_TARGET_LIST; } - if (skill.hasEffectType(L2EffectType.SUMMON) && target.isServitor() && (target.getActingPlayer() != null) && (target.getActingPlayer().getObjectId() == activeChar.getObjectId())) - { + if (skill.hasEffectType(L2EffectType.SUMMON) && target.isServitor() && (target.getActingPlayer() != null) && (target.getActingPlayer().getObjectId() == activeChar.getObjectId())) { return EMPTY_TARGET_LIST; } - if (skill.hasEffectType(L2EffectType.HP_DRAIN) && ((L2Attackable) target).isOldCorpse(activeChar.getActingPlayer(), npc().getCorpseConsumeSkillAllowedTimeBeforeDecay(), true)) - { + if (skill.hasEffectType(L2EffectType.HP_DRAIN) && ((L2Attackable) target).isOldCorpse(activeChar.getActingPlayer(), npc().getCorpseConsumeSkillAllowedTimeBeforeDecay(), true)) { return EMPTY_TARGET_LIST; } - return new L2Character[] - { + return new L2Character[] { target }; } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.CORPSE_MOB; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Enemy.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Enemy.java index dc820aa8c9..2399f6218a 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Enemy.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Enemy.java @@ -33,17 +33,12 @@ import com.l2jserver.gameserver.model.skills.targets.L2TargetType; * @author Zoey76 * @since 2.6.0.0 */ -public class Enemy implements ITargetTypeHandler -{ +public class Enemy implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { - switch (skill.getAffectScope()) - { - case SINGLE: - { - if (target == null) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { + switch (skill.getAffectScope()) { + case SINGLE: { + if (target == null) { return EMPTY_TARGET_LIST; } @@ -51,14 +46,12 @@ public class Enemy implements ITargetTypeHandler if (target.isDead() || (!target.isAttackable() && // (player != null) && // !player.checkIfPvP(target) && // - !player.getCurrentSkill().isCtrlPressed())) - { + !player.getCurrentSkill().isCtrlPressed())) { activeChar.sendPacket(INCORRECT_TARGET); return EMPTY_TARGET_LIST; } - return new L2Character[] - { + return new L2Character[] { target }; } @@ -67,8 +60,7 @@ public class Enemy implements ITargetTypeHandler } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return ENEMY; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/EnemyOnly.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/EnemyOnly.java index 85209e713d..2ffbf2c7c0 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/EnemyOnly.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/EnemyOnly.java @@ -33,17 +33,12 @@ import com.l2jserver.gameserver.model.skills.targets.L2TargetType; * @author Zoey76 * @since 2.6.0.0 */ -public class EnemyOnly implements ITargetTypeHandler -{ +public class EnemyOnly implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { - switch (skill.getAffectScope()) - { - case SINGLE: - { - if (target == null) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { + switch (skill.getAffectScope()) { + case SINGLE: { + if (target == null) { return EMPTY_TARGET_LIST; } @@ -54,14 +49,12 @@ public class EnemyOnly implements ITargetTypeHandler !player.isInClanWith(target) && // !player.isInAllyWith(target) && // TODO(Zoey76): Confirm. !player.isInCommandChannelWith(target) && // TODO(Zoey76): Confirm. - !player.checkIfPvP(target))) - { + !player.checkIfPvP(target))) { activeChar.sendPacket(INCORRECT_TARGET); return EMPTY_TARGET_LIST; } - return new L2Character[] - { + return new L2Character[] { target }; } @@ -70,8 +63,7 @@ public class EnemyOnly implements ITargetTypeHandler } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return ENEMY_ONLY; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/EnemySummon.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/EnemySummon.java index b57f6b6161..c18069e3d7 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/EnemySummon.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/EnemySummon.java @@ -30,21 +30,16 @@ import com.l2jserver.gameserver.model.zone.ZoneId; * Enemy Summon target handler implementation. * @author UnAfraid */ -public class EnemySummon implements ITargetTypeHandler -{ +public class EnemySummon implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { - if ((target != null) && target.isSummon()) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { + if ((target != null) && target.isSummon()) { final L2Summon targetSummon = (L2Summon) target; if ((activeChar.isPlayer() && (activeChar.getSummon() != targetSummon) && // !targetSummon.isDead() && ((targetSummon.getOwner().getPvpFlag() != 0) || (targetSummon.getOwner().getKarma() > 0))) || // (targetSummon.getOwner().isInsideZone(ZoneId.PVP) && activeChar.getActingPlayer().isInsideZone(ZoneId.PVP)) || // - (targetSummon.getOwner().isInDuel() && activeChar.getActingPlayer().isInDuel() && (targetSummon.getOwner().getDuelId() == activeChar.getActingPlayer().getDuelId()))) - { - return new L2Character[] - { + (targetSummon.getOwner().isInDuel() && activeChar.getActingPlayer().isInDuel() && (targetSummon.getOwner().getDuelId() == activeChar.getActingPlayer().getDuelId()))) { + return new L2Character[] { targetSummon }; } @@ -53,8 +48,7 @@ public class EnemySummon implements ITargetTypeHandler } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.ENEMY_SUMMON; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/FlagPole.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/FlagPole.java index 39356132d7..32cd38cca9 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/FlagPole.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/FlagPole.java @@ -27,25 +27,20 @@ import com.l2jserver.gameserver.model.skills.targets.L2TargetType; /** * @author UnAfraid */ -public class FlagPole implements ITargetTypeHandler -{ +public class FlagPole implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { - if (!activeChar.isPlayer()) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { + if (!activeChar.isPlayer()) { return EMPTY_TARGET_LIST; } - return new L2Object[] - { + return new L2Object[] { target }; } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.FLAGPOLE; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/FrontArea.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/FrontArea.java index ae292ffbc8..61faf9ee03 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/FrontArea.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/FrontArea.java @@ -34,14 +34,11 @@ import com.l2jserver.gameserver.util.Util; /** * @author UnAfraid */ -public class FrontArea implements ITargetTypeHandler -{ +public class FrontArea implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { List<L2Character> targetList = new ArrayList<>(); - if ((target == null) || (((target == activeChar) || target.isAlikeDead()) && (skill.getCastRange() >= 0)) || (!(target.isAttackable() || target.isPlayable()))) - { + if ((target == null) || (((target == activeChar) || target.isAlikeDead()) && (skill.getCastRange() >= 0)) || (!(target.isAttackable() || target.isPlayable()))) { activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT); return EMPTY_TARGET_LIST; } @@ -49,57 +46,44 @@ public class FrontArea implements ITargetTypeHandler final L2Character origin; final boolean srcInArena = (activeChar.isInsideZone(ZoneId.PVP) && !activeChar.isInsideZone(ZoneId.SIEGE)); - if (skill.getCastRange() >= 0) - { - if (!Skill.checkForAreaOffensiveSkills(activeChar, target, skill, srcInArena)) - { + if (skill.getCastRange() >= 0) { + if (!Skill.checkForAreaOffensiveSkills(activeChar, target, skill, srcInArena)) { return EMPTY_TARGET_LIST; } - if (onlyFirst) - { - return new L2Character[] - { + if (onlyFirst) { + return new L2Character[] { target }; } origin = target; targetList.add(origin); // Add target to target list - } - else - { + } else { origin = activeChar; } final Collection<L2Character> objs = activeChar.getKnownList().getKnownCharacters(); int maxTargets = skill.getAffectLimit(); - for (L2Character obj : objs) - { - if (!(obj.isAttackable() || obj.isPlayable())) - { + for (L2Character obj : objs) { + if (!(obj.isAttackable() || obj.isPlayable())) { continue; } - if (obj == origin) - { + if (obj == origin) { continue; } - if (Util.checkIfInRange(skill.getAffectRange(), origin, obj, true)) - { - if (!obj.isInFrontOf(activeChar)) - { + if (Util.checkIfInRange(skill.getAffectRange(), origin, obj, true)) { + if (!obj.isInFrontOf(activeChar)) { continue; } - if (!Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena)) - { + if (!Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena)) { continue; } - if ((maxTargets > 0) && (targetList.size() >= maxTargets)) - { + if ((maxTargets > 0) && (targetList.size() >= maxTargets)) { break; } @@ -107,8 +91,7 @@ public class FrontArea implements ITargetTypeHandler } } - if (targetList.isEmpty()) - { + if (targetList.isEmpty()) { return EMPTY_TARGET_LIST; } @@ -116,8 +99,7 @@ public class FrontArea implements ITargetTypeHandler } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.FRONT_AREA; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/FrontAura.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/FrontAura.java index 62a1afbbb3..ecb1b213fa 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/FrontAura.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/FrontAura.java @@ -32,40 +32,31 @@ import com.l2jserver.gameserver.model.zone.ZoneId; /** * @author UnAfraid */ -public class FrontAura implements ITargetTypeHandler -{ +public class FrontAura implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { List<L2Character> targetList = new ArrayList<>(); final boolean srcInArena = (activeChar.isInsideZone(ZoneId.PVP) && !activeChar.isInsideZone(ZoneId.SIEGE)); final Collection<L2Character> objs = activeChar.getKnownList().getKnownCharactersInRadius(skill.getAffectRange()); int maxTargets = skill.getAffectLimit(); - for (L2Character obj : objs) - { - if (obj.isAttackable() || obj.isPlayable()) - { + for (L2Character obj : objs) { + if (obj.isAttackable() || obj.isPlayable()) { - if (!obj.isInFrontOf(activeChar)) - { + if (!obj.isInFrontOf(activeChar)) { continue; } - if (!Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena)) - { + if (!Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena)) { continue; } - if (onlyFirst) - { - return new L2Character[] - { + if (onlyFirst) { + return new L2Character[] { obj }; } - if ((maxTargets > 0) && (targetList.size() >= maxTargets)) - { + if ((maxTargets > 0) && (targetList.size() >= maxTargets)) { break; } @@ -76,8 +67,7 @@ public class FrontAura implements ITargetTypeHandler } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.FRONT_AURA; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Ground.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Ground.java index 03136a91f7..656edfb330 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Ground.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Ground.java @@ -33,42 +33,33 @@ import com.l2jserver.gameserver.model.zone.ZoneId; /** * @author St3eT */ -public class Ground implements ITargetTypeHandler -{ +public class Ground implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { final List<L2Character> targetList = new ArrayList<>(); final L2PcInstance player = (L2PcInstance) activeChar; final int maxTargets = skill.getAffectLimit(); final boolean srcInArena = (activeChar.isInsideZone(ZoneId.PVP) && !activeChar.isInsideZone(ZoneId.SIEGE)); - for (L2Character character : activeChar.getKnownList().getKnownCharacters()) - { - if ((character != null) && character.isInsideRadius(player.getCurrentSkillWorldPosition(), skill.getAffectRange(), false, false)) - { - if (!Skill.checkForAreaOffensiveSkills(activeChar, character, skill, srcInArena)) - { + for (L2Character character : activeChar.getKnownList().getKnownCharacters()) { + if ((character != null) && character.isInsideRadius(player.getCurrentSkillWorldPosition(), skill.getAffectRange(), false, false)) { + if (!Skill.checkForAreaOffensiveSkills(activeChar, character, skill, srcInArena)) { continue; } - if (character.isDoor()) - { + if (character.isDoor()) { continue; } - if ((maxTargets > 0) && (targetList.size() >= maxTargets)) - { + if ((maxTargets > 0) && (targetList.size() >= maxTargets)) { break; } targetList.add(character); } } - if (targetList.isEmpty()) - { - if (skill.hasEffectType(L2EffectType.SUMMON_NPC)) - { + if (targetList.isEmpty()) { + if (skill.hasEffectType(L2EffectType.SUMMON_NPC)) { targetList.add(activeChar); } } @@ -76,8 +67,7 @@ public class Ground implements ITargetTypeHandler } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.GROUND; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Holy.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Holy.java index 739e6f5194..828569c63e 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Holy.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Holy.java @@ -28,25 +28,20 @@ import com.l2jserver.gameserver.model.skills.targets.L2TargetType; /** * @author UnAfraid */ -public class Holy implements ITargetTypeHandler -{ +public class Holy implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { - if (!(target instanceof L2ArtefactInstance)) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { + if (!(target instanceof L2ArtefactInstance)) { return EMPTY_TARGET_LIST; } - return new L2Object[] - { + return new L2Object[] { target }; } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.HOLY; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/One.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/One.java index 8b8d1fa7f8..2ebb19d863 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/One.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/One.java @@ -28,28 +28,23 @@ import com.l2jserver.gameserver.network.SystemMessageId; /** * @author UnAfraid */ -public class One implements ITargetTypeHandler -{ +public class One implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { // Check for null target or any other invalid target - if ((target == null) || target.isDead() || ((target == activeChar) && skill.isBad())) - { + if ((target == null) || target.isDead() || ((target == activeChar) && skill.isBad())) { activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT); return EMPTY_TARGET_LIST; } // If a target is found, return it in a table else send a system message TARGET_IS_INCORRECT - return new L2Character[] - { + return new L2Character[] { target }; } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.ONE; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/OwnerPet.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/OwnerPet.java index 4b7e79641b..1a8d4b47ff 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/OwnerPet.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/OwnerPet.java @@ -28,18 +28,13 @@ import com.l2jserver.gameserver.model.skills.targets.L2TargetType; /** * @author UnAfraid */ -public class OwnerPet implements ITargetTypeHandler -{ +public class OwnerPet implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { - if (activeChar.isSummon()) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { + if (activeChar.isSummon()) { target = ((L2Summon) activeChar).getOwner(); - if ((target != null) && !target.isDead()) - { - return new L2Character[] - { + if ((target != null) && !target.isDead()) { + return new L2Character[] { target }; } @@ -48,8 +43,7 @@ public class OwnerPet implements ITargetTypeHandler } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.OWNER_PET; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Party.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Party.java index d022fa571c..1eadf2361b 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Party.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Party.java @@ -31,16 +31,12 @@ import com.l2jserver.gameserver.model.skills.targets.L2TargetType; /** * @author UnAfraid */ -public class Party implements ITargetTypeHandler -{ +public class Party implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { List<L2Character> targetList = new ArrayList<>(); - if (onlyFirst) - { - return new L2Character[] - { + if (onlyFirst) { + return new L2Character[] { activeChar }; } @@ -49,38 +45,28 @@ public class Party implements ITargetTypeHandler final int radius = skill.getAffectRange(); L2PcInstance player = activeChar.getActingPlayer(); - if (activeChar.isSummon()) - { - if (Skill.addCharacter(activeChar, player, radius, false)) - { + if (activeChar.isSummon()) { + if (Skill.addCharacter(activeChar, player, radius, false)) { targetList.add(player); } - } - else if (activeChar.isPlayer()) - { - if (Skill.addSummon(activeChar, player, radius, false)) - { + } else if (activeChar.isPlayer()) { + if (Skill.addSummon(activeChar, player, radius, false)) { targetList.add(player.getSummon()); } } - if (activeChar.isInParty()) - { + if (activeChar.isInParty()) { // Get a list of Party Members - for (L2PcInstance partyMember : activeChar.getParty().getMembers()) - { - if ((partyMember == null) || (partyMember == player)) - { + for (L2PcInstance partyMember : activeChar.getParty().getMembers()) { + if ((partyMember == null) || (partyMember == player)) { continue; } - if (Skill.addCharacter(activeChar, partyMember, radius, false)) - { + if (Skill.addCharacter(activeChar, partyMember, radius, false)) { targetList.add(partyMember); } - if (Skill.addSummon(activeChar, partyMember, radius, false)) - { + if (Skill.addSummon(activeChar, partyMember, radius, false)) { targetList.add(partyMember.getSummon()); } } @@ -89,8 +75,7 @@ public class Party implements ITargetTypeHandler } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.PARTY; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/PartyClan.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/PartyClan.java index 52083489d1..d689f951a8 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/PartyClan.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/PartyClan.java @@ -33,24 +33,19 @@ import com.l2jserver.gameserver.model.skills.targets.L2TargetType; /** * @author UnAfraid */ -public class PartyClan implements ITargetTypeHandler -{ +public class PartyClan implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { List<L2Character> targetList = new ArrayList<>(); - if (onlyFirst) - { - return new L2Character[] - { + if (onlyFirst) { + return new L2Character[] { activeChar }; } final L2PcInstance player = activeChar.getActingPlayer(); - if (player == null) - { + if (player == null) { return EMPTY_TARGET_LIST; } @@ -60,94 +55,75 @@ public class PartyClan implements ITargetTypeHandler final boolean hasClan = player.getClan() != null; final boolean hasParty = player.isInParty(); - if (Skill.addSummon(activeChar, player, radius, false)) - { + if (Skill.addSummon(activeChar, player, radius, false)) { targetList.add(player.getSummon()); } // if player in clan and not in party - if (!(hasClan || hasParty)) - { + if (!(hasClan || hasParty)) { return targetList.toArray(new L2Character[targetList.size()]); } // Get all visible objects in a spherical area near the L2Character final Collection<L2PcInstance> objs = activeChar.getKnownList().getKnownPlayersInRadius(radius); int maxTargets = skill.getAffectLimit(); - for (L2PcInstance obj : objs) - { - if (obj == null) - { + for (L2PcInstance obj : objs) { + if (obj == null) { continue; } // olympiad mode - adding only own side - if (player.isInOlympiadMode()) - { - if (!obj.isInOlympiadMode()) - { + if (player.isInOlympiadMode()) { + if (!obj.isInOlympiadMode()) { continue; } - if (player.getOlympiadGameId() != obj.getOlympiadGameId()) - { + if (player.getOlympiadGameId() != obj.getOlympiadGameId()) { continue; } - if (player.getOlympiadSide() != obj.getOlympiadSide()) - { + if (player.getOlympiadSide() != obj.getOlympiadSide()) { continue; } } - if (player.isInDuel()) - { - if (player.getDuelId() != obj.getDuelId()) - { + if (player.isInDuel()) { + if (player.getDuelId() != obj.getDuelId()) { continue; } - if (hasParty && obj.isInParty() && (player.getParty().getLeaderObjectId() != obj.getParty().getLeaderObjectId())) - { + if (hasParty && obj.isInParty() && (player.getParty().getLeaderObjectId() != obj.getParty().getLeaderObjectId())) { continue; } } - if (!((hasClan && (obj.getClanId() == player.getClanId())) || (hasParty && obj.isInParty() && (player.getParty().getLeaderObjectId() == obj.getParty().getLeaderObjectId())))) - { + if (!((hasClan && (obj.getClanId() == player.getClanId())) || (hasParty && obj.isInParty() && (player.getParty().getLeaderObjectId() == obj.getParty().getLeaderObjectId())))) { continue; } // Don't add this target if this is a Pc->Pc pvp // casting and pvp condition not met - if (!player.checkPvpSkill(obj, skill)) - { + if (!player.checkPvpSkill(obj, skill)) { continue; } - if (!TvTEvent.checkForTvTSkill(player, obj, skill)) - { + if (!TvTEvent.checkForTvTSkill(player, obj, skill)) { continue; } - if (!onlyFirst && Skill.addSummon(activeChar, obj, radius, false)) - { + if (!onlyFirst && Skill.addSummon(activeChar, obj, radius, false)) { targetList.add(obj.getSummon()); } - if (!Skill.addCharacter(activeChar, obj, radius, false)) - { + if (!Skill.addCharacter(activeChar, obj, radius, false)) { continue; } - if (onlyFirst) - { - return new L2Character[] - { + if (onlyFirst) { + return new L2Character[] { obj }; } - if ((maxTargets > 0) && (targetList.size() >= maxTargets)) - { + if ((maxTargets > 0) && (targetList.size() >= maxTargets)) { break; } @@ -157,8 +133,7 @@ public class PartyClan implements ITargetTypeHandler } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.PARTY_CLAN; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/PartyMember.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/PartyMember.java index e46d96fb82..e75f5f0f0f 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/PartyMember.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/PartyMember.java @@ -28,22 +28,17 @@ import com.l2jserver.gameserver.network.SystemMessageId; /** * @author UnAfraid */ -public class PartyMember implements ITargetTypeHandler -{ +public class PartyMember implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { - if (target == null) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { + if (target == null) { activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT); return EMPTY_TARGET_LIST; } - if (!target.isDead()) - { - if ((target == activeChar) || (activeChar.isInParty() && target.isInParty() && (activeChar.getParty().getLeaderObjectId() == target.getParty().getLeaderObjectId())) || (activeChar.isPlayer() && target.isSummon() && (activeChar.getSummon() == target)) || (activeChar.isSummon() && target.isPlayer() && (activeChar == target.getSummon()))) - { - return new L2Character[] - { + if (!target.isDead()) { + if ((target == activeChar) || (activeChar.isInParty() && target.isInParty() && (activeChar.getParty().getLeaderObjectId() == target.getParty().getLeaderObjectId())) || (activeChar.isPlayer() && target.isSummon() && (activeChar.getSummon() == target)) + || (activeChar.isSummon() && target.isPlayer() && (activeChar == target.getSummon()))) { + return new L2Character[] { target }; } @@ -52,8 +47,7 @@ public class PartyMember implements ITargetTypeHandler } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.PARTY_MEMBER; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/PartyNotMe.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/PartyNotMe.java index c80bdf7c89..426d3be416 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/PartyNotMe.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/PartyNotMe.java @@ -34,39 +34,25 @@ import com.l2jserver.gameserver.util.Util; /** * @author UnAfraid */ -public class PartyNotMe implements ITargetTypeHandler -{ +public class PartyNotMe implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { final List<L2Character> targetList = new ArrayList<>(); - if (activeChar.getParty() != null) - { + if (activeChar.getParty() != null) { final List<L2PcInstance> partyList = activeChar.getParty().getMembers(); - for (L2PcInstance partyMember : partyList) - { - if ((partyMember == null) || partyMember.isDead()) - { + for (L2PcInstance partyMember : partyList) { + if ((partyMember == null) || partyMember.isDead()) { continue; - } - else if (partyMember == activeChar) - { + } else if (partyMember == activeChar) { continue; - } - else if (!Util.checkIfInRange(character().getPartyRange(), activeChar, partyMember, true)) - { + } else if (!Util.checkIfInRange(character().getPartyRange(), activeChar, partyMember, true)) { continue; - } - else if ((skill.getAffectRange() > 0) && !Util.checkIfInRange(skill.getAffectRange(), activeChar, partyMember, true)) - { + } else if ((skill.getAffectRange() > 0) && !Util.checkIfInRange(skill.getAffectRange(), activeChar, partyMember, true)) { continue; - } - else - { + } else { targetList.add(partyMember); - if ((partyMember.getSummon() != null) && !partyMember.getSummon().isDead()) - { + if ((partyMember.getSummon() != null) && !partyMember.getSummon().isDead()) { targetList.add(partyMember.getSummon()); } } @@ -76,8 +62,7 @@ public class PartyNotMe implements ITargetTypeHandler } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.PARTY_NOTME; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/PartyOther.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/PartyOther.java index 779107ddce..6eca3f5db2 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/PartyOther.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/PartyOther.java @@ -28,42 +28,31 @@ import com.l2jserver.gameserver.network.SystemMessageId; /** * @author UnAfraid */ -public class PartyOther implements ITargetTypeHandler -{ +public class PartyOther implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { - if ((target != null) && (target != activeChar) && activeChar.isInParty() && target.isInParty() && (activeChar.getParty().getLeaderObjectId() == target.getParty().getLeaderObjectId())) - { - if (!target.isDead()) - { - if (target.isPlayer()) - { - switch (skill.getId()) - { - // FORCE BUFFS may cancel here but there should be a proper condition + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { + if ((target != null) && (target != activeChar) && activeChar.isInParty() && target.isInParty() && (activeChar.getParty().getLeaderObjectId() == target.getParty().getLeaderObjectId())) { + if (!target.isDead()) { + if (target.isPlayer()) { + switch (skill.getId()) { + // FORCE BUFFS may cancel here but there should be a proper condition case 426: - if (!target.getActingPlayer().isMageClass()) - { - return new L2Character[] - { + if (!target.getActingPlayer().isMageClass()) { + return new L2Character[] { target }; } return EMPTY_TARGET_LIST; case 427: - if (target.getActingPlayer().isMageClass()) - { - return new L2Character[] - { + if (target.getActingPlayer().isMageClass()) { + return new L2Character[] { target }; } return EMPTY_TARGET_LIST; } } - return new L2Character[] - { + return new L2Character[] { target }; } @@ -74,8 +63,7 @@ public class PartyOther implements ITargetTypeHandler } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.PARTY_OTHER; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/PcBody.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/PcBody.java index 508c9fbc94..3f73d9652e 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/PcBody.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/PcBody.java @@ -35,55 +35,39 @@ import com.l2jserver.gameserver.network.SystemMessageId; /** * @author UnAfraid */ -public class PcBody implements ITargetTypeHandler -{ +public class PcBody implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { List<L2Character> targetList = new ArrayList<>(); - if ((target != null) && target.isDead()) - { + if ((target != null) && target.isDead()) { final L2PcInstance player; - if (activeChar.isPlayer()) - { + if (activeChar.isPlayer()) { player = activeChar.getActingPlayer(); - } - else - { + } else { player = null; } final L2PcInstance targetPlayer; - if (target.isPlayer()) - { + if (target.isPlayer()) { targetPlayer = target.getActingPlayer(); - } - else - { + } else { targetPlayer = null; } final L2PetInstance targetPet; - if (target.isPet()) - { + if (target.isPet()) { targetPet = (L2PetInstance) target; - } - else - { + } else { targetPet = null; } - if ((player != null) && ((targetPlayer != null) || (targetPet != null))) - { + if ((player != null) && ((targetPlayer != null) || (targetPet != null))) { boolean condGood = true; - if (skill.hasEffectType(L2EffectType.RESURRECTION)) - { - if (targetPlayer != null) - { + if (skill.hasEffectType(L2EffectType.RESURRECTION)) { + if (targetPlayer != null) { // check target is not in a active siege zone - if (targetPlayer.isInsideZone(ZoneId.SIEGE) && !targetPlayer.isInSiege()) - { + if (targetPlayer.isInsideZone(ZoneId.SIEGE) && !targetPlayer.isInSiege()) { condGood = false; activeChar.sendPacket(SystemMessageId.CANNOT_BE_RESURRECTED_DURING_SIEGE); } @@ -96,15 +80,12 @@ public class PcBody implements ITargetTypeHandler } } - if (condGood) - { - if (!onlyFirst) - { + if (condGood) { + if (!onlyFirst) { targetList.add(target); return targetList.toArray(new L2Object[targetList.size()]); } - return new L2Character[] - { + return new L2Character[] { target }; } @@ -115,8 +96,7 @@ public class PcBody implements ITargetTypeHandler } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.PC_BODY; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Pet.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Pet.java index 4f59c52613..9cb1535997 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Pet.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Pet.java @@ -28,15 +28,11 @@ import com.l2jserver.gameserver.model.skills.targets.L2TargetType; * Target Pet handler. * @author UnAfraid */ -public class Pet implements ITargetTypeHandler -{ +public class Pet implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { - if (activeChar.hasPet()) - { - return new L2Character[] - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { + if (activeChar.hasPet()) { + return new L2Character[] { activeChar.getSummon() }; } @@ -44,8 +40,7 @@ public class Pet implements ITargetTypeHandler } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.PET; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Self.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Self.java index 9b81f536ff..df0780eb95 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Self.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Self.java @@ -27,21 +27,17 @@ import com.l2jserver.gameserver.model.skills.targets.L2TargetType; /** * @author UnAfraid */ -public class Self implements ITargetTypeHandler -{ +public class Self implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { - return new L2Character[] - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { + return new L2Character[] { activeChar }; } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.SELF; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Servitor.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Servitor.java index 7ec3e91ac6..71f13050cf 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Servitor.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Servitor.java @@ -28,15 +28,11 @@ import com.l2jserver.gameserver.model.skills.targets.L2TargetType; * Target Servitor handler. * @author Zoey76 */ -public class Servitor implements ITargetTypeHandler -{ +public class Servitor implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { - if (activeChar.hasServitor()) - { - return new L2Character[] - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { + if (activeChar.hasServitor()) { + return new L2Character[] { activeChar.getSummon() }; } @@ -44,8 +40,7 @@ public class Servitor implements ITargetTypeHandler } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.SERVITOR; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Summon.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Summon.java index 5d51496541..d328ea3621 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Summon.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Summon.java @@ -28,15 +28,11 @@ import com.l2jserver.gameserver.model.skills.targets.L2TargetType; * Target Summon handler. * @author UnAfraid */ -public class Summon implements ITargetTypeHandler -{ +public class Summon implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { - if (activeChar.hasSummon()) - { - return new L2Character[] - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { + if (activeChar.hasSummon()) { + return new L2Character[] { activeChar.getSummon() }; } @@ -44,8 +40,7 @@ public class Summon implements ITargetTypeHandler } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.SUMMON; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/TargetParty.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/TargetParty.java index 3ccff24b05..91ea7c6fa7 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/TargetParty.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/TargetParty.java @@ -32,16 +32,13 @@ import com.l2jserver.gameserver.network.SystemMessageId; /** * @author St3eT */ -public class TargetParty implements ITargetTypeHandler -{ +public class TargetParty implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { List<L2Character> targetList = new ArrayList<>(); // Check for null target or any other invalid target - if ((target == null) || target.isDead() || (target == activeChar)) - { + if ((target == null) || target.isDead() || (target == activeChar)) { activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT); return EMPTY_TARGET_LIST; } @@ -49,36 +46,28 @@ public class TargetParty implements ITargetTypeHandler final int radius = skill.getAffectRange(); final L2PcInstance player = (L2PcInstance) activeChar.getTarget(); - if (player.isInParty()) - { - for (L2PcInstance partyMember : player.getParty().getMembers()) - { - if ((partyMember == null)) - { + if (player.isInParty()) { + for (L2PcInstance partyMember : player.getParty().getMembers()) { + if ((partyMember == null)) { continue; } - if (Skill.addCharacter(player, partyMember, radius, false)) - { + if (Skill.addCharacter(player, partyMember, radius, false)) { targetList.add(partyMember); } - if (Skill.addSummon(player, partyMember, radius, false)) - { + if (Skill.addSummon(player, partyMember, radius, false)) { targetList.add(partyMember.getSummon()); } } - } - else - { + } else { targetList.add(target); } return targetList.toArray(new L2Character[targetList.size()]); } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.TARGET_PARTY; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Unlockable.java b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Unlockable.java index 66e7c118c9..9dcd3e9286 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Unlockable.java +++ b/src/main/java/com/l2jserver/datapack/handlers/targethandlers/Unlockable.java @@ -28,25 +28,20 @@ import com.l2jserver.gameserver.model.skills.targets.L2TargetType; /** * @author UnAfraid */ -public class Unlockable implements ITargetTypeHandler -{ +public class Unlockable implements ITargetTypeHandler { @Override - public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) - { - if ((target == null) || (!target.isDoor() && !(target instanceof L2ChestInstance))) - { + public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { + if ((target == null) || (!target.isDoor() && !(target instanceof L2ChestInstance))) { return EMPTY_TARGET_LIST; } - return new L2Character[] - { + return new L2Character[] { target }; } @Override - public Enum<L2TargetType> getTargetType() - { + public Enum<L2TargetType> getTargetType() { return L2TargetType.UNLOCKABLE; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/ChatsHandler.java b/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/ChatsHandler.java index 4e2f9e76f9..b4b7c818eb 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/ChatsHandler.java +++ b/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/ChatsHandler.java @@ -33,82 +33,60 @@ import com.l2jserver.gameserver.util.Broadcast; /** * @author UnAfraid */ -public class ChatsHandler implements ITelnetHandler -{ - private final String[] _commands = - { +public class ChatsHandler implements ITelnetHandler { + private final String[] _commands = { "announce", "msg", "gmchat" }; @Override - public boolean useCommand(String command, PrintWriter _print, Socket _cSocket, int _uptime) - { - if (command.startsWith("announce")) - { - try - { + public boolean useCommand(String command, PrintWriter _print, Socket _cSocket, int _uptime) { + if (command.startsWith("announce")) { + try { command = command.substring(9); Broadcast.toAllOnlinePlayers(command); _print.println("Announcement Sent!"); - } - catch (StringIndexOutOfBoundsException e) - { + } catch (StringIndexOutOfBoundsException e) { _print.println("Please Enter Some Text To Announce!"); } - } - else if (command.startsWith("msg")) - { - try - { + } else if (command.startsWith("msg")) { + try { String val = command.substring(4); StringTokenizer st = new StringTokenizer(val); String name = st.nextToken(); String message = val.substring(name.length() + 1); L2PcInstance reciever = L2World.getInstance().getPlayer(name); CreatureSay cs = new CreatureSay(0, Say2.TELL, "Telnet Priv", message); - if (reciever != null) - { + if (reciever != null) { reciever.sendPacket(cs); _print.println("Telnet Priv->" + name + ": " + message); _print.println("Message Sent!"); - } - else - { + } else { _print.println("Unable To Find Username: " + name); } - } - catch (StringIndexOutOfBoundsException e) - { + } catch (StringIndexOutOfBoundsException e) { _print.println("Please Enter Some Text!"); } - } - else if (command.startsWith("gmchat")) - { - try - { + } else if (command.startsWith("gmchat")) { + try { command = command.substring(7); CreatureSay cs = new CreatureSay(0, Say2.ALLIANCE, "Telnet GM Broadcast from " + _cSocket.getInetAddress().getHostAddress(), command); AdminData.getInstance().broadcastToGMs(cs); _print.println("Your Message Has Been Sent To " + getOnlineGMS() + " GM(s)."); - } - catch (StringIndexOutOfBoundsException e) - { + } catch (StringIndexOutOfBoundsException e) { _print.println("Please Enter Some Text To Announce!"); } } return false; } - private int getOnlineGMS() - { + private int getOnlineGMS() { return AdminData.getInstance().getAllGms(true).size(); } @Override - public String[] getCommandList() - { + public String[] getCommandList() { return _commands; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/DebugHandler.java b/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/DebugHandler.java index 9057b72135..8ac9646be3 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/DebugHandler.java +++ b/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/DebugHandler.java @@ -75,8 +75,7 @@ public class DebugHandler implements ITelnetHandler { if (dbg.equals("decay")) { _print.print(DecayTaskManager.getInstance().toString()); - } - else if (dbg.equals("packetsend")) { + } else if (dbg.equals("packetsend")) { if (st.countTokens() < 2) { _print.println("Usage: debug packetsend <charName> <packetData>"); return false; @@ -99,8 +98,7 @@ public class DebugHandler implements ITelnetHandler { targetPlayer.sendPacket(sp); _print.println("Packet sent to player " + charName); - } - else if (dbg.equals("PacketTP")) { + } else if (dbg.equals("PacketTP")) { String str = ThreadPoolManager.getInstance().getPacketStats(); _print.println(str); int i = 0; @@ -113,8 +111,7 @@ public class DebugHandler implements ITelnetHandler { fos = new FileOutputStream(f); out = new OutputStreamWriter(fos, "UTF-8"); out.write(str); - } - else if (dbg.equals("IOPacketTP")) { + } else if (dbg.equals("IOPacketTP")) { String str = ThreadPoolManager.getInstance().getIOPacketStats(); _print.println(str); int i = 0; @@ -127,8 +124,7 @@ public class DebugHandler implements ITelnetHandler { fos = new FileOutputStream(f); out = new OutputStreamWriter(fos, "UTF-8"); out.write(str); - } - else if (dbg.equals("GeneralTP")) { + } else if (dbg.equals("GeneralTP")) { String str = ThreadPoolManager.getInstance().getGeneralStats(); _print.println(str); int i = 0; @@ -141,8 +137,7 @@ public class DebugHandler implements ITelnetHandler { fos = new FileOutputStream(f); out = new OutputStreamWriter(fos, "UTF-8"); out.write(str); - } - else if (dbg.equals("full")) { + } else if (dbg.equals("full")) { _uptime = uptime; final Calendar cal = Calendar.getInstance(); @@ -248,24 +243,20 @@ public class DebugHandler implements ITelnetHandler { _print.println("Debug output saved to log/" + f.getName()); _print.flush(); } - } - catch (Exception e) { - } - finally { + } catch (Exception e) { + } finally { try { if (out != null) { out.close(); } - } - catch (Exception e) { + } catch (Exception e) { } try { if (fos != null) { fos.close(); } - } - catch (Exception e) { + } catch (Exception e) { } } @@ -323,34 +314,27 @@ public class DebugHandler implements ITelnetHandler { if (obj instanceof L2ItemInstance) { if (((L2ItemInstance) obj).getItemLocation() == ItemLocation.VOID) { itemVoidCount++; - } - else { + } else { itemCount++; } - } - else if (obj instanceof L2MonsterInstance) { + } else if (obj instanceof L2MonsterInstance) { monsterCount++; if (((L2MonsterInstance) obj).hasMinions()) { minionCount += ((L2MonsterInstance) obj).getMinionList().countSpawnedMinions(); minionsGroupCount += ((L2MonsterInstance) obj).getMinionList().lazyCountSpawnedMinionsGroups(); } - } - else if (obj instanceof L2Npc) { + } else if (obj instanceof L2Npc) { npcCount++; - } - else if (obj instanceof L2PcInstance) { + } else if (obj instanceof L2PcInstance) { pcCount++; if ((((L2PcInstance) obj).getClient() != null) && ((L2PcInstance) obj).getClient().isDetached()) { detachedCount++; } - } - else if (obj instanceof L2Summon) { + } else if (obj instanceof L2Summon) { summonCount++; - } - else if (obj instanceof L2DoorInstance) { + } else if (obj instanceof L2DoorInstance) { doorCount++; - } - else if (obj instanceof L2Character) { + } else if (obj instanceof L2Character) { charCount++; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/HelpHandler.java b/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/HelpHandler.java index ee85dfade6..523bb4844b 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/HelpHandler.java +++ b/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/HelpHandler.java @@ -26,18 +26,14 @@ import com.l2jserver.gameserver.handler.ITelnetHandler; /** * @author UnAfraid */ -public class HelpHandler implements ITelnetHandler -{ - private final String[] _commands = - { +public class HelpHandler implements ITelnetHandler { + private final String[] _commands = { "help" }; @Override - public boolean useCommand(String command, PrintWriter _print, Socket _cSocket, int _uptime) - { - if (command.equals("help")) - { + public boolean useCommand(String command, PrintWriter _print, Socket _cSocket, int _uptime) { + if (command.equals("help")) { _print.println("The following is a list of all available commands: "); _print.println("help - shows this help."); _print.println("status - displays basic server statistics."); @@ -61,9 +57,7 @@ public class HelpHandler implements ITelnetHandler _print.println("jail <player> [time]"); _print.println("unjail <player>"); _print.println("quit - closes telnet session."); - } - else if (command.equals("help debug")) - { + } else if (command.equals("help debug")) { _print.println("The following is a list of all available debug commands: "); _print.println("full - Dumps complete debug information to an file (recommended)"); _print.println("decay - prints info about the DecayManager"); @@ -76,8 +70,7 @@ public class HelpHandler implements ITelnetHandler } @Override - public String[] getCommandList() - { + public String[] getCommandList() { return _commands; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/PlayerHandler.java b/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/PlayerHandler.java index 2300d88214..1c341c3bbe 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/PlayerHandler.java +++ b/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/PlayerHandler.java @@ -48,12 +48,10 @@ import com.l2jserver.gameserver.util.Util; /** * @author UnAfraid */ -public class PlayerHandler implements ITelnetHandler -{ +public class PlayerHandler implements ITelnetHandler { private static final Logger LOGGER = LoggerFactory.getLogger(PlayerHandler.class); - private final String[] _commands = - { + private final String[] _commands = { "kick", "give", "enchant", @@ -62,38 +60,28 @@ public class PlayerHandler implements ITelnetHandler }; @Override - public boolean useCommand(String command, PrintWriter _print, Socket _cSocket, int _uptime) - { - if (command.startsWith("kick")) - { - try - { + public boolean useCommand(String command, PrintWriter _print, Socket _cSocket, int _uptime) { + if (command.startsWith("kick")) { + try { command = command.substring(5); L2PcInstance player = L2World.getInstance().getPlayer(command); - if (player != null) - { + if (player != null) { player.sendMessage("You are kicked by gm"); player.logout(); _print.println("Player kicked"); } - } - catch (StringIndexOutOfBoundsException e) - { + } catch (StringIndexOutOfBoundsException e) { _print.println("Please enter player name to kick"); } - } - else if (command.startsWith("give")) - { + } else if (command.startsWith("give")) { StringTokenizer st = new StringTokenizer(command.substring(5)); - try - { + try { L2PcInstance player = L2World.getInstance().getPlayer(st.nextToken()); int itemId = Integer.parseInt(st.nextToken()); int amount = Integer.parseInt(st.nextToken()); - if (player != null) - { + if (player != null) { L2ItemInstance item = player.getInventory().addItem("Status-Give", itemId, amount, null, null); InventoryUpdate iu = new InventoryUpdate(); iu.addItem(item); @@ -104,30 +92,22 @@ public class PlayerHandler implements ITelnetHandler player.sendPacket(sm); _print.println("ok"); GMAudit.auditGMAction("Telnet Admin", "Give Item", player.getName(), "item: " + itemId + " amount: " + amount); - } - else - { + } else { _print.println("Player not found"); } - } - catch (Exception e) - { + } catch (Exception e) { } - } - else if (command.startsWith("enchant")) - { + } else if (command.startsWith("enchant")) { StringTokenizer st = new StringTokenizer(command.substring(8), " "); int enchant = 0, itemType = 0; - try - { + try { L2PcInstance player = L2World.getInstance().getPlayer(st.nextToken()); itemType = Integer.parseInt(st.nextToken()); enchant = Integer.parseInt(st.nextToken()); - switch (itemType) - { + switch (itemType) { case 1: itemType = Inventory.PAPERDOLL_HEAD; break; @@ -177,135 +157,96 @@ public class PlayerHandler implements ITelnetHandler itemType = 0; } - if (enchant > 65535) - { + if (enchant > 65535) { enchant = 65535; - } - else if (enchant < 0) - { + } else if (enchant < 0) { enchant = 0; } boolean success = false; - if ((player != null) && (itemType > 0)) - { + if ((player != null) && (itemType > 0)) { success = setEnchant(player, enchant, itemType); - if (success) - { + if (success) { _print.println("Item enchanted successfully."); } - } - else if (!success) - { + } else if (!success) { _print.println("Item failed to enchant."); } - } - catch (Exception e) - { + } catch (Exception e) { } - } - else if (command.startsWith("jail")) - { + } else if (command.startsWith("jail")) { StringTokenizer st = new StringTokenizer(command.substring(5)); - try - { + try { String name = st.nextToken(); int charId = CharNameTable.getInstance().getIdByName(name); int delay = 0; String reason = ""; - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { String token = st.nextToken(); - if (Util.isDigit(token)) - { + if (Util.isDigit(token)) { delay = Integer.parseInt(token); } - while (st.hasMoreTokens()) - { + while (st.hasMoreTokens()) { reason += st.nextToken() + " "; } - if (!reason.isEmpty()) - { + if (!reason.isEmpty()) { reason = reason.substring(0, reason.length() - 1); } } - if (charId > 0) - { + if (charId > 0) { long expirationTime = delay > 0 ? System.currentTimeMillis() + (delay * 60 * 1000) : -1; PunishmentManager.getInstance().startPunishment(new PunishmentTask(charId, PunishmentAffect.CHARACTER, PunishmentType.JAIL, expirationTime, reason, "Telnet Admin: " + _cSocket.getInetAddress().getHostAddress())); _print.println("Character " + name + " jailed for " + (delay > 0 ? delay + " minutes." : "ever!")); - } - else - { + } else { _print.println("Character with name: " + name + " was not found!"); } - } - catch (NoSuchElementException nsee) - { + } catch (NoSuchElementException nsee) { _print.println("Specify a character name."); - } - catch (Exception e) - { + } catch (Exception e) { LOGGER.debug("Could not jail player via telnet!", e); } - } - else if (command.startsWith("unjail")) - { + } else if (command.startsWith("unjail")) { StringTokenizer st = new StringTokenizer(command.substring(7)); - try - { + try { String name = st.nextToken(); int charId = CharNameTable.getInstance().getIdByName(name); - if (charId > 0) - { + if (charId > 0) { PunishmentManager.getInstance().stopPunishment(charId, PunishmentAffect.CHARACTER, PunishmentType.JAIL); _print.println("Character " + name + " have been unjailed"); - } - else - { + } else { _print.println("Character with name: " + name + " was not found!"); } - } - catch (NoSuchElementException nsee) - { + } catch (NoSuchElementException nsee) { _print.println("Specify a character name."); - } - catch (Exception e) - { + } catch (Exception e) { LOGGER.debug("Could not unjail player via telnet!", e); } } return false; } - private boolean setEnchant(L2PcInstance activeChar, int ench, int armorType) - { + private boolean setEnchant(L2PcInstance activeChar, int ench, int armorType) { // now we need to find the equipped weapon of the targeted character... int curEnchant = 0; // display purposes only L2ItemInstance itemInstance = null; // only attempt to enchant if there is a weapon equipped L2ItemInstance parmorInstance = activeChar.getInventory().getPaperdollItem(armorType); - if ((parmorInstance != null) && (parmorInstance.getLocationSlot() == armorType)) - { + if ((parmorInstance != null) && (parmorInstance.getLocationSlot() == armorType)) { itemInstance = parmorInstance; - } - else - { + } else { // for bows/crossbows and double handed weapons parmorInstance = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND); - if ((parmorInstance != null) && (parmorInstance.getLocationSlot() == Inventory.PAPERDOLL_RHAND)) - { + if ((parmorInstance != null) && (parmorInstance.getLocationSlot() == Inventory.PAPERDOLL_RHAND)) { itemInstance = parmorInstance; } } - if (itemInstance != null) - { + if (itemInstance != null) { curEnchant = itemInstance.getEnchantLevel(); // set enchant value @@ -333,8 +274,7 @@ public class PlayerHandler implements ITelnetHandler } @Override - public String[] getCommandList() - { + public String[] getCommandList() { return _commands; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/ReloadHandler.java b/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/ReloadHandler.java index 20a27f8e9c..004a69539a 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/ReloadHandler.java +++ b/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/ReloadHandler.java @@ -43,68 +43,48 @@ import com.l2jserver.gameserver.scripting.ScriptEngineManager; /** * @author UnAfraid */ -public class ReloadHandler implements ITelnetHandler -{ - private final String[] _commands = - { +public class ReloadHandler implements ITelnetHandler { + private final String[] _commands = { "reload" }; @Override - public boolean useCommand(String command, PrintWriter _print, Socket _cSocket, int _uptime) - { - if (command.startsWith("reload")) - { + public boolean useCommand(String command, PrintWriter _print, Socket _cSocket, int _uptime) { + if (command.startsWith("reload")) { StringTokenizer st = new StringTokenizer(command.substring(7)); - try - { + try { String type = st.nextToken(); - if (type.equals("multisell")) - { + if (type.equals("multisell")) { _print.print("Reloading multisell... "); MultisellData.getInstance().load(); _print.println("done"); - } - else if (type.equals("skill")) - { + } else if (type.equals("skill")) { _print.print("Reloading skills... "); SkillData.getInstance().reload(); _print.println("done"); - } - else if (type.equals("npc")) - { + } else if (type.equals("npc")) { _print.print("Reloading npc templates... "); NpcData.getInstance().load(); QuestManager.getInstance().reloadAllScripts(); _print.println("done"); - } - else if (type.equals("html")) - { + } else if (type.equals("html")) { _print.print("Reloading html cache... "); HtmCache.getInstance().reload(); _print.println("done"); - } - else if (type.equals("item")) - { + } else if (type.equals("item")) { _print.print("Reloading item templates... "); ItemTable.getInstance().reload(); _print.println("done"); - } - else if (type.equals("zone")) - { + } else if (type.equals("zone")) { _print.print("Reloading zone tables... "); ZoneManager.getInstance().reload(); _print.println("done"); - } - else if (type.equals("teleports")) - { + } else if (type.equals("teleports")) { _print.print("Reloading telport location table... "); TeleportLocationTable.getInstance().reloadAll(); _print.println("done"); - } - else if (type.equals("spawns")) - { + } else if (type.equals("spawns")) { _print.print("Reloading spawns... "); RaidBossSpawnManager.getInstance().cleanUp(); DayNightSpawnManager.getInstance().cleanUp(); @@ -113,47 +93,33 @@ public class ReloadHandler implements ITelnetHandler SpawnTable.getInstance().load(); RaidBossSpawnManager.getInstance().load(); _print.println("done\n"); - } - else if (type.equalsIgnoreCase("script")) - { - try - { + } else if (type.equalsIgnoreCase("script")) { + try { String questPath = st.hasMoreTokens() ? st.nextToken() : ""; File file = new File(server().getScriptRoot(), "com/l2jserver/datapack/" + questPath); - if (file.isFile()) - { - try - { + if (file.isFile()) { + try { ScriptEngineManager.getInstance().compileScript(file); _print.println(file.getName() + " was successfully loaded!\n"); - } - catch (Exception e) - { + } catch (Exception e) { _print.println("Failed loading: " + questPath); } - } - else - { + } else { _print.println(file.getName() + " is not a file in: " + questPath); } - } - catch (StringIndexOutOfBoundsException e) - { + } catch (StringIndexOutOfBoundsException e) { _print.println("Please Enter Some Text!"); } } - } - catch (Exception e) - { + } catch (Exception e) { } } return false; } @Override - public String[] getCommandList() - { + public String[] getCommandList() { return _commands; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/ServerHandler.java b/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/ServerHandler.java index cd759d2c3a..51da28d013 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/ServerHandler.java +++ b/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/ServerHandler.java @@ -27,56 +27,38 @@ import com.l2jserver.gameserver.handler.ITelnetHandler; /** * @author UnAfraid */ -public class ServerHandler implements ITelnetHandler -{ - private final String[] _commands = - { +public class ServerHandler implements ITelnetHandler { + private final String[] _commands = { "shutdown", "restart", "abort" }; @Override - public boolean useCommand(String command, PrintWriter _print, Socket _cSocket, int _uptime) - { - if (command.startsWith("shutdown")) - { - try - { + public boolean useCommand(String command, PrintWriter _print, Socket _cSocket, int _uptime) { + if (command.startsWith("shutdown")) { + try { int val = Integer.parseInt(command.substring(9)); Shutdown.getInstance().startTelnetShutdown(_cSocket.getInetAddress().getHostAddress(), val, false); _print.println("Server Will Shutdown In " + val + " Seconds!"); _print.println("Type \"abort\" To Abort Shutdown!"); - } - catch (StringIndexOutOfBoundsException e) - { + } catch (StringIndexOutOfBoundsException e) { _print.println("Please Enter * amount of seconds to shutdown!"); - } - catch (Exception NumberFormatException) - { + } catch (Exception NumberFormatException) { _print.println("Numbers Only!"); } - } - else if (command.startsWith("restart")) - { - try - { + } else if (command.startsWith("restart")) { + try { int val = Integer.parseInt(command.substring(8)); Shutdown.getInstance().startTelnetShutdown(_cSocket.getInetAddress().getHostAddress(), val, true); _print.println("Server Will Restart In " + val + " Seconds!"); _print.println("Type \"abort\" To Abort Restart!"); - } - catch (StringIndexOutOfBoundsException e) - { + } catch (StringIndexOutOfBoundsException e) { _print.println("Please Enter * amount of seconds to restart!"); - } - catch (Exception NumberFormatException) - { + } catch (Exception NumberFormatException) { _print.println("Numbers Only!"); } - } - else if (command.startsWith("abort")) - { + } else if (command.startsWith("abort")) { Shutdown.getInstance().telnetAbort(_cSocket.getInetAddress().getHostAddress()); _print.println("OK! - Shutdown/Restart Aborted."); } @@ -84,8 +66,7 @@ public class ServerHandler implements ITelnetHandler } @Override - public String[] getCommandList() - { + public String[] getCommandList() { return _commands; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/StatusHandler.java b/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/StatusHandler.java index dec3127a99..3da78fe798 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/StatusHandler.java +++ b/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/StatusHandler.java @@ -58,14 +58,12 @@ public class StatusHandler implements ITelnetHandler { _uptime = uptime; _print.print(getServerStatus()); _print.flush(); - } - else if (command.equals("forcegc")) { + } else if (command.equals("forcegc")) { System.gc(); StringBuilder sb = new StringBuilder(); sb.append("RAM Used: " + ((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1048576)); // 1024 * 1024 = 1048576 _print.println(sb.toString()); - } - else if (command.startsWith("memusage")) { + } else if (command.startsWith("memusage")) { double max = Runtime.getRuntime().maxMemory() / 1024; // maxMemory is the upper // limit the jvm can use double allocated = Runtime.getRuntime().totalMemory() / 1024; // totalMemory the @@ -91,8 +89,7 @@ public class StatusHandler implements ITelnetHandler { _print.println("| |= Unused (cached) Memory:" + df2.format(cached) + df.format((cached / max) * 100)); _print.println("| Useable Memory:" + df2.format(useable) + df.format((useable / max) * 100)); // ... _print.println("+----"); - } - else if (command.equals("gmlist")) { + } else if (command.equals("gmlist")) { int igm = 0; String gmList = ""; @@ -140,34 +137,27 @@ public class StatusHandler implements ITelnetHandler { if (obj instanceof L2ItemInstance) { if (((L2ItemInstance) obj).getItemLocation() == ItemLocation.VOID) { itemVoidCount++; - } - else { + } else { itemCount++; } - } - else if (obj instanceof L2MonsterInstance) { + } else if (obj instanceof L2MonsterInstance) { monsterCount++; if (((L2MonsterInstance) obj).hasMinions()) { minionCount += ((L2MonsterInstance) obj).getMinionList().countSpawnedMinions(); minionsGroupCount += ((L2MonsterInstance) obj).getMinionList().lazyCountSpawnedMinionsGroups(); } - } - else if (obj instanceof L2Npc) { + } else if (obj instanceof L2Npc) { npcCount++; - } - else if (obj instanceof L2PcInstance) { + } else if (obj instanceof L2PcInstance) { pcCount++; if ((((L2PcInstance) obj).getClient() != null) && ((L2PcInstance) obj).getClient().isDetached()) { detachedCount++; } - } - else if (obj instanceof L2Summon) { + } else if (obj instanceof L2Summon) { summonCount++; - } - else if (obj instanceof L2DoorInstance) { + } else if (obj instanceof L2DoorInstance) { doorCount++; - } - else if (obj instanceof L2Character) { + } else if (obj instanceof L2Character) { charCount++; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/ThreadHandler.java b/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/ThreadHandler.java index ca3733496a..fa4dd81457 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/ThreadHandler.java +++ b/src/main/java/com/l2jserver/datapack/handlers/telnethandlers/ThreadHandler.java @@ -27,32 +27,24 @@ import com.l2jserver.gameserver.handler.ITelnetHandler; /** * @author UnAfraid */ -public class ThreadHandler implements ITelnetHandler -{ - private final String[] _commands = - { +public class ThreadHandler implements ITelnetHandler { + private final String[] _commands = { "purge", "performance" }; @Override - public boolean useCommand(String command, PrintWriter _print, Socket _cSocket, int _uptime) - { - if (command.equals("performance")) - { - for (String line : ThreadPoolManager.getInstance().getStats()) - { + public boolean useCommand(String command, PrintWriter _print, Socket _cSocket, int _uptime) { + if (command.equals("performance")) { + for (String line : ThreadPoolManager.getInstance().getStats()) { _print.println(line); } _print.flush(); - } - else if (command.equals("purge")) - { + } else if (command.equals("purge")) { ThreadPoolManager.getInstance().purge(); _print.println("STATUS OF THREAD POOLS AFTER PURGE COMMAND:"); _print.println(""); - for (String line : ThreadPoolManager.getInstance().getStats()) - { + for (String line : ThreadPoolManager.getInstance().getStats()) { _print.println(line); } _print.flush(); @@ -61,8 +53,7 @@ public class ThreadHandler implements ITelnetHandler } @Override - public String[] getCommandList() - { + public String[] getCommandList() { return _commands; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/ChannelDelete.java b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/ChannelDelete.java index 75c467c151..97dff52076 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/ChannelDelete.java +++ b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/ChannelDelete.java @@ -28,25 +28,19 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Channel Delete user command. * @author Chris */ -public class ChannelDelete implements IUserCommandHandler -{ - private static final int[] COMMAND_IDS = - { +public class ChannelDelete implements IUserCommandHandler { + private static final int[] COMMAND_IDS = { 93 }; @Override - public boolean useUserCommand(int id, L2PcInstance activeChar) - { - if (id != COMMAND_IDS[0]) - { + public boolean useUserCommand(int id, L2PcInstance activeChar) { + if (id != COMMAND_IDS[0]) { return false; } - if (activeChar.isInParty()) - { - if (activeChar.getParty().isLeader(activeChar) && activeChar.getParty().isInCommandChannel() && activeChar.getParty().getCommandChannel().getLeader().equals(activeChar)) - { + if (activeChar.isInParty()) { + if (activeChar.getParty().isLeader(activeChar) && activeChar.getParty().isInCommandChannel() && activeChar.getParty().getCommandChannel().getLeader().equals(activeChar)) { L2CommandChannel channel = activeChar.getParty().getCommandChannel(); channel.broadcastMessage(COMMAND_CHANNEL_DISBANDED); @@ -60,8 +54,7 @@ public class ChannelDelete implements IUserCommandHandler } @Override - public int[] getUserCommandList() - { + public int[] getUserCommandList() { return COMMAND_IDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/ChannelInfo.java b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/ChannelInfo.java index a74df53a03..a009d0f758 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/ChannelInfo.java +++ b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/ChannelInfo.java @@ -27,23 +27,18 @@ import com.l2jserver.gameserver.network.serverpackets.ExMultiPartyCommandChannel * Channel Info user command. * @author chris_00 */ -public class ChannelInfo implements IUserCommandHandler -{ - private static final int[] COMMAND_IDS = - { +public class ChannelInfo implements IUserCommandHandler { + private static final int[] COMMAND_IDS = { 97 }; @Override - public boolean useUserCommand(int id, L2PcInstance activeChar) - { - if (id != COMMAND_IDS[0]) - { + public boolean useUserCommand(int id, L2PcInstance activeChar) { + if (id != COMMAND_IDS[0]) { return false; } - if ((activeChar.getParty() == null) || (activeChar.getParty().getCommandChannel() == null)) - { + if ((activeChar.getParty() == null) || (activeChar.getParty().getCommandChannel() == null)) { return false; } @@ -53,8 +48,7 @@ public class ChannelInfo implements IUserCommandHandler } @Override - public int[] getUserCommandList() - { + public int[] getUserCommandList() { return COMMAND_IDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/ChannelLeave.java b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/ChannelLeave.java index f0615d65e7..1ead09e3ed 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/ChannelLeave.java +++ b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/ChannelLeave.java @@ -29,29 +29,23 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Channel Leave user command. * @author Chris, Zoey76 */ -public class ChannelLeave implements IUserCommandHandler -{ - private static final int[] COMMAND_IDS = - { +public class ChannelLeave implements IUserCommandHandler { + private static final int[] COMMAND_IDS = { 96 }; @Override - public boolean useUserCommand(int id, L2PcInstance activeChar) - { - if (id != COMMAND_IDS[0]) - { + public boolean useUserCommand(int id, L2PcInstance activeChar) { + if (id != COMMAND_IDS[0]) { return false; } - if (!activeChar.isInParty() || !activeChar.getParty().isLeader(activeChar)) - { + if (!activeChar.isInParty() || !activeChar.getParty().isLeader(activeChar)) { activeChar.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_LEAVE_CHANNEL); return false; } - if (activeChar.getParty().isInCommandChannel()) - { + if (activeChar.getParty().isInCommandChannel()) { final L2CommandChannel channel = activeChar.getParty().getCommandChannel(); final L2Party party = activeChar.getParty(); channel.removeParty(party); @@ -67,8 +61,7 @@ public class ChannelLeave implements IUserCommandHandler } @Override - public int[] getUserCommandList() - { + public int[] getUserCommandList() { return COMMAND_IDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/ClanPenalty.java b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/ClanPenalty.java index 20e312ac48..f2235fac6e 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/ClanPenalty.java +++ b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/ClanPenalty.java @@ -29,18 +29,14 @@ import com.l2jserver.gameserver.util.StringUtil; * Clan Penalty user command. * @author Tempy */ -public class ClanPenalty implements IUserCommandHandler -{ - private static final int[] COMMAND_IDS = - { +public class ClanPenalty implements IUserCommandHandler { + private static final int[] COMMAND_IDS = { 100 }; @Override - public boolean useUserCommand(int id, L2PcInstance activeChar) - { - if (id != COMMAND_IDS[0]) - { + public boolean useUserCommand(int id, L2PcInstance activeChar) { + if (id != COMMAND_IDS[0]) { return false; } @@ -48,26 +44,22 @@ public class ClanPenalty implements IUserCommandHandler SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); final StringBuilder htmlContent = StringUtil.startAppend(500, "<html><body><center><table width=270 border=0 bgcolor=111111><tr><td width=170>Penalty</td><td width=100 align=center>Expiration Date</td></tr></table><table width=270 border=0><tr>"); - if (activeChar.getClanJoinExpiryTime() > System.currentTimeMillis()) - { + if (activeChar.getClanJoinExpiryTime() > System.currentTimeMillis()) { StringUtil.append(htmlContent, "<td width=170>Unable to join a clan.</td><td width=100 align=center>", format.format(activeChar.getClanJoinExpiryTime()), "</td>"); penalty = true; } - if (activeChar.getClanCreateExpiryTime() > System.currentTimeMillis()) - { + if (activeChar.getClanCreateExpiryTime() > System.currentTimeMillis()) { StringUtil.append(htmlContent, "<td width=170>Unable to create a clan.</td><td width=100 align=center>", format.format(activeChar.getClanCreateExpiryTime()), "</td>"); penalty = true; } - if ((activeChar.getClan() != null) && (activeChar.getClan().getCharPenaltyExpiryTime() > System.currentTimeMillis())) - { + if ((activeChar.getClan() != null) && (activeChar.getClan().getCharPenaltyExpiryTime() > System.currentTimeMillis())) { StringUtil.append(htmlContent, "<td width=170>Unable to invite a clan member.</td><td width=100 align=center>", format.format(activeChar.getClan().getCharPenaltyExpiryTime()), "</td>"); penalty = true; } - if (!penalty) - { + if (!penalty) { htmlContent.append("<td width=170>No penalty is imposed.</td><td width=100 align=center></td>"); } @@ -81,8 +73,7 @@ public class ClanPenalty implements IUserCommandHandler } @Override - public int[] getUserCommandList() - { + public int[] getUserCommandList() { return COMMAND_IDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/ClanWarsList.java b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/ClanWarsList.java index 7ae6b547e0..3a301c2ea9 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/ClanWarsList.java +++ b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/ClanWarsList.java @@ -35,11 +35,9 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Clan War Start, Under Attack List, War List user commands. * @author Tempy */ -public class ClanWarsList implements IUserCommandHandler -{ +public class ClanWarsList implements IUserCommandHandler { private static final Logger _log = Logger.getLogger(ClanWarsList.class.getName()); - private static final int[] COMMAND_IDS = - { + private static final int[] COMMAND_IDS = { 88, 89, 90 @@ -50,62 +48,50 @@ public class ClanWarsList implements IUserCommandHandler private static final String WAR_LIST = "SELECT clan_name,clan_id,ally_id,ally_name FROM clan_data,clan_wars WHERE clan1=? AND clan_id=clan2 AND clan2 IN (SELECT clan1 FROM clan_wars WHERE clan2=?)"; @Override - public boolean useUserCommand(int id, L2PcInstance activeChar) - { - if ((id != COMMAND_IDS[0]) && (id != COMMAND_IDS[1]) && (id != COMMAND_IDS[2])) - { + public boolean useUserCommand(int id, L2PcInstance activeChar) { + if ((id != COMMAND_IDS[0]) && (id != COMMAND_IDS[1]) && (id != COMMAND_IDS[2])) { return false; } final L2Clan clan = activeChar.getClan(); - if (clan == null) - { + if (clan == null) { activeChar.sendPacket(SystemMessageId.NOT_JOINED_IN_ANY_CLAN); return false; } String query; // Attack List - if (id == 88) - { + if (id == 88) { activeChar.sendPacket(SystemMessageId.CLANS_YOU_DECLARED_WAR_ON); query = ATTACK_LIST; } // Under Attack List - else if (id == 89) - { + else if (id == 89) { activeChar.sendPacket(SystemMessageId.CLANS_THAT_HAVE_DECLARED_WAR_ON_YOU); query = UNDER_ATTACK_LIST; } // War List - else - { + else { activeChar.sendPacket(SystemMessageId.WAR_LIST); query = WAR_LIST; } try (Connection con = ConnectionFactory.getInstance().getConnection(); - PreparedStatement ps = con.prepareStatement(query)) - { + PreparedStatement ps = con.prepareStatement(query)) { ps.setInt(1, clan.getId()); ps.setInt(2, clan.getId()); SystemMessage sm; - try (ResultSet rs = ps.executeQuery()) - { - while (rs.next()) - { + try (ResultSet rs = ps.executeQuery()) { + while (rs.next()) { String clanName = rs.getString("clan_name"); int allyId = rs.getInt("ally_id"); - if (allyId > 0) - { + if (allyId > 0) { // Target With Ally sm = SystemMessage.getSystemMessage(SystemMessageId.S1_S2_ALLIANCE); sm.addString(clanName); sm.addString(rs.getString("ally_name")); - } - else - { + } else { // Target Without Ally sm = SystemMessage.getSystemMessage(SystemMessageId.S1_NO_ALLI_EXISTS); sm.addString(clanName); @@ -114,17 +100,14 @@ public class ClanWarsList implements IUserCommandHandler } } activeChar.sendPacket(SystemMessageId.FRIEND_LIST_FOOTER); - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, "", e); } return true; } @Override - public int[] getUserCommandList() - { + public int[] getUserCommandList() { return COMMAND_IDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/Dismount.java b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/Dismount.java index ce4aec797b..f3dc698eeb 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/Dismount.java +++ b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/Dismount.java @@ -25,35 +25,27 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Dismount user command. * @author Micht */ -public class Dismount implements IUserCommandHandler -{ - private static final int[] COMMAND_IDS = - { +public class Dismount implements IUserCommandHandler { + private static final int[] COMMAND_IDS = { 62 }; @Override - public synchronized boolean useUserCommand(int id, L2PcInstance activeChar) - { - if (id != COMMAND_IDS[0]) - { + public synchronized boolean useUserCommand(int id, L2PcInstance activeChar) { + if (id != COMMAND_IDS[0]) { return false; } - if (activeChar.isRentedPet()) - { + if (activeChar.isRentedPet()) { activeChar.stopRentPet(); - } - else if (activeChar.isMounted()) - { + } else if (activeChar.isMounted()) { activeChar.dismount(); } return true; } @Override - public int[] getUserCommandList() - { + public int[] getUserCommandList() { return COMMAND_IDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/InstanceZone.java b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/InstanceZone.java index 4b21ece5d0..37a23b8463 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/InstanceZone.java +++ b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/InstanceZone.java @@ -31,30 +31,24 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Instance Zone user command. * @author nille02 */ -public class InstanceZone implements IUserCommandHandler -{ - private static final int[] COMMAND_IDS = - { +public class InstanceZone implements IUserCommandHandler { + private static final int[] COMMAND_IDS = { 114 }; @Override - public int[] getUserCommandList() - { + public int[] getUserCommandList() { return COMMAND_IDS; } @Override - public boolean useUserCommand(int id, L2PcInstance activeChar) - { - if (id != COMMAND_IDS[0]) - { + public boolean useUserCommand(int id, L2PcInstance activeChar) { + if (id != COMMAND_IDS[0]) { return false; } final InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(activeChar); - if ((world != null) && (world.getTemplateId() >= 0)) - { + if ((world != null) && (world.getTemplateId() >= 0)) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_CURRENTLY_INUSE_S1); sm.addInstanceName(world.getTemplateId()); activeChar.sendPacket(sm); @@ -62,15 +56,11 @@ public class InstanceZone implements IUserCommandHandler final Map<Integer, Long> instanceTimes = InstanceManager.getInstance().getAllInstanceTimes(activeChar.getObjectId()); boolean firstMessage = true; - if (instanceTimes != null) - { - for (int instanceId : instanceTimes.keySet()) - { + if (instanceTimes != null) { + for (int instanceId : instanceTimes.keySet()) { long remainingTime = (instanceTimes.get(instanceId) - System.currentTimeMillis()) / 1000; - if (remainingTime > 60) - { - if (firstMessage) - { + if (remainingTime > 60) { + if (firstMessage) { firstMessage = false; activeChar.sendPacket(SystemMessageId.INSTANCE_ZONE_TIME_LIMIT); } @@ -81,15 +71,12 @@ public class InstanceZone implements IUserCommandHandler sm.addInt(hours); sm.addInt(minutes); activeChar.sendPacket(sm); - } - else - { + } else { InstanceManager.getInstance().deleteInstanceTime(activeChar.getObjectId(), instanceId); } } } - if (firstMessage) - { + if (firstMessage) { activeChar.sendPacket(SystemMessageId.NO_INSTANCEZONE_TIME_LIMIT); } return true; diff --git a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/Loc.java b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/Loc.java index cf9f377542..907106ad43 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/Loc.java +++ b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/Loc.java @@ -30,40 +30,30 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; /** * Loc user command. */ -public class Loc implements IUserCommandHandler -{ - private static final int[] COMMAND_IDS = - { +public class Loc implements IUserCommandHandler { + private static final int[] COMMAND_IDS = { 0 }; @Override - public boolean useUserCommand(int id, L2PcInstance activeChar) - { + public boolean useUserCommand(int id, L2PcInstance activeChar) { int region; L2RespawnZone zone = ZoneManager.getInstance().getZone(activeChar, L2RespawnZone.class); - if (zone != null) - { + if (zone != null) { region = MapRegionManager.getInstance().getRestartRegion(activeChar, zone.getAllRespawnPoints().get(Race.HUMAN)).getLocId(); - } - else - { + } else { region = MapRegionManager.getInstance().getMapRegionLocId(activeChar); } SystemMessage sm; - if (region > 0) - { + if (region > 0) { sm = SystemMessage.getSystemMessage(region); - if (sm.getSystemMessageId().getParamCount() == 3) - { + if (sm.getSystemMessageId().getParamCount() == 3) { sm.addInt(activeChar.getX()); sm.addInt(activeChar.getY()); sm.addInt(activeChar.getZ()); } - } - else - { + } else { sm = SystemMessage.getSystemMessage(SystemMessageId.CURRENT_LOCATION_S1); sm.addString(activeChar.getX() + ", " + activeChar.getY() + ", " + activeChar.getZ()); } @@ -72,8 +62,7 @@ public class Loc implements IUserCommandHandler } @Override - public int[] getUserCommandList() - { + public int[] getUserCommandList() { return COMMAND_IDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/Mount.java b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/Mount.java index 04a0a595bf..5455a52ec6 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/Mount.java +++ b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/Mount.java @@ -25,26 +25,21 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Mount user command. * @author Tempy */ -public class Mount implements IUserCommandHandler -{ - private static final int[] COMMAND_IDS = - { +public class Mount implements IUserCommandHandler { + private static final int[] COMMAND_IDS = { 61 }; @Override - public synchronized boolean useUserCommand(int id, L2PcInstance activeChar) - { - if (id != COMMAND_IDS[0]) - { + public synchronized boolean useUserCommand(int id, L2PcInstance activeChar) { + if (id != COMMAND_IDS[0]) { return false; } return activeChar.mountPlayer(activeChar.getSummon()); } @Override - public int[] getUserCommandList() - { + public int[] getUserCommandList() { return COMMAND_IDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/MyBirthday.java b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/MyBirthday.java index bf6f36db3f..c630a245b3 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/MyBirthday.java +++ b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/MyBirthday.java @@ -29,18 +29,14 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * My Birthday user command. * @author JIV */ -public class MyBirthday implements IUserCommandHandler -{ - private static final int[] COMMAND_IDS = - { +public class MyBirthday implements IUserCommandHandler { + private static final int[] COMMAND_IDS = { 126 }; @Override - public boolean useUserCommand(int id, L2PcInstance activeChar) - { - if (id != COMMAND_IDS[0]) - { + public boolean useUserCommand(int id, L2PcInstance activeChar) { + if (id != COMMAND_IDS[0]) { return false; } @@ -57,8 +53,7 @@ public class MyBirthday implements IUserCommandHandler } @Override - public int[] getUserCommandList() - { + public int[] getUserCommandList() { return COMMAND_IDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/OlympiadStat.java b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/OlympiadStat.java index 7ad25124ba..978f564ce8 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/OlympiadStat.java +++ b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/OlympiadStat.java @@ -29,37 +29,27 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Olympiad Stat user command. * @author kamy, Zoey76 */ -public class OlympiadStat implements IUserCommandHandler -{ - private static final int[] COMMAND_IDS = - { +public class OlympiadStat implements IUserCommandHandler { + private static final int[] COMMAND_IDS = { 109 }; @Override - public boolean useUserCommand(int id, L2PcInstance activeChar) - { - if (id != COMMAND_IDS[0]) - { + public boolean useUserCommand(int id, L2PcInstance activeChar) { + if (id != COMMAND_IDS[0]) { return false; } int nobleObjId = activeChar.getObjectId(); final L2Object target = activeChar.getTarget(); - if (target != null) - { - if (target.isPlayer() && target.getActingPlayer().isNoble()) - { + if (target != null) { + if (target.isPlayer() && target.getActingPlayer().isNoble()) { nobleObjId = target.getObjectId(); - } - else - { + } else { activeChar.sendPacket(SystemMessageId.NOBLESSE_ONLY); return false; } - } - else if (!activeChar.isNoble()) - { + } else if (!activeChar.isNoble()) { activeChar.sendPacket(SystemMessageId.NOBLESSE_ONLY); return false; } @@ -81,8 +71,7 @@ public class OlympiadStat implements IUserCommandHandler } @Override - public int[] getUserCommandList() - { + public int[] getUserCommandList() { return COMMAND_IDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/PartyInfo.java b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/PartyInfo.java index 699c096423..afb5c8fd35 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/PartyInfo.java +++ b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/PartyInfo.java @@ -28,27 +28,21 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Party Info user command. * @author Tempy */ -public class PartyInfo implements IUserCommandHandler -{ - private static final int[] COMMAND_IDS = - { +public class PartyInfo implements IUserCommandHandler { + private static final int[] COMMAND_IDS = { 81 }; @Override - public boolean useUserCommand(int id, L2PcInstance activeChar) - { - if (id != COMMAND_IDS[0]) - { + public boolean useUserCommand(int id, L2PcInstance activeChar) { + if (id != COMMAND_IDS[0]) { return false; } activeChar.sendPacket(SystemMessageId.PARTY_INFORMATION); - if (activeChar.isInParty()) - { + if (activeChar.isInParty()) { final L2Party party = activeChar.getParty(); - switch (party.getDistributionType()) - { + switch (party.getDistributionType()) { case FINDERS_KEEPERS: activeChar.sendPacket(SystemMessageId.LOOTING_FINDERS_KEEPERS); break; @@ -66,8 +60,7 @@ public class PartyInfo implements IUserCommandHandler break; } - if (!party.isLeader(activeChar)) - { + if (!party.isLeader(activeChar)) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.PARTY_LEADER_C1); sm.addPcName(party.getLeader()); activeChar.sendPacket(sm); @@ -79,8 +72,7 @@ public class PartyInfo implements IUserCommandHandler } @Override - public int[] getUserCommandList() - { + public int[] getUserCommandList() { return COMMAND_IDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/SiegeStatus.java b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/SiegeStatus.java index 16243c1e4a..c7f5d86945 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/SiegeStatus.java +++ b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/SiegeStatus.java @@ -30,10 +30,8 @@ import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; /** * @author Tryskell */ -public class SiegeStatus implements IUserCommandHandler -{ - private static final int[] COMMAND_IDS = - { +public class SiegeStatus implements IUserCommandHandler { + private static final int[] COMMAND_IDS = { 99 }; @@ -41,36 +39,29 @@ public class SiegeStatus implements IUserCommandHandler private static final String OUTSIDE_SIEGE_ZONE = "No Castle Siege Area"; @Override - public boolean useUserCommand(int id, L2PcInstance activeChar) - { - if (id != COMMAND_IDS[0]) - { + public boolean useUserCommand(int id, L2PcInstance activeChar) { + if (id != COMMAND_IDS[0]) { return false; } - if (!activeChar.isNoble() || !activeChar.isClanLeader()) - { + if (!activeChar.isNoble() || !activeChar.isClanLeader()) { activeChar.sendPacket(SystemMessageId.ONLY_NOBLESSE_LEADER_CAN_VIEW_SIEGE_STATUS_WINDOW); return false; } - for (Siege siege : SiegeManager.getInstance().getSieges()) - { - if (!siege.isInProgress()) - { + for (Siege siege : SiegeManager.getInstance().getSieges()) { + if (!siege.isInProgress()) { continue; } final L2Clan clan = activeChar.getClan(); - if (!siege.checkIsAttacker(clan) && !siege.checkIsDefender(clan)) - { + if (!siege.checkIsAttacker(clan) && !siege.checkIsDefender(clan)) { continue; } final L2SiegeZone siegeZone = siege.getCastle().getZone(); final StringBuilder sb = new StringBuilder(); - for (L2PcInstance member : clan.getOnlineMembers(0)) - { + for (L2PcInstance member : clan.getOnlineMembers(0)) { sb.append("<tr><td width=170>"); sb.append(member.getName()); sb.append("</td><td width=100>"); @@ -94,8 +85,7 @@ public class SiegeStatus implements IUserCommandHandler } @Override - public int[] getUserCommandList() - { + public int[] getUserCommandList() { return COMMAND_IDS; } diff --git a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/Time.java b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/Time.java index 0c1f95c191..8e249042ec 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/Time.java +++ b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/Time.java @@ -32,59 +32,47 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; /** * Time user command. */ -public class Time implements IUserCommandHandler -{ - private static final int[] COMMAND_IDS = - { +public class Time implements IUserCommandHandler { + private static final int[] COMMAND_IDS = { 77 }; private static final SimpleDateFormat fmt = new SimpleDateFormat("H:mm."); @Override - public boolean useUserCommand(int id, L2PcInstance activeChar) - { - if (COMMAND_IDS[0] != id) - { + public boolean useUserCommand(int id, L2PcInstance activeChar) { + if (COMMAND_IDS[0] != id) { return false; } int t = GameTimeController.getInstance().getGameTime(); String h = "" + ((t / 60) % 24); String m; - if ((t % 60) < 10) - { + if ((t % 60) < 10) { m = "0" + (t % 60); - } - else - { + } else { m = "" + (t % 60); } SystemMessage sm; - if (GameTimeController.getInstance().isNight()) - { + if (GameTimeController.getInstance().isNight()) { sm = SystemMessage.getSystemMessage(SystemMessageId.TIME_S1_S2_IN_THE_NIGHT); sm.addString(h); sm.addString(m); - } - else - { + } else { sm = SystemMessage.getSystemMessage(SystemMessageId.TIME_S1_S2_IN_THE_DAY); sm.addString(h); sm.addString(m); } activeChar.sendPacket(sm); - if (customs().displayServerTime()) - { + if (customs().displayServerTime()) { activeChar.sendMessage("Server time is " + fmt.format(new Date(System.currentTimeMillis()))); } return true; } @Override - public int[] getUserCommandList() - { + public int[] getUserCommandList() { return COMMAND_IDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/Unstuck.java b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/Unstuck.java index 219ea00675..dbe0c5a4f4 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/Unstuck.java +++ b/src/main/java/com/l2jserver/datapack/handlers/usercommandhandlers/Unstuck.java @@ -42,8 +42,7 @@ import com.l2jserver.gameserver.util.Broadcast; * @author Zoey76 * @since 2.6.0.0 */ -public class Unstuck implements IUserCommandHandler -{ +public class Unstuck implements IUserCommandHandler { private static final long FIVE_MINUTES = MINUTES.toSeconds(5); private static final SkillHolder ESCAPE_5_MINUTES = new SkillHolder(2099); @@ -52,60 +51,49 @@ public class Unstuck implements IUserCommandHandler private static final int RETURN = 1050; - private static final int[] COMMAND_IDS = - { + private static final int[] COMMAND_IDS = { 52 }; @Override - public boolean useUserCommand(int id, L2PcInstance activeChar) - { - if (!TvTEvent.onEscapeUse(activeChar.getObjectId())) - { + public boolean useUserCommand(int id, L2PcInstance activeChar) { + if (!TvTEvent.onEscapeUse(activeChar.getObjectId())) { activeChar.sendPacket(STATIC_PACKET); return false; } - if (activeChar.isJailed()) - { + if (activeChar.isJailed()) { activeChar.sendMessage("You cannot use unstuck while you are in jail."); return false; } - if (activeChar.isInOlympiadMode()) - { + if (activeChar.isInOlympiadMode()) { activeChar.sendPacket(THIS_SKILL_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT); return false; } if (activeChar.isCastingNow() || activeChar.isMovementDisabled() || activeChar.isMuted() || // - activeChar.isAlikeDead() || activeChar.inObserverMode() || activeChar.isCombatFlagEquipped()) - { + activeChar.isAlikeDead() || activeChar.inObserverMode() || activeChar.isCombatFlagEquipped()) { return false; } final int unstuckTimer = (activeChar.isGM() ? 1000 : character().getUnstuckInterval()); activeChar.forceIsCasting(GameTimeController.getInstance().getGameTicks() + (unstuckTimer / MILLIS_IN_TICK)); - if (activeChar.isGM()) - { + if (activeChar.isGM()) { activeChar.doCast(ESCAPE_1_SECOND); return true; } - if (character().getUnstuckInterval() == FIVE_MINUTES) - { + if (character().getUnstuckInterval() == FIVE_MINUTES) { activeChar.doCast(ESCAPE_5_MINUTES); return true; } - if (character().getUnstuckInterval() > 100) - { + if (character().getUnstuckInterval() > 100) { activeChar.sendMessage("You use Escape: " + SECONDS.toMinutes(character().getUnstuckInterval()) + " minutes."); - } - else - { - activeChar.sendMessage("You use Escape: " +character().getUnstuckInterval() + " seconds."); + } else { + activeChar.sendMessage("You use Escape: " + character().getUnstuckInterval() + " seconds."); } activeChar.getAI().setIntention(AI_INTENTION_IDLE); @@ -117,10 +105,8 @@ public class Unstuck implements IUserCommandHandler // End SoE Animation section // Continue execution later - activeChar.setSkillCast(ThreadPoolManager.getInstance().scheduleGeneral(() -> - { - if (!activeChar.isDead()) - { + activeChar.setSkillCast(ThreadPoolManager.getInstance().scheduleGeneral(() -> { + if (!activeChar.isDead()) { activeChar.setIsIn7sDungeon(false); activeChar.enableAllSkills(); activeChar.setIsCastingNow(false); @@ -132,8 +118,7 @@ public class Unstuck implements IUserCommandHandler } @Override - public int[] getUserCommandList() - { + public int[] getUserCommandList() { return COMMAND_IDS; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/Banking.java b/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/Banking.java index 35645a64e5..0c262cbd7a 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/Banking.java +++ b/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/Banking.java @@ -27,53 +27,37 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * This class trades Gold Bars for Adena and vice versa. * @author Ahmed */ -public class Banking implements IVoicedCommandHandler -{ - private static final String[] _voicedCommands = - { +public class Banking implements IVoicedCommandHandler { + private static final String[] _voicedCommands = { "bank", "withdraw", "deposit" }; @Override - public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) - { - if (command.equals("bank")) - { + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) { + if (command.equals("bank")) { activeChar.sendMessage(".deposit (" + customs().getBankingAdenaCount() + " Adena = " + customs().getBankingGoldbarCount() + " Goldbar) / .withdraw (" + customs().getBankingGoldbarCount() + " Goldbar = " + customs().getBankingAdenaCount() + " Adena)"); - } - else if (command.equals("deposit")) - { - if (activeChar.getInventory().getInventoryItemCount(57, 0) >= customs().getBankingAdenaCount()) - { - if (!activeChar.reduceAdena("Goldbar", customs().getBankingAdenaCount(), activeChar, false)) - { + } else if (command.equals("deposit")) { + if (activeChar.getInventory().getInventoryItemCount(57, 0) >= customs().getBankingAdenaCount()) { + if (!activeChar.reduceAdena("Goldbar", customs().getBankingAdenaCount(), activeChar, false)) { return false; } activeChar.getInventory().addItem("Goldbar", 3470, customs().getBankingGoldbarCount(), activeChar, null); activeChar.getInventory().updateDatabase(); activeChar.sendMessage("Thank you, you now have " + customs().getBankingGoldbarCount() + " Goldbar(s), and " + customs().getBankingAdenaCount() + " less adena."); - } - else - { + } else { activeChar.sendMessage("You do not have enough Adena to convert to Goldbar(s), you need " + customs().getBankingAdenaCount() + " Adena."); } - } - else if (command.equals("withdraw")) - { - if (activeChar.getInventory().getInventoryItemCount(3470, 0) >= customs().getBankingGoldbarCount()) - { - if (!activeChar.destroyItemByItemId("Adena", 3470, customs().getBankingGoldbarCount(), activeChar, false)) - { + } else if (command.equals("withdraw")) { + if (activeChar.getInventory().getInventoryItemCount(3470, 0) >= customs().getBankingGoldbarCount()) { + if (!activeChar.destroyItemByItemId("Adena", 3470, customs().getBankingGoldbarCount(), activeChar, false)) { return false; } activeChar.getInventory().addAdena("Adena", customs().getBankingAdenaCount(), activeChar, null); activeChar.getInventory().updateDatabase(); activeChar.sendMessage("Thank you, you now have " + customs().getBankingAdenaCount() + " Adena, and " + customs().getBankingGoldbarCount() + " less Goldbar(s)."); - } - else - { + } else { activeChar.sendMessage("You do not have any Goldbars to turn into " + customs().getBankingAdenaCount() + " Adena."); } } @@ -81,8 +65,7 @@ public class Banking implements IVoicedCommandHandler } @Override - public String[] getVoicedCommandList() - { + public String[] getVoicedCommandList() { return _voicedCommands; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/CastleVCmd.java b/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/CastleVCmd.java index 7e600037c8..b02dcb5a31 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/CastleVCmd.java +++ b/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/CastleVCmd.java @@ -28,98 +28,81 @@ import com.l2jserver.gameserver.network.SystemMessageId; /** * @author Zoey76 */ -public class CastleVCmd implements IVoicedCommandHandler -{ - private static final String[] VOICED_COMMANDS = - { +public class CastleVCmd implements IVoicedCommandHandler { + private static final String[] VOICED_COMMANDS = { "opendoors", "closedoors", "ridewyvern" }; @Override - public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) - { - switch (command) - { + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) { + switch (command) { case "opendoors": - if (!params.equals("castle")) - { + if (!params.equals("castle")) { activeChar.sendMessage("Only Castle doors can be open."); return false; } - if (!activeChar.isClanLeader()) - { + if (!activeChar.isClanLeader()) { activeChar.sendPacket(SystemMessageId.ONLY_CLAN_LEADER_CAN_ISSUE_COMMANDS); return false; } final L2DoorInstance door = (L2DoorInstance) activeChar.getTarget(); - if (door == null) - { + if (door == null) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return false; } final Castle castle = CastleManager.getInstance().getCastleById(activeChar.getClan().getCastleId()); - if (castle == null) - { + if (castle == null) { activeChar.sendMessage("Your clan does not own a castle."); return false; } - if (castle.getSiege().isInProgress()) - { + if (castle.getSiege().isInProgress()) { activeChar.sendPacket(SystemMessageId.GATES_NOT_OPENED_CLOSED_DURING_SIEGE); return false; } - if (castle.checkIfInZone(door.getX(), door.getY(), door.getZ())) - { + if (castle.checkIfInZone(door.getX(), door.getY(), door.getZ())) { activeChar.sendPacket(SystemMessageId.GATE_IS_OPENING); door.openMe(); } break; case "closedoors": - if (!params.equals("castle")) - { + if (!params.equals("castle")) { activeChar.sendMessage("Only Castle doors can be closed."); return false; } - if (!activeChar.isClanLeader()) - { + if (!activeChar.isClanLeader()) { activeChar.sendPacket(SystemMessageId.ONLY_CLAN_LEADER_CAN_ISSUE_COMMANDS); return false; } final L2DoorInstance door2 = (L2DoorInstance) activeChar.getTarget(); - if (door2 == null) - { + if (door2 == null) { activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); return false; } final Castle castle2 = CastleManager.getInstance().getCastleById(activeChar.getClan().getCastleId()); - if (castle2 == null) - { + if (castle2 == null) { activeChar.sendMessage("Your clan does not own a castle."); return false; } - if (castle2.getSiege().isInProgress()) - { + if (castle2.getSiege().isInProgress()) { activeChar.sendPacket(SystemMessageId.GATES_NOT_OPENED_CLOSED_DURING_SIEGE); return false; } - if (castle2.checkIfInZone(door2.getX(), door2.getY(), door2.getZ())) - { + if (castle2.checkIfInZone(door2.getX(), door2.getY(), door2.getZ())) { activeChar.sendMessage("The gate is being closed."); door2.closeMe(); } break; case "ridewyvern": - if (activeChar.isClanLeader() && (activeChar.getClan().getCastleId() > 0)) - { + if (activeChar.isClanLeader() && (activeChar.getClan().getCastleId() > 0)) { activeChar.mount(12621, 0, true); } break; @@ -128,8 +111,7 @@ public class CastleVCmd implements IVoicedCommandHandler } @Override - public String[] getVoicedCommandList() - { + public String[] getVoicedCommandList() { return VOICED_COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/ChangePassword.java b/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/ChangePassword.java index dd3293a103..19104a883a 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/ChangePassword.java +++ b/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/ChangePassword.java @@ -30,73 +30,54 @@ import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; /** * @author Nik */ -public class ChangePassword implements IVoicedCommandHandler -{ - private static final String[] _voicedCommands = - { +public class ChangePassword implements IVoicedCommandHandler { + private static final String[] _voicedCommands = { "changepassword" }; @Override - public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target) - { - if (target != null) - { + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target) { + if (target != null) { final StringTokenizer st = new StringTokenizer(target); - try - { + try { String curpass = null, newpass = null, repeatnewpass = null; - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { curpass = st.nextToken(); } - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { newpass = st.nextToken(); } - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { repeatnewpass = st.nextToken(); } - if (!((curpass == null) || (newpass == null) || (repeatnewpass == null))) - { - if (!newpass.equals(repeatnewpass)) - { + if (!((curpass == null) || (newpass == null) || (repeatnewpass == null))) { + if (!newpass.equals(repeatnewpass)) { activeChar.sendMessage("The new password doesn't match with the repeated one!"); return false; } - if (newpass.length() < 3) - { + if (newpass.length() < 3) { activeChar.sendMessage("The new password is shorter than 3 chars! Please try with a longer one."); return false; } - if (newpass.length() > 30) - { + if (newpass.length() > 30) { activeChar.sendMessage("The new password is longer than 30 chars! Please try with a shorter one."); return false; } LoginServerThread.getInstance().sendChangePassword(activeChar.getAccountName(), activeChar.getName(), curpass, newpass); - } - else - { + } else { activeChar.sendMessage("Invalid password data! You have to fill all boxes."); return false; } - } - catch (Exception e) - { + } catch (Exception e) { activeChar.sendMessage("A problem occured while changing password!"); _log.log(Level.WARNING, "", e); } - } - else - { + } else { // showHTML(activeChar); String html = HtmCache.getInstance().getHtm("en", "data/html/mods/ChangePassword.htm"); - if (html == null) - { + if (html == null) { html = "<html><body><br><br><center><font color=LEVEL>404:</font> File Not Found</center></body></html>"; } activeChar.sendPacket(new NpcHtmlMessage(html)); @@ -106,8 +87,7 @@ public class ChangePassword implements IVoicedCommandHandler } @Override - public String[] getVoicedCommandList() - { + public String[] getVoicedCommandList() { return _voicedCommands; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/ChatAdmin.java b/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/ChatAdmin.java index 7177efd457..dda9a732d0 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/ChatAdmin.java +++ b/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/ChatAdmin.java @@ -31,69 +31,55 @@ import com.l2jserver.gameserver.model.punishment.PunishmentTask; import com.l2jserver.gameserver.model.punishment.PunishmentType; import com.l2jserver.gameserver.util.Util; -public class ChatAdmin implements IVoicedCommandHandler -{ - private static final String[] VOICED_COMMANDS = - { +public class ChatAdmin implements IVoicedCommandHandler { + private static final String[] VOICED_COMMANDS = { "banchat", "unbanchat" }; @Override - public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) - { - if (!AdminData.getInstance().hasAccess(command, activeChar.getAccessLevel())) - { + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) { + if (!AdminData.getInstance().hasAccess(command, activeChar.getAccessLevel())) { return false; } if (command.equals(VOICED_COMMANDS[0])) // banchat { - if (params == null) - { + if (params == null) { activeChar.sendMessage("Usage: .banchat name [minutes]"); return true; } StringTokenizer st = new StringTokenizer(params); - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { String name = st.nextToken(); long expirationTime = 0; - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { String token = st.nextToken(); - if (Util.isDigit(token)) - { + if (Util.isDigit(token)) { expirationTime = System.currentTimeMillis() + (Integer.parseInt(st.nextToken()) * 60 * 1000); } } int objId = CharNameTable.getInstance().getIdByName(name); - if (objId > 0) - { + if (objId > 0) { L2PcInstance player = L2World.getInstance().getPlayer(objId); - if ((player == null) || !player.isOnline()) - { + if ((player == null) || !player.isOnline()) { activeChar.sendMessage("Player not online !"); return false; } - if (player.isChatBanned()) - { + if (player.isChatBanned()) { activeChar.sendMessage("Player is already punished !"); return false; } - if (player == activeChar) - { + if (player == activeChar) { activeChar.sendMessage("You can't ban yourself !"); return false; } - if (player.isGM()) - { + if (player.isGM()) { activeChar.sendMessage("You can't ban GM !"); return false; } - if (AdminData.getInstance().hasAccess(command, player.getAccessLevel())) - { + if (AdminData.getInstance().hasAccess(command, player.getAccessLevel())) { activeChar.sendMessage("You can't ban moderator !"); return false; } @@ -101,45 +87,34 @@ public class ChatAdmin implements IVoicedCommandHandler PunishmentManager.getInstance().startPunishment(new PunishmentTask(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN, expirationTime, "Chat banned by moderator", activeChar.getName())); player.sendMessage("Chat banned by moderator " + activeChar.getName()); - if (expirationTime > 0) - { + if (expirationTime > 0) { activeChar.sendMessage("Player " + player.getName() + " chat banned for " + expirationTime + " minutes."); - } - else - { + } else { activeChar.sendMessage("Player " + player.getName() + " chat banned forever."); } - } - else - { + } else { activeChar.sendMessage("Player not found !"); return false; } } - } - else if (command.equals(VOICED_COMMANDS[1])) // unbanchat + } else if (command.equals(VOICED_COMMANDS[1])) // unbanchat { - if (params == null) - { + if (params == null) { activeChar.sendMessage("Usage: .unbanchat name"); return true; } StringTokenizer st = new StringTokenizer(params); - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { String name = st.nextToken(); int objId = CharNameTable.getInstance().getIdByName(name); - if (objId > 0) - { + if (objId > 0) { L2PcInstance player = L2World.getInstance().getPlayer(objId); - if ((player == null) || !player.isOnline()) - { + if ((player == null) || !player.isOnline()) { activeChar.sendMessage("Player not online !"); return false; } - if (!player.isChatBanned()) - { + if (!player.isChatBanned()) { activeChar.sendMessage("Player is not chat banned !"); return false; } @@ -148,9 +123,7 @@ public class ChatAdmin implements IVoicedCommandHandler activeChar.sendMessage("Player " + player.getName() + " chat unbanned."); player.sendMessage("Chat unbanned by moderator " + activeChar.getName()); - } - else - { + } else { activeChar.sendMessage("Player not found !"); return false; } @@ -160,8 +133,7 @@ public class ChatAdmin implements IVoicedCommandHandler } @Override - public String[] getVoicedCommandList() - { + public String[] getVoicedCommandList() { return VOICED_COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/Debug.java b/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/Debug.java index 1a56d46ed6..0fa92333d4 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/Debug.java +++ b/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/Debug.java @@ -22,30 +22,22 @@ import com.l2jserver.gameserver.data.xml.impl.AdminData; import com.l2jserver.gameserver.handler.IVoicedCommandHandler; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -public class Debug implements IVoicedCommandHandler -{ - private static final String[] VOICED_COMMANDS = - { +public class Debug implements IVoicedCommandHandler { + private static final String[] VOICED_COMMANDS = { "debug" }; @Override - public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) - { - if (!AdminData.getInstance().hasAccess(command, activeChar.getAccessLevel())) - { + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) { + if (!AdminData.getInstance().hasAccess(command, activeChar.getAccessLevel())) { return false; } - if (VOICED_COMMANDS[0].equalsIgnoreCase(command)) - { - if (activeChar.isDebug()) - { + if (VOICED_COMMANDS[0].equalsIgnoreCase(command)) { + if (activeChar.isDebug()) { activeChar.setDebug(null); activeChar.sendMessage("Debugging disabled."); - } - else - { + } else { activeChar.setDebug(activeChar); activeChar.sendMessage("Debugging enabled."); } @@ -54,8 +46,7 @@ public class Debug implements IVoicedCommandHandler } @Override - public String[] getVoicedCommandList() - { + public String[] getVoicedCommandList() { return VOICED_COMMANDS; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/Hellbound.java b/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/Hellbound.java index f5e3498afa..bfc9761b2c 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/Hellbound.java +++ b/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/Hellbound.java @@ -26,18 +26,14 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Hellbound voiced command. * @author DS */ -public class Hellbound implements IVoicedCommandHandler -{ - private static final String[] VOICED_COMMANDS = - { +public class Hellbound implements IVoicedCommandHandler { + private static final String[] VOICED_COMMANDS = { "hellbound" }; @Override - public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) - { - if (HellboundEngine.getInstance().isLocked()) - { + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) { + if (HellboundEngine.getInstance().isLocked()) { activeChar.sendMessage("Hellbound is currently locked."); return true; } @@ -48,8 +44,7 @@ public class Hellbound implements IVoicedCommandHandler } @Override - public String[] getVoicedCommandList() - { + public String[] getVoicedCommandList() { return VOICED_COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/Lang.java b/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/Lang.java index 71bed4bf00..bbacf0c449 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/Lang.java +++ b/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/Lang.java @@ -27,27 +27,21 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; import com.l2jserver.gameserver.util.StringUtil; -public class Lang implements IVoicedCommandHandler -{ - private static final String[] VOICED_COMMANDS = - { +public class Lang implements IVoicedCommandHandler { + private static final String[] VOICED_COMMANDS = { "lang" }; @Override - public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) - { - if (!customs().multiLangEnable() || !customs().multiLangVoiceCommand()) - { + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) { + if (!customs().multiLangEnable() || !customs().multiLangVoiceCommand()) { return false; } final NpcHtmlMessage msg = new NpcHtmlMessage(); - if (params == null) - { + if (params == null) { final StringBuilder html = StringUtil.startAppend(100); - for (String lang : customs().getMultiLangAllowed()) - { + for (String lang : customs().getMultiLangAllowed()) { StringUtil.append(html, "<button value=\"", lang.toUpperCase(), "\" action=\"bypass -h voice .lang ", lang, "\" width=60 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><br>"); } @@ -58,11 +52,9 @@ public class Lang implements IVoicedCommandHandler } final StringTokenizer st = new StringTokenizer(params); - if (st.hasMoreTokens()) - { + if (st.hasMoreTokens()) { final String lang = st.nextToken().trim(); - if (activeChar.setLang(lang)) - { + if (activeChar.setLang(lang)) { msg.setFile(activeChar.getHtmlPrefix(), "data/html/mods/Lang/Ok.htm"); activeChar.sendPacket(msg); return true; @@ -75,8 +67,7 @@ public class Lang implements IVoicedCommandHandler } @Override - public String[] getVoicedCommandList() - { + public String[] getVoicedCommandList() { return VOICED_COMMANDS; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/SetVCmd.java b/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/SetVCmd.java index 7c81bf3b7d..c7449c98d1 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/SetVCmd.java +++ b/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/SetVCmd.java @@ -26,51 +26,40 @@ import com.l2jserver.gameserver.util.Util; /** * @author Zoey76 */ -public class SetVCmd implements IVoicedCommandHandler -{ - private static final String[] VOICED_COMMANDS = - { +public class SetVCmd implements IVoicedCommandHandler { + private static final String[] VOICED_COMMANDS = { "set name", "set home", "set group" }; @Override - public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) - { - if (command.equals("set")) - { + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) { + if (command.equals("set")) { final L2Object target = activeChar.getTarget(); - if ((target == null) || !target.isPlayer()) - { + if ((target == null) || !target.isPlayer()) { return false; } final L2PcInstance player = activeChar.getTarget().getActingPlayer(); - if ((activeChar.getClan() == null) || (player.getClan() == null) || (activeChar.getClan().getId() != player.getClan().getId())) - { + if ((activeChar.getClan() == null) || (player.getClan() == null) || (activeChar.getClan().getId() != player.getClan().getId())) { return false; } - if (params.startsWith("privileges")) - { + if (params.startsWith("privileges")) { final String val = params.substring(11); - if (!Util.isDigit(val)) - { + if (!Util.isDigit(val)) { return false; } final int n = Integer.parseInt(val); - if ((activeChar.getClanPrivileges().getBitmask() <= n) || !activeChar.isClanLeader()) - { + if ((activeChar.getClanPrivileges().getBitmask() <= n) || !activeChar.isClanLeader()) { return false; } player.getClanPrivileges().setBitmask(n); activeChar.sendMessage("Your clan privileges have been set to " + n + " by " + activeChar.getName() + "."); - } - else if (params.startsWith("title")) - { + } else if (params.startsWith("title")) { // TODO why is this empty? } } @@ -78,8 +67,7 @@ public class SetVCmd implements IVoicedCommandHandler } @Override - public String[] getVoicedCommandList() - { + public String[] getVoicedCommandList() { return VOICED_COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/StatsVCmd.java b/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/StatsVCmd.java index 1f280f75e6..4bbddfed1e 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/StatsVCmd.java +++ b/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/StatsVCmd.java @@ -32,47 +32,39 @@ import com.l2jserver.gameserver.util.StringUtil; /** * @author Zoey76. */ -public class StatsVCmd implements IVoicedCommandHandler -{ - private static final String[] VOICED_COMMANDS = - { +public class StatsVCmd implements IVoicedCommandHandler { + private static final String[] VOICED_COMMANDS = { "stats" }; @Override - public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) - { - if (!command.equals("stats") || (params == null) || params.isEmpty()) - { + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) { + if (!command.equals("stats") || (params == null) || params.isEmpty()) { activeChar.sendMessage("Usage: .stats <player name>"); return false; } final L2PcInstance pc = L2World.getInstance().getPlayer(params); - if ((pc == null)) - { + if ((pc == null)) { activeChar.sendPacket(TARGET_IS_NOT_FOUND_IN_THE_GAME); return false; } - if (pc.getClient().isDetached()) - { + if (pc.getClient().isDetached()) { final SystemMessage sm = SystemMessage.getSystemMessage(S1_OFFLINE); sm.addPcName(pc); activeChar.sendPacket(sm); return false; } - if (!L2Event.isParticipant(pc) || (pc.getEventStatus() == null)) - { + if (!L2Event.isParticipant(pc) || (pc.getEventStatus() == null)) { activeChar.sendMessage("That player is not an event participant."); return false; } final StringBuilder replyMSG = StringUtil.startAppend(300 + (pc.getEventStatus().getKills().size() * 50), "<html><body>" + "<center><font color=\"LEVEL\">[ L2J EVENT ENGINE ]</font></center><br><br>Statistics for player <font color=\"LEVEL\">", pc.getName(), "</font><br>Total kills <font color=\"FF0000\">", String.valueOf(pc.getEventStatus().getKills().size()), "</font><br><br>Detailed list: <br>"); - for (L2PcInstance plr : pc.getEventStatus().getKills()) - { + for (L2PcInstance plr : pc.getEventStatus().getKills()) { StringUtil.append(replyMSG, "<font color=\"FF0000\">", plr.getName(), "</font><br>"); } replyMSG.append("</body></html>"); @@ -83,8 +75,7 @@ public class StatsVCmd implements IVoicedCommandHandler } @Override - public String[] getVoicedCommandList() - { + public String[] getVoicedCommandList() { return VOICED_COMMANDS; } } diff --git a/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/Wedding.java b/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/Wedding.java index e3d8c4ed1d..b9e56e8cfe 100644 --- a/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/Wedding.java +++ b/src/main/java/com/l2jserver/datapack/handlers/voicedcommandhandlers/Wedding.java @@ -55,42 +55,31 @@ import com.l2jserver.gameserver.util.Broadcast; * Wedding voiced commands handler. * @author evill33t */ -public class Wedding implements IVoicedCommandHandler -{ +public class Wedding implements IVoicedCommandHandler { static final Logger _log = Logger.getLogger(Wedding.class.getName()); - private static final String[] _voicedCommands = - { + private static final String[] _voicedCommands = { "divorce", "engage", "gotolove" }; @Override - public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) - { - if (activeChar == null) - { + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) { + if (activeChar == null) { return false; } - if (command.startsWith("engage")) - { + if (command.startsWith("engage")) { return engage(activeChar); - } - else if (command.startsWith("divorce")) - { + } else if (command.startsWith("divorce")) { return divorce(activeChar); - } - else if (command.startsWith("gotolove")) - { + } else if (command.startsWith("gotolove")) { return goToLove(activeChar); } return false; } - public boolean divorce(L2PcInstance activeChar) - { - if (activeChar.getPartnerId() == 0) - { + public boolean divorce(L2PcInstance activeChar) { + if (activeChar.getPartnerId() == 0) { return false; } @@ -98,35 +87,27 @@ public class Wedding implements IVoicedCommandHandler int _coupleId = activeChar.getCoupleId(); long adenaAmount = 0; - if (activeChar.isMarried()) - { + if (activeChar.isMarried()) { activeChar.sendMessage("You are now divorced."); adenaAmount = (activeChar.getAdena() / 100) * customs().getWeddingDivorceCosts(); activeChar.getInventory().reduceAdena("Wedding", adenaAmount, activeChar, null); - } - else - { + } else { activeChar.sendMessage("You have broken up as a couple."); } final L2PcInstance partner = L2World.getInstance().getPlayer(_partnerId); - if (partner != null) - { + if (partner != null) { partner.setPartnerId(0); - if (partner.isMarried()) - { + if (partner.isMarried()) { partner.sendMessage("Your spouse has decided to divorce you."); - } - else - { + } else { partner.sendMessage("Your fiance has decided to break the engagement with you."); } // give adena - if (adenaAmount > 0) - { + if (adenaAmount > 0) { partner.addAdena("WEDDING", adenaAmount, null, false); } } @@ -134,46 +115,34 @@ public class Wedding implements IVoicedCommandHandler return true; } - public boolean engage(L2PcInstance activeChar) - { - if (activeChar.getTarget() == null) - { + public boolean engage(L2PcInstance activeChar) { + if (activeChar.getTarget() == null) { activeChar.sendMessage("You have no one targeted."); return false; - } - else if (!(activeChar.getTarget() instanceof L2PcInstance)) - { + } else if (!(activeChar.getTarget() instanceof L2PcInstance)) { activeChar.sendMessage("You can only ask another player to engage you."); return false; - } - else if (activeChar.getPartnerId() != 0) - { + } else if (activeChar.getPartnerId() != 0) { activeChar.sendMessage("You are already engaged."); - if (customs().weddingPunishInfidelity()) - { + if (customs().weddingPunishInfidelity()) { activeChar.startAbnormalVisualEffect(true, AbnormalVisualEffect.BIG_HEAD); // give player a Big Head // lets recycle the sevensigns debuffs int skillId; int skillLevel = 1; - if (activeChar.getLevel() > 40) - { + if (activeChar.getLevel() > 40) { skillLevel = 2; } - if (activeChar.isMageClass()) - { + if (activeChar.isMageClass()) { skillId = 4362; - } - else - { + } else { skillId = 4361; } final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); - if (!activeChar.isAffectedBySkill(skillId)) - { + if (!activeChar.isAffectedBySkill(skillId)) { skill.applyEffects(activeChar, activeChar); } } @@ -181,32 +150,27 @@ public class Wedding implements IVoicedCommandHandler } final L2PcInstance ptarget = (L2PcInstance) activeChar.getTarget(); // check if player target himself - if (ptarget.getObjectId() == activeChar.getObjectId()) - { + if (ptarget.getObjectId() == activeChar.getObjectId()) { activeChar.sendMessage("Is there something wrong with you, are you trying to go out with youself?"); return false; } - if (ptarget.isMarried()) - { + if (ptarget.isMarried()) { activeChar.sendMessage("Player already married."); return false; } - if (ptarget.isEngageRequest()) - { + if (ptarget.isEngageRequest()) { activeChar.sendMessage("Player already asked by someone else."); return false; } - if (ptarget.getPartnerId() != 0) - { + if (ptarget.getPartnerId() != 0) { activeChar.sendMessage("Player already engaged with someone else."); return false; } - if ((ptarget.getAppearance().getSex() == activeChar.getAppearance().getSex()) && !customs().weddingAllowSameSex()) - { + if ((ptarget.getAppearance().getSex() == activeChar.getAppearance().getSex()) && !customs().weddingAllowSameSex()) { activeChar.sendMessage("Gay marriage is not allowed on this server!"); return false; } @@ -214,27 +178,20 @@ public class Wedding implements IVoicedCommandHandler // Check if target has player on friend list boolean foundOnFriendList = false; try (Connection con = ConnectionFactory.getInstance().getConnection(); - PreparedStatement statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=?")) - { + PreparedStatement statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=?")) { statement.setInt(1, ptarget.getObjectId()); - try (ResultSet rset = statement.executeQuery()) - { - while (rset.next()) - { - if (rset.getInt("friendId") == activeChar.getObjectId()) - { + try (ResultSet rset = statement.executeQuery()) { + while (rset.next()) { + if (rset.getInt("friendId") == activeChar.getObjectId()) { foundOnFriendList = true; } } } - } - catch (Exception e) - { + } catch (Exception e) { _log.warning("could not read friend data:" + e); } - if (!foundOnFriendList) - { + if (!foundOnFriendList) { activeChar.sendMessage("The player you want to ask is not on your friends list, you must first be on each others friends list before you choose to engage."); return false; } @@ -248,211 +205,174 @@ public class Wedding implements IVoicedCommandHandler return true; } - public boolean goToLove(L2PcInstance activeChar) - { - if (!activeChar.isMarried()) - { + public boolean goToLove(L2PcInstance activeChar) { + if (!activeChar.isMarried()) { activeChar.sendMessage("You're not married."); return false; } - if (activeChar.getPartnerId() == 0) - { + if (activeChar.getPartnerId() == 0) { activeChar.sendMessage("Couldn't find your fiance in the Database - Inform a Gamemaster."); _log.severe("Married but couldn't find parter for " + activeChar.getName()); return false; } - if (GrandBossManager.getInstance().getZone(activeChar) != null) - { + if (GrandBossManager.getInstance().getZone(activeChar) != null) { activeChar.sendMessage("You are inside a Boss Zone."); return false; } - if (activeChar.isCombatFlagEquipped()) - { + if (activeChar.isCombatFlagEquipped()) { activeChar.sendMessage("While you are holding a Combat Flag or Territory Ward you can't go to your love!"); return false; } - if (activeChar.isCursedWeaponEquipped()) - { + if (activeChar.isCursedWeaponEquipped()) { activeChar.sendMessage("While you are holding a Cursed Weapon you can't go to your love!"); return false; } - if (GrandBossManager.getInstance().getZone(activeChar) != null) - { + if (GrandBossManager.getInstance().getZone(activeChar) != null) { activeChar.sendMessage("You are inside a Boss Zone."); return false; } - if (activeChar.isJailed()) - { + if (activeChar.isJailed()) { activeChar.sendMessage("You are in Jail!"); return false; } - if (activeChar.isInOlympiadMode()) - { + if (activeChar.isInOlympiadMode()) { activeChar.sendMessage("You are in the Olympiad now."); return false; } - if (L2Event.isParticipant(activeChar)) - { + if (L2Event.isParticipant(activeChar)) { activeChar.sendMessage("You are in an event."); return false; } - if (activeChar.isInDuel()) - { + if (activeChar.isInDuel()) { activeChar.sendMessage("You are in a duel!"); return false; } - if (activeChar.inObserverMode()) - { + if (activeChar.inObserverMode()) { activeChar.sendMessage("You are in the observation."); return false; } - if ((SiegeManager.getInstance().getSiege(activeChar) != null) && SiegeManager.getInstance().getSiege(activeChar).isInProgress()) - { + if ((SiegeManager.getInstance().getSiege(activeChar) != null) && SiegeManager.getInstance().getSiege(activeChar).isInProgress()) { activeChar.sendMessage("You are in a siege, you cannot go to your partner."); return false; } - if (activeChar.isFestivalParticipant()) - { + if (activeChar.isFestivalParticipant()) { activeChar.sendMessage("You are in a festival."); return false; } - if (activeChar.isInParty() && activeChar.getParty().isInDimensionalRift()) - { + if (activeChar.isInParty() && activeChar.getParty().isInDimensionalRift()) { activeChar.sendMessage("You are in the dimensional rift."); return false; } // Thanks nbd - if (!TvTEvent.onEscapeUse(activeChar.getObjectId())) - { + if (!TvTEvent.onEscapeUse(activeChar.getObjectId())) { activeChar.sendPacket(ActionFailed.STATIC_PACKET); return false; } - if (activeChar.isInsideZone(ZoneId.NO_SUMMON_FRIEND)) - { + if (activeChar.isInsideZone(ZoneId.NO_SUMMON_FRIEND)) { activeChar.sendMessage("You are in area which blocks summoning."); return false; } final L2PcInstance partner = L2World.getInstance().getPlayer(activeChar.getPartnerId()); - if ((partner == null) || !partner.isOnline()) - { + if ((partner == null) || !partner.isOnline()) { activeChar.sendMessage("Your partner is not online."); return false; } - if (activeChar.getInstanceId() != partner.getInstanceId()) - { + if (activeChar.getInstanceId() != partner.getInstanceId()) { activeChar.sendMessage("Your partner is in another World!"); return false; } - if (partner.isJailed()) - { + if (partner.isJailed()) { activeChar.sendMessage("Your partner is in Jail."); return false; } - if (partner.isCursedWeaponEquipped()) - { + if (partner.isCursedWeaponEquipped()) { activeChar.sendMessage("Your partner is holding a Cursed Weapon and you can't go to your love!"); return false; } - if (GrandBossManager.getInstance().getZone(partner) != null) - { + if (GrandBossManager.getInstance().getZone(partner) != null) { activeChar.sendMessage("Your partner is inside a Boss Zone."); return false; } - if (partner.isInOlympiadMode()) - { + if (partner.isInOlympiadMode()) { activeChar.sendMessage("Your partner is in the Olympiad now."); return false; } - if (L2Event.isParticipant(partner)) - { + if (L2Event.isParticipant(partner)) { activeChar.sendMessage("Your partner is in an event."); return false; } - if (partner.isInDuel()) - { + if (partner.isInDuel()) { activeChar.sendMessage("Your partner is in a duel."); return false; } - if (partner.isFestivalParticipant()) - { + if (partner.isFestivalParticipant()) { activeChar.sendMessage("Your partner is in a festival."); return false; } - if (partner.isInParty() && partner.getParty().isInDimensionalRift()) - { + if (partner.isInParty() && partner.getParty().isInDimensionalRift()) { activeChar.sendMessage("Your partner is in dimensional rift."); return false; } - if (partner.inObserverMode()) - { + if (partner.inObserverMode()) { activeChar.sendMessage("Your partner is in the observation."); return false; } - if ((SiegeManager.getInstance().getSiege(partner) != null) && SiegeManager.getInstance().getSiege(partner).isInProgress()) - { + if ((SiegeManager.getInstance().getSiege(partner) != null) && SiegeManager.getInstance().getSiege(partner).isInProgress()) { activeChar.sendMessage("Your partner is in a siege, you cannot go to your partner."); return false; } - if (partner.isIn7sDungeon() && !activeChar.isIn7sDungeon()) - { + if (partner.isIn7sDungeon() && !activeChar.isIn7sDungeon()) { final int playerCabal = SevenSigns.getInstance().getPlayerCabal(activeChar.getObjectId()); final boolean isSealValidationPeriod = SevenSigns.getInstance().isSealValidationPeriod(); final int compWinner = SevenSigns.getInstance().getCabalHighestScore(); - if (isSealValidationPeriod) - { - if (playerCabal != compWinner) - { + if (isSealValidationPeriod) { + if (playerCabal != compWinner) { activeChar.sendMessage("Your Partner is in a Seven Signs Dungeon and you are not in the winner Cabal!"); return false; } - } - else - { - if (playerCabal == SevenSigns.CABAL_NULL) - { + } else { + if (playerCabal == SevenSigns.CABAL_NULL) { activeChar.sendMessage("Your Partner is in a Seven Signs Dungeon and you are not registered!"); return false; } } } - if (!TvTEvent.onEscapeUse(partner.getObjectId())) - { + if (!TvTEvent.onEscapeUse(partner.getObjectId())) { activeChar.sendMessage("Your partner is in an event."); return false; } - if (partner.isInsideZone(ZoneId.NO_SUMMON_FRIEND)) - { + if (partner.isInsideZone(ZoneId.NO_SUMMON_FRIEND)) { activeChar.sendMessage("Your partner is in area which blocks summoning."); return false; } @@ -480,29 +400,24 @@ public class Wedding implements IVoicedCommandHandler return true; } - static class EscapeFinalizer implements Runnable - { + static class EscapeFinalizer implements Runnable { private final L2PcInstance _activeChar; private final Location _partnerLoc; private final boolean _to7sDungeon; - EscapeFinalizer(L2PcInstance activeChar, Location loc, boolean to7sDungeon) - { + EscapeFinalizer(L2PcInstance activeChar, Location loc, boolean to7sDungeon) { _activeChar = activeChar; _partnerLoc = loc; _to7sDungeon = to7sDungeon; } @Override - public void run() - { - if (_activeChar.isDead()) - { + public void run() { + if (_activeChar.isDead()) { return; } - if ((SiegeManager.getInstance().getSiege(_partnerLoc) != null) && SiegeManager.getInstance().getSiege(_partnerLoc).isInProgress()) - { + if ((SiegeManager.getInstance().getSiege(_partnerLoc) != null) && SiegeManager.getInstance().getSiege(_partnerLoc).isInProgress()) { _activeChar.sendMessage("Your partner is in siege, you can't go to your partner."); return; } @@ -511,20 +426,16 @@ public class Wedding implements IVoicedCommandHandler _activeChar.enableAllSkills(); _activeChar.setIsCastingNow(false); - try - { + try { _activeChar.teleToLocation(_partnerLoc); - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.SEVERE, "", e); } } } @Override - public String[] getVoicedCommandList() - { + public String[] getVoicedCommandList() { return _voicedCommands; } } diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/Amaskari.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/Amaskari.java index e5778c5c34..81723b631b 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/Amaskari.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/Amaskari.java @@ -34,38 +34,33 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Manages Amaskari's and minions' chat and some skill usage. * @author GKR */ -public final class Amaskari extends AbstractNpcAI -{ +public final class Amaskari extends AbstractNpcAI { // NPCs private static final int AMASKARI = 22449; private static final int AMASKARI_PRISONER = 22450; // Skills // private static SkillHolder INVINCIBILITY = new SkillHolder(5417, 1); private static final int BUFF_ID = 4632; - private static SkillHolder[] BUFF = - { + private static SkillHolder[] BUFF = { new SkillHolder(BUFF_ID, 1), new SkillHolder(BUFF_ID, 2), new SkillHolder(BUFF_ID, 3) }; // Misc - private static final NpcStringId[] AMASKARI_NPCSTRING_ID = - { + private static final NpcStringId[] AMASKARI_NPCSTRING_ID = { NpcStringId.ILL_MAKE_EVERYONE_FEEL_THE_SAME_SUFFERING_AS_ME, NpcStringId.HA_HA_YES_DIE_SLOWLY_WRITHING_IN_PAIN_AND_AGONY, NpcStringId.MORE_NEED_MORE_SEVERE_PAIN, NpcStringId.SOMETHING_IS_BURNING_INSIDE_MY_BODY }; - private static final NpcStringId[] MINIONS_NPCSTRING_ID = - { + private static final NpcStringId[] MINIONS_NPCSTRING_ID = { NpcStringId.AHH_MY_LIFE_IS_BEING_DRAINED_OUT, NpcStringId.THANK_YOU_FOR_SAVING_ME, NpcStringId.IT_WILL_KILL_EVERYONE, NpcStringId.EEEK_I_FEEL_SICKYOW }; - public Amaskari() - { + public Amaskari() { super(Amaskari.class.getSimpleName(), "hellbound/AI"); addKillId(AMASKARI, AMASKARI_PRISONER); addAttackId(AMASKARI); @@ -73,24 +68,17 @@ public final class Amaskari extends AbstractNpcAI } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equalsIgnoreCase("stop_toggle")) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equalsIgnoreCase("stop_toggle")) { broadcastNpcSay(npc, Say2.NPC_ALL, AMASKARI_NPCSTRING_ID[2]); ((L2MonsterInstance) npc).clearAggroList(); ((L2MonsterInstance) npc).getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); npc.setIsInvul(false); // npc.doCast(INVINCIBILITY) - } - else if (event.equalsIgnoreCase("onspawn_msg") && (npc != null) && !npc.isDead()) - { - if (getRandom(100) > 20) - { + } else if (event.equalsIgnoreCase("onspawn_msg") && (npc != null) && !npc.isDead()) { + if (getRandom(100) > 20) { broadcastNpcSay(npc, Say2.NPC_ALL, MINIONS_NPCSTRING_ID[2]); - } - else if (getRandom(100) > 40) - { + } else if (getRandom(100) > 40) { broadcastNpcSay(npc, Say2.NPC_ALL, MINIONS_NPCSTRING_ID[3]); } startQuestTimer("onspawn_msg", (getRandom(8) + 1) * 30000, npc, null); @@ -99,15 +87,11 @@ public final class Amaskari extends AbstractNpcAI } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) - { - if ((npc.getId() == AMASKARI) && (getRandom(1000) < 25)) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) { + if ((npc.getId() == AMASKARI) && (getRandom(1000) < 25)) { broadcastNpcSay(npc, Say2.NPC_ALL, AMASKARI_NPCSTRING_ID[0]); - for (L2MonsterInstance minion : ((L2MonsterInstance) npc).getMinionList().getSpawnedMinions()) - { - if ((minion != null) && !minion.isDead() && (getRandom(10) == 0)) - { + for (L2MonsterInstance minion : ((L2MonsterInstance) npc).getMinionList().getSpawnedMinions()) { + if ((minion != null) && !minion.isDead() && (getRandom(10) == 0)) { broadcastNpcSay(minion, Say2.NPC_ALL, MINIONS_NPCSTRING_ID[0]); minion.setCurrentHp(minion.getCurrentHp() - (minion.getCurrentHp() / 5)); } @@ -117,33 +101,22 @@ public final class Amaskari extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (npc.getId() == AMASKARI_PRISONER) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (npc.getId() == AMASKARI_PRISONER) { final L2MonsterInstance master = ((L2MonsterInstance) npc).getLeader(); - if ((master != null) && !master.isDead()) - { + if ((master != null) && !master.isDead()) { broadcastNpcSay(master, Say2.NPC_ALL, AMASKARI_NPCSTRING_ID[1]); final BuffInfo info = master.getEffectList().getBuffInfoBySkillId(BUFF_ID); - if ((info != null) && (info.getSkill().getAbnormalLvl() == 3) && master.isInvul()) - { + if ((info != null) && (info.getSkill().getAbnormalLvl() == 3) && master.isInvul()) { master.setCurrentHp(master.getCurrentHp() + (master.getCurrentHp() / 5)); - } - else - { + } else { master.clearAggroList(); master.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); - if (info == null) - { + if (info == null) { master.doCast(BUFF[0]); - } - else if (info.getSkill().getAbnormalLvl() < 3) - { + } else if (info.getSkill().getAbnormalLvl() < 3) { master.doCast(BUFF[info.getSkill().getAbnormalLvl()]); - } - else - { + } else { broadcastNpcSay(master, Say2.NPC_ALL, AMASKARI_NPCSTRING_ID[3]); // master.doCast(INVINCIBILITY) master.setIsInvul(true); @@ -151,15 +124,10 @@ public final class Amaskari extends AbstractNpcAI } } } - } - else if (npc.getId() == AMASKARI) - { - for (L2MonsterInstance minion : ((L2MonsterInstance) npc).getMinionList().getSpawnedMinions()) - { - if ((minion != null) && !minion.isDead()) - { - if (getRandom(1000) > 300) - { + } else if (npc.getId() == AMASKARI) { + for (L2MonsterInstance minion : ((L2MonsterInstance) npc).getMinionList().getSpawnedMinions()) { + if ((minion != null) && !minion.isDead()) { + if (getRandom(1000) > 300) { broadcastNpcSay(minion, Say2.NPC_ALL, MINIONS_NPCSTRING_ID[1]); } HellboundEngine.getInstance().updateTrust(30, true); @@ -171,8 +139,7 @@ public final class Amaskari extends AbstractNpcAI } @Override - public final String onSpawn(L2Npc npc) - { + public final String onSpawn(L2Npc npc) { startQuestTimer("onspawn_msg", (getRandom(3) + 1) * 30000, npc, null); return super.onSpawn(npc); } diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/Chimeras.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/Chimeras.java index 3d293cd180..bf8ac08ab5 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/Chimeras.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/Chimeras.java @@ -31,11 +31,9 @@ import com.l2jserver.gameserver.model.skills.Skill; * Chimeras AI. * @author DS */ -public final class Chimeras extends AbstractNpcAI -{ +public final class Chimeras extends AbstractNpcAI { // NPCs - private static final int[] NPCS = - { + private static final int[] NPCS = { 22349, // Chimera of Earth 22350, // Chimera of Darkness 22351, // Chimera of Wind @@ -43,8 +41,7 @@ public final class Chimeras extends AbstractNpcAI }; private static final int CELTUS = 22353; // Locations - private static final Location[] LOCATIONS = - { + private static final Location[] LOCATIONS = { new Location(3678, 233418, -3319), new Location(2038, 237125, -3363), new Location(7222, 240617, -2033), @@ -57,8 +54,7 @@ public final class Chimeras extends AbstractNpcAI private static final int LIFE_FORCE = 9681; private static final int CONTAINED_LIFE_FORCE = 9682; - public Chimeras() - { + public Chimeras() { super(Chimeras.class.getSimpleName(), "hellbound/AI"); addSkillSeeId(NPCS); addSpawnId(CELTUS); @@ -66,13 +62,11 @@ public final class Chimeras extends AbstractNpcAI } @Override - public final String onSpawn(L2Npc npc) - { + public final String onSpawn(L2Npc npc) { if (HellboundEngine.getInstance().getLevel() == 7) // Have random spawn points only in 7 lvl { final Location loc = LOCATIONS[getRandom(LOCATIONS.length)]; - if (!npc.isInsideRadius(loc, 200, false, false)) - { + if (!npc.isInsideRadius(loc, 200, false, false)) { npc.getSpawn().setLocation(loc); ThreadPoolManager.getInstance().scheduleGeneral(new Teleport(npc, loc), 100); } @@ -81,32 +75,21 @@ public final class Chimeras extends AbstractNpcAI } @Override - public final String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) - { - if ((skill.getId() == BOTTLE) && !npc.isDead()) - { - if ((targets.length > 0) && (targets[0] == npc)) - { - if (npc.getCurrentHp() < (npc.getMaxHp() * 0.1)) - { - if (HellboundEngine.getInstance().getLevel() == 7) - { + public final String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) { + if ((skill.getId() == BOTTLE) && !npc.isDead()) { + if ((targets.length > 0) && (targets[0] == npc)) { + if (npc.getCurrentHp() < (npc.getMaxHp() * 0.1)) { + if (HellboundEngine.getInstance().getLevel() == 7) { HellboundEngine.getInstance().updateTrust(3, true); } npc.setIsDead(true); - if (npc.getId() == CELTUS) - { + if (npc.getId() == CELTUS) { npc.dropItem(caster, CONTAINED_LIFE_FORCE, 1); - } - else - { - if (getRandom(100) < 80) - { + } else { + if (getRandom(100) < 80) { npc.dropItem(caster, DIM_LIFE_FORCE, 1); - } - else if (getRandom(100) < 80) - { + } else if (getRandom(100) < 80) { npc.dropItem(caster, LIFE_FORCE, 1); } } @@ -117,20 +100,17 @@ public final class Chimeras extends AbstractNpcAI return super.onSkillSee(npc, caster, skill, targets, isSummon); } - private static class Teleport implements Runnable - { + private static class Teleport implements Runnable { private final L2Npc _npc; private final Location _loc; - public Teleport(L2Npc npc, Location loc) - { + public Teleport(L2Npc npc, Location loc) { _npc = npc; _loc = loc; } @Override - public void run() - { + public void run() { _npc.teleToLocation(_loc, false); } } diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/DemonPrince.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/DemonPrince.java index 6bc073b6d5..21f463df6f 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/DemonPrince.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/DemonPrince.java @@ -31,15 +31,13 @@ import com.l2jserver.gameserver.model.skills.Skill; * Demon Prince's AI. * @author GKR */ -public final class DemonPrince extends AbstractNpcAI -{ +public final class DemonPrince extends AbstractNpcAI { // NPCs private static final int DEMON_PRINCE = 25540; private static final int FIEND = 25541; // Skills private static final SkillHolder UD = new SkillHolder(5044, 2); - private static final SkillHolder[] AOE = - { + private static final SkillHolder[] AOE = { new SkillHolder(5376, 4), new SkillHolder(5376, 5), new SkillHolder(5376, 6), @@ -47,8 +45,7 @@ public final class DemonPrince extends AbstractNpcAI private static final Map<Integer, Boolean> ATTACK_STATE = new ConcurrentHashMap<>(); - public DemonPrince() - { + public DemonPrince() { super(DemonPrince.class.getSimpleName(), "hellbound/AI"); addAttackId(DEMON_PRINCE); addKillId(DEMON_PRINCE); @@ -56,35 +53,27 @@ public final class DemonPrince extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equalsIgnoreCase("cast") && (npc != null) && (npc.getId() == FIEND) && !npc.isDead()) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equalsIgnoreCase("cast") && (npc != null) && (npc.getId() == FIEND) && !npc.isDead()) { npc.doCast(AOE[getRandom(AOE.length)]); } return super.onAdvEvent(event, npc, player); } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) - { - if (!npc.isDead()) - { - if (!ATTACK_STATE.containsKey(npc.getObjectId()) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.5))) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) { + if (!npc.isDead()) { + if (!ATTACK_STATE.containsKey(npc.getObjectId()) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.5))) { npc.doCast(UD); spawnMinions(npc); ATTACK_STATE.put(npc.getObjectId(), false); - } - else if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.1)) && ATTACK_STATE.containsKey(npc.getObjectId()) && (ATTACK_STATE.get(npc.getObjectId()) == false)) - { + } else if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.1)) && ATTACK_STATE.containsKey(npc.getObjectId()) && (ATTACK_STATE.get(npc.getObjectId()) == false)) { npc.doCast(UD); spawnMinions(npc); ATTACK_STATE.put(npc.getObjectId(), true); } - if (getRandom(1000) < 10) - { + if (getRandom(1000) < 10) { spawnMinions(npc); } } @@ -92,26 +81,21 @@ public final class DemonPrince extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { ATTACK_STATE.remove(npc.getObjectId()); return super.onKill(npc, killer, isSummon); } @Override - public final String onSpawn(L2Npc npc) - { - if (npc.getId() == FIEND) - { + public final String onSpawn(L2Npc npc) { + if (npc.getId() == FIEND) { startQuestTimer("cast", 15000, npc, null); } return super.onSpawn(npc); } - private void spawnMinions(L2Npc master) - { - if ((master != null) && !master.isDead()) - { + private void spawnMinions(L2Npc master) { + if ((master != null) && !master.isDead()) { final int instanceId = master.getInstanceId(); final int x = master.getX(); final int y = master.getY(); diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/HellboundCore.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/HellboundCore.java index 7cd2c5e993..d3000e0672 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/HellboundCore.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/HellboundCore.java @@ -29,29 +29,23 @@ import com.l2jserver.gameserver.model.holders.SkillHolder; * Manages Naia's cast on the Hellbound Core * @author GKR */ -public final class HellboundCore extends AbstractNpcAI -{ +public final class HellboundCore extends AbstractNpcAI { // NPCs private static final int NAIA = 18484; private static final int HELLBOUND_CORE = 32331; // Skills private static final SkillHolder BEAM = new SkillHolder(5493); - public HellboundCore() - { + public HellboundCore() { super(HellboundCore.class.getSimpleName(), "hellbound/AI"); addSpawnId(HELLBOUND_CORE, NAIA); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equalsIgnoreCase("cast") && (HellboundEngine.getInstance().getLevel() <= 6)) - { - for (L2Character naia : npc.getKnownList().getKnownCharactersInRadius(900)) - { - if ((naia != null) && naia.isMonster() && (naia.getId() == NAIA) && !naia.isDead() && !naia.isChanneling()) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equalsIgnoreCase("cast") && (HellboundEngine.getInstance().getLevel() <= 6)) { + for (L2Character naia : npc.getKnownList().getKnownCharactersInRadius(900)) { + if ((naia != null) && naia.isMonster() && (naia.getId() == NAIA) && !naia.isDead() && !naia.isChanneling()) { naia.setTarget(npc); naia.doSimultaneousCast(BEAM); } @@ -62,14 +56,10 @@ public final class HellboundCore extends AbstractNpcAI } @Override - public final String onSpawn(L2Npc npc) - { - if (npc.getId() == NAIA) - { + public final String onSpawn(L2Npc npc) { + if (npc.getId() == NAIA) { npc.setIsNoRndWalk(true); - } - else - { + } else { startQuestTimer("cast", 10000, npc, null); } diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/Keltas.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/Keltas.java index 18300742da..633bef93e4 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/Keltas.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/Keltas.java @@ -35,15 +35,13 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Manages Darion's Enforcer's and Darion's Executioner spawn/despawn * @author GKR */ -public final class Keltas extends AbstractNpcAI -{ +public final class Keltas extends AbstractNpcAI { // NPCs private static final int KELTAS = 22341; private static final int ENFORCER = 22342; private static final int EXECUTIONER = 22343; // Locations - private static final Location[] ENFORCER_SPAWN_POINTS = - { + private static final Location[] ENFORCER_SPAWN_POINTS = { new Location(-24540, 251404, -3320), new Location(-24100, 252578, -3060), new Location(-24607, 252443, -3074), @@ -71,8 +69,7 @@ public final class Keltas extends AbstractNpcAI new Location(-25376, 252368, -3257), new Location(-25376, 252208, -3257) }; - private static final Location[] EXECUTIONER_SPAWN_POINTS = - { + private static final Location[] EXECUTIONER_SPAWN_POINTS = { new Location(-24419, 251395, -3340), new Location(-24912, 252160, -3310), new Location(-25027, 251941, -3300), @@ -103,17 +100,14 @@ public final class Keltas extends AbstractNpcAI private L2MonsterInstance _spawnedKeltas = null; private final Set<L2Spawn> _spawnedMonsters = Collections.newSetFromMap(new ConcurrentHashMap<L2Spawn, Boolean>()); - public Keltas() - { + public Keltas() { super(Keltas.class.getSimpleName(), "hellbound/AI"); addKillId(KELTAS); addSpawnId(KELTAS); } - private void spawnMinions() - { - for (Location loc : ENFORCER_SPAWN_POINTS) - { + private void spawnMinions() { + for (Location loc : ENFORCER_SPAWN_POINTS) { final L2MonsterInstance minion = (L2MonsterInstance) addSpawn(ENFORCER, loc, false, 0, false); final L2Spawn spawn = minion.getSpawn(); spawn.setRespawnDelay(60); @@ -122,8 +116,7 @@ public final class Keltas extends AbstractNpcAI _spawnedMonsters.add(spawn); } - for (Location loc : EXECUTIONER_SPAWN_POINTS) - { + for (Location loc : EXECUTIONER_SPAWN_POINTS) { final L2MonsterInstance minion = (L2MonsterInstance) addSpawn(EXECUTIONER, loc, false, 0, false); final L2Spawn spawn = minion.getSpawn(); spawn.setRespawnDelay(80); @@ -133,19 +126,15 @@ public final class Keltas extends AbstractNpcAI } } - private void despawnMinions() - { - if (_spawnedMonsters.isEmpty()) - { + private void despawnMinions() { + if (_spawnedMonsters.isEmpty()) { return; } - for (L2Spawn spawn : _spawnedMonsters) - { + for (L2Spawn spawn : _spawnedMonsters) { spawn.stopRespawn(); L2Npc minion = spawn.getLastSpawn(); - if ((minion != null) && !minion.isDead()) - { + if ((minion != null) && !minion.isDead()) { minion.deleteMe(); } } @@ -153,13 +142,10 @@ public final class Keltas extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equalsIgnoreCase("despawn")) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equalsIgnoreCase("despawn")) { final L2Npc keltas = _spawnedKeltas; - if ((keltas != null) && !keltas.isDead()) - { + if ((keltas != null) && !keltas.isDead()) { broadcastNpcSay(keltas, Say2.NPC_SHOUT, NpcStringId.THAT_IS_IT_FOR_TODAYLETS_RETREAT_EVERYONE_PULL_BACK); keltas.deleteMe(); keltas.getSpawn().decreaseCount(keltas); @@ -170,16 +156,14 @@ public final class Keltas extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { cancelQuestTimers("despawn"); despawnMinions(); return super.onKill(npc, killer, isSummon); } @Override - public final String onSpawn(L2Npc npc) - { + public final String onSpawn(L2Npc npc) { _spawnedKeltas = (L2MonsterInstance) npc; broadcastNpcSay(_spawnedKeltas, Say2.NPC_SHOUT, NpcStringId.GUYS_SHOW_THEM_OUR_POWER); spawnMinions(); diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Bernarde/Bernarde.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Bernarde/Bernarde.java index 1d67bc6e2c..fd67b3618f 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Bernarde/Bernarde.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Bernarde/Bernarde.java @@ -27,8 +27,7 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Bernarde AI. * @author DS */ -public final class Bernarde extends AbstractNpcAI -{ +public final class Bernarde extends AbstractNpcAI { // NPCs private static final int BERNARDE = 32300; // Misc @@ -38,8 +37,7 @@ public final class Bernarde extends AbstractNpcAI private static final int DARION_BADGE = 9674; private static final int TREASURE = 9684; - public Bernarde() - { + public Bernarde() { super(Bernarde.class.getSimpleName(), "hellbound/AI/NPC"); addFirstTalkId(BERNARDE); addStartNpc(BERNARDE); @@ -47,18 +45,12 @@ public final class Bernarde extends AbstractNpcAI } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { - case "HolyWater": - { - if (HellboundEngine.getInstance().getLevel() == 2) - { - if (player.getInventory().getInventoryItemCount(DARION_BADGE, -1, false) >= 5) - { - if (player.exchangeItemsById("Quest", npc, DARION_BADGE, 5, HOLY_WATER, 1, true)) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { + case "HolyWater": { + if (HellboundEngine.getInstance().getLevel() == 2) { + if (player.getInventory().getInventoryItemCount(DARION_BADGE, -1, false) >= 5) { + if (player.exchangeItemsById("Quest", npc, DARION_BADGE, 5, HOLY_WATER, 1, true)) { return "32300-02b.htm"; } } @@ -66,10 +58,8 @@ public final class Bernarde extends AbstractNpcAI event = "32300-02c.htm"; break; } - case "Treasure": - { - if ((HellboundEngine.getInstance().getLevel() == 3) && hasQuestItems(player, TREASURE)) - { + case "Treasure": { + if ((HellboundEngine.getInstance().getLevel() == 3) && hasQuestItems(player, TREASURE)) { HellboundEngine.getInstance().updateTrust((int) (getQuestItemsCount(player, TREASURE) * 1000), true); takeItems(player, TREASURE, -1); return "32300-02d.htm"; @@ -77,8 +67,7 @@ public final class Bernarde extends AbstractNpcAI event = "32300-02e.htm"; break; } - case "rumors": - { + case "rumors": { event = "32300-" + HellboundEngine.getInstance().getLevel() + "r.htm"; break; } @@ -87,10 +76,8 @@ public final class Bernarde extends AbstractNpcAI } @Override - public final String onFirstTalk(L2Npc npc, L2PcInstance player) - { - switch (HellboundEngine.getInstance().getLevel()) - { + public final String onFirstTalk(L2Npc npc, L2PcInstance player) { + switch (HellboundEngine.getInstance().getLevel()) { case 0: case 1: return isTransformed(player) ? "32300-01a.htm" : "32300-01.htm"; @@ -105,8 +92,7 @@ public final class Bernarde extends AbstractNpcAI } } - private static final boolean isTransformed(L2PcInstance player) - { + private static final boolean isTransformed(L2PcInstance player) { return player.isTransformed() && (player.getTransformation().getId() == NATIVE_TRANSFORM); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Budenka/Budenka.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Budenka/Budenka.java index f8efb9f093..d16ccc0468 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Budenka/Budenka.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Budenka/Budenka.java @@ -26,16 +26,14 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Budenka AI. * @author St3eT */ -public final class Budenka extends AbstractNpcAI -{ +public final class Budenka extends AbstractNpcAI { // NPCs private static final int BUDENKA = 32294; // Items private static final int STANDART_CERT = 9851; private static final int PREMIUM_CERT = 9852; - public Budenka() - { + public Budenka() { super(Budenka.class.getSimpleName(), "hellbound/AI/NPC"); addStartNpc(BUDENKA); addFirstTalkId(BUDENKA); @@ -43,16 +41,13 @@ public final class Budenka extends AbstractNpcAI } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { + switch (event) { case "Budenka-02.html": case "Budenka-03.html": case "Budenka-04.html": - case "Budenka-05.html": - { + case "Budenka-05.html": { htmltext = event; break; } @@ -61,19 +56,13 @@ public final class Budenka extends AbstractNpcAI } @Override - public final String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public final String onFirstTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; - if (hasQuestItems(player, STANDART_CERT, PREMIUM_CERT)) - { + if (hasQuestItems(player, STANDART_CERT, PREMIUM_CERT)) { htmltext = "Budenka-07.html"; - } - else if (hasQuestItems(player, STANDART_CERT)) - { + } else if (hasQuestItems(player, STANDART_CERT)) { htmltext = "Budenka-06.html"; - } - else - { + } else { htmltext = "Budenka-01.html"; } return htmltext; diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Buron/Buron.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Buron/Buron.java index 9b6480172b..cf940d821a 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Buron/Buron.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Buron/Buron.java @@ -27,16 +27,14 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Buron AI. * @author DS */ -public final class Buron extends AbstractNpcAI -{ +public final class Buron extends AbstractNpcAI { private static final int BURON = 32345; private static final int HELMET = 9669; private static final int TUNIC = 9670; private static final int PANTS = 9671; private static final int DARION_BADGE = 9674; - public Buron() - { + public Buron() { super(Buron.class.getSimpleName(), "hellbound/AI/NPC"); addFirstTalkId(BURON); addStartNpc(BURON); @@ -44,40 +42,25 @@ public final class Buron extends AbstractNpcAI } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; - if ("Rumor".equalsIgnoreCase(event)) - { + if ("Rumor".equalsIgnoreCase(event)) { htmltext = "32345-" + HellboundEngine.getInstance().getLevel() + "r.htm"; - } - else - { - if (HellboundEngine.getInstance().getLevel() < 2) - { + } else { + if (HellboundEngine.getInstance().getLevel() < 2) { htmltext = "32345-lowlvl.htm"; - } - else - { - if (getQuestItemsCount(player, DARION_BADGE) >= 10) - { + } else { + if (getQuestItemsCount(player, DARION_BADGE) >= 10) { takeItems(player, DARION_BADGE, 10); - if (event.equalsIgnoreCase("Tunic")) - { + if (event.equalsIgnoreCase("Tunic")) { player.addItem("Quest", TUNIC, 1, npc, true); - } - else if (event.equalsIgnoreCase("Helmet")) - { + } else if (event.equalsIgnoreCase("Helmet")) { player.addItem("Quest", HELMET, 1, npc, true); - } - else if (event.equalsIgnoreCase("Pants")) - { + } else if (event.equalsIgnoreCase("Pants")) { player.addItem("Quest", PANTS, 1, npc, true); } htmltext = null; - } - else - { + } else { htmltext = "32345-noitems.htm"; } } @@ -86,11 +69,9 @@ public final class Buron extends AbstractNpcAI } @Override - public final String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public final String onFirstTalk(L2Npc npc, L2PcInstance player) { getQuestState(player, true); - switch (HellboundEngine.getInstance().getLevel()) - { + switch (HellboundEngine.getInstance().getLevel()) { case 1: return "32345-01.htm"; case 2: diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Deltuva/Deltuva.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Deltuva/Deltuva.java index 263eac63d0..3ff12e5ce3 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Deltuva/Deltuva.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Deltuva/Deltuva.java @@ -29,28 +29,23 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Deltuva AI. * @author GKR */ -public final class Deltuva extends AbstractNpcAI -{ +public final class Deltuva extends AbstractNpcAI { // NPCs private static final int DELTUVA = 32313; // Location private static final Location TELEPORT = new Location(17934, 283189, -9701); - public Deltuva() - { + public Deltuva() { super(Deltuva.class.getSimpleName(), "hellbound/AI/NPC"); addStartNpc(DELTUVA); addTalkId(DELTUVA); } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equalsIgnoreCase("teleport")) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equalsIgnoreCase("teleport")) { final QuestState hostQuest = player.getQuestState(Q00132_MatrasCuriosity.class.getSimpleName()); - if ((hostQuest == null) || !hostQuest.isCompleted()) - { + if ((hostQuest == null) || !hostQuest.isCompleted()) { return "32313-02.htm"; } player.teleToLocation(TELEPORT); diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Falk/Falk.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Falk/Falk.java index 1ed3ad601f..5aaf9eb4d3 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Falk/Falk.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Falk/Falk.java @@ -26,8 +26,7 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Falk AI. * @author DS */ -public final class Falk extends AbstractNpcAI -{ +public final class Falk extends AbstractNpcAI { // NPCs private static final int FALK = 32297; // Items @@ -36,8 +35,7 @@ public final class Falk extends AbstractNpcAI private static final int STANDART_CERT = 9851; // Standard Caravan Certificate private static final int PREMIUM_CERT = 9852; // Premium Caravan Certificate - public Falk() - { + public Falk() { super(Falk.class.getSimpleName(), "hellbound/AI/NPC"); addFirstTalkId(FALK); addStartNpc(FALK); @@ -45,34 +43,26 @@ public final class Falk extends AbstractNpcAI } @Override - public final String onFirstTalk(L2Npc npc, L2PcInstance player) - { - if (hasAtLeastOneQuestItem(player, BASIC_CERT, STANDART_CERT, PREMIUM_CERT)) - { + public final String onFirstTalk(L2Npc npc, L2PcInstance player) { + if (hasAtLeastOneQuestItem(player, BASIC_CERT, STANDART_CERT, PREMIUM_CERT)) { return "32297-01a.htm"; } return "32297-01.htm"; } @Override - public final String onTalk(L2Npc npc, L2PcInstance player) - { - if (hasAtLeastOneQuestItem(player, BASIC_CERT, STANDART_CERT, PREMIUM_CERT)) - { + public final String onTalk(L2Npc npc, L2PcInstance player) { + if (hasAtLeastOneQuestItem(player, BASIC_CERT, STANDART_CERT, PREMIUM_CERT)) { return "32297-01a.htm"; } return "32297-02.htm"; } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equalsIgnoreCase("badges")) - { - if (!hasAtLeastOneQuestItem(player, BASIC_CERT, STANDART_CERT, PREMIUM_CERT)) - { - if (getQuestItemsCount(player, DARION_BADGE) >= 20) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equalsIgnoreCase("badges")) { + if (!hasAtLeastOneQuestItem(player, BASIC_CERT, STANDART_CERT, PREMIUM_CERT)) { + if (getQuestItemsCount(player, DARION_BADGE) >= 20) { takeItems(player, DARION_BADGE, 20); giveItems(player, BASIC_CERT, 1); return "32297-02a.htm"; diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Hude/Hude.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Hude/Hude.java index cd802dcec2..728adc0611 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Hude/Hude.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Hude/Hude.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Hude AI. * @author DS */ -public final class Hude extends AbstractNpcAI -{ +public final class Hude extends AbstractNpcAI { // NPCs private static final int HUDE = 32298; // Items @@ -42,8 +41,7 @@ public final class Hude extends AbstractNpcAI private static final int MAP = 9994; private static final int STINGER = 10012; - public Hude() - { + public Hude() { super(Hude.class.getSimpleName(), "hellbound/AI/NPC"); addFirstTalkId(HUDE); addStartNpc(HUDE); @@ -51,16 +49,11 @@ public final class Hude extends AbstractNpcAI } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { - case "scertif": - { - if (HellboundEngine.getInstance().getLevel() > 3) - { - if (hasQuestItems(player, BASIC_CERT) && (getQuestItemsCount(player, MARK_OF_BETRAYAL) >= 30) && (getQuestItemsCount(player, STINGER) >= 60)) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { + case "scertif": { + if (HellboundEngine.getInstance().getLevel() > 3) { + if (hasQuestItems(player, BASIC_CERT) && (getQuestItemsCount(player, MARK_OF_BETRAYAL) >= 30) && (getQuestItemsCount(player, STINGER) >= 60)) { takeItems(player, MARK_OF_BETRAYAL, 30); takeItems(player, STINGER, 60); takeItems(player, BASIC_CERT, 1); @@ -70,12 +63,9 @@ public final class Hude extends AbstractNpcAI } return "32298-04b.htm"; } - case "pcertif": - { - if (HellboundEngine.getInstance().getLevel() > 6) - { - if (hasQuestItems(player, STANDART_CERT) && (getQuestItemsCount(player, LIFE_FORCE) >= 56) && (getQuestItemsCount(player, CONTAINED_LIFE_FORCE) >= 14)) - { + case "pcertif": { + if (HellboundEngine.getInstance().getLevel() > 6) { + if (hasQuestItems(player, STANDART_CERT) && (getQuestItemsCount(player, LIFE_FORCE) >= 56) && (getQuestItemsCount(player, CONTAINED_LIFE_FORCE) >= 14)) { takeItems(player, LIFE_FORCE, 56); takeItems(player, CONTAINED_LIFE_FORCE, 14); takeItems(player, STANDART_CERT, 1); @@ -86,18 +76,14 @@ public final class Hude extends AbstractNpcAI } return "32298-06b.htm"; } - case "multisell1": - { - if (hasQuestItems(player, STANDART_CERT) || hasQuestItems(player, PREMIUM_CERT)) - { + case "multisell1": { + if (hasQuestItems(player, STANDART_CERT) || hasQuestItems(player, PREMIUM_CERT)) { MultisellData.getInstance().separateAndSend(322980001, player, npc, false); } break; } - case "multisell2": - { - if (hasQuestItems(player, PREMIUM_CERT)) - { + case "multisell2": { + if (hasQuestItems(player, PREMIUM_CERT)) { MultisellData.getInstance().separateAndSend(322980002, player, npc, false); } break; @@ -107,23 +93,15 @@ public final class Hude extends AbstractNpcAI } @Override - public final String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public final String onFirstTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; - if (!hasAtLeastOneQuestItem(player, BASIC_CERT, STANDART_CERT, PREMIUM_CERT)) - { + if (!hasAtLeastOneQuestItem(player, BASIC_CERT, STANDART_CERT, PREMIUM_CERT)) { htmltext = "32298-01.htm"; - } - else if (hasQuestItems(player, BASIC_CERT) && !hasAtLeastOneQuestItem(player, STANDART_CERT, PREMIUM_CERT)) - { + } else if (hasQuestItems(player, BASIC_CERT) && !hasAtLeastOneQuestItem(player, STANDART_CERT, PREMIUM_CERT)) { htmltext = "32298-03.htm"; - } - else if (hasQuestItems(player, STANDART_CERT) && !hasQuestItems(player, PREMIUM_CERT)) - { + } else if (hasQuestItems(player, STANDART_CERT) && !hasQuestItems(player, PREMIUM_CERT)) { htmltext = "32298-05.htm"; - } - else if (hasQuestItems(player, PREMIUM_CERT)) - { + } else if (hasQuestItems(player, PREMIUM_CERT)) { htmltext = "32298-07.htm"; } return htmltext; diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Jude/Jude.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Jude/Jude.java index 31bd7e3e9d..cedd44ab60 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Jude/Jude.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Jude/Jude.java @@ -27,15 +27,13 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Jude AI. * @author DS */ -public final class Jude extends AbstractNpcAI -{ +public final class Jude extends AbstractNpcAI { // NPCs private static final int JUDE = 32356; private static final int NATIVE_TREASURE = 9684; private static final int RING_OF_WIND_MASTERY = 9677; - public Jude() - { + public Jude() { super(Jude.class.getSimpleName(), "hellbound/AI/NPC"); addFirstTalkId(JUDE); addStartNpc(JUDE); @@ -43,14 +41,10 @@ public final class Jude extends AbstractNpcAI } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if ("TreasureSacks".equalsIgnoreCase(event)) - { - if (HellboundEngine.getInstance().getLevel() == 3) - { - if (getQuestItemsCount(player, NATIVE_TREASURE) >= 40) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if ("TreasureSacks".equalsIgnoreCase(event)) { + if (HellboundEngine.getInstance().getLevel() == 3) { + if (getQuestItemsCount(player, NATIVE_TREASURE) >= 40) { takeItems(player, NATIVE_TREASURE, 40); giveItems(player, RING_OF_WIND_MASTERY, 1); return "32356-02.htm"; @@ -62,10 +56,8 @@ public final class Jude extends AbstractNpcAI } @Override - public final String onFirstTalk(L2Npc npc, L2PcInstance player) - { - switch (HellboundEngine.getInstance().getLevel()) - { + public final String onFirstTalk(L2Npc npc, L2PcInstance player) { + switch (HellboundEngine.getInstance().getLevel()) { case 0: case 1: case 2: diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Kanaf/Kanaf.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Kanaf/Kanaf.java index 1689e32290..9f7799e40f 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Kanaf/Kanaf.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Kanaf/Kanaf.java @@ -26,13 +26,11 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Kanaf AI. * @author GKR */ -public final class Kanaf extends AbstractNpcAI -{ +public final class Kanaf extends AbstractNpcAI { // NPCs private static final int KANAF = 32346; - public Kanaf() - { + public Kanaf() { super(Kanaf.class.getSimpleName(), "hellbound/AI/NPC"); addStartNpc(KANAF); addTalkId(KANAF); @@ -40,10 +38,8 @@ public final class Kanaf extends AbstractNpcAI } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equals("info")) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equals("info")) { return "32346-0" + getRandom(1, 3) + ".htm"; } return super.onAdvEvent(event, npc, player); diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Kief/Kief.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Kief/Kief.java index 121d8ad879..b98d1b933f 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Kief/Kief.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Kief/Kief.java @@ -27,8 +27,7 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Kief AI. * @author DS */ -public final class Kief extends AbstractNpcAI -{ +public final class Kief extends AbstractNpcAI { // NPCs private static final int KIEF = 32354; // Items @@ -39,8 +38,7 @@ public final class Kief extends AbstractNpcAI private static final int CONTAINED_LIFE_FORCE = 9682; // Contained Life Force private static final int STINGER = 10012; // Scorpion Poison Stinger - public Kief() - { + public Kief() { super(Kief.class.getSimpleName(), "hellbound/AI/NPC"); addFirstTalkId(KIEF); addStartNpc(KIEF); @@ -48,97 +46,70 @@ public final class Kief extends AbstractNpcAI } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { - case "Badges": - { - switch (HellboundEngine.getInstance().getLevel()) - { + switch (event) { + case "Badges": { + switch (HellboundEngine.getInstance().getLevel()) { case 2: - case 3: - { - if (hasQuestItems(player, DARION_BADGE)) - { + case 3: { + if (hasQuestItems(player, DARION_BADGE)) { HellboundEngine.getInstance().updateTrust((int) getQuestItemsCount(player, DARION_BADGE) * 10, true); takeItems(player, DARION_BADGE, -1); return "32354-10.htm"; } break; } - default: - { + default: { htmltext = "32354-10a.htm"; break; } } break; } - case "Bottle": - { - if (HellboundEngine.getInstance().getLevel() >= 7) - { - if (getQuestItemsCount(player, STINGER) >= 20) - { + case "Bottle": { + if (HellboundEngine.getInstance().getLevel() >= 7) { + if (getQuestItemsCount(player, STINGER) >= 20) { takeItems(player, STINGER, 20); giveItems(player, BOTTLE, 1); htmltext = "32354-11h.htm"; - } - else - { + } else { htmltext = "32354-11i.htm"; } } break; } - case "dlf": - { - if (HellboundEngine.getInstance().getLevel() == 7) - { - if (hasQuestItems(player, DIM_LIFE_FORCE)) - { + case "dlf": { + if (HellboundEngine.getInstance().getLevel() == 7) { + if (hasQuestItems(player, DIM_LIFE_FORCE)) { HellboundEngine.getInstance().updateTrust((int) getQuestItemsCount(player, DIM_LIFE_FORCE) * 20, true); takeItems(player, DIM_LIFE_FORCE, -1); htmltext = "32354-11a.htm"; - } - else - { + } else { htmltext = "32354-11b.htm"; } } break; } - case "lf": - { - if (HellboundEngine.getInstance().getLevel() == 7) - { - if (hasQuestItems(player, LIFE_FORCE)) - { + case "lf": { + if (HellboundEngine.getInstance().getLevel() == 7) { + if (hasQuestItems(player, LIFE_FORCE)) { HellboundEngine.getInstance().updateTrust((int) getQuestItemsCount(player, LIFE_FORCE) * 80, true); takeItems(player, LIFE_FORCE, -1); htmltext = "32354-11c.htm"; - } - else - { + } else { htmltext = "32354-11d.htm"; } } break; } - case "clf": - { - if (HellboundEngine.getInstance().getLevel() == 7) - { - if (hasQuestItems(player, CONTAINED_LIFE_FORCE)) - { + case "clf": { + if (HellboundEngine.getInstance().getLevel() == 7) { + if (hasQuestItems(player, CONTAINED_LIFE_FORCE)) { HellboundEngine.getInstance().updateTrust((int) getQuestItemsCount(player, CONTAINED_LIFE_FORCE) * 200, true); takeItems(player, CONTAINED_LIFE_FORCE, -1); htmltext = "32354-11e.htm"; - } - else - { + } else { htmltext = "32354-11f.htm"; } } @@ -149,10 +120,8 @@ public final class Kief extends AbstractNpcAI } @Override - public final String onFirstTalk(L2Npc npc, L2PcInstance player) - { - switch (HellboundEngine.getInstance().getLevel()) - { + public final String onFirstTalk(L2Npc npc, L2PcInstance player) { + switch (HellboundEngine.getInstance().getLevel()) { case 1: return "32354-01.htm"; case 2: diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Natives/Natives.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Natives/Natives.java index 5668a08fe0..eacdc26ea9 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Natives/Natives.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Natives/Natives.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Natives AI. * @author DS, GKR */ -public final class Natives extends AbstractNpcAI -{ +public final class Natives extends AbstractNpcAI { // NPCs private static final int NATIVE = 32362; private static final int INSURGENT = 32363; @@ -42,14 +41,12 @@ public final class Natives extends AbstractNpcAI private static final int MARK_OF_BETRAYAL = 9676; // Mark of Betrayal private static final int BADGES = 9674; // Darion's Badge // Misc - private static final int[] DOORS = - { + private static final int[] DOORS = { 19250003, 19250004, }; - public Natives() - { + public Natives() { super(Natives.class.getSimpleName(), "hellbound/AI/NPC"); addFirstTalkId(NATIVE); addFirstTalkId(INSURGENT); @@ -62,34 +59,24 @@ public final class Natives extends AbstractNpcAI } @Override - public final String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public final String onFirstTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; final int hellboundLevel = HellboundEngine.getInstance().getLevel(); - switch (npc.getId()) - { - case NATIVE: - { + switch (npc.getId()) { + case NATIVE: { htmltext = hellboundLevel > 5 ? "32362-01.htm" : "32362.htm"; break; } - case INSURGENT: - { + case INSURGENT: { htmltext = hellboundLevel > 5 ? "32363-01.htm" : "32363.htm"; break; } - case INCASTLE: - { - if (hellboundLevel < 9) - { + case INCASTLE: { + if (hellboundLevel < 9) { htmltext = "32357-01a.htm"; - } - else if (hellboundLevel == 9) - { + } else if (hellboundLevel == 9) { htmltext = npc.isBusy() ? "32357-02.htm" : "32357-01.htm"; - } - else - { + } else { htmltext = "32357-01b.htm"; } break; @@ -99,76 +86,52 @@ public final class Natives extends AbstractNpcAI } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - if (npc.getId() == TRAITOR) - { - if (event.equalsIgnoreCase("open_door")) - { - if (getQuestItemsCount(player, MARK_OF_BETRAYAL) >= 10) - { + if (npc.getId() == TRAITOR) { + if (event.equalsIgnoreCase("open_door")) { + if (getQuestItemsCount(player, MARK_OF_BETRAYAL) >= 10) { takeItems(player, MARK_OF_BETRAYAL, 10); broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.ALRIGHT_NOW_LEODAS_IS_YOURS); HellboundEngine.getInstance().updateTrust(-50, true); - for (int doorId : DOORS) - { + for (int doorId : DOORS) { L2DoorInstance door = DoorData.getInstance().getDoor(doorId); - if (door != null) - { + if (door != null) { door.openMe(); } } cancelQuestTimers("close_doors"); startQuestTimer("close_doors", 1800000, npc, player); // 30 min - } - else if (hasQuestItems(player, MARK_OF_BETRAYAL)) - { + } else if (hasQuestItems(player, MARK_OF_BETRAYAL)) { htmltext = "32364-01.htm"; - } - else - { + } else { htmltext = "32364-02.htm"; } - } - else if (event.equalsIgnoreCase("close_doors")) - { - for (int doorId : DOORS) - { + } else if (event.equalsIgnoreCase("close_doors")) { + for (int doorId : DOORS) { L2DoorInstance door = DoorData.getInstance().getDoor(doorId); - if (door != null) - { + if (door != null) { door.closeMe(); } } } - } - else if ((npc.getId() == NATIVE) && event.equalsIgnoreCase("hungry_death")) - { + } else if ((npc.getId() == NATIVE) && event.equalsIgnoreCase("hungry_death")) { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.HUN_HUNGRY); npc.doDie(null); - } - else if (npc.getId() == INCASTLE) - { - if (event.equalsIgnoreCase("FreeSlaves")) - { - if (getQuestItemsCount(player, BADGES) >= 5) - { + } else if (npc.getId() == INCASTLE) { + if (event.equalsIgnoreCase("FreeSlaves")) { + if (getQuestItemsCount(player, BADGES) >= 5) { takeItems(player, BADGES, 5); npc.setBusy(true); // Prevent Native from take items more, than once HellboundEngine.getInstance().updateTrust(100, true); htmltext = "32357-02.htm"; startQuestTimer("delete_me", 3000, npc, null); - } - else - { + } else { htmltext = "32357-02a.htm"; } - } - else if (event.equalsIgnoreCase("delete_me")) - { + } else if (event.equalsIgnoreCase("delete_me")) { npc.setBusy(false); // TODO: Does it really need? npc.deleteMe(); npc.getSpawn().decreaseCount(npc); @@ -178,10 +141,8 @@ public final class Natives extends AbstractNpcAI } @Override - public final String onSpawn(L2Npc npc) - { - if ((npc.getId() == NATIVE) && (HellboundEngine.getInstance().getLevel() < 6)) - { + public final String onSpawn(L2Npc npc) { + if ((npc.getId() == NATIVE) && (HellboundEngine.getInstance().getLevel() < 6)) { startQuestTimer("hungry_death", 600000, npc, null); } return super.onSpawn(npc); diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Quarry/Quarry.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Quarry/Quarry.java index b1278b0ce4..a640c2f78c 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Quarry/Quarry.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Quarry/Quarry.java @@ -38,13 +38,11 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Quarry AI. * @author DS, GKR */ -public final class Quarry extends AbstractNpcAI -{ +public final class Quarry extends AbstractNpcAI { // NPCs private static final int SLAVE = 32299; // Items - protected static final ItemChanceHolder[] DROP_LIST = - { + protected static final ItemChanceHolder[] DROP_LIST = { new ItemChanceHolder(9628, 261), // Leonard new ItemChanceHolder(9630, 175), // Orichalcum new ItemChanceHolder(9629, 145), // Adamantine @@ -57,8 +55,7 @@ public final class Quarry extends AbstractNpcAI // Misc private static final int TRUST = 50; - public Quarry() - { + public Quarry() { super(Quarry.class.getSimpleName(), "hellbound/AI/NPC"); addSpawnId(SLAVE); addFirstTalkId(SLAVE); @@ -69,32 +66,25 @@ public final class Quarry extends AbstractNpcAI } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { - case "FollowMe": - { + switch (event) { + case "FollowMe": { npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); npc.setTarget(player); npc.setAutoAttackable(true); npc.setRHandId(9136); npc.setWalking(); - if (getQuestTimer("TIME_LIMIT", npc, null) == null) - { + if (getQuestTimer("TIME_LIMIT", npc, null) == null) { startQuestTimer("TIME_LIMIT", 900000, npc, null); // 15 min limit for save } htmltext = "32299-02.htm"; break; } - case "TIME_LIMIT": - { - for (L2ZoneType zone : ZoneManager.getInstance().getZones(npc)) - { - if (zone.getId() == 40108) - { + case "TIME_LIMIT": { + for (L2ZoneType zone : ZoneManager.getInstance().getZones(npc)) { + if (zone.getId() == 40108) { npc.setTarget(null); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); npc.setAutoAttackable(false); @@ -107,16 +97,11 @@ public final class Quarry extends AbstractNpcAI npc.doDie(npc); break; } - case "DECAY": - { - if ((npc != null) && !npc.isDead()) - { - if (npc.getTarget().isPlayer()) - { - for (ItemChanceHolder item : DROP_LIST) - { - if (getRandom(10000) < item.getChance()) - { + case "DECAY": { + if ((npc != null) && !npc.isDead()) { + if (npc.getTarget().isPlayer()) { + for (ItemChanceHolder item : DROP_LIST) { + if (getRandom(10000) < item.getChance()) { npc.dropItem((L2PcInstance) npc.getTarget(), item.getId(), (int) (item.getCount() * rates().getRateQuestDrop())); break; } @@ -134,52 +119,39 @@ public final class Quarry extends AbstractNpcAI } @Override - public final String onSpawn(L2Npc npc) - { + public final String onSpawn(L2Npc npc) { npc.setAutoAttackable(false); - if (npc instanceof L2QuestGuardInstance) - { + if (npc instanceof L2QuestGuardInstance) { ((L2QuestGuardInstance) npc).setPassive(true); } return super.onSpawn(npc); } @Override - public final String onFirstTalk(L2Npc npc, L2PcInstance player) - { - if (HellboundEngine.getInstance().getLevel() != 5) - { + public final String onFirstTalk(L2Npc npc, L2PcInstance player) { + if (HellboundEngine.getInstance().getLevel() != 5) { return "32299.htm"; } return "32299-01.htm"; } @Override - public final String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public final String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { npc.setAutoAttackable(false); return super.onKill(npc, killer, isSummon); } @Override - public final String onEnterZone(L2Character character, L2ZoneType zone) - { - if (character.isAttackable()) - { + public final String onEnterZone(L2Character character, L2ZoneType zone) { + if (character.isAttackable()) { final L2Attackable npc = (L2Attackable) character; - if (npc.getId() == SLAVE) - { - if (!npc.isDead() && !npc.isDecayed() && (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_FOLLOW)) - { - if (HellboundEngine.getInstance().getLevel() == 5) - { + if (npc.getId() == SLAVE) { + if (!npc.isDead() && !npc.isDecayed() && (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_FOLLOW)) { + if (HellboundEngine.getInstance().getLevel() == 5) { startQuestTimer("DECAY", 1000, npc, null); - try - { + try { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.THANK_YOU_FOR_THE_RESCUE_ITS_A_SMALL_GIFT); - } - catch (Exception e) - { + } catch (Exception e) { // } } diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Shadai/Shadai.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Shadai/Shadai.java index dae1148c32..d2b6ea5125 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Shadai/Shadai.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Shadai/Shadai.java @@ -28,39 +28,31 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Shadai AI. * @author GKR */ -public final class Shadai extends AbstractNpcAI -{ +public final class Shadai extends AbstractNpcAI { // NPCs private static final int SHADAI = 32347; // Locations private static final Location DAY_COORDS = new Location(16882, 238952, 9776); private static final Location NIGHT_COORDS = new Location(9064, 253037, -1928); - public Shadai() - { + public Shadai() { super(Shadai.class.getSimpleName(), "hellbound/AI/NPC"); addSpawnId(SHADAI); } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equals("VALIDATE_POS") && (npc != null)) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equals("VALIDATE_POS") && (npc != null)) { Location coords = DAY_COORDS; boolean mustRevalidate = false; - if ((npc.getX() != NIGHT_COORDS.getX()) && GameTimeController.getInstance().isNight()) - { + if ((npc.getX() != NIGHT_COORDS.getX()) && GameTimeController.getInstance().isNight()) { coords = NIGHT_COORDS; mustRevalidate = true; - } - else if ((npc.getX() != DAY_COORDS.getX()) && !GameTimeController.getInstance().isNight()) - { + } else if ((npc.getX() != DAY_COORDS.getX()) && !GameTimeController.getInstance().isNight()) { mustRevalidate = true; } - if (mustRevalidate) - { + if (mustRevalidate) { npc.getSpawn().setLocation(coords); npc.teleToLocation(coords); } @@ -69,8 +61,7 @@ public final class Shadai extends AbstractNpcAI } @Override - public final String onSpawn(L2Npc npc) - { + public final String onSpawn(L2Npc npc) { startQuestTimer("VALIDATE_POS", 60000, npc, null, true); return super.onSpawn(npc); } diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Solomon/Solomon.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Solomon/Solomon.java index e162781a8f..acbdefdf30 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Solomon/Solomon.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Solomon/Solomon.java @@ -27,26 +27,20 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Solomon AI. * @author DS */ -public final class Solomon extends AbstractNpcAI -{ +public final class Solomon extends AbstractNpcAI { // NPCs private static final int SOLOMON = 32355; - public Solomon() - { + public Solomon() { super(Solomon.class.getSimpleName(), "hellbound/AI/NPC"); addFirstTalkId(SOLOMON); } @Override - public final String onFirstTalk(L2Npc npc, L2PcInstance player) - { - if (HellboundEngine.getInstance().getLevel() == 5) - { + public final String onFirstTalk(L2Npc npc, L2PcInstance player) { + if (HellboundEngine.getInstance().getLevel() == 5) { return "32355-01.htm"; - } - else if (HellboundEngine.getInstance().getLevel() > 5) - { + } else if (HellboundEngine.getInstance().getLevel() > 5) { return "32355-01a.htm"; } return super.onFirstTalk(npc, player); diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Warpgate/Warpgate.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Warpgate/Warpgate.java index dba34474e0..62551bb814 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Warpgate/Warpgate.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/NPC/Warpgate/Warpgate.java @@ -35,11 +35,9 @@ import com.l2jserver.gameserver.model.zone.L2ZoneType; * Warpgate teleport AI. * @author _DS_ */ -public final class Warpgate extends AbstractNpcAI -{ +public final class Warpgate extends AbstractNpcAI { // NPCs - private static final int[] WARPGATES = - { + private static final int[] WARPGATES = { 32314, 32315, 32316, @@ -55,8 +53,7 @@ public final class Warpgate extends AbstractNpcAI // Misc private static final int ZONE = 40101; - public Warpgate() - { + public Warpgate() { super(Warpgate.class.getSimpleName(), "hellbound/AI/NPC"); addStartNpc(WARPGATES); addFirstTalkId(WARPGATES); @@ -65,60 +62,44 @@ public final class Warpgate extends AbstractNpcAI } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equals("enter")) - { - if (canEnter(player)) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equals("enter")) { + if (canEnter(player)) { player.teleToLocation(ENTER_LOC, true); - } - else - { + } else { return "Warpgate-03.html"; } - } - else if (event.equals("TELEPORT")) - { + } else if (event.equals("TELEPORT")) { player.teleToLocation(REMOVE_LOC, true); } return super.onAdvEvent(event, npc, player); } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return HellboundEngine.getInstance().isLocked() ? "Warpgate-01.html" : "Warpgate-02.html"; } @Override - public final String onEnterZone(L2Character character, L2ZoneType zone) - { - if (character.isPlayer()) - { + public final String onEnterZone(L2Character character, L2ZoneType zone) { + if (character.isPlayer()) { final L2PcInstance player = character.getActingPlayer(); - if (!canEnter(player) && !player.canOverrideCond(PcCondOverride.ZONE_CONDITIONS) && !player.isOnEvent()) - { + if (!canEnter(player) && !player.canOverrideCond(PcCondOverride.ZONE_CONDITIONS) && !player.isOnEvent()) { startQuestTimer("TELEPORT", 1000, null, player); - } - else if (!player.isMinimapAllowed() && hasAtLeastOneQuestItem(player, MAP)) - { + } else if (!player.isMinimapAllowed() && hasAtLeastOneQuestItem(player, MAP)) { player.setMinimapAllowed(true); } } return super.onEnterZone(character, zone); } - private static boolean canEnter(L2PcInstance player) - { - if (player.isFlying()) - { + private static boolean canEnter(L2PcInstance player) { + if (player.isFlying()) { return false; } - if (general().hellboundWithoutQuest()) - { + if (general().hellboundWithoutQuest()) { return true; } return (player.hasQuestCompleted(Q00130_PathToHellbound.class.getSimpleName()) || player.hasQuestCompleted(Q00133_ThatsBloodyHot.class.getSimpleName())); diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/NaiaLock.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/NaiaLock.java index 721b66e5a4..28b0773f6a 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/NaiaLock.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/NaiaLock.java @@ -28,20 +28,17 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Removes minions after master's death. * @author GKR */ -public final class NaiaLock extends AbstractNpcAI -{ +public final class NaiaLock extends AbstractNpcAI { // NPCs private static final int LOCK = 18491; - public NaiaLock() - { + public NaiaLock() { super(NaiaLock.class.getSimpleName(), "hellbound/AI"); addKillId(LOCK); } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { ((L2MonsterInstance) npc).getMinionList().onMasterDie(true); return super.onKill(npc, killer, isSummon); } diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/OutpostCaptain.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/OutpostCaptain.java index ce538f520d..987e9d0833 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/OutpostCaptain.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/OutpostCaptain.java @@ -29,19 +29,16 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; * Outpost Captain's AI. * @author DS */ -public final class OutpostCaptain extends AbstractNpcAI -{ +public final class OutpostCaptain extends AbstractNpcAI { // NPCs private static final int CAPTAIN = 18466; - private static final int[] DEFENDERS = - { + private static final int[] DEFENDERS = { 22357, // Enceinte Defender 22358, // Enceinte Defender }; private static final int DOORKEEPER = 32351; - public OutpostCaptain() - { + public OutpostCaptain() { super(OutpostCaptain.class.getSimpleName(), "hellbound/AI"); addKillId(CAPTAIN); addSpawnId(CAPTAIN, DOORKEEPER); @@ -49,10 +46,8 @@ public final class OutpostCaptain extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equalsIgnoreCase("LEVEL_UP")) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equalsIgnoreCase("LEVEL_UP")) { npc.deleteMe(); HellboundEngine.getInstance().setLevel(9); } @@ -60,30 +55,23 @@ public final class OutpostCaptain extends AbstractNpcAI } @Override - public final String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (HellboundEngine.getInstance().getLevel() == 8) - { + public final String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (HellboundEngine.getInstance().getLevel() == 8) { addSpawn(DOORKEEPER, npc.getSpawn().getLocation(), false, 0, false); } return super.onKill(npc, killer, isSummon); } @Override - public final String onSpawn(L2Npc npc) - { + public final String onSpawn(L2Npc npc) { npc.setIsNoRndWalk(true); - if (npc.getId() == CAPTAIN) - { + if (npc.getId() == CAPTAIN) { final L2DoorInstance door = DoorData.getInstance().getDoor(20250001); - if (door != null) - { + if (door != null) { door.closeMe(); } - } - else if (npc.getId() == DOORKEEPER) - { + } else if (npc.getId() == DOORKEEPER) { startQuestTimer("LEVEL_UP", 3000, npc, null); } return super.onSpawn(npc); diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/Ranku.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/Ranku.java index 16409dda4c..d122e8ae69 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/Ranku.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/Ranku.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.util.MinionList; * Ranku's AI. * @author GKR */ -public final class Ranku extends AbstractNpcAI -{ +public final class Ranku extends AbstractNpcAI { // NPCs private static final int RANKU = 25542; private static final int MINION = 32305; @@ -43,22 +42,17 @@ public final class Ranku extends AbstractNpcAI // Misc private static final Set<Integer> MY_TRACKING_SET = ConcurrentHashMap.newKeySet(); - public Ranku() - { + public Ranku() { super(Ranku.class.getSimpleName(), "hellbound/AI"); addAttackId(RANKU); addKillId(RANKU, MINION); } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equalsIgnoreCase("checkup") && (npc.getId() == RANKU) && !npc.isDead()) - { - for (L2MonsterInstance minion : ((L2MonsterInstance) npc).getMinionList().getSpawnedMinions()) - { - if ((minion != null) && !minion.isDead() && MY_TRACKING_SET.contains(minion.getObjectId())) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equalsIgnoreCase("checkup") && (npc.getId() == RANKU) && !npc.isDead()) { + for (L2MonsterInstance minion : ((L2MonsterInstance) npc).getMinionList().getSpawnedMinions()) { + if ((minion != null) && !minion.isDead() && MY_TRACKING_SET.contains(minion.getObjectId())) { final L2PcInstance[] players = minion.getKnownList().getKnownPlayers().values().toArray(new L2PcInstance[minion.getKnownList().getKnownPlayers().size()]); final L2PcInstance killer = players[getRandom(players.length)]; minion.reduceCurrentHp(minion.getMaxHp() / 100, killer, null); @@ -70,14 +64,10 @@ public final class Ranku extends AbstractNpcAI } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) - { - if (npc.getId() == RANKU) - { - for (L2MonsterInstance minion : ((L2MonsterInstance) npc).getMinionList().getSpawnedMinions()) - { - if ((minion != null) && !minion.isDead() && !MY_TRACKING_SET.contains(minion.getObjectId())) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) { + if (npc.getId() == RANKU) { + for (L2MonsterInstance minion : ((L2MonsterInstance) npc).getMinionList().getSpawnedMinions()) { + if ((minion != null) && !minion.isDead() && !MY_TRACKING_SET.contains(minion.getObjectId())) { broadcastNpcSay(minion, Say2.NPC_ALL, NpcStringId.DONT_KILL_ME_PLEASE_SOMETHINGS_STRANGLING_ME); startQuestTimer("checkup", 1000, npc, null); MY_TRACKING_SET.add(minion.getObjectId()); @@ -88,28 +78,20 @@ public final class Ranku extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (npc.getId() == MINION) - { - if (MY_TRACKING_SET.contains(npc.getObjectId())) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (npc.getId() == MINION) { + if (MY_TRACKING_SET.contains(npc.getObjectId())) { MY_TRACKING_SET.remove(npc.getObjectId()); } final L2MonsterInstance master = ((L2MonsterInstance) npc).getLeader(); - if ((master != null) && !master.isDead()) - { + if ((master != null) && !master.isDead()) { L2MonsterInstance minion2 = MinionList.spawnMinion(master, MINION_2); minion2.teleToLocation(npc.getLocation()); } - } - else if (npc.getId() == RANKU) - { - for (L2MonsterInstance minion : ((L2MonsterInstance) npc).getMinionList().getSpawnedMinions()) - { - if (MY_TRACKING_SET.contains(minion.getObjectId())) - { + } else if (npc.getId() == RANKU) { + for (L2MonsterInstance minion : ((L2MonsterInstance) npc).getMinionList().getSpawnedMinions()) { + if (MY_TRACKING_SET.contains(minion.getObjectId())) { MY_TRACKING_SET.remove(minion.getObjectId()); } } diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/Slaves.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/Slaves.java index 4f0a002ca9..f10d0c9c1c 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/Slaves.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/Slaves.java @@ -35,11 +35,9 @@ import com.l2jserver.gameserver.taskmanager.DecayTaskManager; * Hellbound Slaves AI. * @author DS */ -public final class Slaves extends AbstractNpcAI -{ +public final class Slaves extends AbstractNpcAI { // NPCs - private static final int[] MASTERS = - { + private static final int[] MASTERS = { 22320, // Junior Watchman 22321, // Junior Summoner }; @@ -48,33 +46,26 @@ public final class Slaves extends AbstractNpcAI // Misc private static final int TRUST_REWARD = 10; - public Slaves() - { + public Slaves() { super(Slaves.class.getSimpleName(), "hellbound/AI"); addSpawnId(MASTERS); addKillId(MASTERS); } @Override - public final String onSpawn(L2Npc npc) - { + public final String onSpawn(L2Npc npc) { ((L2MonsterInstance) npc).enableMinions(HellboundEngine.getInstance().getLevel() < 5); ((L2MonsterInstance) npc).setOnKillDelay(1000); return super.onSpawn(npc); } @Override - public final String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (((L2MonsterInstance) npc).getMinionList() != null) - { + public final String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (((L2MonsterInstance) npc).getMinionList() != null) { final List<L2MonsterInstance> slaves = ((L2MonsterInstance) npc).getMinionList().getSpawnedMinions(); - if ((slaves != null) && !slaves.isEmpty()) - { - for (L2MonsterInstance slave : slaves) - { - if ((slave == null) || slave.isDead()) - { + if ((slaves != null) && !slaves.isEmpty()) { + for (L2MonsterInstance slave : slaves) { + if ((slave == null) || slave.isDead()) { continue; } slave.clearAggroList(); @@ -82,8 +73,7 @@ public final class Slaves extends AbstractNpcAI slave.abortCast(); broadcastNpcSay(slave, Say2.NPC_ALL, NpcStringId.THANK_YOU_FOR_SAVING_ME_FROM_THE_CLUTCHES_OF_EVIL); - if ((HellboundEngine.getInstance().getLevel() >= 1) && (HellboundEngine.getInstance().getLevel() <= 2)) - { + if ((HellboundEngine.getInstance().getLevel() >= 1) && (HellboundEngine.getInstance().getLevel() <= 2)) { HellboundEngine.getInstance().updateTrust(TRUST_REWARD, false); } slave.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, MOVE_TO); diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/Typhoon.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/Typhoon.java index 7cf4f884aa..dfebdb3c09 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/Typhoon.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/Typhoon.java @@ -29,31 +29,26 @@ import com.l2jserver.gameserver.model.holders.SkillHolder; * Typhoon's AI. * @author GKR */ -public final class Typhoon extends AbstractNpcAI -{ +public final class Typhoon extends AbstractNpcAI { // NPCs private static final int TYPHOON = 25539; // Skills private static final SkillHolder STORM = new SkillHolder(5434); // Gust - public Typhoon() - { + public Typhoon() { super(Typhoon.class.getSimpleName(), "hellbound/AI"); addAggroRangeEnterId(TYPHOON); addSpawnId(TYPHOON); final L2RaidBossInstance boss = RaidBossSpawnManager.getInstance().getBosses().get(TYPHOON); - if (boss != null) - { + if (boss != null) { onSpawn(boss); } } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equalsIgnoreCase("CAST") && (npc != null) && !npc.isDead()) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equalsIgnoreCase("CAST") && (npc != null) && !npc.isDead()) { npc.doSimultaneousCast(STORM); startQuestTimer("CAST", 5000, npc, null); } @@ -61,15 +56,13 @@ public final class Typhoon extends AbstractNpcAI } @Override - public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) { npc.doSimultaneousCast(STORM); return super.onAggroRangeEnter(npc, player, isSummon); } @Override - public final String onSpawn(L2Npc npc) - { + public final String onSpawn(L2Npc npc) { startQuestTimer("CAST", 5000, npc, null); return super.onSpawn(npc); } diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/Zones/AnomicFoundry/AnomicFoundry.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/Zones/AnomicFoundry/AnomicFoundry.java index 21d4cf700e..b07525cb2f 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/Zones/AnomicFoundry/AnomicFoundry.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/Zones/AnomicFoundry/AnomicFoundry.java @@ -39,8 +39,7 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Anomic Foundry. * @author GKR */ -public final class AnomicFoundry extends AbstractNpcAI -{ +public final class AnomicFoundry extends AbstractNpcAI { // NPCs private static int LABORER = 22396; private static int FOREMAN = 22397; @@ -64,8 +63,7 @@ public final class AnomicFoundry extends AbstractNpcAI private final int respawnMin = 20000; private final int respawnMax = 300000; - private final int[] _spawned = - { + private final int[] _spawned = { 0, 0, 0, @@ -73,8 +71,7 @@ public final class AnomicFoundry extends AbstractNpcAI 0 }; - public AnomicFoundry() - { + public AnomicFoundry() { super(AnomicFoundry.class.getSimpleName(), "hellbound/AI/Zones"); addAggroRangeEnterId(LABORER); addAttackId(LABORER); @@ -85,47 +82,33 @@ public final class AnomicFoundry extends AbstractNpcAI } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equalsIgnoreCase("make_spawn_1")) - { - if (HellboundEngine.getInstance().getLevel() >= 10) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equalsIgnoreCase("make_spawn_1")) { + if (HellboundEngine.getInstance().getLevel() >= 10) { int idx = getRandom(3); - if (_spawned[idx] < SPAWNS[idx][5]) - { + if (_spawned[idx] < SPAWNS[idx][5]) { addSpawn(SPAWNS[idx][0], SPAWNS[idx][1], SPAWNS[idx][2], SPAWNS[idx][3], SPAWNS[idx][4], false, 0, false); respawnTime += 10000; } startQuestTimer("make_spawn_1", respawnTime, null, null); } - } - else if (event.equalsIgnoreCase("make_spawn_2")) - { - if (_spawned[4] < SPAWNS[4][5]) - { + } else if (event.equalsIgnoreCase("make_spawn_2")) { + if (_spawned[4] < SPAWNS[4][5]) { addSpawn(SPAWNS[4][0], SPAWNS[4][1], SPAWNS[4][2], SPAWNS[4][3], SPAWNS[4][4], false, 0, false); } - } - else if (event.equalsIgnoreCase("return_laborer")) - { - if ((npc != null) && !npc.isDead()) - { + } else if (event.equalsIgnoreCase("return_laborer")) { + if ((npc != null) && !npc.isDead()) { ((L2Attackable) npc).returnHome(); } - } - else if (event.equalsIgnoreCase("reset_respawn_time")) - { + } else if (event.equalsIgnoreCase("reset_respawn_time")) { respawnTime = 60000; } return super.onAdvEvent(event, npc, player); } @Override - public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) - { - if (getRandom(10000) < 2000) - { + public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) { + if (getRandom(10000) < 2000) { requestHelp(npc, player, 500, FOREMAN); requestHelp(npc, player, 500, LESSER_EVIL); requestHelp(npc, player, 500, GREATER_EVIL); @@ -135,34 +118,27 @@ public final class AnomicFoundry extends AbstractNpcAI } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) { int atkIndex = _atkIndex.containsKey(npc.getObjectId()) ? _atkIndex.get(npc.getObjectId()) : 0; - if (atkIndex == 0) - { + if (atkIndex == 0) { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.ENEMY_INVASION_HURRY_UP); cancelQuestTimer("return_laborer", npc, null); startQuestTimer("return_laborer", 60000, npc, null); - if (respawnTime > respawnMin) - { + if (respawnTime > respawnMin) { respawnTime -= 5000; - } - else if ((respawnTime <= respawnMin) && (getQuestTimer("reset_respawn_time", null, null) == null)) - { + } else if ((respawnTime <= respawnMin) && (getQuestTimer("reset_respawn_time", null, null) == null)) { startQuestTimer("reset_respawn_time", 600000, null, null); } } - if (getRandom(10000) < 2000) - { + if (getRandom(10000) < 2000) { atkIndex++; _atkIndex.put(npc.getObjectId(), atkIndex); requestHelp(npc, attacker, 1000 * atkIndex, FOREMAN); requestHelp(npc, attacker, 1000 * atkIndex, LESSER_EVIL); requestHelp(npc, attacker, 1000 * atkIndex, GREATER_EVIL); - if (getRandom(10) < 1) - { + if (getRandom(10) < 1) { npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location((npc.getX() + getRandom(-800, 800)), (npc.getY() + getRandom(-800, 800)), npc.getZ(), npc.getHeading())); } } @@ -170,24 +146,16 @@ public final class AnomicFoundry extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (getSpawnGroup(npc) >= 0) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (getSpawnGroup(npc) >= 0) { _spawned[getSpawnGroup(npc)]--; SpawnTable.getInstance().deleteSpawn(npc.getSpawn(), false); - } - else if (npc.getId() == LABORER) - { - if (getRandom(10000) < 8000) - { + } else if (npc.getId() == LABORER) { + if (getRandom(10000) < 8000) { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.PROCESS_SHOULDNT_BE_DELAYED_BECAUSE_OF_ME); - if (respawnTime < respawnMax) - { + if (respawnTime < respawnMax) { respawnTime += 10000; - } - else if ((respawnTime >= respawnMax) && (getQuestTimer("reset_respawn_time", null, null) == null)) - { + } else if ((respawnTime >= respawnMax) && (getQuestTimer("reset_respawn_time", null, null) == null)) { startQuestTimer("reset_respawn_time", 600000, null, null); } } @@ -198,36 +166,28 @@ public final class AnomicFoundry extends AbstractNpcAI } @Override - public final String onSpawn(L2Npc npc) - { + public final String onSpawn(L2Npc npc) { SpawnTable.getInstance().addNewSpawn(npc.getSpawn(), false); - if (getSpawnGroup(npc) >= 0) - { + if (getSpawnGroup(npc) >= 0) { _spawned[getSpawnGroup(npc)]++; } - if (npc.getId() == LABORER) - { + if (npc.getId() == LABORER) { npc.setIsNoRndWalk(true); } return super.onSpawn(npc); } @Override - protected void onTeleport(L2Npc npc) - { - if ((getSpawnGroup(npc) >= 0) && (getSpawnGroup(npc) <= 2)) - { + protected void onTeleport(L2Npc npc) { + if ((getSpawnGroup(npc) >= 0) && (getSpawnGroup(npc) <= 2)) { _spawned[getSpawnGroup(npc)]--; SpawnTable.getInstance().deleteSpawn(npc.getSpawn(), false); npc.scheduleDespawn(100); - if (_spawned[3] < SPAWNS[3][5]) - { + if (_spawned[3] < SPAWNS[3][5]) { addSpawn(SPAWNS[3][0], SPAWNS[3][1], SPAWNS[3][2], SPAWNS[3][3], SPAWNS[3][4], false, 0, false); } - } - else if (getSpawnGroup(npc) == 3) - { + } else if (getSpawnGroup(npc) == 3) { startQuestTimer("make_spawn_2", respawnTime * 2, null, null); _spawned[3]--; SpawnTable.getInstance().deleteSpawn(npc.getSpawn(), false); @@ -235,16 +195,13 @@ public final class AnomicFoundry extends AbstractNpcAI } } - private static int getSpawnGroup(L2Npc npc) - { + private static int getSpawnGroup(L2Npc npc) { final int coordX = npc.getSpawn().getX(); final int coordY = npc.getSpawn().getY(); final int npcId = npc.getId(); - for (int i = 0; i < 5; i++) - { - if ((SPAWNS[i][0] == npcId) && (SPAWNS[i][1] == coordX) && (SPAWNS[i][2] == coordY)) - { + for (int i = 0; i < 5; i++) { + if ((SPAWNS[i][0] == npcId) && (SPAWNS[i][1] == coordX) && (SPAWNS[i][2] == coordY)) { return i; } } @@ -252,13 +209,10 @@ public final class AnomicFoundry extends AbstractNpcAI } // Zoey76: TODO: This should be done with onFactionCall(..) - private static void requestHelp(L2Npc requester, L2PcInstance agressor, int range, int helperId) - { - for (L2Spawn spawn : SpawnTable.getInstance().getSpawns(helperId)) - { + private static void requestHelp(L2Npc requester, L2PcInstance agressor, int range, int helperId) { + for (L2Spawn spawn : SpawnTable.getInstance().getSpawns(helperId)) { final L2MonsterInstance monster = (L2MonsterInstance) spawn.getLastSpawn(); - if ((monster != null) && (agressor != null) && !monster.isDead() && monster.isInsideRadius(requester, range, true, false) && !agressor.isDead()) - { + if ((monster != null) && (agressor != null) && !monster.isDead() && monster.isInsideRadius(requester, range, true, false) && !agressor.isDead()) { monster.addDamageHate(agressor, 0, 1000); } } diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/Zones/BaseTower/BaseTower.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/Zones/BaseTower/BaseTower.java index 08bc4ea3f1..c9dc84cfab 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/Zones/BaseTower/BaseTower.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/Zones/BaseTower/BaseTower.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.model.holders.SkillHolder; * Base Tower. * @author GKR */ -public final class BaseTower extends AbstractNpcAI -{ +public final class BaseTower extends AbstractNpcAI { // NPCs private static final int GUZEN = 22362; private static final int KENDAL = 32301; @@ -43,8 +42,7 @@ public final class BaseTower extends AbstractNpcAI // Misc private static final Map<Integer, L2PcInstance> BODY_DESTROYER_TARGET_LIST = new ConcurrentHashMap<>(); - public BaseTower() - { + public BaseTower() { super(BaseTower.class.getSimpleName(), "hellbound/AI/Zones"); addKillId(GUZEN); addKillId(BODY_DESTROYER); @@ -53,31 +51,25 @@ public final class BaseTower extends AbstractNpcAI } @Override - public final String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public final String onFirstTalk(L2Npc npc, L2PcInstance player) { final ClassId classId = player.getClassId(); - if (classId.equalsOrChildOf(ClassId.hellKnight) || classId.equalsOrChildOf(ClassId.soultaker)) - { + if (classId.equalsOrChildOf(ClassId.hellKnight) || classId.equalsOrChildOf(ClassId.soultaker)) { return "32301-02.htm"; } return "32301-01.htm"; } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equalsIgnoreCase("CLOSE")) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equalsIgnoreCase("CLOSE")) { DoorData.getInstance().getDoor(20260004).closeMe(); } return super.onAdvEvent(event, npc, player); } @Override - public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) - { - if (!BODY_DESTROYER_TARGET_LIST.containsKey(npc.getObjectId())) - { + public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) { + if (!BODY_DESTROYER_TARGET_LIST.containsKey(npc.getObjectId())) { BODY_DESTROYER_TARGET_LIST.put(npc.getObjectId(), player); npc.setTarget(player); npc.doSimultaneousCast(DEATH_WORD); @@ -86,12 +78,9 @@ public final class BaseTower extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - switch (npc.getId()) - { - case GUZEN: - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + switch (npc.getId()) { + case GUZEN: { // Should Kendal be despawned before Guzen's spawn? Or it will be crowd of Kendal's addSpawn(KENDAL, npc.getSpawn().getLocation(), false, npc.getSpawn().getRespawnDelay(), false); DoorData.getInstance().getDoor(20260003).openMe(); @@ -99,13 +88,10 @@ public final class BaseTower extends AbstractNpcAI startQuestTimer("CLOSE", 60000, npc, null, false); break; } - case BODY_DESTROYER: - { - if (BODY_DESTROYER_TARGET_LIST.containsKey(npc.getObjectId())) - { + case BODY_DESTROYER: { + if (BODY_DESTROYER_TARGET_LIST.containsKey(npc.getObjectId())) { final L2PcInstance pl = BODY_DESTROYER_TARGET_LIST.get(npc.getObjectId()); - if ((pl != null) && pl.isOnline() && !pl.isDead()) - { + if ((pl != null) && pl.isOnline() && !pl.isDead()) { pl.stopSkillEffects(true, DEATH_WORD.getSkillId()); } BODY_DESTROYER_TARGET_LIST.remove(npc.getObjectId()); diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/Zones/TowerOfInfinitum/TowerOfInfinitum.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/Zones/TowerOfInfinitum/TowerOfInfinitum.java index e4a67ea9dd..e43c6eb216 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/Zones/TowerOfInfinitum/TowerOfInfinitum.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/Zones/TowerOfInfinitum/TowerOfInfinitum.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.util.Util; * Tower Of Infinitum. * @author GKR */ -public final class TowerOfInfinitum extends AbstractNpcAI -{ +public final class TowerOfInfinitum extends AbstractNpcAI { // NPCs private static final int JERIAN = 32302; private static final int GK_FIRST = 32745; @@ -43,58 +42,47 @@ public final class TowerOfInfinitum extends AbstractNpcAI private static final int PASS_SKILL = 2357; // Misc private static final Map<Integer, Location[]> TELE_COORDS = new HashMap<>(); - static - { - TELE_COORDS.put(32745, new Location[] - { + static { + TELE_COORDS.put(32745, new Location[] { new Location(-22208, 277122, -13376), null }); - TELE_COORDS.put(32746, new Location[] - { + TELE_COORDS.put(32746, new Location[] { new Location(-22208, 277106, -11648), new Location(-22208, 277074, -15040) }); - TELE_COORDS.put(32747, new Location[] - { + TELE_COORDS.put(32747, new Location[] { new Location(-22208, 277120, -9920), new Location(-22208, 277120, -13376) }); - TELE_COORDS.put(32748, new Location[] - { + TELE_COORDS.put(32748, new Location[] { new Location(-19024, 277126, -8256), new Location(-22208, 277106, -11648) }); - TELE_COORDS.put(32749, new Location[] - { + TELE_COORDS.put(32749, new Location[] { new Location(-19024, 277106, -9920), new Location(-22208, 277122, -9920) }); - TELE_COORDS.put(32750, new Location[] - { + TELE_COORDS.put(32750, new Location[] { new Location(-19008, 277100, -11648), new Location(-19024, 277122, -8256) }); - TELE_COORDS.put(32751, new Location[] - { + TELE_COORDS.put(32751, new Location[] { new Location(-19008, 277100, -13376), new Location(-19008, 277106, -9920) }); - TELE_COORDS.put(32752, new Location[] - { + TELE_COORDS.put(32752, new Location[] { new Location(14602, 283179, -7500), new Location(-19008, 277100, -11648) }); } - public TowerOfInfinitum() - { + public TowerOfInfinitum() { super(TowerOfInfinitum.class.getSimpleName(), "hellbound/AI/Zones"); addStartNpc(JERIAN); addTalkId(JERIAN); - for (int i = GK_FIRST; i <= GK_LAST; i++) - { + for (int i = GK_FIRST; i <= GK_LAST; i++) { addStartNpc(i); addTalkId(i); } @@ -103,69 +91,47 @@ public final class TowerOfInfinitum extends AbstractNpcAI private static final Location ENTER_LOCATION = new Location(-22204, 277056, -15023); @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; final int npcId = npc.getId(); - if (event.equalsIgnoreCase("enter") && (npcId == JERIAN)) - { - if (HellboundEngine.getInstance().getLevel() >= 11) - { + if (event.equalsIgnoreCase("enter") && (npcId == JERIAN)) { + if (HellboundEngine.getInstance().getLevel() >= 11) { L2Party party = player.getParty(); - if ((party != null) && (party.getLeaderObjectId() == player.getObjectId())) - { - for (L2PcInstance partyMember : party.getMembers()) - { - if (!Util.checkIfInRange(300, partyMember, npc, true) || !partyMember.isAffectedBySkill(PASS_SKILL)) - { + if ((party != null) && (party.getLeaderObjectId() == player.getObjectId())) { + for (L2PcInstance partyMember : party.getMembers()) { + if (!Util.checkIfInRange(300, partyMember, npc, true) || !partyMember.isAffectedBySkill(PASS_SKILL)) { return "32302-02.htm"; } } - for (L2PcInstance partyMember : party.getMembers()) - { + for (L2PcInstance partyMember : party.getMembers()) { partyMember.teleToLocation(ENTER_LOCATION, true); } htmltext = null; - } - else - { + } else { htmltext = "32302-02a.htm"; } - } - else - { + } else { htmltext = "32302-02b.htm"; } - } - else if ((event.equalsIgnoreCase("up") || event.equalsIgnoreCase("down")) && (npcId >= GK_FIRST) && (npcId <= GK_LAST)) - { + } else if ((event.equalsIgnoreCase("up") || event.equalsIgnoreCase("down")) && (npcId >= GK_FIRST) && (npcId <= GK_LAST)) { final int direction = event.equalsIgnoreCase("up") ? 0 : 1; final L2Party party = player.getParty(); - if (party == null) - { + if (party == null) { htmltext = "gk-noparty.htm"; - } - else if (!party.isLeader(player)) - { + } else if (!party.isLeader(player)) { htmltext = "gk-noreq.htm"; - } - else - { - for (L2PcInstance partyMember : party.getMembers()) - { - if (!Util.checkIfInRange(1000, partyMember, npc, false) || (Math.abs(partyMember.getZ() - npc.getZ()) > 100)) - { + } else { + for (L2PcInstance partyMember : party.getMembers()) { + if (!Util.checkIfInRange(1000, partyMember, npc, false) || (Math.abs(partyMember.getZ() - npc.getZ()) > 100)) { return "gk-noreq.htm"; } } final Location tele = TELE_COORDS.get(npcId)[direction]; - if (tele != null) - { - for (L2PcInstance partyMember : party.getMembers()) - { + if (tele != null) { + for (L2PcInstance partyMember : party.getMembers()) { partyMember.teleToLocation(tele, true); } } diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/Zones/TowerOfNaia/TowerOfNaia.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/Zones/TowerOfNaia/TowerOfNaia.java index 0199a395d9..22559abf96 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/Zones/TowerOfNaia/TowerOfNaia.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/Zones/TowerOfNaia/TowerOfNaia.java @@ -52,8 +52,7 @@ import com.l2jserver.gameserver.util.Util; * Tower Of Naia. * @author GKR */ -public final class TowerOfNaia extends AbstractNpcAI -{ +public final class TowerOfNaia extends AbstractNpcAI { // Challenge states private static final int STATE_SPORE_CHALLENGE_IN_PROGRESS = 1; private static final int STATE_SPORE_CHALLENGE_SUCCESSFULL = 2; @@ -77,15 +76,13 @@ public final class TowerOfNaia extends AbstractNpcAI private static final int SPORE_WIND = 25607; private static final int SPORE_EARTH = 25608; private static final int DWARVEN_GHOST = 32370; - private static final int[] EPIDOSES = - { + private static final int[] EPIDOSES = { 25610, 25609, 25612, 25611 }; // Order is important! - private static final int[] TOWER_MONSTERS = - { + private static final int[] TOWER_MONSTERS = { 18490, 22393, 22394, @@ -98,22 +95,19 @@ public final class TowerOfNaia extends AbstractNpcAI 22441, 22442 }; - private static final int[] ELEMENTS = - { + private static final int[] ELEMENTS = { 25605, 25606, 25607, 25608 }; - private static final int[] OPPOSITE_ELEMENTS = - { + private static final int[] OPPOSITE_ELEMENTS = { 25606, 25605, 25608, 25607 }; - private static final String[] ELEMENTS_NAME = - { + private static final String[] ELEMENTS_NAME = { "Fire", "Water", "Wind", @@ -137,8 +131,7 @@ public final class TowerOfNaia extends AbstractNpcAI {-45462, 248174, -14183}, }; //@formatter:on - private static final NpcStringId[] SPORES_NPCSTRING_ID = - { + private static final NpcStringId[] SPORES_NPCSTRING_ID = { NpcStringId.ITS_S1, NpcStringId.S1_IS_STRONG, NpcStringId.ITS_ALWAYS_S1, @@ -153,8 +146,7 @@ public final class TowerOfNaia extends AbstractNpcAI private final L2Npc _controller; private int _counter; private final AtomicInteger _despawnedSporesCount = new AtomicInteger(); - private final int[] _indexCount = - { + private final int[] _indexCount = { 0, 0 }; @@ -164,66 +156,53 @@ public final class TowerOfNaia extends AbstractNpcAI private final Map<Integer, Boolean> _activeRooms = new HashMap<>(); private final Map<Integer, List<L2Npc>> _spawns = new ConcurrentHashMap<>(); private final Set<L2Npc> _sporeSpawn = ConcurrentHashMap.newKeySet(); - static - { + static { // Format: entrance_door, exit_door - DOORS.put(18494, new int[] - { + DOORS.put(18494, new int[] { 18250001, 18250002 }); - DOORS.put(18495, new int[] - { + DOORS.put(18495, new int[] { 18250003, 18250004 }); - DOORS.put(18496, new int[] - { + DOORS.put(18496, new int[] { 18250005, 18250006 }); - DOORS.put(18497, new int[] - { + DOORS.put(18497, new int[] { 18250007, 18250008 }); - DOORS.put(18498, new int[] - { + DOORS.put(18498, new int[] { 18250009, 18250010 }); - DOORS.put(18499, new int[] - { + DOORS.put(18499, new int[] { 18250011, 18250101 }); - DOORS.put(18500, new int[] - { + DOORS.put(18500, new int[] { 18250013, 18250014 }); - DOORS.put(18501, new int[] - { + DOORS.put(18501, new int[] { 18250015, 18250102 }); - DOORS.put(18502, new int[] - { + DOORS.put(18502, new int[] { 18250017, 18250018 }); - DOORS.put(18503, new int[] - { + DOORS.put(18503, new int[] { 18250019, 18250103 }); - DOORS.put(18504, new int[] - { + DOORS.put(18504, new int[] { 18250021, 18250022 }); - DOORS.put(18505, new int[] - { + DOORS.put(18505, new int[] { 18250023, 18250024 }); @@ -348,8 +327,7 @@ public final class TowerOfNaia extends AbstractNpcAI //@formatter:on } - public TowerOfNaia() - { + public TowerOfNaia() { super(TowerOfNaia.class.getSimpleName(), "hellbound/AI/Zones"); addFirstTalkId(CONTROLLER); addStartNpc(CONTROLLER, DWARVEN_GHOST); @@ -358,22 +336,19 @@ public final class TowerOfNaia extends AbstractNpcAI addKillId(LOCK, MUTATED_ELPY, SPORE_BASIC); addSpawnId(MUTATED_ELPY, SPORE_BASIC); - for (int npcId = SPORE_FIRE; npcId <= SPORE_EARTH; npcId++) - { + for (int npcId = SPORE_FIRE; npcId <= SPORE_EARTH; npcId++) { addKillId(npcId); addSpawnId(npcId); } - for (int npcId = ROOM_MANAGER_FIRST; npcId <= ROOM_MANAGER_LAST; npcId++) - { + for (int npcId = ROOM_MANAGER_FIRST; npcId <= ROOM_MANAGER_LAST; npcId++) { addFirstTalkId(npcId); addTalkId(npcId); addStartNpc(npcId); initRoom(npcId); } - for (int npcId : TOWER_MONSTERS) - { + for (int npcId : TOWER_MONSTERS) { addKillId(npcId); } @@ -385,25 +360,19 @@ public final class TowerOfNaia extends AbstractNpcAI } @Override - public final String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public final String onFirstTalk(L2Npc npc, L2PcInstance player) { final int npcId = npc.getId(); - if (npcId == CONTROLLER) - { - if (_lock == null) - { + if (npcId == CONTROLLER) { + if (_lock == null) { return "18492-02.htm"; } return "18492-01.htm"; } - else if ((npcId >= ROOM_MANAGER_FIRST) && (npcId <= ROOM_MANAGER_LAST)) - { - if (_activeRooms.containsKey(npcId) && !_activeRooms.get(npcId)) - { - if (player.getParty() == null) - { + else if ((npcId >= ROOM_MANAGER_FIRST) && (npcId <= ROOM_MANAGER_LAST)) { + if (_activeRooms.containsKey(npcId) && !_activeRooms.get(npcId)) { + if (player.getParty() == null) { player.sendPacket(SystemMessageId.CAN_OPERATE_MACHINE_WHEN_IN_PARTY); return null; } @@ -414,33 +383,27 @@ public final class TowerOfNaia extends AbstractNpcAI } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; // Timer. Spawns Naia Lock - if (event.equalsIgnoreCase("spawn_lock")) - { + if (event.equalsIgnoreCase("spawn_lock")) { htmltext = null; _lock = (L2MonsterInstance) addSpawn(LOCK, 16409, 244438, 11620, -1048, false, 0, false); _counter = 90; } // Timer. Depending of _challengeState despans all spawned spores, or spores, reached assembly point - else if (event.equalsIgnoreCase("despawn_total")) - { + else if (event.equalsIgnoreCase("despawn_total")) { // Spores is not attacked too long - despawn them all, reinit values - if (_challengeState == STATE_SPORE_IDLE_TOO_LONG) - { + if (_challengeState == STATE_SPORE_IDLE_TOO_LONG) { removeSpores(); initSporeChallenge(); } // Spores are moving to assembly point. Despawn all reached, check for reached spores count. - else if ((_challengeState == STATE_SPORE_CHALLENGE_SUCCESSFULL) && (_winIndex >= 0)) - { + else if ((_challengeState == STATE_SPORE_CHALLENGE_SUCCESSFULL) && (_winIndex >= 0)) { // Requirements are met, despawn all spores, spawn Epidos - if ((_despawnedSporesCount.get() >= 10) || _sporeSpawn.isEmpty()) - { + if ((_despawnedSporesCount.get() >= 10) || _sporeSpawn.isEmpty()) { removeSpores(); _despawnedSporesCount.set(0); int[] coords = SPORES_MERGE_POSITION[_winIndex]; @@ -448,14 +411,11 @@ public final class TowerOfNaia extends AbstractNpcAI initSporeChallenge(); } // Requirements aren't met, despawn reached spores - else - { + else { Iterator<L2Npc> it = _sporeSpawn.iterator(); - while (it.hasNext()) - { + while (it.hasNext()) { L2Npc spore = it.next(); - if ((spore != null) && !spore.isDead() && (spore.getX() == spore.getSpawn().getX()) && (spore.getY() == spore.getSpawn().getY())) - { + if ((spore != null) && !spore.isDead() && (spore.getX() == spore.getSpawn().getX()) && (spore.getY() == spore.getSpawn().getY())) { spore.deleteMe(); it.remove(); _despawnedSporesCount.incrementAndGet(); @@ -466,48 +426,37 @@ public final class TowerOfNaia extends AbstractNpcAI } } - if (npc == null) - { + if (npc == null) { return null; } final int npcId = npc.getId(); - if (event.equalsIgnoreCase("despawn_spore") && !npc.isDead() && (_challengeState == STATE_SPORE_CHALLENGE_IN_PROGRESS)) - { + if (event.equalsIgnoreCase("despawn_spore") && !npc.isDead() && (_challengeState == STATE_SPORE_CHALLENGE_IN_PROGRESS)) { htmltext = null; _sporeSpawn.remove(npc); npc.deleteMe(); - if (npcId == SPORE_BASIC) - { + if (npcId == SPORE_BASIC) { spawnRandomSpore(); spawnRandomSpore(); } - else if ((npcId >= SPORE_FIRE) && (npcId <= SPORE_EARTH)) - { + else if ((npcId >= SPORE_FIRE) && (npcId <= SPORE_EARTH)) { _despawnedSporesCount.incrementAndGet(); - if (_despawnedSporesCount.get() < SELF_DESPAWN_LIMIT) - { + if (_despawnedSporesCount.get() < SELF_DESPAWN_LIMIT) { spawnOppositeSpore(npcId); - } - else - { + } else { _challengeState = STATE_SPORE_IDLE_TOO_LONG; startQuestTimer("despawn_total", 60000, null, null); } } - } - else if (event.equalsIgnoreCase("18492-05.htm")) - { - if ((_lock == null) || (_lock.getCurrentHp() > (_lock.getMaxHp() / 10))) - { + } else if (event.equalsIgnoreCase("18492-05.htm")) { + if ((_lock == null) || (_lock.getCurrentHp() > (_lock.getMaxHp() / 10))) { htmltext = null; - if (_lock != null) - { + if (_lock != null) { _lock.deleteMe(); _lock = null; } @@ -516,19 +465,13 @@ public final class TowerOfNaia extends AbstractNpcAI npc.setTarget(player); npc.doCast(OVERFLOW); } - } - else if (event.equalsIgnoreCase("teleport") && (_lock != null)) - { + } else if (event.equalsIgnoreCase("teleport") && (_lock != null)) { htmltext = null; L2Party party = player.getParty(); - if (party != null) - { - if (Util.checkIfInRange(3000, party.getLeader(), npc, true)) - { - for (L2PcInstance partyMember : party.getMembers()) - { - if (Util.checkIfInRange(2000, partyMember, npc, true)) - { + if (party != null) { + if (Util.checkIfInRange(3000, party.getLeader(), npc, true)) { + for (L2PcInstance partyMember : party.getMembers()) { + if (Util.checkIfInRange(2000, partyMember, npc, true)) { partyMember.teleToLocation(-47271, 246098, -9120, true); } } @@ -536,35 +479,26 @@ public final class TowerOfNaia extends AbstractNpcAI _lock = null; cancelQuestTimers("spawn_lock"); startQuestTimer("spawn_lock", 1200000, null, null); - } - else - { + } else { npc.setTarget(player); npc.doCast(OVERFLOW); } - } - else - { + } else { player.teleToLocation(-47271, 246098, -9120); _lock.deleteMe(); _lock = null; cancelQuestTimers("spawn_lock"); startQuestTimer("spawn_lock", 1200000, null, null); } - } - else if (event.equalsIgnoreCase("go") && _activeRooms.containsKey(npcId) && !_activeRooms.get(npcId)) - { + } else if (event.equalsIgnoreCase("go") && _activeRooms.containsKey(npcId) && !_activeRooms.get(npcId)) { htmltext = null; L2Party party = player.getParty(); - if (party != null) - { + if (party != null) { removeForeigners(npcId, party); startRoom(npcId); ThreadPoolManager.getInstance().scheduleGeneral(new StopRoomTask(npcId), 300000); - } - else - { + } else { player.sendPacket(SystemMessageId.CAN_OPERATE_MACHINE_WHEN_IN_PARTY); } } @@ -572,21 +506,16 @@ public final class TowerOfNaia extends AbstractNpcAI } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) - { - if ((_lock != null) && (npc.getObjectId() == _lock.getObjectId())) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) { + if ((_lock != null) && (npc.getObjectId() == _lock.getObjectId())) { int remaindedHpPercent = (int) ((npc.getCurrentHp() * 100) / npc.getMaxHp()); - if ((remaindedHpPercent <= _counter) && (_controller != null)) - { - if (_counter == 50) - { + if ((remaindedHpPercent <= _counter) && (_controller != null)) { + if (_counter == 50) { MinionList.spawnMinion(_lock, 18493); } - else if (_counter == 10) - { + else if (_counter == 10) { MinionList.spawnMinion(_lock, 18493); MinionList.spawnMinion(_lock, 18493); } @@ -598,29 +527,22 @@ public final class TowerOfNaia extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { int npcId = npc.getId(); - if (npcId == LOCK) - { + if (npcId == LOCK) { _lock = null; cancelQuestTimers("spawn_lock"); startQuestTimer("spawn_lock", 300000, null, null); } - else if (Arrays.binarySearch(TOWER_MONSTERS, npcId) >= 0) - { + else if (Arrays.binarySearch(TOWER_MONSTERS, npcId) >= 0) { int managerId = 0; - for (L2ZoneType zone : ZoneManager.getInstance().getZones(npc.getX(), npc.getY(), npc.getZ())) - { - if (ZONES.containsValue(zone.getId())) - { - for (int i : ZONES.keySet()) - { - if (ZONES.get(i) == zone.getId()) - { + for (L2ZoneType zone : ZoneManager.getInstance().getZones(npc.getX(), npc.getY(), npc.getZ())) { + if (ZONES.containsValue(zone.getId())) { + for (int i : ZONES.keySet()) { + if (ZONES.get(i) == zone.getId()) { managerId = i; break; } @@ -628,88 +550,63 @@ public final class TowerOfNaia extends AbstractNpcAI } } - if ((managerId > 0) && _spawns.containsKey(managerId)) - { + if ((managerId > 0) && _spawns.containsKey(managerId)) { List<L2Npc> spawned = _spawns.get(managerId); spawned.remove(npc); - if (spawned.isEmpty() && DOORS.containsKey(managerId)) - { + if (spawned.isEmpty() && DOORS.containsKey(managerId)) { int[] doorList = DOORS.get(managerId); DoorData.getInstance().getDoor(doorList[1]).openMe(); _spawns.remove(managerId); } } - } - else if (npcId == MUTATED_ELPY) - { + } else if (npcId == MUTATED_ELPY) { _challengeState = STATE_SPORE_CHALLENGE_IN_PROGRESS; markElpyRespawn(); DoorData.getInstance().getDoor(18250025).closeMe(); ZoneManager.getInstance().getZoneById(200100).setEnabled(true); - for (int i = 0; i < 10; i++) - { + for (int i = 0; i < 10; i++) { addSpawn(SPORE_BASIC, -45474, 247450, -13994, 49152, false, 0, false); } - } - else if ((npcId == SPORE_BASIC) && (_challengeState == STATE_SPORE_CHALLENGE_IN_PROGRESS)) - { + } else if ((npcId == SPORE_BASIC) && (_challengeState == STATE_SPORE_CHALLENGE_IN_PROGRESS)) { _sporeSpawn.remove(npc); spawnRandomSpore(); spawnRandomSpore(); - } - else if ((npcId >= SPORE_FIRE) && (npcId <= SPORE_EARTH) && ((_challengeState == STATE_SPORE_CHALLENGE_IN_PROGRESS) || (_challengeState == STATE_SPORE_CHALLENGE_SUCCESSFULL))) - { + } else if ((npcId >= SPORE_FIRE) && (npcId <= SPORE_EARTH) && ((_challengeState == STATE_SPORE_CHALLENGE_IN_PROGRESS) || (_challengeState == STATE_SPORE_CHALLENGE_SUCCESSFULL))) { _sporeSpawn.remove(npc); - if (_challengeState == STATE_SPORE_CHALLENGE_IN_PROGRESS) - { + if (_challengeState == STATE_SPORE_CHALLENGE_IN_PROGRESS) { _despawnedSporesCount.decrementAndGet(); int sporeGroup = getSporeGroup(npcId); - if (sporeGroup >= 0) - { - if ((npcId == SPORE_FIRE) || (npcId == SPORE_WIND)) - { + if (sporeGroup >= 0) { + if ((npcId == SPORE_FIRE) || (npcId == SPORE_WIND)) { _indexCount[sporeGroup] += 2; - } - else - { + } else { _indexCount[sporeGroup] -= 2; } - if (_indexCount[Math.abs(sporeGroup - 1)] > 0) - { + if (_indexCount[Math.abs(sporeGroup - 1)] > 0) { _indexCount[Math.abs(sporeGroup - 1)]--; - } - else if (_indexCount[Math.abs(sporeGroup - 1)] < 0) - { + } else if (_indexCount[Math.abs(sporeGroup - 1)] < 0) { _indexCount[Math.abs(sporeGroup - 1)]++; } - if ((Math.abs(_indexCount[sporeGroup]) < ELEMENT_INDEX_LIMIT) && (Math.abs(_indexCount[sporeGroup]) > 0) && ((_indexCount[sporeGroup] % 20) == 0) && (getRandom(100) < 50)) - { + if ((Math.abs(_indexCount[sporeGroup]) < ELEMENT_INDEX_LIMIT) && (Math.abs(_indexCount[sporeGroup]) > 0) && ((_indexCount[sporeGroup] % 20) == 0) && (getRandom(100) < 50)) { String el = ELEMENTS_NAME[Arrays.binarySearch(ELEMENTS, npcId)]; - for (L2Npc spore : _sporeSpawn) - { - if ((spore != null) && !spore.isDead() && (spore.getId() == npcId)) - { + for (L2Npc spore : _sporeSpawn) { + if ((spore != null) && !spore.isDead() && (spore.getId() == npcId)) { broadcastNpcSay(spore, Say2.NPC_ALL, SPORES_NPCSTRING_ID[getRandom(4)], el); } } } - if (Math.abs(_indexCount[sporeGroup]) < ELEMENT_INDEX_LIMIT) - { - if ((((_indexCount[sporeGroup] > 0) && ((npcId == SPORE_FIRE) || (npcId == SPORE_WIND))) || ((_indexCount[sporeGroup] <= 0) && ((npcId == SPORE_WATER) || (npcId == SPORE_EARTH)))) && (getRandom(1000) > 200)) - { + if (Math.abs(_indexCount[sporeGroup]) < ELEMENT_INDEX_LIMIT) { + if ((((_indexCount[sporeGroup] > 0) && ((npcId == SPORE_FIRE) || (npcId == SPORE_WIND))) || ((_indexCount[sporeGroup] <= 0) && ((npcId == SPORE_WATER) || (npcId == SPORE_EARTH)))) && (getRandom(1000) > 200)) { spawnOppositeSpore(npcId); - } - else - { + } else { spawnRandomSpore(); } - } - else + } else // index value was reached { _challengeState = STATE_SPORE_CHALLENGE_SUCCESSFULL; @@ -717,10 +614,8 @@ public final class TowerOfNaia extends AbstractNpcAI _winIndex = Arrays.binarySearch(ELEMENTS, npcId); int[] coord = SPORES_MERGE_POSITION[_winIndex]; - for (L2Npc spore : _sporeSpawn) - { - if ((spore != null) && !spore.isDead()) - { + for (L2Npc spore : _sporeSpawn) { + if ((spore != null) && !spore.isDead()) { moveTo(spore, coord); } } @@ -734,19 +629,15 @@ public final class TowerOfNaia extends AbstractNpcAI } @Override - public final String onSpawn(L2Npc npc) - { + public final String onSpawn(L2Npc npc) { final int npcId = npc.getId(); - if (npcId == MUTATED_ELPY) - { + if (npcId == MUTATED_ELPY) { DoorData.getInstance().getDoor(18250025).openMe(); ZoneManager.getInstance().getZoneById(200100).setEnabled(false); ZoneManager.getInstance().getZoneById(200101).setEnabled(true); ZoneManager.getInstance().getZoneById(200101).setEnabled(false); - } - else if (((npcId == SPORE_BASIC) || ((npcId >= SPORE_FIRE) && (npcId <= SPORE_EARTH))) && (_challengeState == STATE_SPORE_CHALLENGE_IN_PROGRESS)) - { + } else if (((npcId == SPORE_BASIC) || ((npcId >= SPORE_FIRE) && (npcId <= SPORE_EARTH))) && (_challengeState == STATE_SPORE_CHALLENGE_IN_PROGRESS)) { _sporeSpawn.add(npc); npc.setIsRunning(false); int[] coord = SPORES_MOVE_POINTS[getRandom(SPORES_MOVE_POINTS.length)]; @@ -759,11 +650,9 @@ public final class TowerOfNaia extends AbstractNpcAI return super.onSpawn(npc); } - private int getSporeGroup(int sporeId) - { + private int getSporeGroup(int sporeId) { int ret; - switch (sporeId) - { + switch (sporeId) { case SPORE_FIRE: case SPORE_WATER: ret = 0; @@ -778,24 +667,19 @@ public final class TowerOfNaia extends AbstractNpcAI return ret; } - protected void initRoom(int managerId) - { + protected void initRoom(int managerId) { removeAllPlayers(managerId); _activeRooms.put(managerId, false); - if (DOORS.containsKey(managerId)) - { + if (DOORS.containsKey(managerId)) { int[] doorList = DOORS.get(managerId); DoorData.getInstance().getDoor(doorList[0]).openMe(); DoorData.getInstance().getDoor(doorList[1]).closeMe(); } - if (_spawns.containsKey(managerId) && (_spawns.get(managerId) != null)) - { - for (L2Npc npc : _spawns.get(managerId)) - { - if ((npc != null) && !npc.isDead()) - { + if (_spawns.containsKey(managerId) && (_spawns.get(managerId) != null)) { + for (L2Npc npc : _spawns.get(managerId)) { + if ((npc != null) && !npc.isDead()) { npc.deleteMe(); } } @@ -805,8 +689,7 @@ public final class TowerOfNaia extends AbstractNpcAI } } - private void initSporeChallenge() - { + private void initSporeChallenge() { _despawnedSporesCount.set(0); _challengeState = 0; _winIndex = -1; @@ -817,17 +700,14 @@ public final class TowerOfNaia extends AbstractNpcAI ZoneManager.getInstance().getZoneById(200101).setEnabled(true); } - private void markElpyRespawn() - { + private void markElpyRespawn() { final long respawnTime = (getRandom(43200, 216000) * 1000) + System.currentTimeMillis(); GlobalVariablesManager.getInstance().set("elpy_respawn_time", respawnTime); } - private int moveTo(L2Npc npc, int[] coords) - { + private int moveTo(L2Npc npc, int[] coords) { int time = 0; - if (npc != null) - { + if (npc != null) { double distance = npc.calculateDistance(coords[0], coords[1], coords[2], true, false); int heading = Util.calculateHeadingFrom(npc.getX(), npc.getY(), coords[0], coords[1]); time = (int) ((distance / npc.getWalkSpeed()) * 1000); @@ -842,68 +722,52 @@ public final class TowerOfNaia extends AbstractNpcAI return time == 0 ? 100 : time; } - private void spawnElpy() - { + private void spawnElpy() { final long respawnTime = GlobalVariablesManager.getInstance().getLong("elpy_respawn_time", 0); - if (respawnTime <= System.currentTimeMillis()) - { + if (respawnTime <= System.currentTimeMillis()) { addSpawn(MUTATED_ELPY, -45474, 247450, -13994, 49152, false, 0, false); - } - else - { + } else { ThreadPoolManager.getInstance().scheduleGeneral(() -> addSpawn(MUTATED_ELPY, -45474, 247450, -13994, 49152, false, 0, false), respawnTime - System.currentTimeMillis()); } } - private L2Npc spawnRandomSpore() - { + private L2Npc spawnRandomSpore() { return addSpawn(getRandom(SPORE_FIRE, SPORE_EARTH), -45474, 247450, -13994, 49152, false, 0, false); } - private L2Npc spawnOppositeSpore(int srcSporeId) - { + private L2Npc spawnOppositeSpore(int srcSporeId) { final int idx = Arrays.binarySearch(ELEMENTS, srcSporeId); return idx >= 0 ? addSpawn(OPPOSITE_ELEMENTS[idx], -45474, 247450, -13994, 49152, false, 0, false) : null; } - private void startRoom(int managerId) - { + private void startRoom(int managerId) { _activeRooms.put(managerId, true); - if (DOORS.containsKey(managerId)) - { + if (DOORS.containsKey(managerId)) { int[] doorList = DOORS.get(managerId); DoorData.getInstance().getDoor(doorList[0]).closeMe(); } - if (SPAWNS.containsKey(managerId)) - { + if (SPAWNS.containsKey(managerId)) { int[][] spawnList = SPAWNS.get(managerId); List<L2Npc> spawned = new CopyOnWriteArrayList<>(); - for (int[] spawn : spawnList) - { + for (int[] spawn : spawnList) { L2Npc spawnedNpc = addSpawn(spawn[0], spawn[1], spawn[2], spawn[3], spawn[4], false, 0, false); spawned.add(spawnedNpc); } - if (!spawned.isEmpty()) - { + if (!spawned.isEmpty()) { _spawns.put(managerId, spawned); } } } - private void removeForeigners(int managerId, L2Party party) - { - if ((party != null) && ZONES.containsKey(managerId) && (ZoneManager.getInstance().getZoneById(ZONES.get(managerId)) != null)) - { + private void removeForeigners(int managerId, L2Party party) { + if ((party != null) && ZONES.containsKey(managerId) && (ZoneManager.getInstance().getZoneById(ZONES.get(managerId)) != null)) { L2ZoneType zone = ZoneManager.getInstance().getZoneById(ZONES.get(managerId)); - for (L2PcInstance player : zone.getPlayersInside()) - { - if (player != null) - { + for (L2PcInstance player : zone.getPlayersInside()) { + if (player != null) { L2Party charParty = player.getParty(); - if ((charParty == null) || (charParty.getLeaderObjectId() != party.getLeaderObjectId())) - { + if ((charParty == null) || (charParty.getLeaderObjectId() != party.getLeaderObjectId())) { player.teleToLocation(16110, 243841, 11616); } } @@ -911,27 +775,20 @@ public final class TowerOfNaia extends AbstractNpcAI } } - private void removeAllPlayers(int managerId) - { - if (ZONES.containsKey(managerId) && (ZoneManager.getInstance().getZoneById(ZONES.get(managerId)) != null)) - { + private void removeAllPlayers(int managerId) { + if (ZONES.containsKey(managerId) && (ZoneManager.getInstance().getZoneById(ZONES.get(managerId)) != null)) { L2ZoneType zone = ZoneManager.getInstance().getZoneById(ZONES.get(managerId)); - for (L2PcInstance player : zone.getPlayersInside()) - { - if (player != null) - { + for (L2PcInstance player : zone.getPlayersInside()) { + if (player != null) { player.teleToLocation(16110, 243841, 11616); } } } } - private void removeSpores() - { - for (L2Npc spore : _sporeSpawn) - { - if ((spore != null) && !spore.isDead()) - { + private void removeSpores() { + for (L2Npc spore : _sporeSpawn) { + if ((spore != null) && !spore.isDead()) { spore.deleteMe(); } } @@ -939,18 +796,15 @@ public final class TowerOfNaia extends AbstractNpcAI cancelQuestTimers("despawn_spore"); } - private class StopRoomTask implements Runnable - { + private class StopRoomTask implements Runnable { private final int _managerId; - public StopRoomTask(int managerId) - { + public StopRoomTask(int managerId) { _managerId = managerId; } @Override - public void run() - { + public void run() { initRoom(_managerId); } } diff --git a/src/main/java/com/l2jserver/datapack/hellbound/AI/Zones/TullyWorkshop/TullyWorkshop.java b/src/main/java/com/l2jserver/datapack/hellbound/AI/Zones/TullyWorkshop/TullyWorkshop.java index 91a5203ae7..4a29b15899 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/AI/Zones/TullyWorkshop/TullyWorkshop.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/AI/Zones/TullyWorkshop/TullyWorkshop.java @@ -56,8 +56,7 @@ import com.l2jserver.gameserver.util.Util; * Tully's Workshop. * @author GKR */ -public final class TullyWorkshop extends AbstractNpcAI -{ +public final class TullyWorkshop extends AbstractNpcAI { // NPC's private static final int AGENT = 32372; private static final int CUBE_68 = 32467; @@ -70,8 +69,7 @@ public final class TullyWorkshop extends AbstractNpcAI private static final int PILLAR = 18506; // private static final int BRIDGE_CONTROLLER = 32468; private static final int TIMETWISTER_GOLEM = 22392; - private static final int[] SIN_WARDENS = - { + private static final int[] SIN_WARDENS = { 22423, 22431 }; @@ -86,8 +84,7 @@ public final class TullyWorkshop extends AbstractNpcAI private static final SkillHolder NPC_HEAL = new SkillHolder(4065, 11); // Items - private static final int[] REWARDS = - { + private static final int[] REWARDS = { 10427, 10428, 10429, @@ -96,8 +93,7 @@ public final class TullyWorkshop extends AbstractNpcAI }; // 7 for 6th floor and 10 for 8th floor - private static final int[] DEATH_COUNTS = - { + private static final int[] DEATH_COUNTS = { 7, 10 }; @@ -107,8 +103,7 @@ public final class TullyWorkshop extends AbstractNpcAI // Them are teleporting players to themselves // Master Zelos - 22377, Zelos' Minions - 22378, 22379, Tully's Toy - 22383 - private static final int[] TELEPORTING_MONSTERS = - { + private static final int[] TELEPORTING_MONSTERS = { 22377, 22378, 22379, @@ -459,35 +454,29 @@ public final class TullyWorkshop extends AbstractNpcAI } // @formatter:on - public TullyWorkshop() - { + public TullyWorkshop() { super(TullyWorkshop.class.getSimpleName(), "hellbound/AI/Zones"); addStartNpc(DORIAN); addTalkId(DORIAN); - for (int npcId : TULLY_DOORLIST.keySet()) - { - if (npcId != 99999) - { + for (int npcId : TULLY_DOORLIST.keySet()) { + if (npcId != 99999) { addFirstTalkId(npcId); addStartNpc(npcId); addTalkId(npcId); } } - for (int npcId : TELE_COORDS.keySet()) - { + for (int npcId : TELE_COORDS.keySet()) { addStartNpc(npcId); addTalkId(npcId); } - for (int monsterId : TELEPORTING_MONSTERS) - { + for (int monsterId : TELEPORTING_MONSTERS) { addAttackId(monsterId); } - for (int monsterId : SIN_WARDENS) - { + for (int monsterId : SIN_WARDENS) { addKillId(monsterId); } @@ -525,13 +514,11 @@ public final class TullyWorkshop extends AbstractNpcAI addSpellFinishedId(AGENT); addSpellFinishedId(TEMENIR); - for (int i = SERVANT_FIRST; i <= SERVANT_LAST; i++) - { + for (int i = SERVANT_FIRST; i <= SERVANT_LAST; i++) { addKillId(i); } - for (int i = SERVANT_FIRST; i <= SERVANT_LAST; i++) - { + for (int i = SERVANT_FIRST; i <= SERVANT_LAST; i++) { addSpellFinishedId(i); } @@ -542,89 +529,59 @@ public final class TullyWorkshop extends AbstractNpcAI } @Override - public final String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public final String onFirstTalk(L2Npc npc, L2PcInstance player) { final ClassId classId = player.getClassId(); final int npcId = npc.getId(); - if (TULLY_DOORLIST.containsKey(npcId)) - { - if (classId.equalsOrChildOf(ClassId.maestro)) - { + if (TULLY_DOORLIST.containsKey(npcId)) { + if (classId.equalsOrChildOf(ClassId.maestro)) { return "doorman-01c.htm"; } return "doorman-01.htm"; - } - else if (npcId == INGENIOUS_CONTRAPTION) - { - if (talkedContraptions.contains(npc.getObjectId())) - { + } else if (npcId == INGENIOUS_CONTRAPTION) { + if (talkedContraptions.contains(npc.getObjectId())) { return "32371-02.htm"; - } - else if (!brokenContraptions.contains(npc.getObjectId())) - { - if (classId.equalsOrChildOf(ClassId.maestro)) - { + } else if (!brokenContraptions.contains(npc.getObjectId())) { + if (classId.equalsOrChildOf(ClassId.maestro)) { return "32371-01a.htm"; } return "32371-01.htm"; } return "32371-04.htm"; - } - else if (npcId == DWARVEN_GHOST) - { - if (postMortemSpawn.indexOf(npc) == 11) - { + } else if (npcId == DWARVEN_GHOST) { + if (postMortemSpawn.indexOf(npc) == 11) { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.HA_HA_YOU_WERE_SO_AFRAID_OF_DEATH_LET_ME_SEE_IF_YOU_FIND_ME_IN_TIME_MAYBE_YOU_CAN_FIND_A_WAY); npc.deleteMe(); return null; - } - else if (postMortemSpawn.indexOf(npc) == 12) - { + } else if (postMortemSpawn.indexOf(npc) == 12) { return "32370-01.htm"; - } - else if (npc.isInsideRadius(-45531, 245872, -14192, 100, true, false)) // Hello from Tower of Naia! :) Due to onFirstTalk limitation it should be here + } else if (npc.isInsideRadius(-45531, 245872, -14192, 100, true, false)) // Hello from Tower of Naia! :) Due to onFirstTalk limitation it should be here { return "32370-03.htm"; - } - else - { + } else { return "32370-02.htm"; } - } - else if (npcId == AGENT) - { + } else if (npcId == AGENT) { final L2Party party = player.getParty(); - if ((party == null) || (party.getLeaderObjectId() != player.getObjectId())) - { + if ((party == null) || (party.getLeaderObjectId() != player.getObjectId())) { return "32372-01a.htm"; } final int[] roomData = getRoomData(npc); - if ((roomData[0] < 0) || (roomData[1] < 0)) - { + if ((roomData[0] < 0) || (roomData[1] < 0)) { return "32372-02.htm"; } return "32372-01.htm"; - } - else if (npcId == CUBE_68) - { - if (npc.isInsideRadius(-12752, 279696, -13596, 100, true, false)) - { + } else if (npcId == CUBE_68) { + if (npc.isInsideRadius(-12752, 279696, -13596, 100, true, false)) { return "32467-01.htm"; - } - else if (npc.isInsideRadius(-12752, 279696, -10492, 100, true, false)) - { + } else if (npc.isInsideRadius(-12752, 279696, -10492, 100, true, false)) { return "32467-02.htm"; } return "32467-03.htm"; - } - else if (npcId == TOMBSTONE) - { - for (int itemId : REWARDS) - { - if (hasAtLeastOneQuestItem(player, itemId)) - { + } else if (npcId == TOMBSTONE) { + for (int itemId : REWARDS) { + if (hasAtLeastOneQuestItem(player, itemId)) { return "32344-01.htm"; } } @@ -634,18 +591,14 @@ public final class TullyWorkshop extends AbstractNpcAI } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { - if (npc.getId() == TOMBSTONE) - { + public String onTalk(L2Npc npc, L2PcInstance player) { + if (npc.getId() == TOMBSTONE) { final L2Party party = player.getParty(); - if (party == null) - { + if (party == null) { return "32344-03.htm"; } - boolean[] haveItems = - { + boolean[] haveItems = { false, false, false, @@ -653,17 +606,13 @@ public final class TullyWorkshop extends AbstractNpcAI false }; // For teleportation party should have all 5 medals - for (L2PcInstance pl : party.getMembers()) - { - if (pl == null) - { + for (L2PcInstance pl : party.getMembers()) { + if (pl == null) { continue; } - for (int i = 0; i < REWARDS.length; i++) - { - if ((pl.getInventory().getInventoryItemCount(REWARDS[i], -1, false) > 0) && Util.checkIfInRange(300, pl, npc, true)) - { + for (int i = 0; i < REWARDS.length; i++) { + if ((pl.getInventory().getInventoryItemCount(REWARDS[i], -1, false) > 0) && Util.checkIfInRange(300, pl, npc, true)) { haveItems[i] = true; break; } @@ -671,27 +620,20 @@ public final class TullyWorkshop extends AbstractNpcAI } int medalsCount = 0; - for (boolean haveItem : haveItems) - { - if (haveItem) - { + for (boolean haveItem : haveItems) { + if (haveItem) { medalsCount++; } } - if (medalsCount == 0) - { + if (medalsCount == 0) { return "32344-03.htm"; - } - else if (medalsCount < 5) - { + } else if (medalsCount < 5) { return "32344-02.htm"; } - for (L2PcInstance pl : party.getMembers()) - { - if ((pl != null) && Util.checkIfInRange(6000, pl, npc, false)) - { + for (L2PcInstance pl : party.getMembers()) { + if ((pl != null) && Util.checkIfInRange(6000, pl, npc, false)) { pl.teleToLocation(26612, 248567, -2856); } } @@ -700,82 +642,57 @@ public final class TullyWorkshop extends AbstractNpcAI } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; - if (event.equalsIgnoreCase("disable_zone")) - { + if (event.equalsIgnoreCase("disable_zone")) { final L2ZoneType dmgZone = ZoneManager.getInstance().getZoneById(200011); - if (dmgZone != null) - { + if (dmgZone != null) { dmgZone.setEnabled(false); } - } - else if (event.equalsIgnoreCase("cube_68_spawn")) - { + } else if (event.equalsIgnoreCase("cube_68_spawn")) { final L2Npc spawnedNpc = addSpawn(CUBE_68, 12527, 279714, -11622, 16384, false, 0, false); startQuestTimer("cube_68_despawn", 600000, spawnedNpc, null); - } - else if (event.equalsIgnoreCase("end_7th_floor_attack")) - { + } else if (event.equalsIgnoreCase("end_7th_floor_attack")) { do7thFloorDespawn(); - } - else if (event.equalsIgnoreCase("start_7th_floor_spawn")) - { + } else if (event.equalsIgnoreCase("start_7th_floor_spawn")) { do7thFloorSpawn(); } - if (npc == null) - { + if (npc == null) { return null; } int npcId = npc.getId(); - if (event.equalsIgnoreCase("close") && TULLY_DOORLIST.containsKey(npcId)) - { + if (event.equalsIgnoreCase("close") && TULLY_DOORLIST.containsKey(npcId)) { // Second instance of 18455 - if ((npcId == 18455) && (npc.getX() == -14610)) - { + if ((npcId == 18455) && (npc.getX() == -14610)) { npcId = 99999; } final int[] doors = TULLY_DOORLIST.get(npcId); - for (int doorId : doors) - { + for (int doorId : doors) { DoorData.getInstance().getDoor(doorId).closeMe(); } } - if (event.equalsIgnoreCase("repair_device")) - { + if (event.equalsIgnoreCase("repair_device")) { broadcastNpcSay(npc, Say2.NPC_SHOUT, NpcStringId.DE_ACTIVATE_THE_ALARM); brokenContraptions.remove(npc.getObjectId()); - } - else if (event.equalsIgnoreCase("despawn_servant") && !npc.isDead()) - { - if ((npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_CAST) && (npc.getCurrentHp() == npc.getMaxHp())) - { + } else if (event.equalsIgnoreCase("despawn_servant") && !npc.isDead()) { + if ((npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_CAST) && (npc.getCurrentHp() == npc.getMaxHp())) { npc.deleteMe(); allowServantSpawn = true; - } - else - { + } else { startQuestTimer("despawn_servant", 180000, npc, null); } - } - else if (event.equalsIgnoreCase("despawn_agent")) - { + } else if (event.equalsIgnoreCase("despawn_agent")) { npc.deleteMe(); allowServantSpawn = true; allowAgentSpawn = true; - } - else if (event.equalsIgnoreCase("despawn_agent_7")) - { - for (L2PcInstance pl : npc.getKnownList().getKnownPlayersInRadius(300)) - { - if (pl != null) - { + } else if (event.equalsIgnoreCase("despawn_agent_7")) { + for (L2PcInstance pl : npc.getKnownList().getKnownPlayersInRadius(300)) { + if (pl != null) { pl.teleToLocation(-12176, 279696, -10492, true); } } @@ -783,13 +700,9 @@ public final class TullyWorkshop extends AbstractNpcAI allowAgentSpawn_7th = true; spawnedAgent = null; npc.deleteMe(); - } - else if (event.equalsIgnoreCase("cube_68_despawn")) - { - for (L2PcInstance pl : npc.getKnownList().getKnownPlayersInRadius(500)) - { - if (pl != null) - { + } else if (event.equalsIgnoreCase("cube_68_despawn")) { + for (L2PcInstance pl : npc.getKnownList().getKnownPlayersInRadius(500)) { + if (pl != null) { pl.teleToLocation(-12176, 279696, -10492, true); } } @@ -798,174 +711,121 @@ public final class TullyWorkshop extends AbstractNpcAI startQuestTimer("start_7th_floor_spawn", 120000, null, null); } - if (player == null) - { + if (player == null) { return null; } - if (event.equalsIgnoreCase("enter") && (npcId == DORIAN)) - { + if (event.equalsIgnoreCase("enter") && (npcId == DORIAN)) { L2Party party = player.getParty(); - if ((party != null) && (party.getLeaderObjectId() == player.getObjectId())) - { - for (L2PcInstance partyMember : party.getMembers()) - { - if (!Util.checkIfInRange(300, partyMember, npc, true)) - { + if ((party != null) && (party.getLeaderObjectId() == player.getObjectId())) { + for (L2PcInstance partyMember : party.getMembers()) { + if (!Util.checkIfInRange(300, partyMember, npc, true)) { return "32373-02.htm"; } } - for (L2PcInstance partyMember : party.getMembers()) - { + for (L2PcInstance partyMember : party.getMembers()) { partyMember.teleToLocation(-13400, 272827, -15300, true); } htmltext = null; - } - else - { + } else { htmltext = "32373-02a.htm"; } - } - else if (event.equalsIgnoreCase("open") && TULLY_DOORLIST.containsKey(npcId)) - { + } else if (event.equalsIgnoreCase("open") && TULLY_DOORLIST.containsKey(npcId)) { // Second instance of 18455 - if ((npcId == 18455) && (npc.getX() == -14610)) - { + if ((npcId == 18455) && (npc.getX() == -14610)) { npcId = 99999; } final int[] doors = TULLY_DOORLIST.get(npcId); - for (int doorId : doors) - { + for (int doorId : doors) { DoorData.getInstance().getDoor(doorId).openMe(); } startQuestTimer("close", 120000, npc, null); htmltext = null; - } - else if ((event.equalsIgnoreCase("up") || event.equalsIgnoreCase("down")) && TELE_COORDS.containsKey(npcId)) - { + } else if ((event.equalsIgnoreCase("up") || event.equalsIgnoreCase("down")) && TELE_COORDS.containsKey(npcId)) { final int direction = event.equalsIgnoreCase("up") ? 0 : 1; final L2Party party = player.getParty(); - if (party == null) - { + if (party == null) { player.sendPacket(SystemMessageId.NOT_IN_PARTY_CANT_ENTER); - } - else if (party.getLeaderObjectId() != player.getObjectId()) - { + } else if (party.getLeaderObjectId() != player.getObjectId()) { player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); - } - else if (!Util.checkIfInRange(4000, player, npc, true)) - { + } else if (!Util.checkIfInRange(4000, player, npc, true)) { player.sendPacket(SystemMessageId.TOO_FAR_FROM_NPC); - } - else - { + } else { final Location loc = TELE_COORDS.get(npcId)[direction]; - for (L2PcInstance partyMember : party.getMembers()) - { - if (Util.checkIfInRange(4000, partyMember, npc, true)) - { + for (L2PcInstance partyMember : party.getMembers()) { + if (Util.checkIfInRange(4000, partyMember, npc, true)) { partyMember.teleToLocation(loc, true); } } } htmltext = null; - } - else if (npcId == INGENIOUS_CONTRAPTION) - { - if (event.equalsIgnoreCase("touch_device")) - { + } else if (npcId == INGENIOUS_CONTRAPTION) { + if (event.equalsIgnoreCase("touch_device")) { final int i0 = talkedContraptions.contains(npc.getObjectId()) ? 0 : 1; final int i1 = player.getClassId().equalsOrChildOf(ClassId.maestro) ? 6 : 3; - if (getRandom(1000) < ((i1 - i0) * 100)) - { + if (getRandom(1000) < ((i1 - i0) * 100)) { talkedContraptions.add(npc.getObjectId()); htmltext = player.getClassId().equalsOrChildOf(ClassId.maestro) ? "32371-03a.htm" : "32371-03.htm"; - } - else - { + } else { brokenContraptions.add(npc.getObjectId()); startQuestTimer("repair_device", 60000, npc, null); htmltext = "32371-04.htm"; } - } - else if (event.equalsIgnoreCase("take_reward")) - { + } else if (event.equalsIgnoreCase("take_reward")) { boolean alreadyHaveItem = false; - for (int itemId : REWARDS) - { - if (player.getInventory().getInventoryItemCount(itemId, -1, false) > 0) - { + for (int itemId : REWARDS) { + if (player.getInventory().getInventoryItemCount(itemId, -1, false) > 0) { alreadyHaveItem = true; break; } } - if (!alreadyHaveItem && !rewardedContraptions.contains(npc.getObjectId())) - { + if (!alreadyHaveItem && !rewardedContraptions.contains(npc.getObjectId())) { int idx = postMortemSpawn.indexOf(npc); - if ((idx > -1) && (idx < 5)) - { + if ((idx > -1) && (idx < 5)) { player.addItem("Quest", REWARDS[idx], 1, npc, true); rewardedContraptions.add(npc.getObjectId()); - if (idx != 0) - { + if (idx != 0) { npc.deleteMe(); } } htmltext = null; - } - else - { + } else { htmltext = "32371-05.htm"; } } - } - else if (npcId == AGENT) - { - if (event.equalsIgnoreCase("tele_to_7th_floor") && (allowAgentSpawn == false)) - { + } else if (npcId == AGENT) { + if (event.equalsIgnoreCase("tele_to_7th_floor") && (allowAgentSpawn == false)) { htmltext = null; L2Party party = player.getParty(); - if (party == null) - { + if (party == null) { player.teleToLocation(-12501, 281397, -11936); - if (allowAgentSpawn_7th) - { - if (spawnedAgent != null) - { + if (allowAgentSpawn_7th) { + if (spawnedAgent != null) { spawnedAgent.deleteMe(); } spawnedAgent = addSpawn(AGENT, -12527, 279714, -11622, 16384, false, 0, false); allowAgentSpawn_7th = false; } - } - else - { - if (party.getLeaderObjectId() != player.getObjectId()) - { + } else { + if (party.getLeaderObjectId() != player.getObjectId()) { player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); - } - else - { - for (L2PcInstance partyMember : party.getMembers()) - { - if (Util.checkIfInRange(6000, partyMember, npc, true)) - { + } else { + for (L2PcInstance partyMember : party.getMembers()) { + if (Util.checkIfInRange(6000, partyMember, npc, true)) { partyMember.teleToLocation(-12501, 281397, -11936, true); } } - if (allowAgentSpawn_7th) - { + if (allowAgentSpawn_7th) { - if (spawnedAgent != null) - { + if (spawnedAgent != null) { spawnedAgent.deleteMe(); } spawnedAgent = addSpawn(AGENT, -12527, 279714, -11622, 16384, false, 0, false); @@ -973,136 +833,96 @@ public final class TullyWorkshop extends AbstractNpcAI } } } - } - else if (event.equalsIgnoreCase("buff") && (allowAgentSpawn_7th == false)) - { + } else if (event.equalsIgnoreCase("buff") && (allowAgentSpawn_7th == false)) { htmltext = null; final L2Party party = player.getParty(); - if (party == null) - { - if (!Util.checkIfInRange(400, player, npc, true)) - { + if (party == null) { + if (!Util.checkIfInRange(400, player, npc, true)) { htmltext = "32372-01b.htm"; - } - else - { + } else { npc.setTarget(player); } npc.doCast(CHALLENGERS_BLESSING); - } - else - { - for (L2PcInstance partyMember : party.getMembers()) - { - if (!Util.checkIfInRange(400, partyMember, npc, true)) - { + } else { + for (L2PcInstance partyMember : party.getMembers()) { + if (!Util.checkIfInRange(400, partyMember, npc, true)) { return "32372-01b.htm"; } } - for (L2PcInstance partyMember : party.getMembers()) - { + for (L2PcInstance partyMember : party.getMembers()) { npc.setTarget(partyMember); npc.doCast(CHALLENGERS_BLESSING); } startQuestTimer("despawn_agent_7", 60000, npc, null); } - } - else if (event.equalsIgnoreCase("refuse") && (allowAgentSpawn_7th == false)) - { + } else if (event.equalsIgnoreCase("refuse") && (allowAgentSpawn_7th == false)) { allowAgentSpawn_7th = true; npc.deleteMe(); spawnedAgent = null; - for (L2MonsterInstance monster : spawnedFollowers) - { - if ((monster != null) && !monster.isDead()) - { - if (!monster.hasMinions()) - { + for (L2MonsterInstance monster : spawnedFollowers) { + if ((monster != null) && !monster.isDead()) { + if (!monster.hasMinions()) { MinionList.spawnMinion(monster, 25596); MinionList.spawnMinion(monster, 25596); } L2PcInstance target = player.getParty() == null ? player : player.getParty().getMembers().get(getRandom(player.getParty().getMembers().size())); - if ((target != null) && !target.isDead()) - { + if ((target != null) && !target.isDead()) { monster.addDamageHate(target, 0, 999); monster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target, null); } } } - if (!is7thFloorAttackBegan) - { + if (!is7thFloorAttackBegan) { is7thFloorAttackBegan = true; startQuestTimer("end_7th_floor_attack", 1200000, null, null); } } - } - else if (event.equalsIgnoreCase("teleport") && (npcId == DWARVEN_GHOST)) - { + } else if (event.equalsIgnoreCase("teleport") && (npcId == DWARVEN_GHOST)) { htmltext = null; final L2Party party = player.getParty(); - if (party == null) - { + if (party == null) { player.teleToLocation(-12176, 279696, -13596); - } - else - { - if (party.getLeaderObjectId() != player.getObjectId()) - { + } else { + if (party.getLeaderObjectId() != player.getObjectId()) { player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); return null; } - for (L2PcInstance partyMember : party.getMembers()) - { - if (!Util.checkIfInRange(3000, partyMember, npc, true)) - { + for (L2PcInstance partyMember : party.getMembers()) { + if (!Util.checkIfInRange(3000, partyMember, npc, true)) { return "32370-01f.htm"; } } - for (L2PcInstance partyMember : party.getMembers()) - { - if (Util.checkIfInRange(6000, partyMember, npc, true)) - { + for (L2PcInstance partyMember : party.getMembers()) { + if (Util.checkIfInRange(6000, partyMember, npc, true)) { partyMember.teleToLocation(-12176, 279696, -13596, true); } } } - } - else if ((npcId == CUBE_68) && event.startsWith("cube68_tp")) - { + } else if ((npcId == CUBE_68) && event.startsWith("cube68_tp")) { htmltext = null; final int tpId = Integer.parseInt(event.substring(10)); final L2Party party = player.getParty(); - if (party != null) - { - if (!party.isLeader(player)) - { + if (party != null) { + if (!party.isLeader(player)) { player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); - } - else if (!Util.checkIfInRange(3000, player, npc, true)) - { + } else if (!Util.checkIfInRange(3000, player, npc, true)) { htmltext = "32467-04.htm"; - } - else - { - for (L2PcInstance partyMember : party.getMembers()) - { - if (Util.checkIfInRange(6000, partyMember, npc, true)) - { + } else { + for (L2PcInstance partyMember : party.getMembers()) { + if (Util.checkIfInRange(6000, partyMember, npc, true)) { partyMember.teleToLocation(CUBE_68_TELEPORTS[tpId][0], CUBE_68_TELEPORTS[tpId][1], CUBE_68_TELEPORTS[tpId][2], true); } } } - } - else - { + } else { player.teleToLocation(CUBE_68_TELEPORTS[tpId][0], CUBE_68_TELEPORTS[tpId][1], CUBE_68_TELEPORTS[tpId][2]); } } @@ -1110,39 +930,29 @@ public final class TullyWorkshop extends AbstractNpcAI } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) { final int npcId = npc.getId(); - if (Arrays.binarySearch(TELEPORTING_MONSTERS, npcId) >= 0) - { - if (Math.abs(npc.getZ() - attacker.getZ()) > 150) - { + if (Arrays.binarySearch(TELEPORTING_MONSTERS, npcId) >= 0) { + if (Math.abs(npc.getZ() - attacker.getZ()) > 150) { ((L2MonsterInstance) npc).clearAggroList(); attacker.teleToLocation(npc.getX() + 50, npc.getY() - 50, npc.getZ()); } - } - else if (((npcId == TEMENIR) || (npcId == KIRETCENAH)) && spawnedFollowers.contains(npc)) - { + } else if (((npcId == TEMENIR) || (npcId == KIRETCENAH)) && spawnedFollowers.contains(npc)) { L2MonsterInstance victim1 = spawnedFollowers.get(1); // TEMENIR L2MonsterInstance victim2 = spawnedFollowers.get(0); // KIRETCENAH L2MonsterInstance actor = spawnedFollowers.get(2); // DRAXIUS - if ((actor != null) && !actor.isDead()) - { + if ((actor != null) && !actor.isDead()) { double transferringHp = actor.getMaxHp() * 0.0001; - if ((getRandom(10000) > 1500) && (victim1 != null) && !victim1.isDead()) - { - if ((actor.getCurrentHp() - transferringHp) > 1) - { + if ((getRandom(10000) > 1500) && (victim1 != null) && !victim1.isDead()) { + if ((actor.getCurrentHp() - transferringHp) > 1) { actor.setCurrentHp(actor.getCurrentHp() - transferringHp); victim1.setCurrentHp(victim1.getCurrentHp() + transferringHp); } } - if ((getRandom(10000) > 3000) && (victim2 != null) && !victim2.isDead()) - { - if ((actor.getCurrentHp() - transferringHp) > 1) - { + if ((getRandom(10000) > 3000) && (victim2 != null) && !victim2.isDead()) { + if ((actor.getCurrentHp() - transferringHp) > 1) { actor.setCurrentHp(actor.getCurrentHp() - transferringHp); victim2.setCurrentHp(victim2.getCurrentHp() + transferringHp); } @@ -1150,13 +960,11 @@ public final class TullyWorkshop extends AbstractNpcAI } } - if (((npcId == TEMENIR) || (npcId == DRAXIUS)) && spawnedFollowers.contains(npc)) - { + if (((npcId == TEMENIR) || (npcId == DRAXIUS)) && spawnedFollowers.contains(npc)) { final L2MonsterInstance victim = npcId == TEMENIR ? spawnedFollowers.get(1) : spawnedFollowers.get(2); final L2MonsterInstance actor = spawnedFollowers.get(0); - if ((actor != null) && (victim != null) && !actor.isDead() && !victim.isDead() && (getRandom(1000) > 333)) - { + if ((actor != null) && (victim != null) && !actor.isDead() && !victim.isDead() && (getRandom(1000) > 333)) { actor.clearAggroList(); actor.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); actor.setTarget(victim); @@ -1168,24 +976,19 @@ public final class TullyWorkshop extends AbstractNpcAI } @Override - public String onFactionCall(L2Npc npc, L2Npc caller, L2PcInstance attacker, boolean isSummon) - { + public String onFactionCall(L2Npc npc, L2Npc caller, L2PcInstance attacker, boolean isSummon) { int npcId = npc.getId(); - if ((npcId == TEMENIR) || (npcId == DRAXIUS) || (npcId == KIRETCENAH)) - { - if (!((L2MonsterInstance) npc).hasMinions()) - { + if ((npcId == TEMENIR) || (npcId == DRAXIUS) || (npcId == KIRETCENAH)) { + if (!((L2MonsterInstance) npc).hasMinions()) { MinionList.spawnMinion((L2MonsterInstance) npc, 25596); MinionList.spawnMinion((L2MonsterInstance) npc, 25596); } - if (!is7thFloorAttackBegan) - { + if (!is7thFloorAttackBegan) { is7thFloorAttackBegan = true; startQuestTimer("end_7th_floor_attack", 1200000, null, null); - if (spawnedAgent != null) - { + if (spawnedAgent != null) { spawnedAgent.deleteMe(); spawnedAgent = null; allowAgentSpawn_7th = true; @@ -1196,14 +999,11 @@ public final class TullyWorkshop extends AbstractNpcAI } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final int npcId = npc.getId(); - if ((npcId == TULLY) && npc.isInsideRadius(-12557, 273901, -9000, 1000, false, false)) - { - for (int i[] : POST_MORTEM_SPAWNLIST) - { + if ((npcId == TULLY) && npc.isInsideRadius(-12557, 273901, -9000, 1000, false, false)) { + for (int i[] : POST_MORTEM_SPAWNLIST) { final L2Npc spawnedNpc = addSpawn(i[0], i[1], i[2], i[3], i[4], false, i[5], false); postMortemSpawn.add(spawnedNpc); } @@ -1212,36 +1012,26 @@ public final class TullyWorkshop extends AbstractNpcAI DoorData.getInstance().getDoor(19260052).openMe(); countdownTime = 600000; - _countdown = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(() -> - { + _countdown = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(() -> { countdownTime -= 10000; L2Npc _npc = null; - if ((postMortemSpawn != null) && (postMortemSpawn.size() > 0)) - { + if ((postMortemSpawn != null) && (postMortemSpawn.size() > 0)) { _npc = postMortemSpawn.get(0); } - if (countdownTime > 60000) - { - if ((countdownTime % 60000) == 0) - { - if ((_npc != null) && (_npc.getId() == INGENIOUS_CONTRAPTION)) - { + if (countdownTime > 60000) { + if ((countdownTime % 60000) == 0) { + if ((_npc != null) && (_npc.getId() == INGENIOUS_CONTRAPTION)) { broadcastNpcSay(_npc, Say2.NPC_SHOUT, NpcStringId.S1_MINUTES_REMAINING, Integer.toString((countdownTime / 60000))); } } - } - else if (countdownTime <= 0) - { - if (_countdown != null) - { + } else if (countdownTime <= 0) { + if (_countdown != null) { _countdown.cancel(false); _countdown = null; } - for (L2Npc spawnedNpc : postMortemSpawn) - { - if ((spawnedNpc != null) && ((spawnedNpc.getId() == INGENIOUS_CONTRAPTION) || (spawnedNpc.getId() == TIMETWISTER_GOLEM))) - { + for (L2Npc spawnedNpc : postMortemSpawn) { + if ((spawnedNpc != null) && ((spawnedNpc.getId() == INGENIOUS_CONTRAPTION) || (spawnedNpc.getId() == TIMETWISTER_GOLEM))) { spawnedNpc.deleteMe(); } } @@ -1250,72 +1040,52 @@ public final class TullyWorkshop extends AbstractNpcAI rewardedContraptions.clear(); talkedContraptions.clear(); final L2ZoneType dmgZone = ZoneManager.getInstance().getZoneById(200011); - if (dmgZone != null) - { + if (dmgZone != null) { dmgZone.setEnabled(true); } startQuestTimer("disable_zone", 300000, null, null); - } - else - { - if ((_npc != null) && (_npc.getId() == INGENIOUS_CONTRAPTION)) - { + } else { + if ((_npc != null) && (_npc.getId() == INGENIOUS_CONTRAPTION)) { broadcastNpcSay(_npc, Say2.NPC_SHOUT, NpcStringId.S1_SECONDS_REMAINING, Integer.toString((countdownTime / 1000))); } } }, 60000, 10000); broadcastNpcSay(postMortemSpawn.get(0), Say2.NPC_SHOUT, NpcStringId.DETONATOR_INITIALIZATION_TIME_S1_MINUTES_FROM_NOW, Integer.toString((countdownTime / 60000))); - } - else if ((npcId == TIMETWISTER_GOLEM) && (_countdown != null)) - { - if (getRandom(1000) >= 700) - { + } else if ((npcId == TIMETWISTER_GOLEM) && (_countdown != null)) { + if (getRandom(1000) >= 700) { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.A_FATAL_ERROR_HAS_OCCURRED); - if (countdownTime > 180000) - { + if (countdownTime > 180000) { countdownTime = Math.max(countdownTime - 180000, 60000); - if ((postMortemSpawn != null) && (postMortemSpawn.size() > 0) && (postMortemSpawn.get(0) != null) && (postMortemSpawn.get(0).getId() == INGENIOUS_CONTRAPTION)) - { + if ((postMortemSpawn != null) && (postMortemSpawn.size() > 0) && (postMortemSpawn.get(0) != null) && (postMortemSpawn.get(0).getId() == INGENIOUS_CONTRAPTION)) { broadcastNpcSay(postMortemSpawn.get(0), Say2.NPC_SHOUT, NpcStringId.ZZZZ_CITY_INTERFERENCE_ERROR_FORWARD_EFFECT_CREATED); } } - } - else - { + } else { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.TIME_RIFT_DEVICE_ACTIVATION_SUCCESSFUL); - if ((countdownTime > 0) && (countdownTime <= 420000)) - { + if ((countdownTime > 0) && (countdownTime <= 420000)) { countdownTime += 180000; - if ((postMortemSpawn != null) && (postMortemSpawn.size() > 0) && (postMortemSpawn.get(0) != null) && (postMortemSpawn.get(0).getId() == INGENIOUS_CONTRAPTION)) - { + if ((postMortemSpawn != null) && (postMortemSpawn.size() > 0) && (postMortemSpawn.get(0) != null) && (postMortemSpawn.get(0).getId() == INGENIOUS_CONTRAPTION)) { broadcastNpcSay(postMortemSpawn.get(0), Say2.NPC_SHOUT, NpcStringId.ZZZZ_CITY_INTERFERENCE_ERROR_RECURRENCE_EFFECT_CREATED); } } } - } - else if (Arrays.binarySearch(SIN_WARDENS, npcId) >= 0) - { + } else if (Arrays.binarySearch(SIN_WARDENS, npcId) >= 0) { final int[] roomData = getRoomData(npc); - if ((roomData[0] >= 0) && (roomData[1] >= 0)) - { + if ((roomData[0] >= 0) && (roomData[1] >= 0)) { deathCount[roomData[0]][roomData[1]]++; - if (allowServantSpawn) - { + if (allowServantSpawn) { int max = 0; int floor = roomData[0]; int room = -1; - for (int i = 0; i < 4; i++) - { - if (deathCount[floor][i] > max) - { + for (int i = 0; i < 4; i++) { + if (deathCount[floor][i] > max) { max = deathCount[floor][i]; room = i; } } - if ((room >= 0) && (max >= DEATH_COUNTS[floor])) - { + if ((room >= 0) && (max >= DEATH_COUNTS[floor])) { int cf = floor == 1 ? 3 : 0; int servantId = SERVANT_FIRST + nextServantIdx + cf; int[] coords = SERVANT_COORDINATES[(room + cf)]; @@ -1325,20 +1095,15 @@ public final class TullyWorkshop extends AbstractNpcAI } } } - } - else if ((npcId >= SERVANT_FIRST) && (npcId <= SERVANT_LAST)) - { + } else if ((npcId >= SERVANT_FIRST) && (npcId <= SERVANT_LAST)) { int[] roomData = getRoomData(npc); - if ((roomData[0] >= 0) && (roomData[1] >= 0) && allowAgentSpawn) - { + if ((roomData[0] >= 0) && (roomData[1] >= 0) && allowAgentSpawn) { allowServantSpawn = true; - if (nextServantIdx == 2) - { + if (nextServantIdx == 2) { nextServantIdx = 0; initDeathCounter(roomData[0]); - if (RaidBossSpawnManager.getInstance().getRaidBossStatusId(DARION) == StatusEnum.ALIVE) - { + if (RaidBossSpawnManager.getInstance().getRaidBossStatusId(DARION) == StatusEnum.ALIVE) { allowAgentSpawn = false; allowServantSpawn = false; final int cf = roomData[0] == 1 ? 3 : 0; @@ -1346,109 +1111,75 @@ public final class TullyWorkshop extends AbstractNpcAI L2Npc spawnedNpc = addSpawn(AGENT, coords[0], coords[1], coords[2], 0, false, 0, false); startQuestTimer("despawn_agent", 180000, spawnedNpc, null); } - } - else - { - for (int i = 0; i < 4; i++) - { - if (i == roomData[1]) - { + } else { + for (int i = 0; i < 4; i++) { + if (i == roomData[1]) { deathCount[roomData[0]][i] = 0; - } - else - { + } else { deathCount[roomData[0]][i] = (deathCount[roomData[0]][i] + 1) * getRandom(3); } } - if (getRandom(1000) > 500) - { + if (getRandom(1000) > 500) { nextServantIdx++; } } } - if (((npc.getId() - 22404) == 3) || ((npc.getId() - 22404) == 6)) - { + if (((npc.getId() - 22404) == 3) || ((npc.getId() - 22404) == 6)) { broadcastNpcSay(npc, Say2.NPC_SHOUT, NpcStringId.I_FAILED_PLEASE_FORGIVE_ME_DARION); - } - else - { + } else { broadcastNpcSay(npc, Say2.NPC_SHOUT, NpcStringId.S1_ILL_BE_BACK_DONT_GET_COMFORTABLE, killer.getName()); } - } - else if (((npcId == TEMENIR) || (npcId == DRAXIUS) || (npcId == KIRETCENAH)) && spawnedFollowers.contains(npc)) - { + } else if (((npcId == TEMENIR) || (npcId == DRAXIUS) || (npcId == KIRETCENAH)) && spawnedFollowers.contains(npc)) { killedFollowersCount++; - if (killedFollowersCount >= 3) - { + if (killedFollowersCount >= 3) { do7thFloorDespawn(); } - } - else if (npcId == DARION) - { - if (pillarSpawn != null) - { + } else if (npcId == DARION) { + if (pillarSpawn != null) { pillarSpawn.getLastSpawn().setIsInvul(false); } handleDoorsOnDeath(); - } - else if (npcId == PILLAR) - { + } else if (npcId == PILLAR) { addSpawn(DWARVEN_GHOST, npc.getX() + 30, npc.getY() - 30, npc.getZ(), 0, false, 900000, false); } return super.onKill(npc, killer, isSummon); } @Override - public final String onSpawn(L2Npc npc) - { - if ((npc.getId() == TULLY) && npc.isInsideRadius(-12557, 273901, -9000, 1000, true, false)) - { - for (L2Npc spawnedNpc : postMortemSpawn) - { - if (spawnedNpc != null) - { + public final String onSpawn(L2Npc npc) { + if ((npc.getId() == TULLY) && npc.isInsideRadius(-12557, 273901, -9000, 1000, true, false)) { + for (L2Npc spawnedNpc : postMortemSpawn) { + if (spawnedNpc != null) { spawnedNpc.deleteMe(); } } postMortemSpawn.clear(); - } - else if (npc.getId() == DARION) - { - if (pillarSpawn != null) - { + } else if (npc.getId() == DARION) { + if (pillarSpawn != null) { pillarSpawn.getLastSpawn().setIsInvul(true); } handleDoorsOnRespawn(); - } - else if (npc.getId() == PILLAR) - { + } else if (npc.getId() == PILLAR) { npc.setIsInvul(RaidBossSpawnManager.getInstance().getRaidBossStatusId(DARION) == StatusEnum.ALIVE); } return super.onSpawn(npc); } @Override - public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) - { + public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) { final int npcId = npc.getId(); final int skillId = skill.getId(); - if ((npcId == AGENT) && (skillId == 5526)) - { + if ((npcId == AGENT) && (skillId == 5526)) { player.teleToLocation(21935, 243923, 11088, true); // to the roof - } - else if ((npcId == TEMENIR) && (skillId == 5331)) - { - if (!npc.isDead()) - { + } else if ((npcId == TEMENIR) && (skillId == 5331)) { + if (!npc.isDead()) { npc.setCurrentHp(npc.getCurrentHp() + (npc.getMaxHp() * 0.005)); } - } - else if ((npcId >= SERVANT_FIRST) && (npcId <= SERVANT_LAST) && (skillId == 5392)) - { + } else if ((npcId >= SERVANT_FIRST) && (npcId <= SERVANT_LAST) && (skillId == 5392)) { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.S1_THANK_YOU_FOR_GIVING_ME_YOUR_LIFE, player.getName()); final int dmg = (int) (player.getCurrentHp() / (npc.getId() - 22404)); player.reduceCurrentHp(dmg, null, null); @@ -1457,27 +1188,20 @@ public final class TullyWorkshop extends AbstractNpcAI return super.onSpellFinished(npc, player, skill); } - private int[] getRoomData(L2Npc npc) - { - int[] ret = - { + private int[] getRoomData(L2Npc npc) { + int[] ret = { -1, -1 }; - if (npc != null) - { + if (npc != null) { L2Spawn spawn = npc.getSpawn(); int x = spawn.getX(); int y = spawn.getY(); int z = spawn.getZ(); - for (L2ZoneType zone : ZoneManager.getInstance().getZones(x, y, z)) - { - for (int i = 0; i < 2; i++) - { - for (int j = 0; j < 4; j++) - { - if (SPAWN_ZONE_DEF[i][j] == zone.getId()) - { + for (L2ZoneType zone : ZoneManager.getInstance().getZones(x, y, z)) { + for (int i = 0; i < 2; i++) { + for (int j = 0; j < 4; j++) { + if (SPAWN_ZONE_DEF[i][j] == zone.getId()) { ret[0] = i; // 0 - 6th floor, 1 - 8th floor ret[1] = j; // room number: 0 == 1'st and so on return ret; @@ -1489,48 +1213,36 @@ public final class TullyWorkshop extends AbstractNpcAI return ret; } - private void initDeathCounter(int floor) - { - for (int i = 0; i < 4; i++) - { + private void initDeathCounter(int floor) { + for (int i = 0; i < 4; i++) { deathCount[floor][i] = getRandom(DEATH_COUNTS[floor]); } } - private void do7thFloorSpawn() - { + private void do7thFloorSpawn() { killedFollowersCount = 0; is7thFloorAttackBegan = false; - for (int[] data : SPAWNLIST_7TH_FLOOR) - { + for (int[] data : SPAWNLIST_7TH_FLOOR) { L2MonsterInstance monster = (L2MonsterInstance) addSpawn(data[0], data[1], data[2], data[3], data[4], false, 0, false); - if ((data[0] == TEMENIR) || (data[0] == DRAXIUS) || (data[0] == KIRETCENAH)) - { + if ((data[0] == TEMENIR) || (data[0] == DRAXIUS) || (data[0] == KIRETCENAH)) { spawnedFollowers.add(monster); - } - else - { + } else { spawnedFollowerMinions.add(monster); } } } - private void do7thFloorDespawn() - { + private void do7thFloorDespawn() { cancelQuestTimers("end_7th_floor_attack"); - for (L2MonsterInstance monster : spawnedFollowers) - { - if ((monster != null) && !monster.isDead()) - { + for (L2MonsterInstance monster : spawnedFollowers) { + if ((monster != null) && !monster.isDead()) { monster.deleteMe(); } } - for (L2MonsterInstance monster : spawnedFollowerMinions) - { - if ((monster != null) && !monster.isDead()) - { + for (L2MonsterInstance monster : spawnedFollowerMinions) { + if ((monster != null) && !monster.isDead()) { monster.deleteMe(); } } @@ -1543,13 +1255,10 @@ public final class TullyWorkshop extends AbstractNpcAI /** * Spawns Crystal Pillar (we can't track initial spawn if it done from spawn table) and opens / closes doors according to Darion's state */ - private void doOnLoadSpawn() - { + private void doOnLoadSpawn() { // Ghost of Tully and Spooky Tombstone should be spawned, if Tully isn't alive - if (RaidBossSpawnManager.getInstance().getRaidBossStatusId(TULLY) != StatusEnum.ALIVE) - { - for (int i = 12; i <= 13; i++) - { + if (RaidBossSpawnManager.getInstance().getRaidBossStatusId(TULLY) != StatusEnum.ALIVE) { + for (int i = 12; i <= 13; i++) { int[] data = POST_MORTEM_SPAWNLIST[i]; L2Npc spawnedNpc = addSpawn(data[0], data[1], data[2], data[3], data[4], false, 0, false); postMortemSpawn.add(spawnedNpc); @@ -1563,49 +1272,40 @@ public final class TullyWorkshop extends AbstractNpcAI pillarSpawn.startRespawn(); // Doors related - if (RaidBossSpawnManager.getInstance().getRaidBossStatusId(DARION) != StatusEnum.ALIVE) - { + if (RaidBossSpawnManager.getInstance().getRaidBossStatusId(DARION) != StatusEnum.ALIVE) { handleDoorsOnDeath(); } // addSpawn(BRIDGE_CONTROLLER, 12527, 279714, -11622, 16384, false, 0, false); } - private void handleDoorsOnDeath() - { + private void handleDoorsOnDeath() { DoorData.getInstance().getDoor(20250005).openMe(); DoorData.getInstance().getDoor(20250004).openMe(); - ThreadPoolManager.getInstance().scheduleGeneral(new DoorTask(new int[] - { + ThreadPoolManager.getInstance().scheduleGeneral(new DoorTask(new int[] { 20250006, 20250007 }, STATE_OPEN), 2000); - ThreadPoolManager.getInstance().scheduleGeneral(new DoorTask(new int[] - { + ThreadPoolManager.getInstance().scheduleGeneral(new DoorTask(new int[] { 20250778 }, STATE_CLOSE), 3000); - ThreadPoolManager.getInstance().scheduleGeneral(new DoorTask(new int[] - { + ThreadPoolManager.getInstance().scheduleGeneral(new DoorTask(new int[] { 20250777 }, STATE_CLOSE), 6000); - ThreadPoolManager.getInstance().scheduleGeneral(new DoorTask(new int[] - { + ThreadPoolManager.getInstance().scheduleGeneral(new DoorTask(new int[] { 20250009, 20250008 }, STATE_OPEN), 11000); } - private void handleDoorsOnRespawn() - { + private void handleDoorsOnRespawn() { DoorData.getInstance().getDoor(20250009).closeMe(); DoorData.getInstance().getDoor(20250008).closeMe(); - ThreadPoolManager.getInstance().scheduleGeneral(new DoorTask(new int[] - { + ThreadPoolManager.getInstance().scheduleGeneral(new DoorTask(new int[] { 20250777, 20250778 }, STATE_OPEN), 1000); - ThreadPoolManager.getInstance().scheduleGeneral(new DoorTask(new int[] - { + ThreadPoolManager.getInstance().scheduleGeneral(new DoorTask(new int[] { 20250005, 20250004, 20250006, @@ -1613,28 +1313,22 @@ public final class TullyWorkshop extends AbstractNpcAI }, STATE_CLOSE), 4000); } - private static class DoorTask implements Runnable - { + private static class DoorTask implements Runnable { private final int[] _doorIds; private final byte _state; - public DoorTask(int[] doorIds, byte state) - { + public DoorTask(int[] doorIds, byte state) { _doorIds = doorIds; _state = state; } @Override - public void run() - { + public void run() { L2DoorInstance door; - for (int doorId : _doorIds) - { + for (int doorId : _doorIds) { door = DoorData.getInstance().getDoor(doorId); - if (door != null) - { - switch (_state) - { + if (door != null) { + switch (_state) { case STATE_OPEN: door.openMe(); break; diff --git a/src/main/java/com/l2jserver/datapack/hellbound/HellboundEngine.java b/src/main/java/com/l2jserver/datapack/hellbound/HellboundEngine.java index 5674d31b57..5580606b20 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/HellboundEngine.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/HellboundEngine.java @@ -36,8 +36,7 @@ import com.l2jserver.gameserver.util.Broadcast; * Hellbound Engine. * @author Zoey76 */ -public final class HellboundEngine extends AbstractNpcAI -{ +public final class HellboundEngine extends AbstractNpcAI { private static final Logger LOG = LoggerFactory.getLogger(HellboundEngine.class); @@ -64,8 +63,7 @@ public final class HellboundEngine extends AbstractNpcAI private int _maxTrust = 0; private int _minTrust = 0; - public HellboundEngine() - { + public HellboundEngine() { super(HellboundEngine.class.getSimpleName(), "hellbound"); addKillId(HellboundPointData.getInstance().getPointsInfo().keySet()); @@ -78,22 +76,17 @@ public final class HellboundEngine extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equals(UPDATE_EVENT)) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equals(UPDATE_EVENT)) { int level = getLevel(); - if ((level > 0) && (level == getCachedLevel())) - { + if ((level > 0) && (level == getCachedLevel())) { if ((getTrust() == getMaxTrust()) && (level != 4)) // Only exclusion is kill of Derek. { level++; setLevel(level); onLevelChange(level); } - } - else - { + } else { onLevelChange(level); // First run or changed by administrator. } startQuestTimer(UPDATE_EVENT, UPDATE_INTERVAL, null, null); @@ -104,44 +97,32 @@ public final class HellboundEngine extends AbstractNpcAI /** * Adds and removes spawns for Hellbound given the conditions for spawn. */ - private void doSpawn() - { + private void doSpawn() { int added = 0; int deleted = 0; final HellboundSpawns hellboundSpawns = HellboundSpawns.getInstance(); - for (L2Spawn spawn : hellboundSpawns.getSpawns()) - { + for (L2Spawn spawn : hellboundSpawns.getSpawns()) { final L2Npc npc = spawn.getLastSpawn(); - if ((getLevel() < hellboundSpawns.getSpawnMinLevel(spawn.getId())) || (getLevel() > hellboundSpawns.getSpawnMaxLevel(spawn.getId()))) - { + if ((getLevel() < hellboundSpawns.getSpawnMinLevel(spawn.getId())) || (getLevel() > hellboundSpawns.getSpawnMaxLevel(spawn.getId()))) { spawn.stopRespawn(); - if ((npc != null) && npc.isVisible()) - { + if ((npc != null) && npc.isVisible()) { npc.deleteMe(); deleted++; } - } - else - { + } else { spawn.startRespawn(); - if (npc == null) - { + if (npc == null) { spawn.doSpawn(); added++; - } - else - { - if (npc.isDecayed()) - { + } else { + if (npc.isDecayed()) { npc.setDecayed(false); } - if (npc.isDead()) - { + if (npc.isDead()) { npc.doRevive(); } - if (!npc.isVisible()) - { + if (!npc.isVisible()) { npc.setIsVisible(true); added++; } @@ -152,12 +133,10 @@ public final class HellboundEngine extends AbstractNpcAI } } - if (added > 0) - { + if (added > 0) { LOG.info("Spawned {} NPCs.", added); } - if (deleted > 0) - { + if (deleted > 0) { LOG.info("Removed {} NPCs.", deleted); } } @@ -166,8 +145,7 @@ public final class HellboundEngine extends AbstractNpcAI * Gets the Hellbound level. * @return the level */ - public int getLevel() - { + public int getLevel() { return GlobalVariablesManager.getInstance().getInt("HBLevel", 0); } @@ -175,10 +153,8 @@ public final class HellboundEngine extends AbstractNpcAI * Sets the Hellbound level. * @param lvl the level to set */ - public void setLevel(int lvl) - { - if (lvl == getLevel()) - { + public void setLevel(int lvl) { + if (lvl == getLevel()) { return; } @@ -187,18 +163,15 @@ public final class HellboundEngine extends AbstractNpcAI GlobalVariablesManager.getInstance().set("HBLevel", lvl); } - public int getCachedLevel() - { + public int getCachedLevel() { return _cachedLevel; } - public int getMaxTrust() - { + public int getMaxTrust() { return _maxTrust; } - public int getMinTrust() - { + public int getMinTrust() { return _minTrust; } @@ -206,8 +179,7 @@ public final class HellboundEngine extends AbstractNpcAI * Gets the trust. * @return the trust */ - public int getTrust() - { + public int getTrust() { return GlobalVariablesManager.getInstance().getInt("HBTrust", 0); } @@ -215,8 +187,7 @@ public final class HellboundEngine extends AbstractNpcAI * Sets the truest. * @param trust the trust to set */ - private void setTrust(int trust) - { + private void setTrust(int trust) { GlobalVariablesManager.getInstance().set("HBTrust", trust); } @@ -224,25 +195,20 @@ public final class HellboundEngine extends AbstractNpcAI * Verifies if Hellbound is locked. * @return {@code true} if Hellbound is locked, {@code false} otherwise */ - public boolean isLocked() - { + public boolean isLocked() { return getLevel() <= 0; } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final int npcId = npc.getId(); final HellboundPointData hellboundPointData = HellboundPointData.getInstance(); - if (hellboundPointData.getPointsInfo().containsKey(npcId)) - { - if ((getLevel() >= hellboundPointData.getMinHbLvl(npcId)) && (getLevel() <= hellboundPointData.getMaxHbLvl(npcId)) && ((hellboundPointData.getLowestTrustLimit(npcId) == 0) || (getTrust() > hellboundPointData.getLowestTrustLimit(npcId)))) - { + if (hellboundPointData.getPointsInfo().containsKey(npcId)) { + if ((getLevel() >= hellboundPointData.getMinHbLvl(npcId)) && (getLevel() <= hellboundPointData.getMaxHbLvl(npcId)) && ((hellboundPointData.getLowestTrustLimit(npcId) == 0) || (getTrust() > hellboundPointData.getLowestTrustLimit(npcId)))) { updateTrust(hellboundPointData.getPointsAmount(npcId), true); } - if ((npcId == DEREK) && (getLevel() == 4)) - { + if ((npcId == DEREK) && (getLevel() == 4)) { setLevel(5); } } @@ -253,15 +219,11 @@ public final class HellboundEngine extends AbstractNpcAI * Called on every level change. * @param newLevel the new level */ - public void onLevelChange(int newLevel) - { - try - { + public void onLevelChange(int newLevel) { + try { setMaxTrust(MAX_TRUST[newLevel]); setMinTrust(MAX_TRUST[newLevel - 1]); - } - catch (Exception e) - { + } catch (Exception e) { setMaxTrust(0); setMinTrust(0); } @@ -270,34 +232,24 @@ public final class HellboundEngine extends AbstractNpcAI doSpawn(); - for (int[] doorData : DOOR_LIST) - { - try - { + for (int[] doorData : DOOR_LIST) { + try { L2DoorInstance door = DoorData.getInstance().getDoor(doorData[0]); - if (door.getOpen()) - { - if (newLevel < doorData[1]) - { + if (door.getOpen()) { + if (newLevel < doorData[1]) { door.closeMe(); } - } - else - { - if (newLevel >= doorData[1]) - { + } else { + if (newLevel >= doorData[1]) { door.openMe(); } } - } - catch (Exception ex) - { + } catch (Exception ex) { LOG.warn("Doors problem!", ex); } } - if (_cachedLevel > 0) - { + if (_cachedLevel > 0) { Broadcast.toAllOnlinePlayers(ANNOUNCEMENT.replace("%lvl%", String.valueOf(newLevel))); LOG.info("New level {}.", newLevel); } @@ -308,11 +260,9 @@ public final class HellboundEngine extends AbstractNpcAI * Sets the maximum trust for the current level. * @param trust the maximum trust */ - private void setMaxTrust(int trust) - { + private void setMaxTrust(int trust) { _maxTrust = trust; - if ((_maxTrust > 0) && (getTrust() > _maxTrust)) - { + if ((_maxTrust > 0) && (getTrust() > _maxTrust)) { setTrust(_maxTrust); } } @@ -321,19 +271,16 @@ public final class HellboundEngine extends AbstractNpcAI * Sets the minimum trust for the current level. * @param trust the minimum trust */ - private void setMinTrust(int trust) - { + private void setMinTrust(int trust) { _minTrust = trust; - if (getTrust() >= _maxTrust) - { + if (getTrust() >= _maxTrust) { setTrust(_minTrust); } } @Override - public boolean unload() - { + public boolean unload() { cancelQuestTimers(UPDATE_EVENT); return true; } @@ -343,37 +290,29 @@ public final class HellboundEngine extends AbstractNpcAI * @param trust the trust * @param useRates if {@code true} it will use Hellbound trust rates */ - public synchronized void updateTrust(int trust, boolean useRates) - { - if (isLocked()) - { + public synchronized void updateTrust(int trust, boolean useRates) { + if (isLocked()) { return; } int reward = trust; - if (useRates) - { + if (useRates) { reward = (int) (trust * (trust > 0 ? rates().getRateHellboundTrustIncrease() : rates().getRateHellboundTrustDecrease())); } final int finalTrust = Math.max(getTrust() + reward, _minTrust); - if (_maxTrust > 0) - { + if (_maxTrust > 0) { setTrust(Math.min(finalTrust, _maxTrust)); - } - else - { + } else { setTrust(finalTrust); } } - public static HellboundEngine getInstance() - { + public static HellboundEngine getInstance() { return SingletonHolder.INSTANCE; } - private static class SingletonHolder - { + private static class SingletonHolder { protected static final HellboundEngine INSTANCE = new HellboundEngine(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/hellbound/HellboundPointData.java b/src/main/java/com/l2jserver/datapack/hellbound/HellboundPointData.java index ebacf404a3..2303656823 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/HellboundPointData.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/HellboundPointData.java @@ -33,35 +33,28 @@ import com.l2jserver.gameserver.util.IXmlReader; * Point data parser. * @author Zoey76 */ -public final class HellboundPointData implements IXmlReader -{ - +public final class HellboundPointData implements IXmlReader { + private static final Logger LOG = LoggerFactory.getLogger(HellboundPointData.class); private final Map<Integer, int[]> _pointsInfo = new HashMap<>(); - public HellboundPointData() - { + public HellboundPointData() { load(); } @Override - public void load() - { + public void load() { _pointsInfo.clear(); parseDatapackFile("data/hellbound/hellboundTrustPoints.xml"); LOG.info("Loaded {} trust point reward data.", _pointsInfo.size()); } @Override - public void parseDocument(Document doc) - { - for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) - { - if ("list".equals(n.getNodeName())) - { - for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) - { + public void parseDocument(Document doc) { + for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) { + if ("list".equals(n.getNodeName())) { + for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) { parsePoint(d); } } @@ -72,38 +65,32 @@ public final class HellboundPointData implements IXmlReader * Parses the point. * @param d the node to parse */ - private void parsePoint(Node d) - { - if ("npc".equals(d.getNodeName())) - { + private void parsePoint(Node d) { + if ("npc".equals(d.getNodeName())) { NamedNodeMap attrs = d.getAttributes(); Node att = attrs.getNamedItem("id"); - if (att == null) - { + if (att == null) { LOG.warn("Missing NPC Id, skipping record!"); return; } final int npcId = Integer.parseInt(att.getNodeValue()); att = attrs.getNamedItem("points"); - if (att == null) - { + if (att == null) { LOG.warn("Missing reward point info for NPC Id {}, skipping record", npcId); return; } final int points = Integer.parseInt(att.getNodeValue()); att = attrs.getNamedItem("minHellboundLvl"); - if (att == null) - { + if (att == null) { LOG.warn("Missing minHellboundLvl info for NPC Id {}, skipping record!"); return; } final int minHbLvl = Integer.parseInt(att.getNodeValue()); att = attrs.getNamedItem("maxHellboundLvl"); - if (att == null) - { + if (att == null) { LOG.warn("Missing maxHellboundLvl info for NPC Id {}, skipping record!", npcId); return; } @@ -112,8 +99,7 @@ public final class HellboundPointData implements IXmlReader att = attrs.getNamedItem("lowestTrustLimit"); final int lowestTrustLimit = (att == null) ? 0 : Integer.parseInt(att.getNodeValue()); - _pointsInfo.put(npcId, new int[] - { + _pointsInfo.put(npcId, new int[] { points, minHbLvl, maxHbLvl, @@ -126,8 +112,7 @@ public final class HellboundPointData implements IXmlReader * Gets all the points data. * @return the points data */ - public Map<Integer, int[]> getPointsInfo() - { + public Map<Integer, int[]> getPointsInfo() { return _pointsInfo; } @@ -136,8 +121,7 @@ public final class HellboundPointData implements IXmlReader * @param npcId the NPC ID * @return the points for an specific NPC ID */ - public int getPointsAmount(int npcId) - { + public int getPointsAmount(int npcId) { return _pointsInfo.get(npcId)[0]; } @@ -146,8 +130,7 @@ public final class HellboundPointData implements IXmlReader * @param npcId the NPC ID * @return the minimum Hellbound level for the given NPC ID */ - public int getMinHbLvl(int npcId) - { + public int getMinHbLvl(int npcId) { return _pointsInfo.get(npcId)[1]; } @@ -156,8 +139,7 @@ public final class HellboundPointData implements IXmlReader * @param npcId the NPC ID * @return the maximum Hellbound level for the given NPC ID */ - public int getMaxHbLvl(int npcId) - { + public int getMaxHbLvl(int npcId) { return _pointsInfo.get(npcId)[2]; } @@ -166,18 +148,15 @@ public final class HellboundPointData implements IXmlReader * @param npcId the NPC ID * @return the lowest trust limit for the given NPC ID */ - public int getLowestTrustLimit(int npcId) - { + public int getLowestTrustLimit(int npcId) { return _pointsInfo.get(npcId)[3]; } - public static HellboundPointData getInstance() - { + public static HellboundPointData getInstance() { return SingletonHolder.INSTANCE; } - private static class SingletonHolder - { + private static class SingletonHolder { protected static final HellboundPointData INSTANCE = new HellboundPointData(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/hellbound/HellboundSpawns.java b/src/main/java/com/l2jserver/datapack/hellbound/HellboundSpawns.java index c049dd183f..67ff9424bc 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/HellboundSpawns.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/HellboundSpawns.java @@ -38,23 +38,20 @@ import com.l2jserver.gameserver.util.IXmlReader; * Hellbound Spawns parser. * @author Zoey76 */ -public final class HellboundSpawns implements IXmlReader -{ - +public final class HellboundSpawns implements IXmlReader { + private static final Logger LOG = LoggerFactory.getLogger(HellboundSpawns.class); private final List<L2Spawn> _spawns = new ArrayList<>(); private final Map<Integer, int[]> _spawnLevels = new HashMap<>(); - public HellboundSpawns() - { + public HellboundSpawns() { load(); } @Override - public void load() - { + public void load() { _spawns.clear(); _spawnLevels.clear(); parseDatapackFile("data/hellbound/hellboundSpawns.xml"); @@ -62,14 +59,10 @@ public final class HellboundSpawns implements IXmlReader } @Override - public void parseDocument(Document doc) - { - for (Node node = doc.getFirstChild(); node != null; node = node.getNextSibling()) - { - if ("list".equals(node.getNodeName())) - { - for (Node npc = node.getFirstChild(); npc != null; npc = npc.getNextSibling()) - { + public void parseDocument(Document doc) { + for (Node node = doc.getFirstChild(); node != null; node = node.getNextSibling()) { + if ("list".equals(node.getNodeName())) { + for (Node npc = node.getFirstChild(); npc != null; npc = npc.getNextSibling()) { parseSpawn(npc); } } @@ -80,13 +73,10 @@ public final class HellboundSpawns implements IXmlReader * Parses the spawn. * @param npc the NPC to parse */ - private void parseSpawn(Node npc) - { - if ("npc".equals(npc.getNodeName())) - { + private void parseSpawn(Node npc) { + if ("npc".equals(npc.getNodeName())) { final Node id = npc.getAttributes().getNamedItem("id"); - if (id == null) - { + if (id == null) { LOG.warn("Missing NPC Id, skipping record!"); return; } @@ -97,26 +87,21 @@ public final class HellboundSpawns implements IXmlReader int randomInterval = 0; int minLevel = 1; int maxLevel = 100; - for (Node element = npc.getFirstChild(); element != null; element = element.getNextSibling()) - { + for (Node element = npc.getFirstChild(); element != null; element = element.getNextSibling()) { final NamedNodeMap attrs = element.getAttributes(); minLevel = 1; maxLevel = 100; - switch (element.getNodeName()) - { - case "location": - { + switch (element.getNodeName()) { + case "location": { loc = new Location(parseInteger(attrs, "x"), parseInteger(attrs, "y"), parseInteger(attrs, "z"), parseInteger(attrs, "heading", 0)); break; } - case "respawn": - { + case "respawn": { delay = parseInteger(attrs, "delay"); randomInterval = attrs.getNamedItem("randomInterval") != null ? parseInteger(attrs, "randomInterval") : 1; break; } - case "hellboundLevel": - { + case "hellboundLevel": { minLevel = parseInteger(attrs, "min", 1); maxLevel = parseInteger(attrs, "max", 100); break; @@ -124,26 +109,21 @@ public final class HellboundSpawns implements IXmlReader } } - try - { + try { final L2Spawn spawn = new L2Spawn(npcId); spawn.setAmount(1); - if (loc == null) - { + if (loc == null) { LOG.warn("Hellbound spawn location is null!"); } spawn.setLocation(loc); spawn.setRespawnDelay(delay, randomInterval); - _spawnLevels.put(npcId, new int[] - { + _spawnLevels.put(npcId, new int[] { minLevel, maxLevel }); SpawnTable.getInstance().addNewSpawn(spawn, false); _spawns.add(spawn); - } - catch (Exception ex) - { + } catch (Exception ex) { LOG.warn("Couldn't load spawns!", ex); } } @@ -153,8 +133,7 @@ public final class HellboundSpawns implements IXmlReader * Gets all Hellbound spawns. * @return the list of Hellbound spawns. */ - public List<L2Spawn> getSpawns() - { + public List<L2Spawn> getSpawns() { return _spawns; } @@ -163,8 +142,7 @@ public final class HellboundSpawns implements IXmlReader * @param npcId the NPC ID * @return the spawn minimum level */ - public int getSpawnMinLevel(int npcId) - { + public int getSpawnMinLevel(int npcId) { return _spawnLevels.containsKey(npcId) ? _spawnLevels.get(npcId)[0] : 1; } @@ -173,18 +151,15 @@ public final class HellboundSpawns implements IXmlReader * @param npcId the NPC ID * @return the spawn maximum level */ - public int getSpawnMaxLevel(int npcId) - { + public int getSpawnMaxLevel(int npcId) { return _spawnLevels.containsKey(npcId) ? _spawnLevels.get(npcId)[1] : 1; } - public static HellboundSpawns getInstance() - { + public static HellboundSpawns getInstance() { return SingletonHolder.INSTANCE; } - private static class SingletonHolder - { + private static class SingletonHolder { protected static final HellboundSpawns INSTANCE = new HellboundSpawns(); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/hellbound/Instances/DemonPrinceFloor/DemonPrinceFloor.java b/src/main/java/com/l2jserver/datapack/hellbound/Instances/DemonPrinceFloor/DemonPrinceFloor.java index fbb47b1c8d..930f5eb7bd 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/Instances/DemonPrinceFloor/DemonPrinceFloor.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/Instances/DemonPrinceFloor/DemonPrinceFloor.java @@ -35,10 +35,8 @@ import com.l2jserver.gameserver.util.Util; * Demon Prince Floor instance zone. * @author GKR */ -public final class DemonPrinceFloor extends AbstractInstance -{ - protected class DPFWorld extends InstanceWorld - { +public final class DemonPrinceFloor extends AbstractInstance { + protected class DPFWorld extends InstanceWorld { } @@ -55,8 +53,7 @@ public final class DemonPrinceFloor extends AbstractInstance private static final int TEMPLATE_ID = 142; private static final int MIN_LV = 78; - public DemonPrinceFloor() - { + public DemonPrinceFloor() { super(DemonPrinceFloor.class.getSimpleName(), "hellbound/Instances"); addStartNpc(GK_4, CUBE); addTalkId(GK_4, CUBE); @@ -64,33 +61,23 @@ public final class DemonPrinceFloor extends AbstractInstance } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; - if (npc.getId() == GK_4) - { - if (!player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) - { - if (player.getParty() == null) - { + if (npc.getId() == GK_4) { + if (!player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) { + if (player.getParty() == null) { htmltext = "gk-noparty.htm"; - } - else if (!player.getParty().isLeader(player)) - { + } else if (!player.getParty().isLeader(player)) { htmltext = "gk-noleader.htm"; } } - if (htmltext == null) - { + if (htmltext == null) { enterInstance(player, new DPFWorld(), "DemonPrince.xml", TEMPLATE_ID); } - } - else if (npc.getId() == CUBE) - { + } else if (npc.getId() == CUBE) { final InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (world instanceof DPFWorld) - { + if (world instanceof DPFWorld) { world.removeAllowed(player.getObjectId()); teleportPlayer(player, EXIT_POINT, 0); } @@ -99,11 +86,9 @@ public final class DemonPrinceFloor extends AbstractInstance } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final int instanceId = npc.getInstanceId(); - if (instanceId > 0) - { + if (instanceId > 0) { final Instance inst = InstanceManager.getInstance().getInstance(instanceId); final InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId()); inst.setExitLoc(EXIT_POINT); @@ -115,50 +100,41 @@ public final class DemonPrinceFloor extends AbstractInstance } @Override - protected boolean checkConditions(L2PcInstance player) - { - if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) - { + protected boolean checkConditions(L2PcInstance player) { + if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) { return true; } final L2Party party = player.getParty(); - if ((party == null) || !party.isLeader(player)) - { + if ((party == null) || !party.isLeader(player)) { player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); return false; } - for (L2PcInstance partyMember : party.getMembers()) - { - if (partyMember.getLevel() < MIN_LV) - { + for (L2PcInstance partyMember : party.getMembers()) { + if (partyMember.getLevel() < MIN_LV) { party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addPcName(partyMember)); return false; } - if (!Util.checkIfInRange(500, player, partyMember, true)) - { + if (!Util.checkIfInRange(500, player, partyMember, true)) { party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED).addPcName(partyMember)); return false; } - if (InstanceManager.getInstance().getPlayerWorld(player) != null) - { + if (InstanceManager.getInstance().getPlayerWorld(player) != null) { party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON).addPcName(partyMember)); return false; } final Long reentertime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), TEMPLATE_ID); - if (System.currentTimeMillis() < reentertime) - { + if (System.currentTimeMillis() < reentertime) { party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET).addPcName(partyMember)); return false; } - if (partyMember.getInventory().getInventoryItemCount(SEAL_BREAKER_5, -1, false) < 1) - { + if (partyMember.getInventory().getInventoryItemCount(SEAL_BREAKER_5, -1, false) < 1) { party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_S_QUEST_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addPcName(partyMember)); return false; } @@ -167,28 +143,20 @@ public final class DemonPrinceFloor extends AbstractInstance } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { - if (player.getParty() == null) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { + if (player.getParty() == null) { teleportPlayer(player, ENTRY_POINT, world.getInstanceId()); player.destroyItemByItemId("Quest", SEAL_BREAKER_5, 1, null, true); world.addAllowed(player.getObjectId()); - } - else - { - for (L2PcInstance partyMember : player.getParty().getMembers()) - { + } else { + for (L2PcInstance partyMember : player.getParty().getMembers()) { teleportPlayer(partyMember, ENTRY_POINT, world.getInstanceId()); partyMember.destroyItemByItemId("Quest", SEAL_BREAKER_5, 1, null, true); world.addAllowed(partyMember.getObjectId()); } } - } - else - { + } else { teleportPlayer(player, ENTRY_POINT, world.getInstanceId()); } } diff --git a/src/main/java/com/l2jserver/datapack/hellbound/Instances/RankuFloor/RankuFloor.java b/src/main/java/com/l2jserver/datapack/hellbound/Instances/RankuFloor/RankuFloor.java index 1d4017fbbc..aa34ed920e 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/Instances/RankuFloor/RankuFloor.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/Instances/RankuFloor/RankuFloor.java @@ -35,10 +35,8 @@ import com.l2jserver.gameserver.util.Util; * Tower of Infinitum (10th Floor) instance zone. * @author GKR */ -public final class RankuFloor extends AbstractInstance -{ - protected class RFWorld extends InstanceWorld - { +public final class RankuFloor extends AbstractInstance { + protected class RFWorld extends InstanceWorld { } @@ -55,8 +53,7 @@ public final class RankuFloor extends AbstractInstance private static final int TEMPLATE_ID = 143; private static final int MIN_LV = 78; - public RankuFloor() - { + public RankuFloor() { super(RankuFloor.class.getSimpleName(), "hellbound/Instances"); addStartNpc(GK_9, CUBE); addTalkId(GK_9, CUBE); @@ -64,34 +61,24 @@ public final class RankuFloor extends AbstractInstance } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; - if (npc.getId() == GK_9) - { - if (!player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) - { - if (player.getParty() == null) - { + if (npc.getId() == GK_9) { + if (!player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) { + if (player.getParty() == null) { htmltext = "gk-noparty.htm"; - } - else if (!player.getParty().isLeader(player)) - { + } else if (!player.getParty().isLeader(player)) { htmltext = "gk-noleader.htm"; } } - if (htmltext == null) - { + if (htmltext == null) { enterInstance(player, new RFWorld(), "Ranku.xml", TEMPLATE_ID); } - } - else if (npc.getId() == CUBE) - { + } else if (npc.getId() == CUBE) { final InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (world instanceof RFWorld) - { + if (world instanceof RFWorld) { teleportPlayer(player, EXIT_POINT, 0); } } @@ -99,11 +86,9 @@ public final class RankuFloor extends AbstractInstance } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final int instanceId = npc.getInstanceId(); - if (instanceId > 0) - { + if (instanceId > 0) { final Instance inst = InstanceManager.getInstance().getInstance(instanceId); final InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId()); inst.setExitLoc(EXIT_POINT); @@ -114,50 +99,41 @@ public final class RankuFloor extends AbstractInstance } @Override - protected boolean checkConditions(L2PcInstance player) - { - if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) - { + protected boolean checkConditions(L2PcInstance player) { + if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) { return true; } final L2Party party = player.getParty(); - if ((party == null) || !party.isLeader(player)) - { + if ((party == null) || !party.isLeader(player)) { player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); return false; } - for (L2PcInstance partyMember : party.getMembers()) - { - if (partyMember.getLevel() < MIN_LV) - { + for (L2PcInstance partyMember : party.getMembers()) { + if (partyMember.getLevel() < MIN_LV) { party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addPcName(partyMember)); return false; } - if (!Util.checkIfInRange(500, player, partyMember, true)) - { + if (!Util.checkIfInRange(500, player, partyMember, true)) { party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED).addPcName(partyMember)); return false; } - if (InstanceManager.getInstance().getPlayerWorld(player) != null) - { + if (InstanceManager.getInstance().getPlayerWorld(player) != null) { party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON).addPcName(partyMember)); return false; } final Long reenterTime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), TEMPLATE_ID); - if (System.currentTimeMillis() < reenterTime) - { + if (System.currentTimeMillis() < reenterTime) { party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET).addPcName(partyMember)); return false; } - if (partyMember.getInventory().getInventoryItemCount(SEAL_BREAKER_10, -1, false) < 1) - { + if (partyMember.getInventory().getInventoryItemCount(SEAL_BREAKER_10, -1, false) < 1) { party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_S_QUEST_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addPcName(partyMember)); return false; } @@ -166,28 +142,20 @@ public final class RankuFloor extends AbstractInstance } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { - if (player.getParty() == null) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { + if (player.getParty() == null) { teleportPlayer(player, ENTRY_POINT, world.getInstanceId()); player.destroyItemByItemId("Quest", SEAL_BREAKER_10, 1, null, true); world.addAllowed(player.getObjectId()); - } - else - { - for (L2PcInstance partyMember : player.getParty().getMembers()) - { + } else { + for (L2PcInstance partyMember : player.getParty().getMembers()) { teleportPlayer(partyMember, ENTRY_POINT, world.getInstanceId()); partyMember.destroyItemByItemId("Quest", SEAL_BREAKER_10, 1, null, true); world.addAllowed(partyMember.getObjectId()); } } - } - else - { + } else { teleportPlayer(player, ENTRY_POINT, world.getInstanceId()); } } diff --git a/src/main/java/com/l2jserver/datapack/hellbound/Instances/UrbanArea/UrbanArea.java b/src/main/java/com/l2jserver/datapack/hellbound/Instances/UrbanArea/UrbanArea.java index 8020e8a395..5325e8b3ad 100644 --- a/src/main/java/com/l2jserver/datapack/hellbound/Instances/UrbanArea/UrbanArea.java +++ b/src/main/java/com/l2jserver/datapack/hellbound/Instances/UrbanArea/UrbanArea.java @@ -46,10 +46,8 @@ import com.l2jserver.gameserver.util.Util; * Urban Area instance zone. * @author GKR */ -public final class UrbanArea extends AbstractInstance -{ - protected class UrbanAreaWorld extends InstanceWorld - { +public final class UrbanArea extends AbstractInstance { + protected class UrbanAreaWorld extends InstanceWorld { protected L2MonsterInstance spawnedAmaskari; protected ScheduledFuture<?> activeAmaskariCall = null; protected boolean isAmaskariDead = false; @@ -75,21 +73,18 @@ public final class UrbanArea extends AbstractInstance private static final int MIN_LV = 78; private static final int TEMPLATE_ID = 2; - private static final NpcStringId[] NPCSTRING_ID = - { + private static final NpcStringId[] NPCSTRING_ID = { NpcStringId.INVADER, NpcStringId.YOU_HAVE_DONE_WELL_IN_FINDING_ME_BUT_I_CANNOT_JUST_HAND_YOU_THE_KEY }; - private static final NpcStringId[] NATIVES_NPCSTRING_ID = - { + private static final NpcStringId[] NATIVES_NPCSTRING_ID = { NpcStringId.THANK_YOU_FOR_SAVING_ME, NpcStringId.GUARDS_ARE_COMING_RUN, NpcStringId.NOW_I_CAN_ESCAPE_ON_MY_OWN }; - public UrbanArea() - { + public UrbanArea() { super(UrbanArea.class.getSimpleName(), "hellbound/Instances"); addFirstTalkId(DOWNTOWN_NATIVE); addStartNpc(KANAF, DOWNTOWN_NATIVE); @@ -101,68 +96,49 @@ public final class UrbanArea extends AbstractInstance } @Override - public final String onFirstTalk(L2Npc npc, L2PcInstance player) - { - if (!npc.isAffectedBySkill(STONE.getSkillId())) - { + public final String onFirstTalk(L2Npc npc, L2PcInstance player) { + if (!npc.isAffectedBySkill(STONE.getSkillId())) { return "32358-02.htm"; } return "32358-01.htm"; } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; - if (npc.getId() == KANAF) - { - if (!player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) - { - if (HellboundEngine.getInstance().getLevel() < 10) - { + if (npc.getId() == KANAF) { + if (!player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) { + if (HellboundEngine.getInstance().getLevel() < 10) { htmltext = "32346-lvl.htm"; } - if (player.getParty() == null) - { + if (player.getParty() == null) { htmltext = "32346-party.htm"; } } - if (htmltext == null) - { + if (htmltext == null) { enterInstance(player, new UrbanAreaWorld(), "UrbanArea.xml", TEMPLATE_ID); } - } - else if (npc.getId() == TOMBSTONE) - { + } else if (npc.getId() == TOMBSTONE) { final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if ((tmpworld != null) && (tmpworld instanceof UrbanAreaWorld)) - { + if ((tmpworld != null) && (tmpworld instanceof UrbanAreaWorld)) { final UrbanAreaWorld world = (UrbanAreaWorld) tmpworld; final L2Party party = player.getParty(); - if (party == null) - { + if (party == null) { htmltext = "32343-02.htm"; - } - else if (npc.isBusy()) - { + } else if (npc.isBusy()) { htmltext = "32343-02c.htm"; - } - else if (player.getInventory().getInventoryItemCount(KEY, -1, false) >= 1) - { - for (L2PcInstance partyMember : party.getMembers()) - { - if (!Util.checkIfInRange(300, npc, partyMember, true)) - { + } else if (player.getInventory().getInventoryItemCount(KEY, -1, false) >= 1) { + for (L2PcInstance partyMember : party.getMembers()) { + if (!Util.checkIfInRange(300, npc, partyMember, true)) { return "32343-02b.htm"; } } - if (player.destroyItemByItemId("Quest", KEY, 1, npc, true)) - { + if (player.destroyItemByItemId("Quest", KEY, 1, npc, true)) { npc.setBusy(true); // destroy instance after 5 min final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId()); @@ -171,9 +147,7 @@ public final class UrbanArea extends AbstractInstance ThreadPoolManager.getInstance().scheduleGeneral(new ExitInstance(party, world), 285000); htmltext = "32343-02d.htm"; } - } - else - { + } else { htmltext = "32343-02a.htm"; } } @@ -182,31 +156,21 @@ public final class UrbanArea extends AbstractInstance } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if ((tmpworld != null) && (tmpworld instanceof UrbanAreaWorld)) - { + if ((tmpworld != null) && (tmpworld instanceof UrbanAreaWorld)) { UrbanAreaWorld world = (UrbanAreaWorld) tmpworld; - if (npc.getId() == DOWNTOWN_NATIVE) - { - if (event.equalsIgnoreCase("rebuff") && !world.isAmaskariDead) - { + if (npc.getId() == DOWNTOWN_NATIVE) { + if (event.equalsIgnoreCase("rebuff") && !world.isAmaskariDead) { STONE.getSkill().applyEffects(npc, npc); - } - else if (event.equalsIgnoreCase("break_chains")) - { - if (!npc.isAffectedBySkill(STONE.getSkillId()) || world.isAmaskariDead) - { + } else if (event.equalsIgnoreCase("break_chains")) { + if (!npc.isAffectedBySkill(STONE.getSkillId()) || world.isAmaskariDead) { broadcastNpcSay(npc, Say2.NPC_ALL, NATIVES_NPCSTRING_ID[0]); broadcastNpcSay(npc, Say2.NPC_ALL, NATIVES_NPCSTRING_ID[2]); - } - else - { + } else { cancelQuestTimer("rebuff", npc, null); - if (npc.isAffectedBySkill(STONE.getSkillId())) - { + if (npc.isAffectedBySkill(STONE.getSkillId())) { npc.stopSkillEffects(false, STONE.getSkillId()); } @@ -215,10 +179,8 @@ public final class UrbanArea extends AbstractInstance HellboundEngine.getInstance().updateTrust(10, true); npc.scheduleDespawn(3000); // Try to call Amaskari - if ((world.spawnedAmaskari != null) && !world.spawnedAmaskari.isDead() && (getRandom(1000) < 25) && Util.checkIfInRange(5000, npc, world.spawnedAmaskari, false)) - { - if (world.activeAmaskariCall != null) - { + if ((world.spawnedAmaskari != null) && !world.spawnedAmaskari.isDead() && (getRandom(1000) < 25) && Util.checkIfInRange(5000, npc, world.spawnedAmaskari, false)) { + if (world.activeAmaskariCall != null) { world.activeAmaskariCall.cancel(true); } @@ -232,17 +194,13 @@ public final class UrbanArea extends AbstractInstance } @Override - public final String onSpawn(L2Npc npc) - { - if (npc.getId() == DOWNTOWN_NATIVE) - { + public final String onSpawn(L2Npc npc) { + if (npc.getId() == DOWNTOWN_NATIVE) { ((L2QuestGuardInstance) npc).setPassive(true); ((L2QuestGuardInstance) npc).setAutoAttackable(false); STONE.getSkill().applyEffects(npc, npc); startQuestTimer("rebuff", 357000, npc, null); - } - else if ((npc.getId() == TOWN_GUARD) || (npc.getId() == KEYMASTER)) - { + } else if ((npc.getId() == TOWN_GUARD) || (npc.getId() == KEYMASTER)) { npc.setBusy(false); npc.setBusyMessage(""); } @@ -250,22 +208,17 @@ public final class UrbanArea extends AbstractInstance } @Override - public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) { final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if ((tmpworld != null) && (tmpworld instanceof UrbanAreaWorld)) - { + if ((tmpworld != null) && (tmpworld instanceof UrbanAreaWorld)) { final UrbanAreaWorld world = (UrbanAreaWorld) tmpworld; - if (!npc.isBusy()) - { + if (!npc.isBusy()) { broadcastNpcSay(npc, Say2.NPC_ALL, NPCSTRING_ID[0]); npc.setBusy(true); - if ((world.spawnedAmaskari != null) && !world.spawnedAmaskari.isDead() && (getRandom(1000) < 25) && Util.checkIfInRange(1000, npc, world.spawnedAmaskari, false)) - { - if (world.activeAmaskariCall != null) - { + if ((world.spawnedAmaskari != null) && !world.spawnedAmaskari.isDead() && (getRandom(1000) < 25) && Util.checkIfInRange(1000, npc, world.spawnedAmaskari, false)) { + if (world.activeAmaskariCall != null) { world.activeAmaskariCall.cancel(true); } world.activeAmaskariCall = ThreadPoolManager.getInstance().scheduleGeneral(new CallAmaskari(npc), 25000); @@ -276,19 +229,15 @@ public final class UrbanArea extends AbstractInstance } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) { final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if ((tmpworld != null) && (tmpworld instanceof UrbanAreaWorld)) - { + if ((tmpworld != null) && (tmpworld instanceof UrbanAreaWorld)) { final UrbanAreaWorld world = (UrbanAreaWorld) tmpworld; - if (!world.isAmaskariDead && !(npc.getBusyMessage().equalsIgnoreCase("atk") || npc.isBusy())) - { + if (!world.isAmaskariDead && !(npc.getBusyMessage().equalsIgnoreCase("atk") || npc.isBusy())) { int msgId; int range; - switch (npc.getId()) - { + switch (npc.getId()) { case TOWN_GUARD: msgId = 0; range = 1000; @@ -301,17 +250,14 @@ public final class UrbanArea extends AbstractInstance msgId = -1; range = 0; } - if (msgId >= 0) - { + if (msgId >= 0) { broadcastNpcSay(npc, Say2.NPC_ALL, NPCSTRING_ID[msgId], range); } npc.setBusy(true); npc.setBusyMessage("atk"); - if ((world.spawnedAmaskari != null) && !world.spawnedAmaskari.isDead() && (getRandom(1000) < 25) && Util.checkIfInRange(range, npc, world.spawnedAmaskari, false)) - { - if (world.activeAmaskariCall != null) - { + if ((world.spawnedAmaskari != null) && !world.spawnedAmaskari.isDead() && (getRandom(1000) < 25) && Util.checkIfInRange(range, npc, world.spawnedAmaskari, false)) { + if (world.activeAmaskariCall != null) { world.activeAmaskariCall.cancel(true); } world.activeAmaskariCall = ThreadPoolManager.getInstance().scheduleGeneral(new CallAmaskari(npc), 25000); @@ -322,11 +268,9 @@ public final class UrbanArea extends AbstractInstance } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if ((tmpworld != null) && (tmpworld instanceof UrbanAreaWorld)) - { + if ((tmpworld != null) && (tmpworld instanceof UrbanAreaWorld)) { UrbanAreaWorld world = (UrbanAreaWorld) tmpworld; world.isAmaskariDead = true; } @@ -334,37 +278,30 @@ public final class UrbanArea extends AbstractInstance } @Override - protected boolean checkConditions(L2PcInstance player) - { - if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) - { + protected boolean checkConditions(L2PcInstance player) { + if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) { return true; } final L2Party party = player.getParty(); - if ((party == null) || !party.isLeader(player)) - { + if ((party == null) || !party.isLeader(player)) { player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); return false; } - for (L2PcInstance partyMember : party.getMembers()) - { - if (partyMember.getLevel() < MIN_LV) - { + for (L2PcInstance partyMember : party.getMembers()) { + if (partyMember.getLevel() < MIN_LV) { party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addPcName(partyMember)); return false; } - if (!Util.checkIfInRange(1000, player, partyMember, true)) - { + if (!Util.checkIfInRange(1000, player, partyMember, true)) { party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED).addPcName(partyMember)); return false; } - if (InstanceManager.getInstance().getPlayerWorld(player) != null) - { + if (InstanceManager.getInstance().getPlayerWorld(player) != null) { party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON).addPcName(partyMember)); return false; } @@ -373,52 +310,38 @@ public final class UrbanArea extends AbstractInstance } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { - if (player.getParty() == null) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { + if (player.getParty() == null) { teleportPlayer(player, ENTRY_POINT, world.getInstanceId()); world.addAllowed(player.getObjectId()); - } - else - { - for (L2PcInstance partyMember : player.getParty().getMembers()) - { + } else { + for (L2PcInstance partyMember : player.getParty().getMembers()) { teleportPlayer(partyMember, ENTRY_POINT, world.getInstanceId()); world.addAllowed(partyMember.getObjectId()); } } ((UrbanAreaWorld) world).spawnedAmaskari = (L2MonsterInstance) addSpawn(AMASKARI, AMASKARI_SPAWN_POINT, false, 0, false, world.getInstanceId()); - } - else - { + } else { teleportPlayer(player, ENTRY_POINT, world.getInstanceId()); } } - private static class CallAmaskari implements Runnable - { + private static class CallAmaskari implements Runnable { private final L2Npc _caller; - public CallAmaskari(L2Npc caller) - { + public CallAmaskari(L2Npc caller) { _caller = caller; } @Override - public void run() - { - if ((_caller != null) && !_caller.isDead()) - { + public void run() { + if ((_caller != null) && !_caller.isDead()) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(_caller.getInstanceId()); - if ((tmpworld != null) && (tmpworld instanceof UrbanAreaWorld)) - { + if ((tmpworld != null) && (tmpworld instanceof UrbanAreaWorld)) { UrbanAreaWorld world = (UrbanAreaWorld) tmpworld; - if ((world.spawnedAmaskari != null) && !world.spawnedAmaskari.isDead()) - { + if ((world.spawnedAmaskari != null) && !world.spawnedAmaskari.isDead()) { world.spawnedAmaskari.teleToLocation(_caller.getLocation()); world.spawnedAmaskari.broadcastPacket(new NpcSay(world.spawnedAmaskari.getObjectId(), Say2.NPC_ALL, world.spawnedAmaskari.getId(), NpcStringId.ILL_MAKE_YOU_FEEL_SUFFERING_LIKE_A_FLAME_THAT_IS_NEVER_EXTINGUISHED)); } @@ -427,26 +350,20 @@ public final class UrbanArea extends AbstractInstance } } - private class ExitInstance implements Runnable - { + private class ExitInstance implements Runnable { private final L2Party _party; private final UrbanAreaWorld _world; - public ExitInstance(L2Party party, UrbanAreaWorld world) - { + public ExitInstance(L2Party party, UrbanAreaWorld world) { _party = party; _world = world; } @Override - public void run() - { - if ((_party != null) && (_world != null)) - { - for (L2PcInstance partyMember : _party.getMembers()) - { - if ((partyMember != null) && !partyMember.isDead()) - { + public void run() { + if ((_party != null) && (_world != null)) { + for (L2PcInstance partyMember : _party.getMembers()) { + if ((partyMember != null) && !partyMember.isDead()) { _world.removeAllowed(partyMember.getObjectId()); teleportPlayer(partyMember, EXIT_POINT, 0); } diff --git a/src/main/java/com/l2jserver/datapack/instances/AbstractInstance.java b/src/main/java/com/l2jserver/datapack/instances/AbstractInstance.java index bba1f54204..9961945871 100644 --- a/src/main/java/com/l2jserver/datapack/instances/AbstractInstance.java +++ b/src/main/java/com/l2jserver/datapack/instances/AbstractInstance.java @@ -43,30 +43,23 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Abstract class for Instances. * @author FallenAngel */ -public abstract class AbstractInstance extends AbstractNpcAI -{ - public AbstractInstance(String name, String desc) - { +public abstract class AbstractInstance extends AbstractNpcAI { + public AbstractInstance(String name, String desc) { super(name, desc); } - public AbstractInstance(String name) - { + public AbstractInstance(String name) { super(name, "instances"); } - protected void enterInstance(L2PcInstance player, InstanceWorld instance, String template, int templateId) - { + protected void enterInstance(L2PcInstance player, InstanceWorld instance, String template, int templateId) { final InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - if (world != null) - { - if (world.getTemplateId() == templateId) - { + if (world != null) { + if (world.getTemplateId() == templateId) { onEnterInstance(player, world, false); final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId()); - if (inst.isRemoveBuffEnabled()) - { + if (inst.isRemoveBuffEnabled()) { handleRemoveBuffs(player, world); } return; @@ -75,8 +68,7 @@ public abstract class AbstractInstance extends AbstractNpcAI return; } - if (checkConditions(player, templateId)) - { + if (checkConditions(player, templateId)) { instance.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template)); instance.setTemplateId(templateId); instance.setStatus(0); @@ -84,59 +76,47 @@ public abstract class AbstractInstance extends AbstractNpcAI onEnterInstance(player, instance, true); final Instance inst = InstanceManager.getInstance().getInstance(instance.getInstanceId()); - if (inst.getReenterType() == InstanceReenterType.ON_INSTANCE_ENTER) - { + if (inst.getReenterType() == InstanceReenterType.ON_INSTANCE_ENTER) { handleReenterTime(instance); } - if (inst.isRemoveBuffEnabled()) - { + if (inst.isRemoveBuffEnabled()) { handleRemoveBuffs(instance); } - if (general().instanceDebug()) - { + if (general().instanceDebug()) { _log.info("Instance " + inst.getName() + " (" + instance.getTemplateId() + ") has been created by player " + player.getName()); } } } - protected void finishInstance(InstanceWorld world) - { + protected void finishInstance(InstanceWorld world) { finishInstance(world, SECONDS.toMillis(general().getInstanceFinishTime())); } - protected void finishInstance(InstanceWorld world, long duration) - { + protected void finishInstance(InstanceWorld world, long duration) { final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId()); - if (inst.getReenterType() == InstanceReenterType.ON_INSTANCE_FINISH) - { + if (inst.getReenterType() == InstanceReenterType.ON_INSTANCE_FINISH) { handleReenterTime(world); } - if (duration == 0) - { + if (duration == 0) { InstanceManager.getInstance().destroyInstance(inst.getId()); - } - else if (duration > 0) - { + } else if (duration > 0) { inst.setDuration(duration); inst.setEmptyDestroyTime(0); } } - protected void handleReenterTime(InstanceWorld world) - { + protected void handleReenterTime(InstanceWorld world) { final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId()); final List<InstanceReenterTimeHolder> reenterData = inst.getReenterData(); long time = -1; - for (InstanceReenterTimeHolder data : reenterData) - { - if (data.getTime() > 0) - { + for (InstanceReenterTimeHolder data : reenterData) { + if (data.getTime() > 0) { time = System.currentTimeMillis() + data.getTime(); break; } @@ -147,43 +127,33 @@ public abstract class AbstractInstance extends AbstractNpcAI calendar.set(Calendar.MINUTE, data.getMinute()); calendar.set(Calendar.SECOND, 0); - if (calendar.getTimeInMillis() <= System.currentTimeMillis()) - { + if (calendar.getTimeInMillis() <= System.currentTimeMillis()) { calendar.add(Calendar.DAY_OF_MONTH, 1); } - if (data.getDay() != null) - { - while (calendar.get(Calendar.DAY_OF_WEEK) != (Math.min(data.getDay().getValue() + 1, 7))) - { + if (data.getDay() != null) { + while (calendar.get(Calendar.DAY_OF_WEEK) != (Math.min(data.getDay().getValue() + 1, 7))) { calendar.add(Calendar.DAY_OF_MONTH, 1); } } - if (time == -1) - { + if (time == -1) { time = calendar.getTimeInMillis(); - } - else if (calendar.getTimeInMillis() < time) - { + } else if (calendar.getTimeInMillis() < time) { time = calendar.getTimeInMillis(); } } - if (time > 0) - { + if (time > 0) { setReenterTime(world, time); } } - protected void handleRemoveBuffs(InstanceWorld world) - { - for (int objId : world.getAllowed()) - { + protected void handleRemoveBuffs(InstanceWorld world) { + for (int objId : world.getAllowed()) { final L2PcInstance player = L2World.getInstance().getPlayer(objId); - if (player != null) - { + if (player != null) { handleRemoveBuffs(player, world); } } @@ -191,13 +161,11 @@ public abstract class AbstractInstance extends AbstractNpcAI protected abstract void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance); - protected boolean checkConditions(L2PcInstance player, int templateId) - { + protected boolean checkConditions(L2PcInstance player, int templateId) { return checkConditions(player); } - protected boolean checkConditions(L2PcInstance player) - { + protected boolean checkConditions(L2PcInstance player) { return true; } @@ -207,8 +175,7 @@ public abstract class AbstractInstance extends AbstractNpcAI * @param instanceId the instance ID * @return list of spawned NPC's */ - protected List<L2Npc> spawnGroup(String groupName, int instanceId) - { + protected List<L2Npc> spawnGroup(String groupName, int instanceId) { return InstanceManager.getInstance().getInstance(instanceId).spawnGroup(groupName); } @@ -217,80 +184,60 @@ public abstract class AbstractInstance extends AbstractNpcAI * @param world the instance * @param time the time in milliseconds */ - protected void setReenterTime(InstanceWorld world, long time) - { - for (int objectId : world.getAllowed()) - { + protected void setReenterTime(InstanceWorld world, long time) { + for (int objectId : world.getAllowed()) { InstanceManager.getInstance().setInstanceTime(objectId, world.getTemplateId(), time); final L2PcInstance player = L2World.getInstance().getPlayer(objectId); - if ((player != null) && player.isOnline()) - { + if ((player != null) && player.isOnline()) { player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_FROM_HERE_S1_S_ENTRY_HAS_BEEN_RESTRICTED).addString(InstanceManager.getInstance().getInstance(world.getInstanceId()).getName())); } } - if (general().instanceDebug()) - { + if (general().instanceDebug()) { _log.info("Time restrictions has been set for player in instance ID: " + world.getInstanceId() + " (" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(time) + ")"); } } - private void handleRemoveBuffs(L2PcInstance player, InstanceWorld world) - { + private void handleRemoveBuffs(L2PcInstance player, InstanceWorld world) { final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId()); - switch (inst.getRemoveBuffType()) - { - case ALL: - { + switch (inst.getRemoveBuffType()) { + case ALL: { player.stopAllEffectsExceptThoseThatLastThroughDeath(); final L2Summon summon = player.getSummon(); - if (summon != null) - { + if (summon != null) { summon.stopAllEffectsExceptThoseThatLastThroughDeath(); } break; } - case WHITELIST: - { - for (BuffInfo info : player.getEffectList().getBuffs()) - { - if (!inst.getBuffExceptionList().contains(info.getSkill().getId())) - { + case WHITELIST: { + for (BuffInfo info : player.getEffectList().getBuffs()) { + if (!inst.getBuffExceptionList().contains(info.getSkill().getId())) { info.getEffected().getEffectList().stopSkillEffects(true, info.getSkill()); } } final L2Summon summon = player.getSummon(); - if (summon != null) - { - for (BuffInfo info : summon.getEffectList().getBuffs()) - { - if (!inst.getBuffExceptionList().contains(info.getSkill().getId())) - { + if (summon != null) { + for (BuffInfo info : summon.getEffectList().getBuffs()) { + if (!inst.getBuffExceptionList().contains(info.getSkill().getId())) { info.getEffected().getEffectList().stopSkillEffects(true, info.getSkill()); } } } break; } - case BLACKLIST: - { - for (BuffInfo info : player.getEffectList().getBuffs()) - { - if (inst.getBuffExceptionList().contains(info.getSkill().getId())) - { + case BLACKLIST: { + for (BuffInfo info : player.getEffectList().getBuffs()) { + if (inst.getBuffExceptionList().contains(info.getSkill().getId())) { info.getEffected().getEffectList().stopSkillEffects(true, info.getSkill()); } } final L2Summon summon = player.getSummon(); - if (summon != null) - { - for (BuffInfo info : summon.getEffectList().getBuffs()) - { - if (inst.getBuffExceptionList().contains(info.getSkill().getId())) - { + if (summon != null) { + for (BuffInfo info : summon.getEffectList().getBuffs()) { + if (inst.getBuffExceptionList().contains(info.getSkill().getId())) { info.getEffected().getEffectList().stopSkillEffects(true, info.getSkill()); } } diff --git a/src/main/java/com/l2jserver/datapack/instances/CastleDungeon/CastleDungeon.java b/src/main/java/com/l2jserver/datapack/instances/CastleDungeon/CastleDungeon.java index 1c36d4d054..ea109addb6 100644 --- a/src/main/java/com/l2jserver/datapack/instances/CastleDungeon/CastleDungeon.java +++ b/src/main/java/com/l2jserver/datapack/instances/CastleDungeon/CastleDungeon.java @@ -40,16 +40,13 @@ import com.l2jserver.gameserver.util.Util; * @author Adry_85 * @since 2.6.0.0 */ -public final class CastleDungeon extends AbstractInstance -{ - protected class CDWorld extends InstanceWorld - { +public final class CastleDungeon extends AbstractInstance { + protected class CDWorld extends InstanceWorld { } // Locations - private static final Location[] ENTER_LOC = - { + private static final Location[] ENTER_LOC = { new Location(12188, -48770, -3008), new Location(12218, -48770, -3008), new Location(12248, -48770, -3008), @@ -59,8 +56,7 @@ public final class CastleDungeon extends AbstractInstance // Misc private static final Map<Integer, Integer> CASTLE_DUNGEON = new HashMap<>(); private static final Map<Integer, List<Integer>> FORTRESS = new HashMap<>(); - static - { + static { CASTLE_DUNGEON.put(36403, 13); // Gludio CASTLE_DUNGEON.put(36404, 14); // Dion CASTLE_DUNGEON.put(36405, 15); // Giran @@ -82,28 +78,24 @@ public final class CastleDungeon extends AbstractInstance } // Raid Bosses - protected static final int[] RAIDS1 = - { + protected static final int[] RAIDS1 = { 25546, // Rhianna the Traitor 25549, // Tesla the Deceiver 25552, // Soul Hunter Chakundel }; - protected static final int[] RAIDS2 = - { + protected static final int[] RAIDS2 = { 25553, // Durango the Crusher 25554, // Brutus the Obstinate 25557, // Ranger Karankawa 25560, // Sargon the Mad }; - protected static final int[] RAIDS3 = - { + protected static final int[] RAIDS3 = { 25563, // Beautiful Atrielle 25566, // Nagen the Tomboy 25569, // Jax the Destroyer }; - public CastleDungeon() - { + public CastleDungeon() { super(CastleDungeon.class.getSimpleName()); addFirstTalkId(CASTLE_DUNGEON.keySet()); addStartNpc(CASTLE_DUNGEON.keySet()); @@ -114,19 +106,13 @@ public final class CastleDungeon extends AbstractInstance } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { - if (player.getParty() == null) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { + if (player.getParty() == null) { teleportPlayer(player, ENTER_LOC[getRandom(ENTER_LOC.length)], world.getInstanceId()); world.addAllowed(player.getObjectId()); - } - else - { - for (L2PcInstance partyMember : player.getParty().getMembers()) - { + } else { + for (L2PcInstance partyMember : player.getParty().getMembers()) { teleportPlayer(partyMember, ENTER_LOC[getRandom(ENTER_LOC.length)], world.getInstanceId()); world.addAllowed(partyMember.getObjectId()); } @@ -134,32 +120,24 @@ public final class CastleDungeon extends AbstractInstance world.setStatus(0); spawnRaid((CDWorld) world); - } - else - { + } else { teleportPlayer(player, ENTER_LOC[getRandom(ENTER_LOC.length)], world.getInstanceId()); } } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return "36403.html"; } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof CDWorld) - { + if (tmpworld instanceof CDWorld) { CDWorld world = (CDWorld) tmpworld; - if (Util.contains(RAIDS3, npc.getId())) - { + if (Util.contains(RAIDS3, npc.getId())) { finishInstance(world); - } - else - { + } else { world.incStatus(); spawnRaid(world); } @@ -168,43 +146,34 @@ public final class CastleDungeon extends AbstractInstance } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final L2Party party = player.getParty(); - if (party == null) - { + if (party == null) { return "36403-01.html"; } final Castle castle = npc.getCastle(); - if (castle.getSiege().isInProgress()) - { + if (castle.getSiege().isInProgress()) { return "36403-04.html"; } - if ((npc.isMyLord(player) || ((player.getClan() != null) && (npc.getCastle().getResidenceId() == player.getClan().getCastleId()) && (player.getClan().getCastleId() > 0)))) - { + if ((npc.isMyLord(player) || ((player.getClan() != null) && (npc.getCastle().getResidenceId() == player.getClan().getCastleId()) && (player.getClan().getCastleId() > 0)))) { final int numFort = ((castle.getResidenceId() == 1) || (castle.getResidenceId() == 5)) ? 2 : 1; final List<Integer> fort = FORTRESS.get(castle.getResidenceId()); - for (int i = 0; i < numFort; i++) - { + for (int i = 0; i < numFort; i++) { final Fort fortress = FortManager.getInstance().getFortById(fort.get(i)); - if (fortress.getFortState() == 0) - { + if (fortress.getFortState() == 0) { return "36403-05.html"; } } } - for (L2PcInstance partyMember : party.getMembers()) - { - if ((partyMember.getClan() == null) || (partyMember.getClan().getCastleId() != castle.getResidenceId())) - { + for (L2PcInstance partyMember : party.getMembers()) { + if ((partyMember.getClan() == null) || (partyMember.getClan().getCastleId() != castle.getResidenceId())) { return "36403-02.html"; } - if (System.currentTimeMillis() < InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), CASTLE_DUNGEON.get(npc.getId()))) - { + if (System.currentTimeMillis() < InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), CASTLE_DUNGEON.get(npc.getId()))) { return "36403-03.html"; } } @@ -213,19 +182,13 @@ public final class CastleDungeon extends AbstractInstance return super.onTalk(npc, player); } - protected void spawnRaid(CDWorld world) - { + protected void spawnRaid(CDWorld world) { int spawnId; - if (world.getStatus() == 0) - { + if (world.getStatus() == 0) { spawnId = RAIDS1[getRandom(RAIDS1.length)]; - } - else if (world.getStatus() == 1) - { + } else if (world.getStatus() == 1) { spawnId = RAIDS2[getRandom(RAIDS2.length)]; - } - else - { + } else { spawnId = RAIDS3[getRandom(RAIDS3.length)]; } diff --git a/src/main/java/com/l2jserver/datapack/instances/CavernOfThePirateCaptain/CavernOfThePirateCaptain.java b/src/main/java/com/l2jserver/datapack/instances/CavernOfThePirateCaptain/CavernOfThePirateCaptain.java index 9f98d36a6c..d8b711f879 100644 --- a/src/main/java/com/l2jserver/datapack/instances/CavernOfThePirateCaptain/CavernOfThePirateCaptain.java +++ b/src/main/java/com/l2jserver/datapack/instances/CavernOfThePirateCaptain/CavernOfThePirateCaptain.java @@ -38,10 +38,8 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Cavern Of The Pirate Captain (Day Dream) instance Zone. * @author St3eT */ -public final class CavernOfThePirateCaptain extends AbstractInstance -{ - protected class CavernOfThePirateCaptainWorld extends InstanceWorld - { +public final class CavernOfThePirateCaptain extends AbstractInstance { + protected class CavernOfThePirateCaptainWorld extends InstanceWorld { protected List<L2PcInstance> playersInside = new ArrayList<>(); protected L2Attackable _zaken; protected long storeTime = 0; @@ -70,14 +68,12 @@ public final class CavernOfThePirateCaptain extends AbstractInstance private static final int RED = 15281; // Transparent 1HS (for NPC) private static final int BLUE = 15302; // Transparent Bow (for NPC) // Locations - private static final Location[] ENTER_LOC = - { + private static final Location[] ENTER_LOC = { new Location(52684, 219989, -3496), new Location(52669, 219120, -3224), new Location(52672, 219439, -3312), }; - private static final Location[] CANDLE_LOC = - { + private static final Location[] CANDLE_LOC = { // Floor 1 new Location(53313, 220133, -3498), new Location(53313, 218079, -3498), @@ -151,8 +147,7 @@ public final class CavernOfThePirateCaptain extends AbstractInstance }; //@formatter:on - public CavernOfThePirateCaptain() - { + public CavernOfThePirateCaptain() { super(CavernOfThePirateCaptain.class.getSimpleName()); addStartNpc(PATHFINDER); addTalkId(PATHFINDER); @@ -161,57 +156,42 @@ public final class CavernOfThePirateCaptain extends AbstractInstance } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { final CavernOfThePirateCaptainWorld curworld = (CavernOfThePirateCaptainWorld) world; curworld._is83 = curworld.getTemplateId() == TEMPLATE_ID_83; curworld.storeTime = System.currentTimeMillis(); - if (!player.isInParty()) - { + if (!player.isInParty()) { managePlayerEnter(player, curworld); - } - else if (player.getParty().isInCommandChannel()) - { - for (L2PcInstance players : player.getParty().getCommandChannel().getMembers()) - { + } else if (player.getParty().isInCommandChannel()) { + for (L2PcInstance players : player.getParty().getCommandChannel().getMembers()) { managePlayerEnter(players, curworld); } - } - else - { - for (L2PcInstance players : player.getParty().getMembers()) - { + } else { + for (L2PcInstance players : player.getParty().getMembers()) { managePlayerEnter(players, curworld); } } manageNpcSpawn(curworld); - } - else - { + } else { teleportPlayer(player, ENTER_LOC[getRandom(ENTER_LOC.length)], world.getInstanceId(), false); } } - private void managePlayerEnter(L2PcInstance player, CavernOfThePirateCaptainWorld world) - { + private void managePlayerEnter(L2PcInstance player, CavernOfThePirateCaptainWorld world) { world.playersInside.add(player); world.addAllowed(player.getObjectId()); teleportPlayer(player, ENTER_LOC[getRandom(ENTER_LOC.length)], world.getInstanceId(), false); } @Override - protected boolean checkConditions(L2PcInstance player, int templateId) - { - if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) - { + protected boolean checkConditions(L2PcInstance player, int templateId) { + if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) { return true; } - if (!player.isInParty()) - { + if (!player.isInParty()) { broadcastSystemMessage(player, null, SystemMessageId.NOT_IN_PARTY_CANT_ENTER, false); return false; } @@ -222,35 +202,29 @@ public final class CavernOfThePirateCaptain extends AbstractInstance final List<L2PcInstance> members = (isInCC) ? party.getCommandChannel().getMembers() : party.getMembers(); final boolean isPartyLeader = (isInCC) ? party.getCommandChannel().isLeader(player) : party.isLeader(player); - if (!isPartyLeader) - { + if (!isPartyLeader) { broadcastSystemMessage(player, null, SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER, false); return false; } - if ((members.size() < (is83 ? PLAYERS_83_MIN : PLAYERS_60_MIN)) || (members.size() > (is83 ? PLAYERS_83_MAX : PLAYERS_60_MAX))) - { + if ((members.size() < (is83 ? PLAYERS_83_MIN : PLAYERS_60_MIN)) || (members.size() > (is83 ? PLAYERS_83_MAX : PLAYERS_60_MAX))) { broadcastSystemMessage(player, null, SystemMessageId.PARTY_EXCEEDED_THE_LIMIT_CANT_ENTER, false); return false; } - for (L2PcInstance groupMembers : members) - { - if (groupMembers.getLevel() < (is83 ? MIN_LV_83 : MIN_LV_60)) - { + for (L2PcInstance groupMembers : members) { + if (groupMembers.getLevel() < (is83 ? MIN_LV_83 : MIN_LV_60)) { broadcastSystemMessage(player, groupMembers, SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED, true); return false; } - if (!player.isInsideRadius(groupMembers, 1000, true, true)) - { + if (!player.isInsideRadius(groupMembers, 1000, true, true)) { broadcastSystemMessage(player, groupMembers, SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED, true); return false; } final Long reentertime = InstanceManager.getInstance().getInstanceTime(groupMembers.getObjectId(), (is83 ? TEMPLATE_ID_83 : TEMPLATE_ID_60)); - if (System.currentTimeMillis() < reentertime) - { + if (System.currentTimeMillis() < reentertime) { broadcastSystemMessage(player, groupMembers, SystemMessageId.C1_MAY_NOT_RE_ENTER_YET, true); return false; } @@ -258,84 +232,60 @@ public final class CavernOfThePirateCaptain extends AbstractInstance return true; } - private void broadcastSystemMessage(L2PcInstance player, L2PcInstance member, SystemMessageId msgId, boolean toGroup) - { + private void broadcastSystemMessage(L2PcInstance player, L2PcInstance member, SystemMessageId msgId, boolean toGroup) { final SystemMessage sm = SystemMessage.getSystemMessage(msgId); - if (toGroup) - { + if (toGroup) { sm.addPcName(member); - if (player.getParty().isInCommandChannel()) - { + if (player.getParty().isInCommandChannel()) { player.getParty().getCommandChannel().broadcastPacket(sm); - } - else - { + } else { player.getParty().broadcastPacket(sm); } - } - else - { + } else { player.broadcastPacket(sm); } } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equals("enter60")) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equals("enter60")) { enterInstance(player, new CavernOfThePirateCaptainWorld(), "CavernOfThePirateCaptainWorldDay60.xml", TEMPLATE_ID_60); - } - else if (event.equals("enter83")) - { + } else if (event.equals("enter83")) { enterInstance(player, new CavernOfThePirateCaptainWorld(), "CavernOfThePirateCaptainWorldDay83.xml", TEMPLATE_ID_83); - } - else - { + } else { final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if ((tmpworld != null) && (tmpworld instanceof CavernOfThePirateCaptainWorld)) - { + if ((tmpworld != null) && (tmpworld instanceof CavernOfThePirateCaptainWorld)) { final CavernOfThePirateCaptainWorld world = (CavernOfThePirateCaptainWorld) tmpworld; - switch (event) - { - case "BURN_BLUE": - { - if (npc.getRightHandItem() == 0) - { + switch (event) { + case "BURN_BLUE": { + if (npc.getRightHandItem() == 0) { npc.setRHandId(FIRE); startQuestTimer("BURN_BLUE2", 3000, npc, player); - if (world._blueFounded == 4) - { + if (world._blueFounded == 4) { startQuestTimer("SHOW_ZAKEN", 5000, npc, player); } } break; } - case "BURN_BLUE2": - { - if (npc.getRightHandItem() == FIRE) - { + case "BURN_BLUE2": { + if (npc.getRightHandItem() == FIRE) { npc.setRHandId(BLUE); } break; } - case "BURN_RED": - { - if (npc.getRightHandItem() == 0) - { + case "BURN_RED": { + if (npc.getRightHandItem() == 0) { npc.setRHandId(FIRE); startQuestTimer("BURN_RED2", 3000, npc, player); } break; } - case "BURN_RED2": - { - if (npc.getRightHandItem() == FIRE) - { + case "BURN_RED2": { + if (npc.getRightHandItem() == FIRE) { final int room = getRoomByCandle(npc); npc.setRHandId(RED); manageScreenMsg(world, NpcStringId.THE_CANDLES_CAN_LEAD_YOU_TO_ZAKEN_DESTROY_HIM); @@ -346,10 +296,8 @@ public final class CavernOfThePirateCaptain extends AbstractInstance } break; } - case "SHOW_ZAKEN": - { - if (world._is83) - { + case "SHOW_ZAKEN": { + if (world._is83) { manageScreenMsg(world, NpcStringId.WHO_DARES_AWKAWEN_THE_MIGHTY_ZAKEN); } world._zaken.setInvisible(false); @@ -366,39 +314,29 @@ public final class CavernOfThePirateCaptain extends AbstractInstance } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if ((tmpworld != null) && (tmpworld instanceof CavernOfThePirateCaptainWorld)) - { + if ((tmpworld != null) && (tmpworld instanceof CavernOfThePirateCaptainWorld)) { final CavernOfThePirateCaptainWorld world = (CavernOfThePirateCaptainWorld) tmpworld; - if (npc.getId() == ZAKEN_83) - { - for (L2PcInstance playersInside : world.playersInside) - { - if ((playersInside != null) && ((playersInside.getInstanceId() == world.getInstanceId()) && playersInside.isInsideRadius(npc, 1500, true, true))) - { + if (npc.getId() == ZAKEN_83) { + for (L2PcInstance playersInside : world.playersInside) { + if ((playersInside != null) && ((playersInside.getInstanceId() == world.getInstanceId()) && playersInside.isInsideRadius(npc, 1500, true, true))) { final long time = System.currentTimeMillis() - world.storeTime; if (time <= 300000) // 5 minutes { - if (getRandomBoolean()) - { + if (getRandomBoolean()) { giveItems(playersInside, VORPAL_RING, 1); } - } - else if (time <= 600000) // 10 minutes + } else if (time <= 600000) // 10 minutes { - if (getRandom(100) < 30) - { + if (getRandom(100) < 30) { giveItems(playersInside, VORPAL_EARRING, 1); } - } - else if (time <= 900000) // 15 minutes + } else if (time <= 900000) // 15 minutes { - if (getRandom(100) < 25) - { + if (getRandom(100) < 25) { giveItems(playersInside, VORPAL_RING, 1); } } @@ -411,24 +349,18 @@ public final class CavernOfThePirateCaptain extends AbstractInstance } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if ((tmpworld != null) && (tmpworld instanceof CavernOfThePirateCaptainWorld)) - { + if ((tmpworld != null) && (tmpworld instanceof CavernOfThePirateCaptainWorld)) { final CavernOfThePirateCaptainWorld world = (CavernOfThePirateCaptainWorld) tmpworld; final boolean isBlue = npc.getVariables().getInt("isBlue", 0) == 1; - if (npc.isScriptValue(0)) - { - if (isBlue) - { + if (npc.isScriptValue(0)) { + if (isBlue) { world._blueFounded++; startQuestTimer("BURN_BLUE", 500, npc, player); - } - else - { + } else { startQuestTimer("BURN_RED", 500, npc, player); } npc.setScriptValue(1); @@ -437,48 +369,35 @@ public final class CavernOfThePirateCaptain extends AbstractInstance return null; } - private int getRoomByCandle(L2Npc npc) - { + private int getRoomByCandle(L2Npc npc) { final int candleId = npc.getVariables().getInt("candleId", 0); - for (int i = 0; i < 15; i++) - { - if ((ROOM_DATA[i][3] == candleId) || (ROOM_DATA[i][4] == candleId)) - { + for (int i = 0; i < 15; i++) { + if ((ROOM_DATA[i][3] == candleId) || (ROOM_DATA[i][4] == candleId)) { return i + 1; } } - if ((candleId == 6) || (candleId == 7)) - { + if ((candleId == 6) || (candleId == 7)) { return 3; - } - else if ((candleId == 18) || (candleId == 19)) - { + } else if ((candleId == 18) || (candleId == 19)) { return 8; - } - else if ((candleId == 30) || (candleId == 31)) - { + } else if ((candleId == 30) || (candleId == 31)) { return 13; } return 0; } - private void manageScreenMsg(CavernOfThePirateCaptainWorld world, NpcStringId stringId) - { - for (L2PcInstance players : world.playersInside) - { - if ((players != null) && (players.getInstanceId() == world.getInstanceId())) - { + private void manageScreenMsg(CavernOfThePirateCaptainWorld world, NpcStringId stringId) { + for (L2PcInstance players : world.playersInside) { + if ((players != null) && (players.getInstanceId() == world.getInstanceId())) { showOnScreenMsg(players, stringId, 2, 6000); } } } - private L2Attackable spawnNpc(int npcId, int roomId, L2PcInstance player, CavernOfThePirateCaptainWorld world) - { - if ((player != null) && (npcId != ZAKEN_60) && (npcId != ZAKEN_83)) - { + private L2Attackable spawnNpc(int npcId, int roomId, L2PcInstance player, CavernOfThePirateCaptainWorld world) { + if ((player != null) && (npcId != ZAKEN_60) && (npcId != ZAKEN_83)) { final L2Attackable mob = (L2Attackable) addSpawn(npcId, ROOM_DATA[roomId - 1][0] + getRandom(350), ROOM_DATA[roomId - 1][1] + getRandom(350), ROOM_DATA[roomId - 1][2], 0, false, 0, false, world.getInstanceId()); addAttackDesire(mob, player); return mob; @@ -486,20 +405,17 @@ public final class CavernOfThePirateCaptain extends AbstractInstance return (L2Attackable) addSpawn(npcId, ROOM_DATA[roomId - 1][0], ROOM_DATA[roomId - 1][1], ROOM_DATA[roomId - 1][2], 0, false, 0, false, world.getInstanceId()); } - private void manageNpcSpawn(CavernOfThePirateCaptainWorld world) - { + private void manageNpcSpawn(CavernOfThePirateCaptainWorld world) { final List<L2Npc> candles = new ArrayList<>(); world._zakenRoom = getRandom(1, 15); - for (int i = 0; i < 36; i++) - { + for (int i = 0; i < 36; i++) { final L2Npc candle = addSpawn(CANDLE, CANDLE_LOC[i], false, 0, false, world.getInstanceId()); candle.getVariables().set("candleId", i + 1); candles.add(candle); } - for (int i = 3; i < 7; i++) - { + for (int i = 3; i < 7; i++) { candles.get(ROOM_DATA[world._zakenRoom - 1][i] - 1).getVariables().set("isBlue", 1); } world._zaken = spawnNpc(world._is83 ? ZAKEN_83 : ZAKEN_60, world._zakenRoom, null, world); diff --git a/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/Chamber.java b/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/Chamber.java index 978e9c1a1d..e598897083 100644 --- a/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/Chamber.java +++ b/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/Chamber.java @@ -51,69 +51,53 @@ import com.l2jserver.gameserver.util.Util; * Chambers of Delusion superclass. * @author GKR */ -public abstract class Chamber extends AbstractInstance -{ - protected class CDWorld extends InstanceWorld - { +public abstract class Chamber extends AbstractInstance { + protected class CDWorld extends InstanceWorld { protected int currentRoom; protected final L2Party partyInside; protected final ScheduledFuture<?> _banishTask; protected ScheduledFuture<?> _roomChangeTask; - protected CDWorld(L2Party party) - { + protected CDWorld(L2Party party) { currentRoom = 0; partyInside = party; _banishTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new BanishTask(), 60000, 60000); } - protected L2Party getPartyInside() - { + protected L2Party getPartyInside() { return partyInside; } - protected void scheduleRoomChange(boolean bossRoom) - { + protected void scheduleRoomChange(boolean bossRoom) { final Instance inst = InstanceManager.getInstance().getInstance(getInstanceId()); final long nextInterval = bossRoom ? 60000L : (ROOM_CHANGE_INTERVAL + getRandom(ROOM_CHANGE_RANDOM_TIME)) * 1000L; // Schedule next room change only if remaining time is enough - if ((inst.getInstanceEndTime() - System.currentTimeMillis()) > nextInterval) - { + if ((inst.getInstanceEndTime() - System.currentTimeMillis()) > nextInterval) { _roomChangeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeRoomTask(), nextInterval - 5000); } } - protected void stopBanishTask() - { + protected void stopBanishTask() { _banishTask.cancel(true); } - protected void stopRoomChangeTask() - { + protected void stopRoomChangeTask() { _roomChangeTask.cancel(true); } - protected class BanishTask implements Runnable - { + protected class BanishTask implements Runnable { @Override - public void run() - { + public void run() { final Instance inst = InstanceManager.getInstance().getInstance(getInstanceId()); - if ((inst == null) || ((inst.getInstanceEndTime() - System.currentTimeMillis()) < 60000)) - { + if ((inst == null) || ((inst.getInstanceEndTime() - System.currentTimeMillis()) < 60000)) { _banishTask.cancel(false); - } - else - { - for (int objId : inst.getPlayers()) - { + } else { + for (int objId : inst.getPlayers()) { final L2PcInstance pl = L2World.getInstance().getPlayer(objId); - if ((pl != null) && pl.isOnline()) - { - if ((partyInside == null) || !pl.isInParty() || (partyInside != pl.getParty())) - { + if ((pl != null) && pl.isOnline()) { + if ((partyInside == null) || !pl.isInParty() || (partyInside != pl.getParty())) { exitInstance(pl); } } @@ -122,19 +106,14 @@ public abstract class Chamber extends AbstractInstance } } - protected class ChangeRoomTask implements Runnable - { + protected class ChangeRoomTask implements Runnable { @Override - public void run() - { - try - { + public void run() { + try { earthQuake(CDWorld.this); Thread.sleep(5000); changeRoom(CDWorld.this); - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, getClass().getSimpleName() + " ChangeRoomTask exception : " + e.getMessage(), e); } } @@ -174,8 +153,7 @@ public abstract class Chamber extends AbstractInstance // Misc private static final String RETURN = Chamber.class.getSimpleName() + "_return"; - protected Chamber(String name, String descr, int instanceId, String instanceTemplateName, int entranceGKId, int roomGKFirstId, int roomGKLastId, int aenkinelId, int boxId) - { + protected Chamber(String name, String descr, int instanceId, String instanceTemplateName, int entranceGKId, int roomGKFirstId, int roomGKLastId, int aenkinelId, int boxId) { super(name, descr); INSTANCEID = instanceId; @@ -188,8 +166,7 @@ public abstract class Chamber extends AbstractInstance addStartNpc(ENTRANCE_GATEKEEPER); addTalkId(ENTRANCE_GATEKEEPER); - for (int i = ROOM_GATEKEEPER_FIRST; i <= ROOM_GATEKEEPER_LAST; i++) - { + for (int i = ROOM_GATEKEEPER_FIRST; i <= ROOM_GATEKEEPER_LAST; i++) { addStartNpc(i); addTalkId(i); } @@ -199,56 +176,46 @@ public abstract class Chamber extends AbstractInstance addEventReceivedId(BOX); } - private boolean isBigChamber() - { + private boolean isBigChamber() { return ((INSTANCEID == 131) || (INSTANCEID == 132)); } - private boolean isBossRoom(CDWorld world) - { + private boolean isBossRoom(CDWorld world) { return (world.currentRoom == (ROOM_ENTER_POINTS.length - 1)); } @Override - protected boolean checkConditions(L2PcInstance player) - { + protected boolean checkConditions(L2PcInstance player) { final L2Party party = player.getParty(); - if (party == null) - { + if (party == null) { player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NOT_IN_PARTY_CANT_ENTER)); return false; } - if (party.getLeader() != player) - { + if (party.getLeader() != player) { player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER)); return false; } - for (L2PcInstance partyMember : party.getMembers()) - { - if (partyMember.getLevel() < 80) - { + for (L2PcInstance partyMember : party.getMembers()) { + if (partyMember.getLevel() < 80) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; } - if (!Util.checkIfInRange(1000, player, partyMember, true)) - { + if (!Util.checkIfInRange(1000, player, partyMember, true)) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; } - if (isBigChamber()) - { + if (isBigChamber()) { final long reentertime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), INSTANCEID); - if (System.currentTimeMillis() < reentertime) - { + if (System.currentTimeMillis() < reentertime) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET); sm.addPcName(partyMember); party.broadcastPacket(sm); @@ -260,26 +227,21 @@ public abstract class Chamber extends AbstractInstance return true; } - private void markRestriction(InstanceWorld world) - { - if (world instanceof CDWorld) - { + private void markRestriction(InstanceWorld world) { + if (world instanceof CDWorld) { final Calendar reenter = Calendar.getInstance(); final Calendar now = Calendar.getInstance(); reenter.set(Calendar.MINUTE, RESET_MIN); reenter.set(Calendar.HOUR_OF_DAY, RESET_HOUR); - if (reenter.before(now)) - { + if (reenter.before(now)) { reenter.add(Calendar.DAY_OF_WEEK, 1); } final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_FROM_HERE_S1_S_ENTRY_HAS_BEEN_RESTRICTED); sm.addString(InstanceManager.getInstance().getInstanceIdName(world.getTemplateId())); // set instance reenter time for all allowed players - for (int objectId : world.getAllowed()) - { + for (int objectId : world.getAllowed()) { final L2PcInstance player = L2World.getInstance().getPlayer(objectId); - if ((player != null) && player.isOnline()) - { + if ((player != null) && player.isOnline()) { InstanceManager.getInstance().setInstanceTime(objectId, world.getTemplateId(), reenter.getTimeInMillis()); player.sendPacket(sm); } @@ -287,48 +249,40 @@ public abstract class Chamber extends AbstractInstance } } - protected void changeRoom(CDWorld world) - { + protected void changeRoom(CDWorld world) { final L2Party party = world.getPartyInside(); final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId()); - if ((party == null) || (inst == null)) - { + if ((party == null) || (inst == null)) { return; } int newRoom = world.currentRoom; // Do nothing, if there are raid room of Sqare or Tower Chamber - if (isBigChamber() && isBossRoom(world)) - { + if (isBigChamber() && isBossRoom(world)) { return; } // Teleport to raid room 10 min or lesser before instance end time for Tower and Square Chambers - else if (isBigChamber() && ((inst.getInstanceEndTime() - System.currentTimeMillis()) < 600000)) - { + else if (isBigChamber() && ((inst.getInstanceEndTime() - System.currentTimeMillis()) < 600000)) { newRoom = ROOM_ENTER_POINTS.length - 1; } // 10% chance for teleport to raid room if not here already for Northern, Southern, Western and Eastern Chambers - else if (!isBigChamber() && !isBossRoom(world) && (getRandom(100) < 10)) - { + else if (!isBigChamber() && !isBossRoom(world) && (getRandom(100) < 10)) { newRoom = ROOM_ENTER_POINTS.length - 1; } - else - { + else { while (newRoom == world.currentRoom) // otherwise teleport to another room, except current { newRoom = getRandom(ROOM_ENTER_POINTS.length - 1); } } - for (L2PcInstance partyMember : party.getMembers()) - { - if (world.getInstanceId() == partyMember.getInstanceId()) - { + for (L2PcInstance partyMember : party.getMembers()) { + if (world.getInstanceId() == partyMember.getInstanceId()) { partyMember.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); teleportPlayer(partyMember, ROOM_ENTER_POINTS[newRoom], world.getInstanceId()); } @@ -337,42 +291,32 @@ public abstract class Chamber extends AbstractInstance world.currentRoom = newRoom; // Do not schedule room change for Square and Tower Chambers, if raid room is reached - if (isBigChamber() && isBossRoom(world)) - { + if (isBigChamber() && isBossRoom(world)) { inst.setDuration((int) ((inst.getInstanceEndTime() - System.currentTimeMillis()) + 1200000)); // Add 20 min to instance time if raid room is reached - for (L2Npc npc : inst.getNpcs()) - { - if (npc.getId() == ROOM_GATEKEEPER_LAST) - { + for (L2Npc npc : inst.getNpcs()) { + if (npc.getId() == ROOM_GATEKEEPER_LAST) { npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.N21_MINUTES_ARE_ADDED_TO_THE_REMAINING_TIME_IN_THE_INSTANT_ZONE)); } } - } - else - { + } else { world.scheduleRoomChange(false); } } - private void enter(CDWorld world) - { + private void enter(CDWorld world) { final L2Party party = world.getPartyInside(); - if (party == null) - { + if (party == null) { return; } - for (L2PcInstance partyMember : party.getMembers()) - { - if (hasQuestItems(partyMember, DELUSION_MARK)) - { + for (L2PcInstance partyMember : party.getMembers()) { + if (hasQuestItems(partyMember, DELUSION_MARK)) { takeItems(partyMember, DELUSION_MARK, -1); } - if (party.isLeader(partyMember)) - { + if (party.isLeader(partyMember)) { giveItems(partyMember, DELUSION_MARK, 1); } @@ -386,137 +330,103 @@ public abstract class Chamber extends AbstractInstance changeRoom(world); } - protected void earthQuake(CDWorld world) - { + protected void earthQuake(CDWorld world) { final L2Party party = world.getPartyInside(); - if (party == null) - { + if (party == null) { return; } - for (L2PcInstance partyMember : party.getMembers()) - { - if (world.getInstanceId() == partyMember.getInstanceId()) - { + for (L2PcInstance partyMember : party.getMembers()) { + if (world.getInstanceId() == partyMember.getInstanceId()) { partyMember.sendPacket(new Earthquake(partyMember.getX(), partyMember.getY(), partyMember.getZ(), 20, 10)); } } } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { enter((CDWorld) world); - } - else - { + } else { final CDWorld currentWorld = (CDWorld) world; teleportPlayer(player, ROOM_ENTER_POINTS[currentWorld.currentRoom], world.getInstanceId()); } } - protected void exitInstance(L2PcInstance player) - { - if ((player == null) || !player.isOnline() || (player.getInstanceId() == 0)) - { + protected void exitInstance(L2PcInstance player) { + if ((player == null) || !player.isOnline() || (player.getInstanceId() == 0)) { return; } final Instance inst = InstanceManager.getInstance().getInstance(player.getInstanceId()); Location ret = inst.getExitLoc(); final String return_point = player.getVariables().getString(RETURN, null); - if (return_point != null) - { + if (return_point != null) { String[] coords = return_point.split(";"); - if (coords.length == 3) - { - try - { + if (coords.length == 3) { + try { int x = Integer.parseInt(coords[0]); int y = Integer.parseInt(coords[1]); int z = Integer.parseInt(coords[2]); ret.setLocation(new Location(x, y, z)); - } - catch (Exception e) - { + } catch (Exception e) { } } } teleportPlayer(player, ret, 0); final InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - if (world != null) - { + if (world != null) { world.removeAllowed((player.getObjectId())); } } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = ""; final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if ((player != null) && (tmpworld != null) && (tmpworld instanceof CDWorld) && (npc.getId() >= ROOM_GATEKEEPER_FIRST) && (npc.getId() <= ROOM_GATEKEEPER_LAST)) - { + if ((player != null) && (tmpworld != null) && (tmpworld instanceof CDWorld) && (npc.getId() >= ROOM_GATEKEEPER_FIRST) && (npc.getId() <= ROOM_GATEKEEPER_LAST)) { final CDWorld world = (CDWorld) tmpworld; // Change room from dialog - if (event.equals("next_room")) - { - if (player.getParty() == null) - { + if (event.equals("next_room")) { + if (player.getParty() == null) { htmltext = getHtm(player.getHtmlPrefix(), "data/scripts/instances/ChambersOfDelusion/no_party.html"); } - else if (player.getParty().getLeaderObjectId() != player.getObjectId()) - { + else if (player.getParty().getLeaderObjectId() != player.getObjectId()) { htmltext = getHtm(player.getHtmlPrefix(), "data/scripts/instances/ChambersOfDelusion/no_leader.html"); } - else if (hasQuestItems(player, DELUSION_MARK)) - { + else if (hasQuestItems(player, DELUSION_MARK)) { takeItems(player, DELUSION_MARK, 1); world.stopRoomChangeTask(); changeRoom(world); } - else - { + else { htmltext = getHtm(player.getHtmlPrefix(), "data/scripts/instances/ChambersOfDelusion/no_item.html"); } - } - else if (event.equals("go_out")) - { - if (player.getParty() == null) - { + } else if (event.equals("go_out")) { + if (player.getParty() == null) { htmltext = getHtm(player.getHtmlPrefix(), "data/scripts/instances/ChambersOfDelusion/no_party.html"); - } - else if (player.getParty().getLeaderObjectId() != player.getObjectId()) - { + } else if (player.getParty().getLeaderObjectId() != player.getObjectId()) { htmltext = getHtm(player.getHtmlPrefix(), "data/scripts/instances/ChambersOfDelusion/no_leader.html"); - } - else - { + } else { final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId()); world.stopRoomChangeTask(); world.stopBanishTask(); - for (L2PcInstance partyMember : player.getParty().getMembers()) - { + for (L2PcInstance partyMember : player.getParty().getMembers()) { exitInstance(partyMember); } inst.setEmptyDestroyTime(0); } - } - else if (event.equals("look_party")) - { - if ((player.getParty() != null) && (player.getParty() == world.getPartyInside())) - { + } else if (event.equals("look_party")) { + if ((player.getParty() != null) && (player.getParty() == world.getPartyInside())) { teleportPlayer(player, ROOM_ENTER_POINTS[world.currentRoom], world.getInstanceId(), false); } } @@ -526,35 +436,27 @@ public abstract class Chamber extends AbstractInstance } @Override - public String onAttack(final L2Npc npc, final L2PcInstance attacker, final int damage, final boolean isPet, final Skill skill) - { - if (!npc.isBusy() && (npc.getCurrentHp() < (npc.getMaxHp() / 10))) - { + public String onAttack(final L2Npc npc, final L2PcInstance attacker, final int damage, final boolean isPet, final Skill skill) { + if (!npc.isBusy() && (npc.getCurrentHp() < (npc.getMaxHp() / 10))) { npc.setBusy(true); if (getRandom(100) < 25) // 25% chance to reward { - if (getRandom(100) < 33) - { + if (getRandom(100) < 33) { npc.dropItem(attacker, ENRIA, (int) (3 * rates().getRateQuestDrop())); } - if (getRandom(100) < 50) - { + if (getRandom(100) < 50) { npc.dropItem(attacker, THONS, (int) (4 * rates().getRateQuestDrop())); } - if (getRandom(100) < 50) - { + if (getRandom(100) < 50) { npc.dropItem(attacker, ASOFE, (int) (4 * rates().getRateQuestDrop())); } - if (getRandom(100) < 16) - { + if (getRandom(100) < 16) { npc.dropItem(attacker, LEONARD, (int) (2 * rates().getRateQuestDrop())); } npc.broadcastEvent("SCE_LUCKY", 2000, null); npc.doCast(SUCCESS_SKILL); - } - else - { + } else { npc.broadcastEvent("SCE_DREAM_FIRE_IN_THE_HOLE", 2000, null); } } @@ -563,10 +465,8 @@ public abstract class Chamber extends AbstractInstance } @Override - public String onEventReceived(String eventName, L2Npc sender, L2Npc receiver, L2Object reference) - { - switch (eventName) - { + public String onEventReceived(String eventName, L2Npc sender, L2Npc receiver, L2Object reference) { + switch (eventName) { case "SCE_LUCKY": receiver.setBusy(true); receiver.doCast(SUCCESS_SKILL); @@ -581,24 +481,18 @@ public abstract class Chamber extends AbstractInstance } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) { final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player); - if ((tmpworld != null) && (tmpworld instanceof CDWorld)) - { + if ((tmpworld != null) && (tmpworld instanceof CDWorld)) { final CDWorld world = (CDWorld) tmpworld; final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId()); - if (isBigChamber()) - { + if (isBigChamber()) { markRestriction(world); // Set reenter restriction - if ((inst.getInstanceEndTime() - System.currentTimeMillis()) > 300000) - { + if ((inst.getInstanceEndTime() - System.currentTimeMillis()) > 300000) { inst.setDuration(300000); // Finish instance in 5 minutes } - } - else - { + } else { world.stopRoomChangeTask(); world.scheduleRoomChange(true); } @@ -610,30 +504,24 @@ public abstract class Chamber extends AbstractInstance } @Override - public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) - { - if ((npc.getId() == BOX) && ((skill.getId() == 5376) || (skill.getId() == 5758)) && !npc.isDead()) - { + public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) { + if ((npc.getId() == BOX) && ((skill.getId() == 5376) || (skill.getId() == 5758)) && !npc.isDead()) { npc.doDie(player); } return super.onSpellFinished(npc, player, skill); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { int npcId = npc.getId(); QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { st = newQuestState(player); } - if (npcId == ENTRANCE_GATEKEEPER) - { - if (checkConditions(player)) - { + if (npcId == ENTRANCE_GATEKEEPER) { + if (checkConditions(player)) { final L2Party party = player.getParty(); enterInstance(player, new CDWorld(party), INSTANCE_TEMPLATE, INSTANCEID); } diff --git a/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/ChamberOfDelusionEast.java b/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/ChamberOfDelusionEast.java index eee6125b35..d756724c21 100644 --- a/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/ChamberOfDelusionEast.java +++ b/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/ChamberOfDelusionEast.java @@ -24,8 +24,7 @@ import com.l2jserver.gameserver.model.Location; * Chamber of Delusion East. * @author GKR */ -public final class ChamberOfDelusionEast extends Chamber -{ +public final class ChamberOfDelusionEast extends Chamber { // NPCs private static final int ENTRANCE_GATEKEEPER = 32658; private static final int ROOM_GATEKEEPER_FIRST = 32664; @@ -34,8 +33,7 @@ public final class ChamberOfDelusionEast extends Chamber private static final int BOX = 18838; // Misc - private static final Location[] ENTER_POINTS = new Location[] - { + private static final Location[] ENTER_POINTS = new Location[] { new Location(-122368, -218972, -6720), new Location(-122352, -218044, -6720), new Location(-122368, -220220, -6720), @@ -45,8 +43,7 @@ public final class ChamberOfDelusionEast extends Chamber private static final int INSTANCEID = 127; private static final String INSTANCE_TEMPLATE = "ChamberOfDelusionEast.xml"; - public ChamberOfDelusionEast() - { + public ChamberOfDelusionEast() { super(ChamberOfDelusionEast.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX); ROOM_ENTER_POINTS = ENTER_POINTS; } diff --git a/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/ChamberOfDelusionNorth.java b/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/ChamberOfDelusionNorth.java index 5fe1a5f267..4b651c7b2c 100644 --- a/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/ChamberOfDelusionNorth.java +++ b/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/ChamberOfDelusionNorth.java @@ -24,8 +24,7 @@ import com.l2jserver.gameserver.model.Location; * Chamber of Delusion North. * @author GKR */ -public final class ChamberOfDelusionNorth extends Chamber -{ +public final class ChamberOfDelusionNorth extends Chamber { // NPC's private static final int ENTRANCE_GATEKEEPER = 32661; private static final int ROOM_GATEKEEPER_FIRST = 32679; @@ -34,8 +33,7 @@ public final class ChamberOfDelusionNorth extends Chamber private static final int BOX = 18838; // Misc - private static final Location[] ENTER_POINTS = new Location[] - { + private static final Location[] ENTER_POINTS = new Location[] { new Location(-108976, -207772, -6720), new Location(-108976, -206972, -6720), new Location(-108960, -209164, -6720), @@ -45,8 +43,7 @@ public final class ChamberOfDelusionNorth extends Chamber private static final int INSTANCEID = 130; // this is the client number private static final String INSTANCE_TEMPLATE = "ChamberOfDelusionNorth.xml"; - public ChamberOfDelusionNorth() - { + public ChamberOfDelusionNorth() { super(ChamberOfDelusionNorth.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX); ROOM_ENTER_POINTS = ENTER_POINTS; } diff --git a/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/ChamberOfDelusionSouth.java b/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/ChamberOfDelusionSouth.java index ebdb2207d9..d8e7a9ebd8 100644 --- a/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/ChamberOfDelusionSouth.java +++ b/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/ChamberOfDelusionSouth.java @@ -24,8 +24,7 @@ import com.l2jserver.gameserver.model.Location; * Chamber of Delusion South. * @author GKR */ -public final class ChamberOfDelusionSouth extends Chamber -{ +public final class ChamberOfDelusionSouth extends Chamber { // NPC's private static final int ENTRANCE_GATEKEEPER = 32660; private static final int ROOM_GATEKEEPER_FIRST = 32674; @@ -34,8 +33,7 @@ public final class ChamberOfDelusionSouth extends Chamber private static final int BOX = 18838; // Misc - private static final Location[] ENTER_POINTS = new Location[] - { + private static final Location[] ENTER_POINTS = new Location[] { new Location(-122368, -207820, -6720), new Location(-122368, -206940, -6720), new Location(-122368, -209116, -6720), @@ -45,8 +43,7 @@ public final class ChamberOfDelusionSouth extends Chamber private static final int INSTANCEID = 129; // this is the client number private static final String INSTANCE_TEMPLATE = "ChamberOfDelusionSouth.xml"; - public ChamberOfDelusionSouth() - { + public ChamberOfDelusionSouth() { super(ChamberOfDelusionSouth.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX); ROOM_ENTER_POINTS = ENTER_POINTS; } diff --git a/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/ChamberOfDelusionSquare.java b/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/ChamberOfDelusionSquare.java index 40c3d56ed1..73d7e83501 100644 --- a/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/ChamberOfDelusionSquare.java +++ b/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/ChamberOfDelusionSquare.java @@ -24,8 +24,7 @@ import com.l2jserver.gameserver.model.Location; * Chamber of Delusion Square. * @author GKR */ -public final class ChamberOfDelusionSquare extends Chamber -{ +public final class ChamberOfDelusionSquare extends Chamber { // NPC's private static final int ENTRANCE_GATEKEEPER = 32662; private static final int ROOM_GATEKEEPER_FIRST = 32684; @@ -34,8 +33,7 @@ public final class ChamberOfDelusionSquare extends Chamber private static final int BOX = 18820; // Misc - private static final Location[] ENTER_POINTS = new Location[] - { + private static final Location[] ENTER_POINTS = new Location[] { new Location(-122368, -153388, -6688), new Location(-122368, -152524, -6688), new Location(-120480, -155116, -6688), @@ -49,8 +47,7 @@ public final class ChamberOfDelusionSquare extends Chamber private static final int INSTANCEID = 131; private static final String INSTANCE_TEMPLATE = "ChamberOfDelusionSquare.xml"; - public ChamberOfDelusionSquare() - { + public ChamberOfDelusionSquare() { super(ChamberOfDelusionSquare.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX); ROOM_ENTER_POINTS = ENTER_POINTS; } diff --git a/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/ChamberOfDelusionTower.java b/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/ChamberOfDelusionTower.java index 6bbe372908..fe653e8802 100644 --- a/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/ChamberOfDelusionTower.java +++ b/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/ChamberOfDelusionTower.java @@ -24,8 +24,7 @@ import com.l2jserver.gameserver.model.Location; * Chamber of Delusion Tower. * @author GKR */ -public final class ChamberOfDelusionTower extends Chamber -{ +public final class ChamberOfDelusionTower extends Chamber { // NPC's private static final int ENTRANCE_GATEKEEPER = 32663; private static final int ROOM_GATEKEEPER_FIRST = 32693; @@ -34,8 +33,7 @@ public final class ChamberOfDelusionTower extends Chamber private static final int BOX = 18823; // Misc - private static final Location[] ENTER_POINTS = new Location[] - { + private static final Location[] ENTER_POINTS = new Location[] { new Location(-108976, -153372, -6688), new Location(-108960, -152524, -6688), new Location(-107088, -155052, -6688), @@ -49,8 +47,7 @@ public final class ChamberOfDelusionTower extends Chamber private static final int INSTANCEID = 132; // this is the client number private static final String INSTANCE_TEMPLATE = "ChamberOfDelusionTower.xml"; - public ChamberOfDelusionTower() - { + public ChamberOfDelusionTower() { super(ChamberOfDelusionTower.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX); ROOM_ENTER_POINTS = ENTER_POINTS; } diff --git a/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/ChamberOfDelusionWest.java b/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/ChamberOfDelusionWest.java index b288c5f2cd..fb86baef26 100644 --- a/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/ChamberOfDelusionWest.java +++ b/src/main/java/com/l2jserver/datapack/instances/ChambersOfDelusion/ChamberOfDelusionWest.java @@ -24,8 +24,7 @@ import com.l2jserver.gameserver.model.Location; * Chamber of Delusion West. * @author GKR */ -public final class ChamberOfDelusionWest extends Chamber -{ +public final class ChamberOfDelusionWest extends Chamber { // NPC's private static final int ENTRANCE_GATEKEEPER = 32659; private static final int ROOM_GATEKEEPER_FIRST = 32669; @@ -34,8 +33,7 @@ public final class ChamberOfDelusionWest extends Chamber private static final int BOX = 18838; // Misc - private static final Location[] ENTER_POINTS = new Location[] - { + private static final Location[] ENTER_POINTS = new Location[] { new Location(-108960, -218892, -6720), new Location(-108976, -218028, -6720), new Location(-108960, -220204, -6720), @@ -45,8 +43,7 @@ public final class ChamberOfDelusionWest extends Chamber private static final int INSTANCEID = 128; // this is the client number private static final String INSTANCE_TEMPLATE = "ChamberOfDelusionWest.xml"; - public ChamberOfDelusionWest() - { + public ChamberOfDelusionWest() { super(ChamberOfDelusionWest.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX); ROOM_ENTER_POINTS = ENTER_POINTS; } diff --git a/src/main/java/com/l2jserver/datapack/instances/CrystalCaverns/CrystalCaverns.java b/src/main/java/com/l2jserver/datapack/instances/CrystalCaverns/CrystalCaverns.java index 82a23d94b1..39820005a6 100644 --- a/src/main/java/com/l2jserver/datapack/instances/CrystalCaverns/CrystalCaverns.java +++ b/src/main/java/com/l2jserver/datapack/instances/CrystalCaverns/CrystalCaverns.java @@ -73,17 +73,14 @@ import com.l2jserver.gameserver.util.Util; * 4. Baylor Raid is missing a lot of things This script takes the best elements of different versions and combines them into one script to get the most optimal and retail-like experience.<br> * Original sources: theone, L2JEmu, L2JOfficial, L2JFree Contributing authors: TGS, Lantoc, Janiii, Gigiikun, RosT Please maintain consistency between the Crystal Caverns scripts. */ -public final class CrystalCaverns extends AbstractInstance -{ - protected static class CrystalGolem - { +public final class CrystalCaverns extends AbstractInstance { + protected static class CrystalGolem { protected L2ItemInstance foodItem = null; protected boolean isAtDestination = false; protected Location oldLoc = null; } - private class CCWorld extends InstanceWorld - { + private class CCWorld extends InstanceWorld { public Map<L2Npc, Boolean> npcList1 = new HashMap<>(); public L2Npc tears; public boolean isUsedInvulSkill = false; @@ -94,15 +91,13 @@ public final class CrystalCaverns extends AbstractInstance public List<L2Npc> copys = new ArrayList<>(); public Map<L2Npc, CrystalGolem> crystalGolems = new HashMap<>(); public int correctGolems = 0; - public boolean[] OracleTriggered = - { + public boolean[] OracleTriggered = { false, false, false }; public int kechisHenchmanSpawn = 0; - public int[] roomsStatus = - { + public int[] roomsStatus = { 0, 0, 0, @@ -124,8 +119,7 @@ public final class CrystalCaverns extends AbstractInstance protected L2Npc _baylor = null; protected L2Npc _alarm = null; - public CCWorld(Long time) - { + public CCWorld(Long time) { endTime = time; } } @@ -146,8 +140,7 @@ public final class CrystalCaverns extends AbstractInstance private static final int ORACLE_GUIDE_3 = 32280; private static final int ORACLE_GUIDE_4 = 32279; private static final int CRYSTALLINE_GOLEM = 32328; - private static final int[] DOOR_OPENING_TRAP = - { + private static final int[] DOOR_OPENING_TRAP = { 18378, 143680, 142608, @@ -169,8 +162,7 @@ public final class CrystalCaverns extends AbstractInstance private static final int BAYLOR = 29099; private static final int DARNEL = 25531; private static final int ALARM = 18474; - private static final int[] CGMOBS = - { + private static final int[] CGMOBS = { 22311, 22312, 22313, @@ -179,8 +171,7 @@ public final class CrystalCaverns extends AbstractInstance 22316, 22317 }; - private static final int[] SPAWN = - { + private static final int[] SPAWN = { 60000, 120000, 90000, @@ -188,8 +179,7 @@ public final class CrystalCaverns extends AbstractInstance 50000, 40000 }; // Kechi Hencmans spawn times - private static final int[] MOBLIST = - { + private static final int[] MOBLIST = { 22279, 22280, 22281, @@ -235,8 +225,7 @@ public final class CrystalCaverns extends AbstractInstance private static final int DOOR4 = 24220061; private static final int DOOR5 = 24220025; private static final int DOOR6 = 24220022; - private static final int[] ZONES = - { + private static final int[] ZONES = { 20105, 20106, 20107 @@ -501,8 +490,7 @@ public final class CrystalCaverns extends AbstractInstance private static final int DRAGONSCALETIME = 3000; private static final int DRAGONCLAWTIME = 3000; - public CrystalCaverns() - { + public CrystalCaverns() { super(CrystalCaverns.class.getSimpleName()); addStartNpc(ORACLE_GUIDE_1, ORACLE_GUIDE_4); addTalkId(ORACLE_GUIDE_1, ORACLE_GUIDE_3, ORACLE_GUIDE_4, 32275, 32276, 32277); @@ -519,50 +507,41 @@ public final class CrystalCaverns extends AbstractInstance } @Override - protected boolean checkConditions(L2PcInstance player) - { - if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) - { + protected boolean checkConditions(L2PcInstance player) { + if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) { return true; } final L2Party party = player.getParty(); - if (party == null) - { + if (party == null) { player.sendPacket(SystemMessageId.NOT_IN_PARTY_CANT_ENTER); return false; } - if (party.getLeader() != player) - { + if (party.getLeader() != player) { player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); return false; } - for (L2PcInstance partyMember : party.getMembers()) - { - if (partyMember.getLevel() < MIN_LEVEL) - { + for (L2PcInstance partyMember : party.getMembers()) { + if (partyMember.getLevel() < MIN_LEVEL) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; } L2ItemInstance item = partyMember.getInventory().getItemByItemId(CONTAMINATED_CRYSTAL); - if (item == null) - { + if (item == null) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_ITEM_REQUIREMENT_NOT_SUFFICIENT); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; } - if (!Util.checkIfInRange(1000, player, partyMember, true)) - { + if (!Util.checkIfInRange(1000, player, partyMember, true)) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; } - if (System.currentTimeMillis() < InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), TEMPLATE_ID)) - { + if (System.currentTimeMillis() < InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), TEMPLATE_ID)) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET); sm.addPcName(partyMember); party.broadcastPacket(sm); @@ -572,36 +551,29 @@ public final class CrystalCaverns extends AbstractInstance return true; } - private boolean checkOracleConditions(L2PcInstance player) - { - if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) - { + private boolean checkOracleConditions(L2PcInstance player) { + if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) { return true; } L2Party party = player.getParty(); - if (party == null) - { + if (party == null) { player.sendPacket(SystemMessageId.NOT_IN_PARTY_CANT_ENTER); return false; } - if (party.getLeader() != player) - { + if (party.getLeader() != player) { player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); return false; } - for (L2PcInstance partyMember : party.getMembers()) - { + for (L2PcInstance partyMember : party.getMembers()) { L2ItemInstance item = partyMember.getInventory().getItemByItemId(RED_CORAL); - if (item == null) - { + if (item == null) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_ITEM_REQUIREMENT_NOT_SUFFICIENT); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; } - if (!Util.checkIfInRange(1000, player, partyMember, true)) - { + if (!Util.checkIfInRange(1000, player, partyMember, true)) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED); sm.addPcName(partyMember); party.broadcastPacket(sm); @@ -611,38 +583,31 @@ public final class CrystalCaverns extends AbstractInstance return true; } - private boolean checkBaylorConditions(L2PcInstance player) - { - if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) - { + private boolean checkBaylorConditions(L2PcInstance player) { + if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) { return true; } L2Party party = player.getParty(); - if (party == null) - { + if (party == null) { player.sendPacket(SystemMessageId.NOT_IN_PARTY_CANT_ENTER); return false; } - if (party.getLeader() != player) - { + if (party.getLeader() != player) { player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); return false; } - for (L2PcInstance partyMember : party.getMembers()) - { + for (L2PcInstance partyMember : party.getMembers()) { L2ItemInstance item1 = partyMember.getInventory().getItemByItemId(BLUE_CRYSTAL); L2ItemInstance item2 = partyMember.getInventory().getItemByItemId(RED_CRYSTAL); L2ItemInstance item3 = partyMember.getInventory().getItemByItemId(CLEAR_CRYSTAL); - if ((item1 == null) || (item2 == null) || (item3 == null)) - { + if ((item1 == null) || (item2 == null) || (item3 == null)) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_ITEM_REQUIREMENT_NOT_SUFFICIENT); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; } - if (!Util.checkIfInRange(1000, player, partyMember, true)) - { + if (!Util.checkIfInRange(1000, player, partyMember, true)) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED); sm.addPcName(partyMember); party.broadcastPacket(sm); @@ -653,8 +618,7 @@ public final class CrystalCaverns extends AbstractInstance } // this should be handled from skill effect - private void Throw(L2Character effector, L2Character effected) - { + private void Throw(L2Character effector, L2Character effected) { // Get current position of the L2Character final int curX = effected.getX(); final int curY = effected.getY(); @@ -673,13 +637,11 @@ public final class CrystalCaverns extends AbstractInstance // approximation for moving futher when z coordinates are different // TODO: handle Z axis movement better offset += Math.abs(dz); - if (offset < 5) - { + if (offset < 5) { offset = 5; } - if (distance < 1) - { + if (distance < 1) { return; } // Calculate movement angles needed @@ -701,33 +663,24 @@ public final class CrystalCaverns extends AbstractInstance } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { - if (player.getParty() == null) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { + if (player.getParty() == null) { teleportPlayer(player, START_LOC, world.getInstanceId()); world.addAllowed(player.getObjectId()); - } - else - { - for (L2PcInstance partyMember : player.getParty().getMembers()) - { + } else { + for (L2PcInstance partyMember : player.getParty().getMembers()) { teleportPlayer(partyMember, START_LOC, world.getInstanceId()); world.addAllowed(partyMember.getObjectId()); } } runOracle((CCWorld) world); - } - else - { + } else { teleportPlayer(player, START_LOC, world.getInstanceId()); } } - protected void stopAttack(L2PcInstance player) - { + protected void stopAttack(L2PcInstance player) { player.setTarget(null); player.abortAttack(); player.abortCast(); @@ -735,8 +688,7 @@ public final class CrystalCaverns extends AbstractInstance player.breakCast(); player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); L2Summon pet = player.getSummon(); - if (pet != null) - { + if (pet != null) { pet.setTarget(null); pet.abortAttack(); pet.abortCast(); @@ -746,81 +698,68 @@ public final class CrystalCaverns extends AbstractInstance } } - protected void runOracle(CCWorld world) - { + protected void runOracle(CCWorld world) { world.setStatus(0); world.oracle.add(addSpawn(ORACLE_GUIDE_1, 143172, 148894, -11975, 0, false, 0, false, world.getInstanceId())); } - protected void runEmerald(CCWorld world) - { + protected void runEmerald(CCWorld world) { world.setStatus(1); runFirst(world); openDoor(DOOR1, world.getInstanceId()); } - protected void runCoral(CCWorld world) - { + protected void runCoral(CCWorld world) { world.setStatus(1); runHall(world); openDoor(DOOR2, world.getInstanceId()); openDoor(DOOR5, world.getInstanceId()); } - protected void runHall(CCWorld world) - { + protected void runHall(CCWorld world) { world.setStatus(2); - for (int[] spawn : HALL_SPAWNS) - { + for (int[] spawn : HALL_SPAWNS) { L2Npc mob = addSpawn(CGMOBS[getRandom(CGMOBS.length)], spawn[0], spawn[1], spawn[2], spawn[3], false, 0, false, world.getInstanceId()); world.npcList1.put(mob, false); } } - protected void runFirst(CCWorld world) - { + protected void runFirst(CCWorld world) { world.setStatus(2); world.keyKeepers.add(addSpawn(GATEKEEPER_LOHAN, 148206, 149486, -12140, 32308, false, 0, false, world.getInstanceId())); world.keyKeepers.add(addSpawn(GATEKEEPER_PROVO, 148203, 151093, -12140, 31100, false, 0, false, world.getInstanceId())); - for (int[] spawn : FIRST_SPAWNS) - { + for (int[] spawn : FIRST_SPAWNS) { addSpawn(spawn[0], spawn[1], spawn[2], spawn[3], spawn[4], false, 0, false, world.getInstanceId()); } } - protected void runEmeraldSquare(CCWorld world) - { + protected void runEmeraldSquare(CCWorld world) { world.setStatus(3); Map<L2Npc, Boolean> spawnList = new HashMap<>(); - for (int[] spawn : EMERALD_SPAWNS) - { + for (int[] spawn : EMERALD_SPAWNS) { L2Npc mob = addSpawn(spawn[0], spawn[1], spawn[2], spawn[3], spawn[4], false, 0, false, world.getInstanceId()); spawnList.put(mob, false); } world.npcList2.put(0, spawnList); } - protected void runEmeraldRooms(CCWorld world, int[][] spawnList, int room) - { + protected void runEmeraldRooms(CCWorld world, int[][] spawnList, int room) { Map<L2Npc, Boolean> spawned = new HashMap<>(); - for (int[] spawn : spawnList) - { + for (int[] spawn : spawnList) { L2Npc mob = addSpawn(spawn[0], spawn[1], spawn[2], spawn[3], spawn[4], false, 0, false, world.getInstanceId()); spawned.put(mob, false); } - if (room == 1) - { + if (room == 1) { addSpawn(32359, 142110, 139896, -11888, 8033, false, 0, false, world.getInstanceId()); } world.npcList2.put(room, spawned); world.roomsStatus[room - 1] = 1; } - protected void runDarnel(CCWorld world) - { + protected void runDarnel(CCWorld world) { world.setStatus(9); addSpawn(DARNEL, 152759, 145949, -12588, 21592, false, 0, false, world.getInstanceId()); @@ -829,38 +768,30 @@ public final class CrystalCaverns extends AbstractInstance openDoor(24220006, world.getInstanceId()); } - protected void runSteamRooms(CCWorld world, int[][] spawnList, int status) - { + protected void runSteamRooms(CCWorld world, int[][] spawnList, int status) { world.setStatus(status); Map<L2Npc, Boolean> spawned = new HashMap<>(); - for (int[] spawn : spawnList) - { + for (int[] spawn : spawnList) { L2Npc mob = addSpawn(spawn[0], spawn[1], spawn[2], spawn[3], spawn[4], false, 0, false, world.getInstanceId()); spawned.put(mob, false); } world.npcList2.put(0, spawned); } - protected void runSteamOracles(CCWorld world, int[][] oracleOrder) - { + protected void runSteamOracles(CCWorld world, int[][] oracleOrder) { world.oracles.clear(); - for (int[] oracle : oracleOrder) - { + for (int[] oracle : oracleOrder) { world.oracles.put(addSpawn(oracle[0], oracle[1], oracle[2], oracle[3], oracle[4], false, 0, false, world.getInstanceId()), null); } } - protected boolean checkKillProgress(int room, L2Npc mob, CCWorld world) - { - if (world.npcList2.get(room).containsKey(mob)) - { + protected boolean checkKillProgress(int room, L2Npc mob, CCWorld world) { + if (world.npcList2.get(room).containsKey(mob)) { world.npcList2.get(room).put(mob, true); } - for (boolean isDead : world.npcList2.get(room).values()) - { - if (!isDead) - { + for (boolean isDead : world.npcList2.get(room).values()) { + if (!isDead) { return false; } } @@ -875,75 +806,55 @@ public final class CrystalCaverns extends AbstractInstance */ @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { - if (npc.getId() == ORACLE_GUIDE_1) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { + if (npc.getId() == ORACLE_GUIDE_1) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof CCWorld) - { + if (tmpworld instanceof CCWorld) { CCWorld world = (CCWorld) tmpworld; - if ((world.getStatus() == 0) && world.oracle.contains(npc)) - { + if ((world.getStatus() == 0) && world.oracle.contains(npc)) { return "32281.htm";// TODO: Missing HTML. } } npc.showChatWindow(player); return null; - } - else if ((npc.getId() >= 32275) && (npc.getId() <= 32277)) - { + } else if ((npc.getId() >= 32275) && (npc.getId() <= 32277)) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof CCWorld) - { + if (tmpworld instanceof CCWorld) { CCWorld world = (CCWorld) tmpworld; - if (!world.OracleTriggered[npc.getId() - 32275]) - { + if (!world.OracleTriggered[npc.getId() - 32275]) { return "no.htm"; // TODO: Missing HTML. } npc.showChatWindow(player); return null; } - } - else if (npc.getId() == 32274) - { + } else if (npc.getId() == 32274) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof CCWorld) - { + if (tmpworld instanceof CCWorld) { return "no.htm"; // TODO: Missing HTML. } - } - else if (npc.getId() == 32279) - { + } else if (npc.getId() == 32279) { final QuestState st = player.getQuestState(Q00131_BirdInACage.class.getSimpleName()); return (st != null) && !st.isCompleted() ? "32279-01.htm" : "32279.htm"; - } - else if (npc.getId() == CRYSTALLINE_GOLEM) - { + } else if (npc.getId() == CRYSTALLINE_GOLEM) { player.sendPacket(ActionFailed.STATIC_PACKET); } return ""; } @Override - public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) - { + public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) { boolean doReturn = true; - for (L2Object obj : targets) - { - if (obj == npc) - { + for (L2Object obj : targets) { + if (obj == npc) { doReturn = false; } } - if (doReturn) - { + if (doReturn) { return super.onSkillSee(npc, caster, skill, targets, isSummon); } - switch (skill.getId()) - { + switch (skill.getId()) { case 1011: case 1015: case 1217: @@ -957,78 +868,55 @@ public final class CrystalCaverns extends AbstractInstance default: doReturn = true; } - if (doReturn) - { + if (doReturn) { return super.onSkillSee(npc, caster, skill, targets, isSummon); } - if ((npc.getId() >= 32275) && (npc.getId() <= 32277) && (skill.getId() != 2360) && (skill.getId() != 2369)) - { + if ((npc.getId() >= 32275) && (npc.getId() <= 32277) && (skill.getId() != 2360) && (skill.getId() != 2369)) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if ((tmpworld instanceof CCWorld) && (getRandom(100) < 15)) - { - for (L2Npc oracle : ((CCWorld) tmpworld).oracles.keySet()) - { - if (oracle != npc) - { + if ((tmpworld instanceof CCWorld) && (getRandom(100) < 15)) { + for (L2Npc oracle : ((CCWorld) tmpworld).oracles.keySet()) { + if (oracle != npc) { oracle.decayMe(); } } ((CCWorld) tmpworld).OracleTriggered[npc.getId() - 32275] = true; } - } - else if (npc.isInvul() && (npc.getId() == BAYLOR) && (skill.getId() == 2360) && (caster != null)) - { - if (caster.getParty() == null) - { + } else if (npc.isInvul() && (npc.getId() == BAYLOR) && (skill.getId() == 2360) && (caster != null)) { + if (caster.getParty() == null) { return super.onSkillSee(npc, caster, skill, targets, isSummon); } InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof CCWorld) - { + if (tmpworld instanceof CCWorld) { CCWorld world = (CCWorld) tmpworld; - if (((world._dragonClawStart + DRAGONCLAWTIME) <= System.currentTimeMillis()) || (world._dragonClawNeed <= 0)) - { + if (((world._dragonClawStart + DRAGONCLAWTIME) <= System.currentTimeMillis()) || (world._dragonClawNeed <= 0)) { world._dragonClawStart = System.currentTimeMillis(); world._dragonClawNeed = caster.getParty().getMemberCount() - 1; - } - else - { + } else { world._dragonClawNeed--; } - if (world._dragonClawNeed == 0) - { + if (world._dragonClawNeed == 0) { npc.stopSkillEffects(false, 5225); npc.broadcastPacket(new MagicSkillUse(npc, npc, 5480, 1, 4000, 0)); - if (world._raidStatus == 3) - { + if (world._raidStatus == 3) { world._raidStatus++; } } } - } - else if (npc.isInvul() && (npc.getId() == TEARS) && (skill.getId() == 2369) && (caster != null)) - { + } else if (npc.isInvul() && (npc.getId() == TEARS) && (skill.getId() == 2369) && (caster != null)) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof CCWorld) - { + if (tmpworld instanceof CCWorld) { CCWorld world = (CCWorld) tmpworld; - if (caster.getParty() == null) - { + if (caster.getParty() == null) { return super.onSkillSee(npc, caster, skill, targets, isSummon); - } - else if (((world.dragonScaleStart + DRAGONSCALETIME) <= System.currentTimeMillis()) || (world.dragonScaleNeed <= 0)) - { + } else if (((world.dragonScaleStart + DRAGONSCALETIME) <= System.currentTimeMillis()) || (world.dragonScaleNeed <= 0)) { world.dragonScaleStart = System.currentTimeMillis(); world.dragonScaleNeed = caster.getParty().getMemberCount() - 1; - } - else - { + } else { world.dragonScaleNeed--; } - if ((world.dragonScaleNeed == 0) && (getRandom(100) < 80)) - { + if ((world.dragonScaleNeed == 0) && (getRandom(100) < 80)) { npc.setIsInvul(false); } } @@ -1037,36 +925,25 @@ public final class CrystalCaverns extends AbstractInstance } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) - { - if (npc.getId() == TEARS) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) { + if (npc.getId() == TEARS) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof CCWorld) - { + if (tmpworld instanceof CCWorld) { CCWorld world = (CCWorld) tmpworld; - if ((world.getStatus() != 4) && (attacker != null)) - { + if ((world.getStatus() != 4) && (attacker != null)) { // Lucky cheater, the code only kicks his/her ass out of the dungeon teleportPlayer(attacker, new Location(149361, 172327, -945), 0); world.removeAllowed(attacker.getObjectId()); - } - else if (world.tears != npc) - { + } else if (world.tears != npc) { return ""; - } - else if (!world.copys.isEmpty()) - { + } else if (!world.copys.isEmpty()) { boolean notAOE = true; if ((skill != null) && ((skill.getTargetType() == L2TargetType.AREA) || (skill.getTargetType() == L2TargetType.FRONT_AREA) || (skill.getTargetType() == L2TargetType.BEHIND_AREA) || (skill.getTargetType() == L2TargetType.AURA) || (skill.getTargetType() == L2TargetType.FRONT_AURA) - || (skill.getTargetType() == L2TargetType.BEHIND_AURA))) - { + || (skill.getTargetType() == L2TargetType.BEHIND_AURA))) { notAOE = false; } - if (notAOE) - { - for (L2Npc copy : world.copys) - { + if (notAOE) { + for (L2Npc copy : world.copys) { copy.onDecay(); } world.copys.clear(); @@ -1078,23 +955,17 @@ public final class CrystalCaverns extends AbstractInstance double nowHp = npc.getStatus().getCurrentHp(); int rand = getRandom(1000); - if ((nowHp < (maxHp * 0.4)) && (rand < 5)) - { + if ((nowHp < (maxHp * 0.4)) && (rand < 5)) { L2Party party = attacker.getParty(); - if (party != null) - { - for (L2PcInstance partyMember : party.getMembers()) - { + if (party != null) { + for (L2PcInstance partyMember : party.getMembers()) { stopAttack(partyMember); } - } - else - { + } else { stopAttack(attacker); } L2Character target = npc.getAI().getAttackTarget(); - for (int i = 0; i < 10; i++) - { + for (int i = 0; i < 10; i++) { L2Npc copy = addSpawn(TEARS_COPY, npc.getX(), npc.getY(), npc.getZ(), 0, false, 0, false, attacker.getInstanceId()); copy.setRunning(); ((L2Attackable) copy).addDamageHate(target, 0, 99999); @@ -1102,11 +973,8 @@ public final class CrystalCaverns extends AbstractInstance copy.setCurrentHp(nowHp); world.copys.add(copy); } - } - else if ((nowHp < (maxHp * 0.15)) && !world.isUsedInvulSkill) - { - if ((rand > 994) || (nowHp < (maxHp * 0.1))) - { + } else if ((nowHp < (maxHp * 0.15)) && !world.isUsedInvulSkill) { + if ((rand > 994) || (nowHp < (maxHp * 0.1))) { world.isUsedInvulSkill = true; npc.setIsInvul(true); } @@ -1117,13 +985,10 @@ public final class CrystalCaverns extends AbstractInstance } @Override - public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) - { - if ((npc.getId() == BAYLOR) && (skill.getId() == 5225)) - { + public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) { + if ((npc.getId() == BAYLOR) && (skill.getId() == 5225)) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof CCWorld) - { + if (tmpworld instanceof CCWorld) { ((CCWorld) tmpworld)._raidStatus++; } } @@ -1131,54 +996,38 @@ public final class CrystalCaverns extends AbstractInstance } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof CCWorld) - { + if (tmpworld instanceof CCWorld) { CCWorld world = (CCWorld) tmpworld; - if (event.equalsIgnoreCase("TeleportOut")) - { + if (event.equalsIgnoreCase("TeleportOut")) { teleportPlayer(player, new Location(149413, 173078, -5014), 0); - } - else if (event.equalsIgnoreCase("TeleportParme")) - { + } else if (event.equalsIgnoreCase("TeleportParme")) { teleportPlayer(player, new Location(153689, 142226, -9750), world.getInstanceId()); - } - else if (event.equalsIgnoreCase("Timer2") || event.equalsIgnoreCase("Timer3") || event.equalsIgnoreCase("Timer4") || event.equalsIgnoreCase("Timer5")) - { - if (player.getInstanceId() == world.getInstanceId()) - { + } else if (event.equalsIgnoreCase("Timer2") || event.equalsIgnoreCase("Timer3") || event.equalsIgnoreCase("Timer4") || event.equalsIgnoreCase("Timer5")) { + if (player.getInstanceId() == world.getInstanceId()) { teleportPlayer(player, new Location(144653, 152606, -12126), world.getInstanceId()); player.stopSkillEffects(true, 5239); EVENT_TIMER_1.getSkill().applyEffects(player, player); startQuestTimer("Timer2", 300000, npc, player); } - } - else if (event.equalsIgnoreCase("Timer21") || event.equalsIgnoreCase("Timer31") || event.equalsIgnoreCase("Timer41") || event.equalsIgnoreCase("Timer51")) - { + } else if (event.equalsIgnoreCase("Timer21") || event.equalsIgnoreCase("Timer31") || event.equalsIgnoreCase("Timer41") || event.equalsIgnoreCase("Timer51")) { InstanceManager.getInstance().getInstance(world.getInstanceId()).removeNpcs(); world.npcList2.clear(); runSteamRooms(world, STEAM1_SPAWNS, 22); startQuestTimer("Timer21", 300000, npc, null); } - else if (event.equalsIgnoreCase("checkKechiAttack")) - { - if (npc.isInCombat()) - { + else if (event.equalsIgnoreCase("checkKechiAttack")) { + if (npc.isInCombat()) { startQuestTimer("spawnGuards", SPAWN[0], npc, null); cancelQuestTimers("checkKechiAttack"); closeDoor(DOOR4, npc.getInstanceId()); closeDoor(DOOR3, npc.getInstanceId()); - } - else - { + } else { startQuestTimer("checkKechiAttack", 1000, npc, null); } - } - else if (event.equalsIgnoreCase("spawnGuards")) - { + } else if (event.equalsIgnoreCase("spawnGuards")) { world.kechisHenchmanSpawn++; world.guards.add(addSpawn(KECHIS_HENCHMAN, 153622, 149699, -12131, 56890, false, 0, false, world.getInstanceId())); world.guards.add(addSpawn(KECHIS_HENCHMAN, 153609, 149622, -12131, 64023, false, 0, false, world.getInstanceId())); @@ -1189,66 +1038,44 @@ public final class CrystalCaverns extends AbstractInstance world.guards.add(addSpawn(KECHIS_HENCHMAN, 153638, 149292, -12131, 64071, false, 0, false, world.getInstanceId())); world.guards.add(addSpawn(KECHIS_HENCHMAN, 153647, 149857, -12131, 59402, false, 0, false, world.getInstanceId())); world.guards.add(addSpawn(KECHIS_HENCHMAN, 153661, 149227, -12131, 65275, false, 0, false, world.getInstanceId())); - if (world.kechisHenchmanSpawn <= 5) - { + if (world.kechisHenchmanSpawn <= 5) { startQuestTimer("spawnGuards", SPAWN[world.kechisHenchmanSpawn], npc, null); - } - else - { + } else { cancelQuestTimers("spawnGuards"); } - } - else if (event.equalsIgnoreCase("EmeraldSteam")) - { + } else if (event.equalsIgnoreCase("EmeraldSteam")) { runEmerald(world); - for (L2Npc oracle : world.oracle) - { + for (L2Npc oracle : world.oracle) { oracle.decayMe(); } - } - else if (event.equalsIgnoreCase("CoralGarden")) - { + } else if (event.equalsIgnoreCase("CoralGarden")) { runCoral(world); - for (L2Npc oracle : world.oracle) - { + for (L2Npc oracle : world.oracle) { oracle.decayMe(); } - } - else if (event.equalsIgnoreCase("spawn_oracle")) - { + } else if (event.equalsIgnoreCase("spawn_oracle")) { addSpawn(32271, 153572, 142075, -9728, 10800, false, 0, false, world.getInstanceId()); addSpawn((getRandom(10) < 5 ? 29116 : 29117), npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0, false, world.getInstanceId()); // Baylor's Chest addSpawn(ORACLE_GUIDE_4, 153572, 142075, -12738, 10800, false, 0, false, world.getInstanceId()); cancelQuestTimer("baylor_despawn", npc, null); cancelQuestTimers("baylor_skill"); - } - else if (event.equalsIgnoreCase("baylorEffect0")) - { + } else if (event.equalsIgnoreCase("baylorEffect0")) { npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); npc.broadcastSocialAction(1); startQuestTimer("baylorCamera0", 11000, npc, null); startQuestTimer("baylorEffect1", 19000, npc, null); - } - else if (event.equalsIgnoreCase("baylorCamera0")) - { + } else if (event.equalsIgnoreCase("baylorCamera0")) { npc.broadcastPacket(new SpecialCamera(npc, 500, -45, 170, 5000, 9000, 0, 0, 1, 0, 0)); - } - else if (event.equalsIgnoreCase("baylorEffect1")) - { + } else if (event.equalsIgnoreCase("baylorEffect1")) { npc.broadcastPacket(new SpecialCamera(npc, 300, 0, 120, 2000, 5000, 0, 0, 1, 0, 0)); npc.broadcastSocialAction(3); startQuestTimer("baylorEffect2", 4000, npc, null); - } - else if (event.equalsIgnoreCase("baylorEffect2")) - { + } else if (event.equalsIgnoreCase("baylorEffect2")) { npc.broadcastPacket(new SpecialCamera(npc, 747, 0, 160, 2000, 3000, 0, 0, 1, 0, 0)); npc.broadcastPacket(new MagicSkillUse(npc, npc, 5402, 1, 2000, 0)); startQuestTimer("RaidStart", 2000, npc, null); - } - else if (event.equalsIgnoreCase("BaylorMinions")) - { - for (int i = 0; i < 10; i++) - { + } else if (event.equalsIgnoreCase("BaylorMinions")) { + for (int i = 0; i < 10; i++) { int radius = 300; int x = (int) (radius * Math.cos(i * 0.618)); int y = (int) (radius * Math.sin(i * 0.618)); @@ -1257,48 +1084,35 @@ public final class CrystalCaverns extends AbstractInstance world._animationMobs.add(mob); } startQuestTimer("baylorEffect0", 200, npc, null); - } - else if (event.equalsIgnoreCase("RaidStart")) - { + } else if (event.equalsIgnoreCase("RaidStart")) { world._camera.decayMe(); world._camera = null; npc.setIsParalyzed(false); - for (L2PcInstance p : world._raiders) - { + for (L2PcInstance p : world._raiders) { p.setIsParalyzed(false); Throw(npc, p); - if (p.getSummon() != null) - { + if (p.getSummon() != null) { Throw(npc, p.getSummon()); } } world._raidStatus = 0; - for (L2Npc mob : world._animationMobs) - { + for (L2Npc mob : world._animationMobs) { mob.doDie(mob); } world._animationMobs.clear(); startQuestTimer("baylor_despawn", 60000, npc, null, true); startQuestTimer("checkBaylorAttack", 1000, npc, null); - } - else if (event.equalsIgnoreCase("checkBaylorAttack")) - { - if (npc.isInCombat()) - { + } else if (event.equalsIgnoreCase("checkBaylorAttack")) { + if (npc.isInCombat()) { cancelQuestTimers("checkBaylorAttack"); startQuestTimer("baylor_alarm", 40000, npc, null); startQuestTimer("baylor_skill", 5000, npc, null, true); world._raidStatus++; - } - else - { + } else { startQuestTimer("checkBaylorAttack", 1000, npc, null); } - } - else if (event.equalsIgnoreCase("baylor_alarm")) - { - if (world._alarm == null) - { + } else if (event.equalsIgnoreCase("baylor_alarm")) { + if (world._alarm == null) { int[] spawnLoc = ALARMSPAWN[getRandom(ALARMSPAWN.length)]; npc.addSkill(PHYSICAL_UP.getSkill()); npc.addSkill(MAGICAL_UP.getSkill()); @@ -1307,130 +1121,90 @@ public final class CrystalCaverns extends AbstractInstance world._alarm.setIsImmobilized(true); world._alarm.broadcastPacket(new CreatureSay(world._alarm.getObjectId(), 1, world._alarm.getName(), NpcStringId.AN_ALARM_HAS_BEEN_SET_OFF_EVERYBODY_WILL_BE_IN_DANGER_IF_THEY_ARE_NOT_TAKEN_CARE_OF_IMMEDIATELY)); } - } - else if (event.equalsIgnoreCase("baylor_skill")) - { - if (world._baylor == null) - { + } else if (event.equalsIgnoreCase("baylor_skill")) { + if (world._baylor == null) { cancelQuestTimers("baylor_skill"); - } - else - { + } else { int maxHp = npc.getMaxHp(); double nowHp = npc.getStatus().getCurrentHp(); int rand = getRandom(100); - if ((nowHp < (maxHp * 0.2)) && (world._raidStatus < 3) && !npc.isAffectedBySkill(5224) && !npc.isAffectedBySkill(5225)) - { - if ((nowHp < (maxHp * 0.15)) && (world._raidStatus == 2)) - { + if ((nowHp < (maxHp * 0.2)) && (world._raidStatus < 3) && !npc.isAffectedBySkill(5224) && !npc.isAffectedBySkill(5225)) { + if ((nowHp < (maxHp * 0.15)) && (world._raidStatus == 2)) { npc.doCast(INVINCIBLE); npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 1, npc.getName(), NpcStringId.DEMON_KING_BELETH_GIVE_ME_THE_POWER_AAAHH)); - } - else if ((rand < 10) || (nowHp < (maxHp * 0.15))) - { + } else if ((rand < 10) || (nowHp < (maxHp * 0.15))) { npc.doCast(INVINCIBLE); npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 1, npc.getName(), NpcStringId.DEMON_KING_BELETH_GIVE_ME_THE_POWER_AAAHH)); startQuestTimer("baylor_remove_invul", 30000, world._baylor, null); } - } - else if ((nowHp < (maxHp * 0.3)) && (rand > 50) && !npc.isAffectedBySkill(5225) && !npc.isAffectedBySkill(5224)) - { + } else if ((nowHp < (maxHp * 0.3)) && (rand > 50) && !npc.isAffectedBySkill(5225) && !npc.isAffectedBySkill(5224)) { npc.doCast(BERSERK); - } - else if (rand < 33) - { + } else if (rand < 33) { npc.setTarget(world._raiders.get(getRandom(world._raiders.size()))); npc.doCast(STRONG_PUNCH); } } - } - else if (event.equalsIgnoreCase("baylor_remove_invul")) - { + } else if (event.equalsIgnoreCase("baylor_remove_invul")) { npc.stopSkillEffects(false, 5225); - } - else if (event.equalsIgnoreCase("Baylor")) - { + } else if (event.equalsIgnoreCase("Baylor")) { world._baylor = addSpawn(29099, 153572, 142075, -12738, 10800, false, 0, false, world.getInstanceId()); world._baylor.setIsParalyzed(true); world._camera = addSpawn(29120, 153273, 141400, -12738, 10800, false, 0, false, world.getInstanceId()); world._camera.broadcastPacket(new SpecialCamera(world._camera, 700, -45, 160, 500, 15200, 0, 0, 1, 0, 0)); startQuestTimer("baylorMinions", 2000, world._baylor, null); - } - else if (!event.endsWith("Food")) - { + } else if (!event.endsWith("Food")) { return ""; - } - else if (event.equalsIgnoreCase("autoFood")) - { - if (!world.crystalGolems.containsKey(npc)) - { + } else if (event.equalsIgnoreCase("autoFood")) { + if (!world.crystalGolems.containsKey(npc)) { world.crystalGolems.put(npc, new CrystalGolem()); } - if ((world.getStatus() != 3) || !world.crystalGolems.containsKey(npc) || (world.crystalGolems.get(npc).foodItem != null) || world.crystalGolems.get(npc).isAtDestination) - { + if ((world.getStatus() != 3) || !world.crystalGolems.containsKey(npc) || (world.crystalGolems.get(npc).foodItem != null) || world.crystalGolems.get(npc).isAtDestination) { return ""; } CrystalGolem cryGolem = world.crystalGolems.get(npc); int minDist = 300000; - for (L2Object object : L2World.getInstance().getVisibleObjects(npc, 300)) - { - if (object.isItem() && (object.getId() == CRYSTAL_FRAGMENT)) - { + for (L2Object object : L2World.getInstance().getVisibleObjects(npc, 300)) { + if (object.isItem() && (object.getId() == CRYSTAL_FRAGMENT)) { int dx = npc.getX() - object.getX(); int dy = npc.getY() - object.getY(); int d = (dx * dx) + (dy * dy); - if (d < minDist) - { + if (d < minDist) { minDist = d; cryGolem.foodItem = (L2ItemInstance) object; } } } - if (minDist != 300000) - { + if (minDist != 300000) { startQuestTimer("getFood", 2000, npc, null); - } - else - { - if (getRandom(100) < 5) - { + } else { + if (getRandom(100) < 5) { npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 1, npc.getName(), NpcStringId.AH_IM_HUNGRY)); } startQuestTimer("autoFood", 2000, npc, null); } return ""; - } - else if (!world.crystalGolems.containsKey(npc) || world.crystalGolems.get(npc).isAtDestination) - { + } else if (!world.crystalGolems.containsKey(npc) || world.crystalGolems.get(npc).isAtDestination) { return ""; - } - else if (event.equalsIgnoreCase("backFood")) - { - if (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_ACTIVE) - { + } else if (event.equalsIgnoreCase("backFood")) { + if (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_ACTIVE) { cancelQuestTimers("backFood"); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, null); world.crystalGolems.get(npc).foodItem = null; startQuestTimer("autoFood", 2000, npc, null); } - } - else if (event.equalsIgnoreCase("reachFood")) - { + } else if (event.equalsIgnoreCase("reachFood")) { CrystalGolem cryGolem = world.crystalGolems.get(npc); int dx; int dy; - if ((cryGolem.foodItem == null) || !cryGolem.foodItem.isVisible()) - { + if ((cryGolem.foodItem == null) || !cryGolem.foodItem.isVisible()) { npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, cryGolem.oldLoc); cancelQuestTimers("reachFood"); startQuestTimer("backFood", 2000, npc, null, true); return ""; - } - else if (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_ACTIVE) - { + } else if (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_ACTIVE) { L2World.getInstance().removeVisibleObject(cryGolem.foodItem, cryGolem.foodItem.getWorldRegion()); L2World.getInstance().removeObject(cryGolem.foodItem); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, null); @@ -1441,27 +1215,21 @@ public final class CrystalCaverns extends AbstractInstance dx = npc.getX() - 139494; dy = npc.getY() - 151668; int d2 = (dx * dx) + (dy * dy); - if ((d1 < 10000) || (d2 < 10000)) - { + if ((d1 < 10000) || (d2 < 10000)) { npc.broadcastPacket(new MagicSkillUse(npc, npc, 5441, 1, 1, 0)); cryGolem.isAtDestination = true; world.correctGolems++; - if (world.correctGolems >= 2) - { + if (world.correctGolems >= 2) { openDoor(24220026, world.getInstanceId()); world.setStatus(4); } - } - else - { + } else { startQuestTimer("autoFood", 2000, npc, null); } cancelQuestTimers("reachFood"); } return ""; - } - else if (event.equalsIgnoreCase("getFood")) - { + } else if (event.equalsIgnoreCase("getFood")) { CrystalGolem cryGolem = world.crystalGolems.get(npc); Location newLoc = new Location(cryGolem.foodItem.getX(), cryGolem.foodItem.getY(), cryGolem.foodItem.getZ(), 0); cryGolem.oldLoc = new Location(npc.getX(), npc.getY(), npc.getZ(), npc.getHeading()); @@ -1473,46 +1241,32 @@ public final class CrystalCaverns extends AbstractInstance return ""; } - private void giveRewards(L2PcInstance player, int instanceId, int bossCry, boolean isBaylor) - { + private void giveRewards(L2PcInstance player, int instanceId, int bossCry, boolean isBaylor) { final int num = Math.max(rates().getCorpseDropChanceMultiplier().intValue(), 1); L2Party party = player.getParty(); - if (party != null) - { - for (L2PcInstance partyMember : party.getMembers()) - { - if (partyMember.getInstanceId() == instanceId) - { - if (!isBaylor && hasQuestItems(partyMember, CONTAMINATED_CRYSTAL)) - { + if (party != null) { + for (L2PcInstance partyMember : party.getMembers()) { + if (partyMember.getInstanceId() == instanceId) { + if (!isBaylor && hasQuestItems(partyMember, CONTAMINATED_CRYSTAL)) { takeItems(partyMember, CONTAMINATED_CRYSTAL, 1); giveItems(partyMember, bossCry, 1); } - if (getRandom(10) < 5) - { + if (getRandom(10) < 5) { giveItems(partyMember, WHITE_SEED_OF_EVIL_SHARD, num); - } - else - { + } else { giveItems(partyMember, BLACK_SEED_OF_EVIL_SHARD, num); } } } - } - else if (player.getInstanceId() == instanceId) - { - if (!isBaylor && hasQuestItems(player, CONTAMINATED_CRYSTAL)) - { + } else if (player.getInstanceId() == instanceId) { + if (!isBaylor && hasQuestItems(player, CONTAMINATED_CRYSTAL)) { takeItems(player, CONTAMINATED_CRYSTAL, 1); giveItems(player, bossCry, 1); } - if (getRandom(10) < 5) - { + if (getRandom(10) < 5) { giveItems(player, WHITE_SEED_OF_EVIL_SHARD, num); - } - else - { + } else { giveItems(player, BLACK_SEED_OF_EVIL_SHARD, num); } } @@ -1520,19 +1274,14 @@ public final class CrystalCaverns extends AbstractInstance } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof CCWorld) - { + if (tmpworld instanceof CCWorld) { CCWorld world = (CCWorld) tmpworld; - if ((world.getStatus() == 2) && world.npcList1.containsKey(npc)) - { + if ((world.getStatus() == 2) && world.npcList1.containsKey(npc)) { world.npcList1.put(npc, true); - for (boolean isDead : world.npcList1.values()) - { - if (!isDead) - { + for (boolean isDead : world.npcList1.values()) { + if (!isDead) { return ""; } } @@ -1542,137 +1291,92 @@ public final class CrystalCaverns extends AbstractInstance CrystalGolem crygolem2 = new CrystalGolem(); world.crystalGolems.put(addSpawn(CRYSTALLINE_GOLEM, 140547, 151670, -11813, 32767, false, 0, false, world.getInstanceId()), crygolem1); world.crystalGolems.put(addSpawn(CRYSTALLINE_GOLEM, 141941, 151684, -11813, 63371, false, 0, false, world.getInstanceId()), crygolem2); - for (L2Npc crygolem : world.crystalGolems.keySet()) - { + for (L2Npc crygolem : world.crystalGolems.keySet()) { startQuestTimer("autoFood", 2000, crygolem, null); } - } - else if ((world.getStatus() == 4) && (npc.getId() == TEARS)) - { + } else if ((world.getStatus() == 4) && (npc.getId() == TEARS)) { InstanceManager.getInstance().getInstance(world.getInstanceId()).setDuration(300000); addSpawn(32280, 144312, 154420, -11855, 0, false, 0, false, world.getInstanceId()); giveRewards(player, npc.getInstanceId(), CLEAR_CRYSTAL, false); - } - else if ((world.getStatus() == 2) && world.keyKeepers.contains(npc)) - { - if (npc.getId() == GATEKEEPER_LOHAN) - { + } else if ((world.getStatus() == 2) && world.keyKeepers.contains(npc)) { + if (npc.getId() == GATEKEEPER_LOHAN) { npc.dropItem(player, 9698, 1); runEmeraldSquare(world); - } - else if (npc.getId() == GATEKEEPER_PROVO) - { + } else if (npc.getId() == GATEKEEPER_PROVO) { npc.dropItem(player, 9699, 1); runSteamRooms(world, STEAM1_SPAWNS, 22); L2Party party = player.getParty(); - if (party != null) - { - for (L2PcInstance partyMember : party.getMembers()) - { - if (partyMember.getInstanceId() == world.getInstanceId()) - { + if (party != null) { + for (L2PcInstance partyMember : party.getMembers()) { + if (partyMember.getInstanceId() == world.getInstanceId()) { EVENT_TIMER_1.getSkill().applyEffects(partyMember, partyMember); startQuestTimer("Timer2", 300000, npc, partyMember); } } - } - else - { + } else { EVENT_TIMER_1.getSkill().applyEffects(player, player); startQuestTimer("Timer2", 300000, npc, player); } startQuestTimer("Timer21", 300000, npc, null); } - for (L2Npc gk : world.keyKeepers) - { - if (gk != npc) - { + for (L2Npc gk : world.keyKeepers) { + if (gk != npc) { gk.decayMe(); } } - } - else if (world.getStatus() == 3) - { - if (checkKillProgress(0, npc, world)) - { + } else if (world.getStatus() == 3) { + if (checkKillProgress(0, npc, world)) { world.setStatus(4); addSpawn(TOURMALINE, 148202, 144791, -12235, 0, false, 0, false, world.getInstanceId()); - } - else - { + } else { return ""; } - } - else if (world.getStatus() == 4) - { - if (npc.getId() == TOURMALINE) - { + } else if (world.getStatus() == 4) { + if (npc.getId() == TOURMALINE) { world.setStatus(5); addSpawn(TEROD, 147777, 146780, -12281, 0, false, 0, false, world.getInstanceId()); } - } - else if (world.getStatus() == 5) - { - if (npc.getId() == TEROD) - { + } else if (world.getStatus() == 5) { + if (npc.getId() == TEROD) { world.setStatus(6); addSpawn(TOURMALINE, 143694, 142659, -11882, 0, false, 0, false, world.getInstanceId()); } - } - else if (world.getStatus() == 6) - { - if (npc.getId() == TOURMALINE) - { + } else if (world.getStatus() == 6) { + if (npc.getId() == TOURMALINE) { world.setStatus(7); addSpawn(DOLPH, 142054, 143288, -11825, 0, false, 0, false, world.getInstanceId()); } - } - else if (world.getStatus() == 7) - { - if (npc.getId() == DOLPH) - { + } else if (world.getStatus() == 7) { + if (npc.getId() == DOLPH) { world.setStatus(8); // first door opener trap L2Npc trap = addTrap(DOOR_OPENING_TRAP[0], DOOR_OPENING_TRAP[1], DOOR_OPENING_TRAP[2], DOOR_OPENING_TRAP[3], DOOR_OPENING_TRAP[4], null, world.getInstanceId()); broadcastNpcSay(trap, Say2.NPC_SHOUT, NpcStringId.YOU_HAVE_FINALLY_COME_HERE_BUT_YOU_WILL_NOT_BE_ABLE_TO_FIND_THE_SECRET_ROOM); } - } - else if (world.getStatus() == 8) - { - for (int i = 0; i < 4; i++) - { - if ((world.roomsStatus[i] == 1) && checkKillProgress(i + 1, npc, world)) - { + } else if (world.getStatus() == 8) { + for (int i = 0; i < 4; i++) { + if ((world.roomsStatus[i] == 1) && checkKillProgress(i + 1, npc, world)) { world.roomsStatus[i] = 2; } - if (world.roomsStatus[i] == 2) - { + if (world.roomsStatus[i] == 2) { world.cleanedRooms++; - if (world.cleanedRooms == 21) - { + if (world.cleanedRooms == 21) { runDarnel(world); } } } - } - else if ((world.getStatus() >= 22) && (world.getStatus() <= 25)) - { - if (npc.getId() == 22416) - { - for (L2Npc oracle : world.oracles.keySet()) - { - if (world.oracles.get(oracle) == npc) - { + } else if ((world.getStatus() >= 22) && (world.getStatus() <= 25)) { + if (npc.getId() == 22416) { + for (L2Npc oracle : world.oracles.keySet()) { + if (world.oracles.get(oracle) == npc) { world.oracles.put(oracle, null); } } } - if (checkKillProgress(0, npc, world)) - { + if (checkKillProgress(0, npc, world)) { world.npcList2.clear(); int[][] oracleOrder; - switch (world.getStatus()) - { + switch (world.getStatus()) { case 22: closeDoor(DOOR6, npc.getInstanceId()); oracleOrder = ordreOracle1; @@ -1686,10 +1390,8 @@ public final class CrystalCaverns extends AbstractInstance case 25: world.setStatus(26); L2Party party = player.getParty(); - if (party != null) - { - for (L2PcInstance partyMember : party.getMembers()) - { + if (party != null) { + for (L2PcInstance partyMember : party.getMembers()) { partyMember.stopSkillEffects(true, 5239); } } @@ -1706,41 +1408,30 @@ public final class CrystalCaverns extends AbstractInstance } runSteamOracles(world, oracleOrder); } - } - else if (((world.getStatus() == 9) && (npc.getId() == DARNEL)) || ((world.getStatus() == 26) && (npc.getId() == KECHI))) - { + } else if (((world.getStatus() == 9) && (npc.getId() == DARNEL)) || ((world.getStatus() == 26) && (npc.getId() == KECHI))) { InstanceManager.getInstance().getInstance(world.getInstanceId()).setDuration(300000); int bossCry; - if (npc.getId() == KECHI) - { + if (npc.getId() == KECHI) { bossCry = RED_CRYSTAL; cancelQuestTimers("spawnGuards"); addSpawn(32280, 154077, 149527, -12159, 0, false, 0, false, world.getInstanceId()); - } - else if (npc.getId() == DARNEL) - { + } else if (npc.getId() == DARNEL) { bossCry = BLUE_CRYSTAL; addSpawn(32280, 152761, 145950, -12588, 0, false, 0, false, world.getInstanceId()); - } - else - { + } else { // something is wrong return ""; } giveRewards(player, npc.getInstanceId(), bossCry, false); } - if (npc.getId() == ALARM) - { + if (npc.getId() == ALARM) { world._baylor.removeSkill(PHYSICAL_UP.getSkillId()); world._baylor.removeSkill(MAGICAL_UP.getSkillId()); world._alarm = null; - if ((world._baylor.getMaxHp() * 0.3) < world._baylor.getStatus().getCurrentHp()) - { + if ((world._baylor.getMaxHp() * 0.3) < world._baylor.getStatus().getCurrentHp()) { startQuestTimer("baylor_alarm", 40000, world._baylor, null); } - } - else if (npc.getId() == BAYLOR) - { + } else if (npc.getId() == BAYLOR) { world.setStatus(31); world._baylor = null; Instance baylorInstance = InstanceManager.getInstance().getInstance(npc.getInstanceId()); @@ -1753,57 +1444,43 @@ public final class CrystalCaverns extends AbstractInstance } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { int npcId = npc.getId(); QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { st = newQuestState(player); } - if (npcId == ORACLE_GUIDE_1) - { + if (npcId == ORACLE_GUIDE_1) { enterInstance(player, new CCWorld(System.currentTimeMillis() + 5400000), "CrystalCaverns.xml", TEMPLATE_ID); return ""; } InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof CCWorld) - { + if (tmpworld instanceof CCWorld) { CCWorld world = (CCWorld) tmpworld; - if (npcId == CRYSTALLINE_GOLEM) - { - } - else if ((npc.getId() >= 32275) && (npc.getId() <= 32277) && world.OracleTriggered[npc.getId() - 32275]) - { + if (npcId == CRYSTALLINE_GOLEM) { + } else if ((npc.getId() >= 32275) && (npc.getId() <= 32277) && world.OracleTriggered[npc.getId() - 32275]) { boolean doTeleport = false; Location loc = null; L2Party party = player.getParty(); doTeleport = true; - switch (npc.getId()) - { + switch (npc.getId()) { case 32275: - if (world.getStatus() == 22) - { + if (world.getStatus() == 22) { runSteamRooms(world, STEAM2_SPAWNS, 23); } loc = new Location(147529, 152587, -12169); cancelQuestTimers("Timer2"); cancelQuestTimers("Timer21"); - if (party != null) - { - for (L2PcInstance partyMember : party.getMembers()) - { - if (partyMember.getInstanceId() == world.getInstanceId()) - { + if (party != null) { + for (L2PcInstance partyMember : party.getMembers()) { + if (partyMember.getInstanceId() == world.getInstanceId()) { partyMember.stopSkillEffects(true, 5239); EVENT_TIMER_2.getSkill().applyEffects(partyMember, partyMember); startQuestTimer("Timer3", 600000, npc, partyMember); } } - } - else - { + } else { player.stopSkillEffects(true, 5239); EVENT_TIMER_2.getSkill().applyEffects(player, player); startQuestTimer("Timer3", 600000, npc, player); @@ -1811,27 +1488,21 @@ public final class CrystalCaverns extends AbstractInstance startQuestTimer("Timer31", 600000, npc, null); break; case 32276: - if (world.getStatus() == 23) - { + if (world.getStatus() == 23) { runSteamRooms(world, STEAM3_SPAWNS, 24); } loc = new Location(150194, 152610, -12169); cancelQuestTimers("Timer3"); cancelQuestTimers("Timer31"); - if (party != null) - { - for (L2PcInstance partyMember : party.getMembers()) - { - if (partyMember.getInstanceId() == world.getInstanceId()) - { + if (party != null) { + for (L2PcInstance partyMember : party.getMembers()) { + if (partyMember.getInstanceId() == world.getInstanceId()) { partyMember.stopSkillEffects(true, 5239); EVENT_TIMER_4.getSkill().applyEffects(partyMember, partyMember); startQuestTimer("Timer4", 1200000, npc, partyMember); } } - } - else - { + } else { player.stopSkillEffects(true, 5239); EVENT_TIMER_4.getSkill().applyEffects(player, player); startQuestTimer("Timer4", 1200000, npc, player); @@ -1839,27 +1510,21 @@ public final class CrystalCaverns extends AbstractInstance startQuestTimer("Timer41", 1200000, npc, null); break; case 32277: - if (world.getStatus() == 24) - { + if (world.getStatus() == 24) { runSteamRooms(world, STEAM4_SPAWNS, 25); } loc = new Location(149743, 149986, -12141); cancelQuestTimers("Timer4"); cancelQuestTimers("Timer41"); - if (party != null) - { - for (L2PcInstance partyMember : party.getMembers()) - { - if (partyMember.getInstanceId() == world.getInstanceId()) - { + if (party != null) { + for (L2PcInstance partyMember : party.getMembers()) { + if (partyMember.getInstanceId() == world.getInstanceId()) { partyMember.stopSkillEffects(true, 5239); EVENT_TIMER_3.getSkill().applyEffects(partyMember, partyMember); startQuestTimer("Timer5", 900000, npc, partyMember); } } - } - else - { + } else { player.stopSkillEffects(true, 5239); EVENT_TIMER_3.getSkill().applyEffects(player, player); startQuestTimer("Timer5", 900000, npc, player); @@ -1870,48 +1535,32 @@ public final class CrystalCaverns extends AbstractInstance // something is wrong doTeleport = false; } - if (doTeleport && (loc != null)) - { - if (!checkOracleConditions(player)) - { + if (doTeleport && (loc != null)) { + if (!checkOracleConditions(player)) { return ""; - } - else if (party != null) - { - for (L2PcInstance partyMember : party.getMembers()) - { + } else if (party != null) { + for (L2PcInstance partyMember : party.getMembers()) { partyMember.destroyItemByItemId("Quest", RED_CORAL, 1, player, true); teleportPlayer(partyMember, loc, npc.getInstanceId()); } - } - else - { + } else { teleportPlayer(player, loc, npc.getInstanceId()); } } - } - else if (npc.getId() == ORACLE_GUIDE_3) - { - if ((world.getStatus() < 30) && checkBaylorConditions(player)) - { + } else if (npc.getId() == ORACLE_GUIDE_3) { + if ((world.getStatus() < 30) && checkBaylorConditions(player)) { world._raiders.clear(); L2Party party = player.getParty(); - if (party == null) - { + if (party == null) { world._raiders.add(player); - } - else - { - for (L2PcInstance partyMember : party.getMembers()) - { + } else { + for (L2PcInstance partyMember : party.getMembers()) { // int rnd = getRandom(100); // partyMember.destroyItemByItemId("Quest", (rnd < 33 ? BOSS_CRYSTAL_1:(rnd < 67 ? BOSS_CRYSTAL_2:BOSS_CRYSTAL_3)), 1, partyMember, true); Crystals are no longer beign cunsumed while entering to Baylor Lair. world._raiders.add(partyMember); } } - } - else - { + } else { return ""; } world.setStatus(30); @@ -1922,14 +1571,12 @@ public final class CrystalCaverns extends AbstractInstance int radius = 150; int i = 0; int members = world._raiders.size(); - for (L2PcInstance p : world._raiders) - { + for (L2PcInstance p : world._raiders) { int x = (int) (radius * Math.cos((i * 2 * Math.PI) / members)); int y = (int) (radius * Math.sin((i++ * 2 * Math.PI) / members)); p.teleToLocation(new Location(153571 + x, 142075 + y, -12737)); L2Summon pet = p.getSummon(); - if (pet != null) - { + if (pet != null) { pet.teleToLocation(new Location(153571 + x, 142075 + y, -12737), true); pet.broadcastPacket(new ValidateLocation(pet)); } @@ -1937,9 +1584,7 @@ public final class CrystalCaverns extends AbstractInstance p.broadcastPacket(new ValidateLocation(p)); } startQuestTimer("Baylor", 30000, npc, null); - } - else if ((npc.getId() == ORACLE_GUIDE_4) && (world.getStatus() == 31)) - { + } else if ((npc.getId() == ORACLE_GUIDE_4) && (world.getStatus() == 31)) { teleportPlayer(player, new Location(153522, 144212, -9747), npc.getInstanceId()); } } @@ -1947,17 +1592,13 @@ public final class CrystalCaverns extends AbstractInstance } @Override - public String onTrapAction(L2TrapInstance trap, L2Character trigger, TrapAction action) - { + public String onTrapAction(L2TrapInstance trap, L2Character trigger, TrapAction action) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(trap.getInstanceId()); - if (tmpworld instanceof CCWorld) - { + if (tmpworld instanceof CCWorld) { CCWorld world = (CCWorld) tmpworld; - switch (action) - { + switch (action) { case TRAP_DISARMED: - if (trap.getId() == DOOR_OPENING_TRAP[0]) - { + if (trap.getId() == DOOR_OPENING_TRAP[0]) { openDoor(24220001, world.getInstanceId()); runEmeraldRooms(world, ROOM1_SPAWNS, 1); } @@ -1968,20 +1609,15 @@ public final class CrystalCaverns extends AbstractInstance } @Override - public String onEnterZone(L2Character character, L2ZoneType zone) - { - if (character instanceof L2PcInstance) - { + public String onEnterZone(L2Character character, L2ZoneType zone) { + if (character instanceof L2PcInstance) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(character.getInstanceId()); - if (tmpworld instanceof CCWorld) - { + if (tmpworld instanceof CCWorld) { CCWorld world = (CCWorld) tmpworld; - if (world.getStatus() == 8) - { + if (world.getStatus() == 8) { int room; int[][] spawns; - switch (zone.getId()) - { + switch (zone.getId()) { case 20105: spawns = ROOM2_SPAWNS; room = 2; @@ -1997,21 +1633,16 @@ public final class CrystalCaverns extends AbstractInstance default: return super.onEnterZone(character, zone); } - for (L2DoorInstance door : InstanceManager.getInstance().getInstance(world.getInstanceId()).getDoors()) - { - if (door.getId() == (room + 24220000)) - { - if (door.getOpen()) - { + for (L2DoorInstance door : InstanceManager.getInstance().getInstance(world.getInstanceId()).getDoors()) { + if (door.getId() == (room + 24220000)) { + if (door.getOpen()) { return ""; } - if (!hasQuestItems((L2PcInstance) character, SECRET_KEY)) - { + if (!hasQuestItems((L2PcInstance) character, SECRET_KEY)) { return ""; } - if (world.roomsStatus[zone.getId() - 20104] == 0) - { + if (world.roomsStatus[zone.getId() - 20104] == 0) { runEmeraldRooms(world, spawns, room); } door.openMe(); @@ -2027,19 +1658,14 @@ public final class CrystalCaverns extends AbstractInstance } @Override - public String onExitZone(L2Character character, L2ZoneType zone) - { - if (character instanceof L2PcInstance) - { + public String onExitZone(L2Character character, L2ZoneType zone) { + if (character instanceof L2PcInstance) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(character.getInstanceId()); - if (tmpworld instanceof CCWorld) - { + if (tmpworld instanceof CCWorld) { CCWorld world = (CCWorld) tmpworld; - if (world.getStatus() == 8) - { + if (world.getStatus() == 8) { int doorId; - switch (zone.getId()) - { + switch (zone.getId()) { case 20105: doorId = 24220002; break; @@ -2052,12 +1678,9 @@ public final class CrystalCaverns extends AbstractInstance default: return super.onExitZone(character, zone); } - for (L2DoorInstance door : InstanceManager.getInstance().getInstance(world.getInstanceId()).getDoors()) - { - if (door.getId() == doorId) - { - if (door.getOpen() && (world.openedDoors.get(door) == character)) - { + for (L2DoorInstance door : InstanceManager.getInstance().getInstance(world.getInstanceId()).getDoors()) { + if (door.getId() == doorId) { + if (door.getOpen() && (world.openedDoors.get(door) == character)) { door.closeMe(); world.openedDoors.remove(door); } diff --git a/src/main/java/com/l2jserver/datapack/instances/DarkCloudMansion/DarkCloudMansion.java b/src/main/java/com/l2jserver/datapack/instances/DarkCloudMansion/DarkCloudMansion.java index 0be8844f37..813ff606b9 100644 --- a/src/main/java/com/l2jserver/datapack/instances/DarkCloudMansion/DarkCloudMansion.java +++ b/src/main/java/com/l2jserver/datapack/instances/DarkCloudMansion/DarkCloudMansion.java @@ -42,10 +42,8 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; /** * Dark Cloud Mansion instance zone. */ -public final class DarkCloudMansion extends AbstractInstance -{ - protected class DMCWorld extends InstanceWorld - { +public final class DarkCloudMansion extends AbstractInstance { + protected class DMCWorld extends InstanceWorld { protected Map<String, DMCRoom> rooms = new ConcurrentHashMap<>(); } @@ -58,24 +56,20 @@ public final class DarkCloudMansion extends AbstractInstance private static int BSM = 32324; // Black Stone Monolith private static int SC = 22402; // Shadow Column // Mobs - private static int[] CCG = - { + private static int[] CCG = { 18369, 18370 }; // Chromatic Crystal Golem - private static int[] BM = - { + private static int[] BM = { 22272, 22273, 22274 }; // Beleth's Minions - private static int[] HG = - { + private static int[] HG = { 22264, 22264 }; // [22318,22319] #Hall Guards - private static int[] BS = - { + private static int[] BS = { 18371, 18372, 18373, @@ -84,8 +78,7 @@ public final class DarkCloudMansion extends AbstractInstance 18376, 18377 }; // Beleth's Samples - private static int[] TOKILL = - { + private static int[] TOKILL = { 18371, 18372, 18373, @@ -122,29 +115,25 @@ public final class DarkCloudMansion extends AbstractInstance // private static int W6 = 24230012; // Wall 6 // private static int W7 = 24230013; // Wall 7 private static boolean noRndWalk = true; - private static NpcStringId[] _spawnChat = - { + private static NpcStringId[] _spawnChat = { NpcStringId.IM_THE_REAL_ONE, NpcStringId.PICK_ME, NpcStringId.TRUST_ME, NpcStringId.NOT_THAT_DUDE_IM_THE_REAL_ONE, NpcStringId.DONT_BE_FOOLED_DONT_BE_FOOLED_IM_THE_REAL_ONE }; - private static NpcStringId[] _decayChat = - { + private static NpcStringId[] _decayChat = { NpcStringId.IM_THE_REAL_ONE_PHEW, NpcStringId.CANT_YOU_EVEN_FIND_OUT, NpcStringId.FIND_ME }; - private static NpcStringId[] _successChat = - { + private static NpcStringId[] _successChat = { NpcStringId.HUH_HOW_DID_YOU_KNOW_IT_WAS_ME, NpcStringId.EXCELLENT_CHOICE_TEEHEE, NpcStringId.YOUVE_DONE_WELL, NpcStringId.OH_VERY_SENSIBLE }; - private static NpcStringId[] _faildChat = - { + private static NpcStringId[] _faildChat = { NpcStringId.YOUVE_BEEN_FOOLED, NpcStringId.SORRY_BUT_IM_THE_FAKE_ONE }; @@ -205,8 +194,7 @@ public final class DarkCloudMansion extends AbstractInstance }; // @formatter:on - public DarkCloudMansion() - { + public DarkCloudMansion() { super(DarkCloudMansion.class.getSimpleName()); addFirstTalkId(BSM, SOTruth); addStartNpc(YIYEN); @@ -217,8 +205,7 @@ public final class DarkCloudMansion extends AbstractInstance addKillId(TOKILL); } - protected static class DMCNpc - { + protected static class DMCNpc { public L2Npc npc; public boolean isDead = false; public L2Npc golem = null; @@ -227,8 +214,7 @@ public final class DarkCloudMansion extends AbstractInstance public int count = 0; } - protected static class DMCRoom - { + protected static class DMCRoom { public List<DMCNpc> npcList = new ArrayList<>(); public int counter = 0; public int reset = 0; @@ -237,35 +223,28 @@ public final class DarkCloudMansion extends AbstractInstance } @Override - protected boolean checkConditions(L2PcInstance player) - { + protected boolean checkConditions(L2PcInstance player) { final L2Party party = player.getParty(); - if (party == null) - { + if (party == null) { player.sendPacket(SystemMessageId.NOT_IN_PARTY_CANT_ENTER); return false; } - if (party.getLeader() != player) - { + if (party.getLeader() != player) { player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); return false; } - if (party.getMemberCount() > 2) - { + if (party.getMemberCount() > 2) { player.sendPacket(SystemMessageId.PARTY_EXCEEDED_THE_LIMIT_CANT_ENTER); return false; } - for (L2PcInstance partyMember : party.getMembers()) - { - if (partyMember.getLevel() < 78) - { + for (L2PcInstance partyMember : party.getMembers()) { + if (partyMember.getLevel() < 78) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); sm.addPcName(partyMember); player.sendPacket(sm); return false; } - if (!partyMember.isInsideRadius(player, 1000, true, true)) - { + if (!partyMember.isInsideRadius(player, 1000, true, true)) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED); sm.addPcName(partyMember); player.sendPacket(sm); @@ -277,30 +256,23 @@ public final class DarkCloudMansion extends AbstractInstance } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { runStartRoom((DMCWorld) world); final L2Party party = player.getParty(); - if (party != null) - { - for (L2PcInstance partyMember : party.getMembers()) - { + if (party != null) { + for (L2PcInstance partyMember : party.getMembers()) { getQuestState(partyMember, true); world.addAllowed(partyMember.getObjectId()); teleportPlayer(partyMember, new Location(146534, 180464, -6117), world.getInstanceId()); } } - } - else - { + } else { teleportPlayer(player, new Location(146534, 180464, -6117), world.getInstanceId()); } } - protected void runStartRoom(DMCWorld world) - { + protected void runStartRoom(DMCWorld world) { world.setStatus(0); DMCRoom StartRoom = new DMCRoom(); DMCNpc thisnpc; @@ -308,87 +280,76 @@ public final class DarkCloudMansion extends AbstractInstance thisnpc = new DMCNpc(); thisnpc.npc = addSpawn(BM[0], 146817, 180335, -6117, 0, false, 0, false, world.getInstanceId()); StartRoom.npcList.add(thisnpc); - if (noRndWalk) - { + if (noRndWalk) { thisnpc.npc.setIsNoRndWalk(true); } thisnpc = new DMCNpc(); thisnpc.npc = addSpawn(BM[0], 146741, 180589, -6117, 0, false, 0, false, world.getInstanceId()); StartRoom.npcList.add(thisnpc); - if (noRndWalk) - { + if (noRndWalk) { thisnpc.npc.setIsNoRndWalk(true); } world.rooms.put("StartRoom", StartRoom); } - protected void spawnHall(DMCWorld world) - { + protected void spawnHall(DMCWorld world) { DMCRoom Hall = new DMCRoom(); DMCNpc thisnpc; world.rooms.remove("Hall"); // remove room instance to avoid adding mob every time thisnpc = new DMCNpc(); thisnpc.npc = addSpawn(BM[1], 147217, 180112, -6117, 0, false, 0, false, world.getInstanceId()); - if (noRndWalk) - { + if (noRndWalk) { thisnpc.npc.setIsNoRndWalk(true); } Hall.npcList.add(thisnpc); thisnpc = new DMCNpc(); thisnpc.npc = addSpawn(BM[2], 147217, 180209, -6117, 0, false, 0, false, world.getInstanceId()); - if (noRndWalk) - { + if (noRndWalk) { thisnpc.npc.setIsNoRndWalk(true); } Hall.npcList.add(thisnpc); thisnpc = new DMCNpc(); thisnpc.npc = addSpawn(BM[1], 148521, 180112, -6117, 0, false, 0, false, world.getInstanceId()); - if (noRndWalk) - { + if (noRndWalk) { thisnpc.npc.setIsNoRndWalk(true); } Hall.npcList.add(thisnpc); thisnpc = new DMCNpc(); thisnpc.npc = addSpawn(BM[0], 148521, 180209, -6117, 0, false, 0, false, world.getInstanceId()); - if (noRndWalk) - { + if (noRndWalk) { thisnpc.npc.setIsNoRndWalk(true); } Hall.npcList.add(thisnpc); thisnpc = new DMCNpc(); thisnpc.npc = addSpawn(BM[1], 148525, 180910, -6117, 0, false, 0, false, world.getInstanceId()); - if (noRndWalk) - { + if (noRndWalk) { thisnpc.npc.setIsNoRndWalk(true); } Hall.npcList.add(thisnpc); thisnpc = new DMCNpc(); thisnpc.npc = addSpawn(BM[2], 148435, 180910, -6117, 0, false, 0, false, world.getInstanceId()); - if (noRndWalk) - { + if (noRndWalk) { thisnpc.npc.setIsNoRndWalk(true); } Hall.npcList.add(thisnpc); thisnpc = new DMCNpc(); thisnpc.npc = addSpawn(BM[1], 147242, 180910, -6117, 0, false, 0, false, world.getInstanceId()); - if (noRndWalk) - { + if (noRndWalk) { thisnpc.npc.setIsNoRndWalk(true); } Hall.npcList.add(thisnpc); thisnpc = new DMCNpc(); thisnpc.npc = addSpawn(BM[2], 147242, 180819, -6117, 0, false, 0, false, world.getInstanceId()); - if (noRndWalk) - { + if (noRndWalk) { thisnpc.npc.setIsNoRndWalk(true); } Hall.npcList.add(thisnpc); @@ -396,46 +357,40 @@ public final class DarkCloudMansion extends AbstractInstance world.rooms.put("Hall", Hall); } - protected void runHall(DMCWorld world) - { + protected void runHall(DMCWorld world) { spawnHall(world); world.setStatus(1); openDoor(D1, world.getInstanceId()); } - protected void runFirstRoom(DMCWorld world) - { + protected void runFirstRoom(DMCWorld world) { DMCRoom FirstRoom = new DMCRoom(); DMCNpc thisnpc; thisnpc = new DMCNpc(); thisnpc.npc = addSpawn(HG[1], 147842, 179837, -6117, 0, false, 0, false, world.getInstanceId()); - if (noRndWalk) - { + if (noRndWalk) { thisnpc.npc.setIsNoRndWalk(true); } FirstRoom.npcList.add(thisnpc); thisnpc = new DMCNpc(); thisnpc.npc = addSpawn(HG[0], 147711, 179708, -6117, 0, false, 0, false, world.getInstanceId()); - if (noRndWalk) - { + if (noRndWalk) { thisnpc.npc.setIsNoRndWalk(true); } FirstRoom.npcList.add(thisnpc); thisnpc = new DMCNpc(); thisnpc.npc = addSpawn(HG[1], 147842, 179552, -6117, 0, false, 0, false, world.getInstanceId()); - if (noRndWalk) - { + if (noRndWalk) { thisnpc.npc.setIsNoRndWalk(true); } FirstRoom.npcList.add(thisnpc); thisnpc = new DMCNpc(); thisnpc.npc = addSpawn(HG[0], 147964, 179708, -6117, 0, false, 0, false, world.getInstanceId()); - if (noRndWalk) - { + if (noRndWalk) { thisnpc.npc.setIsNoRndWalk(true); } FirstRoom.npcList.add(thisnpc); @@ -445,23 +400,20 @@ public final class DarkCloudMansion extends AbstractInstance openDoor(D2, world.getInstanceId()); } - protected void runHall2(DMCWorld world) - { + protected void runHall2(DMCWorld world) { addSpawn(SOFaith, 147818, 179643, -6117, 0, false, 0, false, world.getInstanceId()); spawnHall(world); world.setStatus(3); } - protected void runSecondRoom(DMCWorld world) - { + protected void runSecondRoom(DMCWorld world) { DMCRoom SecondRoom = new DMCRoom(); DMCNpc thisnpc; // TODO: find a better way to initialize to [1,0,0,0,0,0,0] SecondRoom.Order = new int[7]; SecondRoom.Order[0] = 1; - for (int i = 1; i < 7; i++) - { + for (int i = 1; i < 7; i++) { SecondRoom.Order[i] = 0; } @@ -502,51 +454,43 @@ public final class DarkCloudMansion extends AbstractInstance openDoor(D3, world.getInstanceId()); } - protected void runHall3(DMCWorld world) - { + protected void runHall3(DMCWorld world) { addSpawn(SOAdversity, 147808, 181281, -6117, 16383, false, 0, false, world.getInstanceId()); spawnHall(world); world.setStatus(5); } - protected void runThirdRoom(DMCWorld world) - { + protected void runThirdRoom(DMCWorld world) { DMCRoom ThirdRoom = new DMCRoom(); DMCNpc thisnpc = new DMCNpc(); thisnpc.isDead = false; thisnpc.npc = addSpawn(BM[1], 148765, 180450, -6117, 0, false, 0, false, world.getInstanceId()); - if (noRndWalk) - { + if (noRndWalk) { thisnpc.npc.setIsNoRndWalk(true); } ThirdRoom.npcList.add(thisnpc); thisnpc.npc = addSpawn(BM[2], 148865, 180190, -6117, 0, false, 0, false, world.getInstanceId()); - if (noRndWalk) - { + if (noRndWalk) { thisnpc.npc.setIsNoRndWalk(true); } ThirdRoom.npcList.add(thisnpc); thisnpc.npc = addSpawn(BM[1], 148995, 180190, -6117, 0, false, 0, false, world.getInstanceId()); - if (noRndWalk) - { + if (noRndWalk) { thisnpc.npc.setIsNoRndWalk(true); } ThirdRoom.npcList.add(thisnpc); thisnpc.npc = addSpawn(BM[0], 149090, 180450, -6117, 0, false, 0, false, world.getInstanceId()); - if (noRndWalk) - { + if (noRndWalk) { thisnpc.npc.setIsNoRndWalk(true); } ThirdRoom.npcList.add(thisnpc); thisnpc.npc = addSpawn(BM[1], 148995, 180705, -6117, 0, false, 0, false, world.getInstanceId()); - if (noRndWalk) - { + if (noRndWalk) { thisnpc.npc.setIsNoRndWalk(true); } ThirdRoom.npcList.add(thisnpc); thisnpc.npc = addSpawn(BM[2], 148865, 180705, -6117, 0, false, 0, false, world.getInstanceId()); - if (noRndWalk) - { + if (noRndWalk) { thisnpc.npc.setIsNoRndWalk(true); } ThirdRoom.npcList.add(thisnpc); @@ -555,45 +499,38 @@ public final class DarkCloudMansion extends AbstractInstance openDoor(D4, world.getInstanceId()); } - protected void runThirdRoom2(DMCWorld world) - { + protected void runThirdRoom2(DMCWorld world) { addSpawn(SOAdventure, 148910, 178397, -6117, 16383, false, 0, false, world.getInstanceId()); DMCRoom ThirdRoom = new DMCRoom(); DMCNpc thisnpc = new DMCNpc(); thisnpc.isDead = false; thisnpc.npc = addSpawn(BM[1], 148765, 180450, -6117, 0, false, 0, false, world.getInstanceId()); - if (noRndWalk) - { + if (noRndWalk) { thisnpc.npc.setIsNoRndWalk(true); } ThirdRoom.npcList.add(thisnpc); thisnpc.npc = addSpawn(BM[2], 148865, 180190, -6117, 0, false, 0, false, world.getInstanceId()); - if (noRndWalk) - { + if (noRndWalk) { thisnpc.npc.setIsNoRndWalk(true); } ThirdRoom.npcList.add(thisnpc); thisnpc.npc = addSpawn(BM[1], 148995, 180190, -6117, 0, false, 0, false, world.getInstanceId()); - if (noRndWalk) - { + if (noRndWalk) { thisnpc.npc.setIsNoRndWalk(true); } ThirdRoom.npcList.add(thisnpc); thisnpc.npc = addSpawn(BM[0], 149090, 180450, -6117, 0, false, 0, false, world.getInstanceId()); - if (noRndWalk) - { + if (noRndWalk) { thisnpc.npc.setIsNoRndWalk(true); } ThirdRoom.npcList.add(thisnpc); thisnpc.npc = addSpawn(BM[1], 148995, 180705, -6117, 0, false, 0, false, world.getInstanceId()); - if (noRndWalk) - { + if (noRndWalk) { thisnpc.npc.setIsNoRndWalk(true); } ThirdRoom.npcList.add(thisnpc); thisnpc.npc = addSpawn(BM[2], 148865, 180705, -6117, 0, false, 0, false, world.getInstanceId()); - if (noRndWalk) - { + if (noRndWalk) { thisnpc.npc.setIsNoRndWalk(true); } ThirdRoom.npcList.add(thisnpc); @@ -601,8 +538,7 @@ public final class DarkCloudMansion extends AbstractInstance world.setStatus(8); } - protected void runForthRoom(DMCWorld world) - { + protected void runForthRoom(DMCWorld world) { DMCRoom ForthRoom = new DMCRoom(); ForthRoom.counter = 0; DMCNpc thisnpc; @@ -610,21 +546,17 @@ public final class DarkCloudMansion extends AbstractInstance int templist[][] = new int[7][5]; int xx = 0; - for (int i = 0; i < 7; i++) - { + for (int i = 0; i < 7; i++) { temp[i] = getRandom(ColumnRows.length); } - for (int i = 0; i < 7; i++) - { + for (int i = 0; i < 7; i++) { templist[i] = ColumnRows[temp[i]]; } - for (int x = 148660; x < 149285; x += 125) - { + for (int x = 148660; x < 149285; x += 125) { int yy = 0; - for (int y = 179280; y > 178405; y -= 125) - { + for (int y = 179280; y > 178405; y -= 125) { thisnpc = new DMCNpc(); thisnpc.npc = addSpawn(SC, x, y, -6115, 16215, false, 0, false, world.getInstanceId()); thisnpc.status = templist[yy][xx]; @@ -635,10 +567,8 @@ public final class DarkCloudMansion extends AbstractInstance xx++; } // TODO: unify this into previous loop - for (DMCNpc npc : ForthRoom.npcList) - { - if (npc.status == 0) - { + for (DMCNpc npc : ForthRoom.npcList) { + if (npc.status == 0) { npc.npc.setIsInvul(true); } } @@ -648,15 +578,13 @@ public final class DarkCloudMansion extends AbstractInstance openDoor(D5, world.getInstanceId()); } - protected void runFifthRoom(DMCWorld world) - { + protected void runFifthRoom(DMCWorld world) { spawnFifthRoom(world); world.setStatus(9); openDoor(D6, world.getInstanceId()); } - private void spawnFifthRoom(DMCWorld world) - { + private void spawnFifthRoom(DMCWorld world) { int idx = 0; int temp[] = new int[6]; DMCRoom FifthRoom = new DMCRoom(); @@ -667,8 +595,7 @@ public final class DarkCloudMansion extends AbstractInstance FifthRoom.reset = 0; FifthRoom.founded = 0; - for (int x = 148720; x < 149175; x += 65) - { + for (int x = 148720; x < 149175; x += 65) { thisnpc = new DMCNpc(); thisnpc.npc = addSpawn(BS[idx], x, 182145, -6117, 48810, false, 0, false, world.getInstanceId()); thisnpc.npc.setIsNoRndWalk(true); @@ -676,12 +603,9 @@ public final class DarkCloudMansion extends AbstractInstance thisnpc.status = temp[idx]; thisnpc.count = 0; FifthRoom.npcList.add(thisnpc); - if ((temp[idx] == 1) && (getRandom(100) < 95)) - { + if ((temp[idx] == 1) && (getRandom(100) < 95)) { thisnpc.npc.broadcastPacket(new NpcSay(thisnpc.npc.getObjectId(), 0, thisnpc.npc.getId(), _spawnChat[getRandom(_spawnChat.length)])); - } - else if ((temp[idx] != 1) && (getRandom(100) < 67)) - { + } else if ((temp[idx] != 1) && (getRandom(100) < 67)) { thisnpc.npc.broadcastPacket(new NpcSay(thisnpc.npc.getObjectId(), 0, thisnpc.npc.getId(), _spawnChat[getRandom(_spawnChat.length)])); } idx++; @@ -690,17 +614,13 @@ public final class DarkCloudMansion extends AbstractInstance world.rooms.put("FifthRoom", FifthRoom); } - protected boolean checkKillProgress(L2Npc npc, DMCRoom room) - { + protected boolean checkKillProgress(L2Npc npc, DMCRoom room) { boolean cont = true; - for (DMCNpc npcobj : room.npcList) - { - if (npcobj.npc == npc) - { + for (DMCNpc npcobj : room.npcList) { + if (npcobj.npc == npc) { npcobj.isDead = true; } - if (npcobj.isDead == false) - { + if (npcobj.isDead == false) { cont = false; } } @@ -708,10 +628,8 @@ public final class DarkCloudMansion extends AbstractInstance return cont; } - protected void spawnRndGolem(DMCWorld world, DMCNpc npc) - { - if (npc.golem != null) - { + protected void spawnRndGolem(DMCWorld world, DMCNpc npc) { + if (npc.golem != null) { return; } @@ -721,21 +639,16 @@ public final class DarkCloudMansion extends AbstractInstance int y = GolemSpawn[i][2]; npc.golem = addSpawn(mobId, x, y, -6117, 0, false, 0, false, world.getInstanceId()); - if (noRndWalk) - { + if (noRndWalk) { npc.golem.setIsNoRndWalk(true); } } - protected void checkStone(L2Npc npc, int order[], DMCNpc npcObj, DMCWorld world) - { - for (int i = 1; i < 7; i++) - { + protected void checkStone(L2Npc npc, int order[], DMCNpc npcObj, DMCWorld world) { + for (int i = 1; i < 7; i++) { // if there is a non zero value in the precedent step, the sequence is ok - if ((order[i] == 0) && (order[i - 1] != 0)) - { - if ((npcObj.order == i) && (npcObj.status == 0)) - { + if ((order[i] == 0) && (order[i - 1] != 0)) { + if ((npcObj.order == i) && (npcObj.status == 0)) { order[i] = 1; npcObj.status = 1; npcObj.isDead = true; @@ -748,89 +661,65 @@ public final class DarkCloudMansion extends AbstractInstance spawnRndGolem(world, npcObj); } - protected void endInstance(DMCWorld world) - { + protected void endInstance(DMCWorld world) { world.setStatus(10); addSpawn(SOTruth, 148911, 181940, -6117, 16383, false, 0, false, world.getInstanceId()); world.rooms.clear(); } - protected void checkBelethSample(DMCWorld world, L2Npc npc, L2PcInstance player) - { + protected void checkBelethSample(DMCWorld world, L2Npc npc, L2PcInstance player) { DMCRoom FifthRoom = world.rooms.get("FifthRoom"); - for (DMCNpc mob : FifthRoom.npcList) - { - if (mob.npc == npc) - { - if (mob.count == 0) - { + for (DMCNpc mob : FifthRoom.npcList) { + if (mob.npc == npc) { + if (mob.count == 0) { mob.count = 1; - if (mob.status == 1) - { + if (mob.status == 1) { mob.npc.broadcastPacket(new NpcSay(mob.npc.getObjectId(), Say2.NPC_ALL, mob.npc.getId(), _successChat[getRandom(_successChat.length)])); FifthRoom.founded += 1; startQuestTimer("decayMe", 1500, npc, player); - } - else - { + } else { FifthRoom.reset = 1; mob.npc.broadcastPacket(new NpcSay(mob.npc.getObjectId(), Say2.NPC_ALL, mob.npc.getId(), _faildChat[getRandom(_faildChat.length)])); startQuestTimer("decayChatBelethSamples", 4000, npc, player); startQuestTimer("decayBelethSamples", 4500, npc, player); } - } - else - { + } else { return; } } } } - protected void killedBelethSample(DMCWorld world, L2Npc npc) - { + protected void killedBelethSample(DMCWorld world, L2Npc npc) { int decayedSamples = 0; DMCRoom FifthRoom = world.rooms.get("FifthRoom"); - for (DMCNpc mob : FifthRoom.npcList) - { - if (mob.npc == npc) - { + for (DMCNpc mob : FifthRoom.npcList) { + if (mob.npc == npc) { decayedSamples += 1; mob.count = 2; - } - else - { - if (mob.count == 2) - { + } else { + if (mob.count == 2) { decayedSamples += 1; } } } - if (FifthRoom.reset == 1) - { - for (DMCNpc mob : FifthRoom.npcList) - { - if ((mob.count == 0) || ((mob.status == 1) && (mob.count != 2))) - { + if (FifthRoom.reset == 1) { + for (DMCNpc mob : FifthRoom.npcList) { + if ((mob.count == 0) || ((mob.status == 1) && (mob.count != 2))) { decayedSamples += 1; mob.npc.decayMe(); mob.count = 2; } } - if (decayedSamples == 7) - { + if (decayedSamples == 7) { startQuestTimer("respawnFifth", 6000, npc, null); } - } - else - { - if ((FifthRoom.reset == 0) && (FifthRoom.founded == 3)) - { - for (DMCNpc mob : FifthRoom.npcList) - { + } else { + if ((FifthRoom.reset == 0) && (FifthRoom.founded == 3)) { + for (DMCNpc mob : FifthRoom.npcList) { mob.npc.decayMe(); } endInstance(world); @@ -838,14 +727,11 @@ public final class DarkCloudMansion extends AbstractInstance } } - protected boolean allStonesDone(DMCWorld world) - { + protected boolean allStonesDone(DMCWorld world) { DMCRoom SecondRoom = world.rooms.get("SecondRoom"); - for (DMCNpc mob : SecondRoom.npcList) - { - if (mob.isDead) - { + for (DMCNpc mob : SecondRoom.npcList) { + if (mob.isDead) { continue; } return false; @@ -854,32 +740,24 @@ public final class DarkCloudMansion extends AbstractInstance return true; } - protected void removeMonoliths(DMCWorld world) - { + protected void removeMonoliths(DMCWorld world) { DMCRoom SecondRoom = world.rooms.get("SecondRoom"); - for (DMCNpc mob : SecondRoom.npcList) - { + for (DMCNpc mob : SecondRoom.npcList) { mob.npc.decayMe(); } } - protected void chkShadowColumn(DMCWorld world, L2Npc npc) - { + protected void chkShadowColumn(DMCWorld world, L2Npc npc) { DMCRoom ForthRoom = world.rooms.get("ForthRoom"); - for (DMCNpc mob : ForthRoom.npcList) - { - if (mob.npc == npc) - { - for (int i = 0; i < 7; i++) - { - if ((mob.order == i) && (ForthRoom.counter == i)) - { + for (DMCNpc mob : ForthRoom.npcList) { + if (mob.npc == npc) { + for (int i = 0; i < 7; i++) { + if ((mob.order == i) && (ForthRoom.counter == i)) { openDoor(W1 + i, world.getInstanceId()); ForthRoom.counter += 1; - if (ForthRoom.counter == 7) - { + if (ForthRoom.counter == 7) { runThirdRoom2(world); } } @@ -889,65 +767,45 @@ public final class DarkCloudMansion extends AbstractInstance } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (npc == null) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (npc == null) { return ""; } final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); final DMCWorld world; - if (tmpworld instanceof DMCWorld) - { + if (tmpworld instanceof DMCWorld) { world = (DMCWorld) tmpworld; - } - else - { + } else { return ""; } - if (world.rooms.containsKey("FifthRoom")) - { + if (world.rooms.containsKey("FifthRoom")) { DMCRoom FifthRoom = world.rooms.get("FifthRoom"); - if (event.equalsIgnoreCase("decayMe")) - { - for (DMCNpc mob : FifthRoom.npcList) - { - if ((mob.npc == npc) || ((FifthRoom.reset == 0) && (FifthRoom.founded == 3))) - { + if (event.equalsIgnoreCase("decayMe")) { + for (DMCNpc mob : FifthRoom.npcList) { + if ((mob.npc == npc) || ((FifthRoom.reset == 0) && (FifthRoom.founded == 3))) { mob.npc.decayMe(); mob.count = 2; } } - if ((FifthRoom.reset == 0) && (FifthRoom.founded == 3)) - { + if ((FifthRoom.reset == 0) && (FifthRoom.founded == 3)) { endInstance(world); } - } - else if (event.equalsIgnoreCase("decayBelethSamples")) - { - for (DMCNpc mob : FifthRoom.npcList) - { - if (mob.count == 0) - { + } else if (event.equalsIgnoreCase("decayBelethSamples")) { + for (DMCNpc mob : FifthRoom.npcList) { + if (mob.count == 0) { mob.npc.decayMe(); mob.count = 2; } } - } - else if (event.equalsIgnoreCase("decayChatBelethSamples")) - { - for (DMCNpc mob : FifthRoom.npcList) - { - if (mob.status == 1) - { + } else if (event.equalsIgnoreCase("decayChatBelethSamples")) { + for (DMCNpc mob : FifthRoom.npcList) { + if (mob.status == 1) { mob.npc.broadcastPacket(new NpcSay(mob.npc.getObjectId(), Say2.NPC_ALL, mob.npc.getId(), _decayChat[getRandom(_decayChat.length)])); } } - } - else if (event.equalsIgnoreCase("respawnFifth")) - { + } else if (event.equalsIgnoreCase("respawnFifth")) { spawnFifthRoom(world); } } @@ -956,79 +814,58 @@ public final class DarkCloudMansion extends AbstractInstance } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); final DMCWorld world; - if (tmpworld instanceof DMCWorld) - { + if (tmpworld instanceof DMCWorld) { world = (DMCWorld) tmpworld; - if (world.getStatus() == 0) - { - if (checkKillProgress(npc, world.rooms.get("StartRoom"))) - { + if (world.getStatus() == 0) { + if (checkKillProgress(npc, world.rooms.get("StartRoom"))) { runHall(world); } } - if (world.getStatus() == 1) - { - if (checkKillProgress(npc, world.rooms.get("Hall"))) - { + if (world.getStatus() == 1) { + if (checkKillProgress(npc, world.rooms.get("Hall"))) { runFirstRoom(world); } } - if (world.getStatus() == 2) - { - if (checkKillProgress(npc, world.rooms.get("FirstRoom"))) - { + if (world.getStatus() == 2) { + if (checkKillProgress(npc, world.rooms.get("FirstRoom"))) { runHall2(world); } } - if (world.getStatus() == 3) - { - if (checkKillProgress(npc, world.rooms.get("Hall"))) - { + if (world.getStatus() == 3) { + if (checkKillProgress(npc, world.rooms.get("Hall"))) { runSecondRoom(world); } } - if (world.getStatus() == 4) - { + if (world.getStatus() == 4) { DMCRoom SecondRoom = world.rooms.get("SecondRoom"); - for (DMCNpc mob : SecondRoom.npcList) - { - if (mob.golem == npc) - { + for (DMCNpc mob : SecondRoom.npcList) { + if (mob.golem == npc) { mob.golem = null; } } } - if (world.getStatus() == 5) - { - if (checkKillProgress(npc, world.rooms.get("Hall"))) - { + if (world.getStatus() == 5) { + if (checkKillProgress(npc, world.rooms.get("Hall"))) { runThirdRoom(world); } } - if (world.getStatus() == 6) - { - if (checkKillProgress(npc, world.rooms.get("ThirdRoom"))) - { + if (world.getStatus() == 6) { + if (checkKillProgress(npc, world.rooms.get("ThirdRoom"))) { runForthRoom(world); } } - if (world.getStatus() == 7) - { + if (world.getStatus() == 7) { chkShadowColumn(world, npc); } - if (world.getStatus() == 8) - { - if (checkKillProgress(npc, world.rooms.get("ThirdRoom2"))) - { + if (world.getStatus() == 8) { + if (checkKillProgress(npc, world.rooms.get("ThirdRoom2"))) { runFifthRoom(world); } } - if (world.getStatus() == 9) - { + if (world.getStatus() == 9) { killedBelethSample(world, npc); } } @@ -1036,29 +873,22 @@ public final class DarkCloudMansion extends AbstractInstance } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) { final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); final DMCWorld world; - if (tmpworld instanceof DMCWorld) - { + if (tmpworld instanceof DMCWorld) { world = (DMCWorld) tmpworld; - if (world.getStatus() == 7) - { + if (world.getStatus() == 7) { DMCRoom ForthRoom = world.rooms.get("ForthRoom"); - for (DMCNpc mob : ForthRoom.npcList) - { - if (mob.npc == npc) - { - if (mob.npc.isInvul() && (getRandom(100) < 12)) - { + for (DMCNpc mob : ForthRoom.npcList) { + if (mob.npc == npc) { + if (mob.npc.isInvul() && (getRandom(100) < 12)) { addSpawn(BM[getRandom(BM.length)], attacker.getX(), attacker.getY(), attacker.getZ(), 0, false, 0, false, world.getInstanceId()); } } } } - if (world.getStatus() == 9) - { + if (world.getStatus() == 9) { checkBelethSample(world, npc, attacker); } } @@ -1067,37 +897,29 @@ public final class DarkCloudMansion extends AbstractInstance } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); DMCWorld world; - if (tmpworld instanceof DMCWorld) - { + if (tmpworld instanceof DMCWorld) { world = (DMCWorld) tmpworld; - if (world.getStatus() == 4) - { + if (world.getStatus() == 4) { DMCRoom SecondRoom = world.rooms.get("SecondRoom"); - for (DMCNpc mob : SecondRoom.npcList) - { - if (mob.npc == npc) - { + for (DMCNpc mob : SecondRoom.npcList) { + if (mob.npc == npc) { checkStone(npc, SecondRoom.Order, mob, world); } } - if (allStonesDone(world)) - { + if (allStonesDone(world)) { removeMonoliths(world); runHall3(world); } } - if ((npc.getId() == SOTruth) && (world.getStatus() == 10)) - { + if ((npc.getId() == SOTruth) && (world.getStatus() == 10)) { npc.showChatWindow(player); - if (!hasQuestItems(player, CC)) - { + if (!hasQuestItems(player, CC)) { giveItems(player, CC, 1); } } @@ -1107,37 +929,27 @@ public final class DarkCloudMansion extends AbstractInstance } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final int npcId = npc.getId(); - if (npcId == YIYEN) - { + if (npcId == YIYEN) { enterInstance(player, new DMCWorld(), "DarkCloudMansion.xml", TEMPLATE_ID); - } - else - { + } else { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); DMCWorld world; - if (tmpworld instanceof DMCWorld) - { + if (tmpworld instanceof DMCWorld) { world = (DMCWorld) tmpworld; - } - else - { + } else { return ""; } - if (npcId == SOTruth) - { - if (world.isAllowed(player.getObjectId())) - { + if (npcId == SOTruth) { + if (world.isAllowed(player.getObjectId())) { world.removeAllowed(player.getObjectId()); } teleportPlayer(player, new Location(139968, 150367, -3111), 0); int instanceId = npc.getInstanceId(); Instance instance = InstanceManager.getInstance().getInstance(instanceId); - if (instance.getPlayers().isEmpty()) - { + if (instance.getPlayers().isEmpty()) { InstanceManager.getInstance().destroyInstance(instanceId); } return ""; diff --git a/src/main/java/com/l2jserver/datapack/instances/DisciplesNecropolisPast/DisciplesNecropolisPast.java b/src/main/java/com/l2jserver/datapack/instances/DisciplesNecropolisPast/DisciplesNecropolisPast.java index 0513d4a161..4998355677 100644 --- a/src/main/java/com/l2jserver/datapack/instances/DisciplesNecropolisPast/DisciplesNecropolisPast.java +++ b/src/main/java/com/l2jserver/datapack/instances/DisciplesNecropolisPast/DisciplesNecropolisPast.java @@ -42,10 +42,8 @@ import com.l2jserver.gameserver.util.Util; * Disciple's Necropolis Past instance zone. * @author Adry_85 */ -public final class DisciplesNecropolisPast extends AbstractInstance -{ - protected class DNPWorld extends InstanceWorld - { +public final class DisciplesNecropolisPast extends AbstractInstance { + protected class DNPWorld extends InstanceWorld { protected final List<L2Npc> anakimGroup = new ArrayList<>(); protected final List<L2Npc> lilithGroup = new ArrayList<>(); protected int countKill = 0; @@ -79,8 +77,7 @@ public final class DisciplesNecropolisPast extends AbstractInstance // Skills private static final SkillHolder SEAL_ISOLATION = new SkillHolder(5980, 3); private static final Map<Integer, SkillHolder> SKILLS = new HashMap<>(); - static - { + static { SKILLS.put(32715, new SkillHolder(6187)); // Presentation - Lilith Battle SKILLS.put(32716, new SkillHolder(6188)); // Presentation - Lilith's Steward Battle1 SKILLS.put(32717, new SkillHolder(6190)); // Presentation - Lilith's Bodyguards Battle1 @@ -93,8 +90,7 @@ public final class DisciplesNecropolisPast extends AbstractInstance private static final Location ENTER = new Location(-89554, 216078, -7488, 0, 0); private static final Location EXIT = new Location(171895, -17501, -4903, 0, 0); // NpcStringId - private static final NpcStringId[] LILITH_SHOUT = - { + private static final NpcStringId[] LILITH_SHOUT = { NpcStringId.HOW_DARE_YOU_TRY_TO_CONTEND_AGAINST_ME_IN_STRENGTH_RIDICULOUS, NpcStringId.ANAKIM_IN_THE_NAME_OF_GREAT_SHILIEN_I_WILL_CUT_YOUR_THROAT, NpcStringId.YOU_CANNOT_BE_THE_MATCH_OF_LILITH_I_LL_TEACH_YOU_A_LESSON @@ -109,8 +105,7 @@ public final class DisciplesNecropolisPast extends AbstractInstance private static final int DISCIPLES_NECROPOLIS_DOOR = 17240111; private static final Map<Integer, Location> LILITH_SPAWN = new HashMap<>(); private static final Map<Integer, Location> ANAKIM_SPAWN = new HashMap<>(); - static - { + static { LILITH_SPAWN.put(LILITH, new Location(-83175, 217021, -7504, 49151)); LILITH_SPAWN.put(LILITHS_STEWARD, new Location(-83327, 216938, -7492, 50768)); LILITH_SPAWN.put(LILITHS_ELITE, new Location(-83003, 216909, -7492, 4827)); @@ -120,8 +115,7 @@ public final class DisciplesNecropolisPast extends AbstractInstance ANAKIM_SPAWN.put(ANAKIMS_EXECUTOR, new Location(-83031, 216604, -7492, 17071)); } - public DisciplesNecropolisPast() - { + public DisciplesNecropolisPast() { super(DisciplesNecropolisPast.class.getSimpleName()); addAttackId(SEAL_DEVICE); addFirstTalkId(SHUNAIMAN, LEON, DISCIPLES_GATEKEEPER); @@ -132,25 +126,20 @@ public final class DisciplesNecropolisPast extends AbstractInstance addTalkId(PROMISE_OF_MAMMON, SHUNAIMAN, LEON, DISCIPLES_GATEKEEPER); } - protected void spawnNPC(DNPWorld world) - { - for (Map.Entry<Integer, Location> entry : LILITH_SPAWN.entrySet()) - { + protected void spawnNPC(DNPWorld world) { + for (Map.Entry<Integer, Location> entry : LILITH_SPAWN.entrySet()) { final L2Npc npc = addSpawn(entry.getKey(), entry.getValue(), false, 0, false, world.getInstanceId()); world.lilithGroup.add(npc); } - for (Map.Entry<Integer, Location> entry : ANAKIM_SPAWN.entrySet()) - { + for (Map.Entry<Integer, Location> entry : ANAKIM_SPAWN.entrySet()) { final L2Npc enpc = addSpawn(entry.getKey(), entry.getValue(), false, 0, false, world.getInstanceId()); world.anakimGroup.add(enpc); } } - private synchronized void checkDoors(L2Npc npc, DNPWorld world) - { + private synchronized void checkDoors(L2Npc npc, DNPWorld world) { world.countKill++; - switch (world.countKill) - { + switch (world.countKill) { case 4: openDoor(DOOR_1, world.getInstanceId()); break; @@ -170,113 +159,82 @@ public final class DisciplesNecropolisPast extends AbstractInstance } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { spawnNPC((DNPWorld) world); world.addAllowed(player.getObjectId()); } teleportPlayer(player, ENTER, world.getInstanceId()); } - private void makeCast(L2Npc npc, List<L2Npc> targets) - { + private void makeCast(L2Npc npc, List<L2Npc> targets) { npc.setTarget(targets.get(getRandom(targets.size()))); - if (SKILLS.containsKey(npc.getId())) - { + if (SKILLS.containsKey(npc.getId())) { npc.doCast(SKILLS.get(npc.getId())); } } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player); - if (tmpworld instanceof DNPWorld) - { + if (tmpworld instanceof DNPWorld) { final DNPWorld world = (DNPWorld) tmpworld; - switch (event) - { - case "FINISH": - { - if (getQuestItemsCount(player, SEAL_OF_BINDING) >= 4) - { + switch (event) { + case "FINISH": { + if (getQuestItemsCount(player, SEAL_OF_BINDING) >= 4) { player.showQuestMovie(13); startQuestTimer("TELEPORT", 27000, null, player); } break; } - case "TELEPORT": - { + case "TELEPORT": { player.teleToLocation(ENTER, 0); break; } - case "FIGHT": - { - for (L2Npc caster : world.anakimGroup) - { - if ((caster != null) && !caster.isCastingNow()) - { + case "FIGHT": { + for (L2Npc caster : world.anakimGroup) { + if ((caster != null) && !caster.isCastingNow()) { makeCast(caster, world.lilithGroup); } - if ((caster != null) && (caster.getId() == ANAKIM)) - { - if (caster.isScriptValue(0)) - { + if ((caster != null) && (caster.getId() == ANAKIM)) { + if (caster.isScriptValue(0)) { caster.broadcastPacket(new NpcSay(caster.getObjectId(), Say2.NPC_SHOUT, caster.getId(), NpcStringId.YOU_SUCH_A_FOOL_THE_VICTORY_OVER_THIS_WAR_BELONGS_TO_SHILIEN)); caster.setScriptValue(1); - } - else if (getRandom(100) < 10) - { + } else if (getRandom(100) < 10) { caster.broadcastPacket(new NpcSay(caster.getObjectId(), Say2.NPC_SHOUT, caster.getId(), LILITH_SHOUT[getRandom(3)])); } } } - for (L2Npc caster : world.lilithGroup) - { - if ((caster != null) && !caster.isCastingNow()) - { + for (L2Npc caster : world.lilithGroup) { + if ((caster != null) && !caster.isCastingNow()) { makeCast(caster, world.anakimGroup); } - if ((caster != null) && (caster.getId() == 32715)) - { - if (caster.isScriptValue(0)) - { + if ((caster != null) && (caster.getId() == 32715)) { + if (caster.isScriptValue(0)) { caster.broadcastPacket(new NpcSay(caster.getObjectId(), Say2.NPC_SHOUT, caster.getId(), NpcStringId.FOR_THE_ETERNITY_OF_EINHASAD)); - if (Util.checkIfInRange(2000, caster, player, true)) - { + if (Util.checkIfInRange(2000, caster, player, true)) { player.sendPacket(new NpcSay(caster.getObjectId(), Say2.TELL, caster.getId(), NpcStringId.MY_POWERS_WEAKENING_HURRY_AND_TURN_ON_THE_SEALING_DEVICE)); } caster.setScriptValue(1); - } - else if (getRandom(100) < 10) - { - switch (getRandom(3)) - { - case 0: - { + } else if (getRandom(100) < 10) { + switch (getRandom(3)) { + case 0: { caster.broadcastPacket(new NpcSay(caster.getObjectId(), Say2.NPC_SHOUT, caster.getId(), NpcStringId.DEAR_SHILLIENS_OFFSPRINGS_YOU_ARE_NOT_CAPABLE_OF_CONFRONTING_US)); - if (Util.checkIfInRange(2000, caster, player, true)) - { + if (Util.checkIfInRange(2000, caster, player, true)) { player.sendPacket(new NpcSay(caster.getObjectId(), Say2.TELL, caster.getId(), NpcStringId.ALL_4_SEALING_DEVICES_MUST_BE_TURNED_ON)); } break; } - case 1: - { + case 1: { caster.broadcastPacket(new NpcSay(caster.getObjectId(), Say2.NPC_SHOUT, caster.getId(), NpcStringId.ILL_SHOW_YOU_THE_REAL_POWER_OF_EINHASAD)); - if (Util.checkIfInRange(2000, caster, player, true)) - { + if (Util.checkIfInRange(2000, caster, player, true)) { player.sendPacket(new NpcSay(caster.getObjectId(), Say2.TELL, caster.getId(), NpcStringId.LILITHS_ATTACK_IS_GETTING_STRONGER_GO_AHEAD_AND_TURN_IT_ON)); } break; } - case 2: - { + case 2: { caster.broadcastPacket(new NpcSay(caster.getObjectId(), Say2.NPC_SHOUT, caster.getId(), NpcStringId.DEAR_MILITARY_FORCE_OF_LIGHT_GO_DESTROY_THE_OFFSPRINGS_OF_SHILLIEN)); - if (Util.checkIfInRange(2000, caster, player, true)) - { + if (Util.checkIfInRange(2000, caster, player, true)) { player.sendPacket(new NpcSay(caster.getObjectId(), Say2.TELL, caster.getId(), NpcStringId.DEAR_S1_GIVE_ME_MORE_STRENGTH).addStringParameter(player.getName())); } break; @@ -294,44 +252,34 @@ public final class DisciplesNecropolisPast extends AbstractInstance } @Override - public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) - { - switch (npc.getId()) - { + public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) { + switch (npc.getId()) { case LILIM_BUTCHER: - case LILIM_GUARD_KNIGHT: - { - if (npc.isScriptValue(0)) - { + case LILIM_GUARD_KNIGHT: { + if (npc.isScriptValue(0)) { npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.THIS_PLACE_ONCE_BELONGED_TO_LORD_SHILEN)); npc.setScriptValue(1); } break; } case LILIM_MAGUS: - case LILIM_GREAT_MAGUS: - { - if (npc.isScriptValue(0)) - { + case LILIM_GREAT_MAGUS: { + if (npc.isScriptValue(0)) { npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.WHO_DARES_ENTER_THIS_PLACE)); npc.setScriptValue(1); } break; } case LILIM_KNIGHT_ERRANT: - case LILIM_KNIGHT: - { - if (npc.isScriptValue(0)) - { + case LILIM_KNIGHT: { + if (npc.isScriptValue(0)) { npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.THOSE_WHO_ARE_AFRAID_SHOULD_GET_AWAY_AND_THOSE_WHO_ARE_BRAVE_SHOULD_FIGHT)); npc.setScriptValue(1); } break; } - case LILIM_SLAYER: - { - if (npc.isScriptValue(0)) - { + case LILIM_SLAYER: { + if (npc.isScriptValue(0)) { npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.LEAVE_NOW)); npc.setScriptValue(1); } @@ -342,15 +290,11 @@ public final class DisciplesNecropolisPast extends AbstractInstance } @Override - public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isSummon) - { + public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isSummon) { InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player); - if (tmpworld instanceof DNPWorld) - { - if (npc.isScriptValue(0)) - { - if (npc.getCurrentHp() < (npc.getMaxHp() * 0.1)) - { + if (tmpworld instanceof DNPWorld) { + if (npc.isScriptValue(0)) { + if (npc.getCurrentHp() < (npc.getMaxHp() * 0.1)) { giveItems(player, SEAL_OF_BINDING, 1); player.sendPacket(SystemMessageId.THE_SEALING_DEVICE_ACTIVATION_COMPLETE); npc.setScriptValue(1); @@ -358,8 +302,7 @@ public final class DisciplesNecropolisPast extends AbstractInstance cancelQuestTimer("FIGHT", npc, player); } } - if (getRandom(100) < 50) - { + if (getRandom(100) < 50) { npc.doCast(SEAL_ISOLATION); } } @@ -367,38 +310,31 @@ public final class DisciplesNecropolisPast extends AbstractInstance } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return npc.getId() + ".htm"; } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player); - if (tmpworld instanceof DNPWorld) - { + if (tmpworld instanceof DNPWorld) { final DNPWorld world = (DNPWorld) tmpworld; checkDoors(npc, world); } - switch (npc.getId()) - { + switch (npc.getId()) { case LILIM_MAGUS: - case LILIM_GREAT_MAGUS: - { + case LILIM_GREAT_MAGUS: { npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.LORD_SHILEN_SOME_DAY_YOU_WILL_ACCOMPLISH_THIS_MISSION)); break; } case LILIM_KNIGHT_ERRANT: case LILIM_KNIGHT: - case LILIM_GUARD_KNIGHT: - { + case LILIM_GUARD_KNIGHT: { npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.WHY_ARE_YOU_GETTING_IN_OUR_WAY)); break; } - case LILIM_SLAYER: - { + case LILIM_SLAYER: { npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.FOR_SHILEN)); break; } @@ -407,37 +343,29 @@ public final class DisciplesNecropolisPast extends AbstractInstance } @Override - public final String onSpawn(L2Npc npc) - { + public final String onSpawn(L2Npc npc) { npc.setIsMortal(false); return super.onSpawn(npc); } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = talker.getQuestState(Q00196_SevenSignsSealOfTheEmperor.class.getSimpleName()); String htmltext = getNoQuestMsg(talker); - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (npc.getId()) - { - case PROMISE_OF_MAMMON: - { - if (qs.isCond(3) || qs.isCond(4)) - { + switch (npc.getId()) { + case PROMISE_OF_MAMMON: { + if (qs.isCond(3) || qs.isCond(4)) { enterInstance(talker, new DNPWorld(), "DisciplesNecropolisPast.xml", TEMPLATE_ID); return ""; } break; } - case LEON: - { - if (qs.getCond() >= 3) - { + case LEON: { + if (qs.getCond() >= 3) { takeItems(talker, SACRED_SWORD_OF_EINHASAD, -1); InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(talker); world.removeAllowed(talker.getObjectId()); @@ -446,13 +374,10 @@ public final class DisciplesNecropolisPast extends AbstractInstance } break; } - case DISCIPLES_GATEKEEPER: - { - if (qs.getCond() >= 3) - { + case DISCIPLES_GATEKEEPER: { + if (qs.getCond() >= 3) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof DNPWorld) - { + if (tmpworld instanceof DNPWorld) { DNPWorld world = (DNPWorld) tmpworld; openDoor(DISCIPLES_NECROPOLIS_DOOR, world.getInstanceId()); talker.showQuestMovie(12); diff --git a/src/main/java/com/l2jserver/datapack/instances/ElcadiasTent/ElcadiasTent.java b/src/main/java/com/l2jserver/datapack/instances/ElcadiasTent/ElcadiasTent.java index c537956096..41ff36a513 100644 --- a/src/main/java/com/l2jserver/datapack/instances/ElcadiasTent/ElcadiasTent.java +++ b/src/main/java/com/l2jserver/datapack/instances/ElcadiasTent/ElcadiasTent.java @@ -34,10 +34,8 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Elcadia's Tent instance zone. * @author Adry_85 */ -public final class ElcadiasTent extends AbstractInstance -{ - protected class ETWorld extends InstanceWorld - { +public final class ElcadiasTent extends AbstractInstance { + protected class ETWorld extends InstanceWorld { } @@ -50,8 +48,7 @@ public final class ElcadiasTent extends AbstractInstance // Misc private static final int TEMPLATE_ID = 158; - public ElcadiasTent() - { + public ElcadiasTent() { super(ElcadiasTent.class.getSimpleName()); addFirstTalkId(GRUFF_LOOKING_MAN, ELCADIA); addStartNpc(GRUFF_LOOKING_MAN, ELCADIA); @@ -59,10 +56,8 @@ public final class ElcadiasTent extends AbstractInstance } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { - if (npc.getId() == GRUFF_LOOKING_MAN) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { + if (npc.getId() == GRUFF_LOOKING_MAN) { final QuestState Q10292 = talker.getQuestState(Q10292_SevenSignsGirlOfDoubt.class.getSimpleName()); final QuestState Q10293 = talker.getQuestState(Q10293_SevenSignsForbiddenBookOfTheElmoreAdenKingdom.class.getSimpleName()); final QuestState Q10294 = talker.getQuestState(Q10294_SevenSignsToTheMonasteryOfSilence.class.getSimpleName()); @@ -71,17 +66,12 @@ public final class ElcadiasTent extends AbstractInstance || ((Q10292 != null) && Q10292.isCompleted() && (Q10293 == null)) // || ((Q10293 != null) && Q10293.isStarted()) // || ((Q10293 != null) && Q10293.isCompleted() && (Q10294 == null)) // - || ((Q10296 != null) && (Q10296.getMemoState() > 2) && (Q10296.getMemoState() < 4))) - { + || ((Q10296 != null) && (Q10296.getMemoState() > 2) && (Q10296.getMemoState() < 4))) { enterInstance(talker, new ETWorld(), "ElcadiasTent.xml", TEMPLATE_ID); - } - else - { + } else { return "32862-01.html"; } - } - else - { + } else { final InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(talker); world.removeAllowed(talker.getObjectId()); talker.setInstanceId(0); @@ -91,10 +81,8 @@ public final class ElcadiasTent extends AbstractInstance } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { world.addAllowed(player.getObjectId()); } teleportPlayer(player, START_LOC, world.getInstanceId(), false); diff --git a/src/main/java/com/l2jserver/datapack/instances/FinalEmperialTomb/FinalEmperialTomb.java b/src/main/java/com/l2jserver/datapack/instances/FinalEmperialTomb/FinalEmperialTomb.java index 29627b58cf..b739bca755 100644 --- a/src/main/java/com/l2jserver/datapack/instances/FinalEmperialTomb/FinalEmperialTomb.java +++ b/src/main/java/com/l2jserver/datapack/instances/FinalEmperialTomb/FinalEmperialTomb.java @@ -80,10 +80,8 @@ import com.l2jserver.gameserver.util.Util; * Use proper zone spawn system. * @author Gigiikun */ -public final class FinalEmperialTomb extends AbstractInstance -{ - protected class FETWorld extends InstanceWorld - { +public final class FinalEmperialTomb extends AbstractInstance { + protected class FETWorld extends InstanceWorld { protected Lock lock = new ReentrantLock(); protected List<L2Npc> npcList = new CopyOnWriteArrayList<>(); protected int darkChoirPlayerCount = 0; @@ -107,8 +105,7 @@ public final class FinalEmperialTomb extends AbstractInstance protected int scarlet_a = 0; } - protected static class FETSpawn - { + protected static class FETSpawn { public boolean isZone = false; public boolean isNeededNextFlag = false; public int npcId; @@ -120,15 +117,13 @@ public final class FinalEmperialTomb extends AbstractInstance public int count = 0; } - private static class FrintezzaSong - { + private static class FrintezzaSong { public SkillHolder skill; public SkillHolder effectSkill; public NpcStringId songName; public int chance; - public FrintezzaSong(SkillHolder sk, SkillHolder esk, NpcStringId sn, int ch) - { + public FrintezzaSong(SkillHolder sk, SkillHolder esk, NpcStringId sn, int ch) { skill = sk; effectSkill = esk; songName = sn; @@ -142,13 +137,11 @@ public final class FinalEmperialTomb extends AbstractInstance private static final int SCARLET1 = 29046; private static final int SCARLET2 = 29047; private static final int FRINTEZZA = 29045; - private static final int[] PORTRAITS = - { + private static final int[] PORTRAITS = { 29048, 29049 }; - private static final int[] DEMONS = - { + private static final int[] DEMONS = { 29050, 29051 }; @@ -157,8 +150,7 @@ public final class FinalEmperialTomb extends AbstractInstance // Items private static final int HALL_KEEPER_SUICIDAL_SOLDIER = 18333; private static final int DARK_CHOIR_PLAYER = 18339; - private static final int[] AI_DISABLED_MOBS = - { + private static final int[] AI_DISABLED_MOBS = { 18328 }; private static final int DEWDROP_OF_DESTRUCTION_ITEM_ID = 8556; @@ -170,8 +162,7 @@ public final class FinalEmperialTomb extends AbstractInstance protected static final SkillHolder INTRO_SKILL = new SkillHolder(5004, 1); private static final SkillHolder FIRST_MORPH_SKILL = new SkillHolder(5017, 1); - protected static final FrintezzaSong[] FRINTEZZASONGLIST = - { + protected static final FrintezzaSong[] FRINTEZZASONGLIST = { new FrintezzaSong(new SkillHolder(5007, 1), new SkillHolder(5008, 1), NpcStringId.REQUIEM_OF_HATRED, 5), new FrintezzaSong(new SkillHolder(5007, 2), new SkillHolder(5008, 2), NpcStringId.RONDO_OF_SOLITUDE, 50), new FrintezzaSong(new SkillHolder(5007, 3), new SkillHolder(5008, 3), NpcStringId.FRENETIC_TOCCATA, 70), @@ -191,8 +182,7 @@ public final class FinalEmperialTomb extends AbstractInstance private final Map<Integer, L2Territory> _spawnZoneList = new HashMap<>(); private final Map<Integer, List<FETSpawn>> _spawnList = new HashMap<>(); private final List<Integer> _mustKillMobsId = new ArrayList<>(); - protected static final int[] FIRST_ROOM_DOORS = - { + protected static final int[] FIRST_ROOM_DOORS = { 17130051, 17130052, 17130053, @@ -202,8 +192,7 @@ public final class FinalEmperialTomb extends AbstractInstance 17130057, 17130058 }; - protected static final int[] SECOND_ROOM_DOORS = - { + protected static final int[] SECOND_ROOM_DOORS = { 17130061, 17130062, 17130063, @@ -215,13 +204,11 @@ public final class FinalEmperialTomb extends AbstractInstance 17130069, 17130070 }; - protected static final int[] FIRST_ROUTE_DOORS = - { + protected static final int[] FIRST_ROUTE_DOORS = { 17130042, 17130043 }; - protected static final int[] SECOND_ROUTE_DOORS = - { + protected static final int[] SECOND_ROUTE_DOORS = { 17130045, 17130046 }; @@ -235,8 +222,7 @@ public final class FinalEmperialTomb extends AbstractInstance }; // @formatter:on - public FinalEmperialTomb() - { + public FinalEmperialTomb() { super(FinalEmperialTomb.class.getSimpleName()); load(); addAttackId(SCARLET1, FRINTEZZA); @@ -250,47 +236,37 @@ public final class FinalEmperialTomb extends AbstractInstance addSpellFinishedId(HALL_KEEPER_SUICIDAL_SOLDIER); } - private void load() - { + private void load() { @SuppressWarnings("unused") int spawnCount = 0; - try - { + try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false); factory.setIgnoringComments(true); File file = new File(server().getDatapackRoot(), "/data/spawnZones/final_emperial_tomb.xml"); - if (!file.exists()) - { + if (!file.exists()) { _log.severe("[Final Emperial Tomb] Missing final_emperial_tomb.xml. The quest wont work without it!"); return; } Document doc = factory.newDocumentBuilder().parse(file); Node first = doc.getFirstChild(); - if ((first != null) && "list".equalsIgnoreCase(first.getNodeName())) - { - for (Node n = first.getFirstChild(); n != null; n = n.getNextSibling()) - { - if ("npc".equalsIgnoreCase(n.getNodeName())) - { - for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) - { - if ("spawn".equalsIgnoreCase(d.getNodeName())) - { + if ((first != null) && "list".equalsIgnoreCase(first.getNodeName())) { + for (Node n = first.getFirstChild(); n != null; n = n.getNextSibling()) { + if ("npc".equalsIgnoreCase(n.getNodeName())) { + for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) { + if ("spawn".equalsIgnoreCase(d.getNodeName())) { NamedNodeMap attrs = d.getAttributes(); Node att = attrs.getNamedItem("npcId"); - if (att == null) - { + if (att == null) { _log.severe("[Final Emperial Tomb] Missing npcId in npc List, skipping"); continue; } int npcId = Integer.parseInt(attrs.getNamedItem("npcId").getNodeValue()); att = attrs.getNamedItem("flag"); - if (att == null) - { + if (att == null) { _log.severe("[Final Emperial Tomb] Missing flag in npc List npcId: " + npcId + ", skipping"); continue; } @@ -298,94 +274,68 @@ public final class FinalEmperialTomb extends AbstractInstance int flag = Integer.parseInt(attrs.getNamedItem("flag").getNodeValue()); _spawnList.putIfAbsent(flag, new ArrayList<FETSpawn>()); - for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling()) - { - if ("loc".equalsIgnoreCase(cd.getNodeName())) - { + for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling()) { + if ("loc".equalsIgnoreCase(cd.getNodeName())) { attrs = cd.getAttributes(); FETSpawn spw = new FETSpawn(); spw.npcId = npcId; att = attrs.getNamedItem("x"); - if (att != null) - { + if (att != null) { spw.x = Integer.parseInt(att.getNodeValue()); - } - else - { + } else { continue; } att = attrs.getNamedItem("y"); - if (att != null) - { + if (att != null) { spw.y = Integer.parseInt(att.getNodeValue()); - } - else - { + } else { continue; } att = attrs.getNamedItem("z"); - if (att != null) - { + if (att != null) { spw.z = Integer.parseInt(att.getNodeValue()); - } - else - { + } else { continue; } att = attrs.getNamedItem("heading"); - if (att != null) - { + if (att != null) { spw.h = Integer.parseInt(att.getNodeValue()); - } - else - { + } else { continue; } att = attrs.getNamedItem("mustKill"); - if (att != null) - { + if (att != null) { spw.isNeededNextFlag = Boolean.parseBoolean(att.getNodeValue()); } - if (spw.isNeededNextFlag) - { + if (spw.isNeededNextFlag) { _mustKillMobsId.add(npcId); } _spawnList.get(flag).add(spw); spawnCount++; - } - else if ("zone".equalsIgnoreCase(cd.getNodeName())) - { + } else if ("zone".equalsIgnoreCase(cd.getNodeName())) { attrs = cd.getAttributes(); FETSpawn spw = new FETSpawn(); spw.npcId = npcId; spw.isZone = true; att = attrs.getNamedItem("id"); - if (att != null) - { + if (att != null) { spw.zone = Integer.parseInt(att.getNodeValue()); - } - else - { + } else { continue; } att = attrs.getNamedItem("count"); - if (att != null) - { + if (att != null) { spw.count = Integer.parseInt(att.getNodeValue()); - } - else - { + } else { continue; } att = attrs.getNamedItem("mustKill"); - if (att != null) - { + if (att != null) { spw.isNeededNextFlag = Boolean.parseBoolean(att.getNodeValue()); } - if (spw.isNeededNextFlag) - { + if (spw.isNeededNextFlag) { _mustKillMobsId.add(npcId); } _spawnList.get(flag).add(spw); @@ -394,59 +344,44 @@ public final class FinalEmperialTomb extends AbstractInstance } } } - } - else if ("spawnZones".equalsIgnoreCase(n.getNodeName())) - { - for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) - { - if ("zone".equalsIgnoreCase(d.getNodeName())) - { + } else if ("spawnZones".equalsIgnoreCase(n.getNodeName())) { + for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) { + if ("zone".equalsIgnoreCase(d.getNodeName())) { NamedNodeMap attrs = d.getAttributes(); Node att = attrs.getNamedItem("id"); - if (att == null) - { + if (att == null) { _log.severe("[Final Emperial Tomb] Missing id in spawnZones List, skipping"); continue; } int id = Integer.parseInt(att.getNodeValue()); att = attrs.getNamedItem("minZ"); - if (att == null) - { + if (att == null) { _log.severe("[Final Emperial Tomb] Missing minZ in spawnZones List id: " + id + ", skipping"); continue; } int minz = Integer.parseInt(att.getNodeValue()); att = attrs.getNamedItem("maxZ"); - if (att == null) - { + if (att == null) { _log.severe("[Final Emperial Tomb] Missing maxZ in spawnZones List id: " + id + ", skipping"); continue; } int maxz = Integer.parseInt(att.getNodeValue()); L2Territory ter = new L2Territory(id); - for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling()) - { - if ("point".equalsIgnoreCase(cd.getNodeName())) - { + for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling()) { + if ("point".equalsIgnoreCase(cd.getNodeName())) { attrs = cd.getAttributes(); int x, y; att = attrs.getNamedItem("x"); - if (att != null) - { + if (att != null) { x = Integer.parseInt(att.getNodeValue()); - } - else - { + } else { continue; } att = attrs.getNamedItem("y"); - if (att != null) - { + if (att != null) { y = Integer.parseInt(att.getNodeValue()); - } - else - { + } else { continue; } @@ -460,71 +395,54 @@ public final class FinalEmperialTomb extends AbstractInstance } } } - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, "[Final Emperial Tomb] Could not parse final_emperial_tomb.xml file: " + e.getMessage(), e); } - if (debug) - { + if (debug) { _log.info("[Final Emperial Tomb] Loaded " + _spawnZoneList.size() + " spawn zones data."); _log.info("[Final Emperial Tomb] Loaded " + spawnCount + " spawns data."); } } @Override - protected boolean checkConditions(L2PcInstance player) - { - if (debug || player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) - { + protected boolean checkConditions(L2PcInstance player) { + if (debug || player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) { return true; } final L2Party party = player.getParty(); - if (party == null) - { + if (party == null) { player.sendPacket(SystemMessageId.NOT_IN_PARTY_CANT_ENTER); return false; } final L2CommandChannel channel = player.getParty().getCommandChannel(); - if (channel == null) - { + if (channel == null) { player.sendPacket(SystemMessageId.NOT_IN_COMMAND_CHANNEL_CANT_ENTER); return false; - } - else if (channel.getLeader() != player) - { + } else if (channel.getLeader() != player) { player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); return false; - } - else if (player.getInventory().getItemByItemId(8073) == null) - { + } else if (player.getInventory().getItemByItemId(8073) == null) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_ITEM_REQUIREMENT_NOT_SUFFICIENT); sm.addPcName(player); player.sendPacket(sm); return false; - } - else if ((channel.getMemberCount() < MIN_PLAYERS) || (channel.getMemberCount() > MAX_PLAYERS)) - { + } else if ((channel.getMemberCount() < MIN_PLAYERS) || (channel.getMemberCount() > MAX_PLAYERS)) { player.sendPacket(SystemMessageId.PARTY_EXCEEDED_THE_LIMIT_CANT_ENTER); return false; } - for (L2PcInstance channelMember : channel.getMembers()) - { - if (channelMember.getLevel() < 80) - { + for (L2PcInstance channelMember : channel.getMembers()) { + if (channelMember.getLevel() < 80) { party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addPcName(channelMember)); return false; } - if (!Util.checkIfInRange(1000, player, channelMember, true)) - { + if (!Util.checkIfInRange(1000, player, channelMember, true)) { party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED).addPcName(channelMember)); return false; } final Long reentertime = InstanceManager.getInstance().getInstanceTime(channelMember.getObjectId(), TEMPLATE_ID); - if (System.currentTimeMillis() < reentertime) - { + if (System.currentTimeMillis() < reentertime) { party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET).addPcName(channelMember)); return false; } @@ -533,121 +451,88 @@ public final class FinalEmperialTomb extends AbstractInstance } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { controlStatus((FETWorld) world); - if ((player.getParty() == null) || (player.getParty().getCommandChannel() == null)) - { + if ((player.getParty() == null) || (player.getParty().getCommandChannel() == null)) { player.destroyItemByItemId(getName(), DEWDROP_OF_DESTRUCTION_ITEM_ID, player.getInventory().getInventoryItemCount(DEWDROP_OF_DESTRUCTION_ITEM_ID, -1), null, true); world.addAllowed(player.getObjectId()); teleportPlayer(player, ENTER_TELEPORT, world.getInstanceId(), false); - } - else - { - for (L2PcInstance channelMember : player.getParty().getCommandChannel().getMembers()) - { + } else { + for (L2PcInstance channelMember : player.getParty().getCommandChannel().getMembers()) { channelMember.destroyItemByItemId(getName(), DEWDROP_OF_DESTRUCTION_ITEM_ID, channelMember.getInventory().getInventoryItemCount(DEWDROP_OF_DESTRUCTION_ITEM_ID, -1), null, true); world.addAllowed(channelMember.getObjectId()); teleportPlayer(channelMember, ENTER_TELEPORT, world.getInstanceId(), false); } } - } - else - { + } else { teleportPlayer(player, ENTER_TELEPORT, world.getInstanceId(), false); } } - protected boolean checkKillProgress(L2Npc mob, FETWorld world) - { - if (world.npcList.contains(mob)) - { + protected boolean checkKillProgress(L2Npc mob, FETWorld world) { + if (world.npcList.contains(mob)) { world.npcList.remove(mob); } return world.npcList.isEmpty(); } - private void spawnFlaggedNPCs(FETWorld world, int flag) - { - if (world.lock.tryLock()) - { - try - { - for (FETSpawn spw : _spawnList.get(flag)) - { - if (spw.isZone) - { - for (int i = 0; i < spw.count; i++) - { - if (_spawnZoneList.containsKey(spw.zone)) - { + private void spawnFlaggedNPCs(FETWorld world, int flag) { + if (world.lock.tryLock()) { + try { + for (FETSpawn spw : _spawnList.get(flag)) { + if (spw.isZone) { + for (int i = 0; i < spw.count; i++) { + if (_spawnZoneList.containsKey(spw.zone)) { final Location location = _spawnZoneList.get(spw.zone).getRandomPoint(); - if (location != null) - { + if (location != null) { spawn(world, spw.npcId, location.getX(), location.getY(), GeoData.getInstance().getSpawnHeight(location), getRandom(65535), spw.isNeededNextFlag); } - } - else - { + } else { _log.info("[Final Emperial Tomb] Missing zone: " + spw.zone); } } - } - else - { + } else { spawn(world, spw.npcId, spw.x, spw.y, spw.z, spw.h, spw.isNeededNextFlag); } } - } - finally - { + } finally { world.lock.unlock(); } } } - protected boolean controlStatus(FETWorld world) - { - if (world.lock.tryLock()) - { - try - { - if (debug) - { + protected boolean controlStatus(FETWorld world) { + if (world.lock.tryLock()) { + try { + if (debug) { _log.info("[Final Emperial Tomb] Starting " + world.getStatus() + ". status."); } world.npcList.clear(); - switch (world.getStatus()) - { + switch (world.getStatus()) { case 0: spawnFlaggedNPCs(world, 0); break; case 1: - for (int doorId : FIRST_ROUTE_DOORS) - { + for (int doorId : FIRST_ROUTE_DOORS) { openDoor(doorId, world.getInstanceId()); } spawnFlaggedNPCs(world, world.getStatus()); break; case 2: - for (int doorId : SECOND_ROUTE_DOORS) - { + for (int doorId : SECOND_ROUTE_DOORS) { openDoor(doorId, world.getInstanceId()); } ThreadPoolManager.getInstance().scheduleGeneral(new IntroTask(world, 0), 600000); break; case 3: // first morph - if (world.songEffectTask != null) - { + if (world.songEffectTask != null) { world.songEffectTask.cancel(false); } world.songEffectTask = null; world.activeScarlet.setIsInvul(true); - if (world.activeScarlet.isCastingNow()) - { + if (world.activeScarlet.isCastingNow()) { world.activeScarlet.abortCast(); } handleReenterTime(world); @@ -657,8 +542,7 @@ public final class FinalEmperialTomb extends AbstractInstance case 4: // second morph world.isVideo = true; broadCastPacket(world, new MagicSkillCanceld(world.frintezza.getObjectId())); - if (world.songEffectTask != null) - { + if (world.songEffectTask != null) { world.songEffectTask.cancel(false); } world.songEffectTask = null; @@ -668,12 +552,10 @@ public final class FinalEmperialTomb extends AbstractInstance case 5: // raid success world.isVideo = true; broadCastPacket(world, new MagicSkillCanceld(world.frintezza.getObjectId())); - if (world.songTask != null) - { + if (world.songTask != null) { world.songTask.cancel(true); } - if (world.songEffectTask != null) - { + if (world.songEffectTask != null) { world.songEffectTask.cancel(false); } world.songTask = null; @@ -682,81 +564,63 @@ public final class FinalEmperialTomb extends AbstractInstance break; case 6: // open doors InstanceManager.getInstance().getInstance(world.getInstanceId()).setDuration(300000); - for (int doorId : FIRST_ROOM_DOORS) - { + for (int doorId : FIRST_ROOM_DOORS) { openDoor(doorId, world.getInstanceId()); } - for (int doorId : FIRST_ROUTE_DOORS) - { + for (int doorId : FIRST_ROUTE_DOORS) { openDoor(doorId, world.getInstanceId()); } - for (int doorId : SECOND_ROUTE_DOORS) - { + for (int doorId : SECOND_ROUTE_DOORS) { openDoor(doorId, world.getInstanceId()); } - for (int doorId : SECOND_ROOM_DOORS) - { + for (int doorId : SECOND_ROOM_DOORS) { closeDoor(doorId, world.getInstanceId()); } break; } world.incStatus(); return true; - } - finally - { + } finally { world.lock.unlock(); } } return false; } - protected void spawn(FETWorld world, int npcId, int x, int y, int z, int h, boolean addToKillTable) - { + protected void spawn(FETWorld world, int npcId, int x, int y, int z, int h, boolean addToKillTable) { final L2Npc npc = addSpawn(npcId, x, y, z, h, false, 0, false, world.getInstanceId()); - if (addToKillTable) - { + if (addToKillTable) { world.npcList.add(npc); } npc.setIsNoRndWalk(true); - if (npc.isInstanceTypes(InstanceType.L2Attackable)) - { + if (npc.isInstanceTypes(InstanceType.L2Attackable)) { ((L2Attackable) npc).setSeeThroughSilentMove(true); } - if (Util.contains(AI_DISABLED_MOBS, npcId)) - { + if (Util.contains(AI_DISABLED_MOBS, npcId)) { npc.disableCoreAI(true); } - if (npcId == DARK_CHOIR_PLAYER) - { + if (npcId == DARK_CHOIR_PLAYER) { world.darkChoirPlayerCount++; } } - private class DemonSpawnTask implements Runnable - { + private class DemonSpawnTask implements Runnable { private final FETWorld _world; - DemonSpawnTask(FETWorld world) - { + DemonSpawnTask(FETWorld world) { _world = world; } @Override - public void run() - { - if ((InstanceManager.getInstance().getWorld(_world.getInstanceId()) != _world) || _world.portraits.isEmpty()) - { - if (debug) - { + public void run() { + if ((InstanceManager.getInstance().getWorld(_world.getInstanceId()) != _world) || _world.portraits.isEmpty()) { + if (debug) { _log.info("[Final Emperial Tomb] Instance is deleted or all Portraits is killed."); } return; } - for (int i : _world.portraits.values()) - { - if (_world.demons.size() > MAX_DEMONS) - { + for (int i : _world.portraits.values()) { + if (_world.demons.size() > MAX_DEMONS) { break; } L2MonsterInstance demon = (L2MonsterInstance) addSpawn(PORTRAIT_SPAWNS[i][0] + 2, PORTRAIT_SPAWNS[i][5], PORTRAIT_SPAWNS[i][6], PORTRAIT_SPAWNS[i][7], PORTRAIT_SPAWNS[i][8], false, 0, false, _world.getInstanceId()); @@ -767,56 +631,42 @@ public final class FinalEmperialTomb extends AbstractInstance } } - private class SoulBreakingArrow implements Runnable - { + private class SoulBreakingArrow implements Runnable { private final L2Npc _npc; - protected SoulBreakingArrow(L2Npc npc) - { + protected SoulBreakingArrow(L2Npc npc) { _npc = npc; } @Override - public void run() - { + public void run() { _npc.setScriptValue(0); } } - private class SongTask implements Runnable - { + private class SongTask implements Runnable { private final FETWorld _world; private final int _status; - SongTask(FETWorld world, int status) - { + SongTask(FETWorld world, int status) { _world = world; _status = status; } @Override - public void run() - { - if (InstanceManager.getInstance().getWorld(_world.getInstanceId()) != _world) - { + public void run() { + if (InstanceManager.getInstance().getWorld(_world.getInstanceId()) != _world) { return; } - switch (_status) - { + switch (_status) { case 0: // new song play - if (_world.isVideo) - { + if (_world.isVideo) { _world.songTask = ThreadPoolManager.getInstance().scheduleGeneral(new SongTask(_world, 0), 1000); - } - else if ((_world.frintezza != null) && !_world.frintezza.isDead()) - { - if (_world.frintezza.getScriptValue() != 1) - { + } else if ((_world.frintezza != null) && !_world.frintezza.isDead()) { + if (_world.frintezza.getScriptValue() != 1) { int rnd = getRandom(100); - for (FrintezzaSong element : FRINTEZZASONGLIST) - { - if (rnd < element.chance) - { + for (FrintezzaSong element : FRINTEZZASONGLIST) { + if (rnd < element.chance) { _world.OnSong = element; broadCastPacket(_world, new ExShowScreenMessage(2, -1, 2, 0, 0, 0, 0, true, 4000, false, null, element.songName, null)); broadCastPacket(_world, new MagicSkillUse(_world.frintezza, _world.frintezza, element.skill.getSkillId(), element.skill.getSkillLvl(), element.skill.getSkill().getHitTime(), 0)); @@ -825,9 +675,7 @@ public final class FinalEmperialTomb extends AbstractInstance break; } } - } - else - { + } else { ThreadPoolManager.getInstance().scheduleGeneral(new SoulBreakingArrow(_world.frintezza), 35000); } } @@ -835,38 +683,28 @@ public final class FinalEmperialTomb extends AbstractInstance case 1: // Frintezza song effect _world.songEffectTask = null; Skill skill = _world.OnSong.effectSkill.getSkill(); - if (skill == null) - { + if (skill == null) { return; } - if ((_world.frintezza != null) && !_world.frintezza.isDead() && (_world.activeScarlet != null) && !_world.activeScarlet.isDead()) - { + if ((_world.frintezza != null) && !_world.frintezza.isDead() && (_world.activeScarlet != null) && !_world.activeScarlet.isDead()) { final List<L2Character> targetList = new ArrayList<>(); - if (skill.hasEffectType(L2EffectType.STUN) || skill.isDebuff()) - { - for (int objId : _world.getAllowed()) - { + if (skill.hasEffectType(L2EffectType.STUN) || skill.isDebuff()) { + for (int objId : _world.getAllowed()) { L2PcInstance player = L2World.getInstance().getPlayer(objId); - if ((player != null) && player.isOnline() && (player.getInstanceId() == _world.getInstanceId())) - { - if (!player.isDead()) - { + if ((player != null) && player.isOnline() && (player.getInstanceId() == _world.getInstanceId())) { + if (!player.isDead()) { targetList.add(player); } - if (player.hasSummon() && !player.getSummon().isDead()) - { + if (player.hasSummon() && !player.getSummon().isDead()) { targetList.add(player.getSummon()); } } } - } - else - { + } else { targetList.add(_world.activeScarlet); } - if (!targetList.isEmpty()) - { + if (!targetList.isEmpty()) { _world.frintezza.doCast(skill, targetList.get(0), targetList.toArray(new L2Character[targetList.size()])); } } @@ -879,42 +717,34 @@ public final class FinalEmperialTomb extends AbstractInstance } } - private class IntroTask implements Runnable - { + private class IntroTask implements Runnable { private final FETWorld _world; private final int _status; - IntroTask(FETWorld world, int status) - { + IntroTask(FETWorld world, int status) { _world = world; _status = status; } @Override - public void run() - { - switch (_status) - { + public void run() { + switch (_status) { case 0: ThreadPoolManager.getInstance().scheduleGeneral(new IntroTask(_world, 1), 27000); ThreadPoolManager.getInstance().scheduleGeneral(new IntroTask(_world, 2), 30000); broadCastPacket(_world, new Earthquake(-87784, -155083, -9087, 45, 27)); break; case 1: - for (int doorId : FIRST_ROOM_DOORS) - { + for (int doorId : FIRST_ROOM_DOORS) { closeDoor(doorId, _world.getInstanceId()); } - for (int doorId : FIRST_ROUTE_DOORS) - { + for (int doorId : FIRST_ROUTE_DOORS) { closeDoor(doorId, _world.getInstanceId()); } - for (int doorId : SECOND_ROOM_DOORS) - { + for (int doorId : SECOND_ROOM_DOORS) { closeDoor(doorId, _world.getInstanceId()); } - for (int doorId : SECOND_ROUTE_DOORS) - { + for (int doorId : SECOND_ROUTE_DOORS) { closeDoor(doorId, _world.getInstanceId()); } addSpawn(29061, -87904, -141296, -9168, 0, false, 0, false, _world.getInstanceId()); @@ -956,8 +786,7 @@ public final class FinalEmperialTomb extends AbstractInstance _world.frintezza.disableAllSkills(); updateKnownList(_world, _world.frintezza); - for (int[] element : PORTRAIT_SPAWNS) - { + for (int[] element : PORTRAIT_SPAWNS) { L2MonsterInstance demon = (L2MonsterInstance) addSpawn(element[0] + 2, element[5], element[6], element[7], element[8], false, 0, false, _world.getInstanceId()); demon.setIsImmobilized(true); demon.disableAllSkills(); @@ -1060,8 +889,7 @@ public final class FinalEmperialTomb extends AbstractInstance ThreadPoolManager.getInstance().scheduleGeneral(new IntroTask(_world, 21), 3000); break; case 21: - for (int i = 0; i < PORTRAIT_SPAWNS.length; i++) - { + for (int i = 0; i < PORTRAIT_SPAWNS.length; i++) { L2MonsterInstance portrait = (L2MonsterInstance) addSpawn(PORTRAIT_SPAWNS[i][0], PORTRAIT_SPAWNS[i][1], PORTRAIT_SPAWNS[i][2], PORTRAIT_SPAWNS[i][3], PORTRAIT_SPAWNS[i][4], false, 0, false, _world.getInstanceId()); updateKnownList(_world, portrait); _world.portraits.put(portrait, i); @@ -1075,8 +903,7 @@ public final class FinalEmperialTomb extends AbstractInstance ThreadPoolManager.getInstance().scheduleGeneral(new IntroTask(_world, 22), 2000); break; case 22: - for (L2MonsterInstance demon : _world.demons) - { + for (L2MonsterInstance demon : _world.demons) { demon.setIsImmobilized(false); demon.enableAllSkills(); } @@ -1120,12 +947,9 @@ public final class FinalEmperialTomb extends AbstractInstance _world.scarlet_y = _world.activeScarlet.getY(); _world.scarlet_z = _world.activeScarlet.getZ(); _world.scarlet_h = _world.activeScarlet.getHeading(); - if (_world.scarlet_h < 32768) - { + if (_world.scarlet_h < 32768) { _world.scarlet_a = Math.abs(180 - (int) (_world.scarlet_h / 182.044444444)); - } - else - { + } else { _world.scarlet_a = Math.abs(540 - (int) (_world.scarlet_h / 182.044444444)); } broadCastPacket(_world, new SpecialCamera(_world.activeScarlet, 250, _world.scarlet_a, 12, 0, 1000, 0, 0, 1, 0, 0)); @@ -1190,13 +1014,10 @@ public final class FinalEmperialTomb extends AbstractInstance } } - private void stopPc() - { - for (int objId : _world.getAllowed()) - { + private void stopPc() { + for (int objId : _world.getAllowed()) { L2PcInstance player = L2World.getInstance().getPlayer(objId); - if ((player != null) && player.isOnline() && (player.getInstanceId() == _world.getInstanceId())) - { + if ((player != null) && player.isOnline() && (player.getInstanceId() == _world.getInstanceId())) { player.abortAttack(); player.abortCast(); player.disableAllSkills(); @@ -1208,32 +1029,23 @@ public final class FinalEmperialTomb extends AbstractInstance } } - private void startPc() - { - for (int objId : _world.getAllowed()) - { + private void startPc() { + for (int objId : _world.getAllowed()) { L2PcInstance player = L2World.getInstance().getPlayer(objId); - if ((player != null) && player.isOnline() && (player.getInstanceId() == _world.getInstanceId())) - { + if ((player != null) && player.isOnline() && (player.getInstanceId() == _world.getInstanceId())) { player.enableAllSkills(); player.setIsImmobilized(false); } } } - private void sendPacketX(L2GameServerPacket packet1, L2GameServerPacket packet2, int x) - { - for (int objId : _world.getAllowed()) - { + private void sendPacketX(L2GameServerPacket packet1, L2GameServerPacket packet2, int x) { + for (int objId : _world.getAllowed()) { L2PcInstance player = L2World.getInstance().getPlayer(objId); - if ((player != null) && player.isOnline() && (player.getInstanceId() == _world.getInstanceId())) - { - if (player.getX() < x) - { + if ((player != null) && player.isOnline() && (player.getInstanceId() == _world.getInstanceId())) { + if (player.getX() < x) { player.sendPacket(packet1); - } - else - { + } else { player.sendPacket(packet2); } } @@ -1241,30 +1053,24 @@ public final class FinalEmperialTomb extends AbstractInstance } } - private class StatusTask implements Runnable - { + private class StatusTask implements Runnable { private final FETWorld _world; private final int _status; - StatusTask(FETWorld world, int status) - { + StatusTask(FETWorld world, int status) { _world = world; _status = status; } @Override - public void run() - { - if (InstanceManager.getInstance().getWorld(_world.getInstanceId()) != _world) - { + public void run() { + if (InstanceManager.getInstance().getWorld(_world.getInstanceId()) != _world) { return; } - switch (_status) - { + switch (_status) { case 0: ThreadPoolManager.getInstance().scheduleGeneral(new StatusTask(_world, 1), 2000); - for (int doorId : FIRST_ROOM_DOORS) - { + for (int doorId : FIRST_ROOM_DOORS) { openDoor(doorId, _world.getInstanceId()); } break; @@ -1273,8 +1079,7 @@ public final class FinalEmperialTomb extends AbstractInstance break; case 2: ThreadPoolManager.getInstance().scheduleGeneral(new StatusTask(_world, 3), 100); - for (int doorId : SECOND_ROOM_DOORS) - { + for (int doorId : SECOND_ROOM_DOORS) { openDoor(doorId, _world.getInstanceId()); } break; @@ -1287,86 +1092,63 @@ public final class FinalEmperialTomb extends AbstractInstance } } - private void addAggroToMobs() - { + private void addAggroToMobs() { L2PcInstance target = L2World.getInstance().getPlayer(_world.getAllowed().get(getRandom(_world.getAllowed().size()))); - if ((target == null) || (target.getInstanceId() != _world.getInstanceId()) || target.isDead() || target.isFakeDeath()) - { - for (int objId : _world.getAllowed()) - { + if ((target == null) || (target.getInstanceId() != _world.getInstanceId()) || target.isDead() || target.isFakeDeath()) { + for (int objId : _world.getAllowed()) { target = L2World.getInstance().getPlayer(objId); - if ((target != null) && (target.getInstanceId() == _world.getInstanceId()) && !target.isDead() && !target.isFakeDeath()) - { + if ((target != null) && (target.getInstanceId() == _world.getInstanceId()) && !target.isDead() && !target.isFakeDeath()) { break; } target = null; } } - for (L2Npc mob : _world.npcList) - { + for (L2Npc mob : _world.npcList) { mob.setRunning(); - if (target != null) - { + if (target != null) { ((L2MonsterInstance) mob).addDamageHate(target, 0, 500); mob.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); - } - else - { + } else { mob.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, MOVE_TO_CENTER); } } } } - protected void broadCastPacket(FETWorld world, L2GameServerPacket packet) - { - for (int objId : world.getAllowed()) - { + protected void broadCastPacket(FETWorld world, L2GameServerPacket packet) { + for (int objId : world.getAllowed()) { L2PcInstance player = L2World.getInstance().getPlayer(objId); - if ((player != null) && player.isOnline() && (player.getInstanceId() == world.getInstanceId())) - { + if ((player != null) && player.isOnline() && (player.getInstanceId() == world.getInstanceId())) { player.sendPacket(packet); } } } - protected void updateKnownList(FETWorld world, L2Npc npc) - { + protected void updateKnownList(FETWorld world, L2Npc npc) { Map<Integer, L2PcInstance> npcKnownPlayers = npc.getKnownList().getKnownPlayers(); - for (int objId : world.getAllowed()) - { + for (int objId : world.getAllowed()) { L2PcInstance player = L2World.getInstance().getPlayer(objId); - if ((player != null) && player.isOnline() && (player.getInstanceId() == world.getInstanceId())) - { + if ((player != null) && player.isOnline() && (player.getInstanceId() == world.getInstanceId())) { npcKnownPlayers.put(player.getObjectId(), player); } } } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) { final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof FETWorld) - { + if (tmpworld instanceof FETWorld) { final FETWorld world = (FETWorld) tmpworld; - if ((npc.getId() == SCARLET1) && (world.getStatus() == 3) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.80))) - { + if ((npc.getId() == SCARLET1) && (world.getStatus() == 3) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.80))) { controlStatus(world); - } - else if ((npc.getId() == SCARLET1) && (world.getStatus() == 4) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.20))) - { + } else if ((npc.getId() == SCARLET1) && (world.getStatus() == 4) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.20))) { controlStatus(world); } - if (skill != null) - { + if (skill != null) { // When Dewdrop of Destruction is used on Portraits they suicide. - if (Util.contains(PORTRAITS, npc.getId()) && (skill.getId() == DEWDROP_OF_DESTRUCTION_SKILL_ID)) - { + if (Util.contains(PORTRAITS, npc.getId()) && (skill.getId() == DEWDROP_OF_DESTRUCTION_SKILL_ID)) { npc.doDie(attacker); - } - else if ((npc.getId() == FRINTEZZA) && (skill.getId() == SOUL_BREAKING_ARROW_SKILL_ID)) - { + } else if ((npc.getId() == FRINTEZZA) && (skill.getId() == SOUL_BREAKING_ARROW_SKILL_ID)) { npc.setScriptValue(1); npc.setTarget(null); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); @@ -1377,67 +1159,46 @@ public final class FinalEmperialTomb extends AbstractInstance } @Override - public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) - { - if (skill.isSuicideAttack()) - { + public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) { + if (skill.isSuicideAttack()) { return onKill(npc, null, false); } return super.onSpellFinished(npc, player, skill); } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof FETWorld) - { + if (tmpworld instanceof FETWorld) { FETWorld world = (FETWorld) tmpworld; - if (npc.getId() == HALL_ALARM) - { + if (npc.getId() == HALL_ALARM) { ThreadPoolManager.getInstance().scheduleGeneral(new StatusTask(world, 0), 2000); - if (debug) - { + if (debug) { _log.info("[Final Emperial Tomb] Hall alarm is disabled, doors will open!"); } - } - else if (npc.getId() == DARK_CHOIR_PLAYER) - { + } else if (npc.getId() == DARK_CHOIR_PLAYER) { world.darkChoirPlayerCount--; - if (world.darkChoirPlayerCount < 1) - { + if (world.darkChoirPlayerCount < 1) { ThreadPoolManager.getInstance().scheduleGeneral(new StatusTask(world, 2), 2000); - if (debug) - { + if (debug) { _log.info("[Final Emperial Tomb] All Dark Choir Players are killed, doors will open!"); } } - } - else if (npc.getId() == SCARLET2) - { + } else if (npc.getId() == SCARLET2) { controlStatus(world); - } - else if (world.getStatus() <= 2) - { - if (npc.getId() == HALL_KEEPER_CAPTAIN) - { - if (getRandom(100) < 5) - { + } else if (world.getStatus() <= 2) { + if (npc.getId() == HALL_KEEPER_CAPTAIN) { + if (getRandom(100) < 5) { npc.dropItem(player, DEWDROP_OF_DESTRUCTION_ITEM_ID, 1); } } - if (checkKillProgress(npc, world)) - { + if (checkKillProgress(npc, world)) { controlStatus(world); } - } - else if (world.demons.contains(npc)) - { + } else if (world.demons.contains(npc)) { world.demons.remove(npc); - } - else if (world.portraits.containsKey(npc)) - { + } else if (world.portraits.containsKey(npc)) { world.portraits.remove(npc); } } @@ -1445,16 +1206,12 @@ public final class FinalEmperialTomb extends AbstractInstance } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { int npcId = npc.getId(); getQuestState(player, true); - if (npcId == GUIDE) - { + if (npcId == GUIDE) { enterInstance(player, new FETWorld(), "FinalEmperialTomb.xml", TEMPLATE_ID); - } - else if (npc.getId() == CUBE) - { + } else if (npc.getId() == CUBE) { int x = -87534 + getRandom(500); int y = -153048 + getRandom(500); player.teleToLocation(x, y, -9165); diff --git a/src/main/java/com/l2jserver/datapack/instances/HideoutOfTheDawn/HideoutOfTheDawn.java b/src/main/java/com/l2jserver/datapack/instances/HideoutOfTheDawn/HideoutOfTheDawn.java index 5e21546550..c3a1192278 100644 --- a/src/main/java/com/l2jserver/datapack/instances/HideoutOfTheDawn/HideoutOfTheDawn.java +++ b/src/main/java/com/l2jserver/datapack/instances/HideoutOfTheDawn/HideoutOfTheDawn.java @@ -28,10 +28,8 @@ import com.l2jserver.gameserver.model.instancezone.InstanceWorld; * Hideout of the Dawn instance zone. * @author Adry_85 */ -public final class HideoutOfTheDawn extends AbstractInstance -{ - protected class HotDWorld extends InstanceWorld - { +public final class HideoutOfTheDawn extends AbstractInstance { + protected class HotDWorld extends InstanceWorld { } @@ -44,8 +42,7 @@ public final class HideoutOfTheDawn extends AbstractInstance // Misc private static final int TEMPLATE_ID = 113; - public HideoutOfTheDawn() - { + public HideoutOfTheDawn() { super(HideoutOfTheDawn.class.getSimpleName()); addFirstTalkId(JAINA); addStartNpc(WOOD); @@ -53,26 +50,21 @@ public final class HideoutOfTheDawn extends AbstractInstance } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { + switch (event) { case "32617-01.html": - case "32617-02a.html": - { + case "32617-02a.html": { htmltext = event; break; } - case "32617-02.html": - { + case "32617-02.html": { player.setInstanceId(0); player.teleToLocation(JAINA_LOC, true); htmltext = event; break; } - case "32593-01.html": - { + case "32593-01.html": { enterInstance(player, new HotDWorld(), "HideoutOfTheDawn.xml", TEMPLATE_ID); htmltext = event; } @@ -81,10 +73,8 @@ public final class HideoutOfTheDawn extends AbstractInstance } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { world.addAllowed(player.getObjectId()); } teleportPlayer(player, WOOD_LOC, world.getInstanceId(), false); diff --git a/src/main/java/com/l2jserver/datapack/instances/IceQueensCastle/IceQueensCastle.java b/src/main/java/com/l2jserver/datapack/instances/IceQueensCastle/IceQueensCastle.java index 8581a5b73d..f2dd12c148 100644 --- a/src/main/java/com/l2jserver/datapack/instances/IceQueensCastle/IceQueensCastle.java +++ b/src/main/java/com/l2jserver/datapack/instances/IceQueensCastle/IceQueensCastle.java @@ -39,10 +39,8 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Ice Queen's Castle instance zone. * @author Adry_85 */ -public final class IceQueensCastle extends AbstractInstance -{ - protected class IQCWorld extends InstanceWorld - { +public final class IceQueensCastle extends AbstractInstance { + protected class IQCWorld extends InstanceWorld { L2PcInstance player = null; } @@ -64,8 +62,7 @@ public final class IceQueensCastle extends AbstractInstance private static final int ICE_QUEEN_DOOR = 23140101; private static final int MIN_LV = 82; - public IceQueensCastle() - { + public IceQueensCastle() { super(IceQueensCastle.class.getSimpleName()); addStartNpc(JINIA); addTalkId(JINIA); @@ -75,16 +72,11 @@ public final class IceQueensCastle extends AbstractInstance } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { - case "ATTACK_KNIGHT": - { - for (L2Character character : npc.getKnownList().getKnownCharacters()) - { - if ((character.getId() == ARCHERY_KNIGHT) && !character.isDead() && !((L2Attackable) character).isDecayed()) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { + case "ATTACK_KNIGHT": { + for (L2Character character : npc.getKnownList().getKnownCharacters()) { + if ((character.getId() == ARCHERY_KNIGHT) && !character.isDead() && !((L2Attackable) character).isDecayed()) { npc.setIsRunning(true); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, character); ((L2Attackable) npc).addDamageHate(character, 0, 999999); @@ -93,37 +85,30 @@ public final class IceQueensCastle extends AbstractInstance startQuestTimer("ATTACK_KNIGHT", 3000, npc, null); break; } - case "TIMER_MOVING": - { - if (npc != null) - { + case "TIMER_MOVING": { + if (npc != null) { npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, FREYA_LOC); } break; } - case "TIMER_BLIZZARD": - { + case "TIMER_BLIZZARD": { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.I_CAN_NO_LONGER_STAND_BY); npc.stopMove(null); npc.setTarget(player); npc.doCast(ETHERNAL_BLIZZARD); break; } - case "TIMER_SCENE_21": - { - if (npc != null) - { + case "TIMER_SCENE_21": { + if (npc != null) { player.showQuestMovie(21); npc.deleteMe(); startQuestTimer("TIMER_PC_LEAVE", 24000, npc, player); } break; } - case "TIMER_PC_LEAVE": - { + case "TIMER_PC_LEAVE": { final QuestState qs = player.getQuestState(Q10285_MeetingSirra.class.getSimpleName()); - if ((qs != null)) - { + if ((qs != null)) { qs.setMemoState(3); qs.setCond(10, true); final InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); @@ -138,14 +123,10 @@ public final class IceQueensCastle extends AbstractInstance } @Override - public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) - { - if (creature.isPlayer() && npc.isScriptValue(0)) - { - for (L2Character character : npc.getKnownList().getKnownCharacters()) - { - if ((character.getId() == ARCHERY_KNIGHT) && !character.isDead() && !((L2Attackable) character).isDecayed()) - { + public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) { + if (creature.isPlayer() && npc.isScriptValue(0)) { + for (L2Character character : npc.getKnownList().getKnownCharacters()) { + if ((character.getId() == ARCHERY_KNIGHT) && !character.isDead() && !((L2Attackable) character).isDecayed()) { npc.setIsRunning(true); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, character); ((L2Attackable) npc).addDamageHate(character, 0, 999999); @@ -159,24 +140,20 @@ public final class IceQueensCastle extends AbstractInstance } @Override - public final String onSpawn(L2Npc npc) - { + public final String onSpawn(L2Npc npc) { startQuestTimer("TIMER_MOVING", 60000, npc, null); startQuestTimer("TIMER_BLIZZARD", 180000, npc, null); return super.onSpawn(npc); } @Override - public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) - { + public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) { final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if ((tmpworld != null) && (tmpworld instanceof IQCWorld)) - { + if ((tmpworld != null) && (tmpworld instanceof IQCWorld)) { final IQCWorld world = (IQCWorld) tmpworld; - if ((skill == ETHERNAL_BLIZZARD.getSkill()) && (world.player != null)) - { + if ((skill == ETHERNAL_BLIZZARD.getSkill()) && (world.player != null)) { startQuestTimer("TIMER_SCENE_21", 1000, npc, world.player); } } @@ -184,17 +161,14 @@ public final class IceQueensCastle extends AbstractInstance } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { enterInstance(talker, new IQCWorld(), "IceQueensCastle.xml", TEMPLATE_ID); return super.onTalk(npc, talker); } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { world.addAllowed(player.getObjectId()); ((IQCWorld) world).player = player; openDoor(ICE_QUEEN_DOOR, world.getInstanceId()); @@ -203,10 +177,8 @@ public final class IceQueensCastle extends AbstractInstance } @Override - protected boolean checkConditions(L2PcInstance player) - { - if (player.getLevel() < MIN_LV) - { + protected boolean checkConditions(L2PcInstance player) { + if (player.getLevel() < MIN_LV) { player.sendPacket(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); return false; } diff --git a/src/main/java/com/l2jserver/datapack/instances/IceQueensCastleNormalBattle/IceQueensCastleNormalBattle.java b/src/main/java/com/l2jserver/datapack/instances/IceQueensCastleNormalBattle/IceQueensCastleNormalBattle.java index 4a52be6fa7..8b8607229c 100644 --- a/src/main/java/com/l2jserver/datapack/instances/IceQueensCastleNormalBattle/IceQueensCastleNormalBattle.java +++ b/src/main/java/com/l2jserver/datapack/instances/IceQueensCastleNormalBattle/IceQueensCastleNormalBattle.java @@ -60,10 +60,8 @@ import com.l2jserver.gameserver.util.Util; * Ice Queen's Castle (Normal Battle) instance zone. * @author St3eT */ -public final class IceQueensCastleNormalBattle extends AbstractInstance -{ - protected class IQCNBWorld extends InstanceWorld - { +public final class IceQueensCastleNormalBattle extends AbstractInstance { + protected class IQCNBWorld extends InstanceWorld { protected List<L2PcInstance> playersInside = new ArrayList<>(); protected List<L2Npc> knightStatues = new ArrayList<>(); protected List<L2Attackable> spawnedMobs = new CopyOnWriteArrayList<>(); @@ -125,8 +123,7 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance private static final Location SUPP_KEGOR_SPAWN = new Location(114659, -114796, -11205); private static final Location BATTLE_PORT = new Location(114694, -113700, -11200); private static final Location CONTROLLER_LOC = new Location(114394, -112383, -11200); - private static final Location[] ENTER_LOC = - { + private static final Location[] ENTER_LOC = { new Location(114185, -112435, -11210), new Location(114183, -112280, -11210), new Location(114024, -112435, -11210), @@ -135,8 +132,7 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance new Location(113865, -112276, -11210), }; - private static final Location[] STATUES_LOC = - { + private static final Location[] STATUES_LOC = { new Location(113845, -116091, -11168, 8264), new Location(113381, -115622, -11168, 8264), new Location(113380, -113978, -11168, -8224), @@ -154,8 +150,7 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance new Location(116501, -115145, -10960, 32724), new Location(116502, -115473, -10960, 32724), }; - private static Location[] KNIGHTS_LOC = - { + private static Location[] KNIGHTS_LOC = { new Location(114502, -115315, -11205, 15451), new Location(114937, -115323, -11205, 18106), new Location(114722, -115185, -11205, 16437), @@ -168,8 +163,7 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance private static final int TEMPLATE_ID_ULTIMATE = 144; // Ice Queen's Castle (Ultimate Battle) private static final int DOOR_ID = 23140101; - public IceQueensCastleNormalBattle() - { + public IceQueensCastleNormalBattle() { super(IceQueensCastleNormalBattle.class.getSimpleName()); addStartNpc(SIRRA, SUPP_KEGOR, SUPP_JINIA); addFirstTalkId(SUPP_KEGOR, SUPP_JINIA); @@ -181,50 +175,34 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.equals("enter")) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.equals("enter")) { enterInstance(player, new IQCNBWorld(), "IceQueensCastleNormalBattle.xml", TEMPLATE_ID); - } - else if (event.equals("enterUltimate")) - { + } else if (event.equals("enterUltimate")) { enterInstance(player, new IQCNBWorld(), "IceQueensCastleUltimateBattle.xml", TEMPLATE_ID_ULTIMATE); - } - else - { + } else { final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if ((tmpworld != null) && (tmpworld instanceof IQCNBWorld)) - { + if ((tmpworld != null) && (tmpworld instanceof IQCNBWorld)) { final IQCNBWorld world = (IQCNBWorld) tmpworld; - switch (event) - { - case "openDoor": - { - if (npc.isScriptValue(0)) - { + switch (event) { + case "openDoor": { + if (npc.isScriptValue(0)) { npc.setScriptValue(1); openDoor(DOOR_ID, world.getInstanceId()); world.controller = (L2NpcInstance) addSpawn(INVISIBLE_NPC, CONTROLLER_LOC, false, 0, true, world.getInstanceId()); - for (Location loc : STATUES_LOC) - { - if (loc.getZ() == -11168) - { + for (Location loc : STATUES_LOC) { + if (loc.getZ() == -11168) { final L2Npc statue = addSpawn(INVISIBLE_NPC, loc, false, 0, false, world.getInstanceId()); world.knightStatues.add(statue); } } - if (!world.isHardMode) - { - for (L2PcInstance players : world.playersInside) - { - if ((players != null) && !players.isDead() && (players.getInstanceId() == world.getInstanceId())) - { + if (!world.isHardMode) { + for (L2PcInstance players : world.playersInside) { + if ((players != null) && !players.isDead() && (players.getInstanceId() == world.getInstanceId())) { final QuestState qs = player.getQuestState(Q10286_ReunionWithSirra.class.getSimpleName()); - if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(5)) - { + if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(5)) { qs.setCond(6, true); } } @@ -234,16 +212,13 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance } break; } - case "portInside": - { + case "portInside": { teleportPlayer(player, BATTLE_PORT, world.getInstanceId()); break; } - case "killFreya": - { + case "killFreya": { final QuestState qs = player.getQuestState(Q10286_ReunionWithSirra.class.getSimpleName()); - if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(6)) - { + if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(6)) { qs.setMemoState(10); qs.setCond(7, true); } @@ -254,20 +229,17 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance startQuestTimer("FINISH_WORLD", 58500, world.controller, null); break; } - case "18851-01.html": - { + case "18851-01.html": { return event; } - case "STAGE_1_MOVIE": - { + case "STAGE_1_MOVIE": { closeDoor(DOOR_ID, world.getInstanceId()); world.setStatus(1); manageMovie(world, 15); startQuestTimer("STAGE_1_START", 53500, world.controller, null); break; } - case "STAGE_1_START": - { + case "STAGE_1_START": { world.freya = (L2GrandBossInstance) addSpawn(FREYA_THRONE, FREYA_SPAWN, false, 0, true, world.getInstanceId()); world.freya.setIsMortal(false); manageScreenMsg(world, NpcStringId.BEGIN_STAGE_1); @@ -275,13 +247,11 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance startQuestTimer("STAGE_1_SPAWN", 2000, world.freya, null); break; } - case "STAGE_1_SPAWN": - { + case "STAGE_1_SPAWN": { notifyEvent("START_SPAWN", world.controller, null); break; } - case "STAGE_1_FINISH": - { + case "STAGE_1_FINISH": { world.freya.deleteMe(); world.freya = null; manageDespawnMinions(world); @@ -289,8 +259,7 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance startQuestTimer("STAGE_1_PAUSE", 24100 - 1000, world.controller, null); break; } - case "STAGE_1_PAUSE": - { + case "STAGE_1_PAUSE": { world.freya = (L2GrandBossInstance) addSpawn(FREYA_SPELLING, FREYA_SPELLING_SPAWN, false, 0, true, world.getInstanceId()); world.freya.setIsInvul(true); world.freya.disableCoreAI(true); @@ -299,32 +268,26 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance startQuestTimer("STAGE_2_START", 60000, world.controller, null); break; } - case "STAGE_2_START": - { + case "STAGE_2_START": { world.canSpawnMobs = true; notifyEvent("START_SPAWN", world.controller, null); manageScreenMsg(world, NpcStringId.BEGIN_STAGE_2); - if (world.isHardMode) - { + if (world.isHardMode) { startQuestTimer("STAGE_2_FAILED", 360000, world.controller, null); manageTimer(world, 360, NpcStringId.BATTLE_END_LIMIT_TIME); world.controller.getVariables().set("TIMER_END", System.currentTimeMillis() + 360000); } break; } - case "STAGE_2_MOVIE": - { + case "STAGE_2_MOVIE": { manageMovie(world, 23); startQuestTimer("STAGE_2_GLAKIAS", 7000, world.controller, null); break; } - case "STAGE_2_GLAKIAS": - { - for (Location loc : STATUES_LOC) - { - if (loc.getZ() == -10960) - { + case "STAGE_2_GLAKIAS": { + for (Location loc : STATUES_LOC) { + if (loc.getZ() == -10960) { final L2Npc statue = addSpawn(INVISIBLE_NPC, loc, false, 0, false, world.getInstanceId()); world.knightStatues.add(statue); startQuestTimer("SPAWN_KNIGHT", 5000, statue, null); @@ -333,35 +296,28 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance final L2RaidBossInstance glakias = (L2RaidBossInstance) addSpawn((world.isHardMode ? GLAKIAS_ULTIMATE : GLAKIAS), GLAKIAS_SPAWN, false, 0, true, world.getInstanceId()); startQuestTimer("LEADER_DELAY", 5000, glakias, null); - if (world.isHardMode) - { + if (world.isHardMode) { startQuestTimer("SHOW_GLAKIAS_TIMER", 3000, world.controller, null); } break; } - case "STAGE_2_FAILED": - { + case "STAGE_2_FAILED": { manageMovie(world, 22); startQuestTimer("STAGE_2_FAILED2", 22000, npc, null); break; } - case "STAGE_2_FAILED2": - { + case "STAGE_2_FAILED2": { InstanceManager.getInstance().destroyInstance(world.getInstanceId()); break; } - case "STAGE_3_MOVIE": - { + case "STAGE_3_MOVIE": { manageMovie(world, 17); startQuestTimer("STAGE_3_START", 21500, world.controller, null); break; } - case "STAGE_3_START": - { - for (L2PcInstance players : world.playersInside) - { - if (players != null) - { + case "STAGE_3_START": { + for (L2PcInstance players : world.playersInside) { + if (players != null) { players.broadcastPacket(ExChangeClientEffectInfo.STATIC_FREYA_DESTROYED); } } @@ -375,42 +331,33 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance startQuestTimer("CAST_BLIZZARD", 50000, world.controller, null); manageScreenMsg(world, NpcStringId.BEGIN_STAGE_3); - if (world.isHardMode) - { + if (world.isHardMode) { world.freya.doCast(RAGE_OF_ICE); startQuestTimer("FREYA_BUFF", 15000, world.controller, null); } break; } - case "FREYA_BUFF": - { + case "FREYA_BUFF": { world.freya.doCast(FREYAS_BLESS); startQuestTimer("FREYA_BUFF", 15000, world.controller, null); break; } - case "START_MOVE": - { - if (npc.getVariables().getInt("FREYA_MOVE") == 0) - { + case "START_MOVE": { + if (npc.getVariables().getInt("FREYA_MOVE") == 0) { world.controller.getVariables().set("FREYA_MOVE", 1); world.freya.setIsRunning(true); world.freya.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, MIDDLE_POINT); } break; } - case "CAST_BLIZZARD": - { - if (!world.freya.isInvul()) - { + case "CAST_BLIZZARD": { + if (!world.freya.isInvul()) { final int blizzardForceCount = world.controller.getVariables().getInt("BLIZZARD_FORCE_COUNT", 0); - if (world.isHardMode && (blizzardForceCount < 4) && (world.freya.getCurrentHp() < (world.freya.getMaxHp() * (0.8 - (0.2 * blizzardForceCount))))) - { + if (world.isHardMode && (blizzardForceCount < 4) && (world.freya.getCurrentHp() < (world.freya.getMaxHp() * (0.8 - (0.2 * blizzardForceCount))))) { world.controller.getVariables().set("BLIZZARD_FORCE_COUNT", blizzardForceCount + 1); world.freya.doCast(ETERNAL_BLIZZARD_FORCE); manageScreenMsg(world, NpcStringId.MAGIC_POWER_SO_STRONG_THAT_IT_COULD_MAKE_YOU_LOSE_YOUR_MIND_CAN_BE_FELT_FROM_SOMEWHERE); - } - else - { + } else { final Skill skill = (world.isHardMode ? ETERNAL_BLIZZARD_HARD.getSkill() : ETERNAL_BLIZZARD.getSkill()); world.freya.doCast(skill); manageScreenMsg(world, NpcStringId.STRONG_MAGIC_POWER_CAN_BE_FELT_FROM_SOMEWHERE); @@ -420,19 +367,15 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance final int time = (world.isHardMode ? getRandom(35, 40) : getRandom(55, 60)) * 1000; startQuestTimer("CAST_BLIZZARD", time, world.controller, null); - for (L2Attackable minion : world.spawnedMobs) - { - if ((minion != null) && !minion.isDead() && !minion.isInCombat()) - { + for (L2Attackable minion : world.spawnedMobs) { + if ((minion != null) && !minion.isDead() && !minion.isInCombat()) { manageRandomAttack(world, minion); } } break; } - case "SPAWN_SUPPORT": - { - for (L2PcInstance players : world.playersInside) - { + case "SPAWN_SUPPORT": { + for (L2PcInstance players : world.playersInside) { players.setIsInvul(false); } world.freya.setIsInvul(false); @@ -451,33 +394,27 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance startQuestTimer("GIVE_SUPPORT", 1000, world.controller, null); break; } - case "GIVE_SUPPORT": - { - if (world.isSupportActive) - { + case "GIVE_SUPPORT": { + if (world.isSupportActive) { world.supp_Jinia.doCast(JINIAS_PRAYER); world.supp_Kegor.doCast(KEGORS_COURAGE); startQuestTimer("GIVE_SUPPORT", 25000, world.controller, null); } break; } - case "FINISH_STAGE": - { + case "FINISH_STAGE": { world.supp_Jinia.deleteMe(); world.supp_Jinia = null; world.freya.teleToLocation(FREYA_CORPSE); world.supp_Kegor.teleToLocation(KEGOR_FINISH); break; } - case "START_SPAWN": - { - for (L2Npc statues : world.knightStatues) - { + case "START_SPAWN": { + for (L2Npc statues : world.knightStatues) { notifyEvent("SPAWN_KNIGHT", statues, null); } - for (Location loc : KNIGHTS_LOC) - { + for (Location loc : KNIGHTS_LOC) { final L2Attackable knight = (L2Attackable) addSpawn((world.isHardMode ? KNIGHT_ULTIMATE : KNIGHT), loc, false, 0, false, world.getInstanceId()); knight.disableCoreAI(true); knight.setDisplayEffect(1); @@ -486,16 +423,13 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance startQuestTimer("ICE_RUPTURE", getRandom(2, 5) * 1000, knight, null); } - for (int i = 0; i < world.getStatus(); i++) - { + for (int i = 0; i < world.getStatus(); i++) { notifyEvent("SPAWN_GLACIER", world.controller, null); } break; } - case "SPAWN_KNIGHT": - { - if (world.canSpawnMobs) - { + case "SPAWN_KNIGHT": { + if (world.canSpawnMobs) { final Location loc = new Location(MIDDLE_POINT.getX() + getRandom(-1000, 1000), MIDDLE_POINT.getY() + getRandom(-1000, 1000), MIDDLE_POINT.getZ()); final L2Attackable knight = (L2Attackable) addSpawn(world.isHardMode ? KNIGHT_ULTIMATE : KNIGHT, npc.getLocation(), false, 0, false, world.getInstanceId()); knight.getVariables().set("SPAWNED_NPC", npc); @@ -509,10 +443,8 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance } break; } - case "SPAWN_GLACIER": - { - if (world.canSpawnMobs) - { + case "SPAWN_GLACIER": { + if (world.canSpawnMobs) { final Location loc = new Location(MIDDLE_POINT.getX() + getRandom(-1000, 1000), MIDDLE_POINT.getY() + getRandom(-1000, 1000), MIDDLE_POINT.getZ()); final L2Attackable glacier = (L2Attackable) addSpawn(GLACIER, loc, false, 0, false, world.getInstanceId()); glacier.setDisplayEffect(1); @@ -523,10 +455,8 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance } break; } - case "ICE_RUPTURE": - { - if (npc.isCoreAIDisabled()) - { + case "ICE_RUPTURE": { + if (npc.isCoreAIDisabled()) { npc.disableCoreAI(false); npc.setIsImmobilized(false); npc.setDisplayEffect(2); @@ -534,48 +464,37 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance } break; } - case "FIND_TARGET": - { + case "FIND_TARGET": { manageRandomAttack(world, (L2Attackable) npc); break; } - case "CHANGE_STATE": - { + case "CHANGE_STATE": { npc.setDisplayEffect(2); startQuestTimer("CAST_SKILL", 20000, npc, null); break; } - case "CAST_SKILL": - { - if (npc.isScriptValue(0) && !npc.isDead()) - { + case "CAST_SKILL": { + if (npc.isScriptValue(0) && !npc.isDead()) { npc.setTarget(npc); npc.doCast(COLD_MANAS_FRAGMENT); npc.setScriptValue(1); } break; } - case "SUICIDE": - { + case "SUICIDE": { npc.setDisplayEffect(3); npc.setIsMortal(true); npc.doDie(null); break; } - case "BLIZZARD": - { + case "BLIZZARD": { npc.getVariables().set("SUICIDE_COUNT", npc.getVariables().getInt("SUICIDE_COUNT") + 1); - if (npc.getVariables().getInt("SUICIDE_ON") == 0) - { - if (npc.getVariables().getInt("SUICIDE_COUNT") == 2) - { + if (npc.getVariables().getInt("SUICIDE_ON") == 0) { + if (npc.getVariables().getInt("SUICIDE_COUNT") == 2) { startQuestTimer("ELEMENTAL_SUICIDE", 20000, npc, null); - } - else - { - if (npc.checkDoCastConditions(BREATH_OF_ICE_PALACE.getSkill()) && !npc.isCastingNow()) - { + } else { + if (npc.checkDoCastConditions(BREATH_OF_ICE_PALACE.getSkill()) && !npc.isCastingNow()) { npc.setTarget(npc); npc.doCast(BREATH_OF_ICE_PALACE); } @@ -584,129 +503,98 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance } break; } - case "ELEMENTAL_SUICIDE": - { + case "ELEMENTAL_SUICIDE": { npc.setTarget(npc); npc.doCast(SELF_DESTRUCTION); break; } - case "ELEMENTAL_KILLED": - { - if (npc.getVariables().getInt("SUICIDE_ON") == 1) - { + case "ELEMENTAL_KILLED": { + if (npc.getVariables().getInt("SUICIDE_ON") == 1) { npc.setTarget(npc); npc.doCast(SELF_DESTRUCTION); } break; } - case "ATTACK_FREYA": - { + case "ATTACK_FREYA": { final SkillHolder skill = npc.getTemplate().getParameters().getObject("Skill01_ID", SkillHolder.class); - if (npc.isInsideRadius(world.freya, 100, true, false)) - { - if (npc.checkDoCastConditions(skill.getSkill()) && !npc.isCastingNow()) - { + if (npc.isInsideRadius(world.freya, 100, true, false)) { + if (npc.checkDoCastConditions(skill.getSkill()) && !npc.isCastingNow()) { npc.setTarget(world.freya); npc.doCast(skill); startQuestTimer("ATTACK_FREYA", 20000, npc, null); - } - else - { + } else { startQuestTimer("ATTACK_FREYA", 5000, npc, null); } - } - else - { + } else { npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, world.freya); startQuestTimer("ATTACK_FREYA", 5000, npc, null); } break; } - case "FINISH_WORLD": - { - if (world.freya != null) - { + case "FINISH_WORLD": { + if (world.freya != null) { world.freya.decayMe(); } - for (L2PcInstance players : world.playersInside) - { - if ((players != null)) - { + for (L2PcInstance players : world.playersInside) { + if ((players != null)) { players.broadcastPacket(ExChangeClientEffectInfo.STATIC_FREYA_DEFAULT); } } InstanceManager.getInstance().destroyInstance(world.getInstanceId()); break; } - case "LEADER_RANGEBUFF": - { - if (npc.checkDoCastConditions(LEADERS_ROAR.getSkill()) && !npc.isCastingNow()) - { + case "LEADER_RANGEBUFF": { + if (npc.checkDoCastConditions(LEADERS_ROAR.getSkill()) && !npc.isCastingNow()) { npc.setTarget(npc); npc.doCast(LEADERS_ROAR); - } - else - { + } else { startQuestTimer("LEADER_RANGEBUFF", 30000, npc, null); } break; } - case "LEADER_RANDOMIZE": - { + case "LEADER_RANDOMIZE": { final L2Attackable mob = (L2Attackable) npc; mob.clearAggroList(); - for (L2Character characters : npc.getKnownList().getKnownPlayersInRadius(1000)) - { - if ((characters != null)) - { + for (L2Character characters : npc.getKnownList().getKnownPlayersInRadius(1000)) { + if ((characters != null)) { mob.addDamageHate(characters, 0, getRandom(10000, 20000)); } } startQuestTimer("LEADER_RANDOMIZE", 25000, npc, null); break; } - case "LEADER_DASH": - { + case "LEADER_DASH": { final L2Character mostHated = ((L2Attackable) npc).getMostHated(); - if (getRandomBoolean() && !npc.isCastingNow() && (mostHated != null) && !mostHated.isDead() && (npc.calculateDistance(mostHated, true, false) < 1000)) - { + if (getRandomBoolean() && !npc.isCastingNow() && (mostHated != null) && !mostHated.isDead() && (npc.calculateDistance(mostHated, true, false) < 1000)) { npc.setTarget(mostHated); npc.doCast(RUSH); } startQuestTimer("LEADER_DASH", 10000, npc, null); break; } - case "LEADER_DESTROY": - { + case "LEADER_DESTROY": { final L2Attackable mob = (L2Attackable) npc; - if (npc.getVariables().getInt("OFF_SHOUT") == 0) - { + if (npc.getVariables().getInt("OFF_SHOUT") == 0) { manageScreenMsg(world, NpcStringId.THE_SPACE_FEELS_LIKE_ITS_GRADUALLY_STARTING_TO_SHAKE); - switch (getRandom(4)) - { - case 0: - { + switch (getRandom(4)) { + case 0: { broadcastNpcSay(npc, Say2.SHOUT, NpcStringId.ARCHER_GIVE_YOUR_BREATH_FOR_THE_INTRUDER); break; } - case 1: - { + case 1: { broadcastNpcSay(npc, Say2.SHOUT, NpcStringId.MY_KNIGHTS_SHOW_YOUR_LOYALTY); break; } - case 2: - { + case 2: { broadcastNpcSay(npc, Say2.SHOUT, NpcStringId.I_CAN_TAKE_IT_NO_LONGER); break; } - case 3: - { + case 3: { broadcastNpcSay(npc, Say2.SHOUT, NpcStringId.ARCHER_HEED_MY_CALL); - for (int i = 0; i < 3; i++) - { + for (int i = 0; i < 3; i++) { final L2Attackable breath = (L2Attackable) addSpawn(BREATH, npc.getLocation(), true, 0, false, world.getInstanceId()); breath.setIsRunning(true); breath.addDamageHate(mob.getMostHated(), 0, 999); @@ -720,16 +608,13 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance } break; } - case "LEADER_DELAY": - { - if (npc.getVariables().getInt("DELAY_VAL") == 0) - { + case "LEADER_DELAY": { + if (npc.getVariables().getInt("DELAY_VAL") == 0) { npc.getVariables().set("DELAY_VAL", 1); } break; } - case "SHOW_GLAKIAS_TIMER": - { + case "SHOW_GLAKIAS_TIMER": { final int time = (int) ((world.controller.getVariables().getLong("TIMER_END", 0) - System.currentTimeMillis()) / 1000); manageTimer(world, time, NpcStringId.BATTLE_END_LIMIT_TIME); break; @@ -741,30 +626,23 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { ((L2Attackable) npc).setOnKillDelay(0); return super.onSpawn(npc); } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof IQCNBWorld) - { + if (tmpworld instanceof IQCNBWorld) { final IQCNBWorld world = (IQCNBWorld) tmpworld; - if (npc.getId() == SUPP_JINIA) - { + if (npc.getId() == SUPP_JINIA) { player.sendPacket(ActionFailed.STATIC_PACKET); return null; - } - else if (npc.getId() == SUPP_KEGOR) - { - if (world.isSupportActive) - { + } else if (npc.getId() == SUPP_KEGOR) { + if (world.isSupportActive) { player.sendPacket(ActionFailed.STATIC_PACKET); return null; } @@ -776,36 +654,26 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) { final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof IQCNBWorld) - { + if (tmpworld instanceof IQCNBWorld) { final IQCNBWorld world = (IQCNBWorld) tmpworld; - switch (npc.getId()) - { - case FREYA_THRONE: - { - if ((world.controller.getVariables().getInt("FREYA_MOVE") == 0) && world.isStatus(1)) - { + switch (npc.getId()) { + case FREYA_THRONE: { + if ((world.controller.getVariables().getInt("FREYA_MOVE") == 0) && world.isStatus(1)) { world.controller.getVariables().set("FREYA_MOVE", 1); manageScreenMsg(world, NpcStringId.FREYA_HAS_STARTED_TO_MOVE); world.freya.setIsRunning(true); world.freya.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, MIDDLE_POINT); } - if (npc.getCurrentHp() < (npc.getMaxHp() * 0.02)) - { + if (npc.getCurrentHp() < (npc.getMaxHp() * 0.02)) { notifyEvent("STAGE_1_FINISH", world.controller, null); cancelQuestTimer("CAST_BLIZZARD", world.controller, null); - } - else - { - if ((attacker.getMountType() == MountType.STRIDER) && !attacker.isAffectedBySkill(HINDER_STRIDER.getSkillId()) && !npc.isCastingNow()) - { - if (!npc.isSkillDisabled(HINDER_STRIDER.getSkill())) - { + } else { + if ((attacker.getMountType() == MountType.STRIDER) && !attacker.isAffectedBySkill(HINDER_STRIDER.getSkillId()) && !npc.isCastingNow()) { + if (!npc.isSkillDisabled(HINDER_STRIDER.getSkill())) { npc.setTarget(attacker); npc.doCast(HINDER_STRIDER); } @@ -814,48 +682,32 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance final L2Character mostHated = ((L2Attackable) npc).getMostHated(); final boolean canReachMostHated = (mostHated != null) && !mostHated.isDead() && (npc.calculateDistance(mostHated, true, false) <= 800); - if (getRandom(10000) < 3333) - { - if (getRandomBoolean()) - { - if ((npc.calculateDistance(attacker, true, false) <= 800) && npc.checkDoCastConditions(ICE_BALL.getSkill()) && !npc.isCastingNow()) - { + if (getRandom(10000) < 3333) { + if (getRandomBoolean()) { + if ((npc.calculateDistance(attacker, true, false) <= 800) && npc.checkDoCastConditions(ICE_BALL.getSkill()) && !npc.isCastingNow()) { npc.setTarget(attacker); npc.doCast(ICE_BALL); } - } - else - { - if (canReachMostHated && npc.checkDoCastConditions(ICE_BALL.getSkill()) && !npc.isCastingNow()) - { + } else { + if (canReachMostHated && npc.checkDoCastConditions(ICE_BALL.getSkill()) && !npc.isCastingNow()) { npc.setTarget(mostHated); npc.doCast(ICE_BALL); } } - } - else if (getRandom(10000) < 800) - { - if (getRandomBoolean()) - { - if ((npc.calculateDistance(attacker, true, false) <= 800) && npc.checkDoCastConditions(SUMMON_SPIRITS.getSkill()) && !npc.isCastingNow()) - { + } else if (getRandom(10000) < 800) { + if (getRandomBoolean()) { + if ((npc.calculateDistance(attacker, true, false) <= 800) && npc.checkDoCastConditions(SUMMON_SPIRITS.getSkill()) && !npc.isCastingNow()) { npc.setTarget(attacker); npc.doCast(SUMMON_SPIRITS); } - } - else - { - if (canReachMostHated && npc.checkDoCastConditions(SUMMON_SPIRITS.getSkill()) && !npc.isCastingNow()) - { + } else { + if (canReachMostHated && npc.checkDoCastConditions(SUMMON_SPIRITS.getSkill()) && !npc.isCastingNow()) { npc.setTarget(mostHated); npc.doCast(SUMMON_SPIRITS); } } - } - else if (getRandom(10000) < 1500) - { - if (!npc.isAffectedBySkill(ATTACK_NEARBY_RANGE.getSkillId()) && npc.checkDoCastConditions(ATTACK_NEARBY_RANGE.getSkill()) && !npc.isCastingNow()) - { + } else if (getRandom(10000) < 1500) { + if (!npc.isAffectedBySkill(ATTACK_NEARBY_RANGE.getSkillId()) && npc.checkDoCastConditions(ATTACK_NEARBY_RANGE.getSkill()) && !npc.isCastingNow()) { npc.setTarget(npc); npc.doCast(ATTACK_NEARBY_RANGE); } @@ -864,22 +716,18 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance break; } case FREYA_STAND: - case FREYA_STAND_ULTIMATE: - { - if (world.controller.getVariables().getInt("FREYA_MOVE") == 0) - { + case FREYA_STAND_ULTIMATE: { + if (world.controller.getVariables().getInt("FREYA_MOVE") == 0) { world.controller.getVariables().set("FREYA_MOVE", 1); world.freya.setIsRunning(true); world.freya.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, MIDDLE_POINT); } - if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.2)) && !world.isSupportActive) - { + if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.2)) && !world.isSupportActive) { world.isSupportActive = true; world.freya.setIsInvul(true); world.freya.disableCoreAI(true); - for (L2PcInstance players : world.playersInside) - { + for (L2PcInstance players : world.playersInside) { players.setIsInvul(true); players.abortAttack(); } @@ -887,10 +735,8 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance startQuestTimer("SPAWN_SUPPORT", 27000, world.controller, null); } - if ((attacker.getMountType() == MountType.STRIDER) && !attacker.isAffectedBySkill(HINDER_STRIDER.getSkillId()) && !npc.isCastingNow()) - { - if (!npc.isSkillDisabled(HINDER_STRIDER.getSkill())) - { + if ((attacker.getMountType() == MountType.STRIDER) && !attacker.isAffectedBySkill(HINDER_STRIDER.getSkillId()) && !npc.isCastingNow()) { + if (!npc.isSkillDisabled(HINDER_STRIDER.getSkill())) { npc.setTarget(attacker); npc.doCast(HINDER_STRIDER); } @@ -899,86 +745,61 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance final L2Character mostHated = ((L2Attackable) npc).getMostHated(); final boolean canReachMostHated = (mostHated != null) && !mostHated.isDead() && (npc.calculateDistance(mostHated, true, false) <= 800); - if (getRandom(10000) < 3333) - { - if (getRandomBoolean()) - { - if ((npc.calculateDistance(attacker, true, false) <= 800) && npc.checkDoCastConditions(ICE_BALL.getSkill()) && !npc.isCastingNow()) - { + if (getRandom(10000) < 3333) { + if (getRandomBoolean()) { + if ((npc.calculateDistance(attacker, true, false) <= 800) && npc.checkDoCastConditions(ICE_BALL.getSkill()) && !npc.isCastingNow()) { npc.setTarget(attacker); npc.doCast(ICE_BALL); } - } - else - { - if (canReachMostHated && npc.checkDoCastConditions(ICE_BALL.getSkill()) && !npc.isCastingNow()) - { + } else { + if (canReachMostHated && npc.checkDoCastConditions(ICE_BALL.getSkill()) && !npc.isCastingNow()) { npc.setTarget(mostHated); npc.doCast(ICE_BALL); } } - } - else if (getRandom(10000) < 1333) - { - if (getRandomBoolean()) - { - if ((npc.calculateDistance(attacker, true, false) <= 800) && npc.checkDoCastConditions(SUMMON_SPIRITS.getSkill()) && !npc.isCastingNow()) - { + } else if (getRandom(10000) < 1333) { + if (getRandomBoolean()) { + if ((npc.calculateDistance(attacker, true, false) <= 800) && npc.checkDoCastConditions(SUMMON_SPIRITS.getSkill()) && !npc.isCastingNow()) { npc.setTarget(attacker); npc.doCast(SUMMON_SPIRITS); } - } - else - { - if (canReachMostHated && npc.checkDoCastConditions(SUMMON_SPIRITS.getSkill()) && !npc.isCastingNow()) - { + } else { + if (canReachMostHated && npc.checkDoCastConditions(SUMMON_SPIRITS.getSkill()) && !npc.isCastingNow()) { npc.setTarget(mostHated); npc.doCast(SUMMON_SPIRITS); } } - } - else if (getRandom(10000) < 1500) - { - if (!npc.isAffectedBySkill(ATTACK_NEARBY_RANGE.getSkillId()) && npc.checkDoCastConditions(ATTACK_NEARBY_RANGE.getSkill()) && !npc.isCastingNow()) - { + } else if (getRandom(10000) < 1500) { + if (!npc.isAffectedBySkill(ATTACK_NEARBY_RANGE.getSkillId()) && npc.checkDoCastConditions(ATTACK_NEARBY_RANGE.getSkill()) && !npc.isCastingNow()) { npc.setTarget(npc); npc.doCast(ATTACK_NEARBY_RANGE); } - } - else if (getRandom(10000) < 1333) - { - if (!npc.isAffectedBySkill(REFLECT_MAGIC.getSkillId()) && npc.checkDoCastConditions(REFLECT_MAGIC.getSkill()) && !npc.isCastingNow()) - { + } else if (getRandom(10000) < 1333) { + if (!npc.isAffectedBySkill(REFLECT_MAGIC.getSkillId()) && npc.checkDoCastConditions(REFLECT_MAGIC.getSkill()) && !npc.isCastingNow()) { npc.setTarget(npc); npc.doCast(REFLECT_MAGIC); } } break; } - case GLACIER: - { - if (npc.isScriptValue(0) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.5))) - { + case GLACIER: { + if (npc.isScriptValue(0) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.5))) { npc.setTarget(attacker); npc.doCast(COLD_MANAS_FRAGMENT); npc.setScriptValue(1); } break; } - case BREATH: - { - if ((npc.getCurrentHp() < (npc.getMaxHp() / 20)) && (npc.getVariables().getInt("SUICIDE_ON", 0) == 0)) - { + case BREATH: { + if ((npc.getCurrentHp() < (npc.getMaxHp() / 20)) && (npc.getVariables().getInt("SUICIDE_ON", 0) == 0)) { npc.getVariables().set("SUICIDE_ON", 1); startQuestTimer("ELEMENTAL_KILLED", 1000, npc, null); } break; } case KNIGHT: - case KNIGHT_ULTIMATE: - { - if (npc.isCoreAIDisabled()) - { + case KNIGHT_ULTIMATE: { + if (npc.isCoreAIDisabled()) { manageRandomAttack(world, (L2Attackable) npc); npc.disableCoreAI(false); npc.setIsImmobilized(false); @@ -988,30 +809,22 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance break; } case GLAKIAS: - case GLAKIAS_ULTIMATE: - { - if (npc.getCurrentHp() < (npc.getMaxHp() * 0.02)) - { - if (npc.getVariables().getInt("OFF_SHOUT") == 0) - { + case GLAKIAS_ULTIMATE: { + if (npc.getCurrentHp() < (npc.getMaxHp() * 0.02)) { + if (npc.getVariables().getInt("OFF_SHOUT") == 0) { npc.getVariables().set("OFF_SHOUT", 1); npc.getVariables().set("DELAY_VAL", 2); npc.setTarget(attacker); npc.doCast(NPC_CANCEL_PC_TARGET); - } - else if (npc.getVariables().getInt("OFF_SHOUT") == 1) - { + } else if (npc.getVariables().getInt("OFF_SHOUT") == 1) { npc.setTarget(attacker); npc.doCast(NPC_CANCEL_PC_TARGET); } - } - else if ((npc.getVariables().getInt("OFF_SHOUT") == 0) && (npc.getVariables().getInt("DELAY_VAL") == 1)) - { + } else if ((npc.getVariables().getInt("OFF_SHOUT") == 0) && (npc.getVariables().getInt("DELAY_VAL") == 1)) { final L2Character mostHated = ((L2Attackable) npc).getMostHated(); final boolean canReachMostHated = (mostHated != null) && !mostHated.isDead() && (npc.calculateDistance(mostHated, true, false) < 1000); - if (npc.getVariables().getInt("TIMER_ON") == 0) - { + if (npc.getVariables().getInt("TIMER_ON") == 0) { npc.getVariables().set("TIMER_ON", 1); startQuestTimer("LEADER_RANGEBUFF", getRandom(5, 30) * 1000, npc, null); startQuestTimer("LEADER_RANDOMIZE", 25000, npc, null); @@ -1019,50 +832,33 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance startQuestTimer("LEADER_DESTROY", 60000, npc, null); } - if (getRandom(10000) < 2500) - { - if (getRandom(10000) < 2500) - { - if (npc.checkDoCastConditions(POWER_STRIKE.getSkill()) && !npc.isCastingNow()) - { + if (getRandom(10000) < 2500) { + if (getRandom(10000) < 2500) { + if (npc.checkDoCastConditions(POWER_STRIKE.getSkill()) && !npc.isCastingNow()) { npc.setTarget(attacker); npc.doCast(POWER_STRIKE); } - } - else if (npc.checkDoCastConditions(POWER_STRIKE.getSkill()) && !npc.isCastingNow() && canReachMostHated) - { + } else if (npc.checkDoCastConditions(POWER_STRIKE.getSkill()) && !npc.isCastingNow() && canReachMostHated) { npc.setTarget(((L2Attackable) npc).getMostHated()); npc.doCast(POWER_STRIKE); } - } - else if (getRandom(10000) < 1500) - { - if (getRandomBoolean()) - { - if (npc.checkDoCastConditions(POINT_TARGET.getSkill()) && !npc.isCastingNow()) - { + } else if (getRandom(10000) < 1500) { + if (getRandomBoolean()) { + if (npc.checkDoCastConditions(POINT_TARGET.getSkill()) && !npc.isCastingNow()) { npc.setTarget(attacker); npc.doCast(POINT_TARGET); } - } - else if (npc.checkDoCastConditions(POINT_TARGET.getSkill()) && !npc.isCastingNow() && canReachMostHated) - { + } else if (npc.checkDoCastConditions(POINT_TARGET.getSkill()) && !npc.isCastingNow() && canReachMostHated) { npc.setTarget(((L2Attackable) npc).getMostHated()); npc.doCast(POINT_TARGET); } - } - else if (getRandom(10000) < 1500) - { - if (getRandomBoolean()) - { - if (npc.checkDoCastConditions(CYLINDER_THROW.getSkill()) && !npc.isCastingNow()) - { + } else if (getRandom(10000) < 1500) { + if (getRandomBoolean()) { + if (npc.checkDoCastConditions(CYLINDER_THROW.getSkill()) && !npc.isCastingNow()) { npc.setTarget(attacker); npc.doCast(CYLINDER_THROW); } - } - else if (npc.checkDoCastConditions(CYLINDER_THROW.getSkill()) && !npc.isCastingNow() && canReachMostHated) - { + } else if (npc.checkDoCastConditions(CYLINDER_THROW.getSkill()) && !npc.isCastingNow() && canReachMostHated) { npc.setTarget(((L2Attackable) npc).getMostHated()); npc.doCast(CYLINDER_THROW); } @@ -1076,31 +872,22 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance } @Override - public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) - { + public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill) { final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof IQCNBWorld) - { + if (tmpworld instanceof IQCNBWorld) { final IQCNBWorld world = (IQCNBWorld) tmpworld; - switch (npc.getId()) - { - case GLACIER: - { - if (skill == COLD_MANAS_FRAGMENT.getSkill()) - { - if (getRandom(100) < 75) - { + switch (npc.getId()) { + case GLACIER: { + if (skill == COLD_MANAS_FRAGMENT.getSkill()) { + if (getRandom(100) < 75) { final L2Attackable breath = (L2Attackable) addSpawn(BREATH, npc.getLocation(), false, 0, false, world.getInstanceId()); - if (player != null) - { + if (player != null) { breath.setIsRunning(true); breath.addDamageHate(player, 0, 999); breath.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player); - } - else - { + } else { manageRandomAttack(world, breath); } world.spawnedMobs.add(breath); @@ -1110,10 +897,8 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance } break; } - case BREATH: - { - if (skill == SELF_DESTRUCTION.getSkill()) - { + case BREATH: { + if (skill == SELF_DESTRUCTION.getSkill()) { npc.doDie(null); } break; @@ -1124,18 +909,14 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof IQCNBWorld) - { + if (tmpworld instanceof IQCNBWorld) { final IQCNBWorld world = (IQCNBWorld) tmpworld; - switch (npc.getId()) - { + switch (npc.getId()) { case GLAKIAS: - case GLAKIAS_ULTIMATE: - { + case GLAKIAS_ULTIMATE: { manageDespawnMinions(world); manageTimer(world, 60, NpcStringId.TIME_REMAINING_UNTIL_NEXT_BATTLE); cancelQuestTimer("STAGE_2_FAILED", world.controller, null); @@ -1143,8 +924,7 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance break; } case FREYA_STAND: - case FREYA_STAND_ULTIMATE: - { + case FREYA_STAND_ULTIMATE: { world.isSupportActive = false; manageMovie(world, 19); manageDespawnMinions(world); @@ -1160,48 +940,41 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance break; } case KNIGHT: - case KNIGHT_ULTIMATE: - { + case KNIGHT_ULTIMATE: { final L2Npc spawnedBy = npc.getVariables().getObject("SPAWNED_NPC", L2Npc.class); final NpcVariables var = world.controller.getVariables(); int knightCount = var.getInt("KNIGHT_COUNT"); - if ((var.getInt("FREYA_MOVE") == 0) && world.isStatus(1)) - { + if ((var.getInt("FREYA_MOVE") == 0) && world.isStatus(1)) { var.set("FREYA_MOVE", 1); manageScreenMsg(world, NpcStringId.FREYA_HAS_STARTED_TO_MOVE); world.freya.setIsRunning(true); world.freya.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, MIDDLE_POINT); } - if ((knightCount < 10) && (world.isStatus(2))) - { + if ((knightCount < 10) && (world.isStatus(2))) { knightCount++; var.set("KNIGHT_COUNT", knightCount); - if (knightCount == 10) - { + if (knightCount == 10) { notifyEvent("STAGE_2_MOVIE", world.controller, null); world.setStatus(3); } } - if (spawnedBy != null) - { + if (spawnedBy != null) { final int time = (world.isHardMode ? getRandom(30, 60) : getRandom(50, 60)) * 1000; startQuestTimer("SPAWN_KNIGHT", time, spawnedBy, null); } world.spawnedMobs.remove(npc); break; } - case GLACIER: - { + case GLACIER: { startQuestTimer("SPAWN_GLACIER", getRandom(30, 60) * 1000, world.controller, null); world.spawnedMobs.remove(npc); break; } - case BREATH: - { + case BREATH: { world.spawnedMobs.remove(npc); break; } @@ -1211,100 +984,71 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { final IQCNBWorld curworld = (IQCNBWorld) world; curworld.isHardMode = curworld.getTemplateId() == TEMPLATE_ID_ULTIMATE; - if (!player.isInParty()) - { + if (!player.isInParty()) { managePlayerEnter(player, curworld); - } - else if (player.getParty().isInCommandChannel()) - { - for (L2PcInstance players : player.getParty().getCommandChannel().getMembers()) - { + } else if (player.getParty().isInCommandChannel()) { + for (L2PcInstance players : player.getParty().getCommandChannel().getMembers()) { managePlayerEnter(players, curworld); } - } - else - { - for (L2PcInstance players : player.getParty().getMembers()) - { + } else { + for (L2PcInstance players : player.getParty().getMembers()) { managePlayerEnter(players, curworld); } } - } - else - { + } else { teleportPlayer(player, world.isStatus(4) ? BATTLE_PORT : ENTER_LOC[getRandom(ENTER_LOC.length)], world.getInstanceId()); } } - private void managePlayerEnter(L2PcInstance player, IQCNBWorld world) - { + private void managePlayerEnter(L2PcInstance player, IQCNBWorld world) { world.playersInside.add(player); world.addAllowed(player.getObjectId()); teleportPlayer(player, ENTER_LOC[getRandom(ENTER_LOC.length)], world.getInstanceId(), false); } @Override - protected boolean checkConditions(L2PcInstance player) - { + protected boolean checkConditions(L2PcInstance player) { final L2Party party = player.getParty(); final L2CommandChannel channel = party != null ? party.getCommandChannel() : null; - if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) - { + if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) { return true; } - if (party == null) - { + if (party == null) { player.sendPacket(SystemMessageId.NOT_IN_PARTY_CANT_ENTER); return false; - } - else if (channel == null) - { + } else if (channel == null) { player.sendPacket(SystemMessageId.NOT_IN_COMMAND_CHANNEL_CANT_ENTER); return false; - } - else if (player != channel.getLeader()) - { + } else if (player != channel.getLeader()) { player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); return false; - } - else if ((channel.getMemberCount() < MIN_PLAYERS) || (channel.getMemberCount() > MAX_PLAYERS)) - { + } else if ((channel.getMemberCount() < MIN_PLAYERS) || (channel.getMemberCount() > MAX_PLAYERS)) { player.sendPacket(SystemMessageId.PARTY_EXCEEDED_THE_LIMIT_CANT_ENTER); return false; } - for (L2PcInstance channelMember : channel.getMembers()) - { - if (channelMember.getLevel() < MIN_LEVEL) - { + for (L2PcInstance channelMember : channel.getMembers()) { + if (channelMember.getLevel() < MIN_LEVEL) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); sm.addPcName(channelMember); party.broadcastPacket(sm); return false; - } - else if (!Util.checkIfInRange(1000, player, channelMember, true)) - { + } else if (!Util.checkIfInRange(1000, player, channelMember, true)) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED); sm.addPcName(channelMember); party.broadcastPacket(sm); return false; - } - else if (System.currentTimeMillis() < InstanceManager.getInstance().getInstanceTime(channelMember.getObjectId(), TEMPLATE_ID)) - { + } else if (System.currentTimeMillis() < InstanceManager.getInstance().getInstanceTime(channelMember.getObjectId(), TEMPLATE_ID)) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET); sm.addPcName(channelMember); party.broadcastPacket(sm); return false; - } - else if (System.currentTimeMillis() < InstanceManager.getInstance().getInstanceTime(channelMember.getObjectId(), TEMPLATE_ID_ULTIMATE)) - { + } else if (System.currentTimeMillis() < InstanceManager.getInstance().getInstanceTime(channelMember.getObjectId(), TEMPLATE_ID_ULTIMATE)) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET); sm.addPcName(channelMember); party.broadcastPacket(sm); @@ -1314,71 +1058,53 @@ public final class IceQueensCastleNormalBattle extends AbstractInstance return true; } - private void manageRandomAttack(IQCNBWorld world, L2Attackable mob) - { + private void manageRandomAttack(IQCNBWorld world, L2Attackable mob) { final List<L2PcInstance> players = new ArrayList<>(); - for (L2PcInstance player : world.playersInside) - { - if ((player != null) && !player.isDead() && (player.getInstanceId() == world.getInstanceId()) && !player.isInvisible()) - { + for (L2PcInstance player : world.playersInside) { + if ((player != null) && !player.isDead() && (player.getInstanceId() == world.getInstanceId()) && !player.isInvisible()) { players.add(player); } } Collections.shuffle(players); final L2PcInstance target = (!players.isEmpty()) ? players.get(0) : null; - if (target != null) - { + if (target != null) { mob.addDamageHate(target, 0, 999); mob.setIsRunning(true); mob.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); - } - else - { + } else { startQuestTimer("FIND_TARGET", 10000, mob, null); } } - private void manageDespawnMinions(IQCNBWorld world) - { + private void manageDespawnMinions(IQCNBWorld world) { world.canSpawnMobs = false; - for (L2Attackable mobs : world.spawnedMobs) - { - if ((mobs != null) && !mobs.isDead()) - { + for (L2Attackable mobs : world.spawnedMobs) { + if ((mobs != null) && !mobs.isDead()) { mobs.doDie(null); } } } - private void manageTimer(IQCNBWorld world, int time, NpcStringId npcStringId) - { - for (L2PcInstance players : world.playersInside) - { - if ((players != null) && (players.getInstanceId() == world.getInstanceId())) - { + private void manageTimer(IQCNBWorld world, int time, NpcStringId npcStringId) { + for (L2PcInstance players : world.playersInside) { + if ((players != null) && (players.getInstanceId() == world.getInstanceId())) { players.sendPacket(new ExSendUIEvent(players, false, false, time, 0, npcStringId)); } } } - private void manageScreenMsg(IQCNBWorld world, NpcStringId stringId) - { - for (L2PcInstance players : world.playersInside) - { - if ((players != null) && (players.getInstanceId() == world.getInstanceId())) - { + private void manageScreenMsg(IQCNBWorld world, NpcStringId stringId) { + for (L2PcInstance players : world.playersInside) { + if ((players != null) && (players.getInstanceId() == world.getInstanceId())) { showOnScreenMsg(players, stringId, 2, 6000); } } } - private void manageMovie(IQCNBWorld world, int movie) - { - for (L2PcInstance players : world.playersInside) - { - if ((players != null) && (players.getInstanceId() == world.getInstanceId())) - { + private void manageMovie(IQCNBWorld world, int movie) { + for (L2PcInstance players : world.playersInside) { + if ((players != null) && (players.getInstanceId() == world.getInstanceId())) { players.showQuestMovie(movie); } } diff --git a/src/main/java/com/l2jserver/datapack/instances/JiniaGuildHideout1/JiniaGuildHideout1.java b/src/main/java/com/l2jserver/datapack/instances/JiniaGuildHideout1/JiniaGuildHideout1.java index c64d95c2f9..e356e3dec7 100644 --- a/src/main/java/com/l2jserver/datapack/instances/JiniaGuildHideout1/JiniaGuildHideout1.java +++ b/src/main/java/com/l2jserver/datapack/instances/JiniaGuildHideout1/JiniaGuildHideout1.java @@ -30,10 +30,8 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Jinia Guild Hideout instance zone. * @author Adry_85 */ -public final class JiniaGuildHideout1 extends AbstractInstance -{ - protected class JGH1World extends InstanceWorld - { +public final class JiniaGuildHideout1 extends AbstractInstance { + protected class JGH1World extends InstanceWorld { } @@ -44,19 +42,16 @@ public final class JiniaGuildHideout1 extends AbstractInstance // Misc private static final int TEMPLATE_ID = 140; - public JiniaGuildHideout1() - { + public JiniaGuildHideout1() { super(JiniaGuildHideout1.class.getSimpleName()); addStartNpc(RAFFORTY); addTalkId(RAFFORTY); } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = talker.getQuestState(Q10284_AcquisitionOfDivineSword.class.getSimpleName()); - if ((qs != null) && qs.isCond(1)) - { + if ((qs != null) && qs.isCond(1)) { enterInstance(talker, new JGH1World(), "JiniaGuildHideout1.xml", TEMPLATE_ID); qs.setCond(2, true); } @@ -64,10 +59,8 @@ public final class JiniaGuildHideout1 extends AbstractInstance } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { world.addAllowed(player.getObjectId()); } teleportPlayer(player, START_LOC, world.getInstanceId(), false); diff --git a/src/main/java/com/l2jserver/datapack/instances/JiniaGuildHideout2/JiniaGuildHideout2.java b/src/main/java/com/l2jserver/datapack/instances/JiniaGuildHideout2/JiniaGuildHideout2.java index 68feb58d11..d1c76317d3 100644 --- a/src/main/java/com/l2jserver/datapack/instances/JiniaGuildHideout2/JiniaGuildHideout2.java +++ b/src/main/java/com/l2jserver/datapack/instances/JiniaGuildHideout2/JiniaGuildHideout2.java @@ -30,10 +30,8 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Jinia Guild Hideout instance zone. * @author Adry_85 */ -public final class JiniaGuildHideout2 extends AbstractInstance -{ - protected class JGH2World extends InstanceWorld - { +public final class JiniaGuildHideout2 extends AbstractInstance { + protected class JGH2World extends InstanceWorld { } @@ -44,19 +42,16 @@ public final class JiniaGuildHideout2 extends AbstractInstance // Misc private static final int TEMPLATE_ID = 141; - public JiniaGuildHideout2() - { + public JiniaGuildHideout2() { super(JiniaGuildHideout2.class.getSimpleName()); addStartNpc(RAFFORTY); addTalkId(RAFFORTY); } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = talker.getQuestState(Q10285_MeetingSirra.class.getSimpleName()); - if ((qs != null) && qs.isMemoState(1)) - { + if ((qs != null) && qs.isMemoState(1)) { enterInstance(talker, new JGH2World(), "JiniaGuildHideout2.xml", TEMPLATE_ID); qs.setCond(2, true); } @@ -64,10 +59,8 @@ public final class JiniaGuildHideout2 extends AbstractInstance } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { world.addAllowed(player.getObjectId()); } teleportPlayer(player, START_LOC, world.getInstanceId(), false); diff --git a/src/main/java/com/l2jserver/datapack/instances/JiniaGuildHideout3/JiniaGuildHideout3.java b/src/main/java/com/l2jserver/datapack/instances/JiniaGuildHideout3/JiniaGuildHideout3.java index 2b63f4ae20..3a9c9211b6 100644 --- a/src/main/java/com/l2jserver/datapack/instances/JiniaGuildHideout3/JiniaGuildHideout3.java +++ b/src/main/java/com/l2jserver/datapack/instances/JiniaGuildHideout3/JiniaGuildHideout3.java @@ -30,10 +30,8 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Jinia Guild Hideout instance zone. * @author Adry_85 */ -public final class JiniaGuildHideout3 extends AbstractInstance -{ - protected class JGH3World extends InstanceWorld - { +public final class JiniaGuildHideout3 extends AbstractInstance { + protected class JGH3World extends InstanceWorld { } @@ -44,19 +42,16 @@ public final class JiniaGuildHideout3 extends AbstractInstance // Misc private static final int TEMPLATE_ID = 145; - public JiniaGuildHideout3() - { + public JiniaGuildHideout3() { super(JiniaGuildHideout3.class.getSimpleName()); addStartNpc(RAFFORTY); addTalkId(RAFFORTY); } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = talker.getQuestState(Q10286_ReunionWithSirra.class.getSimpleName()); - if ((qs != null) && qs.isMemoState(1)) - { + if ((qs != null) && qs.isMemoState(1)) { enterInstance(talker, new JGH3World(), "JiniaGuildHideout3.xml", TEMPLATE_ID); qs.setCond(2, true); } @@ -64,10 +59,8 @@ public final class JiniaGuildHideout3 extends AbstractInstance } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { world.addAllowed(player.getObjectId()); } teleportPlayer(player, START_LOC, world.getInstanceId(), false); diff --git a/src/main/java/com/l2jserver/datapack/instances/JiniaGuildHideout4/JiniaGuildHideout4.java b/src/main/java/com/l2jserver/datapack/instances/JiniaGuildHideout4/JiniaGuildHideout4.java index ce87fdb66d..fade80191f 100644 --- a/src/main/java/com/l2jserver/datapack/instances/JiniaGuildHideout4/JiniaGuildHideout4.java +++ b/src/main/java/com/l2jserver/datapack/instances/JiniaGuildHideout4/JiniaGuildHideout4.java @@ -30,10 +30,8 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Jinia Guild Hideout instance zone. * @author Adry_85 */ -public final class JiniaGuildHideout4 extends AbstractInstance -{ - protected class JGH4World extends InstanceWorld - { +public final class JiniaGuildHideout4 extends AbstractInstance { + protected class JGH4World extends InstanceWorld { } @@ -44,19 +42,16 @@ public final class JiniaGuildHideout4 extends AbstractInstance // Misc private static final int TEMPLATE_ID = 146; - public JiniaGuildHideout4() - { + public JiniaGuildHideout4() { super(JiniaGuildHideout4.class.getSimpleName()); addStartNpc(RAFFORTY); addTalkId(RAFFORTY); } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = talker.getQuestState(Q10287_StoryOfThoseLeft.class.getSimpleName()); - if ((qs != null) && qs.isMemoState(1)) - { + if ((qs != null) && qs.isMemoState(1)) { enterInstance(talker, new JGH4World(), "JiniaGuildHideout4.xml", TEMPLATE_ID); qs.setCond(2, true); } @@ -64,10 +59,8 @@ public final class JiniaGuildHideout4 extends AbstractInstance } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { world.addAllowed(player.getObjectId()); } teleportPlayer(player, START_LOC, world.getInstanceId(), false); diff --git a/src/main/java/com/l2jserver/datapack/instances/Kamaloka/Kamaloka.java b/src/main/java/com/l2jserver/datapack/instances/Kamaloka/Kamaloka.java index c0ca2dcd1d..45bfaec540 100644 --- a/src/main/java/com/l2jserver/datapack/instances/Kamaloka/Kamaloka.java +++ b/src/main/java/com/l2jserver/datapack/instances/Kamaloka/Kamaloka.java @@ -44,8 +44,7 @@ import com.l2jserver.gameserver.model.skills.Skill; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.SystemMessage; -public final class Kamaloka extends AbstractInstance -{ +public final class Kamaloka extends AbstractInstance { /* * Reset time for all kamaloka Default: 6:30AM on server time */ @@ -104,8 +103,7 @@ public final class Kamaloka extends AbstractInstance }; // @formatter:on // Teleport points into instances x, y, z - private static final Location[] TELEPORTS = - { + private static final Location[] TELEPORTS = { new Location(-88429, -220629, -7903), new Location(-82464, -219532, -7899), new Location(-10700, -174882, -10936), // -76280, -185540, -10936 @@ -136,8 +134,7 @@ public final class Kamaloka extends AbstractInstance * Default: 5699 (decrease pdef)<br> * shaman npcId, minions npcId, skillId, skillLvl */ - private static final int[][] FIRST_ROOM = - { + private static final int[][] FIRST_ROOM = { null, null, { @@ -202,8 +199,7 @@ public final class Kamaloka extends AbstractInstance /* * First room spawns, null if room not spawned x, y, z */ - private static final int[][][] FIRST_ROOM_SPAWNS = - { + private static final int[][][] FIRST_ROOM_SPAWNS = { null, null, { @@ -596,8 +592,7 @@ public final class Kamaloka extends AbstractInstance /* * Second room information, null if room not spawned Skill is casted on the boss when all mobs are defeated Default: 5700 (decrease mdef) npcId, skillId, skillLvl */ - private static final int[][] SECOND_ROOM = - { + private static final int[][] SECOND_ROOM = { null, null, { @@ -655,8 +650,7 @@ public final class Kamaloka extends AbstractInstance /* * Spawns for second room, null if room not spawned x, y, z */ - private static final int[][][] SECOND_ROOM_SPAWNS = - { + private static final int[][][] SECOND_ROOM_SPAWNS = { null, null, { @@ -892,8 +886,7 @@ public final class Kamaloka extends AbstractInstance /* * Miniboss information, null if miniboss not spawned Skill is casted on the boss when miniboss is defeated Default: 5701 (decrease patk) npcId, x, y, z, skillId, skillLvl */ - private static final int[][] MINIBOSS = - { + private static final int[][] MINIBOSS = { null, null, { @@ -974,8 +967,7 @@ public final class Kamaloka extends AbstractInstance /* * Bosses of the kamaloka Instance ends when boss is defeated npcId, x, y, z */ - private static final int[][] BOSS = - { + private static final int[][] BOSS = { { 18554, -88998, @@ -1095,8 +1087,7 @@ public final class Kamaloka extends AbstractInstance /* * Escape telepoters spawns, null if not spawned x, y, z */ - private static final int[][] TELEPORTERS = - { + private static final int[][] TELEPORTERS = { null, null, { @@ -1156,8 +1147,7 @@ public final class Kamaloka extends AbstractInstance private static final int TELEPORTER = 32496; /** Kamaloka captains (start npc's) npcIds. */ - private static final int[] CAPTAINS = - { + private static final int[] CAPTAINS = { 30332, 30071, 30916, @@ -1166,8 +1156,7 @@ public final class Kamaloka extends AbstractInstance 31340 }; - protected class KamaWorld extends InstanceWorld - { + protected class KamaWorld extends InstanceWorld { public int index; // 0-18 index of the kama type in arrays public int shaman = 0; // objectId of the shaman public List<L2Spawn> firstRoom; // list of the spawns in the first room (excluding shaman) @@ -1176,43 +1165,32 @@ public final class Kamaloka extends AbstractInstance public L2Npc boss = null; // boss } - public Kamaloka() - { + public Kamaloka() { super(Kamaloka.class.getSimpleName()); addFirstTalkId(TELEPORTER); addTalkId(TELEPORTER); addStartNpc(CAPTAINS); addTalkId(CAPTAINS); - for (int[] mob : FIRST_ROOM) - { - if (mob != null) - { - if (STEALTH_SHAMAN) - { + for (int[] mob : FIRST_ROOM) { + if (mob != null) { + if (STEALTH_SHAMAN) { addKillId(mob[1]); - } - else - { + } else { addKillId(mob[0]); } } } - for (int[] mob : SECOND_ROOM) - { - if (mob != null) - { + for (int[] mob : SECOND_ROOM) { + if (mob != null) { addKillId(mob[0]); } } - for (int[] mob : MINIBOSS) - { - if (mob != null) - { + for (int[] mob : MINIBOSS) { + if (mob != null) { addKillId(mob[0]); } } - for (int[] mob : BOSS) - { + for (int[] mob : BOSS) { addKillId(mob[0]); } } @@ -1223,24 +1201,20 @@ public final class Kamaloka extends AbstractInstance * @param index (0-18) index of the kamaloka in arrays * @return true if party allowed to enter */ - private static final boolean checkPartyConditions(L2PcInstance player, int index) - { + private static final boolean checkPartyConditions(L2PcInstance player, int index) { final L2Party party = player.getParty(); // player must be in party - if (party == null) - { + if (party == null) { player.sendPacket(SystemMessageId.NOT_IN_PARTY_CANT_ENTER); return false; } // ...and be party leader - if (party.getLeader() != player) - { + if (party.getLeader() != player) { player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); return false; } // party must not exceed max size for selected instance - if (party.getMemberCount() > MAX_PARTY_SIZE[index]) - { + if (party.getMemberCount() > MAX_PARTY_SIZE[index]) { player.sendPacket(SystemMessageId.PARTY_EXCEEDED_THE_LIMIT_CANT_ENTER); return false; } @@ -1252,19 +1226,16 @@ public final class Kamaloka extends AbstractInstance Map<Integer, Long> instanceTimes; // for each party member - for (L2PcInstance partyMember : party.getMembers()) - { + for (L2PcInstance partyMember : party.getMembers()) { // player level must be in range - if (Math.abs(partyMember.getLevel() - level) > MAX_LEVEL_DIFFERENCE) - { + if (Math.abs(partyMember.getLevel() - level) > MAX_LEVEL_DIFFERENCE) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); sm.addPcName(partyMember); player.sendPacket(sm); return false; } // player must be near party leader - if (!partyMember.isInsideRadius(player, 1000, true, true)) - { + if (!partyMember.isInsideRadius(player, 1000, true, true)) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED); sm.addPcName(partyMember); player.sendPacket(sm); @@ -1272,19 +1243,15 @@ public final class Kamaloka extends AbstractInstance } // get instances reenter times for player instanceTimes = InstanceManager.getInstance().getAllInstanceTimes(partyMember.getObjectId()); - if (instanceTimes != null) - { - for (int id : instanceTimes.keySet()) - { + if (instanceTimes != null) { + for (int id : instanceTimes.keySet()) { // find instance with same name (kamaloka or labyrinth) // TODO: Zoey76: Don't use instance name, use other system. - if (!instanceName.equals(InstanceManager.getInstance().getInstanceIdName(id))) - { + if (!instanceName.equals(InstanceManager.getInstance().getInstanceIdName(id))) { continue; } // if found instance still can't be reentered - exit - if (System.currentTimeMillis() < instanceTimes.get(id)) - { + if (System.currentTimeMillis() < instanceTimes.get(id)) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET); sm.addPcName(partyMember); player.sendPacket(sm); @@ -1300,12 +1267,9 @@ public final class Kamaloka extends AbstractInstance * Removing all buffs from player and pet except BUFFS_WHITELIST * @param ch player */ - private static final void removeBuffs(L2Character ch) - { - final Function<BuffInfo, Boolean> removeBuffs = info -> - { - if ((info != null) && !info.getSkill().isStayAfterDeath() && (Arrays.binarySearch(BUFFS_WHITELIST, info.getSkill().getId()) < 0)) - { + private static final void removeBuffs(L2Character ch) { + final Function<BuffInfo, Boolean> removeBuffs = info -> { + if ((info != null) && !info.getSkill().isStayAfterDeath() && (Arrays.binarySearch(BUFFS_WHITELIST, info.getSkill().getId()) < 0)) { info.getEffected().getEffectList().stopSkillEffects(true, info.getSkill()); return true; } @@ -1314,8 +1278,7 @@ public final class Kamaloka extends AbstractInstance ch.getEffectList().forEach(removeBuffs, false); - if (ch.hasSummon()) - { + if (ch.hasSummon()) { ch.getSummon().getEffectList().forEach(removeBuffs, false); } } @@ -1325,32 +1288,25 @@ public final class Kamaloka extends AbstractInstance * @param player party leader * @param index (0-18) kamaloka index in arrays */ - private final synchronized void enterInstance(L2PcInstance player, int index) - { + private final synchronized void enterInstance(L2PcInstance player, int index) { int templateId; - try - { + try { templateId = TEMPLATE_IDS[index]; - } - catch (ArrayIndexOutOfBoundsException e) - { + } catch (ArrayIndexOutOfBoundsException e) { throw e; } // check for existing instances for this player InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); // player already in the instance - if (world != null) - { + if (world != null) { // but not in kamaloka - if (!(world instanceof KamaWorld) || (world.getTemplateId() != templateId)) - { + if (!(world instanceof KamaWorld) || (world.getTemplateId() != templateId)) { player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON); return; } // check for level difference again on reenter - if (Math.abs(player.getLevel() - LEVEL[((KamaWorld) world).index]) > MAX_LEVEL_DIFFERENCE) - { + if (Math.abs(player.getLevel() - LEVEL[((KamaWorld) world).index]) > MAX_LEVEL_DIFFERENCE) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); sm.addPcName(player); player.sendPacket(sm); @@ -1358,16 +1314,14 @@ public final class Kamaloka extends AbstractInstance } // check what instance still exist Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId()); - if (inst != null) - { + if (inst != null) { removeBuffs(player); teleportPlayer(player, TELEPORTS[index], world.getInstanceId()); } return; } // Creating new kamaloka instance - if (!checkPartyConditions(player, index)) - { + if (!checkPartyConditions(player, index)) { return; } @@ -1397,8 +1351,7 @@ public final class Kamaloka extends AbstractInstance // and finally teleport party into instance final L2Party party = player.getParty(); - for (L2PcInstance partyMember : party.getMembers()) - { + for (L2PcInstance partyMember : party.getMembers()) { world.addAllowed(partyMember.getObjectId()); removeBuffs(partyMember); teleportPlayer(partyMember, TELEPORTS[index], instanceId); @@ -1411,15 +1364,12 @@ public final class Kamaloka extends AbstractInstance * @param world instanceWorld */ @Override - protected final void finishInstance(InstanceWorld world) - { - if (world instanceof KamaWorld) - { + protected final void finishInstance(InstanceWorld world) { + if (world instanceof KamaWorld) { Calendar reenter = Calendar.getInstance(); reenter.set(Calendar.MINUTE, RESET_MIN); // if time is >= RESET_HOUR - roll to the next day - if (reenter.get(Calendar.HOUR_OF_DAY) >= RESET_HOUR) - { + if (reenter.get(Calendar.HOUR_OF_DAY) >= RESET_HOUR) { reenter.add(Calendar.DATE, 1); } reenter.set(Calendar.HOUR_OF_DAY, RESET_HOUR); @@ -1428,11 +1378,9 @@ public final class Kamaloka extends AbstractInstance sm.addInstanceName(world.getTemplateId()); // set instance reenter time for all allowed players - for (int objectId : world.getAllowed()) - { + for (int objectId : world.getAllowed()) { L2PcInstance obj = L2World.getInstance().getPlayer(objectId); - if ((obj != null) && obj.isOnline()) - { + if ((obj != null) && obj.isOnline()) { InstanceManager.getInstance().setInstanceTime(objectId, world.getTemplateId(), reenter.getTimeInMillis()); obj.sendPacket(sm); } @@ -1450,8 +1398,7 @@ public final class Kamaloka extends AbstractInstance * @param world instanceWorld */ @SuppressWarnings("all") - private final void spawnKama(KamaWorld world) - { + private final void spawnKama(KamaWorld world) { int[] npcs; int[][] spawns; L2Npc npc; @@ -1460,21 +1407,16 @@ public final class Kamaloka extends AbstractInstance // first room npcs = FIRST_ROOM[index]; spawns = FIRST_ROOM_SPAWNS[index]; - if (npcs != null) - { + if (npcs != null) { world.firstRoom = new ArrayList<L2Spawn>(spawns.length - 1); int shaman = getRandom(spawns.length); // random position for shaman - for (int i = 0; i < spawns.length; i++) - { - if (i == shaman) - { + for (int i = 0; i < spawns.length; i++) { + if (i == shaman) { // stealth shaman use same npcId as other mobs npc = addSpawn(STEALTH_SHAMAN ? npcs[1] : npcs[0], spawns[i][0], spawns[i][1], spawns[i][2], 0, false, 0, false, world.getInstanceId()); world.shaman = npc.getObjectId(); - } - else - { + } else { npc = addSpawn(npcs[1], spawns[i][0], spawns[i][1], spawns[i][2], 0, false, 0, false, world.getInstanceId()); L2Spawn spawn = npc.getSpawn(); spawn.setRespawnDelay(FIRST_ROOM_RESPAWN_DELAY); @@ -1489,12 +1431,10 @@ public final class Kamaloka extends AbstractInstance // second room npcs = SECOND_ROOM[index]; spawns = SECOND_ROOM_SPAWNS[index]; - if (npcs != null) - { + if (npcs != null) { world.secondRoom = new ArrayList<Integer>(spawns.length); - for (int[] spawn : spawns) - { + for (int[] spawn : spawns) { npc = addSpawn(npcs[0], spawn[0], spawn[1], spawn[2], 0, false, 0, false, world.getInstanceId()); npc.setIsNoRndWalk(true); world.secondRoom.add(npc.getObjectId()); @@ -1502,16 +1442,14 @@ public final class Kamaloka extends AbstractInstance } // miniboss - if (MINIBOSS[index] != null) - { + if (MINIBOSS[index] != null) { npc = addSpawn(MINIBOSS[index][0], MINIBOSS[index][1], MINIBOSS[index][2], MINIBOSS[index][3], 0, false, 0, false, world.getInstanceId()); npc.setIsNoRndWalk(true); world.miniBoss = npc.getObjectId(); } // escape teleporter - if (TELEPORTERS[index] != null) - { + if (TELEPORTERS[index] != null) { addSpawn(TELEPORTER, TELEPORTERS[index][0], TELEPORTERS[index][1], TELEPORTERS[index][2], 0, false, 0, false, world.getInstanceId()); } @@ -1525,19 +1463,14 @@ public final class Kamaloka extends AbstractInstance * Handles only player's enter, single parameter - integer kamaloka index */ @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (npc == null) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (npc == null) { return ""; } - try - { + try { enterInstance(player, Integer.parseInt(event)); - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, "", e); } return ""; @@ -1547,38 +1480,29 @@ public final class Kamaloka extends AbstractInstance * Talk with captains and using of the escape teleporter */ @Override - public final String onTalk(L2Npc npc, L2PcInstance player) - { + public final String onTalk(L2Npc npc, L2PcInstance player) { final int npcId = npc.getId(); - if (npcId == TELEPORTER) - { + if (npcId == TELEPORTER) { final L2Party party = player.getParty(); // only party leader can talk with escape teleporter - if ((party != null) && party.isLeader(player)) - { + if ((party != null) && party.isLeader(player)) { final InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (world instanceof KamaWorld) - { + if (world instanceof KamaWorld) { // party members must be in the instance - if (world.isAllowed(player.getObjectId())) - { + if (world.isAllowed(player.getObjectId())) { Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId()); // teleports entire party away - for (L2PcInstance partyMember : party.getMembers()) - { - if ((partyMember != null) && (partyMember.getInstanceId() == world.getInstanceId())) - { + for (L2PcInstance partyMember : party.getMembers()) { + if ((partyMember != null) && (partyMember.getInstanceId() == world.getInstanceId())) { teleportPlayer(partyMember, inst.getExitLoc(), 0); } } } } } - } - else - { + } else { return npcId + ".htm"; } @@ -1589,12 +1513,9 @@ public final class Kamaloka extends AbstractInstance * Only escape teleporters first talk handled */ @Override - public final String onFirstTalk(L2Npc npc, L2PcInstance player) - { - if (npc.getId() == TELEPORTER) - { - if (player.isInParty() && player.getParty().isLeader(player)) - { + public final String onFirstTalk(L2Npc npc, L2PcInstance player) { + if (npc.getId() == TELEPORTER) { + if (player.isInParty() && player.getParty().isLeader(player)) { return "32496.htm"; } return "32496-no.htm"; @@ -1603,41 +1524,32 @@ public final class Kamaloka extends AbstractInstance } @Override - public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final InstanceWorld tmpWorld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpWorld instanceof KamaWorld) - { + if (tmpWorld instanceof KamaWorld) { final KamaWorld world = (KamaWorld) tmpWorld; final int objectId = npc.getObjectId(); // first room was spawned ? - if (world.firstRoom != null) - { + if (world.firstRoom != null) { // is shaman killed ? - if ((world.shaman != 0) && (world.shaman == objectId)) - { + if ((world.shaman != 0) && (world.shaman == objectId)) { world.shaman = 0; // stop respawn of the minions - for (L2Spawn spawn : world.firstRoom) - { - if (spawn != null) - { + for (L2Spawn spawn : world.firstRoom) { + if (spawn != null) { spawn.stopRespawn(); } } world.firstRoom.clear(); world.firstRoom = null; - if (world.boss != null) - { + if (world.boss != null) { final int skillId = FIRST_ROOM[world.index][2]; final int skillLvl = FIRST_ROOM[world.index][3]; - if ((skillId != 0) && (skillLvl != 0)) - { + if ((skillId != 0) && (skillLvl != 0)) { final Skill skill = SkillData.getInstance().getSkill(skillId, skillLvl); - if (skill != null) - { + if (skill != null) { skill.applyEffects(world.boss, world.boss); } } @@ -1648,37 +1560,28 @@ public final class Kamaloka extends AbstractInstance } // second room was spawned ? - if (world.secondRoom != null) - { + if (world.secondRoom != null) { boolean all = true; // check for all mobs in the second room - for (int i = 0; i < world.secondRoom.size(); i++) - { + for (int i = 0; i < world.secondRoom.size(); i++) { // found killed now mob - if (world.secondRoom.get(i) == objectId) - { + if (world.secondRoom.get(i) == objectId) { world.secondRoom.set(i, 0); - } - else if (world.secondRoom.get(i) != 0) - { + } else if (world.secondRoom.get(i) != 0) { all = false; } } // all mobs killed ? - if (all) - { + if (all) { world.secondRoom.clear(); world.secondRoom = null; - if (world.boss != null) - { + if (world.boss != null) { final int skillId = SECOND_ROOM[world.index][1]; final int skillLvl = SECOND_ROOM[world.index][2]; - if ((skillId != 0) && (skillLvl != 0)) - { + if ((skillId != 0) && (skillLvl != 0)) { final Skill skill = SkillData.getInstance().getSkill(skillId, skillLvl); - if (skill != null) - { + if (skill != null) { skill.applyEffects(world.boss, world.boss); } } @@ -1689,19 +1592,15 @@ public final class Kamaloka extends AbstractInstance } // miniboss spawned ? - if ((world.miniBoss != 0) && (world.miniBoss == objectId)) - { + if ((world.miniBoss != 0) && (world.miniBoss == objectId)) { world.miniBoss = 0; - if (world.boss != null) - { + if (world.boss != null) { final int skillId = MINIBOSS[world.index][4]; final int skillLvl = MINIBOSS[world.index][5]; - if ((skillId != 0) && (skillLvl != 0)) - { + if ((skillId != 0) && (skillLvl != 0)) { final Skill skill = SkillData.getInstance().getSkill(skillId, skillLvl); - if (skill != null) - { + if (skill != null) { skill.applyEffects(world.boss, world.boss); } } @@ -1711,8 +1610,7 @@ public final class Kamaloka extends AbstractInstance } // boss was killed, finish instance - if ((world.boss != null) && (world.boss == npc)) - { + if ((world.boss != null) && (world.boss == npc)) { world.boss = null; finishInstance(world); } @@ -1721,8 +1619,7 @@ public final class Kamaloka extends AbstractInstance } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { } } diff --git a/src/main/java/com/l2jserver/datapack/instances/LibraryOfSages/LibraryOfSages.java b/src/main/java/com/l2jserver/datapack/instances/LibraryOfSages/LibraryOfSages.java index 087384f27d..324d5ac684 100644 --- a/src/main/java/com/l2jserver/datapack/instances/LibraryOfSages/LibraryOfSages.java +++ b/src/main/java/com/l2jserver/datapack/instances/LibraryOfSages/LibraryOfSages.java @@ -31,10 +31,8 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Library of Sages instance zone. * @author Adry_85 */ -public final class LibraryOfSages extends AbstractInstance -{ - protected class LoSWorld extends InstanceWorld - { +public final class LibraryOfSages extends AbstractInstance { + protected class LoSWorld extends InstanceWorld { protected L2Npc elcadia = null; } @@ -53,8 +51,7 @@ public final class LibraryOfSages extends AbstractInstance private static final Location EXIT_LOC = new Location(37063, -49813, -1128, 0, 0); private static final Location LIBRARY_LOC = new Location(37355, -50065, -1127); // NpcString - private static final NpcStringId[] ELCADIA_DIALOGS = - { + private static final NpcStringId[] ELCADIA_DIALOGS = { NpcStringId.I_MUST_ASK_LIBRARIAN_SOPHIA_ABOUT_THE_BOOK, NpcStringId.THIS_LIBRARY_ITS_HUGE_BUT_THERE_ARENT_MANY_USEFUL_BOOKS_RIGHT, NpcStringId.AN_UNDERGROUND_LIBRARY_I_HATE_DAMP_AND_SMELLY_PLACES, @@ -63,8 +60,7 @@ public final class LibraryOfSages extends AbstractInstance // Misc private static final int TEMPLATE_ID = 156; - public LibraryOfSages() - { + public LibraryOfSages() { super(LibraryOfSages.class.getSimpleName()); addFirstTalkId(SOPHIA2, ELCADIA_INSTANCE, PILE_OF_BOOKS1, PILE_OF_BOOKS2, PILE_OF_BOOKS3, PILE_OF_BOOKS4, PILE_OF_BOOKS5); addStartNpc(SOPHIA1, SOPHIA2, SOPHIA3); @@ -72,37 +68,30 @@ public final class LibraryOfSages extends AbstractInstance } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player); - if (tmpworld instanceof LoSWorld) - { + if (tmpworld instanceof LoSWorld) { final LoSWorld world = (LoSWorld) tmpworld; - switch (event) - { - case "TELEPORT2": - { + switch (event) { + case "TELEPORT2": { teleportPlayer(player, LIBRARY_LOC, world.getInstanceId()); world.elcadia.teleToLocation(LIBRARY_LOC.getX(), LIBRARY_LOC.getY(), LIBRARY_LOC.getZ(), 0, world.getInstanceId()); break; } - case "exit": - { + case "exit": { cancelQuestTimer("FOLLOW", npc, player); player.teleToLocation(EXIT_LOC); world.elcadia.deleteMe(); break; } - case "FOLLOW": - { + case "FOLLOW": { npc.setIsRunning(true); npc.getAI().startFollow(player); broadcastNpcSay(npc, Say2.NPC_ALL, ELCADIA_DIALOGS[getRandom(ELCADIA_DIALOGS.length)]); startQuestTimer("FOLLOW", 10000, npc, player); break; } - case "ENTER": - { + case "ENTER": { cancelQuestTimer("FOLLOW", npc, player); teleportPlayer(player, START_LOC, world.getInstanceId()); world.elcadia.teleToLocation(START_LOC.getX(), START_LOC.getY(), START_LOC.getZ(), 0, world.getInstanceId()); @@ -114,27 +103,22 @@ public final class LibraryOfSages extends AbstractInstance } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { enterInstance(talker, new LoSWorld(), "LibraryOfSages.xml", TEMPLATE_ID); return super.onTalk(npc, talker); } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { world.addAllowed(player.getObjectId()); } teleportPlayer(player, START_LOC, world.getInstanceId(), false); spawnElcadia(player, (LoSWorld) world); } - private void spawnElcadia(L2PcInstance player, LoSWorld world) - { - if (world.elcadia != null) - { + private void spawnElcadia(L2PcInstance player, LoSWorld world) { + if (world.elcadia != null) { world.elcadia.deleteMe(); } world.elcadia = addSpawn(ELCADIA_INSTANCE, player, false, 0, false, player.getInstanceId()); diff --git a/src/main/java/com/l2jserver/datapack/instances/MithrilMine/MithrilMine.java b/src/main/java/com/l2jserver/datapack/instances/MithrilMine/MithrilMine.java index 8ae6317af5..b47a3d45ce 100644 --- a/src/main/java/com/l2jserver/datapack/instances/MithrilMine/MithrilMine.java +++ b/src/main/java/com/l2jserver/datapack/instances/MithrilMine/MithrilMine.java @@ -37,10 +37,8 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Mithril Mine instance zone. * @author Adry_85 */ -public final class MithrilMine extends AbstractInstance -{ - protected class MMWorld extends InstanceWorld - { +public final class MithrilMine extends AbstractInstance { + protected class MMWorld extends InstanceWorld { protected int _count = 0; } @@ -56,8 +54,7 @@ public final class MithrilMine extends AbstractInstance // Location private static final Location START_LOC = new Location(186852, -173492, -3763, 0, 0); private static final Location EXIT_LOC = new Location(178823, -184303, -347, 0, 0); - private static final Location[] MOB_SPAWNS = new Location[] - { + private static final Location[] MOB_SPAWNS = new Location[] { new Location(185216, -184112, -3308, -15396), new Location(185456, -184240, -3308, -19668), new Location(185712, -184384, -3308, -26696), @@ -67,8 +64,7 @@ public final class MithrilMine extends AbstractInstance // Misc private static final int TEMPLATE_ID = 138; - public MithrilMine() - { + public MithrilMine() { super(MithrilMine.class.getSimpleName(), "instances"); addFirstTalkId(KEGOR); addKillId(KEGOR, MITHRIL_MILLIPEDE); @@ -77,28 +73,21 @@ public final class MithrilMine extends AbstractInstance } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - switch (event) - { - case "BUFF": - { - if ((player != null) && npc.isInsideRadius(player, 1000, true, false) && npc.isScriptValue(1) && !player.isDead()) - { + switch (event) { + case "BUFF": { + if ((player != null) && npc.isInsideRadius(player, 1000, true, false) && npc.isScriptValue(1) && !player.isDead()) { npc.setTarget(player); npc.doCast(BLESS_OF_SWORD); } startQuestTimer("BUFF", 30000, npc, player); break; } - case "TIMER": - { - if (world instanceof MMWorld) - { - for (Location loc : MOB_SPAWNS) - { + case "TIMER": { + if (world instanceof MMWorld) { + for (Location loc : MOB_SPAWNS) { final L2Attackable spawnedMob = (L2Attackable) addSpawn(MITHRIL_MILLIPEDE, loc, false, 0, false, world.getInstanceId()); spawnedMob.setScriptValue(1); spawnedMob.setIsRunning(true); @@ -108,12 +97,9 @@ public final class MithrilMine extends AbstractInstance } break; } - case "FINISH": - { - for (L2Character knownChar : npc.getKnownList().getKnownCharacters()) - { - if ((knownChar != null) && (knownChar.getId() == KEGOR)) - { + case "FINISH": { + for (L2Character knownChar : npc.getKnownList().getKnownCharacters()) { + if ((knownChar != null) && (knownChar.getId() == KEGOR)) { final L2Npc kegor = (L2Npc) knownChar; kegor.setScriptValue(2); kegor.setWalking(); @@ -130,17 +116,12 @@ public final class MithrilMine extends AbstractInstance } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = player.getQuestState(Q10284_AcquisitionOfDivineSword.class.getSimpleName()); - if ((qs != null)) - { - if (qs.isMemoState(2)) - { + if ((qs != null)) { + if (qs.isMemoState(2)) { return npc.isScriptValue(0) ? "18846.html" : "18846-01.html"; - } - else if (qs.isMemoState(3)) - { + } else if (qs.isMemoState(3)) { final InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); world.removeAllowed(player.getObjectId()); player.setInstanceId(0); @@ -155,28 +136,21 @@ public final class MithrilMine extends AbstractInstance } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId()); final MMWorld _world = ((MMWorld) world); - if (npc.getId() == KEGOR) - { + if (npc.getId() == KEGOR) { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.HOW_COULD_I_FALL_IN_A_PLACE_LIKE_THIS); InstanceManager.getInstance().getInstance(world.getInstanceId()).setDuration(1000); - } - else - { - if (npc.isScriptValue(1)) - { + } else { + if (npc.isScriptValue(1)) { _world._count++; } - if (_world._count >= 5) - { + if (_world._count >= 5) { final QuestState qs = player.getQuestState(Q10284_AcquisitionOfDivineSword.class.getSimpleName()); - if ((qs != null) && qs.isMemoState(2)) - { + if ((qs != null) && qs.isMemoState(2)) { cancelQuestTimer("BUFF", npc, player); qs.setMemoState(3); qs.setCond(6, true); @@ -188,18 +162,13 @@ public final class MithrilMine extends AbstractInstance } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { - switch (npc.getId()) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { + switch (npc.getId()) { case TARUN: - case KRUN: - { + case KRUN: { final QuestState qs = talker.getQuestState(Q10284_AcquisitionOfDivineSword.class.getSimpleName()); - if ((qs != null) && qs.isMemoState(2)) - { - if (!hasQuestItems(talker, COLD_RESISTANCE_POTION)) - { + if ((qs != null) && qs.isMemoState(2)) { + if (!hasQuestItems(talker, COLD_RESISTANCE_POTION)) { giveItems(talker, COLD_RESISTANCE_POTION, 1); } qs.setCond(4, true); @@ -207,11 +176,9 @@ public final class MithrilMine extends AbstractInstance } break; } - case KEGOR: - { + case KEGOR: { final QuestState qs = talker.getQuestState(Q10284_AcquisitionOfDivineSword.class.getSimpleName()); - if ((qs != null) && qs.isMemoState(2) && hasQuestItems(talker, COLD_RESISTANCE_POTION) && npc.isScriptValue(0)) - { + if ((qs != null) && qs.isMemoState(2) && hasQuestItems(talker, COLD_RESISTANCE_POTION) && npc.isScriptValue(0)) { takeItems(talker, COLD_RESISTANCE_POTION, -1); qs.setCond(5, true); npc.setScriptValue(1); @@ -226,10 +193,8 @@ public final class MithrilMine extends AbstractInstance } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { world.addAllowed(player.getObjectId()); } teleportPlayer(player, START_LOC, world.getInstanceId(), false); diff --git a/src/main/java/com/l2jserver/datapack/instances/MonasteryOfSilence1/MonasteryOfSilence1.java b/src/main/java/com/l2jserver/datapack/instances/MonasteryOfSilence1/MonasteryOfSilence1.java index afc7047b74..626937f0fd 100644 --- a/src/main/java/com/l2jserver/datapack/instances/MonasteryOfSilence1/MonasteryOfSilence1.java +++ b/src/main/java/com/l2jserver/datapack/instances/MonasteryOfSilence1/MonasteryOfSilence1.java @@ -38,10 +38,8 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Monastery of Silence instance zone. * @author Adry_85 */ -public final class MonasteryOfSilence1 extends AbstractInstance -{ - protected static final class MoSWorld extends InstanceWorld - { +public final class MonasteryOfSilence1 extends AbstractInstance { + protected static final class MoSWorld extends InstanceWorld { protected L2Npc elcadia = null; protected int deadTombGuardianCount = 0; protected int deadSolinaGuardianCount = 0; @@ -79,8 +77,7 @@ public final class MonasteryOfSilence1 extends AbstractInstance private static final int SWORD_OF_HOLY_SPIRIT = 17230; private static final int STAFF_OF_BLESSING = 17231; // Skills - private static final SkillHolder[] BUFFS = - { + private static final SkillHolder[] BUFFS = { new SkillHolder(6725), // Bless the Blood of Elcadia new SkillHolder(6728), // Recharge of Elcadia new SkillHolder(6730), // Greater Battle Heal of Elcadia @@ -109,44 +106,38 @@ public final class MonasteryOfSilence1 extends AbstractInstance private static final Location ELCADIA_LOC = new Location(115927, -87005, -3392); private static final Location SPACE_LOC = new Location(76736, -241021, -10780); private static final Location ETIS_VAN_ETINA_LOC = new Location(76625, -240824, -10832, 0); - private static final Location[] SLAVE_SPAWN_1_LOC = - { + private static final Location[] SLAVE_SPAWN_1_LOC = { new Location(55680, -252832, -6752), new Location(55825, -252792, -6752), new Location(55687, -252718, -6752), new Location(55824, -252679, -6752), }; - private static final Location[] SLAVE_SPAWN_2_LOC = - { + private static final Location[] SLAVE_SPAWN_2_LOC = { new Location(55672, -252099, -6751), new Location(55810, -252262, -6752), new Location(55824, -252112, -6752), new Location(55669, -252227, -6752), }; - private static final Location[] SLAVE_SPAWN_3_LOC = - { + private static final Location[] SLAVE_SPAWN_3_LOC = { new Location(56480, -252833, -6751), new Location(56481, -252725, -6752), new Location(56368, -252787, -6752), new Location(56368, -252669, -6752), }; - private static final Location[] SLAVE_SPAWN_4_LOC = - { + private static final Location[] SLAVE_SPAWN_4_LOC = { new Location(56463, -252225, -6751), new Location(56469, -252108, -6752), new Location(56336, -252168, -6752), new Location(56336, -252288, -6752), }; // NpcString - private static final NpcStringId[] ELCADIA_DIALOGS_Q010294 = - { + private static final NpcStringId[] ELCADIA_DIALOGS_Q010294 = { NpcStringId.WE_MUST_SEARCH_HIGH_AND_LOW_IN_EVERY_ROOM_FOR_THE_READING_DESK_THAT_CONTAINS_THE_BOOK_WE_SEEK, NpcStringId.REMEMBER_THE_CONTENT_OF_THE_BOOKS_THAT_YOU_FOUND_YOU_CANT_TAKE_THEM_OUT_WITH_YOU, NpcStringId.IT_SEEMS_THAT_YOU_CANNOT_REMEMBER_TO_THE_ROOM_OF_THE_WATCHER_WHO_FOUND_THE_BOOK }; - private static final NpcStringId[] ELCADIA_DIALOGS_Q010295 = - { + private static final NpcStringId[] ELCADIA_DIALOGS_Q010295 = { NpcStringId.THE_GUARDIAN_OF_THE_SEAL_DOESNT_SEEM_TO_GET_INJURED_AT_ALL_UNTIL_THE_BARRIER_IS_DESTROYED, NpcStringId.THE_DEVICE_LOCATED_IN_THE_ROOM_IN_FRONT_OF_THE_GUARDIAN_OF_THE_SEAL_IS_DEFINITELY_THE_BARRIER_THAT_CONTROLS_THE_GUARDIANS_POWER, NpcStringId.TO_REMOVE_THE_BARRIER_YOU_MUST_FIND_THE_RELICS_THAT_FIT_THE_BARRIER_AND_ACTIVATE_THE_DEVICE @@ -155,8 +146,7 @@ public final class MonasteryOfSilence1 extends AbstractInstance private static final int TEMPLATE_ID = 151; // Doors private static final int TOMB_DOOR = 21100018; - private static final int[] DOORS = - { + private static final int[] DOORS = { 21100014, 21100001, 21100006, @@ -175,16 +165,14 @@ public final class MonasteryOfSilence1 extends AbstractInstance 21100011 }; - private static final int[] FAKE_TOMB_DOORS = - { + private static final int[] FAKE_TOMB_DOORS = { 21100101, 21100102, 21100103, 21100104 }; - public MonasteryOfSilence1() - { + public MonasteryOfSilence1() { super(MonasteryOfSilence1.class.getSimpleName()); addFirstTalkId(TELEPORT_CONTROL_DEVICE1, TELEPORT_CONTROL_DEVICE2, TELEPORT_CONTROL_DEVICE3, TELEPORT_CONTROL_DEVICE4); addKillId(SOLINAS_GUARDIAN_1, SOLINAS_GUARDIAN_2, SOLINAS_GUARDIAN_3, SOLINAS_GUARDIAN_4, GUARDIAN_OF_THE_TOMB_1, GUARDIAN_OF_THE_TOMB_2, GUARDIAN_OF_THE_TOMB_3, GUARDIAN_OF_THE_TOMB_4, ETIS_VAN_ETINA); @@ -194,10 +182,8 @@ public final class MonasteryOfSilence1 extends AbstractInstance } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { world.addAllowed(player.getObjectId()); } teleportPlayer(player, START_LOC, world.getInstanceId(), false); @@ -205,200 +191,162 @@ public final class MonasteryOfSilence1 extends AbstractInstance } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof MoSWorld) - { + if (tmpworld instanceof MoSWorld) { final MoSWorld world = (MoSWorld) tmpworld; - switch (event) - { - case "TELE2": - { + switch (event) { + case "TELE2": { teleportPlayer(player, CENTRAL_ROOM_LOC, world.getInstanceId()); world.elcadia.teleToLocation(CENTRAL_ROOM_LOC, world.getInstanceId(), 0); startQuestTimer("START_MOVIE", 2000, npc, player); break; } - case "EXIT": - { + case "EXIT": { cancelQuestTimer("FOLLOW", npc, player); cancelQuestTimer("DIALOG", npc, player); teleportPlayer(player, EXIT_LOC, 0); world.elcadia.deleteMe(); break; } - case "START_MOVIE": - { + case "START_MOVIE": { player.showQuestMovie(24); break; } - case "BACK": - { + case "BACK": { teleportPlayer(player, BACK_LOC, world.getInstanceId()); world.elcadia.teleToLocation(BACK_LOC, world.getInstanceId(), 0); break; } - case "EAST": - { + case "EAST": { teleportPlayer(player, EAST_WATCHERS_ROOM_LOC, world.getInstanceId()); world.elcadia.teleToLocation(EAST_WATCHERS_ROOM_LOC, world.getInstanceId(), 0); break; } - case "WEST": - { + case "WEST": { teleportPlayer(player, WEST_WATCHERS_ROOM_LOC, world.getInstanceId()); world.elcadia.teleToLocation(WEST_WATCHERS_ROOM_LOC, world.getInstanceId(), 0); break; } - case "NORTH": - { + case "NORTH": { teleportPlayer(player, NORTH_WATCHERS_ROOM_LOC, world.getInstanceId()); world.elcadia.teleToLocation(NORTH_WATCHERS_ROOM_LOC, world.getInstanceId(), 0); break; } - case "SOUTH": - { + case "SOUTH": { teleportPlayer(player, SOUTH_WATCHERS_ROOM_LOC, world.getInstanceId()); world.elcadia.teleToLocation(SOUTH_WATCHERS_ROOM_LOC, world.getInstanceId(), 0); break; } - case "CENTER": - { + case "CENTER": { teleportPlayer(player, CENTRAL_ROOM_LOC, world.getInstanceId()); world.elcadia.teleToLocation(CENTRAL_ROOM_LOC, world.getInstanceId(), 0); break; } - case "FOLLOW": - { + case "FOLLOW": { npc.setIsRunning(true); npc.getAI().startFollow(player); - if (player.isInCombat()) - { + if (player.isInCombat()) { npc.doCast(BUFFS[getRandom(BUFFS.length)]); } startQuestTimer("FOLLOW", 5000, npc, player); break; } - case "DIALOG": - { + case "DIALOG": { final QuestState st_Q10294 = player.getQuestState(Q10294_SevenSignsToTheMonasteryOfSilence.class.getSimpleName()); final QuestState st_Q10295 = player.getQuestState(Q10295_SevenSignsSolinasTomb.class.getSimpleName()); - if ((st_Q10294 != null) && st_Q10294.isStarted()) - { + if ((st_Q10294 != null) && st_Q10294.isStarted()) { broadcastNpcSay(npc, Say2.NPC_ALL, ELCADIA_DIALOGS_Q010294[getRandom(ELCADIA_DIALOGS_Q010294.length)]); } - if ((st_Q10295 != null) && st_Q10295.isMemoState(1)) - { + if ((st_Q10295 != null) && st_Q10295.isMemoState(1)) { broadcastNpcSay(npc, Say2.NPC_ALL, ELCADIA_DIALOGS_Q010295[getRandom(ELCADIA_DIALOGS_Q010295.length)]); } startQuestTimer("DIALOG", 10000, npc, player); break; } - case "ENTER_Q10295": - { + case "ENTER_Q10295": { teleportPlayer(player, START_LOC_Q10295, world.getInstanceId()); world.elcadia.teleToLocation(START_LOC_Q10295, world.getInstanceId(), 0); startQuestTimer("START_MOVIE_Q10295", 2000, npc, player); break; } - case "START_MOVIE_Q10295": - { + case "START_MOVIE_Q10295": { player.showQuestMovie(26); break; } - case "CASKET_ROOM": - { + case "CASKET_ROOM": { teleportPlayer(player, CASKET_ROOM_LOC, world.getInstanceId()); world.elcadia.teleToLocation(CASKET_ROOM_LOC, world.getInstanceId(), 0); break; } - case "SOLINAS_RESTING_PLACE": - { + case "SOLINAS_RESTING_PLACE": { teleportPlayer(player, SOLINAS_RESTING_PLACE_LOC, world.getInstanceId()); world.elcadia.teleToLocation(SOLINAS_RESTING_PLACE_LOC, world.getInstanceId(), 0); break; } - case "ERIS_OFFICE": - { + case "ERIS_OFFICE": { teleportPlayer(player, START_LOC, world.getInstanceId()); world.elcadia.teleToLocation(START_LOC, world.getInstanceId(), 0); break; } - case "OPEN_DOORS": - { - for (int doorId : DOORS) - { + case "OPEN_DOORS": { + for (int doorId : DOORS) { openDoor(doorId, world.getInstanceId()); } break; } - case "DIRECTORS_ROOM": - { + case "DIRECTORS_ROOM": { teleportPlayer(player, DIRECTORS_ROOM_LOC, world.getInstanceId()); world.elcadia.teleToLocation(DIRECTORS_ROOM_LOC, world.getInstanceId(), 0); break; } - case "USE_SCROLL": - { + case "USE_SCROLL": { // TODO (Adry_85): Missing area debuff - if (hasQuestItems(player, SCROLL_OF_ABSTINENCE)) - { + if (hasQuestItems(player, SCROLL_OF_ABSTINENCE)) { takeItems(player, SCROLL_OF_ABSTINENCE, 1); addSpawn(SOLINAS_GUARDIAN_1, SOLINAS_GUARDIAN_1_LOC, false, 0, false, world.getInstanceId()); } break; } - case "USE_SHIELD": - { + case "USE_SHIELD": { // TODO (Adry_85): Missing area debuff - if (hasQuestItems(player, SHIELD_OF_SACRIFICE)) - { + if (hasQuestItems(player, SHIELD_OF_SACRIFICE)) { takeItems(player, SHIELD_OF_SACRIFICE, 1); addSpawn(SOLINAS_GUARDIAN_2, SOLINAS_GUARDIAN_2_LOC, false, 0, false, world.getInstanceId()); } break; } - case "USE_SWORD": - { + case "USE_SWORD": { // TODO (Adry_85): Missing area debuff - if (hasQuestItems(player, SWORD_OF_HOLY_SPIRIT)) - { + if (hasQuestItems(player, SWORD_OF_HOLY_SPIRIT)) { takeItems(player, SWORD_OF_HOLY_SPIRIT, 1); addSpawn(SOLINAS_GUARDIAN_3, SOLINAS_GUARDIAN_3_LOC, false, 0, false, world.getInstanceId()); } break; } - case "USE_STAFF": - { + case "USE_STAFF": { // TODO (Adry_85): Missing area debuff - if (hasQuestItems(player, STAFF_OF_BLESSING)) - { + if (hasQuestItems(player, STAFF_OF_BLESSING)) { takeItems(player, STAFF_OF_BLESSING, 1); addSpawn(SOLINAS_GUARDIAN_4, SOLINAS_GUARDIAN_4_LOC, false, 0, false, world.getInstanceId()); } break; } - case "CLOSE_TOMB_DOORS": - { - for (int doorId : FAKE_TOMB_DOORS) - { + case "CLOSE_TOMB_DOORS": { + for (int doorId : FAKE_TOMB_DOORS) { closeDoor(doorId, world.getInstanceId()); } break; } - case "TOMB_GUARDIAN_SPAWN": - { - for (int doorId : FAKE_TOMB_DOORS) - { + case "TOMB_GUARDIAN_SPAWN": { + for (int doorId : FAKE_TOMB_DOORS) { openDoor(doorId, world.getInstanceId()); } addSpawn(GUARDIAN_OF_THE_TOMB_1, GUARDIAN_OF_THE_TOMB_1_LOC, false, 0, false, world.getInstanceId()); - for (Location LOC : SLAVE_SPAWN_1_LOC) - { + for (Location LOC : SLAVE_SPAWN_1_LOC) { L2Attackable mob = (L2Attackable) addSpawn(TRAINEE_OF_REST, LOC, false, 0, false, world.getInstanceId()); mob.setIsRunning(true); mob.addDamageHate(player, 0, 999); @@ -407,8 +355,7 @@ public final class MonasteryOfSilence1 extends AbstractInstance addSpawn(GUARDIAN_OF_THE_TOMB_2, GUARDIAN_OF_THE_TOMB_2_LOC, false, 0, false, world.getInstanceId()); - for (Location LOC : SLAVE_SPAWN_2_LOC) - { + for (Location LOC : SLAVE_SPAWN_2_LOC) { L2Attackable mob = (L2Attackable) addSpawn(TRAINEE_OF_REST, LOC, false, 0, false, world.getInstanceId()); mob.setIsRunning(true); mob.addDamageHate(player, 0, 999); @@ -417,8 +364,7 @@ public final class MonasteryOfSilence1 extends AbstractInstance addSpawn(GUARDIAN_OF_THE_TOMB_3, GUARDIAN_OF_THE_TOMB_3_LOC, false, 0, false, world.getInstanceId()); - for (Location LOC : SLAVE_SPAWN_3_LOC) - { + for (Location LOC : SLAVE_SPAWN_3_LOC) { L2Attackable mob = (L2Attackable) addSpawn(SUPPLICANT_OF_REST, LOC, false, 0, false, world.getInstanceId()); mob.setIsRunning(true); mob.addDamageHate(player, 0, 999); @@ -427,8 +373,7 @@ public final class MonasteryOfSilence1 extends AbstractInstance addSpawn(GUARDIAN_OF_THE_TOMB_4, GUARDIAN_OF_THE_TOMB_4_LOC, false, 0, false, world.getInstanceId()); - for (Location LOC : SLAVE_SPAWN_4_LOC) - { + for (Location LOC : SLAVE_SPAWN_4_LOC) { L2Attackable mob = (L2Attackable) addSpawn(SUPPLICANT_OF_REST, LOC, false, 0, false, world.getInstanceId()); mob.setIsRunning(true); mob.addDamageHate(player, 0, 999); @@ -436,22 +381,19 @@ public final class MonasteryOfSilence1 extends AbstractInstance } return "32843-01.html"; } - case "START_MOVIE_Q10296": - { + case "START_MOVIE_Q10296": { player.showQuestMovie(29); startQuestTimer("TELEPORT_SPACE", 60000, npc, player); world.elcadia.teleToLocation(ELCADIA_LOC, world.getInstanceId(), 0); break; } - case "TELEPORT_SPACE": - { + case "TELEPORT_SPACE": { teleportPlayer(player, SPACE_LOC, world.getInstanceId()); world.elcadia.teleToLocation(SPACE_LOC, world.getInstanceId(), 0); addSpawn(ETIS_VAN_ETINA, ETIS_VAN_ETINA_LOC, false, 0, false, world.getInstanceId()); break; } - case "TELEPORT_TO_PLAYER": - { + case "TELEPORT_TO_PLAYER": { world.elcadia.teleToLocation(player.getX(), player.getY(), player.getZ(), 0, world.getInstanceId()); break; } @@ -461,26 +403,20 @@ public final class MonasteryOfSilence1 extends AbstractInstance } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof MoSWorld) - { + if (tmpworld instanceof MoSWorld) { MoSWorld world = (MoSWorld) tmpworld; - switch (npc.getId()) - { + switch (npc.getId()) { case GUARDIAN_OF_THE_TOMB_1: case GUARDIAN_OF_THE_TOMB_2: case GUARDIAN_OF_THE_TOMB_3: - case GUARDIAN_OF_THE_TOMB_4: - { + case GUARDIAN_OF_THE_TOMB_4: { world.deadTombGuardianCount++; - if (world.deadTombGuardianCount == 4) - { + if (world.deadTombGuardianCount == 4) { openDoor(TOMB_DOOR, world.getInstanceId()); final QuestState st = player.getQuestState(Q10295_SevenSignsSolinasTomb.class.getSimpleName()); - if ((st != null) && st.isMemoState(2)) - { + if ((st != null) && st.isMemoState(2)) { st.setMemoState(3); } } @@ -489,28 +425,23 @@ public final class MonasteryOfSilence1 extends AbstractInstance case SOLINAS_GUARDIAN_1: case SOLINAS_GUARDIAN_2: case SOLINAS_GUARDIAN_3: - case SOLINAS_GUARDIAN_4: - { + case SOLINAS_GUARDIAN_4: { world.deadSolinaGuardianCount++; - if (world.deadSolinaGuardianCount == 4) - { + if (world.deadSolinaGuardianCount == 4) { player.showQuestMovie(27); final QuestState st = player.getQuestState(Q10295_SevenSignsSolinasTomb.class.getSimpleName()); - if ((st != null) && st.isMemoState(1)) - { + if ((st != null) && st.isMemoState(1)) { st.setMemoState(2); } } break; } - case ETIS_VAN_ETINA: - { + case ETIS_VAN_ETINA: { player.showQuestMovie(30); world.elcadia.teleToLocation(ELCADIA_LOC, world.getInstanceId(), 0); startQuestTimer("TELEPORT_TO_PLAYER", 63000, npc, player); final QuestState st = player.getQuestState(Q10296_SevenSignsOneWhoSeeksThePowerOfTheSeal.class.getSimpleName()); - if ((st != null) && st.isMemoState(2)) - { + if ((st != null) && st.isMemoState(2)) { st.setMemoState(3); } break; @@ -522,17 +453,13 @@ public final class MonasteryOfSilence1 extends AbstractInstance } @Override - public String onSpawn(L2Npc npc) - { - switch (npc.getId()) - { - case ERIS_EVIL_THOUGHTS: - { + public String onSpawn(L2Npc npc) { + switch (npc.getId()) { + case ERIS_EVIL_THOUGHTS: { startQuestTimer("OPEN_DOORS", 1000, npc, null); break; } - case TOMB_OF_THE_SAINTESS: - { + case TOMB_OF_THE_SAINTESS: { startQuestTimer("CLOSE_TOMB_DOORS", 1000, npc, null); break; } @@ -541,19 +468,15 @@ public final class MonasteryOfSilence1 extends AbstractInstance } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { - if (npc.getId() == ODD_GLOBE) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { + if (npc.getId() == ODD_GLOBE) { enterInstance(talker, new MoSWorld(), "MonasteryOfSilence.xml", TEMPLATE_ID); } return super.onTalk(npc, talker); } - protected void spawnElcadia(L2PcInstance player, MoSWorld world) - { - if (world.elcadia != null) - { + protected void spawnElcadia(L2PcInstance player, MoSWorld world) { + if (world.elcadia != null) { world.elcadia.deleteMe(); } world.elcadia = addSpawn(ELCADIA_INSTANCE, player.getX(), player.getY(), player.getZ(), 0, false, 0, false, world.getInstanceId()); diff --git a/src/main/java/com/l2jserver/datapack/instances/NornilsGarden/NornilsGarden.java b/src/main/java/com/l2jserver/datapack/instances/NornilsGarden/NornilsGarden.java index 9b2da3eeaa..a5073a6f2d 100644 --- a/src/main/java/com/l2jserver/datapack/instances/NornilsGarden/NornilsGarden.java +++ b/src/main/java/com/l2jserver/datapack/instances/NornilsGarden/NornilsGarden.java @@ -42,10 +42,8 @@ import com.l2jserver.gameserver.util.Util; * @author Gnacik * @version 2010-10-15 Based on official server Naia */ -public final class NornilsGarden extends AbstractInstance -{ - protected class NornilsWorld extends InstanceWorld - { +public final class NornilsGarden extends AbstractInstance { + protected class NornilsWorld extends InstanceWorld { protected L2Npc first_npc = null; protected boolean spawned_1 = false; protected boolean spawned_2 = false; @@ -55,8 +53,7 @@ public final class NornilsGarden extends AbstractInstance // NPCs private static final int _garden_guard = 32330; - private static final int[] _final_gates = - { + private static final int[] _final_gates = { 32260, 32261, 32262 @@ -75,8 +72,7 @@ public final class NornilsGarden extends AbstractInstance private static final int EMPTY_DESTROY_TIME = 5; private static final int INSTANCE_LVL_MIN = 18; private static final int INSTANCE_LVL_MAX = 22; - private static final int[][] _auto_gates = - { + private static final int[][] _auto_gates = { // Warriors gate { 20110, @@ -166,50 +162,39 @@ public final class NornilsGarden extends AbstractInstance }; // @formatter:on - private static final void dropHerb(L2Npc mob, L2PcInstance player, int[][] drop) - { + private static final void dropHerb(L2Npc mob, L2PcInstance player, int[][] drop) { final int chance = getRandom(100); - for (int[] element : drop) - { - if (chance < element[2]) - { + for (int[] element : drop) { + if (chance < element[2]) { mob.dropItem(player, element[0], element[1]); } } } - private static final void giveBuffs(L2Character ch) - { - if (ADVENTURERS_WIND_WALK.getSkill() != null) - { + private static final void giveBuffs(L2Character ch) { + if (ADVENTURERS_WIND_WALK.getSkill() != null) { ADVENTURERS_WIND_WALK.getSkill().applyEffects(ch, ch); } - if (ADVENTURERS_HASTE.getSkill() != null) - { + if (ADVENTURERS_HASTE.getSkill() != null) { ADVENTURERS_HASTE.getSkill().applyEffects(ch, ch); } - if (ADVENTURERS_ACUMEN.getSkill() != null) - { + if (ADVENTURERS_ACUMEN.getSkill() != null) { ADVENTURERS_ACUMEN.getSkill().applyEffects(ch, ch); } - if (ADVENTURERS_BLESS_THE_BODY.getSkill() != null) - { + if (ADVENTURERS_BLESS_THE_BODY.getSkill() != null) { ADVENTURERS_BLESS_THE_BODY.getSkill().applyEffects(ch, ch); } } - public NornilsGarden() - { + public NornilsGarden() { super(NornilsGarden.class.getSimpleName()); addStartNpc(_garden_guard); addFirstTalkId(_garden_guard); addTalkId(_garden_guard); - for (int i[] : _gatekeepers) - { + for (int i[] : _gatekeepers) { addKillId(i[0]); } - for (int i[] : _auto_gates) - { + for (int i[] : _auto_gates) { addEnterZoneId(i[0]); } addTalkId(_final_gates); @@ -218,40 +203,32 @@ public final class NornilsGarden extends AbstractInstance } @Override - public final void teleportPlayer(L2PcInstance player, Location loc, int instanceId) - { + public final void teleportPlayer(L2PcInstance player, Location loc, int instanceId) { giveBuffs(player); - if (player.hasSummon()) - { + if (player.hasSummon()) { giveBuffs(player.getSummon()); } super.teleportPlayer(player, loc, instanceId); } - private void exitInstance(L2PcInstance player) - { + private void exitInstance(L2PcInstance player) { InstanceWorld inst = InstanceManager.getInstance().getWorld(player.getInstanceId()); - if (inst instanceof NornilsWorld) - { + if (inst instanceof NornilsWorld) { NornilsWorld world = ((NornilsWorld) inst); world.removeAllowed(player.getObjectId()); teleportPlayer(player, EXIT_PPL, 0); } } - private final synchronized String enterInstance(L2Npc npc, L2PcInstance player) - { + private final synchronized String enterInstance(L2Npc npc, L2PcInstance player) { InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - if (world != null) - { - if (!(world instanceof NornilsWorld) || (world.getTemplateId() != TEMPLATE_ID)) - { + if (world != null) { + if (!(world instanceof NornilsWorld) || (world.getTemplateId() != TEMPLATE_ID)) { player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON); return null; } // check for level difference again on reenter - if ((player.getLevel() > INSTANCE_LVL_MAX) || (player.getLevel() < INSTANCE_LVL_MIN)) - { + if ((player.getLevel() > INSTANCE_LVL_MAX) || (player.getLevel() < INSTANCE_LVL_MIN)) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); sm.addPcName(player); player.sendPacket(sm); @@ -259,16 +236,14 @@ public final class NornilsGarden extends AbstractInstance } // check what instance still exist final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId()); - if (inst != null) - { + if (inst != null) { teleportPlayer(player, SPAWN_PPL, world.getInstanceId()); } return null; } // Creating new instance String result = checkConditions(npc, player); - if (!(result.equalsIgnoreCase("ok"))) - { + if (!(result.equalsIgnoreCase("ok"))) { return result; } @@ -290,10 +265,8 @@ public final class NornilsGarden extends AbstractInstance // and finally teleport party into instance final L2Party party = player.getParty(); - if (party != null) - { - for (L2PcInstance partyMember : party.getMembers()) - { + if (party != null) { + for (L2PcInstance partyMember : party.getMembers()) { world.addAllowed(partyMember.getObjectId()); teleportPlayer(partyMember, SPAWN_PPL, instanceId); } @@ -301,158 +274,126 @@ public final class NornilsGarden extends AbstractInstance return null; } - private void prepareInstance(NornilsWorld world) - { + private void prepareInstance(NornilsWorld world) { world.first_npc = addSpawn(18362, -109702, 74696, -12528, 49568, false, 0, false, world.getInstanceId()); final L2DoorInstance door = getDoor(16200010, world.getInstanceId()); - if (door != null) - { + if (door != null) { door.setTargetable(false); door.setMeshIndex(2); } } - private void spawn1(L2Npc npc) - { + private void spawn1(L2Npc npc) { InstanceWorld inst = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (inst instanceof NornilsWorld) - { + if (inst instanceof NornilsWorld) { NornilsWorld world = ((NornilsWorld) inst); - if (npc.equals(world.first_npc) && !world.spawned_1) - { + if (npc.equals(world.first_npc) && !world.spawned_1) { world.spawned_1 = true; - for (int mob[] : _group_1) - { + for (int mob[] : _group_1) { addSpawn(mob[0], mob[1], mob[2], mob[3], mob[4], false, 0, false, world.getInstanceId()); } } } } - private void spawn2(L2Npc npc) - { + private void spawn2(L2Npc npc) { InstanceWorld inst = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (inst instanceof NornilsWorld) - { + if (inst instanceof NornilsWorld) { NornilsWorld world = ((NornilsWorld) inst); - if (!world.spawned_2) - { + if (!world.spawned_2) { world.spawned_2 = true; - for (int mob[] : _group_2) - { + for (int mob[] : _group_2) { addSpawn(mob[0], mob[1], mob[2], mob[3], mob[4], false, 0, false, world.getInstanceId()); } } } } - private void spawn3(L2Character cha) - { + private void spawn3(L2Character cha) { InstanceWorld inst = InstanceManager.getInstance().getWorld(cha.getInstanceId()); - if (inst instanceof NornilsWorld) - { + if (inst instanceof NornilsWorld) { NornilsWorld world = ((NornilsWorld) inst); - if (!world.spawned_3) - { + if (!world.spawned_3) { world.spawned_3 = true; - for (int mob[] : _group_3) - { + for (int mob[] : _group_3) { addSpawn(mob[0], mob[1], mob[2], mob[3], mob[4], false, 0, false, world.getInstanceId()); } } } } - private void spawn4(L2Character cha) - { + private void spawn4(L2Character cha) { InstanceWorld inst = InstanceManager.getInstance().getWorld(cha.getInstanceId()); - if (inst instanceof NornilsWorld) - { + if (inst instanceof NornilsWorld) { NornilsWorld world = ((NornilsWorld) inst); - if (!world.spawned_4) - { + if (!world.spawned_4) { world.spawned_4 = true; - for (int mob[] : _group_4) - { + for (int mob[] : _group_4) { addSpawn(mob[0], mob[1], mob[2], mob[3], mob[4], false, 0, false, world.getInstanceId()); } } } } - public void openDoor(QuestState st, L2PcInstance player, int doorId) - { + public void openDoor(QuestState st, L2PcInstance player, int doorId) { st.unset("correct"); InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(player.getInstanceId()); - if (tmpworld instanceof NornilsWorld) - { + if (tmpworld instanceof NornilsWorld) { openDoor(doorId, tmpworld.getInstanceId()); } } - private static final String checkConditions(L2Npc npc, L2PcInstance player) - { + private static final String checkConditions(L2Npc npc, L2PcInstance player) { final L2Party party = player.getParty(); // player must be in party - if (party == null) - { + if (party == null) { player.sendPacket(SystemMessageId.NOT_IN_PARTY_CANT_ENTER); return "32330-05.html"; } // ...and be party leader - if (party.getLeader() != player) - { + if (party.getLeader() != player) { player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); return "32330-08.html"; } boolean _kamael = false; // for each party member - for (L2PcInstance partyMember : party.getMembers()) - { + for (L2PcInstance partyMember : party.getMembers()) { // player level must be in range - if (partyMember.getLevel() > INSTANCE_LVL_MAX) - { + if (partyMember.getLevel() > INSTANCE_LVL_MAX) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); sm.addPcName(partyMember); player.sendPacket(sm); return "32330-06.html"; } - if (partyMember.getLevel() < INSTANCE_LVL_MIN) - { + if (partyMember.getLevel() < INSTANCE_LVL_MIN) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); sm.addPcName(partyMember); player.sendPacket(sm); return "32330-07.html"; } - if (partyMember.getClassId().level() != 0) - { + if (partyMember.getClassId().level() != 0) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); sm.addPcName(partyMember); player.sendPacket(sm); return "32330-06.html"; } // player must be near party leader - if (!partyMember.isInsideRadius(player, 500, true, true)) - { + if (!partyMember.isInsideRadius(player, 500, true, true)) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED); sm.addPcName(partyMember); player.sendPacket(sm); return "32330-08.html"; } - if (partyMember.getRace().ordinal() == 5) - { + if (partyMember.getRace().ordinal() == 5) { QuestState checkst = partyMember.getQuestState(Q00179_IntoTheLargeCavern.class.getSimpleName()); - if ((checkst != null) && (checkst.getState() == State.STARTED)) - { + if ((checkst != null) && (checkst.getState() == State.STARTED)) { _kamael = true; - } - else - { + } else { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_QUEST_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); sm.addPcName(partyMember); player.sendPacket(sm); @@ -460,33 +401,24 @@ public final class NornilsGarden extends AbstractInstance } } } - if (!_kamael) - { + if (!_kamael) { return "32330-08.html"; } return "ok"; } @Override - public String onEnterZone(L2Character character, L2ZoneType zone) - { - if ((character instanceof L2PcInstance) && !character.isDead() && !character.isTeleporting() && ((L2PcInstance) character).isOnline()) - { + public String onEnterZone(L2Character character, L2ZoneType zone) { + if ((character instanceof L2PcInstance) && !character.isDead() && !character.isTeleporting() && ((L2PcInstance) character).isOnline()) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(character.getInstanceId()); - if (tmpworld instanceof NornilsWorld) - { - for (int _auto[] : _auto_gates) - { - if (zone.getId() == _auto[0]) - { + if (tmpworld instanceof NornilsWorld) { + for (int _auto[] : _auto_gates) { + if (zone.getId() == _auto[0]) { openDoor(_auto[1], tmpworld.getInstanceId()); } - if (zone.getId() == 20111) - { + if (zone.getId() == 20111) { spawn3(character); - } - else if (zone.getId() == 20112) - { + } else if (zone.getId() == 20112) { spawn4(character); } @@ -497,65 +429,40 @@ public final class NornilsGarden extends AbstractInstance } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - if ((npc.getId() == _garden_guard) && event.equalsIgnoreCase("enter_instance")) - { - try - { + if ((npc.getId() == _garden_guard) && event.equalsIgnoreCase("enter_instance")) { + try { htmltext = enterInstance(npc, player); + } catch (Exception e) { } - catch (Exception e) - { - } - } - else if ((npc.getId() == 32258) && event.equalsIgnoreCase("exit")) - { - try - { + } else if ((npc.getId() == 32258) && event.equalsIgnoreCase("exit")) { + try { exitInstance(player); + } catch (Exception e) { } - catch (Exception e) - { - } - } - else if (Util.contains(_final_gates, npc.getId())) - { - if (event.equalsIgnoreCase("32260-02.html") || event.equalsIgnoreCase("32261-02.html") || event.equalsIgnoreCase("32262-02.html")) - { + } else if (Util.contains(_final_gates, npc.getId())) { + if (event.equalsIgnoreCase("32260-02.html") || event.equalsIgnoreCase("32261-02.html") || event.equalsIgnoreCase("32262-02.html")) { st.unset("correct"); - } - else if (Util.isDigit(event)) - { + } else if (Util.isDigit(event)) { int correct = st.getInt("correct"); correct++; st.set("correct", String.valueOf(correct)); htmltext = npc.getId() + "-0" + String.valueOf(correct + 2) + ".html"; - } - else if (event.equalsIgnoreCase("check")) - { + } else if (event.equalsIgnoreCase("check")) { int correct = st.getInt("correct"); - if ((npc.getId() == 32260) && (correct == 3)) - { + if ((npc.getId() == 32260) && (correct == 3)) { openDoor(st, player, 16200014); - } - else if ((npc.getId() == 32261) && (correct == 3)) - { + } else if ((npc.getId() == 32261) && (correct == 3)) { openDoor(st, player, 16200015); - } - else if ((npc.getId() == 32262) && (correct == 4)) - { + } else if ((npc.getId() == 32262) && (correct == 4)) { openDoor(st, player, 16200016); - } - else - { + } else { return npc.getId() + "-00.html"; } } @@ -564,13 +471,10 @@ public final class NornilsGarden extends AbstractInstance } @Override - public final String onTalk(L2Npc npc, L2PcInstance player) - { - if (Util.contains(_final_gates, npc.getId())) - { + public final String onTalk(L2Npc npc, L2PcInstance player) { + if (Util.contains(_final_gates, npc.getId())) { QuestState cst = player.getQuestState(Q00179_IntoTheLargeCavern.class.getSimpleName()); - if ((cst != null) && (cst.getState() == State.STARTED)) - { + if ((cst != null) && (cst.getState() == State.STARTED)) { return npc.getId() + "-01.html"; } return getNoQuestMsg(player); @@ -580,56 +484,44 @@ public final class NornilsGarden extends AbstractInstance } @Override - public final String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public final String onFirstTalk(L2Npc npc, L2PcInstance player) { getQuestState(player, true); return npc.getId() + ".html"; } @Override - public final String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if ((npc.getId() == _herb_jar) && !npc.isDead()) - { + public final String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if ((npc.getId() == _herb_jar) && !npc.isDead()) { dropHerb(npc, attacker, HP_HERBS_DROPLIST); dropHerb(npc, attacker, MP_HERBS_DROPLIST); npc.doDie(attacker); - } - else if ((npc.getId() == 18362) && (npc.getInstanceId() > 0)) - { + } else if ((npc.getId() == 18362) && (npc.getInstanceId() > 0)) { spawn1(npc); } return null; } @Override - public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } - for (int _gk[] : _gatekeepers) - { - if (npc.getId() == _gk[0]) - { + for (int _gk[] : _gatekeepers) { + if (npc.getId() == _gk[0]) { // Drop key npc.dropItem(player, _gk[1], 1); // Check if gatekeeper should open bridge, and open it - if (_gk[2] > 0) - { + if (_gk[2] > 0) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(player.getInstanceId()); - if (tmpworld instanceof NornilsWorld) - { + if (tmpworld instanceof NornilsWorld) { openDoor(_gk[2], tmpworld.getInstanceId()); } } } - if (npc.getId() == 18355) - { + if (npc.getId() == 18355) { spawn2(npc); } } @@ -637,8 +529,7 @@ public final class NornilsGarden extends AbstractInstance } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { } } diff --git a/src/main/java/com/l2jserver/datapack/instances/NornilsGardenQuest/NornilsGardenQuest.java b/src/main/java/com/l2jserver/datapack/instances/NornilsGardenQuest/NornilsGardenQuest.java index 918ff93d56..5ee5cc81dd 100644 --- a/src/main/java/com/l2jserver/datapack/instances/NornilsGardenQuest/NornilsGardenQuest.java +++ b/src/main/java/com/l2jserver/datapack/instances/NornilsGardenQuest/NornilsGardenQuest.java @@ -31,10 +31,8 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Nornil's Garden Quest instant zone. * @author Zoey76 */ -public final class NornilsGardenQuest extends AbstractInstance -{ - protected static final class NornilsGardenQuestWorld extends InstanceWorld - { +public final class NornilsGardenQuest extends AbstractInstance { + protected static final class NornilsGardenQuestWorld extends InstanceWorld { protected Location ORIGIN_LOC; } @@ -46,8 +44,7 @@ public final class NornilsGardenQuest extends AbstractInstance // Misc private static final int TEMPLATE_ID = 12; - public NornilsGardenQuest() - { + public NornilsGardenQuest() { super(NornilsGardenQuest.class.getSimpleName()); addStartNpc(RODENPICULA, MOTHER_NORNIL); @@ -56,39 +53,30 @@ public final class NornilsGardenQuest extends AbstractInstance } @Override - protected boolean checkConditions(L2PcInstance player) - { + protected boolean checkConditions(L2PcInstance player) { final QuestState qs = player.getQuestState(Q00236_SeedsOfChaos.class.getSimpleName()); return (qs != null) && (qs.getMemoState() >= 40) && (qs.getMemoState() <= 45); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; final QuestState q236 = player.getQuestState(Q00236_SeedsOfChaos.class.getSimpleName()); - switch (event) - { - case "enter": - { - if (checkConditions(player)) - { + switch (event) { + case "enter": { + if (checkConditions(player)) { final NornilsGardenQuestWorld world = new NornilsGardenQuestWorld(); world.ORIGIN_LOC = player.getLocation(); enterInstance(player, world, "NornilsGardenQuest.xml", TEMPLATE_ID); q236.setCond(16, true); htmltext = "32190-02.html"; - } - else - { + } else { htmltext = "32190-03.html"; } break; } - case "exit": - { - if ((q236 != null) && q236.isCompleted()) - { + case "exit": { + if ((q236 != null) && q236.isCompleted()) { final NornilsGardenQuestWorld world = (NornilsGardenQuestWorld) InstanceManager.getInstance().getPlayerWorld(player); world.removeAllowed(player.getObjectId()); finishInstance(world, 5000); @@ -104,29 +92,23 @@ public final class NornilsGardenQuest extends AbstractInstance } @Override - protected void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { + protected void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { world.addAllowed(player.getObjectId()); } teleportPlayer(player, ENTER_LOC, world.getInstanceId(), false); } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; final QuestState q236 = player.getQuestState(Q00236_SeedsOfChaos.class.getSimpleName()); - switch (npc.getId()) - { - case RODENPICULA: - { + switch (npc.getId()) { + case RODENPICULA: { htmltext = (q236 != null) && (q236.isCompleted()) ? "32237-02.html" : "32237-01.html"; break; } - case MOTHER_NORNIL: - { + case MOTHER_NORNIL: { htmltext = (q236 != null) && (q236.isCompleted()) ? "32239-02.html" : "32239-01.html"; break; } diff --git a/src/main/java/com/l2jserver/datapack/instances/PailakaDevilsLegacy/PailakaDevilsLegacy.java b/src/main/java/com/l2jserver/datapack/instances/PailakaDevilsLegacy/PailakaDevilsLegacy.java index 658e9196d7..ea4e678926 100644 --- a/src/main/java/com/l2jserver/datapack/instances/PailakaDevilsLegacy/PailakaDevilsLegacy.java +++ b/src/main/java/com/l2jserver/datapack/instances/PailakaDevilsLegacy/PailakaDevilsLegacy.java @@ -39,10 +39,8 @@ import com.l2jserver.gameserver.model.zone.L2ZoneType; * Pailaka Devil's Legacy Instance zone. * @author St3eT */ -public final class PailakaDevilsLegacy extends AbstractInstance -{ - protected class DIWorld extends InstanceWorld - { +public final class PailakaDevilsLegacy extends AbstractInstance { + protected class DIWorld extends InstanceWorld { protected L2Attackable _lematanNpc = null; protected List<L2Attackable> _followerslist = new CopyOnWriteArrayList<>(); } @@ -71,8 +69,7 @@ public final class PailakaDevilsLegacy extends AbstractInstance private static final Location LEMATAN_PORT_POINT = new Location(86116, -209117, -3774); private static final Location LEMATAN_PORT = new Location(85000, -208699, -3336); private static final Location ADVENTURER_LOC = new Location(84983, -208736, -3336, 49915); - private static final Location[] FOLLOWERS_LOC = - { + private static final Location[] FOLLOWERS_LOC = { new Location(85067, -208943, -3336, 20106), new Location(84904, -208944, -3336, 10904), new Location(85062, -208538, -3336, 44884), @@ -86,8 +83,7 @@ public final class PailakaDevilsLegacy extends AbstractInstance private static final int TEMPLATE_ID = 44; private static final int ZONE = 20109; - public PailakaDevilsLegacy() - { + public PailakaDevilsLegacy() { super(PailakaDevilsLegacy.class.getSimpleName()); addTalkId(SURVIVOR); addAttackId(POWDER_KEG, TREASURE_BOX, LEMATAN); @@ -98,37 +94,26 @@ public final class PailakaDevilsLegacy extends AbstractInstance } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); String htmltext = null; - if (event.equals("enter")) - { + if (event.equals("enter")) { final QuestState qs = player.getQuestState(Q00129_PailakaDevilsLegacy.class.getSimpleName()); enterInstance(player, new DIWorld(), "PailakaDevilsLegacy.xml", TEMPLATE_ID); - if (qs.isCond(1)) - { + if (qs.isCond(1)) { qs.setCond(2, true); htmltext = "32498-01.htm"; - } - else - { + } else { htmltext = "32498-02.htm"; } - } - else if ((tmpworld != null) && (tmpworld instanceof DIWorld)) - { + } else if ((tmpworld != null) && (tmpworld instanceof DIWorld)) { final DIWorld world = (DIWorld) tmpworld; - switch (event) - { - case "FOLLOWER_CAST": - { - if ((world._lematanNpc != null) && !world._lematanNpc.isDead()) - { - for (L2Attackable follower : world._followerslist) - { + switch (event) { + case "FOLLOWER_CAST": { + if ((world._lematanNpc != null) && !world._lematanNpc.isDead()) { + for (L2Attackable follower : world._followerslist) { follower.setTarget(world._lematanNpc); follower.doCast(ENERGY); } @@ -136,15 +121,13 @@ public final class PailakaDevilsLegacy extends AbstractInstance } break; } - case "LEMATAN_TELEPORT": - { + case "LEMATAN_TELEPORT": { ((L2Attackable) npc).clearAggroList(); npc.disableCoreAI(false); npc.teleToLocation(LEMATAN_PORT); npc.getVariables().set("ON_SHIP", 1); npc.getSpawn().setLocation(LEMATAN_PORT); - for (Location loc : FOLLOWERS_LOC) - { + for (Location loc : FOLLOWERS_LOC) { final L2Attackable follower = (L2Attackable) addSpawn(FOLLOWERS, loc, false, 0, false, world.getInstanceId()); follower.disableCoreAI(true); follower.setIsImmobilized(true); @@ -153,13 +136,11 @@ public final class PailakaDevilsLegacy extends AbstractInstance startQuestTimer("FOLLOWER_CAST", 4000, world._lematanNpc, null); break; } - case "TELEPORT": - { + case "TELEPORT": { player.teleToLocation(TELEPORT); break; } - case "DELETE": - { + case "DELETE": { npc.deleteMe(); break; } @@ -169,22 +150,15 @@ public final class PailakaDevilsLegacy extends AbstractInstance } @Override - public final String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { + public final String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if ((tmpworld != null) && (tmpworld instanceof DIWorld)) - { - switch (npc.getId()) - { - case POWDER_KEG: - { - if ((damage > 0) && npc.isScriptValue(0)) - { - for (L2Character characters : npc.getKnownList().getKnownCharactersInRadius(600)) - { - if ((characters != null) && characters.isMonster()) - { + if ((tmpworld != null) && (tmpworld instanceof DIWorld)) { + switch (npc.getId()) { + case POWDER_KEG: { + if ((damage > 0) && npc.isScriptValue(0)) { + for (L2Character characters : npc.getKnownList().getKnownCharactersInRadius(600)) { + if ((characters != null) && characters.isMonster()) { final L2Attackable monster = (L2Attackable) characters; monster.addDamageHate(npc, 0, 999); monster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, npc); @@ -197,10 +171,8 @@ public final class PailakaDevilsLegacy extends AbstractInstance } break; } - case LEMATAN: - { - if (npc.isScriptValue(0) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.5))) - { + case LEMATAN: { + if (npc.isScriptValue(0) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.5))) { npc.disableCoreAI(true); npc.setScriptValue(1); npc.setIsRunning(true); @@ -208,40 +180,31 @@ public final class PailakaDevilsLegacy extends AbstractInstance } break; } - case TREASURE_BOX: - { - if (npc.isScriptValue(0)) - { - switch (getRandom(7)) - { + case TREASURE_BOX: { + if (npc.isScriptValue(0)) { + switch (getRandom(7)) { case 0: - case 1: - { + case 1: { npc.dropItem(attacker, ANTIDOTE_POTION, getRandom(1, 10)); break; } - case 2: - { + case 2: { npc.dropItem(attacker, DIVINE_POTION, getRandom(1, 5)); break; } - case 3: - { + case 3: { npc.dropItem(attacker, PAILAKA_KEY, getRandom(1, 2)); break; } - case 4: - { + case 4: { npc.dropItem(attacker, DEFENCE_POTION, getRandom(1, 7)); break; } - case 5: - { + case 5: { npc.dropItem(attacker, SHIELD, getRandom(1, 10)); break; } - case 6: - { + case 6: { npc.dropItem(attacker, HEALING_POTION, getRandom(1, 10)); break; } @@ -257,18 +220,14 @@ public final class PailakaDevilsLegacy extends AbstractInstance } @Override - public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if ((tmpworld != null) && (tmpworld instanceof DIWorld)) - { + if ((tmpworld != null) && (tmpworld instanceof DIWorld)) { final DIWorld world = (DIWorld) tmpworld; - if (world._followerslist != null) - { - for (L2Npc _follower : world._followerslist) - { + if (world._followerslist != null) { + for (L2Npc _follower : world._followerslist) { _follower.deleteMe(); } world._followerslist.clear(); @@ -279,13 +238,10 @@ public final class PailakaDevilsLegacy extends AbstractInstance } @Override - public String onEnterZone(L2Character character, L2ZoneType zone) - { - if ((character.isPlayer()) && !character.isDead() && !character.isTeleporting() && ((L2PcInstance) character).isOnline()) - { + public String onEnterZone(L2Character character, L2ZoneType zone) { + if ((character.isPlayer()) && !character.isDead() && !character.isTeleporting() && ((L2PcInstance) character).isOnline()) { final InstanceWorld world = InstanceManager.getInstance().getWorld(character.getInstanceId()); - if ((world != null) && (world.getTemplateId() == TEMPLATE_ID)) - { + if ((world != null) && (world.getTemplateId() == TEMPLATE_ID)) { startQuestTimer("TELEPORT", 1000, ((DIWorld) world)._lematanNpc, (L2PcInstance) character); } } @@ -293,28 +249,23 @@ public final class PailakaDevilsLegacy extends AbstractInstance } @Override - public void onMoveFinished(L2Npc npc) - { - if (npc.getLocation() == LEMATAN_PORT_POINT) - { + public void onMoveFinished(L2Npc npc) { + if (npc.getLocation() == LEMATAN_PORT_POINT) { npc.doCast(AV_TELEPORT); startQuestTimer("LEMATAN_TELEPORT", 2000, npc, null); } } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { world.addAllowed(player.getObjectId()); ((DIWorld) world)._lematanNpc = (L2Attackable) addSpawn(LEMATAN, LEMATAN_SPAWN, false, 0, false, world.getInstanceId()); } teleportPlayer(player, TELEPORT, world.getInstanceId()); } - public static void main(String[] args) - { + public static void main(String[] args) { new PailakaDevilsLegacy(); } } diff --git a/src/main/java/com/l2jserver/datapack/instances/PailakaSongOfIceAndFire/PailakaSongOfIceAndFire.java b/src/main/java/com/l2jserver/datapack/instances/PailakaSongOfIceAndFire/PailakaSongOfIceAndFire.java index be15744a54..f35251dfe7 100644 --- a/src/main/java/com/l2jserver/datapack/instances/PailakaSongOfIceAndFire/PailakaSongOfIceAndFire.java +++ b/src/main/java/com/l2jserver/datapack/instances/PailakaSongOfIceAndFire/PailakaSongOfIceAndFire.java @@ -33,10 +33,8 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Pailaka Song of Ice and Fire Instance zone. * @author Gnacik, St3eT */ -public final class PailakaSongOfIceAndFire extends AbstractInstance -{ - protected class PSoIWorld extends InstanceWorld - { +public final class PailakaSongOfIceAndFire extends AbstractInstance { + protected class PSoIWorld extends InstanceWorld { } @@ -57,8 +55,7 @@ public final class PailakaSongOfIceAndFire extends AbstractInstance private static final int TEMPLATE_ID = 43; private static final int ZONE = 20108; - public PailakaSongOfIceAndFire() - { + public PailakaSongOfIceAndFire() { super(PailakaSongOfIceAndFire.class.getSimpleName()); addStartNpc(ADLER1); addTalkId(ADLER1); @@ -70,50 +67,39 @@ public final class PailakaSongOfIceAndFire extends AbstractInstance } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { world.addAllowed(player.getObjectId()); } teleportPlayer(player, TELEPORT, world.getInstanceId()); } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { - case "enter": - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { + case "enter": { enterInstance(player, new PSoIWorld(), "PailakaSongOfIceAndFire.xml", TEMPLATE_ID); break; } - case "GARGOS_LAUGH": - { + case "GARGOS_LAUGH": { broadcastNpcSay(npc, Say2.NPC_SHOUT, NpcStringId.OHHOHOH); break; } - case "TELEPORT": - { + case "TELEPORT": { teleportPlayer(player, TELEPORT, player.getInstanceId()); break; } - case "DELETE": - { - if (npc != null) - { + case "DELETE": { + if (npc != null) { npc.deleteMe(); } break; } - case "BLOOM_TIMER": - { + case "BLOOM_TIMER": { startQuestTimer("BLOOM_TIMER2", getRandom(2, 4) * 60 * 1000, npc, null); break; } - case "BLOOM_TIMER2": - { + case "BLOOM_TIMER2": { npc.setInvisible(!npc.isInvisible()); startQuestTimer("BLOOM_TIMER", 5000, npc, null); break; @@ -123,37 +109,28 @@ public final class PailakaSongOfIceAndFire extends AbstractInstance } @Override - public final String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isSummon) - { - if ((damage > 0) && npc.isScriptValue(0)) - { - switch (getRandom(6)) - { - case 0: - { - if (npc.getId() == BOTTLE) - { + public final String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isSummon) { + if ((damage > 0) && npc.isScriptValue(0)) { + switch (getRandom(6)) { + case 0: { + if (npc.getId() == BOTTLE) { npc.dropItem(player, WATER_ENHANCER, getRandom(1, 6)); } break; } - case 1: - { - if (npc.getId() == BRAZIER) - { + case 1: { + if (npc.getId() == BRAZIER) { npc.dropItem(player, FIRE_ENHANCER, getRandom(1, 6)); } break; } case 2: - case 3: - { + case 3: { npc.dropItem(player, SHIELD_POTION, getRandom(1, 10)); break; } case 4: - case 5: - { + case 5: { npc.dropItem(player, HEAL_POTION, getRandom(1, 10)); break; } @@ -165,20 +142,16 @@ public final class PailakaSongOfIceAndFire extends AbstractInstance } @Override - public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { npc.dropItem(player, getRandomBoolean() ? SHIELD_POTION : HEAL_POTION, getRandom(1, 7)); return super.onKill(npc, player, isSummon); } @Override - public String onExitZone(L2Character character, L2ZoneType zone) - { - if ((character.isPlayer()) && !character.isDead() && !character.isTeleporting() && ((L2PcInstance) character).isOnline()) - { + public String onExitZone(L2Character character, L2ZoneType zone) { + if ((character.isPlayer()) && !character.isDead() && !character.isTeleporting() && ((L2PcInstance) character).isOnline()) { final InstanceWorld world = InstanceManager.getInstance().getWorld(character.getInstanceId()); - if ((world != null) && (world.getTemplateId() == TEMPLATE_ID)) - { + if ((world != null) && (world.getTemplateId() == TEMPLATE_ID)) { startQuestTimer("TELEPORT", 1000, null, (L2PcInstance) character); } } @@ -186,10 +159,8 @@ public final class PailakaSongOfIceAndFire extends AbstractInstance } @Override - public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) - { - if (npc.isScriptValue(0) && creature.isPlayer()) - { + public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) { + if (npc.isScriptValue(0) && creature.isPlayer()) { npc.setScriptValue(1); startQuestTimer("GARGOS_LAUGH", 1000, npc, creature.getActingPlayer()); } @@ -197,8 +168,7 @@ public final class PailakaSongOfIceAndFire extends AbstractInstance } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { npc.setInvisible(true); startQuestTimer("BLOOM_TIMER", 1000, npc, null); return super.onSpawn(npc); diff --git a/src/main/java/com/l2jserver/datapack/instances/SanctumOftheLordsOfDawn/SanctumOftheLordsOfDawn.java b/src/main/java/com/l2jserver/datapack/instances/SanctumOftheLordsOfDawn/SanctumOftheLordsOfDawn.java index f20f422f90..6f9c536fca 100644 --- a/src/main/java/com/l2jserver/datapack/instances/SanctumOftheLordsOfDawn/SanctumOftheLordsOfDawn.java +++ b/src/main/java/com/l2jserver/datapack/instances/SanctumOftheLordsOfDawn/SanctumOftheLordsOfDawn.java @@ -42,15 +42,12 @@ import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse; * Sanctum of the Lords of Dawn instance zone. * @author Adry_85 */ -public final class SanctumOftheLordsOfDawn extends AbstractInstance -{ - protected static final class SotLoDWorld extends InstanceWorld - { +public final class SanctumOftheLordsOfDawn extends AbstractInstance { + protected static final class SotLoDWorld extends InstanceWorld { protected int doorst = 0; protected final static Map<Integer, List<L2Npc>> _save_point = new HashMap<>(); - public static Map<Integer, List<L2Npc>> getMonsters() - { + public static Map<Integer, List<L2Npc>> getMonsters() { return _save_point; } } @@ -76,16 +73,14 @@ public final class SanctumOftheLordsOfDawn extends AbstractInstance private static int DOOR_ONE = 17240001; private static int DOOR_TWO = 17240003; private static int DOOR_THREE = 17240005; - private static final Location[] SAVE_POINT = new Location[] - { + private static final Location[] SAVE_POINT = new Location[] { new Location(-75775, 213415, -7120), new Location(-74959, 209240, -7472), new Location(-77699, 208905, -7640), new Location(-79939, 205857, -7888), }; - public SanctumOftheLordsOfDawn() - { + public SanctumOftheLordsOfDawn() { super(SanctumOftheLordsOfDawn.class.getSimpleName()); addStartNpc(LIGHT_OF_DAWN); addTalkId(LIGHT_OF_DAWN, IDENTITY_CONFIRM_DEVICE, PASSWORD_ENTRY_DEVICE, DARKNESS_OF_DAWN, SHELF); @@ -93,49 +88,37 @@ public final class SanctumOftheLordsOfDawn extends AbstractInstance } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { - case "spawn": - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { + case "spawn": { final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player); - if (tmpworld instanceof SotLoDWorld) - { + if (tmpworld instanceof SotLoDWorld) { final SotLoDWorld world = (SotLoDWorld) tmpworld; spawnGroup("high_priest_of_dawn", world.getInstanceId()); player.sendPacket(SystemMessageId.BY_USING_THE_SKILL_OF_EINHASAD_S_HOLY_SWORD_DEFEAT_THE_EVIL_LILIMS); } break; } - case "teleportPlayer": - { - switch (npc.getId()) - { - case GUARDS_OF_THE_DAWN: - { + case "teleportPlayer": { + switch (npc.getId()) { + case GUARDS_OF_THE_DAWN: { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.INTRUDER_PROTECT_THE_PRIESTS_OF_DAWN); break; } - case GUARDS_OF_THE_DAWN_2: - { + case GUARDS_OF_THE_DAWN_2: { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.HOW_DARE_YOU_INTRUDE_WITH_THAT_TRANSFORMATION_GET_LOST); break; } - case GUARDS_OF_THE_DAWN_3: - { + case GUARDS_OF_THE_DAWN_3: { broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.WHO_ARE_YOU_A_NEW_FACE_LIKE_YOU_CAN_T_APPROACH_THIS_PLACE); break; } } OUTTER: - for (Entry<Integer, List<L2Npc>> entry : SotLoDWorld._save_point.entrySet()) - { - for (L2Npc monster : entry.getValue()) - { - if (monster.getObjectId() == npc.getObjectId()) - { + for (Entry<Integer, List<L2Npc>> entry : SotLoDWorld._save_point.entrySet()) { + for (L2Npc monster : entry.getValue()) { + if (monster.getObjectId() == npc.getObjectId()) { player.teleToLocation(SAVE_POINT[entry.getKey()]); break OUTTER; } @@ -147,10 +130,8 @@ public final class SanctumOftheLordsOfDawn extends AbstractInstance } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { world.addAllowed(player.getObjectId()); final Map<Integer, List<L2Npc>> save_point = SotLoDWorld.getMonsters(); save_point.put(0, spawnGroup("save_point1", world.getInstanceId())); @@ -162,47 +143,35 @@ public final class SanctumOftheLordsOfDawn extends AbstractInstance } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { - switch (npc.getId()) - { - case LIGHT_OF_DAWN: - { + public String onTalk(L2Npc npc, L2PcInstance talker) { + switch (npc.getId()) { + case LIGHT_OF_DAWN: { final QuestState qs = talker.getQuestState(Q00195_SevenSignsSecretRitualOfThePriests.class.getSimpleName()); - if ((qs != null) && qs.isCond(3) && hasQuestItems(talker, IDENTITY_CARD) && (talker.getTransformationId() == 113)) - { + if ((qs != null) && qs.isCond(3) && hasQuestItems(talker, IDENTITY_CARD) && (talker.getTransformationId() == 113)) { enterInstance(talker, new SotLoDWorld(), "SanctumoftheLordsofDawn.xml", TEMPLATE_ID); return "32575-01.html"; } return "32575-02.html"; } - case IDENTITY_CONFIRM_DEVICE: - { + case IDENTITY_CONFIRM_DEVICE: { final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof SotLoDWorld) - { - if (hasQuestItems(talker, IDENTITY_CARD) && (talker.getTransformationId() == 113)) - { + if (tmpworld instanceof SotLoDWorld) { + if (hasQuestItems(talker, IDENTITY_CARD) && (talker.getTransformationId() == 113)) { final SotLoDWorld world = (SotLoDWorld) tmpworld; - if (world.doorst == 0) - { + if (world.doorst == 0) { openDoor(DOOR_ONE, world.getInstanceId()); talker.sendPacket(SystemMessageId.SNEAK_INTO_DAWNS_DOCUMENT_STORAGE); talker.sendPacket(SystemMessageId.MALE_GUARDS_CAN_DETECT_FEMALES_DONT); talker.sendPacket(SystemMessageId.FEMALE_GUARDS_NOTICE_BETTER_THAN_MALE); world.doorst++; npc.decayMe(); - } - else if (world.doorst == 1) - { + } else if (world.doorst == 1) { openDoor(DOOR_TWO, world.getInstanceId()); world.doorst++; npc.decayMe(); - for (int objId : world.getAllowed()) - { + for (int objId : world.getAllowed()) { final L2PcInstance pl = L2World.getInstance().getPlayer(objId); - if (pl != null) - { + if (pl != null) { pl.showQuestMovie(11); startQuestTimer("spawn", 35000, null, talker); } @@ -214,26 +183,22 @@ public final class SanctumOftheLordsOfDawn extends AbstractInstance } break; } - case PASSWORD_ENTRY_DEVICE: - { + case PASSWORD_ENTRY_DEVICE: { final InstanceWorld tmworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmworld instanceof SotLoDWorld) - { + if (tmworld instanceof SotLoDWorld) { final SotLoDWorld world = (SotLoDWorld) tmworld; openDoor(DOOR_THREE, world.getInstanceId()); return "32577-01.html"; } break; } - case DARKNESS_OF_DAWN: - { + case DARKNESS_OF_DAWN: { final InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(talker); world.removeAllowed(talker.getObjectId()); talker.teleToLocation(EXIT, 0); return "32579-01.html"; } - case SHELF: - { + case SHELF: { final InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId()); InstanceManager.getInstance().getInstance(world.getInstanceId()).setDuration(300000); talker.teleToLocation(-75925, 213399, -7128); @@ -244,8 +209,7 @@ public final class SanctumOftheLordsOfDawn extends AbstractInstance } @Override - public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) { npc.broadcastPacket(new MagicSkillUse(npc, player, GUARD_SKILL.getSkillId(), 1, 2000, 1)); startQuestTimer("teleportPlayer", 2000, npc, player); return super.onAggroRangeEnter(npc, player, isSummon); diff --git a/src/main/java/com/l2jserver/datapack/instances/SecretAreaInTheKeucereusFortress1/SecretAreaInTheKeucereusFortress1.java b/src/main/java/com/l2jserver/datapack/instances/SecretAreaInTheKeucereusFortress1/SecretAreaInTheKeucereusFortress1.java index 2571325e1b..863a6c8795 100644 --- a/src/main/java/com/l2jserver/datapack/instances/SecretAreaInTheKeucereusFortress1/SecretAreaInTheKeucereusFortress1.java +++ b/src/main/java/com/l2jserver/datapack/instances/SecretAreaInTheKeucereusFortress1/SecretAreaInTheKeucereusFortress1.java @@ -31,10 +31,8 @@ import com.l2jserver.gameserver.model.quest.QuestState; * @author Adry_85 * @since 2.6.0.0 */ -public final class SecretAreaInTheKeucereusFortress1 extends AbstractInstance -{ - protected class SAKF1World extends InstanceWorld - { +public final class SecretAreaInTheKeucereusFortress1 extends AbstractInstance { + protected class SAKF1World extends InstanceWorld { } @@ -45,22 +43,18 @@ public final class SecretAreaInTheKeucereusFortress1 extends AbstractInstance // Misc private static final int TEMPLATE_ID = 117; - public SecretAreaInTheKeucereusFortress1() - { + public SecretAreaInTheKeucereusFortress1() { super(SecretAreaInTheKeucereusFortress1.class.getSimpleName()); addStartNpc(GINBY); addTalkId(GINBY); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = player.getQuestState(Q10270_BirthOfTheSeed.class.getSimpleName()); - if ((st != null) && (st.getMemoState() >= 5) && (st.getMemoState() < 20)) - { + if ((st != null) && (st.getMemoState() >= 5) && (st.getMemoState() < 20)) { enterInstance(player, new SAKF1World(), "SecretAreaInTheKeucereusFortress.xml", TEMPLATE_ID); - if (st.isMemoState(5)) - { + if (st.isMemoState(5)) { st.setMemoState(10); } return "32566-01.html"; @@ -69,10 +63,8 @@ public final class SecretAreaInTheKeucereusFortress1 extends AbstractInstance } @Override - public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) - { - if (firstEntrance) - { + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { + if (firstEntrance) { world.addAllowed(player.getObjectId()); } teleportPlayer(player, START_LOC, world.getInstanceId(), false); diff --git a/src/main/java/com/l2jserver/datapack/quests/AbstractSagaQuest.java b/src/main/java/com/l2jserver/datapack/quests/AbstractSagaQuest.java index 21b2a97b84..6bca2961bc 100644 --- a/src/main/java/com/l2jserver/datapack/quests/AbstractSagaQuest.java +++ b/src/main/java/com/l2jserver/datapack/quests/AbstractSagaQuest.java @@ -77,8 +77,7 @@ public abstract class AbstractSagaQuest extends Quest { return st; } } - } - else if (player.getClassId().getId() == QUEST_CLASS[getId() - 67][0]) { + } else if (player.getClassId().getId() == QUEST_CLASS[getId() - 67][0]) { return st; } } @@ -128,8 +127,7 @@ public abstract class AbstractSagaQuest extends Quest { autoChat(Archon, _text[13].replace("PLAYERNAME", st2.getPlayer().getName())); ((L2Attackable) Archon).addDamageHate(st2.getPlayer(), 0, 99999); Archon.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, st2.getPlayer(), null); - } - else { + } else { st2.giveItems(_items[3], getRandom(1, 4)); } } @@ -159,8 +157,7 @@ public abstract class AbstractSagaQuest extends Quest { if (st.isCreated()) { st.exitQuest(true); } - } - else { + } else { htmltext = "0-05.htm"; } break; @@ -169,8 +166,7 @@ public abstract class AbstractSagaQuest extends Quest { takeItems(player, _items[10], -1); st.setCond(20, true); htmltext = "0-08.htm"; - } - else { + } else { takeItems(player, _items[10], -1); addExpAndSp(player, 2299404, 0); giveAdena(player, 5000000, true); @@ -259,16 +255,14 @@ public abstract class AbstractSagaQuest extends Quest { case "7-1": if (st.getInt("spawned") == 1) { htmltext = "7-03.htm"; - } - else if (st.getInt("spawned") == 0) { + } else if (st.getInt("spawned") == 0) { L2Npc Mob_1 = addSpawn(_mob[0], _npcSpawnLocations[0], false, 0); st.set("spawned", "1"); st.startQuestTimer("Mob_1 Timer 1", 500, Mob_1); st.startQuestTimer("Mob_1 has despawned", 300000, Mob_1); addSpawn(st, Mob_1); htmltext = "7-02.htm"; - } - else { + } else { htmltext = "7-04.htm"; } break; @@ -306,11 +300,9 @@ public abstract class AbstractSagaQuest extends Quest { st.startQuestTimer("Mob_2 Timer 1", 500, Mob_2); st.startQuestTimer("Mob_2 has despawned", 60000, Mob_2); htmltext = "10-02.htm"; - } - else if (st.getInt("Quest1") == 45) { + } else if (st.getInt("Quest1") == 45) { htmltext = "10-03.htm"; - } - else { + } else { htmltext = "10-04.htm"; } break; @@ -368,8 +360,7 @@ public abstract class AbstractSagaQuest extends Quest { st.startQuestTimer("Mob_2 Timer 3", 13000, npc); if (getRandomBoolean()) { autoChat(npc, _text[9].replace("PLAYERNAME", player.getName())); - } - else { + } else { autoChat(npc, _text[10].replace("PLAYERNAME", player.getName())); } } @@ -381,13 +372,11 @@ public abstract class AbstractSagaQuest extends Quest { // TODO this IF will never be true if (st.getInt("Quest0") == 1) { autoChat(npc, _text[11].replace("PLAYERNAME", player.getName())); - } - else { + } else { autoChat(npc, _text[12].replace("PLAYERNAME", player.getName())); } DeleteSpawn(st, npc); - } - else { + } else { st.startQuestTimer("Mob_2 has despawned", 1000, npc); } return null; @@ -418,8 +407,7 @@ public abstract class AbstractSagaQuest extends Quest { } st.set("Quest0", Integer.toString(quest0)); - } - else if ((npcId == _mob[1]) && (cond == 15)) { + } else if ((npcId == _mob[1]) && (cond == 15)) { if ((st != st2) || ((st == st2) && player.isInParty())) { autoChat(npc, _text[5].replace("PLAYERNAME", player.getName())); cancelQuestTimer("Archon Hellisha has despawned", npc, st2.getPlayer()); @@ -450,32 +438,25 @@ public abstract class AbstractSagaQuest extends Quest { if (tab == 1) { if (quest0 == 0) { htmltext = "4-04.htm"; - } - else if (quest0 == 1) { + } else if (quest0 == 1) { htmltext = "4-06.htm"; } - } - else if (quest0 == 0) { + } else if (quest0 == 0) { htmltext = "4-01.htm"; - } - else if (quest0 == 1) { + } else if (quest0 == 1) { htmltext = "4-03.htm"; } - } - else if (tab == 1) { + } else if (tab == 1) { if (quest0 == 0) { htmltext = "4-05.htm"; - } - else if (quest0 == 1) { + } else if (quest0 == 1) { htmltext = "4-07.htm"; } - } - else if (quest0 == 0) { + } else if (quest0 == 0) { htmltext = "4-02.htm"; } } - } - else if (cond == 18) { + } else if (cond == 18) { htmltext = "4-08.htm"; } } @@ -507,8 +488,7 @@ public abstract class AbstractSagaQuest extends Quest { QuestState st2 = partyQuestMembers.get(getRandom(partyQuestMembers.size())); giveHalishaMark(st2); } - } - else { + } else { QuestState st1 = findQuest(player); if (st1 != null) { if (st1.isCond(15)) { @@ -550,8 +530,7 @@ public abstract class AbstractSagaQuest extends Quest { int kills = st1.getInt("kills"); if (kills < 9) { st1.set("kills", Integer.toString(kills + 1)); - } - else { + } else { st1.giveItems(_items[5], 1); st.setCond(7, true); } @@ -574,16 +553,14 @@ public abstract class AbstractSagaQuest extends Quest { cancelQuestTimer("Mob_1 has despawned", npc, st2.getPlayer()); st2.set("spawned", "0"); DeleteSpawn(st2, npc); - } - else if ((npcId == _mob[1]) && (cond == 15)) { + } else if ((npcId == _mob[1]) && (cond == 15)) { if (!player.isInParty()) { if (st == st2) { autoChat(npc, _text[4].replace("PLAYERNAME", player.getName())); giveItems(player, _items[8], 1); takeItems(player, _items[3], -1); st.setCond(16, true); - } - else { + } else { autoChat(npc, _text[5].replace("PLAYERNAME", player.getName())); } } @@ -592,16 +569,14 @@ public abstract class AbstractSagaQuest extends Quest { DeleteSpawn(st2, npc); } } - } - else if (npcId == _mob[0]) { + } else if (npcId == _mob[0]) { st = findRightState(npc); if (st != null) { cancelQuestTimer("Mob_1 has despawned", npc, st.getPlayer()); st.set("spawned", "0"); DeleteSpawn(st, npc); } - } - else if (npcId == _mob[1]) { + } else if (npcId == _mob[1]) { st = findRightState(npc); if (st != null) { cancelQuestTimer("Archon Hellisha has despawned", npc, st.getPlayer()); @@ -643,8 +618,7 @@ public abstract class AbstractSagaQuest extends Quest { int npcId = npc.getId(); if ((npcId == _npc[0]) && st.isCompleted()) { htmltext = getAlreadyCompletedMsg(player); - } - else if (player.getClassId().getId() == getPrevClass(player)) { + } else if (player.getClassId().getId() == getPrevClass(player)) { switch (st.getCond()) { case 0: if (npcId == _npc[0]) { @@ -654,16 +628,14 @@ public abstract class AbstractSagaQuest extends Quest { case 1: if (npcId == _npc[0]) { htmltext = "0-04.htm"; - } - else if (npcId == _npc[2]) { + } else if (npcId == _npc[2]) { htmltext = "2-01.htm"; } break; case 2: if (npcId == _npc[2]) { htmltext = "2-02.htm"; - } - else if (npcId == _npc[1]) { + } else if (npcId == _npc[1]) { htmltext = "1-01.htm"; } break; @@ -671,8 +643,7 @@ public abstract class AbstractSagaQuest extends Quest { if ((npcId == _npc[1]) && hasQuestItems(player, _items[0])) { if ((_items[11] == 0) || hasQuestItems(player, _items[11])) { htmltext = "1-03.htm"; - } - else { + } else { htmltext = "1-02.htm"; } } @@ -680,24 +651,21 @@ public abstract class AbstractSagaQuest extends Quest { case 4: if (npcId == _npc[1]) { htmltext = "1-04.htm"; - } - else if (npcId == _npc[2]) { + } else if (npcId == _npc[2]) { htmltext = "2-03.htm"; } break; case 5: if (npcId == _npc[2]) { htmltext = "2-04.htm"; - } - else if (npcId == _npc[5]) { + } else if (npcId == _npc[5]) { htmltext = "5-01.htm"; } break; case 6: if (npcId == _npc[5]) { htmltext = "5-03.htm"; - } - else if (npcId == _npc[6]) { + } else if (npcId == _npc[6]) { htmltext = "6-01.htm"; } break; @@ -709,8 +677,7 @@ public abstract class AbstractSagaQuest extends Quest { case 8: if (npcId == _npc[6]) { htmltext = "6-04.htm"; - } - else if (npcId == _npc[7]) { + } else if (npcId == _npc[7]) { htmltext = "7-01.htm"; } break; @@ -722,8 +689,7 @@ public abstract class AbstractSagaQuest extends Quest { case 10: if (npcId == _npc[7]) { htmltext = "7-07.htm"; - } - else if (npcId == _npc[3]) { + } else if (npcId == _npc[3]) { htmltext = "3-01.htm"; } break; @@ -732,8 +698,7 @@ public abstract class AbstractSagaQuest extends Quest { if (npcId == _npc[3]) { if (hasQuestItems(player, _items[2])) { htmltext = "3-05.htm"; - } - else { + } else { htmltext = "3-04.htm"; } } @@ -741,24 +706,21 @@ public abstract class AbstractSagaQuest extends Quest { case 13: if (npcId == _npc[3]) { htmltext = "3-06.htm"; - } - else if (npcId == _npc[8]) { + } else if (npcId == _npc[8]) { htmltext = "8-01.htm"; } break; case 14: if (npcId == _npc[8]) { htmltext = "8-03.htm"; - } - else if (npcId == _npc[11]) { + } else if (npcId == _npc[11]) { htmltext = "11-01.htm"; } break; case 15: if (npcId == _npc[11]) { htmltext = "11-02.htm"; - } - else if (npcId == _npc[9]) { + } else if (npcId == _npc[9]) { htmltext = "9-01.htm"; } break; @@ -770,8 +732,7 @@ public abstract class AbstractSagaQuest extends Quest { case 17: if (npcId == _npc[9]) { htmltext = "9-04.htm"; - } - else if (npcId == _npc[10]) { + } else if (npcId == _npc[10]) { htmltext = "10-01.htm"; } break; @@ -783,8 +744,7 @@ public abstract class AbstractSagaQuest extends Quest { case 19: if (npcId == _npc[10]) { htmltext = "10-07.htm"; - } - else if (npcId == _npc[0]) { + } else if (npcId == _npc[0]) { htmltext = "0-06.htm"; } break; @@ -807,8 +767,7 @@ public abstract class AbstractSagaQuest extends Quest { player.broadcastUserInfo(); cast(npc, player, 4339, 1); } - } - else { + } else { htmltext = "0-010.htm"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00201_HumanFighterTutorial.java b/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00201_HumanFighterTutorial.java index ebdabd56f2..12249565fb 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00201_HumanFighterTutorial.java +++ b/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00201_HumanFighterTutorial.java @@ -24,10 +24,8 @@ import com.l2jserver.gameserver.model.quest.Quest; * @author Zealar * @since 2.6.0.0 */ -public class Q00201_HumanFighterTutorial extends Quest -{ - public Q00201_HumanFighterTutorial() - { +public class Q00201_HumanFighterTutorial extends Quest { + public Q00201_HumanFighterTutorial() { super(201, Q00201_HumanFighterTutorial.class.getSimpleName(), "Human Fighter Tutorial"); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00202_HumanMageTutorial.java b/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00202_HumanMageTutorial.java index f079bc0ea0..5bb7323e96 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00202_HumanMageTutorial.java +++ b/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00202_HumanMageTutorial.java @@ -24,10 +24,8 @@ import com.l2jserver.gameserver.model.quest.Quest; * @author Zealar * @since 2.6.0.0 */ -public class Q00202_HumanMageTutorial extends Quest -{ - public Q00202_HumanMageTutorial() - { +public class Q00202_HumanMageTutorial extends Quest { + public Q00202_HumanMageTutorial() { super(202, Q00202_HumanMageTutorial.class.getSimpleName(), "Human Mage Tutorial"); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00203_ElfTutorial.java b/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00203_ElfTutorial.java index 95f4bb98cb..709a3e6bfd 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00203_ElfTutorial.java +++ b/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00203_ElfTutorial.java @@ -24,10 +24,8 @@ import com.l2jserver.gameserver.model.quest.Quest; * @author Zealar * @since 2.6.0.0 */ -public class Q00203_ElfTutorial extends Quest -{ - public Q00203_ElfTutorial() - { +public class Q00203_ElfTutorial extends Quest { + public Q00203_ElfTutorial() { super(203, Q00203_ElfTutorial.class.getSimpleName(), "Elf Tutorial"); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00204_DarkElfTutorial.java b/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00204_DarkElfTutorial.java index 9ed5918210..001bd098cb 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00204_DarkElfTutorial.java +++ b/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00204_DarkElfTutorial.java @@ -24,10 +24,8 @@ import com.l2jserver.gameserver.model.quest.Quest; * @author Zealar * @since 2.6.0.0 */ -public class Q00204_DarkElfTutorial extends Quest -{ - public Q00204_DarkElfTutorial() - { +public class Q00204_DarkElfTutorial extends Quest { + public Q00204_DarkElfTutorial() { super(204, Q00204_DarkElfTutorial.class.getSimpleName(), "Dark Elf Tutorial"); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00205_OrcTutorial.java b/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00205_OrcTutorial.java index b475651013..9786078479 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00205_OrcTutorial.java +++ b/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00205_OrcTutorial.java @@ -24,10 +24,8 @@ import com.l2jserver.gameserver.model.quest.Quest; * @author Zealar * @since 2.6.0.0 */ -public class Q00205_OrcTutorial extends Quest -{ - public Q00205_OrcTutorial() - { +public class Q00205_OrcTutorial extends Quest { + public Q00205_OrcTutorial() { super(205, Q00205_OrcTutorial.class.getSimpleName(), "Orc Tutorial"); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00206_DwarfTutorial.java b/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00206_DwarfTutorial.java index ad88ba3fcd..25179350bf 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00206_DwarfTutorial.java +++ b/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00206_DwarfTutorial.java @@ -24,10 +24,8 @@ import com.l2jserver.gameserver.model.quest.Quest; * @author Zealar * @since 2.6.0.0 */ -public class Q00206_DwarfTutorial extends Quest -{ - public Q00206_DwarfTutorial() - { +public class Q00206_DwarfTutorial extends Quest { + public Q00206_DwarfTutorial() { super(206, Q00206_DwarfTutorial.class.getSimpleName(), "Dwarf Tutorial"); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00207_NewbieWeaponCoupon.java b/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00207_NewbieWeaponCoupon.java index 8d8f94613d..adc4da8f16 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00207_NewbieWeaponCoupon.java +++ b/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00207_NewbieWeaponCoupon.java @@ -24,10 +24,8 @@ import com.l2jserver.gameserver.model.quest.Quest; * @author Zealar * @since 2.6.0.0 */ -public class Q00207_NewbieWeaponCoupon extends Quest -{ - public Q00207_NewbieWeaponCoupon() - { +public class Q00207_NewbieWeaponCoupon extends Quest { + public Q00207_NewbieWeaponCoupon() { super(207, Q00207_NewbieWeaponCoupon.class.getSimpleName(), "Newbie Weapon Coupon"); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00208_NewbieAccessoryCoupon.java b/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00208_NewbieAccessoryCoupon.java index fc63ec32f2..f075e6bff4 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00208_NewbieAccessoryCoupon.java +++ b/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00208_NewbieAccessoryCoupon.java @@ -24,10 +24,8 @@ import com.l2jserver.gameserver.model.quest.Quest; * @author Zealar * @since 2.6.0.0 */ -public class Q00208_NewbieAccessoryCoupon extends Quest -{ - public Q00208_NewbieAccessoryCoupon() - { +public class Q00208_NewbieAccessoryCoupon extends Quest { + public Q00208_NewbieAccessoryCoupon() { super(208, Q00208_NewbieAccessoryCoupon.class.getSimpleName(), "Newbie Accessory Coupon"); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00209_KamaelTutorial.java b/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00209_KamaelTutorial.java index 4483ac1347..c1cb2339f5 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00209_KamaelTutorial.java +++ b/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00209_KamaelTutorial.java @@ -24,10 +24,8 @@ import com.l2jserver.gameserver.model.quest.Quest; * @author Zealar * @since 2.6.0.0 */ -public class Q00209_KamaelTutorial extends Quest -{ - public Q00209_KamaelTutorial() - { +public class Q00209_KamaelTutorial extends Quest { + public Q00209_KamaelTutorial() { super(209, Q00209_KamaelTutorial.class.getSimpleName(), "Kamael Tutorial"); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00728_TerritoryWar.java b/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00728_TerritoryWar.java index 06703c8af4..82276668a8 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00728_TerritoryWar.java +++ b/src/main/java/com/l2jserver/datapack/quests/Dummy/Q00728_TerritoryWar.java @@ -24,10 +24,8 @@ import com.l2jserver.gameserver.model.quest.Quest; * @author Zealar * @since 2.6.0.0 */ -public class Q00728_TerritoryWar extends Quest -{ - public Q00728_TerritoryWar() - { +public class Q00728_TerritoryWar extends Quest { + public Q00728_TerritoryWar() { super(728, Q00728_TerritoryWar.class.getSimpleName(), "Territory War"); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00001_LettersOfLove/Q00001_LettersOfLove.java b/src/main/java/com/l2jserver/datapack/quests/Q00001_LettersOfLove/Q00001_LettersOfLove.java index a27058cd5c..72f8a74095 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00001_LettersOfLove/Q00001_LettersOfLove.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00001_LettersOfLove/Q00001_LettersOfLove.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.network.NpcStringId; * Letters of Love (1) * @author Zoey76 */ -public class Q00001_LettersOfLove extends Quest -{ +public class Q00001_LettersOfLove extends Quest { // NPCs private static final int DARIN = 30048; private static final int ROXXY = 30006; @@ -44,8 +43,7 @@ public class Q00001_LettersOfLove extends Quest // Misc private static final int MIN_LEVEL = 2; - public Q00001_LettersOfLove() - { + public Q00001_LettersOfLove() { super(1, Q00001_LettersOfLove.class.getSimpleName(), "Letters of Love"); addStartNpc(DARIN); addTalkId(DARIN, ROXXY, BAULRO); @@ -53,28 +51,22 @@ public class Q00001_LettersOfLove extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "30048-03.html": case "30048-04.html": - case "30048-05.html": - { + case "30048-05.html": { htmltext = event; break; } - case "30048-06.htm": - { - if (player.getLevel() >= MIN_LEVEL) - { + case "30048-06.htm": { + if (player.getLevel() >= MIN_LEVEL) { st.startQuest(); giveItems(player, DARINS_LETTER, 1); htmltext = event; @@ -86,34 +78,24 @@ public class Q00001_LettersOfLove extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getLevel() < MIN_LEVEL) ? "30048-01.html" : "30048-02.html"; break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { - switch (npc.getId()) - { - case DARIN: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { + switch (npc.getId()) { + case DARIN: { htmltext = "30048-07.html"; break; } - case ROXXY: - { - if (hasQuestItems(player, DARINS_LETTER) && !hasQuestItems(player, ROXXYS_KERCHIEF)) - { + case ROXXY: { + if (hasQuestItems(player, DARINS_LETTER) && !hasQuestItems(player, ROXXYS_KERCHIEF)) { takeItems(player, DARINS_LETTER, -1); giveItems(player, ROXXYS_KERCHIEF, 1); st.setCond(2, true); @@ -124,14 +106,10 @@ public class Q00001_LettersOfLove extends Quest } break; } - case 2: - { - switch (npc.getId()) - { - case DARIN: - { - if (hasQuestItems(player, ROXXYS_KERCHIEF)) - { + case 2: { + switch (npc.getId()) { + case DARIN: { + if (hasQuestItems(player, ROXXYS_KERCHIEF)) { takeItems(player, ROXXYS_KERCHIEF, -1); giveItems(player, DARINS_RECEIPT, 1); st.setCond(3, true); @@ -139,10 +117,8 @@ public class Q00001_LettersOfLove extends Quest } break; } - case ROXXY: - { - if (hasQuestItems(player, ROXXYS_KERCHIEF)) - { + case ROXXY: { + if (hasQuestItems(player, ROXXYS_KERCHIEF)) { htmltext = "30006-02.html"; } break; @@ -150,37 +126,27 @@ public class Q00001_LettersOfLove extends Quest } break; } - case 3: - { - switch (npc.getId()) - { - case DARIN: - { - if (hasQuestItems(player, DARINS_RECEIPT) || !hasQuestItems(player, BAULROS_POTION)) - { + case 3: { + switch (npc.getId()) { + case DARIN: { + if (hasQuestItems(player, DARINS_RECEIPT) || !hasQuestItems(player, BAULROS_POTION)) { htmltext = "30048-09.html"; } break; } - case ROXXY: - { - if (hasQuestItems(player, DARINS_RECEIPT) || hasQuestItems(player, BAULROS_POTION)) - { + case ROXXY: { + if (hasQuestItems(player, DARINS_RECEIPT) || hasQuestItems(player, BAULROS_POTION)) { htmltext = "30006-03.html"; } break; } - case BAULRO: - { - if (hasQuestItems(player, DARINS_RECEIPT)) - { + case BAULRO: { + if (hasQuestItems(player, DARINS_RECEIPT)) { takeItems(player, DARINS_RECEIPT, -1); giveItems(player, BAULROS_POTION, 1); st.setCond(4, true); htmltext = "30033-01.html"; - } - else if (hasQuestItems(player, BAULROS_POTION)) - { + } else if (hasQuestItems(player, BAULROS_POTION)) { htmltext = "30033-02.html"; } break; @@ -188,12 +154,9 @@ public class Q00001_LettersOfLove extends Quest } break; } - case 4: - { - switch (npc.getId()) - { - case DARIN: - { + case 4: { + switch (npc.getId()) { + case DARIN: { // TODO: Beside this message something should be set for the Newbie Guide. showOnScreenMsg(player, NpcStringId.DELIVERY_DUTY_COMPLETE_N_GO_FIND_THE_NEWBIE_GUIDE, 2, 5000); giveItems(player, NECKLACE_OF_KNOWLEDGE, 1); @@ -203,18 +166,14 @@ public class Q00001_LettersOfLove extends Quest htmltext = "30048-10.html"; break; } - case BAULRO: - { - if (hasQuestItems(player, BAULROS_POTION)) - { + case BAULRO: { + if (hasQuestItems(player, BAULROS_POTION)) { htmltext = "30033-02.html"; } break; } - case ROXXY: - { - if (hasQuestItems(player, BAULROS_POTION)) - { + case ROXXY: { + if (hasQuestItems(player, BAULROS_POTION)) { htmltext = "30006-03.html"; } break; @@ -225,8 +184,7 @@ public class Q00001_LettersOfLove extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00002_WhatWomenWant/Q00002_WhatWomenWant.java b/src/main/java/com/l2jserver/datapack/quests/Q00002_WhatWomenWant/Q00002_WhatWomenWant.java index dba44e8f02..cdc68acdf3 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00002_WhatWomenWant/Q00002_WhatWomenWant.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00002_WhatWomenWant/Q00002_WhatWomenWant.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.network.NpcStringId; * What Women Want (2) * @author malyelfik */ -public class Q00002_WhatWomenWant extends Quest -{ +public class Q00002_WhatWomenWant extends Quest { // NPCs private static final int ARUJIEN = 30223; private static final int MIRABEL = 30146; @@ -47,8 +46,7 @@ public class Q00002_WhatWomenWant extends Quest // Misc private static final int MIN_LEVEL = 2; - public Q00002_WhatWomenWant() - { + public Q00002_WhatWomenWant() { super(2, Q00002_WhatWomenWant.class.getSimpleName(), "What Women Want"); addStartNpc(ARUJIEN); addTalkId(ARUJIEN, MIRABEL, HERBIEL, GREENIS); @@ -56,17 +54,14 @@ public class Q00002_WhatWomenWant extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "30223-04.htm": st.startQuest(); giveItems(player, ARUJIENS_LETTER1, 1); @@ -94,21 +89,17 @@ public class Q00002_WhatWomenWant extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case ARUJIEN: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = ((player.getRace() != Race.ELF) && (player.getRace() != Race.HUMAN)) ? "30223-00.htm" : (player.getLevel() >= MIN_LEVEL) ? "30223-02.htm" : "30223-01.html"; break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "30223-05.html"; break; @@ -138,53 +129,39 @@ public class Q00002_WhatWomenWant extends Quest } break; case MIRABEL: - if (st.isStarted()) - { - if (st.isCond(1)) - { + if (st.isStarted()) { + if (st.isCond(1)) { st.setCond(2, true); takeItems(player, ARUJIENS_LETTER1, -1); giveItems(player, ARUJIENS_LETTER2, 1); htmltext = "30146-01.html"; - } - else - { + } else { htmltext = "30146-02.html"; } } break; case HERBIEL: - if (st.isStarted() && (st.getCond() > 1)) - { - if (st.isCond(2)) - { + if (st.isStarted() && (st.getCond() > 1)) { + if (st.isCond(2)) { st.setCond(3, true); takeItems(player, ARUJIENS_LETTER2, -1); giveItems(player, ARUJIENS_LETTER3, 1); htmltext = "30150-01.html"; - } - else - { + } else { htmltext = "30150-02.html"; } } break; case GREENIS: - if (st.isStarted()) - { - if (st.isCond(4)) - { + if (st.isStarted()) { + if (st.isCond(4)) { st.setCond(5, true); takeItems(player, POETRY_BOOK, -1); giveItems(player, GREENIS_LETTER, 1); htmltext = "30157-02.html"; - } - else if (st.isCond(5)) - { + } else if (st.isCond(5)) { htmltext = "30157-03.html"; - } - else - { + } else { htmltext = "30157-01.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00003_WillTheSealBeBroken/Q00003_WillTheSealBeBroken.java b/src/main/java/com/l2jserver/datapack/quests/Q00003_WillTheSealBeBroken/Q00003_WillTheSealBeBroken.java index 44d2ae792a..f7533ac2ab 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00003_WillTheSealBeBroken/Q00003_WillTheSealBeBroken.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00003_WillTheSealBeBroken/Q00003_WillTheSealBeBroken.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.State; * Will the Seal be Broken? (3) * @author malyelfik */ -public class Q00003_WillTheSealBeBroken extends Quest -{ +public class Q00003_WillTheSealBeBroken extends Quest { // NPC private static final int TALLOTH = 30141; // Monsters @@ -49,8 +48,7 @@ public class Q00003_WillTheSealBeBroken extends Quest // Misc private static final int MIN_LEVEL = 16; - public Q00003_WillTheSealBeBroken() - { + public Q00003_WillTheSealBeBroken() { super(3, Q00003_WillTheSealBeBroken.class.getSimpleName(), "Will the Seal be Broken?"); addStartNpc(TALLOTH); addTalkId(TALLOTH); @@ -59,17 +57,14 @@ public class Q00003_WillTheSealBeBroken extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "30141-03.htm": st.startQuest(); break; @@ -83,16 +78,13 @@ public class Q00003_WillTheSealBeBroken extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance member = getRandomPartyMember(player, 1); - if (member == null) - { + if (member == null) { return super.onKill(npc, player, isSummon); } final QuestState st = getQuestState(member, false); - switch (npc.getId()) - { + switch (npc.getId()) { case OMEN_BEAST: giveItem(member, st, OMEN_BEAST_EYE, getRegisteredItemIds()); break; @@ -110,22 +102,17 @@ public class Q00003_WillTheSealBeBroken extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getRace() != Race.DARK_ELF) ? "30141-00.htm" : (player.getLevel() >= MIN_LEVEL) ? "30141-02.htm" : "30141-01.html"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "30141-04.html"; - } - else - { + } else { giveItems(player, ENCHANT, 1); st.exitQuest(false, true); htmltext = "30141-06.html"; @@ -138,14 +125,11 @@ public class Q00003_WillTheSealBeBroken extends Quest return htmltext; } - private static void giveItem(L2PcInstance player, QuestState st, int item, int... items) - { - if (!hasQuestItems(player, item)) - { + private static void giveItem(L2PcInstance player, QuestState st, int item, int... items) { + if (!hasQuestItems(player, item)) { giveItems(player, item, 1); playSound(player, Sound.ITEMSOUND_QUEST_ITEMGET); - if (hasQuestItems(player, items)) - { + if (hasQuestItems(player, items)) { st.setCond(2, true); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00004_LongLiveThePaagrioLord/Q00004_LongLiveThePaagrioLord.java b/src/main/java/com/l2jserver/datapack/quests/Q00004_LongLiveThePaagrioLord/Q00004_LongLiveThePaagrioLord.java index 844ef22b14..eb2bf88317 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00004_LongLiveThePaagrioLord/Q00004_LongLiveThePaagrioLord.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00004_LongLiveThePaagrioLord/Q00004_LongLiveThePaagrioLord.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.network.NpcStringId; * Long Live the Pa'agrio Lord (4) * @author malyelfik */ -public class Q00004_LongLiveThePaagrioLord extends Quest -{ +public class Q00004_LongLiveThePaagrioLord extends Quest { // NPCs private static final int KUNAI = 30559; private static final int USKA = 30560; @@ -52,8 +51,7 @@ public class Q00004_LongLiveThePaagrioLord extends Quest // Misc private static final int MIN_LEVEL = 2; - public Q00004_LongLiveThePaagrioLord() - { + public Q00004_LongLiveThePaagrioLord() { super(4, Q00004_LongLiveThePaagrioLord.class.getSimpleName(), "Long Live the Pa'agrio Lord"); addStartNpc(NAKUSIN); addTalkId(NAKUSIN, VARKEES, URUTU, HESTUI, KUNAI, USKA, GROOKIN); @@ -61,17 +59,14 @@ public class Q00004_LongLiveThePaagrioLord extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "30578-03.htm": st.startQuest(); break; @@ -85,25 +80,19 @@ public class Q00004_LongLiveThePaagrioLord extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case NAKUSIN: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getRace() != Race.ORC) ? "30578-00.htm" : (player.getLevel() >= MIN_LEVEL) ? "30578-02.htm" : "30578-01.htm"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "30578-04.html"; - } - else - { + } else { giveItems(player, CLUB, 1); // Newbie Guide showOnScreenMsg(player, NpcStringId.DELIVERY_DUTY_COMPLETE_N_GO_FIND_THE_NEWBIE_GUIDE, 2, 5000); @@ -140,20 +129,15 @@ public class Q00004_LongLiveThePaagrioLord extends Quest return htmltext; } - private static String giveItem(L2PcInstance player, QuestState st, int npcId, int itemId, int... items) - { - if (!st.isStarted()) - { + private static String giveItem(L2PcInstance player, QuestState st, int npcId, int itemId, int... items) { + if (!st.isStarted()) { return getNoQuestMsg(player); - } - else if (hasQuestItems(player, itemId)) - { + } else if (hasQuestItems(player, itemId)) { return npcId + "-02.html"; } giveItems(player, itemId, 1); playSound(player, Sound.ITEMSOUND_QUEST_ITEMGET); - if (hasQuestItems(player, items)) - { + if (hasQuestItems(player, items)) { st.setCond(2, true); } return npcId + "-01.html"; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00005_MinersFavor/Q00005_MinersFavor.java b/src/main/java/com/l2jserver/datapack/quests/Q00005_MinersFavor/Q00005_MinersFavor.java index a1afa4fc09..0aa4c83ab7 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00005_MinersFavor/Q00005_MinersFavor.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00005_MinersFavor/Q00005_MinersFavor.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.network.NpcStringId; * Miner's Favor (5) * @author malyelfik */ -public class Q00005_MinersFavor extends Quest -{ +public class Q00005_MinersFavor extends Quest { // NPCs private static final int BOLTER = 30554; private static final int SHARI = 30517; @@ -49,8 +48,7 @@ public class Q00005_MinersFavor extends Quest // Misc private static final int MIN_LEVEL = 2; - public Q00005_MinersFavor() - { + public Q00005_MinersFavor() { super(5, Q00005_MinersFavor.class.getSimpleName(), "Miner's Favor"); addStartNpc(BOLTER); addTalkId(BOLTER, SHARI, GARITA, REED, BRUNON); @@ -58,25 +56,21 @@ public class Q00005_MinersFavor extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "30554-03.htm": st.startQuest(); giveItems(player, BOLTERS_LIST, 1); giveItems(player, BOLTERS_SMELLY_SOCKS, 1); break; case "30526-02.html": - if (!hasQuestItems(player, BOLTERS_SMELLY_SOCKS)) - { + if (!hasQuestItems(player, BOLTERS_SMELLY_SOCKS)) { return "30526-04.html"; } takeItems(player, BOLTERS_SMELLY_SOCKS, -1); @@ -93,25 +87,19 @@ public class Q00005_MinersFavor extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case BOLTER: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? "30554-02.htm" : "30554-01.html"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "30554-04.html"; - } - else - { + } else { giveAdena(player, 2466, true); addExpAndSp(player, 5672, 446); giveItems(player, NECKLACE, 1); @@ -127,8 +115,7 @@ public class Q00005_MinersFavor extends Quest } break; case BRUNON: - if (st.isStarted()) - { + if (st.isStarted()) { htmltext = (hasQuestItems(player, MINERS_PICK)) ? "30526-03.html" : "30526-01.html"; } break; @@ -145,22 +132,16 @@ public class Q00005_MinersFavor extends Quest return htmltext; } - private static void checkProgress(L2PcInstance player, QuestState st) - { - if (hasQuestItems(player, BOLTERS_LIST, MINING_BOOTS, MINERS_PICK, BOOMBOOM_POWDER, REDSTONE_BEER)) - { + private static void checkProgress(L2PcInstance player, QuestState st) { + if (hasQuestItems(player, BOLTERS_LIST, MINING_BOOTS, MINERS_PICK, BOOMBOOM_POWDER, REDSTONE_BEER)) { st.setCond(2, true); } } - private static String giveItem(L2PcInstance player, QuestState st, int npcId, int itemId) - { - if (!st.isStarted()) - { + private static String giveItem(L2PcInstance player, QuestState st, int npcId, int itemId) { + if (!st.isStarted()) { return getNoQuestMsg(st.getPlayer()); - } - else if (hasQuestItems(player, itemId)) - { + } else if (hasQuestItems(player, itemId)) { return npcId + "-02.html"; } giveItems(player, itemId, 1); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00006_StepIntoTheFuture/Q00006_StepIntoTheFuture.java b/src/main/java/com/l2jserver/datapack/quests/Q00006_StepIntoTheFuture/Q00006_StepIntoTheFuture.java index a9e7918de8..f9e221ff4d 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00006_StepIntoTheFuture/Q00006_StepIntoTheFuture.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00006_StepIntoTheFuture/Q00006_StepIntoTheFuture.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * Step Into the Future (6) * @author malyelfik */ -public class Q00006_StepIntoTheFuture extends Quest -{ +public class Q00006_StepIntoTheFuture extends Quest { // NPCs private static final int ROXXY = 30006; private static final int BAULRO = 30033; @@ -42,8 +41,7 @@ public class Q00006_StepIntoTheFuture extends Quest // Misc private static final int MIN_LEVEL = 3; - public Q00006_StepIntoTheFuture() - { + public Q00006_StepIntoTheFuture() { super(6, Q00006_StepIntoTheFuture.class.getSimpleName(), "Step Into the Future"); addStartNpc(ROXXY); addTalkId(ROXXY, BAULRO, SIR_COLLIN); @@ -51,17 +49,14 @@ public class Q00006_StepIntoTheFuture extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "30006-03.htm": st.startQuest(); break; @@ -75,8 +70,7 @@ public class Q00006_StepIntoTheFuture extends Quest st.giveItems(BAULRO_LETTER, 1); break; case "30311-02.html": - if (!st.hasQuestItems(BAULRO_LETTER)) - { + if (!st.hasQuestItems(BAULRO_LETTER)) { return "30311-03.html"; } st.takeItems(BAULRO_LETTER, -1); @@ -90,25 +84,19 @@ public class Q00006_StepIntoTheFuture extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case ROXXY: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = ((player.getRace() == Race.HUMAN) && (player.getLevel() >= MIN_LEVEL)) ? "30006-02.htm" : "30006-01.html"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "30006-04.html"; - } - else if (st.isCond(3)) - { + } else if (st.isCond(3)) { htmltext = "30006-05.html"; } break; @@ -118,27 +106,19 @@ public class Q00006_StepIntoTheFuture extends Quest } break; case BAULRO: - if (st.isStarted()) - { - if (st.isCond(1)) - { + if (st.isStarted()) { + if (st.isCond(1)) { htmltext = "30033-01.html"; - } - else if (st.isCond(2)) - { + } else if (st.isCond(2)) { htmltext = "30033-03.html"; } } break; case SIR_COLLIN: - if (st.isStarted()) - { - if (st.isCond(2)) - { + if (st.isStarted()) { + if (st.isCond(2)) { htmltext = "30311-01.html"; - } - else if (st.isCond(3)) - { + } else if (st.isCond(3)) { htmltext = "30311-04.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00007_ATripBegins/Q00007_ATripBegins.java b/src/main/java/com/l2jserver/datapack/quests/Q00007_ATripBegins/Q00007_ATripBegins.java index 86f1dfda36..6c60d2b364 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00007_ATripBegins/Q00007_ATripBegins.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00007_ATripBegins/Q00007_ATripBegins.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * A Trip Begins (7) * @author malyelfik */ -public class Q00007_ATripBegins extends Quest -{ +public class Q00007_ATripBegins extends Quest { // NPCs private static final int MIRABEL = 30146; private static final int ARIEL = 30148; @@ -42,8 +41,7 @@ public class Q00007_ATripBegins extends Quest // Misc private static final int MIN_LEVEL = 3; - public Q00007_ATripBegins() - { + public Q00007_ATripBegins() { super(7, Q00007_ATripBegins.class.getSimpleName(), "A Trip Begins"); addStartNpc(MIRABEL); addTalkId(MIRABEL, ARIEL, ASTERIOS); @@ -51,17 +49,14 @@ public class Q00007_ATripBegins extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "30146-03.htm": st.startQuest(); break; @@ -75,8 +70,7 @@ public class Q00007_ATripBegins extends Quest st.giveItems(ARIELS_RECOMMENDATION, 1); break; case "30154-02.html": - if (!st.hasQuestItems(ARIELS_RECOMMENDATION)) - { + if (!st.hasQuestItems(ARIELS_RECOMMENDATION)) { return "30154-03.html"; } st.takeItems(ARIELS_RECOMMENDATION, -1); @@ -90,25 +84,19 @@ public class Q00007_ATripBegins extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case MIRABEL: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = ((player.getRace() == Race.ELF) && (player.getLevel() >= MIN_LEVEL)) ? "30146-01.htm" : "30146-02.html"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "30146-04.html"; - } - else if (st.isCond(3)) - { + } else if (st.isCond(3)) { htmltext = "30146-05.html"; } break; @@ -118,27 +106,19 @@ public class Q00007_ATripBegins extends Quest } break; case ARIEL: - if (st.isStarted()) - { - if (st.isCond(1)) - { + if (st.isStarted()) { + if (st.isCond(1)) { htmltext = "30148-01.html"; - } - else if (st.isCond(2)) - { + } else if (st.isCond(2)) { htmltext = "30148-03.html"; } } break; case ASTERIOS: - if (st.isStarted()) - { - if (st.isCond(2)) - { + if (st.isStarted()) { + if (st.isCond(2)) { htmltext = "30154-01.html"; - } - else if (st.isCond(3)) - { + } else if (st.isCond(3)) { htmltext = "30154-04.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00008_AnAdventureBegins/Q00008_AnAdventureBegins.java b/src/main/java/com/l2jserver/datapack/quests/Q00008_AnAdventureBegins/Q00008_AnAdventureBegins.java index 2fd7aa628b..1f17494c79 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00008_AnAdventureBegins/Q00008_AnAdventureBegins.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00008_AnAdventureBegins/Q00008_AnAdventureBegins.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * An Adventure Begins (8) * @author malyelfik */ -public class Q00008_AnAdventureBegins extends Quest -{ +public class Q00008_AnAdventureBegins extends Quest { // NPCs private static final int JASMINE = 30134; private static final int ROSELYN = 30355; @@ -42,8 +41,7 @@ public class Q00008_AnAdventureBegins extends Quest // Misc private static final int MIN_LEVEL = 3; - public Q00008_AnAdventureBegins() - { + public Q00008_AnAdventureBegins() { super(8, Q00008_AnAdventureBegins.class.getSimpleName(), "An Adventure Begins"); addStartNpc(JASMINE); addTalkId(JASMINE, ROSELYN, HARNE); @@ -51,17 +49,14 @@ public class Q00008_AnAdventureBegins extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "30134-03.htm": st.startQuest(); break; @@ -75,8 +70,7 @@ public class Q00008_AnAdventureBegins extends Quest st.giveItems(ROSELYNS_NOTE, 1); break; case "30144-02.html": - if (!st.hasQuestItems(ROSELYNS_NOTE)) - { + if (!st.hasQuestItems(ROSELYNS_NOTE)) { return "30144-03.html"; } st.takeItems(ROSELYNS_NOTE, -1); @@ -90,25 +84,19 @@ public class Q00008_AnAdventureBegins extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case JASMINE: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = ((player.getRace() == Race.DARK_ELF) && (player.getLevel() >= MIN_LEVEL)) ? "30134-02.htm" : "30134-01.html"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "30134-04.html"; - } - else if (st.isCond(3)) - { + } else if (st.isCond(3)) { htmltext = "30134-05.html"; } break; @@ -118,27 +106,19 @@ public class Q00008_AnAdventureBegins extends Quest } break; case ROSELYN: - if (st.isStarted()) - { - if (st.isCond(1)) - { + if (st.isStarted()) { + if (st.isCond(1)) { htmltext = "30355-01.html"; - } - else if (st.isCond(2)) - { + } else if (st.isCond(2)) { htmltext = "30355-03.html"; } } break; case HARNE: - if (st.isStarted()) - { - if (st.isCond(2)) - { + if (st.isStarted()) { + if (st.isCond(2)) { htmltext = "30144-01.html"; - } - else if (st.isCond(3)) - { + } else if (st.isCond(3)) { htmltext = "30144-04.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00009_IntoTheCityOfHumans/Q00009_IntoTheCityOfHumans.java b/src/main/java/com/l2jserver/datapack/quests/Q00009_IntoTheCityOfHumans/Q00009_IntoTheCityOfHumans.java index 70bae38d9c..776f48a742 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00009_IntoTheCityOfHumans/Q00009_IntoTheCityOfHumans.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00009_IntoTheCityOfHumans/Q00009_IntoTheCityOfHumans.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * Into the City of Humans (9) * @author malyelfik */ -public class Q00009_IntoTheCityOfHumans extends Quest -{ +public class Q00009_IntoTheCityOfHumans extends Quest { // NPCs private static final int PETUKAI = 30583; private static final int TANAPI = 30571; @@ -41,25 +40,21 @@ public class Q00009_IntoTheCityOfHumans extends Quest // Misc private static final int MIN_LEVEL = 3; - public Q00009_IntoTheCityOfHumans() - { + public Q00009_IntoTheCityOfHumans() { super(9, Q00009_IntoTheCityOfHumans.class.getSimpleName(), "Into the City of Humans"); addStartNpc(PETUKAI); addTalkId(PETUKAI, TANAPI, TAMIL); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "30583-04.htm": st.startQuest(); break; @@ -79,21 +74,17 @@ public class Q00009_IntoTheCityOfHumans extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case PETUKAI: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? (player.getRace() == Race.ORC) ? "30583-01.htm" : "30583-02.html" : "30583-03.html"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "30583-05.html"; } break; @@ -103,14 +94,12 @@ public class Q00009_IntoTheCityOfHumans extends Quest } break; case TANAPI: - if (st.isStarted()) - { + if (st.isStarted()) { htmltext = (st.isCond(1)) ? "30571-01.html" : "30571-03.html"; } break; case TAMIL: - if (st.isStarted() && st.isCond(2)) - { + if (st.isStarted() && st.isCond(2)) { htmltext = "30576-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00010_IntoTheWorld/Q00010_IntoTheWorld.java b/src/main/java/com/l2jserver/datapack/quests/Q00010_IntoTheWorld/Q00010_IntoTheWorld.java index f725780e19..fd6a9ced6f 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00010_IntoTheWorld/Q00010_IntoTheWorld.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00010_IntoTheWorld/Q00010_IntoTheWorld.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * Into the World (10) * @author malyelfik */ -public class Q00010_IntoTheWorld extends Quest -{ +public class Q00010_IntoTheWorld extends Quest { // NPCs private static final int REED = 30520; private static final int BALANKI = 30533; @@ -42,8 +41,7 @@ public class Q00010_IntoTheWorld extends Quest // Misc private static final int MIN_LEVEL = 3; - public Q00010_IntoTheWorld() - { + public Q00010_IntoTheWorld() { super(10, Q00010_IntoTheWorld.class.getSimpleName(), "Into the World"); addStartNpc(BALANKI); addTalkId(BALANKI, REED, GERALD); @@ -51,17 +49,14 @@ public class Q00010_IntoTheWorld extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "30533-03.htm": st.startQuest(); break; @@ -78,8 +73,7 @@ public class Q00010_IntoTheWorld extends Quest st.setCond(4, true); break; case "30650-02.html": - if (!st.hasQuestItems(VERY_EXPENSIVE_NECKLACE)) - { + if (!st.hasQuestItems(VERY_EXPENSIVE_NECKLACE)) { return "30650-03.html"; } st.takeItems(VERY_EXPENSIVE_NECKLACE, -1); @@ -93,25 +87,19 @@ public class Q00010_IntoTheWorld extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case BALANKI: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = ((player.getLevel() >= MIN_LEVEL) && (player.getRace() == Race.DWARF)) ? "30533-01.htm" : "30533-02.html"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "30533-04.html"; - } - else if (st.isCond(4)) - { + } else if (st.isCond(4)) { htmltext = "30533-05.html"; } break; @@ -121,10 +109,8 @@ public class Q00010_IntoTheWorld extends Quest } break; case REED: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: htmltext = "30520-01.html"; break; @@ -141,14 +127,10 @@ public class Q00010_IntoTheWorld extends Quest } break; case GERALD: - if (st.isStarted()) - { - if (st.isCond(2)) - { + if (st.isStarted()) { + if (st.isCond(2)) { htmltext = "30650-01.html"; - } - else if (st.isCond(3)) - { + } else if (st.isCond(3)) { htmltext = "30650-04.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00011_SecretMeetingWithKetraOrcs/Q00011_SecretMeetingWithKetraOrcs.java b/src/main/java/com/l2jserver/datapack/quests/Q00011_SecretMeetingWithKetraOrcs/Q00011_SecretMeetingWithKetraOrcs.java index bf9c89af39..b69e2510e5 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00011_SecretMeetingWithKetraOrcs/Q00011_SecretMeetingWithKetraOrcs.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00011_SecretMeetingWithKetraOrcs/Q00011_SecretMeetingWithKetraOrcs.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * @author ivantotov * @since 2.6.0.0 */ -public final class Q00011_SecretMeetingWithKetraOrcs extends Quest -{ +public final class Q00011_SecretMeetingWithKetraOrcs extends Quest { // NPCs private static final int LEON = 31256; private static final int CADMON = 31296; @@ -39,8 +38,7 @@ public final class Q00011_SecretMeetingWithKetraOrcs extends Quest // Misc private static final int MIN_LEVEL = 74; - public Q00011_SecretMeetingWithKetraOrcs() - { + public Q00011_SecretMeetingWithKetraOrcs() { super(11, Q00011_SecretMeetingWithKetraOrcs.class.getSimpleName(), "Secret Meeting With Ketra Orcs"); addStartNpc(CADMON); addTalkId(CADMON, LEON, WAHKAN); @@ -48,42 +46,33 @@ public final class Q00011_SecretMeetingWithKetraOrcs extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "31296-03.htm": - { + switch (event) { + case "31296-03.htm": { qs.startQuest(); qs.setMemoState(11); htmltext = event; break; } - case "31256-02.html": - { + case "31256-02.html": { giveItems(player, MUNITIONS_BOX, 1); qs.setMemoState(21); qs.setCond(2, true); htmltext = event; break; } - case "31371-02.html": - { - if (hasQuestItems(player, MUNITIONS_BOX)) - { + case "31371-02.html": { + if (hasQuestItems(player, MUNITIONS_BOX)) { addExpAndSp(player, 82045, 6047); qs.exitQuest(false, true); htmltext = event; - } - else - { + } else { htmltext = "31371-03.html"; } break; @@ -93,49 +82,31 @@ public final class Q00011_SecretMeetingWithKetraOrcs extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == CADMON) - { + if (qs.isCreated()) { + if (npc.getId() == CADMON) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "31296-01.htm" : "31296-02.html"; } - } - else if (qs.isStarted()) - { - if (npc.getId() == CADMON) - { - if (qs.isMemoState(11)) - { + } else if (qs.isStarted()) { + if (npc.getId() == CADMON) { + if (qs.isMemoState(11)) { htmltext = "31296-04.html"; } - } - else if (npc.getId() == LEON) - { - if (qs.isMemoState(11)) - { + } else if (npc.getId() == LEON) { + if (qs.isMemoState(11)) { htmltext = "31256-01.html"; - } - else if (qs.isMemoState(21)) - { + } else if (qs.isMemoState(21)) { htmltext = "31256-03.html"; } - } - else if (npc.getId() == WAHKAN) - { - if (hasQuestItems(player, MUNITIONS_BOX) && qs.isMemoState(21)) - { + } else if (npc.getId() == WAHKAN) { + if (hasQuestItems(player, MUNITIONS_BOX) && qs.isMemoState(21)) { htmltext = "31371-01.html"; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == CADMON) - { + } else if (qs.isCompleted()) { + if (npc.getId() == CADMON) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00012_SecretMeetingWithVarkaSilenos/Q00012_SecretMeetingWithVarkaSilenos.java b/src/main/java/com/l2jserver/datapack/quests/Q00012_SecretMeetingWithVarkaSilenos/Q00012_SecretMeetingWithVarkaSilenos.java index 537128d18e..83cfd9d5ea 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00012_SecretMeetingWithVarkaSilenos/Q00012_SecretMeetingWithVarkaSilenos.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00012_SecretMeetingWithVarkaSilenos/Q00012_SecretMeetingWithVarkaSilenos.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * @author ivantotov * @since 2.6.0.0 */ -public final class Q00012_SecretMeetingWithVarkaSilenos extends Quest -{ +public final class Q00012_SecretMeetingWithVarkaSilenos extends Quest { // NPCs private static final int HELMUT = 31258; private static final int CADMON = 31296; @@ -39,8 +38,7 @@ public final class Q00012_SecretMeetingWithVarkaSilenos extends Quest // Misc private static final int MIN_LEVEL = 74; - public Q00012_SecretMeetingWithVarkaSilenos() - { + public Q00012_SecretMeetingWithVarkaSilenos() { super(12, Q00012_SecretMeetingWithVarkaSilenos.class.getSimpleName(), "Secret Meeting With Varka Silenos"); addStartNpc(CADMON); addTalkId(CADMON, HELMUT, NARAN_ASHANUK); @@ -48,42 +46,33 @@ public final class Q00012_SecretMeetingWithVarkaSilenos extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "31296-03.htm": - { + switch (event) { + case "31296-03.htm": { qs.startQuest(); qs.setMemoState(11); htmltext = event; break; } - case "31258-02.html": - { + case "31258-02.html": { giveItems(player, MUNITIONS_BOX, 1); qs.setMemoState(21); qs.setCond(2, true); htmltext = event; break; } - case "31378-02.html": - { - if (hasQuestItems(player, MUNITIONS_BOX)) - { + case "31378-02.html": { + if (hasQuestItems(player, MUNITIONS_BOX)) { addExpAndSp(player, 233125, 18142); qs.exitQuest(false, true); htmltext = event; - } - else - { + } else { htmltext = "31378-03.html"; } break; @@ -93,49 +82,31 @@ public final class Q00012_SecretMeetingWithVarkaSilenos extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == CADMON) - { + if (qs.isCreated()) { + if (npc.getId() == CADMON) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "31296-01.htm" : "31296-02.html"; } - } - else if (qs.isStarted()) - { - if (npc.getId() == CADMON) - { - if (qs.isMemoState(11)) - { + } else if (qs.isStarted()) { + if (npc.getId() == CADMON) { + if (qs.isMemoState(11)) { htmltext = "31296-04.html"; } - } - else if (npc.getId() == HELMUT) - { - if (qs.isMemoState(11)) - { + } else if (npc.getId() == HELMUT) { + if (qs.isMemoState(11)) { htmltext = "31258-01.html"; - } - else if (qs.isMemoState(21)) - { + } else if (qs.isMemoState(21)) { htmltext = "31258-03.html"; } - } - else if (npc.getId() == NARAN_ASHANUK) - { - if (hasQuestItems(player, MUNITIONS_BOX) && qs.isMemoState(21)) - { + } else if (npc.getId() == NARAN_ASHANUK) { + if (hasQuestItems(player, MUNITIONS_BOX) && qs.isMemoState(21)) { htmltext = "31378-01.html"; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == CADMON) - { + } else if (qs.isCompleted()) { + if (npc.getId() == CADMON) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00013_ParcelDelivery/Q00013_ParcelDelivery.java b/src/main/java/com/l2jserver/datapack/quests/Q00013_ParcelDelivery/Q00013_ParcelDelivery.java index 569e31b6ef..07c62a405f 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00013_ParcelDelivery/Q00013_ParcelDelivery.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00013_ParcelDelivery/Q00013_ParcelDelivery.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * @author ivantotov * @since 2.6.0.0 */ -public final class Q00013_ParcelDelivery extends Quest -{ +public final class Q00013_ParcelDelivery extends Quest { // NPCs private static final int FUNDIN = 31274; private static final int VULCAN = 31539; @@ -38,8 +37,7 @@ public final class Q00013_ParcelDelivery extends Quest // Misc private static final int MIN_LEVEL = 74; - public Q00013_ParcelDelivery() - { + public Q00013_ParcelDelivery() { super(13, Q00013_ParcelDelivery.class.getSimpleName(), "Parcel Delivery"); addStartNpc(FUNDIN); addTalkId(FUNDIN, VULCAN); @@ -47,36 +45,28 @@ public final class Q00013_ParcelDelivery extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "31274-03.htm": - { + switch (event) { + case "31274-03.htm": { qs.startQuest(); qs.setMemoState(11); giveItems(player, PACKAGE_TO_VULCAN, 1); htmltext = event; break; } - case "31539-02.html": - { - if (hasQuestItems(player, PACKAGE_TO_VULCAN)) - { + case "31539-02.html": { + if (hasQuestItems(player, PACKAGE_TO_VULCAN)) { giveAdena(player, 157834, true); addExpAndSp(player, 589092, 58794); qs.exitQuest(false, true); htmltext = event; - } - else - { + } else { htmltext = "31539-03.html"; } break; @@ -86,38 +76,25 @@ public final class Q00013_ParcelDelivery extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == FUNDIN) - { + if (qs.isCreated()) { + if (npc.getId() == FUNDIN) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "31274-01.htm" : "31274-02.html"; } - } - else if (qs.isStarted()) - { - if (npc.getId() == FUNDIN) - { - if (qs.isMemoState(11)) - { + } else if (qs.isStarted()) { + if (npc.getId() == FUNDIN) { + if (qs.isMemoState(11)) { htmltext = "31274-04.html"; } - } - else if (npc.getId() == VULCAN) - { - if (hasQuestItems(player, PACKAGE_TO_VULCAN) && qs.isMemoState(11)) - { + } else if (npc.getId() == VULCAN) { + if (hasQuestItems(player, PACKAGE_TO_VULCAN) && qs.isMemoState(11)) { htmltext = "31539-01.html"; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == FUNDIN) - { + } else if (qs.isCompleted()) { + if (npc.getId() == FUNDIN) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00014_WhereaboutsOfTheArchaeologist/Q00014_WhereaboutsOfTheArchaeologist.java b/src/main/java/com/l2jserver/datapack/quests/Q00014_WhereaboutsOfTheArchaeologist/Q00014_WhereaboutsOfTheArchaeologist.java index a01768750e..626fb47dcc 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00014_WhereaboutsOfTheArchaeologist/Q00014_WhereaboutsOfTheArchaeologist.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00014_WhereaboutsOfTheArchaeologist/Q00014_WhereaboutsOfTheArchaeologist.java @@ -29,16 +29,14 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by disKret. * @author nonom */ -public class Q00014_WhereaboutsOfTheArchaeologist extends Quest -{ +public class Q00014_WhereaboutsOfTheArchaeologist extends Quest { // NPCs private static final int LIESEL = 31263; private static final int GHOST_OF_ADVENTURER = 31538; // Item private static final int LETTER = 7253; - public Q00014_WhereaboutsOfTheArchaeologist() - { + public Q00014_WhereaboutsOfTheArchaeologist() { super(14, Q00014_WhereaboutsOfTheArchaeologist.class.getSimpleName(), "Whereabouts of the Archaeologist"); addStartNpc(LIESEL); addTalkId(LIESEL, GHOST_OF_ADVENTURER); @@ -46,30 +44,24 @@ public class Q00014_WhereaboutsOfTheArchaeologist extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { + switch (event) { case "31263-02.html": st.startQuest(); st.giveItems(LETTER, 1); break; case "31538-01.html": - if (st.isCond(1) && st.hasQuestItems(LETTER)) - { + if (st.isCond(1) && st.hasQuestItems(LETTER)) { st.giveAdena(136928, true); st.addExpAndSp(325881, 32524); st.exitQuest(false, true); - } - else - { + } else { htmltext = "31538-02.html"; } break; @@ -78,27 +70,22 @@ public class Q00014_WhereaboutsOfTheArchaeologist extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); final int npcId = npc.getId(); - switch (st.getState()) - { + switch (st.getState()) { case State.COMPLETED: htmltext = getAlreadyCompletedMsg(player); break; case State.CREATED: - if (npcId == LIESEL) - { + if (npcId == LIESEL) { htmltext = (player.getLevel() < 74) ? "31263-01.html" : "31263-00.htm"; } break; case State.STARTED: - if (st.isCond(1)) - { - switch (npcId) - { + if (st.isCond(1)) { + switch (npcId) { case LIESEL: htmltext = "31263-02.html"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00015_SweetWhispers/Q00015_SweetWhispers.java b/src/main/java/com/l2jserver/datapack/quests/Q00015_SweetWhispers/Q00015_SweetWhispers.java index e011c28d0f..7171794577 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00015_SweetWhispers/Q00015_SweetWhispers.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00015_SweetWhispers/Q00015_SweetWhispers.java @@ -29,44 +29,37 @@ import com.l2jserver.gameserver.model.quest.State; * Original jython script by disKret. * @author nonom */ -public class Q00015_SweetWhispers extends Quest -{ +public class Q00015_SweetWhispers extends Quest { // NPCs private static final int VLADIMIR = 31302; private static final int HIERARCH = 31517; private static final int M_NECROMANCER = 31518; - public Q00015_SweetWhispers() - { + public Q00015_SweetWhispers() { super(15, Q00015_SweetWhispers.class.getSimpleName(), "Sweet Whispers"); addStartNpc(VLADIMIR); addTalkId(VLADIMIR, HIERARCH, M_NECROMANCER); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { + switch (event) { case "31302-01.html": st.startQuest(); break; case "31518-01.html": - if (st.isCond(1)) - { + if (st.isCond(1)) { st.setCond(2); } break; case "31517-01.html": - if (st.isCond(2)) - { + if (st.isCond(2)) { st.addExpAndSp(350531, 28204); st.exitQuest(false, true); } @@ -76,34 +69,28 @@ public class Q00015_SweetWhispers extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); final int npcId = npc.getId(); - switch (st.getState()) - { + switch (st.getState()) { case State.COMPLETED: htmltext = getAlreadyCompletedMsg(player); break; case State.CREATED: - if (npcId == VLADIMIR) - { + if (npcId == VLADIMIR) { htmltext = (player.getLevel() >= 60) ? "31302-00.htm" : "31302-00a.html"; } break; case State.STARTED: - switch (npcId) - { + switch (npcId) { case VLADIMIR: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "31302-01a.html"; } break; case M_NECROMANCER: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "31518-00.html"; break; @@ -113,8 +100,7 @@ public class Q00015_SweetWhispers extends Quest } break; case HIERARCH: - if (st.isCond(2)) - { + if (st.isCond(2)) { htmltext = "31517-00.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00016_TheComingDarkness/Q00016_TheComingDarkness.java b/src/main/java/com/l2jserver/datapack/quests/Q00016_TheComingDarkness/Q00016_TheComingDarkness.java index 39f77bf729..59f07f21be 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00016_TheComingDarkness/Q00016_TheComingDarkness.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00016_TheComingDarkness/Q00016_TheComingDarkness.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.State; * TODO: Zoey76: This quest is still not retail like, Altars AI is incomplete. * @author nonom */ -public class Q00016_TheComingDarkness extends Quest -{ +public class Q00016_TheComingDarkness extends Quest { // NPCs private static final int HIERARCH = 31517; private static final int EVIL_ALTAR_1 = 31512; @@ -43,8 +42,7 @@ public class Q00016_TheComingDarkness extends Quest // Item private static final int CRYSTAL_OF_SEAL = 7167; - public Q00016_TheComingDarkness() - { + public Q00016_TheComingDarkness() { super(16, Q00016_TheComingDarkness.class.getSimpleName(), "The Coming Darkness"); addStartNpc(HIERARCH); addTalkId(HIERARCH, EVIL_ALTAR_1, EVIL_ALTAR_2, EVIL_ALTAR_3, EVIL_ALTAR_4, EVIL_ALTAR_5); @@ -52,18 +50,15 @@ public class Q00016_TheComingDarkness extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return htmltext; } final int cond = st.getCond(); - switch (event) - { + switch (event) { case "31517-02.htm": st.startQuest(); st.giveItems(CRYSTAL_OF_SEAL, 5); @@ -74,8 +69,7 @@ public class Q00016_TheComingDarkness extends Quest case "31515-01.html": case "31516-01.html": final int npcId = Integer.parseInt(event.replace("-01.html", "")); - if ((cond == (npcId - 31511)) && st.hasQuestItems(CRYSTAL_OF_SEAL)) - { + if ((cond == (npcId - 31511)) && st.hasQuestItems(CRYSTAL_OF_SEAL)) { st.takeItems(CRYSTAL_OF_SEAL, 1); st.setCond(cond + 1, true); } @@ -85,18 +79,15 @@ public class Q00016_TheComingDarkness extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); final QuestState st2 = player.getQuestState(Q00017_LightAndDarkness.class.getSimpleName()); - if ((st2 != null) && !st2.isCompleted()) - { + if ((st2 != null) && !st2.isCompleted()) { return "31517-04.html"; } - switch (st.getState()) - { + switch (st.getState()) { case State.COMPLETED: htmltext = getAlreadyCompletedMsg(player); break; @@ -105,25 +96,17 @@ public class Q00016_TheComingDarkness extends Quest break; case State.STARTED: final int npcId = npc.getId(); - if (npcId == HIERARCH) - { - if (st.isCond(6)) - { + if (npcId == HIERARCH) { + if (st.isCond(6)) { st.addExpAndSp(865187, 69172); st.exitQuest(false, true); htmltext = "31517-03.html"; - } - else - { + } else { htmltext = "31517-02a.html"; } - } - else if ((npcId - 31511) == st.getCond()) - { + } else if ((npcId - 31511) == st.getCond()) { htmltext = npcId + "-00.html"; - } - else - { + } else { htmltext = npcId + "-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00017_LightAndDarkness/Q00017_LightAndDarkness.java b/src/main/java/com/l2jserver/datapack/quests/Q00017_LightAndDarkness/Q00017_LightAndDarkness.java index 73d1ba63a9..d81084ff84 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00017_LightAndDarkness/Q00017_LightAndDarkness.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00017_LightAndDarkness/Q00017_LightAndDarkness.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original jython script by disKret, Skeleton & DrLecter. * @author nonom */ -public class Q00017_LightAndDarkness extends Quest -{ +public class Q00017_LightAndDarkness extends Quest { // NPCs private static final int HIERARCH = 31517; private static final int SAINT_ALTAR_1 = 31508; @@ -41,8 +40,7 @@ public class Q00017_LightAndDarkness extends Quest // Item private static final int BLOOD_OF_SAINT = 7168; - public Q00017_LightAndDarkness() - { + public Q00017_LightAndDarkness() { super(17, Q00017_LightAndDarkness.class.getSimpleName(), "Light and Darkness"); addStartNpc(HIERARCH); addTalkId(HIERARCH, SAINT_ALTAR_1, SAINT_ALTAR_2, SAINT_ALTAR_3, SAINT_ALTAR_4); @@ -50,25 +48,19 @@ public class Q00017_LightAndDarkness extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { + switch (event) { case "31517-02.html": - if (player.getLevel() >= 61) - { + if (player.getLevel() >= 61) { st.startQuest(); st.giveItems(BLOOD_OF_SAINT, 4); - } - else - { + } else { htmltext = "31517-02a.html"; } break; @@ -78,8 +70,7 @@ public class Q00017_LightAndDarkness extends Quest case "31511-02.html": final int cond = st.getCond(); final int npcId = Integer.parseInt(event.replace("-02.html", "")); - if ((cond == (npcId - 31507)) && st.hasQuestItems(BLOOD_OF_SAINT)) - { + if ((cond == (npcId - 31507)) && st.hasQuestItems(BLOOD_OF_SAINT)) { htmltext = npcId + "-01.html"; st.takeItems(BLOOD_OF_SAINT, 1); st.setCond(cond + 1, true); @@ -90,12 +81,10 @@ public class Q00017_LightAndDarkness extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.COMPLETED: htmltext = getAlreadyCompletedMsg(player); break; @@ -105,15 +94,11 @@ public class Q00017_LightAndDarkness extends Quest case State.STARTED: final long blood = st.getQuestItemsCount(BLOOD_OF_SAINT); final int npcId = npc.getId(); - switch (npcId) - { + switch (npcId) { case HIERARCH: - if (st.getCond() < 5) - { + if (st.getCond() < 5) { htmltext = (blood >= 5) ? "31517-05.html" : "31517-04.html"; - } - else - { + } else { st.addExpAndSp(697040, 54887); st.exitQuest(false, true); htmltext = "31517-03.html"; @@ -123,12 +108,9 @@ public class Q00017_LightAndDarkness extends Quest case SAINT_ALTAR_2: case SAINT_ALTAR_3: case SAINT_ALTAR_4: - if ((npcId - 31507) == st.getCond()) - { + if ((npcId - 31507) == st.getCond()) { htmltext = npcId + ((blood > 0) ? "-00.html" : "-02.html"); - } - else if (st.getCond() > (npcId - 31507)) - { + } else if (st.getCond() > (npcId - 31507)) { htmltext = npcId + "-03.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00018_MeetingWithTheGoldenRam/Q00018_MeetingWithTheGoldenRam.java b/src/main/java/com/l2jserver/datapack/quests/Q00018_MeetingWithTheGoldenRam/Q00018_MeetingWithTheGoldenRam.java index 67224e9333..20a03c7b64 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00018_MeetingWithTheGoldenRam/Q00018_MeetingWithTheGoldenRam.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00018_MeetingWithTheGoldenRam/Q00018_MeetingWithTheGoldenRam.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original jython script by disKret. * @author nonom */ -public class Q00018_MeetingWithTheGoldenRam extends Quest -{ +public class Q00018_MeetingWithTheGoldenRam extends Quest { // NPCs private static final int DONAL = 31314; private static final int DAISY = 31315; @@ -38,8 +37,7 @@ public class Q00018_MeetingWithTheGoldenRam extends Quest // Item private static final int BOX = 7245; - public Q00018_MeetingWithTheGoldenRam() - { + public Q00018_MeetingWithTheGoldenRam() { super(18, Q00018_MeetingWithTheGoldenRam.class.getSimpleName(), "Meeting With The Golden Ram"); addStartNpc(DONAL); addTalkId(DONAL, DAISY, ABERCROMBIE); @@ -47,24 +45,18 @@ public class Q00018_MeetingWithTheGoldenRam extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { + switch (event) { case "31314-03.html": - if (player.getLevel() >= 66) - { + if (player.getLevel() >= 66) { st.startQuest(); - } - else - { + } else { htmltext = "31314-02.html"; } break; @@ -73,8 +65,7 @@ public class Q00018_MeetingWithTheGoldenRam extends Quest st.giveItems(BOX, 1); break; case "31555-02.html": - if (st.hasQuestItems(BOX)) - { + if (st.hasQuestItems(BOX)) { st.giveAdena(40000, true); st.addExpAndSp(126668, 11731); st.exitQuest(false, true); @@ -85,33 +76,25 @@ public class Q00018_MeetingWithTheGoldenRam extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); final int npcId = npc.getId(); - switch (st.getState()) - { + switch (st.getState()) { case State.COMPLETED: htmltext = getAlreadyCompletedMsg(player); break; case State.CREATED: - if (npcId == DONAL) - { + if (npcId == DONAL) { htmltext = "31314-01.htm"; } break; case State.STARTED: - if (npcId == DONAL) - { + if (npcId == DONAL) { htmltext = "31314-04.html"; - } - else if (npcId == DAISY) - { + } else if (npcId == DAISY) { htmltext = (st.getCond() < 2) ? "31315-01.html" : "31315-03.html"; - } - else if ((npcId == ABERCROMBIE) && st.isCond(2) && st.hasQuestItems(BOX)) - { + } else if ((npcId == ABERCROMBIE) && st.isCond(2) && st.hasQuestItems(BOX)) { htmltext = "31555-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00019_GoToThePastureland/Q00019_GoToThePastureland.java b/src/main/java/com/l2jserver/datapack/quests/Q00019_GoToThePastureland/Q00019_GoToThePastureland.java index 867bef554b..f7e08f6c41 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00019_GoToThePastureland/Q00019_GoToThePastureland.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00019_GoToThePastureland/Q00019_GoToThePastureland.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by disKret. * @author malyelfik */ -public class Q00019_GoToThePastureland extends Quest -{ +public class Q00019_GoToThePastureland extends Quest { // NPCs private static final int VLADIMIR = 31302; private static final int TUNATUN = 31537; @@ -38,8 +37,7 @@ public class Q00019_GoToThePastureland extends Quest private static final int VEAL = 15532; private static final int YOUNG_WILD_BEAST_MEAT = 7547; - public Q00019_GoToThePastureland() - { + public Q00019_GoToThePastureland() { super(19, Q00019_GoToThePastureland.class.getSimpleName(), "Go to the Pastureland"); addStartNpc(VLADIMIR); addTalkId(VLADIMIR, TUNATUN); @@ -47,39 +45,29 @@ public class Q00019_GoToThePastureland extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - if (event.equalsIgnoreCase("31302-02.htm")) - { + if (event.equalsIgnoreCase("31302-02.htm")) { st.startQuest(); st.giveItems(VEAL, 1); - } - else if (event.equalsIgnoreCase("31537-02.html")) - { - if (st.hasQuestItems(YOUNG_WILD_BEAST_MEAT)) - { + } else if (event.equalsIgnoreCase("31537-02.html")) { + if (st.hasQuestItems(YOUNG_WILD_BEAST_MEAT)) { st.giveAdena(50000, true); st.addExpAndSp(136766, 12688); st.exitQuest(false, true); htmltext = "31537-02.html"; - } - else if (st.hasQuestItems(VEAL)) - { + } else if (st.hasQuestItems(VEAL)) { st.giveAdena(147200, true); st.addExpAndSp(385040, 75250); st.exitQuest(false, true); htmltext = "31537-02.html"; - } - else - { + } else { htmltext = "31537-03.html"; } } @@ -87,21 +75,15 @@ public class Q00019_GoToThePastureland extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - if (npc.getId() == VLADIMIR) - { - switch (st.getState()) - { + if (npc.getId() == VLADIMIR) { + switch (st.getState()) { case State.CREATED: - if (player.getLevel() >= 82) - { + if (player.getLevel() >= 82) { htmltext = "31302-01.htm"; - } - else - { + } else { htmltext = "31302-03.html"; } break; @@ -112,9 +94,7 @@ public class Q00019_GoToThePastureland extends Quest htmltext = getAlreadyCompletedMsg(player); break; } - } - else if ((npc.getId() == TUNATUN) && (st.isCond(1))) - { + } else if ((npc.getId() == TUNATUN) && (st.isCond(1))) { htmltext = "31537-01.html"; } return htmltext; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00020_BringUpWithLove/Q00020_BringUpWithLove.java b/src/main/java/com/l2jserver/datapack/quests/Q00020_BringUpWithLove/Q00020_BringUpWithLove.java index f47c0c3afe..6cab250046 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00020_BringUpWithLove/Q00020_BringUpWithLove.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00020_BringUpWithLove/Q00020_BringUpWithLove.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.State; * Bring Up With Love (20) * @author Adry_85 */ -public class Q00020_BringUpWithLove extends Quest -{ +public class Q00020_BringUpWithLove extends Quest { // NPC private static final int TUNATUN = 31537; // Items @@ -38,25 +37,21 @@ public class Q00020_BringUpWithLove extends Quest // Misc private static final int MIN_LEVEL = 82; - public Q00020_BringUpWithLove() - { + public Q00020_BringUpWithLove() { super(20, Q00020_BringUpWithLove.class.getSimpleName(), "Bring Up With Love"); addStartNpc(TUNATUN); addTalkId(TUNATUN); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "31537-02.htm": case "31537-03.htm": case "31537-04.htm": @@ -66,21 +61,17 @@ public class Q00020_BringUpWithLove extends Quest case "31537-08.htm": case "31537-09.htm": case "31537-10.htm": - case "31537-12.htm": - { + case "31537-12.htm": { htmltext = event; break; } - case "31537-11.html": - { + case "31537-11.html": { st.startQuest(); htmltext = event; break; } - case "31537-16.html": - { - if (st.isCond(2) && st.hasQuestItems(INNOCENCE_JEWEL)) - { + case "31537-16.html": { + if (st.isCond(2) && st.hasQuestItems(INNOCENCE_JEWEL)) { st.giveItems(WATER_CRYSTAL, 1); st.takeItems(INNOCENCE_JEWEL, -1); st.exitQuest(false, true); @@ -93,14 +84,11 @@ public class Q00020_BringUpWithLove extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.COMPLETED: - { + switch (st.getState()) { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } @@ -108,15 +96,12 @@ public class Q00020_BringUpWithLove extends Quest htmltext = player.getLevel() >= MIN_LEVEL ? "31537-01.htm" : "31537-13.html"; break; case State.STARTED: - switch (st.getCond()) - { - case 1: - { + switch (st.getCond()) { + case 1: { htmltext = "31537-14.html"; break; } - case 2: - { + case 2: { htmltext = (!st.hasQuestItems(INNOCENCE_JEWEL)) ? "31537-14.html" : "31537-15.html"; break; } @@ -126,11 +111,9 @@ public class Q00020_BringUpWithLove extends Quest return htmltext; } - public static void checkJewelOfInnocence(L2PcInstance player) - { + public static void checkJewelOfInnocence(L2PcInstance player) { final QuestState st = player.getQuestState(Q00020_BringUpWithLove.class.getSimpleName()); - if ((st != null) && st.isCond(1) && !st.hasQuestItems(INNOCENCE_JEWEL) && (getRandom(100) < 5)) - { + if ((st != null) && st.isCond(1) && !st.hasQuestItems(INNOCENCE_JEWEL) && (getRandom(100) < 5)) { st.giveItems(INNOCENCE_JEWEL, 1); st.setCond(2, true); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00021_HiddenTruth/Q00021_HiddenTruth.java b/src/main/java/com/l2jserver/datapack/quests/Q00021_HiddenTruth/Q00021_HiddenTruth.java index 390660f33d..fa1e8c494a 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00021_HiddenTruth/Q00021_HiddenTruth.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00021_HiddenTruth/Q00021_HiddenTruth.java @@ -37,8 +37,7 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * Hidden Truth (21) * @author xban1x */ -public class Q00021_HiddenTruth extends Quest -{ +public class Q00021_HiddenTruth extends Quest { // NPCs private static final int INNOCENTIN = 31328; private static final int AGRIPEL = 31348; @@ -63,8 +62,7 @@ public class Q00021_HiddenTruth extends Quest private boolean PAGE_SPAWNED = false; private boolean MOVE_ENDED = false; - public Q00021_HiddenTruth() - { + public Q00021_HiddenTruth() { super(21, Q00021_HiddenTruth.class.getSimpleName(), "Hidden Truth"); addStartNpc(MYSTERIOUS_WIZARD); addTalkId(MYSTERIOUS_WIZARD, TOMBSTONE, GHOST_OF_VON_HELLMAN, GHOST_OF_VON_HELLMANS_PAGE, BROKEN_BOOKSHELF, AGRIPEL, BENEDICT, DOMINIC, INNOCENTIN); @@ -74,14 +72,11 @@ public class Q00021_HiddenTruth extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, false); String htmltext = null; - if (st != null) - { - switch (event) - { + if (st != null) { + switch (event) { case "31328-02.html": case "31328-03.html": case "31328-04.html": @@ -98,15 +93,12 @@ public class Q00021_HiddenTruth extends Quest case "31526-05.html": case "31526-06.html": case "31526-12.html": - case "31526-13.html": - { + case "31526-13.html": { htmltext = event; break; } - case "31328-05.html": - { - if (st.isCond(7)) - { + case "31328-05.html": { + if (st.isCond(7)) { st.giveItems(CROSS_OF_EINHASAD2, 1); st.addExpAndSp(131228, 11978); st.exitQuest(false, true); @@ -114,28 +106,20 @@ public class Q00021_HiddenTruth extends Quest } break; } - case "31522-02.htm": - { - if (player.getLevel() < MIN_LVL) - { + case "31522-02.htm": { + if (player.getLevel() < MIN_LVL) { htmltext = "31522-03.htm"; - } - else - { + } else { st.startQuest(); htmltext = event; } break; } - case "31523-03.html": - { - if (GHOST_SPAWNED) - { + case "31523-03.html": { + if (GHOST_SPAWNED) { htmltext = "31523-04.html"; st.playSound(Sound.SKILLSOUND_HORROR_2); - } - else - { + } else { final L2Npc ghost = addSpawn(GHOST_OF_VON_HELLMAN, GHOST_LOC, false, 0); ghost.broadcastPacket(new NpcSay(ghost.getObjectId(), 0, ghost.getId(), NpcStringId.WHO_AWOKE_ME)); GHOST_SPAWNED = true; @@ -146,10 +130,8 @@ public class Q00021_HiddenTruth extends Quest } break; } - case "31524-06.html": - { - if (PAGE_COUNT < 5) - { + case "31524-06.html": { + if (PAGE_COUNT < 5) { final L2Npc page = addSpawn(GHOST_OF_VON_HELLMANS_PAGE, PAGE_LOC, false, 0); page.setScriptValue(player.getObjectId()); page.broadcastPacket(new NpcSay(page.getObjectId(), Say2.NPC_ALL, page.getId(), NpcStringId.MY_MASTER_HAS_INSTRUCTED_ME_TO_BE_YOUR_GUIDE_S1).addStringParameter(player.getName())); @@ -157,54 +139,43 @@ public class Q00021_HiddenTruth extends Quest PAGE_COUNT++; st.setCond(3); htmltext = event; - } - else - { + } else { htmltext = "31524-06a.html"; } break; } - case "31526-03.html": - { + case "31526-03.html": { st.playSound(Sound.ITEMSOUND_ARMOR_CLOTH); htmltext = event; break; } - case "31526-07.html": - { + case "31526-07.html": { st.setCond(4); htmltext = event; break; } - case "31526-08.html": - { - if (!st.isCond(5)) - { + case "31526-08.html": { + if (!st.isCond(5)) { st.playSound(Sound.AMDSOUND_ED_CHIMES); st.setCond(5); htmltext = event; - } - else - { + } else { htmltext = "31526-09.html"; } break; } - case "31526-14.html": - { + case "31526-14.html": { st.giveItems(CROSS_OF_EINHASAD, 1); st.setCond(6); htmltext = event; break; } - case "DESPAWN_GHOST": - { + case "DESPAWN_GHOST": { GHOST_SPAWNED = false; npc.deleteMe(); break; } - case "DESPAWN": - { + case "DESPAWN": { PAGE_COUNT--; npc.deleteMe(); break; @@ -215,213 +186,151 @@ public class Q00021_HiddenTruth extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (npc.getId()) - { - case MYSTERIOUS_WIZARD: - { - switch (st.getState()) - { - case State.CREATED: - { + switch (npc.getId()) { + case MYSTERIOUS_WIZARD: { + switch (st.getState()) { + case State.CREATED: { htmltext = "31522-01.htm"; break; } - case State.STARTED: - { + case State.STARTED: { htmltext = "31522-05.html"; break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } } break; } - case TOMBSTONE: - { + case TOMBSTONE: { htmltext = "31523-01.html"; break; } - case GHOST_OF_VON_HELLMAN: - { - switch (st.getCond()) - { - case 2: - { + case GHOST_OF_VON_HELLMAN: { + switch (st.getCond()) { + case 2: { htmltext = "31524-01.html"; break; } - case 3: - { - if (PAGE_SPAWNED) - { + case 3: { + if (PAGE_SPAWNED) { htmltext = "31524-07b.html"; - } - else - { - if (PAGE_COUNT < 5) - { + } else { + if (PAGE_COUNT < 5) { final L2Npc PAGE = addSpawn(GHOST_OF_VON_HELLMANS_PAGE, PAGE_LOC, true, 0); PAGE_COUNT++; PAGE_SPAWNED = true; PAGE.setScriptValue(player.getObjectId()); WalkingManager.getInstance().startMoving(PAGE, PAGE_ROUTE_NAME); htmltext = "31524-07.html"; - } - else - { + } else { htmltext = "31524-07a.html"; } } break; } - case 4: - { + case 4: { htmltext = "31524-07c.html"; break; } } break; } - case GHOST_OF_VON_HELLMANS_PAGE: - { - if (st.isCond(3)) - { - if (MOVE_ENDED) - { + case GHOST_OF_VON_HELLMANS_PAGE: { + if (st.isCond(3)) { + if (MOVE_ENDED) { htmltext = "31525-02.html"; st.startQuestTimer("DESPAWN", 3000, npc); - } - else - { + } else { htmltext = "31525-01.html"; } } break; } - case BROKEN_BOOKSHELF: - { - switch (st.getCond()) - { - case 3: - { + case BROKEN_BOOKSHELF: { + switch (st.getCond()) { + case 3: { htmltext = "31526-01.html"; break; } - case 4: - { + case 4: { st.setCond(5); st.playSound(Sound.AMDSOUND_ED_CHIMES); htmltext = "31526-10.html"; break; } - case 5: - { + case 5: { htmltext = "31526-11.html"; break; } - case 6: - { + case 6: { htmltext = "31526-15.html"; break; } } break; } - case AGRIPEL: - { - if (st.hasQuestItems(CROSS_OF_EINHASAD) && st.isCond(6)) - { + case AGRIPEL: { + if (st.hasQuestItems(CROSS_OF_EINHASAD) && st.isCond(6)) { st.set("AGRIPEL", "1"); - if ((st.getInt("AGRIPEL") == 1) && (st.getInt("DOMINIC") == 1) && (st.getInt("BENEDICT") == 1)) - { + if ((st.getInt("AGRIPEL") == 1) && (st.getInt("DOMINIC") == 1) && (st.getInt("BENEDICT") == 1)) { htmltext = "31348-03.html"; st.setCond(7); - } - else if ((st.getInt("DOMINIC") == 1) || (st.getInt("BENEDICT") == 1)) - { + } else if ((st.getInt("DOMINIC") == 1) || (st.getInt("BENEDICT") == 1)) { htmltext = "31348-02.html"; - } - else - { + } else { htmltext = "31348-01.html"; } - } - else if (st.isCond(7)) - { + } else if (st.isCond(7)) { htmltext = "31348-03.html"; } break; } - case BENEDICT: - { - if (st.hasQuestItems(CROSS_OF_EINHASAD) && st.isCond(6)) - { + case BENEDICT: { + if (st.hasQuestItems(CROSS_OF_EINHASAD) && st.isCond(6)) { st.set("BENEDICT", "1"); - if ((st.getInt("AGRIPEL") == 1) && (st.getInt("DOMINIC") == 1) && (st.getInt("BENEDICT") == 1)) - { + if ((st.getInt("AGRIPEL") == 1) && (st.getInt("DOMINIC") == 1) && (st.getInt("BENEDICT") == 1)) { htmltext = "31349-03.html"; st.setCond(7); - } - else if ((st.getInt("AGRIPEL") == 1) || (st.getInt("DOMINIC") == 1)) - { + } else if ((st.getInt("AGRIPEL") == 1) || (st.getInt("DOMINIC") == 1)) { htmltext = "31349-02.html"; - } - else - { + } else { htmltext = "31349-01.html"; } - } - else if (st.isCond(7)) - { + } else if (st.isCond(7)) { htmltext = "31349-03.html"; } break; } - case DOMINIC: - { - if (st.hasQuestItems(CROSS_OF_EINHASAD) && st.isCond(6)) - { + case DOMINIC: { + if (st.hasQuestItems(CROSS_OF_EINHASAD) && st.isCond(6)) { st.set("DOMINIC", "1"); - if ((st.getInt("AGRIPEL") == 1) && (st.getInt("DOMINIC") == 1) && (st.getInt("BENEDICT") == 1)) - { + if ((st.getInt("AGRIPEL") == 1) && (st.getInt("DOMINIC") == 1) && (st.getInt("BENEDICT") == 1)) { htmltext = "31350-03.html"; st.setCond(7); - } - else if ((st.getInt("AGRIPEL") == 1) || (st.getInt("BENEDICT") == 1)) - { + } else if ((st.getInt("AGRIPEL") == 1) || (st.getInt("BENEDICT") == 1)) { htmltext = "31350-02.html"; - } - else - { + } else { htmltext = "31350-01.html"; } - } - else if (st.isCond(7)) - { + } else if (st.isCond(7)) { htmltext = "31350-03.html"; } break; } - case INNOCENTIN: - { - if (st.isCond(7) && st.hasQuestItems(CROSS_OF_EINHASAD)) - { + case INNOCENTIN: { + if (st.isCond(7) && st.hasQuestItems(CROSS_OF_EINHASAD)) { htmltext = "31328-01.html"; - } - else if (st.isCompleted()) - { + } else if (st.isCompleted()) { st = player.getQuestState(Q00022_TragedyInVonHellmannForest.class.getSimpleName()); - if (st == null) - { + if (st == null) { htmltext = "31328-06.html"; } } @@ -432,21 +341,17 @@ public class Q00021_HiddenTruth extends Quest } @Override - public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) - { - if (creature.isPlayer()) - { + public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) { + if (creature.isPlayer()) { playSound((L2PcInstance) creature, Sound.HORROR_01); } return super.onSeeCreature(npc, creature, isSummon); } @Override - public void onRouteFinished(L2Npc npc) - { + public void onRouteFinished(L2Npc npc) { final QuestState st = L2World.getInstance().getPlayer(npc.getScriptValue()).getQuestState(getName()); - if (st != null) - { + if (st != null) { st.startQuestTimer("DESPAWN", 15000, npc); MOVE_ENDED = true; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00022_TragedyInVonHellmannForest/Q00022_TragedyInVonHellmannForest.java b/src/main/java/com/l2jserver/datapack/quests/Q00022_TragedyInVonHellmannForest/Q00022_TragedyInVonHellmannForest.java index 3e27c121f5..9f9f10e5d5 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00022_TragedyInVonHellmannForest/Q00022_TragedyInVonHellmannForest.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00022_TragedyInVonHellmannForest/Q00022_TragedyInVonHellmannForest.java @@ -36,8 +36,7 @@ import com.l2jserver.gameserver.util.Util; * Tragedy in Von Hellmann Forest (22) * @author Joxit */ -public final class Q00022_TragedyInVonHellmannForest extends Quest -{ +public final class Q00022_TragedyInVonHellmannForest extends Quest { // NPCs private static final int INNOCENTIN = 31328; private static final int TIFAREN = 31334; @@ -45,8 +44,7 @@ public final class Q00022_TragedyInVonHellmannForest extends Quest private static final int GHOST_OF_PRIEST = 31528; private static final int GHOST_OF_ADVENTURER = 31529; // Mobs - private static final int[] MOBS = - { + private static final int[] MOBS = { 21553, // Trampled Man 21554, // Trampled Man 21555, // Slaughter Executioner @@ -69,8 +67,7 @@ public final class Q00022_TragedyInVonHellmannForest extends Quest private static int _tifarenOwner = 0; private static L2Npc _soulWellNpc = null; - public Q00022_TragedyInVonHellmannForest() - { + public Q00022_TragedyInVonHellmannForest() { super(22, Q00022_TragedyInVonHellmannForest.class.getSimpleName(), "Tragedy in Von Hellmann Forest"); addKillId(MOBS); addKillId(SOUL_OF_WELL); @@ -81,16 +78,13 @@ public final class Q00022_TragedyInVonHellmannForest extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { + switch (event) { case "31529-02.html": case "31529-04.html": case "31529-05.html": @@ -114,99 +108,75 @@ public final class Q00022_TragedyInVonHellmannForest extends Quest case "31328-16.html": case "31328-17.html": case "31328-18.html": - case "31334-12.html": - { + case "31334-12.html": { htmltext = event; break; } - case "31334-02.htm": - { - if (qs.isCreated()) - { + case "31334-02.htm": { + if (qs.isCreated()) { final QuestState q21 = player.getQuestState(Q00021_HiddenTruth.class.getSimpleName()); - if ((player.getLevel() >= MIN_LVL) && (q21 != null) && q21.isCompleted()) - { + if ((player.getLevel() >= MIN_LVL) && (q21 != null) && q21.isCompleted()) { htmltext = event; - } - else - { + } else { htmltext = "31334-03.html"; } } break; } - case "31334-04.html": - { - if (qs.isCreated()) - { + case "31334-04.html": { + if (qs.isCreated()) { qs.startQuest(); htmltext = event; } break; } - case "31334-06.html": - { - if (qs.isCond(3) && hasQuestItems(player, CROSS_OF_EINHASAD)) - { + case "31334-06.html": { + if (qs.isCond(3) && hasQuestItems(player, CROSS_OF_EINHASAD)) { htmltext = event; - } - else - { + } else { qs.setCond(2, true); htmltext = "31334-07.html"; } break; } - case "31334-08.html": - { - if (qs.isCond(3)) - { + case "31334-08.html": { + if (qs.isCond(3)) { qs.setCond(4, true); htmltext = event; } break; } - case "31334-13.html": - { + case "31334-13.html": { final int cond = qs.getCond(); - if (((5 <= cond) && (cond <= 7)) && hasQuestItems(player, CROSS_OF_EINHASAD)) - { - if (_tifarenOwner == 0) - { + if (((5 <= cond) && (cond <= 7)) && hasQuestItems(player, CROSS_OF_EINHASAD)) { + if (_tifarenOwner == 0) { _tifarenOwner = player.getObjectId(); final L2Npc ghost2 = addSpawn(GHOST_OF_PRIEST, PRIEST_LOC, true, 0); ghost2.setScriptValue(player.getObjectId()); qs.startQuestTimer("DESPAWN_GHOST2", 1000 * 120, ghost2); ghost2.broadcastPacket(new NpcSay(ghost2.getObjectId(), Say2.NPC_ALL, ghost2.getId(), NpcStringId.DID_YOU_CALL_ME_S1).addStringParameter(player.getName())); - if (((cond == 5) || (cond == 6)) && hasQuestItems(player, LOST_SKULL_OF_ELF)) - { + if (((cond == 5) || (cond == 6)) && hasQuestItems(player, LOST_SKULL_OF_ELF)) { takeItems(player, LOST_SKULL_OF_ELF, -1); qs.setCond(7, true); } htmltext = event; - } - else - { + } else { qs.setCond(6, true); htmltext = "31334-14.html"; } } break; } - case "31528-04.html": - { - if (npc.getScriptValue() == player.getObjectId()) - { + case "31528-04.html": { + if (npc.getScriptValue() == player.getObjectId()) { playSound(player, Sound.AMBSOUND_HORROR_03); htmltext = event; } break; } - case "31528-08.html": - { + case "31528-08.html": { QuestTimer qt = getQuestTimer("DESPAWN_GHOST2", npc, player); - if ((qt != null) && (npc.getScriptValue() == player.getObjectId())) - { + if ((qt != null) && (npc.getScriptValue() == player.getObjectId())) { qt.cancelAndRemove(); npc.setScriptValue(0); qs.startQuestTimer("DESPAWN_GHOST2", 1000 * 3, npc); @@ -215,109 +185,86 @@ public final class Q00022_TragedyInVonHellmannForest extends Quest } break; } - case "DESPAWN_GHOST2": - { + case "DESPAWN_GHOST2": { _tifarenOwner = 0; - if (npc.getScriptValue() != 0) - { + if (npc.getScriptValue() != 0) { npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.IM_CONFUSED_MAYBE_ITS_TIME_TO_GO_BACK)); } npc.deleteMe(); break; } - case "31328-03.html": - { - if (qs.isCond(8)) - { + case "31328-03.html": { + if (qs.isCond(8)) { takeItems(player, CROSS_OF_EINHASAD, -1); htmltext = event; } break; } - case "31328-09.html": - { - if (qs.isCond(8)) - { + case "31328-09.html": { + if (qs.isCond(8)) { giveItems(player, LETTER_OF_INNOCENTIN, 1); qs.setCond(9, true); htmltext = event; } break; } - case "31328-11.html": - { - if (qs.isCond(14) && hasQuestItems(player, REPORT_BOX)) - { + case "31328-11.html": { + if (qs.isCond(14) && hasQuestItems(player, REPORT_BOX)) { takeItems(player, REPORT_BOX, -1); qs.setCond(15, true); htmltext = event; } break; } - case "31328-19.html": - { - if (qs.isCond(15)) - { + case "31328-19.html": { + if (qs.isCond(15)) { qs.setCond(16, true); htmltext = event; } break; } - case "31527-02.html": - { - if (qs.isCond(10) && (_soulWellNpc == null)) - { + case "31527-02.html": { + if (qs.isCond(10) && (_soulWellNpc == null)) { _soulWellNpc = addSpawn(SOUL_OF_WELL, SOUL_WELL_LOC, true, 0); qs.startQuestTimer("activateSoulOfWell", 90000, _soulWellNpc); qs.startQuestTimer("despawnSoulOfWell", 120000, _soulWellNpc); _soulWellNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player); playSound(player, Sound.SKILLSOUND_ANTARAS_FEAR); htmltext = event; - } - else - { + } else { htmltext = "31527-03.html"; } break; } - case "activateSoulOfWell": - { + case "activateSoulOfWell": { // this enables onAttack ELSE IF block which allows the player to proceed the quest npc.setScriptValue(1); break; } - case "despawnSoulOfWell": - { + case "despawnSoulOfWell": { // if the player fails to proceed the quest in 2 minutes, the soul is unspawned - if (!npc.isDead()) - { + if (!npc.isDead()) { _soulWellNpc = null; } npc.deleteMe(); break; } - case "31529-03.html": - { - if (qs.isCond(9) && hasQuestItems(player, LETTER_OF_INNOCENTIN)) - { + case "31529-03.html": { + if (qs.isCond(9) && hasQuestItems(player, LETTER_OF_INNOCENTIN)) { qs.setMemoState(8); htmltext = event; } break; } - case "31529-08.html": - { - if (qs.isMemoState(8)) - { + case "31529-08.html": { + if (qs.isMemoState(8)) { qs.setMemoState(9); htmltext = event; } break; } - case "31529-11.html": - { - if (qs.isMemoState(9)) - { + case "31529-11.html": { + if (qs.isMemoState(9)) { giveItems(player, JEWEL_OF_ADVENTURER_1, 1); qs.setCond(10, true); qs.setMemoState(10); @@ -330,18 +277,13 @@ public final class Q00022_TragedyInVonHellmannForest extends Quest } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { final QuestState qs = getQuestState(attacker, false); - if ((qs != null) && qs.isCond(10) && hasQuestItems(attacker, JEWEL_OF_ADVENTURER_1)) - { - if (qs.isMemoState(10)) - { + if ((qs != null) && qs.isCond(10) && hasQuestItems(attacker, JEWEL_OF_ADVENTURER_1)) { + if (qs.isMemoState(10)) { qs.setMemoState(11); - } - else if (npc.isScriptValue(1)) - { + } else if (npc.isScriptValue(1)) { takeItems(attacker, JEWEL_OF_ADVENTURER_1, -1); giveItems(attacker, JEWEL_OF_ADVENTURER_2, 1); qs.setCond(11, true); @@ -351,19 +293,13 @@ public final class Q00022_TragedyInVonHellmannForest extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (Util.checkIfInRange(1500, killer, npc, true)) - { - if (npc.getId() == SOUL_OF_WELL) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (Util.checkIfInRange(1500, killer, npc, true)) { + if (npc.getId() == SOUL_OF_WELL) { _soulWellNpc = null; - } - else - { + } else { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isCond(4) && hasQuestItems(killer, CROSS_OF_EINHASAD) && !hasQuestItems(killer, LOST_SKULL_OF_ELF) && (getRandom(100) < 10)) - { + if ((qs != null) && qs.isCond(4) && hasQuestItems(killer, CROSS_OF_EINHASAD) && !hasQuestItems(killer, LOST_SKULL_OF_ELF) && (getRandom(100) < 10)) { giveItems(killer, LOST_SKULL_OF_ELF, 1); qs.setCond(5, true); } @@ -374,79 +310,54 @@ public final class Q00022_TragedyInVonHellmannForest extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (npc.getId()) - { - case TIFAREN: - { - switch (qs.getCond()) - { - case 0: - { - if (qs.isCreated()) - { + switch (npc.getId()) { + case TIFAREN: { + switch (qs.getCond()) { + case 0: { + if (qs.isCreated()) { htmltext = "31334-01.htm"; - } - else if (qs.isCompleted()) - { + } else if (qs.isCompleted()) { htmltext = getAlreadyCompletedMsg(talker); } break; } case 1: - case 3: - { + case 3: { htmltext = "31334-05.html"; break; } case 4: - case 5: - { - if (hasQuestItems(talker, CROSS_OF_EINHASAD)) - { - if (!hasQuestItems(talker, LOST_SKULL_OF_ELF)) - { + case 5: { + if (hasQuestItems(talker, CROSS_OF_EINHASAD)) { + if (!hasQuestItems(talker, LOST_SKULL_OF_ELF)) { htmltext = "31334-09.html"; - } - else if (_tifarenOwner == 0) - { + } else if (_tifarenOwner == 0) { htmltext = "31334-10.html"; - } - else - { + } else { htmltext = "31334-11.html"; } } break; } case 6: - case 7: - { - if (hasQuestItems(talker, CROSS_OF_EINHASAD)) - { - if (_tifarenOwner == 0) - { + case 7: { + if (hasQuestItems(talker, CROSS_OF_EINHASAD)) { + if (_tifarenOwner == 0) { htmltext = "31334-17.html"; - } - else if (_tifarenOwner == talker.getObjectId()) - { + } else if (_tifarenOwner == talker.getObjectId()) { htmltext = "31334-15.html"; - } - else - { + } else { htmltext = "31334-16.html"; qs.setCond(6, true); } } break; } - case 8: - { - if (hasQuestItems(talker, CROSS_OF_EINHASAD)) - { + case 8: { + if (hasQuestItems(talker, CROSS_OF_EINHASAD)) { htmltext = "31334-18.html"; } break; @@ -454,81 +365,59 @@ public final class Q00022_TragedyInVonHellmannForest extends Quest } break; } - case GHOST_OF_PRIEST: - { + case GHOST_OF_PRIEST: { playSound(talker, Sound.AMBSOUND_HORROR_15); - if (npc.getScriptValue() == talker.getObjectId()) - { + if (npc.getScriptValue() == talker.getObjectId()) { htmltext = "31528-01.html"; - } - else - { + } else { htmltext = "31528-03.html"; } break; } - case INNOCENTIN: - { - switch (qs.getCond()) - { - case 2: - { - if (!hasQuestItems(talker, CROSS_OF_EINHASAD)) - { + case INNOCENTIN: { + switch (qs.getCond()) { + case 2: { + if (!hasQuestItems(talker, CROSS_OF_EINHASAD)) { giveItems(talker, CROSS_OF_EINHASAD, 1); qs.setCond(3, true); htmltext = "31328-01.html"; } break; } - case 3: - { - if (hasQuestItems(talker, CROSS_OF_EINHASAD)) - { + case 3: { + if (hasQuestItems(talker, CROSS_OF_EINHASAD)) { htmltext = "31328-01b.html"; } break; } - case 8: - { - if (hasQuestItems(talker, CROSS_OF_EINHASAD)) - { + case 8: { + if (hasQuestItems(talker, CROSS_OF_EINHASAD)) { htmltext = "31328-02.html"; - } - else - { + } else { htmltext = "31328-04.html"; } break; } - case 9: - { + case 9: { htmltext = "31328-09a.html"; break; } - case 14: - { - if (hasQuestItems(talker, REPORT_BOX)) - { + case 14: { + if (hasQuestItems(talker, REPORT_BOX)) { htmltext = "31328-10.html"; } break; } - case 15: - { + case 15: { htmltext = "31328-12.html"; break; } - case 16: - { + case 16: { addExpAndSp(talker, 345966, 31578); qs.exitQuest(false, true); - if (talker.getLevel() >= MIN_LVL) - { + if (talker.getLevel() >= MIN_LVL) { htmltext = "31328-20.html"; - } - else - { + } else { htmltext = "31328-21.html"; } break; @@ -536,23 +425,17 @@ public final class Q00022_TragedyInVonHellmannForest extends Quest } break; } - case WELL: - { - switch (qs.getCond()) - { - case 10: - { - if (hasQuestItems(talker, JEWEL_OF_ADVENTURER_1)) - { + case WELL: { + switch (qs.getCond()) { + case 10: { + if (hasQuestItems(talker, JEWEL_OF_ADVENTURER_1)) { htmltext = "31527-01.html"; playSound(talker, Sound.AMBSOUND_HORROR_01); } break; } - case 12: - { - if (hasQuestItems(talker, JEWEL_OF_ADVENTURER_2) && !hasQuestItems(talker, SEALED_REPORT_BOX)) - { + case 12: { + if (hasQuestItems(talker, JEWEL_OF_ADVENTURER_2) && !hasQuestItems(talker, SEALED_REPORT_BOX)) { giveItems(talker, SEALED_REPORT_BOX, 1); qs.setCond(13, true); htmltext = "31527-04.html"; @@ -562,36 +445,27 @@ public final class Q00022_TragedyInVonHellmannForest extends Quest case 13: case 14: case 15: - case 16: - { + case 16: { htmltext = "31527-05.html"; break; } } break; } - case GHOST_OF_ADVENTURER: - { - switch (qs.getCond()) - { - case 9: - { - if (hasQuestItems(talker, LETTER_OF_INNOCENTIN)) - { - switch (qs.getMemoState()) - { - case 0: - { + case GHOST_OF_ADVENTURER: { + switch (qs.getCond()) { + case 9: { + if (hasQuestItems(talker, LETTER_OF_INNOCENTIN)) { + switch (qs.getMemoState()) { + case 0: { htmltext = "31529-01.html"; break; } - case 8: - { + case 8: { htmltext = "31529-03a.html"; break; } - case 9: - { + case 9: { htmltext = "31529-10.html"; break; } @@ -601,35 +475,26 @@ public final class Q00022_TragedyInVonHellmannForest extends Quest } break; } - case 10: - { - if (hasQuestItems(talker, JEWEL_OF_ADVENTURER_1)) - { + case 10: { + if (hasQuestItems(talker, JEWEL_OF_ADVENTURER_1)) { final int id = qs.getMemoState(); - if (id == 10) - { + if (id == 10) { htmltext = "31529-12.html"; - } - else if (id == 11) - { + } else if (id == 11) { htmltext = "31529-14.html"; } } break; } - case 11: - { - if (hasQuestItems(talker, JEWEL_OF_ADVENTURER_2) && !hasQuestItems(talker, SEALED_REPORT_BOX)) - { + case 11: { + if (hasQuestItems(talker, JEWEL_OF_ADVENTURER_2) && !hasQuestItems(talker, SEALED_REPORT_BOX)) { htmltext = "31529-15.html"; qs.setCond(12, true); } break; } - case 13: - { - if (hasQuestItems(talker, JEWEL_OF_ADVENTURER_2) && hasQuestItems(talker, SEALED_REPORT_BOX)) - { + case 13: { + if (hasQuestItems(talker, JEWEL_OF_ADVENTURER_2) && hasQuestItems(talker, SEALED_REPORT_BOX)) { giveItems(talker, REPORT_BOX, 1); takeItems(talker, SEALED_REPORT_BOX, -1); takeItems(talker, JEWEL_OF_ADVENTURER_2, -1); @@ -638,10 +503,8 @@ public final class Q00022_TragedyInVonHellmannForest extends Quest } break; } - case 14: - { - if (hasQuestItems(talker, REPORT_BOX)) - { + case 14: { + if (hasQuestItems(talker, REPORT_BOX)) { htmltext = "31529-17.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00023_LidiasHeart/Q00023_LidiasHeart.java b/src/main/java/com/l2jserver/datapack/quests/Q00023_LidiasHeart/Q00023_LidiasHeart.java index 2ba9b5b52e..fa8094dd77 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00023_LidiasHeart/Q00023_LidiasHeart.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00023_LidiasHeart/Q00023_LidiasHeart.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * Lidia's Heart (23) * @author ivantotov */ -public final class Q00023_LidiasHeart extends Quest -{ +public final class Q00023_LidiasHeart extends Quest { // NPCs private static final int HIGH_PRIEST_INNOCENTIN = 31328; private static final int TRADER_VIOLET = 31386; @@ -55,8 +54,7 @@ public final class Q00023_LidiasHeart extends Quest // Locations private static final Location GHOST_SPAWN = new Location(51432, -54570, -3136); - public Q00023_LidiasHeart() - { + public Q00023_LidiasHeart() { super(23, Q00023_LidiasHeart.class.getSimpleName(), "Lidia's Heart"); addStartNpc(HIGH_PRIEST_INNOCENTIN); addTalkId(HIGH_PRIEST_INNOCENTIN, TRADER_VIOLET, TOMBSTONE, GHOST_OF_VON_HELLMANN, BROKEN_BOOKSHELF, BOX); @@ -65,13 +63,10 @@ public final class Q00023_LidiasHeart extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if ("DESPAWN".equals(event)) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if ("DESPAWN".equals(event)) { final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class); - if (npc0 != null) - { + if (npc0 != null) { npc0.getVariables().set("SPAWNED", false); } npc.deleteMe(); @@ -79,24 +74,17 @@ public final class Q00023_LidiasHeart extends Quest } final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (player.getLevel() < MIN_LEVEL) - { + switch (event) { + case "ACCEPT": { + if (player.getLevel() < MIN_LEVEL) { htmltext = "31328-02.htm"; - } - else - { - if (!hasQuestItems(player, MAP_FOREST_OF_THE_DEAD)) - { + } else { + if (!hasQuestItems(player, MAP_FOREST_OF_THE_DEAD)) { giveItems(player, MAP_FOREST_OF_THE_DEAD, 1); } giveItems(player, SILVER_KEY, 1); @@ -117,85 +105,67 @@ public final class Q00023_LidiasHeart extends Quest case "31526-04.html": case "31526-05.html": case "31526-07a.html": - case "31526-09.html": - { + case "31526-09.html": { htmltext = event; break; } - case "31328-07.html": - { - if (qs.isMemoState(1)) - { + case "31328-07.html": { + if (qs.isMemoState(1)) { qs.setMemoState(2); qs.setCond(2, true); htmltext = event; } break; } - case "31328-12.html": - { - if (qs.isMemoState(5) || qs.isMemoState(6)) - { + case "31328-12.html": { + if (qs.isMemoState(5) || qs.isMemoState(6)) { qs.setMemoState(6); qs.setCond(5); htmltext = event; } break; } - case "31328-13.html": - { - if (qs.isMemoState(5) || qs.isMemoState(6)) - { + case "31328-13.html": { + if (qs.isMemoState(5) || qs.isMemoState(6)) { qs.setMemoState(7); htmltext = event; } break; } - case "31328-19.html": - { + case "31328-19.html": { playSound(player, Sound.AMBSOUND_MT_CREAK); htmltext = event; break; } - case "31328-20.html": - { - if (qs.isMemoState(7)) - { + case "31328-20.html": { + if (qs.isMemoState(7)) { qs.setMemoState(8); qs.setCond(6); htmltext = event; } break; } - case "31328-21.html": - { + case "31328-21.html": { qs.setCond(5); htmltext = event; break; } - case "31523-02.html": - { - if (qs.isMemoState(8) || qs.isMemoState(9)) - { + case "31523-02.html": { + if (qs.isMemoState(8) || qs.isMemoState(9)) { playSound(player, Sound.SKILLSOUND_HORROR_02); - if (!npc.getVariables().getBoolean("SPAWNED", false)) - { + if (!npc.getVariables().getBoolean("SPAWNED", false)) { npc.getVariables().set("SPAWNED", true); final L2Npc ghost = addSpawn(npc, GHOST_OF_VON_HELLMANN, GHOST_SPAWN, false, 0); ghost.getVariables().set("npc0", npc); htmltext = event; - } - else - { + } else { htmltext = "31523-03.html"; } } break; } - case "31523-06.html": - { - if (qs.isMemoState(9)) - { + case "31523-06.html": { + if (qs.isMemoState(9)) { giveItems(player, SILVER_KEY, 1); qs.setMemoState(10); qs.setCond(8); @@ -203,16 +173,13 @@ public final class Q00023_LidiasHeart extends Quest } break; } - case "31524-02.html": - { + case "31524-02.html": { playSound(player, Sound.CHRSOUND_MHFIGHTER_CRY); htmltext = event; break; } - case "31524-04.html": - { - if (qs.isMemoState(8)) - { + case "31524-04.html": { + if (qs.isMemoState(8)) { takeItems(player, LIDIAS_DIARY, 1); qs.setMemoState(9); qs.setCond(7); @@ -220,57 +187,46 @@ public final class Q00023_LidiasHeart extends Quest } break; } - case "31526-02.html": - { - if (qs.isMemoState(2) && hasQuestItems(player, SILVER_KEY)) - { + case "31526-02.html": { + if (qs.isMemoState(2) && hasQuestItems(player, SILVER_KEY)) { takeItems(player, SILVER_KEY, -1); qs.setMemoState(3); htmltext = event; } break; } - case "31526-06.html": - { - if (!hasQuestItems(player, LIDIAS_HAIRPIN)) - { + case "31526-06.html": { + if (!hasQuestItems(player, LIDIAS_HAIRPIN)) { giveItems(player, LIDIAS_HAIRPIN, 1); } qs.setMemoState(qs.getMemoState() + 1); - if (hasQuestItems(player, LIDIAS_DIARY)) - { + if (hasQuestItems(player, LIDIAS_DIARY)) { qs.setCond(4); } htmltext = event; break; } - case "31526-08.html": - { + case "31526-08.html": { playSound(player, Sound.ITEMSOUND_ARMOR_LEATHER); htmltext = event; break; } - case "31526-10.html": - { + case "31526-10.html": { playSound(player, Sound.AMBSOUND_EG_DRON); htmltext = event; break; } - case "31526-11.html": - { + case "31526-11.html": { giveItems(player, LIDIAS_DIARY, 1); qs.setMemoState(qs.getMemoState() + 1); - if (hasQuestItems(player, LIDIAS_HAIRPIN)) - { + if (hasQuestItems(player, LIDIAS_HAIRPIN)) { qs.setCond(4); } htmltext = event; break; } - case "31530-02.html": - { - if (qs.isMemoState(11) && hasQuestItems(player, SILVER_KEY)) - { + case "31530-02.html": { + if (qs.isMemoState(11) && hasQuestItems(player, SILVER_KEY)) { giveItems(player, SILVER_SPEAR, 1); takeItems(player, SILVER_KEY, -1); playSound(player, Sound.ITEMSOUND_WEAPON_SPEAR); @@ -284,52 +240,38 @@ public final class Q00023_LidiasHeart extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == HIGH_PRIEST_INNOCENTIN) - { + if (qs.isCreated()) { + if (npc.getId() == HIGH_PRIEST_INNOCENTIN) { htmltext = (player.hasQuestCompleted(Q00022_TragedyInVonHellmannForest.class.getSimpleName())) ? "31328-01.htm" : "31328-01a.html"; } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case HIGH_PRIEST_INNOCENTIN: - { - switch (qs.getMemoState()) - { - case 1: - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case HIGH_PRIEST_INNOCENTIN: { + switch (qs.getMemoState()) { + case 1: { htmltext = "31328-04.html"; break; } - case 2: - { + case 2: { htmltext = "31328-08.html"; break; } - case 5: - { + case 5: { htmltext = "31328-09.html"; break; } - case 6: - { + case 6: { htmltext = "31328-14.html"; break; } - case 7: - { + case 7: { htmltext = "31328-15.html"; break; } - case 8: - { + case 8: { qs.setCond(6, true); htmltext = "31328-22.html"; break; @@ -337,28 +279,20 @@ public final class Q00023_LidiasHeart extends Quest } break; } - case TRADER_VIOLET: - { - switch (qs.getMemoState()) - { - case 10: - { - if (hasQuestItems(player, SILVER_KEY)) - { + case TRADER_VIOLET: { + switch (qs.getMemoState()) { + case 10: { + if (hasQuestItems(player, SILVER_KEY)) { qs.setMemoState(11); qs.setCond(9, true); htmltext = "31386-01.html"; } break; } - case 11: - { - if (!hasQuestItems(player, SILVER_SPEAR)) - { + case 11: { + if (!hasQuestItems(player, SILVER_SPEAR)) { htmltext = "31386-02.html"; - } - else - { + } else { giveAdena(player, 350000, true); addExpAndSp(player, 456893, 42112); qs.exitQuest(false, true); @@ -369,86 +303,62 @@ public final class Q00023_LidiasHeart extends Quest } break; } - case TOMBSTONE: - { - switch (qs.getMemoState()) - { - case 8: - { + case TOMBSTONE: { + switch (qs.getMemoState()) { + case 8: { htmltext = "31523-01.html"; break; } - case 9: - { + case 9: { htmltext = "31523-04.html"; break; } - case 10: - { + case 10: { htmltext = "31523-05.html"; break; } } break; } - case GHOST_OF_VON_HELLMANN: - { + case GHOST_OF_VON_HELLMANN: { final int memoState = qs.getMemoState(); - if (memoState == 8) - { + if (memoState == 8) { htmltext = "31524-01.html"; - } - else if (memoState == 9) - { - if (!hasQuestItems(player, SILVER_KEY)) - { + } else if (memoState == 9) { + if (!hasQuestItems(player, SILVER_KEY)) { htmltext = "31524-05.html"; } - } - else if ((memoState == 9) || (memoState == 10)) - { - if (hasQuestItems(player, SILVER_KEY)) - { + } else if ((memoState == 9) || (memoState == 10)) { + if (hasQuestItems(player, SILVER_KEY)) { qs.setMemoState(10); htmltext = "31524-06.html"; } } break; } - case BROKEN_BOOKSHELF: - { - switch (qs.getMemoState()) - { - case 2: - { - if (hasQuestItems(player, SILVER_KEY)) - { + case BROKEN_BOOKSHELF: { + switch (qs.getMemoState()) { + case 2: { + if (hasQuestItems(player, SILVER_KEY)) { qs.setCond(3, true); htmltext = "31526-01.html"; } break; } - case 3: - { + case 3: { htmltext = "31526-03.html"; break; } - case 4: - { - if (hasQuestItems(player, LIDIAS_HAIRPIN)) - { + case 4: { + if (hasQuestItems(player, LIDIAS_HAIRPIN)) { htmltext = "31526-07.html"; - } - else if (hasQuestItems(player, LIDIAS_DIARY)) - { + } else if (hasQuestItems(player, LIDIAS_DIARY)) { htmltext = "31526-12.html"; } break; } - case 5: - { - if (hasQuestItems(player, LIDIAS_HAIRPIN, LIDIAS_DIARY)) - { + case 5: { + if (hasQuestItems(player, LIDIAS_HAIRPIN, LIDIAS_DIARY)) { htmltext = "31526-13.html"; } break; @@ -456,34 +366,23 @@ public final class Q00023_LidiasHeart extends Quest } break; } - case BOX: - { - if (qs.getMemoState() == 11) - { - if (hasQuestItems(player, SILVER_KEY)) - { + case BOX: { + if (qs.getMemoState() == 11) { + if (hasQuestItems(player, SILVER_KEY)) { htmltext = "31530-01.html"; - } - else if (hasQuestItems(player, SILVER_SPEAR)) - { + } else if (hasQuestItems(player, SILVER_SPEAR)) { htmltext = "31530-03.html"; } } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == HIGH_PRIEST_INNOCENTIN) - { + } else if (qs.isCompleted()) { + if (npc.getId() == HIGH_PRIEST_INNOCENTIN) { htmltext = getAlreadyCompletedMsg(player); - } - else if (npc.getId() == TRADER_VIOLET) - { + } else if (npc.getId() == TRADER_VIOLET) { final QuestState q24 = player.getQuestState(Q00024_InhabitantsOfTheForestOfTheDead.class.getSimpleName()); - if ((q24 == null)) - { + if ((q24 == null)) { htmltext = "31386-04.html"; } } @@ -492,8 +391,7 @@ public final class Q00023_LidiasHeart extends Quest } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { startQuestTimer("DESPAWN", 300000, npc, null); npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.WHO_AWOKE_ME)); return super.onSpawn(npc); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00024_InhabitantsOfTheForestOfTheDead/Q00024_InhabitantsOfTheForestOfTheDead.java b/src/main/java/com/l2jserver/datapack/quests/Q00024_InhabitantsOfTheForestOfTheDead/Q00024_InhabitantsOfTheForestOfTheDead.java index 8cd8ded71e..6ab590d72a 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00024_InhabitantsOfTheForestOfTheDead/Q00024_InhabitantsOfTheForestOfTheDead.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00024_InhabitantsOfTheForestOfTheDead/Q00024_InhabitantsOfTheForestOfTheDead.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.State; * Inhabitants of the Forest of the Dead (24) * @author malyelfik */ -public class Q00024_InhabitantsOfTheForestOfTheDead extends Quest -{ +public class Q00024_InhabitantsOfTheForestOfTheDead extends Quest { // NPCs private static final int DORIAN = 31389; private static final int MYSTERIOUS_WIZARD = 31522; @@ -51,8 +50,7 @@ public class Q00024_InhabitantsOfTheForestOfTheDead extends Quest private static final int[] MOBS = { 21557, 21558, 21560, 21563, 21564, 21565, 21566, 21567 }; // @formatter:on - public Q00024_InhabitantsOfTheForestOfTheDead() - { + public Q00024_InhabitantsOfTheForestOfTheDead() { super(24, Q00024_InhabitantsOfTheForestOfTheDead.class.getSimpleName(), "Inhabitants of the Forest of the Dead"); addStartNpc(DORIAN); addTalkId(DORIAN, MYSTERIOUS_WIZARD, TOMBSTONE, LIDIA_MAID); @@ -61,21 +59,17 @@ public class Q00024_InhabitantsOfTheForestOfTheDead extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { // Dorian case "31389-02.htm": - if ((player.getLevel() >= 65) && player.hasQuestCompleted(Q00023_LidiasHeart.class.getSimpleName())) - { + if ((player.getLevel() >= 65) && player.hasQuestCompleted(Q00023_LidiasHeart.class.getSimpleName())) { st.startQuest(); st.giveItems(FLOWER_BOUQUET, 1); return "31389-03.htm"; @@ -93,8 +87,7 @@ public class Q00024_InhabitantsOfTheForestOfTheDead extends Quest st.playSound(Sound.INTERFACESOUND_CHARSTAT_OPEN); break; case "31389-19.html": - if (!st.hasQuestItems(BROKEN_SILVER_CROSS_OF_EINHASAD)) - { + if (!st.hasQuestItems(BROKEN_SILVER_CROSS_OF_EINHASAD)) { return getNoQuestMsg(player); } st.takeItems(BROKEN_SILVER_CROSS_OF_EINHASAD, -1); @@ -114,21 +107,16 @@ public class Q00024_InhabitantsOfTheForestOfTheDead extends Quest st.setCond(6, true); break; case "31532-07.html": - if (st.isCond(8)) - { - if (!hasQuestItems(player, LIDIA_HAIRPIN, LIDIA_LETTER)) - { + if (st.isCond(8)) { + if (!hasQuestItems(player, LIDIA_HAIRPIN, LIDIA_LETTER)) { return getNoQuestMsg(player); } st.takeItems(LIDIA_HAIRPIN, -1); st.takeItems(LIDIA_LETTER, -1); st.set("var", "1"); htmltext = "31532-06.html"; - } - else - { - if (st.isCond(6)) - { + } else { + if (st.isCond(6)) { st.setCond(7, true); } } @@ -155,8 +143,7 @@ public class Q00024_InhabitantsOfTheForestOfTheDead extends Quest break; // Mysterious Wizard case "31522-03.html": - if (!st.hasQuestItems(SUSPICIOUS_TOTEM_DOLL)) - { + if (!st.hasQuestItems(SUSPICIOUS_TOTEM_DOLL)) { return getNoQuestMsg(player); } st.takeItems(SUSPICIOUS_TOTEM_DOLL, 1); @@ -190,8 +177,7 @@ public class Q00024_InhabitantsOfTheForestOfTheDead extends Quest break; // Tombstone case "31531-02.html": - if (!st.hasQuestItems(FLOWER_BOUQUET)) - { + if (!st.hasQuestItems(FLOWER_BOUQUET)) { return getNoQuestMsg(player); } st.takeItems(FLOWER_BOUQUET, -1); @@ -205,12 +191,10 @@ public class Q00024_InhabitantsOfTheForestOfTheDead extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isCond(9) && (getRandom(100) < 10)) - { + if ((st != null) && st.isCond(9) && (getRandom(100) < 10)) { st.giveItems(SUSPICIOUS_TOTEM_DOLL, 1); st.setCond(10, true); } @@ -218,21 +202,17 @@ public class Q00024_InhabitantsOfTheForestOfTheDead extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case DORIAN: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = "31389-01.htm"; break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "31389-04.html"; break; @@ -265,45 +245,32 @@ public class Q00024_InhabitantsOfTheForestOfTheDead extends Quest } break; case MYSTERIOUS_WIZARD: - if (st.isStarted()) - { - if (st.isCond(10)) - { + if (st.isStarted()) { + if (st.isCond(10)) { htmltext = (st.getInt("var") == 0) ? "31522-01.html" : "31522-04.html"; - } - else if (st.isCond(11)) - { + } else if (st.isCond(11)) { htmltext = (st.getInt("var") == 0) ? "31522-09.html" : "31522-18.html"; } - } - else if (st.isCompleted()) - { + } else if (st.isCompleted()) { final QuestState qs = player.getQuestState(Q00025_HidingBehindTheTruth.class.getSimpleName()); - if (!((qs != null) && (qs.isStarted() || qs.isStarted()))) - { + if (!((qs != null) && (qs.isStarted() || qs.isStarted()))) { htmltext = "31522-22.html"; } } break; case TOMBSTONE: - if (st.isStarted()) - { - if (st.isCond(1)) - { + if (st.isStarted()) { + if (st.isCond(1)) { st.playSound(Sound.AMDSOUND_WIND_LOOT); htmltext = "31531-01.html"; - } - else if (st.isCond(2)) - { + } else if (st.isCond(2)) { htmltext = "31531-03.html"; } } break; case LIDIA_MAID: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 5: htmltext = "31532-01.html"; break; @@ -314,8 +281,7 @@ public class Q00024_InhabitantsOfTheForestOfTheDead extends Quest htmltext = "31532-07a.html"; break; case 8: - switch (st.getInt("var")) - { + switch (st.getInt("var")) { case 0: htmltext = "31532-07a.html"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00025_HidingBehindTheTruth/Q00025_HidingBehindTheTruth.java b/src/main/java/com/l2jserver/datapack/quests/Q00025_HidingBehindTheTruth/Q00025_HidingBehindTheTruth.java index 593817b849..1bb3c3f00b 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00025_HidingBehindTheTruth/Q00025_HidingBehindTheTruth.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00025_HidingBehindTheTruth/Q00025_HidingBehindTheTruth.java @@ -38,8 +38,7 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * Hiding Behind the Truth (25) * @author Joxit */ -public class Q00025_HidingBehindTheTruth extends Quest -{ +public class Q00025_HidingBehindTheTruth extends Quest { // NPCs private static final int HIGH_PRIEST_AGRIPEL = 31348; private static final int PRIEST_BENEDICT = 31349; @@ -68,8 +67,7 @@ public class Q00025_HidingBehindTheTruth extends Quest private static final HashMap<Integer, Location> TRIOL_PAWN_LOC = new HashMap<>(); private static final IPositionable COFFIN_LOC = new Location(60104, -35820, -681); - public Q00025_HidingBehindTheTruth() - { + public Q00025_HidingBehindTheTruth() { super(25, Q00025_HidingBehindTheTruth.class.getSimpleName(), "Hiding Behind the Truth"); addStartNpc(PRIEST_BENEDICT); addTalkId(HIGH_PRIEST_AGRIPEL, PRIEST_BENEDICT, MYSTERIOUS_WIZARD, TOMBSTONE, MAID_OF_LIDIA, BROKEN_BOOKSHELF2, BROKEN_BOOKSHELF3, BROKEN_BOOKSHELF4, COFFIN); @@ -81,13 +79,11 @@ public class Q00025_HidingBehindTheTruth extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = getNoQuestMsg(player); - switch (event) - { + switch (event) { case "31349-06.html": case "31349-07.html": case "31349-08.html": @@ -110,51 +106,39 @@ public class Q00025_HidingBehindTheTruth extends Quest case "31532-15.html": case "31532-16.html": case "31532-19.html": - case "31532-20.html": - { + case "31532-20.html": { htmltext = event; break; } - case "31349-03.html": - { - if (qs.isCreated() && player.hasQuestCompleted(Q00024_InhabitantsOfTheForestOfTheDead.class.getSimpleName()) && (player.getLevel() >= MIN_LVL)) - { + case "31349-03.html": { + if (qs.isCreated() && player.hasQuestCompleted(Q00024_InhabitantsOfTheForestOfTheDead.class.getSimpleName()) && (player.getLevel() >= MIN_LVL)) { qs.setMemoState(1); qs.startQuest(); htmltext = event; } break; } - case "31349-05.html": - { - if (qs.isMemoState(1)) - { - if (hasQuestItems(player, TOTEM_DOLL2)) - { + case "31349-05.html": { + if (qs.isMemoState(1)) { + if (hasQuestItems(player, TOTEM_DOLL2)) { htmltext = "31349-04.html"; - } - else - { + } else { qs.setCond(2, true); htmltext = event; } } break; } - case "31349-10.html": - { - if (qs.isMemoState(1) && hasQuestItems(player, TOTEM_DOLL2)) - { + case "31349-10.html": { + if (qs.isMemoState(1) && hasQuestItems(player, TOTEM_DOLL2)) { qs.setMemoState(2); qs.setCond(4, true); htmltext = event; } break; } - case "31522-04.html": - { - if (qs.isMemoState(6) && hasQuestItems(player, GEMSTONE_KEY)) - { + case "31522-04.html": { + if (qs.isMemoState(6) && hasQuestItems(player, GEMSTONE_KEY)) { qs.setMemoState(7); qs.setMemoStateEx(1, 20); qs.setCond(6, true); @@ -162,29 +146,23 @@ public class Q00025_HidingBehindTheTruth extends Quest } break; } - case "31522-10.html": - { - if (qs.isMemoState(16)) - { + case "31522-10.html": { + if (qs.isMemoState(16)) { qs.setMemoState(19); htmltext = event; } break; } - case "31522-13.html": - { - if (qs.isMemoState(19)) - { + case "31522-13.html": { + if (qs.isMemoState(19)) { qs.setMemoState(20); qs.setCond(16, true); htmltext = event; } break; } - case "31522-16.html": - { - if (qs.isMemoState(24)) - { + case "31522-16.html": { + if (qs.isMemoState(24)) { takeItems(player, MAP_FOREST_OF_THE_DEAD, -1); rewardItems(player, EARING_OF_BLESSING, 1); rewardItems(player, NECKLACE_OF_BLESSING, 1); @@ -194,20 +172,16 @@ public class Q00025_HidingBehindTheTruth extends Quest } break; } - case "31348-02.html": - { - if (qs.isMemoState(2)) - { + case "31348-02.html": { + if (qs.isMemoState(2)) { takeItems(player, TOTEM_DOLL2, -1); qs.setMemoState(3); htmltext = event; } break; } - case "31348-08.html": - { - if (qs.isMemoState(3)) - { + case "31348-08.html": { + if (qs.isMemoState(3)) { giveItems(player, GEMSTONE_KEY, 1); qs.setMemoState(6); qs.setCond(5, true); @@ -215,74 +189,56 @@ public class Q00025_HidingBehindTheTruth extends Quest } break; } - case "31348-10.html": - { - if (qs.isMemoState(20) && hasQuestItems(player, TOTEM_DOLL3)) - { + case "31348-10.html": { + if (qs.isMemoState(20) && hasQuestItems(player, TOTEM_DOLL3)) { takeItems(player, TOTEM_DOLL3, -1); qs.setMemoState(21); htmltext = event; } break; } - case "31348-13.html": - { - if (qs.isMemoState(21)) - { + case "31348-13.html": { + if (qs.isMemoState(21)) { qs.setMemoState(22); htmltext = event; } break; } - case "31348-16.html": - { - if (qs.isMemoState(22)) - { + case "31348-16.html": { + if (qs.isMemoState(22)) { qs.setMemoState(23); qs.setCond(17, true); htmltext = event; } break; } - case "31348-17.html": - { - if (qs.isMemoState(22)) - { + case "31348-17.html": { + if (qs.isMemoState(22)) { qs.setMemoState(24); qs.setCond(18, true); htmltext = event; } break; } - case "31533-04.html": - { - if (qs.getMemoStateEx(npc.getId()) != 0) - { + case "31533-04.html": { + if (qs.getMemoStateEx(npc.getId()) != 0) { htmltext = "31533-03.html"; - } - else if (getRandom(60) > qs.getMemoStateEx(1)) - { + } else if (getRandom(60) > qs.getMemoStateEx(1)) { qs.setMemoStateEx(1, qs.getMemoStateEx(1) + 20); qs.setMemoStateEx(npc.getId(), 1); htmltext = "31533-03.html"; - } - else - { + } else { qs.setMemoState(8); htmltext = event; playSound(player, Sound.AMDSOUND_HORROR_02); } break; } - case "31533-05.html": - { - if (qs.isMemoState(8)) - { - if (!hasQuestItems(player, TOTEM_DOLL3)) - { + case "31533-05.html": { + if (qs.isMemoState(8)) { + if (!hasQuestItems(player, TOTEM_DOLL3)) { final int brokenDeskOwner = npc.getVariables().getInt("Q00025", 0); - if (brokenDeskOwner == 0) - { + if (brokenDeskOwner == 0) { npc.getVariables().set("Q00025", player.getObjectId()); final L2Npc triyol = addSpawn(TRIOL_PAWN, TRIOL_PAWN_LOC.get(npc.getId()), true, 0); triyol.getVariables().set("Q00025", npc); @@ -293,27 +249,19 @@ public class Q00025_HidingBehindTheTruth extends Quest htmltext = event; qs.setCond(7); - } - else if (brokenDeskOwner == player.getObjectId()) - { + } else if (brokenDeskOwner == player.getObjectId()) { htmltext = "31533-06.html"; - } - else - { + } else { htmltext = "31533-07.html"; } - } - else - { + } else { htmltext = "31533-08.html"; } } break; } - case "31533-09.html": - { - if (qs.isMemoState(8) && hasQuestItems(player, TOTEM_DOLL3, GEMSTONE_KEY)) - { + case "31533-09.html": { + if (qs.isMemoState(8) && hasQuestItems(player, TOTEM_DOLL3, GEMSTONE_KEY)) { giveItems(player, CONTRACT, 1); takeItems(player, GEMSTONE_KEY, -1); qs.setMemoState(9); @@ -322,35 +270,28 @@ public class Q00025_HidingBehindTheTruth extends Quest } break; } - case "SAY_TRIYOL": - { + case "SAY_TRIYOL": { npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.ALL, npc.getId(), NpcStringId.THAT_BOX_WAS_SEALED_BY_MY_MASTER_S1_DONT_TOUCH_IT).addStringParameter(player.getName())); break; } - case "DESPAWN_TRIYOL": - { + case "DESPAWN_TRIYOL": { final L2Npc brokenDesk = npc.getVariables().getObject("Q00025", L2Npc.class); - if (brokenDesk != null) - { + if (brokenDesk != null) { brokenDesk.getVariables().set("Q00025", 0); } npc.deleteMe(); break; } - case "31532-02.html": - { - if (qs.isMemoState(9) && hasQuestItems(player, CONTRACT)) - { + case "31532-02.html": { + if (qs.isMemoState(9) && hasQuestItems(player, CONTRACT)) { takeItems(player, CONTRACT, -1); qs.setMemoState(10); htmltext = event; } break; } - case "31532-07.html": - { - if (qs.isMemoState(10)) - { + case "31532-07.html": { + if (qs.isMemoState(10)) { qs.setMemoState(11); playSound(player, Sound.SKILLSOUND_HORROR_1); qs.setCond(11); @@ -358,48 +299,37 @@ public class Q00025_HidingBehindTheTruth extends Quest } break; } - case "31532-11.html": - { - if (qs.isMemoState(13)) - { + case "31532-11.html": { + if (qs.isMemoState(13)) { final int memoStateEx = qs.getMemoStateEx(1); - if (memoStateEx <= 3) - { + if (memoStateEx <= 3) { qs.setMemoStateEx(1, memoStateEx + 1); playSound(player, Sound.CHRSOUND_FDELF_CRY); htmltext = event; - } - else - { + } else { qs.setMemoState(14); htmltext = "31532-12.html"; } } break; } - case "31532-17.html": - { - if (qs.isMemoState(14)) - { + case "31532-17.html": { + if (qs.isMemoState(14)) { qs.setMemoState(15); htmltext = event; } break; } - case "31532-21.html": - { - if (qs.isMemoState(15)) - { + case "31532-21.html": { + if (qs.isMemoState(15)) { qs.setMemoState(16); qs.setCond(15); htmltext = event; } break; } - case "31532-25.html": - { - if (qs.isMemoState(23)) - { + case "31532-25.html": { + if (qs.isMemoState(23)) { takeItems(player, MAP_FOREST_OF_THE_DEAD, -1); rewardItems(player, EARING_OF_BLESSING, 1); rewardItems(player, RING_OF_BLESSING, 2); @@ -409,10 +339,8 @@ public class Q00025_HidingBehindTheTruth extends Quest } break; } - case "31531-02.html": - { - if (qs.isMemoState(11)) - { + case "31531-02.html": { + if (qs.isMemoState(11)) { final L2Npc box = addSpawn(COFFIN, COFFIN_LOC, true, 0); startQuestTimer("DESPAWN_BOX", 20000, box, player); qs.setCond(12, true); @@ -420,8 +348,7 @@ public class Q00025_HidingBehindTheTruth extends Quest } break; } - case "DESPAWN_BOX": - { + case "DESPAWN_BOX": { npc.deleteMe(); break; } @@ -430,20 +357,16 @@ public class Q00025_HidingBehindTheTruth extends Quest } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (npc.getCurrentHp() <= (0.30 * npc.getMaxHp())) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (npc.getCurrentHp() <= (0.30 * npc.getMaxHp())) { final QuestState qs = getQuestState(attacker, false); - if (qs.isMemoState(8) && !hasQuestItems(attacker, TOTEM_DOLL3) && (attacker.getObjectId() == npc.getScriptValue())) - { + if (qs.isMemoState(8) && !hasQuestItems(attacker, TOTEM_DOLL3) && (attacker.getObjectId() == npc.getScriptValue())) { giveItems(attacker, TOTEM_DOLL3, 1); qs.setCond(8, true); npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.ALL, npc.getId(), NpcStringId.YOUVE_ENDED_MY_IMMORTAL_LIFE_YOURE_PROTECTED_BY_THE_FEUDAL_LORD_ARENT_YOU)); final L2Npc brokenDesk = npc.getVariables().getObject("Q00025", L2Npc.class); - if (brokenDesk != null) - { + if (brokenDesk != null) { brokenDesk.getVariables().set("Q00025", 0); } npc.deleteMe(); @@ -453,113 +376,83 @@ public class Q00025_HidingBehindTheTruth extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (qs.getState()) - { - case State.CREATED: - { - if (npc.getId() == PRIEST_BENEDICT) - { + switch (qs.getState()) { + case State.CREATED: { + if (npc.getId() == PRIEST_BENEDICT) { QuestState q24 = talker.getQuestState(Q00024_InhabitantsOfTheForestOfTheDead.class.getSimpleName()); - if ((q24 != null) && q24.isCompleted() && (talker.getLevel() >= MIN_LVL)) - { + if ((q24 != null) && q24.isCompleted() && (talker.getLevel() >= MIN_LVL)) { htmltext = "31349-01.htm"; - } - else - { + } else { htmltext = "31349-02.html"; } } break; } - case State.STARTED: - { - switch (npc.getId()) - { - case PRIEST_BENEDICT: - { - switch (qs.getMemoState()) - { - case 1: - { + case State.STARTED: { + switch (npc.getId()) { + case PRIEST_BENEDICT: { + switch (qs.getMemoState()) { + case 1: { htmltext = "31349-03a.html"; break; } - case 2: - { + case 2: { htmltext = "31349-11.html"; break; } } break; } - case MYSTERIOUS_WIZARD: - { - switch (qs.getMemoState()) - { - case 1: - { - if (!hasQuestItems(talker, TOTEM_DOLL2)) - { + case MYSTERIOUS_WIZARD: { + switch (qs.getMemoState()) { + case 1: { + if (!hasQuestItems(talker, TOTEM_DOLL2)) { giveItems(talker, TOTEM_DOLL2, 1); qs.setCond(3, true); htmltext = "31522-01.html"; - } - else - { + } else { htmltext = "31522-02.html"; } break; } - case 6: - { - if (hasQuestItems(talker, GEMSTONE_KEY)) - { + case 6: { + if (hasQuestItems(talker, GEMSTONE_KEY)) { htmltext = "31522-03.html"; } break; } - case 9: - { - if (hasQuestItems(talker, CONTRACT)) - { + case 9: { + if (hasQuestItems(talker, CONTRACT)) { qs.setCond(10, true); htmltext = "31522-06.html"; } break; } - case 16: - { + case 16: { htmltext = "31522-06a.html"; break; } - case 19: - { + case 19: { htmltext = "31522-12.html"; break; } - case 20: - { + case 20: { htmltext = "31522-14.html"; break; } - case 24: - { + case 24: { htmltext = "31522-15.html"; break; } - case 23: - { + case 23: { htmltext = "31522-15a.html"; break; } - default: - { - if ((qs.getMemoState() % 100) == 7) - { + default: { + if ((qs.getMemoState() % 100) == 7) { htmltext = "31522-05.html"; } break; @@ -567,50 +460,39 @@ public class Q00025_HidingBehindTheTruth extends Quest } break; } - case HIGH_PRIEST_AGRIPEL: - { - switch (qs.getMemoState()) - { - case 2: - { + case HIGH_PRIEST_AGRIPEL: { + switch (qs.getMemoState()) { + case 2: { htmltext = "31348-01.html"; break; } - case 3: - { + case 3: { htmltext = "31348-03.html"; break; } - case 6: - { + case 6: { htmltext = "31348-08a.html"; break; } - case 20: - { - if (hasQuestItems(talker, TOTEM_DOLL3)) - { + case 20: { + if (hasQuestItems(talker, TOTEM_DOLL3)) { htmltext = "31348-09.html"; } break; } - case 21: - { + case 21: { htmltext = "31348-10a.html"; break; } - case 22: - { + case 22: { htmltext = "31348-15.html"; break; } - case 23: - { + case 23: { htmltext = "31348-18.html"; break; } - case 24: - { + case 24: { htmltext = "31348-19.html"; break; } @@ -619,49 +501,35 @@ public class Q00025_HidingBehindTheTruth extends Quest } case BROKEN_BOOKSHELF2: case BROKEN_BOOKSHELF3: - case BROKEN_BOOKSHELF4: - { - if ((qs.getMemoState() % 100) == 7) - { + case BROKEN_BOOKSHELF4: { + if ((qs.getMemoState() % 100) == 7) { htmltext = "31533-01.html"; - } - else if ((qs.getMemoState() % 100) >= 9) - { + } else if ((qs.getMemoState() % 100) >= 9) { htmltext = "31533-02.html"; - } - else if (qs.isMemoState(8)) - { + } else if (qs.isMemoState(8)) { htmltext = "31533-04.html"; } break; } - case MAID_OF_LIDIA: - { - switch (qs.getMemoState()) - { - case 9: - { - if (hasQuestItems(talker, CONTRACT)) - { + case MAID_OF_LIDIA: { + switch (qs.getMemoState()) { + case 9: { + if (hasQuestItems(talker, CONTRACT)) { htmltext = "31532-01.html"; } break; } - case 10: - { + case 10: { htmltext = "31532-03.html"; break; } - case 11: - { + case 11: { playSound(talker, Sound.SKILLSOUND_HORROR_1); htmltext = "31532-08.html"; break; } - case 12: - { - if (hasQuestItems(talker, LIDAS_DRESS)) - { + case 12: { + if (hasQuestItems(talker, LIDAS_DRESS)) { takeItems(talker, LIDAS_DRESS, -1); qs.setMemoState(13); qs.setCond(14, true); @@ -669,62 +537,50 @@ public class Q00025_HidingBehindTheTruth extends Quest } break; } - case 13: - { + case 13: { qs.setMemoStateEx(1, 0); playSound(talker, Sound.CHRSOUND_FDELF_CRY); htmltext = "31532-10.html"; break; } - case 14: - { + case 14: { htmltext = "31532-13.html"; break; } - case 15: - { + case 15: { htmltext = "31532-18.html"; break; } - case 16: - { + case 16: { htmltext = "31532-22.html"; break; } - case 23: - { + case 23: { htmltext = "31532-23.html"; break; } - case 24: - { + case 24: { htmltext = "31532-24.html"; break; } } break; } - case TOMBSTONE: - { - switch (qs.getMemoState()) - { - case 11: - { + case TOMBSTONE: { + switch (qs.getMemoState()) { + case 11: { htmltext = "31531-01.html"; break; } - case 12: - { + case 12: { htmltext = "31531-03.html"; break; } } break; } - case COFFIN: - { - if (qs.isMemoState(11)) - { + case COFFIN: { + if (qs.isMemoState(11)) { giveItems(talker, LIDAS_DRESS, 1); cancelQuestTimer("DESPAWN_BOX", npc, talker); startQuestTimer("DESPAWN_BOX", 3000, npc, talker); @@ -737,10 +593,8 @@ public class Q00025_HidingBehindTheTruth extends Quest } break; } - case State.COMPLETED: - { - if (npc.getId() == PRIEST_BENEDICT) - { + case State.COMPLETED: { + if (npc.getId() == PRIEST_BENEDICT) { htmltext = super.getAlreadyCompletedMsg(talker); } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00026_TiredOfWaiting/Q00026_TiredOfWaiting.java b/src/main/java/com/l2jserver/datapack/quests/Q00026_TiredOfWaiting/Q00026_TiredOfWaiting.java index 337c9d92e0..25274d7cea 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00026_TiredOfWaiting/Q00026_TiredOfWaiting.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00026_TiredOfWaiting/Q00026_TiredOfWaiting.java @@ -30,23 +30,20 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Tired Of Waiting (26) * @author corbin12 */ -public final class Q00026_TiredOfWaiting extends Quest -{ +public final class Q00026_TiredOfWaiting extends Quest { // NPCs private static final int ISAEL_SILVERSHADOW = 30655; private static final int KITZKA = 31045; // Items private static final int DELIVERY_BOX = 17281; private static final Map<String, Integer> REWARDS = new HashMap<>(); - static - { + static { REWARDS.put("31045-10.html", 17248); // Large Dragon Bone REWARDS.put("31045-11.html", 17266); // Will of Antharas REWARDS.put("31045-12.html", 17267); // Sealed Blood Crystal } - public Q00026_TiredOfWaiting() - { + public Q00026_TiredOfWaiting() { super(26, Q00026_TiredOfWaiting.class.getSimpleName(), "Tired of Waiting"); addStartNpc(ISAEL_SILVERSHADOW); addTalkId(ISAEL_SILVERSHADOW, KITZKA); @@ -54,17 +51,14 @@ public final class Q00026_TiredOfWaiting extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { + switch (event) { case "30655-02.htm": case "30655-03.htm": case "30655-05.html": @@ -79,16 +73,14 @@ public final class Q00026_TiredOfWaiting extends Quest htmltext = event; break; case "30655-04.html": - if (st.isCreated()) - { + if (st.isCreated()) { st.giveItems(DELIVERY_BOX, 1); st.startQuest(); htmltext = event; } break; case "31045-04.html": - if (st.isStarted()) - { + if (st.isStarted()) { st.takeItems(DELIVERY_BOX, -1); htmltext = event; } @@ -96,8 +88,7 @@ public final class Q00026_TiredOfWaiting extends Quest case "31045-10.html": case "31045-11.html": case "31045-12.html": - if (st.isStarted()) - { + if (st.isStarted()) { st.giveItems(REWARDS.get(event), 1); st.exitQuest(false, true); htmltext = event; @@ -108,29 +99,21 @@ public final class Q00026_TiredOfWaiting extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case ISAEL_SILVERSHADOW: - if (st.isCreated()) - { + if (st.isCreated()) { htmltext = ((player.getLevel() >= 80) ? "30655-01.htm" : "30655-00.html"); - } - else if (st.isStarted()) - { + } else if (st.isStarted()) { htmltext = "30655-07.html"; - } - else - { + } else { htmltext = "30655-08.html"; } break; case KITZKA: - if (st.isStarted()) - { + if (st.isStarted()) { htmltext = (st.hasQuestItems(DELIVERY_BOX) ? "31045-01.html" : "31045-09.html"); } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00027_ChestCaughtWithABaitOfWind/Q00027_ChestCaughtWithABaitOfWind.java b/src/main/java/com/l2jserver/datapack/quests/Q00027_ChestCaughtWithABaitOfWind/Q00027_ChestCaughtWithABaitOfWind.java index d524cc10ce..3d8207820a 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00027_ChestCaughtWithABaitOfWind/Q00027_ChestCaughtWithABaitOfWind.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00027_ChestCaughtWithABaitOfWind/Q00027_ChestCaughtWithABaitOfWind.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by DooMIta. * @author nonom */ -public class Q00027_ChestCaughtWithABaitOfWind extends Quest -{ +public class Q00027_ChestCaughtWithABaitOfWind extends Quest { // NPCs private static final int LANOSCO = 31570; private static final int SHALING = 31434; @@ -40,8 +39,7 @@ public class Q00027_ChestCaughtWithABaitOfWind extends Quest private static final int STRANGE_BLUESPRINT = 7625; private static final int BLACK_PEARL_RING = 880; - public Q00027_ChestCaughtWithABaitOfWind() - { + public Q00027_ChestCaughtWithABaitOfWind() { super(27, Q00027_ChestCaughtWithABaitOfWind.class.getSimpleName(), "Chest Caught With A Bait Of Wind"); addStartNpc(LANOSCO); addTalkId(LANOSCO, SHALING); @@ -49,23 +47,19 @@ public class Q00027_ChestCaughtWithABaitOfWind extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { + switch (event) { case "31570-03.htm": st.startQuest(); break; case "31570-05.htm": - if (st.isCond(1) && st.hasQuestItems(BLUE_TREASURE_BOX)) - { + if (st.isCond(1) && st.hasQuestItems(BLUE_TREASURE_BOX)) { htmltext = "31570-06.htm"; st.setCond(2, true); st.giveItems(STRANGE_BLUESPRINT, 1); @@ -73,8 +67,7 @@ public class Q00027_ChestCaughtWithABaitOfWind extends Quest } break; case "31434-02.htm": - if (st.isCond(2) && st.hasQuestItems(STRANGE_BLUESPRINT)) - { + if (st.isCond(2) && st.hasQuestItems(STRANGE_BLUESPRINT)) { st.giveItems(BLACK_PEARL_RING, 1); st.exitQuest(false, true); htmltext = "31434-01.htm"; @@ -86,44 +79,33 @@ public class Q00027_ChestCaughtWithABaitOfWind extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.COMPLETED: htmltext = getAlreadyCompletedMsg(player); break; case State.CREATED: - if (npc.getId() == LANOSCO) - { + if (npc.getId() == LANOSCO) { htmltext = ((player.getLevel() >= 27) && player.hasQuestCompleted(Q00050_LanoscosSpecialBait.class.getSimpleName())) ? "31570-01.htm" : "31570-02.htm"; } break; case State.STARTED: - switch (npc.getId()) - { + switch (npc.getId()) { case LANOSCO: - if (st.isCond(1)) - { - if (st.hasQuestItems(BLUE_TREASURE_BOX)) - { + if (st.isCond(1)) { + if (st.hasQuestItems(BLUE_TREASURE_BOX)) { htmltext = "31570-04.htm"; - } - else - { + } else { htmltext = "31570-05.htm"; } - } - else - { + } else { htmltext = "31570-07.htm"; } break; case SHALING: - if (st.isCond(2)) - { + if (st.isCond(2)) { htmltext = "31434-00.htm"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00028_ChestCaughtWithABaitOfIcyAir/Q00028_ChestCaughtWithABaitOfIcyAir.java b/src/main/java/com/l2jserver/datapack/quests/Q00028_ChestCaughtWithABaitOfIcyAir/Q00028_ChestCaughtWithABaitOfIcyAir.java index 5f66881057..ba50e72622 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00028_ChestCaughtWithABaitOfIcyAir/Q00028_ChestCaughtWithABaitOfIcyAir.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00028_ChestCaughtWithABaitOfIcyAir/Q00028_ChestCaughtWithABaitOfIcyAir.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by Skeleton. * @author nonom */ -public class Q00028_ChestCaughtWithABaitOfIcyAir extends Quest -{ +public class Q00028_ChestCaughtWithABaitOfIcyAir extends Quest { // NPCs private static final int OFULLE = 31572; private static final int KIKI = 31442; @@ -40,8 +39,7 @@ public class Q00028_ChestCaughtWithABaitOfIcyAir extends Quest private static final int KIKIS_LETTER = 7626; private static final int ELVEN_RING = 881; - public Q00028_ChestCaughtWithABaitOfIcyAir() - { + public Q00028_ChestCaughtWithABaitOfIcyAir() { super(28, Q00028_ChestCaughtWithABaitOfIcyAir.class.getSimpleName(), "Chest Caught With A Bait Of Icy Air"); addStartNpc(OFULLE); addTalkId(OFULLE, KIKI); @@ -49,23 +47,19 @@ public class Q00028_ChestCaughtWithABaitOfIcyAir extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { + switch (event) { case "31572-04.htm": st.startQuest(); break; case "31572-08.htm": - if (st.isCond(1) && st.hasQuestItems(YELLOW_TREASURE_BOX)) - { + if (st.isCond(1) && st.hasQuestItems(YELLOW_TREASURE_BOX)) { st.giveItems(KIKIS_LETTER, 1); st.takeItems(YELLOW_TREASURE_BOX, -1); st.setCond(2, true); @@ -73,8 +67,7 @@ public class Q00028_ChestCaughtWithABaitOfIcyAir extends Quest } break; case "31442-03.htm": - if (st.isCond(2) && st.hasQuestItems(KIKIS_LETTER)) - { + if (st.isCond(2) && st.hasQuestItems(KIKIS_LETTER)) { st.giveItems(ELVEN_RING, 1); st.exitQuest(false, true); htmltext = "31442-02.htm"; @@ -86,32 +79,26 @@ public class Q00028_ChestCaughtWithABaitOfIcyAir extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); final int npcId = npc.getId(); - switch (st.getState()) - { + switch (st.getState()) { case State.COMPLETED: htmltext = getAlreadyCompletedMsg(player); break; case State.CREATED: - if (npcId == OFULLE) - { + if (npcId == OFULLE) { htmltext = ((player.getLevel() >= 36) && player.hasQuestCompleted(Q00051_OFullesSpecialBait.class.getSimpleName())) ? "31572-01.htm" : "31572-02.htm"; } break; case State.STARTED: - switch (npcId) - { + switch (npcId) { case OFULLE: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "31572-06.htm"; - if (st.hasQuestItems(YELLOW_TREASURE_BOX)) - { + if (st.hasQuestItems(YELLOW_TREASURE_BOX)) { htmltext = "31572-05.htm"; } break; @@ -121,8 +108,7 @@ public class Q00028_ChestCaughtWithABaitOfIcyAir extends Quest } break; case KIKI: - if (st.isCond(2)) - { + if (st.isCond(2)) { htmltext = "31442-01.htm"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00029_ChestCaughtWithABaitOfEarth/Q00029_ChestCaughtWithABaitOfEarth.java b/src/main/java/com/l2jserver/datapack/quests/Q00029_ChestCaughtWithABaitOfEarth/Q00029_ChestCaughtWithABaitOfEarth.java index c03cfa208c..7c84cf699a 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00029_ChestCaughtWithABaitOfEarth/Q00029_ChestCaughtWithABaitOfEarth.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00029_ChestCaughtWithABaitOfEarth/Q00029_ChestCaughtWithABaitOfEarth.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by Skeleton. * @author nonom */ -public class Q00029_ChestCaughtWithABaitOfEarth extends Quest -{ +public class Q00029_ChestCaughtWithABaitOfEarth extends Quest { // NPCs private static final int WILLIE = 31574; private static final int ANABEL = 30909; @@ -40,8 +39,7 @@ public class Q00029_ChestCaughtWithABaitOfEarth extends Quest private static final int SMALL_GLASS_BOX = 7627; private static final int PLATED_LEATHER_GLOVES = 2455; - public Q00029_ChestCaughtWithABaitOfEarth() - { + public Q00029_ChestCaughtWithABaitOfEarth() { super(29, Q00029_ChestCaughtWithABaitOfEarth.class.getSimpleName(), "Chest Caught With A Bait Of Earth"); addStartNpc(WILLIE); addTalkId(WILLIE, ANABEL); @@ -49,23 +47,19 @@ public class Q00029_ChestCaughtWithABaitOfEarth extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { + switch (event) { case "31574-04.htm": st.startQuest(); break; case "31574-08.htm": - if (st.isCond(1) && st.hasQuestItems(PURPLE_TREASURE_BOX)) - { + if (st.isCond(1) && st.hasQuestItems(PURPLE_TREASURE_BOX)) { st.giveItems(SMALL_GLASS_BOX, 1); st.takeItems(PURPLE_TREASURE_BOX, -1); st.setCond(2, true); @@ -73,8 +67,7 @@ public class Q00029_ChestCaughtWithABaitOfEarth extends Quest } break; case "30909-03.htm": - if (st.isCond(2) && st.hasQuestItems(SMALL_GLASS_BOX)) - { + if (st.isCond(2) && st.hasQuestItems(SMALL_GLASS_BOX)) { st.giveItems(PLATED_LEATHER_GLOVES, 1); st.exitQuest(false, true); htmltext = "30909-02.htm"; @@ -86,32 +79,26 @@ public class Q00029_ChestCaughtWithABaitOfEarth extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); final int npcId = npc.getId(); - switch (st.getState()) - { + switch (st.getState()) { case State.COMPLETED: htmltext = getAlreadyCompletedMsg(player); break; case State.CREATED: - if (npcId == WILLIE) - { + if (npcId == WILLIE) { htmltext = ((player.getLevel() >= 48) && player.hasQuestCompleted(Q00052_WilliesSpecialBait.class.getSimpleName())) ? "31574-01.htm" : "31574-02.htm"; } break; case State.STARTED: - switch (npcId) - { + switch (npcId) { case WILLIE: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "31574-06.htm"; - if (st.hasQuestItems(PURPLE_TREASURE_BOX)) - { + if (st.hasQuestItems(PURPLE_TREASURE_BOX)) { htmltext = "31574-05.htm"; } break; @@ -121,8 +108,7 @@ public class Q00029_ChestCaughtWithABaitOfEarth extends Quest } break; case ANABEL: - if (st.isCond(2)) - { + if (st.isCond(2)) { htmltext = "30909-01.htm"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00030_ChestCaughtWithABaitOfFire/Q00030_ChestCaughtWithABaitOfFire.java b/src/main/java/com/l2jserver/datapack/quests/Q00030_ChestCaughtWithABaitOfFire/Q00030_ChestCaughtWithABaitOfFire.java index 373f45575f..807a8c443e 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00030_ChestCaughtWithABaitOfFire/Q00030_ChestCaughtWithABaitOfFire.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00030_ChestCaughtWithABaitOfFire/Q00030_ChestCaughtWithABaitOfFire.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by Ethernaly. * @author nonom */ -public class Q00030_ChestCaughtWithABaitOfFire extends Quest -{ +public class Q00030_ChestCaughtWithABaitOfFire extends Quest { // NPCs private static final int LINNAEUS = 31577; private static final int RUKAL = 30629; @@ -40,8 +39,7 @@ public class Q00030_ChestCaughtWithABaitOfFire extends Quest private static final int RUKAL_MUSICAL = 7628; private static final int PROTECTION_NECKLACE = 916; - public Q00030_ChestCaughtWithABaitOfFire() - { + public Q00030_ChestCaughtWithABaitOfFire() { super(30, Q00030_ChestCaughtWithABaitOfFire.class.getSimpleName(), "Chest Caught With A Bait Of Fire"); addStartNpc(LINNAEUS); addTalkId(LINNAEUS, RUKAL); @@ -49,23 +47,19 @@ public class Q00030_ChestCaughtWithABaitOfFire extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { + switch (event) { case "31577-02.htm": st.startQuest(); break; case "31577-04a.htm": - if (st.isCond(1) && st.hasQuestItems(RED_TREASURE_BOX)) - { + if (st.isCond(1) && st.hasQuestItems(RED_TREASURE_BOX)) { st.giveItems(RUKAL_MUSICAL, 1); st.takeItems(RED_TREASURE_BOX, -1); st.setCond(2, true); @@ -73,8 +67,7 @@ public class Q00030_ChestCaughtWithABaitOfFire extends Quest } break; case "30629-02.htm": - if (st.isCond(2) && st.hasQuestItems(RUKAL_MUSICAL)) - { + if (st.isCond(2) && st.hasQuestItems(RUKAL_MUSICAL)) { st.giveItems(PROTECTION_NECKLACE, 1); st.exitQuest(false, true); htmltext = "30629-03.htm"; @@ -85,32 +78,26 @@ public class Q00030_ChestCaughtWithABaitOfFire extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); final int npcId = npc.getId(); - switch (st.getState()) - { + switch (st.getState()) { case State.COMPLETED: htmltext = getAlreadyCompletedMsg(player); break; case State.CREATED: - if (npcId == LINNAEUS) - { + if (npcId == LINNAEUS) { htmltext = ((player.getLevel() >= 61) && player.hasQuestCompleted(Q00053_LinnaeusSpecialBait.class.getSimpleName())) ? "31577-01.htm" : "31577-00.htm"; } break; case State.STARTED: - switch (npcId) - { + switch (npcId) { case LINNAEUS: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "31577-03a.htm"; - if (st.hasQuestItems(RED_TREASURE_BOX)) - { + if (st.hasQuestItems(RED_TREASURE_BOX)) { htmltext = "31577-03.htm"; } break; @@ -120,8 +107,7 @@ public class Q00030_ChestCaughtWithABaitOfFire extends Quest } break; case RUKAL: - if (st.isCond(2)) - { + if (st.isCond(2)) { htmltext = "30629-01.htm"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00031_SecretBuriedInTheSwamp/Q00031_SecretBuriedInTheSwamp.java b/src/main/java/com/l2jserver/datapack/quests/Q00031_SecretBuriedInTheSwamp/Q00031_SecretBuriedInTheSwamp.java index 85401f71bd..f53d173cdc 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00031_SecretBuriedInTheSwamp/Q00031_SecretBuriedInTheSwamp.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00031_SecretBuriedInTheSwamp/Q00031_SecretBuriedInTheSwamp.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.State; * Secret Buried in the Swamp (31) * @author janiko */ -public final class Q00031_SecretBuriedInTheSwamp extends Quest -{ +public final class Q00031_SecretBuriedInTheSwamp extends Quest { // NPCs private static final int ABERCROMBIE = 31555; private static final int FORGOTTEN_MONUMENT_1 = 31661; @@ -47,8 +46,7 @@ public final class Q00031_SecretBuriedInTheSwamp extends Quest // Monuments private static final List<Integer> MONUMENTS = Arrays.asList(FORGOTTEN_MONUMENT_1, FORGOTTEN_MONUMENT_2, FORGOTTEN_MONUMENT_3, FORGOTTEN_MONUMENT_4); - public Q00031_SecretBuriedInTheSwamp() - { + public Q00031_SecretBuriedInTheSwamp() { super(31, Q00031_SecretBuriedInTheSwamp.class.getSimpleName(), "Secret Buried in the Swamp"); addStartNpc(ABERCROMBIE); addTalkId(ABERCROMBIE, CORPSE_OF_DWARF); @@ -57,40 +55,31 @@ public final class Q00031_SecretBuriedInTheSwamp extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { - case "31555-02.html": - { - if (st.isCreated()) - { + switch (event) { + case "31555-02.html": { + if (st.isCreated()) { st.startQuest(); htmltext = event; } break; } - case "31665-02.html": - { - if (st.isCond(1)) - { + case "31665-02.html": { + if (st.isCond(1)) { st.setCond(2, true); st.giveItems(KRORINS_JOURNAL, 1); htmltext = event; } break; } - case "31555-05.html": - { - if (st.isCond(2) && st.hasQuestItems(KRORINS_JOURNAL)) - { + case "31555-05.html": { + if (st.isCond(2) && st.hasQuestItems(KRORINS_JOURNAL)) { st.takeItems(KRORINS_JOURNAL, -1); st.setCond(3, true); htmltext = event; @@ -100,19 +89,15 @@ public final class Q00031_SecretBuriedInTheSwamp extends Quest case "31661-02.html": case "31662-02.html": case "31663-02.html": - case "31664-02.html": - { - if (MONUMENTS.contains(npc.getId()) && st.isCond(MONUMENTS.indexOf(npc.getId()) + 3)) - { + case "31664-02.html": { + if (MONUMENTS.contains(npc.getId()) && st.isCond(MONUMENTS.indexOf(npc.getId()) + 3)) { st.setCond(st.getCond() + 1, true); htmltext = event; } break; } - case "31555-08.html": - { - if (st.isCond(7)) - { + case "31555-08.html": { + if (st.isCond(7)) { st.addExpAndSp(490000, 45880); st.giveAdena(120000, true); st.exitQuest(false, true); @@ -125,70 +110,53 @@ public final class Q00031_SecretBuriedInTheSwamp extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (npc.getId()) - { - case ABERCROMBIE: - { - switch (st.getState()) - { - case State.CREATED: - { + switch (npc.getId()) { + case ABERCROMBIE: { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getLevel() >= MIN_LVL) ? "31555-01.htm" : "31555-03.htm"; break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "31555-02.html"; break; } - case 2: - { - if (st.hasQuestItems(KRORINS_JOURNAL)) - { + case 2: { + if (st.hasQuestItems(KRORINS_JOURNAL)) { htmltext = "31555-04.html"; } break; } - case 3: - { + case 3: { htmltext = "31555-06.html"; break; } - case 7: - { + case 7: { htmltext = "31555-07.html"; break; } } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } } break; } - case CORPSE_OF_DWARF: - { - switch (st.getCond()) - { - case 1: - { + case CORPSE_OF_DWARF: { + switch (st.getCond()) { + case 1: { htmltext = "31665-01.html"; break; } - case 2: - { + case 2: { htmltext = "31665-03.html"; break; } @@ -198,15 +166,11 @@ public final class Q00031_SecretBuriedInTheSwamp extends Quest case FORGOTTEN_MONUMENT_1: case FORGOTTEN_MONUMENT_2: case FORGOTTEN_MONUMENT_3: - case FORGOTTEN_MONUMENT_4: - { + case FORGOTTEN_MONUMENT_4: { final int loc = MONUMENTS.indexOf(npc.getId()) + 3; - if (st.isCond(loc)) - { + if (st.isCond(loc)) { htmltext = npc.getId() + "-01.html"; - } - else if (st.isCond(loc + 1)) - { + } else if (st.isCond(loc + 1)) { htmltext = npc.getId() + "-03.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java b/src/main/java/com/l2jserver/datapack/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java index e41a4a35cf..0271138b5c 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * An Obvious Lie (32). * @author janiko */ -public final class Q00032_AnObviousLie extends Quest -{ +public final class Q00032_AnObviousLie extends Quest { // NPCs private static final int MAXIMILIAN = 30120; private static final int GENTLER = 30094; @@ -55,8 +54,7 @@ public final class Q00032_AnObviousLie extends Quest EARS.put("rabbit", 7683); // Rabbit ears } - public Q00032_AnObviousLie() - { + public Q00032_AnObviousLie() { super(32, Q00032_AnObviousLie.class.getSimpleName(), "An Obvious Lie"); addStartNpc(MAXIMILIAN); addTalkId(MAXIMILIAN, GENTLER, MIKI_THE_CAT); @@ -65,84 +63,66 @@ public final class Q00032_AnObviousLie extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { - case "30120-02.html": - { - if (qs.isCreated()) - { + switch (event) { + case "30120-02.html": { + if (qs.isCreated()) { qs.startQuest(); htmltext = event; } break; } - case "30094-02.html": - { - if (qs.isCond(1)) - { + case "30094-02.html": { + if (qs.isCond(1)) { giveItems(player, MAP_OF_GENTLER, 1); qs.setCond(2, true); htmltext = event; } break; } - case "31706-02.html": - { - if (qs.isCond(2) && hasQuestItems(player, MAP_OF_GENTLER)) - { + case "31706-02.html": { + if (qs.isCond(2) && hasQuestItems(player, MAP_OF_GENTLER)) { takeItems(player, MAP_OF_GENTLER, -1); qs.setCond(3, true); htmltext = event; } break; } - case "30094-06.html": - { - if (qs.isCond(4) && hasItem(player, MEDICINAL_HERB)) - { + case "30094-06.html": { + if (qs.isCond(4) && hasItem(player, MEDICINAL_HERB)) { takeItem(player, MEDICINAL_HERB); qs.setCond(5, true); htmltext = event; } break; } - case "30094-09.html": - { - if (qs.isCond(5) && hasItem(player, SPIRIT_ORE)) - { + case "30094-09.html": { + if (qs.isCond(5) && hasItem(player, SPIRIT_ORE)) { takeItem(player, SPIRIT_ORE); qs.setCond(6, true); htmltext = event; } break; } - case "30094-12.html": - { - if (qs.isCond(7)) - { + case "30094-12.html": { + if (qs.isCond(7)) { qs.setCond(8, true); htmltext = event; } break; } - case "30094-15.html": - { + case "30094-15.html": { htmltext = event; break; } - case "31706-05.html": - { - if (qs.isCond(6)) - { + case "31706-05.html": { + if (qs.isCond(6)) { qs.setCond(7, true); htmltext = event; } @@ -150,16 +130,12 @@ public final class Q00032_AnObviousLie extends Quest } case "cat": case "raccoon": - case "rabbit": - { - if (qs.isCond(8) && takeAllItems(player, THREAD, SUEDE)) - { + case "rabbit": { + if (qs.isCond(8) && takeAllItems(player, THREAD, SUEDE)) { giveItems(player, EARS.get(event), 1); qs.exitQuest(false, true); htmltext = "30094-16.html"; - } - else - { + } else { htmltext = "30094-17.html"; } break; @@ -169,84 +145,61 @@ public final class Q00032_AnObviousLie extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, 3, 3, npc); - if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, MEDICINAL_HERB.getId(), 1, MEDICINAL_HERB.getCount(), 1.0, true)) - { + if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, MEDICINAL_HERB.getId(), 1, MEDICINAL_HERB.getCount(), 1.0, true)) { qs.setCond(4); } return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (npc.getId()) - { - case MAXIMILIAN: - { - if (qs.isCreated()) - { + switch (npc.getId()) { + case MAXIMILIAN: { + if (qs.isCreated()) { htmltext = ((player.getLevel() >= MIN_LVL) ? "30120-01.htm" : "30120-03.htm"); - } - else if (qs.isStarted()) - { - if (qs.isCond(1)) - { + } else if (qs.isStarted()) { + if (qs.isCond(1)) { htmltext = "30120-04.html"; } - } - else - { + } else { htmltext = getAlreadyCompletedMsg(player); } break; } - case GENTLER: - { - switch (qs.getCond()) - { - case 1: - { + case GENTLER: { + switch (qs.getCond()) { + case 1: { htmltext = "30094-01.html"; break; } - case 2: - { + case 2: { htmltext = "30094-03.html"; break; } - case 4: - { + case 4: { htmltext = (hasItem(player, MEDICINAL_HERB) ? "30094-04.html" : "30094-05.html"); break; } - case 5: - { + case 5: { htmltext = (hasItem(player, SPIRIT_ORE) ? "30094-07.html" : "30094-08.html"); break; } - case 6: - { + case 6: { htmltext = "30094-10.html"; break; } - case 7: - { + case 7: { htmltext = "30094-11.html"; break; } - case 8: - { - if (hasAllItems(player, true, THREAD, SUEDE)) - { + case 8: { + if (hasAllItems(player, true, THREAD, SUEDE)) { htmltext = "30094-13.html"; - } - else - { + } else { htmltext = "30094-14.html"; } break; @@ -254,32 +207,25 @@ public final class Q00032_AnObviousLie extends Quest } break; } - case MIKI_THE_CAT: - { - switch (qs.getCond()) - { - case 2: - { - if (hasQuestItems(player, MAP_OF_GENTLER)) - { + case MIKI_THE_CAT: { + switch (qs.getCond()) { + case 2: { + if (hasQuestItems(player, MAP_OF_GENTLER)) { htmltext = "31706-01.html"; } break; } case 3: case 4: - case 5: - { + case 5: { htmltext = "31706-03.html"; break; } - case 6: - { + case 6: { htmltext = "31706-04.html"; break; } - case 7: - { + case 7: { htmltext = "31706-06.html"; break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00033_MakeAPairOfDressShoes/Q00033_MakeAPairOfDressShoes.java b/src/main/java/com/l2jserver/datapack/quests/Q00033_MakeAPairOfDressShoes/Q00033_MakeAPairOfDressShoes.java index 2c7a77dded..1726f08086 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00033_MakeAPairOfDressShoes/Q00033_MakeAPairOfDressShoes.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00033_MakeAPairOfDressShoes/Q00033_MakeAPairOfDressShoes.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * Make a Pair of Dress Shoes (33) * @author malyelfik */ -public class Q00033_MakeAPairOfDressShoes extends Quest -{ +public class Q00033_MakeAPairOfDressShoes extends Quest { // NPCs private static final int IAN = 30164; private static final int WOODLEY = 30838; @@ -47,25 +46,21 @@ public class Q00033_MakeAPairOfDressShoes extends Quest private static final int ADENA_COUNT2 = 200000; private static final int ADENA_COUNT3 = 300000; - public Q00033_MakeAPairOfDressShoes() - { + public Q00033_MakeAPairOfDressShoes() { super(33, Q00033_MakeAPairOfDressShoes.class.getSimpleName(), "Make a Pair of Dress Shoes"); addStartNpc(WOODLEY); addTalkId(WOODLEY, IAN, LEIKAR); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "30838-03.htm": st.startQuest(); break; @@ -73,15 +68,12 @@ public class Q00033_MakeAPairOfDressShoes extends Quest st.setCond(3, true); break; case "30838-09.html": - if ((st.getQuestItemsCount(LEATHER) >= LEATHER_COUNT) && (st.getQuestItemsCount(THREAD) >= THREAD_COUNT) && (player.getAdena() >= ADENA_COUNT2)) - { + if ((st.getQuestItemsCount(LEATHER) >= LEATHER_COUNT) && (st.getQuestItemsCount(THREAD) >= THREAD_COUNT) && (player.getAdena() >= ADENA_COUNT2)) { st.takeItems(LEATHER, LEATHER_COUNT); st.takeItems(THREAD, LEATHER_COUNT); st.takeItems(Inventory.ADENA_ID, ADENA_COUNT2); st.setCond(4, true); - } - else - { + } else { htmltext = "30838-10.html"; } break; @@ -93,8 +85,7 @@ public class Q00033_MakeAPairOfDressShoes extends Quest st.setCond(2, true); break; case "30164-02.html": - if (player.getAdena() < ADENA_COUNT3) - { + if (player.getAdena() < ADENA_COUNT3) { return "30164-03.html"; } st.takeItems(Inventory.ADENA_ID, ADENA_COUNT3); @@ -108,21 +99,17 @@ public class Q00033_MakeAPairOfDressShoes extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case WOODLEY: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? "30838-01.htm" : "30838-02.html"; break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "30838-04.html"; break; @@ -146,27 +133,19 @@ public class Q00033_MakeAPairOfDressShoes extends Quest } break; case LEIKAR: - if (st.isStarted()) - { - if (st.isCond(1)) - { + if (st.isStarted()) { + if (st.isCond(1)) { htmltext = "31520-01.html"; - } - else if (st.isCond(2)) - { + } else if (st.isCond(2)) { htmltext = "31520-03.html"; } } break; case IAN: - if (st.isStarted()) - { - if (st.isCond(4)) - { + if (st.isStarted()) { + if (st.isCond(4)) { htmltext = "30164-01.html"; - } - else if (st.isCond(5)) - { + } else if (st.isCond(5)) { htmltext = "30164-04.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00034_InSearchOfCloth/Q00034_InSearchOfCloth.java b/src/main/java/com/l2jserver/datapack/quests/Q00034_InSearchOfCloth/Q00034_InSearchOfCloth.java index 3be09edcff..fbf2725b6c 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00034_InSearchOfCloth/Q00034_InSearchOfCloth.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00034_InSearchOfCloth/Q00034_InSearchOfCloth.java @@ -29,15 +29,13 @@ import com.l2jserver.gameserver.model.quest.State; * In Search of Cloth (34) * @author malyelfik */ -public class Q00034_InSearchOfCloth extends Quest -{ +public class Q00034_InSearchOfCloth extends Quest { // NPCs private static final int RADIA = 30088; private static final int RALFORD = 30165; private static final int VARAN = 30294; // Monsters - private static final int[] MOBS = - { + private static final int[] MOBS = { 20560, // Trisalim Spider 20561, // Trisalim Tarantula }; @@ -53,8 +51,7 @@ public class Q00034_InSearchOfCloth extends Quest private static final int SUEDE_COUNT = 3000; private static final int THREAD_COUNT = 5000; - public Q00034_InSearchOfCloth() - { + public Q00034_InSearchOfCloth() { super(34, Q00034_InSearchOfCloth.class.getSimpleName(), "In Search of Cloth"); addStartNpc(RADIA); addTalkId(RADIA, RALFORD, VARAN); @@ -63,17 +60,14 @@ public class Q00034_InSearchOfCloth extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "30088-03.htm": st.startQuest(); break; @@ -87,8 +81,7 @@ public class Q00034_InSearchOfCloth extends Quest st.setCond(4, true); break; case "30165-05.html": - if (st.getQuestItemsCount(SPINNERET) < SPINNERET_COUNT) - { + if (st.getQuestItemsCount(SPINNERET) < SPINNERET_COUNT) { return getNoQuestMsg(player); } st.takeItems(SPINNERET, SPINNERET_COUNT); @@ -96,16 +89,13 @@ public class Q00034_InSearchOfCloth extends Quest st.setCond(6, true); break; case "30088-10.html": - if ((st.getQuestItemsCount(SUEDE) >= SUEDE_COUNT) && (st.getQuestItemsCount(THREAD) >= THREAD_COUNT) && st.hasQuestItems(SKEIN_OF_YARN)) - { + if ((st.getQuestItemsCount(SUEDE) >= SUEDE_COUNT) && (st.getQuestItemsCount(THREAD) >= THREAD_COUNT) && st.hasQuestItems(SKEIN_OF_YARN)) { st.takeItems(SKEIN_OF_YARN, 1); st.takeItems(SUEDE, SUEDE_COUNT); st.takeItems(THREAD, THREAD_COUNT); st.giveItems(MYSTERIOUS_CLOTH, 1); st.exitQuest(false, true); - } - else - { + } else { htmltext = "30088-11.html"; } break; @@ -117,19 +107,14 @@ public class Q00034_InSearchOfCloth extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance member = getRandomPartyMember(player, 4); - if ((member != null) && getRandomBoolean()) - { + if ((member != null) && getRandomBoolean()) { final QuestState st = getQuestState(member, false); st.giveItems(SPINNERET, 1); - if (st.getQuestItemsCount(SPINNERET) >= SPINNERET_COUNT) - { + if (st.getQuestItemsCount(SPINNERET) >= SPINNERET_COUNT) { st.setCond(5, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -137,21 +122,17 @@ public class Q00034_InSearchOfCloth extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case RADIA: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? "30088-01.htm" : "30088-02.html"; break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "30088-04.html"; break; @@ -172,10 +153,8 @@ public class Q00034_InSearchOfCloth extends Quest } break; case VARAN: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: htmltext = "30294-01.html"; break; @@ -186,10 +165,8 @@ public class Q00034_InSearchOfCloth extends Quest } break; case RALFORD: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 3: htmltext = "30165-01.html"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00035_FindGlitteringJewelry/Q00035_FindGlitteringJewelry.java b/src/main/java/com/l2jserver/datapack/quests/Q00035_FindGlitteringJewelry/Q00035_FindGlitteringJewelry.java index 6100943e3f..373a700cc3 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00035_FindGlitteringJewelry/Q00035_FindGlitteringJewelry.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00035_FindGlitteringJewelry/Q00035_FindGlitteringJewelry.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * Find Glittering Jewelry (35) * @author malyelfik */ -public class Q00035_FindGlitteringJewelry extends Quest -{ +public class Q00035_FindGlitteringJewelry extends Quest { // NPCs private static final int ELLIE = 30091; private static final int FELTON = 30879; @@ -49,8 +48,7 @@ public class Q00035_FindGlitteringJewelry extends Quest private static final int NUGGET_COUNT = 500; private static final int THONS_COUNT = 150; - public Q00035_FindGlitteringJewelry() - { + public Q00035_FindGlitteringJewelry() { super(35, Q00035_FindGlitteringJewelry.class.getSimpleName(), "Find Glittering Jewelry"); addStartNpc(ELLIE); addTalkId(ELLIE, FELTON); @@ -59,17 +57,14 @@ public class Q00035_FindGlitteringJewelry extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "30091-03.htm": st.startQuest(); break; @@ -77,24 +72,20 @@ public class Q00035_FindGlitteringJewelry extends Quest st.setCond(2, true); break; case "30091-07.html": - if (st.getQuestItemsCount(ROUGH_JEWEL) < JEWEL_COUNT) - { + if (st.getQuestItemsCount(ROUGH_JEWEL) < JEWEL_COUNT) { return "30091-08.html"; } st.takeItems(ROUGH_JEWEL, -1); st.setCond(4, true); break; case "30091-11.html": - if ((st.getQuestItemsCount(ORIHARUKON) >= ORIHARUKON_COUNT) && (st.getQuestItemsCount(SILVER_NUGGET) >= NUGGET_COUNT) && (st.getQuestItemsCount(THONS) >= THONS_COUNT)) - { + if ((st.getQuestItemsCount(ORIHARUKON) >= ORIHARUKON_COUNT) && (st.getQuestItemsCount(SILVER_NUGGET) >= NUGGET_COUNT) && (st.getQuestItemsCount(THONS) >= THONS_COUNT)) { st.takeItems(ORIHARUKON, ORIHARUKON_COUNT); st.takeItems(SILVER_NUGGET, NUGGET_COUNT); st.takeItems(THONS, THONS_COUNT); st.giveItems(JEWEL_BOX, 1); st.exitQuest(false, true); - } - else - { + } else { htmltext = "30091-12.html"; } break; @@ -106,21 +97,15 @@ public class Q00035_FindGlitteringJewelry extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance member = getRandomPartyMember(player, 2); - if (member != null) - { + if (member != null) { final QuestState st = getQuestState(member, false); - if (getRandomBoolean()) - { + if (getRandomBoolean()) { st.giveItems(ROUGH_JEWEL, 1); - if (st.getQuestItemsCount(ROUGH_JEWEL) >= JEWEL_COUNT) - { + if (st.getQuestItemsCount(ROUGH_JEWEL) >= JEWEL_COUNT) { st.setCond(3, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -129,21 +114,17 @@ public class Q00035_FindGlitteringJewelry extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case ELLIE: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? "30091-01.htm" : "30091-02.html"; break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "30091-04.html"; break; @@ -161,14 +142,10 @@ public class Q00035_FindGlitteringJewelry extends Quest } break; case FELTON: - if (st.isStarted()) - { - if (st.isCond(1)) - { + if (st.isStarted()) { + if (st.isCond(1)) { htmltext = "30879-01.html"; - } - else if (st.isCond(2)) - { + } else if (st.isCond(2)) { htmltext = "30879-03.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00036_MakeASewingKit/Q00036_MakeASewingKit.java b/src/main/java/com/l2jserver/datapack/quests/Q00036_MakeASewingKit/Q00036_MakeASewingKit.java index 4b0b021964..378c45da80 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00036_MakeASewingKit/Q00036_MakeASewingKit.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00036_MakeASewingKit/Q00036_MakeASewingKit.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * Make a Sewing Kit (36) * @author malyelfik */ -public class Q00036_MakeASewingKit extends Quest -{ +public class Q00036_MakeASewingKit extends Quest { // NPC private static final int FERRIS = 30847; // Monster @@ -45,8 +44,7 @@ public class Q00036_MakeASewingKit extends Quest private static final int IRON_COUNT = 5; private static final int COUNT = 10; - public Q00036_MakeASewingKit() - { + public Q00036_MakeASewingKit() { super(36, Q00036_MakeASewingKit.class.getSimpleName(), "Make a Sewing Kit"); addStartNpc(FERRIS); addTalkId(FERRIS); @@ -55,38 +53,31 @@ public class Q00036_MakeASewingKit extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "30847-03.htm": st.startQuest(); break; case "30847-06.html": - if (st.getQuestItemsCount(ENCHANTED_IRON) < IRON_COUNT) - { + if (st.getQuestItemsCount(ENCHANTED_IRON) < IRON_COUNT) { return getNoQuestMsg(player); } st.takeItems(ENCHANTED_IRON, -1); st.setCond(3, true); break; case "30847-09.html": - if ((st.getQuestItemsCount(ARTISANS_FRAME) >= COUNT) && (st.getQuestItemsCount(ORIHARUKON) >= COUNT)) - { + if ((st.getQuestItemsCount(ARTISANS_FRAME) >= COUNT) && (st.getQuestItemsCount(ORIHARUKON) >= COUNT)) { st.takeItems(ARTISANS_FRAME, 10); st.takeItems(ORIHARUKON, 10); st.giveItems(SEWING_KIT, 1); st.exitQuest(false, true); - } - else - { + } else { htmltext = "30847-10.html"; } break; @@ -98,21 +89,15 @@ public class Q00036_MakeASewingKit extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance member = getRandomPartyMember(player, 1); - if (member != null) - { + if (member != null) { final QuestState st = getQuestState(member, false); - if (getRandomBoolean()) - { + if (getRandomBoolean()) { st.giveItems(ENCHANTED_IRON, 1); - if (st.getQuestItemsCount(ENCHANTED_IRON) >= IRON_COUNT) - { + if (st.getQuestItemsCount(ENCHANTED_IRON) >= IRON_COUNT) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -121,18 +106,15 @@ public class Q00036_MakeASewingKit extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? "30847-01.htm" : "30847-02.html"; break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "30847-04.html"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00037_MakeFormalWear/Q00037_MakeFormalWear.java b/src/main/java/com/l2jserver/datapack/quests/Q00037_MakeFormalWear/Q00037_MakeFormalWear.java index 476470315c..0b9625478e 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00037_MakeFormalWear/Q00037_MakeFormalWear.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00037_MakeFormalWear/Q00037_MakeFormalWear.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.State; * Make Formal Wear (37) * @author malyelfik */ -public class Q00037_MakeFormalWear extends Quest -{ +public class Q00037_MakeFormalWear extends Quest { // NPCs private static final int ALEXIS = 30842; private static final int LEIKAR = 31520; @@ -47,8 +46,7 @@ public class Q00037_MakeFormalWear extends Quest // Misc private static final int MIN_LEVEL = 60; - public Q00037_MakeFormalWear() - { + public Q00037_MakeFormalWear() { super(37, Q00037_MakeFormalWear.class.getSimpleName(), "Make Formal Wear"); addStartNpc(ALEXIS); addTalkId(ALEXIS, JEREMY, LEIKAR, MIST); @@ -56,17 +54,14 @@ public class Q00037_MakeFormalWear extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "30842-03.htm": st.startQuest(); break; @@ -79,8 +74,7 @@ public class Q00037_MakeFormalWear extends Quest st.setCond(3, true); break; case "31627-02.html": - if (!st.hasQuestItems(ICE_WINE)) - { + if (!st.hasQuestItems(ICE_WINE)) { return getNoQuestMsg(player); } st.takeItems(ICE_WINE, 1); @@ -91,16 +85,14 @@ public class Q00037_MakeFormalWear extends Quest st.setCond(5, true); break; case "31520-05.html": - if (!st.hasQuestItems(BOX_OF_COOKIES)) - { + if (!st.hasQuestItems(BOX_OF_COOKIES)) { return getNoQuestMsg(player); } st.takeItems(BOX_OF_COOKIES, 1); st.setCond(6, true); break; case "31520-08.html": - if (!st.hasQuestItems(SEWING_KIT, JEWEL_BOX, MYSTERIOUS_CLOTH)) - { + if (!st.hasQuestItems(SEWING_KIT, JEWEL_BOX, MYSTERIOUS_CLOTH)) { return "31520-09.html"; } st.takeItems(SEWING_KIT, 1); @@ -109,8 +101,7 @@ public class Q00037_MakeFormalWear extends Quest st.setCond(7, true); break; case "31520-12.html": - if (!st.hasQuestItems(DRESS_SHOES_BOX)) - { + if (!st.hasQuestItems(DRESS_SHOES_BOX)) { return "31520-13.html"; } st.takeItems(DRESS_SHOES_BOX, 1); @@ -125,21 +116,17 @@ public class Q00037_MakeFormalWear extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case ALEXIS: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? "30842-01.htm" : "30842-02.html"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "30842-04.html"; } break; @@ -149,10 +136,8 @@ public class Q00037_MakeFormalWear extends Quest } break; case LEIKAR: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: htmltext = "31520-01.html"; break; @@ -173,10 +158,8 @@ public class Q00037_MakeFormalWear extends Quest } break; case JEREMY: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 2: htmltext = "31521-01.html"; break; @@ -193,10 +176,8 @@ public class Q00037_MakeFormalWear extends Quest } break; case MIST: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 3: htmltext = "31627-01.html"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00038_DragonFangs/Q00038_DragonFangs.java b/src/main/java/com/l2jserver/datapack/quests/Q00038_DragonFangs/Q00038_DragonFangs.java index 604ff7b1f5..d5ba4c41e4 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00038_DragonFangs/Q00038_DragonFangs.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00038_DragonFangs/Q00038_DragonFangs.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Dragon Fangs (38) * @author Janiko */ -public final class Q00038_DragonFangs extends Quest -{ +public final class Q00038_DragonFangs extends Quest { // NPCs private static final int IRIS = 30034; private static final int MAGISTER_ROHMER = 30344; @@ -53,8 +52,7 @@ public final class Q00038_DragonFangs extends Quest // Misc private static final int MIN_LVL = 19; - public Q00038_DragonFangs() - { + public Q00038_DragonFangs() { super(38, Q00038_DragonFangs.class.getSimpleName(), "Dragon Fangs"); addStartNpc(GUARD_LUIS); addTalkId(GUARD_LUIS, IRIS, MAGISTER_ROHMER); @@ -63,130 +61,93 @@ public final class Q00038_DragonFangs extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { - case "30386-03.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "30386-03.htm": { + if (qs.isCreated()) { qs.startQuest(); htmltext = event; } break; } - case "30386-06.html": - { - if (qs.isCond(2)) - { - if (hasItem(player, FEATHER)) - { + case "30386-06.html": { + if (qs.isCond(2)) { + if (hasItem(player, FEATHER)) { qs.setCond(3, true); takeItem(player, FEATHER); giveItems(player, TOTEM_TOOTH_1ST, 1); htmltext = event; - } - else - { + } else { htmltext = "30386-07.html"; } } break; } - case "30034-02.html": - { - if (qs.isCond(3)) - { - if (hasQuestItems(player, TOTEM_TOOTH_1ST)) - { + case "30034-02.html": { + if (qs.isCond(3)) { + if (hasQuestItems(player, TOTEM_TOOTH_1ST)) { qs.setCond(4, true); takeItems(player, TOTEM_TOOTH_1ST, 1); giveItems(player, LETTER_1ST, 1); htmltext = event; - } - else - { + } else { htmltext = "30034-03.html"; } } break; } - case "30034-06.html": - { - if (qs.isCond(5)) - { - if (hasQuestItems(player, LETTER_2ND)) - { + case "30034-06.html": { + if (qs.isCond(5)) { + if (hasQuestItems(player, LETTER_2ND)) { qs.setCond(6, true); takeItems(player, LETTER_2ND, 1); htmltext = event; - } - else - { + } else { htmltext = "30034-07.html"; } } break; } - case "30034-10.html": - { - if (qs.isCond(7)) - { - if (hasItem(player, TOTEM_TOOTH_2ND)) - { + case "30034-10.html": { + if (qs.isCond(7)) { + if (hasItem(player, TOTEM_TOOTH_2ND)) { addExpAndSp(player, 435117, 23977); final int chance = getRandom(1000); - if (chance < 250) - { + if (chance < 250) { rewardItems(player, BONE_HELMET, 1); giveAdena(player, 5200, true); - } - else if (chance < 500) - { + } else if (chance < 500) { rewardItems(player, ASPIS, 1); giveAdena(player, 1500, true); - } - else if (chance < 750) - { + } else if (chance < 750) { rewardItems(player, BLUE_BUCKSKIN_BOOTS, 1); giveAdena(player, 3200, true); - } - else if (chance < 1000) - { + } else if (chance < 1000) { rewardItems(player, LEATHER_GAUNTLET, 1); giveAdena(player, 3200, true); } qs.exitQuest(false, true); htmltext = event; - } - else - { + } else { htmltext = "30034-11.html"; } } break; } - case "30344-02.html": - { - if (qs.isCond(4)) - { - if (hasQuestItems(player, LETTER_1ST)) - { + case "30344-02.html": { + if (qs.isCond(4)) { + if (hasQuestItems(player, LETTER_1ST)) { qs.setCond(5, true); takeItems(player, LETTER_1ST, 1); giveItems(player, LETTER_2ND, 1); htmltext = event; - } - else - { + } else { htmltext = "30344-03.html"; } } @@ -197,41 +158,31 @@ public final class Q00038_DragonFangs extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (npc.getId()) - { - case IRIS: - { - switch (qs.getCond()) - { - case 3: - { + switch (npc.getId()) { + case IRIS: { + switch (qs.getCond()) { + case 3: { htmltext = "30034-01.html"; break; } - case 4: - { + case 4: { htmltext = "30034-04.html"; break; } - case 5: - { + case 5: { htmltext = "30034-05.html"; break; } - case 6: - { + case 6: { htmltext = "30034-09.html"; break; } - case 7: - { - if (hasItem(talker, TOTEM_TOOTH_2ND)) - { + case 7: { + if (hasItem(talker, TOTEM_TOOTH_2ND)) { htmltext = "30034-08.html"; } break; @@ -239,50 +190,35 @@ public final class Q00038_DragonFangs extends Quest } break; } - case MAGISTER_ROHMER: - { - if (qs.isCond(4)) - { + case MAGISTER_ROHMER: { + if (qs.isCond(4)) { htmltext = "30344-01.html"; - } - else if (qs.isCond(5)) - { + } else if (qs.isCond(5)) { htmltext = "30344-04.html"; } break; } - case GUARD_LUIS: - { - if (qs.isCreated()) - { + case GUARD_LUIS: { + if (qs.isCreated()) { htmltext = (talker.getLevel() >= MIN_LVL) ? "30386-01.htm" : "30386-02.htm"; - } - else if (qs.isStarted()) - { - switch (qs.getCond()) - { - case 1: - { + } else if (qs.isStarted()) { + switch (qs.getCond()) { + case 1: { htmltext = "30386-05.html"; break; } - case 2: - { - if (hasItem(talker, FEATHER)) - { + case 2: { + if (hasItem(talker, FEATHER)) { htmltext = "30386-04.html"; } break; } - case 3: - { + case 3: { htmltext = "30386-08.html"; break; } } - } - else if (qs.isCompleted()) - { + } else if (qs.isCompleted()) { htmltext = getAlreadyCompletedMsg(talker); } break; @@ -292,26 +228,20 @@ public final class Q00038_DragonFangs extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - switch (npc.getId()) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + switch (npc.getId()) { case LIZARDMAN_SUB_LEADER: - case LIZARDMAN_SENTINEL: - { + case LIZARDMAN_SENTINEL: { final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc); - if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, FEATHER.getId(), 1, FEATHER.getCount(), 1.0, true)) - { + if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, FEATHER.getId(), 1, FEATHER.getCount(), 1.0, true)) { qs.setCond(2); } break; } case LIZARDMAN_LEADER: - case LIZARDMAN_SHAMAN: - { + case LIZARDMAN_SHAMAN: { final QuestState qs = getRandomPartyMemberState(killer, 6, 3, npc); - if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, TOTEM_TOOTH_2ND.getId(), 1, TOTEM_TOOTH_2ND.getCount(), 0.5, true)) - { + if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, TOTEM_TOOTH_2ND.getId(), 1, TOTEM_TOOTH_2ND.getCount(), 0.5, true)) { qs.setCond(7); } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00039_RedEyedInvaders/Q00039_RedEyedInvaders.java b/src/main/java/com/l2jserver/datapack/quests/Q00039_RedEyedInvaders/Q00039_RedEyedInvaders.java index a120e5d354..20e8e74670 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00039_RedEyedInvaders/Q00039_RedEyedInvaders.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00039_RedEyedInvaders/Q00039_RedEyedInvaders.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Red-eyed Invaders (39) * @author janiko */ -public final class Q00039_RedEyedInvaders extends Quest -{ +public final class Q00039_RedEyedInvaders extends Quest { // NPCs private static final int CAPTAIN_BATHIA = 30332; private static final int GUARD_BABENCO = 30334; @@ -50,8 +49,7 @@ public final class Q00039_RedEyedInvaders extends Quest // Misc private static final int MIN_LVL = 20; - public Q00039_RedEyedInvaders() - { + public Q00039_RedEyedInvaders() { super(39, Q00039_RedEyedInvaders.class.getSimpleName(), "Red-eyed Invaders"); addStartNpc(GUARD_BABENCO); addTalkId(GUARD_BABENCO, CAPTAIN_BATHIA); @@ -60,66 +58,49 @@ public final class Q00039_RedEyedInvaders extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { - case "30334-03.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "30334-03.htm": { + if (qs.isCreated()) { qs.startQuest(); htmltext = event; } break; } - case "30332-02.html": - { - if (qs.isCond(1)) - { + case "30332-02.html": { + if (qs.isCond(1)) { qs.setCond(2, true); htmltext = event; } break; } - case "30332-05.html": - { - if (qs.isCond(3)) - { - if (hasAllItems(player, true, LIZ_NECKLACE_A, LIZ_NECKLACE_B)) - { + case "30332-05.html": { + if (qs.isCond(3)) { + if (hasAllItems(player, true, LIZ_NECKLACE_A, LIZ_NECKLACE_B)) { qs.setCond(4, true); takeAllItems(player, LIZ_NECKLACE_A, LIZ_NECKLACE_B); htmltext = event; - } - else - { + } else { htmltext = "30332-06.html"; } } break; } - case "30332-09.html": - { - if (qs.isCond(5)) - { - if (hasAllItems(player, true, LIZ_PERFUME, LIZ_GEM)) - { + case "30332-09.html": { + if (qs.isCond(5)) { + if (hasAllItems(player, true, LIZ_PERFUME, LIZ_GEM)) { rewardItems(player, GREEN_HIGH_LURE); rewardItems(player, BABYDUCK_ROD); rewardItems(player, FISHING_SHOT_NONE); addExpAndSp(player, 62366, 2783); qs.exitQuest(false, true); htmltext = event; - } - else - { + } else { htmltext = "30332-10.html"; } } @@ -130,56 +111,41 @@ public final class Q00039_RedEyedInvaders extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (npc.getId()) - { - case CAPTAIN_BATHIA: - { - switch (qs.getCond()) - { - case 1: - { + switch (npc.getId()) { + case CAPTAIN_BATHIA: { + switch (qs.getCond()) { + case 1: { htmltext = "30332-01.html"; break; } - case 2: - { + case 2: { htmltext = "30332-03.html"; break; } - case 3: - { + case 3: { htmltext = "30332-04.html"; break; } - case 4: - { + case 4: { htmltext = "30332-07.html"; break; } - case 5: - { + case 5: { htmltext = "30332-08.html"; break; } } break; } - case GUARD_BABENCO: - { - if (qs.isCreated()) - { + case GUARD_BABENCO: { + if (qs.isCreated()) { htmltext = (talker.getLevel() >= MIN_LVL) ? "30334-01.htm" : "30334-02.htm"; - } - else if (qs.isStarted() && qs.isCond(1)) - { + } else if (qs.isStarted() && qs.isCond(1)) { htmltext = "30334-04.html"; - } - else if (qs.isCompleted()) - { + } else if (qs.isCompleted()) { htmltext = getAlreadyCompletedMsg(talker); } break; @@ -189,81 +155,57 @@ public final class Q00039_RedEyedInvaders extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - switch (npc.getId()) - { - case MALE_LIZARDMAN: - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + switch (npc.getId()) { + case MALE_LIZARDMAN: { final QuestState qs = getRandomPartyMemberState(killer, 2, 3, npc); - if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, LIZ_NECKLACE_A.getId(), 1, LIZ_NECKLACE_A.getCount(), 0.5, true)) - { - if (hasItem(qs.getPlayer(), LIZ_NECKLACE_B)) - { + if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, LIZ_NECKLACE_A.getId(), 1, LIZ_NECKLACE_A.getCount(), 0.5, true)) { + if (hasItem(qs.getPlayer(), LIZ_NECKLACE_B)) { qs.setCond(3); } } break; } - case MALE_LIZARDMAN_SCOUT: - { - if (getRandomBoolean()) - { + case MALE_LIZARDMAN_SCOUT: { + if (getRandomBoolean()) { final QuestState qs = getRandomPartyMemberState(killer, 2, 3, npc); - if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, LIZ_NECKLACE_A.getId(), 1, LIZ_NECKLACE_A.getCount(), 0.5, true)) - { - if (hasItem(qs.getPlayer(), LIZ_NECKLACE_B)) - { + if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, LIZ_NECKLACE_A.getId(), 1, LIZ_NECKLACE_A.getCount(), 0.5, true)) { + if (hasItem(qs.getPlayer(), LIZ_NECKLACE_B)) { qs.setCond(3); } } - } - else - { + } else { final QuestState qs = getRandomPartyMemberState(killer, 4, 3, npc); - if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, LIZ_PERFUME.getId(), 1, LIZ_PERFUME.getCount(), 0.25, true)) - { - if (hasItem(qs.getPlayer(), LIZ_GEM)) - { + if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, LIZ_PERFUME.getId(), 1, LIZ_PERFUME.getCount(), 0.25, true)) { + if (hasItem(qs.getPlayer(), LIZ_GEM)) { qs.setCond(5); } } } break; } - case MALE_LIZARDMAN_GUARD: - { - if (getRandomBoolean()) - { + case MALE_LIZARDMAN_GUARD: { + if (getRandomBoolean()) { final QuestState qs = getRandomPartyMemberState(killer, 2, 3, npc); - if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, LIZ_NECKLACE_B.getId(), 1, LIZ_NECKLACE_B.getCount(), 0.5, true)) - { - if (hasItem(qs.getPlayer(), LIZ_NECKLACE_A)) - { + if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, LIZ_NECKLACE_B.getId(), 1, LIZ_NECKLACE_B.getCount(), 0.5, true)) { + if (hasItem(qs.getPlayer(), LIZ_NECKLACE_A)) { qs.setCond(3); } } - } - else - { + } else { final QuestState qs = getRandomPartyMemberState(killer, 4, 3, npc); - if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, LIZ_PERFUME.getId(), 1, LIZ_PERFUME.getCount(), 0.3, true)) - { - if (hasItem(qs.getPlayer(), LIZ_GEM)) - { + if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, LIZ_PERFUME.getId(), 1, LIZ_PERFUME.getCount(), 0.3, true)) { + if (hasItem(qs.getPlayer(), LIZ_GEM)) { qs.setCond(5); } } } break; } - case GIANT_ARANE: - { + case GIANT_ARANE: { final QuestState qs = getRandomPartyMemberState(killer, 4, 3, npc); - if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, LIZ_GEM.getId(), 1, LIZ_GEM.getCount(), 0.3, true)) - { - if (hasItem(qs.getPlayer(), LIZ_PERFUME)) - { + if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, LIZ_GEM.getId(), 1, LIZ_GEM.getCount(), 0.3, true)) { + if (hasItem(qs.getPlayer(), LIZ_PERFUME)) { qs.setCond(5); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00040_ASpecialOrder/Q00040_ASpecialOrder.java b/src/main/java/com/l2jserver/datapack/quests/Q00040_ASpecialOrder/Q00040_ASpecialOrder.java index e0da95caa0..2fc2efa0b4 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00040_ASpecialOrder/Q00040_ASpecialOrder.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00040_ASpecialOrder/Q00040_ASpecialOrder.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.State; * A Special Order (40) * @author janiko */ -public final class Q00040_ASpecialOrder extends Quest -{ +public final class Q00040_ASpecialOrder extends Quest { // NPCs private static final int HELVETIA = 30081; private static final int OFULLE = 31572; @@ -47,8 +46,7 @@ public final class Q00040_ASpecialOrder extends Quest // Misc private static final int MIN_LVL = 40; - public Q00040_ASpecialOrder() - { + public Q00040_ASpecialOrder() { super(40, Q00040_ASpecialOrder.class.getSimpleName(), "A Special Order"); addStartNpc(HELVETIA); addTalkId(HELVETIA, OFULLE, GESTO); @@ -56,45 +54,34 @@ public final class Q00040_ASpecialOrder extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "accept": - { + switch (event) { + case "accept": { st.startQuest(); - if (getRandomBoolean()) - { + if (getRandomBoolean()) { st.setCond(2); htmltext = "30081-03.html"; - } - else - { + } else { st.setCond(5); htmltext = "30081-04.html"; } break; } - case "30081-07.html": - { - if (st.isCond(4) && st.hasQuestItems(BOX_OF_FISH)) - { + case "30081-07.html": { + if (st.isCond(4) && st.hasQuestItems(BOX_OF_FISH)) { st.rewardItems(WONDROUS_CUBIC, 1); st.exitQuest(false, true); htmltext = event; } break; } - case "30081-10.html": - { - if (st.isCond(7) && st.hasQuestItems(BOX_OF_SEED)) - { + case "30081-10.html": { + if (st.isCond(7) && st.hasQuestItems(BOX_OF_SEED)) { st.rewardItems(WONDROUS_CUBIC, 1); st.exitQuest(false, true); htmltext = event; @@ -102,24 +89,19 @@ public final class Q00040_ASpecialOrder extends Quest break; } case "31572-02.html": - case "30511-02.html": - { + case "30511-02.html": { htmltext = event; break; } - case "31572-03.html": - { - if (st.isCond(2)) - { + case "31572-03.html": { + if (st.isCond(2)) { st.setCond(3, true); htmltext = event; } break; } - case "30511-03.html": - { - if (st.isCond(5)) - { + case "30511-03.html": { + if (st.isCond(5)) { st.setCond(6, true); htmltext = event; } @@ -130,49 +112,36 @@ public final class Q00040_ASpecialOrder extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (npc.getId()) - { - case HELVETIA: - { - switch (st.getState()) - { - case State.CREATED: - { + switch (npc.getId()) { + case HELVETIA: { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getLevel() >= MIN_LVL) ? "30081-01.htm" : "30081-02.htm"; break; } - case State.STARTED: - { - switch (st.getCond()) - { + case State.STARTED: { + switch (st.getCond()) { case 2: - case 3: - { + case 3: { htmltext = "30081-05.html"; break; } - case 4: - { - if (st.hasQuestItems(BOX_OF_FISH)) - { + case 4: { + if (st.hasQuestItems(BOX_OF_FISH)) { htmltext = "30081-06.html"; } break; } case 5: - case 6: - { + case 6: { htmltext = "30081-08.html"; break; } - case 7: - { - if (st.hasQuestItems(BOX_OF_SEED)) - { + case 7: { + if (st.hasQuestItems(BOX_OF_SEED)) { htmltext = "30081-09.html"; } break; @@ -180,72 +149,55 @@ public final class Q00040_ASpecialOrder extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } } break; } - case OFULLE: - { - switch (st.getCond()) - { - case 2: - { + case OFULLE: { + switch (st.getCond()) { + case 2: { htmltext = "31572-01.html"; break; } - case 3: - { - if ((st.getQuestItemsCount(ORANGE_SWIFT_FISH) >= 10) && (st.getQuestItemsCount(ORANGE_UGLY_FISH) >= 10) && (st.getQuestItemsCount(ORANGE_WIDE_FISH) >= 10)) - { + case 3: { + if ((st.getQuestItemsCount(ORANGE_SWIFT_FISH) >= 10) && (st.getQuestItemsCount(ORANGE_UGLY_FISH) >= 10) && (st.getQuestItemsCount(ORANGE_WIDE_FISH) >= 10)) { st.setCond(4, true); st.giveItems(BOX_OF_FISH, 1); takeItems(player, 10, ORANGE_SWIFT_FISH, ORANGE_UGLY_FISH, ORANGE_WIDE_FISH); htmltext = "31572-05.html"; - } - else - { + } else { htmltext = "31572-04.html"; } break; } - case 4: - { + case 4: { htmltext = "31572-06.html"; break; } } break; } - case GESTO: - { - switch (st.getCond()) - { - case 5: - { + case GESTO: { + switch (st.getCond()) { + case 5: { htmltext = "30511-01.html"; break; } - case 6: - { - if ((st.getQuestItemsCount(GOLDEN_COBOL) >= 40) && (st.getQuestItemsCount(BUR_COBOL) >= 40) && (st.getQuestItemsCount(GREAT_COBOL) >= 40)) - { + case 6: { + if ((st.getQuestItemsCount(GOLDEN_COBOL) >= 40) && (st.getQuestItemsCount(BUR_COBOL) >= 40) && (st.getQuestItemsCount(GREAT_COBOL) >= 40)) { st.setCond(7, true); st.giveItems(BOX_OF_SEED, 1); takeItems(player, 40, GOLDEN_COBOL, BUR_COBOL, GREAT_COBOL); htmltext = "30511-05.html"; - } - else - { + } else { htmltext = "30511-04.html"; } break; } - case 7: - { + case 7: { htmltext = "30511-06.html"; break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00042_HelpTheUncle/Q00042_HelpTheUncle.java b/src/main/java/com/l2jserver/datapack/quests/Q00042_HelpTheUncle/Q00042_HelpTheUncle.java index 7d46e1b633..8b96f451b3 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00042_HelpTheUncle/Q00042_HelpTheUncle.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00042_HelpTheUncle/Q00042_HelpTheUncle.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by zerghase. * @author malyelfik */ -public class Q00042_HelpTheUncle extends Quest -{ +public class Q00042_HelpTheUncle extends Quest { // NPCs private static final int WATERS = 30828; private static final int SOPHYA = 30735; @@ -44,8 +43,7 @@ public class Q00042_HelpTheUncle extends Quest private static final int MAP = 7549; private static final int PET_TICKET = 7583; - public Q00042_HelpTheUncle() - { + public Q00042_HelpTheUncle() { super(42, Q00042_HelpTheUncle.class.getSimpleName(), "Help The Uncle!"); addStartNpc(WATERS); addTalkId(WATERS, SOPHYA); @@ -54,51 +52,39 @@ public class Q00042_HelpTheUncle extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } String htmltext = event; - switch (event) - { + switch (event) { case "30828-01.htm": st.startQuest(); break; case "30828-03.html": - if (st.hasQuestItems(TRIDENT)) - { + if (st.hasQuestItems(TRIDENT)) { st.takeItems(TRIDENT, 1); st.setCond(2, true); - } - else - { + } else { htmltext = "30828-03a.html"; } break; case "30828-06.html": - if (st.getQuestItemsCount(MAP_PIECE) == 30) - { + if (st.getQuestItemsCount(MAP_PIECE) == 30) { st.takeItems(MAP_PIECE, -1); st.giveItems(MAP, 1); st.setCond(4, true); - } - else - { + } else { htmltext = "30828-06a.html"; } break; case "30735-02.html": - if (st.hasQuestItems(MAP)) - { + if (st.hasQuestItems(MAP)) { st.takeItems(MAP, -1); st.setCond(5, true); - } - else - { + } else { htmltext = "30735-02a.html"; } break; @@ -111,19 +97,14 @@ public class Q00042_HelpTheUncle extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { QuestState st = getQuestState(player, false); - if ((st != null) && st.isCond(2)) - { + if ((st != null) && st.isCond(2)) { st.giveItems(MAP_PIECE, 1); - if (st.getQuestItemsCount(MAP_PIECE) == 30) - { + if (st.getQuestItemsCount(MAP_PIECE) == 30) { st.setCond(3, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -131,21 +112,17 @@ public class Q00042_HelpTheUncle extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case WATERS: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= 25) ? "30828-00.htm" : "30828-00a.html"; break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = (st.hasQuestItems(TRIDENT)) ? "30828-02.html" : "30828-02a.html"; break; @@ -169,10 +146,8 @@ public class Q00042_HelpTheUncle extends Quest } break; case SOPHYA: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 4: htmltext = "30735-01.html"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00043_HelpTheSister/Q00043_HelpTheSister.java b/src/main/java/com/l2jserver/datapack/quests/Q00043_HelpTheSister/Q00043_HelpTheSister.java index 6fb34cb5f6..919095fa62 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00043_HelpTheSister/Q00043_HelpTheSister.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00043_HelpTheSister/Q00043_HelpTheSister.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by zerghase. * @author malyelfik */ -public class Q00043_HelpTheSister extends Quest -{ +public class Q00043_HelpTheSister extends Quest { // NPCs private static final int COOPER = 30829; private static final int GALLADUCCI = 30097; @@ -44,8 +43,7 @@ public class Q00043_HelpTheSister extends Quest private static final int MAP = 7551; private static final int PET_TICKET = 7584; - public Q00043_HelpTheSister() - { + public Q00043_HelpTheSister() { super(43, Q00043_HelpTheSister.class.getSimpleName(), "Help The Sister!"); addStartNpc(COOPER); addTalkId(COOPER, GALLADUCCI); @@ -54,51 +52,39 @@ public class Q00043_HelpTheSister extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } String htmltext = event; - switch (event) - { + switch (event) { case "30829-01.htm": st.startQuest(); break; case "30829-03.html": - if (st.hasQuestItems(CRAFTED_DAGGER)) - { + if (st.hasQuestItems(CRAFTED_DAGGER)) { st.takeItems(CRAFTED_DAGGER, 1); st.setCond(2, true); - } - else - { + } else { htmltext = getNoQuestMsg(player); } break; case "30829-06.html": - if (st.getQuestItemsCount(MAP_PIECE) == 30) - { + if (st.getQuestItemsCount(MAP_PIECE) == 30) { st.takeItems(MAP_PIECE, -1); st.giveItems(MAP, 1); st.setCond(4, true); - } - else - { + } else { htmltext = "30829-06a.html"; } break; case "30097-02.html": - if (st.hasQuestItems(MAP)) - { + if (st.hasQuestItems(MAP)) { st.takeItems(MAP, -1); st.setCond(5, true); - } - else - { + } else { htmltext = "30097-02a.html"; } break; @@ -111,19 +97,14 @@ public class Q00043_HelpTheSister extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { QuestState st = getQuestState(player, false); - if ((st != null) && st.isCond(2)) - { + if ((st != null) && st.isCond(2)) { st.giveItems(MAP_PIECE, 1); - if (st.getQuestItemsCount(MAP_PIECE) == 30) - { + if (st.getQuestItemsCount(MAP_PIECE) == 30) { st.setCond(3, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -131,21 +112,17 @@ public class Q00043_HelpTheSister extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case COOPER: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= 26) ? "30829-00.htm" : "30829-00a.html"; break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = (st.hasQuestItems(CRAFTED_DAGGER)) ? "30829-02.html" : "30829-02a.html"; break; @@ -169,10 +146,8 @@ public class Q00043_HelpTheSister extends Quest } break; case GALLADUCCI: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 4: htmltext = "30097-01.html"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00044_HelpTheSon/Q00044_HelpTheSon.java b/src/main/java/com/l2jserver/datapack/quests/Q00044_HelpTheSon/Q00044_HelpTheSon.java index 0c9aeb9900..1826e9230b 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00044_HelpTheSon/Q00044_HelpTheSon.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00044_HelpTheSon/Q00044_HelpTheSon.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by zerghase. * @author malyelfik */ -public class Q00044_HelpTheSon extends Quest -{ +public class Q00044_HelpTheSon extends Quest { // NPCs private static final int LUNDY = 30827; private static final int DRIKUS = 30505; @@ -45,8 +44,7 @@ public class Q00044_HelpTheSon extends Quest private static final int GEMSTONE = 7553; private static final int PET_TICKET = 7585; - public Q00044_HelpTheSon() - { + public Q00044_HelpTheSon() { super(44, Q00044_HelpTheSon.class.getSimpleName(), "Help The Son!"); addStartNpc(LUNDY); addTalkId(LUNDY, DRIKUS); @@ -55,51 +53,39 @@ public class Q00044_HelpTheSon extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } String htmltext = event; - switch (event) - { + switch (event) { case "30827-01.htm": st.startQuest(); break; case "30827-03.html": - if (st.hasQuestItems(WORK_HAMMER)) - { + if (st.hasQuestItems(WORK_HAMMER)) { st.takeItems(WORK_HAMMER, 1); st.setCond(2, true); - } - else - { + } else { htmltext = "30827-03a.html"; } break; case "30827-06.html": - if (st.getQuestItemsCount(GEMSTONE_FRAGMENT) == 30) - { + if (st.getQuestItemsCount(GEMSTONE_FRAGMENT) == 30) { st.takeItems(GEMSTONE_FRAGMENT, -1); st.giveItems(GEMSTONE, 1); st.setCond(4, true); - } - else - { + } else { htmltext = "30827-06a.html"; } break; case "30505-02.html": - if (st.hasQuestItems(GEMSTONE)) - { + if (st.hasQuestItems(GEMSTONE)) { st.takeItems(GEMSTONE, -1); st.setCond(5, true); - } - else - { + } else { htmltext = "30505-02a.html"; } break; @@ -113,18 +99,13 @@ public class Q00044_HelpTheSon extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isCond(2)) - { + if ((st != null) && st.isCond(2)) { st.giveItems(GEMSTONE_FRAGMENT, 1); - if (st.getQuestItemsCount(GEMSTONE_FRAGMENT) == 30) - { + if (st.getQuestItemsCount(GEMSTONE_FRAGMENT) == 30) { st.setCond(3, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -132,21 +113,17 @@ public class Q00044_HelpTheSon extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case LUNDY: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= 24) ? "30827-00.htm" : "30827-00a.html"; break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = (st.hasQuestItems(WORK_HAMMER)) ? "30827-02.html" : "30827-02a.html"; break; @@ -170,10 +147,8 @@ public class Q00044_HelpTheSon extends Quest } break; case DRIKUS: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 4: htmltext = "30505-01.html"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00045_ToTalkingIsland/Q00045_ToTalkingIsland.java b/src/main/java/com/l2jserver/datapack/quests/Q00045_ToTalkingIsland/Q00045_ToTalkingIsland.java index 6c51007e2b..194eb23c53 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00045_ToTalkingIsland/Q00045_ToTalkingIsland.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00045_ToTalkingIsland/Q00045_ToTalkingIsland.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.model.quest.State; * To Talking Island (45) * @author janiko */ -public final class Q00045_ToTalkingIsland extends Quest -{ +public final class Q00045_ToTalkingIsland extends Quest { // Npcs private static final int GALLADUCCI = 30097; private static final int GENTLER = 30094; @@ -54,15 +53,13 @@ public final class Q00045_ToTalkingIsland extends Quest private static final int SCROLL_OF_ESCAPE_TALKING_ISLAND_VILLAGE = 7554; // Get condition for each npc private static Map<Integer, ItemHolder> NPC_ITEMS = new HashMap<>(); - static - { + static { NPC_ITEMS.put(GENTLER, new ItemHolder(1, GALLADUCCIS_ORDER_1)); NPC_ITEMS.put(SANDRA, new ItemHolder(3, GALLADUCCIS_ORDER_2)); NPC_ITEMS.put(DUSTIN, new ItemHolder(5, GALLADUCCIS_ORDER_3)); } - public Q00045_ToTalkingIsland() - { + public Q00045_ToTalkingIsland() { super(45, Q00045_ToTalkingIsland.class.getSimpleName(), "To Talking Island"); addStartNpc(GALLADUCCI); addTalkId(GALLADUCCI); @@ -71,111 +68,82 @@ public final class Q00045_ToTalkingIsland extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { - case "30097-04.htm": - { - if (st.isCreated()) - { + switch (event) { + case "30097-04.htm": { + if (st.isCreated()) { st.startQuest(); st.giveItems(GALLADUCCIS_ORDER_1, 1); htmltext = event; } break; } - case "30094-02.html": - { - if (st.isCond(1) && st.hasQuestItems(GALLADUCCIS_ORDER_1)) - { + case "30094-02.html": { + if (st.isCond(1) && st.hasQuestItems(GALLADUCCIS_ORDER_1)) { st.takeItems(GALLADUCCIS_ORDER_1, 1); st.giveItems(MAGIC_SWORD_HILT, 1); st.setCond(2, true); htmltext = event; - } - else - { + } else { htmltext = "30094-03.html"; } break; } - case "30097-07.html": - { - if (st.isCond(2) && st.hasQuestItems(MAGIC_SWORD_HILT)) - { + case "30097-07.html": { + if (st.isCond(2) && st.hasQuestItems(MAGIC_SWORD_HILT)) { st.takeItems(MAGIC_SWORD_HILT, 1); st.giveItems(GALLADUCCIS_ORDER_2, 1); st.setCond(3, true); htmltext = event; - } - else - { + } else { htmltext = "30097-08.html"; } break; } - case "30090-02.html": - { - if (st.isCond(3) && st.hasQuestItems(GALLADUCCIS_ORDER_2)) - { + case "30090-02.html": { + if (st.isCond(3) && st.hasQuestItems(GALLADUCCIS_ORDER_2)) { st.takeItems(GALLADUCCIS_ORDER_2, 1); st.giveItems(GEMSTONE_POWDER, 1); st.setCond(4, true); htmltext = event; - } - else - { + } else { htmltext = "30090-03.html"; } break; } - case "30097-11.html": - { - if (st.isCond(4) && st.hasQuestItems(GEMSTONE_POWDER)) - { + case "30097-11.html": { + if (st.isCond(4) && st.hasQuestItems(GEMSTONE_POWDER)) { st.takeItems(GEMSTONE_POWDER, 1); st.giveItems(GALLADUCCIS_ORDER_3, 1); st.setCond(5, true); htmltext = event; - } - else - { + } else { htmltext = "30097-12.html"; } break; } - case "30116-02.html": - { - if (st.isCond(5) && st.hasQuestItems(GALLADUCCIS_ORDER_3)) - { + case "30116-02.html": { + if (st.isCond(5) && st.hasQuestItems(GALLADUCCIS_ORDER_3)) { st.takeItems(GALLADUCCIS_ORDER_3, 1); st.giveItems(PURIFIED_MAGIC_NECKLACE, 1); st.setCond(6, true); htmltext = event; - } - else - { + } else { htmltext = "30116-03.html"; } break; } - case "30097-15.html": - { - if (st.isCond(6) && st.hasQuestItems(PURIFIED_MAGIC_NECKLACE)) - { + case "30097-15.html": { + if (st.isCond(6) && st.hasQuestItems(PURIFIED_MAGIC_NECKLACE)) { st.giveItems(SCROLL_OF_ESCAPE_TALKING_ISLAND_VILLAGE, 1); st.exitQuest(false, true); htmltext = event; - } - else - { + } else { htmltext = "30097-16.html"; } break; @@ -185,74 +153,52 @@ public final class Q00045_ToTalkingIsland extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { QuestState st = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (npc.getId()) - { - case GALLADUCCI: - { - switch (st.getState()) - { - case State.CREATED: - { - if (talker.getLevel() < MIN_LVL) - { + switch (npc.getId()) { + case GALLADUCCI: { + switch (st.getState()) { + case State.CREATED: { + if (talker.getLevel() < MIN_LVL) { htmltext = "30097-03.html"; - } - else - { - if (talker.hasQuestCompleted(Q00006_StepIntoTheFuture.class.getSimpleName()) && st.hasQuestItems(MARK_OF_TRAVELER)) - { + } else { + if (talker.hasQuestCompleted(Q00006_StepIntoTheFuture.class.getSimpleName()) && st.hasQuestItems(MARK_OF_TRAVELER)) { htmltext = "30097-01.htm"; - } - else - { + } else { htmltext = "30097-02.html"; } } break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "30097-05.html"; break; } - case 2: - { - if (st.hasQuestItems(MAGIC_SWORD_HILT)) - { + case 2: { + if (st.hasQuestItems(MAGIC_SWORD_HILT)) { htmltext = "30097-06.html"; } break; } - case 3: - { + case 3: { htmltext = "30097-09.html"; break; } - case 4: - { - if (st.hasQuestItems(GEMSTONE_POWDER)) - { + case 4: { + if (st.hasQuestItems(GEMSTONE_POWDER)) { htmltext = "30097-10.html"; } break; } - case 5: - { + case 5: { htmltext = "30097-13.html"; break; } - case 6: - { - if (st.hasQuestItems(PURIFIED_MAGIC_NECKLACE)) - { + case 6: { + if (st.hasQuestItems(PURIFIED_MAGIC_NECKLACE)) { htmltext = "30097-14.html"; } break; @@ -260,8 +206,7 @@ public final class Q00045_ToTalkingIsland extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(talker); break; } @@ -270,22 +215,16 @@ public final class Q00045_ToTalkingIsland extends Quest } case GENTLER: case SANDRA: - case DUSTIN: - { - if (st.isStarted()) - { + case DUSTIN: { + if (st.isStarted()) { final ItemHolder i = NPC_ITEMS.get(npc.getId()); final int cond = i.getId(); - if (st.isCond(cond)) - { + if (st.isCond(cond)) { final int itemId = (int) i.getCount(); - if (st.hasQuestItems(itemId)) - { + if (st.hasQuestItems(itemId)) { htmltext = npc.getId() + "-01.html"; } - } - else if (st.isCond(cond + 1)) - { + } else if (st.isCond(cond + 1)) { htmltext = npc.getId() + "-04.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00046_OnceMoreInTheArmsOfTheMotherTree/Q00046_OnceMoreInTheArmsOfTheMotherTree.java b/src/main/java/com/l2jserver/datapack/quests/Q00046_OnceMoreInTheArmsOfTheMotherTree/Q00046_OnceMoreInTheArmsOfTheMotherTree.java index 4b2161743e..f991f54d77 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00046_OnceMoreInTheArmsOfTheMotherTree/Q00046_OnceMoreInTheArmsOfTheMotherTree.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00046_OnceMoreInTheArmsOfTheMotherTree/Q00046_OnceMoreInTheArmsOfTheMotherTree.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.model.quest.State; * Once More In The Arms Of The Mother Tree (46) * @author janiko */ -public final class Q00046_OnceMoreInTheArmsOfTheMotherTree extends Quest -{ +public final class Q00046_OnceMoreInTheArmsOfTheMotherTree extends Quest { // Npcs private static final int GALLADUCCI = 30097; private static final int GENTLER = 30094; @@ -54,15 +53,13 @@ public final class Q00046_OnceMoreInTheArmsOfTheMotherTree extends Quest private static final int SCROLL_OF_ESCAPE_ELVEN_VILLAGE = 7555; // Get condition for each npc private static Map<Integer, ItemHolder> NPC_ITEMS = new HashMap<>(); - static - { + static { NPC_ITEMS.put(GENTLER, new ItemHolder(1, GALLADUCCIS_ORDER_1)); NPC_ITEMS.put(SANDRA, new ItemHolder(3, GALLADUCCIS_ORDER_2)); NPC_ITEMS.put(DUSTIN, new ItemHolder(5, GALLADUCCIS_ORDER_3)); } - public Q00046_OnceMoreInTheArmsOfTheMotherTree() - { + public Q00046_OnceMoreInTheArmsOfTheMotherTree() { super(46, Q00046_OnceMoreInTheArmsOfTheMotherTree.class.getSimpleName(), "Once More In the Arms of the Mother Tree"); addStartNpc(GALLADUCCI); addTalkId(GALLADUCCI); @@ -71,111 +68,82 @@ public final class Q00046_OnceMoreInTheArmsOfTheMotherTree extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { - case "30097-04.htm": - { - if (st.isCreated()) - { + switch (event) { + case "30097-04.htm": { + if (st.isCreated()) { st.startQuest(); st.giveItems(GALLADUCCIS_ORDER_1, 1); htmltext = event; } break; } - case "30094-02.html": - { - if (st.isCond(1) && st.hasQuestItems(GALLADUCCIS_ORDER_1)) - { + case "30094-02.html": { + if (st.isCond(1) && st.hasQuestItems(GALLADUCCIS_ORDER_1)) { st.takeItems(GALLADUCCIS_ORDER_1, 1); st.giveItems(MAGIC_SWORD_HILT, 1); st.setCond(2, true); htmltext = event; - } - else - { + } else { htmltext = "30094-03.html"; } break; } - case "30097-07.html": - { - if (st.isCond(2) && st.hasQuestItems(MAGIC_SWORD_HILT)) - { + case "30097-07.html": { + if (st.isCond(2) && st.hasQuestItems(MAGIC_SWORD_HILT)) { st.takeItems(MAGIC_SWORD_HILT, 1); st.giveItems(GALLADUCCIS_ORDER_2, 1); st.setCond(3, true); htmltext = event; - } - else - { + } else { htmltext = "30097-08.html"; } break; } - case "30090-02.html": - { - if (st.isCond(3) && st.hasQuestItems(GALLADUCCIS_ORDER_2)) - { + case "30090-02.html": { + if (st.isCond(3) && st.hasQuestItems(GALLADUCCIS_ORDER_2)) { st.takeItems(GALLADUCCIS_ORDER_2, 1); st.giveItems(GEMSTONE_POWDER, 1); st.setCond(4, true); htmltext = event; - } - else - { + } else { htmltext = "30090-03.html"; } break; } - case "30097-11.html": - { - if (st.isCond(4) && st.hasQuestItems(GEMSTONE_POWDER)) - { + case "30097-11.html": { + if (st.isCond(4) && st.hasQuestItems(GEMSTONE_POWDER)) { st.takeItems(GEMSTONE_POWDER, 1); st.giveItems(GALLADUCCIS_ORDER_3, 1); st.setCond(5, true); htmltext = event; - } - else - { + } else { htmltext = "30097-12.html"; } break; } - case "30116-02.html": - { - if (st.isCond(5) && st.hasQuestItems(GALLADUCCIS_ORDER_3)) - { + case "30116-02.html": { + if (st.isCond(5) && st.hasQuestItems(GALLADUCCIS_ORDER_3)) { st.takeItems(GALLADUCCIS_ORDER_3, 1); st.giveItems(PURIFIED_MAGIC_NECKLACE, 1); st.setCond(6, true); htmltext = event; - } - else - { + } else { htmltext = "30116-03.html"; } break; } - case "30097-15.html": - { - if (st.isCond(6) && st.hasQuestItems(PURIFIED_MAGIC_NECKLACE)) - { + case "30097-15.html": { + if (st.isCond(6) && st.hasQuestItems(PURIFIED_MAGIC_NECKLACE)) { st.giveItems(SCROLL_OF_ESCAPE_ELVEN_VILLAGE, 1); st.exitQuest(false, true); htmltext = event; - } - else - { + } else { htmltext = "30097-16.html"; } break; @@ -185,74 +153,52 @@ public final class Q00046_OnceMoreInTheArmsOfTheMotherTree extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { QuestState st = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (npc.getId()) - { - case GALLADUCCI: - { - switch (st.getState()) - { - case State.CREATED: - { - if (talker.getLevel() < MIN_LVL) - { + switch (npc.getId()) { + case GALLADUCCI: { + switch (st.getState()) { + case State.CREATED: { + if (talker.getLevel() < MIN_LVL) { htmltext = "30097-03.html"; - } - else - { - if (talker.hasQuestCompleted(Q00007_ATripBegins.class.getSimpleName()) && st.hasQuestItems(MARK_OF_TRAVELER)) - { + } else { + if (talker.hasQuestCompleted(Q00007_ATripBegins.class.getSimpleName()) && st.hasQuestItems(MARK_OF_TRAVELER)) { htmltext = "30097-01.htm"; - } - else - { + } else { htmltext = "30097-02.html"; } } break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "30097-05.html"; break; } - case 2: - { - if (st.hasQuestItems(MAGIC_SWORD_HILT)) - { + case 2: { + if (st.hasQuestItems(MAGIC_SWORD_HILT)) { htmltext = "30097-06.html"; } break; } - case 3: - { + case 3: { htmltext = "30097-09.html"; break; } - case 4: - { - if (st.hasQuestItems(GEMSTONE_POWDER)) - { + case 4: { + if (st.hasQuestItems(GEMSTONE_POWDER)) { htmltext = "30097-10.html"; } break; } - case 5: - { + case 5: { htmltext = "30097-13.html"; break; } - case 6: - { - if (st.hasQuestItems(PURIFIED_MAGIC_NECKLACE)) - { + case 6: { + if (st.hasQuestItems(PURIFIED_MAGIC_NECKLACE)) { htmltext = "30097-14.html"; } break; @@ -260,8 +206,7 @@ public final class Q00046_OnceMoreInTheArmsOfTheMotherTree extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(talker); break; } @@ -270,22 +215,16 @@ public final class Q00046_OnceMoreInTheArmsOfTheMotherTree extends Quest } case GENTLER: case SANDRA: - case DUSTIN: - { - if (st.isStarted()) - { + case DUSTIN: { + if (st.isStarted()) { final ItemHolder i = NPC_ITEMS.get(npc.getId()); final int cond = i.getId(); - if (st.isCond(cond)) - { + if (st.isCond(cond)) { final int itemId = (int) i.getCount(); - if (st.hasQuestItems(itemId)) - { + if (st.hasQuestItems(itemId)) { htmltext = npc.getId() + "-01.html"; } - } - else if (st.isCond(cond + 1)) - { + } else if (st.isCond(cond + 1)) { htmltext = npc.getId() + "-04.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00047_IntoTheDarkElvenForest/Q00047_IntoTheDarkElvenForest.java b/src/main/java/com/l2jserver/datapack/quests/Q00047_IntoTheDarkElvenForest/Q00047_IntoTheDarkElvenForest.java index fdd4af2894..88dfb08b0e 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00047_IntoTheDarkElvenForest/Q00047_IntoTheDarkElvenForest.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00047_IntoTheDarkElvenForest/Q00047_IntoTheDarkElvenForest.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.model.quest.State; * Into The Dark Elven Forest (47) * @author janiko */ -public final class Q00047_IntoTheDarkElvenForest extends Quest -{ +public final class Q00047_IntoTheDarkElvenForest extends Quest { // Npcs private static final int GALLADUCCI = 30097; private static final int GENTLER = 30094; @@ -54,15 +53,13 @@ public final class Q00047_IntoTheDarkElvenForest extends Quest private static final int SCROLL_OF_ESCAPE_DARK_ELF_VILLAGE = 7556; // Get condition for each npc private static Map<Integer, ItemHolder> NPC_ITEMS = new HashMap<>(); - static - { + static { NPC_ITEMS.put(GENTLER, new ItemHolder(1, GALLADUCCIS_ORDER_1)); NPC_ITEMS.put(SANDRA, new ItemHolder(3, GALLADUCCIS_ORDER_2)); NPC_ITEMS.put(DUSTIN, new ItemHolder(5, GALLADUCCIS_ORDER_3)); } - public Q00047_IntoTheDarkElvenForest() - { + public Q00047_IntoTheDarkElvenForest() { super(47, Q00047_IntoTheDarkElvenForest.class.getSimpleName(), "Into the Dark Elven Forest"); addStartNpc(GALLADUCCI); addTalkId(GALLADUCCI); @@ -71,111 +68,82 @@ public final class Q00047_IntoTheDarkElvenForest extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { - case "30097-04.htm": - { - if (st.isCreated()) - { + switch (event) { + case "30097-04.htm": { + if (st.isCreated()) { st.startQuest(); st.giveItems(GALLADUCCIS_ORDER_1, 1); htmltext = event; } break; } - case "30094-02.html": - { - if (st.isCond(1) && st.hasQuestItems(GALLADUCCIS_ORDER_1)) - { + case "30094-02.html": { + if (st.isCond(1) && st.hasQuestItems(GALLADUCCIS_ORDER_1)) { st.takeItems(GALLADUCCIS_ORDER_1, 1); st.giveItems(MAGIC_SWORD_HILT, 1); st.setCond(2, true); htmltext = event; - } - else - { + } else { htmltext = "30094-03.html"; } break; } - case "30097-07.html": - { - if (st.isCond(2) && st.hasQuestItems(MAGIC_SWORD_HILT)) - { + case "30097-07.html": { + if (st.isCond(2) && st.hasQuestItems(MAGIC_SWORD_HILT)) { st.takeItems(MAGIC_SWORD_HILT, 1); st.giveItems(GALLADUCCIS_ORDER_2, 1); st.setCond(3, true); htmltext = event; - } - else - { + } else { htmltext = "30097-08.html"; } break; } - case "30090-02.html": - { - if (st.isCond(3) && st.hasQuestItems(GALLADUCCIS_ORDER_2)) - { + case "30090-02.html": { + if (st.isCond(3) && st.hasQuestItems(GALLADUCCIS_ORDER_2)) { st.takeItems(GALLADUCCIS_ORDER_2, 1); st.giveItems(GEMSTONE_POWDER, 1); st.setCond(4, true); htmltext = event; - } - else - { + } else { htmltext = "30090-03.html"; } break; } - case "30097-11.html": - { - if (st.isCond(4) && st.hasQuestItems(GEMSTONE_POWDER)) - { + case "30097-11.html": { + if (st.isCond(4) && st.hasQuestItems(GEMSTONE_POWDER)) { st.takeItems(GEMSTONE_POWDER, 1); st.giveItems(GALLADUCCIS_ORDER_3, 1); st.setCond(5, true); htmltext = event; - } - else - { + } else { htmltext = "30097-12.html"; } break; } - case "30116-02.html": - { - if (st.isCond(5) && st.hasQuestItems(GALLADUCCIS_ORDER_3)) - { + case "30116-02.html": { + if (st.isCond(5) && st.hasQuestItems(GALLADUCCIS_ORDER_3)) { st.takeItems(GALLADUCCIS_ORDER_3, 1); st.giveItems(PURIFIED_MAGIC_NECKLACE, 1); st.setCond(6, true); htmltext = event; - } - else - { + } else { htmltext = "30116-03.html"; } break; } - case "30097-15.html": - { - if (st.isCond(6) && st.hasQuestItems(PURIFIED_MAGIC_NECKLACE)) - { + case "30097-15.html": { + if (st.isCond(6) && st.hasQuestItems(PURIFIED_MAGIC_NECKLACE)) { st.giveItems(SCROLL_OF_ESCAPE_DARK_ELF_VILLAGE, 1); st.exitQuest(false, true); htmltext = event; - } - else - { + } else { htmltext = "30097-16.html"; } break; @@ -185,74 +153,52 @@ public final class Q00047_IntoTheDarkElvenForest extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { QuestState st = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (npc.getId()) - { - case GALLADUCCI: - { - switch (st.getState()) - { - case State.CREATED: - { - if (talker.getLevel() < MIN_LVL) - { + switch (npc.getId()) { + case GALLADUCCI: { + switch (st.getState()) { + case State.CREATED: { + if (talker.getLevel() < MIN_LVL) { htmltext = "30097-03.html"; - } - else - { - if (talker.hasQuestCompleted(Q00008_AnAdventureBegins.class.getSimpleName()) && st.hasQuestItems(MARK_OF_TRAVELER)) - { + } else { + if (talker.hasQuestCompleted(Q00008_AnAdventureBegins.class.getSimpleName()) && st.hasQuestItems(MARK_OF_TRAVELER)) { htmltext = "30097-01.htm"; - } - else - { + } else { htmltext = "30097-02.html"; } } break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "30097-05.html"; break; } - case 2: - { - if (st.hasQuestItems(MAGIC_SWORD_HILT)) - { + case 2: { + if (st.hasQuestItems(MAGIC_SWORD_HILT)) { htmltext = "30097-06.html"; } break; } - case 3: - { + case 3: { htmltext = "30097-09.html"; break; } - case 4: - { - if (st.hasQuestItems(GEMSTONE_POWDER)) - { + case 4: { + if (st.hasQuestItems(GEMSTONE_POWDER)) { htmltext = "30097-10.html"; } break; } - case 5: - { + case 5: { htmltext = "30097-13.html"; break; } - case 6: - { - if (st.hasQuestItems(PURIFIED_MAGIC_NECKLACE)) - { + case 6: { + if (st.hasQuestItems(PURIFIED_MAGIC_NECKLACE)) { htmltext = "30097-14.html"; } break; @@ -260,8 +206,7 @@ public final class Q00047_IntoTheDarkElvenForest extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(talker); break; } @@ -270,22 +215,16 @@ public final class Q00047_IntoTheDarkElvenForest extends Quest } case GENTLER: case SANDRA: - case DUSTIN: - { - if (st.isStarted()) - { + case DUSTIN: { + if (st.isStarted()) { final ItemHolder i = NPC_ITEMS.get(npc.getId()); final int cond = i.getId(); - if (st.isCond(cond)) - { + if (st.isCond(cond)) { final int itemId = (int) i.getCount(); - if (st.hasQuestItems(itemId)) - { + if (st.hasQuestItems(itemId)) { htmltext = npc.getId() + "-01.html"; } - } - else if (st.isCond(cond + 1)) - { + } else if (st.isCond(cond + 1)) { htmltext = npc.getId() + "-04.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00048_ToTheImmortalPlateau/Q00048_ToTheImmortalPlateau.java b/src/main/java/com/l2jserver/datapack/quests/Q00048_ToTheImmortalPlateau/Q00048_ToTheImmortalPlateau.java index 08b5302c17..facaca8445 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00048_ToTheImmortalPlateau/Q00048_ToTheImmortalPlateau.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00048_ToTheImmortalPlateau/Q00048_ToTheImmortalPlateau.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.model.quest.State; * To The Immortal Plateau (48) * @author janiko */ -public final class Q00048_ToTheImmortalPlateau extends Quest -{ +public final class Q00048_ToTheImmortalPlateau extends Quest { // Npcs private static final int GALLADUCCI = 30097; private static final int GENTLER = 30094; @@ -54,15 +53,13 @@ public final class Q00048_ToTheImmortalPlateau extends Quest private static final int SCROLL_OF_ESCAPE_ORC_VILLAGE = 7557; // Get condition for each npc private static Map<Integer, ItemHolder> NPC_ITEMS = new HashMap<>(); - static - { + static { NPC_ITEMS.put(GENTLER, new ItemHolder(1, GALLADUCCIS_ORDER_1)); NPC_ITEMS.put(SANDRA, new ItemHolder(3, GALLADUCCIS_ORDER_2)); NPC_ITEMS.put(DUSTIN, new ItemHolder(5, GALLADUCCIS_ORDER_3)); } - public Q00048_ToTheImmortalPlateau() - { + public Q00048_ToTheImmortalPlateau() { super(48, Q00048_ToTheImmortalPlateau.class.getSimpleName(), "To The Immortal Plateau"); addStartNpc(GALLADUCCI); addTalkId(GALLADUCCI); @@ -71,111 +68,82 @@ public final class Q00048_ToTheImmortalPlateau extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { - case "30097-04.htm": - { - if (st.isCreated()) - { + switch (event) { + case "30097-04.htm": { + if (st.isCreated()) { st.startQuest(); st.giveItems(GALLADUCCIS_ORDER_1, 1); htmltext = event; } break; } - case "30094-02.html": - { - if (st.isCond(1) && st.hasQuestItems(GALLADUCCIS_ORDER_1)) - { + case "30094-02.html": { + if (st.isCond(1) && st.hasQuestItems(GALLADUCCIS_ORDER_1)) { st.takeItems(GALLADUCCIS_ORDER_1, 1); st.giveItems(MAGIC_SWORD_HILT, 1); st.setCond(2, true); htmltext = event; - } - else - { + } else { htmltext = "30094-03.html"; } break; } - case "30097-07.html": - { - if (st.isCond(2) && st.hasQuestItems(MAGIC_SWORD_HILT)) - { + case "30097-07.html": { + if (st.isCond(2) && st.hasQuestItems(MAGIC_SWORD_HILT)) { st.takeItems(MAGIC_SWORD_HILT, 1); st.giveItems(GALLADUCCIS_ORDER_2, 1); st.setCond(3, true); htmltext = event; - } - else - { + } else { htmltext = "30097-08.html"; } break; } - case "30090-02.html": - { - if (st.isCond(3) && st.hasQuestItems(GALLADUCCIS_ORDER_2)) - { + case "30090-02.html": { + if (st.isCond(3) && st.hasQuestItems(GALLADUCCIS_ORDER_2)) { st.takeItems(GALLADUCCIS_ORDER_2, 1); st.giveItems(GEMSTONE_POWDER, 1); st.setCond(4, true); htmltext = event; - } - else - { + } else { htmltext = "30090-03.html"; } break; } - case "30097-11.html": - { - if (st.isCond(4) && st.hasQuestItems(GEMSTONE_POWDER)) - { + case "30097-11.html": { + if (st.isCond(4) && st.hasQuestItems(GEMSTONE_POWDER)) { st.takeItems(GEMSTONE_POWDER, 1); st.giveItems(GALLADUCCIS_ORDER_3, 1); st.setCond(5, true); htmltext = event; - } - else - { + } else { htmltext = "30097-12.html"; } break; } - case "30116-02.html": - { - if (st.isCond(5) && st.hasQuestItems(GALLADUCCIS_ORDER_3)) - { + case "30116-02.html": { + if (st.isCond(5) && st.hasQuestItems(GALLADUCCIS_ORDER_3)) { st.takeItems(GALLADUCCIS_ORDER_3, 1); st.giveItems(PURIFIED_MAGIC_NECKLACE, 1); st.setCond(6, true); htmltext = event; - } - else - { + } else { htmltext = "30116-03.html"; } break; } - case "30097-15.html": - { - if (st.isCond(6) && st.hasQuestItems(PURIFIED_MAGIC_NECKLACE)) - { + case "30097-15.html": { + if (st.isCond(6) && st.hasQuestItems(PURIFIED_MAGIC_NECKLACE)) { st.giveItems(SCROLL_OF_ESCAPE_ORC_VILLAGE, 1); st.exitQuest(false, true); htmltext = event; - } - else - { + } else { htmltext = "30097-16.html"; } break; @@ -185,74 +153,52 @@ public final class Q00048_ToTheImmortalPlateau extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { QuestState st = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (npc.getId()) - { - case GALLADUCCI: - { - switch (st.getState()) - { - case State.CREATED: - { - if (talker.getLevel() < MIN_LVL) - { + switch (npc.getId()) { + case GALLADUCCI: { + switch (st.getState()) { + case State.CREATED: { + if (talker.getLevel() < MIN_LVL) { htmltext = "30097-03.html"; - } - else - { - if (talker.hasQuestCompleted(Q00009_IntoTheCityOfHumans.class.getSimpleName()) && st.hasQuestItems(MARK_OF_TRAVELER)) - { + } else { + if (talker.hasQuestCompleted(Q00009_IntoTheCityOfHumans.class.getSimpleName()) && st.hasQuestItems(MARK_OF_TRAVELER)) { htmltext = "30097-01.htm"; - } - else - { + } else { htmltext = "30097-02.html"; } } break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "30097-05.html"; break; } - case 2: - { - if (st.hasQuestItems(MAGIC_SWORD_HILT)) - { + case 2: { + if (st.hasQuestItems(MAGIC_SWORD_HILT)) { htmltext = "30097-06.html"; } break; } - case 3: - { + case 3: { htmltext = "30097-09.html"; break; } - case 4: - { - if (st.hasQuestItems(GEMSTONE_POWDER)) - { + case 4: { + if (st.hasQuestItems(GEMSTONE_POWDER)) { htmltext = "30097-10.html"; } break; } - case 5: - { + case 5: { htmltext = "30097-13.html"; break; } - case 6: - { - if (st.hasQuestItems(PURIFIED_MAGIC_NECKLACE)) - { + case 6: { + if (st.hasQuestItems(PURIFIED_MAGIC_NECKLACE)) { htmltext = "30097-14.html"; } break; @@ -260,8 +206,7 @@ public final class Q00048_ToTheImmortalPlateau extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(talker); break; } @@ -270,22 +215,16 @@ public final class Q00048_ToTheImmortalPlateau extends Quest } case GENTLER: case SANDRA: - case DUSTIN: - { - if (st.isStarted()) - { + case DUSTIN: { + if (st.isStarted()) { final ItemHolder i = NPC_ITEMS.get(npc.getId()); final int cond = i.getId(); - if (st.isCond(cond)) - { + if (st.isCond(cond)) { final int itemId = (int) i.getCount(); - if (st.hasQuestItems(itemId)) - { + if (st.hasQuestItems(itemId)) { htmltext = npc.getId() + "-01.html"; } - } - else if (st.isCond(cond + 1)) - { + } else if (st.isCond(cond + 1)) { htmltext = npc.getId() + "-04.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00049_TheRoadHome/Q00049_TheRoadHome.java b/src/main/java/com/l2jserver/datapack/quests/Q00049_TheRoadHome/Q00049_TheRoadHome.java index 927353a1dc..18e9ebb73c 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00049_TheRoadHome/Q00049_TheRoadHome.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00049_TheRoadHome/Q00049_TheRoadHome.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.model.quest.State; * The Road Home (49) * @author janiko */ -public final class Q00049_TheRoadHome extends Quest -{ +public final class Q00049_TheRoadHome extends Quest { // Npcs private static final int GALLADUCCI = 30097; private static final int GENTLER = 30094; @@ -54,15 +53,13 @@ public final class Q00049_TheRoadHome extends Quest private static final int SCROLL_OF_ESCAPE_DWARVEN_VILLAGE = 7558; // Get condition for each npc private static Map<Integer, ItemHolder> NPC_ITEMS = new HashMap<>(); - static - { + static { NPC_ITEMS.put(GENTLER, new ItemHolder(1, GALLADUCCIS_ORDER_1)); NPC_ITEMS.put(SANDRA, new ItemHolder(3, GALLADUCCIS_ORDER_2)); NPC_ITEMS.put(DUSTIN, new ItemHolder(5, GALLADUCCIS_ORDER_3)); } - public Q00049_TheRoadHome() - { + public Q00049_TheRoadHome() { super(49, Q00049_TheRoadHome.class.getSimpleName(), "The Road Home"); addStartNpc(GALLADUCCI); addTalkId(GALLADUCCI); @@ -71,111 +68,82 @@ public final class Q00049_TheRoadHome extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { - case "30097-04.htm": - { - if (st.isCreated()) - { + switch (event) { + case "30097-04.htm": { + if (st.isCreated()) { st.startQuest(); st.giveItems(GALLADUCCIS_ORDER_1, 1); htmltext = event; } break; } - case "30094-02.html": - { - if (st.isCond(1) && st.hasQuestItems(GALLADUCCIS_ORDER_1)) - { + case "30094-02.html": { + if (st.isCond(1) && st.hasQuestItems(GALLADUCCIS_ORDER_1)) { st.takeItems(GALLADUCCIS_ORDER_1, 1); st.giveItems(MAGIC_SWORD_HILT, 1); st.setCond(2, true); htmltext = event; - } - else - { + } else { htmltext = "30094-03.html"; } break; } - case "30097-07.html": - { - if (st.isCond(2) && st.hasQuestItems(MAGIC_SWORD_HILT)) - { + case "30097-07.html": { + if (st.isCond(2) && st.hasQuestItems(MAGIC_SWORD_HILT)) { st.takeItems(MAGIC_SWORD_HILT, 1); st.giveItems(GALLADUCCIS_ORDER_2, 1); st.setCond(3, true); htmltext = event; - } - else - { + } else { htmltext = "30097-08.html"; } break; } - case "30090-02.html": - { - if (st.isCond(3) && st.hasQuestItems(GALLADUCCIS_ORDER_2)) - { + case "30090-02.html": { + if (st.isCond(3) && st.hasQuestItems(GALLADUCCIS_ORDER_2)) { st.takeItems(GALLADUCCIS_ORDER_2, 1); st.giveItems(GEMSTONE_POWDER, 1); st.setCond(4, true); htmltext = event; - } - else - { + } else { htmltext = "30090-03.html"; } break; } - case "30097-11.html": - { - if (st.isCond(4) && st.hasQuestItems(GEMSTONE_POWDER)) - { + case "30097-11.html": { + if (st.isCond(4) && st.hasQuestItems(GEMSTONE_POWDER)) { st.takeItems(GEMSTONE_POWDER, 1); st.giveItems(GALLADUCCIS_ORDER_3, 1); st.setCond(5, true); htmltext = event; - } - else - { + } else { htmltext = "30097-12.html"; } break; } - case "30116-02.html": - { - if (st.isCond(5) && st.hasQuestItems(GALLADUCCIS_ORDER_3)) - { + case "30116-02.html": { + if (st.isCond(5) && st.hasQuestItems(GALLADUCCIS_ORDER_3)) { st.takeItems(GALLADUCCIS_ORDER_3, 1); st.giveItems(PURIFIED_MAGIC_NECKLACE, 1); st.setCond(6, true); htmltext = event; - } - else - { + } else { htmltext = "30116-03.html"; } break; } - case "30097-15.html": - { - if (st.isCond(6) && st.hasQuestItems(PURIFIED_MAGIC_NECKLACE)) - { + case "30097-15.html": { + if (st.isCond(6) && st.hasQuestItems(PURIFIED_MAGIC_NECKLACE)) { st.giveItems(SCROLL_OF_ESCAPE_DWARVEN_VILLAGE, 1); st.exitQuest(false, true); htmltext = event; - } - else - { + } else { htmltext = "30097-16.html"; } break; @@ -185,74 +153,52 @@ public final class Q00049_TheRoadHome extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { QuestState st = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (npc.getId()) - { - case GALLADUCCI: - { - switch (st.getState()) - { - case State.CREATED: - { - if (talker.getLevel() < MIN_LVL) - { + switch (npc.getId()) { + case GALLADUCCI: { + switch (st.getState()) { + case State.CREATED: { + if (talker.getLevel() < MIN_LVL) { htmltext = "30097-03.html"; - } - else - { - if (talker.hasQuestCompleted(Q00010_IntoTheWorld.class.getSimpleName()) && st.hasQuestItems(MARK_OF_TRAVELER)) - { + } else { + if (talker.hasQuestCompleted(Q00010_IntoTheWorld.class.getSimpleName()) && st.hasQuestItems(MARK_OF_TRAVELER)) { htmltext = "30097-01.htm"; - } - else - { + } else { htmltext = "30097-02.html"; } } break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "30097-05.html"; break; } - case 2: - { - if (st.hasQuestItems(MAGIC_SWORD_HILT)) - { + case 2: { + if (st.hasQuestItems(MAGIC_SWORD_HILT)) { htmltext = "30097-06.html"; } break; } - case 3: - { + case 3: { htmltext = "30097-09.html"; break; } - case 4: - { - if (st.hasQuestItems(GEMSTONE_POWDER)) - { + case 4: { + if (st.hasQuestItems(GEMSTONE_POWDER)) { htmltext = "30097-10.html"; } break; } - case 5: - { + case 5: { htmltext = "30097-13.html"; break; } - case 6: - { - if (st.hasQuestItems(PURIFIED_MAGIC_NECKLACE)) - { + case 6: { + if (st.hasQuestItems(PURIFIED_MAGIC_NECKLACE)) { htmltext = "30097-14.html"; } break; @@ -260,8 +206,7 @@ public final class Q00049_TheRoadHome extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(talker); break; } @@ -270,22 +215,16 @@ public final class Q00049_TheRoadHome extends Quest } case GENTLER: case SANDRA: - case DUSTIN: - { - if (st.isStarted()) - { + case DUSTIN: { + if (st.isStarted()) { final ItemHolder i = NPC_ITEMS.get(npc.getId()); final int cond = i.getId(); - if (st.isCond(cond)) - { + if (st.isCond(cond)) { final int itemId = (int) i.getCount(); - if (st.hasQuestItems(itemId)) - { + if (st.hasQuestItems(itemId)) { htmltext = npc.getId() + "-01.html"; } - } - else if (st.isCond(cond + 1)) - { + } else if (st.isCond(cond + 1)) { htmltext = npc.getId() + "-04.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00050_LanoscosSpecialBait/Q00050_LanoscosSpecialBait.java b/src/main/java/com/l2jserver/datapack/quests/Q00050_LanoscosSpecialBait/Q00050_LanoscosSpecialBait.java index 4ffe4fc15d..3d6494c00b 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00050_LanoscosSpecialBait/Q00050_LanoscosSpecialBait.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00050_LanoscosSpecialBait/Q00050_LanoscosSpecialBait.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by Kilkenny. * @author nonom */ -public class Q00050_LanoscosSpecialBait extends Quest -{ +public class Q00050_LanoscosSpecialBait extends Quest { // NPCs private static final int LANOSCO = 31570; private static final int SINGING_WIND = 21026; @@ -41,8 +40,7 @@ public class Q00050_LanoscosSpecialBait extends Quest private static final int ESSENCE_OF_WIND = 7621; private static final int WIND_FISHING_LURE = 7610; - public Q00050_LanoscosSpecialBait() - { + public Q00050_LanoscosSpecialBait() { super(50, Q00050_LanoscosSpecialBait.class.getSimpleName(), "Lanosco's Special Bait"); addStartNpc(LANOSCO); addTalkId(LANOSCO); @@ -51,24 +49,20 @@ public class Q00050_LanoscosSpecialBait extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } String htmltext = event; - switch (event) - { + switch (event) { case "31570-03.htm": st.startQuest(); break; case "31570-07.html": - if ((st.isCond(2)) && (st.getQuestItemsCount(ESSENCE_OF_WIND) >= 100)) - { + if ((st.isCond(2)) && (st.getQuestItemsCount(ESSENCE_OF_WIND) >= 100)) { htmltext = "31570-06.htm"; st.giveItems(WIND_FISHING_LURE, 4); st.exitQuest(false, true); @@ -79,28 +73,23 @@ public class Q00050_LanoscosSpecialBait extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(player, 1); - if (partyMember == null) - { + if (partyMember == null) { return null; } final QuestState st = getQuestState(partyMember, false); - if (st.getQuestItemsCount(ESSENCE_OF_WIND) < 100) - { + if (st.getQuestItemsCount(ESSENCE_OF_WIND) < 100) { double chance = 33 * rates().getRateQuestDrop(); - if (getRandom(100) < chance) - { + if (getRandom(100) < chance) { st.rewardItems(ESSENCE_OF_WIND, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } - if (st.getQuestItemsCount(ESSENCE_OF_WIND) >= 100) - { + if (st.getQuestItemsCount(ESSENCE_OF_WIND) >= 100) { st.setCond(2, true); } @@ -109,12 +98,10 @@ public class Q00050_LanoscosSpecialBait extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.COMPLETED: htmltext = getAlreadyCompletedMsg(player); break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00051_OFullesSpecialBait/Q00051_OFullesSpecialBait.java b/src/main/java/com/l2jserver/datapack/quests/Q00051_OFullesSpecialBait/Q00051_OFullesSpecialBait.java index 28a848d2cf..8c2349d157 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00051_OFullesSpecialBait/Q00051_OFullesSpecialBait.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00051_OFullesSpecialBait/Q00051_OFullesSpecialBait.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by Kilkenny. * @author nonom */ -public class Q00051_OFullesSpecialBait extends Quest -{ +public class Q00051_OFullesSpecialBait extends Quest { // NPCs private static final int OFULLE = 31572; private static final int FETTERED_SOUL = 20552; @@ -41,8 +40,7 @@ public class Q00051_OFullesSpecialBait extends Quest private static final int LOST_BAIT = 7622; private static final int ICY_AIR_LURE = 7611; - public Q00051_OFullesSpecialBait() - { + public Q00051_OFullesSpecialBait() { super(51, Q00051_OFullesSpecialBait.class.getSimpleName(), "O'Fulle's Special Bait"); addStartNpc(OFULLE); addTalkId(OFULLE); @@ -51,23 +49,19 @@ public class Q00051_OFullesSpecialBait extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } String htmltext = event; - switch (event) - { + switch (event) { case "31572-03.htm": st.startQuest(); break; case "31572-07.html": - if ((st.isCond(2)) && (st.getQuestItemsCount(LOST_BAIT) >= 100)) - { + if ((st.isCond(2)) && (st.getQuestItemsCount(LOST_BAIT) >= 100)) { htmltext = "31572-06.htm"; st.giveItems(ICY_AIR_LURE, 4); st.exitQuest(false, true); @@ -78,39 +72,32 @@ public class Q00051_OFullesSpecialBait extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(player, 1); - if (partyMember == null) - { + if (partyMember == null) { return null; } final QuestState st = getQuestState(partyMember, false); - if (st.getQuestItemsCount(LOST_BAIT) < 100) - { + if (st.getQuestItemsCount(LOST_BAIT) < 100) { double chance = 33 * rates().getRateQuestDrop(); - if (getRandom(100) < chance) - { + if (getRandom(100) < chance) { st.rewardItems(LOST_BAIT, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } - if (st.getQuestItemsCount(LOST_BAIT) >= 100) - { + if (st.getQuestItemsCount(LOST_BAIT) >= 100) { st.setCond(2, true); } return super.onKill(npc, player, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.COMPLETED: htmltext = getAlreadyCompletedMsg(player); break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00052_WilliesSpecialBait/Q00052_WilliesSpecialBait.java b/src/main/java/com/l2jserver/datapack/quests/Q00052_WilliesSpecialBait/Q00052_WilliesSpecialBait.java index acb63e471a..4fa310fcff 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00052_WilliesSpecialBait/Q00052_WilliesSpecialBait.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00052_WilliesSpecialBait/Q00052_WilliesSpecialBait.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by Kilkenny. * @author nonom */ -public class Q00052_WilliesSpecialBait extends Quest -{ +public class Q00052_WilliesSpecialBait extends Quest { // NPCs private static final int WILLIE = 31574; private static final int TARLK_BASILISK = 20573; @@ -41,8 +40,7 @@ public class Q00052_WilliesSpecialBait extends Quest private static final int TARLK_EYE = 7623; private static final int EARTH_FISHING_LURE = 7612; - public Q00052_WilliesSpecialBait() - { + public Q00052_WilliesSpecialBait() { super(52, Q00052_WilliesSpecialBait.class.getSimpleName(), "Willie's Special Bait"); addStartNpc(WILLIE); addTalkId(WILLIE); @@ -51,23 +49,19 @@ public class Q00052_WilliesSpecialBait extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } String htmltext = event; - switch (event) - { + switch (event) { case "31574-03.htm": st.startQuest(); break; case "31574-07.html": - if (st.isCond(2) && (st.getQuestItemsCount(TARLK_EYE) >= 100)) - { + if (st.isCond(2) && (st.getQuestItemsCount(TARLK_EYE) >= 100)) { htmltext = "31574-06.htm"; st.giveItems(EARTH_FISHING_LURE, 4); st.exitQuest(false, true); @@ -78,39 +72,32 @@ public class Q00052_WilliesSpecialBait extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(player, 1); - if (partyMember == null) - { + if (partyMember == null) { return null; } final QuestState st = getQuestState(partyMember, false); - if (st.getQuestItemsCount(TARLK_EYE) < 100) - { + if (st.getQuestItemsCount(TARLK_EYE) < 100) { double chance = 33 * rates().getRateQuestDrop(); - if (getRandom(100) < chance) - { + if (getRandom(100) < chance) { st.rewardItems(TARLK_EYE, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } - if (st.getQuestItemsCount(TARLK_EYE) >= 100) - { + if (st.getQuestItemsCount(TARLK_EYE) >= 100) { st.setCond(2, true); } return super.onKill(npc, player, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.COMPLETED: htmltext = getAlreadyCompletedMsg(player); break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00053_LinnaeusSpecialBait/Q00053_LinnaeusSpecialBait.java b/src/main/java/com/l2jserver/datapack/quests/Q00053_LinnaeusSpecialBait/Q00053_LinnaeusSpecialBait.java index 36f13e1290..0fbc3c4f8f 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00053_LinnaeusSpecialBait/Q00053_LinnaeusSpecialBait.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00053_LinnaeusSpecialBait/Q00053_LinnaeusSpecialBait.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by Next and DooMita. * @author nonom */ -public class Q00053_LinnaeusSpecialBait extends Quest -{ +public class Q00053_LinnaeusSpecialBait extends Quest { // NPCs private static final int LINNAEUS = 31577; private static final int CRIMSON_DRAKE = 20670; @@ -41,8 +40,7 @@ public class Q00053_LinnaeusSpecialBait extends Quest private static final int CRIMSON_DRAKE_HEART = 7624; private static final int FLAMING_FISHING_LURE = 7613; - public Q00053_LinnaeusSpecialBait() - { + public Q00053_LinnaeusSpecialBait() { super(53, Q00053_LinnaeusSpecialBait.class.getSimpleName(), "Linnaeus Special Bait"); addStartNpc(LINNAEUS); addTalkId(LINNAEUS); @@ -51,29 +49,23 @@ public class Q00053_LinnaeusSpecialBait extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } String htmltext = event; - switch (event) - { + switch (event) { case "31577-1.htm": st.startQuest(); break; case "31577-3.htm": - if (st.isCond(2) && (st.getQuestItemsCount(CRIMSON_DRAKE_HEART) >= 100)) - { + if (st.isCond(2) && (st.getQuestItemsCount(CRIMSON_DRAKE_HEART) >= 100)) { st.giveItems(FLAMING_FISHING_LURE, 4); st.exitQuest(false, true); - } - else - { + } else { htmltext = "31577-5.html"; } break; @@ -82,28 +74,23 @@ public class Q00053_LinnaeusSpecialBait extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(player, 1); - if (partyMember == null) - { + if (partyMember == null) { return null; } final QuestState st = getQuestState(partyMember, false); - if (st.getQuestItemsCount(CRIMSON_DRAKE_HEART) < 100) - { + if (st.getQuestItemsCount(CRIMSON_DRAKE_HEART) < 100) { double chance = 33 * rates().getRateQuestDrop(); - if (getRandom(100) < chance) - { + if (getRandom(100) < chance) { st.rewardItems(CRIMSON_DRAKE_HEART, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } - if (st.getQuestItemsCount(CRIMSON_DRAKE_HEART) >= 100) - { + if (st.getQuestItemsCount(CRIMSON_DRAKE_HEART) >= 100) { st.setCond(2, true); } @@ -112,12 +99,10 @@ public class Q00053_LinnaeusSpecialBait extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.COMPLETED: htmltext = getAlreadyCompletedMsg(player); break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00060_GoodWorksReward/Q00060_GoodWorksReward.java b/src/main/java/com/l2jserver/datapack/quests/Q00060_GoodWorksReward/Q00060_GoodWorksReward.java index 973d8fa81c..ac4ce34d95 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00060_GoodWorksReward/Q00060_GoodWorksReward.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00060_GoodWorksReward/Q00060_GoodWorksReward.java @@ -58,8 +58,7 @@ import com.l2jserver.gameserver.util.Util; * Good Work's Reward (60) * @author ivantotov */ -public final class Q00060_GoodWorksReward extends Quest -{ +public final class Q00060_GoodWorksReward extends Quest { // NPCs private static final int GROCER_HELVERIA = 30081; private static final int BLACK_MARKETEER_OF_MAMMON = 31092; @@ -100,8 +99,7 @@ public final class Q00060_GoodWorksReward extends Quest private static final int TWO_MILLION = 2000000; private static final int THREE_MILLION = 3000000; - public Q00060_GoodWorksReward() - { + public Q00060_GoodWorksReward() { super(60, Q00060_GoodWorksReward.class.getSimpleName(), "Good Work's Reward"); addStartNpc(BLUEPRINT_SELLER_DAEGER); addTalkId(BLUEPRINT_SELLER_DAEGER, GROCER_HELVERIA, BLACK_MARKETEER_OF_MAMMON, MARK); @@ -111,15 +109,12 @@ public final class Q00060_GoodWorksReward extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { - if ("DESPAWN".equals(event)) - { + if ("DESPAWN".equals(event)) { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.YOU_HAVE_GOOD_LUCK_I_SHALL_RETURN)); final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class); - if (npc0 != null) - { + if (npc0 != null) { npc0.getVariables().set("SPAWNED", false); } npc.deleteMe(); @@ -127,61 +122,48 @@ public final class Q00060_GoodWorksReward extends Quest } final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "31435-07.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "31435-07.htm": { + if (qs.isCreated()) { qs.startQuest(); qs.setMemoState(1); htmltext = event; } break; } - case "31435-02.htm": - { + case "31435-02.htm": { htmltext = event; break; } - case "31435-10.html": - { - if (qs.isMemoState(3)) - { + case "31435-10.html": { + if (qs.isMemoState(3)) { qs.setMemoState(4); qs.setCond(4, true); htmltext = event; } break; } - case "31435-14.html": - { - if (qs.isMemoState(8)) - { + case "31435-14.html": { + if (qs.isMemoState(8)) { qs.setMemoState(9); qs.setCond(9, true); htmltext = event; } break; } - case "30081-02.html": - { - if (qs.isMemoState(4)) - { + case "30081-02.html": { + if (qs.isMemoState(4)) { htmltext = event; } break; } - case "30081-03.html": - { - if (qs.isMemoState(4)) - { + case "30081-03.html": { + if (qs.isMemoState(4)) { takeItems(player, BLOODY_CLOTH_FRAGMENT, -1); qs.setMemoState(5); qs.setCond(5, true); @@ -189,21 +171,16 @@ public final class Q00060_GoodWorksReward extends Quest } break; } - case "30081-05.html": - { + case "30081-05.html": { final int memoState = qs.getMemoState(); - if ((memoState >= 5) && (memoState <= 6)) - { - if (getQuestItemsCount(player, Inventory.ADENA_ID) >= THREE_MILLION) - { + if ((memoState >= 5) && (memoState <= 6)) { + if (getQuestItemsCount(player, Inventory.ADENA_ID) >= THREE_MILLION) { giveItems(player, HELVETIAS_ANTIDOTE, 1); takeItems(player, Inventory.ADENA_ID, THREE_MILLION); qs.setMemoState(7); qs.setCond(7, true); htmltext = event; - } - else - { + } else { qs.setMemoState(6); qs.setCond(6, true); htmltext = "30081-06.html"; @@ -211,112 +188,78 @@ public final class Q00060_GoodWorksReward extends Quest } break; } - case "30081-07.html": - { - if (qs.isMemoState(5)) - { + case "30081-07.html": { + if (qs.isMemoState(5)) { qs.setMemoState(6); qs.setCond(6, true); htmltext = event; } break; } - case "REPLY_1": - { - if (qs.isMemoState(10)) - { + case "REPLY_1": { + if (qs.isMemoState(10)) { if (player.hasQuestCompleted(Q00211_TrialOfTheChallenger.class.getSimpleName()) || player.hasQuestCompleted(Q00212_TrialOfDuty.class.getSimpleName()) || player.hasQuestCompleted(Q00213_TrialOfTheSeeker.class.getSimpleName()) - || player.hasQuestCompleted(Q00214_TrialOfTheScholar.class.getSimpleName()) || player.hasQuestCompleted(Q00215_TrialOfThePilgrim.class.getSimpleName()) || player.hasQuestCompleted(Q00216_TrialOfTheGuildsman.class.getSimpleName())) - { + || player.hasQuestCompleted(Q00214_TrialOfTheScholar.class.getSimpleName()) || player.hasQuestCompleted(Q00215_TrialOfThePilgrim.class.getSimpleName()) || player.hasQuestCompleted(Q00216_TrialOfTheGuildsman.class.getSimpleName())) { if (player.hasQuestCompleted(Q00217_TestimonyOfTrust.class.getSimpleName()) || player.hasQuestCompleted(Q00218_TestimonyOfLife.class.getSimpleName()) || player.hasQuestCompleted(Q00219_TestimonyOfFate.class.getSimpleName()) - || player.hasQuestCompleted(Q00220_TestimonyOfGlory.class.getSimpleName()) || player.hasQuestCompleted(Q00221_TestimonyOfProsperity.class.getSimpleName())) - { + || player.hasQuestCompleted(Q00220_TestimonyOfGlory.class.getSimpleName()) || player.hasQuestCompleted(Q00221_TestimonyOfProsperity.class.getSimpleName())) { if (player.hasQuestCompleted(Q00222_TestOfTheDuelist.class.getSimpleName()) || player.hasQuestCompleted(Q00223_TestOfTheChampion.class.getSimpleName()) || player.hasQuestCompleted(Q00224_TestOfSagittarius.class.getSimpleName()) || player.hasQuestCompleted(Q00225_TestOfTheSearcher.class.getSimpleName()) || player.hasQuestCompleted(Q00226_TestOfTheHealer.class.getSimpleName()) || player.hasQuestCompleted(Q00227_TestOfTheReformer.class.getSimpleName()) || player.hasQuestCompleted(Q00228_TestOfMagus.class.getSimpleName()) || player.hasQuestCompleted(Q00229_TestOfWitchcraft.class.getSimpleName()) || player.hasQuestCompleted(Q00230_TestOfTheSummoner.class.getSimpleName()) - || player.hasQuestCompleted(Q00231_TestOfTheMaestro.class.getSimpleName()) || player.hasQuestCompleted(Q00232_TestOfTheLord.class.getSimpleName()) || player.hasQuestCompleted(Q00233_TestOfTheWarSpirit.class.getSimpleName())) - { + || player.hasQuestCompleted(Q00231_TestOfTheMaestro.class.getSimpleName()) || player.hasQuestCompleted(Q00232_TestOfTheLord.class.getSimpleName()) || player.hasQuestCompleted(Q00233_TestOfTheWarSpirit.class.getSimpleName())) { qs.setMemoStateEx(1, 3); - } - else - { + } else { qs.setMemoStateEx(1, 2); } - } - else if (player.hasQuestCompleted(Q00222_TestOfTheDuelist.class.getSimpleName()) || player.hasQuestCompleted(Q00223_TestOfTheChampion.class.getSimpleName()) || player.hasQuestCompleted(Q00224_TestOfSagittarius.class.getSimpleName()) + } else if (player.hasQuestCompleted(Q00222_TestOfTheDuelist.class.getSimpleName()) || player.hasQuestCompleted(Q00223_TestOfTheChampion.class.getSimpleName()) || player.hasQuestCompleted(Q00224_TestOfSagittarius.class.getSimpleName()) || player.hasQuestCompleted(Q00225_TestOfTheSearcher.class.getSimpleName()) || player.hasQuestCompleted(Q00226_TestOfTheHealer.class.getSimpleName()) || player.hasQuestCompleted(Q00227_TestOfTheReformer.class.getSimpleName()) || player.hasQuestCompleted(Q00228_TestOfMagus.class.getSimpleName()) || player.hasQuestCompleted(Q00229_TestOfWitchcraft.class.getSimpleName()) || player.hasQuestCompleted(Q00230_TestOfTheSummoner.class.getSimpleName()) - || player.hasQuestCompleted(Q00231_TestOfTheMaestro.class.getSimpleName()) || player.hasQuestCompleted(Q00232_TestOfTheLord.class.getSimpleName()) || player.hasQuestCompleted(Q00233_TestOfTheWarSpirit.class.getSimpleName())) - { + || player.hasQuestCompleted(Q00231_TestOfTheMaestro.class.getSimpleName()) || player.hasQuestCompleted(Q00232_TestOfTheLord.class.getSimpleName()) || player.hasQuestCompleted(Q00233_TestOfTheWarSpirit.class.getSimpleName())) { qs.setMemoStateEx(1, 2); - } - else - { + } else { qs.setMemoStateEx(1, 1); } - } - else if (player.hasQuestCompleted(Q00217_TestimonyOfTrust.class.getSimpleName()) || player.hasQuestCompleted(Q00218_TestimonyOfLife.class.getSimpleName()) || player.hasQuestCompleted(Q00219_TestimonyOfFate.class.getSimpleName()) - || player.hasQuestCompleted(Q00220_TestimonyOfGlory.class.getSimpleName()) || player.hasQuestCompleted(Q00221_TestimonyOfProsperity.class.getSimpleName())) - { + } else if (player.hasQuestCompleted(Q00217_TestimonyOfTrust.class.getSimpleName()) || player.hasQuestCompleted(Q00218_TestimonyOfLife.class.getSimpleName()) || player.hasQuestCompleted(Q00219_TestimonyOfFate.class.getSimpleName()) + || player.hasQuestCompleted(Q00220_TestimonyOfGlory.class.getSimpleName()) || player.hasQuestCompleted(Q00221_TestimonyOfProsperity.class.getSimpleName())) { if (player.hasQuestCompleted(Q00222_TestOfTheDuelist.class.getSimpleName()) || player.hasQuestCompleted(Q00223_TestOfTheChampion.class.getSimpleName()) || player.hasQuestCompleted(Q00224_TestOfSagittarius.class.getSimpleName()) || player.hasQuestCompleted(Q00225_TestOfTheSearcher.class.getSimpleName()) || player.hasQuestCompleted(Q00226_TestOfTheHealer.class.getSimpleName()) || player.hasQuestCompleted(Q00227_TestOfTheReformer.class.getSimpleName()) || player.hasQuestCompleted(Q00228_TestOfMagus.class.getSimpleName()) || player.hasQuestCompleted(Q00229_TestOfWitchcraft.class.getSimpleName()) || player.hasQuestCompleted(Q00230_TestOfTheSummoner.class.getSimpleName()) - || player.hasQuestCompleted(Q00231_TestOfTheMaestro.class.getSimpleName()) || player.hasQuestCompleted(Q00232_TestOfTheLord.class.getSimpleName()) || player.hasQuestCompleted(Q00233_TestOfTheWarSpirit.class.getSimpleName())) - { + || player.hasQuestCompleted(Q00231_TestOfTheMaestro.class.getSimpleName()) || player.hasQuestCompleted(Q00232_TestOfTheLord.class.getSimpleName()) || player.hasQuestCompleted(Q00233_TestOfTheWarSpirit.class.getSimpleName())) { qs.setMemoStateEx(1, 2); - } - else - { + } else { qs.setMemoStateEx(1, 1); } - } - else if (player.hasQuestCompleted(Q00222_TestOfTheDuelist.class.getSimpleName()) || player.hasQuestCompleted(Q00223_TestOfTheChampion.class.getSimpleName()) || player.hasQuestCompleted(Q00224_TestOfSagittarius.class.getSimpleName()) + } else if (player.hasQuestCompleted(Q00222_TestOfTheDuelist.class.getSimpleName()) || player.hasQuestCompleted(Q00223_TestOfTheChampion.class.getSimpleName()) || player.hasQuestCompleted(Q00224_TestOfSagittarius.class.getSimpleName()) || player.hasQuestCompleted(Q00225_TestOfTheSearcher.class.getSimpleName()) || player.hasQuestCompleted(Q00226_TestOfTheHealer.class.getSimpleName()) || player.hasQuestCompleted(Q00227_TestOfTheReformer.class.getSimpleName()) || player.hasQuestCompleted(Q00228_TestOfMagus.class.getSimpleName()) || player.hasQuestCompleted(Q00229_TestOfWitchcraft.class.getSimpleName()) || player.hasQuestCompleted(Q00230_TestOfTheSummoner.class.getSimpleName()) - || player.hasQuestCompleted(Q00231_TestOfTheMaestro.class.getSimpleName()) || player.hasQuestCompleted(Q00232_TestOfTheLord.class.getSimpleName()) || player.hasQuestCompleted(Q00233_TestOfTheWarSpirit.class.getSimpleName())) - { + || player.hasQuestCompleted(Q00231_TestOfTheMaestro.class.getSimpleName()) || player.hasQuestCompleted(Q00232_TestOfTheLord.class.getSimpleName()) || player.hasQuestCompleted(Q00233_TestOfTheWarSpirit.class.getSimpleName())) { qs.setMemoStateEx(1, 1); } htmltext = "31092-02.html"; } break; } - case "REPLY_2": - { - if (qs.isMemoState(10)) - { - if (qs.getMemoStateEx(1) >= 3) - { + case "REPLY_2": { + if (qs.isMemoState(10)) { + if (qs.getMemoStateEx(1) >= 3) { htmltext = "31092-03b.html"; - } - else if (qs.getMemoStateEx(1) >= 1) - { + } else if (qs.getMemoStateEx(1) >= 1) { htmltext = "31092-03.html"; - } - else - { + } else { htmltext = "31092-03a.html"; } } break; } - case "REPLY_3": - { - if (qs.isMemoState(10)) - { - if (qs.getMemoStateEx(1) >= 3) - { + case "REPLY_3": { + if (qs.isMemoState(10)) { + if (qs.getMemoStateEx(1) >= 3) { giveItems(player, Inventory.ADENA_ID, THREE_MILLION); htmltext = "31092-04a.html"; - } - else if (qs.getMemoStateEx(1) == 2) - { + } else if (qs.getMemoStateEx(1) == 2) { giveItems(player, Inventory.ADENA_ID, TWO_MILLION); htmltext = "31092-04b.html"; - } - else if (qs.getMemoStateEx(1) == 1) - { + } else if (qs.getMemoStateEx(1) == 1) { giveItems(player, Inventory.ADENA_ID, ONE_MILLION); htmltext = "31092-04b.html"; } @@ -324,12 +267,9 @@ public final class Q00060_GoodWorksReward extends Quest } break; } - case "REPLY_4": - { - if (qs.isMemoState(10)) - { - switch (player.getClassId()) - { + case "REPLY_4": { + if (qs.isMemoState(10)) { + switch (player.getClassId()) { case warrior: return "31092-05.html"; case knight: @@ -371,12 +311,9 @@ public final class Q00060_GoodWorksReward extends Quest } break; } - case "REPLY_5": - { - if (player.isInCategory(CategoryType.SECOND_CLASS_GROUP)) - { - switch (player.getClassId()) - { + case "REPLY_5": { + if (player.isInCategory(CategoryType.SECOND_CLASS_GROUP)) { + switch (player.getClassId()) { case warrior: return "31092-05a.html"; case knight: @@ -417,632 +354,474 @@ public final class Q00060_GoodWorksReward extends Quest } break; } - case "REPLY_6": - { - if ((player.getClassId() == ClassId.warrior)) - { - if (!hasQuestItems(player, MARK_OF_CHALLENGER)) - { + case "REPLY_6": { + if ((player.getClassId() == ClassId.warrior)) { + if (!hasQuestItems(player, MARK_OF_CHALLENGER)) { giveItems(player, MARK_OF_CHALLENGER, 1); } - if (!hasQuestItems(player, MARK_OF_TRUST)) - { + if (!hasQuestItems(player, MARK_OF_TRUST)) { giveItems(player, MARK_OF_TRUST, 1); } - if (!hasQuestItems(player, MARK_OF_DUELIST)) - { + if (!hasQuestItems(player, MARK_OF_DUELIST)) { giveItems(player, MARK_OF_DUELIST, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_7": - { - if ((player.getClassId() == ClassId.warrior)) - { - if (!hasQuestItems(player, MARK_OF_CHALLENGER)) - { + case "REPLY_7": { + if ((player.getClassId() == ClassId.warrior)) { + if (!hasQuestItems(player, MARK_OF_CHALLENGER)) { giveItems(player, MARK_OF_CHALLENGER, 1); } - if (!hasQuestItems(player, MARK_OF_TRUST)) - { + if (!hasQuestItems(player, MARK_OF_TRUST)) { giveItems(player, MARK_OF_TRUST, 1); } - if (!hasQuestItems(player, MARK_OF_CHAMPION)) - { + if (!hasQuestItems(player, MARK_OF_CHAMPION)) { giveItems(player, MARK_OF_CHAMPION, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_8": - { - if ((player.getClassId() == ClassId.knight)) - { - if (!hasQuestItems(player, MARK_OF_DUTY)) - { + case "REPLY_8": { + if ((player.getClassId() == ClassId.knight)) { + if (!hasQuestItems(player, MARK_OF_DUTY)) { giveItems(player, MARK_OF_DUTY, 1); } - if (!hasQuestItems(player, MARK_OF_TRUST)) - { + if (!hasQuestItems(player, MARK_OF_TRUST)) { giveItems(player, MARK_OF_TRUST, 1); } - if (!hasQuestItems(player, MARK_OF_HEALER)) - { + if (!hasQuestItems(player, MARK_OF_HEALER)) { giveItems(player, MARK_OF_HEALER, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_9": - { - if ((player.getClassId() == ClassId.knight)) - { - if (!hasQuestItems(player, MARK_OF_DUTY)) - { + case "REPLY_9": { + if ((player.getClassId() == ClassId.knight)) { + if (!hasQuestItems(player, MARK_OF_DUTY)) { giveItems(player, MARK_OF_DUTY, 1); } - if (!hasQuestItems(player, MARK_OF_TRUST)) - { + if (!hasQuestItems(player, MARK_OF_TRUST)) { giveItems(player, MARK_OF_TRUST, 1); } - if (!hasQuestItems(player, MARK_OF_WITCHCRAFT)) - { + if (!hasQuestItems(player, MARK_OF_WITCHCRAFT)) { giveItems(player, MARK_OF_WITCHCRAFT, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_10": - { - if ((player.getClassId() == ClassId.rogue)) - { - if (!hasQuestItems(player, MARK_OF_SEEKER)) - { + case "REPLY_10": { + if ((player.getClassId() == ClassId.rogue)) { + if (!hasQuestItems(player, MARK_OF_SEEKER)) { giveItems(player, MARK_OF_SEEKER, 1); } - if (!hasQuestItems(player, MARK_OF_TRUST)) - { + if (!hasQuestItems(player, MARK_OF_TRUST)) { giveItems(player, MARK_OF_TRUST, 1); } - if (!hasQuestItems(player, MARK_OF_SEARCHER)) - { + if (!hasQuestItems(player, MARK_OF_SEARCHER)) { giveItems(player, MARK_OF_SEARCHER, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_11": - { - if ((player.getClassId() == ClassId.rogue)) - { - if (!hasQuestItems(player, MARK_OF_SEEKER)) - { + case "REPLY_11": { + if ((player.getClassId() == ClassId.rogue)) { + if (!hasQuestItems(player, MARK_OF_SEEKER)) { giveItems(player, MARK_OF_SEEKER, 1); } - if (!hasQuestItems(player, MARK_OF_TRUST)) - { + if (!hasQuestItems(player, MARK_OF_TRUST)) { giveItems(player, MARK_OF_TRUST, 1); } - if (!hasQuestItems(player, MARK_OF_SAGITTARIUS)) - { + if (!hasQuestItems(player, MARK_OF_SAGITTARIUS)) { giveItems(player, MARK_OF_SAGITTARIUS, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_12": - { - if ((player.getClassId() == ClassId.wizard)) - { - if (!hasQuestItems(player, MARK_OF_SCHOLAR)) - { + case "REPLY_12": { + if ((player.getClassId() == ClassId.wizard)) { + if (!hasQuestItems(player, MARK_OF_SCHOLAR)) { giveItems(player, MARK_OF_SCHOLAR, 1); } - if (!hasQuestItems(player, MARK_OF_TRUST)) - { + if (!hasQuestItems(player, MARK_OF_TRUST)) { giveItems(player, MARK_OF_TRUST, 1); } - if (!hasQuestItems(player, MARK_OF_MAGUS)) - { + if (!hasQuestItems(player, MARK_OF_MAGUS)) { giveItems(player, MARK_OF_MAGUS, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_13": - { - if ((player.getClassId() == ClassId.wizard)) - { - if (!hasQuestItems(player, MARK_OF_SCHOLAR)) - { + case "REPLY_13": { + if ((player.getClassId() == ClassId.wizard)) { + if (!hasQuestItems(player, MARK_OF_SCHOLAR)) { giveItems(player, MARK_OF_SCHOLAR, 1); } - if (!hasQuestItems(player, MARK_OF_TRUST)) - { + if (!hasQuestItems(player, MARK_OF_TRUST)) { giveItems(player, MARK_OF_TRUST, 1); } - if (!hasQuestItems(player, MARK_OF_WITCHCRAFT)) - { + if (!hasQuestItems(player, MARK_OF_WITCHCRAFT)) { giveItems(player, MARK_OF_WITCHCRAFT, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_14": - { - if ((player.getClassId() == ClassId.wizard)) - { - if (!hasQuestItems(player, MARK_OF_SCHOLAR)) - { + case "REPLY_14": { + if ((player.getClassId() == ClassId.wizard)) { + if (!hasQuestItems(player, MARK_OF_SCHOLAR)) { giveItems(player, MARK_OF_SCHOLAR, 1); } - if (!hasQuestItems(player, MARK_OF_TRUST)) - { + if (!hasQuestItems(player, MARK_OF_TRUST)) { giveItems(player, MARK_OF_TRUST, 1); } - if (!hasQuestItems(player, MARK_OF_SUMMONER)) - { + if (!hasQuestItems(player, MARK_OF_SUMMONER)) { giveItems(player, MARK_OF_SUMMONER, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_15": - { - if ((player.getClassId() == ClassId.cleric)) - { - if (!hasQuestItems(player, MARK_OF_PILGRIM)) - { + case "REPLY_15": { + if ((player.getClassId() == ClassId.cleric)) { + if (!hasQuestItems(player, MARK_OF_PILGRIM)) { giveItems(player, MARK_OF_PILGRIM, 1); } - if (!hasQuestItems(player, MARK_OF_TRUST)) - { + if (!hasQuestItems(player, MARK_OF_TRUST)) { giveItems(player, MARK_OF_TRUST, 1); } - if (!hasQuestItems(player, MARK_OF_HEALER)) - { + if (!hasQuestItems(player, MARK_OF_HEALER)) { giveItems(player, MARK_OF_HEALER, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_16": - { - if ((player.getClassId() == ClassId.cleric)) - { - if (!hasQuestItems(player, MARK_OF_PILGRIM)) - { + case "REPLY_16": { + if ((player.getClassId() == ClassId.cleric)) { + if (!hasQuestItems(player, MARK_OF_PILGRIM)) { giveItems(player, MARK_OF_PILGRIM, 1); } - if (!hasQuestItems(player, MARK_OF_TRUST)) - { + if (!hasQuestItems(player, MARK_OF_TRUST)) { giveItems(player, MARK_OF_TRUST, 1); } - if (!hasQuestItems(player, MARK_OF_REFORMER)) - { + if (!hasQuestItems(player, MARK_OF_REFORMER)) { giveItems(player, MARK_OF_REFORMER, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_17": - { - if ((player.getClassId() == ClassId.elvenKnight)) - { - if (!hasQuestItems(player, MARK_OF_DUTY)) - { + case "REPLY_17": { + if ((player.getClassId() == ClassId.elvenKnight)) { + if (!hasQuestItems(player, MARK_OF_DUTY)) { giveItems(player, MARK_OF_DUTY, 1); } - if (!hasQuestItems(player, MARK_OF_LIFE)) - { + if (!hasQuestItems(player, MARK_OF_LIFE)) { giveItems(player, MARK_OF_LIFE, 1); } - if (!hasQuestItems(player, MARK_OF_HEALER)) - { + if (!hasQuestItems(player, MARK_OF_HEALER)) { giveItems(player, MARK_OF_HEALER, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_18": - { - if ((player.getClassId() == ClassId.elvenKnight)) - { - if (!hasQuestItems(player, MARK_OF_CHALLENGER)) - { + case "REPLY_18": { + if ((player.getClassId() == ClassId.elvenKnight)) { + if (!hasQuestItems(player, MARK_OF_CHALLENGER)) { giveItems(player, MARK_OF_CHALLENGER, 1); } - if (!hasQuestItems(player, MARK_OF_LIFE)) - { + if (!hasQuestItems(player, MARK_OF_LIFE)) { giveItems(player, MARK_OF_LIFE, 1); } - if (!hasQuestItems(player, MARK_OF_DUELIST)) - { + if (!hasQuestItems(player, MARK_OF_DUELIST)) { giveItems(player, MARK_OF_DUELIST, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_19": - { - if ((player.getClassId() == ClassId.elvenScout)) - { - if (!hasQuestItems(player, MARK_OF_SEEKER)) - { + case "REPLY_19": { + if ((player.getClassId() == ClassId.elvenScout)) { + if (!hasQuestItems(player, MARK_OF_SEEKER)) { giveItems(player, MARK_OF_SEEKER, 1); } - if (!hasQuestItems(player, MARK_OF_LIFE)) - { + if (!hasQuestItems(player, MARK_OF_LIFE)) { giveItems(player, MARK_OF_LIFE, 1); } - if (!hasQuestItems(player, MARK_OF_SEARCHER)) - { + if (!hasQuestItems(player, MARK_OF_SEARCHER)) { giveItems(player, MARK_OF_SEARCHER, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_20": - { - if ((player.getClassId() == ClassId.elvenScout)) - { - if (!hasQuestItems(player, MARK_OF_SEEKER)) - { + case "REPLY_20": { + if ((player.getClassId() == ClassId.elvenScout)) { + if (!hasQuestItems(player, MARK_OF_SEEKER)) { giveItems(player, MARK_OF_SEEKER, 1); } - if (!hasQuestItems(player, MARK_OF_LIFE)) - { + if (!hasQuestItems(player, MARK_OF_LIFE)) { giveItems(player, MARK_OF_LIFE, 1); } - if (!hasQuestItems(player, MARK_OF_SAGITTARIUS)) - { + if (!hasQuestItems(player, MARK_OF_SAGITTARIUS)) { giveItems(player, MARK_OF_SAGITTARIUS, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_21": - { - if ((player.getClassId() == ClassId.elvenWizard)) - { - if (!hasQuestItems(player, MARK_OF_SCHOLAR)) - { + case "REPLY_21": { + if ((player.getClassId() == ClassId.elvenWizard)) { + if (!hasQuestItems(player, MARK_OF_SCHOLAR)) { giveItems(player, MARK_OF_SCHOLAR, 1); } - if (!hasQuestItems(player, MARK_OF_LIFE)) - { + if (!hasQuestItems(player, MARK_OF_LIFE)) { giveItems(player, MARK_OF_LIFE, 1); } - if (!hasQuestItems(player, MARK_OF_MAGUS)) - { + if (!hasQuestItems(player, MARK_OF_MAGUS)) { giveItems(player, MARK_OF_MAGUS, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_22": - { - if ((player.getClassId() == ClassId.elvenWizard)) - { - if (!hasQuestItems(player, MARK_OF_SCHOLAR)) - { + case "REPLY_22": { + if ((player.getClassId() == ClassId.elvenWizard)) { + if (!hasQuestItems(player, MARK_OF_SCHOLAR)) { giveItems(player, MARK_OF_SCHOLAR, 1); } - if (!hasQuestItems(player, MARK_OF_LIFE)) - { + if (!hasQuestItems(player, MARK_OF_LIFE)) { giveItems(player, MARK_OF_LIFE, 1); } - if (!hasQuestItems(player, MARK_OF_SUMMONER)) - { + if (!hasQuestItems(player, MARK_OF_SUMMONER)) { giveItems(player, MARK_OF_SUMMONER, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_23": - { - if ((player.getClassId() == ClassId.oracle)) - { - if (!hasQuestItems(player, MARK_OF_PILGRIM)) - { + case "REPLY_23": { + if ((player.getClassId() == ClassId.oracle)) { + if (!hasQuestItems(player, MARK_OF_PILGRIM)) { giveItems(player, MARK_OF_PILGRIM, 1); } - if (!hasQuestItems(player, MARK_OF_LIFE)) - { + if (!hasQuestItems(player, MARK_OF_LIFE)) { giveItems(player, MARK_OF_LIFE, 1); } - if (!hasQuestItems(player, MARK_OF_HEALER)) - { + if (!hasQuestItems(player, MARK_OF_HEALER)) { giveItems(player, MARK_OF_HEALER, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_24": - { - if ((player.getClassId() == ClassId.palusKnight)) - { - if (!hasQuestItems(player, MARK_OF_DUTY)) - { + case "REPLY_24": { + if ((player.getClassId() == ClassId.palusKnight)) { + if (!hasQuestItems(player, MARK_OF_DUTY)) { giveItems(player, MARK_OF_DUTY, 1); } - if (!hasQuestItems(player, MARK_OF_FATE)) - { + if (!hasQuestItems(player, MARK_OF_FATE)) { giveItems(player, MARK_OF_FATE, 1); } - if (!hasQuestItems(player, MARK_OF_WITCHCRAFT)) - { + if (!hasQuestItems(player, MARK_OF_WITCHCRAFT)) { giveItems(player, MARK_OF_WITCHCRAFT, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_25": - { - if ((player.getClassId() == ClassId.palusKnight)) - { - if (!hasQuestItems(player, MARK_OF_CHALLENGER)) - { + case "REPLY_25": { + if ((player.getClassId() == ClassId.palusKnight)) { + if (!hasQuestItems(player, MARK_OF_CHALLENGER)) { giveItems(player, MARK_OF_CHALLENGER, 1); } - if (!hasQuestItems(player, MARK_OF_FATE)) - { + if (!hasQuestItems(player, MARK_OF_FATE)) { giveItems(player, MARK_OF_FATE, 1); } - if (!hasQuestItems(player, MARK_OF_DUELIST)) - { + if (!hasQuestItems(player, MARK_OF_DUELIST)) { giveItems(player, MARK_OF_DUELIST, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_26": - { - if ((player.getClassId() == ClassId.assassin)) - { - if (!hasQuestItems(player, MARK_OF_SEEKER)) - { + case "REPLY_26": { + if ((player.getClassId() == ClassId.assassin)) { + if (!hasQuestItems(player, MARK_OF_SEEKER)) { giveItems(player, MARK_OF_SEEKER, 1); } - if (!hasQuestItems(player, MARK_OF_FATE)) - { + if (!hasQuestItems(player, MARK_OF_FATE)) { giveItems(player, MARK_OF_FATE, 1); } - if (!hasQuestItems(player, MARK_OF_SEARCHER)) - { + if (!hasQuestItems(player, MARK_OF_SEARCHER)) { giveItems(player, MARK_OF_SEARCHER, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_27": - { - if ((player.getClassId() == ClassId.assassin)) - { - if (!hasQuestItems(player, MARK_OF_SEEKER)) - { + case "REPLY_27": { + if ((player.getClassId() == ClassId.assassin)) { + if (!hasQuestItems(player, MARK_OF_SEEKER)) { giveItems(player, MARK_OF_SEEKER, 1); } - if (!hasQuestItems(player, MARK_OF_FATE)) - { + if (!hasQuestItems(player, MARK_OF_FATE)) { giveItems(player, MARK_OF_FATE, 1); } - if (!hasQuestItems(player, MARK_OF_SAGITTARIUS)) - { + if (!hasQuestItems(player, MARK_OF_SAGITTARIUS)) { giveItems(player, MARK_OF_SAGITTARIUS, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_28": - { - if ((player.getClassId() == ClassId.darkWizard)) - { - if (!hasQuestItems(player, MARK_OF_SCHOLAR)) - { + case "REPLY_28": { + if ((player.getClassId() == ClassId.darkWizard)) { + if (!hasQuestItems(player, MARK_OF_SCHOLAR)) { giveItems(player, MARK_OF_SCHOLAR, 1); } - if (!hasQuestItems(player, MARK_OF_FATE)) - { + if (!hasQuestItems(player, MARK_OF_FATE)) { giveItems(player, MARK_OF_FATE, 1); } - if (!hasQuestItems(player, MARK_OF_MAGUS)) - { + if (!hasQuestItems(player, MARK_OF_MAGUS)) { giveItems(player, MARK_OF_MAGUS, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_29": - { - if ((player.getClassId() == ClassId.darkWizard)) - { - if (!hasQuestItems(player, MARK_OF_SCHOLAR)) - { + case "REPLY_29": { + if ((player.getClassId() == ClassId.darkWizard)) { + if (!hasQuestItems(player, MARK_OF_SCHOLAR)) { giveItems(player, MARK_OF_SCHOLAR, 1); } - if (!hasQuestItems(player, MARK_OF_FATE)) - { + if (!hasQuestItems(player, MARK_OF_FATE)) { giveItems(player, MARK_OF_FATE, 1); } - if (!hasQuestItems(player, MARK_OF_SUMMONER)) - { + if (!hasQuestItems(player, MARK_OF_SUMMONER)) { giveItems(player, MARK_OF_SUMMONER, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_30": - { - if ((player.getClassId() == ClassId.shillienOracle)) - { - if (!hasQuestItems(player, MARK_OF_PILGRIM)) - { + case "REPLY_30": { + if ((player.getClassId() == ClassId.shillienOracle)) { + if (!hasQuestItems(player, MARK_OF_PILGRIM)) { giveItems(player, MARK_OF_PILGRIM, 1); } - if (!hasQuestItems(player, MARK_OF_FATE)) - { + if (!hasQuestItems(player, MARK_OF_FATE)) { giveItems(player, MARK_OF_FATE, 1); } - if (!hasQuestItems(player, MARK_OF_REFORMER)) - { + if (!hasQuestItems(player, MARK_OF_REFORMER)) { giveItems(player, MARK_OF_REFORMER, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_31": - { - if ((player.getClassId() == ClassId.orcRaider)) - { - if (!hasQuestItems(player, MARK_OF_CHALLENGER)) - { + case "REPLY_31": { + if ((player.getClassId() == ClassId.orcRaider)) { + if (!hasQuestItems(player, MARK_OF_CHALLENGER)) { giveItems(player, MARK_OF_CHALLENGER, 1); } - if (!hasQuestItems(player, MARK_OF_GLORY)) - { + if (!hasQuestItems(player, MARK_OF_GLORY)) { giveItems(player, MARK_OF_GLORY, 1); } - if (!hasQuestItems(player, MARK_OF_CHAMPION)) - { + if (!hasQuestItems(player, MARK_OF_CHAMPION)) { giveItems(player, MARK_OF_CHAMPION, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_32": - { - if ((player.getClassId() == ClassId.orcMonk)) - { - if (!hasQuestItems(player, MARK_OF_CHALLENGER)) - { + case "REPLY_32": { + if ((player.getClassId() == ClassId.orcMonk)) { + if (!hasQuestItems(player, MARK_OF_CHALLENGER)) { giveItems(player, MARK_OF_CHALLENGER, 1); } - if (!hasQuestItems(player, MARK_OF_GLORY)) - { + if (!hasQuestItems(player, MARK_OF_GLORY)) { giveItems(player, MARK_OF_GLORY, 1); } - if (!hasQuestItems(player, MARK_OF_DUELIST)) - { + if (!hasQuestItems(player, MARK_OF_DUELIST)) { giveItems(player, MARK_OF_DUELIST, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_33": - { - if ((player.getClassId() == ClassId.orcShaman)) - { - if (!hasQuestItems(player, MARK_OF_PILGRIM)) - { + case "REPLY_33": { + if ((player.getClassId() == ClassId.orcShaman)) { + if (!hasQuestItems(player, MARK_OF_PILGRIM)) { giveItems(player, MARK_OF_PILGRIM, 1); } - if (!hasQuestItems(player, MARK_OF_GLORY)) - { + if (!hasQuestItems(player, MARK_OF_GLORY)) { giveItems(player, MARK_OF_GLORY, 1); } - if (!hasQuestItems(player, MARK_OF_LORD)) - { + if (!hasQuestItems(player, MARK_OF_LORD)) { giveItems(player, MARK_OF_LORD, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_34": - { - if ((player.getClassId() == ClassId.orcShaman)) - { - if (!hasQuestItems(player, MARK_OF_PILGRIM)) - { + case "REPLY_34": { + if ((player.getClassId() == ClassId.orcShaman)) { + if (!hasQuestItems(player, MARK_OF_PILGRIM)) { giveItems(player, MARK_OF_PILGRIM, 1); } - if (!hasQuestItems(player, MARK_OF_GLORY)) - { + if (!hasQuestItems(player, MARK_OF_GLORY)) { giveItems(player, MARK_OF_GLORY, 1); } - if (!hasQuestItems(player, MARK_OF_WARSPIRIT)) - { + if (!hasQuestItems(player, MARK_OF_WARSPIRIT)) { giveItems(player, MARK_OF_WARSPIRIT, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_35": - { - if ((player.getClassId() == ClassId.scavenger)) - { - if (!hasQuestItems(player, MARK_OF_GUILDSMAN)) - { + case "REPLY_35": { + if ((player.getClassId() == ClassId.scavenger)) { + if (!hasQuestItems(player, MARK_OF_GUILDSMAN)) { giveItems(player, MARK_OF_GUILDSMAN, 1); } - if (!hasQuestItems(player, MARK_OF_PROSPERITY)) - { + if (!hasQuestItems(player, MARK_OF_PROSPERITY)) { giveItems(player, MARK_OF_PROSPERITY, 1); } - if (!hasQuestItems(player, MARK_OF_SEARCHER)) - { + if (!hasQuestItems(player, MARK_OF_SEARCHER)) { giveItems(player, MARK_OF_SEARCHER, 1); } htmltext = "31092-25.html"; } break; } - case "REPLY_36": - { - if ((player.getClassId() == ClassId.artisan)) - { - if (!hasQuestItems(player, MARK_OF_GUILDSMAN)) - { + case "REPLY_36": { + if ((player.getClassId() == ClassId.artisan)) { + if (!hasQuestItems(player, MARK_OF_GUILDSMAN)) { giveItems(player, MARK_OF_GUILDSMAN, 1); } - if (!hasQuestItems(player, MARK_OF_PROSPERITY)) - { + if (!hasQuestItems(player, MARK_OF_PROSPERITY)) { giveItems(player, MARK_OF_PROSPERITY, 1); } - if (!hasQuestItems(player, MARK_OF_MAESTRO)) - { + if (!hasQuestItems(player, MARK_OF_MAESTRO)) { giveItems(player, MARK_OF_MAESTRO, 1); } htmltext = "31092-25.html"; } break; } - case "32487-04.html": - { - if (qs.isMemoState(1)) - { - if (!npc.getVariables().getBoolean("SPAWNED", false)) - { + case "32487-04.html": { + if (qs.isMemoState(1)) { + if (!npc.getVariables().getBoolean("SPAWNED", false)) { npc.getVariables().set("SPAWNED", true); npc.getVariables().set("PLAYER_ID", player.getObjectId()); final L2Npc pursuer = addSpawn(PURSUER, player.getX() + 50, player.getY() + 50, player.getZ(), 0, false, 0); @@ -1051,23 +830,18 @@ public final class Q00060_GoodWorksReward extends Quest pursuer.getVariables().set("player0", player); addAttackDesire(pursuer, player); htmltext = event; - } - else - { + } else { htmltext = "32487-05.html"; } } break; } - case "32487-10.html": - { - if (qs.isMemoState(7)) - { + case "32487-10.html": { + if (qs.isMemoState(7)) { takeItems(player, HELVETIAS_ANTIDOTE, 1); qs.setMemoState(8); qs.setCond(8, true); - if (npc.getVariables().getBoolean("SPAWNED", true)) - { + if (npc.getVariables().getBoolean("SPAWNED", true)) { npc.getVariables().set("SPAWNED", false); } htmltext = event; @@ -1079,30 +853,22 @@ public final class Q00060_GoodWorksReward extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - if (qs.isMemoState(1)) - { - if (killer.isPlayer()) - { - if (killer.getObjectId() == npc.getVariables().getInt("PLAYER_ID", 0)) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + if (qs.isMemoState(1)) { + if (killer.isPlayer()) { + if (killer.getObjectId() == npc.getVariables().getInt("PLAYER_ID", 0)) { qs.setMemoState(2); qs.setCond(2, true); npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.YOU_ARE_STRONG_THIS_WAS_A_MISTAKE)); - } - else - { + } else { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.WHO_ARE_YOU_TO_JOIN_IN_THE_BATTLE_HOW_UPSETTING)); } } } final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class); - if (npc0 != null) - { + if (npc0 != null) { npc0.getVariables().set("SPAWNED", false); } } @@ -1110,109 +876,67 @@ public final class Q00060_GoodWorksReward extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); final int memoState = qs.getMemoState(); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == BLUEPRINT_SELLER_DAEGER) - { - if (player.getRace() != Race.KAMAEL) - { - if (player.isInCategory(CategoryType.SECOND_CLASS_GROUP)) - { + if (qs.isCreated()) { + if (npc.getId() == BLUEPRINT_SELLER_DAEGER) { + if (player.getRace() != Race.KAMAEL) { + if (player.isInCategory(CategoryType.SECOND_CLASS_GROUP)) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "31435-01.htm" : "31435-03.htm"; - } - else - { + } else { htmltext = "31435-04.htm"; } - } - else - { + } else { htmltext = "31435-06.htm"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case BLUEPRINT_SELLER_DAEGER: - { - if (memoState <= 2) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case BLUEPRINT_SELLER_DAEGER: { + if (memoState <= 2) { htmltext = "31435-08.html"; - } - else if (memoState == 3) - { + } else if (memoState == 3) { htmltext = "31435-09.html"; - } - else if (memoState == 4) - { + } else if (memoState == 4) { htmltext = "31435-11.html"; - } - else if ((memoState > 4) && (memoState < 8)) - { + } else if ((memoState > 4) && (memoState < 8)) { htmltext = "31435-12.html"; - } - else if (memoState == 8) - { + } else if (memoState == 8) { htmltext = "31435-13.html"; - } - else if (memoState == 9) - { + } else if (memoState == 9) { qs.setMemoState(10); qs.setCond(10, true); htmltext = "31435-15.html"; - } - else if (memoState == 10) - { + } else if (memoState == 10) { htmltext = "31435-16.html"; } break; } - case GROCER_HELVERIA: - { - if (memoState == 4) - { + case GROCER_HELVERIA: { + if (memoState == 4) { htmltext = "30081-01.html"; - } - else if (memoState == 5) - { + } else if (memoState == 5) { htmltext = "30081-04.html"; - } - else if (memoState == 6) - { + } else if (memoState == 6) { htmltext = "30081-08.html"; - } - else if (memoState == 7) - { - if (!hasQuestItems(player, HELVETIAS_ANTIDOTE)) - { + } else if (memoState == 7) { + if (!hasQuestItems(player, HELVETIAS_ANTIDOTE)) { giveItems(player, HELVETIAS_ANTIDOTE, 1); htmltext = "30081-09.html"; - } - else - { + } else { htmltext = "30081-10.html"; } } break; } - case BLACK_MARKETEER_OF_MAMMON: - { - if (memoState == 10) - { - if (player.isInCategory(CategoryType.SECOND_CLASS_GROUP)) - { + case BLACK_MARKETEER_OF_MAMMON: { + if (memoState == 10) { + if (player.isInCategory(CategoryType.SECOND_CLASS_GROUP)) { qs.setMemoStateEx(1, 0); htmltext = "31092-01.html"; - } - else - { + } else { giveItems(player, Inventory.ADENA_ID, THREE_MILLION); qs.exitQuest(false, true); htmltext = "31092-01a.html"; @@ -1220,56 +944,35 @@ public final class Q00060_GoodWorksReward extends Quest } break; } - case MARK: - { - if (memoState == 1) - { - if (!npc.getVariables().getBoolean("SPAWNED", false)) - { + case MARK: { + if (memoState == 1) { + if (!npc.getVariables().getBoolean("SPAWNED", false)) { htmltext = "32487-01.html"; - } - else if (npc.getVariables().getBoolean("SPAWNED", true) && (npc.getVariables().getInt("PLAYER_ID", 0) == player.getObjectId())) - { + } else if (npc.getVariables().getBoolean("SPAWNED", true) && (npc.getVariables().getInt("PLAYER_ID", 0) == player.getObjectId())) { htmltext = "32487-03.html"; - } - else if (npc.getVariables().getBoolean("SPAWNED", true)) - { + } else if (npc.getVariables().getBoolean("SPAWNED", true)) { htmltext = "32487-02.html"; } - } - else if (memoState == 2) - { + } else if (memoState == 2) { giveItems(player, BLOODY_CLOTH_FRAGMENT, 1); qs.setMemoState(3); qs.setCond(3, true); htmltext = "32487-06.html"; - } - else if ((memoState >= 3) && (memoState < 7)) - { + } else if ((memoState >= 3) && (memoState < 7)) { htmltext = "32487-07.html"; - } - else if (memoState == 7) - { + } else if (memoState == 7) { htmltext = "32487-09.html"; } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == BLUEPRINT_SELLER_DAEGER) - { + } else if (qs.isCompleted()) { + if (npc.getId() == BLUEPRINT_SELLER_DAEGER) { htmltext = getAlreadyCompletedMsg(player); - } - else if (npc.getId() == BLACK_MARKETEER_OF_MAMMON) - { - if (player.isInCategory(CategoryType.SECOND_CLASS_GROUP)) - { + } else if (npc.getId() == BLACK_MARKETEER_OF_MAMMON) { + if (player.isInCategory(CategoryType.SECOND_CLASS_GROUP)) { htmltext = "31092-23.html"; - } - else - { + } else { htmltext = "31092-24.html"; } } @@ -1278,14 +981,11 @@ public final class Q00060_GoodWorksReward extends Quest } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { startQuestTimer("DESPAWN", 60000, npc, null); final L2PcInstance player = npc.getVariables().getObject("player0", L2PcInstance.class); - if (player != null) - { - if (player.isPlayer()) - { + if (player != null) { + if (player.isPlayer()) { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.S1_I_MUST_KILL_YOU_BLAME_YOUR_OWN_CURIOSITY).addStringParameter(player.getAppearance().getVisibleName())); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00061_LawEnforcement/Q00061_LawEnforcement.java b/src/main/java/com/l2jserver/datapack/quests/Q00061_LawEnforcement/Q00061_LawEnforcement.java index 6477a796ab..53e5d47e29 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00061_LawEnforcement/Q00061_LawEnforcement.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00061_LawEnforcement/Q00061_LawEnforcement.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Law Enforcement (61) * @author Adry_85 */ -public final class Q00061_LawEnforcement extends Quest -{ +public final class Q00061_LawEnforcement extends Quest { // NPCs private static final int LIANE = 32222; private static final int KEKROPUS = 32138; @@ -37,50 +36,40 @@ public final class Q00061_LawEnforcement extends Quest // Misc private static final int MIN_LEVEL = 76; - public Q00061_LawEnforcement() - { + public Q00061_LawEnforcement() { super(61, Q00061_LawEnforcement.class.getSimpleName(), "Law Enforcement"); addStartNpc(LIANE); addTalkId(LIANE, KEKROPUS, EINDBURGH); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "32222-02.htm": - { + switch (event) { + case "32222-02.htm": { htmltext = event; break; } - case "32222-03.htm": - { + case "32222-03.htm": { qs.setMemoState(1); qs.startQuest(); htmltext = event; break; } case "32138-01.html": - case "32138-02.html": - { - if (qs.isMemoState(1)) - { + case "32138-02.html": { + if (qs.isMemoState(1)) { htmltext = event; } break; } - case "32138-03.html": - { - if (qs.isMemoState(1)) - { + case "32138-03.html": { + if (qs.isMemoState(1)) { qs.setMemoState(2); htmltext = event; } @@ -89,37 +78,29 @@ public final class Q00061_LawEnforcement extends Quest case "32138-04.html": case "32138-05.html": case "32138-06.html": - case "32138-07.html": - { - if (qs.isMemoState(2) || qs.isMemoState(3)) - { + case "32138-07.html": { + if (qs.isMemoState(2) || qs.isMemoState(3)) { htmltext = event; } break; } - case "32138-08.html": - { - if (qs.isMemoState(2) || qs.isMemoState(3)) - { + case "32138-08.html": { + if (qs.isMemoState(2) || qs.isMemoState(3)) { qs.setMemoState(4); qs.setCond(2, true); htmltext = event; } break; } - case "32138-09.html": - { - if (qs.isMemoState(1)) - { + case "32138-09.html": { + if (qs.isMemoState(1)) { qs.setMemoState(3); htmltext = event; } break; } - case "32469-02.html": - { - if (qs.isMemoState(4)) - { + case "32469-02.html": { + if (qs.isMemoState(4)) { qs.setMemoState(5); htmltext = event; } @@ -129,19 +110,15 @@ public final class Q00061_LawEnforcement extends Quest case "32469-04.html": case "32469-05.html": case "32469-06.html": - case "32469-07.html": - { - if (qs.isMemoState(5)) - { + case "32469-07.html": { + if (qs.isMemoState(5)) { htmltext = event; } break; } case "32469-08.html": - case "32469-09.html": - { - if (qs.isMemoState(5)) - { + case "32469-09.html": { + if (qs.isMemoState(5)) { player.setClassId(136); // SystemMessage and cast skill is done by setClassId player.broadcastUserInfo(); @@ -156,78 +133,55 @@ public final class Q00061_LawEnforcement extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCompleted() && (npc.getId() == LIANE)) - { + if (qs.isCompleted() && (npc.getId() == LIANE)) { htmltext = getAlreadyCompletedMsg(player); - } - else if (qs.isCreated()) - { - if (player.getLevel() >= MIN_LEVEL) - { - if (player.getClassId() == ClassId.inspector) - { + } else if (qs.isCreated()) { + if (player.getLevel() >= MIN_LEVEL) { + if (player.getClassId() == ClassId.inspector) { final String html = getHtm(player.getHtmlPrefix(), "32222-01.htm"); return html.replace("%name%", player.getName()); } htmltext = "32222-04.htm"; - } - else - { + } else { htmltext = "32222-05.htm"; } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case LIANE: - { - if (qs.isMemoState(1)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case LIANE: { + if (qs.isMemoState(1)) { htmltext = "32222-06.html"; } break; } - case KEKROPUS: - { - switch (qs.getMemoState()) - { - case 1: - { + case KEKROPUS: { + switch (qs.getMemoState()) { + case 1: { htmltext = "32138-01.html"; break; } - case 2: - { + case 2: { htmltext = "32138-03.html"; break; } - case 3: - { + case 3: { htmltext = "32138-10.html"; break; } - case 4: - { + case 4: { htmltext = "32138-10.html"; break; } } break; } - case EINDBURGH: - { - if (qs.isMemoState(4)) - { + case EINDBURGH: { + if (qs.isMemoState(4)) { final String html = getHtm(player.getHtmlPrefix(), "32469-01.html"); return html.replace("%name%", player.getName()); - } - else if (qs.isMemoState(5)) - { + } else if (qs.isMemoState(5)) { htmltext = "32469-02.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00062_PathOfTheTrooper/Q00062_PathOfTheTrooper.java b/src/main/java/com/l2jserver/datapack/quests/Q00062_PathOfTheTrooper/Q00062_PathOfTheTrooper.java index ec16166c33..21627c81c7 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00062_PathOfTheTrooper/Q00062_PathOfTheTrooper.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00062_PathOfTheTrooper/Q00062_PathOfTheTrooper.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.util.Util; * Path Of The Trooper (62) * @author ivantotov */ -public final class Q00062_PathOfTheTrooper extends Quest -{ +public final class Q00062_PathOfTheTrooper extends Quest { // NPCs private static final int MASTER_SHUBAIN = 32194; private static final int MASTER_GWAIN = 32197; @@ -51,8 +50,7 @@ public final class Q00062_PathOfTheTrooper extends Quest // Misc private static final int MIN_LEVEL = 18; - public Q00062_PathOfTheTrooper() - { + public Q00062_PathOfTheTrooper() { super(62, Q00062_PathOfTheTrooper.class.getSimpleName(), "Path Of The Trooper"); addStartNpc(MASTER_GWAIN); addTalkId(MASTER_GWAIN, MASTER_SHUBAIN); @@ -61,31 +59,24 @@ public final class Q00062_PathOfTheTrooper extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (qs.isCreated()) - { + switch (event) { + case "ACCEPT": { + if (qs.isCreated()) { qs.startQuest(); qs.setMemoState(1); htmltext = "32197-06.htm"; } break; } - case "32194-02.html": - { - if (qs.isCond(1)) - { + case "32194-02.html": { + if (qs.isCond(1)) { qs.setMemoState(2); qs.setCond(2, true); htmltext = event; @@ -97,49 +88,34 @@ public final class Q00062_PathOfTheTrooper extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case FELIM_LIZARDMAN_WARRIOR: - { - if (qs.isCond(2) && (getQuestItemsCount(killer, FELIM_LIZARDMAN_HEAD) < 5)) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case FELIM_LIZARDMAN_WARRIOR: { + if (qs.isCond(2) && (getQuestItemsCount(killer, FELIM_LIZARDMAN_HEAD) < 5)) { giveItems(killer, FELIM_LIZARDMAN_HEAD, 1); - if (getQuestItemsCount(killer, FELIM_LIZARDMAN_HEAD) == 5) - { + if (getQuestItemsCount(killer, FELIM_LIZARDMAN_HEAD) == 5) { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case VENOMOUS_SPIDER: - { - if (qs.isCond(3) && (getQuestItemsCount(killer, VENOMOUS_SPIDERS_LEG) < 10)) - { + case VENOMOUS_SPIDER: { + if (qs.isCond(3) && (getQuestItemsCount(killer, VENOMOUS_SPIDERS_LEG) < 10)) { giveItems(killer, VENOMOUS_SPIDERS_LEG, 1); - if (getQuestItemsCount(killer, VENOMOUS_SPIDERS_LEG) == 10) - { + if (getQuestItemsCount(killer, VENOMOUS_SPIDERS_LEG) == 10) { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case TUMRAN_BUGBEAR: - { - if (qs.isCond(5) && !hasQuestItems(killer, TUMRAN_BUGBEAR_HEART) && (getRandom(1000) < 500)) - { + case TUMRAN_BUGBEAR: { + if (qs.isCond(5) && !hasQuestItems(killer, TUMRAN_BUGBEAR_HEART) && (getRandom(1000) < 500)) { giveItems(killer, TUMRAN_BUGBEAR_HEART, 1); playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_MIDDLE); } @@ -151,84 +127,56 @@ public final class Q00062_PathOfTheTrooper extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == MASTER_GWAIN) - { - if (player.getRace() == Race.KAMAEL) - { - if (player.getClassId() == ClassId.maleSoldier) - { - if (player.getLevel() >= MIN_LEVEL) - { + if (qs.isCreated()) { + if (npc.getId() == MASTER_GWAIN) { + if (player.getRace() == Race.KAMAEL) { + if (player.getClassId() == ClassId.maleSoldier) { + if (player.getLevel() >= MIN_LEVEL) { htmltext = "32197-01.htm"; - } - else - { + } else { htmltext = "32197-02.html"; } - } - else - { + } else { htmltext = "32197-03.html"; } - } - else - { + } else { htmltext = "32197-04.html"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case MASTER_GWAIN: - { - switch (qs.getCond()) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case MASTER_GWAIN: { + switch (qs.getCond()) { case 1: case 2: - case 3: - { + case 3: { htmltext = "32197-07.html"; break; } - case 4: - { + case 4: { takeItems(player, SHUBAINS_RECOMMENDATION, 1); qs.setMemoState(5); qs.setCond(5, true); htmltext = "32197-08.html"; break; } - case 5: - { - if (!hasQuestItems(player, TUMRAN_BUGBEAR_HEART)) - { + case 5: { + if (!hasQuestItems(player, TUMRAN_BUGBEAR_HEART)) { htmltext = "32197-09.html"; - } - else - { + } else { giveAdena(player, 163800, true); takeItems(player, TUMRAN_BUGBEAR_HEART, 1); giveItems(player, GWAINS_RECOMMENDATION, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 320534, 20848); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 456128, 27546); - } - else - { + } else { addExpAndSp(player, 591724, 34244); } qs.exitQuest(false, true); @@ -241,23 +189,16 @@ public final class Q00062_PathOfTheTrooper extends Quest } break; } - case MASTER_SHUBAIN: - { - switch (qs.getCond()) - { - case 1: - { + case MASTER_SHUBAIN: { + switch (qs.getCond()) { + case 1: { htmltext = "32194-01.html"; break; } - case 2: - { - if (getQuestItemsCount(player, FELIM_LIZARDMAN_HEAD) < 5) - { + case 2: { + if (getQuestItemsCount(player, FELIM_LIZARDMAN_HEAD) < 5) { htmltext = "32194-03.html"; - } - else - { + } else { takeItems(player, FELIM_LIZARDMAN_HEAD, -1); qs.setMemoState(3); qs.setCond(3, true); @@ -265,14 +206,10 @@ public final class Q00062_PathOfTheTrooper extends Quest } break; } - case 3: - { - if (getQuestItemsCount(player, VENOMOUS_SPIDERS_LEG) < 10) - { + case 3: { + if (getQuestItemsCount(player, VENOMOUS_SPIDERS_LEG) < 10) { htmltext = "32194-05.html"; - } - else - { + } else { takeItems(player, VENOMOUS_SPIDERS_LEG, -1); giveItems(player, SHUBAINS_RECOMMENDATION, 1); qs.setMemoState(4); @@ -281,8 +218,7 @@ public final class Q00062_PathOfTheTrooper extends Quest } break; } - case 4: - { + case 4: { htmltext = "32194-07.html"; break; } @@ -290,11 +226,8 @@ public final class Q00062_PathOfTheTrooper extends Quest break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == MASTER_GWAIN) - { + } else if (qs.isCompleted()) { + if (npc.getId() == MASTER_GWAIN) { htmltext = "32197-05.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00063_PathOfTheWarder/Q00063_PathOfTheWarder.java b/src/main/java/com/l2jserver/datapack/quests/Q00063_PathOfTheWarder/Q00063_PathOfTheWarder.java index 3dad124abf..c7066a44aa 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00063_PathOfTheWarder/Q00063_PathOfTheWarder.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00063_PathOfTheWarder/Q00063_PathOfTheWarder.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Path Of The Warder (63) * @author ivantotov */ -public final class Q00063_PathOfTheWarder extends Quest -{ +public final class Q00063_PathOfTheWarder extends Quest { // NPCs private static final int MASTER_SIONE = 32195; private static final int MASTER_GOBIE = 32198; @@ -62,8 +61,7 @@ public final class Q00063_PathOfTheWarder extends Quest // Misc private static final int MIN_LEVEL = 18; - public Q00063_PathOfTheWarder() - { + public Q00063_PathOfTheWarder() { super(63, Q00063_PathOfTheWarder.class.getSimpleName(), "Path Of The Warder"); addStartNpc(MASTER_SIONE); addTalkId(MASTER_SIONE, MASTER_GOBIE, MASTER_TOBIAS, CAPTAIN_BATHIS); @@ -72,49 +70,38 @@ public final class Q00063_PathOfTheWarder extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (qs.isCreated()) - { + switch (event) { + case "ACCEPT": { + if (qs.isCreated()) { qs.startQuest(); qs.setMemoState(1); htmltext = "32195-05.htm"; } break; } - case "32195-06.html": - { - if (qs.isMemoState(1)) - { + case "32195-06.html": { + if (qs.isMemoState(1)) { htmltext = event; } break; } - case "32195-08.html": - { - if (qs.isMemoState(1)) - { + case "32195-08.html": { + if (qs.isMemoState(1)) { qs.setMemoState(2); qs.setCond(2, true); htmltext = event; } break; } - case "32198-03.html": - { - if (qs.isMemoState(3)) - { + case "32198-03.html": { + if (qs.isMemoState(3)) { takeItems(player, GOBIES_ORDERS, 1); giveItems(player, LETTER_TO_HUMANS, 1); qs.setMemoState(4); @@ -123,18 +110,14 @@ public final class Q00063_PathOfTheWarder extends Quest } break; } - case "32198-07.html": - { - if (qs.isMemoState(7)) - { + case "32198-07.html": { + if (qs.isMemoState(7)) { htmltext = event; } break; } - case "32198-08.html": - { - if (qs.isMemoState(7)) - { + case "32198-08.html": { + if (qs.isMemoState(7)) { giveItems(player, LETTER_TO_THE_DARKELVES, 1); qs.setMemoState(8); qs.setCond(7, true); @@ -142,10 +125,8 @@ public final class Q00063_PathOfTheWarder extends Quest } break; } - case "32198-12.html": - { - if (qs.isMemoState(12)) - { + case "32198-12.html": { + if (qs.isMemoState(12)) { giveItems(player, REPORT_TO_SIONE, 1); qs.setMemoState(13); qs.setCond(9, true); @@ -153,19 +134,15 @@ public final class Q00063_PathOfTheWarder extends Quest } break; } - case "32198-15.html": - { - if (qs.isMemoState(14)) - { + case "32198-15.html": { + if (qs.isMemoState(14)) { qs.setMemoState(15); htmltext = event; } break; } - case "32198-16.html": - { - if (qs.isMemoState(15)) - { + case "32198-16.html": { + if (qs.isMemoState(15)) { giveItems(player, EMPTY_SOUL_CRYSTAL, 1); qs.setMemoState(16); qs.set("ex", 0); @@ -174,10 +151,8 @@ public final class Q00063_PathOfTheWarder extends Quest } break; } - case "30332-03.html": - { - if (qs.isMemoState(4)) - { + case "30332-03.html": { + if (qs.isMemoState(4)) { takeItems(player, LETTER_TO_HUMANS, 1); giveItems(player, HUMANS_REOLY, 1); qs.setMemoState(5); @@ -185,45 +160,35 @@ public final class Q00063_PathOfTheWarder extends Quest } break; } - case "30332-05.html": - { - if (qs.isMemoState(5)) - { + case "30332-05.html": { + if (qs.isMemoState(5)) { htmltext = event; } break; } - case "30332-06.html": - { - if (qs.isMemoState(5)) - { + case "30332-06.html": { + if (qs.isMemoState(5)) { qs.setMemoState(6); qs.setCond(6, true); htmltext = event; } break; } - case "30297-03.html": - { - if (qs.isMemoState(9)) - { + case "30297-03.html": { + if (qs.isMemoState(9)) { htmltext = event; } break; } - case "30297-04.html": - { - if (qs.isMemoState(9)) - { + case "30297-04.html": { + if (qs.isMemoState(9)) { qs.setMemoState(10); htmltext = event; } break; } - case "30297-06.html": - { - if (qs.isMemoState(10)) - { + case "30297-06.html": { + if (qs.isMemoState(10)) { giveItems(player, DARK_ELVES_REPLY, 1); qs.setMemoState(11); qs.setCond(8, true); @@ -236,39 +201,26 @@ public final class Q00063_PathOfTheWarder extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case OL_MAHUM_PATROL: - { - if (qs.isMemoState(2) && (getQuestItemsCount(killer, ORGANIZATION_CHART) < 5)) - { - if ((getQuestItemsCount(killer, ORDERS) >= 10) && (getQuestItemsCount(killer, ORGANIZATION_CHART) >= 4)) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case OL_MAHUM_PATROL: { + if (qs.isMemoState(2) && (getQuestItemsCount(killer, ORGANIZATION_CHART) < 5)) { + if ((getQuestItemsCount(killer, ORDERS) >= 10) && (getQuestItemsCount(killer, ORGANIZATION_CHART) >= 4)) { qs.setCond(3, true); - } - else - { + } else { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); } giveItems(killer, ORGANIZATION_CHART, 1); } break; } - case OL_MAHUM_NOVICE: - { - if (qs.isMemoState(2) && (getQuestItemsCount(killer, ORDERS) < 10)) - { - if ((getQuestItemsCount(killer, ORDERS) >= 9) && (getQuestItemsCount(killer, ORGANIZATION_CHART) >= 5)) - { + case OL_MAHUM_NOVICE: { + if (qs.isMemoState(2) && (getQuestItemsCount(killer, ORDERS) < 10)) { + if ((getQuestItemsCount(killer, ORDERS) >= 9) && (getQuestItemsCount(killer, ORGANIZATION_CHART) >= 5)) { qs.setCond(3, true); - } - else - { + } else { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); } giveItems(killer, ORDERS, 1); @@ -277,17 +229,12 @@ public final class Q00063_PathOfTheWarder extends Quest } case MAILLE_LIZARDMAN: case MAILLE_LIZARDMAN_SCOUT: - case MAILLE_LIZARDMAN_GUARD: - { - if (qs.isMemoState(16) && !hasQuestItems(killer, TAKS_CAPTURED_SOUL)) - { + case MAILLE_LIZARDMAN_GUARD: { + if (qs.isMemoState(16) && !hasQuestItems(killer, TAKS_CAPTURED_SOUL)) { final int i4 = qs.getInt("ex"); - if (i4 < 4) - { + if (i4 < 4) { qs.set("ex", i4 + 1); - } - else - { + } else { qs.set("ex", 0); final L2Npc monster = addSpawn(OL_MAHUM_OFFICER_TAK, npc, true, 0, false); addAttackDesire(monster, killer); @@ -295,10 +242,8 @@ public final class Q00063_PathOfTheWarder extends Quest } break; } - case OL_MAHUM_OFFICER_TAK: - { - if (qs.isMemoState(16) && !hasQuestItems(killer, TAKS_CAPTURED_SOUL)) - { + case OL_MAHUM_OFFICER_TAK: { + if (qs.isMemoState(16) && !hasQuestItems(killer, TAKS_CAPTURED_SOUL)) { takeItems(killer, EMPTY_SOUL_CRYSTAL, 1); giveItems(killer, TAKS_CAPTURED_SOUL, 1); qs.setCond(12, true); @@ -311,54 +256,33 @@ public final class Q00063_PathOfTheWarder extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); final int memoState = qs.getMemoState(); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == MASTER_SIONE) - { - if ((player.getClassId() == ClassId.femaleSoldier) && !hasQuestItems(player, STEELRAZOR_EVALUTION)) - { - if (player.getLevel() >= MIN_LEVEL) - { + if (qs.isCreated()) { + if (npc.getId() == MASTER_SIONE) { + if ((player.getClassId() == ClassId.femaleSoldier) && !hasQuestItems(player, STEELRAZOR_EVALUTION)) { + if (player.getLevel() >= MIN_LEVEL) { htmltext = "32195-01.htm"; - } - else - { + } else { htmltext = "32195-02.html"; } - } - else if (hasQuestItems(player, STEELRAZOR_EVALUTION)) - { + } else if (hasQuestItems(player, STEELRAZOR_EVALUTION)) { htmltext = "32195-03.html"; - } - else - { + } else { htmltext = "32195-04.html"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case MASTER_SIONE: - { - if (memoState == 1) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case MASTER_SIONE: { + if (memoState == 1) { htmltext = "32195-07.html"; - } - else if (memoState == 2) - { - if ((getQuestItemsCount(player, ORDERS) < 10) || (getQuestItemsCount(player, ORGANIZATION_CHART) < 5)) - { + } else if (memoState == 2) { + if ((getQuestItemsCount(player, ORDERS) < 10) || (getQuestItemsCount(player, ORGANIZATION_CHART) < 5)) { htmltext = "32195-09.html"; - } - else - { + } else { takeItems(player, ORDERS, -1); takeItems(player, ORGANIZATION_CHART, -1); giveItems(player, GOBIES_ORDERS, 1); @@ -366,17 +290,11 @@ public final class Q00063_PathOfTheWarder extends Quest qs.setCond(4, true); htmltext = "32195-10.html"; } - } - else if (memoState == 3) - { + } else if (memoState == 3) { htmltext = "32195-11.html"; - } - else if ((memoState > 3) && (memoState != 13)) - { + } else if ((memoState > 3) && (memoState != 13)) { htmltext = "32195-12.html"; - } - else if (memoState == 13) - { + } else if (memoState == 13) { takeItems(player, REPORT_TO_SIONE, 1); qs.setMemoState(14); qs.setCond(10, true); @@ -384,85 +302,53 @@ public final class Q00063_PathOfTheWarder extends Quest } break; } - case MASTER_GOBIE: - { - if (memoState < 3) - { + case MASTER_GOBIE: { + if (memoState < 3) { htmltext = "32198-01.html"; - } - else if (memoState == 3) - { + } else if (memoState == 3) { htmltext = "32198-02.html"; - } - else if ((memoState == 4) || (memoState == 5)) - { + } else if ((memoState == 4) || (memoState == 5)) { htmltext = "32198-04.html"; - } - else if (memoState == 6) - { + } else if (memoState == 6) { takeItems(player, HUMANS_REOLY, 1); qs.setMemoState(7); htmltext = "32198-05.html"; - } - else if (memoState == 7) - { + } else if (memoState == 7) { htmltext = "32198-06.html"; - } - else if (memoState == 8) - { + } else if (memoState == 8) { htmltext = "32198-09.html"; - } - else if (memoState == 11) - { + } else if (memoState == 11) { takeItems(player, DARK_ELVES_REPLY, 1); qs.setMemoState(12); htmltext = "32198-10.html"; - } - else if (memoState == 12) - { + } else if (memoState == 12) { giveItems(player, REPORT_TO_SIONE, 1); qs.setMemoState(13); htmltext = "32198-11.html"; - } - else if (memoState == 13) - { + } else if (memoState == 13) { htmltext = "32198-13.html"; - } - else if (memoState == 14) - { + } else if (memoState == 14) { htmltext = "32198-14.html"; - } - else if (memoState == 15) - { + } else if (memoState == 15) { giveItems(player, EMPTY_SOUL_CRYSTAL, 1); qs.setMemoState(16); qs.set("ex", 0); qs.setCond(11, true); htmltext = "32198-17.html"; - } - else if (memoState == 16) - { - if (!hasQuestItems(player, TAKS_CAPTURED_SOUL)) - { + } else if (memoState == 16) { + if (!hasQuestItems(player, TAKS_CAPTURED_SOUL)) { qs.set("ex", 0); htmltext = "32198-18.html"; - } - else - { + } else { giveAdena(player, 163800, true); takeItems(player, TAKS_CAPTURED_SOUL, 1); giveItems(player, STEELRAZOR_EVALUTION, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 320534, 22046); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 456128, 28744); - } - else - { + } else { addExpAndSp(player, 591724, 35442); } qs.exitQuest(false, true); @@ -473,63 +359,41 @@ public final class Q00063_PathOfTheWarder extends Quest } break; } - case CAPTAIN_BATHIS: - { - if (memoState == 4) - { + case CAPTAIN_BATHIS: { + if (memoState == 4) { htmltext = "30332-01.html"; - } - else if (memoState < 4) - { + } else if (memoState < 4) { htmltext = "30332-02.html"; - } - else if (memoState == 5) - { + } else if (memoState == 5) { htmltext = "30332-04.html"; - } - else if (memoState == 6) - { + } else if (memoState == 6) { htmltext = "30332-07.html"; - } - else if (memoState > 6) - { + } else if (memoState > 6) { htmltext = "30332-08.html"; } break; } - case MASTER_TOBIAS: - { - if (memoState == 8) - { + case MASTER_TOBIAS: { + if (memoState == 8) { takeItems(player, LETTER_TO_THE_DARKELVES, 1); qs.setMemoState(9); htmltext = "30297-01.html"; - } - else if (memoState == 9) - { + } else if (memoState == 9) { htmltext = "30297-02.html"; - } - else if (memoState == 10) - { + } else if (memoState == 10) { giveItems(player, DARK_ELVES_REPLY, 1); qs.setMemoState(11); qs.setCond(8, true); htmltext = "30297-05.html"; - } - else if (memoState >= 11) - { + } else if (memoState >= 11) { htmltext = "30297-07.html"; } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == MASTER_GOBIE) - { - if (hasQuestItems(player, STEELRAZOR_EVALUTION)) - { + } else if (qs.isCompleted()) { + if (npc.getId() == MASTER_GOBIE) { + if (hasQuestItems(player, STEELRAZOR_EVALUTION)) { htmltext = "32198-20.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00064_CertifiedBerserker/Q00064_CertifiedBerserker.java b/src/main/java/com/l2jserver/datapack/quests/Q00064_CertifiedBerserker/Q00064_CertifiedBerserker.java index 0368682421..5ac9c9ccd4 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00064_CertifiedBerserker/Q00064_CertifiedBerserker.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00064_CertifiedBerserker/Q00064_CertifiedBerserker.java @@ -35,8 +35,7 @@ import com.l2jserver.gameserver.util.Util; * Certified Berserker (64) * @author ivantotov */ -public final class Q00064_CertifiedBerserker extends Quest -{ +public final class Q00064_CertifiedBerserker extends Quest { // NPCs private static final int MASTER_ENTIENS = 32200; private static final int MASTER_ORKURUS = 32207; @@ -67,8 +66,7 @@ public final class Q00064_CertifiedBerserker extends Quest // Misc private static final int MIN_LEVEL = 39; - public Q00064_CertifiedBerserker() - { + public Q00064_CertifiedBerserker() { super(64, Q00064_CertifiedBerserker.class.getSimpleName(), "Certified Berserker"); addStartNpc(MASTER_ORKURUS); addTalkId(MASTER_ORKURUS, MASTER_ENTIENS, MASTER_TENAIN, CARAVANER_GORT, HARKILGAMED); @@ -77,48 +75,36 @@ public final class Q00064_CertifiedBerserker extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (qs.isCreated()) - { + switch (event) { + case "ACCEPT": { + if (qs.isCreated()) { qs.startQuest(); qs.setMemoState(1); - if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) - { + if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) { giveItems(player, DIMENSIONAL_DIAMOND, 48); player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1); htmltext = "32207-06.htm"; - } - else - { + } else { htmltext = "32207-06a.htm"; } } break; } - case "32207-10.html": - { - if (qs.isMemoState(11)) - { + case "32207-10.html": { + if (qs.isMemoState(11)) { htmltext = event; } break; } - case "32207-11.html": - { - if (qs.isMemoState(11)) - { + case "32207-11.html": { + if (qs.isMemoState(11)) { giveAdena(player, 63104, true); giveItems(player, ORKURUS_RECOMMENDATION, 1); addExpAndSp(player, 349006, 23948); @@ -128,10 +114,8 @@ public final class Q00064_CertifiedBerserker extends Quest } break; } - case "32215-02.html": - { - if (qs.isMemoState(1)) - { + case "32215-02.html": { + if (qs.isMemoState(1)) { qs.setMemoState(2); qs.setCond(2, true); htmltext = event; @@ -140,18 +124,14 @@ public final class Q00064_CertifiedBerserker extends Quest } case "32215-07.html": case "32215-08.html": - case "32215-09.html": - { - if (qs.isMemoState(5)) - { + case "32215-09.html": { + if (qs.isMemoState(5)) { htmltext = event; } break; } - case "32215-10.html": - { - if (qs.isMemoState(5)) - { + case "32215-10.html": { + if (qs.isMemoState(5)) { takeItems(player, MESSAGE_PLATE, 1); qs.setMemoState(6); qs.setCond(8, true); @@ -159,10 +139,8 @@ public final class Q00064_CertifiedBerserker extends Quest } break; } - case "32215-15.html": - { - if (qs.isMemoState(10)) - { + case "32215-15.html": { + if (qs.isMemoState(10)) { takeItems(player, HARKILGAMEDS_LETTER, 1); giveItems(player, TENAINS_RECOMMENDATION, 1); qs.setMemoState(11); @@ -171,20 +149,16 @@ public final class Q00064_CertifiedBerserker extends Quest } break; } - case "32252-02.html": - { - if (qs.isMemoState(3)) - { + case "32252-02.html": { + if (qs.isMemoState(3)) { qs.setMemoState(4); qs.setCond(5, true); htmltext = event; } break; } - case "32253-02.html": - { - if (qs.isMemoState(9)) - { + case "32253-02.html": { + if (qs.isMemoState(9)) { giveItems(player, HARKILGAMEDS_LETTER, 1); qs.setMemoState(10); qs.setCond(13, true); @@ -197,45 +171,30 @@ public final class Q00064_CertifiedBerserker extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case DEAD_SEEKER: - { - if (qs.isMemoState(7) && !hasQuestItems(killer, REPORT_EAST)) - { - if (getRandom(100) < 20) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case DEAD_SEEKER: { + if (qs.isMemoState(7) && !hasQuestItems(killer, REPORT_EAST)) { + if (getRandom(100) < 20) { giveItems(killer, REPORT_EAST, 1); - if (hasQuestItems(killer, REPORT_NORTH)) - { + if (hasQuestItems(killer, REPORT_NORTH)) { qs.setCond(10, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case MARSH_STAKATO_DRONE: - { - if (qs.isMemoState(7) && !hasQuestItems(killer, REPORT_NORTH)) - { - if (getRandom(100) < 20) - { + case MARSH_STAKATO_DRONE: { + if (qs.isMemoState(7) && !hasQuestItems(killer, REPORT_NORTH)) { + if (getRandom(100) < 20) { giveItems(killer, REPORT_NORTH, 1); - if (hasQuestItems(killer, REPORT_EAST)) - { + if (hasQuestItems(killer, REPORT_EAST)) { qs.setCond(10, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -246,41 +205,30 @@ public final class Q00064_CertifiedBerserker extends Quest case BREKA_ORC_ARCHER: case BREKA_ORC_SHAMAN: case BREKA_ORC_OVERLORD: - case BREKA_ORC_WARRIOR: - { - if (qs.isMemoState(2) && (getQuestItemsCount(killer, BREKA_ORC_HEAD) < 20)) - { - if (getQuestItemsCount(killer, BREKA_ORC_HEAD) >= 19) - { + case BREKA_ORC_WARRIOR: { + if (qs.isMemoState(2) && (getQuestItemsCount(killer, BREKA_ORC_HEAD) < 20)) { + if (getQuestItemsCount(killer, BREKA_ORC_HEAD) >= 19) { giveItems(killer, BREKA_ORC_HEAD, 1); qs.setCond(3, true); - } - else - { + } else { giveItems(killer, BREKA_ORC_HEAD, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case ROAD_SCAVENGER: - { - if (qs.isMemoState(4) && !hasQuestItems(killer, MESSAGE_PLATE)) - { - if (getRandom(100) < 20) - { + case ROAD_SCAVENGER: { + if (qs.isMemoState(4) && !hasQuestItems(killer, MESSAGE_PLATE)) { + if (getRandom(100) < 20) { giveItems(killer, MESSAGE_PLATE, 1); qs.setCond(6, true); } } break; } - case DIVINE_EMISSARY: - { - if (qs.isMemoState(9)) - { - if (getRandom(100) < 20) - { + case DIVINE_EMISSARY: { + if (qs.isMemoState(9)) { + if (getRandom(100) < 20) { final L2Npc kamael = addSpawn(HARKILGAMED, npc, true, 60000); kamael.broadcastPacket(new NpcSay(kamael, Say2.NPC_ALL, NpcStringId.S1_DID_YOU_COME_TO_HELP_ME).addStringParameter(killer.getAppearance().getVisibleName())); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); @@ -294,185 +242,118 @@ public final class Q00064_CertifiedBerserker extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); final int memoState = qs.getMemoState(); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == MASTER_ORKURUS) - { - if (player.getRace() == Race.KAMAEL) - { - if (player.getClassId() == ClassId.trooper) - { - if (player.getLevel() >= MIN_LEVEL) - { + if (qs.isCreated()) { + if (npc.getId() == MASTER_ORKURUS) { + if (player.getRace() == Race.KAMAEL) { + if (player.getClassId() == ClassId.trooper) { + if (player.getLevel() >= MIN_LEVEL) { htmltext = "32207-01.htm"; - } - else - { + } else { htmltext = "32207-02.html"; } - } - else - { + } else { htmltext = "32207-03.html"; } - } - else - { + } else { htmltext = "32207-04.html"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case MASTER_ORKURUS: - { - if (memoState == 1) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case MASTER_ORKURUS: { + if (memoState == 1) { htmltext = "32207-07.html"; - } - else if ((memoState >= 2) && (memoState < 11)) - { + } else if ((memoState >= 2) && (memoState < 11)) { htmltext = "32207-08.html"; - } - else if (memoState == 11) - { + } else if (memoState == 11) { htmltext = "32207-09.html"; } break; } - case MASTER_ENTIENS: - { - if (memoState == 6) - { + case MASTER_ENTIENS: { + if (memoState == 6) { qs.setMemoState(7); qs.setCond(9, true); player.getRadar().addMarker(27956, 106003, -3831); player.getRadar().addMarker(50568, 152408, -2656); htmltext = "32200-01.html"; - } - else if (memoState == 7) - { - if (!hasQuestItems(player, REPORT_EAST, REPORT_NORTH)) - { + } else if (memoState == 7) { + if (!hasQuestItems(player, REPORT_EAST, REPORT_NORTH)) { htmltext = "32200-02.html"; - } - else - { + } else { takeItems(player, REPORT_EAST, 1); takeItems(player, REPORT_NORTH, 1); qs.setMemoState(8); qs.setCond(11, true); htmltext = "32200-03.html"; } - } - else if (memoState == 8) - { + } else if (memoState == 8) { htmltext = "32200-04.html"; } break; } - case MASTER_TENAIN: - { - if (memoState == 1) - { + case MASTER_TENAIN: { + if (memoState == 1) { htmltext = "32215-01.html"; - } - else if (memoState == 2) - { - if (getQuestItemsCount(player, BREKA_ORC_HEAD) < 20) - { + } else if (memoState == 2) { + if (getQuestItemsCount(player, BREKA_ORC_HEAD) < 20) { htmltext = "32215-03.html"; - } - else - { + } else { takeItems(player, BREKA_ORC_HEAD, -1); qs.setMemoState(3); qs.setCond(4, true); htmltext = "32215-04.html"; } - } - else if (memoState == 3) - { + } else if (memoState == 3) { htmltext = "32215-05.html"; - } - else if (memoState == 5) - { + } else if (memoState == 5) { htmltext = "32215-06.html"; - } - else if (memoState == 6) - { + } else if (memoState == 6) { htmltext = "32215-11.html"; - } - else if (memoState == 8) - { + } else if (memoState == 8) { qs.setMemoState(9); qs.setCond(12, true); htmltext = "32215-12.html"; - } - else if (memoState == 9) - { + } else if (memoState == 9) { htmltext = "32215-13.html"; - } - else if (memoState == 10) - { + } else if (memoState == 10) { htmltext = "32215-14.html"; - } - else if (memoState == 11) - { + } else if (memoState == 11) { htmltext = "32215-16.html"; } break; } - case CARAVANER_GORT: - { - if (memoState == 3) - { + case CARAVANER_GORT: { + if (memoState == 3) { htmltext = "32252-01.html"; - } - else if (memoState == 4) - { - if (!hasQuestItems(player, MESSAGE_PLATE)) - { + } else if (memoState == 4) { + if (!hasQuestItems(player, MESSAGE_PLATE)) { htmltext = "32252-03.html"; - } - else - { + } else { qs.setMemoState(5); qs.setCond(7, true); htmltext = "32252-04.html"; } - } - else if (memoState == 5) - { + } else if (memoState == 5) { htmltext = "32252-05.html"; } break; } - case HARKILGAMED: - { - if (memoState == 9) - { + case HARKILGAMED: { + if (memoState == 9) { htmltext = "32253-01.html"; - } - else if (memoState == 10) - { + } else if (memoState == 10) { htmltext = "32253-03.html"; } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == MASTER_ORKURUS) - { + } else if (qs.isCompleted()) { + if (npc.getId() == MASTER_ORKURUS) { htmltext = "32207-05.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00065_CertifiedSoulBreaker/Q00065_CertifiedSoulBreaker.java b/src/main/java/com/l2jserver/datapack/quests/Q00065_CertifiedSoulBreaker/Q00065_CertifiedSoulBreaker.java index 395bb2507a..8403d4fd58 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00065_CertifiedSoulBreaker/Q00065_CertifiedSoulBreaker.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00065_CertifiedSoulBreaker/Q00065_CertifiedSoulBreaker.java @@ -36,8 +36,7 @@ import com.l2jserver.gameserver.util.Util; * Certified Soul Breaker (65) * @author ivantotov */ -public final class Q00065_CertifiedSoulBreaker extends Quest -{ +public final class Q00065_CertifiedSoulBreaker extends Quest { // NPCs private static final int CAPTAIN_LUCAS = 30071; private static final int JACOB = 30073; @@ -72,8 +71,7 @@ public final class Q00065_CertifiedSoulBreaker extends Quest private static final Location SUSPICIOUS_SPAWN = new Location(16489, 146249, -3112); private static final Location MOVE_TO = new Location(16490, 145839, -3080); - public Q00065_CertifiedSoulBreaker() - { + public Q00065_CertifiedSoulBreaker() { super(65, Q00065_CertifiedSoulBreaker.class.getSimpleName(), "Certified Soul Breaker"); addStartNpc(GRAND_MASTER_VITUS); addTalkId(GRAND_MASTER_VITUS, CAPTAIN_LUCAS, JACOB, GUARD_HARLAN, GUARD_XABER, GUARD_LIAM, GUARD_VESA, GUARD_ZEROME, WHARF_MANAGER_FELTON, KEKROPUS, VICE_HIERARCH_CASCA, GRAND_MASTER_HOLST, GRAND_MASTER_MELDINA, KATENAR, CARGO_BOX, SUSPICIOUS_MAN); @@ -83,27 +81,19 @@ public final class Q00065_CertifiedSoulBreaker extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if ("DESPAWN_5".equals(event)) - { - if (npc != null) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if ("DESPAWN_5".equals(event)) { + if (npc != null) { npc.deleteMe(); } return super.onAdvEvent(event, npc, player); - } - else if ("DESPAWN_70".equals(event)) - { + } else if ("DESPAWN_70".equals(event)) { final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class); final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class); - if (npc0 != null) - { - if (npc0.getVariables().getBoolean("SPAWNED")) - { + if (npc0 != null) { + if (npc0.getVariables().getBoolean("SPAWNED")) { npc0.getVariables().set("SPAWNED", false); - if (c0 != null) - { + if (c0 != null) { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.S1_I_WILL_BE_BACK_SOON_STAY_THERE_AND_DONT_YOU_DARE_WANDER_OFF).addStringParameter(c0.getAppearance().getVisibleName())); } } @@ -113,68 +103,52 @@ public final class Q00065_CertifiedSoulBreaker extends Quest } final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (qs.isCreated()) - { + switch (event) { + case "ACCEPT": { + if (qs.isCreated()) { qs.startQuest(); qs.setMemoState(1); - if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) - { + if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) { giveItems(player, DIMENSIONAL_DIAMOND, 47); player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1); htmltext = "32213-05.htm"; - } - else - { + } else { htmltext = "32213-06.htm"; } } break; } - case "32213-09.html": - { + case "32213-09.html": { htmltext = event; break; } - case "32213-04.htm": - { - if ((player.getLevel() >= MIN_LEVEL) && player.isInCategory(CategoryType.KAMAEL_SECOND_CLASS_GROUP)) - { + case "32213-04.htm": { + if ((player.getLevel() >= MIN_LEVEL) && player.isInCategory(CategoryType.KAMAEL_SECOND_CLASS_GROUP)) { htmltext = event; } break; } - case "30071-02.html": - { - if (qs.isMemoState(7)) - { + case "30071-02.html": { + if (qs.isMemoState(7)) { qs.setMemoState(8); qs.setCond(8, true); htmltext = event; } break; } - case "30879-02.html": - { - if (qs.isMemoState(11)) - { + case "30879-02.html": { + if (qs.isMemoState(11)) { htmltext = event; } break; } - case "30879-03.html": - { - if (qs.isMemoState(11)) - { + case "30879-03.html": { + if (qs.isMemoState(11)) { qs.setMemoState(12); qs.setCond(12, true); htmltext = event; @@ -182,28 +156,22 @@ public final class Q00065_CertifiedSoulBreaker extends Quest break; } case "32138-02.html": - case "32138-03.html": - { - if (qs.isMemoState(1)) - { + case "32138-03.html": { + if (qs.isMemoState(1)) { htmltext = event; } break; } - case "32138-04.html": - { - if (qs.isMemoState(1)) - { + case "32138-04.html": { + if (qs.isMemoState(1)) { qs.setMemoState(2); qs.setCond(2, true); htmltext = event; } break; } - case "32138-07.html": - { - if (qs.isMemoState(21)) - { + case "32138-07.html": { + if (qs.isMemoState(21)) { qs.setMemoState(22); qs.setCond(15, true); htmltext = event; @@ -211,18 +179,14 @@ public final class Q00065_CertifiedSoulBreaker extends Quest break; } case "32138-10.html": - case "32138-11.html": - { - if (qs.isMemoState(23)) - { + case "32138-11.html": { + if (qs.isMemoState(23)) { htmltext = event; } break; } - case "32138-12.html": - { - if (qs.isMemoState(23)) - { + case "32138-12.html": { + if (qs.isMemoState(23)) { takeItems(player, WYRM_HEART, -1); giveItems(player, KEKROPUS_RECOMMENDATION, 1); qs.setMemoState(24); @@ -231,38 +195,30 @@ public final class Q00065_CertifiedSoulBreaker extends Quest } break; } - case "32139-02.html": - { - if (qs.isMemoState(2)) - { + case "32139-02.html": { + if (qs.isMemoState(2)) { qs.setMemoState(3); qs.setCond(3, true); htmltext = event; } break; } - case "32139-04.html": - { - if (qs.isMemoState(3)) - { + case "32139-04.html": { + if (qs.isMemoState(3)) { qs.setMemoState(4); qs.setCond(4, true); htmltext = event; } break; } - case "32139-07.html": - { - if (qs.isMemoState(14)) - { + case "32139-07.html": { + if (qs.isMemoState(14)) { htmltext = event; } break; } - case "32139-08.html": - { - if (qs.isMemoState(14)) - { + case "32139-08.html": { + if (qs.isMemoState(14)) { takeItems(player, SEALED_DOCUMENT, -1); qs.setMemoState(21); qs.setCond(14, true); @@ -270,10 +226,8 @@ public final class Q00065_CertifiedSoulBreaker extends Quest } break; } - case "32199-02.html": - { - if (qs.isMemoState(4)) - { + case "32199-02.html": { + if (qs.isMemoState(4)) { qs.setMemoState(5); qs.setCond(5, true); addSpawn(npc, SUSPICIOUS_MAN, SUSPICIOUS_SPAWN, false, 0); @@ -281,10 +235,8 @@ public final class Q00065_CertifiedSoulBreaker extends Quest } break; } - case "32214-02.html": - { - if (qs.isMemoState(10)) - { + case "32214-02.html": { + if (qs.isMemoState(10)) { qs.setMemoState(11); qs.setCond(11, true); htmltext = event; @@ -296,35 +248,25 @@ public final class Q00065_CertifiedSoulBreaker extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case WYRM: - { - if (qs.isMemoState(22)) - { - if (giveItemRandomly(killer, npc, WYRM_HEART, 1, 10, 0.20, true)) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case WYRM: { + if (qs.isMemoState(22)) { + if (giveItemRandomly(killer, npc, WYRM_HEART, 1, 10, 0.20, true)) { qs.setMemoState(23); qs.setCond(16, true); } } break; } - case GUARDIAN_ANGEL: - { + case GUARDIAN_ANGEL: { final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class); final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class); - if (killer == c0) - { - if (c0 != null) - { - if (qs.isMemoState(12)) - { + if (killer == c0) { + if (c0 != null) { + if (qs.isMemoState(12)) { L2Npc katenar = addSpawn(KATENAR, killer.getX() + 20, killer.getY() + 20, killer.getZ(), 0, false, 0); katenar.getVariables().set("player0", killer); katenar.getVariables().set("npc0", npc); @@ -332,13 +274,9 @@ public final class Q00065_CertifiedSoulBreaker extends Quest npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.GRR_IVE_BEEN_HIT)); } } - } - else - { - if (npc0 != null) - { - if (npc0.getVariables().getBoolean("SPAWNED")) - { + } else { + if (npc0 != null) { + if (npc0.getVariables().getBoolean("SPAWNED")) { npc0.getVariables().set("SPAWNED", false); } } @@ -351,48 +289,30 @@ public final class Q00065_CertifiedSoulBreaker extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); final int memoState = qs.getMemoState(); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == GRAND_MASTER_VITUS) - { - if (player.getRace() == Race.KAMAEL) - { - if ((player.getLevel() >= MIN_LEVEL) && player.isInCategory(CategoryType.KAMAEL_SECOND_CLASS_GROUP)) - { + if (qs.isCreated()) { + if (npc.getId() == GRAND_MASTER_VITUS) { + if (player.getRace() == Race.KAMAEL) { + if ((player.getLevel() >= MIN_LEVEL) && player.isInCategory(CategoryType.KAMAEL_SECOND_CLASS_GROUP)) { htmltext = "32213-01.htm"; - } - else - { + } else { htmltext = "32213-03.html"; } - } - else - { + } else { htmltext = "32213-02.html"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case GRAND_MASTER_VITUS: - { - if (memoState == 1) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case GRAND_MASTER_VITUS: { + if (memoState == 1) { htmltext = "32213-07.html"; - } - else if ((memoState > 1) && (memoState < 24)) - { + } else if ((memoState > 1) && (memoState < 24)) { htmltext = "32213-08.html"; - } - else if (memoState == 24) - { + } else if (memoState == 24) { giveAdena(player, 71194, true); giveItems(player, SOUL_BREAKER_CERTIFICATE, 1); addExpAndSp(player, 393750, 27020); @@ -402,282 +322,185 @@ public final class Q00065_CertifiedSoulBreaker extends Quest } break; } - case CAPTAIN_LUCAS: - { - if (memoState == 7) - { + case CAPTAIN_LUCAS: { + if (memoState == 7) { htmltext = "30071-01.html"; - } - else if (memoState == 8) - { + } else if (memoState == 8) { htmltext = "30071-03.html"; } break; } - case JACOB: - { - if (memoState == 6) - { - if (qs.getMemoStateEx(1) == 0) - { + case JACOB: { + if (memoState == 6) { + if (qs.getMemoStateEx(1) == 0) { qs.setMemoStateEx(1, 10); htmltext = "30073-01.html"; - } - else if (qs.getMemoStateEx(1) == 10) - { + } else if (qs.getMemoStateEx(1) == 10) { htmltext = "30073-01a.html"; - } - else if (qs.getMemoStateEx(1) == 1) - { + } else if (qs.getMemoStateEx(1) == 1) { qs.setMemoState(7); qs.setMemoStateEx(1, 0); qs.setCond(7, true); htmltext = "30073-02.html"; } - } - else if (memoState == 7) - { + } else if (memoState == 7) { htmltext = "30073-03.html"; } break; } - case GUARD_HARLAN: - { - if (memoState == 6) - { - if (qs.getMemoStateEx(1) == 0) - { + case GUARD_HARLAN: { + if (memoState == 6) { + if (qs.getMemoStateEx(1) == 0) { qs.setMemoStateEx(1, 1); htmltext = "30074-01.html"; - } - else if (qs.getMemoStateEx(1) == 1) - { + } else if (qs.getMemoStateEx(1) == 1) { htmltext = "30074-01a.html"; - } - else if (qs.getMemoStateEx(1) == 10) - { + } else if (qs.getMemoStateEx(1) == 10) { qs.setMemoState(7); qs.setMemoStateEx(1, 0); qs.setCond(7, true); htmltext = "30074-02.html"; } - } - else if (memoState == 7) - { + } else if (memoState == 7) { htmltext = "30074-03.html"; } break; } - case GUARD_XABER: - { - if (memoState == 8) - { - if (qs.getMemoStateEx(1) == 0) - { + case GUARD_XABER: { + if (memoState == 8) { + if (qs.getMemoStateEx(1) == 0) { qs.setMemoStateEx(1, 1); htmltext = "30075-01.html"; - } - else if (qs.getMemoStateEx(1) == 1) - { + } else if (qs.getMemoStateEx(1) == 1) { htmltext = "30075-01a.html"; - } - else if (qs.getMemoStateEx(1) == 10) - { + } else if (qs.getMemoStateEx(1) == 10) { qs.setMemoState(9); qs.setMemoStateEx(1, 0); qs.setCond(9, true); htmltext = "30075-02.html"; } - } - else if (memoState == 9) - { + } else if (memoState == 9) { htmltext = "30075-03.html"; } break; } - case GUARD_LIAM: - { - if (memoState == 8) - { - if (qs.getMemoStateEx(1) == 0) - { + case GUARD_LIAM: { + if (memoState == 8) { + if (qs.getMemoStateEx(1) == 0) { qs.setMemoStateEx(1, 10); htmltext = "30076-01.html"; - } - else if (qs.getMemoStateEx(1) == 10) - { + } else if (qs.getMemoStateEx(1) == 10) { htmltext = "30076-01a.html"; - } - else if (qs.getMemoStateEx(1) == 1) - { + } else if (qs.getMemoStateEx(1) == 1) { qs.setMemoState(9); qs.setMemoStateEx(1, 0); qs.setCond(9, true); htmltext = "30076-02.html"; } - } - else if (memoState == 9) - { + } else if (memoState == 9) { htmltext = "30076-03.html"; } break; } - case GUARD_VESA: - { - if (memoState == 9) - { - if (qs.getMemoStateEx(1) == 0) - { + case GUARD_VESA: { + if (memoState == 9) { + if (qs.getMemoStateEx(1) == 0) { qs.setMemoStateEx(1, 10); htmltext = "30123-01.html"; - } - else if (qs.getMemoStateEx(1) == 10) - { + } else if (qs.getMemoStateEx(1) == 10) { htmltext = "30123-01.html"; - } - else if (qs.getMemoStateEx(1) == 1) - { + } else if (qs.getMemoStateEx(1) == 1) { qs.setMemoState(10); qs.setMemoStateEx(1, 0); qs.setCond(10, true); htmltext = "30123-02.html"; } - } - else if (memoState == 10) - { + } else if (memoState == 10) { htmltext = "30123-03.html"; } break; } - case GUARD_ZEROME: - { - if (memoState == 9) - { - if (qs.getMemoStateEx(1) == 0) - { + case GUARD_ZEROME: { + if (memoState == 9) { + if (qs.getMemoStateEx(1) == 0) { qs.setMemoStateEx(1, 1); htmltext = "30124-01.html"; - } - else if (qs.getMemoStateEx(1) == 1) - { + } else if (qs.getMemoStateEx(1) == 1) { htmltext = "30124-01.html"; - } - else if (qs.getMemoStateEx(1) == 10) - { + } else if (qs.getMemoStateEx(1) == 10) { qs.setMemoState(10); qs.setMemoStateEx(1, 0); qs.setCond(10, true); htmltext = "30124-02.html"; } - } - else if (memoState == 10) - { + } else if (memoState == 10) { htmltext = "30124-03.html"; } break; } - case WHARF_MANAGER_FELTON: - { - if (memoState == 11) - { + case WHARF_MANAGER_FELTON: { + if (memoState == 11) { htmltext = "30879-01.html"; - } - else if (memoState == 12) - { + } else if (memoState == 12) { htmltext = "30879-04.html"; } break; } - case KEKROPUS: - { - if (memoState == 1) - { + case KEKROPUS: { + if (memoState == 1) { htmltext = getHtm(player.getHtmlPrefix(), "32138-01.html"); htmltext = htmltext.replaceAll("%name1%", player.getName()); - } - else if (memoState == 2) - { + } else if (memoState == 2) { htmltext = "32138-05.html"; - } - else if (memoState == 21) - { + } else if (memoState == 21) { htmltext = "32138-06.html"; - } - else if (memoState == 22) - { + } else if (memoState == 22) { htmltext = "32138-08.html"; - } - else if (memoState == 23) - { + } else if (memoState == 23) { htmltext = "32138-09.html"; - } - else if (memoState == 24) - { + } else if (memoState == 24) { htmltext = "32138-13.html"; } break; } - case VICE_HIERARCH_CASCA: - { - if (memoState == 2) - { + case VICE_HIERARCH_CASCA: { + if (memoState == 2) { htmltext = "32139-01.html"; - } - else if (memoState == 3) - { + } else if (memoState == 3) { htmltext = "32139-03.html"; - } - else if (memoState == 4) - { + } else if (memoState == 4) { htmltext = "32139-05.html"; - } - else if (memoState == 14) - { + } else if (memoState == 14) { htmltext = "32139-06.html"; - } - else if (memoState == 21) - { + } else if (memoState == 21) { htmltext = "32139-09.html"; } break; } - case GRAND_MASTER_HOLST: - { - if (memoState == 4) - { + case GRAND_MASTER_HOLST: { + if (memoState == 4) { htmltext = "32199-01.html"; - } - else if (memoState == 5) - { + } else if (memoState == 5) { qs.setMemoState(6); qs.setMemoStateEx(1, 0); // Custom line qs.setCond(6, true); htmltext = "32199-03.html"; - } - else if (memoState == 6) - { + } else if (memoState == 6) { htmltext = "32199-04.html"; } break; } - case GRAND_MASTER_MELDINA: - { - if (memoState == 10) - { + case GRAND_MASTER_MELDINA: { + if (memoState == 10) { htmltext = "32214-01.html"; - } - else if (memoState == 11) - { + } else if (memoState == 11) { htmltext = "32214-03.html"; } break; } - case CARGO_BOX: - { - if (memoState == 12) - { - if (!npc.getVariables().getBoolean("SPAWNED", false)) - { + case CARGO_BOX: { + if (memoState == 12) { + if (!npc.getVariables().getBoolean("SPAWNED", false)) { npc.getVariables().set("SPAWNED", true); npc.getVariables().set("PLAYER_ID", player.getObjectId()); final L2Npc angel = addSpawn(GUARDIAN_ANGEL, 36110, 191921, -3712, 0, true, 0, false); @@ -685,48 +508,32 @@ public final class Q00065_CertifiedSoulBreaker extends Quest angel.getVariables().set("player0", player); addAttackDesire(angel, player); htmltext = "32243-01.html"; - } - else if (npc.getVariables().getInt("PLAYER_ID") == player.getObjectId()) - { + } else if (npc.getVariables().getInt("PLAYER_ID") == player.getObjectId()) { htmltext = "32243-03.html"; - } - else - { + } else { htmltext = "32243-02.html"; } - } - else if (memoState == 13) - { - if (!npc.getVariables().getBoolean("SPAWNED", false)) - { + } else if (memoState == 13) { + if (!npc.getVariables().getBoolean("SPAWNED", false)) { npc.getVariables().set("SPAWNED", true); npc.getVariables().set("PLAYER_ID", player.getObjectId()); final L2Npc katenar = addSpawn(KATENAR, 36110, 191921, -3712, 0, false, 0); katenar.getVariables().set("player0", player); katenar.getVariables().set("npc0", npc); htmltext = "32243-06.html"; - } - else if (npc.getVariables().getInt("PLAYER_ID") == player.getObjectId()) - { + } else if (npc.getVariables().getInt("PLAYER_ID") == player.getObjectId()) { htmltext = "32243-04.html"; - } - else - { + } else { htmltext = "32243-05.html"; } - } - else if (memoState == 14) - { + } else if (memoState == 14) { htmltext = "32243-07.html"; } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == GRAND_MASTER_VITUS) - { + } else if (qs.isCompleted()) { + if (npc.getId() == GRAND_MASTER_VITUS) { htmltext = getAlreadyCompletedMsg(player); } } @@ -734,21 +541,16 @@ public final class Q00065_CertifiedSoulBreaker extends Quest } @Override - public String onSpawn(L2Npc npc) - { - if (npc.getId() == SUSPICIOUS_MAN) - { + public String onSpawn(L2Npc npc) { + if (npc.getId() == SUSPICIOUS_MAN) { startQuestTimer("DESPAWN_5", 5000, npc, null); npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.DRATS_HOW_COULD_I_BE_SO_WRONG)); npc.setIsRunning(true); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, MOVE_TO); - } - else if (npc.getId() == GUARDIAN_ANGEL) - { + } else if (npc.getId() == GUARDIAN_ANGEL) { final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class); startQuestTimer("DESPAWN_70", 70000, npc, null); - if (c0 != null) - { + if (c0 != null) { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.S1_STEP_BACK_FROM_THE_CONFOUNDED_BOX_I_WILL_TAKE_IT_MYSELF).addStringParameter(c0.getAppearance().getVisibleName())); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00066_CertifiedArbalester/Q00066_CertifiedArbalester.java b/src/main/java/com/l2jserver/datapack/quests/Q00066_CertifiedArbalester/Q00066_CertifiedArbalester.java index 113171e8dd..72fc9bcee0 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00066_CertifiedArbalester/Q00066_CertifiedArbalester.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00066_CertifiedArbalester/Q00066_CertifiedArbalester.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Certified Arbalester (66) * @author ivantotov */ -public final class Q00066_CertifiedArbalester extends Quest -{ +public final class Q00066_CertifiedArbalester extends Quest { // NPCs private static final int WAREHOUSE_KEEPER_HOLVAS = 30058; private static final int MAGISTER_GAIUS = 30171; @@ -79,8 +78,7 @@ public final class Q00066_CertifiedArbalester extends Quest // Misc private static final int MIN_LEVEL = 39; - public Q00066_CertifiedArbalester() - { + public Q00066_CertifiedArbalester() { super(66, Q00066_CertifiedArbalester.class.getSimpleName(), "Certified Arbalester"); addStartNpc(MASTER_RINDY); addTalkId(MASTER_RINDY, WAREHOUSE_KEEPER_HOLVAS, MAGISTER_GAIUS, BLACKSMITH_POITAN, MAGISTER_CLAYTON, MAGISTER_GAUEN, MAGISTER_KAIENA, GRAND_MASTER_MELDINA, MASTER_SELSIA); @@ -89,40 +87,30 @@ public final class Q00066_CertifiedArbalester extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if ((player.getLevel() >= MIN_LEVEL) && (player.getClassId() == ClassId.warder) && !hasQuestItems(player, KAMAEL_INQUISITOR_MARK)) - { + switch (event) { + case "ACCEPT": { + if ((player.getLevel() >= MIN_LEVEL) && (player.getClassId() == ClassId.warder) && !hasQuestItems(player, KAMAEL_INQUISITOR_MARK)) { qs.startQuest(); qs.setMemoState(1); - if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) - { + if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) { giveItems(player, DIMENSIONAL_DIAMOND, 64); player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1); htmltext = "32201-07a.htm"; - } - else - { + } else { htmltext = "32201-07.htm"; } } break; } - case "32201-08.html": - { - if (qs.isMemoState(1)) - { + case "32201-08.html": { + if (qs.isMemoState(1)) { qs.setMemoState(2); qs.setCond(2, true); htmltext = event; @@ -130,28 +118,22 @@ public final class Q00066_CertifiedArbalester extends Quest break; } case "30058-03.html": - case "30058-04.html": - { - if (qs.isMemoState(7)) - { + case "30058-04.html": { + if (qs.isMemoState(7)) { htmltext = event; } break; } - case "30058-05.html": - { - if (qs.isMemoState(7)) - { + case "30058-05.html": { + if (qs.isMemoState(7)) { qs.setMemoState(8); qs.setCond(7, true); htmltext = event; } break; } - case "30058-08.html": - { - if (qs.isMemoState(9)) - { + case "30058-08.html": { + if (qs.isMemoState(9)) { giveItems(player, ENCODED_PAGE_ON_THE_ANCIENT_RACE, 1); qs.setMemoState(10); qs.setCond(9, true); @@ -159,18 +141,14 @@ public final class Q00066_CertifiedArbalester extends Quest } break; } - case "30171-03.html": - { - if (qs.isMemoState(23)) - { + case "30171-03.html": { + if (qs.isMemoState(23)) { htmltext = event; } break; } - case "30171-05.html": - { - if (qs.isMemoState(23)) - { + case "30171-05.html": { + if (qs.isMemoState(23)) { takeItems(player, GRANDIS_ATTACK_ORDERS, -1); qs.setMemoState(24); htmltext = event; @@ -178,28 +156,22 @@ public final class Q00066_CertifiedArbalester extends Quest break; } case "30171-06.html": - case "30171-07.html": - { - if (qs.isMemoState(24)) - { + case "30171-07.html": { + if (qs.isMemoState(24)) { htmltext = event; } break; } - case "30171-08.html": - { - if (qs.isMemoState(24)) - { + case "30171-08.html": { + if (qs.isMemoState(24)) { qs.setMemoState(25); } qs.setCond(14, true); htmltext = event; break; } - case "30458-03.html": - { - if (qs.isMemoState(5)) - { + case "30458-03.html": { + if (qs.isMemoState(5)) { takeItems(player, ENMITY_CRYSTAL_CORE, 1); qs.setMemoState(6); htmltext = event; @@ -209,18 +181,14 @@ public final class Q00066_CertifiedArbalester extends Quest case "30458-05.html": case "30458-06.html": case "30458-07.html": - case "30458-08.html": - { - if (qs.isMemoState(6)) - { + case "30458-08.html": { + if (qs.isMemoState(6)) { htmltext = event; } break; } - case "30458-09.html": - { - if (qs.isMemoState(6)) - { + case "30458-09.html": { + if (qs.isMemoState(6)) { qs.setMemoState(7); qs.setCond(6, true); htmltext = event; @@ -229,28 +197,22 @@ public final class Q00066_CertifiedArbalester extends Quest } case "30464-03.html": case "30464-04.html": - case "30464-05.html": - { - if (qs.isMemoState(2)) - { + case "30464-05.html": { + if (qs.isMemoState(2)) { htmltext = event; } break; } - case "30464-06.html": - { - if (qs.isMemoState(2)) - { + case "30464-06.html": { + if (qs.isMemoState(2)) { qs.setMemoState(3); qs.setCond(3, true); htmltext = event; } break; } - case "30464-09.html": - { - if (qs.isMemoState(4)) - { + case "30464-09.html": { + if (qs.isMemoState(4)) { giveItems(player, ENMITY_CRYSTAL_CORE, 1); qs.setMemoState(5); qs.setCond(5, true); @@ -258,8 +220,7 @@ public final class Q00066_CertifiedArbalester extends Quest } break; } - case "30464-11.html": - { + case "30464-11.html": { htmltext = event; break; } @@ -267,54 +228,42 @@ public final class Q00066_CertifiedArbalester extends Quest case "30717-05.html": case "30717-06.html": case "30717-07.html": - case "30717-08.html": - { - if (qs.isMemoState(28)) - { + case "30717-08.html": { + if (qs.isMemoState(28)) { htmltext = event; } break; } - case "30717-09.html": - { - if (qs.isMemoState(28)) - { + case "30717-09.html": { + if (qs.isMemoState(28)) { qs.setMemoState(29); qs.setCond(17, true); htmltext = event; } break; } - case "30720-03.html": - { - if (qs.isMemoState(29)) - { + case "30720-03.html": { + if (qs.isMemoState(29)) { htmltext = event; } break; } - case "30720-04.html": - { - if (qs.isMemoState(29)) - { + case "30720-04.html": { + if (qs.isMemoState(29)) { qs.setMemoState(30); qs.setCond(18, true); htmltext = event; } break; } - case "32214-03.html": - { - if (qs.isMemoState(10)) - { + case "32214-03.html": { + if (qs.isMemoState(10)) { htmltext = event; } break; } - case "32214-04.html": - { - if (qs.isMemoState(10)) - { + case "32214-04.html": { + if (qs.isMemoState(10)) { takeItems(player, ENCODED_PAGE_ON_THE_ANCIENT_RACE, 1); giveItems(player, KAMAEL_INQUISITOR_TRAINEE_MARK, 1); qs.setMemoState(11); @@ -323,69 +272,55 @@ public final class Q00066_CertifiedArbalester extends Quest } break; } - case "32220-03.html": - { - if (qs.isMemoState(11)) - { + case "32220-03.html": { + if (qs.isMemoState(11)) { takeItems(player, KAMAEL_INQUISITOR_TRAINEE_MARK, -1); qs.setMemoState(12); htmltext = event; } break; } - case "32220-05.html": - { - if (qs.isMemoState(12)) - { + case "32220-05.html": { + if (qs.isMemoState(12)) { qs.setMemoState(13); htmltext = event; } break; } - case "32220-06.html": - { - if (qs.isMemoState(13)) - { + case "32220-06.html": { + if (qs.isMemoState(13)) { qs.setMemoStateEx(1, 0); htmltext = event; } break; } case "32220-09.html": - case "32220-10.html": - { - if (qs.isMemoState(13)) - { + case "32220-10.html": { + if (qs.isMemoState(13)) { htmltext = event; } break; } case "32220-11.html": case "32220-12.html": - case "32220-13.html": - { - if (qs.isMemoState(13)) - { + case "32220-13.html": { + if (qs.isMemoState(13)) { qs.setMemoState(13); qs.setMemoStateEx(1, 1); htmltext = event; } break; } - case "32220-13a.html": - { - if (qs.isMemoState(13)) - { + case "32220-13a.html": { + if (qs.isMemoState(13)) { qs.setMemoState(20); qs.setMemoStateEx(1, 0); htmltext = event; } break; } - case "32220-13b.html": - { - if (qs.isMemoState(20)) - { + case "32220-13b.html": { + if (qs.isMemoState(20)) { qs.setMemoState(21); qs.setCond(11, true); htmltext = event; @@ -397,18 +332,14 @@ public final class Q00066_CertifiedArbalester extends Quest case "32220-22.html": case "32220-23.html": case "32220-24.html": - case "32220-25.html": - { - if (qs.isMemoState(31)) - { + case "32220-25.html": { + if (qs.isMemoState(31)) { htmltext = event; } break; } - case "32220-26.html": - { - if (qs.isMemoState(31)) - { + case "32220-26.html": { + if (qs.isMemoState(31)) { qs.setMemoStateEx(1, 0); qs.setMemoState(32); qs.setCond(19, true); @@ -421,46 +352,31 @@ public final class Q00066_CertifiedArbalester extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { case GRANITIC_GOLEM: - case HANGMAN_TREE: - { - if (qs.isMemoState(8) && (getQuestItemsCount(killer, MANUSCRIPT_PAGE) < 30)) - { - if (getQuestItemsCount(killer, MANUSCRIPT_PAGE) >= 29) - { + case HANGMAN_TREE: { + if (qs.isMemoState(8) && (getQuestItemsCount(killer, MANUSCRIPT_PAGE) < 30)) { + if (getQuestItemsCount(killer, MANUSCRIPT_PAGE) >= 29) { qs.setCond(8, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } giveItems(killer, MANUSCRIPT_PAGE, 1); - if ((getRandom(1000) < 100) && (getQuestItemsCount(killer, MANUSCRIPT_PAGE) < 29)) - { + if ((getRandom(1000) < 100) && (getQuestItemsCount(killer, MANUSCRIPT_PAGE) < 29)) { giveItems(killer, MANUSCRIPT_PAGE, 1); } } break; } - case AMBER_BASILISK: - { - if (qs.isMemoState(8) && (getQuestItemsCount(killer, MANUSCRIPT_PAGE) < 30)) - { - if (getRandom(1000) < 980) - { - if (getQuestItemsCount(killer, MANUSCRIPT_PAGE) >= 29) - { + case AMBER_BASILISK: { + if (qs.isMemoState(8) && (getQuestItemsCount(killer, MANUSCRIPT_PAGE) < 30)) { + if (getRandom(1000) < 980) { + if (getQuestItemsCount(killer, MANUSCRIPT_PAGE) >= 29) { qs.setCond(8, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } giveItems(killer, MANUSCRIPT_PAGE, 1); @@ -468,18 +384,12 @@ public final class Q00066_CertifiedArbalester extends Quest } break; } - case STRAIN: - { - if (qs.isMemoState(8) && (getQuestItemsCount(killer, MANUSCRIPT_PAGE) < 30)) - { - if (getRandom(1000) < 860) - { - if (getQuestItemsCount(killer, MANUSCRIPT_PAGE) >= 29) - { + case STRAIN: { + if (qs.isMemoState(8) && (getQuestItemsCount(killer, MANUSCRIPT_PAGE) < 30)) { + if (getRandom(1000) < 860) { + if (getQuestItemsCount(killer, MANUSCRIPT_PAGE) >= 29) { qs.setCond(8, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } giveItems(killer, MANUSCRIPT_PAGE, 1); @@ -488,47 +398,33 @@ public final class Q00066_CertifiedArbalester extends Quest break; } case GHOUL: - case DEAD_SEEKER: - { - if (qs.isMemoState(8) && (getQuestItemsCount(killer, MANUSCRIPT_PAGE) < 30)) - { - if (getQuestItemsCount(killer, MANUSCRIPT_PAGE) >= 29) - { + case DEAD_SEEKER: { + if (qs.isMemoState(8) && (getQuestItemsCount(killer, MANUSCRIPT_PAGE) < 30)) { + if (getQuestItemsCount(killer, MANUSCRIPT_PAGE) >= 29) { qs.setCond(8, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } giveItems(killer, MANUSCRIPT_PAGE, 1); - if ((getRandom(1000) < 20) && (getQuestItemsCount(killer, MANUSCRIPT_PAGE) < 29)) - { + if ((getRandom(1000) < 20) && (getQuestItemsCount(killer, MANUSCRIPT_PAGE) < 29)) { giveItems(killer, MANUSCRIPT_PAGE, 1); } } break; } - case GRANDIS: - { - if (qs.isMemoState(21) || (qs.isMemoState(22) && (getQuestItemsCount(killer, FRAGMENT_OF_ATTACK_ORDERS) < 10))) - { - if (getRandom(1000) < 780) - { - if (qs.isMemoState(21) && !hasQuestItems(killer, FRAGMENT_OF_ATTACK_ORDERS)) - { + case GRANDIS: { + if (qs.isMemoState(21) || (qs.isMemoState(22) && (getQuestItemsCount(killer, FRAGMENT_OF_ATTACK_ORDERS) < 10))) { + if (getRandom(1000) < 780) { + if (qs.isMemoState(21) && !hasQuestItems(killer, FRAGMENT_OF_ATTACK_ORDERS)) { qs.setMemoState(22); qs.setCond(12, true); giveItems(killer, FRAGMENT_OF_ATTACK_ORDERS, 1); - } - else if (qs.isMemoState(22) && (getQuestItemsCount(killer, FRAGMENT_OF_ATTACK_ORDERS) >= 9)) - { + } else if (qs.isMemoState(22) && (getQuestItemsCount(killer, FRAGMENT_OF_ATTACK_ORDERS) >= 9)) { qs.setMemoState(23); qs.setCond(13, true); takeItems(killer, FRAGMENT_OF_ATTACK_ORDERS, -1); giveItems(killer, GRANDIS_ATTACK_ORDERS, 1); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); giveItems(killer, FRAGMENT_OF_ATTACK_ORDERS, 1); } @@ -536,24 +432,16 @@ public final class Q00066_CertifiedArbalester extends Quest break; } } - case MANASHEN_GARGOYLE: - { - if (qs.isMemoState(25) || (qs.isMemoState(26) && (getQuestItemsCount(killer, MANASHENS_TALISMAN) < 10))) - { - if (getRandom(1000) < 840) - { - if (qs.isMemoState(25) && !hasQuestItems(killer, MANASHENS_TALISMAN)) - { + case MANASHEN_GARGOYLE: { + if (qs.isMemoState(25) || (qs.isMemoState(26) && (getQuestItemsCount(killer, MANASHENS_TALISMAN) < 10))) { + if (getRandom(1000) < 840) { + if (qs.isMemoState(25) && !hasQuestItems(killer, MANASHENS_TALISMAN)) { qs.setMemoState(26); qs.setCond(15, true); - } - else if (qs.isMemoState(26) && (getQuestItemsCount(killer, MANASHENS_TALISMAN) >= 9)) - { + } else if (qs.isMemoState(26) && (getQuestItemsCount(killer, MANASHENS_TALISMAN) >= 9)) { qs.setMemoState(27); qs.setCond(16, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } giveItems(killer, MANASHENS_TALISMAN, 1); @@ -562,17 +450,12 @@ public final class Q00066_CertifiedArbalester extends Quest } } case TIMAK_ORC: - case TIMAK_ORC_ARCHER: - { - if (qs.isMemoState(32)) - { + case TIMAK_ORC_ARCHER: { + if (qs.isMemoState(32)) { final int i4 = qs.getMemoStateEx(1); - if (i4 < 5) - { + if (i4 < 5) { qs.setMemoStateEx(1, i4 + 1); - } - else if (i4 >= 4) - { + } else if (i4 >= 4) { qs.setMemoStateEx(1, 0); addSpawn(CRIMSON_LADY, npc, true, 0, false); } @@ -580,38 +463,26 @@ public final class Q00066_CertifiedArbalester extends Quest break; } case DELU_LIZARDMAN_SHAMAN: - case DELU_LIZARDMAN_SUPPLIER: - { - if (qs.isMemoState(3) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 30)) - { - if (getQuestItemsCount(killer, ENMITY_CRYSTAL) >= 29) - { + case DELU_LIZARDMAN_SUPPLIER: { + if (qs.isMemoState(3) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 30)) { + if (getQuestItemsCount(killer, ENMITY_CRYSTAL) >= 29) { qs.setCond(4, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } giveItems(killer, ENMITY_CRYSTAL, 1); - if ((getRandom(1000) < 80) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 29)) - { + if ((getRandom(1000) < 80) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 29)) { giveItems(killer, ENMITY_CRYSTAL, 1); } } break; } - case WATCHMAN_OF_THE_PLAINS: - { - if (qs.isMemoState(3) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 30)) - { - if (getRandom(1000) < 840) - { - if (getQuestItemsCount(killer, ENMITY_CRYSTAL) >= 29) - { + case WATCHMAN_OF_THE_PLAINS: { + if (qs.isMemoState(3) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 30)) { + if (getRandom(1000) < 840) { + if (getQuestItemsCount(killer, ENMITY_CRYSTAL) >= 29) { qs.setCond(4, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } giveItems(killer, ENMITY_CRYSTAL, 1); @@ -619,18 +490,12 @@ public final class Q00066_CertifiedArbalester extends Quest } break; } - case ROUGHLY_HEWN_ROCK_GOLEM: - { - if (qs.isMemoState(3) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 30)) - { - if (getRandom(1000) < 860) - { - if (getQuestItemsCount(killer, ENMITY_CRYSTAL) >= 29) - { + case ROUGHLY_HEWN_ROCK_GOLEM: { + if (qs.isMemoState(3) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 30)) { + if (getRandom(1000) < 860) { + if (getQuestItemsCount(killer, ENMITY_CRYSTAL) >= 29) { qs.setCond(4, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } giveItems(killer, ENMITY_CRYSTAL, 1); @@ -638,82 +503,58 @@ public final class Q00066_CertifiedArbalester extends Quest } break; } - case DELU_LIZARDMAN_AGENT: - { - if (qs.isMemoState(3) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 30)) - { - if (getQuestItemsCount(killer, ENMITY_CRYSTAL) >= 29) - { + case DELU_LIZARDMAN_AGENT: { + if (qs.isMemoState(3) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 30)) { + if (getQuestItemsCount(killer, ENMITY_CRYSTAL) >= 29) { qs.setCond(4, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } giveItems(killer, ENMITY_CRYSTAL, 1); - if ((getRandom(1000) < 240) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 29)) - { + if ((getRandom(1000) < 240) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 29)) { giveItems(killer, ENMITY_CRYSTAL, 1); } } break; } - case CURSED_SEER: - { - if (qs.isMemoState(3) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 30)) - { - if (getQuestItemsCount(killer, ENMITY_CRYSTAL) >= 29) - { + case CURSED_SEER: { + if (qs.isMemoState(3) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 30)) { + if (getQuestItemsCount(killer, ENMITY_CRYSTAL) >= 29) { qs.setCond(4, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } giveItems(killer, ENMITY_CRYSTAL, 1); - if ((getRandom(1000) < 40) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 29)) - { + if ((getRandom(1000) < 40) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 29)) { giveItems(killer, ENMITY_CRYSTAL, 1); } } break; } - case DELU_LIZARDMAN_COMMANDER: - { - if (qs.isMemoState(3) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 30)) - { - if (getQuestItemsCount(killer, ENMITY_CRYSTAL) >= 28) - { + case DELU_LIZARDMAN_COMMANDER: { + if (qs.isMemoState(3) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 30)) { + if (getQuestItemsCount(killer, ENMITY_CRYSTAL) >= 28) { qs.setCond(4, true); } - if (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 29) - { + if (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 29) { giveItems(killer, ENMITY_CRYSTAL, 2); - if ((getRandom(1000) < 220) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 28)) - { + if ((getRandom(1000) < 220) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 28)) { giveItems(killer, ENMITY_CRYSTAL, 1); - if (getQuestItemsCount(killer, ENMITY_CRYSTAL) >= 27) - { + if (getQuestItemsCount(killer, ENMITY_CRYSTAL) >= 27) { qs.setCond(4, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } - } - else - { + } else { giveItems(killer, ENMITY_CRYSTAL, 1); } } break; } - case CRIMSON_LADY: - { - if (qs.isMemoState(32)) - { + case CRIMSON_LADY: { + if (qs.isMemoState(32)) { giveItems(killer, RESEARCH_ON_THE_GIANTS_AND_THE_ANCIENT_RACE, 1); qs.setMemoState(32); qs.setCond(20, true); @@ -726,311 +567,192 @@ public final class Q00066_CertifiedArbalester extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); final int memoState = qs.getMemoState(); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == MASTER_RINDY) - { - if ((player.getClassId() == ClassId.warder) && !hasQuestItems(player, KAMAEL_INQUISITOR_MARK)) - { - if (player.getLevel() >= MIN_LEVEL) - { + if (qs.isCreated()) { + if (npc.getId() == MASTER_RINDY) { + if ((player.getClassId() == ClassId.warder) && !hasQuestItems(player, KAMAEL_INQUISITOR_MARK)) { + if (player.getLevel() >= MIN_LEVEL) { htmltext = "32201-01.htm"; - } - else - { + } else { htmltext = "32201-02.html"; } - } - else - { + } else { htmltext = "32201-03.html"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case MASTER_RINDY: - { - if (memoState == 1) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case MASTER_RINDY: { + if (memoState == 1) { qs.setMemoState(2); qs.setCond(2, true); htmltext = "32201-09.html"; - } - else if (memoState == 2) - { + } else if (memoState == 2) { htmltext = "32201-10.html"; - } - else if ((memoState > 2) && (memoState < 11)) - { + } else if ((memoState > 2) && (memoState < 11)) { htmltext = "32201-11.html"; - } - else if (memoState >= 11) - { + } else if (memoState >= 11) { htmltext = "32201-12.html"; } break; } - case WAREHOUSE_KEEPER_HOLVAS: - { - if (memoState < 7) - { + case WAREHOUSE_KEEPER_HOLVAS: { + if (memoState < 7) { htmltext = "30058-01.html"; - } - else if (memoState == 7) - { + } else if (memoState == 7) { htmltext = "30058-02.html"; - } - else if (memoState == 8) - { - if (getQuestItemsCount(player, MANUSCRIPT_PAGE) < 30) - { + } else if (memoState == 8) { + if (getQuestItemsCount(player, MANUSCRIPT_PAGE) < 30) { htmltext = "30058-06.html"; - } - else - { + } else { takeItems(player, MANUSCRIPT_PAGE, -1); qs.setMemoState(9); htmltext = "30058-07.html"; } - } - else if (memoState == 9) - { + } else if (memoState == 9) { giveItems(player, ENCODED_PAGE_ON_THE_ANCIENT_RACE, 1); qs.setMemoState(10); qs.setCond(9, true); htmltext = "30058-09.html"; - } - else if (memoState > 9) - { + } else if (memoState > 9) { htmltext = "30058-10.html"; } break; } - case MAGISTER_GAIUS: - { - if (memoState < 23) - { + case MAGISTER_GAIUS: { + if (memoState < 23) { htmltext = "30171-01.html"; - } - else if (memoState == 23) - { + } else if (memoState == 23) { htmltext = "30171-02.html"; - } - else if (memoState == 24) - { + } else if (memoState == 24) { htmltext = "30171-06.html"; - } - else if (memoState == 25) - { + } else if (memoState == 25) { htmltext = "30171-09.html"; - } - else if (memoState == 26) - { + } else if (memoState == 26) { htmltext = "30171-10.html"; - } - else if (memoState == 27) - { + } else if (memoState == 27) { htmltext = "30171-11.html"; - } - else if (memoState == 28) - { + } else if (memoState == 28) { htmltext = "30171-12.html"; - } - else if (memoState == 29) - { + } else if (memoState == 29) { htmltext = "30171-13.html"; } break; } - case BLACKSMITH_POITAN: - { - if (memoState < 5) - { + case BLACKSMITH_POITAN: { + if (memoState < 5) { htmltext = "30458-01.html"; - } - else if (memoState == 5) - { + } else if (memoState == 5) { htmltext = "30458-02.html"; - } - else if (memoState == 6) - { + } else if (memoState == 6) { htmltext = "30458-04.html"; - } - else if (memoState == 7) - { + } else if (memoState == 7) { htmltext = "30458-10.html"; } break; } - case MAGISTER_CLAYTON: - { - if (memoState < 2) - { + case MAGISTER_CLAYTON: { + if (memoState < 2) { htmltext = "30464-01.html"; - } - else if (memoState == 2) - { + } else if (memoState == 2) { qs.setMemoState(2); htmltext = "30464-02.html"; - } - else if (memoState == 3) - { - if (getQuestItemsCount(player, ENMITY_CRYSTAL) < 30) - { + } else if (memoState == 3) { + if (getQuestItemsCount(player, ENMITY_CRYSTAL) < 30) { htmltext = "30464-07.html"; - } - else - { + } else { takeItems(player, ENMITY_CRYSTAL, -1); qs.setMemoState(4); htmltext = "30464-08.html"; } - } - else if (memoState == 4) - { + } else if (memoState == 4) { giveItems(player, ENMITY_CRYSTAL_CORE, 1); qs.setMemoState(5); qs.setCond(5, true); htmltext = "30464-10.html"; - } - else if (memoState == 5) - { + } else if (memoState == 5) { htmltext = "30464-12.html"; - } - else if (memoState > 5) - { + } else if (memoState > 5) { htmltext = "30464-13.html"; } break; } - case MAGISTER_GAUEN: - { - if (memoState < 27) - { + case MAGISTER_GAUEN: { + if (memoState < 27) { htmltext = "30717-01.html"; - } - else if (memoState == 27) - { + } else if (memoState == 27) { takeItems(player, MANASHENS_TALISMAN, -1); qs.setMemoState(28); htmltext = "30717-02.html"; - } - else if (memoState == 28) - { + } else if (memoState == 28) { htmltext = "30717-04.html"; - } - else if (memoState >= 29) - { + } else if (memoState >= 29) { htmltext = "30717-10.html"; } break; } - case MAGISTER_KAIENA: - { - if (memoState < 29) - { + case MAGISTER_KAIENA: { + if (memoState < 29) { htmltext = "30720-01.html"; - } - else if (memoState == 29) - { + } else if (memoState == 29) { htmltext = "30720-02.html"; } - if (memoState >= 30) - { + if (memoState >= 30) { htmltext = "30720-05.html"; } break; } - case GRAND_MASTER_MELDINA: - { - if (memoState < 10) - { + case GRAND_MASTER_MELDINA: { + if (memoState < 10) { htmltext = "32214-01.html"; - } - else if (memoState == 10) - { + } else if (memoState == 10) { htmltext = "32214-02.html"; } - if (memoState == 11) - { + if (memoState == 11) { htmltext = "32214-05.html"; } - if (memoState > 11) - { + if (memoState > 11) { htmltext = "32214-06.html"; } break; } - case MASTER_SELSIA: - { - if (memoState < 11) - { + case MASTER_SELSIA: { + if (memoState < 11) { htmltext = "32220-01.html"; - } - else if (memoState == 11) - { + } else if (memoState == 11) { htmltext = "32220-02.html"; - } - else if (memoState == 12) - { + } else if (memoState == 12) { htmltext = "32220-04.html"; - } - else if (memoState == 13) - { - if (qs.getMemoStateEx(1) == 0) - { + } else if (memoState == 13) { + if (qs.getMemoStateEx(1) == 0) { qs.setMemoStateEx(1, 0); htmltext = "32220-07.html"; - } - else if (qs.getMemoStateEx(1) == 1) - { + } else if (qs.getMemoStateEx(1) == 1) { qs.setMemoStateEx(1, 0); htmltext = "32220-08.html"; } - } - else if (memoState == 20) - { + } else if (memoState == 20) { qs.setMemoState(21); qs.setCond(11, true); htmltext = "32220-14.html"; - } - else if (memoState == 21) - { + } else if (memoState == 21) { htmltext = "32220-15.html"; - } - else if (memoState == 22) - { + } else if (memoState == 22) { htmltext = "32220-16.html"; - } - else if ((memoState >= 23) && (memoState < 30)) - { + } else if ((memoState >= 23) && (memoState < 30)) { htmltext = "32220-17.html"; - } - else if (memoState == 30) - { + } else if (memoState == 30) { qs.setMemoState(31); htmltext = "32220-18.html"; - } - else if (memoState == 31) - { + } else if (memoState == 31) { htmltext = "32220-20.html"; - } - else if (memoState == 32) - { - if (!hasQuestItems(player, RESEARCH_ON_THE_GIANTS_AND_THE_ANCIENT_RACE)) - { + } else if (memoState == 32) { + if (!hasQuestItems(player, RESEARCH_ON_THE_GIANTS_AND_THE_ANCIENT_RACE)) { htmltext = "32220-27.html"; - } - else - { + } else { giveAdena(player, 77666, true); giveItems(player, KAMAEL_INQUISITOR_MARK, 1); addExpAndSp(player, 429546, 29476); @@ -1043,16 +765,11 @@ public final class Q00066_CertifiedArbalester extends Quest } } } - if (qs.isCompleted()) - { - if (npc.getId() == MASTER_RINDY) - { - if (player.getClassId() == ClassId.arbalester) - { + if (qs.isCompleted()) { + if (npc.getId() == MASTER_RINDY) { + if (player.getClassId() == ClassId.arbalester) { htmltext = "32201-05.html"; - } - else - { + } else { htmltext = "32201-06.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00067_SagaOfTheDoombringer/Q00067_SagaOfTheDoombringer.java b/src/main/java/com/l2jserver/datapack/quests/Q00067_SagaOfTheDoombringer/Q00067_SagaOfTheDoombringer.java index 12e1ae16e4..a014fbc025 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00067_SagaOfTheDoombringer/Q00067_SagaOfTheDoombringer.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00067_SagaOfTheDoombringer/Q00067_SagaOfTheDoombringer.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Doombringer (67) * @author Emperorc */ -public final class Q00067_SagaOfTheDoombringer extends AbstractSagaQuest -{ - public Q00067_SagaOfTheDoombringer() - { +public final class Q00067_SagaOfTheDoombringer extends AbstractSagaQuest { + public Q00067_SagaOfTheDoombringer() { super(67, Q00067_SagaOfTheDoombringer.class.getSimpleName(), "Saga of the Doombringer"); - _npc = new int[] - { + _npc = new int[] { 32138, 31627, 32223, @@ -45,8 +42,7 @@ public final class Q00067_SagaOfTheDoombringer extends AbstractSagaQuest 31656, 32227 }; - _items = new int[] - { + _items = new int[] { 7080, 9721, 7081, @@ -60,28 +56,23 @@ public final class Q00067_SagaOfTheDoombringer extends AbstractSagaQuest 9717, 0 }; - _mob = new int[] - { + _mob = new int[] { 27324, 27325, 27326 }; - _classId = new int[] - { + _classId = new int[] { 131 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x7f }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(191046, -40640, -3042), new Location(47429, -56923, -2383), new Location(47391, -56929, -2370) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00068_SagaOfTheSoulHound/Q00068_SagaOfTheSoulHound.java b/src/main/java/com/l2jserver/datapack/quests/Q00068_SagaOfTheSoulHound/Q00068_SagaOfTheSoulHound.java index 4c1eda0a5f..ae87f8a41c 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00068_SagaOfTheSoulHound/Q00068_SagaOfTheSoulHound.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00068_SagaOfTheSoulHound/Q00068_SagaOfTheSoulHound.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Soul Hound (68) * @author Emperorc */ -public class Q00068_SagaOfTheSoulHound extends AbstractSagaQuest -{ - public Q00068_SagaOfTheSoulHound() - { +public class Q00068_SagaOfTheSoulHound extends AbstractSagaQuest { + public Q00068_SagaOfTheSoulHound() { super(68, Q00068_SagaOfTheSoulHound.class.getSimpleName(), "Saga of the Soul Hound"); - _npc = new int[] - { + _npc = new int[] { 32138, 31272, 31269, @@ -45,8 +42,7 @@ public class Q00068_SagaOfTheSoulHound extends AbstractSagaQuest 31657, 32241 }; - _items = new int[] - { + _items = new int[] { 7080, 9802, 7081, @@ -60,30 +56,25 @@ public class Q00068_SagaOfTheSoulHound extends AbstractSagaQuest 9719, 0 }; - _mob = new int[] - { + _mob = new int[] { 27327, 27329, 27328 }; - _classId = new int[] - { + _classId = new int[] { 132, 133 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x80, 0x81 }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(161719, -92823, -1893), new Location(46087, -36372, -1685), new Location(46066, -36396, -1685) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00069_SagaOfTheTrickster/Q00069_SagaOfTheTrickster.java b/src/main/java/com/l2jserver/datapack/quests/Q00069_SagaOfTheTrickster/Q00069_SagaOfTheTrickster.java index 7c3d01ede0..9e7c016abe 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00069_SagaOfTheTrickster/Q00069_SagaOfTheTrickster.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00069_SagaOfTheTrickster/Q00069_SagaOfTheTrickster.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Trickster (69) * @author Emperorc */ -public class Q00069_SagaOfTheTrickster extends AbstractSagaQuest -{ - public Q00069_SagaOfTheTrickster() - { +public class Q00069_SagaOfTheTrickster extends AbstractSagaQuest { + public Q00069_SagaOfTheTrickster() { super(69, Q00069_SagaOfTheTrickster.class.getSimpleName(), "Saga of the Trickster"); - _npc = new int[] - { + _npc = new int[] { 32138, 31270, 31282, @@ -45,8 +42,7 @@ public class Q00069_SagaOfTheTrickster extends AbstractSagaQuest 31659, 31283 }; - _items = new int[] - { + _items = new int[] { 7080, 9761, 7081, @@ -60,28 +56,23 @@ public class Q00069_SagaOfTheTrickster extends AbstractSagaQuest 9718, 0 }; - _mob = new int[] - { + _mob = new int[] { 27333, 27334, 27335 }; - _classId = new int[] - { + _classId = new int[] { 134 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x82 }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(164014, -74733, -3093), new Location(124355, 82155, -2803), new Location(124376, 82127, -2796) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00070_SagaOfThePhoenixKnight/Q00070_SagaOfThePhoenixKnight.java b/src/main/java/com/l2jserver/datapack/quests/Q00070_SagaOfThePhoenixKnight/Q00070_SagaOfThePhoenixKnight.java index 28acfb670e..a46133e277 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00070_SagaOfThePhoenixKnight/Q00070_SagaOfThePhoenixKnight.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00070_SagaOfThePhoenixKnight/Q00070_SagaOfThePhoenixKnight.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Phoenix Knight (70) * @author Emperorc */ -public class Q00070_SagaOfThePhoenixKnight extends AbstractSagaQuest -{ - public Q00070_SagaOfThePhoenixKnight() - { +public class Q00070_SagaOfThePhoenixKnight extends AbstractSagaQuest { + public Q00070_SagaOfThePhoenixKnight() { super(70, Q00070_SagaOfThePhoenixKnight.class.getSimpleName(), "Saga of the Phoenix Knight"); - _npc = new int[] - { + _npc = new int[] { 30849, 31624, 31277, @@ -45,8 +42,7 @@ public class Q00070_SagaOfThePhoenixKnight extends AbstractSagaQuest 31657, 31277 }; - _items = new int[] - { + _items = new int[] { 7080, 7534, 7081, @@ -60,28 +56,23 @@ public class Q00070_SagaOfThePhoenixKnight extends AbstractSagaQuest 7093, 6482 }; - _mob = new int[] - { + _mob = new int[] { 27286, 27219, 27278 }; - _classId = new int[] - { + _classId = new int[] { 90 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x05 }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(191046, -40640, -3042), new Location(46087, -36372, -1685), new Location(46066, -36396, -1685) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00071_SagaOfEvasTemplar/Q00071_SagaOfEvasTemplar.java b/src/main/java/com/l2jserver/datapack/quests/Q00071_SagaOfEvasTemplar/Q00071_SagaOfEvasTemplar.java index 7ad36ba09e..d9047174f1 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00071_SagaOfEvasTemplar/Q00071_SagaOfEvasTemplar.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00071_SagaOfEvasTemplar/Q00071_SagaOfEvasTemplar.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of Eva's Templar (71) * @author Emperorc */ -public class Q00071_SagaOfEvasTemplar extends AbstractSagaQuest -{ - public Q00071_SagaOfEvasTemplar() - { +public class Q00071_SagaOfEvasTemplar extends AbstractSagaQuest { + public Q00071_SagaOfEvasTemplar() { super(71, Q00071_SagaOfEvasTemplar.class.getSimpleName(), "Saga of Eva's Templar"); - _npc = new int[] - { + _npc = new int[] { 30852, 31624, 31278, @@ -45,8 +42,7 @@ public class Q00071_SagaOfEvasTemplar extends AbstractSagaQuest 31658, 31281 }; - _items = new int[] - { + _items = new int[] { 7080, 7535, 7081, @@ -60,28 +56,23 @@ public class Q00071_SagaOfEvasTemplar extends AbstractSagaQuest 7094, 6482 }; - _mob = new int[] - { + _mob = new int[] { 27287, 27220, 27279 }; - _classId = new int[] - { + _classId = new int[] { 99 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x14 }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(119518, -28658, -3811), new Location(181215, 36676, -4812), new Location(181227, 36703, -4816) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00072_SagaOfTheSwordMuse/Q00072_SagaOfTheSwordMuse.java b/src/main/java/com/l2jserver/datapack/quests/Q00072_SagaOfTheSwordMuse/Q00072_SagaOfTheSwordMuse.java index 1db58ab0c9..2be37c1518 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00072_SagaOfTheSwordMuse/Q00072_SagaOfTheSwordMuse.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00072_SagaOfTheSwordMuse/Q00072_SagaOfTheSwordMuse.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Sword Muse (72) * @author Emperorc */ -public class Q00072_SagaOfTheSwordMuse extends AbstractSagaQuest -{ - public Q00072_SagaOfTheSwordMuse() - { +public class Q00072_SagaOfTheSwordMuse extends AbstractSagaQuest { + public Q00072_SagaOfTheSwordMuse() { super(72, Q00072_SagaOfTheSwordMuse.class.getSimpleName(), "Saga of the Sword Muse"); - _npc = new int[] - { + _npc = new int[] { 30853, 31624, 31583, @@ -45,8 +42,7 @@ public class Q00072_SagaOfTheSwordMuse extends AbstractSagaQuest 31659, 31281 }; - _items = new int[] - { + _items = new int[] { 7080, 7536, 7081, @@ -60,28 +56,23 @@ public class Q00072_SagaOfTheSwordMuse extends AbstractSagaQuest 7095, 6482 }; - _mob = new int[] - { + _mob = new int[] { 27288, 27221, 27280 }; - _classId = new int[] - { + _classId = new int[] { 100 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x15 }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(161719, -92823, -1893), new Location(124355, 82155, -2803), new Location(124376, 82127, -2796) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00073_SagaOfTheDuelist/Q00073_SagaOfTheDuelist.java b/src/main/java/com/l2jserver/datapack/quests/Q00073_SagaOfTheDuelist/Q00073_SagaOfTheDuelist.java index 754c4993d0..64a583e13b 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00073_SagaOfTheDuelist/Q00073_SagaOfTheDuelist.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00073_SagaOfTheDuelist/Q00073_SagaOfTheDuelist.java @@ -28,19 +28,16 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Saga of the Duelist (73) * @author Emperorc */ -public class Q00073_SagaOfTheDuelist extends AbstractSagaQuest -{ +public class Q00073_SagaOfTheDuelist extends AbstractSagaQuest { /** * Third Class Transfer Quest - Duelist: The quest asks for "Top-grade Meat" which can now be acquired directly through NPC Tunatun, instead of through an additional quest from NPC Tunatun. */ private final int TUNATUN = 31537; private final int TOPQUALITYMEAT = 7546; - public Q00073_SagaOfTheDuelist() - { + public Q00073_SagaOfTheDuelist() { super(73, Q00073_SagaOfTheDuelist.class.getSimpleName(), "Saga of the Duelist"); - _npc = new int[] - { + _npc = new int[] { 30849, 31624, 31226, @@ -54,8 +51,7 @@ public class Q00073_SagaOfTheDuelist extends AbstractSagaQuest 31656, 31277 }; - _items = new int[] - { + _items = new int[] { 7080, 7537, 7081, @@ -69,28 +65,23 @@ public class Q00073_SagaOfTheDuelist extends AbstractSagaQuest 7096, 7546 }; - _mob = new int[] - { + _mob = new int[] { 27289, 27222, 27281 }; - _classId = new int[] - { + _classId = new int[] { 88 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x02 }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(164650, -74121, -2871), new Location(47429, -56923, -2383), new Location(47391, -56929, -2370) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", @@ -116,16 +107,12 @@ public class Q00073_SagaOfTheDuelist extends AbstractSagaQuest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { - if (npc.getId() == TUNATUN) - { + public String onTalk(L2Npc npc, L2PcInstance player) { + if (npc.getId() == TUNATUN) { String htmltext = getNoQuestMsg(player); QuestState st = getQuestState(player, false); - if ((st != null) && st.isCond(3)) - { - if (!st.hasQuestItems(TOPQUALITYMEAT)) - { + if ((st != null) && st.isCond(3)) { + if (!st.hasQuestItems(TOPQUALITYMEAT)) { st.giveItems(TOPQUALITYMEAT, 1); return "tunatun_01.htm"; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00074_SagaOfTheDreadnought/Q00074_SagaOfTheDreadnought.java b/src/main/java/com/l2jserver/datapack/quests/Q00074_SagaOfTheDreadnought/Q00074_SagaOfTheDreadnought.java index d71c749b9e..1fbb9ec9d7 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00074_SagaOfTheDreadnought/Q00074_SagaOfTheDreadnought.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00074_SagaOfTheDreadnought/Q00074_SagaOfTheDreadnought.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Dreadnought (74) * @author Emperorc */ -public class Q00074_SagaOfTheDreadnought extends AbstractSagaQuest -{ - public Q00074_SagaOfTheDreadnought() - { +public class Q00074_SagaOfTheDreadnought extends AbstractSagaQuest { + public Q00074_SagaOfTheDreadnought() { super(74, Q00074_SagaOfTheDreadnought.class.getSimpleName(), "Saga of the Dreadnought"); - _npc = new int[] - { + _npc = new int[] { 30850, 31624, 31298, @@ -45,8 +42,7 @@ public class Q00074_SagaOfTheDreadnought extends AbstractSagaQuest 31657, 31522 }; - _items = new int[] - { + _items = new int[] { 7080, 7538, 7081, @@ -60,28 +56,23 @@ public class Q00074_SagaOfTheDreadnought extends AbstractSagaQuest 7097, 6480 }; - _mob = new int[] - { + _mob = new int[] { 27290, 27223, 27282 }; - _classId = new int[] - { + _classId = new int[] { 89 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x03 }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(191046, -40640, -3042), new Location(46087, -36372, -1685), new Location(46066, -36396, -1685) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00075_SagaOfTheTitan/Q00075_SagaOfTheTitan.java b/src/main/java/com/l2jserver/datapack/quests/Q00075_SagaOfTheTitan/Q00075_SagaOfTheTitan.java index 7928151256..9895cbb4d9 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00075_SagaOfTheTitan/Q00075_SagaOfTheTitan.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00075_SagaOfTheTitan/Q00075_SagaOfTheTitan.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Titan (75) * @author Emperorc */ -public class Q00075_SagaOfTheTitan extends AbstractSagaQuest -{ - public Q00075_SagaOfTheTitan() - { +public class Q00075_SagaOfTheTitan extends AbstractSagaQuest { + public Q00075_SagaOfTheTitan() { super(75, Q00075_SagaOfTheTitan.class.getSimpleName(), "Saga of the Titan"); - _npc = new int[] - { + _npc = new int[] { 31327, 31624, 31289, @@ -45,8 +42,7 @@ public class Q00075_SagaOfTheTitan extends AbstractSagaQuest 31658, 31290 }; - _items = new int[] - { + _items = new int[] { 7080, 7539, 7081, @@ -60,28 +56,23 @@ public class Q00075_SagaOfTheTitan extends AbstractSagaQuest 7098, 0 }; - _mob = new int[] - { + _mob = new int[] { 27292, 27224, 27283 }; - _classId = new int[] - { + _classId = new int[] { 113 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x2e }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(119518, -28658, -3811), new Location(181215, 36676, -4812), new Location(181227, 36703, -4816) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00076_SagaOfTheGrandKhavatari/Q00076_SagaOfTheGrandKhavatari.java b/src/main/java/com/l2jserver/datapack/quests/Q00076_SagaOfTheGrandKhavatari/Q00076_SagaOfTheGrandKhavatari.java index 9ec06dea2a..ecfd11f43d 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00076_SagaOfTheGrandKhavatari/Q00076_SagaOfTheGrandKhavatari.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00076_SagaOfTheGrandKhavatari/Q00076_SagaOfTheGrandKhavatari.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Grand Khavatari (76) * @author Emperorc */ -public class Q00076_SagaOfTheGrandKhavatari extends AbstractSagaQuest -{ - public Q00076_SagaOfTheGrandKhavatari() - { +public class Q00076_SagaOfTheGrandKhavatari extends AbstractSagaQuest { + public Q00076_SagaOfTheGrandKhavatari() { super(76, Q00076_SagaOfTheGrandKhavatari.class.getSimpleName(), "Saga of the Grand Khavatari"); - _npc = new int[] - { + _npc = new int[] { 31339, 31624, 31589, @@ -45,8 +42,7 @@ public class Q00076_SagaOfTheGrandKhavatari extends AbstractSagaQuest 31659, 31290 }; - _items = new int[] - { + _items = new int[] { 7080, 7539, 7081, @@ -60,28 +56,23 @@ public class Q00076_SagaOfTheGrandKhavatari extends AbstractSagaQuest 7099, 0 }; - _mob = new int[] - { + _mob = new int[] { 27293, 27226, 27284 }; - _classId = new int[] - { + _classId = new int[] { 114 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x30 }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(161719, -92823, -1893), new Location(124355, 82155, -2803), new Location(124376, 82127, -2796) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00077_SagaOfTheDominator/Q00077_SagaOfTheDominator.java b/src/main/java/com/l2jserver/datapack/quests/Q00077_SagaOfTheDominator/Q00077_SagaOfTheDominator.java index b21e651be7..1bcb455478 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00077_SagaOfTheDominator/Q00077_SagaOfTheDominator.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00077_SagaOfTheDominator/Q00077_SagaOfTheDominator.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Dominator (77) * @author Emperorc */ -public class Q00077_SagaOfTheDominator extends AbstractSagaQuest -{ - public Q00077_SagaOfTheDominator() - { +public class Q00077_SagaOfTheDominator extends AbstractSagaQuest { + public Q00077_SagaOfTheDominator() { super(77, Q00077_SagaOfTheDominator.class.getSimpleName(), "Saga of the Dominator"); - _npc = new int[] - { + _npc = new int[] { 31336, 31624, 31371, @@ -45,8 +42,7 @@ public class Q00077_SagaOfTheDominator extends AbstractSagaQuest 31656, 31290 }; - _items = new int[] - { + _items = new int[] { 7080, 7539, 7081, @@ -60,28 +56,23 @@ public class Q00077_SagaOfTheDominator extends AbstractSagaQuest 7100, 0 }; - _mob = new int[] - { + _mob = new int[] { 27294, 27226, 27262 }; - _classId = new int[] - { + _classId = new int[] { 115 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x33 }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(162898, -76492, -3096), new Location(47429, -56923, -2383), new Location(47391, -56929, -2370) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00078_SagaOfTheDoomcryer/Q00078_SagaOfTheDoomcryer.java b/src/main/java/com/l2jserver/datapack/quests/Q00078_SagaOfTheDoomcryer/Q00078_SagaOfTheDoomcryer.java index 6516796e86..2fb073e1e6 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00078_SagaOfTheDoomcryer/Q00078_SagaOfTheDoomcryer.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00078_SagaOfTheDoomcryer/Q00078_SagaOfTheDoomcryer.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Doomcryer (78) * @author Emperorc */ -public class Q00078_SagaOfTheDoomcryer extends AbstractSagaQuest -{ - public Q00078_SagaOfTheDoomcryer() - { +public class Q00078_SagaOfTheDoomcryer extends AbstractSagaQuest { + public Q00078_SagaOfTheDoomcryer() { super(78, Q00078_SagaOfTheDoomcryer.class.getSimpleName(), "Saga of the Doomcryer"); - _npc = new int[] - { + _npc = new int[] { 31336, 31624, 31589, @@ -45,8 +42,7 @@ public class Q00078_SagaOfTheDoomcryer extends AbstractSagaQuest 31657, 31290 }; - _items = new int[] - { + _items = new int[] { 7080, 7539, 7081, @@ -60,28 +56,23 @@ public class Q00078_SagaOfTheDoomcryer extends AbstractSagaQuest 7101, 0 }; - _mob = new int[] - { + _mob = new int[] { 27295, 27227, 27285 }; - _classId = new int[] - { + _classId = new int[] { 116 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x34 }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(191046, -40640, -3042), new Location(46087, -36372, -1685), new Location(46066, -36396, -1685) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00079_SagaOfTheAdventurer/Q00079_SagaOfTheAdventurer.java b/src/main/java/com/l2jserver/datapack/quests/Q00079_SagaOfTheAdventurer/Q00079_SagaOfTheAdventurer.java index 951b9eb49d..876a231881 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00079_SagaOfTheAdventurer/Q00079_SagaOfTheAdventurer.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00079_SagaOfTheAdventurer/Q00079_SagaOfTheAdventurer.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Adventurer (79) * @author Emperorc */ -public class Q00079_SagaOfTheAdventurer extends AbstractSagaQuest -{ - public Q00079_SagaOfTheAdventurer() - { +public class Q00079_SagaOfTheAdventurer extends AbstractSagaQuest { + public Q00079_SagaOfTheAdventurer() { super(79, Q00079_SagaOfTheAdventurer.class.getSimpleName(), "Saga of the Adventurer"); - _npc = new int[] - { + _npc = new int[] { 31603, 31584, 31579, @@ -45,8 +42,7 @@ public class Q00079_SagaOfTheAdventurer extends AbstractSagaQuest 31658, 31616 }; - _items = new int[] - { + _items = new int[] { 7080, 7516, 7081, @@ -60,28 +56,23 @@ public class Q00079_SagaOfTheAdventurer extends AbstractSagaQuest 7102, 0 }; - _mob = new int[] - { + _mob = new int[] { 27299, 27228, 27302 }; - _classId = new int[] - { + _classId = new int[] { 93 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x08 }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(119518, -28658, -3811), new Location(181205, 36676, -4816), new Location(181215, 36676, -4812) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00080_SagaOfTheWindRider/Q00080_SagaOfTheWindRider.java b/src/main/java/com/l2jserver/datapack/quests/Q00080_SagaOfTheWindRider/Q00080_SagaOfTheWindRider.java index b71ff34073..41d331a96a 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00080_SagaOfTheWindRider/Q00080_SagaOfTheWindRider.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00080_SagaOfTheWindRider/Q00080_SagaOfTheWindRider.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Wind Rider (80) * @author Emperorc */ -public class Q00080_SagaOfTheWindRider extends AbstractSagaQuest -{ - public Q00080_SagaOfTheWindRider() - { +public class Q00080_SagaOfTheWindRider extends AbstractSagaQuest { + public Q00080_SagaOfTheWindRider() { super(80, Q00080_SagaOfTheWindRider.class.getSimpleName(), "Saga of the Wind Rider"); - _npc = new int[] - { + _npc = new int[] { 31603, 31624, 31284, @@ -45,8 +42,7 @@ public class Q00080_SagaOfTheWindRider extends AbstractSagaQuest 31659, 31616 }; - _items = new int[] - { + _items = new int[] { 7080, 7517, 7081, @@ -60,28 +56,23 @@ public class Q00080_SagaOfTheWindRider extends AbstractSagaQuest 7103, 0 }; - _mob = new int[] - { + _mob = new int[] { 27300, 27229, 27303 }; - _classId = new int[] - { + _classId = new int[] { 101 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x17 }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(161719, -92823, -1893), new Location(124314, 82155, -2803), new Location(124355, 82155, -2803) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00081_SagaOfTheGhostHunter/Q00081_SagaOfTheGhostHunter.java b/src/main/java/com/l2jserver/datapack/quests/Q00081_SagaOfTheGhostHunter/Q00081_SagaOfTheGhostHunter.java index 856594fe8b..4aa486c41c 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00081_SagaOfTheGhostHunter/Q00081_SagaOfTheGhostHunter.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00081_SagaOfTheGhostHunter/Q00081_SagaOfTheGhostHunter.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Ghost Hunter (81) * @author Emperorc */ -public class Q00081_SagaOfTheGhostHunter extends AbstractSagaQuest -{ - public Q00081_SagaOfTheGhostHunter() - { +public class Q00081_SagaOfTheGhostHunter extends AbstractSagaQuest { + public Q00081_SagaOfTheGhostHunter() { super(81, Q00081_SagaOfTheGhostHunter.class.getSimpleName(), "Saga of the Ghost Hunter"); - _npc = new int[] - { + _npc = new int[] { 31603, 31624, 31286, @@ -45,8 +42,7 @@ public class Q00081_SagaOfTheGhostHunter extends AbstractSagaQuest 31656, 31616 }; - _items = new int[] - { + _items = new int[] { 7080, 7518, 7081, @@ -60,28 +56,23 @@ public class Q00081_SagaOfTheGhostHunter extends AbstractSagaQuest 7104, 0 }; - _mob = new int[] - { + _mob = new int[] { 27301, 27230, 27304 }; - _classId = new int[] - { + _classId = new int[] { 108 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x24 }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(164650, -74121, -2871), new Location(47391, -56929, -2370), new Location(47429, -56923, -2383) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00082_SagaOfTheSagittarius/Q00082_SagaOfTheSagittarius.java b/src/main/java/com/l2jserver/datapack/quests/Q00082_SagaOfTheSagittarius/Q00082_SagaOfTheSagittarius.java index f7ad4f22b7..425b728a40 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00082_SagaOfTheSagittarius/Q00082_SagaOfTheSagittarius.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00082_SagaOfTheSagittarius/Q00082_SagaOfTheSagittarius.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Sagittarius (82) * @author Emperorc */ -public class Q00082_SagaOfTheSagittarius extends AbstractSagaQuest -{ - public Q00082_SagaOfTheSagittarius() - { +public class Q00082_SagaOfTheSagittarius extends AbstractSagaQuest { + public Q00082_SagaOfTheSagittarius() { super(82, Q00082_SagaOfTheSagittarius.class.getSimpleName(), "Saga of the Sagittarius"); - _npc = new int[] - { + _npc = new int[] { 30702, 31627, 31604, @@ -45,8 +42,7 @@ public class Q00082_SagaOfTheSagittarius extends AbstractSagaQuest 31657, 31641 }; - _items = new int[] - { + _items = new int[] { 7080, 7519, 7081, @@ -60,28 +56,23 @@ public class Q00082_SagaOfTheSagittarius extends AbstractSagaQuest 7105, 0 }; - _mob = new int[] - { + _mob = new int[] { 27296, 27231, 27305 }; - _classId = new int[] - { + _classId = new int[] { 92 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x09 }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(191046, -40640, -3042), new Location(46066, -36396, -1685), new Location(46066, -36396, -1685) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00083_SagaOfTheMoonlightSentinel/Q00083_SagaOfTheMoonlightSentinel.java b/src/main/java/com/l2jserver/datapack/quests/Q00083_SagaOfTheMoonlightSentinel/Q00083_SagaOfTheMoonlightSentinel.java index 49a5d0e939..1867454c17 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00083_SagaOfTheMoonlightSentinel/Q00083_SagaOfTheMoonlightSentinel.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00083_SagaOfTheMoonlightSentinel/Q00083_SagaOfTheMoonlightSentinel.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Moonlight Sentinel (83) * @author Emperorc */ -public class Q00083_SagaOfTheMoonlightSentinel extends AbstractSagaQuest -{ - public Q00083_SagaOfTheMoonlightSentinel() - { +public class Q00083_SagaOfTheMoonlightSentinel extends AbstractSagaQuest { + public Q00083_SagaOfTheMoonlightSentinel() { super(83, Q00083_SagaOfTheMoonlightSentinel.class.getSimpleName(), "Saga of the Moonlight Sentinel"); - _npc = new int[] - { + _npc = new int[] { 30702, 31627, 31604, @@ -45,8 +42,7 @@ public class Q00083_SagaOfTheMoonlightSentinel extends AbstractSagaQuest 31658, 31641 }; - _items = new int[] - { + _items = new int[] { 7080, 7520, 7081, @@ -60,28 +56,23 @@ public class Q00083_SagaOfTheMoonlightSentinel extends AbstractSagaQuest 7106, 0 }; - _mob = new int[] - { + _mob = new int[] { 27297, 27232, 27306 }; - _classId = new int[] - { + _classId = new int[] { 102 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x18 }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(161719, -92823, -1893), new Location(181227, 36703, -4816), new Location(181215, 36676, -4812) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00084_SagaOfTheGhostSentinel/Q00084_SagaOfTheGhostSentinel.java b/src/main/java/com/l2jserver/datapack/quests/Q00084_SagaOfTheGhostSentinel/Q00084_SagaOfTheGhostSentinel.java index 98771717a4..b8b9b8f9f2 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00084_SagaOfTheGhostSentinel/Q00084_SagaOfTheGhostSentinel.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00084_SagaOfTheGhostSentinel/Q00084_SagaOfTheGhostSentinel.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Ghost Sentinel (84) * @author Emperorc */ -public class Q00084_SagaOfTheGhostSentinel extends AbstractSagaQuest -{ - public Q00084_SagaOfTheGhostSentinel() - { +public class Q00084_SagaOfTheGhostSentinel extends AbstractSagaQuest { + public Q00084_SagaOfTheGhostSentinel() { super(84, Q00084_SagaOfTheGhostSentinel.class.getSimpleName(), "Saga of the Ghost Sentinel"); - _npc = new int[] - { + _npc = new int[] { 30702, 31587, 31604, @@ -45,8 +42,7 @@ public class Q00084_SagaOfTheGhostSentinel extends AbstractSagaQuest 31659, 31641 }; - _items = new int[] - { + _items = new int[] { 7080, 7521, 7081, @@ -60,28 +56,23 @@ public class Q00084_SagaOfTheGhostSentinel extends AbstractSagaQuest 7107, 0 }; - _mob = new int[] - { + _mob = new int[] { 27298, 27233, 27307 }; - _classId = new int[] - { + _classId = new int[] { 109 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x25 }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(161719, -92823, -1893), new Location(124376, 82127, -2796), new Location(124376, 82127, -2796) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00085_SagaOfTheCardinal/Q00085_SagaOfTheCardinal.java b/src/main/java/com/l2jserver/datapack/quests/Q00085_SagaOfTheCardinal/Q00085_SagaOfTheCardinal.java index 0fe6b650ed..d8990d3666 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00085_SagaOfTheCardinal/Q00085_SagaOfTheCardinal.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00085_SagaOfTheCardinal/Q00085_SagaOfTheCardinal.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Cardinal (85) * @author Emperorc */ -public class Q00085_SagaOfTheCardinal extends AbstractSagaQuest -{ - public Q00085_SagaOfTheCardinal() - { +public class Q00085_SagaOfTheCardinal extends AbstractSagaQuest { + public Q00085_SagaOfTheCardinal() { super(85, Q00085_SagaOfTheCardinal.class.getSimpleName(), "Saga of the Cardinal"); - _npc = new int[] - { + _npc = new int[] { 30191, 31626, 31588, @@ -45,8 +42,7 @@ public class Q00085_SagaOfTheCardinal extends AbstractSagaQuest 31658, 31280 }; - _items = new int[] - { + _items = new int[] { 7080, 7522, 7081, @@ -60,28 +56,23 @@ public class Q00085_SagaOfTheCardinal extends AbstractSagaQuest 7087, 0 }; - _mob = new int[] - { + _mob = new int[] { 27267, 27234, 27274 }; - _classId = new int[] - { + _classId = new int[] { 97 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x10 }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(119518, -28658, -3811), new Location(181215, 36676, -4812), new Location(181227, 36703, -4816) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00086_SagaOfTheHierophant/Q00086_SagaOfTheHierophant.java b/src/main/java/com/l2jserver/datapack/quests/Q00086_SagaOfTheHierophant/Q00086_SagaOfTheHierophant.java index 0a51e66417..73be8a1721 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00086_SagaOfTheHierophant/Q00086_SagaOfTheHierophant.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00086_SagaOfTheHierophant/Q00086_SagaOfTheHierophant.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Hierophant (86) * @author Emperorc */ -public class Q00086_SagaOfTheHierophant extends AbstractSagaQuest -{ - public Q00086_SagaOfTheHierophant() - { +public class Q00086_SagaOfTheHierophant extends AbstractSagaQuest { + public Q00086_SagaOfTheHierophant() { super(86, Q00086_SagaOfTheHierophant.class.getSimpleName(), "Saga of the Hierophant"); - _npc = new int[] - { + _npc = new int[] { 30191, 31626, 31588, @@ -45,8 +42,7 @@ public class Q00086_SagaOfTheHierophant extends AbstractSagaQuest 31659, 31280 }; - _items = new int[] - { + _items = new int[] { 7080, 7523, 7081, @@ -60,28 +56,23 @@ public class Q00086_SagaOfTheHierophant extends AbstractSagaQuest 7089, 0 }; - _mob = new int[] - { + _mob = new int[] { 27269, 27235, 27275 }; - _classId = new int[] - { + _classId = new int[] { 98 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x11 }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(161719, -92823, -1893), new Location(124355, 82155, -2803), new Location(124376, 82127, -2796) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00087_SagaOfEvasSaint/Q00087_SagaOfEvasSaint.java b/src/main/java/com/l2jserver/datapack/quests/Q00087_SagaOfEvasSaint/Q00087_SagaOfEvasSaint.java index 78c064068d..c4b0316633 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00087_SagaOfEvasSaint/Q00087_SagaOfEvasSaint.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00087_SagaOfEvasSaint/Q00087_SagaOfEvasSaint.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of Eva's Saint (87) * @author Emperorc */ -public class Q00087_SagaOfEvasSaint extends AbstractSagaQuest -{ - public Q00087_SagaOfEvasSaint() - { +public class Q00087_SagaOfEvasSaint extends AbstractSagaQuest { + public Q00087_SagaOfEvasSaint() { super(87, Q00087_SagaOfEvasSaint.class.getSimpleName(), "Saga of Eva's Saint"); - _npc = new int[] - { + _npc = new int[] { 30191, 31626, 31588, @@ -45,8 +42,7 @@ public class Q00087_SagaOfEvasSaint extends AbstractSagaQuest 31657, 31280 }; - _items = new int[] - { + _items = new int[] { 7080, 7524, 7081, @@ -60,28 +56,23 @@ public class Q00087_SagaOfEvasSaint extends AbstractSagaQuest 7088, 0 }; - _mob = new int[] - { + _mob = new int[] { 27266, 27236, 27276 }; - _classId = new int[] - { + _classId = new int[] { 105 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x1e }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(164650, -74121, -2871), new Location(46087, -36372, -1685), new Location(46066, -36396, -1685) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00088_SagaOfTheArchmage/Q00088_SagaOfTheArchmage.java b/src/main/java/com/l2jserver/datapack/quests/Q00088_SagaOfTheArchmage/Q00088_SagaOfTheArchmage.java index 182f697e14..4a6f0ef989 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00088_SagaOfTheArchmage/Q00088_SagaOfTheArchmage.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00088_SagaOfTheArchmage/Q00088_SagaOfTheArchmage.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Archmage (88) * @author Emperorc */ -public class Q00088_SagaOfTheArchmage extends AbstractSagaQuest -{ - public Q00088_SagaOfTheArchmage() - { +public class Q00088_SagaOfTheArchmage extends AbstractSagaQuest { + public Q00088_SagaOfTheArchmage() { super(88, Q00088_SagaOfTheArchmage.class.getSimpleName(), "Saga of the Archmage"); - _npc = new int[] - { + _npc = new int[] { 30176, 31627, 31282, @@ -45,8 +42,7 @@ public class Q00088_SagaOfTheArchmage extends AbstractSagaQuest 31657, 31282 }; - _items = new int[] - { + _items = new int[] { 7080, 7529, 7081, @@ -60,28 +56,23 @@ public class Q00088_SagaOfTheArchmage extends AbstractSagaQuest 7082, 0 }; - _mob = new int[] - { + _mob = new int[] { 27250, 27237, 27254 }; - _classId = new int[] - { + _classId = new int[] { 94 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x0c }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(191046, -40640, -3042), new Location(46066, -36396, -1685), new Location(46087, -36372, -1685) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00089_SagaOfTheMysticMuse/Q00089_SagaOfTheMysticMuse.java b/src/main/java/com/l2jserver/datapack/quests/Q00089_SagaOfTheMysticMuse/Q00089_SagaOfTheMysticMuse.java index 65598db61e..b4078bf5d8 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00089_SagaOfTheMysticMuse/Q00089_SagaOfTheMysticMuse.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00089_SagaOfTheMysticMuse/Q00089_SagaOfTheMysticMuse.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Mystic Muse (89) * @author Emperorc */ -public class Q00089_SagaOfTheMysticMuse extends AbstractSagaQuest -{ - public Q00089_SagaOfTheMysticMuse() - { +public class Q00089_SagaOfTheMysticMuse extends AbstractSagaQuest { + public Q00089_SagaOfTheMysticMuse() { super(89, Q00089_SagaOfTheMysticMuse.class.getSimpleName(), "Saga of the Mystic Muse"); - _npc = new int[] - { + _npc = new int[] { 30174, 31627, 31283, @@ -45,8 +42,7 @@ public class Q00089_SagaOfTheMysticMuse extends AbstractSagaQuest 31658, 31283 }; - _items = new int[] - { + _items = new int[] { 7080, 7530, 7081, @@ -60,28 +56,23 @@ public class Q00089_SagaOfTheMysticMuse extends AbstractSagaQuest 7083, 0 }; - _mob = new int[] - { + _mob = new int[] { 27251, 27238, 27255 }; - _classId = new int[] - { + _classId = new int[] { 103 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x1b }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(119518, -28658, -3811), new Location(181227, 36703, -4816), new Location(181215, 36676, -4812) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00090_SagaOfTheStormScreamer/Q00090_SagaOfTheStormScreamer.java b/src/main/java/com/l2jserver/datapack/quests/Q00090_SagaOfTheStormScreamer/Q00090_SagaOfTheStormScreamer.java index eda395539d..75ce8453d2 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00090_SagaOfTheStormScreamer/Q00090_SagaOfTheStormScreamer.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00090_SagaOfTheStormScreamer/Q00090_SagaOfTheStormScreamer.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Storm Screamer (90) * @author Emperorc */ -public class Q00090_SagaOfTheStormScreamer extends AbstractSagaQuest -{ - public Q00090_SagaOfTheStormScreamer() - { +public class Q00090_SagaOfTheStormScreamer extends AbstractSagaQuest { + public Q00090_SagaOfTheStormScreamer() { super(90, Q00090_SagaOfTheStormScreamer.class.getSimpleName(), "Saga of the Storm Screamer"); - _npc = new int[] - { + _npc = new int[] { 30175, 31627, 31287, @@ -45,8 +42,7 @@ public class Q00090_SagaOfTheStormScreamer extends AbstractSagaQuest 31659, 31287 }; - _items = new int[] - { + _items = new int[] { 7080, 7531, 7081, @@ -60,28 +56,23 @@ public class Q00090_SagaOfTheStormScreamer extends AbstractSagaQuest 7084, 0 }; - _mob = new int[] - { + _mob = new int[] { 27252, 27239, 27256 }; - _classId = new int[] - { + _classId = new int[] { 110 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x28 }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(161719, -92823, -1893), new Location(124376, 82127, -2796), new Location(124355, 82155, -2803) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00091_SagaOfTheArcanaLord/Q00091_SagaOfTheArcanaLord.java b/src/main/java/com/l2jserver/datapack/quests/Q00091_SagaOfTheArcanaLord/Q00091_SagaOfTheArcanaLord.java index 6283300e75..0e7640e332 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00091_SagaOfTheArcanaLord/Q00091_SagaOfTheArcanaLord.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00091_SagaOfTheArcanaLord/Q00091_SagaOfTheArcanaLord.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Arcana Lord (91) * @author Emperorc */ -public class Q00091_SagaOfTheArcanaLord extends AbstractSagaQuest -{ - public Q00091_SagaOfTheArcanaLord() - { +public class Q00091_SagaOfTheArcanaLord extends AbstractSagaQuest { + public Q00091_SagaOfTheArcanaLord() { super(91, Q00091_SagaOfTheArcanaLord.class.getSimpleName(), "Saga of the Arcana Lord"); - _npc = new int[] - { + _npc = new int[] { 31605, 31622, 31585, @@ -45,8 +42,7 @@ public class Q00091_SagaOfTheArcanaLord extends AbstractSagaQuest 31658, 31608 }; - _items = new int[] - { + _items = new int[] { 7080, 7604, 7081, @@ -60,28 +56,23 @@ public class Q00091_SagaOfTheArcanaLord extends AbstractSagaQuest 7110, 0 }; - _mob = new int[] - { + _mob = new int[] { 27313, 27240, 27310 }; - _classId = new int[] - { + _classId = new int[] { 96 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x0e }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(119518, -28658, -3811), new Location(181215, 36676, -4812), new Location(181227, 36703, -4816) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00092_SagaOfTheElementalMaster/Q00092_SagaOfTheElementalMaster.java b/src/main/java/com/l2jserver/datapack/quests/Q00092_SagaOfTheElementalMaster/Q00092_SagaOfTheElementalMaster.java index 73d3279104..27e245e1a8 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00092_SagaOfTheElementalMaster/Q00092_SagaOfTheElementalMaster.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00092_SagaOfTheElementalMaster/Q00092_SagaOfTheElementalMaster.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Elemental Master (92) * @author Emperorc */ -public class Q00092_SagaOfTheElementalMaster extends AbstractSagaQuest -{ - public Q00092_SagaOfTheElementalMaster() - { +public class Q00092_SagaOfTheElementalMaster extends AbstractSagaQuest { + public Q00092_SagaOfTheElementalMaster() { super(92, Q00092_SagaOfTheElementalMaster.class.getSimpleName(), "Saga of the Elemental Master"); - _npc = new int[] - { + _npc = new int[] { 30174, 31281, 31614, @@ -45,8 +42,7 @@ public class Q00092_SagaOfTheElementalMaster extends AbstractSagaQuest 31659, 31614 }; - _items = new int[] - { + _items = new int[] { 7080, 7605, 7081, @@ -60,28 +56,23 @@ public class Q00092_SagaOfTheElementalMaster extends AbstractSagaQuest 7111, 0 }; - _mob = new int[] - { + _mob = new int[] { 27314, 27241, 27311 }; - _classId = new int[] - { + _classId = new int[] { 104 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x1c }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(161719, -92823, -1893), new Location(124376, 82127, -2796), new Location(124355, 82155, -2803) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00093_SagaOfTheSpectralMaster/Q00093_SagaOfTheSpectralMaster.java b/src/main/java/com/l2jserver/datapack/quests/Q00093_SagaOfTheSpectralMaster/Q00093_SagaOfTheSpectralMaster.java index 8e3c4bcf7f..d76c3192c0 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00093_SagaOfTheSpectralMaster/Q00093_SagaOfTheSpectralMaster.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00093_SagaOfTheSpectralMaster/Q00093_SagaOfTheSpectralMaster.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Spectral Master (93) * @author Emperorc */ -public class Q00093_SagaOfTheSpectralMaster extends AbstractSagaQuest -{ - public Q00093_SagaOfTheSpectralMaster() - { +public class Q00093_SagaOfTheSpectralMaster extends AbstractSagaQuest { + public Q00093_SagaOfTheSpectralMaster() { super(93, Q00093_SagaOfTheSpectralMaster.class.getSimpleName(), "Saga of the Spectral Master"); - _npc = new int[] - { + _npc = new int[] { 30175, 31287, 31613, @@ -45,8 +42,7 @@ public class Q00093_SagaOfTheSpectralMaster extends AbstractSagaQuest 31656, 31613 }; - _items = new int[] - { + _items = new int[] { 7080, 7606, 7081, @@ -60,28 +56,23 @@ public class Q00093_SagaOfTheSpectralMaster extends AbstractSagaQuest 7112, 0 }; - _mob = new int[] - { + _mob = new int[] { 27315, 27242, 27312 }; - _classId = new int[] - { + _classId = new int[] { 111 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x29 }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(164650, -74121, -2871), new Location(47429, -56923, -2383), new Location(47391, -56929, -2370) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00094_SagaOfTheSoultaker/Q00094_SagaOfTheSoultaker.java b/src/main/java/com/l2jserver/datapack/quests/Q00094_SagaOfTheSoultaker/Q00094_SagaOfTheSoultaker.java index c671fa9f04..f5b145e6bd 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00094_SagaOfTheSoultaker/Q00094_SagaOfTheSoultaker.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00094_SagaOfTheSoultaker/Q00094_SagaOfTheSoultaker.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Soultaker (94) * @author Emperorc */ -public class Q00094_SagaOfTheSoultaker extends AbstractSagaQuest -{ - public Q00094_SagaOfTheSoultaker() - { +public class Q00094_SagaOfTheSoultaker extends AbstractSagaQuest { + public Q00094_SagaOfTheSoultaker() { super(94, Q00094_SagaOfTheSoultaker.class.getSimpleName(), "Saga of the Soultaker"); - _npc = new int[] - { + _npc = new int[] { 30832, 31623, 31279, @@ -45,8 +42,7 @@ public class Q00094_SagaOfTheSoultaker extends AbstractSagaQuest 31657, 31279 }; - _items = new int[] - { + _items = new int[] { 7080, 7533, 7081, @@ -60,28 +56,23 @@ public class Q00094_SagaOfTheSoultaker extends AbstractSagaQuest 7085, 0 }; - _mob = new int[] - { + _mob = new int[] { 27257, 27243, 27265 }; - _classId = new int[] - { + _classId = new int[] { 95 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x0d }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(191046, -40640, -3042), new Location(46066, -36396, -1685), new Location(46087, -36372, -1685) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00095_SagaOfTheHellKnight/Q00095_SagaOfTheHellKnight.java b/src/main/java/com/l2jserver/datapack/quests/Q00095_SagaOfTheHellKnight/Q00095_SagaOfTheHellKnight.java index a298af6392..5e8f0e4d94 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00095_SagaOfTheHellKnight/Q00095_SagaOfTheHellKnight.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00095_SagaOfTheHellKnight/Q00095_SagaOfTheHellKnight.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Hell Knight (95) * @author Emperorc */ -public class Q00095_SagaOfTheHellKnight extends AbstractSagaQuest -{ - public Q00095_SagaOfTheHellKnight() - { +public class Q00095_SagaOfTheHellKnight extends AbstractSagaQuest { + public Q00095_SagaOfTheHellKnight() { super(95, Q00095_SagaOfTheHellKnight.class.getSimpleName(), "Saga of the Hell Knight"); - _npc = new int[] - { + _npc = new int[] { 31582, 31623, 31297, @@ -45,8 +42,7 @@ public class Q00095_SagaOfTheHellKnight extends AbstractSagaQuest 31656, 31297 }; - _items = new int[] - { + _items = new int[] { 7080, 7532, 7081, @@ -60,28 +56,23 @@ public class Q00095_SagaOfTheHellKnight extends AbstractSagaQuest 7086, 0 }; - _mob = new int[] - { + _mob = new int[] { 27258, 27244, 27263 }; - _classId = new int[] - { + _classId = new int[] { 91 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x06 }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(164650, -74121, -2871), new Location(47391, -56929, -2370), new Location(47429, -56923, -2383) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00096_SagaOfTheSpectralDancer/Q00096_SagaOfTheSpectralDancer.java b/src/main/java/com/l2jserver/datapack/quests/Q00096_SagaOfTheSpectralDancer/Q00096_SagaOfTheSpectralDancer.java index d1e5a47e92..302dfe16fa 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00096_SagaOfTheSpectralDancer/Q00096_SagaOfTheSpectralDancer.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00096_SagaOfTheSpectralDancer/Q00096_SagaOfTheSpectralDancer.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Spectral Dancer (96) * @author Emperorc */ -public class Q00096_SagaOfTheSpectralDancer extends AbstractSagaQuest -{ - public Q00096_SagaOfTheSpectralDancer() - { +public class Q00096_SagaOfTheSpectralDancer extends AbstractSagaQuest { + public Q00096_SagaOfTheSpectralDancer() { super(96, Q00096_SagaOfTheSpectralDancer.class.getSimpleName(), "Saga of the Spectral Dancer"); - _npc = new int[] - { + _npc = new int[] { 31582, 31623, 31284, @@ -45,8 +42,7 @@ public class Q00096_SagaOfTheSpectralDancer extends AbstractSagaQuest 31656, 31284 }; - _items = new int[] - { + _items = new int[] { 7080, 7527, 7081, @@ -60,28 +56,23 @@ public class Q00096_SagaOfTheSpectralDancer extends AbstractSagaQuest 7092, 0 }; - _mob = new int[] - { + _mob = new int[] { 27272, 27245, 27264 }; - _classId = new int[] - { + _classId = new int[] { 107 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x22 }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(164650, -74121, -2871), new Location(47429, -56923, -2383), new Location(47391, -56929, -2370) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00097_SagaOfTheShillienTemplar/Q00097_SagaOfTheShillienTemplar.java b/src/main/java/com/l2jserver/datapack/quests/Q00097_SagaOfTheShillienTemplar/Q00097_SagaOfTheShillienTemplar.java index 9199654e73..87a70b5bb5 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00097_SagaOfTheShillienTemplar/Q00097_SagaOfTheShillienTemplar.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00097_SagaOfTheShillienTemplar/Q00097_SagaOfTheShillienTemplar.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Shillien Templar (97) * @author Emperorc */ -public class Q00097_SagaOfTheShillienTemplar extends AbstractSagaQuest -{ - public Q00097_SagaOfTheShillienTemplar() - { +public class Q00097_SagaOfTheShillienTemplar extends AbstractSagaQuest { + public Q00097_SagaOfTheShillienTemplar() { super(97, Q00097_SagaOfTheShillienTemplar.class.getSimpleName(), "Saga of the Shillien Templar"); - _npc = new int[] - { + _npc = new int[] { 31580, 31623, 31285, @@ -45,8 +42,7 @@ public class Q00097_SagaOfTheShillienTemplar extends AbstractSagaQuest 31659, 31285 }; - _items = new int[] - { + _items = new int[] { 7080, 7526, 7081, @@ -60,28 +56,23 @@ public class Q00097_SagaOfTheShillienTemplar extends AbstractSagaQuest 7091, 0 }; - _mob = new int[] - { + _mob = new int[] { 27271, 27246, 27273 }; - _classId = new int[] - { + _classId = new int[] { 106 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x21 }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(161719, -92823, -1893), new Location(124355, 82155, -2803), new Location(124376, 82127, -2796) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00098_SagaOfTheShillienSaint/Q00098_SagaOfTheShillienSaint.java b/src/main/java/com/l2jserver/datapack/quests/Q00098_SagaOfTheShillienSaint/Q00098_SagaOfTheShillienSaint.java index 8f9b26ab37..a647fd4bf7 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00098_SagaOfTheShillienSaint/Q00098_SagaOfTheShillienSaint.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00098_SagaOfTheShillienSaint/Q00098_SagaOfTheShillienSaint.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Shillien Saint (98) * @author Emperorc */ -public class Q00098_SagaOfTheShillienSaint extends AbstractSagaQuest -{ - public Q00098_SagaOfTheShillienSaint() - { +public class Q00098_SagaOfTheShillienSaint extends AbstractSagaQuest { + public Q00098_SagaOfTheShillienSaint() { super(98, Q00098_SagaOfTheShillienSaint.class.getSimpleName(), "Saga of the Shillien Saint"); - _npc = new int[] - { + _npc = new int[] { 31581, 31626, 31588, @@ -45,8 +42,7 @@ public class Q00098_SagaOfTheShillienSaint extends AbstractSagaQuest 31658, 31287 }; - _items = new int[] - { + _items = new int[] { 7080, 7525, 7081, @@ -60,28 +56,23 @@ public class Q00098_SagaOfTheShillienSaint extends AbstractSagaQuest 7090, 0 }; - _mob = new int[] - { + _mob = new int[] { 27270, 27247, 27277 }; - _classId = new int[] - { + _classId = new int[] { 112 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x2b }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(119518, -28658, -3811), new Location(181215, 36676, -4812), new Location(181227, 36703, -4816) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00099_SagaOfTheFortuneSeeker/Q00099_SagaOfTheFortuneSeeker.java b/src/main/java/com/l2jserver/datapack/quests/Q00099_SagaOfTheFortuneSeeker/Q00099_SagaOfTheFortuneSeeker.java index 92366162e0..c3a1d1465b 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00099_SagaOfTheFortuneSeeker/Q00099_SagaOfTheFortuneSeeker.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00099_SagaOfTheFortuneSeeker/Q00099_SagaOfTheFortuneSeeker.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Fortune Seeker (99) * @author Emperorc */ -public class Q00099_SagaOfTheFortuneSeeker extends AbstractSagaQuest -{ - public Q00099_SagaOfTheFortuneSeeker() - { +public class Q00099_SagaOfTheFortuneSeeker extends AbstractSagaQuest { + public Q00099_SagaOfTheFortuneSeeker() { super(99, Q00099_SagaOfTheFortuneSeeker.class.getSimpleName(), "Saga of the Fortune Seeker"); - _npc = new int[] - { + _npc = new int[] { 31594, 31623, 31600, @@ -45,8 +42,7 @@ public class Q00099_SagaOfTheFortuneSeeker extends AbstractSagaQuest 31657, 31600 }; - _items = new int[] - { + _items = new int[] { 7080, 7608, 7081, @@ -60,28 +56,23 @@ public class Q00099_SagaOfTheFortuneSeeker extends AbstractSagaQuest 7109, 0 }; - _mob = new int[] - { + _mob = new int[] { 27259, 27248, 27309 }; - _classId = new int[] - { + _classId = new int[] { 117 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x37 }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(191046, -40640, -3042), new Location(46066, -36396, -1685), new Location(46087, -36372, -1685) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00100_SagaOfTheMaestro/Q00100_SagaOfTheMaestro.java b/src/main/java/com/l2jserver/datapack/quests/Q00100_SagaOfTheMaestro/Q00100_SagaOfTheMaestro.java index 8f9e2e6a7d..9ffcbfd448 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00100_SagaOfTheMaestro/Q00100_SagaOfTheMaestro.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00100_SagaOfTheMaestro/Q00100_SagaOfTheMaestro.java @@ -25,13 +25,10 @@ import com.l2jserver.gameserver.model.Location; * Saga of the Maestro (100) * @author Emperorc */ -public class Q00100_SagaOfTheMaestro extends AbstractSagaQuest -{ - public Q00100_SagaOfTheMaestro() - { +public class Q00100_SagaOfTheMaestro extends AbstractSagaQuest { + public Q00100_SagaOfTheMaestro() { super(100, Q00100_SagaOfTheMaestro.class.getSimpleName(), "Saga of the Maestro"); - _npc = new int[] - { + _npc = new int[] { 31592, 31273, 31597, @@ -45,8 +42,7 @@ public class Q00100_SagaOfTheMaestro extends AbstractSagaQuest 31656, 31597 }; - _items = new int[] - { + _items = new int[] { 7080, 7607, 7081, @@ -60,28 +56,23 @@ public class Q00100_SagaOfTheMaestro extends AbstractSagaQuest 7108, 0 }; - _mob = new int[] - { + _mob = new int[] { 27260, 27249, 27308 }; - _classId = new int[] - { + _classId = new int[] { 118 }; - _previousClass = new int[] - { + _previousClass = new int[] { 0x39 }; - _npcSpawnLocations = new Location[] - { + _npcSpawnLocations = new Location[] { new Location(164650, -74121, -2871), new Location(47429, -56923, -2383), new Location(47391, -56929, -2370) }; - _text = new String[] - { + _text = new String[] { "PLAYERNAME! Pursued to here! However, I jumped out of the Banshouren boundaries! You look at the giant as the sign of power!", "... Oh ... good! So it was ... let's begin!", "I do not have the patience ..! I have been a giant force ...! Cough chatter ah ah ah!", diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00101_SwordOfSolidarity/Q00101_SwordOfSolidarity.java b/src/main/java/com/l2jserver/datapack/quests/Q00101_SwordOfSolidarity/Q00101_SwordOfSolidarity.java index 059b8950e9..b592739529 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00101_SwordOfSolidarity/Q00101_SwordOfSolidarity.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00101_SwordOfSolidarity/Q00101_SwordOfSolidarity.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.model.quest.State; * Sword of Solidarity (101) * @author xban1x */ -public class Q00101_SwordOfSolidarity extends Quest -{ +public class Q00101_SwordOfSolidarity extends Quest { // NPCs private static final int ROIEN = 30008; private static final int ALTRAN = 30283; @@ -45,14 +44,12 @@ public class Q00101_SwordOfSolidarity extends Quest private static final int ROIENS_LETTER = 796; private static final int DIRECTIONS_TO_RUINS = 937; // Monsters - private static final int[] MONSTERS = - { + private static final int[] MONSTERS = { 20361, // Tunath Orc Marksman 20362, // Tunath Orc Warrior }; // Rewards - private static final ItemHolder[] REWARDS = - { + private static final ItemHolder[] REWARDS = { new ItemHolder(738, 1), // Sword of Solidarity new ItemHolder(1060, 100), // Lesser Healing Potion new ItemHolder(4412, 10), // Echo Crystal - Theme of Battle @@ -64,8 +61,7 @@ public class Q00101_SwordOfSolidarity extends Quest // Misc private static final int MIN_LVL = 9; - public Q00101_SwordOfSolidarity() - { + public Q00101_SwordOfSolidarity() { super(101, Q00101_SwordOfSolidarity.class.getSimpleName(), "Sword of Solidarity"); addStartNpc(ROIEN); addKillId(MONSTERS); @@ -74,31 +70,24 @@ public class Q00101_SwordOfSolidarity extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st != null) - { - switch (event) - { + if (st != null) { + switch (event) { case "30008-03.html": - case "30008-09.html": - { + case "30008-09.html": { htmltext = event; break; } - case "30008-04.htm": - { + case "30008-04.htm": { st.startQuest(); st.giveItems(ROIENS_LETTER, 1); htmltext = event; break; } - case "30283-02.html": - { - if (st.isCond(1) && st.hasQuestItems(ROIENS_LETTER)) - { + case "30283-02.html": { + if (st.isCond(1) && st.hasQuestItems(ROIENS_LETTER)) { st.takeItems(ROIENS_LETTER, -1); st.giveItems(DIRECTIONS_TO_RUINS, 1); st.setCond(2, true); @@ -106,13 +95,10 @@ public class Q00101_SwordOfSolidarity extends Quest } break; } - case "30283-07.html": - { - if (st.isCond(5) && st.hasQuestItems(BROKEN_SWORD_HANDLE)) - { + case "30283-07.html": { + if (st.isCond(5) && st.hasQuestItems(BROKEN_SWORD_HANDLE)) { Q00281_HeadForTheHills.giveNewbieReward(player); - for (ItemHolder reward : REWARDS) - { + for (ItemHolder reward : REWARDS) { st.giveItems(reward); } st.addExpAndSp(25747, 2171); @@ -128,32 +114,21 @@ public class Q00101_SwordOfSolidarity extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isCond(2) && (getRandom(5) == 0)) - { - if (!st.hasQuestItems(BROKEN_BLADE_TOP)) - { + if ((st != null) && st.isCond(2) && (getRandom(5) == 0)) { + if (!st.hasQuestItems(BROKEN_BLADE_TOP)) { st.giveItems(BROKEN_BLADE_TOP, 1); - if (st.hasQuestItems(BROKEN_BLADE_BOTTOM)) - { + if (st.hasQuestItems(BROKEN_BLADE_BOTTOM)) { st.setCond(3, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } - } - else if (!st.hasQuestItems(BROKEN_BLADE_BOTTOM)) - { + } else if (!st.hasQuestItems(BROKEN_BLADE_BOTTOM)) { st.giveItems(BROKEN_BLADE_BOTTOM, 1); - if (st.hasQuestItems(BROKEN_BLADE_TOP)) - { + if (st.hasQuestItems(BROKEN_BLADE_TOP)) { st.setCond(3, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -162,57 +137,40 @@ public class Q00101_SwordOfSolidarity extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (npc.getId()) - { - case ROIEN: - { - switch (st.getState()) - { - case State.CREATED: - { + switch (npc.getId()) { + case ROIEN: { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getRace() == Race.HUMAN) ? (player.getLevel() >= MIN_LVL) ? "30008-02.htm" : "30008-08.htm" : "30008-01.htm"; break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { - if (st.hasQuestItems(ROIENS_LETTER)) - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { + if (st.hasQuestItems(ROIENS_LETTER)) { htmltext = "30008-05.html"; } break; } - case 2: - { - if (hasAtLeastOneQuestItem(player, BROKEN_BLADE_BOTTOM, BROKEN_BLADE_TOP)) - { + case 2: { + if (hasAtLeastOneQuestItem(player, BROKEN_BLADE_BOTTOM, BROKEN_BLADE_TOP)) { htmltext = "30008-11.html"; - } - else if (st.hasQuestItems(DIRECTIONS_TO_RUINS)) - { + } else if (st.hasQuestItems(DIRECTIONS_TO_RUINS)) { htmltext = "30008-10.html"; } break; } - case 3: - { - if (st.hasQuestItems(BROKEN_BLADE_BOTTOM, BROKEN_BLADE_TOP)) - { + case 3: { + if (st.hasQuestItems(BROKEN_BLADE_BOTTOM, BROKEN_BLADE_TOP)) { htmltext = "30008-12.html"; } break; } - case 4: - { - if (st.hasQuestItems(ALTRANS_NOTE)) - { + case 4: { + if (st.hasQuestItems(ALTRANS_NOTE)) { st.takeItems(ALTRANS_NOTE, -1); st.giveItems(BROKEN_SWORD_HANDLE, 1); st.setCond(5, true); @@ -220,10 +178,8 @@ public class Q00101_SwordOfSolidarity extends Quest } break; } - case 5: - { - if (st.hasQuestItems(BROKEN_SWORD_HANDLE)) - { + case 5: { + if (st.hasQuestItems(BROKEN_SWORD_HANDLE)) { htmltext = "30008-07.html"; } break; @@ -231,42 +187,31 @@ public class Q00101_SwordOfSolidarity extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } } break; } - case ALTRAN: - { - switch (st.getCond()) - { - case 1: - { - if (st.hasQuestItems(ROIENS_LETTER)) - { + case ALTRAN: { + switch (st.getCond()) { + case 1: { + if (st.hasQuestItems(ROIENS_LETTER)) { htmltext = "30283-01.html"; } break; } - case 2: - { - if (hasAtLeastOneQuestItem(player, BROKEN_BLADE_BOTTOM, BROKEN_BLADE_TOP)) - { + case 2: { + if (hasAtLeastOneQuestItem(player, BROKEN_BLADE_BOTTOM, BROKEN_BLADE_TOP)) { htmltext = "30283-08.html"; - } - else if (st.hasQuestItems(DIRECTIONS_TO_RUINS)) - { + } else if (st.hasQuestItems(DIRECTIONS_TO_RUINS)) { htmltext = "30283-03.html"; } break; } - case 3: - { - if (st.hasQuestItems(BROKEN_BLADE_BOTTOM, BROKEN_BLADE_TOP)) - { + case 3: { + if (st.hasQuestItems(BROKEN_BLADE_BOTTOM, BROKEN_BLADE_TOP)) { takeItems(player, -1, DIRECTIONS_TO_RUINS, BROKEN_BLADE_TOP, BROKEN_BLADE_BOTTOM); st.giveItems(ALTRANS_NOTE, 1); st.setCond(4, true); @@ -274,18 +219,14 @@ public class Q00101_SwordOfSolidarity extends Quest } break; } - case 4: - { - if (st.hasQuestItems(ALTRANS_NOTE)) - { + case 4: { + if (st.hasQuestItems(ALTRANS_NOTE)) { htmltext = "30283-05.html"; } break; } - case 5: - { - if (st.hasQuestItems(BROKEN_SWORD_HANDLE)) - { + case 5: { + if (st.hasQuestItems(BROKEN_SWORD_HANDLE)) { htmltext = "30283-06.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00102_SeaOfSporesFever/Q00102_SeaOfSporesFever.java b/src/main/java/com/l2jserver/datapack/quests/Q00102_SeaOfSporesFever/Q00102_SeaOfSporesFever.java index 33c74aa66e..5a5e52720a 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00102_SeaOfSporesFever/Q00102_SeaOfSporesFever.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00102_SeaOfSporesFever/Q00102_SeaOfSporesFever.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.model.quest.State; * Sea of Spores Fever (102) * @author xban1x */ -public class Q00102_SeaOfSporesFever extends Quest -{ +public class Q00102_SeaOfSporesFever extends Quest { // NPCs private static final int COBENDELL = 30156; private static final int BERROS = 30217; @@ -68,8 +67,7 @@ public class Q00102_SeaOfSporesFever extends Quest // Misc private static final int MIN_LVL = 12; private static final Map<Integer, Integer> SENTINELS = new HashMap<>(); - static - { + static { SENTINELS.put(GARTRANDELL, COBENDELLS_MEDICINE5); SENTINELS.put(RAYEN, COBENDELLS_MEDICINE4); SENTINELS.put(VELTRESS, COBENDELLS_MEDICINE3); @@ -77,8 +75,7 @@ public class Q00102_SeaOfSporesFever extends Quest SENTINELS.put(ALBERIUS, COBENDELLS_MEDICINE1); } - public Q00102_SeaOfSporesFever() - { + public Q00102_SeaOfSporesFever() { super(102, Q00102_SeaOfSporesFever.class.getSimpleName(), "Sea of Spores Fever"); addStartNpc(ALBERIUS); addTalkId(ALBERIUS, COBENDELL, GARTRANDELL, BERROS, VELTRESS, RAYEN); @@ -87,11 +84,9 @@ public class Q00102_SeaOfSporesFever extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && event.equals("30284-02.htm")) - { + if ((st != null) && event.equals("30284-02.htm")) { st.startQuest(); st.giveItems(ALBERIUS_LETTER, 1); return event; @@ -100,18 +95,13 @@ public class Q00102_SeaOfSporesFever extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isCond(2) && (getRandom(10) < 3)) - { + if ((st != null) && st.isCond(2) && (getRandom(10) < 3)) { st.giveItems(DRYADS_TEAR, 1); - if (st.getQuestItemsCount(DRYADS_TEAR) < 10) - { + if (st.getQuestItemsCount(DRYADS_TEAR) < 10) { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - } - else - { + } else { st.setCond(3, true); } } @@ -119,45 +109,32 @@ public class Q00102_SeaOfSporesFever extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (npc.getId()) - { - case ALBERIUS: - { - switch (st.getState()) - { - case State.CREATED: - { + switch (npc.getId()) { + case ALBERIUS: { + switch (st.getState()) { + case State.CREATED: { htmltext = player.getRace() == Race.ELF ? player.getLevel() >= MIN_LVL ? "30284-07.htm" : "30284-08.htm" : "30284-00.htm"; break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { - if (st.hasQuestItems(ALBERIUS_LETTER)) - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { + if (st.hasQuestItems(ALBERIUS_LETTER)) { htmltext = "30284-03.html"; } break; } - case 2: - { - if (st.hasQuestItems(EVERGREEN_AMULET)) - { + case 2: { + if (st.hasQuestItems(EVERGREEN_AMULET)) { htmltext = "30284-09.html"; } break; } - case 4: - { - if (st.hasQuestItems(COBENDELLS_MEDICINE1)) - { + case 4: { + if (st.hasQuestItems(COBENDELLS_MEDICINE1)) { st.takeItems(COBENDELLS_MEDICINE1, 1); st.giveItems(ALBERIUS_LIST, 1); st.setCond(5); @@ -165,31 +142,24 @@ public class Q00102_SeaOfSporesFever extends Quest } break; } - case 5: - { - if (hasAtLeastOneQuestItem(player, COBENDELLS_MEDICINE1, COBENDELLS_MEDICINE2, COBENDELLS_MEDICINE3, COBENDELLS_MEDICINE4, COBENDELLS_MEDICINE5)) - { + case 5: { + if (hasAtLeastOneQuestItem(player, COBENDELLS_MEDICINE1, COBENDELLS_MEDICINE2, COBENDELLS_MEDICINE3, COBENDELLS_MEDICINE4, COBENDELLS_MEDICINE5)) { htmltext = "30284-05.html"; } break; } - case 6: - { - if (!hasAtLeastOneQuestItem(player, COBENDELLS_MEDICINE1, COBENDELLS_MEDICINE2, COBENDELLS_MEDICINE3, COBENDELLS_MEDICINE4, COBENDELLS_MEDICINE5)) - { + case 6: { + if (!hasAtLeastOneQuestItem(player, COBENDELLS_MEDICINE1, COBENDELLS_MEDICINE2, COBENDELLS_MEDICINE3, COBENDELLS_MEDICINE4, COBENDELLS_MEDICINE5)) { st.giveItems(LESSER_HEALING_POTION, 100); st.giveItems(ECHO_CRYSTAL_THEME_OF_BATTLE, 10); st.giveItems(ECHO_CRYSTAL_THEME_OF_LOVE, 10); st.giveItems(ECHO_CRYSTAL_THEME_OF_SOLITUDE, 10); st.giveItems(ECHO_CRYSTAL_THEME_OF_FEAST, 10); st.giveItems(ECHO_CRYSTAL_THEME_OF_CELEBRATION, 10); - if (player.isMageClass()) - { + if (player.isMageClass()) { st.giveItems(STAFF_OF_SENTINEL, 1); st.giveItems(SPIRITSHOT_NO_GRADE, 500); - } - else - { + } else { st.giveItems(SWORD_OF_SENTINEL, 1); st.giveItems(SOULSHOT_NO_GRADE, 500); } @@ -203,22 +173,17 @@ public class Q00102_SeaOfSporesFever extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } } break; } - case COBENDELL: - { - switch (st.getCond()) - { - case 1: - { - if (st.hasQuestItems(ALBERIUS_LETTER)) - { + case COBENDELL: { + switch (st.getCond()) { + case 1: { + if (st.hasQuestItems(ALBERIUS_LETTER)) { st.takeItems(ALBERIUS_LETTER, 1); st.giveItems(EVERGREEN_AMULET, 1); st.setCond(2, true); @@ -226,18 +191,14 @@ public class Q00102_SeaOfSporesFever extends Quest } break; } - case 2: - { - if (st.hasQuestItems(EVERGREEN_AMULET) && (st.getQuestItemsCount(DRYADS_TEAR) < 10)) - { + case 2: { + if (st.hasQuestItems(EVERGREEN_AMULET) && (st.getQuestItemsCount(DRYADS_TEAR) < 10)) { htmltext = "30156-04.html"; } break; } - case 3: - { - if (st.getQuestItemsCount(DRYADS_TEAR) >= 10) - { + case 3: { + if (st.getQuestItemsCount(DRYADS_TEAR) >= 10) { st.takeItems(EVERGREEN_AMULET, -1); st.takeItems(DRYADS_TEAR, -1); st.giveItems(COBENDELLS_MEDICINE1, 1); @@ -250,18 +211,14 @@ public class Q00102_SeaOfSporesFever extends Quest } break; } - case 4: - { - if (hasAtLeastOneQuestItem(player, COBENDELLS_MEDICINE1, COBENDELLS_MEDICINE2, COBENDELLS_MEDICINE3, COBENDELLS_MEDICINE4, COBENDELLS_MEDICINE5)) - { + case 4: { + if (hasAtLeastOneQuestItem(player, COBENDELLS_MEDICINE1, COBENDELLS_MEDICINE2, COBENDELLS_MEDICINE3, COBENDELLS_MEDICINE4, COBENDELLS_MEDICINE5)) { htmltext = "30156-06.html"; } break; } - case 5: - { - if (hasAtLeastOneQuestItem(player, COBENDELLS_MEDICINE1, COBENDELLS_MEDICINE2, COBENDELLS_MEDICINE3, COBENDELLS_MEDICINE4, COBENDELLS_MEDICINE5)) - { + case 5: { + if (hasAtLeastOneQuestItem(player, COBENDELLS_MEDICINE1, COBENDELLS_MEDICINE2, COBENDELLS_MEDICINE3, COBENDELLS_MEDICINE4, COBENDELLS_MEDICINE5)) { htmltext = "30156-07.html"; } break; @@ -272,13 +229,10 @@ public class Q00102_SeaOfSporesFever extends Quest case GARTRANDELL: case RAYEN: case VELTRESS: - case BERROS: - { - if (st.hasQuestItems(ALBERIUS_LIST, SENTINELS.get(npc.getId()))) - { + case BERROS: { + if (st.hasQuestItems(ALBERIUS_LIST, SENTINELS.get(npc.getId()))) { st.takeItems(SENTINELS.get(npc.getId()), -1); - if (!hasAtLeastOneQuestItem(player, COBENDELLS_MEDICINE1, COBENDELLS_MEDICINE2, COBENDELLS_MEDICINE3, COBENDELLS_MEDICINE4, COBENDELLS_MEDICINE5)) - { + if (!hasAtLeastOneQuestItem(player, COBENDELLS_MEDICINE1, COBENDELLS_MEDICINE2, COBENDELLS_MEDICINE3, COBENDELLS_MEDICINE4, COBENDELLS_MEDICINE5)) { st.setCond(6); } htmltext = npc.getId() + "-01.html"; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00103_SpiritOfCraftsman/Q00103_SpiritOfCraftsman.java b/src/main/java/com/l2jserver/datapack/quests/Q00103_SpiritOfCraftsman/Q00103_SpiritOfCraftsman.java index ea4a5d47d2..97060bfa31 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00103_SpiritOfCraftsman/Q00103_SpiritOfCraftsman.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00103_SpiritOfCraftsman/Q00103_SpiritOfCraftsman.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.util.Util; * Spirit of Craftsman (103) * @author janiko */ -public final class Q00103_SpiritOfCraftsman extends Quest -{ +public final class Q00103_SpiritOfCraftsman extends Quest { // NPCs private static final int BLACKSMITH_KAROYD = 30307; private static final int CECON = 30132; @@ -54,8 +53,7 @@ public final class Q00103_SpiritOfCraftsman extends Quest private static final int SKELETON_HUNTER_ARCHER = 20518; // Rewards private static final int BLOODSABER = 975; - private static final ItemHolder[] REWARDS = - { + private static final ItemHolder[] REWARDS = { new ItemHolder(1060, 100), // Lesser Healing Potion new ItemHolder(4412, 10), // Echo Crystal - Theme of Battle new ItemHolder(4413, 10), // Echo Crystal - Theme of Love @@ -66,8 +64,7 @@ public final class Q00103_SpiritOfCraftsman extends Quest // Misc private static final int MIN_LVL = 10; - public Q00103_SpiritOfCraftsman() - { + public Q00103_SpiritOfCraftsman() { super(103, Q00103_SpiritOfCraftsman.class.getSimpleName(), "Spirit of Craftsman"); addStartNpc(BLACKSMITH_KAROYD); addTalkId(BLACKSMITH_KAROYD, CECON, HARNE); @@ -76,25 +73,19 @@ public final class Q00103_SpiritOfCraftsman extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { - case "30307-04.htm": - { + switch (event) { + case "30307-04.htm": { htmltext = event; break; } - case "30307-05.htm": - { - if (qs.isCreated()) - { + case "30307-05.htm": { + if (qs.isCreated()) { qs.startQuest(); giveItems(player, KAROYDS_LETTER, 1); htmltext = event; @@ -106,42 +97,27 @@ public final class Q00103_SpiritOfCraftsman extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (npc.getId()) - { - case BLACKSMITH_KAROYD: - { - if (qs.isCreated()) - { - if (talker.getRace() != Race.DARK_ELF) - { + switch (npc.getId()) { + case BLACKSMITH_KAROYD: { + if (qs.isCreated()) { + if (talker.getRace() != Race.DARK_ELF) { htmltext = "30307-01.htm"; - } - else if (talker.getLevel() < MIN_LVL) - { + } else if (talker.getLevel() < MIN_LVL) { htmltext = "30307-02.htm"; - } - else - { + } else { htmltext = "30307-03.htm"; } - } - else if (qs.isStarted()) - { - if (hasAtLeastOneQuestItem(talker, KAROYDS_LETTER, CECKTINONS_VOUCHER1, CECKTINONS_VOUCHER2)) - { + } else if (qs.isStarted()) { + if (hasAtLeastOneQuestItem(talker, KAROYDS_LETTER, CECKTINONS_VOUCHER1, CECKTINONS_VOUCHER2)) { htmltext = "30307-06.html"; - } - else if (hasQuestItems(talker, STEELBENDERS_HEAD)) - { + } else if (hasQuestItems(talker, STEELBENDERS_HEAD)) { Q00281_HeadForTheHills.giveNewbieReward(talker); addExpAndSp(talker, 46663, 3999); giveAdena(talker, 19799, true); - for (ItemHolder reward : REWARDS) - { + for (ItemHolder reward : REWARDS) { rewardItems(talker, reward); } rewardItems(talker, BLOODSABER, 1); @@ -149,81 +125,56 @@ public final class Q00103_SpiritOfCraftsman extends Quest talker.sendPacket(new SocialAction(talker.getObjectId(), 3)); htmltext = "30307-07.html"; } - } - else if (qs.isCompleted()) - { + } else if (qs.isCompleted()) { htmltext = getAlreadyCompletedMsg(talker); break; } } - case CECON: - { - if (qs.isStarted()) - { - if (hasQuestItems(talker, KAROYDS_LETTER)) - { + case CECON: { + if (qs.isStarted()) { + if (hasQuestItems(talker, KAROYDS_LETTER)) { qs.setCond(2, true); takeItems(talker, KAROYDS_LETTER, 1); giveItems(talker, CECKTINONS_VOUCHER1, 1); htmltext = "30132-01.html"; - } - else if (hasAtLeastOneQuestItem(talker, CECKTINONS_VOUCHER1, CECKTINONS_VOUCHER2)) - { + } else if (hasAtLeastOneQuestItem(talker, CECKTINONS_VOUCHER1, CECKTINONS_VOUCHER2)) { htmltext = "30132-02.html"; - } - else if (hasQuestItems(talker, SOUL_CATCHER)) - { + } else if (hasQuestItems(talker, SOUL_CATCHER)) { qs.setCond(6, true); takeItems(talker, SOUL_CATCHER, 1); giveItems(talker, PRESERVE_OIL, 1); htmltext = "30132-03.html"; - } - else if (hasQuestItems(talker, PRESERVE_OIL) && !hasQuestItems(talker, ZOMBIE_HEAD, STEELBENDERS_HEAD)) - { + } else if (hasQuestItems(talker, PRESERVE_OIL) && !hasQuestItems(talker, ZOMBIE_HEAD, STEELBENDERS_HEAD)) { htmltext = "30132-04.html"; - } - else if (hasQuestItems(talker, ZOMBIE_HEAD)) - { + } else if (hasQuestItems(talker, ZOMBIE_HEAD)) { qs.setCond(8, true); takeItems(talker, ZOMBIE_HEAD, 1); giveItems(talker, STEELBENDERS_HEAD, 1); htmltext = "30132-05.html"; - } - else if (hasQuestItems(talker, STEELBENDERS_HEAD)) - { + } else if (hasQuestItems(talker, STEELBENDERS_HEAD)) { htmltext = "30132-06.html"; } } break; } - case HARNE: - { - if (qs.isStarted()) - { - if (hasQuestItems(talker, CECKTINONS_VOUCHER1)) - { + case HARNE: { + if (qs.isStarted()) { + if (hasQuestItems(talker, CECKTINONS_VOUCHER1)) { qs.setCond(3, true); takeItems(talker, CECKTINONS_VOUCHER1, 1); giveItems(talker, CECKTINONS_VOUCHER2, 1); htmltext = "30144-01.html"; - } - else if (hasQuestItems(talker, CECKTINONS_VOUCHER2)) - { - if (getQuestItemsCount(talker, BONE_FRAGMENT) >= 10) - { + } else if (hasQuestItems(talker, CECKTINONS_VOUCHER2)) { + if (getQuestItemsCount(talker, BONE_FRAGMENT) >= 10) { qs.setCond(5, true); takeItems(talker, CECKTINONS_VOUCHER2, 1); takeItems(talker, BONE_FRAGMENT, 10); giveItems(talker, SOUL_CATCHER, 1); htmltext = "30144-03.html"; - } - else - { + } else { htmltext = "30144-02.html"; } - } - else if (hasQuestItems(talker, SOUL_CATCHER)) - { + } else if (hasQuestItems(talker, SOUL_CATCHER)) { htmltext = "30144-04.html"; } } @@ -234,20 +185,15 @@ public final class Q00103_SpiritOfCraftsman extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc); - if (qs == null) - { + if (qs == null) { return super.onKill(npc, killer, isSummon); } - switch (npc.getId()) - { - case MARSH_ZOMBIE: - { - if (hasQuestItems(killer, PRESERVE_OIL) && (getRandom(10) < 5) && Util.checkIfInRange(1500, npc, killer, true)) - { + switch (npc.getId()) { + case MARSH_ZOMBIE: { + if (hasQuestItems(killer, PRESERVE_OIL) && (getRandom(10) < 5) && Util.checkIfInRange(1500, npc, killer, true)) { giveItems(killer, ZOMBIE_HEAD, 1); takeItems(killer, PRESERVE_OIL, -1); qs.setCond(7, true); @@ -256,10 +202,8 @@ public final class Q00103_SpiritOfCraftsman extends Quest } case DOOM_SOLDIER: case SKELETON_HUNTER: - case SKELETON_HUNTER_ARCHER: - { - if (hasQuestItems(killer, CECKTINONS_VOUCHER2) && giveItemRandomly(qs.getPlayer(), npc, BONE_FRAGMENT, 1, 10, 1.0, true)) - { + case SKELETON_HUNTER_ARCHER: { + if (hasQuestItems(killer, CECKTINONS_VOUCHER2) && giveItemRandomly(qs.getPlayer(), npc, BONE_FRAGMENT, 1, 10, 1.0, true)) { qs.setCond(4, true); } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00104_SpiritOfMirrors/Q00104_SpiritOfMirrors.java b/src/main/java/com/l2jserver/datapack/quests/Q00104_SpiritOfMirrors/Q00104_SpiritOfMirrors.java index 8c936fcf99..a3587a7813 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00104_SpiritOfMirrors/Q00104_SpiritOfMirrors.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00104_SpiritOfMirrors/Q00104_SpiritOfMirrors.java @@ -36,8 +36,7 @@ import com.l2jserver.gameserver.model.quest.State; * Spirit of Mirrors (104) * @author xban1x */ -public final class Q00104_SpiritOfMirrors extends Quest -{ +public final class Q00104_SpiritOfMirrors extends Quest { // NPCs private static final int GALLINT = 30017; private static final int ARNOLD = 30041; @@ -50,15 +49,13 @@ public final class Q00104_SpiritOfMirrors extends Quest private static final int SPIRITBOUND_WAND3 = 1137; // Monsters private static final Map<Integer, Integer> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(27003, SPIRITBOUND_WAND1); // Spirit Of Mirrors MONSTERS.put(27004, SPIRITBOUND_WAND2); // Spirit Of Mirrors MONSTERS.put(27005, SPIRITBOUND_WAND3); // Spirit Of Mirrors } // Rewards - private static final ItemHolder[] REWARDS = - { + private static final ItemHolder[] REWARDS = { new ItemHolder(1060, 100), // Lesser Healing Potion new ItemHolder(4412, 10), // Echo Crystal - Theme of Battle new ItemHolder(4413, 10), // Echo Crystal - Theme of Love @@ -70,8 +67,7 @@ public final class Q00104_SpiritOfMirrors extends Quest // Misc private static final int MIN_LVL = 10; - public Q00104_SpiritOfMirrors() - { + public Q00104_SpiritOfMirrors() { super(104, Q00104_SpiritOfMirrors.class.getSimpleName(), "Spirit of Mirrors"); addStartNpc(GALLINT); addTalkId(ARNOLD, GALLINT, JOHNSTONE, KENYOS); @@ -80,11 +76,9 @@ public final class Q00104_SpiritOfMirrors extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && event.equalsIgnoreCase("30017-04.htm")) - { + if ((st != null) && event.equalsIgnoreCase("30017-04.htm")) { st.startQuest(); st.giveItems(GALLINTS_OAK_WAND, 3); return event; @@ -93,19 +87,14 @@ public final class Q00104_SpiritOfMirrors extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && (st.isCond(1) || st.isCond(2)) && (st.getItemEquipped(Inventory.PAPERDOLL_RHAND) == GALLINTS_OAK_WAND) && !st.hasQuestItems(MONSTERS.get(npc.getId()))) - { + if ((st != null) && (st.isCond(1) || st.isCond(2)) && (st.getItemEquipped(Inventory.PAPERDOLL_RHAND) == GALLINTS_OAK_WAND) && !st.hasQuestItems(MONSTERS.get(npc.getId()))) { st.takeItems(GALLINTS_OAK_WAND, 1); st.giveItems(MONSTERS.get(npc.getId()), 1); - if (st.hasQuestItems(SPIRITBOUND_WAND1, SPIRITBOUND_WAND2, SPIRITBOUND_WAND3)) - { + if (st.hasQuestItems(SPIRITBOUND_WAND1, SPIRITBOUND_WAND2, SPIRITBOUND_WAND3)) { st.setCond(3, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -113,43 +102,32 @@ public final class Q00104_SpiritOfMirrors extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (npc.getId()) - { - case GALLINT: - { - switch (st.getState()) - { - case State.CREATED: - { + switch (npc.getId()) { + case GALLINT: { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getRace() == Race.HUMAN) ? (player.getLevel() >= MIN_LVL) ? "30017-03.htm" : "30017-02.htm" : "30017-01.htm"; break; } - case State.STARTED: - { - if (st.isCond(3) && st.hasQuestItems(SPIRITBOUND_WAND1, SPIRITBOUND_WAND2, SPIRITBOUND_WAND3)) - { + case State.STARTED: { + if (st.isCond(3) && st.hasQuestItems(SPIRITBOUND_WAND1, SPIRITBOUND_WAND2, SPIRITBOUND_WAND3)) { Q00281_HeadForTheHills.giveNewbieReward(player); - for (ItemHolder reward : REWARDS) - { + for (ItemHolder reward : REWARDS) { st.giveItems(reward); } st.addExpAndSp(39750, 3407); st.giveAdena(16866, true); st.exitQuest(false, true); htmltext = "30017-06.html"; - } - else - { + } else { htmltext = "30017-05.html"; } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } @@ -158,16 +136,12 @@ public final class Q00104_SpiritOfMirrors extends Quest } case ARNOLD: case JOHNSTONE: - case KENYOS: - { - if (st.isCond(1)) - { - if (!st.isSet(npc.getName())) - { + case KENYOS: { + if (st.isCond(1)) { + if (!st.isSet(npc.getName())) { st.set(npc.getName(), "1"); } - if (st.isSet("Arnold") && st.isSet("Johnstone") && st.isSet("Kenyos")) - { + if (st.isSet("Arnold") && st.isSet("Johnstone") && st.isSet("Kenyos")) { st.setCond(2, true); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00105_SkirmishWithOrcs/Q00105_SkirmishWithOrcs.java b/src/main/java/com/l2jserver/datapack/quests/Q00105_SkirmishWithOrcs/Q00105_SkirmishWithOrcs.java index 1c9dff802d..d8dedfc556 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00105_SkirmishWithOrcs/Q00105_SkirmishWithOrcs.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00105_SkirmishWithOrcs/Q00105_SkirmishWithOrcs.java @@ -35,8 +35,7 @@ import com.l2jserver.gameserver.util.Util; * Skimirish with Orcs (105) * @author janiko */ -public final class Q00105_SkirmishWithOrcs extends Quest -{ +public final class Q00105_SkirmishWithOrcs extends Quest { // NPC private static final int KENDNELL = 30218; // Items @@ -51,8 +50,7 @@ public final class Q00105_SkirmishWithOrcs extends Quest private static final int KABOO_CHIEFS_1ST_TORQUE = 1844; private static final int KABOO_CHIEFS_2ST_TORQUE = 1845; private static final Map<Integer, Integer> MONSTER_DROP = new HashMap<>(); - static - { + static { MONSTER_DROP.put(27059, KENDELLS_1ST_ORDER); // Uoph (Kaboo Chief) MONSTER_DROP.put(27060, KENDELLS_2ND_ORDER); // Kracha (Kaboo Chief) MONSTER_DROP.put(27061, KENDELLS_3RD_ORDER); // Batoh (Kaboo Chief) @@ -62,8 +60,7 @@ public final class Q00105_SkirmishWithOrcs extends Quest MONSTER_DROP.put(27067, KENDELLS_7TH_ORDER); // Kamut (Kaboo Chief) MONSTER_DROP.put(27068, KENDELLS_8TH_ORDER); // Murtika (Kaboo Chief) } - private static final int[] KENDNELLS_ORDERS = - { + private static final int[] KENDNELLS_ORDERS = { KENDELLS_1ST_ORDER, KENDELLS_2ND_ORDER, KENDELLS_3RD_ORDER, @@ -76,8 +73,7 @@ public final class Q00105_SkirmishWithOrcs extends Quest // Misc private static final int MIN_LVL = 10; - public Q00105_SkirmishWithOrcs() - { + public Q00105_SkirmishWithOrcs() { super(105, Q00105_SkirmishWithOrcs.class.getSimpleName(), "Skirmish with Orcs"); addStartNpc(KENDNELL); addTalkId(KENDNELL); @@ -86,28 +82,22 @@ public final class Q00105_SkirmishWithOrcs extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { - case "30218-04.html": - { - if (st.isCreated()) - { + switch (event) { + case "30218-04.html": { + if (st.isCreated()) { st.startQuest(); st.giveItems(KENDNELLS_ORDERS[getRandom(0, 3)], 1); htmltext = event; } break; } - case "30218-05.html": - { + case "30218-05.html": { htmltext = event; break; } @@ -116,20 +106,15 @@ public final class Q00105_SkirmishWithOrcs extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { + if ((st != null) && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { case 27059: case 27060: case 27061: - case 27062: - { - if (st.isCond(1) && st.hasQuestItems(MONSTER_DROP.get(npc.getId()))) - { + case 27062: { + if (st.isCond(1) && st.hasQuestItems(MONSTER_DROP.get(npc.getId()))) { st.giveItems(KABOO_CHIEFS_1ST_TORQUE, 1); st.setCond(2, true); } @@ -138,10 +123,8 @@ public final class Q00105_SkirmishWithOrcs extends Quest case 27064: case 27065: case 27067: - case 27068: - { - if (st.isCond(3) && st.hasQuestItems(MONSTER_DROP.get(npc.getId()))) - { + case 27068: { + if (st.isCond(3) && st.hasQuestItems(MONSTER_DROP.get(npc.getId()))) { st.giveItems(KABOO_CHIEFS_2ST_TORQUE, 1); st.setCond(4, true); } @@ -153,34 +136,24 @@ public final class Q00105_SkirmishWithOrcs extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState st = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (st.getState()) - { - case State.CREATED: - { - if (talker.getRace() == Race.ELF) - { + switch (st.getState()) { + case State.CREATED: { + if (talker.getRace() == Race.ELF) { htmltext = (talker.getLevel() >= MIN_LVL) ? "30218-03.htm" : "30218-02.htm"; - } - else - { + } else { htmltext = "30218-01.htm"; } break; } - case State.STARTED: - { - if (hasAtLeastOneQuestItem(talker, KENDELLS_1ST_ORDER, KENDELLS_2ND_ORDER, KENDELLS_3RD_ORDER, KENDELLS_4TH_ORDER)) - { + case State.STARTED: { + if (hasAtLeastOneQuestItem(talker, KENDELLS_1ST_ORDER, KENDELLS_2ND_ORDER, KENDELLS_3RD_ORDER, KENDELLS_4TH_ORDER)) { htmltext = "30218-06.html"; } - if (st.isCond(2) && st.hasQuestItems(KABOO_CHIEFS_1ST_TORQUE)) - { - for (int i = 0; i < 4; i++) - { + if (st.isCond(2) && st.hasQuestItems(KABOO_CHIEFS_1ST_TORQUE)) { + for (int i = 0; i < 4; i++) { st.takeItems(KENDNELLS_ORDERS[i], -1); } st.takeItems(KABOO_CHIEFS_1ST_TORQUE, 1); @@ -188,12 +161,10 @@ public final class Q00105_SkirmishWithOrcs extends Quest st.setCond(3, true); htmltext = "30218-07.html"; } - if (hasAtLeastOneQuestItem(talker, KENDELLS_5TH_ORDER, KENDELLS_6TH_ORDER, KENDELLS_7TH_ORDER, KENDELLS_8TH_ORDER)) - { + if (hasAtLeastOneQuestItem(talker, KENDELLS_5TH_ORDER, KENDELLS_6TH_ORDER, KENDELLS_7TH_ORDER, KENDELLS_8TH_ORDER)) { htmltext = "30218-08.html"; } - if (st.isCond(4) && st.hasQuestItems(KABOO_CHIEFS_2ST_TORQUE)) - { + if (st.isCond(4) && st.hasQuestItems(KABOO_CHIEFS_2ST_TORQUE)) { Q00281_HeadForTheHills.giveNewbieReward(talker); talker.sendPacket(new SocialAction(talker.getObjectId(), 3)); st.giveAdena(17599, true); @@ -203,8 +174,7 @@ public final class Q00105_SkirmishWithOrcs extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(talker); break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00106_ForgottenTruth/Q00106_ForgottenTruth.java b/src/main/java/com/l2jserver/datapack/quests/Q00106_ForgottenTruth/Q00106_ForgottenTruth.java index f55156125d..70fad21daf 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00106_ForgottenTruth/Q00106_ForgottenTruth.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00106_ForgottenTruth/Q00106_ForgottenTruth.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.util.Util; * Forgotten Truth (106) * @author janiko */ -public final class Q00106_ForgottenTruth extends Quest -{ +public final class Q00106_ForgottenTruth extends Quest { // NPCs private static final int THIFIELL = 30358; private static final int KARTA = 30133; @@ -49,8 +48,7 @@ public final class Q00106_ForgottenTruth extends Quest // Misc private static final int MIN_LVL = 10; - public Q00106_ForgottenTruth() - { + public Q00106_ForgottenTruth() { super(106, Q00106_ForgottenTruth.class.getSimpleName(), "Forgotten Truth"); addStartNpc(THIFIELL); addTalkId(THIFIELL, KARTA); @@ -59,25 +57,19 @@ public final class Q00106_ForgottenTruth extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { - case "30358-04.htm": - { + switch (event) { + case "30358-04.htm": { htmltext = event; break; } - case "30358-05.htm": - { - if (st.isCreated()) - { + case "30358-05.htm": { + if (st.isCreated()) { st.startQuest(); st.giveItems(ONYX_TALISMAN1, 1); htmltext = event; @@ -89,20 +81,14 @@ public final class Q00106_ForgottenTruth extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isCond(2) && Util.checkIfInRange(1500, npc, killer, true)) - { - if ((getRandom(100) < 20) && st.hasQuestItems(ONYX_TALISMAN2)) - { - if (!st.hasQuestItems(ANCIENT_SCROLL)) - { + if ((st != null) && st.isCond(2) && Util.checkIfInRange(1500, npc, killer, true)) { + if ((getRandom(100) < 20) && st.hasQuestItems(ONYX_TALISMAN2)) { + if (!st.hasQuestItems(ANCIENT_SCROLL)) { st.giveItems(ANCIENT_SCROLL, 1); st.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); - } - else if (!st.hasQuestItems(ANCIENT_CLAY_TABLET)) - { + } else if (!st.hasQuestItems(ANCIENT_CLAY_TABLET)) { st.setCond(3, true); st.giveItems(ANCIENT_CLAY_TABLET, 1); } @@ -112,36 +98,24 @@ public final class Q00106_ForgottenTruth extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState st = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (npc.getId()) - { - case THIFIELL: - { - switch (st.getState()) - { - case State.CREATED: - { - if (talker.getRace() == Race.DARK_ELF) - { + switch (npc.getId()) { + case THIFIELL: { + switch (st.getState()) { + case State.CREATED: { + if (talker.getRace() == Race.DARK_ELF) { htmltext = talker.getLevel() >= MIN_LVL ? "30358-03.htm" : "30358-02.htm"; - } - else - { + } else { htmltext = "30358-01.htm"; } break; } - case State.STARTED: - { - if (hasAtLeastOneQuestItem(talker, ONYX_TALISMAN1, ONYX_TALISMAN2) && !st.hasQuestItems(KARTAS_TRANSLATION)) - { + case State.STARTED: { + if (hasAtLeastOneQuestItem(talker, ONYX_TALISMAN1, ONYX_TALISMAN2) && !st.hasQuestItems(KARTAS_TRANSLATION)) { htmltext = "30358-06.html"; - } - else if (st.isCond(4) && st.hasQuestItems(KARTAS_TRANSLATION)) - { + } else if (st.isCond(4) && st.hasQuestItems(KARTAS_TRANSLATION)) { Q00281_HeadForTheHills.giveNewbieReward(talker); talker.sendPacket(new SocialAction(talker.getObjectId(), 3)); st.giveAdena(10266, true); @@ -151,24 +125,18 @@ public final class Q00106_ForgottenTruth extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(talker); break; } } break; } - case KARTA: - { - if (st.isStarted()) - { - switch (st.getCond()) - { - case 1: - { - if (st.hasQuestItems(ONYX_TALISMAN1)) - { + case KARTA: { + if (st.isStarted()) { + switch (st.getCond()) { + case 1: { + if (st.hasQuestItems(ONYX_TALISMAN1)) { st.setCond(2, true); st.takeItems(ONYX_TALISMAN1, -1); st.giveItems(ONYX_TALISMAN2, 1); @@ -176,18 +144,14 @@ public final class Q00106_ForgottenTruth extends Quest } break; } - case 2: - { - if (st.hasQuestItems(ONYX_TALISMAN2)) - { + case 2: { + if (st.hasQuestItems(ONYX_TALISMAN2)) { htmltext = "30133-02.html"; } break; } - case 3: - { - if (st.hasQuestItems(ANCIENT_SCROLL, ANCIENT_CLAY_TABLET)) - { + case 3: { + if (st.hasQuestItems(ANCIENT_SCROLL, ANCIENT_CLAY_TABLET)) { st.setCond(4, true); takeItems(talker, -1, ANCIENT_SCROLL, ANCIENT_CLAY_TABLET, ONYX_TALISMAN2); st.giveItems(KARTAS_TRANSLATION, 1); @@ -195,10 +159,8 @@ public final class Q00106_ForgottenTruth extends Quest } break; } - case 4: - { - if (st.hasQuestItems(KARTAS_TRANSLATION)) - { + case 4: { + if (st.hasQuestItems(KARTAS_TRANSLATION)) { htmltext = "30133-04.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00107_MercilessPunishment/Q00107_MercilessPunishment.java b/src/main/java/com/l2jserver/datapack/quests/Q00107_MercilessPunishment/Q00107_MercilessPunishment.java index 49cee302a6..e1528be48f 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00107_MercilessPunishment/Q00107_MercilessPunishment.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00107_MercilessPunishment/Q00107_MercilessPunishment.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.util.Util; * Merciless Punishment (107) * @author janiko */ -public final class Q00107_MercilessPunishment extends Quest -{ +public final class Q00107_MercilessPunishment extends Quest { // Npc private static final int URUTU_CHIEF_HATOS = 30568; private static final int CENTURION_PARUGON = 30580; @@ -50,8 +49,7 @@ public final class Q00107_MercilessPunishment extends Quest private static final int BARANKA_MESSENGER = 27041; // Rewards private static final int BUTCHER = 1510; - private static final ItemHolder[] REWARDS = - { + private static final ItemHolder[] REWARDS = { new ItemHolder(1060, 100), // Lesser Healing Potion new ItemHolder(4412, 10), // Echo Crystal - Theme of Battle new ItemHolder(4413, 10), // Echo Crystal - Theme of Love @@ -62,8 +60,7 @@ public final class Q00107_MercilessPunishment extends Quest // Misc private static final int MIN_LVL = 10; - public Q00107_MercilessPunishment() - { + public Q00107_MercilessPunishment() { super(107, Q00107_MercilessPunishment.class.getSimpleName(), "Merciless Punishment"); addStartNpc(URUTU_CHIEF_HATOS); addTalkId(URUTU_CHIEF_HATOS, CENTURION_PARUGON); @@ -72,38 +69,30 @@ public final class Q00107_MercilessPunishment extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { - case "30568-04.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "30568-04.htm": { + if (qs.isCreated()) { qs.startQuest(); giveItems(player, HATOSS_ORDER_1, 1); htmltext = event; } break; } - case "30568-07.html": - { + case "30568-07.html": { giveAdena(player, 200, true); playSound(player, Sound.ITEMSOUND_QUEST_GIVEUP); qs.exitQuest(true); htmltext = event; break; } - case "30568-08.html": - { - if (qs.isCond(3) && hasQuestItems(player, HATOSS_ORDER_1)) - { + case "30568-08.html": { + if (qs.isCond(3) && hasQuestItems(player, HATOSS_ORDER_1)) { qs.setCond(4); takeItems(player, HATOSS_ORDER_1, -1); giveItems(player, HATOSS_ORDER_2, 1); @@ -111,10 +100,8 @@ public final class Q00107_MercilessPunishment extends Quest } break; } - case "30568-10.html": - { - if (qs.isCond(5) && hasQuestItems(player, HATOSS_ORDER_2)) - { + case "30568-10.html": { + if (qs.isCond(5) && hasQuestItems(player, HATOSS_ORDER_2)) { qs.setCond(6); takeItems(player, HATOSS_ORDER_2, -1); giveItems(player, HATOSS_ORDER_3, 1); @@ -127,86 +114,61 @@ public final class Q00107_MercilessPunishment extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (npc.getId()) - { - case URUTU_CHIEF_HATOS: - { - switch (qs.getState()) - { - case State.CREATED: - { - if (talker.getRace() != Race.ORC) - { + switch (npc.getId()) { + case URUTU_CHIEF_HATOS: { + switch (qs.getState()) { + case State.CREATED: { + if (talker.getRace() != Race.ORC) { htmltext = "30568-01.htm"; - } - else if (talker.getLevel() < MIN_LVL) - { + } else if (talker.getLevel() < MIN_LVL) { htmltext = "30568-02.htm"; - } - else - { + } else { htmltext = "30568-03.htm"; } break; } - case State.STARTED: - { - switch (qs.getCond()) - { + case State.STARTED: { + switch (qs.getCond()) { case 1: - case 2: - { - if (hasQuestItems(talker, HATOSS_ORDER_1)) - { + case 2: { + if (hasQuestItems(talker, HATOSS_ORDER_1)) { htmltext = "30568-05.html"; } break; } - case 3: - { - if (hasQuestItems(talker, HATOSS_ORDER_1, LETTER_TO_HUMAN)) - { + case 3: { + if (hasQuestItems(talker, HATOSS_ORDER_1, LETTER_TO_HUMAN)) { htmltext = "30568-06.html"; } break; } - case 4: - { - if (hasQuestItems(talker, HATOSS_ORDER_2, LETTER_TO_HUMAN)) - { + case 4: { + if (hasQuestItems(talker, HATOSS_ORDER_2, LETTER_TO_HUMAN)) { htmltext = "30568-08.html"; } break; } - case 5: - { - if (hasQuestItems(talker, HATOSS_ORDER_2, LETTER_TO_HUMAN, LETTER_TO_DARK_ELF)) - { + case 5: { + if (hasQuestItems(talker, HATOSS_ORDER_2, LETTER_TO_HUMAN, LETTER_TO_DARK_ELF)) { htmltext = "30568-09.html"; } break; } - case 6: - { - if (hasQuestItems(talker, HATOSS_ORDER_3, LETTER_TO_HUMAN, LETTER_TO_DARK_ELF)) - { + case 6: { + if (hasQuestItems(talker, HATOSS_ORDER_3, LETTER_TO_HUMAN, LETTER_TO_DARK_ELF)) { htmltext = "30568-10.html"; } break; } - case 7: - { - if (hasQuestItems(talker, HATOSS_ORDER_3, LETTER_TO_HUMAN, LETTER_TO_DARK_ELF, LETTER_TO_ELF)) - { + case 7: { + if (hasQuestItems(talker, HATOSS_ORDER_3, LETTER_TO_HUMAN, LETTER_TO_DARK_ELF, LETTER_TO_ELF)) { Q00281_HeadForTheHills.giveNewbieReward(talker); addExpAndSp(talker, 34565, 2962); giveAdena(talker, 14666, true); - for (ItemHolder reward : REWARDS) - { + for (ItemHolder reward : REWARDS) { giveItems(talker, reward); } giveItems(talker, BUTCHER, 1); @@ -219,20 +181,16 @@ public final class Q00107_MercilessPunishment extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(talker); break; } } break; } - case CENTURION_PARUGON: - { - if (qs.isStarted()) - { - if (qs.isCond(1) && hasQuestItems(talker, HATOSS_ORDER_1)) - { + case CENTURION_PARUGON: { + if (qs.isStarted()) { + if (qs.isCond(1) && hasQuestItems(talker, HATOSS_ORDER_1)) { qs.setCond(2, true); htmltext = "30580-01.html"; } @@ -244,35 +202,26 @@ public final class Q00107_MercilessPunishment extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (qs.getCond()) - { - case 2: - { - if (hasQuestItems(killer, HATOSS_ORDER_1)) - { + if ((qs != null) && Util.checkIfInRange(1500, npc, killer, true)) { + switch (qs.getCond()) { + case 2: { + if (hasQuestItems(killer, HATOSS_ORDER_1)) { giveItems(killer, LETTER_TO_HUMAN, 1); qs.setCond(3, true); } break; } - case 4: - { - if (hasQuestItems(killer, HATOSS_ORDER_2)) - { + case 4: { + if (hasQuestItems(killer, HATOSS_ORDER_2)) { giveItems(killer, LETTER_TO_DARK_ELF, 1); qs.setCond(5, true); } break; } - case 6: - { - if (hasQuestItems(killer, HATOSS_ORDER_3)) - { + case 6: { + if (hasQuestItems(killer, HATOSS_ORDER_3)) { giveItems(killer, LETTER_TO_ELF, 1); qs.setCond(7, true); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00108_JumbleTumbleDiamondFuss/Q00108_JumbleTumbleDiamondFuss.java b/src/main/java/com/l2jserver/datapack/quests/Q00108_JumbleTumbleDiamondFuss/Q00108_JumbleTumbleDiamondFuss.java index de5f09c83f..8612366d7e 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00108_JumbleTumbleDiamondFuss/Q00108_JumbleTumbleDiamondFuss.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00108_JumbleTumbleDiamondFuss/Q00108_JumbleTumbleDiamondFuss.java @@ -37,8 +37,7 @@ import com.l2jserver.gameserver.util.Util; * Jumble, Tumble, Diamond Fuss (108) * @author Janiko */ -public final class Q00108_JumbleTumbleDiamondFuss extends Quest -{ +public final class Q00108_JumbleTumbleDiamondFuss extends Quest { // NPCs private static final int COLLECTOR_GOUPH = 30523; private static final int TRADER_REEP = 30516; @@ -66,8 +65,7 @@ public final class Q00108_JumbleTumbleDiamondFuss extends Quest private static final int BAT_DIAGRAM = 1570; private static final int STAR_DIAMOND = 1571; // Rewards - private static final ItemHolder[] REWARDS = - { + private static final ItemHolder[] REWARDS = { new ItemHolder(1060, 100), // Lesser Healing Potion new ItemHolder(4412, 10), // Echo Crystal - Theme of Battle new ItemHolder(4413, 10), // Echo Crystal - Theme of Love @@ -80,14 +78,12 @@ public final class Q00108_JumbleTumbleDiamondFuss extends Quest private static final int MIN_LVL = 10; private static final int MAX_GEM_COUNT = 10; private static final Map<Integer, Double> GOBLIN_DROP_CHANCES = new HashMap<>(); - static - { + static { GOBLIN_DROP_CHANCES.put(GOBLIN_BRIGAND_LEADER, 0.8); GOBLIN_DROP_CHANCES.put(GOBLIN_BRIGAND_LIEUTENANT, 0.6); } - public Q00108_JumbleTumbleDiamondFuss() - { + public Q00108_JumbleTumbleDiamondFuss() { super(108, Q00108_JumbleTumbleDiamondFuss.class.getSimpleName(), "Jumble, Tumble, Diamond Fuss"); addStartNpc(COLLECTOR_GOUPH); addTalkId(COLLECTOR_GOUPH, TRADER_REEP, CARRIER_TOROCCO, MINER_MARON, BLACKSMITH_BRUNON, WAREHOUSE_KEEPER_MURDOC, WAREHOUSE_KEEPER_AIRY); @@ -96,30 +92,23 @@ public final class Q00108_JumbleTumbleDiamondFuss extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { - case "30523-04.htm": - { - if (st.isCreated()) - { + switch (event) { + case "30523-04.htm": { + if (st.isCreated()) { st.startQuest(); st.giveItems(GOUPHS_CONTRACT, 1); htmltext = event; } break; } - case "30555-02.html": - { - if (st.isCond(2) && st.hasQuestItems(REEPS_CONTRACT)) - { + case "30555-02.html": { + if (st.isCond(2) && st.hasQuestItems(REEPS_CONTRACT)) { st.takeItems(REEPS_CONTRACT, -1); st.giveItems(ELVEN_WINE, 1); st.setCond(3, true); @@ -127,10 +116,8 @@ public final class Q00108_JumbleTumbleDiamondFuss extends Quest } break; } - case "30526-02.html": - { - if (st.isCond(4) && st.hasQuestItems(BRUNONS_DICE)) - { + case "30526-02.html": { + if (st.isCond(4) && st.hasQuestItems(BRUNONS_DICE)) { st.takeItems(BRUNONS_DICE, -1); st.giveItems(BRUNONS_CONTRACT, 1); st.setCond(5, true); @@ -143,40 +130,26 @@ public final class Q00108_JumbleTumbleDiamondFuss extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState st = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (npc.getId()) - { - case COLLECTOR_GOUPH: - { - switch (st.getState()) - { - case State.CREATED: - { - if (talker.getRace() != Race.DWARF) - { + switch (npc.getId()) { + case COLLECTOR_GOUPH: { + switch (st.getState()) { + case State.CREATED: { + if (talker.getRace() != Race.DWARF) { htmltext = "30523-01.htm"; - } - else if (talker.getLevel() < MIN_LVL) - { + } else if (talker.getLevel() < MIN_LVL) { htmltext = "30523-02.htm"; - } - else - { + } else { htmltext = "30523-03.htm"; } break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { - if (st.hasQuestItems(GOUPHS_CONTRACT)) - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { + if (st.hasQuestItems(GOUPHS_CONTRACT)) { htmltext = "30523-05.html"; } break; @@ -185,18 +158,14 @@ public final class Q00108_JumbleTumbleDiamondFuss extends Quest case 3: case 4: case 5: - case 6: - { - if (hasAtLeastOneQuestItem(talker, REEPS_CONTRACT, ELVEN_WINE, BRUNONS_DICE, BRUNONS_CONTRACT)) - { + case 6: { + if (hasAtLeastOneQuestItem(talker, REEPS_CONTRACT, ELVEN_WINE, BRUNONS_DICE, BRUNONS_CONTRACT)) { htmltext = "30523-06.html"; } break; } - case 7: - { - if (st.hasQuestItems(GEM_BOX)) - { + case 7: { + if (st.hasQuestItems(GEM_BOX)) { st.takeItems(GEM_BOX, -1); st.giveItems(COAL_PIECE, 1); st.setCond(8, true); @@ -207,23 +176,18 @@ public final class Q00108_JumbleTumbleDiamondFuss extends Quest case 8: case 9: case 10: - case 11: - { - if (hasAtLeastOneQuestItem(talker, COAL_PIECE, BRUNONS_LETTER, BERRY_TART, BAT_DIAGRAM)) - { + case 11: { + if (hasAtLeastOneQuestItem(talker, COAL_PIECE, BRUNONS_LETTER, BERRY_TART, BAT_DIAGRAM)) { htmltext = "30523-08.html"; } break; } - case 12: - { - if (st.hasQuestItems(STAR_DIAMOND)) - { + case 12: { + if (st.hasQuestItems(STAR_DIAMOND)) { Q00281_HeadForTheHills.giveNewbieReward(talker); st.addExpAndSp(34565, 2962); st.giveAdena(14666, true); - for (ItemHolder reward : REWARDS) - { + for (ItemHolder reward : REWARDS) { st.giveItems(reward); } st.giveItems(SILVERSMITH_HAMMER, 1); @@ -237,22 +201,17 @@ public final class Q00108_JumbleTumbleDiamondFuss extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(talker); break; } } break; } - case TRADER_REEP: - { - switch (st.getCond()) - { - case 1: - { - if (st.hasQuestItems(GOUPHS_CONTRACT)) - { + case TRADER_REEP: { + switch (st.getCond()) { + case 1: { + if (st.hasQuestItems(GOUPHS_CONTRACT)) { st.takeItems(GOUPHS_CONTRACT, -1); st.giveItems(REEPS_CONTRACT, 1); st.setCond(2, true); @@ -260,18 +219,14 @@ public final class Q00108_JumbleTumbleDiamondFuss extends Quest } break; } - case 2: - { - if (st.hasQuestItems(REEPS_CONTRACT)) - { + case 2: { + if (st.hasQuestItems(REEPS_CONTRACT)) { htmltext = "30516-02.html"; } break; } - default: - { - if (st.getCond() > 2) - { + default: { + if (st.getCond() > 2) { htmltext = "30516-02.html"; } break; @@ -279,38 +234,28 @@ public final class Q00108_JumbleTumbleDiamondFuss extends Quest } break; } - case CARRIER_TOROCCO: - { - switch (st.getCond()) - { - case 2: - { - if (st.hasQuestItems(REEPS_CONTRACT)) - { + case CARRIER_TOROCCO: { + switch (st.getCond()) { + case 2: { + if (st.hasQuestItems(REEPS_CONTRACT)) { htmltext = "30555-01.html"; } break; } - case 3: - { - if (st.hasQuestItems(ELVEN_WINE)) - { + case 3: { + if (st.hasQuestItems(ELVEN_WINE)) { htmltext = "30555-03.html"; } break; } - case 7: - { - if (st.hasQuestItems(GEM_BOX)) - { + case 7: { + if (st.hasQuestItems(GEM_BOX)) { htmltext = "30555-04.html"; } break; } - default: - { - if (st.isStarted()) - { + default: { + if (st.isStarted()) { htmltext = "30555-05.html"; } break; @@ -318,14 +263,10 @@ public final class Q00108_JumbleTumbleDiamondFuss extends Quest } break; } - case MINER_MARON: - { - switch (st.getCond()) - { - case 3: - { - if (st.hasQuestItems(ELVEN_WINE)) - { + case MINER_MARON: { + switch (st.getCond()) { + case 3: { + if (st.hasQuestItems(ELVEN_WINE)) { st.takeItems(ELVEN_WINE, -1); st.giveItems(BRUNONS_DICE, 1); st.setCond(4, true); @@ -333,18 +274,14 @@ public final class Q00108_JumbleTumbleDiamondFuss extends Quest } break; } - case 4: - { - if (st.hasQuestItems(BRUNONS_DICE)) - { + case 4: { + if (st.hasQuestItems(BRUNONS_DICE)) { htmltext = "30529-02.html"; } break; } - default: - { - if (st.getCond() > 4) - { + default: { + if (st.getCond() > 4) { htmltext = "30529-03.html"; } break; @@ -352,30 +289,22 @@ public final class Q00108_JumbleTumbleDiamondFuss extends Quest } break; } - case BLACKSMITH_BRUNON: - { - switch (st.getCond()) - { - case 4: - { - if (st.hasQuestItems(BRUNONS_DICE)) - { + case BLACKSMITH_BRUNON: { + switch (st.getCond()) { + case 4: { + if (st.hasQuestItems(BRUNONS_DICE)) { htmltext = "30526-01.html"; } break; } - case 5: - { - if (st.hasQuestItems(BRUNONS_CONTRACT)) - { + case 5: { + if (st.hasQuestItems(BRUNONS_CONTRACT)) { htmltext = "30526-03.html"; } break; } - case 6: - { - if (st.hasQuestItems(BRUNONS_CONTRACT) && (st.getQuestItemsCount(AQUAMARINE) >= MAX_GEM_COUNT) && (st.getQuestItemsCount(CHRYSOBERYL) >= MAX_GEM_COUNT)) - { + case 6: { + if (st.hasQuestItems(BRUNONS_CONTRACT) && (st.getQuestItemsCount(AQUAMARINE) >= MAX_GEM_COUNT) && (st.getQuestItemsCount(CHRYSOBERYL) >= MAX_GEM_COUNT)) { takeItems(talker, -1, BRUNONS_CONTRACT, AQUAMARINE, CHRYSOBERYL); st.giveItems(GEM_BOX, 1); st.setCond(7, true); @@ -383,18 +312,14 @@ public final class Q00108_JumbleTumbleDiamondFuss extends Quest } break; } - case 7: - { - if (st.hasQuestItems(GEM_BOX)) - { + case 7: { + if (st.hasQuestItems(GEM_BOX)) { htmltext = "30526-05.html"; } break; } - case 8: - { - if (st.hasQuestItems(COAL_PIECE)) - { + case 8: { + if (st.hasQuestItems(COAL_PIECE)) { st.takeItems(COAL_PIECE, -1); st.giveItems(BRUNONS_LETTER, 1); st.setCond(9, true); @@ -402,20 +327,16 @@ public final class Q00108_JumbleTumbleDiamondFuss extends Quest } break; } - case 9: - { - if (st.hasQuestItems(BRUNONS_LETTER)) - { + case 9: { + if (st.hasQuestItems(BRUNONS_LETTER)) { htmltext = "30526-07.html"; } break; } case 10: case 11: - case 12: - { - if (hasAtLeastOneQuestItem(talker, BERRY_TART, BAT_DIAGRAM, STAR_DIAMOND)) - { + case 12: { + if (hasAtLeastOneQuestItem(talker, BERRY_TART, BAT_DIAGRAM, STAR_DIAMOND)) { htmltext = "30526-08.html"; } break; @@ -423,14 +344,10 @@ public final class Q00108_JumbleTumbleDiamondFuss extends Quest } break; } - case WAREHOUSE_KEEPER_MURDOC: - { - switch (st.getCond()) - { - case 9: - { - if (st.hasQuestItems(BRUNONS_LETTER)) - { + case WAREHOUSE_KEEPER_MURDOC: { + switch (st.getCond()) { + case 9: { + if (st.hasQuestItems(BRUNONS_LETTER)) { st.takeItems(BRUNONS_LETTER, -1); st.giveItems(BERRY_TART, 1); st.setCond(10, true); @@ -438,31 +355,24 @@ public final class Q00108_JumbleTumbleDiamondFuss extends Quest } break; } - case 10: - { - if (st.hasQuestItems(BERRY_TART)) - { + case 10: { + if (st.hasQuestItems(BERRY_TART)) { htmltext = "30521-02.html"; } break; } case 11: - case 12: - { + case 12: { htmltext = "30521-03.html"; break; } } break; } - case WAREHOUSE_KEEPER_AIRY: - { - switch (st.getCond()) - { - case 10: - { - if (st.hasQuestItems(BERRY_TART)) - { + case WAREHOUSE_KEEPER_AIRY: { + switch (st.getCond()) { + case 10: { + if (st.hasQuestItems(BERRY_TART)) { st.takeItems(BERRY_TART, -1); st.giveItems(BAT_DIAGRAM, 1); st.setCond(11, true); @@ -470,26 +380,20 @@ public final class Q00108_JumbleTumbleDiamondFuss extends Quest } break; } - case 11: - { - if (st.hasQuestItems(BAT_DIAGRAM)) - { + case 11: { + if (st.hasQuestItems(BAT_DIAGRAM)) { htmltext = "30522-02.html"; } break; } - case 12: - { - if (st.hasQuestItems(STAR_DIAMOND)) - { + case 12: { + if (st.hasQuestItems(STAR_DIAMOND)) { htmltext = "30522-03.html"; } break; } - default: - { - if (st.isStarted()) - { + default: { + if (st.isStarted()) { htmltext = "30522-04.html"; } break; @@ -502,34 +406,25 @@ public final class Q00108_JumbleTumbleDiamondFuss extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { + if ((st != null) && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { case GOBLIN_BRIGAND_LEADER: - case GOBLIN_BRIGAND_LIEUTENANT: - { - if (st.isCond(5) && st.hasQuestItems(BRUNONS_CONTRACT)) - { + case GOBLIN_BRIGAND_LIEUTENANT: { + if (st.isCond(5) && st.hasQuestItems(BRUNONS_CONTRACT)) { final double dropChance = GOBLIN_DROP_CHANCES.get(npc.getId()); boolean playSound = false; - if (st.giveItemRandomly(npc, AQUAMARINE, 1, MAX_GEM_COUNT, dropChance, false)) - { - if (st.getQuestItemsCount(CHRYSOBERYL) >= MAX_GEM_COUNT) - { + if (st.giveItemRandomly(npc, AQUAMARINE, 1, MAX_GEM_COUNT, dropChance, false)) { + if (st.getQuestItemsCount(CHRYSOBERYL) >= MAX_GEM_COUNT) { st.setCond(6, true); break; } playSound = true; } - if (st.giveItemRandomly(npc, CHRYSOBERYL, 1, MAX_GEM_COUNT, dropChance, false)) - { - if (st.getQuestItemsCount(AQUAMARINE) >= MAX_GEM_COUNT) - { + if (st.giveItemRandomly(npc, CHRYSOBERYL, 1, MAX_GEM_COUNT, dropChance, false)) { + if (st.getQuestItemsCount(AQUAMARINE) >= MAX_GEM_COUNT) { st.setCond(6, true); break; } @@ -537,19 +432,15 @@ public final class Q00108_JumbleTumbleDiamondFuss extends Quest playSound = true; } - if (playSound) - { + if (playSound) { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case BLADE_BAT: - { - if (st.isCond(11) && st.hasQuestItems(BAT_DIAGRAM)) - { - if (st.giveItemRandomly(npc, STAR_DIAMOND, 1, 1, 0.2, true)) - { + case BLADE_BAT: { + if (st.isCond(11) && st.hasQuestItems(BAT_DIAGRAM)) { + if (st.giveItemRandomly(npc, STAR_DIAMOND, 1, 1, 0.2, true)) { st.takeItems(BAT_DIAGRAM, -1); st.setCond(12); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00109_InSearchOfTheNest/Q00109_InSearchOfTheNest.java b/src/main/java/com/l2jserver/datapack/quests/Q00109_InSearchOfTheNest/Q00109_InSearchOfTheNest.java index cfc1bafa12..f9dd6f7830 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00109_InSearchOfTheNest/Q00109_InSearchOfTheNest.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00109_InSearchOfTheNest/Q00109_InSearchOfTheNest.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.State; * In Search of the Nest (109) * @author Adry_85 */ -public class Q00109_InSearchOfTheNest extends Quest -{ +public class Q00109_InSearchOfTheNest extends Quest { // NPCs private static final int PIERCE = 31553; private static final int SCOUTS_CORPSE = 32015; @@ -37,8 +36,7 @@ public class Q00109_InSearchOfTheNest extends Quest // Items private static final int SCOUTS_NOTE = 14858; - public Q00109_InSearchOfTheNest() - { + public Q00109_InSearchOfTheNest() { super(109, Q00109_InSearchOfTheNest.class.getSimpleName(), "In Search of the Nest"); addStartNpc(PIERCE); addTalkId(PIERCE, SCOUTS_CORPSE, KAHMAN); @@ -46,16 +44,13 @@ public class Q00109_InSearchOfTheNest extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - switch (event) - { + switch (event) { case "31553-0.htm": st.startQuest(); break; @@ -77,21 +72,17 @@ public class Q00109_InSearchOfTheNest extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case PIERCE: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() < 81) ? "31553-0a.htm" : "31553-0b.htm"; break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "31553-1.html"; break; @@ -109,21 +100,16 @@ public class Q00109_InSearchOfTheNest extends Quest } break; case SCOUTS_CORPSE: - if (st.isStarted()) - { - if (st.isCond(1)) - { + if (st.isStarted()) { + if (st.isCond(1)) { htmltext = "32015-1.html"; - } - else if (st.isCond(2)) - { + } else if (st.isCond(2)) { htmltext = "32015-3.html"; } } break; case KAHMAN: - if (st.isStarted() && st.isCond(3)) - { + if (st.isStarted() && st.isCond(3)) { htmltext = "31554-1.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00110_ToThePrimevalIsle/Q00110_ToThePrimevalIsle.java b/src/main/java/com/l2jserver/datapack/quests/Q00110_ToThePrimevalIsle/Q00110_ToThePrimevalIsle.java index 5a4f000e13..fbd467b4bb 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00110_ToThePrimevalIsle/Q00110_ToThePrimevalIsle.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00110_ToThePrimevalIsle/Q00110_ToThePrimevalIsle.java @@ -28,16 +28,14 @@ import com.l2jserver.gameserver.model.quest.State; * To the Primeval Isle (110) * @author Adry_85 */ -public class Q00110_ToThePrimevalIsle extends Quest -{ +public class Q00110_ToThePrimevalIsle extends Quest { // NPCs private static final int ANTON = 31338; private static final int MARQUEZ = 32113; // Item private static final int ANCIENT_BOOK = 8777; - public Q00110_ToThePrimevalIsle() - { + public Q00110_ToThePrimevalIsle() { super(110, Q00110_ToThePrimevalIsle.class.getSimpleName(), "To the Primeval Isle"); addStartNpc(ANTON); addTalkId(ANTON, MARQUEZ); @@ -45,16 +43,13 @@ public class Q00110_ToThePrimevalIsle extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - switch (event) - { + switch (event) { case "31338-1.html": st.giveItems(ANCIENT_BOOK, 1); st.startQuest(); @@ -70,15 +65,12 @@ public class Q00110_ToThePrimevalIsle extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case ANTON: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() < 75) ? "31338-0a.htm" : "31338-0b.htm"; break; @@ -91,8 +83,7 @@ public class Q00110_ToThePrimevalIsle extends Quest } break; case MARQUEZ: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "32113-1.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00111_ElrokianHuntersProof/Q00111_ElrokianHuntersProof.java b/src/main/java/com/l2jserver/datapack/quests/Q00111_ElrokianHuntersProof/Q00111_ElrokianHuntersProof.java index c51c33a082..6ebf95ca3c 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00111_ElrokianHuntersProof/Q00111_ElrokianHuntersProof.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00111_ElrokianHuntersProof/Q00111_ElrokianHuntersProof.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.model.quest.State; * Elrokian Hunter's Proof (111) * @author Adry_85 */ -public final class Q00111_ElrokianHuntersProof extends Quest -{ +public final class Q00111_ElrokianHuntersProof extends Quest { // NPCs private static final int MARQUEZ = 32113; private static final int MUSHIKA = 32114; @@ -53,8 +52,7 @@ public final class Q00111_ElrokianHuntersProof extends Quest private static final int MIN_LEVEL = 75; // Mobs private static final Map<Integer, ItemChanceHolder> MOBS_DROP_CHANCES = new HashMap<>(); - static - { + static { MOBS_DROP_CHANCES.put(22196, new ItemChanceHolder(DIARY_FRAGMENT, 0.51, 4)); // velociraptor_leader MOBS_DROP_CHANCES.put(22197, new ItemChanceHolder(DIARY_FRAGMENT, 0.51, 4)); // velociraptor MOBS_DROP_CHANCES.put(22198, new ItemChanceHolder(DIARY_FRAGMENT, 0.51, 4)); // velociraptor_s @@ -77,8 +75,7 @@ public final class Q00111_ElrokianHuntersProof extends Quest MOBS_DROP_CHANCES.put(22226, new ItemChanceHolder(PACHYCEPHALOSAURUS_SKIN, 0.50, 11)); // pachycephalosaurus_ldr2 } - public Q00111_ElrokianHuntersProof() - { + public Q00111_ElrokianHuntersProof() { super(111, Q00111_ElrokianHuntersProof.class.getSimpleName(), "Elrokian Hunter's Proof"); addStartNpc(MARQUEZ); addTalkId(MARQUEZ, MUSHIKA, ASAMAH, KIRIKACHIN); @@ -87,17 +84,14 @@ public final class Q00111_ElrokianHuntersProof extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { + switch (event) { case "32113-02.htm": case "32113-05.htm": case "32113-04.html": @@ -114,32 +108,26 @@ public final class Q00111_ElrokianHuntersProof extends Quest case "32113-23.html": case "32113-24.html": case "32115-08.html": - case "32116-03.html": - { + case "32116-03.html": { htmltext = event; break; } - case "32113-03.html": - { + case "32113-03.html": { qs.startQuest(); qs.setMemoState(1); htmltext = event; break; } - case "32113-15.html": - { - if (qs.isMemoState(3)) - { + case "32113-15.html": { + if (qs.isMemoState(3)) { qs.setMemoState(4); qs.setCond(4, true); htmltext = event; } break; } - case "32113-25.html": - { - if (qs.isMemoState(5)) - { + case "32113-25.html": { + if (qs.isMemoState(5)) { qs.setMemoState(6); qs.setCond(6, true); giveItems(player, EXPEDITION_MEMBERS_LETTER, 1); @@ -147,20 +135,16 @@ public final class Q00111_ElrokianHuntersProof extends Quest } break; } - case "32115-03.html": - { - if (qs.isMemoState(2)) - { + case "32115-03.html": { + if (qs.isMemoState(2)) { qs.setMemoState(3); qs.setCond(3, true); htmltext = event; } break; } - case "32115-06.html": - { - if (qs.isMemoState(9)) - { + case "32115-06.html": { + if (qs.isMemoState(9)) { qs.setMemoState(10); qs.setCond(9); playSound(player, Sound.ETCSOUND_ELROKI_SONG_FULL); @@ -168,40 +152,32 @@ public final class Q00111_ElrokianHuntersProof extends Quest } break; } - case "32115-09.html": - { - if (qs.isMemoState(10)) - { + case "32115-09.html": { + if (qs.isMemoState(10)) { qs.setMemoState(11); qs.setCond(10, true); htmltext = event; } break; } - case "32116-04.html": - { - if (qs.isMemoState(7)) - { + case "32116-04.html": { + if (qs.isMemoState(7)) { qs.setMemoState(8); playSound(player, Sound.ETCSOUND_ELROKI_SONG_FULL); htmltext = event; } break; } - case "32116-07.html": - { - if (qs.isMemoState(8)) - { + case "32116-07.html": { + if (qs.isMemoState(8)) { qs.setMemoState(9); qs.setCond(8, true); htmltext = event; } break; } - case "32116-10.html": - { - if (qs.isMemoState(12) && hasQuestItems(player, PRACTICE_ELROKIAN_TRAP)) - { + case "32116-10.html": { + if (qs.isMemoState(12) && hasQuestItems(player, PRACTICE_ELROKIAN_TRAP)) { takeItems(player, PRACTICE_ELROKIAN_TRAP, -1); giveItems(player, ELROKIAN_TRAP, 1); giveItems(player, TRAP_STONE, 100); @@ -217,28 +193,20 @@ public final class Q00111_ElrokianHuntersProof extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(player, -1, 3, npc); - if (qs != null) - { + if (qs != null) { final ItemChanceHolder item = MOBS_DROP_CHANCES.get(npc.getId()); - if (item.getCount() == qs.getMemoState()) - { - if (qs.isCond(4)) - { - if (giveItemRandomly(qs.getPlayer(), npc, item.getId(), 1, 50, item.getChance(), true)) - { + if (item.getCount() == qs.getMemoState()) { + if (qs.isCond(4)) { + if (giveItemRandomly(qs.getPlayer(), npc, item.getId(), 1, 50, item.getChance(), true)) { qs.setCond(5); } - } - else if (qs.isCond(10)) - { + } else if (qs.isCond(10)) { if (giveItemRandomly(qs.getPlayer(), npc, item.getId(), 1, 10, item.getChance(), true) // && (getQuestItemsCount(qs.getPlayer(), ORNITHOMINUS_CLAW) >= 10) // && (getQuestItemsCount(qs.getPlayer(), DEINONYCHUS_BONE) >= 10) // - && (getQuestItemsCount(qs.getPlayer(), PACHYCEPHALOSAURUS_SKIN) >= 10)) - { + && (getQuestItemsCount(qs.getPlayer(), PACHYCEPHALOSAURUS_SKIN) >= 10)) { qs.setCond(11); } } @@ -248,125 +216,93 @@ public final class Q00111_ElrokianHuntersProof extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (qs.getState()) - { - case State.COMPLETED: - { - if (npc.getId() == MARQUEZ) - { + switch (qs.getState()) { + case State.COMPLETED: { + if (npc.getId() == MARQUEZ) { htmltext = getAlreadyCompletedMsg(player); } break; } - case State.CREATED: - { - if (npc.getId() == MARQUEZ) - { + case State.CREATED: { + if (npc.getId() == MARQUEZ) { htmltext = ((player.getLevel() >= MIN_LEVEL) ? "32113-01.htm" : "32113-06.html"); } break; } - case State.STARTED: - { - switch (npc.getId()) - { - case MARQUEZ: - { - switch (qs.getMemoState()) - { - case 1: - { + case State.STARTED: { + switch (npc.getId()) { + case MARQUEZ: { + switch (qs.getMemoState()) { + case 1: { htmltext = "32113-07.html"; break; } - case 2: - { + case 2: { htmltext = "32113-08.html"; break; } - case 3: - { + case 3: { htmltext = "32113-09.html"; break; } - case 4: - { - if (getQuestItemsCount(player, DIARY_FRAGMENT) < 50) - { + case 4: { + if (getQuestItemsCount(player, DIARY_FRAGMENT) < 50) { htmltext = "32113-16.html"; - } - else - { + } else { takeItems(player, DIARY_FRAGMENT, -1); qs.setMemoState(5); htmltext = "32113-17.html"; } break; } - case 5: - { + case 5: { htmltext = "32113-26.html"; break; } - case 6: - { + case 6: { htmltext = "32113-27.html"; break; } case 7: - case 8: - { + case 8: { htmltext = "32113-28.html"; break; } - case 9: - { + case 9: { htmltext = "32113-29.html"; break; } case 10: case 11: - case 12: - { + case 12: { htmltext = "32113-30.html"; break; } } break; } - case MUSHIKA: - { - if (qs.isMemoState(1)) - { + case MUSHIKA: { + if (qs.isMemoState(1)) { qs.setCond(2, true); qs.setMemoState(2); htmltext = "32114-01.html"; - } - else if ((qs.getMemoState() > 1) && (qs.getMemoState() < 10)) - { + } else if ((qs.getMemoState() > 1) && (qs.getMemoState() < 10)) { htmltext = "32114-02.html"; - } - else - { + } else { htmltext = "32114-03.html"; } break; } - case ASAMAH: - { - switch (qs.getMemoState()) - { - case 1: - { + case ASAMAH: { + switch (qs.getMemoState()) { + case 1: { htmltext = "32115-01.html"; break; } - case 2: - { + case 2: { htmltext = "32115-02.html"; break; } @@ -375,29 +311,22 @@ public final class Q00111_ElrokianHuntersProof extends Quest case 5: case 6: case 7: - case 8: - { + case 8: { htmltext = "32115-04.html"; break; } - case 9: - { + case 9: { htmltext = "32115-05.html"; break; } - case 10: - { + case 10: { htmltext = "32115-07.html"; break; } - case 11: - { - if ((getQuestItemsCount(player, ORNITHOMINUS_CLAW) < 10) || (getQuestItemsCount(player, DEINONYCHUS_BONE) < 10) || (getQuestItemsCount(player, PACHYCEPHALOSAURUS_SKIN) < 10)) - { + case 11: { + if ((getQuestItemsCount(player, ORNITHOMINUS_CLAW) < 10) || (getQuestItemsCount(player, DEINONYCHUS_BONE) < 10) || (getQuestItemsCount(player, PACHYCEPHALOSAURUS_SKIN) < 10)) { htmltext = "32115-10.html"; - } - else - { + } else { qs.setMemoState(12); qs.setCond(12, true); giveItems(player, PRACTICE_ELROKIAN_TRAP, 1); @@ -408,31 +337,25 @@ public final class Q00111_ElrokianHuntersProof extends Quest } break; } - case 12: - { + case 12: { htmltext = "32115-12.html"; break; } } break; } - case KIRIKACHIN: - { - switch (qs.getMemoState()) - { + case KIRIKACHIN: { + switch (qs.getMemoState()) { case 1: case 2: case 3: case 4: - case 5: - { + case 5: { htmltext = "32116-01.html"; break; } - case 6: - { - if (hasQuestItems(player, EXPEDITION_MEMBERS_LETTER)) - { + case 6: { + if (hasQuestItems(player, EXPEDITION_MEMBERS_LETTER)) { qs.setMemoState(7); qs.setCond(7, true); takeItems(player, EXPEDITION_MEMBERS_LETTER, -1); @@ -440,25 +363,21 @@ public final class Q00111_ElrokianHuntersProof extends Quest } break; } - case 7: - { + case 7: { htmltext = "32116-05.html"; break; } - case 8: - { + case 8: { htmltext = "32116-06.html"; break; } case 9: case 10: - case 11: - { + case 11: { htmltext = "32116-08.html"; break; } - case 12: - { + case 12: { htmltext = "32116-09.html"; break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00112_WalkOfFate/Q00112_WalkOfFate.java b/src/main/java/com/l2jserver/datapack/quests/Q00112_WalkOfFate/Q00112_WalkOfFate.java index b09c93b36b..68c815ee0d 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00112_WalkOfFate/Q00112_WalkOfFate.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00112_WalkOfFate/Q00112_WalkOfFate.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.State; * Walk of Fate (112) * @author Zoey76 */ -public class Q00112_WalkOfFate extends Quest -{ +public class Q00112_WalkOfFate extends Quest { // NPCs private static final int LIVINA = 30572; private static final int KARUDA = 32017; @@ -38,33 +37,27 @@ public class Q00112_WalkOfFate extends Quest // Misc private static final int MIN_LEVEL = 20; - public Q00112_WalkOfFate() - { + public Q00112_WalkOfFate() { super(112, Q00112_WalkOfFate.class.getSimpleName(), "Walk of Fate"); addStartNpc(LIVINA); addTalkId(LIVINA, KARUDA); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st == null) || (player.getLevel() < MIN_LEVEL)) - { + if ((st == null) || (player.getLevel() < MIN_LEVEL)) { return null; } String htmltext = null; - switch (event) - { - case "30572-04.htm": - { + switch (event) { + case "30572-04.htm": { st.startQuest(); htmltext = event; break; } - case "32017-02.html": - { + case "32017-02.html": { st.giveAdena(22308, true); st.addExpAndSp(112876, 5774); st.giveItems(SCROLL_ENCHANT_ARMOR_D_GRADE, 1); @@ -76,32 +69,26 @@ public class Q00112_WalkOfFate extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() < MIN_LEVEL) ? "30572-03.html" : "30572-01.htm"; break; case State.STARTED: - switch (npc.getId()) - { - case LIVINA: - { + switch (npc.getId()) { + case LIVINA: { htmltext = "30572-05.html"; break; } - case KARUDA: - { + case KARUDA: { htmltext = "32017-01.html"; break; } } break; - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00113_StatusOfTheBeaconTower/Q00113_StatusOfTheBeaconTower.java b/src/main/java/com/l2jserver/datapack/quests/Q00113_StatusOfTheBeaconTower/Q00113_StatusOfTheBeaconTower.java index 6d33a490ea..52a0902ad1 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00113_StatusOfTheBeaconTower/Q00113_StatusOfTheBeaconTower.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00113_StatusOfTheBeaconTower/Q00113_StatusOfTheBeaconTower.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by Kerberos. * @author malyelfik */ -public class Q00113_StatusOfTheBeaconTower extends Quest -{ +public class Q00113_StatusOfTheBeaconTower extends Quest { // NPCs private static final int MOIRA = 31979; private static final int TORRANT = 32016; @@ -38,8 +37,7 @@ public class Q00113_StatusOfTheBeaconTower extends Quest private static final int FLAME_BOX = 14860; private static final int FIRE_BOX = 8086; - public Q00113_StatusOfTheBeaconTower() - { + public Q00113_StatusOfTheBeaconTower() { super(113, Q00113_StatusOfTheBeaconTower.class.getSimpleName(), "Status of the Beacon Tower"); addStartNpc(MOIRA); addTalkId(MOIRA, TORRANT); @@ -47,30 +45,24 @@ public class Q00113_StatusOfTheBeaconTower extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "31979-02.htm": st.startQuest(); st.giveItems(FLAME_BOX, 1); break; case "32016-02.html": - if (st.hasQuestItems(FIRE_BOX)) - { + if (st.hasQuestItems(FIRE_BOX)) { st.giveAdena(21578, true); st.addExpAndSp(76665, 5333); - } - else - { + } else { st.giveAdena(154800, true); st.addExpAndSp(619300, 44200); } @@ -84,15 +76,12 @@ public class Q00113_StatusOfTheBeaconTower extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case MOIRA: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= 80) ? "31979-01.htm" : "31979-00.htm"; break; @@ -105,8 +94,7 @@ public class Q00113_StatusOfTheBeaconTower extends Quest } break; case TORRANT: - if (st.isStarted()) - { + if (st.isStarted()) { htmltext = "32016-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00114_ResurrectionOfAnOldManager/Q00114_ResurrectionOfAnOldManager.java b/src/main/java/com/l2jserver/datapack/quests/Q00114_ResurrectionOfAnOldManager/Q00114_ResurrectionOfAnOldManager.java index 6f12c3e3e3..d06af1bc56 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00114_ResurrectionOfAnOldManager/Q00114_ResurrectionOfAnOldManager.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00114_ResurrectionOfAnOldManager/Q00114_ResurrectionOfAnOldManager.java @@ -37,8 +37,7 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * Original Jython script by Kerberos * @author malyelfik */ -public class Q00114_ResurrectionOfAnOldManager extends Quest -{ +public class Q00114_ResurrectionOfAnOldManager extends Quest { // NPCs private static final int NEWYEAR = 31961; private static final int YUMI = 32041; @@ -56,8 +55,7 @@ public class Q00114_ResurrectionOfAnOldManager extends Quest private static L2Attackable golem = null; - public Q00114_ResurrectionOfAnOldManager() - { + public Q00114_ResurrectionOfAnOldManager() { super(114, Q00114_ResurrectionOfAnOldManager.class.getSimpleName(), "Resurrection of an Old Manager"); addStartNpc(YUMI); addTalkId(YUMI, WENDY, BOX, STONES, NEWYEAR); @@ -67,18 +65,15 @@ public class Q00114_ResurrectionOfAnOldManager extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { // Yumi case "32041-04.htm": st.startQuest(); @@ -91,8 +86,7 @@ public class Q00114_ResurrectionOfAnOldManager extends Quest st.unset("talk"); break; case "32041-12.html": - switch (st.getCond()) - { + switch (st.getCond()) { case 3: htmltext = "32041-12.html"; break; @@ -123,8 +117,7 @@ public class Q00114_ResurrectionOfAnOldManager extends Quest st.takeItems(DETCTOR2, 1); break; case "32041-38.html": - if (st.getInt("choice") == 2) - { + if (st.getInt("choice") == 2) { htmltext = "32041-37.html"; } break; @@ -147,20 +140,17 @@ public class Q00114_ResurrectionOfAnOldManager extends Quest break; // Wendy case "32047-02.html": - if (st.getInt("talk") == 0) - { + if (st.getInt("talk") == 0) { st.set("talk", "1"); } break; case "32047-03.html": - if (st.getInt("talk1") == 0) - { + if (st.getInt("talk1") == 0) { st.set("talk1", "1"); } break; case "32047-05.html": - if ((st.getInt("talk") == 0) || (st.getInt("talk1") == 0)) - { + if ((st.getInt("talk") == 0) || (st.getInt("talk1") == 0)) { htmltext = "32047-04.html"; } break; @@ -190,8 +180,7 @@ public class Q00114_ResurrectionOfAnOldManager extends Quest st.setCond(10, true); break; case "32047-15b.html": - if ((golem == null) || ((golem != null) && golem.isDead())) - { + if ((golem == null) || ((golem != null) && golem.isDead())) { golem = (L2Attackable) addSpawn(GUARDIAN, 96977, -110625, -3280, 0, false, 0); golem.broadcastPacket(new NpcSay(golem.getObjectId(), Say2.NPC_ALL, golem.getId(), NpcStringId.YOU_S1_YOU_ATTACKED_WENDY_PREPARE_TO_DIE).addStringParameter(player.getName())); golem.setRunning(); @@ -199,13 +188,9 @@ public class Q00114_ResurrectionOfAnOldManager extends Quest golem.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player); st.set("spawned", "1"); startQuestTimer("golem_despawn", 300000, null, player); - } - else if (st.getInt("spawned") == 1) - { + } else if (st.getInt("spawned") == 1) { htmltext = "32047-17b.html"; - } - else - { + } else { htmltext = "32047-16b.html"; } break; @@ -229,15 +214,12 @@ public class Q00114_ResurrectionOfAnOldManager extends Quest st.setCond(15, true); break; case "32047-29c.html": - if (player.getAdena() >= 3000) - { + if (player.getAdena() >= 3000) { st.giveItems(STARSTONE2, 1); st.takeItems(Inventory.ADENA_ID, 3000); st.unset("talk"); st.setCond(26, true); - } - else - { + } else { htmltext = "32047-29ca.html"; } break; @@ -322,12 +304,10 @@ public class Q00114_ResurrectionOfAnOldManager extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isCond(10) && (st.getInt("spawned") == 1)) - { + if ((st != null) && st.isCond(10) && (st.getInt("spawned") == 1)) { npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.THIS_ENEMY_IS_FAR_TOO_POWERFUL_FOR_ME_TO_FIGHT_I_MUST_WITHDRAW)); st.setCond(11, true); st.unset("spawned"); @@ -337,13 +317,10 @@ public class Q00114_ResurrectionOfAnOldManager extends Quest } @Override - public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) - { - if (creature.isPlayer()) - { + public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) { + if (creature.isPlayer()) { final QuestState st = getQuestState(creature.getActingPlayer(), false); - if ((st != null) && st.isCond(17)) - { + if ((st != null) && st.isCond(17)) { st.takeItems(DETCTOR, 1); st.giveItems(DETCTOR2, 1); st.setCond(18, true); @@ -354,29 +331,22 @@ public class Q00114_ResurrectionOfAnOldManager extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); int talk = st.getInt("talk"); - switch (npc.getId()) - { + switch (npc.getId()) { case YUMI: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: - if (player.hasQuestCompleted(Q00121_PavelTheGiant.class.getSimpleName())) - { + if (player.hasQuestCompleted(Q00121_PavelTheGiant.class.getSimpleName())) { htmltext = (player.getLevel() >= 70) ? "32041-02.htm" : "32041-03.htm"; - } - else - { + } else { htmltext = "32041-01.htm"; } break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = (talk == 1) ? "32041-08.html" : "32041-04.htm"; break; @@ -386,8 +356,7 @@ public class Q00114_ResurrectionOfAnOldManager extends Quest case 3: case 4: case 5: - switch (talk) - { + switch (talk) { case 0: htmltext = "32041-11.html"; break; @@ -444,10 +413,8 @@ public class Q00114_ResurrectionOfAnOldManager extends Quest } break; case WENDY: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 2: htmltext = ((talk == 1) && (st.getInt("talk1") == 1)) ? "32047-05.html" : "32047-01.html"; break; @@ -461,8 +428,7 @@ public class Q00114_ResurrectionOfAnOldManager extends Quest htmltext = "32047-10.html"; break; case 6: - switch (st.getInt("choice")) - { + switch (st.getInt("choice")) { case 1: htmltext = "32047-11a.html"; break; @@ -502,12 +468,9 @@ public class Q00114_ResurrectionOfAnOldManager extends Quest htmltext = "32047-24c.html"; break; case 20: - if (st.getInt("choice") == 1) - { + if (st.getInt("choice") == 1) { htmltext = "32047-22a.html"; - } - else - { + } else { htmltext = (talk == 1) ? "32047-31c.html" : "32047-26c.html"; } break; @@ -528,10 +491,8 @@ public class Q00114_ResurrectionOfAnOldManager extends Quest } break; case NEWYEAR: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 21: htmltext = "31961-01.html"; break; @@ -542,10 +503,8 @@ public class Q00114_ResurrectionOfAnOldManager extends Quest } break; case BOX: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 13: htmltext = (talk == 1) ? "32050-02.html" : "32050-01.html"; break; @@ -562,10 +521,8 @@ public class Q00114_ResurrectionOfAnOldManager extends Quest } break; case STONES: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 18: htmltext = "32046-02.html"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00115_TheOtherSideOfTruth/Q00115_TheOtherSideOfTruth.java b/src/main/java/com/l2jserver/datapack/quests/Q00115_TheOtherSideOfTruth/Q00115_TheOtherSideOfTruth.java index 780dcdd8ef..0159e2c6e4 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00115_TheOtherSideOfTruth/Q00115_TheOtherSideOfTruth.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00115_TheOtherSideOfTruth/Q00115_TheOtherSideOfTruth.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * The Other Side of Truth (115) * @author Adry_85 */ -public class Q00115_TheOtherSideOfTruth extends Quest -{ +public class Q00115_TheOtherSideOfTruth extends Quest { // NPCs private static final int MISA = 32018; private static final int RAFFORTY = 32020; @@ -47,8 +46,7 @@ public class Q00115_TheOtherSideOfTruth extends Quest // Misc private static final int MIN_LEVEL = 53; - public Q00115_TheOtherSideOfTruth() - { + public Q00115_TheOtherSideOfTruth() { super(115, Q00115_TheOtherSideOfTruth.class.getSimpleName(), "The Other Side of Truth"); addStartNpc(RAFFORTY); addTalkId(RAFFORTY, MISA, KIER, ICE_SCULPTURE1, ICE_SCULPTURE2, ICE_SCULPTURE3, ICE_SCULPTURE4); @@ -56,65 +54,51 @@ public class Q00115_TheOtherSideOfTruth extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "32020-02.html": - { + switch (event) { + case "32020-02.html": { st.startQuest(); htmltext = event; break; } - case "32020-07.html": - { - if (st.isCond(2)) - { + case "32020-07.html": { + if (st.isCond(2)) { st.takeItems(MISAS_LETTER, -1); st.setCond(3, true); htmltext = event; } break; } - case "32020-05.html": - { - if (st.isCond(2)) - { + case "32020-05.html": { + if (st.isCond(2)) { st.takeItems(MISAS_LETTER, -1); st.exitQuest(true, true); htmltext = event; } break; } - case "32020-10.html": - { - if (st.isCond(3)) - { + case "32020-10.html": { + if (st.isCond(3)) { st.setCond(4, true); htmltext = event; } break; } - case "32020-11.html": - { - if (st.isCond(3)) - { + case "32020-11.html": { + if (st.isCond(3)) { st.setCond(4, true); htmltext = event; } break; } - case "32020-12.html": - { - if (st.isCond(3)) - { + case "32020-12.html": { + if (st.isCond(3)) { st.exitQuest(true, true); htmltext = event; } @@ -123,43 +107,33 @@ public class Q00115_TheOtherSideOfTruth extends Quest case "32020-08.html": case "32020-09.html": case "32020-13.html": - case "32020-14.html": - { + case "32020-14.html": { htmltext = event; break; } - case "32020-15.html": - { - if (st.isCond(4)) - { + case "32020-15.html": { + if (st.isCond(4)) { st.setCond(5, true); st.playSound(Sound.AMBSOUND_WINGFLAP); htmltext = event; } break; } - case "32020-23.html": - { - if (st.isCond(9)) - { + case "32020-23.html": { + if (st.isCond(9)) { st.setCond(10, true); htmltext = event; } break; } - case "finish": - { - if (st.isCond(10)) - { - if (st.hasQuestItems(PIECE_OF_TABLET)) - { + case "finish": { + if (st.isCond(10)) { + if (st.hasQuestItems(PIECE_OF_TABLET)) { st.giveAdena(115673, true); st.addExpAndSp(493595, 40442); st.exitQuest(false, true); htmltext = "32020-25.html"; - } - else - { + } else { st.setCond(11, true); htmltext = "32020-26.html"; st.playSound(Sound.AMBSOUND_THUNDER); @@ -167,19 +141,14 @@ public class Q00115_TheOtherSideOfTruth extends Quest } break; } - case "finish2": - { - if (st.isCond(10)) - { - if (st.hasQuestItems(PIECE_OF_TABLET)) - { + case "finish2": { + if (st.isCond(10)) { + if (st.hasQuestItems(PIECE_OF_TABLET)) { st.giveAdena(115673, true); st.addExpAndSp(493595, 40442); st.exitQuest(false, true); htmltext = "32020-27.html"; - } - else - { + } else { st.setCond(11, true); htmltext = "32020-28.html"; st.playSound(Sound.AMBSOUND_THUNDER); @@ -187,37 +156,28 @@ public class Q00115_TheOtherSideOfTruth extends Quest } break; } - case "32018-05.html": - { - if (st.isCond(6) && (st.hasQuestItems(RAFFORTYS_LETTER))) - { + case "32018-05.html": { + if (st.isCond(6) && (st.hasQuestItems(RAFFORTYS_LETTER))) { st.takeItems(RAFFORTYS_LETTER, -1); st.setCond(7, true); htmltext = event; } break; } - case "32022-02.html": - { - if (st.isCond(8)) - { + case "32022-02.html": { + if (st.isCond(8)) { st.giveItems(REPORT_PIECE, 1); st.setCond(9, true); htmltext = event; } break; } - case "32021-02.html": - { - switch (npc.getId()) - { - case ICE_SCULPTURE1: - { - if (st.isCond(7) && ((st.getInt("ex") % 2) <= 1)) - { + case "32021-02.html": { + switch (npc.getId()) { + case ICE_SCULPTURE1: { + if (st.isCond(7) && ((st.getInt("ex") % 2) <= 1)) { int ex = st.getInt("ex"); - if ((ex == 6) || (ex == 10) || (ex == 12)) - { + if ((ex == 6) || (ex == 10) || (ex == 12)) { ex++; st.set("ex", ex); st.giveItems(PIECE_OF_TABLET, 1); @@ -226,13 +186,10 @@ public class Q00115_TheOtherSideOfTruth extends Quest } break; } - case ICE_SCULPTURE2: - { - if (st.isCond(7) && ((st.getInt("ex") % 4) <= 1)) - { + case ICE_SCULPTURE2: { + if (st.isCond(7) && ((st.getInt("ex") % 4) <= 1)) { int ex = st.getInt("ex"); - if ((ex == 5) || (ex == 9) || (ex == 12)) - { + if ((ex == 5) || (ex == 9) || (ex == 12)) { ex += 2; st.set("ex", ex); st.giveItems(PIECE_OF_TABLET, 1); @@ -241,13 +198,10 @@ public class Q00115_TheOtherSideOfTruth extends Quest } break; } - case ICE_SCULPTURE3: - { - if (st.isCond(7) && ((st.getInt("ex") % 8) <= 3)) - { + case ICE_SCULPTURE3: { + if (st.isCond(7) && ((st.getInt("ex") % 8) <= 3)) { int ex = st.getInt("ex"); - if ((ex == 3) || (ex == 9) || (ex == 10)) - { + if ((ex == 3) || (ex == 9) || (ex == 10)) { ex += 4; st.set("ex", ex); st.giveItems(PIECE_OF_TABLET, 1); @@ -256,13 +210,10 @@ public class Q00115_TheOtherSideOfTruth extends Quest } break; } - case ICE_SCULPTURE4: - { - if (st.isCond(7) && (st.getInt("ex") <= 7)) - { + case ICE_SCULPTURE4: { + if (st.isCond(7) && (st.getInt("ex") <= 7)) { int ex = st.getInt("ex"); - if ((ex == 3) || (ex == 5) || (ex == 6)) - { + if ((ex == 3) || (ex == 5) || (ex == 6)) { ex += 8; st.set("ex", ex); st.giveItems(PIECE_OF_TABLET, 1); @@ -274,17 +225,12 @@ public class Q00115_TheOtherSideOfTruth extends Quest } break; } - case "32021-03.html": - { - switch (npc.getId()) - { - case ICE_SCULPTURE1: - { - if (st.isCond(7) && ((st.getInt("ex") % 2) <= 1)) - { + case "32021-03.html": { + switch (npc.getId()) { + case ICE_SCULPTURE1: { + if (st.isCond(7) && ((st.getInt("ex") % 2) <= 1)) { int ex = st.getInt("ex"); - if ((ex == 6) || (ex == 10) || (ex == 12)) - { + if ((ex == 6) || (ex == 10) || (ex == 12)) { ex++; st.set("ex", ex); htmltext = event; @@ -292,13 +238,10 @@ public class Q00115_TheOtherSideOfTruth extends Quest } break; } - case ICE_SCULPTURE2: - { - if (st.isCond(7) && ((st.getInt("ex") % 4) <= 1)) - { + case ICE_SCULPTURE2: { + if (st.isCond(7) && ((st.getInt("ex") % 4) <= 1)) { int ex = st.getInt("ex"); - if ((ex == 5) || (ex == 9) || (ex == 12)) - { + if ((ex == 5) || (ex == 9) || (ex == 12)) { ex += 2; st.set("ex", ex); htmltext = event; @@ -306,13 +249,10 @@ public class Q00115_TheOtherSideOfTruth extends Quest } break; } - case ICE_SCULPTURE3: - { - if (st.isCond(7) && ((st.getInt("ex") % 8) <= 3)) - { + case ICE_SCULPTURE3: { + if (st.isCond(7) && ((st.getInt("ex") % 8) <= 3)) { int ex = st.getInt("ex"); - if ((ex == 3) || (ex == 9) || (ex == 12)) - { + if ((ex == 3) || (ex == 9) || (ex == 12)) { ex += 4; st.set("ex", ex); htmltext = event; @@ -320,13 +260,10 @@ public class Q00115_TheOtherSideOfTruth extends Quest } break; } - case ICE_SCULPTURE4: - { - if (st.isCond(7) && (st.getInt("ex") <= 7)) - { + case ICE_SCULPTURE4: { + if (st.isCond(7) && (st.getInt("ex") <= 7)) { int ex = st.getInt("ex"); - if ((ex == 3) || (ex == 5) || (ex == 6)) - { + if ((ex == 3) || (ex == 5) || (ex == 6)) { ex += 8; st.set("ex", ex); htmltext = event; @@ -337,41 +274,31 @@ public class Q00115_TheOtherSideOfTruth extends Quest } break; } - case "32021-06.html": - { - switch (npc.getId()) - { - case ICE_SCULPTURE1: - { - if (st.isCond(7) && (st.getInt("ex") == 14)) - { + case "32021-06.html": { + switch (npc.getId()) { + case ICE_SCULPTURE1: { + if (st.isCond(7) && (st.getInt("ex") == 14)) { st.setCond(8); htmltext = event; } break; } - case ICE_SCULPTURE2: - { - if (st.isCond(7) && (st.getInt("ex") == 13)) - { + case ICE_SCULPTURE2: { + if (st.isCond(7) && (st.getInt("ex") == 13)) { st.setCond(8); htmltext = event; } break; } - case ICE_SCULPTURE3: - { - if (st.isCond(7) && (st.getInt("ex") == 11)) - { + case ICE_SCULPTURE3: { + if (st.isCond(7) && (st.getInt("ex") == 11)) { st.setCond(8); htmltext = event; } break; } - case ICE_SCULPTURE4: - { - if (st.isCond(7) && (st.getInt("ex") == 7)) - { + case ICE_SCULPTURE4: { + if (st.isCond(7) && (st.getInt("ex") == 7)) { st.setCond(8); htmltext = event; } @@ -385,100 +312,74 @@ public class Q00115_TheOtherSideOfTruth extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.COMPLETED: - { - if (npc.getId() == RAFFORTY) - { + switch (st.getState()) { + case State.COMPLETED: { + if (npc.getId() == RAFFORTY) { htmltext = getAlreadyCompletedMsg(player); } break; } - case State.CREATED: - { + case State.CREATED: { htmltext = (player.getLevel() >= MIN_LEVEL) ? "32020-01.htm" : "32020-03.html"; break; } - case State.STARTED: - { - switch (npc.getId()) - { - case RAFFORTY: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (npc.getId()) { + case RAFFORTY: { + switch (st.getCond()) { + case 1: { htmltext = "32020-04.html"; break; } - case 2: - { + case 2: { htmltext = (!st.hasQuestItems(MISAS_LETTER)) ? "32020-05.html" : "32020-06.html"; break; } - case 3: - { + case 3: { htmltext = "32020-16.html"; break; } - case 4: - { + case 4: { htmltext = "32020-17.html"; break; } - case 5: - { + case 5: { st.giveItems(RAFFORTYS_LETTER, 1); st.setCond(6, true); htmltext = "32020-18.html"; break; } - case 6: - { - if (st.hasQuestItems(RAFFORTYS_LETTER)) - { + case 6: { + if (st.hasQuestItems(RAFFORTYS_LETTER)) { htmltext = "32020-19.html"; - } - else - { + } else { st.giveItems(RAFFORTYS_LETTER, 1); htmltext = "32020-20.html"; } break; } case 7: - case 8: - { + case 8: { htmltext = "32020-21.html"; break; } - case 9: - { - if (st.hasQuestItems(REPORT_PIECE)) - { + case 9: { + if (st.hasQuestItems(REPORT_PIECE)) { htmltext = "32020-22.html"; } break; } - case 10: - { + case 10: { htmltext = "32020-24.html"; break; } - case 11: - { - if (!st.hasQuestItems(PIECE_OF_TABLET)) - { + case 11: { + if (!st.hasQuestItems(PIECE_OF_TABLET)) { htmltext = "32020-29.html"; - } - else - { + } else { st.giveAdena(115673, true); st.addExpAndSp(493595, 40442); st.exitQuest(false, true); @@ -489,74 +390,56 @@ public class Q00115_TheOtherSideOfTruth extends Quest } break; } - case MISA: - { - switch (st.getCond()) - { - case 1: - { + case MISA: { + switch (st.getCond()) { + case 1: { st.giveItems(MISAS_LETTER, 1); st.setCond(2, true); htmltext = "32018-01.html"; break; } - case 2: - { + case 2: { htmltext = "32018-02.html"; break; } case 3: - case 4: - { + case 4: { htmltext = "32018-03.html"; break; } - case 5: - { + case 5: { break; } - case 6: - { - if (st.hasQuestItems(RAFFORTYS_LETTER)) - { + case 6: { + if (st.hasQuestItems(RAFFORTYS_LETTER)) { htmltext = "32018-04.html"; } break; } - case 7: - { + case 7: { htmltext = "32018-06.html"; break; } } break; } - case KIER: - { - switch (st.getCond()) - { - case 8: - { + case KIER: { + switch (st.getCond()) { + case 8: { htmltext = "32022-01.html"; break; } - case 9: - { - if (st.hasQuestItems(REPORT_PIECE)) - { + case 9: { + if (st.hasQuestItems(REPORT_PIECE)) { htmltext = "32022-03.html"; - } - else - { + } else { st.giveItems(REPORT_PIECE, 1); htmltext = "32022-04.html"; } break; } - case 11: - { - if (!st.hasQuestItems(REPORT_PIECE)) - { + case 11: { + if (!st.hasQuestItems(REPORT_PIECE)) { htmltext = "32022-05.html"; } break; @@ -564,50 +447,34 @@ public class Q00115_TheOtherSideOfTruth extends Quest } break; } - case ICE_SCULPTURE1: - { - switch (st.getCond()) - { - case 7: - { - if ((st.getInt("ex") % 2) <= 1) - { + case ICE_SCULPTURE1: { + switch (st.getCond()) { + case 7: { + if ((st.getInt("ex") % 2) <= 1) { int ex = st.getInt("ex"); - if ((ex == 6) || (ex == 10) || (ex == 12)) - { + if ((ex == 6) || (ex == 10) || (ex == 12)) { htmltext = "32021-01.html"; - } - else if (ex == 14) - { + } else if (ex == 14) { htmltext = "32021-05.html"; - } - else - { + } else { ex++; st.set("ex", ex); htmltext = "32021-07.html"; } - } - else - { + } else { htmltext = "32021-04.html"; } break; } - case 8: - { + case 8: { htmltext = "32021-08.html"; break; } - case 11: - { - if (!st.hasQuestItems(PIECE_OF_TABLET)) - { + case 11: { + if (!st.hasQuestItems(PIECE_OF_TABLET)) { st.giveItems(PIECE_OF_TABLET, 1); htmltext = "32021-09.html"; - } - else - { + } else { htmltext = "32021-10.html"; } break; @@ -615,50 +482,34 @@ public class Q00115_TheOtherSideOfTruth extends Quest } break; } - case ICE_SCULPTURE2: - { - switch (st.getCond()) - { - case 7: - { - if ((st.getInt("ex") % 4) <= 1) - { + case ICE_SCULPTURE2: { + switch (st.getCond()) { + case 7: { + if ((st.getInt("ex") % 4) <= 1) { int ex = st.getInt("ex"); - if ((ex == 5) || (ex == 9) || (ex == 12)) - { + if ((ex == 5) || (ex == 9) || (ex == 12)) { htmltext = "32021-01.html"; - } - else if (ex == 13) - { + } else if (ex == 13) { htmltext = "32021-05.html"; - } - else - { + } else { ex += 2; st.set("ex", ex); htmltext = "32021-07.html"; } - } - else - { + } else { htmltext = "32021-04.html"; } break; } - case 8: - { + case 8: { htmltext = "32021-08.html"; break; } - case 11: - { - if (!st.hasQuestItems(PIECE_OF_TABLET)) - { + case 11: { + if (!st.hasQuestItems(PIECE_OF_TABLET)) { st.giveItems(PIECE_OF_TABLET, 1); htmltext = "32021-09.html"; - } - else - { + } else { htmltext = "32021-10.html"; } break; @@ -666,50 +517,34 @@ public class Q00115_TheOtherSideOfTruth extends Quest } break; } - case ICE_SCULPTURE3: - { - switch (st.getCond()) - { - case 7: - { - if ((st.getInt("ex") % 8) <= 3) - { + case ICE_SCULPTURE3: { + switch (st.getCond()) { + case 7: { + if ((st.getInt("ex") % 8) <= 3) { int ex = st.getInt("ex"); - if ((ex == 3) || (ex == 9) || (ex == 10)) - { + if ((ex == 3) || (ex == 9) || (ex == 10)) { htmltext = "32021-01.html"; - } - else if (ex == 11) - { + } else if (ex == 11) { htmltext = "32021-05.html"; - } - else - { + } else { ex += 4; st.set("ex", ex); htmltext = "32021-07.html"; } - } - else - { + } else { htmltext = "32021-04.html"; } break; } - case 8: - { + case 8: { htmltext = "32021-08.html"; break; } - case 11: - { - if (!st.hasQuestItems(PIECE_OF_TABLET)) - { + case 11: { + if (!st.hasQuestItems(PIECE_OF_TABLET)) { st.giveItems(PIECE_OF_TABLET, 1); htmltext = "32021-09.html"; - } - else - { + } else { htmltext = "32021-10.html"; } break; @@ -717,50 +552,34 @@ public class Q00115_TheOtherSideOfTruth extends Quest } break; } - case ICE_SCULPTURE4: - { - switch (st.getCond()) - { - case 7: - { - if (st.getInt("ex") <= 7) - { + case ICE_SCULPTURE4: { + switch (st.getCond()) { + case 7: { + if (st.getInt("ex") <= 7) { int ex = st.getInt("ex"); - if ((ex == 3) || (ex == 5) || (ex == 6)) - { + if ((ex == 3) || (ex == 5) || (ex == 6)) { htmltext = "32021-01.html"; - } - else if (ex == 7) - { + } else if (ex == 7) { htmltext = "32021-05.html"; - } - else - { + } else { ex += 8; st.set("ex", ex); htmltext = "32021-07.html"; } - } - else - { + } else { htmltext = "32021-04.html"; } break; } - case 8: - { + case 8: { htmltext = "32021-08.html"; break; } - case 11: - { - if (!st.hasQuestItems(PIECE_OF_TABLET)) - { + case 11: { + if (!st.hasQuestItems(PIECE_OF_TABLET)) { st.giveItems(PIECE_OF_TABLET, 1); htmltext = "32021-09.html"; - } - else - { + } else { htmltext = "32021-10.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00116_BeyondTheHillsOfWinter/Q00116_BeyondTheHillsOfWinter.java b/src/main/java/com/l2jserver/datapack/quests/Q00116_BeyondTheHillsOfWinter/Q00116_BeyondTheHillsOfWinter.java index 8df3e566b8..3c29892986 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00116_BeyondTheHillsOfWinter/Q00116_BeyondTheHillsOfWinter.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00116_BeyondTheHillsOfWinter/Q00116_BeyondTheHillsOfWinter.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * Beyond the Hills of Winter (116) * @author Adry_85 */ -public final class Q00116_BeyondTheHillsOfWinter extends Quest -{ +public final class Q00116_BeyondTheHillsOfWinter extends Quest { // NPCs private static final int FILAUR = 30535; private static final int OBI = 32052; @@ -44,8 +43,7 @@ public final class Q00116_BeyondTheHillsOfWinter extends Quest // Misc private static final int MIN_LEVEL = 30; - public Q00116_BeyondTheHillsOfWinter() - { + public Q00116_BeyondTheHillsOfWinter() { super(116, Q00116_BeyondTheHillsOfWinter.class.getSimpleName(), "Beyond the Hills of Winter"); addStartNpc(FILAUR); addTalkId(FILAUR, OBI); @@ -53,28 +51,22 @@ public final class Q00116_BeyondTheHillsOfWinter extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "30535-02.htm": - { + switch (event) { + case "30535-02.htm": { st.startQuest(); st.setMemoState(1); htmltext = event; break; } - case "30535-05.html": - { - if (st.isMemoState(1)) - { + case "30535-05.html": { + if (st.isMemoState(1)) { st.setMemoState(2); st.setCond(2, true); st.giveItems(SUPPLYING_GOODS, 1); @@ -82,18 +74,14 @@ public final class Q00116_BeyondTheHillsOfWinter extends Quest } break; } - case "32052-02.html": - { - if (st.isMemoState(2)) - { + case "32052-02.html": { + if (st.isMemoState(2)) { htmltext = event; } break; } - case "MATERIAL": - { - if (st.isMemoState(2)) - { + case "MATERIAL": { + if (st.isMemoState(2)) { st.rewardItems(SOULSHOT_D, 1740); st.addExpAndSp(82792, 4981); st.exitQuest(false, true); @@ -101,10 +89,8 @@ public final class Q00116_BeyondTheHillsOfWinter extends Quest } break; } - case "ADENA": - { - if (st.isMemoState(2)) - { + case "ADENA": { + if (st.isMemoState(2)) { st.giveAdena(17387, true); st.addExpAndSp(82792, 4981); st.exitQuest(false, true); @@ -117,48 +103,34 @@ public final class Q00116_BeyondTheHillsOfWinter extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.COMPLETED: - { - if (npc.getId() == FILAUR) - { + switch (st.getState()) { + case State.COMPLETED: { + if (npc.getId() == FILAUR) { htmltext = getAlreadyCompletedMsg(player); } break; } - case State.CREATED: - { - if (npc.getId() == FILAUR) - { + case State.CREATED: { + if (npc.getId() == FILAUR) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "30535-01.htm" : "30535-03.htm"; } break; } - case State.STARTED: - { - switch (npc.getId()) - { - case FILAUR: - { - if (st.isMemoState(1)) - { + case State.STARTED: { + switch (npc.getId()) { + case FILAUR: { + if (st.isMemoState(1)) { htmltext = (hasAllItems(player, true, THIEF_KEY, BANDAGE, ENERGY_STONE)) ? "30535-04.html" : "30535-06.html"; - } - else if (st.isMemoState(2)) - { + } else if (st.isMemoState(2)) { htmltext = "30535-07.html"; } break; } - case OBI: - { - if (st.isMemoState(2) && st.hasQuestItems(SUPPLYING_GOODS)) - { + case OBI: { + if (st.isMemoState(2) && st.hasQuestItems(SUPPLYING_GOODS)) { htmltext = "32052-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00117_TheOceanOfDistantStars/Q00117_TheOceanOfDistantStars.java b/src/main/java/com/l2jserver/datapack/quests/Q00117_TheOceanOfDistantStars/Q00117_TheOceanOfDistantStars.java index 84dd4cd81b..f3c40d2500 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00117_TheOceanOfDistantStars/Q00117_TheOceanOfDistantStars.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00117_TheOceanOfDistantStars/Q00117_TheOceanOfDistantStars.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * The Ocean of Distant Stars (117) * @author Adry_85 */ -public final class Q00117_TheOceanOfDistantStars extends Quest -{ +public final class Q00117_TheOceanOfDistantStars extends Quest { // NPCs private static final int OBI = 32052; private static final int ABEY = 32053; @@ -48,14 +47,12 @@ public final class Q00117_TheOceanOfDistantStars extends Quest private static final int BANDIT_WARRIOR = 22023; private static final int BANDIT_INSPECTOR = 22024; private static final Map<Integer, Double> MONSTER_DROP_CHANCES = new HashMap<>(); - static - { + static { MONSTER_DROP_CHANCES.put(BANDIT_WARRIOR, 0.179); MONSTER_DROP_CHANCES.put(BANDIT_INSPECTOR, 0.1); } - public Q00117_TheOceanOfDistantStars() - { + public Q00117_TheOceanOfDistantStars() { super(117, Q00117_TheOceanOfDistantStars.class.getSimpleName(), "The Ocean of Distant Stars"); addStartNpc(ABEY); addTalkId(ABEY, GHOST_OF_A_RAILROAD_ENGINEER, GHOST_OF_AN_ANCIENT_RAILROAD_ENGINEER, BOX, OBI); @@ -64,56 +61,44 @@ public final class Q00117_TheOceanOfDistantStars extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "32053-02.htm": - { + switch (event) { + case "32053-02.htm": { qs.setMemoState(1); qs.startQuest(); htmltext = event; break; } - case "32053-06.html": - { - if (qs.isMemoState(3)) - { + case "32053-06.html": { + if (qs.isMemoState(3)) { qs.setMemoState(4); qs.setCond(4, true); htmltext = event; } break; } - case "32053-09.html": - { - if (qs.isMemoState(5) && hasQuestItems(player, ENGRAVED_HAMMER)) - { + case "32053-09.html": { + if (qs.isMemoState(5) && hasQuestItems(player, ENGRAVED_HAMMER)) { qs.setMemoState(6); qs.setCond(6, true); htmltext = event; } break; } - case "32054-02.html": - { - if (qs.isMemoState(9)) - { + case "32054-02.html": { + if (qs.isMemoState(9)) { htmltext = event; } break; } - case "32054-03.html": - { - if (qs.isMemoState(9)) - { + case "32054-03.html": { + if (qs.isMemoState(9)) { giveAdena(player, 17647, true); addExpAndSp(player, 107387, 7369); qs.exitQuest(false, true); @@ -121,38 +106,29 @@ public final class Q00117_TheOceanOfDistantStars extends Quest } break; } - case "32055-02.html": - { - if (qs.isMemoState(1)) - { + case "32055-02.html": { + if (qs.isMemoState(1)) { qs.setMemoState(2); qs.setCond(2, true); htmltext = event; } break; } - case "32055-05.html": - { - if (qs.isMemoState(8)) - { - if (hasQuestItems(player, ENGRAVED_HAMMER)) - { + case "32055-05.html": { + if (qs.isMemoState(8)) { + if (hasQuestItems(player, ENGRAVED_HAMMER)) { qs.setMemoState(9); qs.setCond(10, true); takeItems(player, ENGRAVED_HAMMER, -1); htmltext = event; - } - else - { + } else { htmltext = "32055-06.html"; } } break; } - case "32076-02.html": - { - if (qs.isMemoState(4)) - { + case "32076-02.html": { + if (qs.isMemoState(4)) { qs.setMemoState(5); qs.setCond(5, true); giveItems(player, ENGRAVED_HAMMER, 1); @@ -160,30 +136,24 @@ public final class Q00117_TheOceanOfDistantStars extends Quest } break; } - case "32052-02.html": - { - if (qs.isMemoState(2)) - { + case "32052-02.html": { + if (qs.isMemoState(2)) { qs.setMemoState(3); qs.setCond(3, true); htmltext = event; } break; } - case "32052-05.html": - { - if (qs.isMemoState(6)) - { + case "32052-05.html": { + if (qs.isMemoState(6)) { qs.setMemoState(7); qs.setCond(7, true); htmltext = event; } break; } - case "32052-07.html": - { - if (qs.isMemoState(7) && hasQuestItems(player, BOOK_OF_GREY_STAR)) - { + case "32052-07.html": { + if (qs.isMemoState(7) && hasQuestItems(player, BOOK_OF_GREY_STAR)) { qs.setMemoState(8); qs.setCond(9, true); takeItems(player, BOOK_OF_GREY_STAR, -1); @@ -196,157 +166,116 @@ public final class Q00117_TheOceanOfDistantStars extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, 7, 3, npc); - if ((qs == null) || !Util.checkIfInRange(1500, npc, killer, true)) - { + if ((qs == null) || !Util.checkIfInRange(1500, npc, killer, true)) { return null; } - if (giveItemRandomly(killer, npc, BOOK_OF_GREY_STAR, 1, 1, MONSTER_DROP_CHANCES.get(npc.getId()), true)) - { + if (giveItemRandomly(killer, npc, BOOK_OF_GREY_STAR, 1, 1, MONSTER_DROP_CHANCES.get(npc.getId()), true)) { qs.setCond(8); } return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCompleted()) - { - if (npc.getId() == ABEY) - { + if (qs.isCompleted()) { + if (npc.getId() == ABEY) { htmltext = getAlreadyCompletedMsg(player); } - } - else if (qs.isCreated()) - { + } else if (qs.isCreated()) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "32053-01.htm" : "32053-03.htm"; - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case ABEY: - { - switch (qs.getMemoState()) - { - case 1: - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case ABEY: { + switch (qs.getMemoState()) { + case 1: { htmltext = "32053-04.html"; break; } - case 3: - { + case 3: { htmltext = "32053-05.html"; break; } - case 4: - { + case 4: { htmltext = "32053-07.html"; break; } - case 5: - { - if (hasQuestItems(player, ENGRAVED_HAMMER)) - { + case 5: { + if (hasQuestItems(player, ENGRAVED_HAMMER)) { htmltext = "32053-08.html"; } break; } - case 6: - { + case 6: { htmltext = "32053-10.html"; break; } } break; } - case GHOST_OF_A_RAILROAD_ENGINEER: - { - if (qs.isMemoState(9)) - { + case GHOST_OF_A_RAILROAD_ENGINEER: { + if (qs.isMemoState(9)) { htmltext = "32054-01.html"; } break; } - case GHOST_OF_AN_ANCIENT_RAILROAD_ENGINEER: - { - switch (qs.getMemoState()) - { - case 1: - { + case GHOST_OF_AN_ANCIENT_RAILROAD_ENGINEER: { + switch (qs.getMemoState()) { + case 1: { htmltext = "32055-01.html"; break; } - case 2: - { + case 2: { htmltext = "32055-03.html"; break; } - case 8: - { + case 8: { htmltext = "32055-04.html"; break; } - case 9: - { + case 9: { htmltext = "32055-07.html"; break; } } break; } - case BOX: - { - if (qs.isMemoState(4)) - { + case BOX: { + if (qs.isMemoState(4)) { htmltext = "32076-01.html"; - } - else if (qs.isMemoState(5)) - { + } else if (qs.isMemoState(5)) { htmltext = "32076-03.html"; } break; } - case OBI: - { - switch (qs.getMemoState()) - { - case 2: - { + case OBI: { + switch (qs.getMemoState()) { + case 2: { htmltext = "32052-01.html"; break; } - case 3: - { + case 3: { htmltext = "32052-03.html"; break; } - case 6: - { + case 6: { htmltext = "32052-04.html"; break; } - case 7: - { - if (hasQuestItems(player, BOOK_OF_GREY_STAR)) - { + case 7: { + if (hasQuestItems(player, BOOK_OF_GREY_STAR)) { htmltext = "32052-06.html"; - } - else - { + } else { htmltext = "32052-08.html"; } break; } - case 8: - { + case 8: { htmltext = "32052-09.html"; break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00118_ToLeadAndBeLed/Q00118_ToLeadAndBeLed.java b/src/main/java/com/l2jserver/datapack/quests/Q00118_ToLeadAndBeLed/Q00118_ToLeadAndBeLed.java index 594cea9aa7..aa4cf78d5e 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00118_ToLeadAndBeLed/Q00118_ToLeadAndBeLed.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00118_ToLeadAndBeLed/Q00118_ToLeadAndBeLed.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * To Lead And Be Led (118) * @author ivantotov */ -public final class Q00118_ToLeadAndBeLed extends Quest -{ +public final class Q00118_ToLeadAndBeLed extends Quest { // NPC private static final int BLACKSMITH_PINTER = 30298; // Items @@ -60,8 +59,7 @@ public final class Q00118_ToLeadAndBeLed extends Quest private static final int CRYSTAL_COUNT_1 = 922; private static final int CRYSTAL_COUNT_2 = 771; - public Q00118_ToLeadAndBeLed() - { + public Q00118_ToLeadAndBeLed() { super(118, Q00118_ToLeadAndBeLed.class.getSimpleName(), "To Lead And Be Led"); addStartNpc(BLACKSMITH_PINTER); addTalkId(BLACKSMITH_PINTER); @@ -70,77 +68,53 @@ public final class Q00118_ToLeadAndBeLed extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; // Manage Sponsor's quest events. - if (player.getApprentice() > 0) - { + if (player.getApprentice() > 0) { final L2PcInstance apprentice = L2World.getInstance().getPlayer(player.getApprentice()); - if (apprentice == null) - { + if (apprentice == null) { return htmltext; } final QuestState q118 = apprentice.getQuestState(Q00118_ToLeadAndBeLed.class.getSimpleName()); - switch (event) - { - case "sponsor": - { - if (!Util.checkIfInRange(1500, npc, apprentice, true)) - { + switch (event) { + case "sponsor": { + if (!Util.checkIfInRange(1500, npc, apprentice, true)) { htmltext = "30298-09.html"; - } - else - { - if ((q118 == null) || (!q118.isMemoState(2) && !q118.isMemoState(3))) - { + } else { + if ((q118 == null) || (!q118.isMemoState(2) && !q118.isMemoState(3))) { htmltext = "30298-14.html"; - } - else if (q118.isMemoState(2)) - { + } else if (q118.isMemoState(2)) { htmltext = "30298-08.html"; - } - else if (q118.isMemoState(3)) - { + } else if (q118.isMemoState(3)) { htmltext = "30298-12.html"; } } break; } - case "30298-10.html": - { - if (Util.checkIfInRange(1500, npc, apprentice, true) && (q118 != null) && q118.isMemoState(2)) - { - switch (q118.getMemoStateEx(1)) - { - case 1: - { - if (getQuestItemsCount(player, CRYSTAL_D) >= CRYSTAL_COUNT_1) - { + case "30298-10.html": { + if (Util.checkIfInRange(1500, npc, apprentice, true) && (q118 != null) && q118.isMemoState(2)) { + switch (q118.getMemoStateEx(1)) { + case 1: { + if (getQuestItemsCount(player, CRYSTAL_D) >= CRYSTAL_COUNT_1) { takeItems(player, CRYSTAL_D, CRYSTAL_COUNT_1); q118.setMemoState(3); q118.setCond(6, true); htmltext = event; - } - else - { + } else { htmltext = "30298-11.html"; } break; } case 2: - case 3: - { - if (getQuestItemsCount(player, CRYSTAL_D) >= CRYSTAL_COUNT_2) - { + case 3: { + if (getQuestItemsCount(player, CRYSTAL_D) >= CRYSTAL_COUNT_2) { takeItems(player, CRYSTAL_D, CRYSTAL_COUNT_2); q118.setMemoState(3); q118.setCond(6, true); htmltext = event; - } - else - { + } else { htmltext = "30298-11a.html"; } break; @@ -154,17 +128,13 @@ public final class Q00118_ToLeadAndBeLed extends Quest } final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } - switch (event) - { - case "30298-03.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "30298-03.htm": { + if (qs.isCreated()) { qs.startQuest(); qs.setMemoState(1); htmltext = event; @@ -174,15 +144,12 @@ public final class Q00118_ToLeadAndBeLed extends Quest case "30298-05a.html": case "30298-05b.html": case "30298-05c.html": - case "30298-05g.html": - { + case "30298-05g.html": { htmltext = event; break; } - case "30298-05d.html": - { - if (qs.isMemoState(1) && (getQuestItemsCount(player, BLOOD_OF_MAILLE_LIZARDMAN) >= 10)) - { + case "30298-05d.html": { + if (qs.isMemoState(1) && (getQuestItemsCount(player, BLOOD_OF_MAILLE_LIZARDMAN) >= 10)) { takeItems(player, BLOOD_OF_MAILLE_LIZARDMAN, -1); qs.setMemoState(2); qs.setMemoStateEx(1, 1); @@ -191,10 +158,8 @@ public final class Q00118_ToLeadAndBeLed extends Quest } break; } - case "30298-05e.html": - { - if (qs.isMemoState(1) && (getQuestItemsCount(player, BLOOD_OF_MAILLE_LIZARDMAN) >= 10)) - { + case "30298-05e.html": { + if (qs.isMemoState(1) && (getQuestItemsCount(player, BLOOD_OF_MAILLE_LIZARDMAN) >= 10)) { takeItems(player, BLOOD_OF_MAILLE_LIZARDMAN, -1); qs.setMemoState(2); qs.setMemoStateEx(1, 2); @@ -203,10 +168,8 @@ public final class Q00118_ToLeadAndBeLed extends Quest } break; } - case "30298-05f.html": - { - if (qs.isMemoState(1) && (getQuestItemsCount(player, BLOOD_OF_MAILLE_LIZARDMAN) >= 10)) - { + case "30298-05f.html": { + if (qs.isMemoState(1) && (getQuestItemsCount(player, BLOOD_OF_MAILLE_LIZARDMAN) >= 10)) { takeItems(player, BLOOD_OF_MAILLE_LIZARDMAN, -1); qs.setMemoState(2); qs.setMemoStateEx(1, 3); @@ -220,37 +183,26 @@ public final class Q00118_ToLeadAndBeLed extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted()) - { - switch (npc.getId()) - { + if ((qs != null) && qs.isStarted()) { + switch (npc.getId()) { case MAILLE_LIZARDMAN: case MAILLE_LIZARDMAN_SCOUT: - case MAILLE_LIZARDMAN_GUARD: - { - if (qs.isMemoState(1)) - { - if (giveItemRandomly(killer, npc, BLOOD_OF_MAILLE_LIZARDMAN, 1, 10, 7, true)) - { + case MAILLE_LIZARDMAN_GUARD: { + if (qs.isMemoState(1)) { + if (giveItemRandomly(killer, npc, BLOOD_OF_MAILLE_LIZARDMAN, 1, 10, 7, true)) { qs.setCond(2); } } break; } - case KING_OF_THE_ARANEID: - { - if (qs.isMemoState(4)) - { - if (killer.getSponsor() > 0) - { + case KING_OF_THE_ARANEID: { + if (qs.isMemoState(4)) { + if (killer.getSponsor() > 0) { final L2PcInstance c0 = L2World.getInstance().getPlayer(killer.getSponsor()); - if ((c0 != null) && Util.checkIfInRange(1500, npc, c0, true)) - { - if (giveItemRandomly(killer, npc, LEG_OF_KING_ARANEID, 1, 8, 7, true)) - { + if ((c0 != null) && Util.checkIfInRange(1500, npc, c0, true)) { + if (giveItemRandomly(killer, npc, LEG_OF_KING_ARANEID, 1, 8, 7, true)) { qs.setCond(8); } } @@ -264,120 +216,75 @@ public final class Q00118_ToLeadAndBeLed extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); final QuestState q123 = player.getQuestState(Q00123_TheLeaderAndTheFollower.class.getSimpleName()); String htmltext = getNoQuestMsg(player); - switch (qs.getState()) - { - case State.CREATED: - { - if ((q123 != null) && q123.isStarted()) - { + switch (qs.getState()) { + case State.CREATED: { + if ((q123 != null) && q123.isStarted()) { htmltext = "30298-02b.html"; - } - else if ((q123 != null) && q123.isCompleted()) - { + } else if ((q123 != null) && q123.isCompleted()) { htmltext = "30298-02a.htm"; - } - else if ((player.getLevel() >= MIN_LEVEL) && (player.getPledgeType() == -1) && (player.getSponsor() > 0)) - { + } else if ((player.getLevel() >= MIN_LEVEL) && (player.getPledgeType() == -1) && (player.getSponsor() > 0)) { htmltext = "30298-01.htm"; - } - else - { + } else { htmltext = "30298-02.htm"; } break; } - case State.STARTED: - { - if (qs.isMemoState(1)) - { - if (getQuestItemsCount(player, BLOOD_OF_MAILLE_LIZARDMAN) < 10) - { + case State.STARTED: { + if (qs.isMemoState(1)) { + if (getQuestItemsCount(player, BLOOD_OF_MAILLE_LIZARDMAN) < 10) { htmltext = "30298-04.html"; - } - else - { + } else { htmltext = "30298-05.html"; } - } - else if (qs.isMemoState(2)) - { - if (player.getSponsor() == 0) - { - if (qs.getMemoStateEx(1) == 1) - { + } else if (qs.isMemoState(2)) { + if (player.getSponsor() == 0) { + if (qs.getMemoStateEx(1) == 1) { htmltext = "30298-06a.html"; - } - else if (qs.getMemoStateEx(1) == 2) - { + } else if (qs.getMemoStateEx(1) == 2) { htmltext = "30298-06b.html"; - } - else if (qs.getMemoStateEx(1) == 3) - { + } else if (qs.getMemoStateEx(1) == 3) { htmltext = "30298-06c.html"; } - } - else - { + } else { final L2PcInstance c0 = L2World.getInstance().getPlayer(player.getSponsor()); - if ((c0 != null) && Util.checkIfInRange(1500, npc, c0, true)) - { + if ((c0 != null) && Util.checkIfInRange(1500, npc, c0, true)) { htmltext = "30298-07.html"; - } - else - { - if (qs.getMemoStateEx(1) == 1) - { + } else { + if (qs.getMemoStateEx(1) == 1) { htmltext = "30298-06.html"; - } - else if (qs.getMemoStateEx(1) == 2) - { + } else if (qs.getMemoStateEx(1) == 2) { htmltext = "30298-06d.html"; - } - else if (qs.getMemoStateEx(1) == 3) - { + } else if (qs.getMemoStateEx(1) == 3) { htmltext = "30298-06e.html"; } } } - } - else if (qs.isMemoState(3)) - { + } else if (qs.isMemoState(3)) { qs.setMemoState(4); qs.setCond(7, true); htmltext = "30298-15.html"; - } - else if (qs.isMemoState(4)) - { - if (getQuestItemsCount(player, LEG_OF_KING_ARANEID) < 8) - { + } else if (qs.isMemoState(4)) { + if (getQuestItemsCount(player, LEG_OF_KING_ARANEID) < 8) { htmltext = "30298-16.html"; - } - else - { - if (qs.getMemoStateEx(1) == 1) - { + } else { + if (qs.getMemoStateEx(1) == 1) { giveItems(player, CLAN_OATH_HELM, 1); giveItems(player, CLAN_OATH_ARMOR, 1); giveItems(player, CLAN_OATH_GAUNTLETS_HEAVY_ARMOR, 1); giveItems(player, CLAN_OATH_SABATON_HEAVY_ARMOR, 1); takeItems(player, LEG_OF_KING_ARANEID, -1); - } - else if (qs.getMemoStateEx(1) == 2) - { + } else if (qs.getMemoStateEx(1) == 2) { giveItems(player, CLAN_OATH_HELM, 1); giveItems(player, CLAN_OATH_BRIGANDINE, 1); giveItems(player, CLAN_OATH_LEATHER_GLOVES_LIGHT_ARMOR, 1); giveItems(player, CLAN_OATH_BOOTS_LIGHT_ARMOR, 1); takeItems(player, LEG_OF_KING_ARANEID, -1); - } - else if (qs.getMemoStateEx(1) == 3) - { + } else if (qs.getMemoStateEx(1) == 3) { giveItems(player, CLAN_OATH_HELM, 1); giveItems(player, CLAN_OATH_AKETON, 1); giveItems(player, CLAN_OATH_PADDED_GLOVES_ROBE, 1); @@ -390,8 +297,7 @@ public final class Q00118_ToLeadAndBeLed extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00119_LastImperialPrince/Q00119_LastImperialPrince.java b/src/main/java/com/l2jserver/datapack/quests/Q00119_LastImperialPrince/Q00119_LastImperialPrince.java index 8827cd8029..2b68a40c17 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00119_LastImperialPrince/Q00119_LastImperialPrince.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00119_LastImperialPrince/Q00119_LastImperialPrince.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.State; * Last Imperial Prince (119) * @author Adry_85 */ -public class Q00119_LastImperialPrince extends Quest -{ +public class Q00119_LastImperialPrince extends Quest { // NPCs private static final int NAMELESS_SPIRIT = 31453; private static final int DEVORIN = 32009; @@ -38,42 +37,34 @@ public class Q00119_LastImperialPrince extends Quest // Misc private static final int MIN_LEVEL = 74; - public Q00119_LastImperialPrince() - { + public Q00119_LastImperialPrince() { super(119, Q00119_LastImperialPrince.class.getSimpleName(), "Last Imperial Prince"); addStartNpc(NAMELESS_SPIRIT); addTalkId(NAMELESS_SPIRIT, DEVORIN); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "31453-02.htm": case "31453-03.htm": - case "31453-10.html": - { + case "31453-10.html": { htmltext = event; break; } - case "31453-04.html": - { + case "31453-04.html": { st.startQuest(); htmltext = event; break; } - case "31453-11.html": - { - if (st.isCond(2)) - { + case "31453-11.html": { + if (st.isCond(2)) { st.giveAdena(150292, true); st.addExpAndSp(902439, 90067); st.exitQuest(false, true); @@ -81,15 +72,12 @@ public class Q00119_LastImperialPrince extends Quest } break; } - case "brooch": - { + case "brooch": { htmltext = (st.hasQuestItems(ANTIQUE_BROOCH)) ? "32009-02.html" : "32009-03.html"; break; } - case "32009-04.html": - { - if (st.isCond(1) && st.hasQuestItems(ANTIQUE_BROOCH)) - { + case "32009-04.html": { + if (st.isCond(1) && st.hasQuestItems(ANTIQUE_BROOCH)) { st.setCond(2, true); htmltext = event; } @@ -100,54 +88,36 @@ public class Q00119_LastImperialPrince extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.COMPLETED: - { - if (npc.getId() == NAMELESS_SPIRIT) - { + switch (st.getState()) { + case State.COMPLETED: { + if (npc.getId() == NAMELESS_SPIRIT) { htmltext = "31453-06.html"; } break; } - case State.CREATED: - { + case State.CREATED: { htmltext = ((player.getLevel() >= MIN_LEVEL) && st.hasQuestItems(ANTIQUE_BROOCH)) ? "31453-01.htm" : "31453-05.html"; break; } - case State.STARTED: - { - if (npc.getId() == NAMELESS_SPIRIT) - { - if (st.isCond(1)) - { - if (st.hasQuestItems(ANTIQUE_BROOCH)) - { + case State.STARTED: { + if (npc.getId() == NAMELESS_SPIRIT) { + if (st.isCond(1)) { + if (st.hasQuestItems(ANTIQUE_BROOCH)) { htmltext = "31453-07.html"; - } - else - { + } else { htmltext = "31453-08.html"; st.exitQuest(true); } - } - else if (st.isCond(2)) - { + } else if (st.isCond(2)) { htmltext = "31453-09.html"; } - } - else if (npc.getId() == DEVORIN) - { - if (st.isCond(1)) - { + } else if (npc.getId() == DEVORIN) { + if (st.isCond(1)) { htmltext = "32009-01.html"; - } - else if (st.isCond(2)) - { + } else if (st.isCond(2)) { htmltext = "32009-05.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00120_PavelsLastResearch/Q00120_PavelsLastResearch.java b/src/main/java/com/l2jserver/datapack/quests/Q00120_PavelsLastResearch/Q00120_PavelsLastResearch.java index c1b46afa2f..9f4d40a760 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00120_PavelsLastResearch/Q00120_PavelsLastResearch.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00120_PavelsLastResearch/Q00120_PavelsLastResearch.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.model.skills.Skill; * Pavel's Last Research (120) * @author jurchiks */ -public final class Q00120_PavelsLastResearch extends Quest -{ +public final class Q00120_PavelsLastResearch extends Quest { // NPCs private static final int SUSPICIOUS_LOOKING_PILE_OF_STONES = 32046; private static final int WENDY = 32047; @@ -55,8 +54,7 @@ public final class Q00120_PavelsLastResearch extends Quest // Rewards private static final int SEALED_PHOENIX_EARRING = 6324; - public Q00120_PavelsLastResearch() - { + public Q00120_PavelsLastResearch() { super(120, Q00120_PavelsLastResearch.class.getSimpleName(), "Pavel's Last Research"); addStartNpc(SUSPICIOUS_LOOKING_PILE_OF_STONES); addTalkId(SUSPICIOUS_LOOKING_PILE_OF_STONES, WENDY, YUMI, WEATHERMASTER_1, WEATHERMASTER_2, WEATHERMASTER_3, DOCTOR_CHAOS_SECRET_BOOKSHELF); @@ -65,75 +63,57 @@ public final class Q00120_PavelsLastResearch extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return super.onAdvEvent(event, npc, player); } String html = null; - switch (event) - { + switch (event) { case "32046-03.html": case "32046-04.htm": case "32046-05.html": - case "32046-06.html": - { - if (qs.isCreated()) - { + case "32046-06.html": { + if (qs.isCreated()) { html = event; } break; } - case "quest_accept": - { - if (qs.isCreated() && player.hasQuestCompleted(Q00114_ResurrectionOfAnOldManager.class.getSimpleName())) - { - if (player.getLevel() >= 70) - { + case "quest_accept": { + if (qs.isCreated() && player.hasQuestCompleted(Q00114_ResurrectionOfAnOldManager.class.getSimpleName())) { + if (player.getLevel() >= 70) { qs.startQuest(); qs.setMemoState(1); html = "32046-08.htm"; - } - else - { + } else { html = "32046-07.htm"; } } break; } - case "32046-10.html": - { - if (qs.isMemoState(1)) - { + case "32046-10.html": { + if (qs.isMemoState(1)) { html = event; } break; } - case "32046-11.html": - { - if (qs.isMemoState(1)) - { + case "32046-11.html": { + if (qs.isMemoState(1)) { qs.setMemoState(2); qs.setCond(2, true); html = event; } break; } - case "32046-14.html": - { - if (qs.isMemoState(3)) - { + case "32046-14.html": { + if (qs.isMemoState(3)) { html = event; } break; } - case "32046-15.html": - { - if (qs.isMemoState(3)) - { + case "32046-15.html": { + if (qs.isMemoState(3)) { giveItems(player, FLOWER_OF_PAVEL, 1); qs.setMemoState(4); qs.setCond(6, true); @@ -147,18 +127,14 @@ public final class Q00120_PavelsLastResearch extends Quest case "32046-21.html": case "32046-22.html": case "32046-23.html": - case "32046-24.html": - { - if (qs.isMemoState(7)) - { + case "32046-24.html": { + if (qs.isMemoState(7)) { html = event; } break; } - case "32046-25.html": - { - if (qs.isMemoState(7)) - { + case "32046-25.html": { + if (qs.isMemoState(7)) { qs.setMemoState(8); qs.setCond(10, true); html = event; @@ -167,10 +143,8 @@ public final class Q00120_PavelsLastResearch extends Quest } case "32046-26.html": case "32046-27.html": - case "32046-28.html": - { - if (qs.isMemoState(8)) - { + case "32046-28.html": { + if (qs.isMemoState(8)) { html = event; } break; @@ -179,18 +153,14 @@ public final class Q00120_PavelsLastResearch extends Quest case "32046-31.html": case "32046-32.html": case "32046-33.html": - case "32046-34.html": - { - if (qs.isMemoState(11)) - { + case "32046-34.html": { + if (qs.isMemoState(11)) { html = event; } break; } - case "32046-35.html": - { - if (qs.isMemoState(11)) - { + case "32046-35.html": { + if (qs.isMemoState(11)) { qs.setMemoState(12); qs.setCond(13, true); html = event; @@ -199,28 +169,22 @@ public final class Q00120_PavelsLastResearch extends Quest } case "32046-38.html": case "32046-39.html": - case "32046-40.html": - { - if (qs.isMemoState(19)) - { + case "32046-40.html": { + if (qs.isMemoState(19)) { html = event; } break; } - case "32046-41.html": - { - if (qs.isMemoState(19)) - { + case "32046-41.html": { + if (qs.isMemoState(19)) { qs.setMemoState(20); qs.setCond(20, true); html = event; } break; } - case "32046-44.html": - { - if (qs.isMemoState(22)) - { + case "32046-44.html": { + if (qs.isMemoState(22)) { giveItems(player, HEART_OF_ATLANTA, 1); qs.setMemoState(23); qs.setCond(23, true); @@ -231,36 +195,28 @@ public final class Q00120_PavelsLastResearch extends Quest case "32047-02.html": case "32047-03.html": case "32047-04.html": - case "32047-05.html": - { - if (qs.isMemoState(2)) - { + case "32047-05.html": { + if (qs.isMemoState(2)) { html = event; } break; } - case "32047-06.html": - { - if (qs.isMemoState(2)) - { + case "32047-06.html": { + if (qs.isMemoState(2)) { qs.setMemoState(3); qs.setCond(5, true); html = event; } break; } - case "32047-09.html": - { - if (qs.isMemoState(4) && hasQuestItems(player, FLOWER_OF_PAVEL)) - { + case "32047-09.html": { + if (qs.isMemoState(4) && hasQuestItems(player, FLOWER_OF_PAVEL)) { html = event; } break; } - case "32047-10.html": - { - if (qs.isMemoState(4) && hasQuestItems(player, FLOWER_OF_PAVEL)) - { + case "32047-10.html": { + if (qs.isMemoState(4) && hasQuestItems(player, FLOWER_OF_PAVEL)) { takeItems(player, FLOWER_OF_PAVEL, -1); qs.setMemoState(5); qs.setCond(7, true); @@ -269,36 +225,28 @@ public final class Q00120_PavelsLastResearch extends Quest break; } case "32047-13.html": - case "32047-14.html": - { - if (qs.isMemoState(6)) - { + case "32047-14.html": { + if (qs.isMemoState(6)) { html = event; } break; } - case "32047-15.html": - { - if (qs.isMemoState(6)) - { + case "32047-15.html": { + if (qs.isMemoState(6)) { qs.setMemoState(7); qs.setCond(9, true); html = event; } break; } - case "32047-18.html": - { - if (qs.isMemoState(12)) - { + case "32047-18.html": { + if (qs.isMemoState(12)) { html = event; } break; } - case "32047-19.html": - { - if (qs.isMemoState(12)) - { + case "32047-19.html": { + if (qs.isMemoState(12)) { qs.setMemoState(13); qs.setCond(14, true); html = event; @@ -308,18 +256,14 @@ public final class Q00120_PavelsLastResearch extends Quest case "32047-23.html": case "32047-24.html": case "32047-25.html": - case "32047-26.html": - { - if (qs.isMemoState(23) && hasQuestItems(player, HEART_OF_ATLANTA)) - { + case "32047-26.html": { + if (qs.isMemoState(23) && hasQuestItems(player, HEART_OF_ATLANTA)) { html = event; } break; } - case "32047-27.html": - { - if (qs.isMemoState(23) && hasQuestItems(player, HEART_OF_ATLANTA)) - { + case "32047-27.html": { + if (qs.isMemoState(23) && hasQuestItems(player, HEART_OF_ATLANTA)) { takeItems(player, HEART_OF_ATLANTA, -1); qs.setMemoState(24); qs.setCond(24, true); @@ -328,36 +272,28 @@ public final class Q00120_PavelsLastResearch extends Quest break; } case "32047-28.html": - case "32047-29.html": - { - if (qs.isMemoState(24)) - { + case "32047-29.html": { + if (qs.isMemoState(24)) { html = event; } break; } - case "32047-30.html": - { - if (qs.isMemoState(24)) - { + case "32047-30.html": { + if (qs.isMemoState(24)) { qs.setMemoState(25); html = event; } break; } case "32047-31.html": - case "32047-32.html": - { - if (qs.isMemoState(25)) - { + case "32047-32.html": { + if (qs.isMemoState(25)) { html = event; } break; } - case "32047-33.html": - { - if (qs.isMemoState(25)) - { + case "32047-33.html": { + if (qs.isMemoState(25)) { giveItems(player, WENDYS_NECKLACE, 1); qs.setMemoState(26); qs.setCond(25, true); @@ -365,28 +301,22 @@ public final class Q00120_PavelsLastResearch extends Quest } break; } - case "32041-02.html": - { - if (qs.isMemoState(2)) - { + case "32041-02.html": { + if (qs.isMemoState(2)) { html = event; } break; } - case "32041-03.html": - { - if (qs.isMemoState(2) && qs.isMemoStateEx(0, 0)) - { + case "32041-03.html": { + if (qs.isMemoState(2) && qs.isMemoStateEx(0, 0)) { qs.setMemoStateEx(0, 1); qs.setCond(3, true); html = event; } break; } - case "32041-05.html": - { - if (qs.isMemoState(2) && qs.isMemoStateEx(0, 0)) - { + case "32041-05.html": { + if (qs.isMemoState(2) && qs.isMemoStateEx(0, 0)) { qs.setMemoStateEx(0, 2); qs.setCond(4, true); html = event; @@ -396,36 +326,28 @@ public final class Q00120_PavelsLastResearch extends Quest case "32041-09.html": case "32041-10.html": case "32041-11.html": - case "32041-12.html": - { - if (qs.isMemoState(5)) - { + case "32041-12.html": { + if (qs.isMemoState(5)) { html = event; } break; } - case "32041-13.html": - { - if (qs.isMemoState(5)) - { + case "32041-13.html": { + if (qs.isMemoState(5)) { qs.setMemoState(6); qs.setCond(8, true); html = event; } break; } - case "32041-16.html": - { - if (qs.isMemoState(14) && hasQuestItems(player, LOCKUP_RESEARCH_REPORT)) - { + case "32041-16.html": { + if (qs.isMemoState(14) && hasQuestItems(player, LOCKUP_RESEARCH_REPORT)) { html = event; } break; } - case "32041-17.html": - { - if (qs.isMemoState(14) && hasQuestItems(player, LOCKUP_RESEARCH_REPORT)) - { + case "32041-17.html": { + if (qs.isMemoState(14) && hasQuestItems(player, LOCKUP_RESEARCH_REPORT)) { giveItems(player, KEY_OF_ENIGMA, 1); qs.setMemoState(15); qs.setCond(16, true); @@ -433,35 +355,27 @@ public final class Q00120_PavelsLastResearch extends Quest } break; } - case "32041-20.html": - { - if (qs.isMemoState(15) && hasQuestItems(player, RESEARCH_REPORT, KEY_OF_ENIGMA)) - { + case "32041-20.html": { + if (qs.isMemoState(15) && hasQuestItems(player, RESEARCH_REPORT, KEY_OF_ENIGMA)) { html = event; } break; } case "pavel": - case "e=mc2": - { - if (qs.isMemoState(15) && hasQuestItems(player, RESEARCH_REPORT, KEY_OF_ENIGMA)) - { + case "e=mc2": { + if (qs.isMemoState(15) && hasQuestItems(player, RESEARCH_REPORT, KEY_OF_ENIGMA)) { html = "32041-21.html"; } break; } - case "wdl": - { - if (qs.isMemoState(15) && hasQuestItems(player, RESEARCH_REPORT, KEY_OF_ENIGMA)) - { + case "wdl": { + if (qs.isMemoState(15) && hasQuestItems(player, RESEARCH_REPORT, KEY_OF_ENIGMA)) { html = "32041-22.html"; } break; } - case "32041-23.html": - { - if (qs.isMemoState(15) && hasQuestItems(player, RESEARCH_REPORT, KEY_OF_ENIGMA)) - { + case "32041-23.html": { + if (qs.isMemoState(15) && hasQuestItems(player, RESEARCH_REPORT, KEY_OF_ENIGMA)) { takeItems(player, KEY_OF_ENIGMA, -1); qs.setMemoState(16); qs.setCond(17, true); @@ -470,10 +384,8 @@ public final class Q00120_PavelsLastResearch extends Quest break; } case "32041-24.html": - case "32041-26.html": - { - if (qs.isMemoState(16) && hasQuestItems(player, RESEARCH_REPORT)) - { + case "32041-26.html": { + if (qs.isMemoState(16) && hasQuestItems(player, RESEARCH_REPORT)) { html = event; } break; @@ -482,18 +394,14 @@ public final class Q00120_PavelsLastResearch extends Quest case "32041-30.html": case "32041-31.html": case "32041-32.html": - case "32041-33.html": - { - if (qs.isMemoState(26) && hasQuestItems(player, WENDYS_NECKLACE)) - { + case "32041-33.html": { + if (qs.isMemoState(26) && hasQuestItems(player, WENDYS_NECKLACE)) { html = event; } break; } - case "32041-34.html": - { - if (qs.isMemoState(26) && hasQuestItems(player, WENDYS_NECKLACE)) - { + case "32041-34.html": { + if (qs.isMemoState(26) && hasQuestItems(player, WENDYS_NECKLACE)) { takeItems(player, WENDYS_NECKLACE, -1); rewardItems(player, SEALED_PHOENIX_EARRING, 1); giveAdena(player, 783720, true); @@ -503,10 +411,8 @@ public final class Q00120_PavelsLastResearch extends Quest } break; } - case "32042-02.html": - { - if (qs.isMemoState(8)) - { + case "32042-02.html": { + if (qs.isMemoState(8)) { qs.setMemoStateEx(0, 0); html = event; } @@ -520,18 +426,14 @@ public final class Q00120_PavelsLastResearch extends Quest case "wm1_1_n": case "wm1_1_s": case "wm1_1_t": - case "wm1_1_u": - { - if (qs.isMemoState(8)) - { + case "wm1_1_u": { + if (qs.isMemoState(8)) { html = "32042-03.html"; } break; } - case "wm1_1_a": - { - if (qs.isMemoState(8)) - { + case "wm1_1_a": { + if (qs.isMemoState(8)) { qs.setMemoStateEx(0, 1); html = "32042-03.html"; } @@ -545,18 +447,14 @@ public final class Q00120_PavelsLastResearch extends Quest case "wm1_2_m": case "wm1_2_n": case "wm1_2_s": - case "wm1_2_u": - { - if (qs.isMemoState(8)) - { + case "wm1_2_u": { + if (qs.isMemoState(8)) { html = "32042-04.html"; } break; } - case "wm1_2_t": - { - if (qs.isMemoState(8)) - { + case "wm1_2_t": { + if (qs.isMemoState(8)) { qs.setMemoStateEx(0, 10 + (qs.getMemoStateEx(0) % 10)); html = "32042-04.html"; } @@ -570,27 +468,20 @@ public final class Q00120_PavelsLastResearch extends Quest case "wm1_3_n": case "wm1_3_s": case "wm1_3_t": - case "wm1_3_u": - { - if (qs.isMemoState(8)) - { + case "wm1_3_u": { + if (qs.isMemoState(8)) { html = "32042-05.html"; } break; } - case "wm1_3_l": - { - if (qs.isMemoState(8)) - { - if (qs.isMemoStateEx(0, 11)) - { + case "wm1_3_l": { + if (qs.isMemoState(8)) { + if (qs.isMemoStateEx(0, 11)) { qs.setMemoState(9); qs.setCond(11, true); qs.setMemoStateEx(0, 0); html = "32042-06.html"; - } - else - { + } else { html = "32042-05.html"; } } @@ -598,52 +489,39 @@ public final class Q00120_PavelsLastResearch extends Quest } case "32042-15.html": case "32042-06.html": - case "32042-07.html": - { - if (qs.isMemoState(9)) - { + case "32042-07.html": { + if (qs.isMemoState(9)) { html = event; } break; } - case "32042-08.html": - { - if (qs.isMemoState(9)) - { + case "32042-08.html": { + if (qs.isMemoState(9)) { qs.setMemoState(10); playSound(player, Sound.AMBSOUND_PERCUSSION_01); html = event; } break; } - case "wm1_return": - { - if (qs.isMemoState(10)) - { - if (qs.isMemoStateEx(0, 10101)) - { + case "wm1_return": { + if (qs.isMemoState(10)) { + if (qs.isMemoStateEx(0, 10101)) { html = "32042-13.html"; - } - else - { + } else { html = "32042-09.html"; } } break; } - case "32042-10.html": - { - if (qs.isMemoState(10)) - { + case "32042-10.html": { + if (qs.isMemoState(10)) { qs.setMemoStateEx(0, ((qs.getMemoStateEx(0) / 10) * 10) + 1); html = event; } break; } - case "32042-11.html": - { - if (qs.isMemoState(10)) - { + case "32042-11.html": { + if (qs.isMemoState(10)) { final int memoStateEx = qs.getMemoStateEx(0); final int i1 = (memoStateEx / 1000) * 1000; final int i2 = (memoStateEx % 100) + 100; @@ -652,19 +530,15 @@ public final class Q00120_PavelsLastResearch extends Quest } break; } - case "32042-12.html": - { - if (qs.isMemoState(10)) - { + case "32042-12.html": { + if (qs.isMemoState(10)) { qs.setMemoStateEx(0, 10000 + (qs.getMemoStateEx(0) % 10000)); html = event; } break; } - case "32042-14.html": - { - if (qs.isMemoState(10) && qs.isMemoStateEx(0, 10101)) - { + case "32042-14.html": { + if (qs.isMemoState(10) && qs.isMemoStateEx(0, 10101)) { qs.setMemoState(11); qs.setCond(12, true); qs.setMemoStateEx(0, 0); @@ -672,10 +546,8 @@ public final class Q00120_PavelsLastResearch extends Quest } break; } - case "32043-02.html": - { - if (qs.isMemoState(16)) - { + case "32043-02.html": { + if (qs.isMemoState(16)) { qs.setMemoStateEx(0, 0); html = event; } @@ -689,18 +561,14 @@ public final class Q00120_PavelsLastResearch extends Quest case "wm2_1_m": case "wm2_1_n": case "wm2_1_v": - case "wm2_1_x": - { - if (qs.isMemoState(16)) - { + case "wm2_1_x": { + if (qs.isMemoState(16)) { html = "32043-03.html"; } break; } - case "wm2_1_w": - { - if (qs.isMemoState(16)) - { + case "wm2_1_w": { + if (qs.isMemoState(16)) { qs.setMemoStateEx(0, 1); html = "32043-03.html"; } @@ -714,18 +582,14 @@ public final class Q00120_PavelsLastResearch extends Quest case "wm2_2_n": case "wm2_2_v": case "wm2_2_w": - case "wm2_2_x": - { - if (qs.isMemoState(16)) - { + case "wm2_2_x": { + if (qs.isMemoState(16)) { html = "32043-04.html"; } break; } - case "wm2_2_d": - { - if (qs.isMemoState(16)) - { + case "wm2_2_d": { + if (qs.isMemoState(16)) { qs.setMemoStateEx(0, 10 + (qs.getMemoStateEx(0) % 10)); html = "32043-04.html"; } @@ -739,27 +603,20 @@ public final class Q00120_PavelsLastResearch extends Quest case "wm2_3_n": case "wm2_3_v": case "wm2_3_w": - case "wm2_3_x": - { - if (qs.isMemoState(8)) - { + case "wm2_3_x": { + if (qs.isMemoState(8)) { html = "32043-05.html"; } break; } - case "wm2_3_l": - { - if (qs.isMemoState(16)) - { - if (qs.isMemoStateEx(0, 11)) - { + case "wm2_3_l": { + if (qs.isMemoState(16)) { + if (qs.isMemoStateEx(0, 11)) { qs.setMemoState(17); qs.setCond(18, true); qs.setMemoStateEx(0, 0); html = "32043-06.html"; - } - else - { + } else { html = "32043-05.html"; } } @@ -771,83 +628,61 @@ public final class Q00120_PavelsLastResearch extends Quest case "32043-28.html": case "32043-06.html": case "32043-07.html": - case "32043-08.html": - { - if (qs.isMemoState(17)) - { + case "32043-08.html": { + if (qs.isMemoState(17)) { html = event; } break; } - case "32043-09.html": - { - if (qs.isMemoState(17)) - { + case "32043-09.html": { + if (qs.isMemoState(17)) { qs.setMemoState(18); html = event; } break; } case "32043-10.html": - case "wm2_return": - { - if (qs.isMemoState(18)) - { - if (qs.isMemoStateEx(0, 1111)) - { + case "wm2_return": { + if (qs.isMemoState(18)) { + if (qs.isMemoStateEx(0, 1111)) { html = "32043-12.html"; - } - else - { + } else { html = "32043-11.html"; } } break; } - case "32043-13.html": - { - if (qs.isMemoState(18)) - { + case "32043-13.html": { + if (qs.isMemoState(18)) { qs.setMemoStateEx(0, ((qs.getMemoStateEx(0) / 10) * 10) + 1); html = event; } break; } - case "32043-14.html": - { - if (qs.isMemoState(18)) - { + case "32043-14.html": { + if (qs.isMemoState(18)) { html = event; } break; } - case "wm2_output": - { - if (qs.isMemoState(18)) - { - if (qs.getMemoStateEx(0) < 1000) - { + case "wm2_output": { + if (qs.isMemoState(18)) { + if (qs.getMemoStateEx(0) < 1000) { html = "32043-15.html"; - } - else - { + } else { html = "32043-18.html"; } } break; } - case "32043-16.html": - { - if (qs.isMemoState(18)) - { + case "32043-16.html": { + if (qs.isMemoState(18)) { html = event; } break; } - case "32043-17.html": - { - if (qs.isMemoState(18)) - { + case "32043-17.html": { + if (qs.isMemoState(18)) { final int memoStateEx = qs.getMemoStateEx(0); final int i1 = (memoStateEx / 10000) * 10000; final int i2 = (memoStateEx % 1000) + 1000; @@ -858,18 +693,14 @@ public final class Q00120_PavelsLastResearch extends Quest break; } case "32043-19.html": - case "32043-20.html": - { - if (qs.isMemoState(18)) - { + case "32043-20.html": { + if (qs.isMemoState(18)) { html = event; } break; } - case "32043-21.html": - { - if (qs.isMemoState(18)) - { + case "32043-21.html": { + if (qs.isMemoState(18)) { final int memoStateEx = qs.getMemoStateEx(0); final int i1 = (memoStateEx / 100) * 100; final int i2 = (memoStateEx % 10) + 10; @@ -878,10 +709,8 @@ public final class Q00120_PavelsLastResearch extends Quest } break; } - case "32043-22.html": - { - if (qs.isMemoState(18) && qs.isMemoStateEx(0, 1111)) - { + case "32043-22.html": { + if (qs.isMemoState(18) && qs.isMemoStateEx(0, 1111)) { qs.setMemoState(19); qs.setCond(19, true); qs.setMemoStateEx(0, 0); @@ -890,18 +719,14 @@ public final class Q00120_PavelsLastResearch extends Quest break; } case "32043-24.html": - case "32043-25.html": - { - if (qs.isMemoState(18)) - { + case "32043-25.html": { + if (qs.isMemoState(18)) { html = event; } break; } - case "32043-26.html": - { - if (qs.isMemoState(18)) - { + case "32043-26.html": { + if (qs.isMemoState(18)) { final int memoStateEx = qs.getMemoStateEx(0); final int i1 = (memoStateEx / 1000) * 1000; final int i2 = (memoStateEx % 100) + 100; @@ -910,18 +735,14 @@ public final class Q00120_PavelsLastResearch extends Quest } break; } - case "32043-27.html": - { - if (qs.isMemoState(18)) - { + case "32043-27.html": { + if (qs.isMemoState(18)) { html = event; } break; } - case "32044-02.html": - { - if (qs.isMemoState(20)) - { + case "32044-02.html": { + if (qs.isMemoState(20)) { qs.setMemoStateEx(0, 0); html = event; } @@ -935,18 +756,14 @@ public final class Q00120_PavelsLastResearch extends Quest case "wm3_1_m": case "wm3_1_v": case "wm3_1_w": - case "wm3_1_x": - { - if (qs.isMemoState(20)) - { + case "wm3_1_x": { + if (qs.isMemoState(20)) { html = "32044-03.html"; } break; } - case "wm3_1_n": - { - if (qs.isMemoState(20)) - { + case "wm3_1_n": { + if (qs.isMemoState(20)) { qs.setMemoStateEx(0, 1); html = "32044-03.html"; } @@ -960,18 +777,14 @@ public final class Q00120_PavelsLastResearch extends Quest case "wm3_2_7": case "wm3_2_8": case "wm3_2_9": - case "wm3_2_10": - { - if (qs.isMemoState(20)) - { + case "wm3_2_10": { + if (qs.isMemoState(20)) { html = "32044-04.html"; } break; } - case "wm3_2_4": - { - if (qs.isMemoState(20)) - { + case "wm3_2_4": { + if (qs.isMemoState(20)) { qs.setMemoStateEx(0, 10 + (qs.getMemoStateEx(0) % 10)); html = "32044-04.html"; } @@ -985,60 +798,44 @@ public final class Q00120_PavelsLastResearch extends Quest case "wm3_3_7": case "wm3_3_8": case "wm3_3_9": - case "wm3_3_10": - { - if (qs.isMemoState(20)) - { + case "wm3_3_10": { + if (qs.isMemoState(20)) { html = "32044-05.html"; } break; } - case "wm3_3_5": - { - if (qs.isMemoState(20)) - { - if (qs.isMemoStateEx(0, 11)) - { + case "wm3_3_5": { + if (qs.isMemoState(20)) { + if (qs.isMemoStateEx(0, 11)) { qs.setMemoState(21); qs.setCond(21, true); qs.setMemoStateEx(0, 0); playSound(player, Sound.AMBSOUND_PERCUSSION_02); html = "32044-06.html"; - } - else - { + } else { html = "32044-05.html"; } } break; } - case "32044-07.html": - { - if (qs.isMemoState(21)) - { + case "32044-07.html": { + if (qs.isMemoState(21)) { html = event; } break; } - case "wm3_observe": - { - if (qs.isMemoState(21)) - { - if ((qs.getMemoStateEx(0) % 100) == 11) - { + case "wm3_observe": { + if (qs.isMemoState(21)) { + if ((qs.getMemoStateEx(0) % 100) == 11) { html = "32044-10.html"; - } - else - { + } else { html = "32044-09.html"; } } break; } - case "32044-11.html": - { - if (qs.isMemoState(21)) - { + case "32044-11.html": { + if (qs.isMemoState(21)) { final int memoStateEx = qs.getMemoStateEx(0); final int i1 = (memoStateEx / 100) * 100; final int i2 = (memoStateEx % 10) + 10; @@ -1047,41 +844,29 @@ public final class Q00120_PavelsLastResearch extends Quest } break; } - case "wm3_fire_of_paagrio": - { - if (qs.isMemoState(21)) - { - if ((qs.getMemoStateEx(0) / 100) == 1) - { + case "wm3_fire_of_paagrio": { + if (qs.isMemoState(21)) { + if ((qs.getMemoStateEx(0) / 100) == 1) { html = "32044-13.html"; - } - else - { + } else { qs.setMemoStateEx(0, ((qs.getMemoStateEx(0) / 10) * 10) + 1); html = "32044-12.html"; } } break; } - case "wm3_control": - { - if (qs.isMemoState(21)) - { - if ((qs.getMemoStateEx(0) / 100) == 1) - { + case "wm3_control": { + if (qs.isMemoState(21)) { + if ((qs.getMemoStateEx(0) / 100) == 1) { html = "32044-15.html"; - } - else - { + } else { html = "32044-14.html"; } } break; } - case "32044-16.html": - { - if (qs.isMemoState(21) && ((qs.getMemoStateEx(0) / 100) != 1)) - { + case "32044-16.html": { + if (qs.isMemoState(21) && ((qs.getMemoStateEx(0) / 100) != 1)) { qs.setMemoStateEx(0, (qs.getMemoStateEx(0) % 100) + 100); html = event; } @@ -1089,18 +874,14 @@ public final class Q00120_PavelsLastResearch extends Quest } case "32044-17.html": case "32044-18.html": - case "32044-19.html": - { - if (qs.isMemoState(21)) - { + case "32044-19.html": { + if (qs.isMemoState(21)) { html = event; } break; } - case "32044-20.html": - { - if (qs.isMemoState(21) && ((qs.getMemoStateEx(0) / 100) == 1)) - { + case "32044-20.html": { + if (qs.isMemoState(21) && ((qs.getMemoStateEx(0) / 100) == 1)) { qs.setMemoState(22); qs.setCond(22, true); qs.setMemoStateEx(0, 0); @@ -1111,18 +892,14 @@ public final class Q00120_PavelsLastResearch extends Quest } break; } - case "32044-21.html": - { - if (qs.isMemoState(22)) - { + case "32044-21.html": { + if (qs.isMemoState(22)) { html = event; } break; } - case "32045-02.html": - { - if (qs.isMemoState(13)) - { + case "32045-02.html": { + if (qs.isMemoState(13)) { giveItems(player, LOCKUP_RESEARCH_REPORT, 1); // IMPORTANT! // locked report is exchanged to unlocked by using key of enigma @@ -1141,11 +918,9 @@ public final class Q00120_PavelsLastResearch extends Quest } @Override - public String onSkillSee(L2Npc npc, L2PcInstance player, Skill skill, L2Object[] targets, boolean isSummon) - { + public String onSkillSee(L2Npc npc, L2PcInstance player, Skill skill, L2Object[] targets, boolean isSummon) { final QuestState qs = getQuestState(player, false); - if ((qs != null) && qs.isStarted()) - { + if ((qs != null) && qs.isStarted()) { final Skill npcDefault = NPC_DEFAULT.getSkill(); castSkill(npc, player, npcDefault); castSkill(npc, player, npcDefault); @@ -1154,184 +929,138 @@ public final class Q00120_PavelsLastResearch extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String html = getNoQuestMsg(player); - switch (npc.getId()) - { - case SUSPICIOUS_LOOKING_PILE_OF_STONES: - { - if (qs.isCreated()) - { - if (player.hasQuestCompleted(Q00114_ResurrectionOfAnOldManager.class.getSimpleName())) - { + switch (npc.getId()) { + case SUSPICIOUS_LOOKING_PILE_OF_STONES: { + if (qs.isCreated()) { + if (player.hasQuestCompleted(Q00114_ResurrectionOfAnOldManager.class.getSimpleName())) { html = "32046-01.htm"; - } - else - { + } else { html = "32046-02.htm"; } - } - else if (qs.isStarted()) - { - switch (qs.getMemoState()) - { - case 1: - { + } else if (qs.isStarted()) { + switch (qs.getMemoState()) { + case 1: { html = "32046-09.html"; break; } - case 2: - { + case 2: { html = "32046-12.html"; break; } - case 3: - { + case 3: { html = "32046-13.html"; break; } - case 4: - { - if (hasQuestItems(player, FLOWER_OF_PAVEL)) - { + case 4: { + if (hasQuestItems(player, FLOWER_OF_PAVEL)) { html = "32046-16.html"; } break; } - case 7: - { + case 7: { html = "32046-17.html"; break; } - case 8: - { + case 8: { html = "32046-28.html"; break; } - case 11: - { + case 11: { html = "32046-29.html"; break; } - case 12: - { + case 12: { html = "32046-36.html"; break; } - case 19: - { + case 19: { html = "32046-37.html"; break; } - case 20: - { + case 20: { html = "32046-42.html"; break; } - case 22: - { + case 22: { html = "32046-43.html"; break; } - case 23: - { - if (hasQuestItems(player, HEART_OF_ATLANTA)) - { + case 23: { + if (hasQuestItems(player, HEART_OF_ATLANTA)) { html = "32046-45.html"; } break; } } - } - else - { - if (player.hasQuestCompleted(Q00114_ResurrectionOfAnOldManager.class.getSimpleName())) - { + } else { + if (player.hasQuestCompleted(Q00114_ResurrectionOfAnOldManager.class.getSimpleName())) { html = getAlreadyCompletedMsg(player); } } break; } - case WENDY: - { - switch (qs.getMemoState()) - { - case 2: - { + case WENDY: { + switch (qs.getMemoState()) { + case 2: { html = "32047-01.html"; break; } - case 3: - { + case 3: { html = "32047-07.html"; break; } - case 4: - { - if (hasQuestItems(player, FLOWER_OF_PAVEL)) - { + case 4: { + if (hasQuestItems(player, FLOWER_OF_PAVEL)) { html = "32047-08.html"; } break; } - case 5: - { + case 5: { html = "32047-11.html"; break; } - case 6: - { + case 6: { html = "32047-12.html"; break; } - case 7: - { + case 7: { html = "32047-16.html"; break; } - case 12: - { + case 12: { html = "32047-17.html"; break; } - case 13: - { + case 13: { html = "32047-20.html"; break; } - case 14: - { - if (hasQuestItems(player, LOCKUP_RESEARCH_REPORT)) - { + case 14: { + if (hasQuestItems(player, LOCKUP_RESEARCH_REPORT)) { html = "32047-21.html"; } break; } - case 23: - { - if (hasQuestItems(player, HEART_OF_ATLANTA)) - { + case 23: { + if (hasQuestItems(player, HEART_OF_ATLANTA)) { html = "32047-22.html"; } break; } - case 24: - { + case 24: { html = "32047-27.html"; break; } - case 25: - { + case 25: { html = "32047-30.html"; break; } - case 26: - { - if (hasQuestItems(player, WENDYS_NECKLACE)) - { + case 26: { + if (hasQuestItems(player, WENDYS_NECKLACE)) { html = "32047-34.html"; } break; @@ -1339,85 +1068,62 @@ public final class Q00120_PavelsLastResearch extends Quest } break; } - case YUMI: - { - switch (qs.getMemoState()) - { - case 2: - { + case YUMI: { + switch (qs.getMemoState()) { + case 2: { - switch (qs.getMemoStateEx(0)) - { - case 0: - { + switch (qs.getMemoStateEx(0)) { + case 0: { html = "32041-01.html"; break; } - case 1: - { + case 1: { html = "32041-04.html"; break; } - case 2: - { + case 2: { html = "32041-06.html"; break; } } break; } - case 5: - { - if (qs.getMemoStateEx(0) > 0) - { + case 5: { + if (qs.getMemoStateEx(0) > 0) { html = "32041-07.html"; - } - else - { + } else { html = "32041-08.html"; } break; } - case 6: - { + case 6: { html = "32041-14.html"; break; } - case 14: - { - if (hasQuestItems(player, LOCKUP_RESEARCH_REPORT)) - { + case 14: { + if (hasQuestItems(player, LOCKUP_RESEARCH_REPORT)) { html = "32041-15.html"; } break; } - case 15: - { - if (hasQuestItems(player, KEY_OF_ENIGMA)) - { - if (hasQuestItems(player, RESEARCH_REPORT)) - { + case 15: { + if (hasQuestItems(player, KEY_OF_ENIGMA)) { + if (hasQuestItems(player, RESEARCH_REPORT)) { html = "32041-19.html"; - } - else if (hasQuestItems(player, LOCKUP_RESEARCH_REPORT)) - { + } else if (hasQuestItems(player, LOCKUP_RESEARCH_REPORT)) { html = "32041-18.html"; } } break; } - case 16: - { - if (hasQuestItems(player, RESEARCH_REPORT)) - { + case 16: { + if (hasQuestItems(player, RESEARCH_REPORT)) { html = "32041-27.html"; } break; } - case 26: - { - if (hasQuestItems(player, WENDYS_NECKLACE)) - { + case 26: { + if (hasQuestItems(player, WENDYS_NECKLACE)) { html = "32041-28.html"; } break; @@ -1425,101 +1131,77 @@ public final class Q00120_PavelsLastResearch extends Quest } break; } - case WEATHERMASTER_1: - { - switch (qs.getMemoState()) - { - case 8: - { + case WEATHERMASTER_1: { + switch (qs.getMemoState()) { + case 8: { html = "32042-01.html"; playSound(player, Sound.AMBSOUND_CRYSTAL_LOOP); break; } - case 9: - { + case 9: { html = "32042-06.html"; break; } - case 10: - { - if (qs.isMemoStateEx(0, 10101)) - { + case 10: { + if (qs.isMemoStateEx(0, 10101)) { html = "32042-13.html"; - } - else - { + } else { html = "32042-09.html"; } break; } - case 11: - { + case 11: { html = "32042-14.html"; break; } } break; } - case WEATHERMASTER_2: - { - switch (qs.getMemoState()) - { - case 16: - { + case WEATHERMASTER_2: { + switch (qs.getMemoState()) { + case 16: { html = "32043-01.html"; break; } - case 17: - { + case 17: { html = "32043-06.html"; break; } - case 18: - { + case 18: { html = "32043-09.html"; break; } - case 19: - { + case 19: { html = "32043-23.html"; break; } } break; } - case WEATHERMASTER_3: - { - switch (qs.getMemoState()) - { - case 20: - { + case WEATHERMASTER_3: { + switch (qs.getMemoState()) { + case 20: { html = "32044-01.html"; break; } - case 21: - { + case 21: { html = "32044-08.html"; break; } - case 22: - { + case 22: { html = "32044-22.html"; break; } } break; } - case DOCTOR_CHAOS_SECRET_BOOKSHELF: - { - switch (qs.getMemoState()) - { - case 13: - { + case DOCTOR_CHAOS_SECRET_BOOKSHELF: { + switch (qs.getMemoState()) { + case 13: { html = "32045-01.html"; break; } - case 14: - { + case 14: { html = "32045-03.html"; break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00121_PavelTheGiant/Q00121_PavelTheGiant.java b/src/main/java/com/l2jserver/datapack/quests/Q00121_PavelTheGiant/Q00121_PavelTheGiant.java index 4f12d1b9da..2c5ae2249c 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00121_PavelTheGiant/Q00121_PavelTheGiant.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00121_PavelTheGiant/Q00121_PavelTheGiant.java @@ -29,30 +29,25 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by Ethernaly. * @author malyelfik */ -public class Q00121_PavelTheGiant extends Quest -{ +public class Q00121_PavelTheGiant extends Quest { // NPCs private static final int NEWYEAR = 31961; private static final int YUMI = 32041; - public Q00121_PavelTheGiant() - { + public Q00121_PavelTheGiant() { super(121, Q00121_PavelTheGiant.class.getSimpleName(), "Pavel the Giant"); addStartNpc(NEWYEAR); addTalkId(NEWYEAR, YUMI); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - switch (event) - { + switch (event) { case "31961-02.htm": st.startQuest(); break; @@ -65,15 +60,12 @@ public class Q00121_PavelTheGiant extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case NEWYEAR: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= 70) ? "31961-01.htm" : "31961-00.htm"; break; @@ -86,8 +78,7 @@ public class Q00121_PavelTheGiant extends Quest } break; case YUMI: - if (st.isStarted()) - { + if (st.isStarted()) { htmltext = "32041-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00122_OminousNews/Q00122_OminousNews.java b/src/main/java/com/l2jserver/datapack/quests/Q00122_OminousNews/Q00122_OminousNews.java index 9755802c75..f6ca28d574 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00122_OminousNews/Q00122_OminousNews.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00122_OminousNews/Q00122_OminousNews.java @@ -29,30 +29,25 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by Polo. * @author malyelfik */ -public class Q00122_OminousNews extends Quest -{ +public class Q00122_OminousNews extends Quest { // NPCs private static final int MOIRA = 31979; private static final int KARUDA = 32017; - public Q00122_OminousNews() - { + public Q00122_OminousNews() { super(122, Q00122_OminousNews.class.getSimpleName(), "Ominous News"); addStartNpc(MOIRA); addTalkId(MOIRA, KARUDA); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - switch (event) - { + switch (event) { case "31979-02.htm": st.startQuest(); break; @@ -66,15 +61,12 @@ public class Q00122_OminousNews extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case MOIRA: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= 20) ? "31979-01.htm" : "31979-00.htm"; break; @@ -87,8 +79,7 @@ public class Q00122_OminousNews extends Quest } break; case KARUDA: - if (st.isStarted()) - { + if (st.isStarted()) { htmltext = "32017-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00123_TheLeaderAndTheFollower/Q00123_TheLeaderAndTheFollower.java b/src/main/java/com/l2jserver/datapack/quests/Q00123_TheLeaderAndTheFollower/Q00123_TheLeaderAndTheFollower.java index 7b336dd6da..a5605bad40 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00123_TheLeaderAndTheFollower/Q00123_TheLeaderAndTheFollower.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00123_TheLeaderAndTheFollower/Q00123_TheLeaderAndTheFollower.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * The Leader And The Follower (123) * @author ivantotov */ -public final class Q00123_TheLeaderAndTheFollower extends Quest -{ +public final class Q00123_TheLeaderAndTheFollower extends Quest { // NPC private static final int HEAD_BLACKSMITH_NEWYEAR = 31961; // Items @@ -58,8 +57,7 @@ public final class Q00123_TheLeaderAndTheFollower extends Quest private static final int CRYSTAL_COUNT_1 = 922; private static final int CRYSTAL_COUNT_2 = 771; - public Q00123_TheLeaderAndTheFollower() - { + public Q00123_TheLeaderAndTheFollower() { super(123, Q00123_TheLeaderAndTheFollower.class.getSimpleName(), "The Leader And The Follower"); addStartNpc(HEAD_BLACKSMITH_NEWYEAR); addTalkId(HEAD_BLACKSMITH_NEWYEAR); @@ -68,77 +66,53 @@ public final class Q00123_TheLeaderAndTheFollower extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; // Manage Sponsor's quest events. - if (player.getApprentice() > 0) - { + if (player.getApprentice() > 0) { final L2PcInstance apprentice = L2World.getInstance().getPlayer(player.getApprentice()); - if (apprentice == null) - { + if (apprentice == null) { return htmltext; } final QuestState q123 = apprentice.getQuestState(Q00123_TheLeaderAndTheFollower.class.getSimpleName()); - switch (event) - { - case "sponsor": - { - if (!Util.checkIfInRange(1500, npc, apprentice, true)) - { + switch (event) { + case "sponsor": { + if (!Util.checkIfInRange(1500, npc, apprentice, true)) { htmltext = "31961-09.html"; - } - else - { - if ((q123 == null) || (!q123.isMemoState(2) && !q123.isMemoState(3))) - { + } else { + if ((q123 == null) || (!q123.isMemoState(2) && !q123.isMemoState(3))) { htmltext = "31961-14.html"; - } - else if (q123.isMemoState(2)) - { + } else if (q123.isMemoState(2)) { htmltext = "31961-08.html"; - } - else if (q123.isMemoState(3)) - { + } else if (q123.isMemoState(3)) { htmltext = "31961-12.html"; } } break; } - case "31961-10.html": - { - if (Util.checkIfInRange(1500, npc, apprentice, true) && (q123 != null) && q123.isMemoState(2)) - { - switch (q123.getMemoStateEx(1)) - { - case 1: - { - if (getQuestItemsCount(player, CRYSTAL_D) >= CRYSTAL_COUNT_1) - { + case "31961-10.html": { + if (Util.checkIfInRange(1500, npc, apprentice, true) && (q123 != null) && q123.isMemoState(2)) { + switch (q123.getMemoStateEx(1)) { + case 1: { + if (getQuestItemsCount(player, CRYSTAL_D) >= CRYSTAL_COUNT_1) { takeItems(player, CRYSTAL_D, CRYSTAL_COUNT_1); q123.setMemoState(3); q123.setCond(6, true); htmltext = event; - } - else - { + } else { htmltext = "31961-11.html"; } break; } case 2: - case 3: - { - if (getQuestItemsCount(player, CRYSTAL_D) >= CRYSTAL_COUNT_2) - { + case 3: { + if (getQuestItemsCount(player, CRYSTAL_D) >= CRYSTAL_COUNT_2) { takeItems(player, CRYSTAL_D, CRYSTAL_COUNT_2); q123.setMemoState(3); q123.setCond(6, true); htmltext = event; - } - else - { + } else { htmltext = "31961-11a.html"; } break; @@ -152,17 +126,13 @@ public final class Q00123_TheLeaderAndTheFollower extends Quest } final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } - switch (event) - { - case "31961-03.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "31961-03.htm": { + if (qs.isCreated()) { qs.startQuest(); qs.setMemoState(1); htmltext = event; @@ -172,15 +142,12 @@ public final class Q00123_TheLeaderAndTheFollower extends Quest case "31961-05a.html": case "31961-05b.html": case "31961-05c.html": - case "31961-05g.html": - { + case "31961-05g.html": { htmltext = event; break; } - case "31961-05d.html": - { - if (qs.isMemoState(1) && (getQuestItemsCount(player, BRUIN_LIZARDMAN_BLOOD) >= 10)) - { + case "31961-05d.html": { + if (qs.isMemoState(1) && (getQuestItemsCount(player, BRUIN_LIZARDMAN_BLOOD) >= 10)) { takeItems(player, BRUIN_LIZARDMAN_BLOOD, -1); qs.setMemoState(2); qs.setMemoStateEx(1, 1); @@ -189,10 +156,8 @@ public final class Q00123_TheLeaderAndTheFollower extends Quest } break; } - case "31961-05e.html": - { - if (qs.isMemoState(1) && (getQuestItemsCount(player, BRUIN_LIZARDMAN_BLOOD) >= 10)) - { + case "31961-05e.html": { + if (qs.isMemoState(1) && (getQuestItemsCount(player, BRUIN_LIZARDMAN_BLOOD) >= 10)) { takeItems(player, BRUIN_LIZARDMAN_BLOOD, -1); qs.setMemoState(2); qs.setMemoStateEx(1, 2); @@ -201,10 +166,8 @@ public final class Q00123_TheLeaderAndTheFollower extends Quest } break; } - case "31961-05f.html": - { - if (qs.isMemoState(1) && (getQuestItemsCount(player, BRUIN_LIZARDMAN_BLOOD) >= 10)) - { + case "31961-05f.html": { + if (qs.isMemoState(1) && (getQuestItemsCount(player, BRUIN_LIZARDMAN_BLOOD) >= 10)) { takeItems(player, BRUIN_LIZARDMAN_BLOOD, -1); qs.setMemoState(2); qs.setMemoStateEx(1, 3); @@ -219,35 +182,24 @@ public final class Q00123_TheLeaderAndTheFollower extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted()) - { - switch (npc.getId()) - { - case BRUIN_LIZARDMAN: - { - if (qs.isMemoState(1)) - { - if (giveItemRandomly(killer, npc, BRUIN_LIZARDMAN_BLOOD, 1, 10, 7, true)) - { + if ((qs != null) && qs.isStarted()) { + switch (npc.getId()) { + case BRUIN_LIZARDMAN: { + if (qs.isMemoState(1)) { + if (giveItemRandomly(killer, npc, BRUIN_LIZARDMAN_BLOOD, 1, 10, 7, true)) { qs.setCond(2); } } break; } - case PICOT_ARANEID: - { - if (qs.isMemoState(4)) - { - if (killer.getSponsor() > 0) - { + case PICOT_ARANEID: { + if (qs.isMemoState(4)) { + if (killer.getSponsor() > 0) { final L2PcInstance c0 = L2World.getInstance().getPlayer(killer.getSponsor()); - if ((c0 != null) && Util.checkIfInRange(1500, npc, c0, true)) - { - if (giveItemRandomly(killer, npc, PICOT_ARANEIDS_LEG, 1, 8, 7, true)) - { + if ((c0 != null) && Util.checkIfInRange(1500, npc, c0, true)) { + if (giveItemRandomly(killer, npc, PICOT_ARANEIDS_LEG, 1, 8, 7, true)) { qs.setCond(8); } } @@ -261,120 +213,75 @@ public final class Q00123_TheLeaderAndTheFollower extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); final QuestState q118 = player.getQuestState(Q00118_ToLeadAndBeLed.class.getSimpleName()); String htmltext = getNoQuestMsg(player); - switch (qs.getState()) - { - case State.CREATED: - { - if ((q118 != null) && q118.isStarted()) - { + switch (qs.getState()) { + case State.CREATED: { + if ((q118 != null) && q118.isStarted()) { htmltext = "31961-02b.htm"; - } - else if ((q118 != null) && q118.isCompleted()) - { + } else if ((q118 != null) && q118.isCompleted()) { htmltext = "31961-02a.html"; - } - else if ((player.getLevel() >= MIN_LEVEL) && (player.getPledgeType() == -1) && (player.getSponsor() > 0)) - { + } else if ((player.getLevel() >= MIN_LEVEL) && (player.getPledgeType() == -1) && (player.getSponsor() > 0)) { htmltext = "31961-01.htm"; - } - else - { + } else { htmltext = "31961-02.htm"; } break; } - case State.STARTED: - { - if (qs.isMemoState(1)) - { - if (getQuestItemsCount(player, BRUIN_LIZARDMAN_BLOOD) < 10) - { + case State.STARTED: { + if (qs.isMemoState(1)) { + if (getQuestItemsCount(player, BRUIN_LIZARDMAN_BLOOD) < 10) { htmltext = "31961-04.html"; - } - else - { + } else { htmltext = "31961-05.html"; } - } - else if (qs.isMemoState(2)) - { - if (player.getSponsor() == 0) - { - if (qs.getMemoStateEx(1) == 1) - { + } else if (qs.isMemoState(2)) { + if (player.getSponsor() == 0) { + if (qs.getMemoStateEx(1) == 1) { htmltext = "31961-06a.html"; - } - else if (qs.getMemoStateEx(1) == 2) - { + } else if (qs.getMemoStateEx(1) == 2) { htmltext = "31961-06b.html"; - } - else if (qs.getMemoStateEx(1) == 3) - { + } else if (qs.getMemoStateEx(1) == 3) { htmltext = "31961-06c.html"; } - } - else - { + } else { final L2PcInstance c0 = L2World.getInstance().getPlayer(player.getSponsor()); - if ((c0 != null) && Util.checkIfInRange(1500, npc, c0, true)) - { + if ((c0 != null) && Util.checkIfInRange(1500, npc, c0, true)) { htmltext = "31961-07.html"; - } - else - { - if (qs.getMemoStateEx(1) == 1) - { + } else { + if (qs.getMemoStateEx(1) == 1) { htmltext = "31961-06.html"; - } - else if (qs.getMemoStateEx(1) == 2) - { + } else if (qs.getMemoStateEx(1) == 2) { htmltext = "31961-06d.html"; - } - else if (qs.getMemoStateEx(1) == 3) - { + } else if (qs.getMemoStateEx(1) == 3) { htmltext = "31961-06e.html"; } } } - } - else if (qs.isMemoState(3)) - { + } else if (qs.isMemoState(3)) { qs.setMemoState(4); qs.setCond(7, true); htmltext = "31961-15.html"; - } - else if (qs.isMemoState(4)) - { - if (getQuestItemsCount(player, PICOT_ARANEIDS_LEG) < 8) - { + } else if (qs.isMemoState(4)) { + if (getQuestItemsCount(player, PICOT_ARANEIDS_LEG) < 8) { htmltext = "31961-16.html"; - } - else - { - if (qs.getMemoStateEx(1) == 1) - { + } else { + if (qs.getMemoStateEx(1) == 1) { giveItems(player, CLAN_OATH_HELM, 1); giveItems(player, CLAN_OATH_ARMOR, 1); giveItems(player, CLAN_OATH_GAUNTLETS_HEAVY_ARMOR, 1); giveItems(player, CLAN_OATH_SABATON_HEAVY_ARMOR, 1); takeItems(player, PICOT_ARANEIDS_LEG, -1); - } - else if (qs.getMemoStateEx(1) == 2) - { + } else if (qs.getMemoStateEx(1) == 2) { giveItems(player, CLAN_OATH_HELM, 1); giveItems(player, CLAN_OATH_BRIGANDINE, 1); giveItems(player, CLAN_OATH_LEATHER_GLOVES_LIGHT_ARMOR, 1); giveItems(player, CLAN_OATH_BOOTS_LIGHT_ARMOR, 1); takeItems(player, PICOT_ARANEIDS_LEG, -1); - } - else if (qs.getMemoStateEx(1) == 3) - { + } else if (qs.getMemoStateEx(1) == 3) { giveItems(player, CLAN_OATH_HELM, 1); giveItems(player, CLAN_OATH_AKETON, 1); giveItems(player, CLAN_OATH_PADDED_GLOVES_ROBE, 1); @@ -387,8 +294,7 @@ public final class Q00123_TheLeaderAndTheFollower extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00124_MeetingTheElroki/Q00124_MeetingTheElroki.java b/src/main/java/com/l2jserver/datapack/quests/Q00124_MeetingTheElroki/Q00124_MeetingTheElroki.java index ecbbdb13ea..873ff2fbca 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00124_MeetingTheElroki/Q00124_MeetingTheElroki.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00124_MeetingTheElroki/Q00124_MeetingTheElroki.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.State; * Meeting the Elroki (124) * @author Adry_85 */ -public class Q00124_MeetingTheElroki extends Quest -{ +public class Q00124_MeetingTheElroki extends Quest { // NPCs private static final int MARQUEZ = 32113; private static final int MUSHIKA = 32114; @@ -39,8 +38,7 @@ public class Q00124_MeetingTheElroki extends Quest // Item private static final int MANTARASA_EGG = 8778; - public Q00124_MeetingTheElroki() - { + public Q00124_MeetingTheElroki() { super(124, Q00124_MeetingTheElroki.class.getSimpleName(), "Meeting the Elroki"); addStartNpc(MARQUEZ); addTalkId(MARQUEZ, MUSHIKA, ASAMAH, KARAKAWEI, MANTARASA); @@ -48,46 +46,38 @@ public class Q00124_MeetingTheElroki extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - switch (event) - { + switch (event) { case "32113-03.html": st.startQuest(); break; case "32113-04.html": - if (st.isCond(1)) - { + if (st.isCond(1)) { st.setCond(2, true); } break; case "32114-04.html": - if (st.isCond(2)) - { + if (st.isCond(2)) { st.setCond(3, true); } break; case "32115-06.html": - if (st.isCond(3)) - { + if (st.isCond(3)) { st.setCond(4, true); } break; case "32117-05.html": - if (st.isCond(4)) - { + if (st.isCond(4)) { st.setCond(5, true); } break; case "32118-04.html": - if (st.isCond(5)) - { + if (st.isCond(5)) { st.giveItems(MANTARASA_EGG, 1); st.setCond(6, true); } @@ -97,21 +87,17 @@ public class Q00124_MeetingTheElroki extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case MARQUEZ: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() < 75) ? "32113-01a.htm" : "32113-01.htm"; break; case State.STARTED: - switch (st.getInt("cond")) - { + switch (st.getInt("cond")) { case 1: htmltext = "32113-05.html"; break; @@ -131,10 +117,8 @@ public class Q00124_MeetingTheElroki extends Quest } break; case MUSHIKA: - if (st.isStarted()) - { - switch (st.getInt("cond")) - { + if (st.isStarted()) { + switch (st.getInt("cond")) { case 1: htmltext = "32114-01.html"; break; @@ -149,10 +133,8 @@ public class Q00124_MeetingTheElroki extends Quest } break; case ASAMAH: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: case 2: htmltext = "32115-01.html"; @@ -167,8 +149,7 @@ public class Q00124_MeetingTheElroki extends Quest htmltext = "32115-08.html"; break; case 6: - if (st.hasQuestItems(MANTARASA_EGG)) - { + if (st.hasQuestItems(MANTARASA_EGG)) { htmltext = "32115-09.html"; st.giveAdena(100013, true); st.addExpAndSp(301922, 30294); @@ -179,10 +160,8 @@ public class Q00124_MeetingTheElroki extends Quest } break; case KARAKAWEI: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: case 2: case 3: @@ -201,10 +180,8 @@ public class Q00124_MeetingTheElroki extends Quest } break; case MANTARASA: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: case 2: case 3: diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00125_TheNameOfEvil1/Q00125_TheNameOfEvil1.java b/src/main/java/com/l2jserver/datapack/quests/Q00125_TheNameOfEvil1/Q00125_TheNameOfEvil1.java index 614a308b94..21a74911b6 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00125_TheNameOfEvil1/Q00125_TheNameOfEvil1.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00125_TheNameOfEvil1/Q00125_TheNameOfEvil1.java @@ -36,8 +36,7 @@ import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse; * The Name of Evil - 1 (125) * @author Adry_85 */ -public class Q00125_TheNameOfEvil1 extends Quest -{ +public class Q00125_TheNameOfEvil1 extends Quest { // NPCs private static final int MUSHIKA = 32114; private static final int KARAKAWEI = 32117; @@ -55,8 +54,7 @@ public class Q00125_TheNameOfEvil1 extends Quest private static final Map<Integer, Integer> ORNITHOMIMUS = new HashMap<>(); private static final Map<Integer, Integer> DEINONYCHUS = new HashMap<>(); - static - { + static { ORNITHOMIMUS.put(22200, 661); ORNITHOMIMUS.put(22201, 330); ORNITHOMIMUS.put(22202, 661); @@ -69,8 +67,7 @@ public class Q00125_TheNameOfEvil1 extends Quest DEINONYCHUS.put(22225, 319); } - public Q00125_TheNameOfEvil1() - { + public Q00125_TheNameOfEvil1() { super(125, Q00125_TheNameOfEvil1.class.getSimpleName(), "The Name of Evil - 1"); addStartNpc(MUSHIKA); addTalkId(MUSHIKA, KARAKAWEI, ULU_KAIMU, BALU_KAIMU, CHUTA_KAIMU); @@ -80,36 +77,30 @@ public class Q00125_TheNameOfEvil1 extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } String htmltext = event; - switch (event) - { + switch (event) { case "32114-05.html": st.startQuest(); break; case "32114-08.html": - if (st.isCond(1)) - { + if (st.isCond(1)) { st.giveItems(GAZKH_FRAGMENT, 1); st.setCond(2, true); } break; case "32117-09.html": - if (st.isCond(2)) - { + if (st.isCond(2)) { st.setCond(3, true); } break; case "32117-15.html": - if (st.isCond(4)) - { + if (st.isCond(4)) { st.setCond(5, true); } break; @@ -127,13 +118,10 @@ public class Q00125_TheNameOfEvil1 extends Quest break; case "U_One": st.set("U", "1"); - if (st.isCond(5) && (st.getInt("T") > 0) && (st.getInt("E") > 0) && (st.getInt("P") > 0) && (st.getInt("U") > 0)) - { + if (st.isCond(5) && (st.getInt("T") > 0) && (st.getInt("E") > 0) && (st.getInt("P") > 0) && (st.getInt("U") > 0)) { htmltext = "32119-08.html"; st.set("Memo", "1"); - } - else - { + } else { htmltext = "32119-07.html"; } st.unset("T"); @@ -148,8 +136,7 @@ public class Q00125_TheNameOfEvil1 extends Quest st.unset("U"); break; case "32119-18.html": - if (st.isCond(5)) - { + if (st.isCond(5)) { st.setCond(6, true); st.unset("Memo"); } @@ -168,13 +155,10 @@ public class Q00125_TheNameOfEvil1 extends Quest break; case "N_Two": st.set("N", "1"); - if (st.isCond(6) && (st.getInt("T") > 0) && (st.getInt("O") > 0) && (st.getInt("O2") > 0) && (st.getInt("N") > 0)) - { + if (st.isCond(6) && (st.getInt("T") > 0) && (st.getInt("O") > 0) && (st.getInt("O2") > 0) && (st.getInt("N") > 0)) { htmltext = "32120-08.html"; st.set("Memo", "1"); - } - else - { + } else { htmltext = "32120-07.html"; } st.unset("T"); @@ -188,8 +172,7 @@ public class Q00125_TheNameOfEvil1 extends Quest st.unset("O2"); st.unset("N"); case "32120-17.html": - if (st.isCond(6)) - { + if (st.isCond(6)) { st.setCond(7, true); st.unset("Memo"); } @@ -208,13 +191,10 @@ public class Q00125_TheNameOfEvil1 extends Quest break; case "U_Three": st.set("U", "1"); - if (st.isCond(7) && (st.getInt("W") > 0) && (st.getInt("A") > 0) && (st.getInt("G") > 0) && (st.getInt("U") > 0)) - { + if (st.isCond(7) && (st.getInt("W") > 0) && (st.getInt("A") > 0) && (st.getInt("G") > 0) && (st.getInt("U") > 0)) { htmltext = "32121-08.html"; st.set("Memo", "1"); - } - else - { + } else { htmltext = "32121-07.html"; } st.unset("W"); @@ -235,8 +215,7 @@ public class Q00125_TheNameOfEvil1 extends Quest st.set("Memo", "3"); break; case "32121-18.html": - if (st.isCond(7) && st.hasQuestItems(GAZKH_FRAGMENT)) - { + if (st.isCond(7) && st.hasQuestItems(GAZKH_FRAGMENT)) { st.giveItems(EPITAPH_OF_WISDOM, 1); st.takeItems(GAZKH_FRAGMENT, -1); st.setCond(8, true); @@ -248,71 +227,54 @@ public class Q00125_TheNameOfEvil1 extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(player, 3); - if (partyMember == null) - { + if (partyMember == null) { return null; } final QuestState st = getQuestState(partyMember, false); int npcId = npc.getId(); - if (ORNITHOMIMUS.containsKey(npcId)) - { - if (st.getQuestItemsCount(ORNITHOMIMUS_CLAW) < 2) - { + if (ORNITHOMIMUS.containsKey(npcId)) { + if (st.getQuestItemsCount(ORNITHOMIMUS_CLAW) < 2) { double chance = ORNITHOMIMUS.get(npcId) * rates().getRateQuestDrop(); - if (getRandom(1000) < chance) - { + if (getRandom(1000) < chance) { st.giveItems(ORNITHOMIMUS_CLAW, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } - } - else if (DEINONYCHUS.containsKey(npcId)) - { - if (st.getQuestItemsCount(DEINONYCHUS_BONE) < 2) - { + } else if (DEINONYCHUS.containsKey(npcId)) { + if (st.getQuestItemsCount(DEINONYCHUS_BONE) < 2) { double chance = DEINONYCHUS.get(npcId) * rates().getRateQuestDrop(); - if (getRandom(1000) < chance) - { + if (getRandom(1000) < chance) { st.giveItems(DEINONYCHUS_BONE, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } } - if ((st.getQuestItemsCount(ORNITHOMIMUS_CLAW) == 2) && (st.getQuestItemsCount(DEINONYCHUS_BONE) == 2)) - { + if ((st.getQuestItemsCount(ORNITHOMIMUS_CLAW) == 2) && (st.getQuestItemsCount(DEINONYCHUS_BONE) == 2)) { st.setCond(4, true); } return super.onKill(npc, player, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case MUSHIKA: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: - if (player.getLevel() < 76) - { + if (player.getLevel() < 76) { htmltext = "32114-01a.htm"; - } - else - { + } else { htmltext = (player.hasQuestCompleted(Q00124_MeetingTheElroki.class.getSimpleName())) ? "32114-01.htm" : "32114-01b.htm"; } break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "32114-09.html"; break; @@ -327,8 +289,7 @@ public class Q00125_TheNameOfEvil1 extends Quest htmltext = "32114-11.html"; break; case 8: - if (st.hasQuestItems(EPITAPH_OF_WISDOM)) - { + if (st.hasQuestItems(EPITAPH_OF_WISDOM)) { htmltext = "32114-12.html"; st.addExpAndSp(859195, 86603); st.exitQuest(false, true); @@ -342,10 +303,8 @@ public class Q00125_TheNameOfEvil1 extends Quest } break; case KARAKAWEI: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: htmltext = "32117-01.html"; break; @@ -356,8 +315,7 @@ public class Q00125_TheNameOfEvil1 extends Quest htmltext = "32117-10.html"; break; case 4: - if ((st.getQuestItemsCount(ORNITHOMIMUS_CLAW) >= 2) && (st.getQuestItemsCount(DEINONYCHUS_BONE) >= 2)) - { + if ((st.getQuestItemsCount(ORNITHOMIMUS_CLAW) >= 2) && (st.getQuestItemsCount(DEINONYCHUS_BONE) >= 2)) { st.takeItems(ORNITHOMIMUS_CLAW, -1); st.takeItems(DEINONYCHUS_BONE, -1); htmltext = "32117-11.html"; @@ -377,8 +335,7 @@ public class Q00125_TheNameOfEvil1 extends Quest } break; case ULU_KAIMU: - if (st.isStarted()) - { + if (st.isStarted()) { switch (st.getCond()) { case 1: case 2: @@ -411,8 +368,7 @@ public class Q00125_TheNameOfEvil1 extends Quest } break; case BALU_KAIMU: - if (st.isStarted()) - { + if (st.isStarted()) { switch (st.getCond()) { case 1: case 2: @@ -447,8 +403,7 @@ public class Q00125_TheNameOfEvil1 extends Quest } break; case CHUTA_KAIMU: - if (st.isStarted()) - { + if (st.isStarted()) { switch (st.getCond()) { case 1: case 2: diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00126_TheNameOfEvil2/Q00126_TheNameOfEvil2.java b/src/main/java/com/l2jserver/datapack/quests/Q00126_TheNameOfEvil2/Q00126_TheNameOfEvil2.java index 0cd438df06..bb1a507651 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00126_TheNameOfEvil2/Q00126_TheNameOfEvil2.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00126_TheNameOfEvil2/Q00126_TheNameOfEvil2.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse; * The Name of Evil - 2 (126) * @author Adry_85 */ -public class Q00126_TheNameOfEvil2 extends Quest -{ +public class Q00126_TheNameOfEvil2 extends Quest { // NPCs private static final int SHILENS_STONE_STATUE = 32109; private static final int MUSHIKA = 32114; @@ -47,8 +46,7 @@ public class Q00126_TheNameOfEvil2 extends Quest // Reward private static final int ENCHANT_WEAPON_A = 729; - public Q00126_TheNameOfEvil2() - { + public Q00126_TheNameOfEvil2() { super(126, Q00126_TheNameOfEvil2.class.getSimpleName(), "The Name of Evil - 2"); addStartNpc(ASAMAH); addTalkId(ASAMAH, ULU_KAIMU, BALU_KAIMU, CHUTA_KAIMU, WARRIORS_GRAVE, SHILENS_STONE_STATUE, MUSHIKA); @@ -56,34 +54,28 @@ public class Q00126_TheNameOfEvil2 extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - switch (event) - { + switch (event) { case "32115-1.html": st.startQuest(); break; case "32115-1b.html": - if (st.isCond(1)) - { + if (st.isCond(1)) { st.setCond(2, true); } break; case "32119-3.html": - if (st.isCond(2)) - { + if (st.isCond(2)) { st.setCond(3, true); } break; case "32119-4.html": - if (st.isCond(3)) - { + if (st.isCond(3)) { st.setCond(4, true); } break; @@ -92,20 +84,17 @@ public class Q00126_TheNameOfEvil2 extends Quest st.playSound(Sound.ETCSOUND_ELROKI_SONG_1ST); break; case "32119-5.html": - if (st.isCond(4)) - { + if (st.isCond(4)) { st.setCond(5, true); } break; case "32120-3.html": - if (st.isCond(5)) - { + if (st.isCond(5)) { st.setCond(6, true); } break; case "32120-4.html": - if (st.isCond(6)) - { + if (st.isCond(6)) { st.setCond(7, true); } break; @@ -114,20 +103,17 @@ public class Q00126_TheNameOfEvil2 extends Quest st.playSound(Sound.ETCSOUND_ELROKI_SONG_2ND); break; case "32120-5.html": - if (st.isCond(7)) - { + if (st.isCond(7)) { st.setCond(8, true); } break; case "32121-3.html": - if (st.isCond(8)) - { + if (st.isCond(8)) { st.setCond(9, true); } break; case "32121-4.html": - if (st.isCond(9)) - { + if (st.isCond(9)) { st.setCond(10, true); } break; @@ -136,8 +122,7 @@ public class Q00126_TheNameOfEvil2 extends Quest st.playSound(Sound.ETCSOUND_ELROKI_SONG_3RD); break; case "32121-5.html": - if (st.isCond(10)) - { + if (st.isCond(10)) { st.giveItems(GAZKH_FRAGMENT, 1); st.setCond(11, true); } @@ -149,14 +134,12 @@ public class Q00126_TheNameOfEvil2 extends Quest st.takeItems(GAZKH_FRAGMENT, -1); break; case "32122-3.html": - if (st.isCond(12)) - { + if (st.isCond(12)) { st.setCond(13, true); } break; case "32122-4.html": - if (st.isCond(13)) - { + if (st.isCond(13)) { st.setCond(14, true); } break; @@ -178,13 +161,10 @@ public class Q00126_TheNameOfEvil2 extends Quest break; case "FA2_One": st.set("FA2", "1"); - if (st.isCond(14) && (st.getInt("DO") > 0) && (st.getInt("MI") > 0) && (st.getInt("FA") > 0) && (st.getInt("SOL") > 0) && (st.getInt("FA2") > 0)) - { + if (st.isCond(14) && (st.getInt("DO") > 0) && (st.getInt("MI") > 0) && (st.getInt("FA") > 0) && (st.getInt("SOL") > 0) && (st.getInt("FA2") > 0)) { event = "32122-4n.html"; st.setCond(15, true); - } - else - { + } else { event = "32122-4m.html"; } st.unset("DO"); @@ -218,13 +198,10 @@ public class Q00126_TheNameOfEvil2 extends Quest break; case "FA2_Two": st.set("FA2", "1"); - if (st.isCond(15) && (st.getInt("FA") > 0) && (st.getInt("SOL") > 0) && (st.getInt("TI") > 0) && (st.getInt("SOL2") > 0) && (st.getInt("FA2") > 0)) - { + if (st.isCond(15) && (st.getInt("FA") > 0) && (st.getInt("SOL") > 0) && (st.getInt("TI") > 0) && (st.getInt("SOL2") > 0) && (st.getInt("FA2") > 0)) { event = "32122-5j.html"; st.setCond(16, true); - } - else - { + } else { event = "32122-5i.html"; } st.unset("FA"); @@ -258,13 +235,10 @@ public class Q00126_TheNameOfEvil2 extends Quest break; case "MI2_Three": st.set("MI2", "1"); - if (st.isCond(16) && (st.getInt("SOL") > 0) && (st.getInt("FA") > 0) && (st.getInt("MI") > 0) && (st.getInt("FA2") > 0) && (st.getInt("MI2") > 0)) - { + if (st.isCond(16) && (st.getInt("SOL") > 0) && (st.getInt("FA") > 0) && (st.getInt("MI") > 0) && (st.getInt("FA2") > 0) && (st.getInt("MI2") > 0)) { event = "32122-6j.html"; st.setCond(17, true); - } - else - { + } else { event = "32122-6i.html"; } st.unset("SOL"); @@ -286,39 +260,33 @@ public class Q00126_TheNameOfEvil2 extends Quest npc.broadcastPacket(new MagicSkillUse(npc, player, 5089, 1, 1000, 0)); break; case "32122-8.html": - if (st.isCond(17)) - { + if (st.isCond(17)) { st.setCond(18, true); } break; case "32109-2.html": - if (st.isCond(18)) - { + if (st.isCond(18)) { st.setCond(19, true); } break; case "32109-3.html": - if (st.isCond(19)) - { + if (st.isCond(19)) { st.takeItems(BONE_POWDER, -1); st.setCond(20, true); } break; case "32115-4.html": - if (st.isCond(20)) - { + if (st.isCond(20)) { st.setCond(21, true); } break; case "32115-5.html": - if (st.isCond(21)) - { + if (st.isCond(21)) { st.setCond(22, true); } break; case "32114-2.html": - if (st.isCond(22)) - { + if (st.isCond(22)) { st.setCond(23, true); } break; @@ -333,28 +301,21 @@ public class Q00126_TheNameOfEvil2 extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case ASAMAH: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: - if (player.getLevel() < 77) - { + if (player.getLevel() < 77) { htmltext = "32115-0.htm"; - } - else - { + } else { htmltext = (player.hasQuestCompleted(Q00125_TheNameOfEvil1.class.getSimpleName())) ? "32115-0a.htm" : "32115-0b.htm"; } break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "32115-1d.html"; break; @@ -397,10 +358,8 @@ public class Q00126_TheNameOfEvil2 extends Quest } break; case ULU_KAIMU: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: htmltext = "32119-1.html"; break; @@ -421,10 +380,8 @@ public class Q00126_TheNameOfEvil2 extends Quest } break; case BALU_KAIMU: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: case 2: case 3: @@ -448,10 +405,8 @@ public class Q00126_TheNameOfEvil2 extends Quest } break; case CHUTA_KAIMU: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: case 2: case 3: @@ -478,10 +433,8 @@ public class Q00126_TheNameOfEvil2 extends Quest } break; case WARRIORS_GRAVE: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: case 2: case 3: @@ -541,10 +494,8 @@ public class Q00126_TheNameOfEvil2 extends Quest } break; case SHILENS_STONE_STATUE: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: case 2: case 3: @@ -565,8 +516,7 @@ public class Q00126_TheNameOfEvil2 extends Quest htmltext = "32109-1a.html"; break; case 18: - if (st.hasQuestItems(BONE_POWDER)) - { + if (st.hasQuestItems(BONE_POWDER)) { htmltext = "32109-1.html"; } break; @@ -583,18 +533,12 @@ public class Q00126_TheNameOfEvil2 extends Quest } break; case MUSHIKA: - if (st.isStarted()) - { - if (st.getCond() < 22) - { + if (st.isStarted()) { + if (st.getCond() < 22) { htmltext = "32114-4.html"; - } - else if (st.isCond(22)) - { + } else if (st.isCond(22)) { htmltext = "32114-1.html"; - } - else - { + } else { htmltext = "32114-2.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00128_PailakaSongOfIceAndFire/Q00128_PailakaSongOfIceAndFire.java b/src/main/java/com/l2jserver/datapack/quests/Q00128_PailakaSongOfIceAndFire/Q00128_PailakaSongOfIceAndFire.java index 8b0bbec812..92a9a3e9e4 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00128_PailakaSongOfIceAndFire/Q00128_PailakaSongOfIceAndFire.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00128_PailakaSongOfIceAndFire/Q00128_PailakaSongOfIceAndFire.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.model.quest.State; * Pailaka - Song of Ice and Fire (128) * @author Gnacik, St3eT */ -public final class Q00128_PailakaSongOfIceAndFire extends Quest -{ +public final class Q00128_PailakaSongOfIceAndFire extends Quest { // NPCs private static final int ADLER1 = 32497; private static final int ADLER2 = 32510; @@ -61,8 +60,7 @@ public final class Q00128_PailakaSongOfIceAndFire extends Quest private static final int HEAL_POTION = 13033; private static final int FIRE_ENHANCER = 13040; private static final int WATER_ENHANCER = 13041; - private static final int[] REWARDS = - { + private static final int[] REWARDS = { 13294, // Pailaka Ring 13293, // Pailaka Earring 736, // Scroll of Escape @@ -74,8 +72,7 @@ public final class Q00128_PailakaSongOfIceAndFire extends Quest private static final int MAX_LEVEL = 42; private static final int EXIT_TIME = 5; - public Q00128_PailakaSongOfIceAndFire() - { + public Q00128_PailakaSongOfIceAndFire() { super(128, Q00128_PailakaSongOfIceAndFire.class.getSimpleName(), "Pailaka - Song of Ice and Fire"); addStartNpc(ADLER1); addTalkId(ADLER1, ADLER2, SINAI, INSPECTOR); @@ -84,41 +81,33 @@ public final class Q00128_PailakaSongOfIceAndFire extends Quest } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - switch (event) - { + switch (event) { case "32500-02.htm": case "32500-03.htm": case "32500-04.htm": case "32500-05.htm": case "32497-02.htm": case "32507-07.htm": - case "32497-04.htm": - { + case "32497-04.htm": { htmltext = event; break; } - case "32497-03.htm": - { - if (!st.isStarted()) - { + case "32497-03.htm": { + if (!st.isStarted()) { st.startQuest(); htmltext = event; } break; } - case "32500-06.htm": - { - if (st.isCond(1)) - { + case "32500-06.htm": { + if (st.isCond(1)) { st.setCond(2, true); giveItems(player, SWORD, 1); giveItems(player, BOOK1, 1); @@ -126,10 +115,8 @@ public final class Q00128_PailakaSongOfIceAndFire extends Quest } break; } - case "32507-04.htm": - { - if (st.isCond(3)) - { + case "32507-04.htm": { + if (st.isCond(3)) { st.setCond(4, true); takeItems(player, SWORD, -1); takeItems(player, WATER_ESSENCE, -1); @@ -140,10 +127,8 @@ public final class Q00128_PailakaSongOfIceAndFire extends Quest } break; } - case "32507-08.htm": - { - if (st.isCond(6)) - { + case "32507-08.htm": { + if (st.isCond(6)) { st.setCond(7, true); takeItems(player, ENH_SWORD1, -1); takeItems(player, BOOK5, -1); @@ -154,21 +139,18 @@ public final class Q00128_PailakaSongOfIceAndFire extends Quest } break; } - case "32510-02.htm": - { + case "32510-02.htm": { st.exitQuest(false, true); Instance inst = InstanceManager.getInstance().getInstance(npc.getInstanceId()); inst.setDuration(EXIT_TIME * 60000); inst.setEmptyDestroyTime(0); - if (inst.containsPlayer(player.getObjectId())) - { + if (inst.containsPlayer(player.getObjectId())) { npc.setTarget(player); npc.doCast(VITALITY_REPLENISHING); addExpAndSp(player, 810000, 50000); - for (int id : REWARDS) - { + for (int id : REWARDS) { giveItems(player, id, 1); } } @@ -180,115 +162,83 @@ public final class Q00128_PailakaSongOfIceAndFire extends Quest } @Override - public final String onTalk(L2Npc npc, L2PcInstance player) - { + public final String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { - case ADLER1: - { - switch (st.getState()) - { - case State.CREATED: - { - if (player.getLevel() < MIN_LEVEL) - { + switch (npc.getId()) { + case ADLER1: { + switch (st.getState()) { + case State.CREATED: { + if (player.getLevel() < MIN_LEVEL) { htmltext = "32497-05.htm"; - } - else if (player.getLevel() > MAX_LEVEL) - { + } else if (player.getLevel() > MAX_LEVEL) { htmltext = "32497-06.htm"; - } - else - { + } else { htmltext = "32497-01.htm"; } break; } - case State.STARTED: - { - if (st.getCond() > 1) - { + case State.STARTED: { + if (st.getCond() > 1) { htmltext = "32497-00.htm"; - } - else - { + } else { htmltext = "32497-03.htm"; } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = "32497-07.htm"; break; } - default: - { + default: { htmltext = "32497-01.htm"; break; } } break; } - case SINAI: - { - if (st.getCond() > 1) - { + case SINAI: { + if (st.getCond() > 1) { htmltext = "32500-00.htm"; - } - else - { + } else { htmltext = "32500-01.htm"; } break; } - case INSPECTOR: - { - switch (st.getCond()) - { - case 1: - { + case INSPECTOR: { + switch (st.getCond()) { + case 1: { htmltext = "32507-01.htm"; break; } - case 2: - { + case 2: { htmltext = "32507-02.htm"; break; } - case 3: - { + case 3: { htmltext = "32507-03.htm"; break; } case 4: - case 5: - { + case 5: { htmltext = "32507-05.htm"; break; } - case 6: - { + case 6: { htmltext = "32507-06.htm"; break; } - default: - { + default: { htmltext = "32507-09.htm"; break; } } break; } - case ADLER2: - { - if (st.isCompleted()) - { + case ADLER2: { + if (st.isCompleted()) { htmltext = "32510-00.htm"; - } - else if (st.isCond(9)) - { + } else if (st.isCond(9)) { htmltext = "32510-01.htm"; } break; @@ -298,17 +248,12 @@ public final class Q00128_PailakaSongOfIceAndFire extends Quest } @Override - public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isStarted()) - { - switch (npc.getId()) - { - case HILLAS: - { - if (st.isCond(2)) - { + if ((st != null) && st.isStarted()) { + switch (npc.getId()) { + case HILLAS: { + if (st.isCond(2)) { st.setCond(3); playSound(player, Sound.ITEMSOUND_QUEST_ITEMGET); takeItems(player, BOOK1, -1); @@ -318,10 +263,8 @@ public final class Q00128_PailakaSongOfIceAndFire extends Quest addSpawn(PAPION, -53903, 181484, -4555, 30456, false, 0, false, npc.getInstanceId()); break; } - case PAPION: - { - if (st.isCond(4)) - { + case PAPION: { + if (st.isCond(4)) { st.setCond(5); takeItems(player, BOOK3, -1); giveItems(player, BOOK4, 1); @@ -330,10 +273,8 @@ public final class Q00128_PailakaSongOfIceAndFire extends Quest addSpawn(KINSUS, -61415, 181418, -4818, 63852, false, 0, false, npc.getInstanceId()); break; } - case KINSUS: - { - if (st.isCond(5)) - { + case KINSUS: { + if (st.isCond(5)) { st.setCond(6); playSound(player, Sound.ITEMSOUND_QUEST_ITEMGET); takeItems(player, BOOK4, -1); @@ -343,10 +284,8 @@ public final class Q00128_PailakaSongOfIceAndFire extends Quest addSpawn(GARGOS, -61354, 183624, -4821, 63613, false, 0, false, npc.getInstanceId()); break; } - case GARGOS: - { - if (st.isCond(7)) - { + case GARGOS: { + if (st.isCond(7)) { st.setCond(8); playSound(player, Sound.ITEMSOUND_QUEST_ITEMGET); takeItems(player, BOOK6, -1); @@ -355,10 +294,8 @@ public final class Q00128_PailakaSongOfIceAndFire extends Quest addSpawn(ADIANTUM, -53297, 185027, -4617, 1512, false, 0, false, npc.getInstanceId()); break; } - case ADIANTUM: - { - if (st.isCond(8)) - { + case ADIANTUM: { + if (st.isCond(8)) { st.setCond(9); playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); takeItems(player, BOOK7, -1); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00129_PailakaDevilsLegacy/Q00129_PailakaDevilsLegacy.java b/src/main/java/com/l2jserver/datapack/quests/Q00129_PailakaDevilsLegacy/Q00129_PailakaDevilsLegacy.java index 20108a3764..4b6922443e 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00129_PailakaDevilsLegacy/Q00129_PailakaDevilsLegacy.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00129_PailakaDevilsLegacy/Q00129_PailakaDevilsLegacy.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.model.quest.State; * Pailaka - Devil's Legacy (129) * @author Gnacik, St3eT */ -public final class Q00129_PailakaDevilsLegacy extends Quest -{ +public final class Q00129_PailakaDevilsLegacy extends Quest { // NPCs private static final int KAMS = 18629; // Kams (Panuka) private static final int ALKASO = 18631; // Alkaso (Panuka) @@ -63,8 +62,7 @@ public final class Q00129_PailakaDevilsLegacy extends Quest private static final int MAX_LEVEL = 67; private static final int EXIT_TIME = 5; - public Q00129_PailakaDevilsLegacy() - { + public Q00129_PailakaDevilsLegacy() { super(129, Q00129_PailakaDevilsLegacy.class.getSimpleName(), "Pailaka - Devil's Legacy"); addStartNpc(SURVIVOR); addFirstTalkId(SURVIVOR, SUPPORTER, ADVENTURER1, ADVENTURER2); @@ -74,44 +72,35 @@ public final class Q00129_PailakaDevilsLegacy extends Quest } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return getNoQuestMsg(player); } - switch (event) - { + switch (event) { case "32498-02.htm": case "32498-03.htm": - case "32498-04.htm": - { + case "32498-04.htm": { htmltext = event; break; } - case "32498-05.htm": - { - if (!qs.isStarted()) - { + case "32498-05.htm": { + if (!qs.isStarted()) { htmltext = event; qs.startQuest(); } break; } case "32501-02.htm": - case "32501-04.htm": - { + case "32501-04.htm": { htmltext = event; break; } - case "32501-03.htm": - { - if (qs.isCond(2)) - { + case "32501-03.htm": { + if (qs.isCond(2)) { giveItems(player, SWORD, 1); qs.setCond(3, true); htmltext = event; @@ -123,144 +112,101 @@ public final class Q00129_PailakaDevilsLegacy extends Quest } @Override - public final String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public final String onFirstTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if ((npc.getId() != ADVENTURER2) || (qs == null) || !qs.isCompleted()) - { + if ((npc.getId() != ADVENTURER2) || (qs == null) || !qs.isCompleted()) { return npc.getId() + ".htm"; } return "32511-03.htm"; } @Override - public final String onTalk(L2Npc npc, L2PcInstance player) - { + public final String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState qs = getQuestState(player, true); - switch (npc.getId()) - { - case SURVIVOR: - { - switch (qs.getState()) - { - case State.CREATED: - { - if (player.getLevel() < MIN_LEVEL) - { + switch (npc.getId()) { + case SURVIVOR: { + switch (qs.getState()) { + case State.CREATED: { + if (player.getLevel() < MIN_LEVEL) { htmltext = "32498-11.htm"; - } - else if (player.getLevel() > MAX_LEVEL) - { + } else if (player.getLevel() > MAX_LEVEL) { htmltext = "32498-12.htm"; - } - else - { + } else { htmltext = "32498-01.htm"; } break; } - case State.STARTED: - { - if (qs.getCond() > 1) - { + case State.STARTED: { + if (qs.getCond() > 1) { htmltext = "32498-08.htm"; - } - else - { + } else { htmltext = "32498-06.htm"; } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = "32498-10.htm"; break; } - default: - { + default: { htmltext = "32498-01.htm"; break; } } break; } - case SUPPORTER: - { - if (qs.getCond() > 2) - { + case SUPPORTER: { + if (qs.getCond() > 2) { htmltext = "32501-04.htm"; - } - else - { + } else { htmltext = "32501-01.htm"; } break; } - case ADVENTURER1: - { - if (player.hasSummon()) - { + case ADVENTURER1: { + if (player.hasSummon()) { htmltext = "32508-07.htm"; - } - else if (hasQuestItems(player, SWORD)) - { - if (hasQuestItems(player, SCROLL_1)) - { + } else if (hasQuestItems(player, SWORD)) { + if (hasQuestItems(player, SCROLL_1)) { takeItems(player, SWORD, -1); takeItems(player, SCROLL_1, -1); giveItems(player, ENH_SWORD1, 1); htmltext = "32508-03.htm"; - } - else - { + } else { htmltext = "32508-02.htm"; } - } - else if (hasQuestItems(player, ENH_SWORD1)) - { - if (hasQuestItems(player, SCROLL_2)) - { + } else if (hasQuestItems(player, ENH_SWORD1)) { + if (hasQuestItems(player, SCROLL_2)) { takeItems(player, ENH_SWORD1, -1); takeItems(player, SCROLL_2, -1); giveItems(player, ENH_SWORD2, 1); htmltext = "32508-05.htm"; } htmltext = "32508-04.htm"; - } - else if (hasQuestItems(player, ENH_SWORD2)) - { + } else if (hasQuestItems(player, ENH_SWORD2)) { htmltext = "32508-06.htm"; - } - else - { + } else { htmltext = "32508-00.htm"; } break; } - case ADVENTURER2: - { - if (player.hasSummon()) - { + case ADVENTURER2: { + if (player.hasSummon()) { htmltext = "32511-02.htm"; - } - else - { + } else { final Instance inst = InstanceManager.getInstance().getInstance(npc.getInstanceId()); qs.exitQuest(false, true); inst.setDuration(EXIT_TIME * 60000); inst.setEmptyDestroyTime(0); - if (inst.containsPlayer(player.getObjectId())) - { + if (inst.containsPlayer(player.getObjectId())) { npc.setTarget(player); npc.doCast(VITALITY_REPLENISHING); addExpAndSp(player, 10800000, 950000); rewardItems(player, BRACELET, 1); rewardItems(player, ESCAPE, 1); - } - else - { + } else { htmltext = "32511-01.htm"; } } @@ -271,36 +217,27 @@ public final class Q00129_PailakaDevilsLegacy extends Quest } @Override - public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState qs = getQuestState(player, false); - if ((qs != null) && qs.isStarted()) - { - switch (npc.getId()) - { - case KAMS: - { - if (hasQuestItems(player, SWORD)) - { + if ((qs != null) && qs.isStarted()) { + switch (npc.getId()) { + case KAMS: { + if (hasQuestItems(player, SWORD)) { giveItems(player, SCROLL_1, 1); playSound(player, Sound.ITEMSOUND_QUEST_ITEMGET); } break; } - case ALKASO: - { - if (hasQuestItems(player, ENH_SWORD1)) - { + case ALKASO: { + if (hasQuestItems(player, ENH_SWORD1)) { giveItems(player, SCROLL_2, 1); playSound(player, Sound.ITEMSOUND_QUEST_ITEMGET); } break; } - case LEMATAN: - { - if (qs.isCond(3)) - { + case LEMATAN: { + if (qs.isCond(3)) { qs.setCond(4, true); } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00130_PathToHellbound/Q00130_PathToHellbound.java b/src/main/java/com/l2jserver/datapack/quests/Q00130_PathToHellbound/Q00130_PathToHellbound.java index 228a448dbc..70373bdaf3 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00130_PathToHellbound/Q00130_PathToHellbound.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00130_PathToHellbound/Q00130_PathToHellbound.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * Path To Hellbound (130) * @author Zoey76 */ -public class Q00130_PathToHellbound extends Quest -{ +public class Q00130_PathToHellbound extends Quest { // NPCs private static final int CASIAN = 30612; private static final int GALATE = 32292; @@ -39,8 +38,7 @@ public class Q00130_PathToHellbound extends Quest // Misc private static final int MIN_LEVEL = 78; - public Q00130_PathToHellbound() - { + public Q00130_PathToHellbound() { super(130, Q00130_PathToHellbound.class.getSimpleName(), "Path To Hellbound"); addStartNpc(CASIAN); addTalkId(CASIAN, GALATE); @@ -48,67 +46,52 @@ public class Q00130_PathToHellbound extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "30612-04.htm": - { + switch (event) { + case "30612-04.htm": { htmltext = event; break; } - case "32292-02.html": - { - if (st.isCond(1)) - { + case "32292-02.html": { + if (st.isCond(1)) { htmltext = event; } break; } - case "32292-06.html": - { - if (st.isCond(3)) - { + case "32292-06.html": { + if (st.isCond(3)) { htmltext = event; } break; } - case "30612-05.html": - { + case "30612-05.html": { st.startQuest(); htmltext = event; break; } - case "30612-08.html": - { - if (st.isCond(2)) - { + case "30612-08.html": { + if (st.isCond(2)) { st.giveItems(CASIANS_BLUE_CRYSTAL, 1); st.setCond(3, true); htmltext = event; } break; } - case "32292-03.html": - { - if (st.isCond(1)) - { + case "32292-03.html": { + if (st.isCond(1)) { st.setCond(2, true); htmltext = event; } break; } - case "32292-07.html": - { - if (st.isCond(3) && st.hasQuestItems(CASIANS_BLUE_CRYSTAL)) - { + case "32292-07.html": { + if (st.isCond(3) && st.hasQuestItems(CASIANS_BLUE_CRYSTAL)) { st.exitQuest(false, true); htmltext = event; } @@ -119,76 +102,55 @@ public class Q00130_PathToHellbound extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st == null) - { + if (st == null) { return htmltext; } - switch (st.getState()) - { - case State.COMPLETED: - { + switch (st.getState()) { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } - case State.CREATED: - { - if (npc.getId() == CASIAN) - { - if (!HellboundEngine.getInstance().isLocked()) - { + case State.CREATED: { + if (npc.getId() == CASIAN) { + if (!HellboundEngine.getInstance().isLocked()) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "30612-01.htm" : "30612-02.html"; - } - else - { + } else { htmltext = "30612-03.html"; } } break; } - case State.STARTED: - { - if (npc.getId() == CASIAN) - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + if (npc.getId() == CASIAN) { + switch (st.getCond()) { + case 1: { htmltext = "30612-06.html"; break; } - case 2: - { + case 2: { htmltext = "30612-07.html"; break; } - case 3: - { + case 3: { htmltext = "30612-09.html"; break; } } - } - else if (npc.getId() == GALATE) - { - switch (st.getCond()) - { - case 1: - { + } else if (npc.getId() == GALATE) { + switch (st.getCond()) { + case 1: { htmltext = "32292-01.html"; break; } - case 2: - { + case 2: { htmltext = "32292-04.html"; break; } - case 3: - { + case 3: { htmltext = "32292-05.html"; break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00131_BirdInACage/Q00131_BirdInACage.java b/src/main/java/com/l2jserver/datapack/quests/Q00131_BirdInACage/Q00131_BirdInACage.java index d7a67204b9..79844614c4 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00131_BirdInACage/Q00131_BirdInACage.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00131_BirdInACage/Q00131_BirdInACage.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * Bird in a Cage (131) * @author Zoey76 */ -public class Q00131_BirdInACage extends Quest -{ +public class Q00131_BirdInACage extends Quest { // NPCs private static final int KANIS = 32264; private static final int PARME = 32271; @@ -43,8 +42,7 @@ public class Q00131_BirdInACage extends Quest // Misc private static final int MIN_LEVEL = 78; - public Q00131_BirdInACage() - { + public Q00131_BirdInACage() { super(131, Q00131_BirdInACage.class.getSimpleName(), "Bird in a Cage"); addStartNpc(KANIS); addTalkId(KANIS, PARME); @@ -52,38 +50,29 @@ public class Q00131_BirdInACage extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "32264-04.html": - { - if (player.getLevel() >= MIN_LEVEL) - { + switch (event) { + case "32264-04.html": { + if (player.getLevel() >= MIN_LEVEL) { st.startQuest(); htmltext = event; } break; } - case "32264-06.html": - { - if (st.isCond(1)) - { + case "32264-06.html": { + if (st.isCond(1)) { htmltext = event; } break; } - case "32264-07.html": - { - if (st.isCond(1)) - { + case "32264-07.html": { + if (st.isCond(1)) { st.setCond(2); htmltext = event; } @@ -91,18 +80,14 @@ public class Q00131_BirdInACage extends Quest } case "32264-09.html": case "32264-10.html": - case "32264-11.html": - { - if (st.isCond(2)) - { + case "32264-11.html": { + if (st.isCond(2)) { htmltext = event; } break; } - case "32264-12.html": - { - if (st.isCond(2)) - { + case "32264-12.html": { + if (st.isCond(2)) { st.giveItems(ECHO_CRYSTAL_OF_FREE_THOUGHT, 1); st.setCond(3, true); htmltext = event; @@ -110,28 +95,22 @@ public class Q00131_BirdInACage extends Quest break; } case "32264-14.html": - case "32264-15.html": - { - if (st.isCond(3)) - { + case "32264-15.html": { + if (st.isCond(3)) { htmltext = event; } break; } - case "32264-17.html": - { - if (st.isCond(4) && st.hasQuestItems(PARMES_LETTER)) - { + case "32264-17.html": { + if (st.isCond(4) && st.hasQuestItems(PARMES_LETTER)) { st.takeItems(PARMES_LETTER, -1); st.setCond(5); htmltext = event; } break; } - case "32264-19.html": - { - if (st.isCond(5) && st.hasQuestItems(ECHO_CRYSTAL_OF_FREE_THOUGHT)) - { + case "32264-19.html": { + if (st.isCond(5) && st.hasQuestItems(ECHO_CRYSTAL_OF_FREE_THOUGHT)) { st.addExpAndSp(250677, 25019); st.giveItems(FIRE_STONE + getRandom(4), 4); st.exitQuest(false, true); @@ -139,18 +118,14 @@ public class Q00131_BirdInACage extends Quest } break; } - case "32271-03.html": - { - if (st.isCond(3)) - { + case "32271-03.html": { + if (st.isCond(3)) { htmltext = event; } break; } - case "32271-04.html": - { - if (st.isCond(3)) - { + case "32271-04.html": { + if (st.isCond(3)) { st.giveItems(PARMES_LETTER, 1); st.setCond(4, true); player.setInstanceId(0); @@ -164,66 +139,48 @@ public class Q00131_BirdInACage extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.COMPLETED: - { + switch (st.getState()) { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } - case State.CREATED: - { - if (npc.getId() == KANIS) - { + case State.CREATED: { + if (npc.getId() == KANIS) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "32264-01.htm" : "32264-02.html"; } break; } - case State.STARTED: - { - if (npc.getId() == KANIS) - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + if (npc.getId() == KANIS) { + switch (st.getCond()) { + case 1: { htmltext = "32264-05.html"; break; } - case 2: - { + case 2: { htmltext = "32264-08.html"; break; } - case 3: - { + case 3: { htmltext = "32264-13.html"; break; } - case 4: - { + case 4: { htmltext = "32264-16.html"; break; } - case 5: - { + case 5: { htmltext = "32264-18.html"; break; } } - } - else if (npc.getId() == PARME) - { - if (st.getCond() < 3) - { + } else if (npc.getId() == PARME) { + if (st.getCond() < 3) { htmltext = "32271-01.html"; - } - else if (st.isCond(3)) - { + } else if (st.isCond(3)) { htmltext = "32271-02.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00132_MatrasCuriosity/Q00132_MatrasCuriosity.java b/src/main/java/com/l2jserver/datapack/quests/Q00132_MatrasCuriosity/Q00132_MatrasCuriosity.java index 28985cc352..4daec0a2ca 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00132_MatrasCuriosity/Q00132_MatrasCuriosity.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00132_MatrasCuriosity/Q00132_MatrasCuriosity.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Matras' Curiosity (132) * @author GKR, Gladicek */ -public final class Q00132_MatrasCuriosity extends Quest -{ +public final class Q00132_MatrasCuriosity extends Quest { // NPCs private static final int MATRAS = 32245; private static final int DEMON_PRINCE = 25540; @@ -44,8 +43,7 @@ public final class Q00132_MatrasCuriosity extends Quest private static final int BLUEPRINT_RANKU = 9800; private static final int BLUEPRINT_PRINCE = 9801; - public Q00132_MatrasCuriosity() - { + public Q00132_MatrasCuriosity() { super(132, Q00132_MatrasCuriosity.class.getSimpleName(), "Matras' Curiosity"); addStartNpc(MATRAS); addTalkId(MATRAS); @@ -54,31 +52,23 @@ public final class Q00132_MatrasCuriosity extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } String htmltext = event; - if (event.equalsIgnoreCase("32245-03.htm") && (player.getLevel() >= 76) && !st.isCompleted()) - { - if (st.isCreated()) - { + if (event.equalsIgnoreCase("32245-03.htm") && (player.getLevel() >= 76) && !st.isCompleted()) { + if (st.isCreated()) { st.startQuest(); st.set("rewarded_prince", "1"); st.set("rewarded_ranku", "1"); - } - else - { + } else { htmltext = "32245-03a.htm"; } - } - else if (event.equalsIgnoreCase("32245-07.htm") && st.isCond(3) && !st.isCompleted()) - { + } else if (event.equalsIgnoreCase("32245-07.htm") && st.isCond(3) && !st.isCompleted()) { st.giveAdena(65884, true); st.addExpAndSp(50541, 5094); st.giveItems(FIRE, 1); @@ -93,43 +83,33 @@ public final class Q00132_MatrasCuriosity extends Quest } @Override - public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { L2PcInstance pl = null; - switch (npc.getId()) - { + switch (npc.getId()) { case DEMON_PRINCE: pl = getRandomPartyMember(player, "rewarded_prince", "1"); - if (pl != null) - { + if (pl != null) { final QuestState st = getQuestState(pl, false); st.giveItems(BLUEPRINT_PRINCE, 1); st.set("rewarded_prince", "2"); - if (st.hasQuestItems(BLUEPRINT_RANKU)) - { + if (st.hasQuestItems(BLUEPRINT_RANKU)) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } break; case RANKU: pl = getRandomPartyMember(player, "rewarded_ranku", "1"); - if (pl != null) - { + if (pl != null) { final QuestState st = getQuestState(pl, false); st.giveItems(BLUEPRINT_RANKU, 1); st.set("rewarded_ranku", "2"); - if (st.hasQuestItems(BLUEPRINT_PRINCE)) - { + if (st.hasQuestItems(BLUEPRINT_PRINCE)) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -139,33 +119,23 @@ public final class Q00132_MatrasCuriosity extends Quest } @Override - public final String onTalk(L2Npc npc, L2PcInstance player) - { + public final String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - if (st.isCreated()) - { + if (st.isCreated()) { htmltext = (player.getLevel() >= 76) ? "32245-01.htm" : "32245-02.htm"; - } - else if (st.isCompleted()) - { + } else if (st.isCompleted()) { htmltext = getAlreadyCompletedMsg(player); - } - else if (st.isStarted()) - { - switch (st.getCond()) - { + } else if (st.isStarted()) { + switch (st.getCond()) { case 1: case 2: - if (st.hasQuestItems(BLUEPRINT_RANKU) && st.hasQuestItems(BLUEPRINT_PRINCE)) - { + if (st.hasQuestItems(BLUEPRINT_RANKU) && st.hasQuestItems(BLUEPRINT_PRINCE)) { st.takeItems(BLUEPRINT_RANKU, -1); st.takeItems(BLUEPRINT_PRINCE, -1); st.setCond(3, true); htmltext = "32245-05.htm"; - } - else - { + } else { htmltext = "32245-04.htm"; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00133_ThatsBloodyHot/Q00133_ThatsBloodyHot.java b/src/main/java/com/l2jserver/datapack/quests/Q00133_ThatsBloodyHot/Q00133_ThatsBloodyHot.java index ff8fbb3d7b..8c5cb6e8bd 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00133_ThatsBloodyHot/Q00133_ThatsBloodyHot.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00133_ThatsBloodyHot/Q00133_ThatsBloodyHot.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.State; * That's Bloody Hot! (133) * @author Zoey76 */ -public class Q00133_ThatsBloodyHot extends Quest -{ +public class Q00133_ThatsBloodyHot extends Quest { // NPCs private static final int KANIS = 32264; private static final int GALATE = 32292; @@ -40,8 +39,7 @@ public class Q00133_ThatsBloodyHot extends Quest // Misc private static final int MIN_LEVEL = 78; - public Q00133_ThatsBloodyHot() - { + public Q00133_ThatsBloodyHot() { super(133, Q00133_ThatsBloodyHot.class.getSimpleName(), "That's Bloody Hot!"); addStartNpc(KANIS); addTalkId(KANIS, GALATE); @@ -49,91 +47,70 @@ public class Q00133_ThatsBloodyHot extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "32264-04.html": - { - if (player.getLevel() >= MIN_LEVEL) - { + switch (event) { + case "32264-04.html": { + if (player.getLevel() >= MIN_LEVEL) { st.startQuest(); htmltext = event; } break; } case "32264-06.html": - case "32264-07.html": - { - if (st.isCond(1)) - { + case "32264-07.html": { + if (st.isCond(1)) { htmltext = event; } break; } - case "32264-08.html": - { + case "32264-08.html": { st.setCond(2); htmltext = event; break; } case "32264-10.html": - case "32264-11.html": - { - if (st.isCond(2)) - { + case "32264-11.html": { + if (st.isCond(2)) { htmltext = event; } break; } - case "32264-12.html": - { - if (st.isCond(2)) - { + case "32264-12.html": { + if (st.isCond(2)) { st.giveItems(REFINED_CRYSTAL_SAMPLE, 1); st.setCond(3); htmltext = event; } break; } - case "32292-03.html": - { - if (st.isCond(3)) - { + case "32292-03.html": { + if (st.isCond(3)) { htmltext = event; } break; } - case "32292-05.html": - { - if (st.isCond(3) && st.hasQuestItems(REFINED_CRYSTAL_SAMPLE)) - { + case "32292-05.html": { + if (st.isCond(3) && st.hasQuestItems(REFINED_CRYSTAL_SAMPLE)) { st.takeItems(REFINED_CRYSTAL_SAMPLE, -1); htmltext = event; st.setCond(4); } break; } - case "32292-06.html": - { - if (st.isCond(4)) - { - if (!HellboundEngine.getInstance().isLocked()) - { + case "32292-06.html": { + if (st.isCond(4)) { + if (!HellboundEngine.getInstance().isLocked()) { st.giveAdena(254247, true); st.addExpAndSp(331457, 32524); st.exitQuest(false, true); htmltext = event; - } - else - { + } else { HellboundEngine.getInstance().setLevel(1); st.giveAdena(254247, true); st.addExpAndSp(325881, 32524); @@ -148,61 +125,39 @@ public class Q00133_ThatsBloodyHot extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.COMPLETED: - { + switch (st.getState()) { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } - case State.CREATED: - { - if (npc.getId() == KANIS) - { - if (player.hasQuestCompleted(Q00131_BirdInACage.class.getSimpleName())) - { + case State.CREATED: { + if (npc.getId() == KANIS) { + if (player.hasQuestCompleted(Q00131_BirdInACage.class.getSimpleName())) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "32264-01.htm" : "32264-02.html"; - } - else - { + } else { htmltext = "32264-03.html"; } } break; } - case State.STARTED: - { - if (npc.getId() == KANIS) - { - if (st.isCond(1)) - { + case State.STARTED: { + if (npc.getId() == KANIS) { + if (st.isCond(1)) { htmltext = "32264-05.html"; - } - else if (st.isCond(2)) - { + } else if (st.isCond(2)) { htmltext = "32264-09.html"; - } - else if (st.getCond() >= 3) - { + } else if (st.getCond() >= 3) { htmltext = "32264-13.html"; } - } - else if (npc.getId() == GALATE) - { - if (st.getCond() < 3) - { + } else if (npc.getId() == GALATE) { + if (st.getCond() < 3) { htmltext = "32292-01.html"; - } - else if (st.isCond(3)) - { + } else if (st.isCond(3)) { htmltext = "32292-02.html"; - } - else if (st.isCond(4)) - { + } else if (st.isCond(4)) { htmltext = "32292-04.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00134_TempleMissionary/Q00134_TempleMissionary.java b/src/main/java/com/l2jserver/datapack/quests/Q00134_TempleMissionary/Q00134_TempleMissionary.java index fc1779790a..469cc7eefd 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00134_TempleMissionary/Q00134_TempleMissionary.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00134_TempleMissionary/Q00134_TempleMissionary.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.model.quest.State; * Temple Missionary (134) * @author malyelfik */ -public class Q00134_TempleMissionary extends Quest -{ +public class Q00134_TempleMissionary extends Quest { // NPCs private static final int GLYVKA = 30067; private static final int ROUKE = 31418; @@ -46,8 +45,7 @@ public class Q00134_TempleMissionary extends Quest // Monsters private static final int CRUMA_MARSHLANDS_TRAITOR = 27339; private static final Map<Integer, Integer> MOBS = new HashMap<>(); - static - { + static { MOBS.put(20157, 78); // Marsh Stakato MOBS.put(20229, 75); // Stinger Wasp MOBS.put(20230, 86); // Marsh Stakato Worker @@ -62,8 +60,7 @@ public class Q00134_TempleMissionary extends Quest private static final int FRAGMENT_COUNT = 10; private static final int REPORT_COUNT = 3; - public Q00134_TempleMissionary() - { + public Q00134_TempleMissionary() { super(134, Q00134_TempleMissionary.class.getSimpleName(), "Temple Missionary"); addStartNpc(GLYVKA); addTalkId(GLYVKA, ROUKE); @@ -73,17 +70,14 @@ public class Q00134_TempleMissionary extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "30067-05.html": case "30067-09.html": case "31418-07.html": @@ -105,8 +99,7 @@ public class Q00134_TempleMissionary extends Quest case "30067-10.html": st.giveItems(BADGE_TEMPLE_MISSIONARY, 1); st.giveAdena(15100, true); - if (player.getLevel() < MAX_REWARD_LEVEL) - { + if (player.getLevel() < MAX_REWARD_LEVEL) { st.addExpAndSp(30000, 2000); } st.exitQuest(false, true); @@ -119,38 +112,26 @@ public class Q00134_TempleMissionary extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance member = getRandomPartyMember(player, 3); - if (member == null) - { + if (member == null) { return super.onKill(npc, player, isSummon); } final QuestState st = getQuestState(member, false); - if (npc.getId() == CRUMA_MARSHLANDS_TRAITOR) - { + if (npc.getId() == CRUMA_MARSHLANDS_TRAITOR) { st.giveItems(GIANTS_TECHNOLOGY_REPORT, 1); - if (st.getQuestItemsCount(GIANTS_TECHNOLOGY_REPORT) >= REPORT_COUNT) - { + if (st.getQuestItemsCount(GIANTS_TECHNOLOGY_REPORT) >= REPORT_COUNT) { st.setCond(4, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } - } - else - { - if (st.hasQuestItems(GIANTS_EXPERIMENTAL_TOOL)) - { + } else { + if (st.hasQuestItems(GIANTS_EXPERIMENTAL_TOOL)) { st.takeItems(GIANTS_EXPERIMENTAL_TOOL, 1); - if (getRandom(100) != 0) - { + if (getRandom(100) != 0) { addSpawn(CRUMA_MARSHLANDS_TRAITOR, npc.getX() + 20, npc.getY() + 20, npc.getZ(), npc.getHeading(), false, 60000); } - } - else if (getRandom(100) < MOBS.get(npc.getId())) - { + } else if (getRandom(100) < MOBS.get(npc.getId())) { st.giveItems(GIANTS_EXPERIMENTAL_TOOL_FRAGMENT, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -159,21 +140,17 @@ public class Q00134_TempleMissionary extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case GLYVKA: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? "30067-01.htm" : "30067-02.htm"; break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "30067-04.html"; break; @@ -183,12 +160,9 @@ public class Q00134_TempleMissionary extends Quest htmltext = "30067-07.html"; break; case 5: - if (st.isSet("talk")) - { + if (st.isSet("talk")) { htmltext = "30067-09.html"; - } - else - { + } else { st.takeItems(ROUKES_REPOT, -1); st.set("talk", "1"); htmltext = "30067-08.html"; @@ -202,10 +176,8 @@ public class Q00134_TempleMissionary extends Quest } break; case ROUKE: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: htmltext = "31418-01.html"; break; @@ -213,12 +185,9 @@ public class Q00134_TempleMissionary extends Quest htmltext = "31418-02.html"; break; case 3: - if ((st.getQuestItemsCount(GIANTS_EXPERIMENTAL_TOOL_FRAGMENT) < FRAGMENT_COUNT) && (st.getQuestItemsCount(GIANTS_TECHNOLOGY_REPORT) < REPORT_COUNT)) - { + if ((st.getQuestItemsCount(GIANTS_EXPERIMENTAL_TOOL_FRAGMENT) < FRAGMENT_COUNT) && (st.getQuestItemsCount(GIANTS_TECHNOLOGY_REPORT) < REPORT_COUNT)) { htmltext = "31418-04.html"; - } - else if (st.getQuestItemsCount(GIANTS_EXPERIMENTAL_TOOL_FRAGMENT) >= FRAGMENT_COUNT) - { + } else if (st.getQuestItemsCount(GIANTS_EXPERIMENTAL_TOOL_FRAGMENT) >= FRAGMENT_COUNT) { final int count = (int) (st.getQuestItemsCount(GIANTS_EXPERIMENTAL_TOOL_FRAGMENT) / 10); st.takeItems(GIANTS_EXPERIMENTAL_TOOL_FRAGMENT, count * 10); st.giveItems(GIANTS_EXPERIMENTAL_TOOL, count); @@ -226,12 +195,9 @@ public class Q00134_TempleMissionary extends Quest } break; case 4: - if (st.isSet("talk")) - { + if (st.isSet("talk")) { htmltext = "31418-07.html"; - } - else if (st.getQuestItemsCount(GIANTS_TECHNOLOGY_REPORT) >= REPORT_COUNT) - { + } else if (st.getQuestItemsCount(GIANTS_TECHNOLOGY_REPORT) >= REPORT_COUNT) { st.takeItems(GIANTS_EXPERIMENTAL_TOOL_FRAGMENT, -1); st.takeItems(GIANTS_EXPERIMENTAL_TOOL, -1); st.takeItems(GIANTS_TECHNOLOGY_REPORT, -1); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00135_TempleExecutor/Q00135_TempleExecutor.java b/src/main/java/com/l2jserver/datapack/quests/Q00135_TempleExecutor/Q00135_TempleExecutor.java index 308febbea5..704a5ace20 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00135_TempleExecutor/Q00135_TempleExecutor.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00135_TempleExecutor/Q00135_TempleExecutor.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.State; * Temple Executor (135) * @author malyelfik */ -public class Q00135_TempleExecutor extends Quest -{ +public class Q00135_TempleExecutor extends Quest { // NPCs private static final int SHEGFIELD = 30068; private static final int PANO = 30078; @@ -48,8 +47,7 @@ public class Q00135_TempleExecutor extends Quest private static final int BADGE_TEMPLE_EXECUTOR = 10334; // Monsters private static final Map<Integer, Integer> MOBS = new HashMap<>(); - static - { + static { MOBS.put(20781, 439); // Delu Lizardman Shaman MOBS.put(21104, 439); // Delu Lizardman Supplier MOBS.put(21105, 504); // Delu Lizardman Special Agent @@ -61,8 +59,7 @@ public class Q00135_TempleExecutor extends Quest private static final int ITEM_COUNT = 10; private static final int MAX_REWARD_LEVEL = 41; - public Q00135_TempleExecutor() - { + public Q00135_TempleExecutor() { super(135, Q00135_TempleExecutor.class.getSimpleName(), "Temple Executor"); addStartNpc(SHEGFIELD); addTalkId(SHEGFIELD, ALEX, SONIN, PANO); @@ -71,17 +68,14 @@ public class Q00135_TempleExecutor extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "30291-02a.html": case "30291-04.html": case "30291-05.html": @@ -103,8 +97,7 @@ public class Q00135_TempleExecutor extends Quest case "30068-11.html": st.giveItems(BADGE_TEMPLE_EXECUTOR, 1); st.giveAdena(16924, true); - if (player.getLevel() < MAX_REWARD_LEVEL) - { + if (player.getLevel() < MAX_REWARD_LEVEL) { st.addExpAndSp(30000, 2000); } st.exitQuest(false, true); @@ -117,31 +110,22 @@ public class Q00135_TempleExecutor extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance member = getRandomPartyMember(player, 3); - if (member == null) - { + if (member == null) { return super.onKill(npc, player, isSummon); } final QuestState st = getQuestState(member, false); - if ((getRandom(1000) < MOBS.get(npc.getId()))) - { - if (st.getQuestItemsCount(STOLEN_CARGO) < ITEM_COUNT) - { + if ((getRandom(1000) < MOBS.get(npc.getId()))) { + if (st.getQuestItemsCount(STOLEN_CARGO) < ITEM_COUNT) { st.giveItems(STOLEN_CARGO, 1); - } - else if (st.getQuestItemsCount(HATE_CRYSTAL) < ITEM_COUNT) - { + } else if (st.getQuestItemsCount(HATE_CRYSTAL) < ITEM_COUNT) { st.giveItems(HATE_CRYSTAL, 1); - } - else - { + } else { st.giveItems(OLD_TREASURE_MAP, 1); } - if ((st.getQuestItemsCount(STOLEN_CARGO) >= ITEM_COUNT) && (st.getQuestItemsCount(HATE_CRYSTAL) >= ITEM_COUNT) && (st.getQuestItemsCount(OLD_TREASURE_MAP) >= ITEM_COUNT)) - { + if ((st.getQuestItemsCount(STOLEN_CARGO) >= ITEM_COUNT) && (st.getQuestItemsCount(HATE_CRYSTAL) >= ITEM_COUNT) && (st.getQuestItemsCount(OLD_TREASURE_MAP) >= ITEM_COUNT)) { st.setCond(4, true); } } @@ -149,21 +133,17 @@ public class Q00135_TempleExecutor extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case SHEGFIELD: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? "30068-01.htm" : "30068-02.htm"; break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: // 1 st.setCond(2, true); htmltext = "30068-04.html"; @@ -176,20 +156,15 @@ public class Q00135_TempleExecutor extends Quest htmltext = "30068-06.html"; break; case 5: - if (st.isSet("talk")) - { + if (st.isSet("talk")) { htmltext = "30068-08.html"; - } - else if (st.hasQuestItems(PANOS_CREDENTIALS, SONINS_CREDENTIALS, ALEXS_CREDENTIALS)) - { + } else if (st.hasQuestItems(PANOS_CREDENTIALS, SONINS_CREDENTIALS, ALEXS_CREDENTIALS)) { st.takeItems(SONINS_CREDENTIALS, -1); st.takeItems(PANOS_CREDENTIALS, -1); st.takeItems(ALEXS_CREDENTIALS, -1); st.set("talk", "1"); htmltext = "30068-07.html"; - } - else - { + } else { htmltext = "30068-06.html"; } break; @@ -201,20 +176,15 @@ public class Q00135_TempleExecutor extends Quest } break; case ALEX: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: htmltext = "30291-01.html"; break; case 2: - if (st.isSet("talk")) - { + if (st.isSet("talk")) { htmltext = "30291-03.html"; - } - else - { + } else { st.set("talk", "1"); htmltext = "30291-02.html"; } @@ -223,19 +193,15 @@ public class Q00135_TempleExecutor extends Quest htmltext = "30291-08.html"; // 4 break; case 4: - if (st.hasQuestItems(PANOS_CREDENTIALS, SONINS_CREDENTIALS)) - { - if (st.getQuestItemsCount(OLD_TREASURE_MAP) < ITEM_COUNT) - { + if (st.hasQuestItems(PANOS_CREDENTIALS, SONINS_CREDENTIALS)) { + if (st.getQuestItemsCount(OLD_TREASURE_MAP) < ITEM_COUNT) { return htmltext; } st.setCond(5, true); st.takeItems(OLD_TREASURE_MAP, -1); st.giveItems(ALEXS_CREDENTIALS, 1); htmltext = "30291-10.html"; - } - else - { + } else { htmltext = "30291-09.html"; } break; @@ -246,10 +212,8 @@ public class Q00135_TempleExecutor extends Quest } break; case PANO: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: htmltext = "30078-01.html"; break; @@ -260,10 +224,8 @@ public class Q00135_TempleExecutor extends Quest htmltext = "30078-03.html"; break; case 4: - if (!st.isSet("Pano")) - { - if (st.getQuestItemsCount(HATE_CRYSTAL) < ITEM_COUNT) - { + if (!st.isSet("Pano")) { + if (st.getQuestItemsCount(HATE_CRYSTAL) < ITEM_COUNT) { return htmltext; } st.takeItems(HATE_CRYSTAL, -1); @@ -279,10 +241,8 @@ public class Q00135_TempleExecutor extends Quest } break; case SONIN: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: htmltext = "31773-01.html"; break; @@ -293,10 +253,8 @@ public class Q00135_TempleExecutor extends Quest htmltext = "31773-03.html"; break; case 4: - if (!st.isSet("Sonin")) - { - if (st.getQuestItemsCount(STOLEN_CARGO) < ITEM_COUNT) - { + if (!st.isSet("Sonin")) { + if (st.getQuestItemsCount(STOLEN_CARGO) < ITEM_COUNT) { return htmltext; } st.takeItems(STOLEN_CARGO, -1); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00136_MoreThanMeetsTheEye/Q00136_MoreThanMeetsTheEye.java b/src/main/java/com/l2jserver/datapack/quests/Q00136_MoreThanMeetsTheEye/Q00136_MoreThanMeetsTheEye.java index 4f743855a6..5a4a06c8dd 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00136_MoreThanMeetsTheEye/Q00136_MoreThanMeetsTheEye.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00136_MoreThanMeetsTheEye/Q00136_MoreThanMeetsTheEye.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * More Than Meets the Eye (136) * @author malyelfik */ -public class Q00136_MoreThanMeetsTheEye extends Quest -{ +public class Q00136_MoreThanMeetsTheEye extends Quest { // NPCs private static final int HARDIN = 30832; private static final int ERRICKIN = 30701; @@ -55,16 +54,14 @@ public class Q00136_MoreThanMeetsTheEye extends Quest private static final int MIN_LEVEL = 50; private static final int ECTOPLASM_COUNT = 35; private static final int CRYSTAL_COUNT = 5; - private static final int[] CHANCES = - { + private static final int[] CHANCES = { 0, 40, 90, 290 }; - public Q00136_MoreThanMeetsTheEye() - { + public Q00136_MoreThanMeetsTheEye() { super(136, Q00136_MoreThanMeetsTheEye.class.getSimpleName(), "More Than Meets the Eye"); addStartNpc(HARDIN); addTalkId(HARDIN, ERRICKIN, CLAYTON); @@ -73,31 +70,24 @@ public class Q00136_MoreThanMeetsTheEye extends Quest registerQuestItems(ECTOPLASM, STABILIZED_ECTOPLASM, ORDER, GLASS_JAGUAR_CRYSTAL, BOOK_OF_SEAL); } - private void giveItem(QuestState st, int itemId, int count, int maxCount, int cond) - { + private void giveItem(QuestState st, int itemId, int count, int maxCount, int cond) { st.giveItems(itemId, count); - if (st.getQuestItemsCount(itemId) >= maxCount) - { + if (st.getQuestItemsCount(itemId) >= maxCount) { st.setCond(cond, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "30832-05.html": case "30832-06.html": case "30832-12.html": @@ -141,49 +131,39 @@ public class Q00136_MoreThanMeetsTheEye extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if (st == null) - { + if (st == null) { return super.onKill(npc, killer, isSummon); } final int npcId = npc.getId(); - if ((npcId != GLASS_JAGUAR) && st.isCond(3)) - { + if ((npcId != GLASS_JAGUAR) && st.isCond(3)) { final int count = ((npcId == MIRROR) && ((st.getQuestItemsCount(ECTOPLASM) + 2) < ECTOPLASM_COUNT)) ? 2 : 1; final int index = npcId - GHOST1; - if ((getRandom(1000) < CHANCES[index]) && ((st.getQuestItemsCount(ECTOPLASM) + count) < ECTOPLASM_COUNT)) - { + if ((getRandom(1000) < CHANCES[index]) && ((st.getQuestItemsCount(ECTOPLASM) + count) < ECTOPLASM_COUNT)) { st.giveItems(ECTOPLASM, 1); } giveItem(st, ECTOPLASM, count, ECTOPLASM_COUNT, 4); - } - else if ((npcId == GLASS_JAGUAR) && st.isCond(7)) - { + } else if ((npcId == GLASS_JAGUAR) && st.isCond(7)) { giveItem(st, GLASS_JAGUAR_CRYSTAL, 1, CRYSTAL_COUNT, 8); } return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (npc.getId()) - { + switch (npc.getId()) { case HARDIN: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? "30832-01.htm" : "30832-02.htm"; break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "30832-04.html"; break; @@ -193,22 +173,15 @@ public class Q00136_MoreThanMeetsTheEye extends Quest htmltext = "30832-08.html"; break; case 5: - if (st.getInt("talked") == 1) - { + if (st.getInt("talked") == 1) { htmltext = "30832-10.html"; - } - else if (st.getInt("talked") == 2) - { + } else if (st.getInt("talked") == 2) { htmltext = "30832-12.html"; - } - else if (st.hasQuestItems(STABILIZED_ECTOPLASM)) - { + } else if (st.hasQuestItems(STABILIZED_ECTOPLASM)) { st.takeItems(STABILIZED_ECTOPLASM, -1); st.set("talked", "1"); htmltext = "30832-09.html"; - } - else - { + } else { htmltext = "30832-08.html"; } break; @@ -218,17 +191,12 @@ public class Q00136_MoreThanMeetsTheEye extends Quest htmltext = "30832-15.html"; break; case 9: - if (st.getInt("talked") == 1) - { + if (st.getInt("talked") == 1) { st.set("talked", "2"); htmltext = "30832-17.html"; - } - else if (st.getInt("talked") == 2) - { + } else if (st.getInt("talked") == 2) { htmltext = "30832-18.html"; - } - else - { + } else { st.takeItems(BOOK_OF_SEAL, -1); st.set("talked", "1"); htmltext = "30832-16.html"; @@ -242,10 +210,8 @@ public class Q00136_MoreThanMeetsTheEye extends Quest } break; case ERRICKIN: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: htmltext = "30701-01.html"; break; @@ -256,14 +222,11 @@ public class Q00136_MoreThanMeetsTheEye extends Quest htmltext = "30701-04.html"; break; case 4: - if (st.getQuestItemsCount(ECTOPLASM) < ECTOPLASM_COUNT) - { + if (st.getQuestItemsCount(ECTOPLASM) < ECTOPLASM_COUNT) { st.giveItems(STABILIZED_ECTOPLASM, 1); st.setCond(5, true); htmltext = "30701-06.html"; - } - else - { + } else { st.takeItems(ECTOPLASM, -1); htmltext = "30701-05.html"; } @@ -275,10 +238,8 @@ public class Q00136_MoreThanMeetsTheEye extends Quest } break; case CLAYTON: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: case 2: case 3: diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00137_TempleChampionPart1/Q00137_TempleChampionPart1.java b/src/main/java/com/l2jserver/datapack/quests/Q00137_TempleChampionPart1/Q00137_TempleChampionPart1.java index 5741f98ce8..927261fa8a 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00137_TempleChampionPart1/Q00137_TempleChampionPart1.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00137_TempleChampionPart1/Q00137_TempleChampionPart1.java @@ -28,12 +28,10 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Temple Champion - 1 (137) * @author nonom */ -public class Q00137_TempleChampionPart1 extends Quest -{ +public class Q00137_TempleChampionPart1 extends Quest { // NPCs private static final int SYLVAIN = 30070; - private static final int MOBS[] = - { + private static final int MOBS[] = { 20083, // Granite Golem 20144, // Hangman Tree 20199, // Amber Basilisk @@ -46,8 +44,7 @@ public class Q00137_TempleChampionPart1 extends Quest private static final int EXECUTOR = 10334; private static final int MISSIONARY = 10339; - public Q00137_TempleChampionPart1() - { + public Q00137_TempleChampionPart1() { super(137, Q00137_TempleChampionPart1.class.getSimpleName(), "Temple Champion - 1"); addStartNpc(SYLVAIN); addTalkId(SYLVAIN); @@ -56,15 +53,12 @@ public class Q00137_TempleChampionPart1 extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - switch (event) - { + switch (event) { case "30070-02.htm": st.startQuest(); break; @@ -79,13 +73,11 @@ public class Q00137_TempleChampionPart1 extends Quest st.setCond(2, true); break; case "30070-16.html": - if (st.isCond(3) && (st.hasQuestItems(EXECUTOR) && st.hasQuestItems(MISSIONARY))) - { + if (st.isCond(3) && (st.hasQuestItems(EXECUTOR) && st.hasQuestItems(MISSIONARY))) { st.takeItems(EXECUTOR, -1); st.takeItems(MISSIONARY, -1); st.giveAdena(69146, true); - if (player.getLevel() < 41) - { + if (player.getLevel() < 41) { st.addExpAndSp(219975, 13047); } st.exitQuest(false, true); @@ -96,18 +88,13 @@ public class Q00137_TempleChampionPart1 extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isStarted() && st.isCond(2) && (st.getQuestItemsCount(FRAGMENT) < 30)) - { + if ((st != null) && st.isStarted() && st.isCond(2) && (st.getQuestItemsCount(FRAGMENT) < 30)) { st.giveItems(FRAGMENT, 1); - if (st.getQuestItemsCount(FRAGMENT) >= 30) - { + if (st.getQuestItemsCount(FRAGMENT) >= 30) { st.setCond(3, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -115,19 +102,15 @@ public class Q00137_TempleChampionPart1 extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - if (st.isCompleted()) - { + if (st.isCompleted()) { return getAlreadyCompletedMsg(player); } - switch (st.getCond()) - { + switch (st.getCond()) { case 1: - switch (st.getInt("talk")) - { + switch (st.getInt("talk")) { case 1: htmltext = "30070-05.html"; break; @@ -143,12 +126,9 @@ public class Q00137_TempleChampionPart1 extends Quest htmltext = "30070-08.html"; break; case 3: - if (st.getInt("talk") == 1) - { + if (st.getInt("talk") == 1) { htmltext = "30070-10.html"; - } - else if (st.getQuestItemsCount(FRAGMENT) >= 30) - { + } else if (st.getQuestItemsCount(FRAGMENT) >= 30) { st.set("talk", "1"); htmltext = "30070-09.html"; st.takeItems(FRAGMENT, -1); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00138_TempleChampionPart2/Q00138_TempleChampionPart2.java b/src/main/java/com/l2jserver/datapack/quests/Q00138_TempleChampionPart2/Q00138_TempleChampionPart2.java index 5734f8827c..9df959ec23 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00138_TempleChampionPart2/Q00138_TempleChampionPart2.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00138_TempleChampionPart2/Q00138_TempleChampionPart2.java @@ -29,15 +29,13 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Temple Champion - 2 (138) * @author nonom */ -public class Q00138_TempleChampionPart2 extends Quest -{ +public class Q00138_TempleChampionPart2 extends Quest { // NPCs private static final int SYLVAIN = 30070; private static final int PUPINA = 30118; private static final int ANGUS = 30474; private static final int SLA = 30666; - private static final int MOBS[] = - { + private static final int MOBS[] = { 20176, // Wyrm 20550, // Guardian Basilisk 20551, // Road Scavenger @@ -49,8 +47,7 @@ public class Q00138_TempleChampionPart2 extends Quest private static final int ANGUS_RECOMMENDATION = 10343; private static final int PUPINAS_RECOMMENDATION = 10344; - public Q00138_TempleChampionPart2() - { + public Q00138_TempleChampionPart2() { super(138, Q00138_TempleChampionPart2.class.getSimpleName(), "Temple Champion - 2"); addStartNpc(SYLVAIN); addTalkId(SYLVAIN, PUPINA, ANGUS, SLA); @@ -59,23 +56,19 @@ public class Q00138_TempleChampionPart2 extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - switch (event) - { + switch (event) { case "30070-02.htm": st.startQuest(); st.giveItems(TEMPLE_MANIFESTO, 1); break; case "30070-05.html": st.giveAdena(84593, true); - if ((player.getLevel() < 42)) - { + if ((player.getLevel() < 42)) { st.addExpAndSp(187062, 11307); } st.exitQuest(false, true); @@ -94,15 +87,13 @@ public class Q00138_TempleChampionPart2 extends Quest st.setCond(4, true); break; case "30666-02.html": - if (st.hasQuestItems(PUPINAS_RECOMMENDATION)) - { + if (st.hasQuestItems(PUPINAS_RECOMMENDATION)) { st.set("talk", "1"); st.takeItems(PUPINAS_RECOMMENDATION, -1); } break; case "30666-03.html": - if (st.hasQuestItems(TEMPLE_MANIFESTO)) - { + if (st.hasQuestItems(TEMPLE_MANIFESTO)) { st.set("talk", "2"); st.takeItems(TEMPLE_MANIFESTO, -1); } @@ -116,18 +107,13 @@ public class Q00138_TempleChampionPart2 extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isStarted() && st.isCond(4) && (st.getQuestItemsCount(RELICS_OF_THE_DARK_ELF_TRAINEE) < 10)) - { + if ((st != null) && st.isStarted() && st.isCond(4) && (st.getQuestItemsCount(RELICS_OF_THE_DARK_ELF_TRAINEE) < 10)) { st.giveItems(RELICS_OF_THE_DARK_ELF_TRAINEE, 1); - if (st.getQuestItemsCount(RELICS_OF_THE_DARK_ELF_TRAINEE) >= 10) - { + if (st.getQuestItemsCount(RELICS_OF_THE_DARK_ELF_TRAINEE) >= 10) { st.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -135,15 +121,12 @@ public class Q00138_TempleChampionPart2 extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case SYLVAIN: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "30070-02.htm"; break; @@ -158,8 +141,7 @@ public class Q00138_TempleChampionPart2 extends Quest htmltext = "30070-04.html"; break; default: - if (st.isCompleted()) - { + if (st.isCompleted()) { return getAlreadyCompletedMsg(player); } htmltext = (player.getLevel() >= 36) ? (player.hasQuestCompleted(Q00137_TempleChampionPart1.class.getSimpleName())) ? "30070-01.htm" : "30070-00a.htm" : "30070-00.htm"; @@ -167,8 +149,7 @@ public class Q00138_TempleChampionPart2 extends Quest } break; case PUPINA: - switch (st.getCond()) - { + switch (st.getCond()) { case 2: htmltext = "30118-01.html"; break; @@ -178,8 +159,7 @@ public class Q00138_TempleChampionPart2 extends Quest break; case 5: htmltext = "30118-08.html"; - if (st.hasQuestItems(ANGUS_RECOMMENDATION)) - { + if (st.hasQuestItems(ANGUS_RECOMMENDATION)) { st.takeItems(ANGUS_RECOMMENDATION, -1); } break; @@ -189,21 +169,17 @@ public class Q00138_TempleChampionPart2 extends Quest } break; case ANGUS: - switch (st.getCond()) - { + switch (st.getCond()) { case 3: htmltext = "30474-01.html"; break; case 4: - if (st.getQuestItemsCount(RELICS_OF_THE_DARK_ELF_TRAINEE) >= 10) - { + if (st.getQuestItemsCount(RELICS_OF_THE_DARK_ELF_TRAINEE) >= 10) { st.takeItems(RELICS_OF_THE_DARK_ELF_TRAINEE, -1); st.giveItems(ANGUS_RECOMMENDATION, 1); st.setCond(5, true); htmltext = "30474-04.html"; - } - else - { + } else { htmltext = "30474-03.html"; } break; @@ -213,11 +189,9 @@ public class Q00138_TempleChampionPart2 extends Quest } break; case SLA: - switch (st.getCond()) - { + switch (st.getCond()) { case 6: - switch (st.getInt("talk")) - { + switch (st.getInt("talk")) { case 1: htmltext = "30666-02.html"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00139_ShadowFoxPart1/Q00139_ShadowFoxPart1.java b/src/main/java/com/l2jserver/datapack/quests/Q00139_ShadowFoxPart1/Q00139_ShadowFoxPart1.java index 632c995231..ca60d64a68 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00139_ShadowFoxPart1/Q00139_ShadowFoxPart1.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00139_ShadowFoxPart1/Q00139_ShadowFoxPart1.java @@ -30,13 +30,11 @@ import com.l2jserver.gameserver.model.quest.State; * Shadow Fox - 1 (139) * @author Nono */ -public class Q00139_ShadowFoxPart1 extends Quest -{ +public class Q00139_ShadowFoxPart1 extends Quest { // NPC private static final int MIA = 30896; // Monsters - private static final int MOBS[] = - { + private static final int MOBS[] = { 20784, // Tasaba Lizardman 20785, // Tasaba Lizardman Shaman 21639, // Tasaba Lizardman @@ -50,8 +48,7 @@ public class Q00139_ShadowFoxPart1 extends Quest private static final int MAX_REWARD_LEVEL = 42; private static final int DROP_CHANCE = 68; - public Q00139_ShadowFoxPart1() - { + public Q00139_ShadowFoxPart1() { super(139, Q00139_ShadowFoxPart1.class.getSimpleName(), "Shadow Fox - 1"); addStartNpc(MIA); addTalkId(MIA); @@ -60,20 +57,16 @@ public class Q00139_ShadowFoxPart1 extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "30896-02.htm": - if (player.getLevel() < MIN_LEVEL) - { + if (player.getLevel() < MIN_LEVEL) { htmltext = "30896-03.htm"; } break; @@ -88,8 +81,7 @@ public class Q00139_ShadowFoxPart1 extends Quest st.unset("talk"); break; case "30896-17.html": - if (getRandom(20) < 3) - { + if (getRandom(20) < 3) { st.takeItems(FRAGMENT, 10); st.takeItems(CHEST, 1); return "30896-16.html"; @@ -100,8 +92,7 @@ public class Q00139_ShadowFoxPart1 extends Quest break; case "30896-19.html": st.giveAdena(14050, true); - if (player.getLevel() <= MAX_REWARD_LEVEL) - { + if (player.getLevel() <= MAX_REWARD_LEVEL) { st.addExpAndSp(30000, 2000); } st.exitQuest(false, true); @@ -122,16 +113,13 @@ public class Q00139_ShadowFoxPart1 extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance member = getRandomPartyMember(player, 2); - if (member == null) - { + if (member == null) { return super.onKill(npc, player, isSummon); } final QuestState st = getQuestState(member, false); - if (!st.isSet("talk") && (getRandom(100) < DROP_CHANCE)) - { + if (!st.isSet("talk") && (getRandom(100) < DROP_CHANCE)) { int itemId = (getRandom(11) == 0) ? CHEST : FRAGMENT; st.giveItems(itemId, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); @@ -140,18 +128,15 @@ public class Q00139_ShadowFoxPart1 extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.hasQuestCompleted(Q00138_TempleChampionPart2.class.getSimpleName())) ? "30896-01.htm" : "30896-00.html"; break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = (st.isSet("talk")) ? "30896-11.html" : "30896-05.html"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00140_ShadowFoxPart2/Q00140_ShadowFoxPart2.java b/src/main/java/com/l2jserver/datapack/quests/Q00140_ShadowFoxPart2/Q00140_ShadowFoxPart2.java index 0ebd7260ed..e77e4a859a 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00140_ShadowFoxPart2/Q00140_ShadowFoxPart2.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00140_ShadowFoxPart2/Q00140_ShadowFoxPart2.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.model.quest.State; * Shadow Fox - 2 (140) * @author Nono */ -public class Q00140_ShadowFoxPart2 extends Quest -{ +public class Q00140_ShadowFoxPart2 extends Quest { // NPCs private static final int KLUCK = 30895; private static final int XENOVIA = 30912; @@ -44,8 +43,7 @@ public class Q00140_ShadowFoxPart2 extends Quest private static final int CRYPTOGRAM_OF_THE_GODDESS_SWORD = 10349; // Monsters private static final Map<Integer, Integer> MOBS = new HashMap<>(); - static - { + static { MOBS.put(20789, 45); // Crokian MOBS.put(20790, 58); // Dailaon MOBS.put(20791, 100);// Crokian Warrior @@ -58,8 +56,7 @@ public class Q00140_ShadowFoxPart2 extends Quest private static final int CRYSTAL_COUNT = 5; private static final int OXYDE_COUNT = 2; - public Q00140_ShadowFoxPart2() - { + public Q00140_ShadowFoxPart2() { super(140, Q00140_ShadowFoxPart2.class.getSimpleName(), "Shadow Fox - 2"); addStartNpc(KLUCK); addTalkId(KLUCK, XENOVIA); @@ -68,17 +65,14 @@ public class Q00140_ShadowFoxPart2 extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "30895-05.html": case "30895-06.html": case "30912-03.html": @@ -101,10 +95,8 @@ public class Q00140_ShadowFoxPart2 extends Quest st.setCond(3, true); break; case "30912-14.html": - if (getRandom(10) < CHANCE) - { - if (st.getQuestItemsCount(DARK_OXYDE) < OXYDE_COUNT) - { + if (getRandom(10) < CHANCE) { + if (st.getQuestItemsCount(DARK_OXYDE) < OXYDE_COUNT) { st.giveItems(DARK_OXYDE, 1); st.takeItems(DARK_CRYSTAL, 5); return "30912-12.html"; @@ -119,8 +111,7 @@ public class Q00140_ShadowFoxPart2 extends Quest break; case "30895-11.html": st.giveAdena(18775, true); - if (player.getLevel() <= MAX_REWARD_LEVEL) - { + if (player.getLevel() <= MAX_REWARD_LEVEL) { st.addExpAndSp(30000, 2000); } st.exitQuest(false, true); @@ -133,16 +124,13 @@ public class Q00140_ShadowFoxPart2 extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance member = getRandomPartyMember(player, 3); - if (member == null) - { + if (member == null) { return super.onKill(npc, player, isSummon); } final QuestState st = getQuestState(member, false); - if (getRandom(100) < MOBS.get(npc.getId())) - { + if (getRandom(100) < MOBS.get(npc.getId())) { st.giveItems(DARK_CRYSTAL, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -150,21 +138,17 @@ public class Q00140_ShadowFoxPart2 extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case KLUCK: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? (player.hasQuestCompleted(Q00139_ShadowFoxPart1.class.getSimpleName())) ? "30895-01.htm" : "30895-00.htm" : "30895-02.htm"; break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "30895-04.html"; break; @@ -173,12 +157,9 @@ public class Q00140_ShadowFoxPart2 extends Quest htmltext = "30895-08.html"; break; case 4: - if (st.isSet("talk")) - { + if (st.isSet("talk")) { htmltext = "30895-10.html"; - } - else - { + } else { st.takeItems(CRYPTOGRAM_OF_THE_GODDESS_SWORD, -1); st.set("talk", "1"); htmltext = "30895-09.html"; @@ -193,10 +174,8 @@ public class Q00140_ShadowFoxPart2 extends Quest break; case XENOVIA: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: htmltext = "30912-01.html"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00141_ShadowFoxPart3/Q00141_ShadowFoxPart3.java b/src/main/java/com/l2jserver/datapack/quests/Q00141_ShadowFoxPart3/Q00141_ShadowFoxPart3.java index 1c51faca23..b7b85d5665 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00141_ShadowFoxPart3/Q00141_ShadowFoxPart3.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00141_ShadowFoxPart3/Q00141_ShadowFoxPart3.java @@ -35,14 +35,12 @@ import com.l2jserver.gameserver.model.quest.State; * Shadow Fox - 3 (141) * @author Nono */ -public class Q00141_ShadowFoxPart3 extends Quest -{ +public class Q00141_ShadowFoxPart3 extends Quest { // NPCs private static final int NATOOLS = 30894; // Monsters private static final Map<Integer, Integer> MOBS = new HashMap<>(); - static - { + static { MOBS.put(20135, 53); // Alligator MOBS.put(20791, 100); // Crokian Warrior MOBS.put(20792, 92); // Farhite @@ -54,8 +52,7 @@ public class Q00141_ShadowFoxPart3 extends Quest private static final int MAX_REWARD_LEVEL = 42; private static final int REPORT_COUNT = 30; - public Q00141_ShadowFoxPart3() - { + public Q00141_ShadowFoxPart3() { super(141, Q00141_ShadowFoxPart3.class.getSimpleName(), "Shadow Fox - 3"); addStartNpc(NATOOLS); addTalkId(NATOOLS); @@ -64,17 +61,14 @@ public class Q00141_ShadowFoxPart3 extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "30894-05.html": case "30894-10.html": case "30894-11.html": @@ -101,15 +95,13 @@ public class Q00141_ShadowFoxPart3 extends Quest break; case "30894-21.html": st.giveAdena(88888, true); - if (player.getLevel() <= MAX_REWARD_LEVEL) - { + if (player.getLevel() <= MAX_REWARD_LEVEL) { st.addExpAndSp(278005, 17058); } st.exitQuest(false, true); final Quest q = QuestManager.getInstance().getQuest(Q00998_FallenAngelSelect.class.getSimpleName()); - if (q != null) - { + if (q != null) { q.newQuestState(player).setState(State.STARTED); } break; @@ -121,23 +113,17 @@ public class Q00141_ShadowFoxPart3 extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance member = getRandomPartyMember(player, 2); - if (member == null) - { + if (member == null) { return super.onKill(npc, player, isSummon); } final QuestState st = getQuestState(member, false); - if ((getRandom(100) < MOBS.get(npc.getId()))) - { + if ((getRandom(100) < MOBS.get(npc.getId()))) { st.giveItems(PREDECESSORS_REPORT, 1); - if (st.getQuestItemsCount(PREDECESSORS_REPORT) >= REPORT_COUNT) - { + if (st.getQuestItemsCount(PREDECESSORS_REPORT) >= REPORT_COUNT) { st.setCond(3, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -145,18 +131,15 @@ public class Q00141_ShadowFoxPart3 extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? (player.hasQuestCompleted(Q00140_ShadowFoxPart2.class.getSimpleName())) ? "30894-01.htm" : "30894-00.html" : "30894-02.htm"; break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "30894-04.html"; break; @@ -164,16 +147,11 @@ public class Q00141_ShadowFoxPart3 extends Quest htmltext = "30894-07.html"; break; case 3: - if (st.getInt("talk") == 1) - { + if (st.getInt("talk") == 1) { htmltext = "30894-09.html"; - } - else if (st.getInt("talk") == 2) - { + } else if (st.getInt("talk") == 2) { htmltext = "30894-16.html"; - } - else - { + } else { htmltext = "30894-08.html"; st.takeItems(PREDECESSORS_REPORT, -1); st.set("talk", "1"); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00142_FallenAngelRequestOfDawn/Q00142_FallenAngelRequestOfDawn.java b/src/main/java/com/l2jserver/datapack/quests/Q00142_FallenAngelRequestOfDawn/Q00142_FallenAngelRequestOfDawn.java index e54d637a4d..b062d2aa4d 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00142_FallenAngelRequestOfDawn/Q00142_FallenAngelRequestOfDawn.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00142_FallenAngelRequestOfDawn/Q00142_FallenAngelRequestOfDawn.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.model.quest.State; * Fallen Angel - Request of Dawn (142) * @author Nono */ -public class Q00142_FallenAngelRequestOfDawn extends Quest -{ +public class Q00142_FallenAngelRequestOfDawn extends Quest { // NPCs private static final int RAYMOND = 30289; private static final int CASIAN = 30612; @@ -43,8 +42,7 @@ public class Q00142_FallenAngelRequestOfDawn extends Quest private static final int FALLEN_ANGEL = 27338; private static final Map<Integer, Integer> MOBS = new HashMap<>(); - static - { + static { MOBS.put(20079, 338); // Ant MOBS.put(20080, 363); // Ant Captain MOBS.put(20081, 611); // Ant Overseer @@ -66,8 +64,7 @@ public class Q00142_FallenAngelRequestOfDawn extends Quest private static final int FRAGMENT_COUNT = 30; private boolean isAngelSpawned = false; - public Q00142_FallenAngelRequestOfDawn() - { + public Q00142_FallenAngelRequestOfDawn() { super(142, Q00142_FallenAngelRequestOfDawn.class.getSimpleName(), "Fallen Angel - Request of Dawn"); addTalkId(NATOOLS, RAYMOND, CASIAN, ROCK); addKillId(MOBS.keySet()); @@ -76,17 +73,14 @@ public class Q00142_FallenAngelRequestOfDawn extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "30894-02.html": case "30289-03.html": case "30289-04.html": @@ -114,8 +108,7 @@ public class Q00142_FallenAngelRequestOfDawn extends Quest st.setCond(4, true); break; case "32368-04.html": - if (isAngelSpawned) - { + if (isAngelSpawned) { return "32368-03.html"; } addSpawn(FALLEN_ANGEL, npc.getX() + 100, npc.getY() + 100, npc.getZ(), 0, false, 120000); @@ -123,8 +116,7 @@ public class Q00142_FallenAngelRequestOfDawn extends Quest startQuestTimer("despawn", 120000, null, player); break; case "despawn": - if (isAngelSpawned) - { + if (isAngelSpawned) { isAngelSpawned = false; } default: @@ -135,35 +127,25 @@ public class Q00142_FallenAngelRequestOfDawn extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st; - if ((npc.getId() == FALLEN_ANGEL)) - { + if ((npc.getId() == FALLEN_ANGEL)) { st = getQuestState(player, false); - if (st.isCond(5)) - { + if (st.isCond(5)) { st.giveItems(FALLEN_ANGEL_BLOOD, 1); st.setCond(6, true); isAngelSpawned = false; } - } - else - { + } else { final L2PcInstance member = getRandomPartyMember(player, 4); - if (member != null) - { + if (member != null) { st = getQuestState(member, false); - if (getRandom(1000) < MOBS.get(npc.getId())) - { + if (getRandom(1000) < MOBS.get(npc.getId())) { st.giveItems(PROPHECY_FRAGMENT, 1); - if (st.getQuestItemsCount(PROPHECY_FRAGMENT) >= FRAGMENT_COUNT) - { + if (st.getQuestItemsCount(PROPHECY_FRAGMENT) >= FRAGMENT_COUNT) { st.takeItems(PROPHECY_FRAGMENT, -1); st.setCond(5, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -173,18 +155,14 @@ public class Q00142_FallenAngelRequestOfDawn extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case NATOOLS: - switch (st.getState()) - { + switch (st.getState()) { case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "30894-01.html"; break; @@ -199,20 +177,15 @@ public class Q00142_FallenAngelRequestOfDawn extends Quest } break; case RAYMOND: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: htmltext = "30289-01.html"; break; case 2: - if (st.isSet("talk")) - { + if (st.isSet("talk")) { htmltext = "30289-03.html"; - } - else - { + } else { st.takeItems(CRYPTOGRAM_OF_THE_ANGEL_SEARCH, -1); st.set("talk", "1"); htmltext = "30289-02.html"; @@ -225,8 +198,7 @@ public class Q00142_FallenAngelRequestOfDawn extends Quest break; case 6: st.giveAdena(92676, true); - if (player.getLevel() <= MAX_REWARD_LEVEL) - { + if (player.getLevel() <= MAX_REWARD_LEVEL) { st.addExpAndSp(223036, 13091); } st.exitQuest(false, true); @@ -236,25 +208,18 @@ public class Q00142_FallenAngelRequestOfDawn extends Quest } break; case CASIAN: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: case 2: htmltext = "30612-01.html"; break; case 3: - if (st.getInt("talk") == 1) - { + if (st.getInt("talk") == 1) { htmltext = "30612-03.html"; - } - else if (st.getInt("talk") == 2) - { + } else if (st.getInt("talk") == 2) { htmltext = "30612-06.html"; - } - else - { + } else { htmltext = "30612-02.html"; st.set("talk", "1"); } @@ -268,10 +233,8 @@ public class Q00142_FallenAngelRequestOfDawn extends Quest } break; case ROCK: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 5: htmltext = "32368-02.html"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00143_FallenAngelRequestOfDusk/Q00143_FallenAngelRequestOfDusk.java b/src/main/java/com/l2jserver/datapack/quests/Q00143_FallenAngelRequestOfDusk/Q00143_FallenAngelRequestOfDusk.java index dd1861aa32..141b92b246 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00143_FallenAngelRequestOfDusk/Q00143_FallenAngelRequestOfDusk.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00143_FallenAngelRequestOfDusk/Q00143_FallenAngelRequestOfDusk.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.State; * Fallen Angel - Request of Dusk (143) * @author Nono */ -public class Q00143_FallenAngelRequestOfDusk extends Quest -{ +public class Q00143_FallenAngelRequestOfDusk extends Quest { // NPCs private static final int TOBIAS = 30297; private static final int CASIAN = 30612; @@ -46,25 +45,21 @@ public class Q00143_FallenAngelRequestOfDusk extends Quest private static final int MAX_REWARD_LEVEL = 43; private boolean isAngelSpawned = false; - public Q00143_FallenAngelRequestOfDusk() - { + public Q00143_FallenAngelRequestOfDusk() { super(143, Q00143_FallenAngelRequestOfDusk.class.getSimpleName(), "Fallen Angel - Request of Dusk"); addTalkId(NATOOLS, TOBIAS, CASIAN, ROCK, ANGEL); registerQuestItems(SEALED_PROPHECY_PATH_OF_THE_GOD, PROPHECY_PATH_OF_THE_GOD, EMPTY_SOUND_CRYSTAL, ANGEL_MEDICINE, ANGELS_MESSAGE); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "30894-02.html": case "30297-04.html": case "30612-05.html": @@ -105,8 +100,7 @@ public class Q00143_FallenAngelRequestOfDusk extends Quest st.giveItems(ANGEL_MEDICINE, 1); break; case "32368-04.html": - if (isAngelSpawned) - { + if (isAngelSpawned) { return "32368-03.html"; } addSpawn(ANGEL, npc.getX() + 100, npc.getY() + 100, npc.getZ(), 0, false, 120000); @@ -129,8 +123,7 @@ public class Q00143_FallenAngelRequestOfDusk extends Quest isAngelSpawned = false; break; case "despawn": - if (isAngelSpawned) - { + if (isAngelSpawned) { isAngelSpawned = false; } default: @@ -141,18 +134,14 @@ public class Q00143_FallenAngelRequestOfDusk extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case NATOOLS: - switch (st.getState()) - { + switch (st.getState()) { case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "30894-01.html"; break; @@ -167,10 +156,8 @@ public class Q00143_FallenAngelRequestOfDusk extends Quest } break; case TOBIAS: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: htmltext = "30297-01.html"; break; @@ -183,8 +170,7 @@ public class Q00143_FallenAngelRequestOfDusk extends Quest break; case 5: st.giveAdena(89046, true); - if (player.getLevel() <= MAX_REWARD_LEVEL) - { + if (player.getLevel() <= MAX_REWARD_LEVEL) { st.addExpAndSp(223036, 13901); } st.exitQuest(false, true); @@ -194,10 +180,8 @@ public class Q00143_FallenAngelRequestOfDusk extends Quest } break; case CASIAN: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: case 2: htmltext = "30612-01.html"; @@ -212,10 +196,8 @@ public class Q00143_FallenAngelRequestOfDusk extends Quest } break; case ROCK: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: case 2: case 3: @@ -231,26 +213,19 @@ public class Q00143_FallenAngelRequestOfDusk extends Quest } break; case ANGEL: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: case 2: case 3: htmltext = "32369-01.html"; break; case 4: - if (st.getInt("talk") == 1) - { + if (st.getInt("talk") == 1) { htmltext = "32369-04.html"; - } - else if (st.getInt("talk") == 2) - { + } else if (st.getInt("talk") == 2) { htmltext = "32369-07.html"; - } - else - { + } else { htmltext = "32369-02.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00146_TheZeroHour/Q00146_TheZeroHour.java b/src/main/java/com/l2jserver/datapack/quests/Q00146_TheZeroHour/Q00146_TheZeroHour.java index 38a3e82291..88970d6158 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00146_TheZeroHour/Q00146_TheZeroHour.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00146_TheZeroHour/Q00146_TheZeroHour.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * The Zero Hour (146) * @author Gnacik, malyelfik */ -public class Q00146_TheZeroHour extends Quest -{ +public class Q00146_TheZeroHour extends Quest { // NPCs private static final int KAHMAN = 31554; private static final int QUEEN_SHYEED = 25671; @@ -38,8 +37,7 @@ public class Q00146_TheZeroHour extends Quest private static final int KAHMANS_SUPPLY_BOX = 14849; private static final int FANG = 14859; - public Q00146_TheZeroHour() - { + public Q00146_TheZeroHour() { super(146, Q00146_TheZeroHour.class.getSimpleName(), "The Zero Hour"); addStartNpc(KAHMAN); addTalkId(KAHMAN); @@ -48,30 +46,24 @@ public class Q00146_TheZeroHour extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - if (event.equalsIgnoreCase("31554-03.htm")) - { + if (event.equalsIgnoreCase("31554-03.htm")) { st.startQuest(); } return event; } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(killer, 1); - if (partyMember != null) - { + if (partyMember != null) { final QuestState st = getQuestState(partyMember, false); - if (!st.hasQuestItems(FANG)) - { + if (!st.hasQuestItems(FANG)) { st.giveItems(FANG, 1); st.setCond(2, true); } @@ -80,29 +72,21 @@ public class Q00146_TheZeroHour extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: - if (player.getLevel() < 81) - { + if (player.getLevel() < 81) { htmltext = "31554-02.htm"; - } - else - { + } else { htmltext = (player.hasQuestCompleted(Q00109_InSearchOfTheNest.class.getSimpleName())) ? "31554-01a.htm" : "31554-04.html"; } break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "31554-06.html"; - } - else - { + } else { st.giveItems(KAHMANS_SUPPLY_BOX, 1); st.addExpAndSp(154616, 12500); st.exitQuest(false, true); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00147_PathtoBecominganEliteMercenary/Q00147_PathtoBecominganEliteMercenary.java b/src/main/java/com/l2jserver/datapack/quests/Q00147_PathtoBecominganEliteMercenary/Q00147_PathtoBecominganEliteMercenary.java index 7daf3cdff9..8e33c5577f 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00147_PathtoBecominganEliteMercenary/Q00147_PathtoBecominganEliteMercenary.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00147_PathtoBecominganEliteMercenary/Q00147_PathtoBecominganEliteMercenary.java @@ -29,11 +29,9 @@ import com.l2jserver.gameserver.model.quest.State; * @author Gnacik * @version 2010-09-30 Based on official server Franz */ -public class Q00147_PathtoBecominganEliteMercenary extends Quest -{ +public class Q00147_PathtoBecominganEliteMercenary extends Quest { // NPCs - private static final int[] MERC = - { + private static final int[] MERC = { 36481, 36482, 36483, @@ -48,63 +46,48 @@ public class Q00147_PathtoBecominganEliteMercenary extends Quest private static final int ORDINARY_CERTIFICATE = 13766; private static final int ELITE_CERTIFICATE = 13767; - public Q00147_PathtoBecominganEliteMercenary() - { + public Q00147_PathtoBecominganEliteMercenary() { super(147, Q00147_PathtoBecominganEliteMercenary.class.getSimpleName(), "Path to Becoming an Elite Mercenary"); addStartNpc(MERC); addTalkId(MERC); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return htmltext; } - if (event.equalsIgnoreCase("elite-02.htm")) - { - if (st.hasQuestItems(ORDINARY_CERTIFICATE)) - { + if (event.equalsIgnoreCase("elite-02.htm")) { + if (st.hasQuestItems(ORDINARY_CERTIFICATE)) { return "elite-02a.htm"; } st.giveItems(ORDINARY_CERTIFICATE, 1); - } - else if (event.equalsIgnoreCase("elite-04.htm")) - { + } else if (event.equalsIgnoreCase("elite-04.htm")) { st.startQuest(); } return htmltext; } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: - if ((player.getClan() != null) && (player.getClan().getCastleId() > 0)) - { + if ((player.getClan() != null) && (player.getClan().getCastleId() > 0)) { htmltext = "castle.htm"; - } - else - { + } else { htmltext = "elite-01.htm"; } break; case State.STARTED: - if (st.getCond() < 4) - { + if (st.getCond() < 4) { htmltext = "elite-05.htm"; - } - else if (st.isCond(4)) - { + } else if (st.isCond(4)) { st.takeItems(ORDINARY_CERTIFICATE, -1); st.giveItems(ELITE_CERTIFICATE, 1); st.exitQuest(false); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00148_PathtoBecominganExaltedMercenary/Q00148_PathtoBecominganExaltedMercenary.java b/src/main/java/com/l2jserver/datapack/quests/Q00148_PathtoBecominganExaltedMercenary/Q00148_PathtoBecominganExaltedMercenary.java index 3f0d7c4372..02db53e3f5 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00148_PathtoBecominganExaltedMercenary/Q00148_PathtoBecominganExaltedMercenary.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00148_PathtoBecominganExaltedMercenary/Q00148_PathtoBecominganExaltedMercenary.java @@ -30,11 +30,9 @@ import com.l2jserver.gameserver.model.quest.State; * @author Gnacik * @version 2010-09-30 Based on official server Franz */ -public class Q00148_PathtoBecominganExaltedMercenary extends Quest -{ +public class Q00148_PathtoBecominganExaltedMercenary extends Quest { // NPCs - private static final int[] MERC = - { + private static final int[] MERC = { 36481, 36482, 36483, @@ -49,62 +47,46 @@ public class Q00148_PathtoBecominganExaltedMercenary extends Quest private static final int ELITE_CERTIFICATE = 13767; private static final int TOP_ELITE_CERTIFICATE = 13768; - public Q00148_PathtoBecominganExaltedMercenary() - { + public Q00148_PathtoBecominganExaltedMercenary() { super(148, Q00148_PathtoBecominganExaltedMercenary.class.getSimpleName(), "Path to Becoming an Exalted Mercenary"); addStartNpc(MERC); addTalkId(MERC); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return htmltext; } - if (event.equalsIgnoreCase("exalted-00b.htm")) - { + if (event.equalsIgnoreCase("exalted-00b.htm")) { st.giveItems(ELITE_CERTIFICATE, 1); - } - else if (event.equalsIgnoreCase("exalted-03.htm")) - { + } else if (event.equalsIgnoreCase("exalted-03.htm")) { st.startQuest(); } return htmltext; } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: - if ((player.getClan() != null) && (player.getClan().getCastleId() > 0)) - { + if ((player.getClan() != null) && (player.getClan().getCastleId() > 0)) { htmltext = "castle.htm"; - } - else if (st.hasQuestItems(ELITE_CERTIFICATE)) - { + } else if (st.hasQuestItems(ELITE_CERTIFICATE)) { htmltext = "exalted-01.htm"; - } - else - { + } else { htmltext = (player.hasQuestCompleted(Q00147_PathtoBecominganEliteMercenary.class.getSimpleName())) ? "exalted-00a.htm" : "exalted-00.htm"; } break; case State.STARTED: - if (st.getCond() < 4) - { + if (st.getCond() < 4) { htmltext = "exalted-04.htm"; - } - else if (st.isCond(4)) - { + } else if (st.isCond(4)) { st.takeItems(ELITE_CERTIFICATE, -1); st.giveItems(TOP_ELITE_CERTIFICATE, 1); st.exitQuest(false); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00151_CureForFever/Q00151_CureForFever.java b/src/main/java/com/l2jserver/datapack/quests/Q00151_CureForFever/Q00151_CureForFever.java index a84764f113..877ebe6efc 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00151_CureForFever/Q00151_CureForFever.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00151_CureForFever/Q00151_CureForFever.java @@ -29,14 +29,12 @@ import com.l2jserver.gameserver.network.NpcStringId; * Cure for Fever (151) * @author malyelfik */ -public class Q00151_CureForFever extends Quest -{ +public class Q00151_CureForFever extends Quest { // NPCs private static final int ELLIAS = 30050; private static final int YOHANES = 30032; // Monsters - private static final int[] MOBS = - { + private static final int[] MOBS = { 20103, // Giant Spider 20106, // Talon Spider 20108, // Blade Spider @@ -49,8 +47,7 @@ public class Q00151_CureForFever extends Quest private static final int MIN_LEVEL = 15; private static final int CHANCE = 0; - public Q00151_CureForFever() - { + public Q00151_CureForFever() { super(151, Q00151_CureForFever.class.getSimpleName(), "Cure for Fever"); addStartNpc(ELLIAS); addTalkId(ELLIAS, YOHANES); @@ -59,11 +56,9 @@ public class Q00151_CureForFever extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && event.equalsIgnoreCase("30050-03.htm")) - { + if ((st != null) && event.equalsIgnoreCase("30050-03.htm")) { st.startQuest(); return event; } @@ -71,11 +66,9 @@ public class Q00151_CureForFever extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isCond(1) && (getRandom(5) == CHANCE)) - { + if ((st != null) && st.isCond(1) && (getRandom(5) == CHANCE)) { st.giveItems(POISON_SAC, 1); st.setCond(2, true); } @@ -83,33 +76,25 @@ public class Q00151_CureForFever extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case ELLIAS: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? "30050-02.htm" : "30050-01.htm"; break; case State.STARTED: - if (st.isCond(3) && st.hasQuestItems(FEVER_MEDICINE)) - { + if (st.isCond(3) && st.hasQuestItems(FEVER_MEDICINE)) { st.giveItems(ROUND_SHIELD, 1); st.addExpAndSp(13106, 613); st.exitQuest(false, true); showOnScreenMsg(player, NpcStringId.LAST_DUTY_COMPLETE_N_GO_FIND_THE_NEWBIE_GUIDE, 2, 5000); // TODO: Newbie Guide htmltext = "30050-06.html"; - } - else if (st.isCond(2) && st.hasQuestItems(POISON_SAC)) - { + } else if (st.isCond(2) && st.hasQuestItems(POISON_SAC)) { htmltext = "30050-05.html"; - } - else - { + } else { htmltext = "30050-04.html"; } break; @@ -119,17 +104,13 @@ public class Q00151_CureForFever extends Quest } break; case YOHANES: - if (st.isStarted()) - { - if (st.isCond(2) && st.hasQuestItems(POISON_SAC)) - { + if (st.isStarted()) { + if (st.isCond(2) && st.hasQuestItems(POISON_SAC)) { st.setCond(3, true); st.takeItems(POISON_SAC, -1); st.giveItems(FEVER_MEDICINE, 1); htmltext = "30032-01.html"; - } - else if (st.isCond(3) && st.hasQuestItems(FEVER_MEDICINE)) - { + } else if (st.isCond(3) && st.hasQuestItems(FEVER_MEDICINE)) { htmltext = "30032-02.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00152_ShardsOfGolem/Q00152_ShardsOfGolem.java b/src/main/java/com/l2jserver/datapack/quests/Q00152_ShardsOfGolem/Q00152_ShardsOfGolem.java index e5422f9713..3b2801ad2d 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00152_ShardsOfGolem/Q00152_ShardsOfGolem.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00152_ShardsOfGolem/Q00152_ShardsOfGolem.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * Shards of Golem (152) * @author xban1x */ -public class Q00152_ShardsOfGolem extends Quest -{ +public class Q00152_ShardsOfGolem extends Quest { // NPCs private static final int HARRYS = 30035; private static final int ALTRAN = 30283; @@ -45,8 +44,7 @@ public class Q00152_ShardsOfGolem extends Quest // Misc private static final int MIN_LVL = 10; - public Q00152_ShardsOfGolem() - { + public Q00152_ShardsOfGolem() { super(152, Q00152_ShardsOfGolem.class.getSimpleName(), "Shards of Golem"); addStartNpc(HARRYS); addTalkId(HARRYS, ALTRAN); @@ -55,25 +53,19 @@ public class Q00152_ShardsOfGolem extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st != null) - { - switch (event) - { - case "30035-03.htm": - { + if (st != null) { + switch (event) { + case "30035-03.htm": { st.startQuest(); st.giveItems(HARRYS_1ST_RECIEPT, 1); htmltext = event; break; } - case "30283-02.html": - { - if (st.isCond(1) && st.hasQuestItems(HARRYS_1ST_RECIEPT)) - { + case "30283-02.html": { + if (st.isCond(1) && st.hasQuestItems(HARRYS_1ST_RECIEPT)) { st.takeItems(HARRYS_1ST_RECIEPT, -1); st.giveItems(HARRYS_2ND_RECIEPT, 1); st.setCond(2, true); @@ -87,18 +79,13 @@ public class Q00152_ShardsOfGolem extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isCond(2) && (getRandom(100) < 30) && (st.getQuestItemsCount(GOLEM_SHARD) < 5)) - { + if ((st != null) && st.isCond(2) && (getRandom(100) < 30) && (st.getQuestItemsCount(GOLEM_SHARD) < 5)) { st.giveItems(GOLEM_SHARD, 1); - if (st.getQuestItemsCount(GOLEM_SHARD) >= 5) - { + if (st.getQuestItemsCount(GOLEM_SHARD) >= 5) { st.setCond(3, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -106,46 +93,33 @@ public class Q00152_ShardsOfGolem extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (npc.getId()) - { - case HARRYS: - { - switch (st.getState()) - { - case State.CREATED: - { + switch (npc.getId()) { + case HARRYS: { + switch (st.getState()) { + case State.CREATED: { htmltext = player.getLevel() >= MIN_LVL ? "30035-02.htm" : "30035-01.htm"; break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { - if (st.hasQuestItems(HARRYS_1ST_RECIEPT)) - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { + if (st.hasQuestItems(HARRYS_1ST_RECIEPT)) { htmltext = "30035-04a.html"; } break; } case 2: - case 3: - { - if (st.hasQuestItems(HARRYS_2ND_RECIEPT)) - { + case 3: { + if (st.hasQuestItems(HARRYS_2ND_RECIEPT)) { htmltext = "30035-04.html"; } break; } - case 4: - { - if (st.hasQuestItems(HARRYS_2ND_RECIEPT, TOOL_BOX)) - { + case 4: { + if (st.hasQuestItems(HARRYS_2ND_RECIEPT, TOOL_BOX)) { st.giveItems(WOODEN_BREASTPLATE, 1); st.addExpAndSp(5000, 0); st.exitQuest(false, true); @@ -156,38 +130,29 @@ public class Q00152_ShardsOfGolem extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } } break; } - case ALTRAN: - { - switch (st.getCond()) - { - case 1: - { - if (st.hasQuestItems(HARRYS_1ST_RECIEPT)) - { + case ALTRAN: { + switch (st.getCond()) { + case 1: { + if (st.hasQuestItems(HARRYS_1ST_RECIEPT)) { htmltext = "30283-01.html"; } break; } - case 2: - { - if (st.hasQuestItems(HARRYS_2ND_RECIEPT) && (st.getQuestItemsCount(GOLEM_SHARD) < 5)) - { + case 2: { + if (st.hasQuestItems(HARRYS_2ND_RECIEPT) && (st.getQuestItemsCount(GOLEM_SHARD) < 5)) { htmltext = "30283-03.html"; } break; } - case 3: - { - if (st.hasQuestItems(HARRYS_2ND_RECIEPT) && (st.getQuestItemsCount(GOLEM_SHARD) >= 5)) - { + case 3: { + if (st.hasQuestItems(HARRYS_2ND_RECIEPT) && (st.getQuestItemsCount(GOLEM_SHARD) >= 5)) { st.takeItems(GOLEM_SHARD, -1); st.giveItems(TOOL_BOX, 1); st.setCond(4, true); @@ -195,10 +160,8 @@ public class Q00152_ShardsOfGolem extends Quest } break; } - case 4: - { - if (st.hasQuestItems(HARRYS_2ND_RECIEPT, TOOL_BOX)) - { + case 4: { + if (st.hasQuestItems(HARRYS_2ND_RECIEPT, TOOL_BOX)) { htmltext = "30283-05.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00153_DeliverGoods/Q00153_DeliverGoods.java b/src/main/java/com/l2jserver/datapack/quests/Q00153_DeliverGoods/Q00153_DeliverGoods.java index 334d1b3612..2926fabb3b 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00153_DeliverGoods/Q00153_DeliverGoods.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00153_DeliverGoods/Q00153_DeliverGoods.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * @author Zoey76 * @version 1.0 Freya (11/16/2010), Based on Naia (EURO) */ -public class Q00153_DeliverGoods extends Quest -{ +public class Q00153_DeliverGoods extends Quest { // NPCs private static final int JACKSON_ID = 30002; private static final int SILVIA_ID = 30003; @@ -49,8 +48,7 @@ public class Q00153_DeliverGoods extends Quest private static final int RING_OF_KNOWLEDGE_ID = 875; private static final int XP_REWARD_AMOUNT = 600; - public Q00153_DeliverGoods() - { + public Q00153_DeliverGoods() { super(153, Q00153_DeliverGoods.class.getSimpleName(), "Deliver Goods"); addStartNpc(ARNOLD_ID); addTalkId(JACKSON_ID, SILVIA_ID, ARNOLD_ID, RANT_ID); @@ -58,13 +56,10 @@ public class Q00153_DeliverGoods extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && (npc.getId() == ARNOLD_ID)) - { - if (event.equalsIgnoreCase("30041-02.html")) - { + if ((st != null) && (npc.getId() == ARNOLD_ID)) { + if (event.equalsIgnoreCase("30041-02.html")) { st.startQuest(); st.giveItems(DELIVERY_LIST_ID, 1); st.giveItems(HEAVY_WOOD_BOX_ID, 1); @@ -76,24 +71,18 @@ public class Q00153_DeliverGoods extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - if (npc.getId() == ARNOLD_ID) - { - switch (st.getState()) - { + if (npc.getId() == ARNOLD_ID) { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= 2) ? "30041-01.htm" : "30041-00.htm"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "30041-03.html"; - } - else if (st.isCond(2)) - { + } else if (st.isCond(2)) { st.takeItems(DELIVERY_LIST_ID, -1); st.takeItems(JACKSONS_RECEIPT_ID, -1); st.takeItems(SILVIAS_RECEIPT_ID, -1); @@ -110,52 +99,35 @@ public class Q00153_DeliverGoods extends Quest htmltext = getAlreadyCompletedMsg(player); break; } - } - else - { - if (npc.getId() == JACKSON_ID) - { - if (st.hasQuestItems(HEAVY_WOOD_BOX_ID)) - { + } else { + if (npc.getId() == JACKSON_ID) { + if (st.hasQuestItems(HEAVY_WOOD_BOX_ID)) { st.takeItems(HEAVY_WOOD_BOX_ID, -1); st.giveItems(JACKSONS_RECEIPT_ID, 1); htmltext = "30002-01.html"; - } - else - { + } else { htmltext = "30002-02.html"; } - } - else if (npc.getId() == SILVIA_ID) - { - if (st.hasQuestItems(CLOTH_BUNDLE_ID)) - { + } else if (npc.getId() == SILVIA_ID) { + if (st.hasQuestItems(CLOTH_BUNDLE_ID)) { st.takeItems(CLOTH_BUNDLE_ID, -1); st.giveItems(SILVIAS_RECEIPT_ID, 1); st.giveItems(SOULSHOT_NO_GRADE_ID, 3); htmltext = "30003-01.html"; - } - else - { + } else { htmltext = "30003-02.html"; } - } - else if (npc.getId() == RANT_ID) - { - if (st.hasQuestItems(CLAY_POT_ID)) - { + } else if (npc.getId() == RANT_ID) { + if (st.hasQuestItems(CLAY_POT_ID)) { st.takeItems(CLAY_POT_ID, -1); st.giveItems(RANTS_RECEIPT_ID, 1); htmltext = "30054-01.html"; - } - else - { + } else { htmltext = "30054-02.html"; } } - if (st.isCond(1) && st.hasQuestItems(JACKSONS_RECEIPT_ID) && st.hasQuestItems(SILVIAS_RECEIPT_ID) && st.hasQuestItems(RANTS_RECEIPT_ID)) - { + if (st.isCond(1) && st.hasQuestItems(JACKSONS_RECEIPT_ID) && st.hasQuestItems(SILVIAS_RECEIPT_ID) && st.hasQuestItems(RANTS_RECEIPT_ID)) { st.setCond(2, true); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00154_SacrificeToTheSea/Q00154_SacrificeToTheSea.java b/src/main/java/com/l2jserver/datapack/quests/Q00154_SacrificeToTheSea/Q00154_SacrificeToTheSea.java index 55031118c6..d7f827f1ec 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00154_SacrificeToTheSea/Q00154_SacrificeToTheSea.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00154_SacrificeToTheSea/Q00154_SacrificeToTheSea.java @@ -27,8 +27,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Sacrifice to the Sea (154) * @author Pandragon */ -public final class Q00154_SacrificeToTheSea extends Quest -{ +public final class Q00154_SacrificeToTheSea extends Quest { // NPCs private static final int ROCKSWELL = 30312; private static final int CRISTEL = 30051; @@ -46,8 +45,7 @@ public final class Q00154_SacrificeToTheSea extends Quest // Misc private static final int MIN_LVL = 2; - public Q00154_SacrificeToTheSea() - { + public Q00154_SacrificeToTheSea() { super(154, Q00154_SacrificeToTheSea.class.getSimpleName(), "Sacrifice to the Sea"); addStartNpc(ROCKSWELL); addTalkId(ROCKSWELL, CRISTEL, ROLLFNAN); @@ -56,11 +54,9 @@ public final class Q00154_SacrificeToTheSea extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if ((qs != null) && event.equals("30312-03.htm")) - { + if ((qs != null) && event.equals("30312-03.htm")) { qs.startQuest(); return event; } @@ -68,39 +64,28 @@ public final class Q00154_SacrificeToTheSea extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (npc.getId()) - { - case ROCKSWELL: - { - if (qs.isCreated()) - { + switch (npc.getId()) { + case ROCKSWELL: { + if (qs.isCreated()) { htmltext = ((talker.getLevel() >= MIN_LVL) ? "30312-01.htm" : "30312-02.htm"); - } - else if (qs.isStarted()) - { - switch (qs.getCond()) - { - case 1: - { + } else if (qs.isStarted()) { + switch (qs.getCond()) { + case 1: { htmltext = "30312-04.html"; break; } - case 2: - { + case 2: { htmltext = "30312-07.html"; break; } - case 3: - { + case 3: { htmltext = "30312-05.html"; break; } - case 4: - { + case 4: { takeItems(talker, MAIDEN_DOLL, -1); rewardItems(talker, MAGE_EARING, 1); addExpAndSp(talker, 0, 1000); @@ -109,63 +94,50 @@ public final class Q00154_SacrificeToTheSea extends Quest break; } } - } - else - { + } else { htmltext = getAlreadyCompletedMsg(talker); } break; } - case CRISTEL: - { - switch (qs.getCond()) - { - case 1: - { + case CRISTEL: { + switch (qs.getCond()) { + case 1: { htmltext = "30051-02.html"; break; } - case 2: - { + case 2: { takeItems(talker, FOX_FUR, -1); giveItems(talker, FOX_FUR_YAM, 1); qs.setCond(3, true); htmltext = "30051-01.html"; break; } - case 3: - { + case 3: { htmltext = "30051-03.html"; break; } - case 4: - { + case 4: { htmltext = "30051-04.html"; break; } } break; } - case ROLLFNAN: - { - switch (qs.getCond()) - { + case ROLLFNAN: { + switch (qs.getCond()) { case 1: - case 2: - { + case 2: { htmltext = "30055-03.html"; break; } - case 3: - { + case 3: { takeItems(talker, FOX_FUR_YAM, -1); giveItems(talker, MAIDEN_DOLL, 1); qs.setCond(4, true); htmltext = "30055-01.html"; break; } - case 4: - { + case 4: { htmltext = "30055-02.html"; break; } @@ -177,11 +149,9 @@ public final class Q00154_SacrificeToTheSea extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc); - if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, FOX_FUR, 1, 10, 0.3, true)) - { + if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, FOX_FUR, 1, 10, 0.3, true)) { qs.setCond(2); } return super.onKill(npc, killer, isSummon); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00155_FindSirWindawood/Q00155_FindSirWindawood.java b/src/main/java/com/l2jserver/datapack/quests/Q00155_FindSirWindawood/Q00155_FindSirWindawood.java index 69c54abe84..8b9996ea00 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00155_FindSirWindawood/Q00155_FindSirWindawood.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00155_FindSirWindawood/Q00155_FindSirWindawood.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.State; * Find Sir Windawood (155) * @author malyelfik */ -public class Q00155_FindSirWindawood extends Quest -{ +public class Q00155_FindSirWindawood extends Quest { // NPCs private static final int ABELLOS = 30042; private static final int SIR_COLLIN_WINDAWOOD = 30311; @@ -39,8 +38,7 @@ public class Q00155_FindSirWindawood extends Quest // Misc private static final int MIN_LEVEL = 3; - public Q00155_FindSirWindawood() - { + public Q00155_FindSirWindawood() { super(155, Q00155_FindSirWindawood.class.getSimpleName(), "Find Sir Windawood"); addStartNpc(ABELLOS); addTalkId(ABELLOS, SIR_COLLIN_WINDAWOOD); @@ -48,11 +46,9 @@ public class Q00155_FindSirWindawood extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && event.equalsIgnoreCase("30042-03.htm")) - { + if ((st != null) && event.equalsIgnoreCase("30042-03.htm")) { st.startQuest(); st.giveItems(OFFICIAL_LETTER, 1); return event; @@ -61,15 +57,12 @@ public class Q00155_FindSirWindawood extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case ABELLOS: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? "30042-02.htm" : "30042-01.htm"; break; @@ -82,8 +75,7 @@ public class Q00155_FindSirWindawood extends Quest } break; case SIR_COLLIN_WINDAWOOD: - if (st.isStarted() && st.hasQuestItems(OFFICIAL_LETTER)) - { + if (st.isStarted() && st.hasQuestItems(OFFICIAL_LETTER)) { st.giveItems(HASTE_POTION, 1); st.exitQuest(false, true); htmltext = "30311-01.html"; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00156_MillenniumLove/Q00156_MillenniumLove.java b/src/main/java/com/l2jserver/datapack/quests/Q00156_MillenniumLove/Q00156_MillenniumLove.java index f8236e3704..84c82f6021 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00156_MillenniumLove/Q00156_MillenniumLove.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00156_MillenniumLove/Q00156_MillenniumLove.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.State; * Millennium Love (156) * @author xban1x */ -public class Q00156_MillenniumLove extends Quest -{ +public class Q00156_MillenniumLove extends Quest { // NPCs private static final int LILITH = 30368; private static final int BAENEDES = 30369; @@ -40,8 +39,7 @@ public class Q00156_MillenniumLove extends Quest // Misc private static final int MIN_LVL = 15; - public Q00156_MillenniumLove() - { + public Q00156_MillenniumLove() { super(156, Q00156_MillenniumLove.class.getSimpleName(), "Millennium Love"); addStartNpc(LILITH); addTalkId(LILITH, BAENEDES); @@ -49,38 +47,28 @@ public class Q00156_MillenniumLove extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st != null) - { - switch (event) - { + if (st != null) { + switch (event) { case "30368-02.html": - case "30368-03.html": - { + case "30368-03.html": { htmltext = event; break; } - case "30368-05.htm": - { - if (player.getLevel() >= MIN_LVL) - { + case "30368-05.htm": { + if (player.getLevel() >= MIN_LVL) { st.startQuest(); st.giveItems(LILITHS_LETTER, 1); htmltext = event; - } - else - { + } else { htmltext = "30368-04.htm"; } break; } - case "30369-02.html": - { - if (st.isCond(1) && st.hasQuestItems(LILITHS_LETTER)) - { + case "30369-02.html": { + if (st.isCond(1) && st.hasQuestItems(LILITHS_LETTER)) { st.takeItems(LILITHS_LETTER, 1); st.giveItems(THEONS_DIARY, 1); st.setCond(2, true); @@ -88,10 +76,8 @@ public class Q00156_MillenniumLove extends Quest } break; } - case "30369-03.html": - { - if (st.isCond(1) && st.hasQuestItems(LILITHS_LETTER)) - { + case "30369-03.html": { + if (st.isCond(1) && st.hasQuestItems(LILITHS_LETTER)) { st.addExpAndSp(3000, 0); st.exitQuest(false, true); htmltext = event; @@ -104,29 +90,20 @@ public class Q00156_MillenniumLove extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (npc.getId()) - { - case LILITH: - { - switch (st.getState()) - { - case State.CREATED: - { + switch (npc.getId()) { + case LILITH: { + switch (st.getState()) { + case State.CREATED: { htmltext = "30368-01.htm"; break; } - case State.STARTED: - { - if (st.isCond(1) && st.hasQuestItems(LILITHS_LETTER)) - { + case State.STARTED: { + if (st.isCond(1) && st.hasQuestItems(LILITHS_LETTER)) { htmltext = "30368-06.html"; - } - else if (st.isCond(2) && st.hasQuestItems(THEONS_DIARY)) - { + } else if (st.isCond(2) && st.hasQuestItems(THEONS_DIARY)) { st.giveItems(GREATER_COMP_SOULSHOUT_PACKAGE_NO_GRADE, 1); st.addExpAndSp(3000, 0); st.exitQuest(false, true); @@ -134,30 +111,23 @@ public class Q00156_MillenniumLove extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } } break; } - case BAENEDES: - { - switch (st.getCond()) - { - case 1: - { - if (st.hasQuestItems(LILITHS_LETTER)) - { + case BAENEDES: { + switch (st.getCond()) { + case 1: { + if (st.hasQuestItems(LILITHS_LETTER)) { htmltext = "30369-01.html"; } break; } - case 2: - { - if (st.hasQuestItems(THEONS_DIARY)) - { + case 2: { + if (st.hasQuestItems(THEONS_DIARY)) { htmltext = "30369-04.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00157_RecoverSmuggledGoods/Q00157_RecoverSmuggledGoods.java b/src/main/java/com/l2jserver/datapack/quests/Q00157_RecoverSmuggledGoods/Q00157_RecoverSmuggledGoods.java index 149df41219..1a3a90f74b 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00157_RecoverSmuggledGoods/Q00157_RecoverSmuggledGoods.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00157_RecoverSmuggledGoods/Q00157_RecoverSmuggledGoods.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * Recover Smuggled Goods (157) * @author xban1x */ -public class Q00157_RecoverSmuggledGoods extends Quest -{ +public class Q00157_RecoverSmuggledGoods extends Quest { // NPC private static final int WILFORD = 30005; // Monster @@ -41,8 +40,7 @@ public class Q00157_RecoverSmuggledGoods extends Quest // Misc private static final int MIN_LVL = 5; - public Q00157_RecoverSmuggledGoods() - { + public Q00157_RecoverSmuggledGoods() { super(157, Q00157_RecoverSmuggledGoods.class.getSimpleName(), "Recover Smuggled Goods"); addStartNpc(WILFORD); addTalkId(WILFORD); @@ -51,21 +49,16 @@ public class Q00157_RecoverSmuggledGoods extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st != null) - { - switch (event) - { - case "30005-03.htm": - { + if (st != null) { + switch (event) { + case "30005-03.htm": { htmltext = event; break; } - case "30005-04.htm": - { + case "30005-04.htm": { st.startQuest(); htmltext = event; break; @@ -76,18 +69,13 @@ public class Q00157_RecoverSmuggledGoods extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isCond(1) && (getRandom(10) < 4) && (st.getQuestItemsCount(ADAMANTITE_ORE) < 20)) - { + if ((st != null) && st.isCond(1) && (getRandom(10) < 4) && (st.getQuestItemsCount(ADAMANTITE_ORE) < 20)) { st.giveItems(ADAMANTITE_ORE, 1); - if (st.getQuestItemsCount(ADAMANTITE_ORE) >= 20) - { + if (st.getQuestItemsCount(ADAMANTITE_ORE) >= 20) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -95,33 +83,25 @@ public class Q00157_RecoverSmuggledGoods extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = player.getLevel() >= MIN_LVL ? "30005-02.htm" : "30005-01.htm"; break; } - case State.STARTED: - { - if (st.isCond(2) && (st.getQuestItemsCount(ADAMANTITE_ORE) >= 20)) - { + case State.STARTED: { + if (st.isCond(2) && (st.getQuestItemsCount(ADAMANTITE_ORE) >= 20)) { st.giveItems(BUCKLER, 1); st.exitQuest(false, true); htmltext = "30005-06.html"; - } - else - { + } else { htmltext = "30005-05.html"; } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00158_SeedOfEvil/Q00158_SeedOfEvil.java b/src/main/java/com/l2jserver/datapack/quests/Q00158_SeedOfEvil/Q00158_SeedOfEvil.java index 9ed5b2f87e..ed51dc13db 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00158_SeedOfEvil/Q00158_SeedOfEvil.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00158_SeedOfEvil/Q00158_SeedOfEvil.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * Seed of Evil (158) * @author malyelfik */ -public class Q00158_SeedOfEvil extends Quest -{ +public class Q00158_SeedOfEvil extends Quest { // NPC private static final int BIOTIN = 30031; // Monster @@ -43,8 +42,7 @@ public class Q00158_SeedOfEvil extends Quest // Misc private static final int MIN_LEVEL = 21; - public Q00158_SeedOfEvil() - { + public Q00158_SeedOfEvil() { super(158, Q00158_SeedOfEvil.class.getSimpleName(), "Seed of Evil"); addStartNpc(BIOTIN); addTalkId(BIOTIN); @@ -54,11 +52,9 @@ public class Q00158_SeedOfEvil extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && event.equalsIgnoreCase("30031-03.htm")) - { + if ((st != null) && event.equalsIgnoreCase("30031-03.htm")) { st.startQuest(); return event; } @@ -66,10 +62,8 @@ public class Q00158_SeedOfEvil extends Quest } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (npc.isScriptValue(0)) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (npc.isScriptValue(0)) { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId._HOW_DARE_YOU_CHALLENGE_ME)); npc.setScriptValue(1); } @@ -77,11 +71,9 @@ public class Q00158_SeedOfEvil extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && !st.hasQuestItems(CLAY_TABLET)) - { + if ((st != null) && !st.hasQuestItems(CLAY_TABLET)) { st.giveItems(CLAY_TABLET, 1); st.setCond(2, true); } @@ -90,22 +82,17 @@ public class Q00158_SeedOfEvil extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? "30031-02.htm" : "30031-01.html"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "30031-04.html"; - } - else if (st.isCond(2) && st.hasQuestItems(CLAY_TABLET)) - { + } else if (st.isCond(2) && st.hasQuestItems(CLAY_TABLET)) { st.giveItems(ENCHANT_ARMOR_D, 1); st.addExpAndSp(17818, 927); st.giveAdena(1495, true); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00159_ProtectTheWaterSource/Q00159_ProtectTheWaterSource.java b/src/main/java/com/l2jserver/datapack/quests/Q00159_ProtectTheWaterSource/Q00159_ProtectTheWaterSource.java index ce449f1963..0ed66a7fb5 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00159_ProtectTheWaterSource/Q00159_ProtectTheWaterSource.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00159_ProtectTheWaterSource/Q00159_ProtectTheWaterSource.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.State; * Protect the Water Source (159) * @author xban1x */ -public class Q00159_ProtectTheWaterSource extends Quest -{ +public class Q00159_ProtectTheWaterSource extends Quest { // NPC private static final int ASTERIOS = 30154; // Monster @@ -43,8 +42,7 @@ public class Q00159_ProtectTheWaterSource extends Quest // Misc private static final int MIN_LVL = 12; - public Q00159_ProtectTheWaterSource() - { + public Q00159_ProtectTheWaterSource() { super(159, Q00159_ProtectTheWaterSource.class.getSimpleName(), "Protect the Water Source"); addStartNpc(ASTERIOS); addTalkId(ASTERIOS); @@ -53,11 +51,9 @@ public class Q00159_ProtectTheWaterSource extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && event.equals("30154-04.htm")) - { + if ((st != null) && event.equals("30154-04.htm")) { st.startQuest(); st.giveItems(HYACINTH_CHARM, 1); return event; @@ -66,34 +62,24 @@ public class Q00159_ProtectTheWaterSource extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null)) - { - switch (st.getCond()) - { - case 1: - { - if ((getRandom(100) < 40) && st.hasQuestItems(HYACINTH_CHARM) && !st.hasQuestItems(PLAGUE_DUST)) - { + if ((st != null)) { + switch (st.getCond()) { + case 1: { + if ((getRandom(100) < 40) && st.hasQuestItems(HYACINTH_CHARM) && !st.hasQuestItems(PLAGUE_DUST)) { st.giveItems(PLAGUE_DUST, 1); st.setCond(2, true); } break; } - case 3: - { + case 3: { long dust = st.getQuestItemsCount(PLAGUE_DUST); - if ((getRandom(100) < 40) && (dust < 5) && st.hasQuestItems(HYACINTH_CHARM2)) - { + if ((getRandom(100) < 40) && (dust < 5) && st.hasQuestItems(HYACINTH_CHARM2)) { st.giveItems(PLAGUE_DUST, 1); - if ((++dust) >= 5) - { + if ((++dust) >= 5) { st.setCond(4, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -105,33 +91,24 @@ public class Q00159_ProtectTheWaterSource extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getRace() == Race.ELF) ? (player.getLevel() >= MIN_LVL ? "30154-03.htm" : "30154-02.htm") : "30154-01.htm"; break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { - if (st.hasQuestItems(HYACINTH_CHARM) && !st.hasQuestItems(PLAGUE_DUST)) - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { + if (st.hasQuestItems(HYACINTH_CHARM) && !st.hasQuestItems(PLAGUE_DUST)) { htmltext = "30154-05.html"; } break; } - case 2: - { - if (st.hasQuestItems(HYACINTH_CHARM, PLAGUE_DUST)) - { + case 2: { + if (st.hasQuestItems(HYACINTH_CHARM, PLAGUE_DUST)) { st.takeItems(HYACINTH_CHARM, -1); st.takeItems(PLAGUE_DUST, -1); st.giveItems(HYACINTH_CHARM2, 1); @@ -140,18 +117,14 @@ public class Q00159_ProtectTheWaterSource extends Quest } break; } - case 3: - { - if (st.hasQuestItems(HYACINTH_CHARM2)) - { + case 3: { + if (st.hasQuestItems(HYACINTH_CHARM2)) { htmltext = "30154-07.html"; } break; } - case 4: - { - if (st.hasQuestItems(HYACINTH_CHARM2) && (st.getQuestItemsCount(PLAGUE_DUST) >= 5)) - { + case 4: { + if (st.hasQuestItems(HYACINTH_CHARM2) && (st.getQuestItemsCount(PLAGUE_DUST) >= 5)) { st.giveAdena(18250, true); st.exitQuest(false, true); htmltext = "30154-08.html"; @@ -161,8 +134,7 @@ public class Q00159_ProtectTheWaterSource extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00160_NerupasRequest/Q00160_NerupasRequest.java b/src/main/java/com/l2jserver/datapack/quests/Q00160_NerupasRequest/Q00160_NerupasRequest.java index a807932f6b..de1fa138ad 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00160_NerupasRequest/Q00160_NerupasRequest.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00160_NerupasRequest/Q00160_NerupasRequest.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * Nerupa's Request (160) * @author ivantotov */ -public final class Q00160_NerupasRequest extends Quest -{ +public final class Q00160_NerupasRequest extends Quest { // NPCs private static final int NERUPA = 30370; private static final int UNOREN = 30147; @@ -46,8 +45,7 @@ public final class Q00160_NerupasRequest extends Quest // Misc private static final int MIN_LEVEL = 3; - public Q00160_NerupasRequest() - { + public Q00160_NerupasRequest() { super(160, Q00160_NerupasRequest.class.getSimpleName(), "Nerupa's Request"); addStartNpc(NERUPA); addTalkId(NERUPA, UNOREN, CREAMEES, JULIA); @@ -55,14 +53,11 @@ public final class Q00160_NerupasRequest extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if ((qs != null) && event.equals("30370-04.htm")) - { + if ((qs != null) && event.equals("30370-04.htm")) { qs.startQuest(); - if (!hasQuestItems(player, SILVERY_SPIDERSILK)) - { + if (!hasQuestItems(player, SILVERY_SPIDERSILK)) { giveItems(player, SILVERY_SPIDERSILK, 1); } return event; @@ -71,48 +66,32 @@ public final class Q00160_NerupasRequest extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (qs.getState()) - { - case State.COMPLETED: - { + switch (qs.getState()) { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } - case State.CREATED: - { - if (npc.getId() == NERUPA) - { - if (player.getRace() != Race.ELF) - { + case State.CREATED: { + if (npc.getId() == NERUPA) { + if (player.getRace() != Race.ELF) { htmltext = "30370-01.htm"; - } - else if (player.getLevel() < MIN_LEVEL) - { + } else if (player.getLevel() < MIN_LEVEL) { htmltext = "30370-02.htm"; - } - else - { + } else { htmltext = "30370-03.htm"; } } break; } - case State.STARTED: - { - switch (npc.getId()) - { - case NERUPA: - { - if (hasAtLeastOneQuestItem(player, SILVERY_SPIDERSILK, UNOS_RECEIPT, CELS_TICKET)) - { + case State.STARTED: { + switch (npc.getId()) { + case NERUPA: { + if (hasAtLeastOneQuestItem(player, SILVERY_SPIDERSILK, UNOS_RECEIPT, CELS_TICKET)) { htmltext = "30370-05.html"; - } - else if (hasQuestItems(player, NIGHTSHADE_LEAF)) - { + } else if (hasQuestItems(player, NIGHTSHADE_LEAF)) { rewardItems(player, LESSER_HEALING_POTION, 5); addExpAndSp(player, 1000, 0); qs.exitQuest(false, true); @@ -120,65 +99,46 @@ public final class Q00160_NerupasRequest extends Quest } break; } - case UNOREN: - { - if (hasQuestItems(player, SILVERY_SPIDERSILK)) - { + case UNOREN: { + if (hasQuestItems(player, SILVERY_SPIDERSILK)) { takeItems(player, SILVERY_SPIDERSILK, -1); - if (!hasQuestItems(player, UNOS_RECEIPT)) - { + if (!hasQuestItems(player, UNOS_RECEIPT)) { giveItems(player, UNOS_RECEIPT, 1); } qs.setCond(2, true); htmltext = "30147-01.html"; - } - else if (hasQuestItems(player, UNOS_RECEIPT)) - { + } else if (hasQuestItems(player, UNOS_RECEIPT)) { htmltext = "30147-02.html"; - } - else if (hasQuestItems(player, NIGHTSHADE_LEAF)) - { + } else if (hasQuestItems(player, NIGHTSHADE_LEAF)) { htmltext = "30147-03.html"; } break; } - case CREAMEES: - { - if (hasQuestItems(player, UNOS_RECEIPT)) - { + case CREAMEES: { + if (hasQuestItems(player, UNOS_RECEIPT)) { takeItems(player, UNOS_RECEIPT, -1); - if (!hasQuestItems(player, CELS_TICKET)) - { + if (!hasQuestItems(player, CELS_TICKET)) { giveItems(player, CELS_TICKET, 1); } qs.setCond(3, true); htmltext = "30149-01.html"; - } - else if (hasQuestItems(player, CELS_TICKET)) - { + } else if (hasQuestItems(player, CELS_TICKET)) { htmltext = "30149-02.html"; - } - else if (hasQuestItems(player, NIGHTSHADE_LEAF)) - { + } else if (hasQuestItems(player, NIGHTSHADE_LEAF)) { htmltext = "30149-03.html"; } break; } - case JULIA: - { - if (hasQuestItems(player, CELS_TICKET)) - { + case JULIA: { + if (hasQuestItems(player, CELS_TICKET)) { takeItems(player, CELS_TICKET, -1); - if (!hasQuestItems(player, NIGHTSHADE_LEAF)) - { + if (!hasQuestItems(player, NIGHTSHADE_LEAF)) { giveItems(player, NIGHTSHADE_LEAF, 1); } qs.setCond(4, true); htmltext = "30152-01.html"; - } - else if (hasQuestItems(player, NIGHTSHADE_LEAF)) - { + } else if (hasQuestItems(player, NIGHTSHADE_LEAF)) { htmltext = "30152-02.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00161_FruitOfTheMotherTree/Q00161_FruitOfTheMotherTree.java b/src/main/java/com/l2jserver/datapack/quests/Q00161_FruitOfTheMotherTree/Q00161_FruitOfTheMotherTree.java index 081401ba39..9e44263311 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00161_FruitOfTheMotherTree/Q00161_FruitOfTheMotherTree.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00161_FruitOfTheMotherTree/Q00161_FruitOfTheMotherTree.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * Fruit of the Mother Tree (161) * @author malyelfik */ -public class Q00161_FruitOfTheMotherTree extends Quest -{ +public class Q00161_FruitOfTheMotherTree extends Quest { // NPCs private static final int ANDELLIA = 30362; private static final int THALIA = 30371; @@ -40,8 +39,7 @@ public class Q00161_FruitOfTheMotherTree extends Quest // Misc private static final int MIN_LEVEL = 3; - public Q00161_FruitOfTheMotherTree() - { + public Q00161_FruitOfTheMotherTree() { super(161, Q00161_FruitOfTheMotherTree.class.getSimpleName(), "Fruit of the Mother Tree"); addStartNpc(ANDELLIA); addTalkId(ANDELLIA, THALIA); @@ -49,17 +47,14 @@ public class Q00161_FruitOfTheMotherTree extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "30362-04.htm": st.startQuest(); st.giveItems(ANDELLRIAS_LETTER, 1); @@ -75,25 +70,19 @@ public class Q00161_FruitOfTheMotherTree extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case ANDELLIA: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getRace() == Race.ELF) ? (player.getLevel() >= MIN_LEVEL) ? "30362-03.htm" : "30362-02.htm" : "30362-01.htm"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "30362-05.html"; - } - else if (st.isCond(2) && st.hasQuestItems(MOTHERTREE_FRUIT)) - { + } else if (st.isCond(2) && st.hasQuestItems(MOTHERTREE_FRUIT)) { st.giveAdena(1000, true); st.addExpAndSp(1000, 0); st.exitQuest(false, true); @@ -106,17 +95,13 @@ public class Q00161_FruitOfTheMotherTree extends Quest } break; case THALIA: - if (st.isStarted()) - { - if (st.isCond(1) && st.hasQuestItems(ANDELLRIAS_LETTER)) - { + if (st.isStarted()) { + if (st.isCond(1) && st.hasQuestItems(ANDELLRIAS_LETTER)) { st.takeItems(ANDELLRIAS_LETTER, -1); st.giveItems(MOTHERTREE_FRUIT, 1); st.setCond(2, true); htmltext = "30371-01.html"; - } - else if (st.isCond(2) && st.hasQuestItems(MOTHERTREE_FRUIT)) - { + } else if (st.isCond(2) && st.hasQuestItems(MOTHERTREE_FRUIT)) { htmltext = "30371-02.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00162_CurseOfTheUndergroundFortress/Q00162_CurseOfTheUndergroundFortress.java b/src/main/java/com/l2jserver/datapack/quests/Q00162_CurseOfTheUndergroundFortress/Q00162_CurseOfTheUndergroundFortress.java index ec2dfa1ab7..cae76a3770 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00162_CurseOfTheUndergroundFortress/Q00162_CurseOfTheUndergroundFortress.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00162_CurseOfTheUndergroundFortress/Q00162_CurseOfTheUndergroundFortress.java @@ -33,15 +33,13 @@ import com.l2jserver.gameserver.model.quest.State; * Curse of the Underground Fortress (162) * @author xban1x */ -public class Q00162_CurseOfTheUndergroundFortress extends Quest -{ +public class Q00162_CurseOfTheUndergroundFortress extends Quest { // NPC private static final int UNOREN = 30147; // Monsters private static final Map<Integer, Integer> MONSTERS_SKULLS = new HashMap<>(); private static final Map<Integer, Integer> MONSTERS_BONES = new HashMap<>(); - static - { + static { MONSTERS_SKULLS.put(20033, 25); // Shade Horror MONSTERS_SKULLS.put(20345, 26); // Dark Terror MONSTERS_SKULLS.put(20371, 23); // Mist Terror @@ -57,8 +55,7 @@ public class Q00162_CurseOfTheUndergroundFortress extends Quest private static final int MIN_LVL = 12; private static final int REQUIRED_COUNT = 13; - public Q00162_CurseOfTheUndergroundFortress() - { + public Q00162_CurseOfTheUndergroundFortress() { super(162, Q00162_CurseOfTheUndergroundFortress.class.getSimpleName(), "Curse of the Underground Fortress"); addStartNpc(UNOREN); addTalkId(UNOREN); @@ -68,21 +65,16 @@ public class Q00162_CurseOfTheUndergroundFortress extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st != null) - { - switch (event) - { - case "30147-03.htm": - { + if (st != null) { + switch (event) { + case "30147-03.htm": { htmltext = event; break; } - case "30147-04.htm": - { + case "30147-04.htm": { st.startQuest(); htmltext = event; break; @@ -93,44 +85,29 @@ public class Q00162_CurseOfTheUndergroundFortress extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isCond(1)) - { - if (MONSTERS_SKULLS.containsKey(npc.getId())) - { - if (getRandom(100) < MONSTERS_SKULLS.get(npc.getId())) - { + if ((st != null) && st.isCond(1)) { + if (MONSTERS_SKULLS.containsKey(npc.getId())) { + if (getRandom(100) < MONSTERS_SKULLS.get(npc.getId())) { long skulls = st.getQuestItemsCount(ELF_SKULL); - if (skulls < 3) - { + if (skulls < 3) { st.giveItems(ELF_SKULL, 1); - if (((++skulls) >= 3) && (st.getQuestItemsCount(BONE_FRAGMENT) >= 10)) - { + if (((++skulls) >= 3) && (st.getQuestItemsCount(BONE_FRAGMENT) >= 10)) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } } - } - else if (MONSTERS_BONES.containsKey(npc.getId())) - { - if (getRandom(100) < MONSTERS_BONES.get(npc.getId())) - { + } else if (MONSTERS_BONES.containsKey(npc.getId())) { + if (getRandom(100) < MONSTERS_BONES.get(npc.getId())) { long bones = st.getQuestItemsCount(BONE_FRAGMENT); - if (bones < 10) - { + if (bones < 10) { st.giveItems(BONE_FRAGMENT, 1); - if (((++bones) >= 10) && (st.getQuestItemsCount(ELF_SKULL) >= 3)) - { + if (((++bones) >= 10) && (st.getQuestItemsCount(ELF_SKULL) >= 3)) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -141,35 +118,27 @@ public class Q00162_CurseOfTheUndergroundFortress extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getRace() != Race.DARK_ELF) ? (player.getLevel() >= MIN_LVL) ? "30147-02.htm" : "30147-01.htm" : "30147-00.htm"; break; } - case State.STARTED: - { - if ((st.getQuestItemsCount(BONE_FRAGMENT) + st.getQuestItemsCount(ELF_SKULL)) >= REQUIRED_COUNT) - { + case State.STARTED: { + if ((st.getQuestItemsCount(BONE_FRAGMENT) + st.getQuestItemsCount(ELF_SKULL)) >= REQUIRED_COUNT) { st.giveItems(BONE_SHIELD, 1); st.addExpAndSp(22652, 1004); st.giveAdena(24000, true); st.exitQuest(false, true); htmltext = "30147-06.html"; - } - else - { + } else { htmltext = "30147-05.html"; } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00163_LegacyOfThePoet/Q00163_LegacyOfThePoet.java b/src/main/java/com/l2jserver/datapack/quests/Q00163_LegacyOfThePoet/Q00163_LegacyOfThePoet.java index 2a3512c44e..613a812af4 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00163_LegacyOfThePoet/Q00163_LegacyOfThePoet.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00163_LegacyOfThePoet/Q00163_LegacyOfThePoet.java @@ -30,13 +30,11 @@ import com.l2jserver.gameserver.model.quest.State; * Legacy of the Poet (163) * @author xban1x */ -public class Q00163_LegacyOfThePoet extends Quest -{ +public class Q00163_LegacyOfThePoet extends Quest { // NPC private static final int STARDEN = 30220; // Monsters - private static final int[] MONSTERS = - { + private static final int[] MONSTERS = { 20372, // Baraq Orc Fighter 20373, // Baraq Orc Warrior Leader }; @@ -48,8 +46,7 @@ public class Q00163_LegacyOfThePoet extends Quest // Misc private static final int MIN_LVL = 11; - public Q00163_LegacyOfThePoet() - { + public Q00163_LegacyOfThePoet() { super(163, Q00163_LegacyOfThePoet.class.getSimpleName(), "Legacy of the Poet"); addStartNpc(STARDEN); addTalkId(STARDEN); @@ -58,22 +55,17 @@ public class Q00163_LegacyOfThePoet extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st != null) - { - switch (event) - { + if (st != null) { + switch (event) { case "30220-03.html": - case "30220-04.html": - { + case "30220-04.html": { htmltext = event; break; } - case "30220-05.htm": - { + case "30220-05.htm": { st.startQuest(); htmltext = event; break; @@ -84,56 +76,38 @@ public class Q00163_LegacyOfThePoet extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isCond(1)) - { - if ((getRandom(10) == 0) && !st.hasQuestItems(RUMIELS_1ST_POEM)) - { + if ((st != null) && st.isCond(1)) { + if ((getRandom(10) == 0) && !st.hasQuestItems(RUMIELS_1ST_POEM)) { st.giveItems(RUMIELS_1ST_POEM, 1); - if (st.hasQuestItems(RUMIELS_2ND_POEM, RUMIELS_3RD_POEM, RUMIELS_4TH_POEM)) - { + if (st.hasQuestItems(RUMIELS_2ND_POEM, RUMIELS_3RD_POEM, RUMIELS_4TH_POEM)) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } - if ((getRandom(10) > 7) && !st.hasQuestItems(RUMIELS_2ND_POEM)) - { + if ((getRandom(10) > 7) && !st.hasQuestItems(RUMIELS_2ND_POEM)) { st.giveItems(RUMIELS_2ND_POEM, 1); - if (st.hasQuestItems(RUMIELS_1ST_POEM, RUMIELS_3RD_POEM, RUMIELS_4TH_POEM)) - { + if (st.hasQuestItems(RUMIELS_1ST_POEM, RUMIELS_3RD_POEM, RUMIELS_4TH_POEM)) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } - if ((getRandom(10) > 7) && !st.hasQuestItems(RUMIELS_3RD_POEM)) - { + if ((getRandom(10) > 7) && !st.hasQuestItems(RUMIELS_3RD_POEM)) { st.giveItems(RUMIELS_3RD_POEM, 1); - if (st.hasQuestItems(RUMIELS_1ST_POEM, RUMIELS_2ND_POEM, RUMIELS_4TH_POEM)) - { + if (st.hasQuestItems(RUMIELS_1ST_POEM, RUMIELS_2ND_POEM, RUMIELS_4TH_POEM)) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } - if ((getRandom(10) > 5) && !st.hasQuestItems(RUMIELS_4TH_POEM)) - { + if ((getRandom(10) > 5) && !st.hasQuestItems(RUMIELS_4TH_POEM)) { st.giveItems(RUMIELS_4TH_POEM, 1); - if (st.hasQuestItems(RUMIELS_1ST_POEM, RUMIELS_2ND_POEM, RUMIELS_3RD_POEM)) - { + if (st.hasQuestItems(RUMIELS_1ST_POEM, RUMIELS_2ND_POEM, RUMIELS_3RD_POEM)) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -142,34 +116,26 @@ public class Q00163_LegacyOfThePoet extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getRace() != Race.DARK_ELF) ? (player.getLevel() >= MIN_LVL) ? "30220-02.htm" : "30220-01.htm" : "30220-00.htm"; break; } - case State.STARTED: - { - if (st.hasQuestItems(RUMIELS_1ST_POEM, RUMIELS_2ND_POEM, RUMIELS_3RD_POEM, RUMIELS_4TH_POEM)) - { + case State.STARTED: { + if (st.hasQuestItems(RUMIELS_1ST_POEM, RUMIELS_2ND_POEM, RUMIELS_3RD_POEM, RUMIELS_4TH_POEM)) { st.addExpAndSp(21643, 943); st.giveAdena(13890, true); st.exitQuest(false, true); htmltext = "30220-07.html"; - } - else - { + } else { htmltext = "30220-06.html"; } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00164_BloodFiend/Q00164_BloodFiend.java b/src/main/java/com/l2jserver/datapack/quests/Q00164_BloodFiend/Q00164_BloodFiend.java index c012847cb2..ed312b51f3 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00164_BloodFiend/Q00164_BloodFiend.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00164_BloodFiend/Q00164_BloodFiend.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * Blood Fiend (164) * @author xban1x */ -public class Q00164_BloodFiend extends Quest -{ +public class Q00164_BloodFiend extends Quest { // NPC private static final int CREAMEES = 30149; // Monster @@ -43,8 +42,7 @@ public class Q00164_BloodFiend extends Quest // Misc private static final int MIN_LVL = 21; - public Q00164_BloodFiend() - { + public Q00164_BloodFiend() { super(164, Q00164_BloodFiend.class.getSimpleName(), "Blood Fiend"); addStartNpc(CREAMEES); addTalkId(CREAMEES); @@ -53,11 +51,9 @@ public class Q00164_BloodFiend extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && event.equals("30149-04.htm")) - { + if ((st != null) && event.equals("30149-04.htm")) { st.startQuest(); return event; } @@ -65,11 +61,9 @@ public class Q00164_BloodFiend extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isCond(1)) - { + if ((st != null) && st.isCond(1)) { npc.broadcastPacket(new NpcSay(npc, Say2.ALL, NpcStringId.I_HAVE_FULFILLED_MY_CONTRACT_WITH_TRADER_CREAMEES)); st.giveItems(KIRUNAK_SKULL, 1); st.setCond(2, true); @@ -78,34 +72,26 @@ public class Q00164_BloodFiend extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getRace() != Race.DARK_ELF) ? player.getLevel() >= MIN_LVL ? "30149-03.htm" : "30149-02.htm" : "30149-00.htm"; break; } - case State.STARTED: - { - if (st.isCond(2) && st.hasQuestItems(KIRUNAK_SKULL)) - { + case State.STARTED: { + if (st.isCond(2) && st.hasQuestItems(KIRUNAK_SKULL)) { st.giveAdena(42130, true); st.addExpAndSp(35637, 1854); st.exitQuest(false, true); htmltext = "30149-06.html"; - } - else - { + } else { htmltext = "30149-05.html"; } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00165_ShilensHunt/Q00165_ShilensHunt.java b/src/main/java/com/l2jserver/datapack/quests/Q00165_ShilensHunt/Q00165_ShilensHunt.java index 30605abd27..cce890420a 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00165_ShilensHunt/Q00165_ShilensHunt.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00165_ShilensHunt/Q00165_ShilensHunt.java @@ -33,14 +33,12 @@ import com.l2jserver.gameserver.model.quest.State; * Shilen's Hunt (165) * @author xban1x */ -public class Q00165_ShilensHunt extends Quest -{ +public class Q00165_ShilensHunt extends Quest { // NPC private static final int NELSYA = 30348; // Monsters private static final Map<Integer, Integer> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(20456, 3); // Ashen Wolf MONSTERS.put(20529, 1); // Young Brown Keltir MONSTERS.put(20532, 1); // Brown Keltir @@ -53,8 +51,7 @@ public class Q00165_ShilensHunt extends Quest private static final int MIN_LVL = 3; private static final int REQUIRED_COUNT = 13; - public Q00165_ShilensHunt() - { + public Q00165_ShilensHunt() { super(165, Q00165_ShilensHunt.class.getSimpleName(), "Shilen's Hunt"); addStartNpc(NELSYA); addTalkId(NELSYA); @@ -63,11 +60,9 @@ public class Q00165_ShilensHunt extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && event.equalsIgnoreCase("30348-03.htm")) - { + if ((st != null) && event.equalsIgnoreCase("30348-03.htm")) { st.startQuest(); return event; } @@ -75,18 +70,13 @@ public class Q00165_ShilensHunt extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isCond(1) && (getRandom(3) < MONSTERS.get(npc.getId()))) - { + if ((st != null) && st.isCond(1) && (getRandom(3) < MONSTERS.get(npc.getId()))) { st.giveItems(DARK_BEZOAR, 1); - if (st.getQuestItemsCount(DARK_BEZOAR) < REQUIRED_COUNT) - { + if (st.getQuestItemsCount(DARK_BEZOAR) < REQUIRED_COUNT) { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - } - else - { + } else { st.setCond(2, true); } } @@ -94,34 +84,26 @@ public class Q00165_ShilensHunt extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getRace() == Race.DARK_ELF) ? (player.getLevel() >= MIN_LVL) ? "30348-02.htm" : "30348-01.htm" : "30348-00.htm"; break; } - case State.STARTED: - { - if (st.isCond(2) && (st.getQuestItemsCount(DARK_BEZOAR) >= REQUIRED_COUNT)) - { + case State.STARTED: { + if (st.isCond(2) && (st.getQuestItemsCount(DARK_BEZOAR) >= REQUIRED_COUNT)) { st.giveItems(LESSER_HEALING_POTION, 5); st.addExpAndSp(1000, 0); st.exitQuest(false, true); htmltext = "30348-05.html"; - } - else - { + } else { htmltext = "30348-04.html"; } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00166_MassOfDarkness/Q00166_MassOfDarkness.java b/src/main/java/com/l2jserver/datapack/quests/Q00166_MassOfDarkness/Q00166_MassOfDarkness.java index e8735ee9b7..51b8037cb2 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00166_MassOfDarkness/Q00166_MassOfDarkness.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00166_MassOfDarkness/Q00166_MassOfDarkness.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.network.NpcStringId; * Mass of Darkness (166) * @author xban1x */ -public class Q00166_MassOfDarkness extends Quest -{ +public class Q00166_MassOfDarkness extends Quest { // NPCs private static final int UNDRIAS = 30130; private static final int IRIA = 30135; @@ -48,15 +47,13 @@ public class Q00166_MassOfDarkness extends Quest // Misc private static final int MIN_LVL = 2; private static final Map<Integer, Integer> NPCs = new HashMap<>(); - static - { + static { NPCs.put(IRIA, CEREMONIAL_DAGGER); NPCs.put(DORANKUS, DREVIANT_WINE); NPCs.put(TRUDY, GARMIELS_SCRIPTURE); } - public Q00166_MassOfDarkness() - { + public Q00166_MassOfDarkness() { super(166, Q00166_MassOfDarkness.class.getSimpleName(), "Mass of Darkness"); addStartNpc(UNDRIAS); addTalkId(UNDRIAS, IRIA, DORANKUS, TRUDY); @@ -64,11 +61,9 @@ public class Q00166_MassOfDarkness extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && event.equals("30130-03.htm")) - { + if ((st != null) && event.equals("30130-03.htm")) { st.startQuest(); st.giveItems(UNDRIAS_LETTER, 1); return event; @@ -77,39 +72,29 @@ public class Q00166_MassOfDarkness extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (npc.getId()) - { - case UNDRIAS: - { - switch (st.getState()) - { - case State.CREATED: - { + switch (npc.getId()) { + case UNDRIAS: { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getRace() == Race.DARK_ELF) ? (player.getLevel() >= MIN_LVL) ? "30130-02.htm" : "30130-01.htm" : "30130-00.htm"; break; } - case State.STARTED: - { - if (st.isCond(2) && st.hasQuestItems(UNDRIAS_LETTER, CEREMONIAL_DAGGER, DREVIANT_WINE, GARMIELS_SCRIPTURE)) - { + case State.STARTED: { + if (st.isCond(2) && st.hasQuestItems(UNDRIAS_LETTER, CEREMONIAL_DAGGER, DREVIANT_WINE, GARMIELS_SCRIPTURE)) { showOnScreenMsg(player, NpcStringId.DELIVERY_DUTY_COMPLETE_N_GO_FIND_THE_NEWBIE_GUIDE, 2, 5000); // TODO: Newbie Guide st.addExpAndSp(5672, 466); st.giveAdena(2966, true); st.exitQuest(false, true); htmltext = "30130-05.html"; - } - else - { + } else { htmltext = "30130-04.html"; } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } @@ -118,23 +103,17 @@ public class Q00166_MassOfDarkness extends Quest } case IRIA: case DORANKUS: - case TRUDY: - { - if (st.isStarted()) - { + case TRUDY: { + if (st.isStarted()) { final int npcId = npc.getId(); final int itemId = NPCs.get(npcId); - if (st.isCond(1) && !st.hasQuestItems(itemId)) - { + if (st.isCond(1) && !st.hasQuestItems(itemId)) { st.giveItems(itemId, 1); - if (st.hasQuestItems(CEREMONIAL_DAGGER, DREVIANT_WINE, GARMIELS_SCRIPTURE)) - { + if (st.hasQuestItems(CEREMONIAL_DAGGER, DREVIANT_WINE, GARMIELS_SCRIPTURE)) { st.setCond(2, true); } htmltext = npcId + "-01.html"; - } - else - { + } else { htmltext = npcId + "-02.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00167_DwarvenKinship/Q00167_DwarvenKinship.java b/src/main/java/com/l2jserver/datapack/quests/Q00167_DwarvenKinship/Q00167_DwarvenKinship.java index fdb123019a..ce54a50e7b 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00167_DwarvenKinship/Q00167_DwarvenKinship.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00167_DwarvenKinship/Q00167_DwarvenKinship.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.State; * Dwarven Kinship (167) * @author xban1x */ -public class Q00167_DwarvenKinship extends Quest -{ +public class Q00167_DwarvenKinship extends Quest { // NPCs private static final int NORMAN = 30210; private static final int HAPROCK = 30255; @@ -40,8 +39,7 @@ public class Q00167_DwarvenKinship extends Quest // Misc private static final int MIN_LVL = 15; - public Q00167_DwarvenKinship() - { + public Q00167_DwarvenKinship() { super(167, Q00167_DwarvenKinship.class.getSimpleName(), "Dwarven Kinship"); addStartNpc(CARLON); addTalkId(CARLON, NORMAN, HAPROCK); @@ -49,33 +47,25 @@ public class Q00167_DwarvenKinship extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st != null) - { - switch (event) - { - case "30210-02.html": - { - if (st.isCond(2) && st.hasQuestItems(NORMANS_LETTER)) - { + if (st != null) { + switch (event) { + case "30210-02.html": { + if (st.isCond(2) && st.hasQuestItems(NORMANS_LETTER)) { st.giveAdena(20000, true); st.exitQuest(false, true); htmltext = event; } break; } - case "30255-02.html": - { + case "30255-02.html": { htmltext = event; break; } - case "30255-03.html": - { - if (st.isCond(1) && st.hasQuestItems(CARLONS_LETTER)) - { + case "30255-03.html": { + if (st.isCond(1) && st.hasQuestItems(CARLONS_LETTER)) { st.takeItems(CARLONS_LETTER, -1); st.giveItems(NORMANS_LETTER, 1); st.giveAdena(2000, true); @@ -84,18 +74,15 @@ public class Q00167_DwarvenKinship extends Quest } break; } - case "30255-04.html": - { - if (st.isCond(1) && st.hasQuestItems(CARLONS_LETTER)) - { + case "30255-04.html": { + if (st.isCond(1) && st.hasQuestItems(CARLONS_LETTER)) { st.giveAdena(15000, true); st.exitQuest(false, true); htmltext = event; } break; } - case "30350-03.htm": - { + case "30350-03.htm": { st.startQuest(); st.giveItems(CARLONS_LETTER, 1); htmltext = event; @@ -107,53 +94,39 @@ public class Q00167_DwarvenKinship extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (npc.getId()) - { - case CARLON: - { - switch (st.getState()) - { - case State.CREATED: - { + switch (npc.getId()) { + case CARLON: { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getLevel() >= MIN_LVL) ? "30350-02.htm" : "30350-01.htm"; break; } - case State.STARTED: - { - if (st.isCond(1) && st.hasQuestItems(CARLONS_LETTER)) - { + case State.STARTED: { + if (st.isCond(1) && st.hasQuestItems(CARLONS_LETTER)) { htmltext = "30350-04.html"; } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } } break; } - case HAPROCK: - { - if (st.isCond(1) && st.hasQuestItems(CARLONS_LETTER)) - { + case HAPROCK: { + if (st.isCond(1) && st.hasQuestItems(CARLONS_LETTER)) { htmltext = "30255-01.html"; - } - else if (st.isCond(2) && st.hasQuestItems(NORMANS_LETTER)) - { + } else if (st.isCond(2) && st.hasQuestItems(NORMANS_LETTER)) { htmltext = "30255-05.html"; } break; } - case NORMAN: - { - if (st.isCond(2) && st.hasQuestItems(NORMANS_LETTER)) - { + case NORMAN: { + if (st.isCond(2) && st.hasQuestItems(NORMANS_LETTER)) { htmltext = "30210-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00168_DeliverSupplies/Q00168_DeliverSupplies.java b/src/main/java/com/l2jserver/datapack/quests/Q00168_DeliverSupplies/Q00168_DeliverSupplies.java index c57ab540d5..a4038780c6 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00168_DeliverSupplies/Q00168_DeliverSupplies.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00168_DeliverSupplies/Q00168_DeliverSupplies.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.model.quest.State; * Deliver Supplies (168) * @author xban1x */ -public class Q00168_DeliverSupplies extends Quest -{ +public class Q00168_DeliverSupplies extends Quest { // NPCs private static final int JENNA = 30349; private static final int ROSELYN = 30355; @@ -48,14 +47,12 @@ public class Q00168_DeliverSupplies extends Quest // Misc private static final int MIN_LVL = 3; private static final Map<Integer, Integer> SENTRIES = new HashMap<>(); - static - { + static { SENTRIES.put(KRISTIN, SENTRY_BLADE3); SENTRIES.put(ROSELYN, SENTRY_BLADE2); } - public Q00168_DeliverSupplies() - { + public Q00168_DeliverSupplies() { super(168, Q00168_DeliverSupplies.class.getSimpleName(), "Deliver Supplies"); addStartNpc(JENNA); addTalkId(JENNA, ROSELYN, KRISTIN, HARANT); @@ -63,11 +60,9 @@ public class Q00168_DeliverSupplies extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && event.equals("30349-03.htm")) - { + if ((st != null) && event.equals("30349-03.htm")) { st.startQuest(); st.giveItems(JENNAS_LETTER, 1); return event; @@ -76,55 +71,40 @@ public class Q00168_DeliverSupplies extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (npc.getId()) - { - case JENNA: - { - switch (st.getState()) - { - case State.CREATED: - { + switch (npc.getId()) { + case JENNA: { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getRace() == Race.DARK_ELF) ? (player.getLevel() >= MIN_LVL) ? "30349-02.htm" : "30349-01.htm" : "30349-00.htm"; break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { - if (st.hasQuestItems(JENNAS_LETTER)) - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { + if (st.hasQuestItems(JENNAS_LETTER)) { htmltext = "30349-04.html"; } break; } - case 2: - { - if (st.hasQuestItems(SENTRY_BLADE1, SENTRY_BLADE2, SENTRY_BLADE3)) - { + case 2: { + if (st.hasQuestItems(SENTRY_BLADE1, SENTRY_BLADE2, SENTRY_BLADE3)) { st.takeItems(SENTRY_BLADE1, -1); st.setCond(3, true); htmltext = "30349-05.html"; } break; } - case 3: - { - if (hasAtLeastOneQuestItem(player, SENTRY_BLADE2, SENTRY_BLADE3)) - { + case 3: { + if (hasAtLeastOneQuestItem(player, SENTRY_BLADE2, SENTRY_BLADE3)) { htmltext = "30349-07.html"; } break; } - case 4: - { - if (st.getQuestItemsCount(OLD_BRONZE_SWORD) >= 2) - { + case 4: { + if (st.getQuestItemsCount(OLD_BRONZE_SWORD) >= 2) { st.giveAdena(820, true); st.exitQuest(false, true); htmltext = "30349-07.html"; @@ -134,46 +114,36 @@ public class Q00168_DeliverSupplies extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } } break; } - case HARANT: - { - if (st.isCond(1) && st.hasQuestItems(JENNAS_LETTER)) - { + case HARANT: { + if (st.isCond(1) && st.hasQuestItems(JENNAS_LETTER)) { st.takeItems(JENNAS_LETTER, -1); st.giveItems(SENTRY_BLADE1, 1); st.giveItems(SENTRY_BLADE2, 1); st.giveItems(SENTRY_BLADE3, 1); st.setCond(2, true); htmltext = "30360-01.html"; - } - else if (st.isCond(2)) - { + } else if (st.isCond(2)) { htmltext = "30360-02.html"; } break; } case ROSELYN: - case KRISTIN: - { - if (st.isCond(3) && st.hasQuestItems(SENTRIES.get(npc.getId()))) - { + case KRISTIN: { + if (st.isCond(3) && st.hasQuestItems(SENTRIES.get(npc.getId()))) { st.takeItems(SENTRIES.get(npc.getId()), -1); st.giveItems(OLD_BRONZE_SWORD, 1); - if (st.getQuestItemsCount(OLD_BRONZE_SWORD) >= 2) - { + if (st.getQuestItemsCount(OLD_BRONZE_SWORD) >= 2) { st.setCond(4, true); } htmltext = npc.getId() + "-01.html"; - } - else if (!st.hasQuestItems(SENTRIES.get(npc.getId())) && st.hasQuestItems(OLD_BRONZE_SWORD)) - { + } else if (!st.hasQuestItems(SENTRIES.get(npc.getId())) && st.hasQuestItems(OLD_BRONZE_SWORD)) { htmltext = npc.getId() + "-02.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00169_OffspringOfNightmares/Q00169_OffspringOfNightmares.java b/src/main/java/com/l2jserver/datapack/quests/Q00169_OffspringOfNightmares/Q00169_OffspringOfNightmares.java index 0be89d1660..8f976892f8 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00169_OffspringOfNightmares/Q00169_OffspringOfNightmares.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00169_OffspringOfNightmares/Q00169_OffspringOfNightmares.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.network.NpcStringId; * Offspring of Nightmares (169) * @author xban1x */ -public class Q00169_OffspringOfNightmares extends Quest -{ +public class Q00169_OffspringOfNightmares extends Quest { // NPC private static final int VLASTY = 30145; // Monsters @@ -45,8 +44,7 @@ public class Q00169_OffspringOfNightmares extends Quest // Misc private static final int MIN_LVL = 15; - public Q00169_OffspringOfNightmares() - { + public Q00169_OffspringOfNightmares() { super(169, Q00169_OffspringOfNightmares.class.getSimpleName(), "Offspring of Nightmares"); addStartNpc(VLASTY); addTalkId(VLASTY); @@ -55,24 +53,18 @@ public class Q00169_OffspringOfNightmares extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st != null) - { - switch (event) - { - case "30145-03.htm": - { + if (st != null) { + switch (event) { + case "30145-03.htm": { st.startQuest(); htmltext = event; break; } - case "30145-07.html": - { - if (st.isCond(2) && st.hasQuestItems(PERFECT_SKULL)) - { + case "30145-07.html": { + if (st.isCond(2) && st.hasQuestItems(PERFECT_SKULL)) { st.giveItems(BONE_GAITERS, 1); st.addExpAndSp(17475, 818); st.giveAdena(17030 + (10 * st.getQuestItemsCount(CRACKED_SKULL)), true); @@ -88,18 +80,13 @@ public class Q00169_OffspringOfNightmares extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isStarted()) - { - if ((getRandom(10) > 7) && !st.hasQuestItems(PERFECT_SKULL)) - { + if ((st != null) && st.isStarted()) { + if ((getRandom(10) > 7) && !st.hasQuestItems(PERFECT_SKULL)) { st.giveItems(PERFECT_SKULL, 1); st.setCond(2, true); - } - else if (getRandom(10) > 4) - { + } else if (getRandom(10) > 4) { st.giveItems(CRACKED_SKULL, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -108,35 +95,25 @@ public class Q00169_OffspringOfNightmares extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getRace() == Race.DARK_ELF) ? (player.getLevel() >= MIN_LVL) ? "30145-02.htm" : "30145-01.htm" : "30145-00.htm"; break; } - case State.STARTED: - { - if (st.hasQuestItems(CRACKED_SKULL) && !st.hasQuestItems(PERFECT_SKULL)) - { + case State.STARTED: { + if (st.hasQuestItems(CRACKED_SKULL) && !st.hasQuestItems(PERFECT_SKULL)) { htmltext = "30145-05.html"; - } - else if (st.isCond(2) && st.hasQuestItems(PERFECT_SKULL)) - { + } else if (st.isCond(2) && st.hasQuestItems(PERFECT_SKULL)) { htmltext = "30145-06.html"; - } - else if (!st.hasQuestItems(CRACKED_SKULL, PERFECT_SKULL)) - { + } else if (!st.hasQuestItems(CRACKED_SKULL, PERFECT_SKULL)) { htmltext = "30145-04.html"; } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00170_DangerousSeduction/Q00170_DangerousSeduction.java b/src/main/java/com/l2jserver/datapack/quests/Q00170_DangerousSeduction/Q00170_DangerousSeduction.java index 0cbac68dd1..ff91e85691 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00170_DangerousSeduction/Q00170_DangerousSeduction.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00170_DangerousSeduction/Q00170_DangerousSeduction.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * Dangerous Seduction (170) * @author malyelfik */ -public class Q00170_DangerousSeduction extends Quest -{ +public class Q00170_DangerousSeduction extends Quest { // NPC private static final int VELLIOR = 30305; @@ -46,8 +45,7 @@ public class Q00170_DangerousSeduction extends Quest // Misc private static final int MIN_LEVEL = 21; - public Q00170_DangerousSeduction() - { + public Q00170_DangerousSeduction() { super(170, Q00170_DangerousSeduction.class.getSimpleName(), "Dangerous Seduction"); addStartNpc(VELLIOR); addTalkId(VELLIOR); @@ -57,16 +55,13 @@ public class Q00170_DangerousSeduction extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } - if (event.equalsIgnoreCase("30305-04.htm")) - { + if (event.equalsIgnoreCase("30305-04.htm")) { st.startQuest(); return event; } @@ -74,11 +69,9 @@ public class Q00170_DangerousSeduction extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isCond(1)) - { + if ((st != null) && st.isCond(1)) { st.setCond(2, true); st.giveItems(NIGHTMARE_CRYSTAL, 1); npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.SEND_MY_SOUL_TO_LICH_KING_ICARUS)); @@ -87,22 +80,17 @@ public class Q00170_DangerousSeduction extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getRace() == Race.DARK_ELF) ? (player.getLevel() >= MIN_LEVEL) ? "30305-01.htm" : "30305-02.htm" : "30305-03.htm"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "30305-05.html"; - } - else - { + } else { st.giveAdena(102680, true); st.addExpAndSp(38607, 4018); st.exitQuest(false, true); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00171_ActsOfEvil/Q00171_ActsOfEvil.java b/src/main/java/com/l2jserver/datapack/quests/Q00171_ActsOfEvil/Q00171_ActsOfEvil.java index 449983b5e7..b2e79a73c3 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00171_ActsOfEvil/Q00171_ActsOfEvil.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00171_ActsOfEvil/Q00171_ActsOfEvil.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.util.Util; * Acts Of Evil (171) * @author ivantotov */ -public final class Q00171_ActsOfEvil extends Quest -{ +public final class Q00171_ActsOfEvil extends Quest { // NPCs private final static int TRADER_ARODIN = 30207; private static final int GUARD_ALVAH = 30381; @@ -67,8 +66,7 @@ public final class Q00171_ActsOfEvil extends Quest // Misc private static final int MIN_LEVEL = 27; - public Q00171_ActsOfEvil() - { + public Q00171_ActsOfEvil() { super(171, Q00171_ActsOfEvil.class.getSimpleName(), "Acts Of Evil"); addStartNpc(GUARD_ALVAH); addTalkId(GUARD_ALVAH, TRADER_ARODIN, TYRA, NETI, TRADER_ROLENTO, TUREK_CHIEF_BURAI); @@ -78,12 +76,9 @@ public final class Q00171_ActsOfEvil extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if ("DESPAWN".equals(event)) - { - if (npc != null) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if ("DESPAWN".equals(event)) { + if (npc != null) { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.YOU_SHOULD_CONSIDER_GOING_BACK)); npc.deleteMe(); } @@ -91,40 +86,33 @@ public final class Q00171_ActsOfEvil extends Quest } final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "30381-03.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "30381-03.htm": { + if (qs.isCreated()) { qs.startQuest(); qs.setMemoState(1); htmltext = event; } break; } - case "30381-07.html": - { + case "30381-07.html": { qs.setMemoState(5); qs.setCond(5, true); htmltext = event; break; } - case "30381-12.html": - { + case "30381-12.html": { qs.setMemoState(7); qs.setCond(7, true); htmltext = event; break; } - case "30437-04.html": - { + case "30437-04.html": { takeItems(player, WEAPONS_TRADE_CONTRACT, 1); giveItems(player, CERTIFICATE_OF_THE_SILVER_GUILD, 1); giveItems(player, ROLENTOS_CARGOBOX, 1); @@ -137,13 +125,11 @@ public final class Q00171_ActsOfEvil extends Quest case "30437-02.html": case "30437-03.html": case "30617-03.html": - case "30617-04.html": - { + case "30617-04.html": { htmltext = event; break; } - case "30617-05.html": - { + case "30617-05.html": { takeItems(player, ATTACK_DIRECTIVES, 1); takeItems(player, CERTIFICATE_OF_THE_SILVER_GUILD, 1); takeItems(player, ROLENTOS_CARGOBOX, 1); @@ -157,43 +143,28 @@ public final class Q00171_ActsOfEvil extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { case TUMRAN_BUGBEAR: - case TUMRAN_BUGBEAR_WARRIOR: - { - if (qs.isMemoState(5)) - { - if (!hasQuestItems(killer, RANGERS_REPORT1)) - { + case TUMRAN_BUGBEAR_WARRIOR: { + if (qs.isMemoState(5)) { + if (!hasQuestItems(killer, RANGERS_REPORT1)) { giveItems(killer, RANGERS_REPORT1, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); - } - else if (hasQuestItems(killer, RANGERS_REPORT1) && !hasQuestItems(killer, RANGERS_REPORT2)) - { - if (getRandom(100) <= 19) - { + } else if (hasQuestItems(killer, RANGERS_REPORT1) && !hasQuestItems(killer, RANGERS_REPORT2)) { + if (getRandom(100) <= 19) { giveItems(killer, RANGERS_REPORT2, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } - } - else if (hasQuestItems(killer, RANGERS_REPORT1, RANGERS_REPORT2) && !hasQuestItems(killer, RANGERS_REPORT3)) - { - if (getRandom(100) <= 19) - { + } else if (hasQuestItems(killer, RANGERS_REPORT1, RANGERS_REPORT2) && !hasQuestItems(killer, RANGERS_REPORT3)) { + if (getRandom(100) <= 19) { giveItems(killer, RANGERS_REPORT3, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } - } - else if (hasQuestItems(killer, RANGERS_REPORT1, RANGERS_REPORT2, RANGERS_REPORT3) && !hasQuestItems(killer, RANGERS_REPORT4)) - { - if (getRandom(100) <= 19) - { + } else if (hasQuestItems(killer, RANGERS_REPORT1, RANGERS_REPORT2, RANGERS_REPORT3) && !hasQuestItems(killer, RANGERS_REPORT4)) { + if (getRandom(100) <= 19) { giveItems(killer, RANGERS_REPORT4, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -201,38 +172,27 @@ public final class Q00171_ActsOfEvil extends Quest } break; } - case OL_MAHUM_CAPTAIN: - { - if (qs.isMemoState(10) && (getQuestItemsCount(killer, OL_MAHUM_CAPTAINS_HEAD) < 30)) - { - if (getRandom(100) <= 49) - { + case OL_MAHUM_CAPTAIN: { + if (qs.isMemoState(10) && (getQuestItemsCount(killer, OL_MAHUM_CAPTAINS_HEAD) < 30)) { + if (getRandom(100) <= 49) { giveItems(killer, OL_MAHUM_CAPTAINS_HEAD, 1); - if (getQuestItemsCount(killer, OL_MAHUM_CAPTAINS_HEAD) == 30) - { + if (getQuestItemsCount(killer, OL_MAHUM_CAPTAINS_HEAD) == 30) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case OL_MAHUM_GENERAL: - { - if (qs.isMemoState(6)) - { - if (getRandom(100) <= 9) - { - if (!hasQuestItems(killer, WEAPONS_TRADE_CONTRACT)) - { + case OL_MAHUM_GENERAL: { + if (qs.isMemoState(6)) { + if (getRandom(100) <= 9) { + if (!hasQuestItems(killer, WEAPONS_TRADE_CONTRACT)) { giveItems(killer, WEAPONS_TRADE_CONTRACT, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } - if (!hasQuestItems(killer, ATTACK_DIRECTIVES)) - { + if (!hasQuestItems(killer, ATTACK_DIRECTIVES)) { giveItems(killer, ATTACK_DIRECTIVES, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -240,120 +200,84 @@ public final class Q00171_ActsOfEvil extends Quest } break; } - case TUREK_ORC_ARCHER: - { - if (qs.isMemoState(2) && (getQuestItemsCount(killer, BLADE_MOLD) < 20)) - { - if (getRandom(100) < 53) - { + case TUREK_ORC_ARCHER: { + if (qs.isMemoState(2) && (getQuestItemsCount(killer, BLADE_MOLD) < 20)) { + if (getRandom(100) < 53) { giveItems(killer, BLADE_MOLD, 1); - if (getQuestItemsCount(killer, BLADE_MOLD) == 20) - { + if (getQuestItemsCount(killer, BLADE_MOLD) == 20) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } - if (getQuestItemsCount(killer, BLADE_MOLD) == 5) - { + if (getQuestItemsCount(killer, BLADE_MOLD) == 5) { addAttackDesire(addSpawn(OL_MAHUM_SUPPORT_TROOP, npc, true, 0, false), killer); } - if (getQuestItemsCount(killer, BLADE_MOLD) >= 10) - { - if (getRandom(100) <= 24) - { + if (getQuestItemsCount(killer, BLADE_MOLD) >= 10) { + if (getRandom(100) <= 24) { addAttackDesire(addSpawn(OL_MAHUM_SUPPORT_TROOP, npc, true, 0, false), killer); } } } break; } - case TUREK_ORC_SKIRMISHER: - { - if (qs.isMemoState(2) && (getQuestItemsCount(killer, BLADE_MOLD) < 20)) - { - if (getRandom(100) < 55) - { + case TUREK_ORC_SKIRMISHER: { + if (qs.isMemoState(2) && (getQuestItemsCount(killer, BLADE_MOLD) < 20)) { + if (getRandom(100) < 55) { giveItems(killer, BLADE_MOLD, 1); - if (getQuestItemsCount(killer, BLADE_MOLD) == 20) - { + if (getQuestItemsCount(killer, BLADE_MOLD) == 20) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } - if (getQuestItemsCount(killer, BLADE_MOLD) == 5) - { + if (getQuestItemsCount(killer, BLADE_MOLD) == 5) { addAttackDesire(addSpawn(OL_MAHUM_SUPPORT_TROOP, npc, true, 0, false), killer); } - if (getQuestItemsCount(killer, BLADE_MOLD) >= 10) - { - if (getRandom(100) <= 24) - { + if (getQuestItemsCount(killer, BLADE_MOLD) >= 10) { + if (getRandom(100) <= 24) { addAttackDesire(addSpawn(OL_MAHUM_SUPPORT_TROOP, npc, true, 0, false), killer); } } } break; } - case TUREK_ORC_SUPPLIER: - { - if (qs.isMemoState(2) && (getQuestItemsCount(killer, BLADE_MOLD) < 20)) - { - if (getRandom(100) < 51) - { + case TUREK_ORC_SUPPLIER: { + if (qs.isMemoState(2) && (getQuestItemsCount(killer, BLADE_MOLD) < 20)) { + if (getRandom(100) < 51) { giveItems(killer, BLADE_MOLD, 1); - if (getQuestItemsCount(killer, BLADE_MOLD) == 20) - { + if (getQuestItemsCount(killer, BLADE_MOLD) == 20) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } - if (getQuestItemsCount(killer, BLADE_MOLD) == 5) - { + if (getQuestItemsCount(killer, BLADE_MOLD) == 5) { addAttackDesire(addSpawn(OL_MAHUM_SUPPORT_TROOP, npc, true, 0, false), killer); } - if (getQuestItemsCount(killer, BLADE_MOLD) >= 10) - { - if (getRandom(100) <= 24) - { + if (getQuestItemsCount(killer, BLADE_MOLD) >= 10) { + if (getRandom(100) <= 24) { addAttackDesire(addSpawn(OL_MAHUM_SUPPORT_TROOP, npc, true, 0, false), killer); } } } break; } - case TUREK_ORC_FOOTMAN: - { - if (qs.isMemoState(2) && (getQuestItemsCount(killer, BLADE_MOLD) < 20)) - { - if (getRandom(2) < 1) - { + case TUREK_ORC_FOOTMAN: { + if (qs.isMemoState(2) && (getQuestItemsCount(killer, BLADE_MOLD) < 20)) { + if (getRandom(2) < 1) { giveItems(killer, BLADE_MOLD, 1); - if (getQuestItemsCount(killer, BLADE_MOLD) == 20) - { + if (getQuestItemsCount(killer, BLADE_MOLD) == 20) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } - if (getQuestItemsCount(killer, BLADE_MOLD) == 5) - { + if (getQuestItemsCount(killer, BLADE_MOLD) == 5) { addAttackDesire(addSpawn(OL_MAHUM_SUPPORT_TROOP, npc, true, 0, false), killer); } - if (getQuestItemsCount(killer, BLADE_MOLD) >= 10) - { - if (getRandom(100) <= 24) - { + if (getQuestItemsCount(killer, BLADE_MOLD) >= 10) { + if (getRandom(100) <= 24) { addAttackDesire(addSpawn(OL_MAHUM_SUPPORT_TROOP, npc, true, 0, false), killer); } } @@ -366,53 +290,37 @@ public final class Q00171_ActsOfEvil extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); final int memoState = qs.getMemoState(); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == GUARD_ALVAH) - { - if (player.getLevel() < MIN_LEVEL) - { + if (qs.isCreated()) { + if (npc.getId() == GUARD_ALVAH) { + if (player.getLevel() < MIN_LEVEL) { htmltext = "30381-01.htm"; - } - else - { + } else { htmltext = "30381-02.htm"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case GUARD_ALVAH: - { - switch (qs.getCond()) - { - case 1: - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case GUARD_ALVAH: { + switch (qs.getCond()) { + case 1: { htmltext = "30381-04.html"; break; } case 2: - case 3: - { + case 3: { htmltext = "30381-05.html"; break; } - case 4: - { + case 4: { htmltext = "30381-06.html"; break; } - case 5: - { - if (hasQuestItems(player, RANGERS_REPORT1, RANGERS_REPORT2, RANGERS_REPORT3, RANGERS_REPORT4)) - { + case 5: { + if (hasQuestItems(player, RANGERS_REPORT1, RANGERS_REPORT2, RANGERS_REPORT3, RANGERS_REPORT4)) { takeItems(player, RANGERS_REPORT1, 1); takeItems(player, RANGERS_REPORT2, 1); takeItems(player, RANGERS_REPORT3, 1); @@ -420,47 +328,36 @@ public final class Q00171_ActsOfEvil extends Quest qs.setMemoState(6); qs.setCond(6, true); htmltext = "30381-09.html"; - } - else - { + } else { htmltext = "30381-08.html"; } break; } - case 6: - { - if (hasQuestItems(player, WEAPONS_TRADE_CONTRACT, ATTACK_DIRECTIVES)) - { + case 6: { + if (hasQuestItems(player, WEAPONS_TRADE_CONTRACT, ATTACK_DIRECTIVES)) { htmltext = "30381-11.html"; - } - else - { + } else { htmltext = "30381-10.html"; } break; } - case 7: - { + case 7: { htmltext = "30381-13.html"; break; } - case 8: - { + case 8: { htmltext = "30381-14.html"; break; } - case 9: - { + case 9: { htmltext = "30381-15.html"; break; } - case 10: - { + case 10: { htmltext = "30381-16.html"; break; } - case 11: - { + case 11: { giveAdena(player, 95000, true); addExpAndSp(player, 159820, 9182); htmltext = "30381-17.html"; @@ -470,136 +367,90 @@ public final class Q00171_ActsOfEvil extends Quest } break; } - case TRADER_ARODIN: - { - if (memoState == 1) - { + case TRADER_ARODIN: { + if (memoState == 1) { qs.setMemoState(2); qs.setCond(2, true); htmltext = "30207-01.html"; - } - else if (memoState == 2) - { - if (getQuestItemsCount(player, BLADE_MOLD) < 20) - { + } else if (memoState == 2) { + if (getQuestItemsCount(player, BLADE_MOLD) < 20) { htmltext = "30207-02.html"; - } - else - { + } else { htmltext = "30207-03.html"; } - } - else if (memoState == 3) - { + } else if (memoState == 3) { takeItems(player, TYRAS_BILL, 1); qs.setMemoState(4); qs.setCond(4, true); htmltext = "30207-04.html"; - } - else if (memoState >= 4) - { + } else if (memoState >= 4) { htmltext = "30207-05.html"; } break; } - case TYRA: - { - if (memoState == 2) - { - if (getQuestItemsCount(player, BLADE_MOLD) < 20) - { + case TYRA: { + if (memoState == 2) { + if (getQuestItemsCount(player, BLADE_MOLD) < 20) { htmltext = "30420-01.html"; - } - else - { + } else { takeItems(player, BLADE_MOLD, -1); giveItems(player, TYRAS_BILL, 1); qs.setMemoState(3); qs.setCond(3, true); htmltext = "30420-02.html"; } - } - else if (memoState == 3) - { + } else if (memoState == 3) { htmltext = "30420-03.html"; - } - else if (memoState >= 4) - { + } else if (memoState >= 4) { htmltext = "30420-04.html"; } break; } - case NETI: - { - if (memoState == 7) - { + case NETI: { + if (memoState == 7) { qs.setMemoState(8); qs.setCond(8, true); htmltext = "30425-01.html"; - } - else if (memoState == 8) - { + } else if (memoState == 8) { htmltext = "30425-02.html"; - } - else if (memoState >= 9) - { + } else if (memoState >= 9) { htmltext = "30425-03.html"; } break; } - case TRADER_ROLENTO: - { - if (memoState == 8) - { + case TRADER_ROLENTO: { + if (memoState == 8) { htmltext = "30437-02.html"; - } - else if (memoState == 9) - { + } else if (memoState == 9) { htmltext = "30437-05.html"; - } - else if (memoState >= 10) - { + } else if (memoState >= 10) { htmltext = "30437-06.html"; } break; } - case TUREK_CHIEF_BURAI: - { - if (memoState < 9) - { + case TUREK_CHIEF_BURAI: { + if (memoState < 9) { htmltext = "30617-01.html"; - } - else if (memoState == 9) - { + } else if (memoState == 9) { htmltext = "30617-02.html"; - } - else if (memoState == 10) - { - if (getQuestItemsCount(player, OL_MAHUM_CAPTAINS_HEAD) < 30) - { + } else if (memoState == 10) { + if (getQuestItemsCount(player, OL_MAHUM_CAPTAINS_HEAD) < 30) { htmltext = "30617-06.html"; - } - else - { + } else { giveAdena(player, 8000, true); takeItems(player, OL_MAHUM_CAPTAINS_HEAD, -1); qs.setMemoState(11); qs.setCond(11, true); htmltext = "30617-07.html"; } - } - else if (memoState == 11) - { + } else if (memoState == 11) { htmltext = "30617-08.html"; } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == GUARD_ALVAH) - { + } else if (qs.isCompleted()) { + if (npc.getId() == GUARD_ALVAH) { htmltext = getAlreadyCompletedMsg(player); } } @@ -607,8 +458,7 @@ public final class Q00171_ActsOfEvil extends Quest } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { startQuestTimer("DESPAWN", 200000, npc, null); return super.onSpawn(npc); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00172_NewHorizons/Q00172_NewHorizons.java b/src/main/java/com/l2jserver/datapack/quests/Q00172_NewHorizons/Q00172_NewHorizons.java index 9c7b0d2662..b01b13a814 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00172_NewHorizons/Q00172_NewHorizons.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00172_NewHorizons/Q00172_NewHorizons.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * New Horizons (172) * @author malyelfik */ -public class Q00172_NewHorizons extends Quest -{ +public class Q00172_NewHorizons extends Quest { // NPCs private static final int ZENYA = 32140; private static final int RAGARA = 32163; @@ -42,25 +41,21 @@ public class Q00172_NewHorizons extends Quest // Misc private static final int MIN_LEVEL = 3; - public Q00172_NewHorizons() - { + public Q00172_NewHorizons() { super(172, Q00172_NewHorizons.class.getSimpleName(), "New Horizons"); addStartNpc(ZENYA); addTalkId(ZENYA, RAGARA); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "32140-04.htm": st.startQuest(); break; @@ -77,15 +72,12 @@ public class Q00172_NewHorizons extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case ZENYA: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getRace() == Race.KAMAEL) ? (player.getLevel() >= MIN_LEVEL) ? "32140-01.htm" : "32140-02.htm" : "32140-03.htm"; break; @@ -98,8 +90,7 @@ public class Q00172_NewHorizons extends Quest } break; case RAGARA: - if (st.isStarted()) - { + if (st.isStarted()) { htmltext = "32163-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00173_ToTheIsleOfSouls/Q00173_ToTheIsleOfSouls.java b/src/main/java/com/l2jserver/datapack/quests/Q00173_ToTheIsleOfSouls/Q00173_ToTheIsleOfSouls.java index 6ff30a80a8..3299354eae 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00173_ToTheIsleOfSouls/Q00173_ToTheIsleOfSouls.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00173_ToTheIsleOfSouls/Q00173_ToTheIsleOfSouls.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.State; * To the Isle of Souls (173) * @author malyelfik */ -public class Q00173_ToTheIsleOfSouls extends Quest -{ +public class Q00173_ToTheIsleOfSouls extends Quest { // NPCs private static final int GALLADUCCI = 30097; private static final int GENTLER = 30094; @@ -42,8 +41,7 @@ public class Q00173_ToTheIsleOfSouls extends Quest private static final int MARK_OF_TRAVELER = 7570; private static final int SCROLL_OF_ESCAPE_KAMAEL_VILLAGE = 9716; - public Q00173_ToTheIsleOfSouls() - { + public Q00173_ToTheIsleOfSouls() { super(173, Q00173_ToTheIsleOfSouls.class.getSimpleName(), "To the Isle of Souls"); addStartNpc(GALLADUCCI); addTalkId(GALLADUCCI, GENTLER); @@ -52,17 +50,14 @@ public class Q00173_ToTheIsleOfSouls extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "30097-03.htm": st.startQuest(); st.giveItems(GALLADUCCIS_ORDER, 1); @@ -85,15 +80,12 @@ public class Q00173_ToTheIsleOfSouls extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case GALLADUCCI: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.hasQuestCompleted(Q00172_NewHorizons.class.getSimpleName()) && (player.getRace() == Race.KAMAEL) && st.hasQuestItems(MARK_OF_TRAVELER)) ? "30097-01.htm" : "30097-02.htm"; break; @@ -106,8 +98,7 @@ public class Q00173_ToTheIsleOfSouls extends Quest } break; case GENTLER: - if (st.isStarted()) - { + if (st.isStarted()) { htmltext = (st.isCond(1)) ? "30094-01.html" : "30094-03.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00174_SupplyCheck/Q00174_SupplyCheck.java b/src/main/java/com/l2jserver/datapack/quests/Q00174_SupplyCheck/Q00174_SupplyCheck.java index 084231b84f..f41df73c9c 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00174_SupplyCheck/Q00174_SupplyCheck.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00174_SupplyCheck/Q00174_SupplyCheck.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.network.NpcStringId; * Supply Check (174) * @author malyelfik */ -public class Q00174_SupplyCheck extends Quest -{ +public class Q00174_SupplyCheck extends Quest { // NPCs private static final int NIKA = 32167; private static final int BENIS = 32170; @@ -39,8 +38,7 @@ public class Q00174_SupplyCheck extends Quest // Items private static final int WAREHOUSE_MANIFEST = 9792; private static final int GROCERY_STORE_MANIFEST = 9793; - private static final int[] REWARD = - { + private static final int[] REWARD = { 23, // Wooden Breastplate 43, // Wooden Helmet 49, // Gloves @@ -51,8 +49,7 @@ public class Q00174_SupplyCheck extends Quest // Misc private static final int MIN_LEVEL = 2; - public Q00174_SupplyCheck() - { + public Q00174_SupplyCheck() { super(174, Q00174_SupplyCheck.class.getSimpleName(), "Supply Check"); addStartNpc(MARCELA); addTalkId(MARCELA, BENIS, NIKA); @@ -61,16 +58,13 @@ public class Q00174_SupplyCheck extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } - if (event.equalsIgnoreCase("32173-03.htm")) - { + if (event.equalsIgnoreCase("32173-03.htm")) { st.startQuest(); return event; } @@ -78,21 +72,17 @@ public class Q00174_SupplyCheck extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case MARCELA: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? "32173-01.htm" : "32173-02.htm"; break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "32173-04.html"; break; @@ -105,8 +95,7 @@ public class Q00174_SupplyCheck extends Quest htmltext = "32173-06.html"; break; case 4: - for (int itemId : REWARD) - { + for (int itemId : REWARD) { st.giveItems(itemId, 1); } st.giveAdena(2466, true); @@ -124,10 +113,8 @@ public class Q00174_SupplyCheck extends Quest } break; case BENIS: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: st.setCond(2, true); st.giveItems(WAREHOUSE_MANIFEST, 1); @@ -143,10 +130,8 @@ public class Q00174_SupplyCheck extends Quest } break; case NIKA: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: case 2: htmltext = "32167-01.html"; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00175_TheWayOfTheWarrior/Q00175_TheWayOfTheWarrior.java b/src/main/java/com/l2jserver/datapack/quests/Q00175_TheWayOfTheWarrior/Q00175_TheWayOfTheWarrior.java index 995ff9d21d..7a90f5c916 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00175_TheWayOfTheWarrior/Q00175_TheWayOfTheWarrior.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00175_TheWayOfTheWarrior/Q00175_TheWayOfTheWarrior.java @@ -35,8 +35,7 @@ import com.l2jserver.gameserver.network.serverpackets.SocialAction; * The Way of the Warrior (175) * @author ivantotov */ -public final class Q00175_TheWayOfTheWarrior extends Quest -{ +public final class Q00175_TheWayOfTheWarrior extends Quest { // NPCs private static final int PERWAN = 32133; private static final int KEKROPUS = 32138; @@ -52,8 +51,7 @@ public final class Q00175_TheWayOfTheWarrior extends Quest // Rewards private static final int WARRIORS_SWORD = 9720; private static final ItemHolder SOULSHOTS_NO_GRADE_FOR_ROOKIES = new ItemHolder(5789, 7000); - private static final ItemHolder[] REWARDS = - { + private static final ItemHolder[] REWARDS = { new ItemHolder(1060, 100), // Lesser Healing Potion new ItemHolder(4412, 10), // Echo Crystal - Theme of Battle new ItemHolder(4413, 10), // Echo Crystal - Theme of Love @@ -63,8 +61,7 @@ public final class Q00175_TheWayOfTheWarrior extends Quest }; // Monsters private static final int MOUNTAIN_WEREWOLF = 22235; - private static final int[] MONSTERS = - { + private static final int[] MONSTERS = { 22236, // Muertos Archer 22239, // Muertos Guard 22240, // Muertos Scout @@ -74,8 +71,7 @@ public final class Q00175_TheWayOfTheWarrior extends Quest 22246, // Muertos Commander }; - public Q00175_TheWayOfTheWarrior() - { + public Q00175_TheWayOfTheWarrior() { super(175, Q00175_TheWayOfTheWarrior.class.getSimpleName(), "The Way of the Warrior"); addStartNpc(KEKROPUS); addTalkId(KEKROPUS, PERWAN); @@ -85,46 +81,36 @@ public final class Q00175_TheWayOfTheWarrior extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "32138-02.htm": - { + switch (event) { + case "32138-02.htm": { htmltext = event; break; } - case "32138-05.htm": - { - if (qs.isCreated()) - { + case "32138-05.htm": { + if (qs.isCreated()) { qs.startQuest(); qs.setMemoState(1); htmltext = event; } break; } - case "32138-10.html": - { + case "32138-10.html": { qs.setMemoState(6); qs.setCond(7, true); htmltext = event; break; } - case "32138-13.html": - { - if (hasItem(player, MUERTOS_CLAW)) - { + case "32138-13.html": { + if (hasItem(player, MUERTOS_CLAW)) { takeItem(player, MUERTOS_CLAW); giveAdena(player, 8799, true); - for (ItemHolder reward : REWARDS) - { + for (ItemHolder reward : REWARDS) { giveItems(player, reward); } giveNewbieReward(player); @@ -136,8 +122,7 @@ public final class Q00175_TheWayOfTheWarrior extends Quest } break; } - case "32133-06.html": - { + case "32133-06.html": { qs.setMemoState(5); qs.setCond(6, true); npc.setTarget(player); @@ -150,21 +135,15 @@ public final class Q00175_TheWayOfTheWarrior extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { - if (npc.getId() == MOUNTAIN_WEREWOLF) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { + if (npc.getId() == MOUNTAIN_WEREWOLF) { final QuestState qs = getRandomPartyMemberState(player, 2, 3, npc); - if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, WOLF_TAIL.getId(), 1, WOLF_TAIL.getCount(), 0.5, true)) - { + if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, WOLF_TAIL.getId(), 1, WOLF_TAIL.getCount(), 0.5, true)) { qs.setCond(3, true); } - } - else - { + } else { final QuestState qs = getRandomPartyMemberState(player, 7, 3, npc); - if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, MUERTOS_CLAW.getId(), 1, MUERTOS_CLAW.getCount(), 1.0, true)) - { + if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, MUERTOS_CLAW.getId(), 1, MUERTOS_CLAW.getCount(), 1.0, true)) { qs.setCond(8, true); } } @@ -172,102 +151,75 @@ public final class Q00175_TheWayOfTheWarrior extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (npc.getId()) - { - case KEKROPUS: - { - if (qs.isCreated()) - { - if (player.getRace() != Race.KAMAEL) - { + switch (npc.getId()) { + case KEKROPUS: { + if (qs.isCreated()) { + if (player.getRace() != Race.KAMAEL) { htmltext = "32138-04.htm"; - } - else if (player.getLevel() >= MIN_LEVEL) - { + } else if (player.getLevel() >= MIN_LEVEL) { htmltext = "32138-01.htm"; - } - else - { + } else { htmltext = "32138-03.htm"; } break; - } - else if (qs.isStarted()) - { - switch (qs.getCond()) - { + } else if (qs.isStarted()) { + switch (qs.getCond()) { case 1: case 2: - case 3: - { + case 3: { htmltext = "32138-06.html"; break; } - case 4: - { + case 4: { qs.setMemoState(4); qs.setCond(5, true); htmltext = "32138-07.html"; break; } - case 5: - { + case 5: { htmltext = "32138-08.html"; break; } - case 6: - { + case 6: { htmltext = "32138-09.html"; break; } - case 7: - { + case 7: { htmltext = "32138-11.html"; break; } - case 8: - { - if (hasItem(player, MUERTOS_CLAW)) - { + case 8: { + if (hasItem(player, MUERTOS_CLAW)) { htmltext = "32138-12.html"; } break; } } break; - } - else if (qs.isCompleted()) - { + } else if (qs.isCompleted()) { htmltext = getAlreadyCompletedMsg(player); break; } break; } - case PERWAN: - { - switch (qs.getCond()) - { - case 1: - { + case PERWAN: { + switch (qs.getCond()) { + case 1: { qs.setMemoState(2); qs.setCond(2, true); htmltext = "32133-01.html"; break; } - case 2: - { + case 2: { htmltext = "32133-02.html"; break; } - case 3: - { - if (hasItem(player, WOLF_TAIL)) - { + case 3: { + if (hasItem(player, WOLF_TAIL)) { takeItem(player, WOLF_TAIL); qs.setMemoState(3); qs.setCond(4, true); @@ -275,18 +227,15 @@ public final class Q00175_TheWayOfTheWarrior extends Quest } break; } - case 4: - { + case 4: { htmltext = "32133-04.html"; break; } - case 5: - { + case 5: { htmltext = "32133-05.html"; break; } - case 6: - { + case 6: { htmltext = "32133-07.html"; break; } @@ -297,22 +246,17 @@ public final class Q00175_TheWayOfTheWarrior extends Quest return htmltext; } - public static final void giveNewbieReward(L2PcInstance player) - { + public static final void giveNewbieReward(L2PcInstance player) { final PlayerVariables vars = player.getVariables(); - if ((player.getLevel() < 25) && !vars.getBoolean("NEWBIE_SHOTS", false)) - { + if ((player.getLevel() < 25) && !vars.getBoolean("NEWBIE_SHOTS", false)) { playSound(player, Voice.TUTORIAL_VOICE_026_1000); giveItems(player, SOULSHOTS_NO_GRADE_FOR_ROOKIES); vars.set("NEWBIE_SHOTS", true); } - if (vars.getString("GUIDE_MISSION", null) == null) - { + if (vars.getString("GUIDE_MISSION", null) == null) { vars.set("GUIDE_MISSION", 100000); player.sendPacket(MESSAGE); - } - else if (((vars.getInt("GUIDE_MISSION") % 1000000) / 100000) != 1) - { + } else if (((vars.getInt("GUIDE_MISSION") % 1000000) / 100000) != 1) { vars.set("GUIDE_MISSION", vars.getInt("GUIDE_MISSION") + 100000); player.sendPacket(MESSAGE); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00176_StepsForHonor/Q00176_StepsForHonor.java b/src/main/java/com/l2jserver/datapack/quests/Q00176_StepsForHonor/Q00176_StepsForHonor.java index 87f74bf3ff..881cca7391 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00176_StepsForHonor/Q00176_StepsForHonor.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00176_StepsForHonor/Q00176_StepsForHonor.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * Steps for Honor (176) * @author malyelfik */ -public class Q00176_StepsForHonor extends Quest -{ +public class Q00176_StepsForHonor extends Quest { // NPC private static final int RAPIDUS = 36479; // Item @@ -38,19 +37,16 @@ public class Q00176_StepsForHonor extends Quest // Misc private static final int MIN_LEVEL = 80; - public Q00176_StepsForHonor() - { + public Q00176_StepsForHonor() { super(176, Q00176_StepsForHonor.class.getSimpleName(), "Steps for Honor"); addStartNpc(RAPIDUS); addTalkId(RAPIDUS); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && event.equalsIgnoreCase("36479-04.html")) - { + if ((st != null) && event.equalsIgnoreCase("36479-04.html")) { st.startQuest(); return event; } @@ -58,22 +54,18 @@ public class Q00176_StepsForHonor extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? "36479-03.html" : "36479-02.html"; break; case State.STARTED: - if (TerritoryWarManager.getInstance().isTWInProgress()) - { + if (TerritoryWarManager.getInstance().isTWInProgress()) { return "36479-05.html"; } - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "36479-06.html"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00178_IconicTrinity/Q00178_IconicTrinity.java b/src/main/java/com/l2jserver/datapack/quests/Q00178_IconicTrinity/Q00178_IconicTrinity.java index 106f79fc39..06660caf97 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00178_IconicTrinity/Q00178_IconicTrinity.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00178_IconicTrinity/Q00178_IconicTrinity.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Iconic Trinity (178) * @author ivantotov */ -public final class Q00178_IconicTrinity extends Quest -{ +public final class Q00178_IconicTrinity extends Quest { // NPCs private static final int HIERARCH_KEKROPUS = 32138; private static final int ICON_OF_THE_PAST = 32255; @@ -42,29 +41,23 @@ public final class Q00178_IconicTrinity extends Quest private static final int MIN_LEVEL = 17; private static final int TWENTY_LEVEL = 20; - public Q00178_IconicTrinity() - { + public Q00178_IconicTrinity() { super(178, Q00178_IconicTrinity.class.getSimpleName(), "Iconic Trinity"); addStartNpc(HIERARCH_KEKROPUS); addTalkId(HIERARCH_KEKROPUS, ICON_OF_THE_PAST, ICON_OF_THE_PRESENT, ICON_OF_THE_FUTURE); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "32138-05.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "32138-05.htm": { + if (qs.isCreated()) { qs.startQuest(); qs.setMemoState(1); htmltext = event; @@ -74,16 +67,13 @@ public final class Q00178_IconicTrinity extends Quest case "32255-11.html": case "32256-11.html": case "32256-12.html": - case "32256-13.html": - { + case "32256-13.html": { htmltext = getHtm(player.getHtmlPrefix(), event); htmltext = htmltext.replaceAll("%name1%", player.getName()); break; } - case "32138-14.htm": - { - if ((qs.isMemoState(10) && (player.getLevel() <= TWENTY_LEVEL) && (player.getClassId() == ClassId.maleSoldier)) || (player.getClassId() == ClassId.femaleSoldier)) - { + case "32138-14.htm": { + if ((qs.isMemoState(10) && (player.getLevel() <= TWENTY_LEVEL) && (player.getClassId() == ClassId.maleSoldier)) || (player.getClassId() == ClassId.femaleSoldier)) { giveItems(player, SCROLL_ENCHANT_ARMOR_D_GRADE, 1); addExpAndSp(player, 20123, 976); qs.exitQuest(false, true); @@ -91,85 +81,66 @@ public final class Q00178_IconicTrinity extends Quest } break; } - case "32138-17.html": - { - if ((qs.isMemoState(10) && (player.getLevel() > TWENTY_LEVEL) && (player.getClassId() != ClassId.maleSoldier)) || (player.getClassId() != ClassId.femaleSoldier)) - { + case "32138-17.html": { + if ((qs.isMemoState(10) && (player.getLevel() > TWENTY_LEVEL) && (player.getClassId() != ClassId.maleSoldier)) || (player.getClassId() != ClassId.femaleSoldier)) { giveItems(player, SCROLL_ENCHANT_ARMOR_D_GRADE, 1); qs.exitQuest(false, true); htmltext = event; } break; } - case "32255-02.html": - { - if (qs.isMemoState(1)) - { + case "32255-02.html": { + if (qs.isMemoState(1)) { qs.setMemoState(2); htmltext = event; } break; } - case "32255-03.html": - { - if (qs.isMemoState(2)) - { + case "32255-03.html": { + if (qs.isMemoState(2)) { qs.setMemoStateEx(1, 0); htmltext = event; } break; } - case "PASS1_1": - { - if (qs.isMemoState(2)) - { + case "PASS1_1": { + if (qs.isMemoState(2)) { final int i0 = qs.getMemoStateEx(1); qs.setMemoStateEx(1, i0 + 1); htmltext = "32255-04.html"; } break; } - case "PASS1_2": - { - if (qs.isMemoState(2)) - { + case "PASS1_2": { + if (qs.isMemoState(2)) { final int i0 = qs.getMemoStateEx(1); qs.setMemoStateEx(1, i0 + 10); htmltext = "32255-05.html"; } break; } - case "PASS1_3": - { - if (qs.isMemoState(2)) - { + case "PASS1_3": { + if (qs.isMemoState(2)) { final int i0 = qs.getMemoStateEx(1); qs.setMemoStateEx(1, i0 + 100); htmltext = "32255-06.html"; } break; } - case "PASS1_4": - { - if (qs.isMemoState(2)) - { - if (qs.getMemoStateEx(1) == 111) - { + case "PASS1_4": { + if (qs.isMemoState(2)) { + if (qs.getMemoStateEx(1) == 111) { qs.setMemoState(3); qs.setMemoStateEx(1, 0); htmltext = "32255-07.html"; - } - else if (qs.getMemoStateEx(1) != 111) - { + } else if (qs.getMemoStateEx(1) != 111) { htmltext = "32255-08.html"; } } break; } - case "32255-13.html": - { - if (qs.isMemoState(3)) - { + case "32255-13.html": { + if (qs.isMemoState(3)) { qs.setMemoState(4); qs.setCond(2, true); htmltext = getHtm(player.getHtmlPrefix(), event); @@ -177,75 +148,58 @@ public final class Q00178_IconicTrinity extends Quest } break; } - case "32256-02.html": - { - if (qs.isMemoState(4)) - { + case "32256-02.html": { + if (qs.isMemoState(4)) { qs.setMemoState(5); htmltext = event; } break; } - case "32256-03.html": - { - if (qs.isMemoState(5)) - { + case "32256-03.html": { + if (qs.isMemoState(5)) { qs.setMemoStateEx(1, 0); htmltext = event; } break; } - case "PASS2_1": - { - if (qs.isMemoState(5)) - { + case "PASS2_1": { + if (qs.isMemoState(5)) { final int i0 = qs.getMemoStateEx(1); qs.setMemoStateEx(1, i0 + 1); htmltext = "32256-04.html"; } break; } - case "PASS2_2": - { - if (qs.isMemoState(5)) - { + case "PASS2_2": { + if (qs.isMemoState(5)) { final int i0 = qs.getMemoStateEx(1); qs.setMemoStateEx(1, i0 + 10); htmltext = "32256-05.html"; } break; } - case "PASS2_3": - { - if (qs.isMemoState(5)) - { + case "PASS2_3": { + if (qs.isMemoState(5)) { final int i0 = qs.getMemoStateEx(1); qs.setMemoStateEx(1, i0 + 100); htmltext = "32256-06.html"; } break; } - case "PASS2_4": - { - if (qs.isMemoState(5)) - { - if (qs.getMemoStateEx(1) == 111) - { + case "PASS2_4": { + if (qs.isMemoState(5)) { + if (qs.getMemoStateEx(1) == 111) { qs.setMemoState(6); qs.setMemoStateEx(1, 0); htmltext = "32256-07.html"; - } - else if (qs.getMemoStateEx(1) != 111) - { + } else if (qs.getMemoStateEx(1) != 111) { htmltext = "32256-08.html"; } } break; } - case "32256-14.html": - { - if (qs.isMemoState(6)) - { + case "32256-14.html": { + if (qs.isMemoState(6)) { qs.setMemoState(7); qs.setCond(3, true); htmltext = getHtm(player.getHtmlPrefix(), event); @@ -253,85 +207,66 @@ public final class Q00178_IconicTrinity extends Quest } break; } - case "32257-02.html": - { - if (qs.isMemoState(7)) - { + case "32257-02.html": { + if (qs.isMemoState(7)) { qs.setMemoState(8); htmltext = event; } break; } - case "32257-03.html": - { - if (qs.isMemoState(8)) - { + case "32257-03.html": { + if (qs.isMemoState(8)) { qs.setMemoStateEx(1, 0); htmltext = event; } break; } - case "PASS3_1": - { - if (qs.isMemoState(8)) - { + case "PASS3_1": { + if (qs.isMemoState(8)) { final int i0 = qs.getMemoStateEx(1); qs.setMemoStateEx(1, i0 + 1); htmltext = "32257-04.html"; } break; } - case "PASS3_2": - { - if (qs.isMemoState(8)) - { + case "PASS3_2": { + if (qs.isMemoState(8)) { final int i0 = qs.getMemoStateEx(1); qs.setMemoStateEx(1, i0 + 10); htmltext = "32257-05.html"; } break; } - case "PASS3_3": - { - if (qs.isMemoState(8)) - { + case "PASS3_3": { + if (qs.isMemoState(8)) { final int i0 = qs.getMemoStateEx(1); qs.setMemoStateEx(1, i0 + 100); htmltext = "32257-06.html"; } break; } - case "PASS3_4": - { - if (qs.isMemoState(8)) - { + case "PASS3_4": { + if (qs.isMemoState(8)) { final int i0 = qs.getMemoStateEx(1); qs.setMemoStateEx(1, i0 + 1000); htmltext = "32257-07.html"; } break; } - case "PASS3_5": - { - if (qs.isMemoState(8)) - { - if (qs.getMemoStateEx(1) == 1111) - { + case "PASS3_5": { + if (qs.isMemoState(8)) { + if (qs.getMemoStateEx(1) == 1111) { qs.setMemoState(9); qs.setMemoStateEx(1, 0); htmltext = "32257-08.html"; - } - else if (qs.getMemoStateEx(1) != 1111) - { + } else if (qs.getMemoStateEx(1) != 1111) { htmltext = "32257-09.html"; } } break; } - case "32257-12.html": - { - if (qs.isMemoState(9)) - { + case "32257-12.html": { + if (qs.isMemoState(9)) { qs.setMemoState(10); qs.setCond(4, true); htmltext = getHtm(player.getHtmlPrefix(), event); @@ -363,8 +298,7 @@ public final class Q00178_IconicTrinity extends Quest case "32257-08.html": case "32257-09.html": case "32257-10.html": - case "32257-11.html": - { + case "32257-11.html": { htmltext = event; break; } @@ -373,77 +307,54 @@ public final class Q00178_IconicTrinity extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == HIERARCH_KEKROPUS) - { - if (player.getRace() != Race.KAMAEL) - { + if (qs.isCreated()) { + if (npc.getId() == HIERARCH_KEKROPUS) { + if (player.getRace() != Race.KAMAEL) { htmltext = "32138-03.htm"; - } - else if (player.getLevel() >= MIN_LEVEL) - { + } else if (player.getLevel() >= MIN_LEVEL) { htmltext = "32138-01.htm"; - } - else - { + } else { htmltext = "32138-02.htm"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case HIERARCH_KEKROPUS: - { - switch (qs.getMemoState()) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case HIERARCH_KEKROPUS: { + switch (qs.getMemoState()) { case 1: - case 2: - { + case 2: { htmltext = "32138-06.html"; break; } - case 3: - { + case 3: { htmltext = "32138-07.html"; break; } case 4: - case 5: - { + case 5: { htmltext = "32138-08.html"; break; } - case 6: - { + case 6: { htmltext = "32138-09.html"; break; } case 7: - case 8: - { + case 8: { htmltext = "32138-10.html"; break; } - case 9: - { + case 9: { htmltext = "32138-11.html"; break; } - case 10: - { - if (((player.getLevel() <= TWENTY_LEVEL) && (player.getClassId() == ClassId.maleSoldier)) || (player.getClassId() == ClassId.femaleSoldier)) - { + case 10: { + if (((player.getLevel() <= TWENTY_LEVEL) && (player.getClassId() == ClassId.maleSoldier)) || (player.getClassId() == ClassId.femaleSoldier)) { htmltext = "32138-12.html"; - } - else - { + } else { htmltext = "32138-15.html"; } break; @@ -451,86 +362,68 @@ public final class Q00178_IconicTrinity extends Quest } break; } - case ICON_OF_THE_PAST: - { - switch (qs.getMemoState()) - { - case 1: - { + case ICON_OF_THE_PAST: { + switch (qs.getMemoState()) { + case 1: { htmltext = "32255-01.html"; break; } - case 2: - { + case 2: { qs.setMemoStateEx(1, 0); htmltext = "32255-03.html"; break; } - case 3: - { + case 3: { htmltext = "32255-09.html"; break; } case 4: - case 5: - { + case 5: { htmltext = "32255-14.html"; break; } } break; } - case ICON_OF_THE_PRESENT: - { - switch (qs.getMemoState()) - { - case 4: - { + case ICON_OF_THE_PRESENT: { + switch (qs.getMemoState()) { + case 4: { htmltext = "32256-01.html"; break; } - case 5: - { + case 5: { qs.setMemoStateEx(1, 0); htmltext = "32256-03.html"; break; } - case 6: - { + case 6: { htmltext = "32256-09.html"; break; } case 7: - case 8: - { + case 8: { htmltext = "32256-15.html"; break; } } break; } - case ICON_OF_THE_FUTURE: - { - switch (qs.getMemoState()) - { - case 7: - { + case ICON_OF_THE_FUTURE: { + switch (qs.getMemoState()) { + case 7: { htmltext = "32257-01.html"; break; } - case 8: - { + case 8: { qs.setMemoStateEx(1, 0); htmltext = "32257-03.html"; break; } - case 9: - { + case 9: { htmltext = "32257-10.html"; break; } - case 10: - { + case 10: { htmltext = "32257-13.html"; break; } @@ -538,11 +431,8 @@ public final class Q00178_IconicTrinity extends Quest break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == HIERARCH_KEKROPUS) - { + } else if (qs.isCompleted()) { + if (npc.getId() == HIERARCH_KEKROPUS) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00179_IntoTheLargeCavern/Q00179_IntoTheLargeCavern.java b/src/main/java/com/l2jserver/datapack/quests/Q00179_IntoTheLargeCavern/Q00179_IntoTheLargeCavern.java index 9b3177a4df..fb8bd5cfb9 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00179_IntoTheLargeCavern/Q00179_IntoTheLargeCavern.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00179_IntoTheLargeCavern/Q00179_IntoTheLargeCavern.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.State; * @author Gnacik * @version 2010-10-15 Based on official server Naia */ -public class Q00179_IntoTheLargeCavern extends Quest -{ +public class Q00179_IntoTheLargeCavern extends Quest { // NPCs private static final int KEKROPUS = 32138; private static final int MENACING_MACHINE = 32258; @@ -40,40 +39,30 @@ public class Q00179_IntoTheLargeCavern extends Quest private static final int MIN_LEVEL = 17; private static final int MAX_LEVEL = 21; - public Q00179_IntoTheLargeCavern() - { + public Q00179_IntoTheLargeCavern() { super(179, Q00179_IntoTheLargeCavern.class.getSimpleName(), "Into The Large Cavern"); addStartNpc(KEKROPUS); addTalkId(KEKROPUS, MENACING_MACHINE); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return htmltext; } - if (npc.getId() == KEKROPUS) - { - if (event.equalsIgnoreCase("32138-03.html")) - { + if (npc.getId() == KEKROPUS) { + if (event.equalsIgnoreCase("32138-03.html")) { st.startQuest(); } - } - else if (npc.getId() == MENACING_MACHINE) - { - if (event.equalsIgnoreCase("32258-08.html")) - { + } else if (npc.getId() == MENACING_MACHINE) { + if (event.equalsIgnoreCase("32258-08.html")) { st.giveItems(391, 1); st.giveItems(413, 1); st.exitQuest(false, true); - } - else if (event.equalsIgnoreCase("32258-09.html")) - { + } else if (event.equalsIgnoreCase("32258-09.html")) { st.giveItems(847, 2); st.giveItems(890, 2); st.giveItems(910, 1); @@ -84,39 +73,27 @@ public class Q00179_IntoTheLargeCavern extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - if (npc.getId() == KEKROPUS) - { - switch (st.getState()) - { + if (npc.getId() == KEKROPUS) { + switch (st.getState()) { case State.CREATED: - if (player.getRace() != Race.KAMAEL) - { + if (player.getRace() != Race.KAMAEL) { htmltext = "32138-00b.html"; - } - else - { + } else { final int level = player.getLevel(); - if (player.hasQuestCompleted(Q00178_IconicTrinity.class.getSimpleName()) && (level >= MIN_LEVEL) && (level <= MAX_LEVEL) && (player.getClassId().level() == 0)) - { + if (player.hasQuestCompleted(Q00178_IconicTrinity.class.getSimpleName()) && (level >= MIN_LEVEL) && (level <= MAX_LEVEL) && (player.getClassId().level() == 0)) { htmltext = "32138-01.htm"; - } - else if (level < MIN_LEVEL) - { + } else if (level < MIN_LEVEL) { htmltext = "32138-00.html"; - } - else - { + } else { htmltext = "32138-00c.html"; } } break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "32138-03.htm"; } break; @@ -124,9 +101,7 @@ public class Q00179_IntoTheLargeCavern extends Quest htmltext = getAlreadyCompletedMsg(player); break; } - } - else if ((npc.getId() == MENACING_MACHINE) && (st.getState() == State.STARTED)) - { + } else if ((npc.getId() == MENACING_MACHINE) && (st.getState() == State.STARTED)) { htmltext = "32258-01.html"; } return htmltext; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00182_NewRecruits/Q00182_NewRecruits.java b/src/main/java/com/l2jserver/datapack/quests/Q00182_NewRecruits/Q00182_NewRecruits.java index 398466992f..3fa557fbb8 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00182_NewRecruits/Q00182_NewRecruits.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00182_NewRecruits/Q00182_NewRecruits.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * @author Adry_85 * @since 2.6.0.0 */ -public class Q00182_NewRecruits extends Quest -{ +public class Q00182_NewRecruits extends Quest { // NPCs private static final int KEKROPUS = 32138; private static final int MENACING_MACHINE = 32258; @@ -42,37 +41,29 @@ public class Q00182_NewRecruits extends Quest private static final int RED_CRESCENT_EARRING = 10122; private static final int RING_OF_DEVOTION = 10124; - public Q00182_NewRecruits() - { + public Q00182_NewRecruits() { super(182, Q00182_NewRecruits.class.getSimpleName(), "New Recruits"); addStartNpc(KEKROPUS); addTalkId(KEKROPUS, MENACING_MACHINE); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "32138-03.htm": - { - if ((player.getLevel() >= MIN_LEVEL) && (player.getLevel() <= MAX_LEVEL) && player.isInCategory(CategoryType.FIRST_CLASS_GROUP)) - { + switch (event) { + case "32138-03.htm": { + if ((player.getLevel() >= MIN_LEVEL) && (player.getLevel() <= MAX_LEVEL) && player.isInCategory(CategoryType.FIRST_CLASS_GROUP)) { htmltext = event; } break; } - case "32138-04.htm": - { - if ((player.getLevel() >= MIN_LEVEL) && (player.getLevel() <= MAX_LEVEL) && player.isInCategory(CategoryType.FIRST_CLASS_GROUP)) - { + case "32138-04.htm": { + if ((player.getLevel() >= MIN_LEVEL) && (player.getLevel() <= MAX_LEVEL) && player.isInCategory(CategoryType.FIRST_CLASS_GROUP)) { st.startQuest(); st.setMemoState(1); htmltext = event; @@ -80,28 +71,22 @@ public class Q00182_NewRecruits extends Quest break; } case "32258-02.html": - case "32258-03.html": - { - if (st.isMemoState(1)) - { + case "32258-03.html": { + if (st.isMemoState(1)) { htmltext = event; } break; } - case "32258-04.html": - { - if (st.isMemoState(1)) - { + case "32258-04.html": { + if (st.isMemoState(1)) { giveItems(player, RED_CRESCENT_EARRING, 2); st.exitQuest(false, true); htmltext = event; } break; } - case "32258-05.html": - { - if (st.isMemoState(1)) - { + case "32258-05.html": { + if (st.isMemoState(1)) { giveItems(player, RING_OF_DEVOTION, 2); st.exitQuest(false, true); htmltext = event; @@ -113,48 +98,31 @@ public class Q00182_NewRecruits extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCompleted()) - { - if (npc.getId() == KEKROPUS) - { + if (st.isCompleted()) { + if (npc.getId() == KEKROPUS) { htmltext = getAlreadyCompletedMsg(player); } - } - else if (st.isCreated()) - { - if (player.getRace() == Race.KAMAEL) - { + } else if (st.isCreated()) { + if (player.getRace() == Race.KAMAEL) { htmltext = "32138-01.htm"; - } - else if ((player.getLevel() >= MIN_LEVEL) && (player.getLevel() <= MAX_LEVEL) && player.isInCategory(CategoryType.FIRST_CLASS_GROUP)) - { + } else if ((player.getLevel() >= MIN_LEVEL) && (player.getLevel() <= MAX_LEVEL) && player.isInCategory(CategoryType.FIRST_CLASS_GROUP)) { htmltext = "32138-02.htm"; - } - else if ((player.getLevel() < MIN_LEVEL) || (player.getLevel() > MAX_LEVEL) || !player.isInCategory(CategoryType.FIRST_CLASS_GROUP)) - { + } else if ((player.getLevel() < MIN_LEVEL) || (player.getLevel() > MAX_LEVEL) || !player.isInCategory(CategoryType.FIRST_CLASS_GROUP)) { htmltext = "32138-05.htm"; } - } - else if (st.isStarted()) - { - switch (npc.getId()) - { - case KEKROPUS: - { - if (st.isMemoState(1)) - { + } else if (st.isStarted()) { + switch (npc.getId()) { + case KEKROPUS: { + if (st.isMemoState(1)) { htmltext = "32138-06.html"; } break; } - case MENACING_MACHINE: - { - if (st.isMemoState(1)) - { + case MENACING_MACHINE: { + if (st.isMemoState(1)) { htmltext = "32258-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00183_RelicExploration/Q00183_RelicExploration.java b/src/main/java/com/l2jserver/datapack/quests/Q00183_RelicExploration/Q00183_RelicExploration.java index 1cdedcfa61..c9c3e16a3e 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00183_RelicExploration/Q00183_RelicExploration.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00183_RelicExploration/Q00183_RelicExploration.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Relic Exploration (183) * @author ivantotov */ -public final class Q00183_RelicExploration extends Quest -{ +public final class Q00183_RelicExploration extends Quest { // NPCs private static final int HEAD_BLACKSMITH_KUSTO = 30512; private static final int MAESTRO_NIKOLA = 30621; @@ -40,44 +39,35 @@ public final class Q00183_RelicExploration extends Quest private static final int MIN_LEVEL = 40; private static final int MAX_LEVEL_FOR_EXP_SP = 46; - public Q00183_RelicExploration() - { + public Q00183_RelicExploration() { super(183, Q00183_RelicExploration.class.getSimpleName(), "Relic Exploration"); addStartNpc(HEAD_BLACKSMITH_KUSTO); addTalkId(HEAD_BLACKSMITH_KUSTO, RESEARCHER_LORAIN, MAESTRO_NIKOLA); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "30512-04.htm": - { + switch (event) { + case "30512-04.htm": { qs.startQuest(); qs.setMemoState(1); htmltext = event; break; } - case "30512-02.htm": - { + case "30512-02.htm": { htmltext = event; break; } - case "30621-02.html": - { - if (qs.isMemoState(2)) - { + case "30621-02.html": { + if (qs.isMemoState(2)) { qs.giveAdena(18100, true); - if (player.getLevel() < MAX_LEVEL_FOR_EXP_SP) - { + if (player.getLevel() < MAX_LEVEL_FOR_EXP_SP) { qs.addExpAndSp(60000, 3000); } qs.exitQuest(false, true); @@ -86,55 +76,41 @@ public final class Q00183_RelicExploration extends Quest break; } case "30673-02.html": - case "30673-03.html": - { - if (qs.isMemoState(1)) - { + case "30673-03.html": { + if (qs.isMemoState(1)) { htmltext = event; } break; } - case "30673-04.html": - { - if (qs.isMemoState(1)) - { + case "30673-04.html": { + if (qs.isMemoState(1)) { qs.setMemoState(2); qs.setCond(2, true); htmltext = event; } break; } - case "Contract": - { + case "Contract": { final QuestState qs184 = player.getQuestState(Q00184_ArtOfPersuasion.class.getSimpleName()); final QuestState qs185 = player.getQuestState(Q00185_NikolasCooperation.class.getSimpleName()); final Quest quest = QuestManager.getInstance().getQuest(Q00184_ArtOfPersuasion.class.getSimpleName()); - if ((quest != null) && (qs184 == null) && (qs185 == null)) - { - if (player.getLevel() >= MIN_LEVEL) - { + if ((quest != null) && (qs184 == null) && (qs185 == null)) { + if (player.getLevel() >= MIN_LEVEL) { quest.notifyEvent("30621-03.htm", npc, player); - } - else - { + } else { quest.notifyEvent("30621-03a.html", npc, player); } } break; } - case "Consideration": - { + case "Consideration": { final QuestState qs184 = player.getQuestState(Q00184_ArtOfPersuasion.class.getSimpleName()); final QuestState qs185 = player.getQuestState(Q00185_NikolasCooperation.class.getSimpleName()); final Quest quest = QuestManager.getInstance().getQuest(Q00185_NikolasCooperation.class.getSimpleName()); - if ((quest != null) && (qs184 == null) && (qs185 == null)) - { - if (player.getLevel() >= MIN_LEVEL) - { + if ((quest != null) && (qs184 == null) && (qs185 == null)) { + if (player.getLevel() >= MIN_LEVEL) { quest.notifyEvent("30621-03.htm", npc, player); - } - else - { + } else { quest.notifyEvent("30621-03a.html", npc, player); } } @@ -145,50 +121,35 @@ public final class Q00183_RelicExploration extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == HEAD_BLACKSMITH_KUSTO) - { + if (qs.isCreated()) { + if (npc.getId() == HEAD_BLACKSMITH_KUSTO) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "30512-01.htm" : "30512-03.html"; } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case HEAD_BLACKSMITH_KUSTO: - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case HEAD_BLACKSMITH_KUSTO: { htmltext = "30512-05.html"; break; } - case MAESTRO_NIKOLA: - { - if (qs.isMemoState(2)) - { + case MAESTRO_NIKOLA: { + if (qs.isMemoState(2)) { htmltext = "30621-01.html"; } break; } - case RESEARCHER_LORAIN: - { - if (qs.isMemoState(1)) - { + case RESEARCHER_LORAIN: { + if (qs.isMemoState(1)) { htmltext = "30673-01.html"; - } - else if (qs.isMemoState(2)) - { + } else if (qs.isMemoState(2)) { htmltext = "30673-05.html"; } break; } } - } - else if (qs.isCompleted()) - { + } else if (qs.isCompleted()) { htmltext = getAlreadyCompletedMsg(player); } return htmltext; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00184_ArtOfPersuasion/Q00184_ArtOfPersuasion.java b/src/main/java/com/l2jserver/datapack/quests/Q00184_ArtOfPersuasion/Q00184_ArtOfPersuasion.java index 75e67edb20..4d575e647f 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00184_ArtOfPersuasion/Q00184_ArtOfPersuasion.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00184_ArtOfPersuasion/Q00184_ArtOfPersuasion.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Art Of Persuasion (184) * @author ivantotov */ -public final class Q00184_ArtOfPersuasion extends Quest -{ +public final class Q00184_ArtOfPersuasion extends Quest { // NPCs private static final int MAESTRO_NIKOLA = 30621; private static final int RESEARCHER_LORAIN = 30673; @@ -46,8 +45,7 @@ public final class Q00184_ArtOfPersuasion extends Quest private static final int MIN_LEVEL = 40; private static final int MAX_LEVEL_FOR_EXP_SP = 46; - public Q00184_ArtOfPersuasion() - { + public Q00184_ArtOfPersuasion() { super(184, Q00184_ArtOfPersuasion.class.getSimpleName(), "Art Of Persuasion"); addStartNpc(MAESTRO_NIKOLA); addTalkId(MAESTRO_NIKOLA, RESEARCHER_LORAIN, DESTROYED_DEVICE, ALARM_OF_GIANT); @@ -55,21 +53,16 @@ public final class Q00184_ArtOfPersuasion extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "30621-06.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "30621-06.htm": { + if (qs.isCreated()) { qs.startQuest(); qs.setMemoState(1); giveItems(player, NIKOLAS_MAP, 1); @@ -77,36 +70,27 @@ public final class Q00184_ArtOfPersuasion extends Quest } break; } - case "30621-03.htm": - { - if (player.getLevel() >= MIN_LEVEL) - { + case "30621-03.htm": { + if (player.getLevel() >= MIN_LEVEL) { htmltext = event; - } - else - { + } else { htmltext = "30621-03a.htm"; } break; } case "30621-04.htm": - case "30621-05.htm": - { + case "30621-05.htm": { htmltext = event; break; } - case "30673-02.html": - { - if (qs.isMemoState(1)) - { + case "30673-02.html": { + if (qs.isMemoState(1)) { htmltext = event; } break; } - case "30673-03.html": - { - if (qs.isMemoState(1)) - { + case "30673-03.html": { + if (qs.isMemoState(1)) { takeItems(player, NIKOLAS_MAP, -1); qs.setMemoState(2); qs.setCond(2, true); @@ -114,55 +98,41 @@ public final class Q00184_ArtOfPersuasion extends Quest } break; } - case "30673-05.html": - { - if (qs.isMemoState(2)) - { + case "30673-05.html": { + if (qs.isMemoState(2)) { qs.setMemoState(3); qs.setCond(3, true); htmltext = event; } break; } - case "30673-08.html": - { - if (qs.isMemoState(6)) - { + case "30673-08.html": { + if (qs.isMemoState(6)) { htmltext = event; } break; } - case "30673-09.html": - { - if (qs.isMemoState(6)) - { - if (hasQuestItems(player, METALLOGRAPH)) - { + case "30673-09.html": { + if (qs.isMemoState(6)) { + if (hasQuestItems(player, METALLOGRAPH)) { giveItems(player, LORAINES_CERTIFICATE, 1); qs.exitQuest(false, true); htmltext = event; - } - else - { + } else { htmltext = "30673-10.htm"; qs.exitQuest(false, true); } - if (player.getLevel() < MAX_LEVEL_FOR_EXP_SP) - { + if (player.getLevel() < MAX_LEVEL_FOR_EXP_SP) { giveAdena(player, 72527, true); addExpAndSp(player, 203717, 14032); - } - else - { + } else { giveAdena(player, 72527, true); } } break; } - case "32366-03.html": - { - if (qs.isMemoState(3) && !npc.getVariables().getBoolean("SPAWNED", false)) - { + case "32366-03.html": { + if (qs.isMemoState(3) && !npc.getVariables().getBoolean("SPAWNED", false)) { npc.getVariables().set("SPAWNED", true); npc.getVariables().set("PLAYER_ID", player.getObjectId()); L2Npc alarm = addSpawn(ALARM_OF_GIANT, player.getX() + 80, player.getY() + 60, player.getZ(), 16384, false, 0); @@ -171,10 +141,8 @@ public final class Q00184_ArtOfPersuasion extends Quest } break; } - case "32366-06.html": - { - if (qs.isMemoState(4)) - { + case "32366-06.html": { + if (qs.isMemoState(4)) { giveItems(player, METALLOGRAPH, 1); qs.setMemoState(6); qs.setCond(4, true); @@ -182,10 +150,8 @@ public final class Q00184_ArtOfPersuasion extends Quest } break; } - case "32366-08.html": - { - if (qs.isMemoState(5)) - { + case "32366-08.html": { + if (qs.isMemoState(5)) { giveItems(player, BROKEN_METAL_PIECES, 1); qs.setMemoState(6); qs.setCond(5, true); @@ -198,88 +164,57 @@ public final class Q00184_ArtOfPersuasion extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); final int memoState = qs.getMemoState(); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == MAESTRO_NIKOLA) - { + if (qs.isCreated()) { + if (npc.getId() == MAESTRO_NIKOLA) { final QuestState q184 = player.getQuestState(Q00184_ArtOfPersuasion.class.getSimpleName()); final QuestState q185 = player.getQuestState(Q00185_NikolasCooperation.class.getSimpleName()); - if (player.hasQuestCompleted(Q00183_RelicExploration.class.getSimpleName()) && (q184 != null) && (q185 != null)) - { + if (player.hasQuestCompleted(Q00183_RelicExploration.class.getSimpleName()) && (q184 != null) && (q185 != null)) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "30621-01.htm" : "30621-02.html"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case MAESTRO_NIKOLA: - { - if (memoState == 1) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case MAESTRO_NIKOLA: { + if (memoState == 1) { htmltext = "30621-07.html"; } break; } - case RESEARCHER_LORAIN: - { - if (memoState == 1) - { + case RESEARCHER_LORAIN: { + if (memoState == 1) { htmltext = "30673-01.html"; - } - else if (memoState == 2) - { + } else if (memoState == 2) { htmltext = "30673-04.html"; - } - else if ((memoState >= 3) && (memoState <= 5)) - { + } else if ((memoState >= 3) && (memoState <= 5)) { htmltext = "30673-06.html"; - } - else if (memoState == 6) - { + } else if (memoState == 6) { htmltext = "30673-07.html"; } break; } - case DESTROYED_DEVICE: - { - if (memoState == 3) - { - if (!npc.getVariables().getBoolean("SPAWNED", false)) - { + case DESTROYED_DEVICE: { + if (memoState == 3) { + if (!npc.getVariables().getBoolean("SPAWNED", false)) { htmltext = "32366-01.html"; - } - else if (npc.getVariables().getInt("PLAYER_ID") == player.getObjectId()) - { + } else if (npc.getVariables().getInt("PLAYER_ID") == player.getObjectId()) { htmltext = "32366-03.html"; - } - else - { + } else { htmltext = "32366-04.html"; } - } - else if (memoState == 4) - { + } else if (memoState == 4) { htmltext = "32366-05.html"; - } - else if (memoState == 5) - { + } else if (memoState == 5) { htmltext = "32366-07.html"; } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == MAESTRO_NIKOLA) - { + } else if (qs.isCompleted()) { + if (npc.getId() == MAESTRO_NIKOLA) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00185_NikolasCooperation/Q00185_NikolasCooperation.java b/src/main/java/com/l2jserver/datapack/quests/Q00185_NikolasCooperation/Q00185_NikolasCooperation.java index 6c03d67bd3..cc143a71c0 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00185_NikolasCooperation/Q00185_NikolasCooperation.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00185_NikolasCooperation/Q00185_NikolasCooperation.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Nikola's Cooperation (185) * @author ivantotov */ -public final class Q00185_NikolasCooperation extends Quest -{ +public final class Q00185_NikolasCooperation extends Quest { // NPC's private static final int MAESTRO_NIKOLA = 30621; private static final int RESEARCHER_LORAIN = 30673; @@ -46,8 +45,7 @@ public final class Q00185_NikolasCooperation extends Quest private static final int MIN_LEVEL = 40; private static final int MAX_LEVEL_FOR_EXP_SP = 46; - public Q00185_NikolasCooperation() - { + public Q00185_NikolasCooperation() { super(185, Q00185_NikolasCooperation.class.getSimpleName(), "Nikola's Cooperation"); addStartNpc(MAESTRO_NIKOLA); addTalkId(MAESTRO_NIKOLA, RESEARCHER_LORAIN, DESTROYED_DEVICE); @@ -55,21 +53,16 @@ public final class Q00185_NikolasCooperation extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "30621-06.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "30621-06.htm": { + if (qs.isCreated()) { qs.startQuest(); qs.setMemoState(1); giveItems(player, NIKOLAS_MAP, 1); @@ -77,36 +70,27 @@ public final class Q00185_NikolasCooperation extends Quest } break; } - case "30621-03.htm": - { - if (player.getLevel() >= MIN_LEVEL) - { + case "30621-03.htm": { + if (player.getLevel() >= MIN_LEVEL) { htmltext = event; - } - else - { + } else { htmltext = "30621-03a.htm"; } break; } case "30621-04.htm": - case "30621-05.htm": - { + case "30621-05.htm": { htmltext = event; break; } - case "30673-02.html": - { - if (qs.isMemoState(1)) - { + case "30673-02.html": { + if (qs.isMemoState(1)) { htmltext = event; } break; } - case "30673-03.html": - { - if (qs.isMemoState(1)) - { + case "30673-03.html": { + if (qs.isMemoState(1)) { takeItems(player, NIKOLAS_MAP, -1); qs.setMemoState(2); qs.setCond(2, true); @@ -114,55 +98,41 @@ public final class Q00185_NikolasCooperation extends Quest } break; } - case "30673-05.html": - { - if (qs.isMemoState(2)) - { + case "30673-05.html": { + if (qs.isMemoState(2)) { qs.setMemoState(3); qs.setCond(3, true); htmltext = event; } break; } - case "30673-08.html": - { - if (qs.isMemoState(6)) - { + case "30673-08.html": { + if (qs.isMemoState(6)) { htmltext = event; } break; } - case "30673-09.html": - { - if (qs.isMemoState(6)) - { - if (hasQuestItems(player, METALLOGRAPH)) - { + case "30673-09.html": { + if (qs.isMemoState(6)) { + if (hasQuestItems(player, METALLOGRAPH)) { giveItems(player, LORAINES_CERTIFICATE, 1); qs.exitQuest(false, true); htmltext = event; - } - else - { + } else { htmltext = "30673-10.html"; qs.exitQuest(false, true); } - if (player.getLevel() < MAX_LEVEL_FOR_EXP_SP) - { + if (player.getLevel() < MAX_LEVEL_FOR_EXP_SP) { giveAdena(player, 72527, true); addExpAndSp(player, 203717, 14032); - } - else - { + } else { giveAdena(player, 72527, true); } } break; } - case "32366-03.html": - { - if (qs.isMemoState(3) && !npc.getVariables().getBoolean("SPAWNED", false)) - { + case "32366-03.html": { + if (qs.isMemoState(3) && !npc.getVariables().getBoolean("SPAWNED", false)) { npc.getVariables().set("SPAWNED", true); npc.getVariables().set("PLAYER_ID", player.getObjectId()); L2Npc alarm = addSpawn(ALARM_OF_GIANT, player.getX() + 80, player.getY() + 60, player.getZ(), 16384, false, 0); @@ -171,10 +141,8 @@ public final class Q00185_NikolasCooperation extends Quest } break; } - case "32366-06.html": - { - if (qs.isMemoState(4)) - { + case "32366-06.html": { + if (qs.isMemoState(4)) { giveItems(player, METALLOGRAPH, 1); qs.setMemoState(6); qs.setCond(4, true); @@ -182,10 +150,8 @@ public final class Q00185_NikolasCooperation extends Quest } break; } - case "32366-08.html": - { - if (qs.isMemoState(5)) - { + case "32366-08.html": { + if (qs.isMemoState(5)) { giveItems(player, BROKEN_METAL_PIECES, 1); qs.setMemoState(6); qs.setCond(5, true); @@ -198,88 +164,57 @@ public final class Q00185_NikolasCooperation extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); final int memoState = qs.getMemoState(); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == MAESTRO_NIKOLA) - { + if (qs.isCreated()) { + if (npc.getId() == MAESTRO_NIKOLA) { final QuestState q184 = player.getQuestState(Q00184_ArtOfPersuasion.class.getSimpleName()); final QuestState q185 = player.getQuestState(Q00185_NikolasCooperation.class.getSimpleName()); - if (player.hasQuestCompleted(Q00183_RelicExploration.class.getSimpleName()) && (q184 != null) && (q185 != null)) - { + if (player.hasQuestCompleted(Q00183_RelicExploration.class.getSimpleName()) && (q184 != null) && (q185 != null)) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "30621-01.htm" : "30621-02.html"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case MAESTRO_NIKOLA: - { - if (memoState == 1) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case MAESTRO_NIKOLA: { + if (memoState == 1) { htmltext = "30621-07.html"; } break; } - case RESEARCHER_LORAIN: - { - if (memoState == 1) - { + case RESEARCHER_LORAIN: { + if (memoState == 1) { htmltext = "30673-01.html"; - } - else if (memoState == 2) - { + } else if (memoState == 2) { htmltext = "30673-04.html"; - } - else if ((memoState >= 3) && (memoState <= 5)) - { + } else if ((memoState >= 3) && (memoState <= 5)) { htmltext = "30673-06.html"; - } - else if (memoState == 6) - { + } else if (memoState == 6) { htmltext = "30673-07.html"; } break; } - case DESTROYED_DEVICE: - { - if (memoState == 3) - { - if (!npc.getVariables().getBoolean("SPAWNED", false)) - { + case DESTROYED_DEVICE: { + if (memoState == 3) { + if (!npc.getVariables().getBoolean("SPAWNED", false)) { htmltext = "32366-01.html"; - } - else if (npc.getVariables().getInt("PLAYER_ID") == player.getObjectId()) - { + } else if (npc.getVariables().getInt("PLAYER_ID") == player.getObjectId()) { htmltext = "32366-03.html"; - } - else - { + } else { htmltext = "32366-04.html"; } - } - else if (memoState == 4) - { + } else if (memoState == 4) { htmltext = "32366-05.html"; - } - else if (memoState == 5) - { + } else if (memoState == 5) { htmltext = "32366-07.html"; } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == MAESTRO_NIKOLA) - { + } else if (qs.isCompleted()) { + if (npc.getId() == MAESTRO_NIKOLA) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00186_ContractExecution/Q00186_ContractExecution.java b/src/main/java/com/l2jserver/datapack/quests/Q00186_ContractExecution/Q00186_ContractExecution.java index 217d9ac675..534c82d9b8 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00186_ContractExecution/Q00186_ContractExecution.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00186_ContractExecution/Q00186_ContractExecution.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.util.Util; * Contract Execution (186) * @author ivantotov */ -public final class Q00186_ContractExecution extends Quest -{ +public final class Q00186_ContractExecution extends Quest { // NPCs private static final int MAESTRO_NIKOLA = 30621; private static final int RESEARCHER_LORAIN = 30673; @@ -48,8 +47,7 @@ public final class Q00186_ContractExecution extends Quest private static final int MAX_LEVEL_FOR_EXP_SP = 47; // Monsters private static final Map<Integer, Integer> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(20577, 40); // Leto Lizardman MONSTERS.put(20578, 44); // Leto Lizardman Archer MONSTERS.put(20579, 46); // Leto Lizardman Soldier @@ -58,8 +56,7 @@ public final class Q00186_ContractExecution extends Quest MONSTERS.put(20582, 100); // Leto Lizardman Overlord } - public Q00186_ContractExecution() - { + public Q00186_ContractExecution() { super(186, Q00186_ContractExecution.class.getSimpleName(), "Contract Execution"); addStartNpc(RESEARCHER_LORAIN); addTalkId(RESEARCHER_LORAIN, BLUEPRINT_SELLER_LUKA, MAESTRO_NIKOLA); @@ -68,21 +65,16 @@ public final class Q00186_ContractExecution extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "30673-03.htm": - { - if ((player.getLevel() >= MIN_LEVEL) && hasQuestItems(player, LORAINES_CERTIFICATE)) - { + switch (event) { + case "30673-03.htm": { + if ((player.getLevel() >= MIN_LEVEL) && hasQuestItems(player, LORAINES_CERTIFICATE)) { qs.startQuest(); qs.setMemoState(1); giveItems(player, METALLOGRAPH_RESEARCH_REPORT, 1); @@ -91,48 +83,37 @@ public final class Q00186_ContractExecution extends Quest } break; } - case "30621-02.html": - { - if (qs.isMemoState(1)) - { + case "30621-02.html": { + if (qs.isMemoState(1)) { htmltext = event; } break; } - case "30621-03.html": - { - if (qs.isMemoState(1)) - { + case "30621-03.html": { + if (qs.isMemoState(1)) { qs.setMemoState(2); qs.setCond(2, true); htmltext = event; } break; } - case "31437-03.html": - { - if (qs.isMemoState(2) && hasQuestItems(player, LETO_LIZARDMAN_ACCESSORY)) - { + case "31437-03.html": { + if (qs.isMemoState(2) && hasQuestItems(player, LETO_LIZARDMAN_ACCESSORY)) { htmltext = event; } break; } - case "31437-04.html": - { - if (qs.isMemoState(2) && hasQuestItems(player, LETO_LIZARDMAN_ACCESSORY)) - { + case "31437-04.html": { + if (qs.isMemoState(2) && hasQuestItems(player, LETO_LIZARDMAN_ACCESSORY)) { qs.setMemoState(3); htmltext = event; } break; } - case "31437-06.html": - { - if (qs.isMemoState(3)) - { + case "31437-06.html": { + if (qs.isMemoState(3)) { giveAdena(player, 105083, true); - if (player.getLevel() < MAX_LEVEL_FOR_EXP_SP) - { + if (player.getLevel() < MAX_LEVEL_FOR_EXP_SP) { addExpAndSp(player, 285935, 18711); } qs.exitQuest(false, true); @@ -145,13 +126,10 @@ public final class Q00186_ContractExecution extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isMemoState(2) && Util.checkIfInRange(1500, npc, killer, false) && (getRandom(100) < MONSTERS.get(npc.getId()))) - { - if (!hasQuestItems(killer, LETO_LIZARDMAN_ACCESSORY)) - { + if ((qs != null) && qs.isMemoState(2) && Util.checkIfInRange(1500, npc, killer, false) && (getRandom(100) < MONSTERS.get(npc.getId()))) { + if (!hasQuestItems(killer, LETO_LIZARDMAN_ACCESSORY)) { giveItems(killer, LETO_LIZARDMAN_ACCESSORY, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -160,70 +138,47 @@ public final class Q00186_ContractExecution extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); final int memoState = qs.getMemoState(); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == RESEARCHER_LORAIN) - { - if (player.hasQuestCompleted(Q00184_ArtOfPersuasion.class.getSimpleName()) && hasQuestItems(player, LORAINES_CERTIFICATE)) - { + if (qs.isCreated()) { + if (npc.getId() == RESEARCHER_LORAIN) { + if (player.hasQuestCompleted(Q00184_ArtOfPersuasion.class.getSimpleName()) && hasQuestItems(player, LORAINES_CERTIFICATE)) { htmltext = player.getLevel() >= MIN_LEVEL ? "30673-01.htm" : "30673-02.htm"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case RESEARCHER_LORAIN: - { - if (memoState >= 1) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case RESEARCHER_LORAIN: { + if (memoState >= 1) { htmltext = "30673-04.html"; } break; } - case MAESTRO_NIKOLA: - { - if (memoState == 1) - { + case MAESTRO_NIKOLA: { + if (memoState == 1) { htmltext = "30621-01.html"; - } - else if (memoState == 2) - { + } else if (memoState == 2) { htmltext = "30621-04.html"; } break; } - case BLUEPRINT_SELLER_LUKA: - { - if (memoState == 2) - { - if (hasQuestItems(player, LETO_LIZARDMAN_ACCESSORY)) - { + case BLUEPRINT_SELLER_LUKA: { + if (memoState == 2) { + if (hasQuestItems(player, LETO_LIZARDMAN_ACCESSORY)) { htmltext = "31437-02.html"; - } - else - { + } else { htmltext = "31437-01.html"; } - } - else if (memoState == 3) - { + } else if (memoState == 3) { htmltext = "31437-05.html"; } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == RESEARCHER_LORAIN) - { + } else if (qs.isCompleted()) { + if (npc.getId() == RESEARCHER_LORAIN) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00187_NikolasHeart/Q00187_NikolasHeart.java b/src/main/java/com/l2jserver/datapack/quests/Q00187_NikolasHeart/Q00187_NikolasHeart.java index 67d3d3b212..4a3123c5d0 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00187_NikolasHeart/Q00187_NikolasHeart.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00187_NikolasHeart/Q00187_NikolasHeart.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Nikola's Heart (187) * @author ivantotov */ -public final class Q00187_NikolasHeart extends Quest -{ +public final class Q00187_NikolasHeart extends Quest { // NPCs private static final int HEAD_BLACKSMITH_KUSTO = 30512; private static final int MAESTRO_NIKOLA = 30621; @@ -41,8 +40,7 @@ public final class Q00187_NikolasHeart extends Quest private static final int MIN_LEVEL = 41; private static final int MAX_LEVEL_FOR_EXP_SP = 47; - public Q00187_NikolasHeart() - { + public Q00187_NikolasHeart() { super(187, Q00187_NikolasHeart.class.getSimpleName(), "Nikola's Heart"); addStartNpc(RESEARCHER_LORAIN); addTalkId(HEAD_BLACKSMITH_KUSTO, RESEARCHER_LORAIN, MAESTRO_NIKOLA); @@ -50,21 +48,16 @@ public final class Q00187_NikolasHeart extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "30673-03.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "30673-03.htm": { + if (qs.isCreated()) { qs.startQuest(); qs.setMemoState(1); giveItems(player, METALLOGRAPH, 1); @@ -73,21 +66,16 @@ public final class Q00187_NikolasHeart extends Quest } break; } - case "30512-02.html": - { - if (qs.isMemoState(2)) - { + case "30512-02.html": { + if (qs.isMemoState(2)) { htmltext = event; } break; } - case "30512-03.html": - { - if (qs.isMemoState(2)) - { + case "30512-03.html": { + if (qs.isMemoState(2)) { giveAdena(player, 93383, true); - if (player.getLevel() < MAX_LEVEL_FOR_EXP_SP) - { + if (player.getLevel() < MAX_LEVEL_FOR_EXP_SP) { addExpAndSp(player, 285935, 18711); } qs.exitQuest(false, true); @@ -95,18 +83,14 @@ public final class Q00187_NikolasHeart extends Quest } break; } - case "30621-02.html": - { - if (qs.isMemoState(1)) - { + case "30621-02.html": { + if (qs.isMemoState(1)) { htmltext = event; } break; } - case "30621-03.html": - { - if (qs.isMemoState(1)) - { + case "30621-03.html": { + if (qs.isMemoState(1)) { qs.setMemoState(2); qs.setCond(2, true); htmltext = event; @@ -118,59 +102,41 @@ public final class Q00187_NikolasHeart extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); final int memoState = qs.getMemoState(); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == RESEARCHER_LORAIN) - { - if (player.hasQuestCompleted(Q00185_NikolasCooperation.class.getSimpleName()) && hasQuestItems(player, LORAINES_CERTIFICATE)) - { + if (qs.isCreated()) { + if (npc.getId() == RESEARCHER_LORAIN) { + if (player.hasQuestCompleted(Q00185_NikolasCooperation.class.getSimpleName()) && hasQuestItems(player, LORAINES_CERTIFICATE)) { htmltext = player.getLevel() >= MIN_LEVEL ? "30673-01.htm" : "30673-02.htm"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case RESEARCHER_LORAIN: - { - if (memoState >= 1) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case RESEARCHER_LORAIN: { + if (memoState >= 1) { htmltext = "30673-04.html"; } break; } - case HEAD_BLACKSMITH_KUSTO: - { - if (memoState == 2) - { + case HEAD_BLACKSMITH_KUSTO: { + if (memoState == 2) { htmltext = "30512-01.html"; } break; } - case MAESTRO_NIKOLA: - { - if (memoState == 1) - { + case MAESTRO_NIKOLA: { + if (memoState == 1) { htmltext = "30621-01.html"; - } - else if (memoState == 2) - { + } else if (memoState == 2) { htmltext = "30621-04.html"; } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == RESEARCHER_LORAIN) - { + } else if (qs.isCompleted()) { + if (npc.getId() == RESEARCHER_LORAIN) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00188_SealRemoval/Q00188_SealRemoval.java b/src/main/java/com/l2jserver/datapack/quests/Q00188_SealRemoval/Q00188_SealRemoval.java index 4aac9e1b27..c747d3e5e9 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00188_SealRemoval/Q00188_SealRemoval.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00188_SealRemoval/Q00188_SealRemoval.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Seal Removal (188) * @author ivantotov */ -public final class Q00188_SealRemoval extends Quest -{ +public final class Q00188_SealRemoval extends Quest { // NPCs private static final int MAESTRO_NIKOLA = 30621; private static final int RESEARCHER_LORAIN = 30673; @@ -44,8 +43,7 @@ public final class Q00188_SealRemoval extends Quest private static final int MIN_LEVEL = 41; private static final int MAX_LEVEL_FOR_EXP_SP = 47; - public Q00188_SealRemoval() - { + public Q00188_SealRemoval() { super(188, Q00188_SealRemoval.class.getSimpleName(), "Seal Removal"); addStartNpc(RESEARCHER_LORAIN); addTalkId(RESEARCHER_LORAIN, MAESTRO_NIKOLA, DOROTHY_LOCKSMITH); @@ -53,21 +51,16 @@ public final class Q00188_SealRemoval extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "30673-03.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "30673-03.htm": { + if (qs.isCreated()) { qs.startQuest(); qs.setMemoState(1); giveItems(player, BROKEN_METAL_PIECES, 1); @@ -75,47 +68,36 @@ public final class Q00188_SealRemoval extends Quest } break; } - case "30621-02.html": - { - if (qs.isMemoState(1)) - { + case "30621-02.html": { + if (qs.isMemoState(1)) { htmltext = event; } break; } - case "30621-03.html": - { - if (qs.isMemoState(1)) - { + case "30621-03.html": { + if (qs.isMemoState(1)) { qs.setMemoState(2); qs.setCond(2, true); htmltext = event; } break; } - case "30621-04.html": - { - if (qs.isMemoState(2)) - { + case "30621-04.html": { + if (qs.isMemoState(2)) { htmltext = event; } break; } - case "30970-02.html": - { - if (qs.isMemoState(2)) - { + case "30970-02.html": { + if (qs.isMemoState(2)) { htmltext = event; } break; } - case "30970-03.html": - { - if (qs.isMemoState(2)) - { + case "30970-03.html": { + if (qs.isMemoState(2)) { giveAdena(player, 98583, true); - if (player.getLevel() < MAX_LEVEL_FOR_EXP_SP) - { + if (player.getLevel() < MAX_LEVEL_FOR_EXP_SP) { addExpAndSp(player, 285935, 18711); } qs.exitQuest(false, true); @@ -128,60 +110,42 @@ public final class Q00188_SealRemoval extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == RESEARCHER_LORAIN) - { - if (!hasQuestItems(player, LORAINES_CERTIFICATE)) - { + if (qs.isCreated()) { + if (npc.getId() == RESEARCHER_LORAIN) { + if (!hasQuestItems(player, LORAINES_CERTIFICATE)) { final QuestState q186 = player.getQuestState(Q00186_ContractExecution.class.getSimpleName()); final QuestState q187 = player.getQuestState(Q00187_NikolasHeart.class.getSimpleName()); - if (player.hasQuestCompleted(Q00184_ArtOfPersuasion.class.getSimpleName()) || (player.hasQuestCompleted(Q00185_NikolasCooperation.class.getSimpleName()) && (q186 == null) && (q187 == null))) - { + if (player.hasQuestCompleted(Q00184_ArtOfPersuasion.class.getSimpleName()) || (player.hasQuestCompleted(Q00185_NikolasCooperation.class.getSimpleName()) && (q186 == null) && (q187 == null))) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "30673-01.htm" : "30673-02.htm"; } } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case RESEARCHER_LORAIN: - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case RESEARCHER_LORAIN: { htmltext = "30673-04.html"; break; } - case MAESTRO_NIKOLA: - { - if (qs.isMemoState(1)) - { + case MAESTRO_NIKOLA: { + if (qs.isMemoState(1)) { htmltext = "30621-01.html"; - } - else if (qs.isMemoState(2)) - { + } else if (qs.isMemoState(2)) { htmltext = "30621-05.html"; } break; } - case DOROTHY_LOCKSMITH: - { - if (qs.isMemoState(2)) - { + case DOROTHY_LOCKSMITH: { + if (qs.isMemoState(2)) { htmltext = "30970-01.html"; } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == RESEARCHER_LORAIN) - { + } else if (qs.isCompleted()) { + if (npc.getId() == RESEARCHER_LORAIN) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00189_ContractCompletion/Q00189_ContractCompletion.java b/src/main/java/com/l2jserver/datapack/quests/Q00189_ContractCompletion/Q00189_ContractCompletion.java index fb0e9ce69e..26dbc6c07e 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00189_ContractCompletion/Q00189_ContractCompletion.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00189_ContractCompletion/Q00189_ContractCompletion.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Contract Completion (189) * @author ivantotov */ -public final class Q00189_ContractCompletion extends Quest -{ +public final class Q00189_ContractCompletion extends Quest { // NPCs private static final int SHEGFIELD = 30068; private static final int HEAD_BLACKSMITH_KUSTO = 30512; @@ -41,8 +40,7 @@ public final class Q00189_ContractCompletion extends Quest private static final int MIN_LEVEL = 42; private static final int MAX_LEVEL_FOR_EXP_SP = 48; - public Q00189_ContractCompletion() - { + public Q00189_ContractCompletion() { super(189, Q00189_ContractCompletion.class.getSimpleName(), "Contract Completion"); addStartNpc(BLUEPRINT_SELLER_LUKA); addTalkId(BLUEPRINT_SELLER_LUKA, HEAD_BLACKSMITH_KUSTO, RESEARCHER_LORAIN, SHEGFIELD); @@ -50,21 +48,16 @@ public final class Q00189_ContractCompletion extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "31437-03.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "31437-03.htm": { + if (qs.isCreated()) { qs.startQuest(); qs.setMemoState(1); giveItems(player, SCROLL_OF_DECODING, 1); @@ -72,13 +65,10 @@ public final class Q00189_ContractCompletion extends Quest } break; } - case "30512-02.html": - { - if (qs.isMemoState(4)) - { + case "30512-02.html": { + if (qs.isMemoState(4)) { giveAdena(player, 121527, true); - if (player.getLevel() < MAX_LEVEL_FOR_EXP_SP) - { + if (player.getLevel() < MAX_LEVEL_FOR_EXP_SP) { addExpAndSp(player, 309467, 20614); } qs.exitQuest(false, true); @@ -86,10 +76,8 @@ public final class Q00189_ContractCompletion extends Quest } break; } - case "30673-02.html": - { - if (qs.isMemoState(1)) - { + case "30673-02.html": { + if (qs.isMemoState(1)) { qs.setMemoState(2); qs.setCond(2, true); takeItems(player, SCROLL_OF_DECODING, -1); @@ -97,18 +85,14 @@ public final class Q00189_ContractCompletion extends Quest } break; } - case "30068-02.html": - { - if (qs.isMemoState(2)) - { + case "30068-02.html": { + if (qs.isMemoState(2)) { htmltext = event; } break; } - case "30068-03.html": - { - if (qs.isMemoState(2)) - { + case "30068-03.html": { + if (qs.isMemoState(2)) { qs.setMemoState(3); qs.setCond(3, true); htmltext = event; @@ -120,80 +104,59 @@ public final class Q00189_ContractCompletion extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == BLUEPRINT_SELLER_LUKA) - { - if (player.hasQuestCompleted(Q00186_ContractExecution.class.getSimpleName())) - { + if (qs.isCreated()) { + if (npc.getId() == BLUEPRINT_SELLER_LUKA) { + if (player.hasQuestCompleted(Q00186_ContractExecution.class.getSimpleName())) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "31437-01.htm" : "31437-02.htm"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case BLUEPRINT_SELLER_LUKA: - { - if (qs.getMemoState() >= 1) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case BLUEPRINT_SELLER_LUKA: { + if (qs.getMemoState() >= 1) { htmltext = "31437-04.html"; } break; } - case HEAD_BLACKSMITH_KUSTO: - { - if (qs.isMemoState(4)) - { + case HEAD_BLACKSMITH_KUSTO: { + if (qs.isMemoState(4)) { htmltext = "30512-01.html"; } break; } - case RESEARCHER_LORAIN: - { - switch (qs.getCond()) - { - case 1: - { + case RESEARCHER_LORAIN: { + switch (qs.getCond()) { + case 1: { htmltext = "30673-01.html"; break; } - case 2: - { + case 2: { htmltext = "30673-03.html"; break; } - case 3: - { + case 3: { qs.setMemoState(4); qs.setCond(4, true); htmltext = "30673-04.html"; break; } - case 4: - { + case 4: { htmltext = "30673-05.html"; break; } } break; } - case SHEGFIELD: - { - switch (qs.getCond()) - { - case 2: - { + case SHEGFIELD: { + switch (qs.getCond()) { + case 2: { htmltext = "30068-01.html"; break; } - case 3: - { + case 3: { htmltext = "30068-04.html"; break; } @@ -201,11 +164,8 @@ public final class Q00189_ContractCompletion extends Quest break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == BLUEPRINT_SELLER_LUKA) - { + } else if (qs.isCompleted()) { + if (npc.getId() == BLUEPRINT_SELLER_LUKA) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00190_LostDream/Q00190_LostDream.java b/src/main/java/com/l2jserver/datapack/quests/Q00190_LostDream/Q00190_LostDream.java index 38b3875aa7..fe0dfb28f4 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00190_LostDream/Q00190_LostDream.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00190_LostDream/Q00190_LostDream.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Lost Dream (190) * @author ivantotov */ -public final class Q00190_LostDream extends Quest -{ +public final class Q00190_LostDream extends Quest { // NPCs private static final int JURIS = 30113; private static final int HEAD_BLACKSMITH_KUSTO = 30512; @@ -39,57 +38,45 @@ public final class Q00190_LostDream extends Quest private static final int MIN_LEVEL = 42; private static final int MAX_LEVEL_FOR_EXP_SP = 48; - public Q00190_LostDream() - { + public Q00190_LostDream() { super(190, Q00190_LostDream.class.getSimpleName(), "Lost Dream"); addStartNpc(HEAD_BLACKSMITH_KUSTO); addTalkId(HEAD_BLACKSMITH_KUSTO, RESEARCHER_LORAIN, MAESTRO_NIKOLA, JURIS); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "30512-03.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "30512-03.htm": { + if (qs.isCreated()) { qs.startQuest(); qs.setMemoState(1); htmltext = event; } break; } - case "30512-06.html": - { - if (qs.isMemoState(2)) - { + case "30512-06.html": { + if (qs.isMemoState(2)) { qs.setMemoState(3); qs.setCond(3, true); htmltext = event; } break; } - case "30113-02.html": - { - if (qs.isMemoState(1)) - { + case "30113-02.html": { + if (qs.isMemoState(1)) { htmltext = event; } break; } - case "30113-03.html": - { - if (qs.isMemoState(1)) - { + case "30113-03.html": { + if (qs.isMemoState(1)) { qs.setMemoState(2); qs.setCond(2, true); htmltext = event; @@ -101,97 +88,66 @@ public final class Q00190_LostDream extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); final int memoState = qs.getMemoState(); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == HEAD_BLACKSMITH_KUSTO) - { - if (player.hasQuestCompleted(Q00187_NikolasHeart.class.getSimpleName())) - { + if (qs.isCreated()) { + if (npc.getId() == HEAD_BLACKSMITH_KUSTO) { + if (player.hasQuestCompleted(Q00187_NikolasHeart.class.getSimpleName())) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "30512-01.htm" : "30512-02.htm"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case HEAD_BLACKSMITH_KUSTO: - { - if (memoState == 1) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case HEAD_BLACKSMITH_KUSTO: { + if (memoState == 1) { htmltext = "30512-04.html"; - } - else if (memoState == 2) - { + } else if (memoState == 2) { htmltext = "30512-05.html"; - } - else if ((memoState >= 3) && (memoState <= 4)) - { + } else if ((memoState >= 3) && (memoState <= 4)) { htmltext = "30512-07.html"; - } - else if (memoState == 5) - { + } else if (memoState == 5) { htmltext = "30512-08.html"; giveAdena(player, 109427, true); - if (player.getLevel() < MAX_LEVEL_FOR_EXP_SP) - { + if (player.getLevel() < MAX_LEVEL_FOR_EXP_SP) { addExpAndSp(player, 309467, 20614); } qs.exitQuest(false, true); } break; } - case JURIS: - { - if (memoState == 1) - { + case JURIS: { + if (memoState == 1) { htmltext = "30113-01.html"; - } - else if (memoState == 2) - { + } else if (memoState == 2) { htmltext = "30113-04.html"; } break; } - case MAESTRO_NIKOLA: - { - if (memoState == 4) - { + case MAESTRO_NIKOLA: { + if (memoState == 4) { qs.setMemoState(5); qs.setCond(5, true); htmltext = "30621-01.html"; - } - else if (memoState == 5) - { + } else if (memoState == 5) { htmltext = "30621-02.html"; } break; } - case RESEARCHER_LORAIN: - { - if (memoState == 3) - { + case RESEARCHER_LORAIN: { + if (memoState == 3) { qs.setMemoState(4); qs.setCond(4, true); htmltext = "30673-01.html"; - } - else if (memoState == 4) - { + } else if (memoState == 4) { htmltext = "30673-02.html"; } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == HEAD_BLACKSMITH_KUSTO) - { + } else if (qs.isCompleted()) { + if (npc.getId() == HEAD_BLACKSMITH_KUSTO) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00191_VainConclusion/Q00191_VainConclusion.java b/src/main/java/com/l2jserver/datapack/quests/Q00191_VainConclusion/Q00191_VainConclusion.java index 902da388fb..57185076ff 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00191_VainConclusion/Q00191_VainConclusion.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00191_VainConclusion/Q00191_VainConclusion.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Vain Conclusion (191) * @author ivantotov */ -public final class Q00191_VainConclusion extends Quest -{ +public final class Q00191_VainConclusion extends Quest { // NPCs private static final int SHEGFIELD = 30068; private static final int HEAD_BLACKSMITH_KUSTO = 30512; @@ -41,8 +40,7 @@ public final class Q00191_VainConclusion extends Quest private static final int MIN_LEVEL = 42; private static final int MAX_LEVEL_FOR_EXP_SP = 48; - public Q00191_VainConclusion() - { + public Q00191_VainConclusion() { super(191, Q00191_VainConclusion.class.getSimpleName(), "Vain Conclusion"); addStartNpc(DOROTHY_LOCKSMITH); addTalkId(DOROTHY_LOCKSMITH, HEAD_BLACKSMITH_KUSTO, RESEARCHER_LORAIN, SHEGFIELD); @@ -50,26 +48,20 @@ public final class Q00191_VainConclusion extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "30970-03.htm": - { + switch (event) { + case "30970-03.htm": { htmltext = event; break; } - case "30970-04.htm": - { - if (qs.isCreated()) - { + case "30970-04.htm": { + if (qs.isCreated()) { qs.startQuest(); qs.setMemoState(1); giveItems(player, REPAIRED_METALLOGRAPH, 1); @@ -77,31 +69,24 @@ public final class Q00191_VainConclusion extends Quest } break; } - case "30068-02.html": - { - if (qs.isMemoState(2)) - { + case "30068-02.html": { + if (qs.isMemoState(2)) { htmltext = event; } break; } - case "30068-03.html": - { - if (qs.isMemoState(2)) - { + case "30068-03.html": { + if (qs.isMemoState(2)) { qs.setMemoState(3); qs.setCond(3, true); htmltext = event; } break; } - case "30512-02.html": - { - if (qs.isMemoState(4)) - { + case "30512-02.html": { + if (qs.isMemoState(4)) { giveAdena(player, 117327, true); - if (player.getLevel() < MAX_LEVEL_FOR_EXP_SP) - { + if (player.getLevel() < MAX_LEVEL_FOR_EXP_SP) { addExpAndSp(player, 309467, 20614); } qs.exitQuest(false, true); @@ -109,10 +94,8 @@ public final class Q00191_VainConclusion extends Quest } break; } - case "30673-02.html": - { - if (qs.isMemoState(1)) - { + case "30673-02.html": { + if (qs.isMemoState(1)) { qs.setMemoState(2); qs.setCond(2, true); takeItems(player, REPAIRED_METALLOGRAPH, -1); @@ -125,80 +108,59 @@ public final class Q00191_VainConclusion extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == DOROTHY_LOCKSMITH) - { - if (player.hasQuestCompleted(Q00188_SealRemoval.class.getSimpleName())) - { + if (qs.isCreated()) { + if (npc.getId() == DOROTHY_LOCKSMITH) { + if (player.hasQuestCompleted(Q00188_SealRemoval.class.getSimpleName())) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "30970-01.htm" : "30970-02.htm"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case DOROTHY_LOCKSMITH: - { - if (qs.getMemoState() >= 1) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case DOROTHY_LOCKSMITH: { + if (qs.getMemoState() >= 1) { htmltext = "30970-05.html"; } break; } - case SHEGFIELD: - { - switch (qs.getCond()) - { - case 2: - { + case SHEGFIELD: { + switch (qs.getCond()) { + case 2: { htmltext = "30068-01.html"; break; } - case 3: - { + case 3: { htmltext = "30068-04.html"; break; } } break; } - case HEAD_BLACKSMITH_KUSTO: - { - if (qs.isMemoState(4)) - { + case HEAD_BLACKSMITH_KUSTO: { + if (qs.isMemoState(4)) { htmltext = "30512-01.html"; } break; } - case RESEARCHER_LORAIN: - { - switch (qs.getCond()) - { - case 1: - { + case RESEARCHER_LORAIN: { + switch (qs.getCond()) { + case 1: { htmltext = "30673-01.html"; break; } - case 2: - { + case 2: { htmltext = "30673-03.html"; break; } - case 3: - { + case 3: { qs.setMemoState(4); qs.setCond(4, true); htmltext = "30673-04.html"; break; } - case 4: - { + case 4: { htmltext = "30673-05.html"; break; } @@ -206,11 +168,8 @@ public final class Q00191_VainConclusion extends Quest break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == DOROTHY_LOCKSMITH) - { + } else if (qs.isCompleted()) { + if (npc.getId() == DOROTHY_LOCKSMITH) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00192_SevenSignsSeriesOfDoubt/Q00192_SevenSignsSeriesOfDoubt.java b/src/main/java/com/l2jserver/datapack/quests/Q00192_SevenSignsSeriesOfDoubt/Q00192_SevenSignsSeriesOfDoubt.java index 8cb6bdce15..bb4f301039 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00192_SevenSignsSeriesOfDoubt/Q00192_SevenSignsSeriesOfDoubt.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00192_SevenSignsSeriesOfDoubt/Q00192_SevenSignsSeriesOfDoubt.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.State; * Seven Signs, Series of Doubt (192) * @author Adry_85 */ -public final class Q00192_SevenSignsSeriesOfDoubt extends Quest -{ +public final class Q00192_SevenSignsSeriesOfDoubt extends Quest { // NPCs private static final int HOLLINT = 30191; private static final int HECTOR = 30197; @@ -43,8 +42,7 @@ public final class Q00192_SevenSignsSeriesOfDoubt extends Quest // Misc private static final int MIN_LEVEL = 79; - public Q00192_SevenSignsSeriesOfDoubt() - { + public Q00192_SevenSignsSeriesOfDoubt() { super(192, Q00192_SevenSignsSeriesOfDoubt.class.getSimpleName(), "Seven Signs, Series of Doubt"); addStartNpc(CROOP, UNIDENTIFIED_BODY); addTalkId(CROOP, STAN, UNIDENTIFIED_BODY, HECTOR, HOLLINT); @@ -52,32 +50,25 @@ public final class Q00192_SevenSignsSeriesOfDoubt extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "30676-02.htm": - { + switch (event) { + case "30676-02.htm": { htmltext = event; break; } - case "30676-03.html": - { + case "30676-03.html": { st.startQuest(); htmltext = event; break; } - case "video": - { - if (st.isCond(1)) - { + case "video": { + if (st.isCond(1)) { st.setCond(2, true); player.showQuestMovie(8); startQuestTimer("back", 32000, npc, player); @@ -85,26 +76,21 @@ public final class Q00192_SevenSignsSeriesOfDoubt extends Quest } break; } - case "back": - { + case "back": { player.teleToLocation(81654, 54851, -1513); return ""; } case "30676-10.html": case "30676-11.html": case "30676-12.html": - case "30676-13.html": - { - if (st.isCond(6) && st.hasQuestItems(JACOBS_NECKLACE)) - { + case "30676-13.html": { + if (st.isCond(6) && st.hasQuestItems(JACOBS_NECKLACE)) { htmltext = event; } break; } - case "30676-14.html": - { - if (st.isCond(6) && st.hasQuestItems(JACOBS_NECKLACE)) - { + case "30676-14.html": { + if (st.isCond(6) && st.hasQuestItems(JACOBS_NECKLACE)) { st.giveItems(CROOPS_LETTER, 1); st.takeItems(JACOBS_NECKLACE, -1); st.setCond(7, true); @@ -113,71 +99,54 @@ public final class Q00192_SevenSignsSeriesOfDoubt extends Quest break; } case "30200-02.html": - case "30200-03.html": - { - if (st.isCond(4)) - { + case "30200-03.html": { + if (st.isCond(4)) { htmltext = event; } break; } - case "30200-04.html": - { - if (st.isCond(4)) - { + case "30200-04.html": { + if (st.isCond(4)) { st.setCond(5, true); htmltext = event; } break; } - case "32568-02.html": - { - if (st.isCond(5)) - { + case "32568-02.html": { + if (st.isCond(5)) { st.giveItems(JACOBS_NECKLACE, 1); st.setCond(6, true); htmltext = event; } break; } - case "30197-02.html": - { - if (st.isCond(3) && st.hasQuestItems(CROOPS_INTRODUCTION)) - { + case "30197-02.html": { + if (st.isCond(3) && st.hasQuestItems(CROOPS_INTRODUCTION)) { htmltext = event; } break; } - case "30197-03.html": - { - if (st.isCond(3) && st.hasQuestItems(CROOPS_INTRODUCTION)) - { + case "30197-03.html": { + if (st.isCond(3) && st.hasQuestItems(CROOPS_INTRODUCTION)) { st.takeItems(CROOPS_INTRODUCTION, -1); st.setCond(4, true); htmltext = event; } break; } - case "30191-02.html": - { - if (st.isCond(7) && st.hasQuestItems(CROOPS_LETTER)) - { + case "30191-02.html": { + if (st.isCond(7) && st.hasQuestItems(CROOPS_LETTER)) { htmltext = event; } break; } - case "reward": - { - if (st.isCond(7) && st.hasQuestItems(CROOPS_LETTER)) - { - if (player.getLevel() >= MIN_LEVEL) - { + case "reward": { + if (st.isCond(7) && st.hasQuestItems(CROOPS_LETTER)) { + if (player.getLevel() >= MIN_LEVEL) { st.addExpAndSp(52518015, 5817677); st.exitQuest(false, true); htmltext = "30191-03.html"; - } - else - { + } else { htmltext = "level_check.html"; } } @@ -188,51 +157,35 @@ public final class Q00192_SevenSignsSeriesOfDoubt extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.COMPLETED: - { - if (npc.getId() == CROOP) - { + switch (st.getState()) { + case State.COMPLETED: { + if (npc.getId() == CROOP) { htmltext = "30676-05.html"; - } - else if (npc.getId() == UNIDENTIFIED_BODY) - { + } else if (npc.getId() == UNIDENTIFIED_BODY) { htmltext = "32568-04.html"; } break; } - case State.CREATED: - { - if (npc.getId() == CROOP) - { + case State.CREATED: { + if (npc.getId() == CROOP) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "30676-01.htm" : "30676-04.html"; - } - else if (npc.getId() == UNIDENTIFIED_BODY) - { + } else if (npc.getId() == UNIDENTIFIED_BODY) { htmltext = "32568-04.html"; } break; } - case State.STARTED: - { - switch (npc.getId()) - { - case CROOP: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (npc.getId()) { + case CROOP: { + switch (st.getCond()) { + case 1: { htmltext = "30676-06.html"; break; } - case 2: - { + case 2: { st.giveItems(CROOPS_INTRODUCTION, 1); st.setCond(3, true); htmltext = "30676-07.html"; @@ -240,15 +193,12 @@ public final class Q00192_SevenSignsSeriesOfDoubt extends Quest } case 3: case 4: - case 5: - { + case 5: { htmltext = "30676-08.html"; break; } - case 6: - { - if (st.hasQuestItems(JACOBS_NECKLACE)) - { + case 6: { + if (st.hasQuestItems(JACOBS_NECKLACE)) { htmltext = "30676-09.html"; } break; @@ -256,49 +206,34 @@ public final class Q00192_SevenSignsSeriesOfDoubt extends Quest } break; } - case HECTOR: - { - if (st.isCond(3)) - { - if (st.hasQuestItems(CROOPS_INTRODUCTION)) - { + case HECTOR: { + if (st.isCond(3)) { + if (st.hasQuestItems(CROOPS_INTRODUCTION)) { htmltext = "30197-01.html"; } - } - else if (st.getCond() > 3) - { + } else if (st.getCond() > 3) { htmltext = "30197-04.html"; } break; } - case STAN: - { - if (st.isCond(4)) - { + case STAN: { + if (st.isCond(4)) { htmltext = "30200-01.html"; - } - else if (st.getCond() > 4) - { + } else if (st.getCond() > 4) { htmltext = "30200-05.html"; } break; } - case UNIDENTIFIED_BODY: - { - if (st.isCond(5)) - { + case UNIDENTIFIED_BODY: { + if (st.isCond(5)) { htmltext = "32568-01.html"; - } - else if (st.getCond() < 5) - { + } else if (st.getCond() < 5) { htmltext = "32568-03.html"; } break; } - case HOLLINT: - { - if (st.isCond(7) && st.hasQuestItems(CROOPS_LETTER)) - { + case HOLLINT: { + if (st.isCond(7) && st.hasQuestItems(CROOPS_LETTER)) { htmltext = "30191-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00193_SevenSignsDyingMessage/Q00193_SevenSignsDyingMessage.java b/src/main/java/com/l2jserver/datapack/quests/Q00193_SevenSignsDyingMessage/Q00193_SevenSignsDyingMessage.java index a1650e9b9a..af9004a8b3 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00193_SevenSignsDyingMessage/Q00193_SevenSignsDyingMessage.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00193_SevenSignsDyingMessage/Q00193_SevenSignsDyingMessage.java @@ -36,8 +36,7 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * Seven Signs, Dying Message (193) * @author Adry_85 */ -public final class Q00193_SevenSignsDyingMessage extends Quest -{ +public final class Q00193_SevenSignsDyingMessage extends Quest { // NPCs private static final int SHILENS_EVIL_THOUGHTS = 27343; private static final int HOLLINT = 30191; @@ -54,8 +53,7 @@ public final class Q00193_SevenSignsDyingMessage extends Quest // Skill private static final SkillHolder NPC_HEAL = new SkillHolder(4065, 8); - public Q00193_SevenSignsDyingMessage() - { + public Q00193_SevenSignsDyingMessage() { super(193, Q00193_SevenSignsDyingMessage.class.getSimpleName(), "Seven Signs, Dying Message"); addStartNpc(HOLLINT); addTalkId(HOLLINT, CAIN, ERIC, SIR_GUSTAV_ATHEBALDT); @@ -64,12 +62,9 @@ public final class Q00193_SevenSignsDyingMessage extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if ((npc.getId() == SHILENS_EVIL_THOUGHTS) && "despawn".equals(event)) - { - if (!npc.isDead()) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if ((npc.getId() == SHILENS_EVIL_THOUGHTS) && "despawn".equals(event)) { + if (!npc.isDead()) { isBusy = false; npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.NEXT_TIME_YOU_WILL_NOT_ESCAPE)); npc.deleteMe(); @@ -78,16 +73,13 @@ public final class Q00193_SevenSignsDyingMessage extends Quest } final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "30191-02.html": - { + switch (event) { + case "30191-02.html": { st.giveItems(JACOBS_NECKLACE, 1); st.startQuest(); htmltext = event; @@ -95,28 +87,22 @@ public final class Q00193_SevenSignsDyingMessage extends Quest } case "32569-02.html": case "32569-03.html": - case "32569-04.html": - { - if (st.isCond(1) && st.hasQuestItems(JACOBS_NECKLACE)) - { + case "32569-04.html": { + if (st.isCond(1) && st.hasQuestItems(JACOBS_NECKLACE)) { htmltext = event; } break; } - case "32569-05.html": - { - if (st.isCond(1) && st.hasQuestItems(JACOBS_NECKLACE)) - { + case "32569-05.html": { + if (st.isCond(1) && st.hasQuestItems(JACOBS_NECKLACE)) { st.takeItems(JACOBS_NECKLACE, -1); st.setCond(2, true); htmltext = event; } break; } - case "showmovie": - { - if (st.isCond(3) && st.hasQuestItems(DEADMANS_HERB)) - { + case "showmovie": { + if (st.isCond(3) && st.hasQuestItems(DEADMANS_HERB)) { st.takeItems(DEADMANS_HERB, -1); st.setCond(4, true); player.showQuestMovie(9); @@ -125,39 +111,31 @@ public final class Q00193_SevenSignsDyingMessage extends Quest break; } case "32569-10.html": - case "32569-11.html": - { - if (st.isCond(5) && st.hasQuestItems(SCULPTURE_OF_DOUBT)) - { + case "32569-11.html": { + if (st.isCond(5) && st.hasQuestItems(SCULPTURE_OF_DOUBT)) { htmltext = event; } break; } - case "32569-12.html": - { - if (st.isCond(5) && st.hasQuestItems(SCULPTURE_OF_DOUBT)) - { + case "32569-12.html": { + if (st.isCond(5) && st.hasQuestItems(SCULPTURE_OF_DOUBT)) { st.takeItems(SCULPTURE_OF_DOUBT, -1); st.setCond(6, true); htmltext = event; } break; } - case "32570-02.html": - { - if (st.isCond(2)) - { + case "32570-02.html": { + if (st.isCond(2)) { st.giveItems(DEADMANS_HERB, 1); st.setCond(3, true); htmltext = event; } break; } - case "fight": - { + case "fight": { htmltext = "32569-14.html"; - if (st.isCond(4)) - { + if (st.isCond(4)) { isBusy = true; NpcSay ns = new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.S1_THAT_STRANGER_MUST_BE_DEFEATED_HERE_IS_THE_ULTIMATE_HELP); ns.addStringParameter(player.getName()); @@ -172,34 +150,25 @@ public final class Q00193_SevenSignsDyingMessage extends Quest } break; } - case "heal": - { - if (!npc.isInsideRadius(player, 600, true, false)) - { + case "heal": { + if (!npc.isInsideRadius(player, 600, true, false)) { NpcSay ns = new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.LOOK_HERE_S1_DONT_FALL_TOO_FAR_BEHIND); ns.addStringParameter(player.getName()); npc.broadcastPacket(ns); - } - else if (!player.isDead()) - { + } else if (!player.isDead()) { npc.setTarget(player); npc.doCast(NPC_HEAL); } startQuestTimer("heal", 30000 - getRandom(20000), npc, player); break; } - case "reward": - { - if (st.isCond(6)) - { - if (player.getLevel() >= MIN_LEVEL) - { + case "reward": { + if (st.isCond(6)) { + if (player.getLevel() >= MIN_LEVEL) { st.addExpAndSp(52518015, 5817677); st.exitQuest(false, true); htmltext = "30760-02.html"; - } - else - { + } else { htmltext = "level_check.html"; } } @@ -210,17 +179,14 @@ public final class Q00193_SevenSignsDyingMessage extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(player, 4); - if (partyMember == null) - { + if (partyMember == null) { return null; } final QuestState st = getQuestState(partyMember, false); - if (npc.isInsideRadius(partyMember, 1500, true, false)) - { + if (npc.isInsideRadius(partyMember, 1500, true, false)) { st.giveItems(SCULPTURE_OF_DOUBT, 1); st.playSound(Sound.ITEMSOUND_QUEST_FINISH); st.setCond(5); @@ -234,78 +200,56 @@ public final class Q00193_SevenSignsDyingMessage extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.COMPLETED: - { + switch (st.getState()) { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } - case State.CREATED: - { - if (npc.getId() == HOLLINT) - { + case State.CREATED: { + if (npc.getId() == HOLLINT) { htmltext = ((player.getLevel() >= MIN_LEVEL) && player.hasQuestCompleted(Q00192_SevenSignsSeriesOfDoubt.class.getSimpleName())) ? "30191-01.htm" : "30191-03.html"; } break; } - case State.STARTED: - { - switch (npc.getId()) - { - case HOLLINT: - { - if (st.isCond(1) && st.hasQuestItems(JACOBS_NECKLACE)) - { + case State.STARTED: { + switch (npc.getId()) { + case HOLLINT: { + if (st.isCond(1) && st.hasQuestItems(JACOBS_NECKLACE)) { htmltext = "30191-04.html"; } break; } - case CAIN: - { - switch (st.getCond()) - { - case 1: - { - if (st.hasQuestItems(JACOBS_NECKLACE)) - { + case CAIN: { + switch (st.getCond()) { + case 1: { + if (st.hasQuestItems(JACOBS_NECKLACE)) { htmltext = "32569-01.html"; } break; } - case 2: - { + case 2: { htmltext = "32569-06.html"; break; } - case 3: - { - if (st.hasQuestItems(DEADMANS_HERB)) - { + case 3: { + if (st.hasQuestItems(DEADMANS_HERB)) { htmltext = "32569-07.html"; } break; } - case 4: - { - if (isBusy) - { + case 4: { + if (isBusy) { htmltext = "32569-13.html"; - } - else - { + } else { htmltext = "32569-08.html"; } break; } - case 5: - { - if (st.hasQuestItems(SCULPTURE_OF_DOUBT)) - { + case 5: { + if (st.hasQuestItems(SCULPTURE_OF_DOUBT)) { htmltext = "32569-09.html"; } break; @@ -313,27 +257,21 @@ public final class Q00193_SevenSignsDyingMessage extends Quest } break; } - case ERIC: - { - switch (st.getCond()) - { - case 2: - { + case ERIC: { + switch (st.getCond()) { + case 2: { htmltext = "32570-01.html"; break; } - case 3: - { + case 3: { htmltext = "32570-03.html"; break; } } break; } - case SIR_GUSTAV_ATHEBALDT: - { - if (st.isCond(6)) - { + case SIR_GUSTAV_ATHEBALDT: { + if (st.isCond(6)) { htmltext = "30760-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00194_SevenSignsMammonsContract/Q00194_SevenSignsMammonsContract.java b/src/main/java/com/l2jserver/datapack/quests/Q00194_SevenSignsMammonsContract/Q00194_SevenSignsMammonsContract.java index 4e843e2b1c..5e8b903e93 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00194_SevenSignsMammonsContract/Q00194_SevenSignsMammonsContract.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00194_SevenSignsMammonsContract/Q00194_SevenSignsMammonsContract.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.State; * Seven Signs, Mammon's Contract (194) * @author Adry_85 */ -public final class Q00194_SevenSignsMammonsContract extends Quest -{ +public final class Q00194_SevenSignsMammonsContract extends Quest { // NPCs private static final int SIR_GUSTAV_ATHEBALDT = 30760; private static final int CLAUDIA_ATHEBALDT = 31001; @@ -52,8 +51,7 @@ public final class Q00194_SevenSignsMammonsContract extends Quest private static final SkillHolder TRANSFORMATION_KID = new SkillHolder(6202); private static final SkillHolder TRANSFORMATION_NATIVE = new SkillHolder(6203); - public Q00194_SevenSignsMammonsContract() - { + public Q00194_SevenSignsMammonsContract() { super(194, Q00194_SevenSignsMammonsContract.class.getSimpleName(), "Seven Signs, Mammon's Contract"); addStartNpc(SIR_GUSTAV_ATHEBALDT); addTalkId(SIR_GUSTAV_ATHEBALDT, COLIN, FROG, TESS, KUTA, CLAUDIA_ATHEBALDT); @@ -61,54 +59,42 @@ public final class Q00194_SevenSignsMammonsContract extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "30760-02.html": - { + switch (event) { + case "30760-02.html": { st.startQuest(); htmltext = event; break; } - case "30760-03.html": - { - if (st.isCond(1)) - { + case "30760-03.html": { + if (st.isCond(1)) { htmltext = event; } break; } - case "30760-04.html": - { - if (st.isCond(1)) - { + case "30760-04.html": { + if (st.isCond(1)) { htmltext = event; st.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); } break; } - case "showmovie": - { - if (st.isCond(1)) - { + case "showmovie": { + if (st.isCond(1)) { st.setCond(2, true); player.showQuestMovie(10); return ""; } break; } - case "30760-07.html": - { - if (st.isCond(2)) - { + case "30760-07.html": { + if (st.isCond(2)) { st.giveItems(ATHEBALDTS_INTRODUCTION, 1); st.setCond(3, true); htmltext = event; @@ -116,18 +102,14 @@ public final class Q00194_SevenSignsMammonsContract extends Quest break; } case "32571-03.html": - case "32571-04.html": - { - if (st.isCond(3) && st.hasQuestItems(ATHEBALDTS_INTRODUCTION)) - { + case "32571-04.html": { + if (st.isCond(3) && st.hasQuestItems(ATHEBALDTS_INTRODUCTION)) { htmltext = event; } break; } - case "32571-05.html": - { - if (st.isCond(3) && st.hasQuestItems(ATHEBALDTS_INTRODUCTION)) - { + case "32571-05.html": { + if (st.isCond(3) && st.hasQuestItems(ATHEBALDTS_INTRODUCTION)) { st.takeItems(ATHEBALDTS_INTRODUCTION, -1); npc.setTarget(player); npc.doCast(TRANSFORMATION_FROG); @@ -136,43 +118,34 @@ public final class Q00194_SevenSignsMammonsContract extends Quest } break; } - case "32571-07.html": - { - if (st.isCond(4) && (player.getTransformationId() != 111) && !st.hasQuestItems(FROG_KINGS_BEAD)) - { + case "32571-07.html": { + if (st.isCond(4) && (player.getTransformationId() != 111) && !st.hasQuestItems(FROG_KINGS_BEAD)) { npc.setTarget(player); npc.doCast(TRANSFORMATION_FROG); htmltext = event; } break; } - case "32571-09.html": - { - if (st.isCond(4) && (player.getTransformationId() == 111) && !st.hasQuestItems(FROG_KINGS_BEAD)) - { + case "32571-09.html": { + if (st.isCond(4) && (player.getTransformationId() == 111) && !st.hasQuestItems(FROG_KINGS_BEAD)) { player.stopAllEffects(); htmltext = event; } break; } - case "32571-11.html": - { - if (st.isCond(5) && st.hasQuestItems(FROG_KINGS_BEAD)) - { + case "32571-11.html": { + if (st.isCond(5) && st.hasQuestItems(FROG_KINGS_BEAD)) { st.takeItems(FROG_KINGS_BEAD, -1); st.setCond(6, true); htmltext = event; - if (player.getTransformationId() == 111) - { + if (player.getTransformationId() == 111) { player.stopAllEffects(); } } break; } - case "32571-13.html": - { - if (st.isCond(6)) - { + case "32571-13.html": { + if (st.isCond(6)) { npc.setTarget(player); npc.doCast(TRANSFORMATION_KID); st.setCond(7, true); @@ -180,43 +153,34 @@ public final class Q00194_SevenSignsMammonsContract extends Quest } break; } - case "32571-15.html": - { - if (st.isCond(7) && (player.getTransformationId() != 112) && !st.hasQuestItems(GRANDA_TESS_CANDY_POUCH)) - { + case "32571-15.html": { + if (st.isCond(7) && (player.getTransformationId() != 112) && !st.hasQuestItems(GRANDA_TESS_CANDY_POUCH)) { npc.setTarget(player); npc.doCast(TRANSFORMATION_KID); htmltext = event; } break; } - case "32571-17.html": - { - if (st.isCond(7) && (player.getTransformationId() == 112) && !st.hasQuestItems(GRANDA_TESS_CANDY_POUCH)) - { + case "32571-17.html": { + if (st.isCond(7) && (player.getTransformationId() == 112) && !st.hasQuestItems(GRANDA_TESS_CANDY_POUCH)) { player.stopAllEffects(); htmltext = event; } break; } - case "32571-19.html": - { - if (st.isCond(8) && st.hasQuestItems(GRANDA_TESS_CANDY_POUCH)) - { + case "32571-19.html": { + if (st.isCond(8) && st.hasQuestItems(GRANDA_TESS_CANDY_POUCH)) { st.takeItems(GRANDA_TESS_CANDY_POUCH, -1); st.setCond(9, true); htmltext = event; - if (player.getTransformationId() == 112) - { + if (player.getTransformationId() == 112) { player.stopAllEffects(); } } break; } - case "32571-21.html": - { - if (st.isCond(9)) - { + case "32571-21.html": { + if (st.isCond(9)) { npc.setTarget(player); npc.doCast(TRANSFORMATION_NATIVE); st.setCond(10, true); @@ -224,70 +188,55 @@ public final class Q00194_SevenSignsMammonsContract extends Quest } break; } - case "32571-23.html": - { - if (st.isCond(10) && (player.getTransformationId() != 124) && !st.hasQuestItems(NATIVES_GLOVE)) - { + case "32571-23.html": { + if (st.isCond(10) && (player.getTransformationId() != 124) && !st.hasQuestItems(NATIVES_GLOVE)) { npc.setTarget(player); npc.doCast(TRANSFORMATION_NATIVE); htmltext = event; } break; } - case "32571-25.html": - { - if (st.isCond(10) && (player.getTransformationId() == 124) && !st.hasQuestItems(NATIVES_GLOVE)) - { + case "32571-25.html": { + if (st.isCond(10) && (player.getTransformationId() == 124) && !st.hasQuestItems(NATIVES_GLOVE)) { player.stopAllEffects(); htmltext = event; } break; } - case "32571-27.html": - { - if (st.isCond(11) && st.hasQuestItems(NATIVES_GLOVE)) - { + case "32571-27.html": { + if (st.isCond(11) && st.hasQuestItems(NATIVES_GLOVE)) { st.takeItems(NATIVES_GLOVE, -1); st.setCond(12, true); htmltext = event; - if (player.getTransformationId() == 124) - { + if (player.getTransformationId() == 124) { player.stopAllEffects(); } } break; } case "32572-03.html": - case "32572-04.html": - { - if (st.isCond(4)) - { + case "32572-04.html": { + if (st.isCond(4)) { htmltext = event; } break; } - case "32572-05.html": - { - if (st.isCond(4)) - { + case "32572-05.html": { + if (st.isCond(4)) { st.giveItems(FROG_KINGS_BEAD, 1); st.setCond(5, true); htmltext = event; } break; } - case "32573-03.html": - { - if (st.isCond(7)) - { + case "32573-03.html": { + if (st.isCond(7)) { htmltext = event; } break; } - case "32573-04.html": - { - if (st.isCond(7)) - { + case "32573-04.html": { + if (st.isCond(7)) { st.giveItems(GRANDA_TESS_CANDY_POUCH, 1); st.setCond(8, true); htmltext = event; @@ -295,44 +244,33 @@ public final class Q00194_SevenSignsMammonsContract extends Quest break; } case "32574-03.html": - case "32574-04.html": - { - if (st.isCond(10)) - { + case "32574-04.html": { + if (st.isCond(10)) { htmltext = event; } break; } - case "32574-05.html": - { - if (st.isCond(10)) - { + case "32574-05.html": { + if (st.isCond(10)) { st.giveItems(NATIVES_GLOVE, 1); st.setCond(11, true); htmltext = event; } break; } - case "31001-02.html": - { - if (st.isCond(12)) - { + case "31001-02.html": { + if (st.isCond(12)) { htmltext = event; } break; } - case "31001-03.html": - { - if (st.isCond(12)) - { - if (player.getLevel() >= MIN_LEVEL) - { + case "31001-03.html": { + if (st.isCond(12)) { + if (player.getLevel() >= MIN_LEVEL) { st.addExpAndSp(52518015, 5817677); st.exitQuest(false, true); htmltext = event; - } - else - { + } else { htmltext = "level_check.html"; } } @@ -343,149 +281,110 @@ public final class Q00194_SevenSignsMammonsContract extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.COMPLETED: - { + switch (st.getState()) { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } - case State.CREATED: - { - if (npc.getId() == SIR_GUSTAV_ATHEBALDT) - { + case State.CREATED: { + if (npc.getId() == SIR_GUSTAV_ATHEBALDT) { htmltext = ((player.getLevel() >= MIN_LEVEL) && player.hasQuestCompleted(Q00193_SevenSignsDyingMessage.class.getSimpleName())) ? "30760-01.htm" : "30760-05.html"; } break; } - case State.STARTED: - { - switch (npc.getId()) - { - case SIR_GUSTAV_ATHEBALDT: - { - if (st.isCond(1)) - { + case State.STARTED: { + switch (npc.getId()) { + case SIR_GUSTAV_ATHEBALDT: { + if (st.isCond(1)) { htmltext = "30760-02.html"; - } - else if (st.isCond(2)) - { + } else if (st.isCond(2)) { htmltext = "30760-06.html"; - } - else if (st.isCond(3) && st.hasQuestItems(ATHEBALDTS_INTRODUCTION)) - { + } else if (st.isCond(3) && st.hasQuestItems(ATHEBALDTS_INTRODUCTION)) { htmltext = "30760-08.html"; } break; } - case COLIN: - { - switch (st.getCond()) - { + case COLIN: { + switch (st.getCond()) { case 1: - case 2: - { + case 2: { htmltext = "32571-01.html"; break; } - case 3: - { - if (st.hasQuestItems(ATHEBALDTS_INTRODUCTION)) - { + case 3: { + if (st.hasQuestItems(ATHEBALDTS_INTRODUCTION)) { htmltext = "32571-02.html"; } break; } - case 4: - { - if (!st.hasQuestItems(FROG_KINGS_BEAD)) - { + case 4: { + if (!st.hasQuestItems(FROG_KINGS_BEAD)) { htmltext = (player.getTransformationId() != 111) ? "32571-06.html" : "32571-08.html"; } break; } - case 5: - { - if (st.hasQuestItems(FROG_KINGS_BEAD)) - { + case 5: { + if (st.hasQuestItems(FROG_KINGS_BEAD)) { htmltext = "32571-10.html"; } break; } - case 6: - { + case 6: { htmltext = "32571-12.html"; break; } - case 7: - { - if (!st.hasQuestItems(GRANDA_TESS_CANDY_POUCH)) - { + case 7: { + if (!st.hasQuestItems(GRANDA_TESS_CANDY_POUCH)) { htmltext = (player.getTransformationId() != 112) ? "32571-14.html" : "32571-16.html"; } break; } - case 8: - { - if (st.hasQuestItems(GRANDA_TESS_CANDY_POUCH)) - { + case 8: { + if (st.hasQuestItems(GRANDA_TESS_CANDY_POUCH)) { htmltext = "32571-18.html"; } break; } - case 9: - { + case 9: { htmltext = "32571-20.html"; break; } - case 10: - { - if (!st.hasQuestItems(NATIVES_GLOVE)) - { + case 10: { + if (!st.hasQuestItems(NATIVES_GLOVE)) { htmltext = (player.getTransformationId() != 124) ? "32571-22.html" : "32571-24.html"; } break; } - case 11: - { - if (st.hasQuestItems(NATIVES_GLOVE)) - { + case 11: { + if (st.hasQuestItems(NATIVES_GLOVE)) { htmltext = "32571-26.html"; } break; } - case 12: - { + case 12: { htmltext = "32571-28.html"; break; } } break; } - case FROG: - { - switch (st.getCond()) - { + case FROG: { + switch (st.getCond()) { case 1: case 2: - case 3: - { + case 3: { htmltext = "32572-01.html"; break; } - case 4: - { + case 4: { htmltext = (player.getTransformationId() == 111) ? "32572-02.html" : "32572-06.html"; break; } - case 5: - { - if (st.hasQuestItems(FROG_KINGS_BEAD) && (player.getTransformationId() == 111)) - { + case 5: { + if (st.hasQuestItems(FROG_KINGS_BEAD) && (player.getTransformationId() == 111)) { htmltext = "32572-07.html"; } break; @@ -493,29 +392,23 @@ public final class Q00194_SevenSignsMammonsContract extends Quest } break; } - case TESS: - { - switch (st.getCond()) - { + case TESS: { + switch (st.getCond()) { case 1: case 2: case 3: case 4: case 5: - case 6: - { + case 6: { htmltext = "32573-01.html"; break; } - case 7: - { + case 7: { htmltext = (player.getTransformationId() == 112) ? "32573-02.html" : "32573-05.html"; break; } - case 8: - { - if (st.hasQuestItems(GRANDA_TESS_CANDY_POUCH) && (player.getTransformationId() == 112)) - { + case 8: { + if (st.hasQuestItems(GRANDA_TESS_CANDY_POUCH) && (player.getTransformationId() == 112)) { htmltext = "32573-06.html"; } break; @@ -523,10 +416,8 @@ public final class Q00194_SevenSignsMammonsContract extends Quest } break; } - case KUTA: - { - switch (st.getCond()) - { + case KUTA: { + switch (st.getCond()) { case 1: case 2: case 3: @@ -535,20 +426,16 @@ public final class Q00194_SevenSignsMammonsContract extends Quest case 6: case 7: case 8: - case 9: - { + case 9: { htmltext = "32574-01.html"; break; } - case 10: - { + case 10: { htmltext = (player.getTransformationId() == 124) ? "32574-02.html" : "32574-06.html"; break; } - case 11: - { - if (st.hasQuestItems(NATIVES_GLOVE) && (player.getTransformationId() == 124)) - { + case 11: { + if (st.hasQuestItems(NATIVES_GLOVE) && (player.getTransformationId() == 124)) { htmltext = "32574-07.html"; } break; @@ -556,10 +443,8 @@ public final class Q00194_SevenSignsMammonsContract extends Quest } break; } - case CLAUDIA_ATHEBALDT: - { - if (st.isCond(12)) - { + case CLAUDIA_ATHEBALDT: { + if (st.isCond(12)) { htmltext = "31001-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00195_SevenSignsSecretRitualOfThePriests/Q00195_SevenSignsSecretRitualOfThePriests.java b/src/main/java/com/l2jserver/datapack/quests/Q00195_SevenSignsSecretRitualOfThePriests/Q00195_SevenSignsSecretRitualOfThePriests.java index b299d0253a..bb5fa00038 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00195_SevenSignsSecretRitualOfThePriests/Q00195_SevenSignsSecretRitualOfThePriests.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00195_SevenSignsSecretRitualOfThePriests/Q00195_SevenSignsSecretRitualOfThePriests.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.State; * Seven Signs, Secret Ritual of the Priests (195) * @author Adry_85 */ -public final class Q00195_SevenSignsSecretRitualOfThePriests extends Quest -{ +public final class Q00195_SevenSignsSecretRitualOfThePriests extends Quest { // NPCs private static final int RAYMOND = 30289; private static final int IASON_HEINE = 30969; @@ -51,8 +50,7 @@ public final class Q00195_SevenSignsSecretRitualOfThePriests extends Quest // private static SkillHolder TRANSFORM_DISPEL = new SkillHolder(6200, 1); private static final SkillHolder TRANSFORMATION = new SkillHolder(6204); - public Q00195_SevenSignsSecretRitualOfThePriests() - { + public Q00195_SevenSignsSecretRitualOfThePriests() { super(195, Q00195_SevenSignsSecretRitualOfThePriests.class.getSimpleName(), "Seven Signs, Secret Ritual of the Priests"); addFirstTalkId(IDENTITY_CONFIRM_DEVICE, PASSWORD_ENTRY_DEVICE, DARKNESS_OF_DAWN, SHELF); addStartNpc(CLAUDIA_ATHEBALDT); @@ -61,35 +59,28 @@ public final class Q00195_SevenSignsSecretRitualOfThePriests extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "31001-03.html": case "31001-04.html": case "31001-05.html": - case "32580-03.html": - { + case "32580-03.html": { htmltext = event; break; } - case "31001-06.html": - { + case "31001-06.html": { st.startQuest(); htmltext = event; break; } - case "32576-02.html": - { - if (st.isCond(1)) - { + case "32576-02.html": { + if (st.isCond(1)) { st.giveItems(IDENTITY_CARD, 1); st.setCond(2, true); htmltext = event; @@ -98,18 +89,14 @@ public final class Q00195_SevenSignsSecretRitualOfThePriests extends Quest } case "30289-02.html": case "30289-03.html": - case "30289-05.html": - { - if (st.isCond(2)) - { + case "30289-05.html": { + if (st.isCond(2)) { htmltext = event; } break; } - case "30289-04.html": - { - if (st.isCond(2)) - { + case "30289-04.html": { + if (st.isCond(2)) { npc.setTarget(player); npc.doCast(TRANSFORMATION); st.setCond(3, true); @@ -117,69 +104,53 @@ public final class Q00195_SevenSignsSecretRitualOfThePriests extends Quest } break; } - case "30289-07.html": - { - if (st.isCond(3)) - { + case "30289-07.html": { + if (st.isCond(3)) { htmltext = event; } break; } - case "30289-08.html": - { - if (st.isCond(3) && st.hasQuestItems(IDENTITY_CARD) && st.hasQuestItems(SHUNAIMANS_CONTRACT)) - { + case "30289-08.html": { + if (st.isCond(3) && st.hasQuestItems(IDENTITY_CARD) && st.hasQuestItems(SHUNAIMANS_CONTRACT)) { st.takeItems(IDENTITY_CARD, -1); st.setCond(4, true); htmltext = event; - if (player.getTransformationId() == 113) - { + if (player.getTransformationId() == 113) { // player.doCast(TRANSFORM_DISPEL); player.stopAllEffects(); } } break; } - case "30289-10.html": - { - if (st.isCond(3)) - { + case "30289-10.html": { + if (st.isCond(3)) { npc.setTarget(player); npc.doCast(TRANSFORMATION); htmltext = event; } break; } - case "30289-11.html": - { - if (st.isCond(3)) - { + case "30289-11.html": { + if (st.isCond(3)) { // player.doCast(TRANSFORM_DISPEL); player.stopAllEffects(); htmltext = event; } break; } - case "30969-02.html": - { - if (st.isCond(4) && st.hasQuestItems(SHUNAIMANS_CONTRACT)) - { + case "30969-02.html": { + if (st.isCond(4) && st.hasQuestItems(SHUNAIMANS_CONTRACT)) { htmltext = event; } break; } - case "reward": - { - if (st.isCond(4) && st.hasQuestItems(SHUNAIMANS_CONTRACT)) - { - if (player.getLevel() >= MIN_LEVEL) - { + case "reward": { + if (st.isCond(4) && st.hasQuestItems(SHUNAIMANS_CONTRACT)) { + if (player.getLevel() >= MIN_LEVEL) { st.addExpAndSp(52518015, 5817677); st.exitQuest(false, true); htmltext = "30969-03.html"; - } - else - { + } else { htmltext = "level_check.html"; } } @@ -190,28 +161,22 @@ public final class Q00195_SevenSignsSecretRitualOfThePriests extends Quest } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (npc.getId()) - { - case IDENTITY_CONFIRM_DEVICE: - { + switch (npc.getId()) { + case IDENTITY_CONFIRM_DEVICE: { htmltext = "32578-01.html"; break; } - case PASSWORD_ENTRY_DEVICE: - { + case PASSWORD_ENTRY_DEVICE: { htmltext = "32577-01.html"; break; } - case DARKNESS_OF_DAWN: - { + case DARKNESS_OF_DAWN: { htmltext = "32579-01.html"; break; } - case SHELF: - { + case SHELF: { htmltext = "32580-01.html"; break; } @@ -220,123 +185,92 @@ public final class Q00195_SevenSignsSecretRitualOfThePriests extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.COMPLETED: - { + switch (st.getState()) { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } - case State.CREATED: - { - if (npc.getId() == CLAUDIA_ATHEBALDT) - { + case State.CREATED: { + if (npc.getId() == CLAUDIA_ATHEBALDT) { htmltext = ((player.getLevel() >= MIN_LEVEL) && player.hasQuestCompleted(Q00194_SevenSignsMammonsContract.class.getSimpleName())) ? "31001-01.htm" : "31001-02.html"; } break; } - case State.STARTED: - { - switch (npc.getId()) - { - case CLAUDIA_ATHEBALDT: - { - if (st.isCond(1)) - { + case State.STARTED: { + switch (npc.getId()) { + case CLAUDIA_ATHEBALDT: { + if (st.isCond(1)) { htmltext = "31001-07.html"; } break; } - case JOHN: - { - switch (st.getCond()) - { - case 1: - { + case JOHN: { + switch (st.getCond()) { + case 1: { htmltext = "32576-01.html"; break; } - case 2: - { + case 2: { htmltext = "32576-03.html"; break; } } break; } - case RAYMOND: - { - switch (st.getCond()) - { - case 2: - { - if (st.hasQuestItems(IDENTITY_CARD) && (player.getTransformationId() != 113)) - { + case RAYMOND: { + switch (st.getCond()) { + case 2: { + if (st.hasQuestItems(IDENTITY_CARD) && (player.getTransformationId() != 113)) { htmltext = "30289-01.html"; } break; } - case 3: - { - if (st.hasQuestItems(IDENTITY_CARD)) - { + case 3: { + if (st.hasQuestItems(IDENTITY_CARD)) { htmltext = st.hasQuestItems(SHUNAIMANS_CONTRACT) ? "30289-06.html" : "30289-09.html"; } break; } - case 4: - { + case 4: { htmltext = "30289-12.html"; break; } } break; } - case LIGHT_OF_DAWN: - { - if (st.isCond(3)) - { - if (st.hasQuestItems(IDENTITY_CARD)) - { + case LIGHT_OF_DAWN: { + if (st.isCond(3)) { + if (st.hasQuestItems(IDENTITY_CARD)) { htmltext = "31001-07.html"; } } break; } - case PASSWORD_ENTRY_DEVICE: - { - if (st.isCond(3) && st.hasQuestItems(IDENTITY_CARD)) - { + case PASSWORD_ENTRY_DEVICE: { + if (st.isCond(3) && st.hasQuestItems(IDENTITY_CARD)) { htmltext = "32577-02.html"; player.teleToLocation(-78240, 205858, -7856); } break; } - case SHELF: - { - if (st.isCond(3) && !st.hasQuestItems(SHUNAIMANS_CONTRACT)) - { + case SHELF: { + if (st.isCond(3) && !st.hasQuestItems(SHUNAIMANS_CONTRACT)) { st.giveItems(SHUNAIMANS_CONTRACT, 1); htmltext = "32580-02.html"; } break; } - case DARKNESS_OF_DAWN: - { - if (st.isCond(3) && !st.hasQuestItems(SHUNAIMANS_CONTRACT)) - { + case DARKNESS_OF_DAWN: { + if (st.isCond(3) && !st.hasQuestItems(SHUNAIMANS_CONTRACT)) { htmltext = "32579-02.html"; } break; } - case IASON_HEINE: - { - if (st.isCond(4) && st.hasQuestItems(SHUNAIMANS_CONTRACT)) - { + case IASON_HEINE: { + if (st.isCond(4) && st.hasQuestItems(SHUNAIMANS_CONTRACT)) { htmltext = "30969-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00196_SevenSignsSealOfTheEmperor/Q00196_SevenSignsSealOfTheEmperor.java b/src/main/java/com/l2jserver/datapack/quests/Q00196_SevenSignsSealOfTheEmperor/Q00196_SevenSignsSealOfTheEmperor.java index 7d5bd2e0e9..5874b0b272 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00196_SevenSignsSealOfTheEmperor/Q00196_SevenSignsSealOfTheEmperor.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00196_SevenSignsSealOfTheEmperor/Q00196_SevenSignsSealOfTheEmperor.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * Seven Signs, Seal of the Emperor (196) * @author Adry_85 */ -public final class Q00196_SevenSignsSealOfTheEmperor extends Quest -{ +public final class Q00196_SevenSignsSealOfTheEmperor extends Quest { // NPCs private static final int IASON_HEINE = 30969; private static final int MERCHANT_OF_MAMMON = 32584; @@ -50,8 +49,7 @@ public final class Q00196_SevenSignsSealOfTheEmperor extends Quest private static final int MIN_LEVEL = 79; private boolean isBusy = false; - public Q00196_SevenSignsSealOfTheEmperor() - { + public Q00196_SevenSignsSealOfTheEmperor() { super(196, Q00196_SevenSignsSealOfTheEmperor.class.getSimpleName(), "Seven Signs, Seal of the Emperor"); addFirstTalkId(MERCHANT_OF_MAMMON); addStartNpc(IASON_HEINE); @@ -60,10 +58,8 @@ public final class Q00196_SevenSignsSealOfTheEmperor extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if ((npc.getId() == MERCHANT_OF_MAMMON) && "DESPAWN".equals(event)) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if ((npc.getId() == MERCHANT_OF_MAMMON) && "DESPAWN".equals(event)) { isBusy = false; npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.THE_ANCIENT_PROMISE_TO_THE_EMPEROR_HAS_BEEN_FULFILLED)); npc.deleteMe(); @@ -71,59 +67,46 @@ public final class Q00196_SevenSignsSealOfTheEmperor extends Quest } final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "30969-02.htm": case "30969-03.htm": - case "30969-04.htm": - { + case "30969-04.htm": { htmltext = event; break; } - case "30969-05.html": - { + case "30969-05.html": { st.startQuest(); htmltext = event; break; } - case "ssq_mammon": - { - if (st.isCond(1)) - { - if (!isBusy) - { + case "ssq_mammon": { + if (st.isCond(1)) { + if (!isBusy) { isBusy = true; npc.setScriptValue(1); final L2Npc merchant = addSpawn(MERCHANT_OF_MAMMON, 109743, 219975, -3512, 0, false, 0, false); merchant.broadcastPacket(new NpcSay(merchant.getObjectId(), Say2.NPC_ALL, merchant.getId(), NpcStringId.WHO_DARES_SUMMON_THE_MERCHANT_OF_MAMMON)); htmltext = "30969-06.html"; startQuestTimer("DESPAWN", 120000, merchant, null); - } - else - { + } else { htmltext = "30969-07.html"; } } break; } - case "30969-13.html": - { - if (st.isCond(5)) - { + case "30969-13.html": { + if (st.isCond(5)) { htmltext = event; } break; } - case "30969-14.html": - { - if (st.isCond(5)) - { + case "30969-14.html": { + if (st.isCond(5)) { st.setCond(6, true); htmltext = event; } @@ -131,18 +114,14 @@ public final class Q00196_SevenSignsSealOfTheEmperor extends Quest } case "32584-02.html": case "32584-03.html": - case "32584-04.html": - { - if (st.isCond(1)) - { + case "32584-04.html": { + if (st.isCond(1)) { htmltext = event; } break; } - case "32584-05.html": - { - if (st.isCond(1)) - { + case "32584-05.html": { + if (st.isCond(1)) { st.setCond(2, true); htmltext = event; cancelQuestTimers("DESPAWN"); @@ -154,18 +133,14 @@ public final class Q00196_SevenSignsSealOfTheEmperor extends Quest case "32586-02.html": case "32586-03.html": case "32586-04.html": - case "32586-06.html": - { - if (st.isCond(3)) - { + case "32586-06.html": { + if (st.isCond(3)) { htmltext = event; } break; } - case "32586-07.html": - { - if (st.isCond(3)) - { + case "32586-07.html": { + if (st.isCond(3)) { giveItems(player, ELMOREDEN_HOLY_WATER, 1); giveItems(player, SACRED_SWORD_OF_EINHASAD, 1); st.setCond(4, true); @@ -177,45 +152,34 @@ public final class Q00196_SevenSignsSealOfTheEmperor extends Quest } case "32586-11.html": case "32586-12.html": - case "32586-13.html": - { - if (st.isCond(4) && (getQuestItemsCount(player, SEAL_OF_BINDING) >= 4)) - { + case "32586-13.html": { + if (st.isCond(4) && (getQuestItemsCount(player, SEAL_OF_BINDING) >= 4)) { htmltext = event; } break; } - case "32586-14.html": - { - if (st.isCond(4) && (getQuestItemsCount(player, SEAL_OF_BINDING) >= 4)) - { + case "32586-14.html": { + if (st.isCond(4) && (getQuestItemsCount(player, SEAL_OF_BINDING) >= 4)) { takeItems(player, -1, ELMOREDEN_HOLY_WATER, COURT_MAGICIANS_MAGIC_STAFF, SEAL_OF_BINDING, SACRED_SWORD_OF_EINHASAD); st.setCond(5, true); htmltext = event; } break; } - case "finish": - { - if (st.isCond(6)) - { - if (player.getLevel() >= MIN_LEVEL) - { + case "finish": { + if (st.isCond(6)) { + if (player.getLevel() >= MIN_LEVEL) { addExpAndSp(player, 52518015, 5817677); st.exitQuest(false, true); htmltext = "32593-02.html"; - } - else - { + } else { htmltext = "level_check.html"; } } break; } - case "32598-02.html": - { - if (st.isCond(3) || st.isCond(4)) - { + case "32598-02.html": { + if (st.isCond(3) || st.isCond(4)) { giveItems(player, COURT_MAGICIANS_MAGIC_STAFF, 1); htmltext = event; } @@ -226,138 +190,103 @@ public final class Q00196_SevenSignsSealOfTheEmperor extends Quest } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return "32584.htm"; } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.COMPLETED: - { + switch (st.getState()) { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } - case State.CREATED: - { - if (npc.getId() == IASON_HEINE) - { + case State.CREATED: { + if (npc.getId() == IASON_HEINE) { htmltext = ((player.getLevel() >= MIN_LEVEL) && player.hasQuestCompleted(Q00195_SevenSignsSecretRitualOfThePriests.class.getSimpleName())) ? "30969-01.htm" : "30969-08.html"; } break; } - case State.STARTED: - { - switch (npc.getId()) - { - case IASON_HEINE: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (npc.getId()) { + case IASON_HEINE: { + switch (st.getCond()) { + case 1: { htmltext = "30969-09.html"; break; } - case 2: - { + case 2: { st.setCond(3, true); npc.setScriptValue(0); htmltext = "30969-10.html"; break; } case 3: - case 4: - { + case 4: { htmltext = "30969-11.html"; break; } - case 5: - { + case 5: { htmltext = "30969-12.html"; break; } - case 6: - { + case 6: { htmltext = "30969-15.html"; break; } } break; } - case MERCHANT_OF_MAMMON: - { - if (st.isCond(1)) - { - if (npc.isScriptValue(0)) - { + case MERCHANT_OF_MAMMON: { + if (st.isCond(1)) { + if (npc.isScriptValue(0)) { npc.setScriptValue(player.getObjectId()); } htmltext = (npc.isScriptValue(player.getObjectId())) ? "32584-01.html" : "32584-06.html"; } break; } - case SHUNAIMAN: - { - switch (st.getCond()) - { - case 3: - { + case SHUNAIMAN: { + switch (st.getCond()) { + case 3: { htmltext = "32586-01.html"; break; } - case 4: - { - if (getQuestItemsCount(player, SEAL_OF_BINDING) < 4) - { - if (hasQuestItems(player, ELMOREDEN_HOLY_WATER, SACRED_SWORD_OF_EINHASAD)) - { + case 4: { + if (getQuestItemsCount(player, SEAL_OF_BINDING) < 4) { + if (hasQuestItems(player, ELMOREDEN_HOLY_WATER, SACRED_SWORD_OF_EINHASAD)) { htmltext = "32586-08.html"; - } - else if (!hasQuestItems(player, ELMOREDEN_HOLY_WATER) && hasQuestItems(player, SACRED_SWORD_OF_EINHASAD)) - { + } else if (!hasQuestItems(player, ELMOREDEN_HOLY_WATER) && hasQuestItems(player, SACRED_SWORD_OF_EINHASAD)) { htmltext = "32586-09.html"; giveItems(player, ELMOREDEN_HOLY_WATER, 1); - } - else if (hasQuestItems(player, ELMOREDEN_HOLY_WATER) && !hasQuestItems(player, SACRED_SWORD_OF_EINHASAD)) - { + } else if (hasQuestItems(player, ELMOREDEN_HOLY_WATER) && !hasQuestItems(player, SACRED_SWORD_OF_EINHASAD)) { htmltext = "32586-09.html"; giveItems(player, SACRED_SWORD_OF_EINHASAD, 1); } player.sendPacket(SystemMessageId.BY_USING_THE_SKILL_OF_EINHASAD_S_HOLY_SWORD_DEFEAT_THE_EVIL_LILIMS); player.sendPacket(SystemMessageId.USING_EINHASAD_HOLY_WATER_TO_OPEN_DOOR); - } - else - { + } else { htmltext = "32586-10.html"; } break; } - case 5: - { + case 5: { htmltext = "32586-15.html"; break; } } break; } - case WOOD: - { - if (st.isCond(6)) - { + case WOOD: { + if (st.isCond(6)) { htmltext = "32593-01.html"; } break; } - case COURT_MAGICIAN: - { - if (st.isCond(3) || st.isCond(4)) - { + case COURT_MAGICIAN: { + if (st.isCond(3) || st.isCond(4)) { htmltext = (!hasQuestItems(player, COURT_MAGICIANS_MAGIC_STAFF)) ? "32598-01.html" : "32598-03.html"; player.sendPacket(SystemMessageId.USING_COURT_MAGICIANS_STAFF_TO_OPEN_DOOR); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00197_SevenSignsTheSacredBookOfSeal/Q00197_SevenSignsTheSacredBookOfSeal.java b/src/main/java/com/l2jserver/datapack/quests/Q00197_SevenSignsTheSacredBookOfSeal/Q00197_SevenSignsTheSacredBookOfSeal.java index 1b5449ce8a..d80234ecd1 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00197_SevenSignsTheSacredBookOfSeal/Q00197_SevenSignsTheSacredBookOfSeal.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00197_SevenSignsTheSacredBookOfSeal/Q00197_SevenSignsTheSacredBookOfSeal.java @@ -35,8 +35,7 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * Seven Signs, The Sacred Book of Seal (197) * @author Adry_85 */ -public final class Q00197_SevenSignsTheSacredBookOfSeal extends Quest -{ +public final class Q00197_SevenSignsTheSacredBookOfSeal extends Quest { // NPCs private static final int SHILENS_EVIL_THOUGHTS = 27396; private static final int ORVEN = 30857; @@ -51,8 +50,7 @@ public final class Q00197_SevenSignsTheSacredBookOfSeal extends Quest private static final int MIN_LEVEL = 79; private boolean isBusy = false; - public Q00197_SevenSignsTheSacredBookOfSeal() - { + public Q00197_SevenSignsTheSacredBookOfSeal() { super(197, Q00197_SevenSignsTheSacredBookOfSeal.class.getSimpleName(), "Seven Signs, the Sacred Book of Seal"); addStartNpc(WOOD); addTalkId(WOOD, ORVEN, LEOPARD, LAWRENCE, SOPHIA); @@ -61,12 +59,9 @@ public final class Q00197_SevenSignsTheSacredBookOfSeal extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if ((npc.getId() == SHILENS_EVIL_THOUGHTS) && "despawn".equals(event)) - { - if (!npc.isDead()) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if ((npc.getId() == SHILENS_EVIL_THOUGHTS) && "despawn".equals(event)) { + if (!npc.isDead()) { isBusy = false; npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.NEXT_TIME_YOU_WILL_NOT_ESCAPE)); npc.deleteMe(); @@ -75,99 +70,76 @@ public final class Q00197_SevenSignsTheSacredBookOfSeal extends Quest } final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "32593-02.htm": - case "32593-03.htm": - { + case "32593-03.htm": { htmltext = event; break; } - case "32593-04.html": - { + case "32593-04.html": { st.startQuest(); htmltext = event; break; } - case "32593-08.html": - { - if (st.isCond(6) && st.hasQuestItems(MYSTERIOUS_HAND_WRITTEN_TEXT, SCULPTURE_OF_DOUBT)) - { + case "32593-08.html": { + if (st.isCond(6) && st.hasQuestItems(MYSTERIOUS_HAND_WRITTEN_TEXT, SCULPTURE_OF_DOUBT)) { htmltext = event; } break; } - case "32593-09.html": - { - if (st.isCond(6)) - { - if (player.getLevel() >= MIN_LEVEL) - { + case "32593-09.html": { + if (st.isCond(6)) { + if (player.getLevel() >= MIN_LEVEL) { st.addExpAndSp(52518015, 5817677); st.exitQuest(false, true); htmltext = event; - } - else - { + } else { htmltext = "level_check.html"; } } break; } case "30857-02.html": - case "30857-03.html": - { - if (st.isCond(1)) - { + case "30857-03.html": { + if (st.isCond(1)) { htmltext = event; } break; } - case "30857-04.html": - { - if (st.isCond(1)) - { + case "30857-04.html": { + if (st.isCond(1)) { st.setCond(2, true); htmltext = event; } break; } - case "32594-02.html": - { - if (st.isCond(2)) - { + case "32594-02.html": { + if (st.isCond(2)) { htmltext = event; } break; } - case "32594-03.html": - { - if (st.isCond(2)) - { + case "32594-03.html": { + if (st.isCond(2)) { st.setCond(3, true); htmltext = event; } break; } case "32595-02.html": - case "32595-03.html": - { - if (st.isCond(3)) - { + case "32595-03.html": { + if (st.isCond(3)) { htmltext = event; } break; } - case "32595-04.html": - { - if (st.isCond(3)) - { + case "32595-04.html": { + if (st.isCond(3)) { isBusy = true; npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.S1_THAT_STRANGER_MUST_BE_DEFEATED_HERE_IS_THE_ULTIMATE_HELP).addStringParameter(player.getName())); final L2MonsterInstance monster = (L2MonsterInstance) addSpawn(SHILENS_EVIL_THOUGHTS, 152520, -57502, -3408, 0, false, 0, false); @@ -181,36 +153,28 @@ public final class Q00197_SevenSignsTheSacredBookOfSeal extends Quest } case "32595-06.html": case "32595-07.html": - case "32595-08.html": - { - if (st.isCond(4) && st.hasQuestItems(SCULPTURE_OF_DOUBT)) - { + case "32595-08.html": { + if (st.isCond(4) && st.hasQuestItems(SCULPTURE_OF_DOUBT)) { htmltext = event; } break; } - case "32595-09.html": - { - if (st.isCond(4) && st.hasQuestItems(SCULPTURE_OF_DOUBT)) - { + case "32595-09.html": { + if (st.isCond(4) && st.hasQuestItems(SCULPTURE_OF_DOUBT)) { st.setCond(5, true); htmltext = event; } break; } case "32596-02.html": - case "32596-03.html": - { - if (st.isCond(5) && st.hasQuestItems(SCULPTURE_OF_DOUBT)) - { + case "32596-03.html": { + if (st.isCond(5) && st.hasQuestItems(SCULPTURE_OF_DOUBT)) { htmltext = event; } break; } - case "32596-04.html": - { - if (st.isCond(5) && st.hasQuestItems(SCULPTURE_OF_DOUBT)) - { + case "32596-04.html": { + if (st.isCond(5) && st.hasQuestItems(SCULPTURE_OF_DOUBT)) { st.giveItems(MYSTERIOUS_HAND_WRITTEN_TEXT, 1); st.setCond(6, true); htmltext = event; @@ -222,17 +186,14 @@ public final class Q00197_SevenSignsTheSacredBookOfSeal extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(player, 3); - if (partyMember == null) - { + if (partyMember == null) { return null; } final QuestState st = getQuestState(partyMember, false); - if (npc.isInsideRadius(partyMember, 1500, true, false)) - { + if (npc.isInsideRadius(partyMember, 1500, true, false)) { st.giveItems(SCULPTURE_OF_DOUBT, 1); st.playSound(Sound.ITEMSOUND_QUEST_FINISH); st.setCond(4); @@ -245,110 +206,73 @@ public final class Q00197_SevenSignsTheSacredBookOfSeal extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.COMPLETED: - { + switch (st.getState()) { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } - case State.CREATED: - { - if (npc.getId() == WOOD) - { + case State.CREATED: { + if (npc.getId() == WOOD) { htmltext = ((player.getLevel() >= MIN_LEVEL) && player.hasQuestCompleted(Q00196_SevenSignsSealOfTheEmperor.class.getSimpleName())) ? "32593-01.htm" : "32593-05.html"; } break; } - case State.STARTED: - { - switch (npc.getId()) - { - case WOOD: - { - if ((st.getCond() > 0) && (st.getCond() < 6)) - { + case State.STARTED: { + switch (npc.getId()) { + case WOOD: { + if ((st.getCond() > 0) && (st.getCond() < 6)) { htmltext = "32593-06.html"; - } - else if (st.isCond(6)) - { - if (st.hasQuestItems(MYSTERIOUS_HAND_WRITTEN_TEXT, SCULPTURE_OF_DOUBT)) - { + } else if (st.isCond(6)) { + if (st.hasQuestItems(MYSTERIOUS_HAND_WRITTEN_TEXT, SCULPTURE_OF_DOUBT)) { htmltext = "32593-07.html"; } } break; } - case ORVEN: - { - if (st.isCond(1)) - { + case ORVEN: { + if (st.isCond(1)) { htmltext = "30857-01.html"; - } - else if (st.getCond() >= 2) - { + } else if (st.getCond() >= 2) { htmltext = "30857-05.html"; } break; } - case LEOPARD: - { - if (st.isCond(2)) - { + case LEOPARD: { + if (st.isCond(2)) { htmltext = "32594-01.html"; - } - else if (st.getCond() >= 3) - { + } else if (st.getCond() >= 3) { htmltext = "32594-04.html"; } break; } - case LAWRENCE: - { - if (st.isCond(3)) - { - if (isBusy) - { + case LAWRENCE: { + if (st.isCond(3)) { + if (isBusy) { htmltext = "32595-05.html"; - } - else - { + } else { htmltext = "32595-01.html"; } - } - else if (st.isCond(4)) - { - if (st.hasQuestItems(SCULPTURE_OF_DOUBT)) - { + } else if (st.isCond(4)) { + if (st.hasQuestItems(SCULPTURE_OF_DOUBT)) { htmltext = "32595-06.html"; } - } - else if (st.getCond() >= 5) - { - if (st.hasQuestItems(SCULPTURE_OF_DOUBT)) - { + } else if (st.getCond() >= 5) { + if (st.hasQuestItems(SCULPTURE_OF_DOUBT)) { htmltext = "32595-10.html"; } } break; } - case SOPHIA: - { - if (st.isCond(5)) - { - if (st.hasQuestItems(SCULPTURE_OF_DOUBT)) - { + case SOPHIA: { + if (st.isCond(5)) { + if (st.hasQuestItems(SCULPTURE_OF_DOUBT)) { htmltext = "32596-01.html"; } - } - else if (st.getCond() >= 6) - { - if (st.hasQuestItems(SCULPTURE_OF_DOUBT, MYSTERIOUS_HAND_WRITTEN_TEXT)) - { + } else if (st.getCond() >= 6) { + if (st.hasQuestItems(SCULPTURE_OF_DOUBT, MYSTERIOUS_HAND_WRITTEN_TEXT)) { htmltext = "32596-05.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00198_SevenSignsEmbryo/Q00198_SevenSignsEmbryo.java b/src/main/java/com/l2jserver/datapack/quests/Q00198_SevenSignsEmbryo/Q00198_SevenSignsEmbryo.java index 9c8169bbc9..31149088d3 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00198_SevenSignsEmbryo/Q00198_SevenSignsEmbryo.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00198_SevenSignsEmbryo/Q00198_SevenSignsEmbryo.java @@ -36,8 +36,7 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * Seven Signs, Embryo (198) * @author Adry_85 */ -public final class Q00198_SevenSignsEmbryo extends Quest -{ +public final class Q00198_SevenSignsEmbryo extends Quest { // NPCs private static final int SHILENS_EVIL_THOUGHTS = 27346; private static final int WOOD = 32593; @@ -51,8 +50,7 @@ public final class Q00198_SevenSignsEmbryo extends Quest // Skill private static final SkillHolder NPC_HEAL = new SkillHolder(4065, 8); - public Q00198_SevenSignsEmbryo() - { + public Q00198_SevenSignsEmbryo() { super(198, Q00198_SevenSignsEmbryo.class.getSimpleName(), "Seven Signs, Embryo"); addStartNpc(WOOD); addTalkId(WOOD, FRANZ); @@ -61,12 +59,9 @@ public final class Q00198_SevenSignsEmbryo extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if ((npc.getId() == SHILENS_EVIL_THOUGHTS) && "despawn".equals(event)) - { - if (!npc.isDead()) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if ((npc.getId() == SHILENS_EVIL_THOUGHTS) && "despawn".equals(event)) { + if (!npc.isDead()) { isBusy = false; npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.NEXT_TIME_YOU_WILL_NOT_ESCAPE)); npc.deleteMe(); @@ -75,35 +70,28 @@ public final class Q00198_SevenSignsEmbryo extends Quest } final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "32593-02.html": - { + switch (event) { + case "32593-02.html": { st.startQuest(); htmltext = event; break; } case "32597-02.html": case "32597-03.html": - case "32597-04.html": - { - if (st.isCond(1)) - { + case "32597-04.html": { + if (st.isCond(1)) { htmltext = event; } break; } - case "fight": - { + case "fight": { htmltext = "32597-05.html"; - if (st.isCond(1)) - { + if (st.isCond(1)) { isBusy = true; npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.S1_THAT_STRANGER_MUST_BE_DEFEATED_HERE_IS_THE_ULTIMATE_HELP).addStringParameter(player.getName())); startQuestTimer("heal", 30000 - getRandom(20000), npc, player); @@ -116,16 +104,12 @@ public final class Q00198_SevenSignsEmbryo extends Quest } break; } - case "heal": - { - if (!npc.isInsideRadius(player, 600, true, false)) - { + case "heal": { + if (!npc.isInsideRadius(player, 600, true, false)) { NpcSay ns = new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.LOOK_HERE_S1_DONT_FALL_TOO_FAR_BEHIND); ns.addStringParameter(player.getName()); npc.broadcastPacket(ns); - } - else if (!player.isDead()) - { + } else if (!player.isDead()) { npc.setTarget(player); npc.doCast(NPC_HEAL); } @@ -134,18 +118,14 @@ public final class Q00198_SevenSignsEmbryo extends Quest } case "32597-08.html": case "32597-09.html": - case "32597-10.html": - { - if (st.isCond(2) && st.hasQuestItems(SCULPTURE_OF_DOUBT)) - { + case "32597-10.html": { + if (st.isCond(2) && st.hasQuestItems(SCULPTURE_OF_DOUBT)) { htmltext = event; } break; } - case "32597-11.html": - { - if (st.isCond(2) && st.hasQuestItems(SCULPTURE_OF_DOUBT)) - { + case "32597-11.html": { + if (st.isCond(2) && st.hasQuestItems(SCULPTURE_OF_DOUBT)) { st.takeItems(SCULPTURE_OF_DOUBT, -1); st.setCond(3, true); htmltext = event; @@ -153,8 +133,7 @@ public final class Q00198_SevenSignsEmbryo extends Quest } break; } - case "32617-02.html": - { + case "32617-02.html": { htmltext = event; break; } @@ -163,17 +142,14 @@ public final class Q00198_SevenSignsEmbryo extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(player, 1); - if (partyMember == null) - { + if (partyMember == null) { return null; } final QuestState st = getQuestState(partyMember, false); - if (npc.isInsideRadius(partyMember, 1500, true, false)) - { + if (npc.isInsideRadius(partyMember, 1500, true, false)) { st.giveItems(SCULPTURE_OF_DOUBT, 1); st.setCond(2, true); } @@ -188,68 +164,48 @@ public final class Q00198_SevenSignsEmbryo extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.COMPLETED: - { + switch (st.getState()) { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } - case State.CREATED: - { - if (npc.getId() == WOOD) - { + case State.CREATED: { + if (npc.getId() == WOOD) { htmltext = ((player.getLevel() >= MIN_LEVEL) && player.hasQuestCompleted(Q00197_SevenSignsTheSacredBookOfSeal.class.getSimpleName())) ? "32593-01.htm" : "32593-03.html"; } break; } - case State.STARTED: - { - if (npc.getId() == WOOD) - { - if ((st.getCond() > 0) && (st.getCond() < 3)) - { + case State.STARTED: { + if (npc.getId() == WOOD) { + if ((st.getCond() > 0) && (st.getCond() < 3)) { htmltext = "32593-04.html"; - } - else if (st.isCond(3)) - { - if (player.getLevel() >= MIN_LEVEL) - { + } else if (st.isCond(3)) { + if (player.getLevel() >= MIN_LEVEL) { st.addExpAndSp(315108090, 34906059); st.giveItems(DAWNS_BRACELET, 1); st.giveItems(Inventory.ANCIENT_ADENA_ID, 1500000); st.exitQuest(false, true); htmltext = "32593-05.html"; - } - else - { + } else { htmltext = "level_check.html"; } } - } - else if (npc.getId() == FRANZ) - { - switch (st.getCond()) - { - case 1: - { + } else if (npc.getId() == FRANZ) { + switch (st.getCond()) { + case 1: { htmltext = (isBusy) ? "32597-06.html" : "32597-01.html"; break; } - case 2: - { - if (st.hasQuestItems(SCULPTURE_OF_DOUBT)) - { + case 2: { + if (st.hasQuestItems(SCULPTURE_OF_DOUBT)) { htmltext = "32597-07.html"; } break; } - case 3: - { + case 3: { htmltext = "32597-12.html"; break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00211_TrialOfTheChallenger/Q00211_TrialOfTheChallenger.java b/src/main/java/com/l2jserver/datapack/quests/Q00211_TrialOfTheChallenger/Q00211_TrialOfTheChallenger.java index df0fc754ba..360b40668f 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00211_TrialOfTheChallenger/Q00211_TrialOfTheChallenger.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00211_TrialOfTheChallenger/Q00211_TrialOfTheChallenger.java @@ -35,8 +35,7 @@ import com.l2jserver.gameserver.util.Util; * Trial of the Challenger (211) * @author Pandragon */ -public final class Q00211_TrialOfTheChallenger extends Quest -{ +public final class Q00211_TrialOfTheChallenger extends Quest { // NPCs private static final int FILAUR = 30535; private static final int KASH = 30644; @@ -69,8 +68,7 @@ public final class Q00211_TrialOfTheChallenger extends Quest // Misc private static final int MIN_LVL = 35; - public Q00211_TrialOfTheChallenger() - { + public Q00211_TrialOfTheChallenger() { super(211, Q00211_TrialOfTheChallenger.class.getSimpleName(), "Trial of the Challenger"); addStartNpc(KASH); addTalkId(FILAUR, KASH, MARTIAN, RALDO, CHEST_OF_SHYSLASSYS, MARKETEER_OF_MAMMON); @@ -79,110 +77,81 @@ public final class Q00211_TrialOfTheChallenger extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return null; } - switch (event) - { - case "30644-04.htm": - { + switch (event) { + case "30644-04.htm": { htmltext = event; break; } case "30645-07.html": case "30645-08.html": case "30646-02.html": - case "30646-03.html": - { - if (qs.isStarted()) - { + case "30646-03.html": { + if (qs.isStarted()) { htmltext = event; } break; } - case "30644-06.htm": - { - if (qs.isCreated()) - { + case "30644-06.htm": { + if (qs.isCreated()) { final PlayerVariables vars = player.getVariables(); - if (vars.getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) - { + if (vars.getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) { giveItems(player, DIMENSIONAL_DIAMONDS); vars.set("2ND_CLASS_DIAMOND_REWARD", 1); htmltext = event; - } - else - { + } else { htmltext = "30644-05.htm"; } qs.startQuest(); } break; } - case "30647-02.html": - { - if (qs.isCond(2) && hasQuestItems(player, BROKEN_KEY)) - { + case "30647-02.html": { + if (qs.isCond(2) && hasQuestItems(player, BROKEN_KEY)) { takeItems(player, BROKEN_KEY, -1); - if (getRandom(10) < 2) - { + if (getRandom(10) < 2) { playSound(player, Sound.ITEMSOUND_QUEST_JACKPOT); final int random = getRandom(100); - if (random > 90) - { + if (random > 90) { rewardItems(player, MITHRIL_SCALE_GAITERS_MATERIAL, 1); rewardItems(player, BRIGAMDINE_GAUNTLET_PATTERN, 1); rewardItems(player, MANTICOR_SKIN_GAITERS_PATTERN, 1); rewardItems(player, GAUNTLET_OF_REPOSE_PATTERN, 1); rewardItems(player, IRON_BOOTS_DESIGN, 1); - } - else if (random > 70) - { + } else if (random > 70) { rewardItems(player, TOME_OF_BLOOD_PAGE, 1); rewardItems(player, ELVEN_NECKLACE_BEADS, 1); - } - else if (random > 40) - { + } else if (random > 40) { rewardItems(player, WHITE_TUNIC_PATTERN, 1); - } - else - { + } else { rewardItems(player, IRON_BOOTS_DESIGN, 1); } htmltext = "30647-03.html"; - } - else - { + } else { giveAdena(player, getRandom(1000) + 1, true); htmltext = event; } - } - else - { + } else { htmltext = "30647-04.html"; } break; } - case "30645-02.html": - { - if (qs.isCond(3) && hasQuestItems(player, LETTER_OF_KASH)) - { + case "30645-02.html": { + if (qs.isCond(3) && hasQuestItems(player, LETTER_OF_KASH)) { qs.setCond(4, true); htmltext = event; } break; } case "30646-04.html": - case "30646-05.html": - { - if (qs.isCond(7) && hasQuestItems(player, WATCHERS_EYE2)) - { + case "30646-05.html": { + if (qs.isCond(7) && hasQuestItems(player, WATCHERS_EYE2)) { takeItems(player, WATCHERS_EYE2, -1); qs.setCond(8, true); htmltext = event; @@ -194,42 +163,27 @@ public final class Q00211_TrialOfTheChallenger extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (npc.getId()) - { - case KASH: - { - if (qs.isCreated()) - { - if (!talker.isInCategory(CategoryType.WARRIOR_GROUP)) - { + switch (npc.getId()) { + case KASH: { + if (qs.isCreated()) { + if (!talker.isInCategory(CategoryType.WARRIOR_GROUP)) { htmltext = "30644-02.html"; - } - else if (talker.getLevel() < MIN_LVL) - { + } else if (talker.getLevel() < MIN_LVL) { htmltext = "30644-01.html"; - } - else - { + } else { htmltext = "30644-03.htm"; } - } - else if (qs.isStarted()) - { - switch (qs.getCond()) - { - case 1: - { + } else if (qs.isStarted()) { + switch (qs.getCond()) { + case 1: { htmltext = "30644-07.html"; break; } - case 2: - { - if (hasQuestItems(talker, SCROLL_OF_SHYSLASSYS)) - { + case 2: { + if (hasQuestItems(talker, SCROLL_OF_SHYSLASSYS)) { takeItems(talker, SCROLL_OF_SHYSLASSYS, -1); giveItems(talker, LETTER_OF_KASH, 1); qs.setCond(3, true); @@ -237,110 +191,86 @@ public final class Q00211_TrialOfTheChallenger extends Quest } break; } - case 3: - { - if (hasQuestItems(talker, LETTER_OF_KASH)) - { + case 3: { + if (hasQuestItems(talker, LETTER_OF_KASH)) { htmltext = "30644-09.html"; } break; } case 8: case 9: - case 10: - { + case 10: { htmltext = "30644-10.html"; break; } } - } - else if (qs.isCompleted()) - { + } else if (qs.isCompleted()) { htmltext = getAlreadyCompletedMsg(talker); } break; } - case MARTIAN: - { - switch (qs.getCond()) - { - case 3: - { - if (hasQuestItems(talker, LETTER_OF_KASH)) - { + case MARTIAN: { + switch (qs.getCond()) { + case 3: { + if (hasQuestItems(talker, LETTER_OF_KASH)) { htmltext = "30645-01.html"; } break; } - case 4: - { + case 4: { htmltext = "30645-03.html"; break; } - case 5: - { - if (hasQuestItems(talker, WATCHERS_EYE1)) - { + case 5: { + if (hasQuestItems(talker, WATCHERS_EYE1)) { takeItems(talker, WATCHERS_EYE1, -1); qs.setCond(6, true); htmltext = "30645-04.html"; } break; } - case 6: - { + case 6: { htmltext = "30645-05.html"; break; } - case 7: - { + case 7: { htmltext = "30645-06.html"; break; } case 8: - case 9: - { + case 9: { htmltext = "30645-09.html"; break; } } break; } - case CHEST_OF_SHYSLASSYS: - { - if (qs.isStarted()) - { + case CHEST_OF_SHYSLASSYS: { + if (qs.isStarted()) { htmltext = "30647-01.html"; } break; } - case RALDO: - { - switch (qs.getCond()) - { - case 7: - { - if (hasQuestItems(talker, WATCHERS_EYE2)) - { + case RALDO: { + switch (qs.getCond()) { + case 7: { + if (hasQuestItems(talker, WATCHERS_EYE2)) { htmltext = "30646-01.html"; } break; } - case 8: - { + case 8: { htmltext = "30646-06.html"; break; } - case 10: - { + case 10: { addExpAndSp(talker, 1067606, 69242); giveAdena(talker, 194556, true); giveItems(talker, MARK_OF_CHALLENGER, 1); // redundant retail check - already rewarded at beginning of quest final PlayerVariables vars = talker.getVariables(); - if (vars.getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) - { + if (vars.getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) { giveItems(talker, DIMENSIONAL_DIAMONDS); vars.set("2ND_CLASS_DIAMOND_REWARD", 1); } @@ -353,24 +283,19 @@ public final class Q00211_TrialOfTheChallenger extends Quest } break; } - case FILAUR: - { - switch (qs.getCond()) - { - case 8: - { + case FILAUR: { + switch (qs.getCond()) { + case 8: { htmltext = "30535-01.html"; qs.setCond(9, true); break; } - case 9: - { + case 9: { talker.sendPacket(new RadarControl(0, 2, 151589, -174823, -1776)); htmltext = "30535-02.html"; break; } - case 10: - { + case 10: { htmltext = "30535-03.html"; break; } @@ -382,22 +307,16 @@ public final class Q00211_TrialOfTheChallenger extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs == null) || !Util.checkIfInRange(1500, npc, killer, true)) - { + if ((qs == null) || !Util.checkIfInRange(1500, npc, killer, true)) { return super.onKill(npc, killer, isSummon); } - switch (npc.getId()) - { - case SHYSLASSYS: - { - if (qs.isCond(1)) - { - if (SpawnTable.getInstance().getSpawns(npc.getId()).size() < 10) - { + switch (npc.getId()) { + case SHYSLASSYS: { + if (qs.isCond(1)) { + if (SpawnTable.getInstance().getSpawns(npc.getId()).size() < 10) { addSpawn(CHEST_OF_SHYSLASSYS, npc, false, 200000); } giveItems(killer, SCROLL_OF_SHYSLASSYS, 1); @@ -406,21 +325,16 @@ public final class Q00211_TrialOfTheChallenger extends Quest } break; } - case GORR: - { - if (qs.isCond(4)) - { + case GORR: { + if (qs.isCond(4)) { giveItems(killer, WATCHERS_EYE1, 1); qs.setCond(5, true); } break; } - case BARAHAM: - { - if (qs.isCond(6)) - { - if (SpawnTable.getInstance().getSpawns(npc.getId()).size() < 10) - { + case BARAHAM: { + if (qs.isCond(6)) { + if (SpawnTable.getInstance().getSpawns(npc.getId()).size() < 10) { addSpawn(RALDO, npc, false, 100000); } giveItems(killer, WATCHERS_EYE2, 1); @@ -428,12 +342,9 @@ public final class Q00211_TrialOfTheChallenger extends Quest } break; } - case QUEEN_OF_SUCCUBUS: - { - if (qs.isCond(9)) - { - if (SpawnTable.getInstance().getSpawns(npc.getId()).size() < 10) - { + case QUEEN_OF_SUCCUBUS: { + if (qs.isCond(9)) { + if (SpawnTable.getInstance().getSpawns(npc.getId()).size() < 10) { addSpawn(RALDO, npc, false, 100000); } qs.setCond(10, true); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00212_TrialOfDuty/Q00212_TrialOfDuty.java b/src/main/java/com/l2jserver/datapack/quests/Q00212_TrialOfDuty/Q00212_TrialOfDuty.java index 2e5058e88e..3bd7b237b9 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00212_TrialOfDuty/Q00212_TrialOfDuty.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00212_TrialOfDuty/Q00212_TrialOfDuty.java @@ -35,8 +35,7 @@ import com.l2jserver.gameserver.util.Util; * Trial of Duty (212) * @author jurchiks */ -public final class Q00212_TrialOfDuty extends Quest -{ +public final class Q00212_TrialOfDuty extends Quest { // NPCs private static final int HANNAVALT = 30109; private static final int DUSTIN = 30116; @@ -80,8 +79,7 @@ public final class Q00212_TrialOfDuty extends Quest // Misc private static final int MIN_LEVEL = 35; - public Q00212_TrialOfDuty() - { + public Q00212_TrialOfDuty() { super(212, Q00212_TrialOfDuty.class.getSimpleName(), "Trial of Duty"); addStartNpc(HANNAVALT); addTalkId(HANNAVALT, DUSTIN, SIR_COLLIN_WINDAWOOD, SIR_ARON_TANFORD, SIR_KIEL_NIGHTHAWK, ISAEL_SILVERSHADOW, SPIRIT_OF_SIR_TALIANUS); @@ -90,32 +88,24 @@ public final class Q00212_TrialOfDuty extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String html = null; - if (qs == null) - { + if (qs == null) { return html; } - switch (event) - { - case "quest_accept": - { - if (qs.isCreated() && (player.getLevel() >= MIN_LEVEL) && player.isInCategory(CategoryType.KNIGHT_GROUP)) - { + switch (event) { + case "quest_accept": { + if (qs.isCreated() && (player.getLevel() >= MIN_LEVEL) && player.isInCategory(CategoryType.KNIGHT_GROUP)) { qs.startQuest(); qs.setMemoState(1); qs.set("flag", 0); - if (rewardDimensionalDiamonds(player)) - { + if (rewardDimensionalDiamonds(player)) { html = "30109-04a.htm"; - } - else - { + } else { html = "30109-04.htm"; } } @@ -123,18 +113,14 @@ public final class Q00212_TrialOfDuty extends Quest } case "30116-02.html": case "30116-03.html": - case "30116-04.html": - { - if (qs.isMemoState(10) && hasQuestItems(player, TEAR_OF_LOYALTY)) - { + case "30116-04.html": { + if (qs.isMemoState(10) && hasQuestItems(player, TEAR_OF_LOYALTY)) { html = event; } break; } - case "30116-05.html": - { - if (qs.isMemoState(10) && hasQuestItems(player, TEAR_OF_LOYALTY)) - { + case "30116-05.html": { + if (qs.isMemoState(10) && hasQuestItems(player, TEAR_OF_LOYALTY)) { html = event; takeItems(player, TEAR_OF_LOYALTY, -1); qs.setMemoState(11); @@ -147,44 +133,33 @@ public final class Q00212_TrialOfDuty extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs == null) || !Util.checkIfInRange(1500, killer, npc, true)) - { + if ((qs == null) || !Util.checkIfInRange(1500, killer, npc, true)) { return super.onKill(npc, killer, isSummon); } - switch (npc.getId()) - { + switch (npc.getId()) { case SKELETON_MARAUDER: - case SKELETON_RAIDER: - { - if (qs.isMemoState(2)) - { + case SKELETON_RAIDER: { + if (qs.isMemoState(2)) { final int flag = qs.getInt("flag"); - if (getRandom(100) < (flag * 10)) - { + if (getRandom(100) < (flag * 10)) { addSpawn(SPIRIT_OF_SIR_HEROD, npc); qs.set("flag", 0); - } - else - { + } else { qs.set("flag", flag + 1); } } break; } - case SPIRIT_OF_SIR_HEROD: - { - if (qs.isMemoState(2)) - { + case SPIRIT_OF_SIR_HEROD: { + if (qs.isMemoState(2)) { final L2Weapon weapon = killer.getActiveWeaponItem(); - if ((weapon != null) && (weapon.getId() == OLD_KNIGHTS_SWORD)) - { + if ((weapon != null) && (weapon.getId() == OLD_KNIGHTS_SWORD)) { giveItems(killer, KNIGHTS_TEAR, 1); qs.setMemoState(3); qs.setCond(3, true); @@ -193,12 +168,9 @@ public final class Q00212_TrialOfDuty extends Quest break; } case STRAIN: - case GHOUL: - { - if (qs.isMemoState(5) && !hasQuestItems(killer, TALIANUSS_REPORT)) - { - if (giveItemRandomly(killer, npc, REPORT_PIECE.getId(), 1, REPORT_PIECE.getCount(), 1, true)) - { + case GHOUL: { + if (qs.isMemoState(5) && !hasQuestItems(killer, TALIANUSS_REPORT)) { + if (giveItemRandomly(killer, npc, REPORT_PIECE.getId(), 1, REPORT_PIECE.getCount(), 1, true)) { takeItem(killer, REPORT_PIECE); giveItems(killer, TALIANUSS_REPORT, 1); qs.setCond(6); @@ -206,20 +178,15 @@ public final class Q00212_TrialOfDuty extends Quest } break; } - case HANGMAN_TREE: - { - if (qs.isMemoState(6)) - { + case HANGMAN_TREE: { + if (qs.isMemoState(6)) { final int flag = qs.getInt("flag"); - if (getRandom(100) < ((flag - 3) * 33)) - { + if (getRandom(100) < ((flag - 3) * 33)) { addSpawn(SPIRIT_OF_SIR_TALIANUS, npc); qs.set("flag", 0); qs.setCond(8, true); - } - else - { + } else { qs.set("flag", flag + 1); } } @@ -230,30 +197,21 @@ public final class Q00212_TrialOfDuty extends Quest case LETO_LIZARDMAN_SOLDIER: case LETO_LIZARDMAN_WARRIOR: case LETO_LIZARDMAN_SHAMAN: - case LETO_LIZARDMAN_OVERLORD: - { - if (qs.isMemoState(9) && giveItemRandomly(killer, npc, MILITAS_ARTICLE.getId(), 1, MILITAS_ARTICLE.getCount(), 1, true)) - { + case LETO_LIZARDMAN_OVERLORD: { + if (qs.isMemoState(9) && giveItemRandomly(killer, npc, MILITAS_ARTICLE.getId(), 1, MILITAS_ARTICLE.getCount(), 1, true)) { qs.setCond(12); } break; } - case BREKA_ORC_OVERLORD: - { - if (qs.isMemoState(11)) - { - if (!hasQuestItems(killer, ATHEBALDTS_SKULL)) - { + case BREKA_ORC_OVERLORD: { + if (qs.isMemoState(11)) { + if (!hasQuestItems(killer, ATHEBALDTS_SKULL)) { giveItems(killer, ATHEBALDTS_SKULL, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); - } - else if (!hasQuestItems(killer, ATHEBALDTS_RIBS)) - { + } else if (!hasQuestItems(killer, ATHEBALDTS_RIBS)) { giveItems(killer, ATHEBALDTS_RIBS, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); - } - else if (!hasQuestItems(killer, ATHEBALDTS_SHIN)) - { + } else if (!hasQuestItems(killer, ATHEBALDTS_SHIN)) { giveItems(killer, ATHEBALDTS_SHIN, 1); qs.setCond(15, true); } @@ -265,43 +223,28 @@ public final class Q00212_TrialOfDuty extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String html = getNoQuestMsg(talker); - switch (npc.getId()) - { - case HANNAVALT: - { - if (qs.isCreated()) - { - if (!talker.isInCategory(CategoryType.KNIGHT_GROUP)) - { + switch (npc.getId()) { + case HANNAVALT: { + if (qs.isCreated()) { + if (!talker.isInCategory(CategoryType.KNIGHT_GROUP)) { html = "30109-02.html"; - } - else if (talker.getLevel() < MIN_LEVEL) - { + } else if (talker.getLevel() < MIN_LEVEL) { html = "30109-01.html"; - } - else - { + } else { html = "30109-03.htm"; } - } - else if (qs.isStarted()) - { - switch (qs.getMemoState()) - { - case 1: - { + } else if (qs.isStarted()) { + switch (qs.getMemoState()) { + case 1: { html = "30109-04.htm"; break; } - case 14: - { - if (hasQuestItems(talker, LETTER_OF_DUSTIN)) - { + case 14: { + if (hasQuestItems(talker, LETTER_OF_DUSTIN)) { html = "30109-05.html"; takeItems(talker, LETTER_OF_DUSTIN, -1); addExpAndSp(talker, 762576, 49458); @@ -314,23 +257,17 @@ public final class Q00212_TrialOfDuty extends Quest break; } } - } - else - { + } else { html = getAlreadyCompletedMsg(talker); } break; } - case SIR_ARON_TANFORD: - { - switch (qs.getMemoState()) - { - case 1: - { + case SIR_ARON_TANFORD: { + switch (qs.getMemoState()) { + case 1: { html = "30653-01.html"; - if (!hasQuestItems(talker, OLD_KNIGHTS_SWORD)) - { + if (!hasQuestItems(talker, OLD_KNIGHTS_SWORD)) { giveItems(talker, OLD_KNIGHTS_SWORD, 1); } @@ -338,18 +275,14 @@ public final class Q00212_TrialOfDuty extends Quest qs.setCond(2, true); break; } - case 2: - { - if (hasQuestItems(talker, OLD_KNIGHTS_SWORD)) - { + case 2: { + if (hasQuestItems(talker, OLD_KNIGHTS_SWORD)) { html = "30653-02.html"; } break; } - case 3: - { - if (hasQuestItems(talker, KNIGHTS_TEAR)) - { + case 3: { + if (hasQuestItems(talker, KNIGHTS_TEAR)) { html = "30653-03.html"; takeItems(talker, -1, KNIGHTS_TEAR, OLD_KNIGHTS_SWORD); qs.setMemoState(4); @@ -357,33 +290,25 @@ public final class Q00212_TrialOfDuty extends Quest } break; } - case 4: - { + case 4: { html = "30653-04.html"; break; } } break; } - case SIR_KIEL_NIGHTHAWK: - { - switch (qs.getMemoState()) - { - case 4: - { + case SIR_KIEL_NIGHTHAWK: { + switch (qs.getMemoState()) { + case 4: { html = "30654-01.html"; qs.setMemoState(5); qs.setCond(5, true); break; } - case 5: - { - if (!hasQuestItems(talker, TALIANUSS_REPORT)) - { + case 5: { + if (!hasQuestItems(talker, TALIANUSS_REPORT)) { html = "30654-02.html"; - } - else - { + } else { html = "30654-03.html"; qs.setMemoState(6); qs.setCond(7, true); @@ -391,18 +316,14 @@ public final class Q00212_TrialOfDuty extends Quest } break; } - case 6: - { - if (hasQuestItems(talker, MIRROR_OF_ORPIC)) - { + case 6: { + if (hasQuestItems(talker, MIRROR_OF_ORPIC)) { html = "30654-04.html"; } break; } - case 7: - { - if (hasQuestItems(talker, TEAR_OF_CONFESSION)) - { + case 7: { + if (hasQuestItems(talker, TEAR_OF_CONFESSION)) { html = "30654-05.html"; takeItems(talker, TEAR_OF_CONFESSION, -1); qs.setMemoState(8); @@ -410,18 +331,15 @@ public final class Q00212_TrialOfDuty extends Quest } break; } - case 8: - { + case 8: { html = "30654-06.html"; break; } } break; } - case SPIRIT_OF_SIR_TALIANUS: - { - if (qs.isMemoState(6) && hasQuestItems(talker, MIRROR_OF_ORPIC, TALIANUSS_REPORT)) - { + case SPIRIT_OF_SIR_TALIANUS: { + if (qs.isMemoState(6) && hasQuestItems(talker, MIRROR_OF_ORPIC, TALIANUSS_REPORT)) { html = "30656-01.html"; takeItems(talker, -1, MIRROR_OF_ORPIC, TALIANUSS_REPORT); giveItems(talker, TEAR_OF_CONFESSION, 1); @@ -431,32 +349,22 @@ public final class Q00212_TrialOfDuty extends Quest } break; } - case ISAEL_SILVERSHADOW: - { - switch (qs.getMemoState()) - { - case 8: - { - if (talker.getLevel() < MIN_LEVEL) - { + case ISAEL_SILVERSHADOW: { + switch (qs.getMemoState()) { + case 8: { + if (talker.getLevel() < MIN_LEVEL) { html = "30655-01.html"; - } - else - { + } else { html = "30655-02.html"; qs.setMemoState(9); qs.setCond(11, true); } break; } - case 9: - { - if (!hasItem(talker, MILITAS_ARTICLE)) - { + case 9: { + if (!hasItem(talker, MILITAS_ARTICLE)) { html = "30655-03.html"; - } - else - { + } else { html = "30655-04.html"; giveItems(talker, TEAR_OF_LOYALTY, 1); takeItem(talker, MILITAS_ARTICLE); @@ -465,10 +373,8 @@ public final class Q00212_TrialOfDuty extends Quest } break; } - case 10: - { - if (hasQuestItems(talker, TEAR_OF_LOYALTY)) - { + case 10: { + if (hasQuestItems(talker, TEAR_OF_LOYALTY)) { html = "30655-05.html"; } break; @@ -476,26 +382,18 @@ public final class Q00212_TrialOfDuty extends Quest } break; } - case DUSTIN: - { - switch (qs.getMemoState()) - { - case 10: - { - if (hasQuestItems(talker, TEAR_OF_LOYALTY)) - { + case DUSTIN: { + switch (qs.getMemoState()) { + case 10: { + if (hasQuestItems(talker, TEAR_OF_LOYALTY)) { html = "30116-01.html"; } break; } - case 11: - { - if (!hasQuestItems(talker, ATHEBALDTS_SKULL, ATHEBALDTS_RIBS, ATHEBALDTS_SHIN)) - { + case 11: { + if (!hasQuestItems(talker, ATHEBALDTS_SKULL, ATHEBALDTS_RIBS, ATHEBALDTS_SHIN)) { html = "30116-06.html"; - } - else - { + } else { html = "30116-07.html"; takeItems(talker, -1, ATHEBALDTS_SKULL, ATHEBALDTS_RIBS, ATHEBALDTS_SHIN); giveItems(talker, SAINTS_ASHES_URN, 1); @@ -504,18 +402,14 @@ public final class Q00212_TrialOfDuty extends Quest } break; } - case 12: - { - if (hasQuestItems(talker, SAINTS_ASHES_URN)) - { + case 12: { + if (hasQuestItems(talker, SAINTS_ASHES_URN)) { html = "30116-09.html"; } break; } - case 13: - { - if (hasQuestItems(talker, LETTER_OF_WINDAWOOD)) - { + case 13: { + if (hasQuestItems(talker, LETTER_OF_WINDAWOOD)) { html = "30116-08.html"; takeItems(talker, LETTER_OF_WINDAWOOD, -1); giveItems(talker, LETTER_OF_DUSTIN, 1); @@ -524,10 +418,8 @@ public final class Q00212_TrialOfDuty extends Quest } break; } - case 14: - { - if (hasQuestItems(talker, LETTER_OF_DUSTIN)) - { + case 14: { + if (hasQuestItems(talker, LETTER_OF_DUSTIN)) { html = "30116-10.html"; } break; @@ -535,14 +427,10 @@ public final class Q00212_TrialOfDuty extends Quest } break; } - case SIR_COLLIN_WINDAWOOD: - { - switch (qs.getMemoState()) - { - case 12: - { - if (hasQuestItems(talker, SAINTS_ASHES_URN)) - { + case SIR_COLLIN_WINDAWOOD: { + switch (qs.getMemoState()) { + case 12: { + if (hasQuestItems(talker, SAINTS_ASHES_URN)) { html = "30311-01.html"; takeItems(talker, SAINTS_ASHES_URN, -1); giveItems(talker, LETTER_OF_WINDAWOOD, 1); @@ -551,10 +439,8 @@ public final class Q00212_TrialOfDuty extends Quest } break; } - case 13: - { - if (hasQuestItems(talker, LETTER_OF_WINDAWOOD)) - { + case 13: { + if (hasQuestItems(talker, LETTER_OF_WINDAWOOD)) { html = "30311-02.html"; } break; @@ -566,18 +452,13 @@ public final class Q00212_TrialOfDuty extends Quest return html; } - private static boolean rewardDimensionalDiamonds(L2PcInstance player) - { + private static boolean rewardDimensionalDiamonds(L2PcInstance player) { final PlayerVariables vars = player.getVariables(); - if (vars.getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) - { - if (player.getClassId() == ClassId.knight) - { + if (vars.getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) { + if (player.getClassId() == ClassId.knight) { rewardItems(player, DIMENSIONAL_DIAMOND, 45); - } - else - { + } else { rewardItems(player, DIMENSIONAL_DIAMOND, 61); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00213_TrialOfTheSeeker/Q00213_TrialOfTheSeeker.java b/src/main/java/com/l2jserver/datapack/quests/Q00213_TrialOfTheSeeker/Q00213_TrialOfTheSeeker.java index 84bcd446f0..e641c7d3b7 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00213_TrialOfTheSeeker/Q00213_TrialOfTheSeeker.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00213_TrialOfTheSeeker/Q00213_TrialOfTheSeeker.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Trial Of The Seeker (213) * @author ivantotov */ -public final class Q00213_TrialOfTheSeeker extends Quest -{ +public final class Q00213_TrialOfTheSeeker extends Quest { // NPCs private static final int MASTER_TERRY = 30064; private static final int MASTER_DUFNER = 30106; @@ -84,8 +83,7 @@ public final class Q00213_TrialOfTheSeeker extends Quest private static final int MIN_LVL = 35; private static final int LEVEL = 36; - public Q00213_TrialOfTheSeeker() - { + public Q00213_TrialOfTheSeeker() { super(213, Q00213_TrialOfTheSeeker.class.getSimpleName(), "Trial Of The Seeker"); addStartNpc(MASTER_DUFNER); addTalkId(MASTER_DUFNER, MASTER_TERRY, BLACKSMITH_BRUNON, TRADER_VIKTOR, MAGISTER_MARINA); @@ -94,35 +92,26 @@ public final class Q00213_TrialOfTheSeeker extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (qs.isCreated()) - { + switch (event) { + case "ACCEPT": { + if (qs.isCreated()) { qs.startQuest(); - if (!hasQuestItems(player, DUFNERS_LETTER)) - { + if (!hasQuestItems(player, DUFNERS_LETTER)) { giveItems(player, DUFNERS_LETTER, 1); } playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); - if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) - { + if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) { giveItems(player, DIMENSIONAL_DIAMOND, 128); player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1); htmltext = "30106-05a.htm"; - } - else - { + } else { htmltext = "30106-05.htm"; } } @@ -141,15 +130,12 @@ public final class Q00213_TrialOfTheSeeker extends Quest case "30684-07.html": case "30684-08.html": case "30684-09.html": - case "30684-10.html": - { + case "30684-10.html": { htmltext = event; break; } - case "30064-03.html": - { - if (hasQuestItems(player, DUFNERS_LETTER)) - { + case "30064-03.html": { + if (hasQuestItems(player, DUFNERS_LETTER)) { takeItems(player, DUFNERS_LETTER, 1); giveItems(player, TERRYS_1ST_ORDER, 1); qs.setCond(2, true); @@ -157,10 +143,8 @@ public final class Q00213_TrialOfTheSeeker extends Quest } break; } - case "30064-06.html": - { - if (hasQuestItems(player, TERRYS_1ST_ORDER)) - { + case "30064-06.html": { + if (hasQuestItems(player, TERRYS_1ST_ORDER)) { takeItems(player, TERRYS_1ST_ORDER, 1); giveItems(player, TERRYS_2ND_ORDER, 1); takeItems(player, MYSTERIOUS_SPIRIT_ORE, 1); @@ -169,8 +153,7 @@ public final class Q00213_TrialOfTheSeeker extends Quest } break; } - case "30064-10.html": - { + case "30064-10.html": { giveItems(player, TERRYS_LETTER, 1); takeItems(player, OL_MAHUM_SPIRIT_ORE, 1); takeItems(player, TUREK_SPIRIT_ORE, 1); @@ -182,10 +165,8 @@ public final class Q00213_TrialOfTheSeeker extends Quest htmltext = event; break; } - case "30064-18.html": - { - if (hasQuestItems(player, ANALYSIS_RESULT)) - { + case "30064-18.html": { + if (hasQuestItems(player, ANALYSIS_RESULT)) { takeItems(player, ANALYSIS_RESULT, 1); giveItems(player, LIST_OF_HOST, 1); qs.setCond(15, true); @@ -193,10 +174,8 @@ public final class Q00213_TrialOfTheSeeker extends Quest } break; } - case "30684-05.html": - { - if (hasQuestItems(player, TERRYS_LETTER)) - { + case "30684-05.html": { + if (hasQuestItems(player, TERRYS_LETTER)) { takeItems(player, TERRYS_LETTER, 1); giveItems(player, VIKTORS_LETTER, 1); qs.setCond(7, true); @@ -204,8 +183,7 @@ public final class Q00213_TrialOfTheSeeker extends Quest } break; } - case "30684-11.html": - { + case "30684-11.html": { takeItems(player, TERRYS_LETTER, 1); takeItems(player, TERRY_BOX, 1); takeItems(player, HAWKEYES_LETTER, 1); @@ -215,8 +193,7 @@ public final class Q00213_TrialOfTheSeeker extends Quest htmltext = event; break; } - case "30684-15.html": - { + case "30684-15.html": { takeItems(player, VIKTORS_REQUEST, 1); takeItems(player, MEDUSA_SCALES, -1); giveItems(player, SHILENS_SPIRIT_ORE, 1); @@ -225,8 +202,7 @@ public final class Q00213_TrialOfTheSeeker extends Quest htmltext = event; break; } - case "30715-02.html": - { + case "30715-02.html": { takeItems(player, SHILENS_SPIRIT_ORE, 1); takeItems(player, ANALYSIS_REQUEST, 1); giveItems(player, MARINAS_LETTER, 1); @@ -234,8 +210,7 @@ public final class Q00213_TrialOfTheSeeker extends Quest htmltext = event; break; } - case "30715-05.html": - { + case "30715-05.html": { takeItems(player, EXPERIMENT_TOOLS, 1); giveItems(player, ANALYSIS_RESULT, 1); qs.setCond(14, true); @@ -247,140 +222,105 @@ public final class Q00213_TrialOfTheSeeker extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case ANT_CAPTAIN: - { - if (hasQuestItems(killer, TERRYS_2ND_ORDER) && !hasQuestItems(killer, ANT_SPIRIT_ORE)) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case ANT_CAPTAIN: { + if (hasQuestItems(killer, TERRYS_2ND_ORDER) && !hasQuestItems(killer, ANT_SPIRIT_ORE)) { giveItems(killer, ANT_SPIRIT_ORE, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if (hasQuestItems(killer, OL_MAHUM_SPIRIT_ORE, TUREK_SPIRIT_ORE, TURAK_BUGBEAR_SPIRIT_ORE)) - { + if (hasQuestItems(killer, OL_MAHUM_SPIRIT_ORE, TUREK_SPIRIT_ORE, TURAK_BUGBEAR_SPIRIT_ORE)) { qs.setCond(5); } } break; } - case ANT_WARRIOR_CAPTAIN: - { - if (hasQuestItems(killer, LIST_OF_HOST) && !hasQuestItems(killer, ABYSS_SPIRIT_ORE3)) - { + case ANT_WARRIOR_CAPTAIN: { + if (hasQuestItems(killer, LIST_OF_HOST) && !hasQuestItems(killer, ABYSS_SPIRIT_ORE3)) { giveItems(killer, ABYSS_SPIRIT_ORE3, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if (hasQuestItems(killer, ABYSS_SPIRIT_ORE1, ABYSS_SPIRIT_ORE2, ABYSS_SPIRIT_ORE4)) - { + if (hasQuestItems(killer, ABYSS_SPIRIT_ORE1, ABYSS_SPIRIT_ORE2, ABYSS_SPIRIT_ORE4)) { qs.setCond(16); } } break; } - case MEDUSA: - { - if (hasQuestItems(killer, VIKTORS_REQUEST) && (getQuestItemsCount(killer, MEDUSA_SCALES) < 10)) - { + case MEDUSA: { + if (hasQuestItems(killer, VIKTORS_REQUEST) && (getQuestItemsCount(killer, MEDUSA_SCALES) < 10)) { giveItems(killer, MEDUSA_SCALES, 1); - if (getQuestItemsCount(killer, MEDUSA_SCALES) == 10) - { + if (getQuestItemsCount(killer, MEDUSA_SCALES) == 10) { qs.setCond(10, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case NEER_GHOUL_BERSERKER: - { - if (hasQuestItems(killer, TERRYS_1ST_ORDER) && !hasQuestItems(killer, MYSTERIOUS_SPIRIT_ORE)) - { - if (getRandom(100) < 50) - { + case NEER_GHOUL_BERSERKER: { + if (hasQuestItems(killer, TERRYS_1ST_ORDER) && !hasQuestItems(killer, MYSTERIOUS_SPIRIT_ORE)) { + if (getRandom(100) < 50) { giveItems(killer, MYSTERIOUS_SPIRIT_ORE, 1); qs.setCond(3, true); } } break; } - case OL_MAHUM_CAPTAIN: - { - if (hasQuestItems(killer, TERRYS_2ND_ORDER) && !hasQuestItems(killer, OL_MAHUM_SPIRIT_ORE)) - { + case OL_MAHUM_CAPTAIN: { + if (hasQuestItems(killer, TERRYS_2ND_ORDER) && !hasQuestItems(killer, OL_MAHUM_SPIRIT_ORE)) { giveItems(killer, OL_MAHUM_SPIRIT_ORE, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if (hasQuestItems(killer, TUREK_SPIRIT_ORE, ANT_SPIRIT_ORE, TURAK_BUGBEAR_SPIRIT_ORE)) - { + if (hasQuestItems(killer, TUREK_SPIRIT_ORE, ANT_SPIRIT_ORE, TURAK_BUGBEAR_SPIRIT_ORE)) { qs.setCond(5); } } break; } - case MARSH_STAKATO_DRONE: - { - if (hasQuestItems(killer, LIST_OF_HOST) && !hasQuestItems(killer, ABYSS_SPIRIT_ORE1)) - { + case MARSH_STAKATO_DRONE: { + if (hasQuestItems(killer, LIST_OF_HOST) && !hasQuestItems(killer, ABYSS_SPIRIT_ORE1)) { giveItems(killer, ABYSS_SPIRIT_ORE1, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if (hasQuestItems(killer, ABYSS_SPIRIT_ORE2, ABYSS_SPIRIT_ORE3, ABYSS_SPIRIT_ORE4)) - { + if (hasQuestItems(killer, ABYSS_SPIRIT_ORE2, ABYSS_SPIRIT_ORE3, ABYSS_SPIRIT_ORE4)) { qs.setCond(16); } } break; } - case TURAK_BUGBEAR_WARRIOR: - { - if (hasQuestItems(killer, TERRYS_2ND_ORDER) && !hasQuestItems(killer, TURAK_BUGBEAR_SPIRIT_ORE)) - { + case TURAK_BUGBEAR_WARRIOR: { + if (hasQuestItems(killer, TERRYS_2ND_ORDER) && !hasQuestItems(killer, TURAK_BUGBEAR_SPIRIT_ORE)) { giveItems(killer, TURAK_BUGBEAR_SPIRIT_ORE, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if (hasQuestItems(killer, OL_MAHUM_SPIRIT_ORE, TUREK_SPIRIT_ORE, ANT_SPIRIT_ORE)) - { + if (hasQuestItems(killer, OL_MAHUM_SPIRIT_ORE, TUREK_SPIRIT_ORE, ANT_SPIRIT_ORE)) { qs.setCond(5); } } break; } - case BREKA_ORC_OVERLORD: - { - if (hasQuestItems(killer, LIST_OF_HOST) && !hasQuestItems(killer, ABYSS_SPIRIT_ORE2)) - { + case BREKA_ORC_OVERLORD: { + if (hasQuestItems(killer, LIST_OF_HOST) && !hasQuestItems(killer, ABYSS_SPIRIT_ORE2)) { giveItems(killer, ABYSS_SPIRIT_ORE2, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if (hasQuestItems(killer, ABYSS_SPIRIT_ORE1, ABYSS_SPIRIT_ORE3, ABYSS_SPIRIT_ORE4)) - { + if (hasQuestItems(killer, ABYSS_SPIRIT_ORE1, ABYSS_SPIRIT_ORE3, ABYSS_SPIRIT_ORE4)) { qs.setCond(16); } } break; } - case TUREK_ORC_WARLORD: - { - if (hasQuestItems(killer, TERRYS_2ND_ORDER) && !hasQuestItems(killer, TUREK_SPIRIT_ORE)) - { + case TUREK_ORC_WARLORD: { + if (hasQuestItems(killer, TERRYS_2ND_ORDER) && !hasQuestItems(killer, TUREK_SPIRIT_ORE)) { giveItems(killer, TUREK_SPIRIT_ORE, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if (hasQuestItems(killer, OL_MAHUM_SPIRIT_ORE, ANT_SPIRIT_ORE, TURAK_BUGBEAR_SPIRIT_ORE)) - { + if (hasQuestItems(killer, OL_MAHUM_SPIRIT_ORE, ANT_SPIRIT_ORE, TURAK_BUGBEAR_SPIRIT_ORE)) { qs.setCond(5); } } break; } - case LETO_LIZARDMAN_WARRIOR: - { - if (hasQuestItems(killer, LIST_OF_HOST) && !hasQuestItems(killer, ABYSS_SPIRIT_ORE4)) - { + case LETO_LIZARDMAN_WARRIOR: { + if (hasQuestItems(killer, LIST_OF_HOST) && !hasQuestItems(killer, ABYSS_SPIRIT_ORE4)) { giveItems(killer, ABYSS_SPIRIT_ORE4, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if (hasQuestItems(killer, ABYSS_SPIRIT_ORE1, ABYSS_SPIRIT_ORE2, ABYSS_SPIRIT_ORE3)) - { + if (hasQuestItems(killer, ABYSS_SPIRIT_ORE1, ABYSS_SPIRIT_ORE2, ABYSS_SPIRIT_ORE3)) { qs.setCond(16); } } @@ -392,47 +332,29 @@ public final class Q00213_TrialOfTheSeeker extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == MASTER_DUFNER) - { - if ((player.getClassId() == ClassId.rogue) || (player.getClassId() == ClassId.elvenScout) || ((player.getClassId() == ClassId.assassin))) - { - if (player.getLevel() < MIN_LVL) - { + if (qs.isCreated()) { + if (npc.getId() == MASTER_DUFNER) { + if ((player.getClassId() == ClassId.rogue) || (player.getClassId() == ClassId.elvenScout) || ((player.getClassId() == ClassId.assassin))) { + if (player.getLevel() < MIN_LVL) { htmltext = "30106-02.html"; - } - else - { + } else { htmltext = "30106-03.htm"; } - } - else - { + } else { htmltext = "30106-01.html"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case MASTER_DUFNER: - { - if (hasQuestItems(player, DUFNERS_LETTER) && !hasQuestItems(player, TERRYS_REPORT)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case MASTER_DUFNER: { + if (hasQuestItems(player, DUFNERS_LETTER) && !hasQuestItems(player, TERRYS_REPORT)) { htmltext = "30106-06.html"; - } - else if (!hasAtLeastOneQuestItem(player, DUFNERS_LETTER, TERRYS_REPORT)) - { + } else if (!hasAtLeastOneQuestItem(player, DUFNERS_LETTER, TERRYS_REPORT)) { htmltext = "30106-07.html"; - } - else if (hasQuestItems(player, TERRYS_REPORT) && !hasQuestItems(player, DUFNERS_LETTER)) - { + } else if (hasQuestItems(player, TERRYS_REPORT) && !hasQuestItems(player, DUFNERS_LETTER)) { giveAdena(player, 187606, true); giveItems(player, MARK_OF_SEEKER, 1); addExpAndSp(player, 1029478, 66768); @@ -442,79 +364,47 @@ public final class Q00213_TrialOfTheSeeker extends Quest } break; } - case MASTER_TERRY: - { - if (hasQuestItems(player, DUFNERS_LETTER)) - { + case MASTER_TERRY: { + if (hasQuestItems(player, DUFNERS_LETTER)) { htmltext = "30064-01.html"; - } - else if (hasQuestItems(player, TERRYS_1ST_ORDER)) - { - if (!hasQuestItems(player, MYSTERIOUS_SPIRIT_ORE)) - { + } else if (hasQuestItems(player, TERRYS_1ST_ORDER)) { + if (!hasQuestItems(player, MYSTERIOUS_SPIRIT_ORE)) { htmltext = "30064-04.html"; - } - else - { + } else { htmltext = "30064-05.html"; } - } - else if (hasQuestItems(player, TERRYS_2ND_ORDER)) - { - if ((getQuestItemsCount(player, OL_MAHUM_SPIRIT_ORE) + getQuestItemsCount(player, TUREK_SPIRIT_ORE) + getQuestItemsCount(player, ANT_SPIRIT_ORE) + getQuestItemsCount(player, TURAK_BUGBEAR_SPIRIT_ORE)) < 4) - { + } else if (hasQuestItems(player, TERRYS_2ND_ORDER)) { + if ((getQuestItemsCount(player, OL_MAHUM_SPIRIT_ORE) + getQuestItemsCount(player, TUREK_SPIRIT_ORE) + getQuestItemsCount(player, ANT_SPIRIT_ORE) + getQuestItemsCount(player, TURAK_BUGBEAR_SPIRIT_ORE)) < 4) { htmltext = "30064-08.html"; - } - else - { + } else { htmltext = "30064-09.html"; } - } - else if (hasQuestItems(player, TERRYS_LETTER)) - { + } else if (hasQuestItems(player, TERRYS_LETTER)) { htmltext = "30064-11.html"; - } - else if (hasQuestItems(player, VIKTORS_LETTER)) - { + } else if (hasQuestItems(player, VIKTORS_LETTER)) { takeItems(player, VIKTORS_LETTER, 1); giveItems(player, HAWKEYES_LETTER, 1); qs.setCond(8, true); htmltext = "30064-12.html"; - } - else if (hasQuestItems(player, HAWKEYES_LETTER)) - { + } else if (hasQuestItems(player, HAWKEYES_LETTER)) { htmltext = "30064-13.html"; - } - else if (hasAtLeastOneQuestItem(player, VIKTORS_REQUEST, ANALYSIS_REQUEST, MARINAS_LETTER, EXPERIMENT_TOOLS)) - { + } else if (hasAtLeastOneQuestItem(player, VIKTORS_REQUEST, ANALYSIS_REQUEST, MARINAS_LETTER, EXPERIMENT_TOOLS)) { htmltext = "30064-14.html"; - } - else if (hasQuestItems(player, ANALYSIS_RESULT)) - { + } else if (hasQuestItems(player, ANALYSIS_RESULT)) { htmltext = "30064-15.html"; - } - else if (hasQuestItems(player, TERRYS_3RD_ORDER)) - { - if (player.getLevel() < LEVEL) - { + } else if (hasQuestItems(player, TERRYS_3RD_ORDER)) { + if (player.getLevel() < LEVEL) { htmltext = "30064-20.html"; - } - else - { + } else { takeItems(player, TERRYS_3RD_ORDER, 1); giveItems(player, LIST_OF_HOST, 1); qs.setCond(15, true); htmltext = "30064-21.html"; } - } - else if (hasQuestItems(player, LIST_OF_HOST)) - { - if ((getQuestItemsCount(player, ABYSS_SPIRIT_ORE1) + getQuestItemsCount(player, ABYSS_SPIRIT_ORE2) + getQuestItemsCount(player, ABYSS_SPIRIT_ORE3) + getQuestItemsCount(player, ABYSS_SPIRIT_ORE4)) < 4) - { + } else if (hasQuestItems(player, LIST_OF_HOST)) { + if ((getQuestItemsCount(player, ABYSS_SPIRIT_ORE1) + getQuestItemsCount(player, ABYSS_SPIRIT_ORE2) + getQuestItemsCount(player, ABYSS_SPIRIT_ORE3) + getQuestItemsCount(player, ABYSS_SPIRIT_ORE4)) < 4) { htmltext = "30064-22.html"; - } - else - { + } else { takeItems(player, LIST_OF_HOST, 1); takeItems(player, ABYSS_SPIRIT_ORE1, 1); takeItems(player, ABYSS_SPIRIT_ORE2, 1); @@ -524,89 +414,57 @@ public final class Q00213_TrialOfTheSeeker extends Quest qs.setCond(17, true); htmltext = "30064-23.html"; } - } - else if (hasQuestItems(player, TERRYS_REPORT)) - { + } else if (hasQuestItems(player, TERRYS_REPORT)) { htmltext = "30064-24.html"; } break; } - case BLACKSMITH_BRUNON: - { - if (hasQuestItems(player, MARINAS_LETTER)) - { + case BLACKSMITH_BRUNON: { + if (hasQuestItems(player, MARINAS_LETTER)) { takeItems(player, MARINAS_LETTER, 1); giveItems(player, EXPERIMENT_TOOLS, 1); qs.setCond(13, true); htmltext = "30526-01.html"; - } - else if (hasQuestItems(player, EXPERIMENT_TOOLS)) - { + } else if (hasQuestItems(player, EXPERIMENT_TOOLS)) { htmltext = "30526-02.html"; } break; } - case TRADER_VIKTOR: - { - if (hasQuestItems(player, TERRYS_LETTER)) - { + case TRADER_VIKTOR: { + if (hasQuestItems(player, TERRYS_LETTER)) { htmltext = "30684-01.html"; - } - else if (hasQuestItems(player, HAWKEYES_LETTER)) - { + } else if (hasQuestItems(player, HAWKEYES_LETTER)) { htmltext = "30684-12.html"; - } - else if (hasQuestItems(player, VIKTORS_REQUEST)) - { - if (getQuestItemsCount(player, MEDUSA_SCALES) < 10) - { + } else if (hasQuestItems(player, VIKTORS_REQUEST)) { + if (getQuestItemsCount(player, MEDUSA_SCALES) < 10) { htmltext = "30684-13.html"; - } - else - { + } else { htmltext = "30684-14.html"; } - } - else if (hasQuestItems(player, SHILENS_SPIRIT_ORE, ANALYSIS_REQUEST)) - { + } else if (hasQuestItems(player, SHILENS_SPIRIT_ORE, ANALYSIS_REQUEST)) { htmltext = "30684-16.html"; - } - else if (hasQuestItems(player, MARINAS_LETTER, EXPERIMENT_TOOLS, ANALYSIS_REQUEST, TERRYS_REPORT)) - { + } else if (hasQuestItems(player, MARINAS_LETTER, EXPERIMENT_TOOLS, ANALYSIS_REQUEST, TERRYS_REPORT)) { htmltext = "30684-17.html"; - } - else if (hasQuestItems(player, VIKTORS_LETTER)) - { + } else if (hasQuestItems(player, VIKTORS_LETTER)) { htmltext = "30684-05.html"; } break; } - case MAGISTER_MARINA: - { - if (hasQuestItems(player, SHILENS_SPIRIT_ORE, ANALYSIS_REQUEST)) - { + case MAGISTER_MARINA: { + if (hasQuestItems(player, SHILENS_SPIRIT_ORE, ANALYSIS_REQUEST)) { htmltext = "30715-01.html"; - } - else if (hasQuestItems(player, MARINAS_LETTER)) - { + } else if (hasQuestItems(player, MARINAS_LETTER)) { htmltext = "30715-03.html"; - } - else if (hasQuestItems(player, EXPERIMENT_TOOLS)) - { + } else if (hasQuestItems(player, EXPERIMENT_TOOLS)) { htmltext = "30715-04.html"; - } - else if (hasQuestItems(player, ANALYSIS_RESULT)) - { + } else if (hasQuestItems(player, ANALYSIS_RESULT)) { htmltext = "30715-06.html"; } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == MASTER_DUFNER) - { + } else if (qs.isCompleted()) { + if (npc.getId() == MASTER_DUFNER) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00214_TrialOfTheScholar/Q00214_TrialOfTheScholar.java b/src/main/java/com/l2jserver/datapack/quests/Q00214_TrialOfTheScholar/Q00214_TrialOfTheScholar.java index abc91bd46d..70dcb0f737 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00214_TrialOfTheScholar/Q00214_TrialOfTheScholar.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00214_TrialOfTheScholar/Q00214_TrialOfTheScholar.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Trial Of The Scholar (214) * @author ivantotov */ -public final class Q00214_TrialOfTheScholar extends Quest -{ +public final class Q00214_TrialOfTheScholar extends Quest { // NPCs private static final int HIGH_PRIEST_SYLVAIN = 30070; private static final int CAPTAIN_LUCAS = 30071; @@ -112,8 +111,7 @@ public final class Q00214_TrialOfTheScholar extends Quest private static final int MIN_LVL = 35; private static final int LEVEL = 36; - public Q00214_TrialOfTheScholar() - { + public Q00214_TrialOfTheScholar() { super(214, Q00214_TrialOfTheScholar.class.getSimpleName(), "Trial Of The Scholar"); addStartNpc(MAGISTER_MIRIEN); addTalkId(MAGISTER_MIRIEN, HIGH_PRIEST_SYLVAIN, CAPTAIN_LUCAS, WAREHOUSE_KEEPER_VALKON, MAGISTER_DIETER, GRAND_MAGISTER_JUREK, TRADER_EDROC, WAREHOUSE_KEEPER_RAUT, BLACKSMITH_POITAN, MARIA, ASTROLOGER_CRETA, ELDER_CRONOS, DRUNKARD_TRIFF, ELDER_CASIAN); @@ -122,35 +120,26 @@ public final class Q00214_TrialOfTheScholar extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (qs.isCreated()) - { + switch (event) { + case "ACCEPT": { + if (qs.isCreated()) { qs.startQuest(); - if (!hasQuestItems(player, MIRIENS_1ST_SIGIL)) - { + if (!hasQuestItems(player, MIRIENS_1ST_SIGIL)) { giveItems(player, MIRIENS_1ST_SIGIL, 1); } playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); - if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) - { + if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) { giveItems(player, DIMENSIONAL_DIAMOND, 168); player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1); htmltext = "30461-04a.htm"; - } - else - { + } else { htmltext = "30461-04.htm"; } } @@ -184,15 +173,12 @@ public final class Q00214_TrialOfTheScholar extends Quest case "30611-02.html": case "30611-03.html": case "30611-06.html": - case "30612-03.html": - { + case "30612-03.html": { htmltext = event; break; } - case "30461-10.html": - { - if (hasQuestItems(player, MIRIENS_2ND_SIGIL, SYMBOL_OF_JUREK)) - { + case "30461-10.html": { + if (hasQuestItems(player, MIRIENS_2ND_SIGIL, SYMBOL_OF_JUREK)) { takeItems(player, MIRIENS_2ND_SIGIL, 1); giveItems(player, MIRIENS_3RD_SIGIL, 1); takeItems(player, SYMBOL_OF_JUREK, 1); @@ -201,18 +187,15 @@ public final class Q00214_TrialOfTheScholar extends Quest } break; } - case "30070-02.html": - { + case "30070-02.html": { giveItems(player, HIGH_PRIESTS_SIGIL, 1); giveItems(player, SYLVAINS_LETTER, 1); qs.setCond(2, true); htmltext = event; break; } - case "30071-04.html": - { - if (hasQuestItems(player, CRERAS_PAINTING2)) - { + case "30071-04.html": { + if (hasQuestItems(player, CRERAS_PAINTING2)) { takeItems(player, CRERAS_PAINTING2, 1); giveItems(player, CRERAS_PAINTING3, 1); qs.setCond(10, true); @@ -220,16 +203,13 @@ public final class Q00214_TrialOfTheScholar extends Quest } break; } - case "30103-04.html": - { + case "30103-04.html": { giveItems(player, VALKONS_REQUEST, 1); htmltext = event; break; } - case "30111-05.html": - { - if (hasQuestItems(player, CRONOS_LETTER)) - { + case "30111-05.html": { + if (hasQuestItems(player, CRONOS_LETTER)) { takeItems(player, CRONOS_LETTER, 1); giveItems(player, DIETERS_KEY, 1); qs.setCond(21, true); @@ -237,10 +217,8 @@ public final class Q00214_TrialOfTheScholar extends Quest } break; } - case "30111-09.html": - { - if (hasQuestItems(player, CRETAS_2ND_LETTER)) - { + case "30111-09.html": { + if (hasQuestItems(player, CRETAS_2ND_LETTER)) { takeItems(player, CRETAS_2ND_LETTER, 1); giveItems(player, DIETERS_LETTER, 1); giveItems(player, DIETERS_DIARY, 1); @@ -249,18 +227,15 @@ public final class Q00214_TrialOfTheScholar extends Quest } break; } - case "30115-03.html": - { + case "30115-03.html": { giveItems(player, JUREKS_LIST, 1); giveItems(player, GRAND_MAGISTER_SIGIL, 1); qs.setCond(16, true); htmltext = event; break; } - case "30230-02.html": - { - if (hasQuestItems(player, DIETERS_LETTER)) - { + case "30230-02.html": { + if (hasQuestItems(player, DIETERS_LETTER)) { takeItems(player, DIETERS_LETTER, 1); giveItems(player, RAUTS_LETTER_ENVELOPE, 1); qs.setCond(24, true); @@ -268,10 +243,8 @@ public final class Q00214_TrialOfTheScholar extends Quest } break; } - case "30316-02.html": - { - if (hasQuestItems(player, RAUTS_LETTER_ENVELOPE)) - { + case "30316-02.html": { + if (hasQuestItems(player, RAUTS_LETTER_ENVELOPE)) { takeItems(player, RAUTS_LETTER_ENVELOPE, 1); giveItems(player, SCRIPTURE_CHAPTER_1, 1); giveItems(player, STRONG_LIGUOR, 1); @@ -280,10 +253,8 @@ public final class Q00214_TrialOfTheScholar extends Quest } break; } - case "30608-02.html": - { - if (hasQuestItems(player, SYLVAINS_LETTER)) - { + case "30608-02.html": { + if (hasQuestItems(player, SYLVAINS_LETTER)) { giveItems(player, MARIAS_1ST_LETTER, 1); takeItems(player, SYLVAINS_LETTER, 1); qs.setCond(3, true); @@ -291,10 +262,8 @@ public final class Q00214_TrialOfTheScholar extends Quest } break; } - case "30608-08.html": - { - if (hasQuestItems(player, CRETAS_1ST_LETTER)) - { + case "30608-08.html": { + if (hasQuestItems(player, CRETAS_1ST_LETTER)) { giveItems(player, LUCILLAS_HANDBAG, 1); takeItems(player, CRETAS_1ST_LETTER, 1); qs.setCond(7, true); @@ -302,10 +271,8 @@ public final class Q00214_TrialOfTheScholar extends Quest } break; } - case "30608-14.html": - { - if (hasQuestItems(player, CRERAS_PAINTING3)) - { + case "30608-14.html": { + if (hasQuestItems(player, CRERAS_PAINTING3)) { takeItems(player, CRERAS_PAINTING3, 1); takeItems(player, BROWN_SCROLL_SCRAP, -1); giveItems(player, CRYSTAL_OF_PURITY1, 1); @@ -314,10 +281,8 @@ public final class Q00214_TrialOfTheScholar extends Quest } break; } - case "30609-05.html": - { - if (hasQuestItems(player, MARIAS_2ND_LETTER)) - { + case "30609-05.html": { + if (hasQuestItems(player, MARIAS_2ND_LETTER)) { takeItems(player, MARIAS_2ND_LETTER, 1); giveItems(player, CRETAS_1ST_LETTER, 1); qs.setCond(6, true); @@ -325,10 +290,8 @@ public final class Q00214_TrialOfTheScholar extends Quest } break; } - case "30609-09.html": - { - if (hasQuestItems(player, LUCILLAS_HANDBAG)) - { + case "30609-09.html": { + if (hasQuestItems(player, LUCILLAS_HANDBAG)) { takeItems(player, LUCILLAS_HANDBAG, 1); giveItems(player, CRERAS_PAINTING1, 1); qs.setCond(8, true); @@ -336,10 +299,8 @@ public final class Q00214_TrialOfTheScholar extends Quest } break; } - case "30609-14.html": - { - if (hasQuestItems(player, DIETERS_KEY)) - { + case "30609-14.html": { + if (hasQuestItems(player, DIETERS_KEY)) { takeItems(player, DIETERS_KEY, 1); giveItems(player, CRETAS_2ND_LETTER, 1); qs.setCond(22, true); @@ -347,18 +308,15 @@ public final class Q00214_TrialOfTheScholar extends Quest } break; } - case "30610-10.html": - { + case "30610-10.html": { giveItems(player, CRONOS_SIGIL, 1); giveItems(player, CRONOS_LETTER, 1); qs.setCond(20, true); htmltext = event; break; } - case "30610-14.html": - { - if (hasQuestItems(player, SCRIPTURE_CHAPTER_1, SCRIPTURE_CHAPTER_2, SCRIPTURE_CHAPTER_3, SCRIPTURE_CHAPTER_4)) - { + case "30610-14.html": { + if (hasQuestItems(player, SCRIPTURE_CHAPTER_1, SCRIPTURE_CHAPTER_2, SCRIPTURE_CHAPTER_3, SCRIPTURE_CHAPTER_4)) { takeItems(player, CRONOS_SIGIL, 1); takeItems(player, DIETERS_DIARY, 1); takeItems(player, TRIFFS_RING, 1); @@ -372,10 +330,8 @@ public final class Q00214_TrialOfTheScholar extends Quest } break; } - case "30611-04.html": - { - if (hasQuestItems(player, STRONG_LIGUOR)) - { + case "30611-04.html": { + if (hasQuestItems(player, STRONG_LIGUOR)) { giveItems(player, TRIFFS_RING, 1); takeItems(player, STRONG_LIGUOR, 1); qs.setCond(26, true); @@ -383,15 +339,13 @@ public final class Q00214_TrialOfTheScholar extends Quest } break; } - case "30612-04.html": - { + case "30612-04.html": { giveItems(player, CASIANS_LIST, 1); qs.setCond(28, true); htmltext = event; break; } - case "30612-07.html": - { + case "30612-07.html": { giveItems(player, SCRIPTURE_CHAPTER_4, 1); takeItems(player, POITANS_NOTES, 1); takeItems(player, CASIANS_LIST, 1); @@ -408,146 +362,101 @@ public final class Q00214_TrialOfTheScholar extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case MONSTER_EYE_DESTREOYER: - { - if (hasQuestItems(killer, MIRIENS_2ND_SIGIL, GRAND_MAGISTER_SIGIL, JUREKS_LIST) && (getQuestItemsCount(killer, MONSTER_EYE_DESTROYER_SKIN) < 5)) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case MONSTER_EYE_DESTREOYER: { + if (hasQuestItems(killer, MIRIENS_2ND_SIGIL, GRAND_MAGISTER_SIGIL, JUREKS_LIST) && (getQuestItemsCount(killer, MONSTER_EYE_DESTROYER_SKIN) < 5)) { giveItems(killer, MONSTER_EYE_DESTROYER_SKIN, 1); - if ((getQuestItemsCount(killer, MONSTER_EYE_DESTROYER_SKIN) == 5) && (getQuestItemsCount(killer, SHAMANS_NECKLACE) >= 5) && (getQuestItemsCount(killer, SHACKLES_SCALP) >= 2)) - { + if ((getQuestItemsCount(killer, MONSTER_EYE_DESTROYER_SKIN) == 5) && (getQuestItemsCount(killer, SHAMANS_NECKLACE) >= 5) && (getQuestItemsCount(killer, SHACKLES_SCALP) >= 2)) { qs.setCond(17, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case MEDUSA: - { - if (hasQuestItems(killer, TRIFFS_RING, POITANS_NOTES, CASIANS_LIST) && (getQuestItemsCount(killer, MEDUSAS_BLOOD) < 12)) - { + case MEDUSA: { + if (hasQuestItems(killer, TRIFFS_RING, POITANS_NOTES, CASIANS_LIST) && (getQuestItemsCount(killer, MEDUSAS_BLOOD) < 12)) { giveItems(killer, MEDUSAS_BLOOD, 1); - if (getQuestItemsCount(killer, MEDUSAS_BLOOD) == 12) - { + if (getQuestItemsCount(killer, MEDUSAS_BLOOD) == 12) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case GHOUL: - { - if (hasQuestItems(killer, TRIFFS_RING, POITANS_NOTES, CASIANS_LIST) && (getQuestItemsCount(killer, GHOULS_SKIN) < 10)) - { + case GHOUL: { + if (hasQuestItems(killer, TRIFFS_RING, POITANS_NOTES, CASIANS_LIST) && (getQuestItemsCount(killer, GHOULS_SKIN) < 10)) { giveItems(killer, GHOULS_SKIN, 1); - if (getQuestItemsCount(killer, GHOULS_SKIN) == 10) - { + if (getQuestItemsCount(killer, GHOULS_SKIN) == 10) { qs.setCond(29, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } case SHACKLE1: - case SHACKLE2: - { - if (hasQuestItems(killer, MIRIENS_2ND_SIGIL, GRAND_MAGISTER_SIGIL, JUREKS_LIST) && (getQuestItemsCount(killer, SHACKLES_SCALP) < 2)) - { + case SHACKLE2: { + if (hasQuestItems(killer, MIRIENS_2ND_SIGIL, GRAND_MAGISTER_SIGIL, JUREKS_LIST) && (getQuestItemsCount(killer, SHACKLES_SCALP) < 2)) { giveItems(killer, SHACKLES_SCALP, 1); - if ((getQuestItemsCount(killer, MONSTER_EYE_DESTROYER_SKIN) >= 5) && (getQuestItemsCount(killer, SHAMANS_NECKLACE) >= 5) && (getQuestItemsCount(killer, SHACKLES_SCALP) == 2)) - { + if ((getQuestItemsCount(killer, MONSTER_EYE_DESTROYER_SKIN) >= 5) && (getQuestItemsCount(killer, SHAMANS_NECKLACE) >= 5) && (getQuestItemsCount(killer, SHACKLES_SCALP) == 2)) { qs.setCond(17, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case BREKA_ORC_SHAMAN: - { - if (hasQuestItems(killer, MIRIENS_2ND_SIGIL, GRAND_MAGISTER_SIGIL, JUREKS_LIST) && (getQuestItemsCount(killer, SHAMANS_NECKLACE) < 5)) - { + case BREKA_ORC_SHAMAN: { + if (hasQuestItems(killer, MIRIENS_2ND_SIGIL, GRAND_MAGISTER_SIGIL, JUREKS_LIST) && (getQuestItemsCount(killer, SHAMANS_NECKLACE) < 5)) { giveItems(killer, SHAMANS_NECKLACE, 1); - if ((getQuestItemsCount(killer, MONSTER_EYE_DESTROYER_SKIN) >= 5) && (getQuestItemsCount(killer, SHAMANS_NECKLACE) == 5) && (getQuestItemsCount(killer, SHACKLES_SCALP) >= 2)) - { + if ((getQuestItemsCount(killer, MONSTER_EYE_DESTROYER_SKIN) >= 5) && (getQuestItemsCount(killer, SHAMANS_NECKLACE) == 5) && (getQuestItemsCount(killer, SHACKLES_SCALP) >= 2)) { qs.setCond(17, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case FETTERED_SOUL: - { - if (hasQuestItems(killer, TRIFFS_RING, POITANS_NOTES, CASIANS_LIST) && (getQuestItemsCount(killer, FETTERED_SOULS_ICHOR) < 5)) - { + case FETTERED_SOUL: { + if (hasQuestItems(killer, TRIFFS_RING, POITANS_NOTES, CASIANS_LIST) && (getQuestItemsCount(killer, FETTERED_SOULS_ICHOR) < 5)) { giveItems(killer, FETTERED_SOULS_ICHOR, 1); - if (getQuestItemsCount(killer, FETTERED_SOULS_ICHOR) >= 5) - { + if (getQuestItemsCount(killer, FETTERED_SOULS_ICHOR) >= 5) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case GRANDIS: - { - if (hasQuestItems(killer, MIRIENS_3RD_SIGIL, CRONOS_SIGIL, TRIFFS_RING) && !hasQuestItems(killer, SCRIPTURE_CHAPTER_3)) - { + case GRANDIS: { + if (hasQuestItems(killer, MIRIENS_3RD_SIGIL, CRONOS_SIGIL, TRIFFS_RING) && !hasQuestItems(killer, SCRIPTURE_CHAPTER_3)) { giveItems(killer, SCRIPTURE_CHAPTER_3, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); } break; } - case ENCHANTED_GARGOYLE: - { - if (hasQuestItems(killer, TRIFFS_RING, POITANS_NOTES, CASIANS_LIST) && (getQuestItemsCount(killer, ENCHANTED_GARGOYLES_NAIL) < 5)) - { + case ENCHANTED_GARGOYLE: { + if (hasQuestItems(killer, TRIFFS_RING, POITANS_NOTES, CASIANS_LIST) && (getQuestItemsCount(killer, ENCHANTED_GARGOYLES_NAIL) < 5)) { giveItems(killer, ENCHANTED_GARGOYLES_NAIL, 1); - if (getQuestItemsCount(killer, ENCHANTED_GARGOYLES_NAIL) >= 5) - { + if (getQuestItemsCount(killer, ENCHANTED_GARGOYLES_NAIL) >= 5) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case LETO_LIZARDMAN_WARRIOR: - { - if (hasQuestItems(killer, MIRIENS_1ST_SIGIL, HIGH_PRIESTS_SIGIL, CRERAS_PAINTING3) && (getQuestItemsCount(killer, BROWN_SCROLL_SCRAP) < 5)) - { + case LETO_LIZARDMAN_WARRIOR: { + if (hasQuestItems(killer, MIRIENS_1ST_SIGIL, HIGH_PRIESTS_SIGIL, CRERAS_PAINTING3) && (getQuestItemsCount(killer, BROWN_SCROLL_SCRAP) < 5)) { giveItems(killer, BROWN_SCROLL_SCRAP, 1); - if (getQuestItemsCount(killer, BROWN_SCROLL_SCRAP) == 5) - { + if (getQuestItemsCount(killer, BROWN_SCROLL_SCRAP) == 5) { qs.setCond(12, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -559,85 +468,53 @@ public final class Q00214_TrialOfTheScholar extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == MAGISTER_MIRIEN) - { - if ((player.getClassId() == ClassId.wizard) || (player.getClassId() == ClassId.elvenWizard) || ((player.getClassId() == ClassId.darkWizard))) - { - if (player.getLevel() < MIN_LVL) - { + if (qs.isCreated()) { + if (npc.getId() == MAGISTER_MIRIEN) { + if ((player.getClassId() == ClassId.wizard) || (player.getClassId() == ClassId.elvenWizard) || ((player.getClassId() == ClassId.darkWizard))) { + if (player.getLevel() < MIN_LVL) { htmltext = "30461-02.html"; - } - else - { + } else { htmltext = "30461-03.htm"; } - } - else - { + } else { htmltext = "30461-01.html"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case MAGISTER_MIRIEN: - { - if (hasQuestItems(player, MIRIENS_1ST_SIGIL)) - { - if (!hasQuestItems(player, SYMBOL_OF_SYLVAIN)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case MAGISTER_MIRIEN: { + if (hasQuestItems(player, MIRIENS_1ST_SIGIL)) { + if (!hasQuestItems(player, SYMBOL_OF_SYLVAIN)) { htmltext = "30461-05.html"; - } - else - { + } else { takeItems(player, MIRIENS_1ST_SIGIL, 1); giveItems(player, MIRIENS_2ND_SIGIL, 1); takeItems(player, SYMBOL_OF_SYLVAIN, 1); qs.setCond(15, true); htmltext = "30461-06.html"; } - } - else if (hasQuestItems(player, MIRIENS_2ND_SIGIL)) - { - if (!hasQuestItems(player, SYMBOL_OF_JUREK)) - { + } else if (hasQuestItems(player, MIRIENS_2ND_SIGIL)) { + if (!hasQuestItems(player, SYMBOL_OF_JUREK)) { htmltext = "30461-07.html"; - } - else - { + } else { htmltext = "30461-08.html"; } - } - else if (hasQuestItems(player, MIRIENS_INSTRUCTION)) - { - if (player.getLevel() < LEVEL) - { + } else if (hasQuestItems(player, MIRIENS_INSTRUCTION)) { + if (player.getLevel() < LEVEL) { htmltext = "30461-11.html"; - } - else - { + } else { takeItems(player, MIRIENS_INSTRUCTION, 1); giveItems(player, MIRIENS_3RD_SIGIL, 1); qs.setCond(19, true); htmltext = "30461-12.html"; } - } - else if (hasQuestItems(player, MIRIENS_3RD_SIGIL)) - { - if (!hasQuestItems(player, SYMBOL_OF_CRONOS)) - { + } else if (hasQuestItems(player, MIRIENS_3RD_SIGIL)) { + if (!hasQuestItems(player, SYMBOL_OF_CRONOS)) { htmltext = "30461-13.html"; - } - else - { + } else { giveAdena(player, 319628, true); giveItems(player, MARK_OF_SCHOLAR, 1); addExpAndSp(player, 1753926, 113754); @@ -648,154 +525,95 @@ public final class Q00214_TrialOfTheScholar extends Quest } break; } - case HIGH_PRIEST_SYLVAIN: - { - if (hasQuestItems(player, MIRIENS_1ST_SIGIL) && !hasAtLeastOneQuestItem(player, HIGH_PRIESTS_SIGIL, SYMBOL_OF_SYLVAIN)) - { + case HIGH_PRIEST_SYLVAIN: { + if (hasQuestItems(player, MIRIENS_1ST_SIGIL) && !hasAtLeastOneQuestItem(player, HIGH_PRIESTS_SIGIL, SYMBOL_OF_SYLVAIN)) { htmltext = "30070-01.html"; - } - else if (!hasQuestItems(player, CRYSTAL_OF_PURITY1) && hasQuestItems(player, HIGH_PRIESTS_SIGIL, MIRIENS_1ST_SIGIL)) - { + } else if (!hasQuestItems(player, CRYSTAL_OF_PURITY1) && hasQuestItems(player, HIGH_PRIESTS_SIGIL, MIRIENS_1ST_SIGIL)) { htmltext = "30070-03.html"; - } - else if (hasQuestItems(player, HIGH_PRIESTS_SIGIL, MIRIENS_1ST_SIGIL, CRYSTAL_OF_PURITY1)) - { + } else if (hasQuestItems(player, HIGH_PRIESTS_SIGIL, MIRIENS_1ST_SIGIL, CRYSTAL_OF_PURITY1)) { takeItems(player, CRYSTAL_OF_PURITY1, 1); takeItems(player, HIGH_PRIESTS_SIGIL, 1); giveItems(player, SYMBOL_OF_SYLVAIN, 1); qs.setCond(14, true); htmltext = "30070-04.html"; - } - else if (hasQuestItems(player, MIRIENS_1ST_SIGIL, SYMBOL_OF_SYLVAIN) && !hasQuestItems(player, HIGH_PRIESTS_SIGIL)) - { + } else if (hasQuestItems(player, MIRIENS_1ST_SIGIL, SYMBOL_OF_SYLVAIN) && !hasQuestItems(player, HIGH_PRIESTS_SIGIL)) { htmltext = "30070-05.html"; - } - else if (hasAtLeastOneQuestItem(player, MIRIENS_2ND_SIGIL, MIRIENS_3RD_SIGIL)) - { + } else if (hasAtLeastOneQuestItem(player, MIRIENS_2ND_SIGIL, MIRIENS_3RD_SIGIL)) { htmltext = "30070-06.html"; } break; } - case CAPTAIN_LUCAS: - { - if (hasQuestItems(player, MIRIENS_1ST_SIGIL, HIGH_PRIESTS_SIGIL)) - { - if (hasQuestItems(player, MARIAS_1ST_LETTER)) - { + case CAPTAIN_LUCAS: { + if (hasQuestItems(player, MIRIENS_1ST_SIGIL, HIGH_PRIESTS_SIGIL)) { + if (hasQuestItems(player, MARIAS_1ST_LETTER)) { takeItems(player, MARIAS_1ST_LETTER, 1); giveItems(player, LUCASS_LETTER, 1); qs.setCond(4, true); htmltext = "30071-01.html"; - } - else if (hasAtLeastOneQuestItem(player, MARIAS_2ND_LETTER, CRETAS_1ST_LETTER, LUCILLAS_HANDBAG, CRERAS_PAINTING1, LUCASS_LETTER)) - { + } else if (hasAtLeastOneQuestItem(player, MARIAS_2ND_LETTER, CRETAS_1ST_LETTER, LUCILLAS_HANDBAG, CRERAS_PAINTING1, LUCASS_LETTER)) { htmltext = "30071-02.html"; - } - else if (hasQuestItems(player, CRERAS_PAINTING2)) - { + } else if (hasQuestItems(player, CRERAS_PAINTING2)) { htmltext = "30071-03.html"; - } - else if (hasQuestItems(player, CRERAS_PAINTING3)) - { - if (getQuestItemsCount(player, BROWN_SCROLL_SCRAP) < 5) - { + } else if (hasQuestItems(player, CRERAS_PAINTING3)) { + if (getQuestItemsCount(player, BROWN_SCROLL_SCRAP) < 5) { htmltext = "30071-05.html"; - } - else - { + } else { htmltext = "30071-06.html"; } } - } - else if (hasAtLeastOneQuestItem(player, SYMBOL_OF_SYLVAIN, MIRIENS_2ND_SIGIL, MIRIENS_3RD_SIGIL, CRYSTAL_OF_PURITY1)) - { + } else if (hasAtLeastOneQuestItem(player, SYMBOL_OF_SYLVAIN, MIRIENS_2ND_SIGIL, MIRIENS_3RD_SIGIL, CRYSTAL_OF_PURITY1)) { htmltext = "30071-07.html"; } break; } - case WAREHOUSE_KEEPER_VALKON: - { - if (hasQuestItems(player, TRIFFS_RING)) - { - if (!hasAtLeastOneQuestItem(player, VALKONS_REQUEST, CRYSTAL_OF_PURITY2, SCRIPTURE_CHAPTER_2)) - { + case WAREHOUSE_KEEPER_VALKON: { + if (hasQuestItems(player, TRIFFS_RING)) { + if (!hasAtLeastOneQuestItem(player, VALKONS_REQUEST, CRYSTAL_OF_PURITY2, SCRIPTURE_CHAPTER_2)) { htmltext = "30103-01.html"; - } - else if (hasQuestItems(player, VALKONS_REQUEST) && !hasAtLeastOneQuestItem(player, CRYSTAL_OF_PURITY2, SCRIPTURE_CHAPTER_2)) - { + } else if (hasQuestItems(player, VALKONS_REQUEST) && !hasAtLeastOneQuestItem(player, CRYSTAL_OF_PURITY2, SCRIPTURE_CHAPTER_2)) { htmltext = "30103-05.html"; - } - else if (hasQuestItems(player, CRYSTAL_OF_PURITY2) && !hasAtLeastOneQuestItem(player, VALKONS_REQUEST, SCRIPTURE_CHAPTER_2)) - { + } else if (hasQuestItems(player, CRYSTAL_OF_PURITY2) && !hasAtLeastOneQuestItem(player, VALKONS_REQUEST, SCRIPTURE_CHAPTER_2)) { giveItems(player, SCRIPTURE_CHAPTER_2, 1); takeItems(player, CRYSTAL_OF_PURITY2, 1); htmltext = "30103-06.html"; - } - else if (hasQuestItems(player, SCRIPTURE_CHAPTER_2) && !hasAtLeastOneQuestItem(player, VALKONS_REQUEST, CRYSTAL_OF_PURITY2)) - { + } else if (hasQuestItems(player, SCRIPTURE_CHAPTER_2) && !hasAtLeastOneQuestItem(player, VALKONS_REQUEST, CRYSTAL_OF_PURITY2)) { htmltext = "30103-07.html"; } } break; } - case MAGISTER_DIETER: - { - if (hasQuestItems(player, MIRIENS_3RD_SIGIL, CRONOS_SIGIL)) - { - if (hasQuestItems(player, CRONOS_LETTER)) - { + case MAGISTER_DIETER: { + if (hasQuestItems(player, MIRIENS_3RD_SIGIL, CRONOS_SIGIL)) { + if (hasQuestItems(player, CRONOS_LETTER)) { htmltext = "30111-01.html"; - } - else if (hasQuestItems(player, DIETERS_KEY)) - { + } else if (hasQuestItems(player, DIETERS_KEY)) { htmltext = "30111-06.html"; - } - else if (hasQuestItems(player, CRETAS_2ND_LETTER)) - { + } else if (hasQuestItems(player, CRETAS_2ND_LETTER)) { htmltext = "30111-07.html"; - } - else if (hasQuestItems(player, DIETERS_DIARY, DIETERS_LETTER)) - { + } else if (hasQuestItems(player, DIETERS_DIARY, DIETERS_LETTER)) { htmltext = "30111-10.html"; - } - else if (hasQuestItems(player, DIETERS_DIARY, RAUTS_LETTER_ENVELOPE)) - { + } else if (hasQuestItems(player, DIETERS_DIARY, RAUTS_LETTER_ENVELOPE)) { htmltext = "30111-11.html"; - } - else if (hasQuestItems(player, DIETERS_DIARY) && !hasAtLeastOneQuestItem(player, DIETERS_LETTER, RAUTS_LETTER_ENVELOPE)) - { - if (hasQuestItems(player, SCRIPTURE_CHAPTER_1, SCRIPTURE_CHAPTER_2, SCRIPTURE_CHAPTER_3, SCRIPTURE_CHAPTER_4)) - { + } else if (hasQuestItems(player, DIETERS_DIARY) && !hasAtLeastOneQuestItem(player, DIETERS_LETTER, RAUTS_LETTER_ENVELOPE)) { + if (hasQuestItems(player, SCRIPTURE_CHAPTER_1, SCRIPTURE_CHAPTER_2, SCRIPTURE_CHAPTER_3, SCRIPTURE_CHAPTER_4)) { htmltext = "30111-13.html"; - } - else - { + } else { htmltext = "30111-12.html"; } } - } - else if (hasQuestItems(player, SYMBOL_OF_CRONOS)) - { + } else if (hasQuestItems(player, SYMBOL_OF_CRONOS)) { htmltext = "30111-15.html"; } break; } - case GRAND_MAGISTER_JUREK: - { - if (hasQuestItems(player, MIRIENS_2ND_SIGIL)) - { - if (!hasAtLeastOneQuestItem(player, GRAND_MAGISTER_SIGIL, SYMBOL_OF_JUREK)) - { + case GRAND_MAGISTER_JUREK: { + if (hasQuestItems(player, MIRIENS_2ND_SIGIL)) { + if (!hasAtLeastOneQuestItem(player, GRAND_MAGISTER_SIGIL, SYMBOL_OF_JUREK)) { htmltext = "30115-01.html"; - } - else if (hasQuestItems(player, JUREKS_LIST)) - { - if ((getQuestItemsCount(player, MONSTER_EYE_DESTROYER_SKIN) + getQuestItemsCount(player, SHAMANS_NECKLACE) + getQuestItemsCount(player, SHACKLES_SCALP)) < 12) - { + } else if (hasQuestItems(player, JUREKS_LIST)) { + if ((getQuestItemsCount(player, MONSTER_EYE_DESTROYER_SKIN) + getQuestItemsCount(player, SHAMANS_NECKLACE) + getQuestItemsCount(player, SHACKLES_SCALP)) < 12) { htmltext = "30115-04.html"; - } - else - { + } else { takeItems(player, GRAND_MAGISTER_SIGIL, 1); takeItems(player, JUREKS_LIST, 1); takeItems(player, MONSTER_EYE_DESTROYER_SKIN, -1); @@ -805,151 +623,93 @@ public final class Q00214_TrialOfTheScholar extends Quest qs.setCond(18, true); htmltext = "30115-05.html"; } - } - else if (hasQuestItems(player, SYMBOL_OF_JUREK) && !hasQuestItems(player, GRAND_MAGISTER_SIGIL)) - { + } else if (hasQuestItems(player, SYMBOL_OF_JUREK) && !hasQuestItems(player, GRAND_MAGISTER_SIGIL)) { htmltext = "30115-06.html"; } - } - else if (hasAtLeastOneQuestItem(player, MIRIENS_1ST_SIGIL, MIRIENS_3RD_SIGIL)) - { + } else if (hasAtLeastOneQuestItem(player, MIRIENS_1ST_SIGIL, MIRIENS_3RD_SIGIL)) { htmltext = "30115-07.html"; } break; } - case TRADER_EDROC: - { - if (hasQuestItems(player, DIETERS_DIARY)) - { - if (hasQuestItems(player, DIETERS_LETTER)) - { + case TRADER_EDROC: { + if (hasQuestItems(player, DIETERS_DIARY)) { + if (hasQuestItems(player, DIETERS_LETTER)) { htmltext = "30230-01.html"; - } - else if (hasQuestItems(player, RAUTS_LETTER_ENVELOPE)) - { + } else if (hasQuestItems(player, RAUTS_LETTER_ENVELOPE)) { htmltext = "30230-03.html"; - } - else if (hasAtLeastOneQuestItem(player, STRONG_LIGUOR, TRIFFS_RING)) - { + } else if (hasAtLeastOneQuestItem(player, STRONG_LIGUOR, TRIFFS_RING)) { htmltext = "30230-04.html"; } } break; } - case WAREHOUSE_KEEPER_RAUT: - { - if (hasQuestItems(player, DIETERS_DIARY)) - { - if (hasQuestItems(player, RAUTS_LETTER_ENVELOPE)) - { + case WAREHOUSE_KEEPER_RAUT: { + if (hasQuestItems(player, DIETERS_DIARY)) { + if (hasQuestItems(player, RAUTS_LETTER_ENVELOPE)) { htmltext = "30316-01.html"; - } - else if (hasQuestItems(player, SCRIPTURE_CHAPTER_1, STRONG_LIGUOR)) - { + } else if (hasQuestItems(player, SCRIPTURE_CHAPTER_1, STRONG_LIGUOR)) { htmltext = "30316-04.html"; - } - else if (hasQuestItems(player, SCRIPTURE_CHAPTER_1, TRIFFS_RING)) - { + } else if (hasQuestItems(player, SCRIPTURE_CHAPTER_1, TRIFFS_RING)) { htmltext = "30316-05.html"; } } break; } - case BLACKSMITH_POITAN: - { - if (hasQuestItems(player, TRIFFS_RING)) - { - if (!hasAtLeastOneQuestItem(player, POITANS_NOTES, CASIANS_LIST, SCRIPTURE_CHAPTER_4)) - { + case BLACKSMITH_POITAN: { + if (hasQuestItems(player, TRIFFS_RING)) { + if (!hasAtLeastOneQuestItem(player, POITANS_NOTES, CASIANS_LIST, SCRIPTURE_CHAPTER_4)) { giveItems(player, POITANS_NOTES, 1); htmltext = "30458-01.html"; - } - else if (hasQuestItems(player, POITANS_NOTES) && !hasAtLeastOneQuestItem(player, CASIANS_LIST, SCRIPTURE_CHAPTER_4)) - { + } else if (hasQuestItems(player, POITANS_NOTES) && !hasAtLeastOneQuestItem(player, CASIANS_LIST, SCRIPTURE_CHAPTER_4)) { htmltext = "30458-02.html"; - } - else if (hasQuestItems(player, POITANS_NOTES, CASIANS_LIST) && !hasQuestItems(player, SCRIPTURE_CHAPTER_4)) - { + } else if (hasQuestItems(player, POITANS_NOTES, CASIANS_LIST) && !hasQuestItems(player, SCRIPTURE_CHAPTER_4)) { htmltext = "30458-03.html"; - } - else if (hasQuestItems(player, SCRIPTURE_CHAPTER_4) && !hasAtLeastOneQuestItem(player, POITANS_NOTES, CASIANS_LIST)) - { + } else if (hasQuestItems(player, SCRIPTURE_CHAPTER_4) && !hasAtLeastOneQuestItem(player, POITANS_NOTES, CASIANS_LIST)) { htmltext = "30458-04.html"; } } break; } - case MARIA: - { - if (hasQuestItems(player, MIRIENS_1ST_SIGIL, HIGH_PRIESTS_SIGIL)) - { - if (hasQuestItems(player, SYLVAINS_LETTER)) - { + case MARIA: { + if (hasQuestItems(player, MIRIENS_1ST_SIGIL, HIGH_PRIESTS_SIGIL)) { + if (hasQuestItems(player, SYLVAINS_LETTER)) { htmltext = "30608-01.html"; - } - else if (hasQuestItems(player, MARIAS_1ST_LETTER)) - { + } else if (hasQuestItems(player, MARIAS_1ST_LETTER)) { htmltext = "30608-03.html"; - } - else if (hasQuestItems(player, LUCASS_LETTER)) - { + } else if (hasQuestItems(player, LUCASS_LETTER)) { giveItems(player, MARIAS_2ND_LETTER, 1); takeItems(player, LUCASS_LETTER, 1); qs.setCond(5, true); htmltext = "30608-04.html"; - } - else if (hasQuestItems(player, MARIAS_2ND_LETTER)) - { + } else if (hasQuestItems(player, MARIAS_2ND_LETTER)) { htmltext = "30608-05.html"; - } - else if (hasQuestItems(player, CRETAS_1ST_LETTER)) - { + } else if (hasQuestItems(player, CRETAS_1ST_LETTER)) { htmltext = "30608-06.html"; - } - else if (hasQuestItems(player, LUCILLAS_HANDBAG)) - { + } else if (hasQuestItems(player, LUCILLAS_HANDBAG)) { htmltext = "30608-09.html"; - } - else if (hasQuestItems(player, CRERAS_PAINTING1)) - { + } else if (hasQuestItems(player, CRERAS_PAINTING1)) { takeItems(player, CRERAS_PAINTING1, 1); giveItems(player, CRERAS_PAINTING2, 1); qs.setCond(9, true); htmltext = "30608-10.html"; - } - else if (hasQuestItems(player, CRERAS_PAINTING2)) - { + } else if (hasQuestItems(player, CRERAS_PAINTING2)) { htmltext = "30608-11.html"; - } - else if (hasQuestItems(player, CRERAS_PAINTING3)) - { - if (getQuestItemsCount(player, BROWN_SCROLL_SCRAP) < 5) - { + } else if (hasQuestItems(player, CRERAS_PAINTING3)) { + if (getQuestItemsCount(player, BROWN_SCROLL_SCRAP) < 5) { qs.setCond(11, true); htmltext = "30608-12.html"; - } - else - { + } else { htmltext = "30608-13.html"; } - } - else if (hasQuestItems(player, CRYSTAL_OF_PURITY1)) - { + } else if (hasQuestItems(player, CRYSTAL_OF_PURITY1)) { htmltext = "30608-15.html"; } - } - else if (hasAtLeastOneQuestItem(player, SYMBOL_OF_SYLVAIN, MIRIENS_2ND_SIGIL)) - { + } else if (hasAtLeastOneQuestItem(player, SYMBOL_OF_SYLVAIN, MIRIENS_2ND_SIGIL)) { htmltext = "30608-16.html"; - } - else if (hasQuestItems(player, MIRIENS_3RD_SIGIL)) - { - if (!hasQuestItems(player, VALKONS_REQUEST)) - { + } else if (hasQuestItems(player, MIRIENS_3RD_SIGIL)) { + if (!hasQuestItems(player, VALKONS_REQUEST)) { htmltext = "30608-17.html"; - } - else - { + } else { takeItems(player, VALKONS_REQUEST, 1); giveItems(player, CRYSTAL_OF_PURITY2, 1); htmltext = "30608-18.html"; @@ -957,121 +717,75 @@ public final class Q00214_TrialOfTheScholar extends Quest } break; } - case ASTROLOGER_CRETA: - { - if (hasQuestItems(player, MIRIENS_1ST_SIGIL, HIGH_PRIESTS_SIGIL)) - { - if (hasQuestItems(player, MARIAS_2ND_LETTER)) - { + case ASTROLOGER_CRETA: { + if (hasQuestItems(player, MIRIENS_1ST_SIGIL, HIGH_PRIESTS_SIGIL)) { + if (hasQuestItems(player, MARIAS_2ND_LETTER)) { htmltext = "30609-01.html"; - } - else if (hasQuestItems(player, CRETAS_1ST_LETTER)) - { + } else if (hasQuestItems(player, CRETAS_1ST_LETTER)) { htmltext = "30609-06.html"; - } - else if (hasQuestItems(player, LUCILLAS_HANDBAG)) - { + } else if (hasQuestItems(player, LUCILLAS_HANDBAG)) { htmltext = "30609-07.html"; - } - else if (hasAtLeastOneQuestItem(player, CRERAS_PAINTING1, CRERAS_PAINTING2, CRERAS_PAINTING3)) - { + } else if (hasAtLeastOneQuestItem(player, CRERAS_PAINTING1, CRERAS_PAINTING2, CRERAS_PAINTING3)) { htmltext = "30609-10.html"; } - } - else if (hasAtLeastOneQuestItem(player, CRYSTAL_OF_PURITY1, SYMBOL_OF_SYLVAIN, MIRIENS_2ND_SIGIL)) - { + } else if (hasAtLeastOneQuestItem(player, CRYSTAL_OF_PURITY1, SYMBOL_OF_SYLVAIN, MIRIENS_2ND_SIGIL)) { htmltext = "30609-11.html"; - } - else if (hasQuestItems(player, MIRIENS_3RD_SIGIL)) - { - if (hasQuestItems(player, DIETERS_KEY)) - { + } else if (hasQuestItems(player, MIRIENS_3RD_SIGIL)) { + if (hasQuestItems(player, DIETERS_KEY)) { htmltext = "30609-12.html"; - } - else - { + } else { htmltext = "30609-15.html"; } } break; } - case ELDER_CRONOS: - { - if (hasQuestItems(player, MIRIENS_3RD_SIGIL)) - { - if (!hasAtLeastOneQuestItem(player, CRONOS_SIGIL, SYMBOL_OF_CRONOS)) - { + case ELDER_CRONOS: { + if (hasQuestItems(player, MIRIENS_3RD_SIGIL)) { + if (!hasAtLeastOneQuestItem(player, CRONOS_SIGIL, SYMBOL_OF_CRONOS)) { htmltext = "30610-01.html"; - } - else if (hasQuestItems(player, CRONOS_SIGIL)) - { - if (hasQuestItems(player, SCRIPTURE_CHAPTER_1, SCRIPTURE_CHAPTER_2, SCRIPTURE_CHAPTER_3, SCRIPTURE_CHAPTER_4)) - { + } else if (hasQuestItems(player, CRONOS_SIGIL)) { + if (hasQuestItems(player, SCRIPTURE_CHAPTER_1, SCRIPTURE_CHAPTER_2, SCRIPTURE_CHAPTER_3, SCRIPTURE_CHAPTER_4)) { htmltext = "30610-12.html"; - } - else - { + } else { htmltext = "30610-11.html"; } - } - else if (hasQuestItems(player, SYMBOL_OF_CRONOS) && !hasQuestItems(player, CRONOS_SIGIL)) - { + } else if (hasQuestItems(player, SYMBOL_OF_CRONOS) && !hasQuestItems(player, CRONOS_SIGIL)) { htmltext = "30610-15.html"; } } break; } - case DRUNKARD_TRIFF: - { - if (hasQuestItems(player, DIETERS_DIARY, SCRIPTURE_CHAPTER_1, STRONG_LIGUOR)) - { + case DRUNKARD_TRIFF: { + if (hasQuestItems(player, DIETERS_DIARY, SCRIPTURE_CHAPTER_1, STRONG_LIGUOR)) { htmltext = "30611-01.html"; - } - else if (hasAtLeastOneQuestItem(player, TRIFFS_RING, SYMBOL_OF_CRONOS)) - { + } else if (hasAtLeastOneQuestItem(player, TRIFFS_RING, SYMBOL_OF_CRONOS)) { htmltext = "30611-05.html"; } break; } - case ELDER_CASIAN: - { - if (hasQuestItems(player, TRIFFS_RING, POITANS_NOTES)) - { - if (!hasQuestItems(player, CASIANS_LIST)) - { - if (hasQuestItems(player, SCRIPTURE_CHAPTER_1, SCRIPTURE_CHAPTER_2, SCRIPTURE_CHAPTER_3)) - { + case ELDER_CASIAN: { + if (hasQuestItems(player, TRIFFS_RING, POITANS_NOTES)) { + if (!hasQuestItems(player, CASIANS_LIST)) { + if (hasQuestItems(player, SCRIPTURE_CHAPTER_1, SCRIPTURE_CHAPTER_2, SCRIPTURE_CHAPTER_3)) { htmltext = "30612-02.html"; - } - else - { + } else { htmltext = "30612-01.html"; } - } - else - { - if ((getQuestItemsCount(player, GHOULS_SKIN) + getQuestItemsCount(player, MEDUSAS_BLOOD) + getQuestItemsCount(player, FETTERED_SOULS_ICHOR) + getQuestItemsCount(player, ENCHANTED_GARGOYLES_NAIL)) < 32) - { + } else { + if ((getQuestItemsCount(player, GHOULS_SKIN) + getQuestItemsCount(player, MEDUSAS_BLOOD) + getQuestItemsCount(player, FETTERED_SOULS_ICHOR) + getQuestItemsCount(player, ENCHANTED_GARGOYLES_NAIL)) < 32) { htmltext = "30612-05.html"; - } - else - { + } else { htmltext = "30612-06.html"; } } - } - else if (hasQuestItems(player, TRIFFS_RING, SCRIPTURE_CHAPTER_1, SCRIPTURE_CHAPTER_2, SCRIPTURE_CHAPTER_3, SCRIPTURE_CHAPTER_4) && !hasAtLeastOneQuestItem(player, POITANS_NOTES, CASIANS_LIST)) - { + } else if (hasQuestItems(player, TRIFFS_RING, SCRIPTURE_CHAPTER_1, SCRIPTURE_CHAPTER_2, SCRIPTURE_CHAPTER_3, SCRIPTURE_CHAPTER_4) && !hasAtLeastOneQuestItem(player, POITANS_NOTES, CASIANS_LIST)) { htmltext = "30612-08.html"; } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == MAGISTER_MIRIEN) - { + } else if (qs.isCompleted()) { + if (npc.getId() == MAGISTER_MIRIEN) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00215_TrialOfThePilgrim/Q00215_TrialOfThePilgrim.java b/src/main/java/com/l2jserver/datapack/quests/Q00215_TrialOfThePilgrim/Q00215_TrialOfThePilgrim.java index f2ad49dbdc..1ffeacca4f 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00215_TrialOfThePilgrim/Q00215_TrialOfThePilgrim.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00215_TrialOfThePilgrim/Q00215_TrialOfThePilgrim.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Trial Of The Pilgrim (215) * @author ivantotov */ -public final class Q00215_TrialOfThePilgrim extends Quest -{ +public final class Q00215_TrialOfThePilgrim extends Quest { // NPCs private static final int PRIEST_PETRON = 30036; private static final int PRIEST_PRIMOS = 30117; @@ -69,8 +68,7 @@ public final class Q00215_TrialOfThePilgrim extends Quest // Misc private static final int MIN_LVL = 35; - public Q00215_TrialOfThePilgrim() - { + public Q00215_TrialOfThePilgrim() { super(215, Q00215_TrialOfThePilgrim.class.getSimpleName(), "Trial Of The Pilgrim"); addStartNpc(HERMIT_SANTIAGO); addTalkId(HERMIT_SANTIAGO, PRIEST_PETRON, PRIEST_PRIMOS, ANDELLIA, GAURI_TWINKLEROCK, SEER_TANAPI, ELDER_CASIAN, ANCESTOR_MARTANKUS, PRIEST_OF_THE_EARTH_GERALD, WANDERER_DORF, URUHA); @@ -79,33 +77,25 @@ public final class Q00215_TrialOfThePilgrim extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (qs.isCreated()) - { + switch (event) { + case "ACCEPT": { + if (qs.isCreated()) { qs.startQuest(); qs.setMemoState(1); giveItems(player, VOUCHER_OF_TRIAL, 1); playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); - if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) - { + if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) { giveItems(player, DIMENSIONAL_DIAMOND, 49); player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1); htmltext = "30648-04a.htm"; - } - else - { + } else { htmltext = "30648-04.htm"; } } @@ -114,15 +104,12 @@ public final class Q00215_TrialOfThePilgrim extends Quest case "30648-05.html": case "30648-06.html": case "30648-07.html": - case "30648-08.html": - { + case "30648-08.html": { htmltext = event; break; } - case "30362-05.html": - { - if (qs.isMemoState(15) && hasQuestItems(player, BOOK_OF_DARKNESS)) - { + case "30362-05.html": { + if (qs.isMemoState(15) && hasQuestItems(player, BOOK_OF_DARKNESS)) { takeItems(player, BOOK_OF_DARKNESS, 1); qs.setMemoState(16); qs.setCond(16, true); @@ -130,20 +117,16 @@ public final class Q00215_TrialOfThePilgrim extends Quest } break; } - case "30362-04.html": - { - if (qs.isMemoState(15) && hasQuestItems(player, BOOK_OF_DARKNESS)) - { + case "30362-04.html": { + if (qs.isMemoState(15) && hasQuestItems(player, BOOK_OF_DARKNESS)) { qs.setMemoState(16); qs.setCond(16, true); htmltext = event; } break; } - case "30649-04.html": - { - if (qs.isMemoState(4) && hasQuestItems(player, ESSENSE_OF_FLAME)) - { + case "30649-04.html": { + if (qs.isMemoState(4) && hasQuestItems(player, ESSENSE_OF_FLAME)) { giveItems(player, SPIRIT_OF_FLAME, 1); takeItems(player, ESSENSE_OF_FLAME, 1); qs.setMemoState(5); @@ -152,36 +135,27 @@ public final class Q00215_TrialOfThePilgrim extends Quest } break; } - case "30650-02.html": - { - if (qs.isMemoState(6) && hasQuestItems(player, TAG_OF_RUMOR)) - { - if (getQuestItemsCount(player, ADENA) >= 100000) - { + case "30650-02.html": { + if (qs.isMemoState(6) && hasQuestItems(player, TAG_OF_RUMOR)) { + if (getQuestItemsCount(player, ADENA) >= 100000) { giveItems(player, BOOK_OF_GERALD, 1); takeItems(player, ADENA, 100000); qs.setMemoState(7); htmltext = event; - } - else - { + } else { htmltext = "30650-03.html"; } } break; } - case "30650-03.html": - { - if (qs.isMemoState(6) && hasQuestItems(player, TAG_OF_RUMOR)) - { + case "30650-03.html": { + if (qs.isMemoState(6) && hasQuestItems(player, TAG_OF_RUMOR)) { htmltext = event; } break; } - case "30652-02.html": - { - if (qs.isMemoState(14) && hasQuestItems(player, DEBRIS_OF_WILLOW)) - { + case "30652-02.html": { + if (qs.isMemoState(14) && hasQuestItems(player, DEBRIS_OF_WILLOW)) { giveItems(player, BOOK_OF_DARKNESS, 1); takeItems(player, DEBRIS_OF_WILLOW, 1); qs.setMemoState(15); @@ -195,37 +169,28 @@ public final class Q00215_TrialOfThePilgrim extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case LAVA_SALAMANDER: - { - if (qs.isMemoState(3) && !hasQuestItems(killer, ESSENSE_OF_FLAME)) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case LAVA_SALAMANDER: { + if (qs.isMemoState(3) && !hasQuestItems(killer, ESSENSE_OF_FLAME)) { qs.setMemoState(4); qs.setCond(4, true); giveItems(killer, ESSENSE_OF_FLAME, 1); } break; } - case NAHIR: - { - if (qs.isMemoState(10) && !hasQuestItems(killer, HAIR_OF_NAHIR)) - { + case NAHIR: { + if (qs.isMemoState(10) && !hasQuestItems(killer, HAIR_OF_NAHIR)) { qs.setMemoState(11); qs.setCond(11, true); giveItems(killer, HAIR_OF_NAHIR, 1); } break; } - case BLACK_WILLOW: - { - if (qs.isMemoState(13) && !hasQuestItems(killer, DEBRIS_OF_WILLOW)) - { + case BLACK_WILLOW: { + if (qs.isMemoState(13) && !hasQuestItems(killer, DEBRIS_OF_WILLOW)) { qs.setMemoState(14); qs.setCond(14, true); giveItems(killer, DEBRIS_OF_WILLOW, 1); @@ -238,43 +203,27 @@ public final class Q00215_TrialOfThePilgrim extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); final int memoState = qs.getMemoState(); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == HERMIT_SANTIAGO) - { - if (!player.isInCategory(CategoryType.HEAL_GROUP)) - { + if (qs.isCreated()) { + if (npc.getId() == HERMIT_SANTIAGO) { + if (!player.isInCategory(CategoryType.HEAL_GROUP)) { htmltext = "30648-02.html"; - } - else if (player.getLevel() < MIN_LVL) - { + } else if (player.getLevel() < MIN_LVL) { htmltext = "30648-01.html"; - } - else - { + } else { htmltext = "30648-03.htm"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case HERMIT_SANTIAGO: - { - if (memoState >= 1) - { - if (!hasQuestItems(player, BOOK_OF_SAGE)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case HERMIT_SANTIAGO: { + if (memoState >= 1) { + if (!hasQuestItems(player, BOOK_OF_SAGE)) { htmltext = "30648-09.html"; - } - else - { + } else { giveAdena(player, 229298, true); giveItems(player, MARK_OF_PILGRIM, 1); addExpAndSp(player, 1258250, 81606); @@ -285,256 +234,179 @@ public final class Q00215_TrialOfThePilgrim extends Quest } break; } - case PRIEST_PETRON: - { - if (memoState == 9) - { + case PRIEST_PETRON: { + if (memoState == 9) { giveItems(player, PICTURE_OF_NAHIR, 1); qs.setMemoState(10); qs.setCond(10, true); htmltext = "30036-01.html"; - } - else if (memoState == 10) - { + } else if (memoState == 10) { htmltext = "30036-02.html"; - } - else if (memoState == 11) - { + } else if (memoState == 11) { takeItems(player, PICTURE_OF_NAHIR, 1); takeItems(player, HAIR_OF_NAHIR, 1); giveItems(player, STATUE_OF_EINHASAD, 1); qs.setMemoState(12); qs.setCond(12, true); htmltext = "30036-03.html"; - } - else if (memoState == 12) - { - if (hasQuestItems(player, STATUE_OF_EINHASAD)) - { + } else if (memoState == 12) { + if (hasQuestItems(player, STATUE_OF_EINHASAD)) { htmltext = "30036-04.html"; } } break; } - case PRIEST_PRIMOS: - { - if (memoState == 8) - { + case PRIEST_PRIMOS: { + if (memoState == 8) { qs.setMemoState(9); qs.setCond(9, true); htmltext = "30117-01.html"; - } - else if (memoState == 9) - { + } else if (memoState == 9) { qs.setMemoState(9); qs.setCond(9, true); htmltext = "30117-02.html"; } break; } - case ANDELLIA: - { - if (memoState == 12) - { - if (player.getLevel() >= 0) - { + case ANDELLIA: { + if (memoState == 12) { + if (player.getLevel() >= 0) { qs.setMemoState(13); qs.setCond(13, true); htmltext = "30362-01.html"; - } - else - { + } else { htmltext = "30362-01a.html"; } - } - else if (memoState == 13) - { + } else if (memoState == 13) { htmltext = "30362-02.html"; - } - else if (memoState == 14) - { + } else if (memoState == 14) { htmltext = "30362-02a.html"; - } - else if (memoState == 15) - { - if (hasQuestItems(player, BOOK_OF_DARKNESS)) - { + } else if (memoState == 15) { + if (hasQuestItems(player, BOOK_OF_DARKNESS)) { htmltext = "30362-03.html"; - } - else - { + } else { htmltext = "30362-07.html"; } - } - else if (memoState == 16) - { + } else if (memoState == 16) { htmltext = "30362-06.html"; } break; } - case GAURI_TWINKLEROCK: - { - if (memoState == 5) - { - if (hasQuestItems(player, SPIRIT_OF_FLAME)) - { + case GAURI_TWINKLEROCK: { + if (memoState == 5) { + if (hasQuestItems(player, SPIRIT_OF_FLAME)) { takeItems(player, SPIRIT_OF_FLAME, 1); giveItems(player, TAG_OF_RUMOR, 1); qs.setMemoState(6); qs.setCond(7, true); htmltext = "30550-01.html"; } - } - else if (memoState == 6) - { + } else if (memoState == 6) { htmltext = "30550-02.html"; } break; } - case SEER_TANAPI: - { - if (memoState == 1) - { - if (hasQuestItems(player, VOUCHER_OF_TRIAL)) - { + case SEER_TANAPI: { + if (memoState == 1) { + if (hasQuestItems(player, VOUCHER_OF_TRIAL)) { takeItems(player, VOUCHER_OF_TRIAL, 1); qs.setMemoState(2); qs.setCond(2, true); htmltext = "30571-01.html"; } - } - else if (memoState == 2) - { + } else if (memoState == 2) { htmltext = "30571-02.html"; - } - else if (memoState == 5) - { - if (hasQuestItems(player, SPIRIT_OF_FLAME)) - { + } else if (memoState == 5) { + if (hasQuestItems(player, SPIRIT_OF_FLAME)) { qs.setCond(6, true); htmltext = "30571-03.html"; } } break; } - case ELDER_CASIAN: - { - if (memoState == 16) - { + case ELDER_CASIAN: { + if (memoState == 16) { qs.setMemoState(17); - if (!hasQuestItems(player, BOOK_OF_SAGE)) - { + if (!hasQuestItems(player, BOOK_OF_SAGE)) { giveItems(player, BOOK_OF_SAGE, 1); } takeItems(player, GREY_BADGE, 1); takeItems(player, SPIRIT_OF_FLAME, 1); takeItems(player, STATUE_OF_EINHASAD, 1); - if (hasQuestItems(player, BOOK_OF_DARKNESS)) - { + if (hasQuestItems(player, BOOK_OF_DARKNESS)) { addExpAndSp(player, 5000, 500); takeItems(player, BOOK_OF_DARKNESS, 1); } htmltext = "30612-01.html"; - } - else if (memoState == 17) - { + } else if (memoState == 17) { qs.setCond(17, true); htmltext = "30612-02.html"; } break; } - case ANCESTOR_MARTANKUS: - { - if (memoState == 2) - { + case ANCESTOR_MARTANKUS: { + if (memoState == 2) { qs.setMemoState(3); qs.setCond(3, true); htmltext = "30649-01.html"; - } - else if (memoState == 3) - { + } else if (memoState == 3) { htmltext = "30649-02.html"; - } - else if (memoState == 4) - { - if (hasQuestItems(player, ESSENSE_OF_FLAME)) - { + } else if (memoState == 4) { + if (hasQuestItems(player, ESSENSE_OF_FLAME)) { htmltext = "30649-03.html"; } } break; } - case PRIEST_OF_THE_EARTH_GERALD: - { - if (memoState == 6) - { - if (hasQuestItems(player, TAG_OF_RUMOR)) - { + case PRIEST_OF_THE_EARTH_GERALD: { + if (memoState == 6) { + if (hasQuestItems(player, TAG_OF_RUMOR)) { htmltext = "30650-01.html"; } - } - else if (hasQuestItems(player, GREY_BADGE, BOOK_OF_GERALD)) - { + } else if (hasQuestItems(player, GREY_BADGE, BOOK_OF_GERALD)) { giveAdena(player, 100000, true); takeItems(player, BOOK_OF_GERALD, 1); htmltext = "30650-04.html"; } break; } - case WANDERER_DORF: - { - if (memoState == 6) - { - if (hasQuestItems(player, TAG_OF_RUMOR)) - { + case WANDERER_DORF: { + if (memoState == 6) { + if (hasQuestItems(player, TAG_OF_RUMOR)) { giveItems(player, GREY_BADGE, 1); takeItems(player, TAG_OF_RUMOR, 1); qs.setMemoState(8); htmltext = "30651-01.html"; } - } - else if (memoState == 7) - { - if (hasQuestItems(player, TAG_OF_RUMOR)) - { + } else if (memoState == 7) { + if (hasQuestItems(player, TAG_OF_RUMOR)) { giveItems(player, GREY_BADGE, 1); takeItems(player, TAG_OF_RUMOR, 1); qs.setMemoState(8); htmltext = "30651-02.html"; } - } - else if (memoState == 8) - { + } else if (memoState == 8) { qs.setCond(8, true); htmltext = "30651-03.html"; } break; } - case URUHA: - { - if (memoState == 14) - { - if (hasQuestItems(player, DEBRIS_OF_WILLOW)) - { + case URUHA: { + if (memoState == 14) { + if (hasQuestItems(player, DEBRIS_OF_WILLOW)) { htmltext = "30652-01.html"; } - } - else if (memoState == 15) - { - if (hasQuestItems(player, BOOK_OF_DARKNESS)) - { + } else if (memoState == 15) { + if (hasQuestItems(player, BOOK_OF_DARKNESS)) { htmltext = "30652-03.html"; } } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == HERMIT_SANTIAGO) - { + } else if (qs.isCompleted()) { + if (npc.getId() == HERMIT_SANTIAGO) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00216_TrialOfTheGuildsman/Q00216_TrialOfTheGuildsman.java b/src/main/java/com/l2jserver/datapack/quests/Q00216_TrialOfTheGuildsman/Q00216_TrialOfTheGuildsman.java index 1ff222452b..d450e81418 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00216_TrialOfTheGuildsman/Q00216_TrialOfTheGuildsman.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00216_TrialOfTheGuildsman/Q00216_TrialOfTheGuildsman.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.util.Util; * Trial Of The Guildsman (216) * @author ivantotov */ -public final class Q00216_TrialOfTheGuildsman extends Quest -{ +public final class Q00216_TrialOfTheGuildsman extends Quest { private static final int WAREHOUSE_KEEPER_VALKON = 30103; private static final int WAREHOUSE_KEEPER_NORMAN = 30210; private static final int BLACKSMITH_ALTRAN = 30283; @@ -86,8 +85,7 @@ public final class Q00216_TrialOfTheGuildsman extends Quest // Misc private static final int MIN_LVL = 35; - public Q00216_TrialOfTheGuildsman() - { + public Q00216_TrialOfTheGuildsman() { super(216, Q00216_TrialOfTheGuildsman.class.getSimpleName(), "Trial Of The Guildsman"); addStartNpc(WAREHOUSE_KEEPER_VALKON); addTalkId(WAREHOUSE_KEEPER_VALKON, WAREHOUSE_KEEPER_NORMAN, BLACKSMITH_ALTRAN, BLACKSMITH_PINTER, BLACKSMITH_DUNING); @@ -96,41 +94,30 @@ public final class Q00216_TrialOfTheGuildsman extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (getQuestItemsCount(player, Inventory.ADENA_ID) >= 2000) - { + switch (event) { + case "ACCEPT": { + if (getQuestItemsCount(player, Inventory.ADENA_ID) >= 2000) { qs.startQuest(); takeItems(player, Inventory.ADENA_ID, 2000); - if (!hasQuestItems(player, VALKONS_RECOMMENDATION)) - { + if (!hasQuestItems(player, VALKONS_RECOMMENDATION)) { giveItems(player, VALKONS_RECOMMENDATION, 1); } playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); - if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) - { + if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) { giveItems(player, DIMENSIONAL_DIAMOND, 85); player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1); htmltext = "30103-06d.htm"; - } - else - { + } else { htmltext = "30103-06.htm"; } - } - else - { + } else { htmltext = "30103-05b.htm"; } break; @@ -153,15 +140,12 @@ public final class Q00216_TrialOfTheGuildsman extends Quest case "30283-03b.html": case "30283-04.html": case "30298-03.html": - case "30298-05a.html": - { + case "30298-05a.html": { htmltext = event; break; } - case "30103-09a.html": - { - if (hasQuestItems(player, ALLTRANS_INSTRUCTIONS) && (getQuestItemsCount(player, JOURNEYMAN_RING) >= 7)) - { + case "30103-09a.html": { + if (hasQuestItems(player, ALLTRANS_INSTRUCTIONS) && (getQuestItemsCount(player, JOURNEYMAN_RING) >= 7)) { giveAdena(player, 187606, true); giveItems(player, MARK_OF_GUILDSMAN, 1); addExpAndSp(player, 1029478, 66768); @@ -171,10 +155,8 @@ public final class Q00216_TrialOfTheGuildsman extends Quest } break; } - case "30103-09b.html": - { - if (hasQuestItems(player, ALLTRANS_INSTRUCTIONS) && (getQuestItemsCount(player, JOURNEYMAN_RING) >= 7)) - { + case "30103-09b.html": { + if (hasQuestItems(player, ALLTRANS_INSTRUCTIONS) && (getQuestItemsCount(player, JOURNEYMAN_RING) >= 7)) { giveAdena(player, 93803, true); giveItems(player, MARK_OF_GUILDSMAN, 1); addExpAndSp(player, 514739, 33384); @@ -184,10 +166,8 @@ public final class Q00216_TrialOfTheGuildsman extends Quest } break; } - case "30210-04.html": - { - if (hasQuestItems(player, ALLTRANS_1ST_RECOMMENDATION)) - { + case "30210-04.html": { + if (hasQuestItems(player, ALLTRANS_1ST_RECOMMENDATION)) { takeItems(player, ALLTRANS_1ST_RECOMMENDATION, 1); giveItems(player, NORMANS_INSTRUCTIONS, 1); giveItems(player, NORMANS_RECEIPT, 1); @@ -195,10 +175,8 @@ public final class Q00216_TrialOfTheGuildsman extends Quest } break; } - case "30210-10.html": - { - if (hasQuestItems(player, NORMANS_INSTRUCTIONS)) - { + case "30210-10.html": { + if (hasQuestItems(player, NORMANS_INSTRUCTIONS)) { takeItems(player, NORMANS_INSTRUCTIONS, 1); takeItems(player, DUNINGS_KEY, -1); giveItems(player, NORMANS_LIST, 1); @@ -206,10 +184,8 @@ public final class Q00216_TrialOfTheGuildsman extends Quest } break; } - case "30283-03.html": - { - if (hasQuestItems(player, VALKONS_RECOMMENDATION, MANDRAGORA_BERRY)) - { + case "30283-03.html": { + if (hasQuestItems(player, VALKONS_RECOMMENDATION, MANDRAGORA_BERRY)) { giveItems(player, RECIPE_JOURNEYMAN_RING, 1); takeItems(player, VALKONS_RECOMMENDATION, 1); takeItems(player, MANDRAGORA_BERRY, 1); @@ -221,19 +197,14 @@ public final class Q00216_TrialOfTheGuildsman extends Quest } break; } - case "30298-04.html": - { - if (player.getClassId() == ClassId.scavenger) - { - if (hasQuestItems(player, ALLTRANS_2ND_RECOMMENDATION)) - { + case "30298-04.html": { + if (player.getClassId() == ClassId.scavenger) { + if (hasQuestItems(player, ALLTRANS_2ND_RECOMMENDATION)) { takeItems(player, ALLTRANS_2ND_RECOMMENDATION, 1); giveItems(player, PINTERS_INSTRUCTIONS, 1); htmltext = event; } - } - else if (hasQuestItems(player, ALLTRANS_2ND_RECOMMENDATION)) - { + } else if (hasQuestItems(player, ALLTRANS_2ND_RECOMMENDATION)) { giveItems(player, RECIPE_AMBER_BEAD, 1); takeItems(player, ALLTRANS_2ND_RECOMMENDATION, 1); giveItems(player, PINTERS_INSTRUCTIONS, 1); @@ -241,10 +212,8 @@ public final class Q00216_TrialOfTheGuildsman extends Quest } break; } - case "30688-02.html": - { - if (hasQuestItems(player, NORMANS_RECEIPT)) - { + case "30688-02.html": { + if (hasQuestItems(player, NORMANS_RECEIPT)) { takeItems(player, NORMANS_RECEIPT, 1); giveItems(player, DUNINGS_INSTRUCTIONS, 1); htmltext = event; @@ -256,53 +225,40 @@ public final class Q00216_TrialOfTheGuildsman extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - switch (npc.getId()) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + switch (npc.getId()) { case ANT: case ANT_CAPTAIN: - case ANT_OVERSEER: - { + case ANT_OVERSEER: { final QuestState qs = getRandomPartyMemberState(killer, -1, 2, npc); - if (qs != null) - { + if (qs != null) { int count = 0; - if ((qs.getPlayer().getClassId() == ClassId.scavenger) && npc.isSweepActive()) - { + if ((qs.getPlayer().getClassId() == ClassId.scavenger) && npc.isSweepActive()) { count += 5; } - if (getRandomBoolean() && (qs.getPlayer().getClassId() == ClassId.artisan)) - { + if (getRandomBoolean() && (qs.getPlayer().getClassId() == ClassId.artisan)) { giveItems(qs.getPlayer(), AMBER_LUMP, 1); playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_MIDDLE); } - if ((getQuestItemsCount(qs.getPlayer(), AMBER_BEAD) + count) < 70) - { + if ((getQuestItemsCount(qs.getPlayer(), AMBER_BEAD) + count) < 70) { count += 5; } - if (count > 0) - { + if (count > 0) { giveItemRandomly(qs.getPlayer(), npc, AMBER_BEAD, count, 70, 1.0, true); } } break; } - case GRANITE_GOLEM: - { + case GRANITE_GOLEM: { final QuestState qs = getRandomPartyMemberState(killer, -1, 2, npc); - if (qs != null) - { + if (qs != null) { giveItems(qs.getPlayer(), GRANITE_WHETSTONE, 7); - if (getQuestItemsCount(qs.getPlayer(), GRANITE_WHETSTONE) == 70) - { + if (getQuestItemsCount(qs.getPlayer(), GRANITE_WHETSTONE) == 70) { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -311,66 +267,48 @@ public final class Q00216_TrialOfTheGuildsman extends Quest case MANDRAGORA_SPROUT1: case MANDRAGORA_SAPLONG: case MANDRAGORA_BLOSSOM: - case MANDRAGORA_SPROUT2: - { + case MANDRAGORA_SPROUT2: { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - if (hasQuestItems(killer, VALKONS_RECOMMENDATION) && !hasQuestItems(killer, MANDRAGORA_BERRY)) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + if (hasQuestItems(killer, VALKONS_RECOMMENDATION) && !hasQuestItems(killer, MANDRAGORA_BERRY)) { giveItems(killer, MANDRAGORA_BERRY, 1); qs.setCond(4, true); } } break; } - case SILENOS: - { + case SILENOS: { final QuestState qs = getRandomPartyMemberState(killer, -1, 2, npc); - if (qs != null) - { + if (qs != null) { giveItems(qs.getPlayer(), BRAIDED_YARN, 10); - if (getQuestItemsCount(qs.getPlayer(), BRAIDED_YARN) == 70) - { + if (getQuestItemsCount(qs.getPlayer(), BRAIDED_YARN) == 70) { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } case STRAIN: - case GHOUL: - { + case GHOUL: { final QuestState qs = getRandomPartyMemberState(killer, -1, 2, npc); - if (qs != null) - { + if (qs != null) { giveItems(qs.getPlayer(), GRAY_BONE_POWDER, 5); - if (getQuestItemsCount(qs.getPlayer(), GRAY_BONE_POWDER) == 70) - { + if (getQuestItemsCount(qs.getPlayer(), GRAY_BONE_POWDER) == 70) { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case DEAD_SEEKER: - { + case DEAD_SEEKER: { final QuestState qs = getRandomPartyMemberState(killer, -1, 2, npc); - if (qs != null) - { + if (qs != null) { giveItems(qs.getPlayer(), RED_PIGMENT, 7); - if (getQuestItemsCount(qs.getPlayer(), RED_PIGMENT) == 70) - { + if (getQuestItemsCount(qs.getPlayer(), RED_PIGMENT) == 70) { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -380,19 +318,14 @@ public final class Q00216_TrialOfTheGuildsman extends Quest case BREKA_ORC_ARCHER: case BREKA_ORC_SHAMAN: case BREKA_ORC_OVERLORD: - case BREKA_ORC_WARRIOR: - { + case BREKA_ORC_WARRIOR: { final QuestState qs = getRandomPartyMemberState(killer, -1, 2, npc); - if (qs != null) - { - if (getQuestItemsCount(qs.getPlayer(), DUNINGS_KEY) >= 29) - { + if (qs != null) { + if (getQuestItemsCount(qs.getPlayer(), DUNINGS_KEY) >= 29) { giveItems(qs.getPlayer(), DUNINGS_KEY, 1); takeItems(qs.getPlayer(), DUNINGS_INSTRUCTIONS, 1); playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { giveItems(qs.getPlayer(), DUNINGS_KEY, 1); playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -404,194 +337,126 @@ public final class Q00216_TrialOfTheGuildsman extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == WAREHOUSE_KEEPER_VALKON) - { - if ((player.getClassId() == ClassId.artisan) || (player.getClassId() == ClassId.scavenger)) - { - if (player.getLevel() < MIN_LVL) - { + if (qs.isCreated()) { + if (npc.getId() == WAREHOUSE_KEEPER_VALKON) { + if ((player.getClassId() == ClassId.artisan) || (player.getClassId() == ClassId.scavenger)) { + if (player.getLevel() < MIN_LVL) { htmltext = "30103-02.html"; - } - else - { + } else { htmltext = "30103-03.htm"; } - } - else - { + } else { htmltext = "30103-01.html"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case WAREHOUSE_KEEPER_VALKON: - { - if (hasQuestItems(player, VALKONS_RECOMMENDATION)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case WAREHOUSE_KEEPER_VALKON: { + if (hasQuestItems(player, VALKONS_RECOMMENDATION)) { qs.setCond(3, true); htmltext = "30103-07.html"; - } - else if (hasQuestItems(player, ALLTRANS_INSTRUCTIONS)) - { - if (getQuestItemsCount(player, JOURNEYMAN_RING) < 7) - { + } else if (hasQuestItems(player, ALLTRANS_INSTRUCTIONS)) { + if (getQuestItemsCount(player, JOURNEYMAN_RING) < 7) { htmltext = "30103-08.html"; - } - else - { + } else { htmltext = "30103-09.html"; } } break; } - case WAREHOUSE_KEEPER_NORMAN: - { - if (hasQuestItems(player, ALLTRANS_INSTRUCTIONS)) - { - if (hasQuestItems(player, ALLTRANS_1ST_RECOMMENDATION)) - { + case WAREHOUSE_KEEPER_NORMAN: { + if (hasQuestItems(player, ALLTRANS_INSTRUCTIONS)) { + if (hasQuestItems(player, ALLTRANS_1ST_RECOMMENDATION)) { htmltext = "30210-01.html"; - } - else if (hasQuestItems(player, NORMANS_INSTRUCTIONS, NORMANS_RECEIPT)) - { + } else if (hasQuestItems(player, NORMANS_INSTRUCTIONS, NORMANS_RECEIPT)) { htmltext = "30210-05.html"; - } - else if (hasQuestItems(player, NORMANS_INSTRUCTIONS, DUNINGS_INSTRUCTIONS)) - { + } else if (hasQuestItems(player, NORMANS_INSTRUCTIONS, DUNINGS_INSTRUCTIONS)) { htmltext = "30210-06.html"; - } - else if (hasQuestItems(player, NORMANS_INSTRUCTIONS) && (getQuestItemsCount(player, DUNINGS_KEY) >= 30)) - { + } else if (hasQuestItems(player, NORMANS_INSTRUCTIONS) && (getQuestItemsCount(player, DUNINGS_KEY) >= 30)) { htmltext = "30210-07.html"; - } - else if (hasQuestItems(player, NORMANS_LIST)) - { - if ((getQuestItemsCount(player, GRAY_BONE_POWDER) >= 70) && (getQuestItemsCount(player, GRANITE_WHETSTONE) >= 70) && (getQuestItemsCount(player, RED_PIGMENT) >= 70) && (getQuestItemsCount(player, BRAIDED_YARN) >= 70)) - { + } else if (hasQuestItems(player, NORMANS_LIST)) { + if ((getQuestItemsCount(player, GRAY_BONE_POWDER) >= 70) && (getQuestItemsCount(player, GRANITE_WHETSTONE) >= 70) && (getQuestItemsCount(player, RED_PIGMENT) >= 70) && (getQuestItemsCount(player, BRAIDED_YARN) >= 70)) { takeItems(player, NORMANS_LIST, 1); takeItems(player, GRAY_BONE_POWDER, -1); takeItems(player, GRANITE_WHETSTONE, -1); takeItems(player, RED_PIGMENT, -1); takeItems(player, BRAIDED_YARN, -1); giveItems(player, JOURNEYMAN_GEM, 7); - if (getQuestItemsCount(player, JOURNEYMAN_DECO_BEADS) >= 7) - { + if (getQuestItemsCount(player, JOURNEYMAN_DECO_BEADS) >= 7) { qs.setCond(6, true); } htmltext = "30210-12.html"; - } - else - { + } else { htmltext = "30210-11.html"; } - } - else if (!hasAtLeastOneQuestItem(player, NORMANS_INSTRUCTIONS, NORMANS_LIST) && hasAtLeastOneQuestItem(player, JOURNEYMAN_GEM, JOURNEYMAN_RING)) - { + } else if (!hasAtLeastOneQuestItem(player, NORMANS_INSTRUCTIONS, NORMANS_LIST) && hasAtLeastOneQuestItem(player, JOURNEYMAN_GEM, JOURNEYMAN_RING)) { htmltext = "30210-13.html"; } } break; } - case BLACKSMITH_ALTRAN: - { - if (hasQuestItems(player, VALKONS_RECOMMENDATION)) - { - if (!hasQuestItems(player, MANDRAGORA_BERRY)) - { + case BLACKSMITH_ALTRAN: { + if (hasQuestItems(player, VALKONS_RECOMMENDATION)) { + if (!hasQuestItems(player, MANDRAGORA_BERRY)) { qs.setCond(2, true); htmltext = "30283-01.html"; - } - else - { + } else { htmltext = "30283-02.html"; } - } - else if (hasQuestItems(player, ALLTRANS_INSTRUCTIONS)) - { - if (getQuestItemsCount(player, JOURNEYMAN_RING) < 7) - { + } else if (hasQuestItems(player, ALLTRANS_INSTRUCTIONS)) { + if (getQuestItemsCount(player, JOURNEYMAN_RING) < 7) { htmltext = "30283-04.html"; - } - else - { + } else { htmltext = "30283-05.html"; } } break; } - case BLACKSMITH_PINTER: - { - if (hasQuestItems(player, ALLTRANS_INSTRUCTIONS)) - { - if (hasQuestItems(player, ALLTRANS_2ND_RECOMMENDATION)) - { + case BLACKSMITH_PINTER: { + if (hasQuestItems(player, ALLTRANS_INSTRUCTIONS)) { + if (hasQuestItems(player, ALLTRANS_2ND_RECOMMENDATION)) { htmltext = "30298-02.html"; - } - else if (hasQuestItems(player, PINTERS_INSTRUCTIONS)) - { - if (getQuestItemsCount(player, AMBER_BEAD) < 70) - { + } else if (hasQuestItems(player, PINTERS_INSTRUCTIONS)) { + if (getQuestItemsCount(player, AMBER_BEAD) < 70) { htmltext = "30298-06.html"; - } - else - { + } else { takeItems(player, RECIPE_AMBER_BEAD, 1); takeItems(player, PINTERS_INSTRUCTIONS, 1); takeItems(player, AMBER_BEAD, -1); takeItems(player, AMBER_LUMP, -1); giveItems(player, JOURNEYMAN_DECO_BEADS, 7); - if (getQuestItemsCount(player, JOURNEYMAN_GEM) >= 7) - { + if (getQuestItemsCount(player, JOURNEYMAN_GEM) >= 7) { qs.setCond(6, true); } htmltext = "30298-07.html"; } - } - else if (!hasQuestItems(player, PINTERS_INSTRUCTIONS) && hasAtLeastOneQuestItem(player, JOURNEYMAN_DECO_BEADS, JOURNEYMAN_RING)) - { + } else if (!hasQuestItems(player, PINTERS_INSTRUCTIONS) && hasAtLeastOneQuestItem(player, JOURNEYMAN_DECO_BEADS, JOURNEYMAN_RING)) { htmltext = "30298-08.html"; } } break; } - case BLACKSMITH_DUNING: - { - if (hasQuestItems(player, ALLTRANS_INSTRUCTIONS, NORMANS_INSTRUCTIONS)) - { - if (hasQuestItems(player, NORMANS_RECEIPT) && !hasQuestItems(player, DUNINGS_INSTRUCTIONS)) - { + case BLACKSMITH_DUNING: { + if (hasQuestItems(player, ALLTRANS_INSTRUCTIONS, NORMANS_INSTRUCTIONS)) { + if (hasQuestItems(player, NORMANS_RECEIPT) && !hasQuestItems(player, DUNINGS_INSTRUCTIONS)) { htmltext = "30688-01.html"; } - if (hasQuestItems(player, DUNINGS_INSTRUCTIONS) && !hasQuestItems(player, NORMANS_RECEIPT) && (getQuestItemsCount(player, DUNINGS_KEY) < 30)) - { + if (hasQuestItems(player, DUNINGS_INSTRUCTIONS) && !hasQuestItems(player, NORMANS_RECEIPT) && (getQuestItemsCount(player, DUNINGS_KEY) < 30)) { htmltext = "30688-03.html"; - } - else if ((getQuestItemsCount(player, DUNINGS_KEY) >= 30) && !hasQuestItems(player, DUNINGS_INSTRUCTIONS)) - { + } else if ((getQuestItemsCount(player, DUNINGS_KEY) >= 30) && !hasQuestItems(player, DUNINGS_INSTRUCTIONS)) { htmltext = "30688-04.html"; } - } - else if (hasQuestItems(player, ALLTRANS_INSTRUCTIONS) && !hasAtLeastOneQuestItem(player, NORMANS_INSTRUCTIONS, DUNINGS_INSTRUCTIONS)) - { + } else if (hasQuestItems(player, ALLTRANS_INSTRUCTIONS) && !hasAtLeastOneQuestItem(player, NORMANS_INSTRUCTIONS, DUNINGS_INSTRUCTIONS)) { htmltext = "30688-05.html"; } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == WAREHOUSE_KEEPER_VALKON) - { + } else if (qs.isCompleted()) { + if (npc.getId() == WAREHOUSE_KEEPER_VALKON) { htmltext = getAlreadyCompletedMsg(player); } } @@ -599,36 +464,29 @@ public final class Q00216_TrialOfTheGuildsman extends Quest } @Override - public boolean checkPartyMember(L2PcInstance player, L2Npc npc) - { + public boolean checkPartyMember(L2PcInstance player, L2Npc npc) { boolean check = false; - switch (npc.getId()) - { + switch (npc.getId()) { case ANT: case ANT_CAPTAIN: - case ANT_OVERSEER: - { + case ANT_OVERSEER: { check = hasQuestItems(player, ALLTRANS_INSTRUCTIONS, PINTERS_INSTRUCTIONS) && (getQuestItemsCount(player, AMBER_BEAD) < 70); break; } - case GRANITE_GOLEM: - { + case GRANITE_GOLEM: { check = hasQuestItems(player, ALLTRANS_INSTRUCTIONS, NORMANS_LIST) && (getQuestItemsCount(player, GRANITE_WHETSTONE) < 70); break; } - case SILENOS: - { + case SILENOS: { check = hasQuestItems(player, ALLTRANS_INSTRUCTIONS, NORMANS_LIST) && (getQuestItemsCount(player, BRAIDED_YARN) < 70); break; } case STRAIN: - case GHOUL: - { + case GHOUL: { check = hasQuestItems(player, ALLTRANS_INSTRUCTIONS, NORMANS_LIST) && (getQuestItemsCount(player, GRAY_BONE_POWDER) < 70); break; } - case DEAD_SEEKER: - { + case DEAD_SEEKER: { check = hasQuestItems(player, ALLTRANS_INSTRUCTIONS, NORMANS_LIST) && (getQuestItemsCount(player, RED_PIGMENT) < 70); break; } @@ -636,8 +494,7 @@ public final class Q00216_TrialOfTheGuildsman extends Quest case BREKA_ORC_ARCHER: case BREKA_ORC_SHAMAN: case BREKA_ORC_OVERLORD: - case BREKA_ORC_WARRIOR: - { + case BREKA_ORC_WARRIOR: { check = hasQuestItems(player, ALLTRANS_INSTRUCTIONS, NORMANS_INSTRUCTIONS, DUNINGS_INSTRUCTIONS) && (getQuestItemsCount(player, DUNINGS_KEY) < 30); break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00217_TestimonyOfTrust/Q00217_TestimonyOfTrust.java b/src/main/java/com/l2jserver/datapack/quests/Q00217_TestimonyOfTrust/Q00217_TestimonyOfTrust.java index f1a647d19b..68b7b6cfab 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00217_TestimonyOfTrust/Q00217_TestimonyOfTrust.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00217_TestimonyOfTrust/Q00217_TestimonyOfTrust.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.util.Util; * Testimony Of Trust (217) * @author ivantotov */ -public final class Q00217_TestimonyOfTrust extends Quest -{ +public final class Q00217_TestimonyOfTrust extends Quest { // NPCs private static final int HIGH_PRIEST_BIOTIN = 30031; private static final int HIERARCH_ASTERIOS = 30154; @@ -99,8 +98,7 @@ public final class Q00217_TestimonyOfTrust extends Quest // Misc private static final int MIN_LEVEL = 37; - public Q00217_TestimonyOfTrust() - { + public Q00217_TestimonyOfTrust() { super(217, Q00217_TestimonyOfTrust.class.getSimpleName(), "Testimony Of Trust"); addStartNpc(HIGH_PRIEST_HOLLINT); addTalkId(HIGH_PRIEST_HOLLINT, HIGH_PRIEST_BIOTIN, HIERARCH_ASTERIOS, TETRARCH_THIFIELL, MAGISTER_CLAYTON, SEER_MANAKIA, IRON_GATES_LOCKIRIN, FLAME_LORD_KAKAI, MAESTRO_NIKOLA, CARDINAL_SERESIN); @@ -109,49 +107,38 @@ public final class Q00217_TestimonyOfTrust extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (qs.isCreated()) - { + switch (event) { + case "ACCEPT": { + if (qs.isCreated()) { qs.startQuest(); qs.setMemoState(1); giveItems(player, LETTER_TO_ELF, 1); giveItems(player, LETTER_TO_DARKELF, 1); playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); - if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) - { + if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) { giveItems(player, DIMENSIONAL_DIAMOND, 96); player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1); htmltext = "30191-04a.htm"; - } - else - { + } else { htmltext = "30191-04.htm"; } } break; } case "30154-02.html": - case "30657-02.html": - { + case "30657-02.html": { htmltext = event; break; } - case "30154-03.html": - { - if (hasQuestItems(player, LETTER_TO_ELF)) - { + case "30154-03.html": { + if (hasQuestItems(player, LETTER_TO_ELF)) { takeItems(player, LETTER_TO_ELF, 1); giveItems(player, ORDER_OF_ASTERIOS, 1); qs.setMemoState(2); @@ -160,10 +147,8 @@ public final class Q00217_TestimonyOfTrust extends Quest } break; } - case "30358-02.html": - { - if (hasQuestItems(player, LETTER_TO_DARKELF)) - { + case "30358-02.html": { + if (hasQuestItems(player, LETTER_TO_DARKELF)) { takeItems(player, LETTER_TO_DARKELF, 1); giveItems(player, LETTER_OF_THIFIELL, 1); qs.setMemoState(5); @@ -172,10 +157,8 @@ public final class Q00217_TestimonyOfTrust extends Quest } break; } - case "30515-02.html": - { - if (hasQuestItems(player, LETTER_TO_MANAKIA)) - { + case "30515-02.html": { + if (hasQuestItems(player, LETTER_TO_MANAKIA)) { takeItems(player, LETTER_TO_MANAKIA, 1); qs.setMemoState(11); qs.setCond(14, true); @@ -183,10 +166,8 @@ public final class Q00217_TestimonyOfTrust extends Quest } break; } - case "30531-02.html": - { - if (hasQuestItems(player, LETTER_TO_DWARF)) - { + case "30531-02.html": { + if (hasQuestItems(player, LETTER_TO_DWARF)) { takeItems(player, LETTER_TO_DWARF, 1); giveItems(player, LETTER_TO_NICHOLA, 1); qs.setMemoState(15); @@ -195,10 +176,8 @@ public final class Q00217_TestimonyOfTrust extends Quest } break; } - case "30565-02.html": - { - if (hasQuestItems(player, LETTER_TO_ORC)) - { + case "30565-02.html": { + if (hasQuestItems(player, LETTER_TO_ORC)) { takeItems(player, LETTER_TO_ORC, 1); giveItems(player, LETTER_TO_MANAKIA, 1); qs.setMemoState(10); @@ -207,10 +186,8 @@ public final class Q00217_TestimonyOfTrust extends Quest } break; } - case "30621-02.html": - { - if (hasQuestItems(player, LETTER_TO_NICHOLA)) - { + case "30621-02.html": { + if (hasQuestItems(player, LETTER_TO_NICHOLA)) { takeItems(player, LETTER_TO_NICHOLA, 1); giveItems(player, ORDER_OF_NICHOLA, 1); qs.setMemoState(16); @@ -219,10 +196,8 @@ public final class Q00217_TestimonyOfTrust extends Quest } break; } - case "30657-03.html": - { - if (qs.isMemoState(8) && hasQuestItems(player, LETTER_TO_SERESIN)) - { + case "30657-03.html": { + if (qs.isMemoState(8) && hasQuestItems(player, LETTER_TO_SERESIN)) { giveItems(player, LETTER_TO_DWARF, 1); giveItems(player, LETTER_TO_ORC, 1); takeItems(player, LETTER_TO_SERESIN, 1); @@ -237,21 +212,15 @@ public final class Q00217_TestimonyOfTrust extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { case DRYAD: - case DRYAD_ELDER: - { - if (qs.isMemoState(2)) - { + case DRYAD_ELDER: { + if (qs.isMemoState(2)) { final int flag = killer.getVariables().getInt("flag", +1); - if (getRandom(100) < (flag * 33)) - { + if (getRandom(100) < (flag * 33)) { addSpawn(ACTEA_OF_VERDANT_WILDS, npc, true, 200000); playSound(killer, Sound.ITEMSOUND_QUEST_BEFORE_BATTLE); } @@ -259,13 +228,10 @@ public final class Q00217_TestimonyOfTrust extends Quest break; } case LIREIN: - case LIREIN_ELDER: - { - if (qs.isMemoState(2)) - { + case LIREIN_ELDER: { + if (qs.isMemoState(2)) { final int flag = killer.getVariables().getInt("flag", +1); - if (getRandom(100) < (flag * 33)) - { + if (getRandom(100) < (flag * 33)) { addSpawn(LUELL_OF_ZEPHYR_WINDS, npc, true, 200000); playSound(killer, Sound.ITEMSOUND_QUEST_BEFORE_BATTLE); } @@ -273,22 +239,16 @@ public final class Q00217_TestimonyOfTrust extends Quest break; } case ANT_RECRUIT: - case ANT_GUARD: - { - if (qs.isMemoState(6) && (getQuestItemsCount(killer, GIANT_APHID) < 5) && hasQuestItems(killer, ORDER_OF_CLAYTON) && !hasQuestItems(killer, HONEY_DEW)) - { - if (getQuestItemsCount(killer, GIANT_APHID) >= 4) - { + case ANT_GUARD: { + if (qs.isMemoState(6) && (getQuestItemsCount(killer, GIANT_APHID) < 5) && hasQuestItems(killer, ORDER_OF_CLAYTON) && !hasQuestItems(killer, HONEY_DEW)) { + if (getQuestItemsCount(killer, GIANT_APHID) >= 4) { giveItems(killer, HONEY_DEW, 1); takeItems(killer, GIANT_APHID, -1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if (hasQuestItems(killer, BASILISK_PLASMA, STAKATO_ICHOR)) - { + if (hasQuestItems(killer, BASILISK_PLASMA, STAKATO_ICHOR)) { qs.setCond(7); } - } - else - { + } else { giveItems(killer, GIANT_APHID, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -297,22 +257,16 @@ public final class Q00217_TestimonyOfTrust extends Quest } case ANT_PATROL: case ANT_SOLDIER: - case ANT_WARRIOR_CAPTAIN: - { - if (qs.isMemoState(6) && (getQuestItemsCount(killer, GIANT_APHID) < 10) && hasQuestItems(killer, ORDER_OF_CLAYTON) && !hasQuestItems(killer, HONEY_DEW)) - { - if (getQuestItemsCount(killer, GIANT_APHID) >= 4) - { + case ANT_WARRIOR_CAPTAIN: { + if (qs.isMemoState(6) && (getQuestItemsCount(killer, GIANT_APHID) < 10) && hasQuestItems(killer, ORDER_OF_CLAYTON) && !hasQuestItems(killer, HONEY_DEW)) { + if (getQuestItemsCount(killer, GIANT_APHID) >= 4) { giveItems(killer, HONEY_DEW, 1); takeItems(killer, GIANT_APHID, -1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if (hasQuestItems(killer, BASILISK_PLASMA, STAKATO_ICHOR)) - { + if (hasQuestItems(killer, BASILISK_PLASMA, STAKATO_ICHOR)) { qs.setCond(7); } - } - else - { + } else { giveItems(killer, GIANT_APHID, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -320,22 +274,16 @@ public final class Q00217_TestimonyOfTrust extends Quest break; } case MARSH_STAKATO: - case MARSH_STAKATO_WORKER: - { - if (qs.isMemoState(6) && (getQuestItemsCount(killer, STAKATOS_FLUIDS) < 10) && hasQuestItems(killer, ORDER_OF_CLAYTON) && !hasQuestItems(killer, STAKATO_ICHOR)) - { - if (getQuestItemsCount(killer, STAKATOS_FLUIDS) >= 4) - { + case MARSH_STAKATO_WORKER: { + if (qs.isMemoState(6) && (getQuestItemsCount(killer, STAKATOS_FLUIDS) < 10) && hasQuestItems(killer, ORDER_OF_CLAYTON) && !hasQuestItems(killer, STAKATO_ICHOR)) { + if (getQuestItemsCount(killer, STAKATOS_FLUIDS) >= 4) { giveItems(killer, STAKATO_ICHOR, 1); takeItems(killer, STAKATOS_FLUIDS, -1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if (hasQuestItems(killer, BASILISK_PLASMA, HONEY_DEW)) - { + if (hasQuestItems(killer, BASILISK_PLASMA, HONEY_DEW)) { qs.setCond(7); } - } - else - { + } else { giveItems(killer, STAKATOS_FLUIDS, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -343,109 +291,79 @@ public final class Q00217_TestimonyOfTrust extends Quest break; } case MARSH_STAKATO_SOLDIER: - case MARSH_STAKATO_DRONE: - { - if (qs.isMemoState(6) && (getQuestItemsCount(killer, STAKATOS_FLUIDS) < 5) && hasQuestItems(killer, ORDER_OF_CLAYTON) && !hasQuestItems(killer, STAKATO_ICHOR)) - { - if (getQuestItemsCount(killer, STAKATOS_FLUIDS) >= 4) - { + case MARSH_STAKATO_DRONE: { + if (qs.isMemoState(6) && (getQuestItemsCount(killer, STAKATOS_FLUIDS) < 5) && hasQuestItems(killer, ORDER_OF_CLAYTON) && !hasQuestItems(killer, STAKATO_ICHOR)) { + if (getQuestItemsCount(killer, STAKATOS_FLUIDS) >= 4) { giveItems(killer, STAKATO_ICHOR, 1); takeItems(killer, STAKATOS_FLUIDS, -1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if (hasQuestItems(killer, BASILISK_PLASMA, HONEY_DEW)) - { + if (hasQuestItems(killer, BASILISK_PLASMA, HONEY_DEW)) { qs.setCond(7); } - } - else - { + } else { giveItems(killer, STAKATOS_FLUIDS, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case PORTA: - { - if (qs.isMemoState(16) && !hasQuestItems(killer, HEART_OF_PORTA)) - { + case PORTA: { + if (qs.isMemoState(16) && !hasQuestItems(killer, HEART_OF_PORTA)) { giveItems(killer, HEART_OF_PORTA, 1); - if (hasQuestItems(killer, HEART_OF_PORTA)) - { + if (hasQuestItems(killer, HEART_OF_PORTA)) { qs.setCond(20, true); } } break; } - case GUARDIAN_BASILISK: - { - if (qs.isMemoState(6) && (getQuestItemsCount(killer, BLOOD_OF_GUARDIAN_BASILISK) < 10) && hasQuestItems(killer, ORDER_OF_CLAYTON) && !hasQuestItems(killer, BASILISK_PLASMA)) - { - if (getQuestItemsCount(killer, BLOOD_OF_GUARDIAN_BASILISK) >= 4) - { + case GUARDIAN_BASILISK: { + if (qs.isMemoState(6) && (getQuestItemsCount(killer, BLOOD_OF_GUARDIAN_BASILISK) < 10) && hasQuestItems(killer, ORDER_OF_CLAYTON) && !hasQuestItems(killer, BASILISK_PLASMA)) { + if (getQuestItemsCount(killer, BLOOD_OF_GUARDIAN_BASILISK) >= 4) { giveItems(killer, BASILISK_PLASMA, 1); takeItems(killer, BLOOD_OF_GUARDIAN_BASILISK, -1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if (hasQuestItems(killer, STAKATO_ICHOR, HONEY_DEW)) - { + if (hasQuestItems(killer, STAKATO_ICHOR, HONEY_DEW)) { qs.setCond(7); } - } - else - { + } else { giveItems(killer, BLOOD_OF_GUARDIAN_BASILISK, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case WINDSUS: - { - if (qs.isMemoState(11) && (getQuestItemsCount(killer, PARASITE_OF_LOTA) < 10)) - { + case WINDSUS: { + if (qs.isMemoState(11) && (getQuestItemsCount(killer, PARASITE_OF_LOTA) < 10)) { giveItems(killer, PARASITE_OF_LOTA, 2); - if (getQuestItemsCount(killer, PARASITE_OF_LOTA) == 10) - { + if (getQuestItemsCount(killer, PARASITE_OF_LOTA) == 10) { qs.setMemoState(12); qs.setCond(15, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case LUELL_OF_ZEPHYR_WINDS: - { - if (qs.isMemoState(2) && !hasQuestItems(killer, BREATH_OF_WINDS)) - { - if (hasQuestItems(killer, SEED_OF_VERDURE)) - { + case LUELL_OF_ZEPHYR_WINDS: { + if (qs.isMemoState(2) && !hasQuestItems(killer, BREATH_OF_WINDS)) { + if (hasQuestItems(killer, SEED_OF_VERDURE)) { giveItems(killer, BREATH_OF_WINDS, 1); qs.setMemoState(3); qs.setCond(3, true); - } - else - { + } else { giveItems(killer, BREATH_OF_WINDS, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case ACTEA_OF_VERDANT_WILDS: - { - if (qs.isMemoState(2) && !hasQuestItems(killer, SEED_OF_VERDURE)) - { - if (hasQuestItems(killer, BREATH_OF_WINDS)) - { + case ACTEA_OF_VERDANT_WILDS: { + if (qs.isMemoState(2) && !hasQuestItems(killer, SEED_OF_VERDURE)) { + if (hasQuestItems(killer, BREATH_OF_WINDS)) { giveItems(killer, SEED_OF_VERDURE, 1); qs.setMemoState(3); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { giveItems(killer, SEED_OF_VERDURE, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -458,47 +376,29 @@ public final class Q00217_TestimonyOfTrust extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); final int memoState = qs.getMemoState(); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == HIGH_PRIEST_HOLLINT) - { - if ((player.getRace() == Race.HUMAN) && (player.getLevel() >= MIN_LEVEL) && player.isInCategory(CategoryType.HUMAN_2ND_GROUP)) - { + if (qs.isCreated()) { + if (npc.getId() == HIGH_PRIEST_HOLLINT) { + if ((player.getRace() == Race.HUMAN) && (player.getLevel() >= MIN_LEVEL) && player.isInCategory(CategoryType.HUMAN_2ND_GROUP)) { htmltext = "30191-03.htm"; - } - else if ((player.getRace() == Race.HUMAN) && (player.getLevel() >= MIN_LEVEL) && player.isInCategory(CategoryType.FIRST_CLASS_GROUP)) - { + } else if ((player.getRace() == Race.HUMAN) && (player.getLevel() >= MIN_LEVEL) && player.isInCategory(CategoryType.FIRST_CLASS_GROUP)) { htmltext = "30191-01a.html"; - } - else if ((player.getRace() == Race.HUMAN) && (player.getLevel() >= MIN_LEVEL)) - { + } else if ((player.getRace() == Race.HUMAN) && (player.getLevel() >= MIN_LEVEL)) { htmltext = "30191-01b.html"; - } - else if ((player.getRace() == Race.HUMAN)) - { + } else if ((player.getRace() == Race.HUMAN)) { htmltext = "30191-01.html"; - } - else - { + } else { htmltext = "30191-02.html"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case HIGH_PRIEST_HOLLINT: - { - if (memoState == 7) - { - if (hasQuestItems(player, SCROLL_OF_ELF_TRUST, SCROLL_OF_DARKELF_TRUST)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case HIGH_PRIEST_HOLLINT: { + if (memoState == 7) { + if (hasQuestItems(player, SCROLL_OF_ELF_TRUST, SCROLL_OF_DARKELF_TRUST)) { giveItems(player, LETTER_TO_SERESIN, 1); takeItems(player, SCROLL_OF_DARKELF_TRUST, 1); takeItems(player, SCROLL_OF_ELF_TRUST, 1); @@ -506,11 +406,8 @@ public final class Q00217_TestimonyOfTrust extends Quest qs.setCond(10, true); htmltext = "30191-05.html"; } - } - else if (memoState == 18) - { - if (hasQuestItems(player, SCROLL_OF_DWARF_TRUST, SCROLL_OF_ORC_TRUST)) - { + } else if (memoState == 18) { + if (hasQuestItems(player, SCROLL_OF_DWARF_TRUST, SCROLL_OF_ORC_TRUST)) { takeItems(player, SCROLL_OF_DWARF_TRUST, 1); takeItems(player, SCROLL_OF_ORC_TRUST, 1); giveItems(player, RECOMMENDATION_OF_HOLLIN, 1); @@ -518,27 +415,18 @@ public final class Q00217_TestimonyOfTrust extends Quest qs.setCond(23, true); htmltext = "30191-06.html"; } - } - else if (memoState == 19) - { + } else if (memoState == 19) { htmltext = "30191-07.html"; - } - else if (memoState == 1) - { + } else if (memoState == 1) { htmltext = "30191-08.html"; - } - else if (memoState == 8) - { + } else if (memoState == 8) { htmltext = "30191-09.html"; } break; } - case HIGH_PRIEST_BIOTIN: - { - if (memoState == 19) - { - if (hasQuestItems(player, RECOMMENDATION_OF_HOLLIN)) - { + case HIGH_PRIEST_BIOTIN: { + if (memoState == 19) { + if (hasQuestItems(player, RECOMMENDATION_OF_HOLLIN)) { giveAdena(player, 252212, true); giveItems(player, MARK_OF_TRUST, 1); addExpAndSp(player, 1390298, 92782); @@ -549,26 +437,17 @@ public final class Q00217_TestimonyOfTrust extends Quest } break; } - case HIERARCH_ASTERIOS: - { - if (memoState == 1) - { - if (hasQuestItems(player, LETTER_TO_ELF)) - { + case HIERARCH_ASTERIOS: { + if (memoState == 1) { + if (hasQuestItems(player, LETTER_TO_ELF)) { htmltext = "30154-01.html"; } - } - else if (memoState == 2) - { - if (hasQuestItems(player, ORDER_OF_ASTERIOS)) - { + } else if (memoState == 2) { + if (hasQuestItems(player, ORDER_OF_ASTERIOS)) { htmltext = "30154-04.html"; } - } - else if (memoState == 3) - { - if (hasQuestItems(player, BREATH_OF_WINDS, SEED_OF_VERDURE)) - { + } else if (memoState == 3) { + if (hasQuestItems(player, BREATH_OF_WINDS, SEED_OF_VERDURE)) { giveItems(player, SCROLL_OF_ELF_TRUST, 1); takeItems(player, ORDER_OF_ASTERIOS, 1); takeItems(player, BREATH_OF_WINDS, 1); @@ -577,26 +456,18 @@ public final class Q00217_TestimonyOfTrust extends Quest qs.setCond(4, true); htmltext = "30154-05.html"; } - } - else if (memoState == 4) - { + } else if (memoState == 4) { htmltext = "30154-06.html"; } break; } - case TETRARCH_THIFIELL: - { - if (memoState == 4) - { - if (hasQuestItems(player, LETTER_TO_DARKELF)) - { + case TETRARCH_THIFIELL: { + if (memoState == 4) { + if (hasQuestItems(player, LETTER_TO_DARKELF)) { htmltext = "30358-01.html"; } - } - else if (memoState == 6) - { - if (hasQuestItems(player, ORDER_OF_CLAYTON) && ((getQuestItemsCount(player, STAKATO_ICHOR) + getQuestItemsCount(player, HONEY_DEW) + getQuestItemsCount(player, BASILISK_PLASMA)) == 3)) - { + } else if (memoState == 6) { + if (hasQuestItems(player, ORDER_OF_CLAYTON) && ((getQuestItemsCount(player, STAKATO_ICHOR) + getQuestItemsCount(player, HONEY_DEW) + getQuestItemsCount(player, BASILISK_PLASMA)) == 3)) { giveItems(player, SCROLL_OF_DARKELF_TRUST, 1); takeItems(player, BASILISK_PLASMA, -1); takeItems(player, HONEY_DEW, -1); @@ -606,179 +477,120 @@ public final class Q00217_TestimonyOfTrust extends Quest qs.setCond(9, true); htmltext = "30358-03.html"; } - } - else if (memoState == 7) - { + } else if (memoState == 7) { htmltext = "30358-04.html"; - } - else if (memoState == 5) - { + } else if (memoState == 5) { htmltext = "30358-05.html"; } break; } - case MAGISTER_CLAYTON: - { - if (memoState == 5) - { - if (hasQuestItems(player, LETTER_OF_THIFIELL)) - { + case MAGISTER_CLAYTON: { + if (memoState == 5) { + if (hasQuestItems(player, LETTER_OF_THIFIELL)) { takeItems(player, LETTER_OF_THIFIELL, 1); giveItems(player, ORDER_OF_CLAYTON, 1); qs.setMemoState(6); qs.setCond(6, true); htmltext = "30464-01.html"; } - } - else if (memoState == 6) - { - if (hasQuestItems(player, ORDER_OF_CLAYTON) && ((getQuestItemsCount(player, STAKATO_ICHOR) + getQuestItemsCount(player, HONEY_DEW) + getQuestItemsCount(player, BASILISK_PLASMA)) < 3)) - { + } else if (memoState == 6) { + if (hasQuestItems(player, ORDER_OF_CLAYTON) && ((getQuestItemsCount(player, STAKATO_ICHOR) + getQuestItemsCount(player, HONEY_DEW) + getQuestItemsCount(player, BASILISK_PLASMA)) < 3)) { htmltext = "30464-02.html"; - } - else - { + } else { qs.setCond(8, true); htmltext = "30464-03.html"; } } break; } - case SEER_MANAKIA: - { - if (hasQuestItems(player, LETTER_TO_MANAKIA)) - { + case SEER_MANAKIA: { + if (hasQuestItems(player, LETTER_TO_MANAKIA)) { htmltext = "30515-01.html"; - } - else if (memoState == 11) - { + } else if (memoState == 11) { htmltext = "30515-03.html"; - } - else if (memoState == 12) - { - if (getQuestItemsCount(player, PARASITE_OF_LOTA) == 10) - { + } else if (memoState == 12) { + if (getQuestItemsCount(player, PARASITE_OF_LOTA) == 10) { takeItems(player, PARASITE_OF_LOTA, -1); giveItems(player, LETTER_OF_MANAKIA, 1); qs.setMemoState(13); qs.setCond(16, true); htmltext = "30515-04.html"; } - } - else if (memoState == 13) - { + } else if (memoState == 13) { htmltext = "30515-05.html"; } break; } - case IRON_GATES_LOCKIRIN: - { - if (memoState == 14) - { - if (hasQuestItems(player, LETTER_TO_DWARF)) - { + case IRON_GATES_LOCKIRIN: { + if (memoState == 14) { + if (hasQuestItems(player, LETTER_TO_DWARF)) { htmltext = "30531-01.html"; } - } - else if (memoState == 15) - { + } else if (memoState == 15) { htmltext = "30531-03.html"; - } - else if (memoState == 17) - { + } else if (memoState == 17) { giveItems(player, SCROLL_OF_DWARF_TRUST, 1); qs.setMemoState(18); qs.setCond(22, true); htmltext = "30531-04.html"; - } - else if (memoState == 18) - { + } else if (memoState == 18) { htmltext = "30531-05.html"; } break; } - case FLAME_LORD_KAKAI: - { - if (memoState == 9) - { - if (hasQuestItems(player, LETTER_TO_ORC)) - { + case FLAME_LORD_KAKAI: { + if (memoState == 9) { + if (hasQuestItems(player, LETTER_TO_ORC)) { htmltext = "30565-01.html"; } - } - else if (memoState == 10) - { + } else if (memoState == 10) { htmltext = "30565-03.html"; - } - else if (memoState == 13) - { + } else if (memoState == 13) { giveItems(player, SCROLL_OF_ORC_TRUST, 1); takeItems(player, LETTER_OF_MANAKIA, 1); qs.setMemoState(14); qs.setCond(17, true); htmltext = "30565-04.html"; - } - else if (memoState == 14) - { + } else if (memoState == 14) { htmltext = "30565-05.html"; } break; } - case MAESTRO_NIKOLA: - { - if (memoState == 15) - { - if (hasQuestItems(player, LETTER_TO_NICHOLA)) - { + case MAESTRO_NIKOLA: { + if (memoState == 15) { + if (hasQuestItems(player, LETTER_TO_NICHOLA)) { htmltext = "30621-01.html"; } - } - else if (memoState == 16) - { - if (!hasQuestItems(player, HEART_OF_PORTA)) - { + } else if (memoState == 16) { + if (!hasQuestItems(player, HEART_OF_PORTA)) { htmltext = "30621-03.html"; - } - else - { + } else { takeItems(player, ORDER_OF_NICHOLA, 1); takeItems(player, HEART_OF_PORTA, 1); qs.setMemoState(17); qs.setCond(21, true); htmltext = "30621-04.html"; } - } - else if (memoState == 17) - { + } else if (memoState == 17) { htmltext = "30621-05.html"; } break; } - case CARDINAL_SERESIN: - { - if (memoState == 8) - { - if (hasQuestItems(player, LETTER_TO_SERESIN)) - { + case CARDINAL_SERESIN: { + if (memoState == 8) { + if (hasQuestItems(player, LETTER_TO_SERESIN)) { htmltext = "30657-01.html"; } - } - else if (memoState == 9) - { + } else if (memoState == 9) { htmltext = "30657-04.html"; - } - else if (memoState == 18) - { + } else if (memoState == 18) { htmltext = "30657-05.html"; } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == HIGH_PRIEST_HOLLINT) - { + } else if (qs.isCompleted()) { + if (npc.getId() == HIGH_PRIEST_HOLLINT) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00218_TestimonyOfLife/Q00218_TestimonyOfLife.java b/src/main/java/com/l2jserver/datapack/quests/Q00218_TestimonyOfLife/Q00218_TestimonyOfLife.java index 669f359d10..35645d0947 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00218_TestimonyOfLife/Q00218_TestimonyOfLife.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00218_TestimonyOfLife/Q00218_TestimonyOfLife.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.util.Util; * Testimony Of Life (218) * @author ivantotov */ -public final class Q00218_TestimonyOfLife extends Quest -{ +public final class Q00218_TestimonyOfLife extends Quest { // NPCs private static final int HIERARCH_ASTERIOS = 30154; private static final int BLACKSMITH_PUSHKIN = 30300; @@ -96,8 +95,7 @@ public final class Q00218_TestimonyOfLife extends Quest private static final int MIN_LEVEL = 37; private static final int LEVEL = 38; - public Q00218_TestimonyOfLife() - { + public Q00218_TestimonyOfLife() { super(218, Q00218_TestimonyOfLife.class.getSimpleName(), "Testimony Of Life"); addStartNpc(MASTER_CARDIEN); addTalkId(MASTER_CARDIEN, HIERARCH_ASTERIOS, BLACKSMITH_PUSHKIN, THALIA, PRIEST_ADONIUS, ARKENIA, ISAEL_SILVERSHADOW); @@ -106,35 +104,26 @@ public final class Q00218_TestimonyOfLife extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (qs.isCreated()) - { + switch (event) { + case "ACCEPT": { + if (qs.isCreated()) { qs.startQuest(); - if (!hasQuestItems(player, CARDIENS_LETTER)) - { + if (!hasQuestItems(player, CARDIENS_LETTER)) { giveItems(player, CARDIENS_LETTER, 1); } playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); - if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) - { + if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) { giveItems(player, DIMENSIONAL_DIAMOND, 102); player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1); htmltext = "30460-04a.htm"; - } - else - { + } else { htmltext = "30460-04.htm"; } } @@ -154,15 +143,12 @@ public final class Q00218_TestimonyOfLife extends Quest case "30371-02.html": case "30371-10.html": case "30419-02.html": - case "30419-03.html": - { + case "30419-03.html": { htmltext = event; break; } - case "30154-07.html": - { - if (hasQuestItems(player, CARDIENS_LETTER)) - { + case "30154-07.html": { + if (hasQuestItems(player, CARDIENS_LETTER)) { takeItems(player, CARDIENS_LETTER, 1); giveItems(player, HIERARCHS_LETTER, 1); giveItems(player, MOONFLOWER_CHARM, 1); @@ -171,10 +157,8 @@ public final class Q00218_TestimonyOfLife extends Quest } break; } - case "30300-06.html": - { - if (hasQuestItems(player, GRAIL_DIAGRAM)) - { + case "30300-06.html": { + if (hasQuestItems(player, GRAIL_DIAGRAM)) { takeItems(player, GRAIL_DIAGRAM, 1); giveItems(player, PUSHKINS_LIST, 1); qs.setCond(4, true); @@ -182,10 +166,8 @@ public final class Q00218_TestimonyOfLife extends Quest } break; } - case "30300-10.html": - { - if (hasQuestItems(player, PUSHKINS_LIST)) - { + case "30300-10.html": { + if (hasQuestItems(player, PUSHKINS_LIST)) { takeItems(player, PUSHKINS_LIST, 1); giveItems(player, PURE_MITHRIL_CUP, 1); takeItems(player, PURE_MITHRIL_ORE, -1); @@ -196,10 +178,8 @@ public final class Q00218_TestimonyOfLife extends Quest } break; } - case "30371-03.html": - { - if (hasQuestItems(player, HIERARCHS_LETTER)) - { + case "30371-03.html": { + if (hasQuestItems(player, HIERARCHS_LETTER)) { takeItems(player, HIERARCHS_LETTER, 1); giveItems(player, GRAIL_DIAGRAM, 1); qs.setCond(3, true); @@ -207,10 +187,8 @@ public final class Q00218_TestimonyOfLife extends Quest } break; } - case "30371-11.html": - { - if (hasQuestItems(player, STARDUST)) - { + case "30371-11.html": { + if (hasQuestItems(player, STARDUST)) { giveItems(player, THALIAS_2ND_LETTER, 1); takeItems(player, STARDUST, 1); qs.setCond(14, true); @@ -218,10 +196,8 @@ public final class Q00218_TestimonyOfLife extends Quest } break; } - case "30419-04.html": - { - if (hasQuestItems(player, THALIAS_1ST_LETTER)) - { + case "30419-04.html": { + if (hasQuestItems(player, THALIAS_1ST_LETTER)) { takeItems(player, THALIAS_1ST_LETTER, 1); giveItems(player, ARKENIAS_CONTRACT, 1); giveItems(player, ARKENIAS_INSTRUCTIONS, 1); @@ -230,10 +206,8 @@ public final class Q00218_TestimonyOfLife extends Quest } break; } - case "30375-02.html": - { - if (hasQuestItems(player, ARKENIAS_INSTRUCTIONS)) - { + case "30375-02.html": { + if (hasQuestItems(player, ARKENIAS_INSTRUCTIONS)) { takeItems(player, ARKENIAS_INSTRUCTIONS, 1); giveItems(player, ADONIUS_LIST, 1); qs.setCond(9, true); @@ -241,10 +215,8 @@ public final class Q00218_TestimonyOfLife extends Quest } break; } - case "30655-02.html": - { - if (hasQuestItems(player, THALIAS_2ND_LETTER)) - { + case "30655-02.html": { + if (hasQuestItems(player, THALIAS_2ND_LETTER)) { takeItems(player, THALIAS_2ND_LETTER, 1); giveItems(player, ISAELS_INSTRUCTIONS, 1); qs.setCond(15, true); @@ -257,162 +229,113 @@ public final class Q00218_TestimonyOfLife extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { case ANT_RECRUIT: case ANT_PATROL: case ANT_GUARD: case ANT_SOLDIER: - case ANT_WARRIOR_CAPTAIN: - { - if (hasQuestItems(killer, MOONFLOWER_CHARM, PUSHKINS_LIST) && (getQuestItemsCount(killer, ANT_SOLDIER_ACID) < 20)) - { + case ANT_WARRIOR_CAPTAIN: { + if (hasQuestItems(killer, MOONFLOWER_CHARM, PUSHKINS_LIST) && (getQuestItemsCount(killer, ANT_SOLDIER_ACID) < 20)) { giveItems(killer, ANT_SOLDIER_ACID, 2); - if (getQuestItemsCount(killer, ANT_SOLDIER_ACID) == 20) - { + if (getQuestItemsCount(killer, ANT_SOLDIER_ACID) == 20) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if ((getQuestItemsCount(killer, PURE_MITHRIL_ORE) >= 10) && (getQuestItemsCount(killer, WYRMS_TALON) >= 20)) - { + if ((getQuestItemsCount(killer, PURE_MITHRIL_ORE) >= 10) && (getQuestItemsCount(killer, WYRMS_TALON) >= 20)) { qs.setCond(5); } - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case HARPY: - { - if (hasQuestItems(killer, MOONFLOWER_CHARM, ADONIUS_LIST) && (getQuestItemsCount(killer, HARPYS_DOWN) < 20)) - { + case HARPY: { + if (hasQuestItems(killer, MOONFLOWER_CHARM, ADONIUS_LIST) && (getQuestItemsCount(killer, HARPYS_DOWN) < 20)) { giveItems(killer, HARPYS_DOWN, 4); - if (getQuestItemsCount(killer, HARPYS_DOWN) == 20) - { + if (getQuestItemsCount(killer, HARPYS_DOWN) == 20) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if (getQuestItemsCount(killer, SPIDER_ICHOR) >= 20) - { + if (getQuestItemsCount(killer, SPIDER_ICHOR) >= 20) { qs.setCond(10); } - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case WYRM: - { - if (hasQuestItems(killer, MOONFLOWER_CHARM, PUSHKINS_LIST) && (getQuestItemsCount(killer, WYRMS_TALON) < 20)) - { + case WYRM: { + if (hasQuestItems(killer, MOONFLOWER_CHARM, PUSHKINS_LIST) && (getQuestItemsCount(killer, WYRMS_TALON) < 20)) { giveItems(killer, WYRMS_TALON, 4); - if (getQuestItemsCount(killer, WYRMS_TALON) == 20) - { + if (getQuestItemsCount(killer, WYRMS_TALON) == 20) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if ((getQuestItemsCount(killer, PURE_MITHRIL_ORE) >= 10) && (getQuestItemsCount(killer, ANT_SOLDIER_ACID) >= 20)) - { + if ((getQuestItemsCount(killer, PURE_MITHRIL_ORE) >= 10) && (getQuestItemsCount(killer, ANT_SOLDIER_ACID) >= 20)) { qs.setCond(5); } - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case MARSH_SPIDER: - { - if (hasQuestItems(killer, MOONFLOWER_CHARM, ADONIUS_LIST) && (getQuestItemsCount(killer, SPIDER_ICHOR) < 20)) - { + case MARSH_SPIDER: { + if (hasQuestItems(killer, MOONFLOWER_CHARM, ADONIUS_LIST) && (getQuestItemsCount(killer, SPIDER_ICHOR) < 20)) { giveItems(killer, SPIDER_ICHOR, 4); - if (getQuestItemsCount(killer, SPIDER_ICHOR) == 20) - { + if (getQuestItemsCount(killer, SPIDER_ICHOR) == 20) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if (getQuestItemsCount(killer, HARPYS_DOWN) >= 20) - { + if (getQuestItemsCount(killer, HARPYS_DOWN) >= 20) { qs.setCond(10); } - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case GUARDIAN_BASILISK: - { - if (hasQuestItems(killer, MOONFLOWER_CHARM, PUSHKINS_LIST) && (getQuestItemsCount(killer, PURE_MITHRIL_ORE) < 10)) - { + case GUARDIAN_BASILISK: { + if (hasQuestItems(killer, MOONFLOWER_CHARM, PUSHKINS_LIST) && (getQuestItemsCount(killer, PURE_MITHRIL_ORE) < 10)) { giveItems(killer, PURE_MITHRIL_ORE, 2); - if (getQuestItemsCount(killer, PURE_MITHRIL_ORE) == 10) - { + if (getQuestItemsCount(killer, PURE_MITHRIL_ORE) == 10) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if ((getQuestItemsCount(killer, WYRMS_TALON) >= 20) && (getQuestItemsCount(killer, ANT_SOLDIER_ACID) >= 20)) - { + if ((getQuestItemsCount(killer, WYRMS_TALON) >= 20) && (getQuestItemsCount(killer, ANT_SOLDIER_ACID) >= 20)) { qs.setCond(5); } - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } case LETO_LIZARDMAN_SHAMAN: - case LETO_LIZARDMAN_OVERLORD: - { - if (hasQuestItems(killer, ISAELS_INSTRUCTIONS)) - { - if (!hasQuestItems(killer, TALINS_SPEAR_BLADE)) - { + case LETO_LIZARDMAN_OVERLORD: { + if (hasQuestItems(killer, ISAELS_INSTRUCTIONS)) { + if (!hasQuestItems(killer, TALINS_SPEAR_BLADE)) { giveItems(killer, TALINS_SPEAR_BLADE, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else if (!hasQuestItems(killer, TALINS_SPEAR_SHAFT)) - { + } else if (!hasQuestItems(killer, TALINS_SPEAR_SHAFT)) { giveItems(killer, TALINS_SPEAR_SHAFT, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else if (!hasQuestItems(killer, TALINS_RUBY)) - { + } else if (!hasQuestItems(killer, TALINS_RUBY)) { giveItems(killer, TALINS_RUBY, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else if (!hasQuestItems(killer, TALINS_AQUAMARINE)) - { + } else if (!hasQuestItems(killer, TALINS_AQUAMARINE)) { giveItems(killer, TALINS_AQUAMARINE, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else if (!hasQuestItems(killer, TALINS_AMETHYST)) - { + } else if (!hasQuestItems(killer, TALINS_AMETHYST)) { giveItems(killer, TALINS_AMETHYST, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else if (!hasQuestItems(killer, TALINS_PERIDOT)) - { + } else if (!hasQuestItems(killer, TALINS_PERIDOT)) { giveItems(killer, TALINS_PERIDOT, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); } } break; } - case UNICORN_OF_EVA: - { - if (!hasQuestItems(killer, TEARS_OF_UNICORN) && hasQuestItems(killer, MOONFLOWER_CHARM, TALINS_SPEAR, GRAIL_OF_PURITY)) - { - if (npc.getKillingBlowWeapon() == TALINS_SPEAR) - { + case UNICORN_OF_EVA: { + if (!hasQuestItems(killer, TEARS_OF_UNICORN) && hasQuestItems(killer, MOONFLOWER_CHARM, TALINS_SPEAR, GRAIL_OF_PURITY)) { + if (npc.getKillingBlowWeapon() == TALINS_SPEAR) { takeItems(killer, TALINS_SPEAR, 1); takeItems(killer, GRAIL_OF_PURITY, 1); giveItems(killer, TEARS_OF_UNICORN, 1); @@ -427,51 +350,31 @@ public final class Q00218_TestimonyOfLife extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == MASTER_CARDIEN) - { - if (player.getRace() == Race.ELF) - { - if ((player.getLevel() >= MIN_LEVEL) && player.isInCategory(CategoryType.ELF_2ND_GROUP)) - { + if (qs.isCreated()) { + if (npc.getId() == MASTER_CARDIEN) { + if (player.getRace() == Race.ELF) { + if ((player.getLevel() >= MIN_LEVEL) && player.isInCategory(CategoryType.ELF_2ND_GROUP)) { htmltext = "30460-03.htm"; - } - else if (player.getLevel() >= MIN_LEVEL) - { + } else if (player.getLevel() >= MIN_LEVEL) { htmltext = "30460-01a.html"; - } - else - { + } else { htmltext = "30460-02.html"; } - } - else - { + } else { htmltext = "30460-01.html"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case MASTER_CARDIEN: - { - if (hasQuestItems(player, CARDIENS_LETTER)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case MASTER_CARDIEN: { + if (hasQuestItems(player, CARDIENS_LETTER)) { htmltext = "30460-05.html"; - } - else if (hasQuestItems(player, MOONFLOWER_CHARM)) - { + } else if (hasQuestItems(player, MOONFLOWER_CHARM)) { htmltext = "30460-06.html"; - } - else if (hasQuestItems(player, CAMOMILE_CHARM)) - { + } else if (hasQuestItems(player, CAMOMILE_CHARM)) { giveAdena(player, 342288, true); giveItems(player, MARK_OF_LIFE, 1); addExpAndSp(player, 1886832, 125918); @@ -481,223 +384,141 @@ public final class Q00218_TestimonyOfLife extends Quest } break; } - case HIERARCH_ASTERIOS: - { - if (hasQuestItems(player, CARDIENS_LETTER)) - { + case HIERARCH_ASTERIOS: { + if (hasQuestItems(player, CARDIENS_LETTER)) { htmltext = "30154-01.html"; - } - else if (hasQuestItems(player, MOONFLOWER_CHARM)) - { - if (!hasQuestItems(player, WATER_OF_LIFE)) - { + } else if (hasQuestItems(player, MOONFLOWER_CHARM)) { + if (!hasQuestItems(player, WATER_OF_LIFE)) { htmltext = "30154-08.html"; - } - else - { + } else { giveItems(player, CAMOMILE_CHARM, 1); takeItems(player, MOONFLOWER_CHARM, 1); takeItems(player, WATER_OF_LIFE, 1); qs.setCond(21, true); htmltext = "30154-09.html"; } - } - else if (hasQuestItems(player, CAMOMILE_CHARM)) - { + } else if (hasQuestItems(player, CAMOMILE_CHARM)) { htmltext = "30154-10.html"; } break; } - case BLACKSMITH_PUSHKIN: - { - if (hasQuestItems(player, MOONFLOWER_CHARM)) - { - if (hasQuestItems(player, GRAIL_DIAGRAM)) - { + case BLACKSMITH_PUSHKIN: { + if (hasQuestItems(player, MOONFLOWER_CHARM)) { + if (hasQuestItems(player, GRAIL_DIAGRAM)) { htmltext = "30300-01.html"; - } - else if (hasQuestItems(player, PUSHKINS_LIST)) - { - if ((getQuestItemsCount(player, PURE_MITHRIL_ORE) >= 10) && (getQuestItemsCount(player, ANT_SOLDIER_ACID) >= 20) && (getQuestItemsCount(player, WYRMS_TALON) >= 20)) - { + } else if (hasQuestItems(player, PUSHKINS_LIST)) { + if ((getQuestItemsCount(player, PURE_MITHRIL_ORE) >= 10) && (getQuestItemsCount(player, ANT_SOLDIER_ACID) >= 20) && (getQuestItemsCount(player, WYRMS_TALON) >= 20)) { htmltext = "30300-08.html"; - } - else - { + } else { htmltext = "30300-07.html"; } - } - else if (hasQuestItems(player, PURE_MITHRIL_CUP)) - { + } else if (hasQuestItems(player, PURE_MITHRIL_CUP)) { htmltext = "30300-11.html"; - } - else if (!hasAtLeastOneQuestItem(player, GRAIL_DIAGRAM, PUSHKINS_LIST, PURE_MITHRIL_CUP)) - { + } else if (!hasAtLeastOneQuestItem(player, GRAIL_DIAGRAM, PUSHKINS_LIST, PURE_MITHRIL_CUP)) { htmltext = "30300-12.html"; } } break; } - case THALIA: - { - if (hasQuestItems(player, MOONFLOWER_CHARM)) - { - if (hasQuestItems(player, HIERARCHS_LETTER)) - { + case THALIA: { + if (hasQuestItems(player, MOONFLOWER_CHARM)) { + if (hasQuestItems(player, HIERARCHS_LETTER)) { htmltext = "30371-01.html"; - } - else if (hasQuestItems(player, GRAIL_DIAGRAM)) - { + } else if (hasQuestItems(player, GRAIL_DIAGRAM)) { htmltext = "30371-04.html"; - } - else if (hasQuestItems(player, PUSHKINS_LIST)) - { + } else if (hasQuestItems(player, PUSHKINS_LIST)) { htmltext = "30371-05.html"; - } - else if (hasQuestItems(player, PURE_MITHRIL_CUP)) - { + } else if (hasQuestItems(player, PURE_MITHRIL_CUP)) { giveItems(player, THALIAS_1ST_LETTER, 1); takeItems(player, PURE_MITHRIL_CUP, 1); qs.setCond(7, true); htmltext = "30371-06.html"; - } - else if (hasQuestItems(player, THALIAS_1ST_LETTER)) - { + } else if (hasQuestItems(player, THALIAS_1ST_LETTER)) { htmltext = "30371-07.html"; - } - else if (hasQuestItems(player, ARKENIAS_CONTRACT)) - { + } else if (hasQuestItems(player, ARKENIAS_CONTRACT)) { htmltext = "30371-08.html"; - } - else if (hasQuestItems(player, STARDUST)) - { + } else if (hasQuestItems(player, STARDUST)) { htmltext = "30371-09.html"; - } - else if (hasQuestItems(player, THALIAS_INSTRUCTIONS)) - { - if (player.getLevel() >= LEVEL) - { + } else if (hasQuestItems(player, THALIAS_INSTRUCTIONS)) { + if (player.getLevel() >= LEVEL) { takeItems(player, THALIAS_INSTRUCTIONS, 1); giveItems(player, THALIAS_2ND_LETTER, 1); qs.setCond(14, true); htmltext = "30371-13.html"; - } - else - { + } else { htmltext = "30371-12.html"; } - } - else if (hasQuestItems(player, THALIAS_2ND_LETTER)) - { + } else if (hasQuestItems(player, THALIAS_2ND_LETTER)) { htmltext = "30371-14.html"; - } - else if (hasQuestItems(player, ISAELS_INSTRUCTIONS)) - { + } else if (hasQuestItems(player, ISAELS_INSTRUCTIONS)) { htmltext = "30371-15.html"; - } - else if (hasQuestItems(player, TALINS_SPEAR, ISAELS_LETTER)) - { + } else if (hasQuestItems(player, TALINS_SPEAR, ISAELS_LETTER)) { takeItems(player, ISAELS_LETTER, 1); giveItems(player, GRAIL_OF_PURITY, 1); qs.setCond(18, true); htmltext = "30371-16.html"; - } - else if (hasQuestItems(player, TALINS_SPEAR, GRAIL_OF_PURITY)) - { + } else if (hasQuestItems(player, TALINS_SPEAR, GRAIL_OF_PURITY)) { htmltext = "30371-17.html"; - } - else if (hasQuestItems(player, TEARS_OF_UNICORN)) - { + } else if (hasQuestItems(player, TEARS_OF_UNICORN)) { takeItems(player, TEARS_OF_UNICORN, 1); giveItems(player, WATER_OF_LIFE, 1); qs.setCond(20, true); htmltext = "30371-18.html"; - } - else if (hasAtLeastOneQuestItem(player, CAMOMILE_CHARM, WATER_OF_LIFE)) - { + } else if (hasAtLeastOneQuestItem(player, CAMOMILE_CHARM, WATER_OF_LIFE)) { htmltext = "30371-19.html"; } } break; } - case ARKENIA: - { - if (hasQuestItems(player, MOONFLOWER_CHARM)) - { - if (hasQuestItems(player, THALIAS_1ST_LETTER)) - { + case ARKENIA: { + if (hasQuestItems(player, MOONFLOWER_CHARM)) { + if (hasQuestItems(player, THALIAS_1ST_LETTER)) { htmltext = "30419-01.html"; - } - else if (hasAtLeastOneQuestItem(player, ARKENIAS_INSTRUCTIONS, ADONIUS_LIST)) - { + } else if (hasAtLeastOneQuestItem(player, ARKENIAS_INSTRUCTIONS, ADONIUS_LIST)) { htmltext = "30419-05.html"; - } - else if (hasQuestItems(player, ANDARIEL_SCRIPTURE_COPY)) - { + } else if (hasQuestItems(player, ANDARIEL_SCRIPTURE_COPY)) { takeItems(player, ARKENIAS_CONTRACT, 1); takeItems(player, ANDARIEL_SCRIPTURE_COPY, 1); giveItems(player, STARDUST, 1); qs.setCond(12, true); htmltext = "30419-06.html"; - } - else if (hasQuestItems(player, STARDUST)) - { + } else if (hasQuestItems(player, STARDUST)) { htmltext = "30419-07.html"; - } - else if (!hasAtLeastOneQuestItem(player, THALIAS_1ST_LETTER, ARKENIAS_CONTRACT, ANDARIEL_SCRIPTURE_COPY, STARDUST)) - { + } else if (!hasAtLeastOneQuestItem(player, THALIAS_1ST_LETTER, ARKENIAS_CONTRACT, ANDARIEL_SCRIPTURE_COPY, STARDUST)) { htmltext = "30419-08.html"; } } break; } - case PRIEST_ADONIUS: - { - if (hasQuestItems(player, MOONFLOWER_CHARM)) - { - if (hasQuestItems(player, ARKENIAS_INSTRUCTIONS)) - { + case PRIEST_ADONIUS: { + if (hasQuestItems(player, MOONFLOWER_CHARM)) { + if (hasQuestItems(player, ARKENIAS_INSTRUCTIONS)) { htmltext = "30375-01.html"; - } - else if (hasQuestItems(player, ADONIUS_LIST)) - { - if ((getQuestItemsCount(player, SPIDER_ICHOR) >= 20) && (getQuestItemsCount(player, HARPYS_DOWN) >= 20)) - { + } else if (hasQuestItems(player, ADONIUS_LIST)) { + if ((getQuestItemsCount(player, SPIDER_ICHOR) >= 20) && (getQuestItemsCount(player, HARPYS_DOWN) >= 20)) { takeItems(player, ADONIUS_LIST, 1); giveItems(player, ANDARIEL_SCRIPTURE_COPY, 1); takeItems(player, SPIDER_ICHOR, -1); takeItems(player, HARPYS_DOWN, -1); qs.setCond(11, true); htmltext = "30375-04.html"; - } - else - { + } else { htmltext = "30375-03.html"; } - } - else if (hasQuestItems(player, ANDARIEL_SCRIPTURE_COPY)) - { + } else if (hasQuestItems(player, ANDARIEL_SCRIPTURE_COPY)) { htmltext = "30375-05.html"; - } - else if (!hasAtLeastOneQuestItem(player, ARKENIAS_INSTRUCTIONS, ADONIUS_LIST, ANDARIEL_SCRIPTURE_COPY)) - { + } else if (!hasAtLeastOneQuestItem(player, ARKENIAS_INSTRUCTIONS, ADONIUS_LIST, ANDARIEL_SCRIPTURE_COPY)) { htmltext = "30375-06.html"; } } break; } - case ISAEL_SILVERSHADOW: - { - if (hasQuestItems(player, MOONFLOWER_CHARM)) - { - if (hasQuestItems(player, THALIAS_2ND_LETTER)) - { + case ISAEL_SILVERSHADOW: { + if (hasQuestItems(player, MOONFLOWER_CHARM)) { + if (hasQuestItems(player, THALIAS_2ND_LETTER)) { htmltext = "30655-01.html"; - } - else if (hasQuestItems(player, ISAELS_INSTRUCTIONS)) - { - if (hasQuestItems(player, TALINS_SPEAR_BLADE, TALINS_SPEAR_SHAFT, TALINS_RUBY, TALINS_AQUAMARINE, TALINS_AMETHYST, TALINS_PERIDOT)) - { + } else if (hasQuestItems(player, ISAELS_INSTRUCTIONS)) { + if (hasQuestItems(player, TALINS_SPEAR_BLADE, TALINS_SPEAR_SHAFT, TALINS_RUBY, TALINS_AQUAMARINE, TALINS_AMETHYST, TALINS_PERIDOT)) { giveItems(player, TALINS_SPEAR, 1); takeItems(player, ISAELS_INSTRUCTIONS, 1); giveItems(player, ISAELS_LETTER, 1); @@ -709,29 +530,20 @@ public final class Q00218_TestimonyOfLife extends Quest takeItems(player, TALINS_PERIDOT, 1); qs.setCond(17, true); htmltext = "30655-04.html"; - } - else - { + } else { htmltext = "30655-03.html"; } - } - else if (hasQuestItems(player, TALINS_SPEAR, ISAELS_LETTER)) - { + } else if (hasQuestItems(player, TALINS_SPEAR, ISAELS_LETTER)) { htmltext = "30655-05.html"; - } - else if (hasAtLeastOneQuestItem(player, GRAIL_OF_PURITY, WATER_OF_LIFE, CAMOMILE_CHARM)) - { + } else if (hasAtLeastOneQuestItem(player, GRAIL_OF_PURITY, WATER_OF_LIFE, CAMOMILE_CHARM)) { htmltext = "30655-06.html"; } } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == MASTER_CARDIEN) - { + } else if (qs.isCompleted()) { + if (npc.getId() == MASTER_CARDIEN) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00219_TestimonyOfFate/Q00219_TestimonyOfFate.java b/src/main/java/com/l2jserver/datapack/quests/Q00219_TestimonyOfFate/Q00219_TestimonyOfFate.java index 0ad40ccc2f..10ce8a7484 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00219_TestimonyOfFate/Q00219_TestimonyOfFate.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00219_TestimonyOfFate/Q00219_TestimonyOfFate.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.util.Util; * Testimony Of Fate (219) * @author ivantotov */ -public final class Q00219_TestimonyOfFate extends Quest -{ +public final class Q00219_TestimonyOfFate extends Quest { // NPCs private static final int MAGISTER_ROA = 30114; private static final int WAREHOUSE_KEEPER_NORMAN = 30210; @@ -99,8 +98,7 @@ public final class Q00219_TestimonyOfFate extends Quest // Misc private static final int MIN_LEVEL = 37; - public Q00219_TestimonyOfFate() - { + public Q00219_TestimonyOfFate() { super(219, Q00219_TestimonyOfFate.class.getSimpleName(), "Testimony Of Fate"); addStartNpc(MAGISTER_KAIRA); addTalkId(MAGISTER_KAIRA, MAGISTER_ROA, WAREHOUSE_KEEPER_NORMAN, TETRARCH_THIFIELL, ARKENIA, MASTER_IXIA, ALDERS_SPIRIT, BROTHER_METHEUS, BLOODY_PIXY, BLIGHT_TREANT); @@ -109,32 +107,24 @@ public final class Q00219_TestimonyOfFate extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (qs.isCreated()) - { + switch (event) { + case "ACCEPT": { + if (qs.isCreated()) { qs.startQuest(); playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); giveItems(player, KAIRAS_LETTER, 1); - if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) - { + if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) { giveItems(player, DIMENSIONAL_DIAMOND, 98); player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1); htmltext = "30476-05a.htm"; - } - else - { + } else { htmltext = "30476-05.htm"; } } @@ -145,15 +135,12 @@ public final class Q00219_TestimonyOfFate extends Quest case "30476-14.html": case "30114-02.html": case "30114-03.html": - case "30463-02a.html": - { + case "30463-02a.html": { htmltext = event; break; } - case "30476-12.html": - { - if (hasQuestItems(player, REVELATIONS_MANUSCRIPT)) - { + case "30476-12.html": { + if (hasQuestItems(player, REVELATIONS_MANUSCRIPT)) { takeItems(player, REVELATIONS_MANUSCRIPT, 1); giveItems(player, KAIRAS_RECOMMENDATION, 1); qs.setCond(15, true); @@ -161,10 +148,8 @@ public final class Q00219_TestimonyOfFate extends Quest } break; } - case "30114-04.html": - { - if (hasQuestItems(player, ALDERS_SKULL2)) - { + case "30114-04.html": { + if (hasQuestItems(player, ALDERS_SKULL2)) { takeItems(player, ALDERS_SKULL2, 1); giveItems(player, ALDERS_RECEIPT, 1); qs.setCond(12, true); @@ -172,10 +157,8 @@ public final class Q00219_TestimonyOfFate extends Quest } break; } - case "30419-02.html": - { - if (hasQuestItems(player, THIFIELLS_LETTER)) - { + case "30419-02.html": { + if (hasQuestItems(player, THIFIELLS_LETTER)) { takeItems(player, THIFIELLS_LETTER, 1); giveItems(player, ARKENIAS_NOTE, 1); qs.setCond(17, true); @@ -183,10 +166,8 @@ public final class Q00219_TestimonyOfFate extends Quest } break; } - case "30419-05.html": - { - if (hasQuestItems(player, ARKENIAS_NOTE, RED_FAIRY_DUST, BLIGHT_TREANT_SAP)) - { + case "30419-05.html": { + if (hasQuestItems(player, ARKENIAS_NOTE, RED_FAIRY_DUST, BLIGHT_TREANT_SAP)) { takeItems(player, ARKENIAS_NOTE, 1); takeItems(player, RED_FAIRY_DUST, 1); takeItems(player, BLIGHT_TREANT_SAP, 1); @@ -196,14 +177,12 @@ public final class Q00219_TestimonyOfFate extends Quest } break; } - case "31845-02.html": - { + case "31845-02.html": { giveItems(player, PIXY_GARNET, 1); htmltext = event; break; } - case "31850-02.html": - { + case "31850-02.html": { giveItems(player, TIMIRIRAN_SEED, 1); htmltext = event; break; @@ -213,17 +192,12 @@ public final class Q00219_TestimonyOfFate extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case HANGMAN_TREE: - { - if (hasQuestItems(killer, METHEUSS_FUNERAL_JAR) && !hasQuestItems(killer, KASANDRAS_REMAINS)) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case HANGMAN_TREE: { + if (hasQuestItems(killer, METHEUSS_FUNERAL_JAR) && !hasQuestItems(killer, KASANDRAS_REMAINS)) { takeItems(killer, METHEUSS_FUNERAL_JAR, 1); giveItems(killer, KASANDRAS_REMAINS, 1); qs.setCond(3, true); @@ -232,42 +206,30 @@ public final class Q00219_TestimonyOfFate extends Quest case MARSH_STAKATO: case MARSH_STAKATO_WORKER: case MARSH_STAKATO_SOLDIER: - case MARSH_STAKATO_DRONE: - { - if (hasQuestItems(killer, IXIAS_LIST) && (getQuestItemsCount(killer, NIGHTSHADE_ROOT) < 10)) - { - if (getQuestItemsCount(killer, NIGHTSHADE_ROOT) == 9) - { + case MARSH_STAKATO_DRONE: { + if (hasQuestItems(killer, IXIAS_LIST) && (getQuestItemsCount(killer, NIGHTSHADE_ROOT) < 10)) { + if (getQuestItemsCount(killer, NIGHTSHADE_ROOT) == 9) { giveItems(killer, NIGHTSHADE_ROOT, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if ((getQuestItemsCount(killer, MEDUSAS_ICHOR) >= 10) && (getQuestItemsCount(killer, MARSH_SPIDER_FLUIDS) >= 10) && (getQuestItemsCount(killer, DEAD_SEEKER_DUNG) >= 10) && (getQuestItemsCount(killer, TYRANTS_BLOOD) >= 10)) - { + if ((getQuestItemsCount(killer, MEDUSAS_ICHOR) >= 10) && (getQuestItemsCount(killer, MARSH_SPIDER_FLUIDS) >= 10) && (getQuestItemsCount(killer, DEAD_SEEKER_DUNG) >= 10) && (getQuestItemsCount(killer, TYRANTS_BLOOD) >= 10)) { qs.setCond(7); } - } - else - { + } else { giveItems(killer, NIGHTSHADE_ROOT, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case MEDUSA: - { - if (hasQuestItems(killer, IXIAS_LIST) && (getQuestItemsCount(killer, MEDUSAS_ICHOR) < 10)) - { - if (getQuestItemsCount(killer, MEDUSAS_ICHOR) == 9) - { + case MEDUSA: { + if (hasQuestItems(killer, IXIAS_LIST) && (getQuestItemsCount(killer, MEDUSAS_ICHOR) < 10)) { + if (getQuestItemsCount(killer, MEDUSAS_ICHOR) == 9) { giveItems(killer, MEDUSAS_ICHOR, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if ((getQuestItemsCount(killer, MARSH_SPIDER_FLUIDS) >= 10) && (getQuestItemsCount(killer, DEAD_SEEKER_DUNG) >= 10) && (getQuestItemsCount(killer, TYRANTS_BLOOD) >= 10) && (getQuestItemsCount(killer, NIGHTSHADE_ROOT) >= 10)) - { + if ((getQuestItemsCount(killer, MARSH_SPIDER_FLUIDS) >= 10) && (getQuestItemsCount(killer, DEAD_SEEKER_DUNG) >= 10) && (getQuestItemsCount(killer, TYRANTS_BLOOD) >= 10) && (getQuestItemsCount(killer, NIGHTSHADE_ROOT) >= 10)) { qs.setCond(7); } - } - else - { + } else { giveItems(killer, MEDUSAS_ICHOR, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -275,121 +237,89 @@ public final class Q00219_TestimonyOfFate extends Quest break; } case TYRANT: - case TYRANT_KINGPIN: - { - if (hasQuestItems(killer, IXIAS_LIST) && (getQuestItemsCount(killer, TYRANTS_BLOOD) < 10)) - { - if (getQuestItemsCount(killer, TYRANTS_BLOOD) == 9) - { + case TYRANT_KINGPIN: { + if (hasQuestItems(killer, IXIAS_LIST) && (getQuestItemsCount(killer, TYRANTS_BLOOD) < 10)) { + if (getQuestItemsCount(killer, TYRANTS_BLOOD) == 9) { giveItems(killer, TYRANTS_BLOOD, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if ((getQuestItemsCount(killer, MEDUSAS_ICHOR) >= 10) && (getQuestItemsCount(killer, MARSH_SPIDER_FLUIDS) >= 10) && (getQuestItemsCount(killer, DEAD_SEEKER_DUNG) >= 10) && (getQuestItemsCount(killer, NIGHTSHADE_ROOT) >= 10)) - { + if ((getQuestItemsCount(killer, MEDUSAS_ICHOR) >= 10) && (getQuestItemsCount(killer, MARSH_SPIDER_FLUIDS) >= 10) && (getQuestItemsCount(killer, DEAD_SEEKER_DUNG) >= 10) && (getQuestItemsCount(killer, NIGHTSHADE_ROOT) >= 10)) { qs.setCond(7); } - } - else - { + } else { giveItems(killer, TYRANTS_BLOOD, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case DEAD_SEEKER: - { - if (hasQuestItems(killer, IXIAS_LIST) && (getQuestItemsCount(killer, DEAD_SEEKER_DUNG) < 10)) - { - if (getQuestItemsCount(killer, DEAD_SEEKER_DUNG) == 9) - { + case DEAD_SEEKER: { + if (hasQuestItems(killer, IXIAS_LIST) && (getQuestItemsCount(killer, DEAD_SEEKER_DUNG) < 10)) { + if (getQuestItemsCount(killer, DEAD_SEEKER_DUNG) == 9) { giveItems(killer, DEAD_SEEKER_DUNG, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if ((getQuestItemsCount(killer, MEDUSAS_ICHOR) >= 10) && (getQuestItemsCount(killer, MARSH_SPIDER_FLUIDS) >= 10) && (getQuestItemsCount(killer, TYRANTS_BLOOD) >= 10) && (getQuestItemsCount(killer, NIGHTSHADE_ROOT) >= 10)) - { + if ((getQuestItemsCount(killer, MEDUSAS_ICHOR) >= 10) && (getQuestItemsCount(killer, MARSH_SPIDER_FLUIDS) >= 10) && (getQuestItemsCount(killer, TYRANTS_BLOOD) >= 10) && (getQuestItemsCount(killer, NIGHTSHADE_ROOT) >= 10)) { qs.setCond(7); } - } - else - { + } else { giveItems(killer, DEAD_SEEKER_DUNG, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case MARSH_SPIDER: - { - if (hasQuestItems(killer, IXIAS_LIST) && (getQuestItemsCount(killer, MARSH_SPIDER_FLUIDS) < 10)) - { - if (getQuestItemsCount(killer, MARSH_SPIDER_FLUIDS) == 9) - { + case MARSH_SPIDER: { + if (hasQuestItems(killer, IXIAS_LIST) && (getQuestItemsCount(killer, MARSH_SPIDER_FLUIDS) < 10)) { + if (getQuestItemsCount(killer, MARSH_SPIDER_FLUIDS) == 9) { giveItems(killer, MARSH_SPIDER_FLUIDS, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if ((getQuestItemsCount(killer, MEDUSAS_ICHOR) >= 10) && (getQuestItemsCount(killer, DEAD_SEEKER_DUNG) >= 10) && (getQuestItemsCount(killer, TYRANTS_BLOOD) >= 10) && (getQuestItemsCount(killer, NIGHTSHADE_ROOT) >= 10)) - { + if ((getQuestItemsCount(killer, MEDUSAS_ICHOR) >= 10) && (getQuestItemsCount(killer, DEAD_SEEKER_DUNG) >= 10) && (getQuestItemsCount(killer, TYRANTS_BLOOD) >= 10) && (getQuestItemsCount(killer, NIGHTSHADE_ROOT) >= 10)) { qs.setCond(7); } - } - else - { + } else { giveItems(killer, MARSH_SPIDER_FLUIDS, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case BREKA_ORC_OVERLORD: - { - if (hasQuestItems(killer, PALUS_CHARM, ARKENIAS_NOTE, PIXY_GARNET) && !hasQuestItems(killer, RED_FAIRY_DUST, BREKA_OVERLORD_SKULL)) - { - if (!hasQuestItems(killer, BREKA_OVERLORD_SKULL)) - { + case BREKA_ORC_OVERLORD: { + if (hasQuestItems(killer, PALUS_CHARM, ARKENIAS_NOTE, PIXY_GARNET) && !hasQuestItems(killer, RED_FAIRY_DUST, BREKA_OVERLORD_SKULL)) { + if (!hasQuestItems(killer, BREKA_OVERLORD_SKULL)) { giveItems(killer, BREKA_OVERLORD_SKULL, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); } } break; } - case GRANDIS: - { - if (hasQuestItems(killer, PALUS_CHARM, ARKENIAS_NOTE, PIXY_GARNET) && !hasQuestItems(killer, RED_FAIRY_DUST, GRANDISS_SKULL)) - { - if (!hasQuestItems(killer, GRANDISS_SKULL)) - { + case GRANDIS: { + if (hasQuestItems(killer, PALUS_CHARM, ARKENIAS_NOTE, PIXY_GARNET) && !hasQuestItems(killer, RED_FAIRY_DUST, GRANDISS_SKULL)) { + if (!hasQuestItems(killer, GRANDISS_SKULL)) { giveItems(killer, GRANDISS_SKULL, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); } } break; } - case LETO_LIZARDMAN_OVERLORD: - { - if (hasQuestItems(killer, PALUS_CHARM, ARKENIAS_NOTE, PIXY_GARNET) && !hasQuestItems(killer, RED_FAIRY_DUST, LETO_OVERLORD_SKULL)) - { - if (!hasQuestItems(killer, LETO_OVERLORD_SKULL)) - { + case LETO_LIZARDMAN_OVERLORD: { + if (hasQuestItems(killer, PALUS_CHARM, ARKENIAS_NOTE, PIXY_GARNET) && !hasQuestItems(killer, RED_FAIRY_DUST, LETO_OVERLORD_SKULL)) { + if (!hasQuestItems(killer, LETO_OVERLORD_SKULL)) { giveItems(killer, LETO_OVERLORD_SKULL, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); } } break; } - case KARUL_BUGBEAR: - { - if (hasQuestItems(killer, PALUS_CHARM, ARKENIAS_NOTE, PIXY_GARNET) && !hasQuestItems(killer, RED_FAIRY_DUST, KARUL_BUGBEAR_SKULL)) - { - if (!hasQuestItems(killer, KARUL_BUGBEAR_SKULL)) - { + case KARUL_BUGBEAR: { + if (hasQuestItems(killer, PALUS_CHARM, ARKENIAS_NOTE, PIXY_GARNET) && !hasQuestItems(killer, RED_FAIRY_DUST, KARUL_BUGBEAR_SKULL)) { + if (!hasQuestItems(killer, KARUL_BUGBEAR_SKULL)) { giveItems(killer, KARUL_BUGBEAR_SKULL, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); } } break; } - case BLACK_WILLOW_LURKER: - { - if (hasQuestItems(killer, PALUS_CHARM, ARKENIAS_NOTE, TIMIRIRAN_SEED) && !hasQuestItems(killer, BLIGHT_TREANT_SAP, BLACK_WILLOW_LEAF)) - { + case BLACK_WILLOW_LURKER: { + if (hasQuestItems(killer, PALUS_CHARM, ARKENIAS_NOTE, TIMIRIRAN_SEED) && !hasQuestItems(killer, BLIGHT_TREANT_SAP, BLACK_WILLOW_LEAF)) { giveItems(killer, BLACK_WILLOW_LEAF, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); } @@ -401,139 +331,91 @@ public final class Q00219_TestimonyOfFate extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == MAGISTER_KAIRA) - { - if (player.getRace() == Race.DARK_ELF) - { - if ((player.getLevel() >= MIN_LEVEL) && player.isInCategory(CategoryType.DELF_2ND_GROUP)) - { + if (qs.isCreated()) { + if (npc.getId() == MAGISTER_KAIRA) { + if (player.getRace() == Race.DARK_ELF) { + if ((player.getLevel() >= MIN_LEVEL) && player.isInCategory(CategoryType.DELF_2ND_GROUP)) { htmltext = "30476-03.htm"; - } - else if (player.getLevel() >= MIN_LEVEL) - { + } else if (player.getLevel() >= MIN_LEVEL) { htmltext = "30476-01a.html"; - } - else - { + } else { htmltext = "30476-02.html"; } - } - else - { + } else { htmltext = "30476-01.html"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case MAGISTER_KAIRA: - { - if (hasQuestItems(player, KAIRAS_LETTER)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case MAGISTER_KAIRA: { + if (hasQuestItems(player, KAIRAS_LETTER)) { htmltext = "30476-06.html"; - } - else if (hasAtLeastOneQuestItem(player, METHEUSS_FUNERAL_JAR, KASANDRAS_REMAINS)) - { + } else if (hasAtLeastOneQuestItem(player, METHEUSS_FUNERAL_JAR, KASANDRAS_REMAINS)) { htmltext = "30476-07.html"; - } - else if (hasAtLeastOneQuestItem(player, HERBALISM_TEXTBOOK, IXIAS_LIST)) - { + } else if (hasAtLeastOneQuestItem(player, HERBALISM_TEXTBOOK, IXIAS_LIST)) { qs.setCond(5, true); htmltext = "30476-08.html"; - } - else if (hasQuestItems(player, ALDERS_SKULL1)) - { + } else if (hasQuestItems(player, ALDERS_SKULL1)) { takeItems(player, ALDERS_SKULL1, 1); giveItems(player, ALDERS_SKULL2, 1); addSpawn(ALDERS_SPIRIT, 78977, 149036, -3597, 0, false, 200000, false); qs.setCond(10, true); htmltext = "30476-09.html"; - } - else if (hasAtLeastOneQuestItem(player, ALDERS_SKULL2, ALDERS_RECEIPT)) - { + } else if (hasAtLeastOneQuestItem(player, ALDERS_SKULL2, ALDERS_RECEIPT)) { qs.setCond(11, true); htmltext = "30476-10.html"; - } - else if (hasQuestItems(player, REVELATIONS_MANUSCRIPT)) - { + } else if (hasQuestItems(player, REVELATIONS_MANUSCRIPT)) { htmltext = "30476-11.html"; - } - else if (hasQuestItems(player, KAIRAS_INSTRUCTIONS)) - { + } else if (hasQuestItems(player, KAIRAS_INSTRUCTIONS)) { giveItems(player, KAIRAS_RECOMMENDATION, 1); takeItems(player, KAIRAS_INSTRUCTIONS, 1); qs.setCond(15, true); htmltext = "30476-15.html"; - } - else if (hasQuestItems(player, KAIRAS_RECOMMENDATION)) - { + } else if (hasQuestItems(player, KAIRAS_RECOMMENDATION)) { htmltext = "30476-16.html"; - } - else if (hasQuestItems(player, PALUS_CHARM)) - { + } else if (hasQuestItems(player, PALUS_CHARM)) { htmltext = "30476-17.html"; } break; } - case BROTHER_METHEUS: - { - if (hasQuestItems(player, KAIRAS_LETTER)) - { + case BROTHER_METHEUS: { + if (hasQuestItems(player, KAIRAS_LETTER)) { takeItems(player, KAIRAS_LETTER, 1); giveItems(player, METHEUSS_FUNERAL_JAR, 1); qs.setCond(2, true); htmltext = "30614-01.html"; - } - else if (hasQuestItems(player, METHEUSS_FUNERAL_JAR) && !hasQuestItems(player, KASANDRAS_REMAINS)) - { + } else if (hasQuestItems(player, METHEUSS_FUNERAL_JAR) && !hasQuestItems(player, KASANDRAS_REMAINS)) { htmltext = "30614-02.html"; - } - else if (hasQuestItems(player, KASANDRAS_REMAINS) && !hasQuestItems(player, METHEUSS_FUNERAL_JAR)) - { + } else if (hasQuestItems(player, KASANDRAS_REMAINS) && !hasQuestItems(player, METHEUSS_FUNERAL_JAR)) { takeItems(player, KASANDRAS_REMAINS, 1); giveItems(player, HERBALISM_TEXTBOOK, 1); qs.setCond(4, true); htmltext = "30614-03.html"; - } - else if (hasAtLeastOneQuestItem(player, HERBALISM_TEXTBOOK, IXIAS_LIST)) - { + } else if (hasAtLeastOneQuestItem(player, HERBALISM_TEXTBOOK, IXIAS_LIST)) { qs.setCond(5, true); htmltext = "30614-04.html"; - } - else if (hasQuestItems(player, BELLADONNA)) - { + } else if (hasQuestItems(player, BELLADONNA)) { takeItems(player, BELLADONNA, 1); giveItems(player, ALDERS_SKULL1, 1); qs.setCond(9, true); htmltext = "30614-05.html"; - } - else if (hasAtLeastOneQuestItem(player, ALDERS_SKULL1, ALDERS_SKULL2, ALDERS_RECEIPT, REVELATIONS_MANUSCRIPT, KAIRAS_INSTRUCTIONS, KAIRAS_RECOMMENDATION)) - { + } else if (hasAtLeastOneQuestItem(player, ALDERS_SKULL1, ALDERS_SKULL2, ALDERS_RECEIPT, REVELATIONS_MANUSCRIPT, KAIRAS_INSTRUCTIONS, KAIRAS_RECOMMENDATION)) { htmltext = "30614-06.html"; } break; } - case MASTER_IXIA: - { - if (hasQuestItems(player, HERBALISM_TEXTBOOK)) - { + case MASTER_IXIA: { + if (hasQuestItems(player, HERBALISM_TEXTBOOK)) { takeItems(player, HERBALISM_TEXTBOOK, 1); giveItems(player, IXIAS_LIST, 1); qs.setCond(6, true); htmltext = "30463-01.html"; - } - else if (hasQuestItems(player, IXIAS_LIST)) - { - if ((getQuestItemsCount(player, MEDUSAS_ICHOR) >= 10) && (getQuestItemsCount(player, MARSH_SPIDER_FLUIDS) >= 10) && (getQuestItemsCount(player, DEAD_SEEKER_DUNG) >= 10) && (getQuestItemsCount(player, TYRANTS_BLOOD) >= 10) && (getQuestItemsCount(player, NIGHTSHADE_ROOT) >= 10)) - { + } else if (hasQuestItems(player, IXIAS_LIST)) { + if ((getQuestItemsCount(player, MEDUSAS_ICHOR) >= 10) && (getQuestItemsCount(player, MARSH_SPIDER_FLUIDS) >= 10) && (getQuestItemsCount(player, DEAD_SEEKER_DUNG) >= 10) && (getQuestItemsCount(player, TYRANTS_BLOOD) >= 10) + && (getQuestItemsCount(player, NIGHTSHADE_ROOT) >= 10)) { takeItems(player, IXIAS_LIST, 1); takeItems(player, MEDUSAS_ICHOR, -1); takeItems(player, MARSH_SPIDER_FLUIDS, -1); @@ -543,74 +425,49 @@ public final class Q00219_TestimonyOfFate extends Quest giveItems(player, BELLADONNA, 1); qs.setCond(8, true); htmltext = "30463-03.html"; - } - else - { + } else { htmltext = "30463-02.html"; } - } - else if (hasQuestItems(player, BELLADONNA)) - { + } else if (hasQuestItems(player, BELLADONNA)) { htmltext = "30463-04.html"; - } - else if (hasAtLeastOneQuestItem(player, ALDERS_SKULL1, ALDERS_SKULL2, ALDERS_RECEIPT, REVELATIONS_MANUSCRIPT, KAIRAS_INSTRUCTIONS, KAIRAS_RECOMMENDATION)) - { + } else if (hasAtLeastOneQuestItem(player, ALDERS_SKULL1, ALDERS_SKULL2, ALDERS_RECEIPT, REVELATIONS_MANUSCRIPT, KAIRAS_INSTRUCTIONS, KAIRAS_RECOMMENDATION)) { htmltext = "30463-05.html"; } break; } - case MAGISTER_ROA: - { - if (hasQuestItems(player, ALDERS_SKULL2)) - { + case MAGISTER_ROA: { + if (hasQuestItems(player, ALDERS_SKULL2)) { htmltext = "30114-01.html"; - } - else if (hasQuestItems(player, ALDERS_RECEIPT)) - { + } else if (hasQuestItems(player, ALDERS_RECEIPT)) { htmltext = "30114-05.html"; - } - else if (hasAtLeastOneQuestItem(player, REVELATIONS_MANUSCRIPT, KAIRAS_INSTRUCTIONS, KAIRAS_RECOMMENDATION)) - { + } else if (hasAtLeastOneQuestItem(player, REVELATIONS_MANUSCRIPT, KAIRAS_INSTRUCTIONS, KAIRAS_RECOMMENDATION)) { htmltext = "30114-06.html"; } break; } - case WAREHOUSE_KEEPER_NORMAN: - { - if (hasQuestItems(player, ALDERS_RECEIPT)) - { + case WAREHOUSE_KEEPER_NORMAN: { + if (hasQuestItems(player, ALDERS_RECEIPT)) { takeItems(player, ALDERS_RECEIPT, 1); giveItems(player, REVELATIONS_MANUSCRIPT, 1); qs.setCond(13, true); htmltext = "30210-01.html"; - } - else if (hasQuestItems(player, REVELATIONS_MANUSCRIPT)) - { + } else if (hasQuestItems(player, REVELATIONS_MANUSCRIPT)) { htmltext = "30210-02.html"; } } - case TETRARCH_THIFIELL: - { - if (hasQuestItems(player, KAIRAS_RECOMMENDATION)) - { + case TETRARCH_THIFIELL: { + if (hasQuestItems(player, KAIRAS_RECOMMENDATION)) { takeItems(player, KAIRAS_RECOMMENDATION, 1); giveItems(player, PALUS_CHARM, 1); giveItems(player, THIFIELLS_LETTER, 1); qs.setCond(16, true); htmltext = "30358-01.html"; - } - else if (hasQuestItems(player, PALUS_CHARM)) - { - if (hasQuestItems(player, THIFIELLS_LETTER)) - { + } else if (hasQuestItems(player, PALUS_CHARM)) { + if (hasQuestItems(player, THIFIELLS_LETTER)) { htmltext = "30358-02.html"; - } - else if (hasQuestItems(player, ARKENIAS_NOTE)) - { + } else if (hasQuestItems(player, ARKENIAS_NOTE)) { htmltext = "30358-03.html"; - } - else if (hasQuestItems(player, ARKENIAS_LETTER)) - { + } else if (hasQuestItems(player, ARKENIAS_LETTER)) { giveAdena(player, 247708, true); giveItems(player, MARK_OF_FATE, 1); addExpAndSp(player, 1365470, 91124); @@ -621,51 +478,33 @@ public final class Q00219_TestimonyOfFate extends Quest } break; } - case ARKENIA: - { - if (hasQuestItems(player, PALUS_CHARM)) - { - if (hasQuestItems(player, THIFIELLS_LETTER)) - { + case ARKENIA: { + if (hasQuestItems(player, PALUS_CHARM)) { + if (hasQuestItems(player, THIFIELLS_LETTER)) { htmltext = "30419-01.html"; - } - else if (hasQuestItems(player, ARKENIAS_NOTE) && !hasQuestItems(player, RED_FAIRY_DUST, BLIGHT_TREANT_SAP)) - { + } else if (hasQuestItems(player, ARKENIAS_NOTE) && !hasQuestItems(player, RED_FAIRY_DUST, BLIGHT_TREANT_SAP)) { htmltext = "30419-03.html"; - } - else if (hasQuestItems(player, ARKENIAS_NOTE, RED_FAIRY_DUST, BLIGHT_TREANT_SAP)) - { + } else if (hasQuestItems(player, ARKENIAS_NOTE, RED_FAIRY_DUST, BLIGHT_TREANT_SAP)) { htmltext = "30419-04.html"; - } - else if (hasQuestItems(player, ARKENIAS_LETTER)) - { + } else if (hasQuestItems(player, ARKENIAS_LETTER)) { htmltext = "30419-06.html"; } } break; } - case ALDERS_SPIRIT: - { - if (hasAtLeastOneQuestItem(player, ALDERS_SKULL1, ALDERS_SKULL2)) - { + case ALDERS_SPIRIT: { + if (hasAtLeastOneQuestItem(player, ALDERS_SKULL1, ALDERS_SKULL2)) { htmltext = "30613-01.html"; } break; } - case BLOODY_PIXY: - { - if (hasQuestItems(player, PALUS_CHARM, ARKENIAS_NOTE)) - { - if (!hasAtLeastOneQuestItem(player, RED_FAIRY_DUST, PIXY_GARNET)) - { + case BLOODY_PIXY: { + if (hasQuestItems(player, PALUS_CHARM, ARKENIAS_NOTE)) { + if (!hasAtLeastOneQuestItem(player, RED_FAIRY_DUST, PIXY_GARNET)) { htmltext = "31845-01.html"; - } - else if (!hasQuestItems(player, RED_FAIRY_DUST) && hasQuestItems(player, PIXY_GARNET) && !hasAtLeastOneQuestItem(player, GRANDISS_SKULL, KARUL_BUGBEAR_SKULL, BREKA_OVERLORD_SKULL, LETO_OVERLORD_SKULL)) - { + } else if (!hasQuestItems(player, RED_FAIRY_DUST) && hasQuestItems(player, PIXY_GARNET) && !hasAtLeastOneQuestItem(player, GRANDISS_SKULL, KARUL_BUGBEAR_SKULL, BREKA_OVERLORD_SKULL, LETO_OVERLORD_SKULL)) { htmltext = "31845-03.html"; - } - else if (!hasQuestItems(player, RED_FAIRY_DUST) && hasQuestItems(player, PIXY_GARNET, GRANDISS_SKULL, KARUL_BUGBEAR_SKULL, BREKA_OVERLORD_SKULL, LETO_OVERLORD_SKULL)) - { + } else if (!hasQuestItems(player, RED_FAIRY_DUST) && hasQuestItems(player, PIXY_GARNET, GRANDISS_SKULL, KARUL_BUGBEAR_SKULL, BREKA_OVERLORD_SKULL, LETO_OVERLORD_SKULL)) { takeItems(player, PIXY_GARNET, 1); takeItems(player, GRANDISS_SKULL, 1); takeItems(player, KARUL_BUGBEAR_SKULL, 1); @@ -673,46 +512,32 @@ public final class Q00219_TestimonyOfFate extends Quest takeItems(player, LETO_OVERLORD_SKULL, 1); giveItems(player, RED_FAIRY_DUST, 1); htmltext = "31845-04.html"; - } - else if (!hasQuestItems(player, PIXY_GARNET) && hasQuestItems(player, PALUS_CHARM, ARKENIAS_NOTE, RED_FAIRY_DUST)) - { + } else if (!hasQuestItems(player, PIXY_GARNET) && hasQuestItems(player, PALUS_CHARM, ARKENIAS_NOTE, RED_FAIRY_DUST)) { htmltext = "31845-05.html"; } } break; } - case BLIGHT_TREANT: - { - if (hasQuestItems(player, PALUS_CHARM, ARKENIAS_NOTE)) - { - if (!hasAtLeastOneQuestItem(player, BLIGHT_TREANT_SAP, TIMIRIRAN_SEED)) - { + case BLIGHT_TREANT: { + if (hasQuestItems(player, PALUS_CHARM, ARKENIAS_NOTE)) { + if (!hasAtLeastOneQuestItem(player, BLIGHT_TREANT_SAP, TIMIRIRAN_SEED)) { htmltext = "31850-01.html"; - } - else if (hasQuestItems(player, TIMIRIRAN_SEED) && !hasAtLeastOneQuestItem(player, BLIGHT_TREANT_SAP, BLACK_WILLOW_LEAF)) - { + } else if (hasQuestItems(player, TIMIRIRAN_SEED) && !hasAtLeastOneQuestItem(player, BLIGHT_TREANT_SAP, BLACK_WILLOW_LEAF)) { htmltext = "31850-03.html"; - } - else if (hasQuestItems(player, TIMIRIRAN_SEED, BLACK_WILLOW_LEAF) && !hasQuestItems(player, BLIGHT_TREANT_SAP)) - { + } else if (hasQuestItems(player, TIMIRIRAN_SEED, BLACK_WILLOW_LEAF) && !hasQuestItems(player, BLIGHT_TREANT_SAP)) { takeItems(player, TIMIRIRAN_SEED, 1); takeItems(player, BLACK_WILLOW_LEAF, 1); giveItems(player, BLIGHT_TREANT_SAP, 1); htmltext = "31850-04.html"; - } - else if (hasQuestItems(player, BLIGHT_TREANT_SAP) && !hasQuestItems(player, TIMIRIRAN_SEED)) - { + } else if (hasQuestItems(player, BLIGHT_TREANT_SAP) && !hasQuestItems(player, TIMIRIRAN_SEED)) { htmltext = "31850-05.html"; } } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == MAGISTER_KAIRA) - { + } else if (qs.isCompleted()) { + if (npc.getId() == MAGISTER_KAIRA) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00220_TestimonyOfGlory/Q00220_TestimonyOfGlory.java b/src/main/java/com/l2jserver/datapack/quests/Q00220_TestimonyOfGlory/Q00220_TestimonyOfGlory.java index a6dd01f4c0..52715de4ee 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00220_TestimonyOfGlory/Q00220_TestimonyOfGlory.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00220_TestimonyOfGlory/Q00220_TestimonyOfGlory.java @@ -35,8 +35,7 @@ import com.l2jserver.gameserver.util.Util; * Testimony Of Glory (220) * @author ivantotov */ -public final class Q00220_TestimonyOfGlory extends Quest -{ +public final class Q00220_TestimonyOfGlory extends Quest { // NPCs private static final int PREFECT_KASMAN = 30501; private static final int PREFECT_VOKIAN = 30514; @@ -112,8 +111,7 @@ public final class Q00220_TestimonyOfGlory extends Quest // Misc private static final int MIN_LEVEL = 37; - public Q00220_TestimonyOfGlory() - { + public Q00220_TestimonyOfGlory() { super(220, Q00220_TestimonyOfGlory.class.getSimpleName(), "Testimony Of Glory"); addStartNpc(PREFECT_VOKIAN); addTalkId(PREFECT_VOKIAN, PREFECT_KASMAN, SEER_MANAKIA, FLAME_LORD_KAKAI, SEER_TANAPI, BREKA_CHIEF_VOLTAR, ENKU_CHIEF_KEPRA, TUREK_CHIEF_BURAI, LEUNT_CHIEF_HARAK, VUKU_CHIEF_DRIKO, GANDI_CHIEF_CHIANTA); @@ -123,32 +121,24 @@ public final class Q00220_TestimonyOfGlory extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (qs.isCreated()) - { + switch (event) { + case "ACCEPT": { + if (qs.isCreated()) { qs.startQuest(); playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); giveItems(player, VOKIANS_ORDER, 1); - if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) - { + if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) { giveItems(player, DIMENSIONAL_DIAMOND, 109); player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1); htmltext = "30514-05a.htm"; - } - else - { + } else { htmltext = "30514-05.htm"; } } @@ -161,110 +151,77 @@ public final class Q00220_TestimonyOfGlory extends Quest case "30616-03.html": case "30642-02.html": case "30642-06.html": - case "30642-08.html": - { + case "30642-08.html": { htmltext = event; break; } - case "30501-02.html": - { - if (hasQuestItems(player, SCEPTER_OF_VUKU)) - { + case "30501-02.html": { + if (hasQuestItems(player, SCEPTER_OF_VUKU)) { htmltext = event; - } - else if (!hasAtLeastOneQuestItem(player, SCEPTER_OF_VUKU, KASMANS_1ST_LETTER)) - { + } else if (!hasAtLeastOneQuestItem(player, SCEPTER_OF_VUKU, KASMANS_1ST_LETTER)) { giveItems(player, KASMANS_1ST_LETTER, 1); player.getRadar().addMarker(-2150, 124443, -3724); htmltext = "30501-03.html"; - } - else if (!hasQuestItems(player, SCEPTER_OF_VUKU) && hasAtLeastOneQuestItem(player, KASMANS_1ST_LETTER, DRIKOS_CONTRACT)) - { + } else if (!hasQuestItems(player, SCEPTER_OF_VUKU) && hasAtLeastOneQuestItem(player, KASMANS_1ST_LETTER, DRIKOS_CONTRACT)) { player.getRadar().addMarker(-2150, 124443, -3724); htmltext = "30501-04.html"; } break; } - case "30501-05.html": - { - if (hasQuestItems(player, SCEPTER_OF_TUREK)) - { + case "30501-05.html": { + if (hasQuestItems(player, SCEPTER_OF_TUREK)) { htmltext = event; - } - else if (!hasAtLeastOneQuestItem(player, SCEPTER_OF_TUREK, KASMANS_2ND_LETTER)) - { + } else if (!hasAtLeastOneQuestItem(player, SCEPTER_OF_TUREK, KASMANS_2ND_LETTER)) { giveItems(player, KASMANS_2ND_LETTER, 1); player.getRadar().addMarker(-94294, 110818, -3563); htmltext = "30501-06.html"; - } - else if (!hasQuestItems(player, SCEPTER_OF_TUREK) && hasQuestItems(player, KASMANS_2ND_LETTER)) - { + } else if (!hasQuestItems(player, SCEPTER_OF_TUREK) && hasQuestItems(player, KASMANS_2ND_LETTER)) { player.getRadar().addMarker(-94294, 110818, -3563); htmltext = "30501-07.html"; } break; } - case "30501-08.html": - { - if (hasQuestItems(player, SCEPTER_OF_TUNATH)) - { + case "30501-08.html": { + if (hasQuestItems(player, SCEPTER_OF_TUNATH)) { htmltext = event; - } - else if (!hasAtLeastOneQuestItem(player, SCEPTER_OF_TUNATH, KASMANS_3RD_LETTER)) - { + } else if (!hasAtLeastOneQuestItem(player, SCEPTER_OF_TUNATH, KASMANS_3RD_LETTER)) { giveItems(player, KASMANS_3RD_LETTER, 1); player.getRadar().addMarker(-55217, 200628, -3724); htmltext = "30501-09.html"; - } - else if (!hasQuestItems(player, SCEPTER_OF_TUNATH) && hasQuestItems(player, KASMANS_3RD_LETTER)) - { + } else if (!hasQuestItems(player, SCEPTER_OF_TUNATH) && hasQuestItems(player, KASMANS_3RD_LETTER)) { player.getRadar().addMarker(-55217, 200628, -3724); htmltext = "30501-10.html"; } break; } - case "30515-04.html": - { - if (!hasQuestItems(player, SCEPTER_OF_BREKA) && hasQuestItems(player, MANAKIA_1ST_LETTER)) - { + case "30515-04.html": { + if (!hasQuestItems(player, SCEPTER_OF_BREKA) && hasQuestItems(player, MANAKIA_1ST_LETTER)) { player.getRadar().addMarker(80100, 119991, -2264); htmltext = event; - } - else if (hasQuestItems(player, SCEPTER_OF_BREKA)) - { + } else if (hasQuestItems(player, SCEPTER_OF_BREKA)) { htmltext = "30515-02.html"; - } - else if (!hasAtLeastOneQuestItem(player, SCEPTER_OF_BREKA, MANAKIA_1ST_LETTER)) - { + } else if (!hasAtLeastOneQuestItem(player, SCEPTER_OF_BREKA, MANAKIA_1ST_LETTER)) { giveItems(player, MANAKIA_1ST_LETTER, 1); player.getRadar().addMarker(80100, 119991, -2264); htmltext = "30515-03.html"; } break; } - case "30515-05.html": - { - if (hasQuestItems(player, SCEPTER_OF_ENKU)) - { + case "30515-05.html": { + if (hasQuestItems(player, SCEPTER_OF_ENKU)) { htmltext = event; - } - else if (!hasAtLeastOneQuestItem(player, SCEPTER_OF_ENKU, MANAKIA_2ND_LETTER)) - { + } else if (!hasAtLeastOneQuestItem(player, SCEPTER_OF_ENKU, MANAKIA_2ND_LETTER)) { giveItems(player, MANAKIA_2ND_LETTER, 1); player.getRadar().addMarker(12805, 189249, -3616); htmltext = "30515-06.html"; - } - else if (!hasQuestItems(player, SCEPTER_OF_ENKU) && hasQuestItems(player, MANAKIA_2ND_LETTER)) - { + } else if (!hasQuestItems(player, SCEPTER_OF_ENKU) && hasQuestItems(player, MANAKIA_2ND_LETTER)) { player.getRadar().addMarker(12805, 189249, -3616); htmltext = "30515-07.html"; } break; } - case "30571-03.html": - { - if (hasQuestItems(player, SCEPTER_BOX)) - { + case "30571-03.html": { + if (hasQuestItems(player, SCEPTER_BOX)) { takeItems(player, SCEPTER_BOX, 1); giveItems(player, TANAPIS_ORDER, 1); qs.setCond(9, true); @@ -272,10 +229,8 @@ public final class Q00220_TestimonyOfGlory extends Quest } break; } - case "30615-04.html": - { - if (hasQuestItems(player, MANAKIA_1ST_LETTER)) - { + case "30615-04.html": { + if (hasQuestItems(player, MANAKIA_1ST_LETTER)) { giveItems(player, GLOVE_OF_VOLTAR, 1); takeItems(player, MANAKIA_1ST_LETTER, 1); addAttackDesire(addSpawn(npc, PASHIKA_SON_OF_VOLTAR, npc, true, 200000), player); @@ -284,10 +239,8 @@ public final class Q00220_TestimonyOfGlory extends Quest } break; } - case "30616-04.html": - { - if (hasQuestItems(player, MANAKIA_2ND_LETTER)) - { + case "30616-04.html": { + if (hasQuestItems(player, MANAKIA_2ND_LETTER)) { giveItems(player, GLOVE_OF_KEPRA, 1); takeItems(player, MANAKIA_2ND_LETTER, 1); addAttackDesire(addSpawn(npc, ENKU_ORC_OVERLORD, npc, true, 200000), player); @@ -298,10 +251,8 @@ public final class Q00220_TestimonyOfGlory extends Quest } break; } - case "30617-03.html": - { - if (hasQuestItems(player, KASMANS_2ND_LETTER)) - { + case "30617-03.html": { + if (hasQuestItems(player, KASMANS_2ND_LETTER)) { giveItems(player, GLOVE_OF_BURAI, 1); takeItems(player, KASMANS_2ND_LETTER, 1); addAttackDesire(addSpawn(npc, MAKUM_BUGBEAR_THUG, npc, true, 200000), player); @@ -310,34 +261,27 @@ public final class Q00220_TestimonyOfGlory extends Quest } break; } - case "30618-03.html": - { - if (hasQuestItems(player, KASMANS_3RD_LETTER)) - { + case "30618-03.html": { + if (hasQuestItems(player, KASMANS_3RD_LETTER)) { giveItems(player, SCEPTER_OF_TUNATH, 1); takeItems(player, KASMANS_3RD_LETTER, 1); - if (hasQuestItems(player, SCEPTER_OF_TUREK, SCEPTER_OF_ENKU, SCEPTER_OF_BREKA, SCEPTER_OF_VUKU)) - { + if (hasQuestItems(player, SCEPTER_OF_TUREK, SCEPTER_OF_ENKU, SCEPTER_OF_BREKA, SCEPTER_OF_VUKU)) { qs.setCond(5, true); } htmltext = event; } break; } - case "30619-03.html": - { - if (hasQuestItems(player, KASMANS_1ST_LETTER)) - { + case "30619-03.html": { + if (hasQuestItems(player, KASMANS_1ST_LETTER)) { giveItems(player, DRIKOS_CONTRACT, 1); takeItems(player, KASMANS_1ST_LETTER, 1); htmltext = event; } break; } - case "30642-03.html": - { - if (hasQuestItems(player, VOKIANS_ORDER2)) - { + case "30642-03.html": { + if (hasQuestItems(player, VOKIANS_ORDER2)) { takeItems(player, VOKIANS_ORDER2, 1); giveItems(player, CHIANTA_1ST_ORDER, 1); qs.setCond(4, true); @@ -345,10 +289,8 @@ public final class Q00220_TestimonyOfGlory extends Quest } break; } - case "30642-07.html": - { - if (hasQuestItems(player, CHIANTA_1ST_ORDER, SCEPTER_OF_BREKA, SCEPTER_OF_VUKU, SCEPTER_OF_TUREK, SCEPTER_OF_TUNATH, SCEPTER_OF_ENKU)) - { + case "30642-07.html": { + if (hasQuestItems(player, CHIANTA_1ST_ORDER, SCEPTER_OF_BREKA, SCEPTER_OF_VUKU, SCEPTER_OF_TUREK, SCEPTER_OF_TUNATH, SCEPTER_OF_ENKU)) { takeItems(player, CHIANTA_1ST_ORDER, 1); takeItems(player, SCEPTER_OF_BREKA, 1); takeItems(player, SCEPTER_OF_ENKU, 1); @@ -369,54 +311,40 @@ public final class Q00220_TestimonyOfGlory extends Quest } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { final QuestState qs = getQuestState(attacker, false); - if ((qs != null) && qs.isStarted()) - { - switch (npc.getId()) - { + if ((qs != null) && qs.isStarted()) { + switch (npc.getId()) { case RAGNA_ORC_OVERLORD: - case RAGNA_ORC_SEER: - { - switch (npc.getScriptValue()) - { - case 0: - { + case RAGNA_ORC_SEER: { + switch (npc.getScriptValue()) { + case 0: { npc.getVariables().set("lastAttacker", attacker.getObjectId()); - if (!hasQuestItems(attacker, SCEPTER_OF_TANTOS)) - { + if (!hasQuestItems(attacker, SCEPTER_OF_TANTOS)) { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.IS_IT_A_LACKEY_OF_KAKAI)); npc.setScriptValue(1); } break; } - case 1: - { + case 1: { npc.setScriptValue(2); break; } } break; } - case REVENANT_OF_TANTOS_CHIEF: - { - switch (npc.getScriptValue()) - { - case 0: - { + case REVENANT_OF_TANTOS_CHIEF: { + switch (npc.getScriptValue()) { + case 0: { npc.getVariables().set("lastAttacker", attacker.getObjectId()); - if (!hasQuestItems(attacker, SCEPTER_OF_TANTOS)) - { + if (!hasQuestItems(attacker, SCEPTER_OF_TANTOS)) { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.HOW_REGRETFUL_UNJUST_DISHONOR)); npc.setScriptValue(1); } break; } - case 1: - { - if (!hasQuestItems(attacker, SCEPTER_OF_TANTOS) && (npc.getCurrentHp() < (npc.getMaxHp() / 3))) - { + case 1: { + if (!hasQuestItems(attacker, SCEPTER_OF_TANTOS) && (npc.getCurrentHp() < (npc.getMaxHp() / 3))) { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.INDIGNANT_AND_UNFAIR_DEATH)); npc.setScriptValue(2); } @@ -431,88 +359,62 @@ public final class Q00220_TestimonyOfGlory extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { case TYRANT: - case TYRANT_KINGPIN: - { - if (hasQuestItems(killer, VOKIANS_ORDER) && (getQuestItemsCount(killer, TYRANT_TALON) < 10)) - { - if (getQuestItemsCount(killer, TYRANT_TALON) == 9) - { + case TYRANT_KINGPIN: { + if (hasQuestItems(killer, VOKIANS_ORDER) && (getQuestItemsCount(killer, TYRANT_TALON) < 10)) { + if (getQuestItemsCount(killer, TYRANT_TALON) == 9) { giveItems(killer, TYRANT_TALON, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if ((getQuestItemsCount(killer, MANASHEN_SHARD) >= 10) && (getQuestItemsCount(killer, GUARDIAN_BASILISK_FANG) >= 10)) - { + if ((getQuestItemsCount(killer, MANASHEN_SHARD) >= 10) && (getQuestItemsCount(killer, GUARDIAN_BASILISK_FANG) >= 10)) { qs.setCond(2); } - } - else - { + } else { giveItems(killer, TYRANT_TALON, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case MARSH_STAKATO_DRONE: - { - if (!hasQuestItems(killer, SCEPTER_OF_VUKU) && hasQuestItems(killer, NECKLACE_OF_AUTHORITY, CHIANTA_1ST_ORDER, DRIKOS_CONTRACT) && (getQuestItemsCount(killer, STAKATO_DRONE_HUSK) < 30)) - { - if (getQuestItemsCount(killer, TYRANT_TALON) == 29) - { + case MARSH_STAKATO_DRONE: { + if (!hasQuestItems(killer, SCEPTER_OF_VUKU) && hasQuestItems(killer, NECKLACE_OF_AUTHORITY, CHIANTA_1ST_ORDER, DRIKOS_CONTRACT) && (getQuestItemsCount(killer, STAKATO_DRONE_HUSK) < 30)) { + if (getQuestItemsCount(killer, TYRANT_TALON) == 29) { giveItems(killer, STAKATO_DRONE_HUSK, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { giveItems(killer, STAKATO_DRONE_HUSK, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case GUARDIAN_BASILISK: - { - if (hasQuestItems(killer, VOKIANS_ORDER) && (getQuestItemsCount(killer, GUARDIAN_BASILISK_FANG) < 10)) - { - if (getQuestItemsCount(killer, GUARDIAN_BASILISK_FANG) == 9) - { + case GUARDIAN_BASILISK: { + if (hasQuestItems(killer, VOKIANS_ORDER) && (getQuestItemsCount(killer, GUARDIAN_BASILISK_FANG) < 10)) { + if (getQuestItemsCount(killer, GUARDIAN_BASILISK_FANG) == 9) { giveItems(killer, GUARDIAN_BASILISK_FANG, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if ((getQuestItemsCount(killer, MANASHEN_SHARD) >= 10) && (getQuestItemsCount(killer, TYRANT_TALON) >= 10)) - { + if ((getQuestItemsCount(killer, MANASHEN_SHARD) >= 10) && (getQuestItemsCount(killer, TYRANT_TALON) >= 10)) { qs.setCond(2); } - } - else - { + } else { giveItems(killer, GUARDIAN_BASILISK_FANG, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case MANASHEN_GARGOYLE: - { - if (hasQuestItems(killer, VOKIANS_ORDER) && (getQuestItemsCount(killer, MANASHEN_SHARD) < 10)) - { - if (getQuestItemsCount(killer, MANASHEN_SHARD) == 9) - { + case MANASHEN_GARGOYLE: { + if (hasQuestItems(killer, VOKIANS_ORDER) && (getQuestItemsCount(killer, MANASHEN_SHARD) < 10)) { + if (getQuestItemsCount(killer, MANASHEN_SHARD) == 9) { giveItems(killer, MANASHEN_SHARD, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if ((getQuestItemsCount(killer, TYRANT_TALON) >= 10) && (getQuestItemsCount(killer, GUARDIAN_BASILISK_FANG) >= 10)) - { + if ((getQuestItemsCount(killer, TYRANT_TALON) >= 10) && (getQuestItemsCount(killer, GUARDIAN_BASILISK_FANG) >= 10)) { qs.setCond(2); } - } - else - { + } else { giveItems(killer, MANASHEN_SHARD, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -524,21 +426,15 @@ public final class Q00220_TestimonyOfGlory extends Quest case TIMAK_ORC_SOLDIER: case TIMAK_ORC_WARRIOR: case TIMAK_ORC_SHAMAN: - case TIMAK_ORC_OVERLORD: - { - if (hasQuestItems(killer, NECKLACE_OF_AUTHORITY, CHIANTA_3RD_ORDER) && (getQuestItemsCount(killer, TIMAK_ORC_HEAD) < 20)) - { - if (getQuestItemsCount(killer, MANASHEN_SHARD) == 19) - { + case TIMAK_ORC_OVERLORD: { + if (hasQuestItems(killer, NECKLACE_OF_AUTHORITY, CHIANTA_3RD_ORDER) && (getQuestItemsCount(killer, TIMAK_ORC_HEAD) < 20)) { + if (getQuestItemsCount(killer, MANASHEN_SHARD) == 19) { giveItems(killer, TIMAK_ORC_HEAD, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if (getQuestItemsCount(killer, TAMLIN_ORC_SKULL) >= 20) - { + if (getQuestItemsCount(killer, TAMLIN_ORC_SKULL) >= 20) { qs.setCond(7); } - } - else - { + } else { giveItems(killer, TIMAK_ORC_HEAD, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -546,21 +442,15 @@ public final class Q00220_TestimonyOfGlory extends Quest break; } case TAMLIN_ORC: - case TAMLIN_ORC_ARCHER: - { - if (hasQuestItems(killer, NECKLACE_OF_AUTHORITY, CHIANTA_3RD_ORDER) && (getQuestItemsCount(killer, TAMLIN_ORC_SKULL) < 20)) - { - if (getQuestItemsCount(killer, TAMLIN_ORC_SKULL) == 19) - { + case TAMLIN_ORC_ARCHER: { + if (hasQuestItems(killer, NECKLACE_OF_AUTHORITY, CHIANTA_3RD_ORDER) && (getQuestItemsCount(killer, TAMLIN_ORC_SKULL) < 20)) { + if (getQuestItemsCount(killer, TAMLIN_ORC_SKULL) == 19) { giveItems(killer, TAMLIN_ORC_SKULL, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if (getQuestItemsCount(killer, TIMAK_ORC_HEAD) >= 20) - { + if (getQuestItemsCount(killer, TIMAK_ORC_HEAD) >= 20) { qs.setCond(7); } - } - else - { + } else { giveItems(killer, TAMLIN_ORC_SKULL, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -568,91 +458,67 @@ public final class Q00220_TestimonyOfGlory extends Quest break; } case RAGNA_ORC_OVERLORD: - case RAGNA_ORC_SEER: - { - if (hasQuestItems(killer, TANAPIS_ORDER) && !hasQuestItems(killer, SCEPTER_OF_TANTOS)) - { + case RAGNA_ORC_SEER: { + if (hasQuestItems(killer, TANAPIS_ORDER) && !hasQuestItems(killer, SCEPTER_OF_TANTOS)) { addSpawn(REVENANT_OF_TANTOS_CHIEF, npc, true, 200000); npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.TOO_LATE)); } break; } - case PASHIKA_SON_OF_VOLTAR: - { - if (hasQuestItems(killer, NECKLACE_OF_AUTHORITY, CHIANTA_1ST_ORDER, GLOVE_OF_VOLTAR) && !hasQuestItems(killer, PASHIKAS_HEAD)) - { - if (hasQuestItems(killer, VULTUS_HEAD)) - { + case PASHIKA_SON_OF_VOLTAR: { + if (hasQuestItems(killer, NECKLACE_OF_AUTHORITY, CHIANTA_1ST_ORDER, GLOVE_OF_VOLTAR) && !hasQuestItems(killer, PASHIKAS_HEAD)) { + if (hasQuestItems(killer, VULTUS_HEAD)) { giveItems(killer, PASHIKAS_HEAD, 1); takeItems(killer, GLOVE_OF_VOLTAR, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { giveItems(killer, PASHIKAS_HEAD, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case VULTUS_SON_OF_VOLTAR: - { - if (hasQuestItems(killer, NECKLACE_OF_AUTHORITY, CHIANTA_1ST_ORDER, GLOVE_OF_VOLTAR) && !hasQuestItems(killer, VULTUS_HEAD)) - { - if (hasQuestItems(killer, PASHIKAS_HEAD)) - { + case VULTUS_SON_OF_VOLTAR: { + if (hasQuestItems(killer, NECKLACE_OF_AUTHORITY, CHIANTA_1ST_ORDER, GLOVE_OF_VOLTAR) && !hasQuestItems(killer, VULTUS_HEAD)) { + if (hasQuestItems(killer, PASHIKAS_HEAD)) { giveItems(killer, VULTUS_HEAD, 1); takeItems(killer, GLOVE_OF_VOLTAR, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { giveItems(killer, VULTUS_HEAD, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case ENKU_ORC_OVERLORD: - { - if (hasQuestItems(killer, NECKLACE_OF_AUTHORITY, CHIANTA_1ST_ORDER, GLOVE_OF_KEPRA) && (getQuestItemsCount(killer, ENKU_OVERLORD_HEAD) < 4)) - { - if (getQuestItemsCount(killer, ENKU_OVERLORD_HEAD) == 3) - { + case ENKU_ORC_OVERLORD: { + if (hasQuestItems(killer, NECKLACE_OF_AUTHORITY, CHIANTA_1ST_ORDER, GLOVE_OF_KEPRA) && (getQuestItemsCount(killer, ENKU_OVERLORD_HEAD) < 4)) { + if (getQuestItemsCount(killer, ENKU_OVERLORD_HEAD) == 3) { giveItems(killer, ENKU_OVERLORD_HEAD, 1); takeItems(killer, GLOVE_OF_KEPRA, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { giveItems(killer, ENKU_OVERLORD_HEAD, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case MAKUM_BUGBEAR_THUG: - { - if (hasQuestItems(killer, NECKLACE_OF_AUTHORITY, CHIANTA_1ST_ORDER, GLOVE_OF_BURAI) && (getQuestItemsCount(killer, MAKUM_BUGBEAR_HEAD) < 2)) - { - if (getQuestItemsCount(killer, MAKUM_BUGBEAR_HEAD) == 1) - { + case MAKUM_BUGBEAR_THUG: { + if (hasQuestItems(killer, NECKLACE_OF_AUTHORITY, CHIANTA_1ST_ORDER, GLOVE_OF_BURAI) && (getQuestItemsCount(killer, MAKUM_BUGBEAR_HEAD) < 2)) { + if (getQuestItemsCount(killer, MAKUM_BUGBEAR_HEAD) == 1) { giveItems(killer, MAKUM_BUGBEAR_HEAD, 1); takeItems(killer, GLOVE_OF_BURAI, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { giveItems(killer, MAKUM_BUGBEAR_HEAD, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case REVENANT_OF_TANTOS_CHIEF: - { - if (hasQuestItems(killer, TANAPIS_ORDER) && !hasQuestItems(killer, SCEPTER_OF_TANTOS)) - { + case REVENANT_OF_TANTOS_CHIEF: { + if (hasQuestItems(killer, TANAPIS_ORDER) && !hasQuestItems(killer, SCEPTER_OF_TANTOS)) { giveItems(killer, SCEPTER_OF_TANTOS, 1); npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.ILL_GET_REVENGE_SOMEDAY)); qs.setCond(10, true); @@ -665,45 +531,28 @@ public final class Q00220_TestimonyOfGlory extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == PREFECT_VOKIAN) - { - if (player.getRace() == Race.ORC) - { - if ((player.getLevel() >= MIN_LEVEL) && player.isInCategory(CategoryType.ORC_2ND_GROUP)) - { + if (qs.isCreated()) { + if (npc.getId() == PREFECT_VOKIAN) { + if (player.getRace() == Race.ORC) { + if ((player.getLevel() >= MIN_LEVEL) && player.isInCategory(CategoryType.ORC_2ND_GROUP)) { htmltext = "30514-03.htm"; - } - else if (player.getLevel() >= MIN_LEVEL) - { + } else if (player.getLevel() >= MIN_LEVEL) { htmltext = "30514-01a.html"; - } - else - { + } else { htmltext = "30514-02.html"; } - } - else - { + } else { htmltext = "30514-01.html"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case PREFECT_VOKIAN: - { - if (hasQuestItems(player, VOKIANS_ORDER)) - { - if ((getQuestItemsCount(player, MANASHEN_SHARD) >= 10) && (getQuestItemsCount(player, TYRANT_TALON) >= 10) && (getQuestItemsCount(player, GUARDIAN_BASILISK_FANG) >= 10)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case PREFECT_VOKIAN: { + if (hasQuestItems(player, VOKIANS_ORDER)) { + if ((getQuestItemsCount(player, MANASHEN_SHARD) >= 10) && (getQuestItemsCount(player, TYRANT_TALON) >= 10) && (getQuestItemsCount(player, GUARDIAN_BASILISK_FANG) >= 10)) { takeItems(player, VOKIANS_ORDER, 1); takeItems(player, MANASHEN_SHARD, -1); takeItems(player, TYRANT_TALON, -1); @@ -712,54 +561,36 @@ public final class Q00220_TestimonyOfGlory extends Quest giveItems(player, NECKLACE_OF_AUTHORITY, 1); qs.setCond(3, true); htmltext = "30514-08.html"; - } - else - { + } else { htmltext = "30514-06.html"; } - } - else if (hasQuestItems(player, VOKIANS_ORDER2, NECKLACE_OF_AUTHORITY)) - { + } else if (hasQuestItems(player, VOKIANS_ORDER2, NECKLACE_OF_AUTHORITY)) { htmltext = "30514-09.html"; - } - else if (!hasQuestItems(player, NECKLACE_OF_AUTHORITY) && hasAtLeastOneQuestItem(player, VOKIANS_ORDER2, SCEPTER_BOX)) - { + } else if (!hasQuestItems(player, NECKLACE_OF_AUTHORITY) && hasAtLeastOneQuestItem(player, VOKIANS_ORDER2, SCEPTER_BOX)) { htmltext = "30514-10.html"; } break; } - case PREFECT_KASMAN: - { - if (hasQuestItems(player, NECKLACE_OF_AUTHORITY, CHIANTA_1ST_ORDER)) - { + case PREFECT_KASMAN: { + if (hasQuestItems(player, NECKLACE_OF_AUTHORITY, CHIANTA_1ST_ORDER)) { htmltext = "30501-01.html"; - } - else if (hasAtLeastOneQuestItem(player, CHIANTA_2ND_ORDER, CHIANTA_3RD_ORDER, SCEPTER_BOX)) - { + } else if (hasAtLeastOneQuestItem(player, CHIANTA_2ND_ORDER, CHIANTA_3RD_ORDER, SCEPTER_BOX)) { htmltext = "30501-11.html"; } break; } - case SEER_MANAKIA: - { - if (hasQuestItems(player, NECKLACE_OF_AUTHORITY, CHIANTA_1ST_ORDER)) - { + case SEER_MANAKIA: { + if (hasQuestItems(player, NECKLACE_OF_AUTHORITY, CHIANTA_1ST_ORDER)) { htmltext = "30515-01.html"; - } - else if (hasAtLeastOneQuestItem(player, CHIANTA_2ND_ORDER, CHIANTA_3RD_ORDER, SCEPTER_BOX)) - { + } else if (hasAtLeastOneQuestItem(player, CHIANTA_2ND_ORDER, CHIANTA_3RD_ORDER, SCEPTER_BOX)) { htmltext = "30515-08.html"; } break; } - case FLAME_LORD_KAKAI: - { - if (!hasQuestItems(player, RITUAL_BOX) && hasAtLeastOneQuestItem(player, SCEPTER_BOX, TANAPIS_ORDER)) - { + case FLAME_LORD_KAKAI: { + if (!hasQuestItems(player, RITUAL_BOX) && hasAtLeastOneQuestItem(player, SCEPTER_BOX, TANAPIS_ORDER)) { htmltext = "30565-01.html"; - } - else if (hasQuestItems(player, RITUAL_BOX)) - { + } else if (hasQuestItems(player, RITUAL_BOX)) { giveAdena(player, 262720, true); giveItems(player, MARK_OF_GLORY, 1); addExpAndSp(player, 1448226, 96648); @@ -769,255 +600,165 @@ public final class Q00220_TestimonyOfGlory extends Quest } break; } - case SEER_TANAPI: - { - if (hasQuestItems(player, SCEPTER_BOX)) - { + case SEER_TANAPI: { + if (hasQuestItems(player, SCEPTER_BOX)) { htmltext = "30571-01.html"; - } - else if (hasQuestItems(player, TANAPIS_ORDER)) - { - if (!hasQuestItems(player, SCEPTER_OF_TANTOS)) - { + } else if (hasQuestItems(player, TANAPIS_ORDER)) { + if (!hasQuestItems(player, SCEPTER_OF_TANTOS)) { htmltext = "30571-04.html"; - } - else - { + } else { takeItems(player, TANAPIS_ORDER, 1); takeItems(player, SCEPTER_OF_TANTOS, 1); giveItems(player, RITUAL_BOX, 1); qs.setCond(11, true); htmltext = "30571-05.html"; } - } - else if (hasQuestItems(player, RITUAL_BOX)) - { + } else if (hasQuestItems(player, RITUAL_BOX)) { htmltext = "30571-06.html"; } break; } - case BREKA_CHIEF_VOLTAR: - { - if (hasQuestItems(player, NECKLACE_OF_AUTHORITY, CHIANTA_1ST_ORDER)) - { - if (!hasAtLeastOneQuestItem(player, SCEPTER_OF_BREKA, MANAKIA_1ST_LETTER, GLOVE_OF_VOLTAR, PASHIKAS_HEAD, VULTUS_HEAD)) - { + case BREKA_CHIEF_VOLTAR: { + if (hasQuestItems(player, NECKLACE_OF_AUTHORITY, CHIANTA_1ST_ORDER)) { + if (!hasAtLeastOneQuestItem(player, SCEPTER_OF_BREKA, MANAKIA_1ST_LETTER, GLOVE_OF_VOLTAR, PASHIKAS_HEAD, VULTUS_HEAD)) { htmltext = "30615-01.html"; - } - else if (hasQuestItems(player, MANAKIA_1ST_LETTER)) - { + } else if (hasQuestItems(player, MANAKIA_1ST_LETTER)) { htmltext = "30615-02.html"; player.getRadar().removeMarker(80100, 119991, -2264); - } - else if (!hasQuestItems(player, SCEPTER_OF_BREKA) && hasQuestItems(player, GLOVE_OF_VOLTAR) && ((getQuestItemsCount(player, PASHIKAS_HEAD) + getQuestItemsCount(player, VULTUS_HEAD)) < 2)) - { - if (npc.getSummonedNpcCount() < 2) - { + } else if (!hasQuestItems(player, SCEPTER_OF_BREKA) && hasQuestItems(player, GLOVE_OF_VOLTAR) && ((getQuestItemsCount(player, PASHIKAS_HEAD) + getQuestItemsCount(player, VULTUS_HEAD)) < 2)) { + if (npc.getSummonedNpcCount() < 2) { addAttackDesire(addSpawn(npc, PASHIKA_SON_OF_VOLTAR, npc, true, 200000), player); addAttackDesire(addSpawn(npc, VULTUS_SON_OF_VOLTAR, npc, true, 200000), player); } htmltext = "30615-05.html"; - } - else if (hasQuestItems(player, PASHIKAS_HEAD, VULTUS_HEAD)) - { + } else if (hasQuestItems(player, PASHIKAS_HEAD, VULTUS_HEAD)) { giveItems(player, SCEPTER_OF_BREKA, 1); takeItems(player, PASHIKAS_HEAD, 1); takeItems(player, VULTUS_HEAD, 1); - if (hasQuestItems(player, SCEPTER_OF_ENKU, SCEPTER_OF_VUKU, SCEPTER_OF_TUREK, SCEPTER_OF_TUNATH)) - { + if (hasQuestItems(player, SCEPTER_OF_ENKU, SCEPTER_OF_VUKU, SCEPTER_OF_TUREK, SCEPTER_OF_TUNATH)) { qs.setCond(5, true); } htmltext = "30615-06.html"; - } - else if (hasQuestItems(player, SCEPTER_OF_BREKA)) - { + } else if (hasQuestItems(player, SCEPTER_OF_BREKA)) { htmltext = "30615-07.html"; } - } - else if (hasAtLeastOneQuestItem(player, CHIANTA_2ND_ORDER, CHIANTA_3RD_ORDER, SCEPTER_BOX)) - { + } else if (hasAtLeastOneQuestItem(player, CHIANTA_2ND_ORDER, CHIANTA_3RD_ORDER, SCEPTER_BOX)) { htmltext = "30615-08.html"; } break; } - case ENKU_CHIEF_KEPRA: - { - if (hasQuestItems(player, NECKLACE_OF_AUTHORITY, CHIANTA_1ST_ORDER)) - { - if (!hasAtLeastOneQuestItem(player, SCEPTER_OF_ENKU, MANAKIA_2ND_LETTER, GLOVE_OF_KEPRA) && ((getQuestItemsCount(player, ENKU_OVERLORD_HEAD)) < 4)) - { + case ENKU_CHIEF_KEPRA: { + if (hasQuestItems(player, NECKLACE_OF_AUTHORITY, CHIANTA_1ST_ORDER)) { + if (!hasAtLeastOneQuestItem(player, SCEPTER_OF_ENKU, MANAKIA_2ND_LETTER, GLOVE_OF_KEPRA) && ((getQuestItemsCount(player, ENKU_OVERLORD_HEAD)) < 4)) { htmltext = "30616-01.html"; - } - else if (hasQuestItems(player, MANAKIA_2ND_LETTER)) - { + } else if (hasQuestItems(player, MANAKIA_2ND_LETTER)) { player.getRadar().removeMarker(12805, 189249, -3616); htmltext = "30616-02.html"; - } - else if (hasQuestItems(player, GLOVE_OF_KEPRA) && ((getQuestItemsCount(player, ENKU_OVERLORD_HEAD)) < 4)) - { - if (npc.getSummonedNpcCount() < 5) - { + } else if (hasQuestItems(player, GLOVE_OF_KEPRA) && ((getQuestItemsCount(player, ENKU_OVERLORD_HEAD)) < 4)) { + if (npc.getSummonedNpcCount() < 5) { addAttackDesire(addSpawn(npc, ENKU_ORC_OVERLORD, npc, true, 200000), player); } htmltext = "30616-05.html"; - } - else if (getQuestItemsCount(player, ENKU_OVERLORD_HEAD) >= 4) - { + } else if (getQuestItemsCount(player, ENKU_OVERLORD_HEAD) >= 4) { giveItems(player, SCEPTER_OF_ENKU, 1); takeItems(player, ENKU_OVERLORD_HEAD, -1); - if (hasQuestItems(player, SCEPTER_OF_BREKA, SCEPTER_OF_VUKU, SCEPTER_OF_TUREK, SCEPTER_OF_TUNATH)) - { + if (hasQuestItems(player, SCEPTER_OF_BREKA, SCEPTER_OF_VUKU, SCEPTER_OF_TUREK, SCEPTER_OF_TUNATH)) { qs.setCond(5, true); } htmltext = "30616-06.html"; - } - else if (hasQuestItems(player, SCEPTER_OF_ENKU)) - { + } else if (hasQuestItems(player, SCEPTER_OF_ENKU)) { htmltext = "30616-07.html"; } - } - else if (hasAtLeastOneQuestItem(player, CHIANTA_2ND_ORDER, CHIANTA_3RD_ORDER, SCEPTER_BOX)) - { + } else if (hasAtLeastOneQuestItem(player, CHIANTA_2ND_ORDER, CHIANTA_3RD_ORDER, SCEPTER_BOX)) { htmltext = "30616-08.html"; } break; } - case TUREK_CHIEF_BURAI: - { - if (hasQuestItems(player, NECKLACE_OF_AUTHORITY, CHIANTA_1ST_ORDER)) - { - if (!hasAtLeastOneQuestItem(player, SCEPTER_OF_TUREK, KASMANS_2ND_LETTER, GLOVE_OF_BURAI, MAKUM_BUGBEAR_HEAD)) - { + case TUREK_CHIEF_BURAI: { + if (hasQuestItems(player, NECKLACE_OF_AUTHORITY, CHIANTA_1ST_ORDER)) { + if (!hasAtLeastOneQuestItem(player, SCEPTER_OF_TUREK, KASMANS_2ND_LETTER, GLOVE_OF_BURAI, MAKUM_BUGBEAR_HEAD)) { htmltext = "30617-01.html"; - } - else if (hasQuestItems(player, KASMANS_2ND_LETTER)) - { + } else if (hasQuestItems(player, KASMANS_2ND_LETTER)) { player.getRadar().removeMarker(-94294, 110818, -3563); htmltext = "30617-02.html"; - } - else if (hasQuestItems(player, GLOVE_OF_BURAI)) - { - if (npc.getSummonedNpcCount() < 3) - { + } else if (hasQuestItems(player, GLOVE_OF_BURAI)) { + if (npc.getSummonedNpcCount() < 3) { addAttackDesire(addSpawn(npc, MAKUM_BUGBEAR_THUG, npc, true, 200000), player); addAttackDesire(addSpawn(npc, MAKUM_BUGBEAR_THUG, npc, true, 200000), player); } htmltext = "30617-04.html"; - } - else if (getQuestItemsCount(player, MAKUM_BUGBEAR_HEAD) >= 2) - { + } else if (getQuestItemsCount(player, MAKUM_BUGBEAR_HEAD) >= 2) { giveItems(player, SCEPTER_OF_TUREK, 1); takeItems(player, MAKUM_BUGBEAR_HEAD, -1); - if (hasQuestItems(player, SCEPTER_OF_ENKU, SCEPTER_OF_BREKA, SCEPTER_OF_VUKU, SCEPTER_OF_TUNATH)) - { + if (hasQuestItems(player, SCEPTER_OF_ENKU, SCEPTER_OF_BREKA, SCEPTER_OF_VUKU, SCEPTER_OF_TUNATH)) { qs.setCond(5, true); } htmltext = "30617-05.html"; - } - else if (hasQuestItems(player, SCEPTER_OF_TUREK)) - { + } else if (hasQuestItems(player, SCEPTER_OF_TUREK)) { htmltext = "30617-06.html"; } - } - else if (hasQuestItems(player, NECKLACE_OF_AUTHORITY) && hasAtLeastOneQuestItem(player, CHIANTA_2ND_ORDER, CHIANTA_3RD_ORDER, SCEPTER_BOX)) - { + } else if (hasQuestItems(player, NECKLACE_OF_AUTHORITY) && hasAtLeastOneQuestItem(player, CHIANTA_2ND_ORDER, CHIANTA_3RD_ORDER, SCEPTER_BOX)) { htmltext = "30617-07.html"; } break; } - case LEUNT_CHIEF_HARAK: - { - if (hasQuestItems(player, NECKLACE_OF_AUTHORITY, CHIANTA_1ST_ORDER)) - { - if (!hasAtLeastOneQuestItem(player, SCEPTER_OF_TUNATH, KASMANS_3RD_LETTER)) - { + case LEUNT_CHIEF_HARAK: { + if (hasQuestItems(player, NECKLACE_OF_AUTHORITY, CHIANTA_1ST_ORDER)) { + if (!hasAtLeastOneQuestItem(player, SCEPTER_OF_TUNATH, KASMANS_3RD_LETTER)) { htmltext = "30618-01.html"; - } - else if (!hasQuestItems(player, SCEPTER_OF_TUNATH) && hasQuestItems(player, KASMANS_3RD_LETTER)) - { + } else if (!hasQuestItems(player, SCEPTER_OF_TUNATH) && hasQuestItems(player, KASMANS_3RD_LETTER)) { player.getRadar().removeMarker(-55217, 200628, -3724); htmltext = "30618-02.html"; - } - else if (hasQuestItems(player, SCEPTER_OF_TUNATH)) - { + } else if (hasQuestItems(player, SCEPTER_OF_TUNATH)) { htmltext = "30618-04.html"; } - } - else if (hasAtLeastOneQuestItem(player, CHIANTA_2ND_ORDER, CHIANTA_3RD_ORDER, SCEPTER_BOX)) - { + } else if (hasAtLeastOneQuestItem(player, CHIANTA_2ND_ORDER, CHIANTA_3RD_ORDER, SCEPTER_BOX)) { htmltext = "30618-05.html"; } break; } - case VUKU_CHIEF_DRIKO: - { - if (hasQuestItems(player, NECKLACE_OF_AUTHORITY, CHIANTA_1ST_ORDER)) - { - if (!hasAtLeastOneQuestItem(player, SCEPTER_OF_VUKU, KASMANS_1ST_LETTER, DRIKOS_CONTRACT)) - { + case VUKU_CHIEF_DRIKO: { + if (hasQuestItems(player, NECKLACE_OF_AUTHORITY, CHIANTA_1ST_ORDER)) { + if (!hasAtLeastOneQuestItem(player, SCEPTER_OF_VUKU, KASMANS_1ST_LETTER, DRIKOS_CONTRACT)) { htmltext = "30619-01.html"; - } - else if (!hasQuestItems(player, SCEPTER_OF_VUKU) && hasQuestItems(player, KASMANS_1ST_LETTER)) - { + } else if (!hasQuestItems(player, SCEPTER_OF_VUKU) && hasQuestItems(player, KASMANS_1ST_LETTER)) { player.getRadar().removeMarker(-2150, 124443, -3724); htmltext = "30619-02.html"; - } - else if (!hasQuestItems(player, SCEPTER_OF_VUKU) && hasQuestItems(player, DRIKOS_CONTRACT)) - { - if (getQuestItemsCount(player, STAKATO_DRONE_HUSK) < 30) - { + } else if (!hasQuestItems(player, SCEPTER_OF_VUKU) && hasQuestItems(player, DRIKOS_CONTRACT)) { + if (getQuestItemsCount(player, STAKATO_DRONE_HUSK) < 30) { htmltext = "30619-04.html"; - } - else - { + } else { giveItems(player, SCEPTER_OF_VUKU, 1); takeItems(player, DRIKOS_CONTRACT, 1); takeItems(player, STAKATO_DRONE_HUSK, -1); - if (hasQuestItems(player, SCEPTER_OF_TUREK, SCEPTER_OF_ENKU, SCEPTER_OF_BREKA, SCEPTER_OF_TUNATH)) - { + if (hasQuestItems(player, SCEPTER_OF_TUREK, SCEPTER_OF_ENKU, SCEPTER_OF_BREKA, SCEPTER_OF_TUNATH)) { qs.setCond(5, true); } htmltext = "30619-05.html"; } - } - else if (hasQuestItems(player, SCEPTER_OF_VUKU)) - { + } else if (hasQuestItems(player, SCEPTER_OF_VUKU)) { htmltext = "30619-06.html"; } - } - else if (hasQuestItems(player, NECKLACE_OF_AUTHORITY) && hasAtLeastOneQuestItem(player, CHIANTA_2ND_ORDER, CHIANTA_3RD_ORDER, SCEPTER_BOX)) - { + } else if (hasQuestItems(player, NECKLACE_OF_AUTHORITY) && hasAtLeastOneQuestItem(player, CHIANTA_2ND_ORDER, CHIANTA_3RD_ORDER, SCEPTER_BOX)) { htmltext = "30619-07.html"; } break; } - case GANDI_CHIEF_CHIANTA: - { - if (hasQuestItems(player, NECKLACE_OF_AUTHORITY, VOKIANS_ORDER2)) - { + case GANDI_CHIEF_CHIANTA: { + if (hasQuestItems(player, NECKLACE_OF_AUTHORITY, VOKIANS_ORDER2)) { htmltext = "30642-01.html"; - } - else if (hasQuestItems(player, NECKLACE_OF_AUTHORITY, CHIANTA_1ST_ORDER)) - { - if ((getQuestItemsCount(player, SCEPTER_OF_BREKA) + getQuestItemsCount(player, SCEPTER_OF_VUKU) + getQuestItemsCount(player, SCEPTER_OF_TUREK) + getQuestItemsCount(player, SCEPTER_OF_TUNATH) + getQuestItemsCount(player, SCEPTER_OF_ENKU)) < 5) - { + } else if (hasQuestItems(player, NECKLACE_OF_AUTHORITY, CHIANTA_1ST_ORDER)) { + if ((getQuestItemsCount(player, SCEPTER_OF_BREKA) + getQuestItemsCount(player, SCEPTER_OF_VUKU) + getQuestItemsCount(player, SCEPTER_OF_TUREK) + getQuestItemsCount(player, SCEPTER_OF_TUNATH) + getQuestItemsCount(player, SCEPTER_OF_ENKU)) < 5) { htmltext = "30642-04.html"; - } - else if (hasQuestItems(player, SCEPTER_OF_BREKA, SCEPTER_OF_VUKU, SCEPTER_OF_TUREK, SCEPTER_OF_TUNATH, SCEPTER_OF_ENKU)) - { + } else if (hasQuestItems(player, SCEPTER_OF_BREKA, SCEPTER_OF_VUKU, SCEPTER_OF_TUREK, SCEPTER_OF_TUNATH, SCEPTER_OF_ENKU)) { htmltext = "30642-05.html"; } - } - else if (hasQuestItems(player, NECKLACE_OF_AUTHORITY, CHIANTA_2ND_ORDER)) - { + } else if (hasQuestItems(player, NECKLACE_OF_AUTHORITY, CHIANTA_2ND_ORDER)) { giveItems(player, CHIANTA_3RD_ORDER, 1); takeItems(player, CHIANTA_2ND_ORDER, 1); htmltext = "30642-09.html"; - } - else if (hasQuestItems(player, NECKLACE_OF_AUTHORITY, CHIANTA_3RD_ORDER)) - { - if ((getQuestItemsCount(player, TAMLIN_ORC_SKULL) >= 20) && (getQuestItemsCount(player, TIMAK_ORC_HEAD) >= 20)) - { + } else if (hasQuestItems(player, NECKLACE_OF_AUTHORITY, CHIANTA_3RD_ORDER)) { + if ((getQuestItemsCount(player, TAMLIN_ORC_SKULL) >= 20) && (getQuestItemsCount(player, TIMAK_ORC_HEAD) >= 20)) { takeItems(player, NECKLACE_OF_AUTHORITY, 1); takeItems(player, CHIANTA_3RD_ORDER, 1); takeItems(player, TAMLIN_ORC_SKULL, -1); @@ -1025,28 +766,19 @@ public final class Q00220_TestimonyOfGlory extends Quest giveItems(player, SCEPTER_BOX, 1); qs.setCond(8, true); htmltext = "30642-11.html"; - } - else - { + } else { htmltext = "30642-10.html"; } - } - else if (hasQuestItems(player, SCEPTER_BOX)) - { + } else if (hasQuestItems(player, SCEPTER_BOX)) { htmltext = "30642-12.html"; - } - else if (hasAtLeastOneQuestItem(player, TANAPIS_ORDER, RITUAL_BOX)) - { + } else if (hasAtLeastOneQuestItem(player, TANAPIS_ORDER, RITUAL_BOX)) { htmltext = "30642-13.html"; } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == PREFECT_VOKIAN) - { + } else if (qs.isCompleted()) { + if (npc.getId() == PREFECT_VOKIAN) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00221_TestimonyOfProsperity/Q00221_TestimonyOfProsperity.java b/src/main/java/com/l2jserver/datapack/quests/Q00221_TestimonyOfProsperity/Q00221_TestimonyOfProsperity.java index 56b0dfb916..7bf684d42e 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00221_TestimonyOfProsperity/Q00221_TestimonyOfProsperity.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00221_TestimonyOfProsperity/Q00221_TestimonyOfProsperity.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.util.Util; * Testimony Of Prosperity (221) * @author ivantotov */ -public final class Q00221_TestimonyOfProsperity extends Quest -{ +public final class Q00221_TestimonyOfProsperity extends Quest { // NPCs private static final int WAREHOUSE_KEEPER_WILFORD = 30005; private static final int WAREHOUSE_KEEPER_PARMAN = 30104; @@ -116,8 +115,7 @@ public final class Q00221_TestimonyOfProsperity extends Quest // Misc private static final int MIN_LEVEL = 37; - public Q00221_TestimonyOfProsperity() - { + public Q00221_TestimonyOfProsperity() { super(221, Q00221_TestimonyOfProsperity.class.getSimpleName(), "Testimony Of Prosperity"); addStartNpc(WAREHOUSE_KEEPER_PARMAN); addTalkId(WAREHOUSE_KEEPER_PARMAN, WAREHOUSE_KEEPER_WILFORD, LILITH, GUARD_BRIGHT, TRADER_SHARI, TRADER_MION, IRON_GATES_LOCKIRIN, GOLDEN_WHEELS_SPIRON, SILVER_SCALES_BALANKI, BRONZE_KEYS_KEEF, GRAY_PILLAR_MEMBER_FILAUR, BLACK_ANVILS_ARIN, MARYSE_REDBONNET, MINER_BOLTER, CARRIER_TOROCCO, MASTER_TOMA, PIOTUR, EMILY, MAESTRO_NIKOLA, BOX_OF_TITAN); @@ -126,42 +124,32 @@ public final class Q00221_TestimonyOfProsperity extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (qs.isCreated()) - { + switch (event) { + case "ACCEPT": { + if (qs.isCreated()) { qs.startQuest(); - if (!hasQuestItems(player, RING_OF_TESTIMONY_1ST)) - { + if (!hasQuestItems(player, RING_OF_TESTIMONY_1ST)) { giveItems(player, RING_OF_TESTIMONY_1ST, 1); } playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); - if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) - { + if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) { giveItems(player, DIMENSIONAL_DIAMOND, 50); player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1); htmltext = "30104-04e.htm"; - } - else - { + } else { htmltext = "30104-04.htm"; } } break; } - case "30104-08.html": - { + case "30104-08.html": { takeItems(player, RING_OF_TESTIMONY_1ST, 1); giveItems(player, RING_OF_TESTIMONY_2ND, 1); takeItems(player, OLD_ACCOUNT_BOOK, 1); @@ -188,39 +176,32 @@ public final class Q00221_TestimonyOfProsperity extends Quest case "30531-02.html": case "30620-02.html": case "30621-02.html": - case "30621-03.html": - { + case "30621-03.html": { htmltext = event; break; } - case "30005-04.html": - { + case "30005-04.html": { giveItems(player, CRYSTAL_BROOCH, 1); htmltext = event; break; } - case "30368-03.html": - { - if (hasQuestItems(player, CRYSTAL_BROOCH)) - { + case "30368-03.html": { + if (hasQuestItems(player, CRYSTAL_BROOCH)) { giveItems(player, LILITHS_ELVEN_WAFER, 1); takeItems(player, CRYSTAL_BROOCH, 1); - if (hasQuestItems(player, OLD_ACCOUNT_BOOK, BLESSED_SEED, EMILYS_RECIPE)) - { + if (hasQuestItems(player, OLD_ACCOUNT_BOOK, BLESSED_SEED, EMILYS_RECIPE)) { qs.setCond(2, true); } htmltext = event; } break; } - case "30466-03.html": - { + case "30466-03.html": { giveItems(player, BRIGHTS_LIST, 1); htmltext = event; break; } - case "30531-03.html": - { + case "30531-03.html": { giveItems(player, COLLECTION_LICENSE, 1); giveItems(player, LOCKIRINS_1ST_NOTICE, 1); giveItems(player, LOCKIRINS_2ND_NOTICE, 1); @@ -230,14 +211,10 @@ public final class Q00221_TestimonyOfProsperity extends Quest htmltext = event; break; } - case "30534-03a.html": - { - if (getQuestItemsCount(player, ADENA) < 5000) - { + case "30534-03a.html": { + if (getQuestItemsCount(player, ADENA) < 5000) { htmltext = event; - } - else if (hasQuestItems(player, PROCURATION_OF_TOROCCO)) - { + } else if (hasQuestItems(player, PROCURATION_OF_TOROCCO)) { takeItems(player, ADENA, 5000); giveItems(player, RECEIPT_OF_CONTRIBUTION_3RD, 1); takeItems(player, PROCURATION_OF_TOROCCO, 1); @@ -245,47 +222,38 @@ public final class Q00221_TestimonyOfProsperity extends Quest } break; } - case "30555-02.html": - { + case "30555-02.html": { giveItems(player, PROCURATION_OF_TOROCCO, 1); htmltext = event; break; } - case "30597-02.html": - { + case "30597-02.html": { giveItems(player, BLESSED_SEED, 1); - if (hasQuestItems(player, OLD_ACCOUNT_BOOK, EMILYS_RECIPE, LILITHS_ELVEN_WAFER)) - { + if (hasQuestItems(player, OLD_ACCOUNT_BOOK, EMILYS_RECIPE, LILITHS_ELVEN_WAFER)) { qs.setCond(2, true); } htmltext = event; break; } - case "30620-03.html": - { - if (hasQuestItems(player, MANDRAGORA_BOUGUET)) - { + case "30620-03.html": { + if (hasQuestItems(player, MANDRAGORA_BOUGUET)) { giveItems(player, EMILYS_RECIPE, 1); takeItems(player, MANDRAGORA_BOUGUET, 1); - if (hasQuestItems(player, OLD_ACCOUNT_BOOK, BLESSED_SEED, LILITHS_ELVEN_WAFER)) - { + if (hasQuestItems(player, OLD_ACCOUNT_BOOK, BLESSED_SEED, LILITHS_ELVEN_WAFER)) { qs.setCond(2, true); } htmltext = event; } break; } - case "30621-04.html": - { + case "30621-04.html": { giveItems(player, CLAY_DOUGH, 1); qs.setCond(5, true); htmltext = event; break; } - case "30622-02.html": - { - if (hasQuestItems(player, CLAY_DOUGH)) - { + case "30622-02.html": { + if (hasQuestItems(player, CLAY_DOUGH)) { takeItems(player, CLAY_DOUGH, 1); giveItems(player, PATTERN_OF_KEYHOLE, 1); qs.setCond(6, true); @@ -293,10 +261,8 @@ public final class Q00221_TestimonyOfProsperity extends Quest } break; } - case "30622-04.html": - { - if (hasQuestItems(player, KEY_OF_TITAN)) - { + case "30622-04.html": { + if (hasQuestItems(player, KEY_OF_TITAN)) { takeItems(player, KEY_OF_TITAN, 1); giveItems(player, MAPHR_TABLET_FRAGMENT, 1); takeItems(player, NIKOLAS_LIST, 1); @@ -314,29 +280,20 @@ public final class Q00221_TestimonyOfProsperity extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { case MANDRAGORA_SPROUT1: case MANDRAGORA_SAPLING: case MANDRAGORA_BLOSSOM: - case MANDRAGORA_SPROUT2: - { - if (hasQuestItems(killer, RING_OF_TESTIMONY_1ST, BRIGHTS_LIST) && !hasQuestItems(killer, EMILYS_RECIPE)) - { - if ((getQuestItemsCount(killer, MANDRAGORA_PETAL) < 20)) - { + case MANDRAGORA_SPROUT2: { + if (hasQuestItems(killer, RING_OF_TESTIMONY_1ST, BRIGHTS_LIST) && !hasQuestItems(killer, EMILYS_RECIPE)) { + if ((getQuestItemsCount(killer, MANDRAGORA_PETAL) < 20)) { giveItems(killer, MANDRAGORA_PETAL, 1); - if (getQuestItemsCount(killer, MANDRAGORA_PETAL) == 20) - { + if (getQuestItemsCount(killer, MANDRAGORA_PETAL) == 20) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -346,88 +303,61 @@ public final class Q00221_TestimonyOfProsperity extends Quest case MARSH_STAKATO: case MARSH_STAKATO_WORKER: case MARSH_STAKATO_SOLDIER: - case MARSH_STAKATO_DRONE: - { - if (hasQuestItems(killer, RING_OF_TESTIMONY_2ND, NIKOLAS_LIST) && !hasAtLeastOneQuestItem(killer, CLAY_DOUGH, PATTERN_OF_KEYHOLE)) - { - if ((getQuestItemsCount(killer, STAKATO_SHELL) < 20)) - { + case MARSH_STAKATO_DRONE: { + if (hasQuestItems(killer, RING_OF_TESTIMONY_2ND, NIKOLAS_LIST) && !hasAtLeastOneQuestItem(killer, CLAY_DOUGH, PATTERN_OF_KEYHOLE)) { + if ((getQuestItemsCount(killer, STAKATO_SHELL) < 20)) { giveItems(killer, STAKATO_SHELL, 1); - if (getQuestItemsCount(killer, STAKATO_SHELL) == 20) - { + if (getQuestItemsCount(killer, STAKATO_SHELL) == 20) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if ((getQuestItemsCount(killer, TOAD_LORD_SAC) >= 10) && (getQuestItemsCount(killer, MARSH_SPIDER_THORN) >= 10)) - { + if ((getQuestItemsCount(killer, TOAD_LORD_SAC) >= 10) && (getQuestItemsCount(killer, MARSH_SPIDER_THORN) >= 10)) { qs.setCond(8); } - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case GIANT_CRIMSON_ANT: - { - if (hasQuestItems(killer, RING_OF_TESTIMONY_1ST, BRIGHTS_LIST) && !hasQuestItems(killer, EMILYS_RECIPE)) - { - if ((getQuestItemsCount(killer, CRIMSON_MOSS) < 10)) - { + case GIANT_CRIMSON_ANT: { + if (hasQuestItems(killer, RING_OF_TESTIMONY_1ST, BRIGHTS_LIST) && !hasQuestItems(killer, EMILYS_RECIPE)) { + if ((getQuestItemsCount(killer, CRIMSON_MOSS) < 10)) { giveItems(killer, CRIMSON_MOSS, 1); - if (getQuestItemsCount(killer, CRIMSON_MOSS) == 10) - { + if (getQuestItemsCount(killer, CRIMSON_MOSS) == 10) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case TOAD_LORD: - { - if (hasQuestItems(killer, RING_OF_TESTIMONY_2ND, NIKOLAS_LIST) && !hasAtLeastOneQuestItem(killer, CLAY_DOUGH, PATTERN_OF_KEYHOLE)) - { - if ((getQuestItemsCount(killer, TOAD_LORD_SAC) < 10)) - { + case TOAD_LORD: { + if (hasQuestItems(killer, RING_OF_TESTIMONY_2ND, NIKOLAS_LIST) && !hasAtLeastOneQuestItem(killer, CLAY_DOUGH, PATTERN_OF_KEYHOLE)) { + if ((getQuestItemsCount(killer, TOAD_LORD_SAC) < 10)) { giveItems(killer, TOAD_LORD_SAC, 1); - if (getQuestItemsCount(killer, TOAD_LORD_SAC) == 10) - { + if (getQuestItemsCount(killer, TOAD_LORD_SAC) == 10) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if ((getQuestItemsCount(killer, STAKATO_SHELL) >= 20) && (getQuestItemsCount(killer, MARSH_SPIDER_THORN) >= 10)) - { + if ((getQuestItemsCount(killer, STAKATO_SHELL) >= 20) && (getQuestItemsCount(killer, MARSH_SPIDER_THORN) >= 10)) { qs.setCond(8); } - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case MARSH_SPIDER: - { - if (hasQuestItems(killer, RING_OF_TESTIMONY_2ND, NIKOLAS_LIST) && !hasAtLeastOneQuestItem(killer, CLAY_DOUGH, PATTERN_OF_KEYHOLE)) - { - if ((getQuestItemsCount(killer, MARSH_SPIDER_THORN) < 10)) - { + case MARSH_SPIDER: { + if (hasQuestItems(killer, RING_OF_TESTIMONY_2ND, NIKOLAS_LIST) && !hasAtLeastOneQuestItem(killer, CLAY_DOUGH, PATTERN_OF_KEYHOLE)) { + if ((getQuestItemsCount(killer, MARSH_SPIDER_THORN) < 10)) { giveItems(killer, MARSH_SPIDER_THORN, 1); - if (getQuestItemsCount(killer, MARSH_SPIDER_THORN) == 10) - { + if (getQuestItemsCount(killer, MARSH_SPIDER_THORN) == 10) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if ((getQuestItemsCount(killer, STAKATO_SHELL) >= 20) && (getQuestItemsCount(killer, TOAD_LORD_SAC) >= 10)) - { + if ((getQuestItemsCount(killer, STAKATO_SHELL) >= 20) && (getQuestItemsCount(killer, TOAD_LORD_SAC) >= 10)) { qs.setCond(8); } - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -440,69 +370,42 @@ public final class Q00221_TestimonyOfProsperity extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == WAREHOUSE_KEEPER_PARMAN) - { - if ((player.getRace() == Race.DWARF) && (player.getLevel() >= MIN_LEVEL) && player.isInCategory(CategoryType.DWARF_2ND_GROUP)) - { + if (qs.isCreated()) { + if (npc.getId() == WAREHOUSE_KEEPER_PARMAN) { + if ((player.getRace() == Race.DWARF) && (player.getLevel() >= MIN_LEVEL) && player.isInCategory(CategoryType.DWARF_2ND_GROUP)) { htmltext = "30104-03.htm"; - } - else if ((player.getRace() == Race.DWARF) && (player.getLevel() >= MIN_LEVEL)) - { + } else if ((player.getRace() == Race.DWARF) && (player.getLevel() >= MIN_LEVEL)) { htmltext = "30104-01a.html"; - } - else if ((player.getRace() == Race.DWARF)) - { + } else if ((player.getRace() == Race.DWARF)) { htmltext = "30104-02.html"; - } - else - { + } else { htmltext = "30104-01.html"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case WAREHOUSE_KEEPER_PARMAN: - { - if (hasQuestItems(player, RING_OF_TESTIMONY_1ST)) - { - if (hasQuestItems(player, OLD_ACCOUNT_BOOK, BLESSED_SEED, EMILYS_RECIPE, LILITHS_ELVEN_WAFER)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case WAREHOUSE_KEEPER_PARMAN: { + if (hasQuestItems(player, RING_OF_TESTIMONY_1ST)) { + if (hasQuestItems(player, OLD_ACCOUNT_BOOK, BLESSED_SEED, EMILYS_RECIPE, LILITHS_ELVEN_WAFER)) { htmltext = "30104-06.html"; - } - else - { + } else { htmltext = "30104-05.html"; } - } - else if (hasQuestItems(player, PARMANS_INSTRUCTIONS)) - { + } else if (hasQuestItems(player, PARMANS_INSTRUCTIONS)) { takeItems(player, PARMANS_INSTRUCTIONS, 1); giveItems(player, RING_OF_TESTIMONY_2ND, 1); giveItems(player, PARMANS_LETTER, 1); qs.setCond(4, true); htmltext = "30104-10.html"; - } - else if (hasQuestItems(player, RING_OF_TESTIMONY_2ND)) - { - if (hasQuestItems(player, PARMANS_LETTER)) - { + } else if (hasQuestItems(player, RING_OF_TESTIMONY_2ND)) { + if (hasQuestItems(player, PARMANS_LETTER)) { htmltext = "30104-11.html"; - } - else if (hasAtLeastOneQuestItem(player, CLAY_DOUGH, PATTERN_OF_KEYHOLE, NIKOLAS_LIST)) - { + } else if (hasAtLeastOneQuestItem(player, CLAY_DOUGH, PATTERN_OF_KEYHOLE, NIKOLAS_LIST)) { htmltext = "30104-12.html"; - } - else if (hasQuestItems(player, MAPHR_TABLET_FRAGMENT)) - { + } else if (hasQuestItems(player, MAPHR_TABLET_FRAGMENT)) { giveAdena(player, 217682, true); giveItems(player, MARK_OF_PROSPERITY, 1); addExpAndSp(player, 1199958, 80080); @@ -513,130 +416,84 @@ public final class Q00221_TestimonyOfProsperity extends Quest } break; } - case WAREHOUSE_KEEPER_WILFORD: - { - if (hasQuestItems(player, RING_OF_TESTIMONY_1ST)) - { - if (!hasAtLeastOneQuestItem(player, LILITHS_ELVEN_WAFER, CRYSTAL_BROOCH)) - { + case WAREHOUSE_KEEPER_WILFORD: { + if (hasQuestItems(player, RING_OF_TESTIMONY_1ST)) { + if (!hasAtLeastOneQuestItem(player, LILITHS_ELVEN_WAFER, CRYSTAL_BROOCH)) { htmltext = "30005-01.html"; - } - else if (hasQuestItems(player, CRYSTAL_BROOCH) && !hasQuestItems(player, LILITHS_ELVEN_WAFER)) - { + } else if (hasQuestItems(player, CRYSTAL_BROOCH) && !hasQuestItems(player, LILITHS_ELVEN_WAFER)) { htmltext = "30005-05.html"; - } - else if (hasQuestItems(player, LILITHS_ELVEN_WAFER)) - { + } else if (hasQuestItems(player, LILITHS_ELVEN_WAFER)) { htmltext = "30005-06.html"; } - } - else if (hasQuestItems(player, RING_OF_TESTIMONY_2ND)) - { + } else if (hasQuestItems(player, RING_OF_TESTIMONY_2ND)) { htmltext = "30005-07.html"; } break; } - case LILITH: - { - if (hasQuestItems(player, RING_OF_TESTIMONY_1ST)) - { - if (hasQuestItems(player, CRYSTAL_BROOCH) && !hasQuestItems(player, LILITHS_ELVEN_WAFER)) - { + case LILITH: { + if (hasQuestItems(player, RING_OF_TESTIMONY_1ST)) { + if (hasQuestItems(player, CRYSTAL_BROOCH) && !hasQuestItems(player, LILITHS_ELVEN_WAFER)) { htmltext = "30368-01.html"; - } - else - { + } else { htmltext = "30368-04.html"; } - } - else if (hasQuestItems(player, RING_OF_TESTIMONY_2ND)) - { + } else if (hasQuestItems(player, RING_OF_TESTIMONY_2ND)) { htmltext = "30368-05.html"; } break; } - case GUARD_BRIGHT: - { - if (hasQuestItems(player, RING_OF_TESTIMONY_1ST)) - { - if (!hasAtLeastOneQuestItem(player, EMILYS_RECIPE, BRIGHTS_LIST, MANDRAGORA_BOUGUET)) - { + case GUARD_BRIGHT: { + if (hasQuestItems(player, RING_OF_TESTIMONY_1ST)) { + if (!hasAtLeastOneQuestItem(player, EMILYS_RECIPE, BRIGHTS_LIST, MANDRAGORA_BOUGUET)) { htmltext = "30466-01.html"; - } - else if (hasQuestItems(player, BRIGHTS_LIST) && !hasQuestItems(player, EMILYS_RECIPE)) - { - if ((getQuestItemsCount(player, MANDRAGORA_PETAL) < 20) || (getQuestItemsCount(player, CRIMSON_MOSS) < 10)) - { + } else if (hasQuestItems(player, BRIGHTS_LIST) && !hasQuestItems(player, EMILYS_RECIPE)) { + if ((getQuestItemsCount(player, MANDRAGORA_PETAL) < 20) || (getQuestItemsCount(player, CRIMSON_MOSS) < 10)) { htmltext = "30466-04.html"; - } - else - { + } else { takeItems(player, BRIGHTS_LIST, 1); takeItems(player, MANDRAGORA_PETAL, -1); takeItems(player, CRIMSON_MOSS, -1); giveItems(player, MANDRAGORA_BOUGUET, 1); htmltext = "30466-05.html"; } - } - else if (hasQuestItems(player, MANDRAGORA_BOUGUET) && !hasAtLeastOneQuestItem(player, EMILYS_RECIPE, BRIGHTS_LIST)) - { + } else if (hasQuestItems(player, MANDRAGORA_BOUGUET) && !hasAtLeastOneQuestItem(player, EMILYS_RECIPE, BRIGHTS_LIST)) { htmltext = "30466-06.html"; - } - else if (hasQuestItems(player, EMILYS_RECIPE)) - { + } else if (hasQuestItems(player, EMILYS_RECIPE)) { htmltext = "30466-07.html"; } - } - else if (hasQuestItems(player, RING_OF_TESTIMONY_2ND)) - { + } else if (hasQuestItems(player, RING_OF_TESTIMONY_2ND)) { htmltext = "30466-08.html"; } break; } - case TRADER_SHARI: - { - if (hasQuestItems(player, RING_OF_TESTIMONY_1ST, COLLECTION_LICENSE)) - { - if (!hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_1ST, CONTRIBUTION_OF_SHARI, LOCKIRINS_1ST_NOTICE)) - { + case TRADER_SHARI: { + if (hasQuestItems(player, RING_OF_TESTIMONY_1ST, COLLECTION_LICENSE)) { + if (!hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_1ST, CONTRIBUTION_OF_SHARI, LOCKIRINS_1ST_NOTICE)) { giveItems(player, CONTRIBUTION_OF_SHARI, 1); htmltext = "30517-01.html"; - } - else if (hasQuestItems(player, CONTRIBUTION_OF_SHARI) && !hasAtLeastOneQuestItem(player, LOCKIRINS_1ST_NOTICE, RECEIPT_OF_CONTRIBUTION_1ST)) - { + } else if (hasQuestItems(player, CONTRIBUTION_OF_SHARI) && !hasAtLeastOneQuestItem(player, LOCKIRINS_1ST_NOTICE, RECEIPT_OF_CONTRIBUTION_1ST)) { htmltext = "30517-02.html"; } } break; } - case TRADER_MION: - { - if (hasQuestItems(player, RING_OF_TESTIMONY_1ST, COLLECTION_LICENSE)) - { - if (!hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_2ND, CONTRIBUTION_OF_MION, LOCKIRINS_2ND_NOTICE)) - { + case TRADER_MION: { + if (hasQuestItems(player, RING_OF_TESTIMONY_1ST, COLLECTION_LICENSE)) { + if (!hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_2ND, CONTRIBUTION_OF_MION, LOCKIRINS_2ND_NOTICE)) { giveItems(player, CONTRIBUTION_OF_MION, 1); htmltext = "30519-01.html"; - } - else if (hasQuestItems(player, CONTRIBUTION_OF_MION) && !hasAtLeastOneQuestItem(player, LOCKIRINS_2ND_NOTICE, RECEIPT_OF_CONTRIBUTION_2ND)) - { + } else if (hasQuestItems(player, CONTRIBUTION_OF_MION) && !hasAtLeastOneQuestItem(player, LOCKIRINS_2ND_NOTICE, RECEIPT_OF_CONTRIBUTION_2ND)) { htmltext = "30519-02.html"; } } break; } - case IRON_GATES_LOCKIRIN: - { - if (hasQuestItems(player, RING_OF_TESTIMONY_1ST)) - { - if (!hasAtLeastOneQuestItem(player, COLLECTION_LICENSE, OLD_ACCOUNT_BOOK)) - { + case IRON_GATES_LOCKIRIN: { + if (hasQuestItems(player, RING_OF_TESTIMONY_1ST)) { + if (!hasAtLeastOneQuestItem(player, COLLECTION_LICENSE, OLD_ACCOUNT_BOOK)) { htmltext = "30531-01.html"; - } - else if (hasQuestItems(player, COLLECTION_LICENSE)) - { - if (hasQuestItems(player, RECEIPT_OF_CONTRIBUTION_1ST, RECEIPT_OF_CONTRIBUTION_2ND, RECEIPT_OF_CONTRIBUTION_3RD, RECEIPT_OF_CONTRIBUTION_4TH, RECEIPT_OF_CONTRIBUTION_5TH)) - { + } else if (hasQuestItems(player, COLLECTION_LICENSE)) { + if (hasQuestItems(player, RECEIPT_OF_CONTRIBUTION_1ST, RECEIPT_OF_CONTRIBUTION_2ND, RECEIPT_OF_CONTRIBUTION_3RD, RECEIPT_OF_CONTRIBUTION_4TH, RECEIPT_OF_CONTRIBUTION_5TH)) { giveItems(player, OLD_ACCOUNT_BOOK, 1); takeItems(player, COLLECTION_LICENSE, 1); takeItems(player, RECEIPT_OF_CONTRIBUTION_1ST, 1); @@ -645,333 +502,219 @@ public final class Q00221_TestimonyOfProsperity extends Quest takeItems(player, RECEIPT_OF_CONTRIBUTION_4TH, 1); takeItems(player, RECEIPT_OF_CONTRIBUTION_5TH, 1); playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); - if (hasQuestItems(player, BLESSED_SEED, EMILYS_RECIPE, LILITHS_ELVEN_WAFER)) - { + if (hasQuestItems(player, BLESSED_SEED, EMILYS_RECIPE, LILITHS_ELVEN_WAFER)) { qs.setCond(2, true); } htmltext = "30531-05.html"; - } - else - { + } else { htmltext = "30531-04.html"; } - } - else if (hasQuestItems(player, OLD_ACCOUNT_BOOK) && !hasQuestItems(player, COLLECTION_LICENSE)) - { + } else if (hasQuestItems(player, OLD_ACCOUNT_BOOK) && !hasQuestItems(player, COLLECTION_LICENSE)) { htmltext = "30531-06.html"; } - } - else if (hasQuestItems(player, RING_OF_TESTIMONY_2ND)) - { + } else if (hasQuestItems(player, RING_OF_TESTIMONY_2ND)) { htmltext = "30531-07.html"; } break; } - case GOLDEN_WHEELS_SPIRON: - { - if (hasQuestItems(player, RING_OF_TESTIMONY_1ST, COLLECTION_LICENSE)) - { - if (hasQuestItems(player, LOCKIRINS_1ST_NOTICE) && !hasAtLeastOneQuestItem(player, CONTRIBUTION_OF_SHARI, RECEIPT_OF_CONTRIBUTION_1ST)) - { + case GOLDEN_WHEELS_SPIRON: { + if (hasQuestItems(player, RING_OF_TESTIMONY_1ST, COLLECTION_LICENSE)) { + if (hasQuestItems(player, LOCKIRINS_1ST_NOTICE) && !hasAtLeastOneQuestItem(player, CONTRIBUTION_OF_SHARI, RECEIPT_OF_CONTRIBUTION_1ST)) { takeItems(player, LOCKIRINS_1ST_NOTICE, 1); htmltext = "30532-01.html"; - } - else if (!hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_1ST, CONTRIBUTION_OF_SHARI, LOCKIRINS_1ST_NOTICE)) - { + } else if (!hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_1ST, CONTRIBUTION_OF_SHARI, LOCKIRINS_1ST_NOTICE)) { htmltext = "30532-02.html"; - } - else if (hasQuestItems(player, CONTRIBUTION_OF_SHARI) && !hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_1ST, LOCKIRINS_1ST_NOTICE)) - { + } else if (hasQuestItems(player, CONTRIBUTION_OF_SHARI) && !hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_1ST, LOCKIRINS_1ST_NOTICE)) { takeItems(player, CONTRIBUTION_OF_SHARI, 1); giveItems(player, RECEIPT_OF_CONTRIBUTION_1ST, 1); htmltext = "30532-03.html"; - } - else if (hasQuestItems(player, RECEIPT_OF_CONTRIBUTION_1ST) && !hasAtLeastOneQuestItem(player, CONTRIBUTION_OF_SHARI, LOCKIRINS_1ST_NOTICE)) - { + } else if (hasQuestItems(player, RECEIPT_OF_CONTRIBUTION_1ST) && !hasAtLeastOneQuestItem(player, CONTRIBUTION_OF_SHARI, LOCKIRINS_1ST_NOTICE)) { htmltext = "30532-04.html"; } } break; } - case SILVER_SCALES_BALANKI: - { - if (hasQuestItems(player, RING_OF_TESTIMONY_1ST, COLLECTION_LICENSE)) - { - if (hasQuestItems(player, LOCKIRINS_2ND_NOTICE) && !hasQuestItems(player, RECEIPT_OF_CONTRIBUTION_2ND) && ((getQuestItemsCount(player, CONTRIBUTION_OF_MION) + getQuestItemsCount(player, CONTRIBUTION_OF_MARYSE)) < 2)) - { + case SILVER_SCALES_BALANKI: { + if (hasQuestItems(player, RING_OF_TESTIMONY_1ST, COLLECTION_LICENSE)) { + if (hasQuestItems(player, LOCKIRINS_2ND_NOTICE) && !hasQuestItems(player, RECEIPT_OF_CONTRIBUTION_2ND) && ((getQuestItemsCount(player, CONTRIBUTION_OF_MION) + getQuestItemsCount(player, CONTRIBUTION_OF_MARYSE)) < 2)) { takeItems(player, LOCKIRINS_2ND_NOTICE, 1); htmltext = "30533-01.html"; - } - else if (!hasAtLeastOneQuestItem(player, LOCKIRINS_2ND_NOTICE, RECEIPT_OF_CONTRIBUTION_2ND) && ((getQuestItemsCount(player, CONTRIBUTION_OF_MION) + getQuestItemsCount(player, CONTRIBUTION_OF_MARYSE)) < 2)) - { + } else if (!hasAtLeastOneQuestItem(player, LOCKIRINS_2ND_NOTICE, RECEIPT_OF_CONTRIBUTION_2ND) && ((getQuestItemsCount(player, CONTRIBUTION_OF_MION) + getQuestItemsCount(player, CONTRIBUTION_OF_MARYSE)) < 2)) { htmltext = "30533-02.html"; - } - else if (!hasAtLeastOneQuestItem(player, LOCKIRINS_2ND_NOTICE, RECEIPT_OF_CONTRIBUTION_2ND) && hasQuestItems(player, CONTRIBUTION_OF_MION, CONTRIBUTION_OF_MARYSE)) - { + } else if (!hasAtLeastOneQuestItem(player, LOCKIRINS_2ND_NOTICE, RECEIPT_OF_CONTRIBUTION_2ND) && hasQuestItems(player, CONTRIBUTION_OF_MION, CONTRIBUTION_OF_MARYSE)) { takeItems(player, CONTRIBUTION_OF_MION, 1); takeItems(player, CONTRIBUTION_OF_MARYSE, 1); giveItems(player, RECEIPT_OF_CONTRIBUTION_2ND, 1); htmltext = "30533-03.html"; - } - else if (!hasQuestItems(player, LOCKIRINS_2ND_NOTICE) && hasQuestItems(player, RECEIPT_OF_CONTRIBUTION_2ND) && !hasQuestItems(player, CONTRIBUTION_OF_MION, CONTRIBUTION_OF_MARYSE)) - { + } else if (!hasQuestItems(player, LOCKIRINS_2ND_NOTICE) && hasQuestItems(player, RECEIPT_OF_CONTRIBUTION_2ND) && !hasQuestItems(player, CONTRIBUTION_OF_MION, CONTRIBUTION_OF_MARYSE)) { htmltext = "30533-04.html"; } } break; } - case BRONZE_KEYS_KEEF: - { - if (hasQuestItems(player, RING_OF_TESTIMONY_1ST, COLLECTION_LICENSE)) - { - if (hasQuestItems(player, LOCKIRINS_3RD_NOTICE) && !hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_3RD, PROCURATION_OF_TOROCCO)) - { + case BRONZE_KEYS_KEEF: { + if (hasQuestItems(player, RING_OF_TESTIMONY_1ST, COLLECTION_LICENSE)) { + if (hasQuestItems(player, LOCKIRINS_3RD_NOTICE) && !hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_3RD, PROCURATION_OF_TOROCCO)) { takeItems(player, LOCKIRINS_3RD_NOTICE, 1); htmltext = "30534-01.html"; - } - else if (!hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_3RD, PROCURATION_OF_TOROCCO, LOCKIRINS_3RD_NOTICE)) - { + } else if (!hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_3RD, PROCURATION_OF_TOROCCO, LOCKIRINS_3RD_NOTICE)) { htmltext = "30534-02.html"; - } - else if (hasQuestItems(player, PROCURATION_OF_TOROCCO) && !hasAtLeastOneQuestItem(player, LOCKIRINS_3RD_NOTICE, RECEIPT_OF_CONTRIBUTION_3RD)) - { + } else if (hasQuestItems(player, PROCURATION_OF_TOROCCO) && !hasAtLeastOneQuestItem(player, LOCKIRINS_3RD_NOTICE, RECEIPT_OF_CONTRIBUTION_3RD)) { htmltext = "30534-03.html"; - } - else if (hasQuestItems(player, RECEIPT_OF_CONTRIBUTION_3RD) && !hasAtLeastOneQuestItem(player, PROCURATION_OF_TOROCCO, LOCKIRINS_3RD_NOTICE)) - { + } else if (hasQuestItems(player, RECEIPT_OF_CONTRIBUTION_3RD) && !hasAtLeastOneQuestItem(player, PROCURATION_OF_TOROCCO, LOCKIRINS_3RD_NOTICE)) { htmltext = "30534-04.html"; } } break; } - case GRAY_PILLAR_MEMBER_FILAUR: - { - if (hasQuestItems(player, RING_OF_TESTIMONY_1ST, COLLECTION_LICENSE)) - { - if (hasQuestItems(player, LOCKIRINS_4TH_NOTICE) && !hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_4TH, RECEIPT_OF_BOLTER)) - { + case GRAY_PILLAR_MEMBER_FILAUR: { + if (hasQuestItems(player, RING_OF_TESTIMONY_1ST, COLLECTION_LICENSE)) { + if (hasQuestItems(player, LOCKIRINS_4TH_NOTICE) && !hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_4TH, RECEIPT_OF_BOLTER)) { takeItems(player, LOCKIRINS_4TH_NOTICE, 1); htmltext = "30535-01.html"; - } - else if (!hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_4TH, RECEIPT_OF_BOLTER, LOCKIRINS_4TH_NOTICE)) - { + } else if (!hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_4TH, RECEIPT_OF_BOLTER, LOCKIRINS_4TH_NOTICE)) { htmltext = "30535-02.html"; - } - else if (hasQuestItems(player, RECEIPT_OF_BOLTER) && !hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_4TH, LOCKIRINS_4TH_NOTICE)) - { + } else if (hasQuestItems(player, RECEIPT_OF_BOLTER) && !hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_4TH, LOCKIRINS_4TH_NOTICE)) { takeItems(player, RECEIPT_OF_BOLTER, 1); giveItems(player, RECEIPT_OF_CONTRIBUTION_4TH, 1); htmltext = "30535-03.html"; - } - else if (hasQuestItems(player, RECEIPT_OF_CONTRIBUTION_4TH) && !hasAtLeastOneQuestItem(player, RECEIPT_OF_BOLTER, LOCKIRINS_4TH_NOTICE)) - { + } else if (hasQuestItems(player, RECEIPT_OF_CONTRIBUTION_4TH) && !hasAtLeastOneQuestItem(player, RECEIPT_OF_BOLTER, LOCKIRINS_4TH_NOTICE)) { htmltext = "30535-04.html"; } } break; } - case BLACK_ANVILS_ARIN: - { - if (hasQuestItems(player, RING_OF_TESTIMONY_1ST, COLLECTION_LICENSE)) - { - if (hasQuestItems(player, LOCKIRINS_5TH_NOTICE) && !hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_5TH, CONTRIBUTION_OF_TOMA)) - { + case BLACK_ANVILS_ARIN: { + if (hasQuestItems(player, RING_OF_TESTIMONY_1ST, COLLECTION_LICENSE)) { + if (hasQuestItems(player, LOCKIRINS_5TH_NOTICE) && !hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_5TH, CONTRIBUTION_OF_TOMA)) { takeItems(player, LOCKIRINS_5TH_NOTICE, 1); htmltext = "30536-01.html"; - } - else if (!hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_5TH, CONTRIBUTION_OF_TOMA, LOCKIRINS_5TH_NOTICE)) - { + } else if (!hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_5TH, CONTRIBUTION_OF_TOMA, LOCKIRINS_5TH_NOTICE)) { htmltext = "30536-02.html"; - } - else if (hasQuestItems(player, CONTRIBUTION_OF_TOMA) && !hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_5TH, LOCKIRINS_5TH_NOTICE)) - { + } else if (hasQuestItems(player, CONTRIBUTION_OF_TOMA) && !hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_5TH, LOCKIRINS_5TH_NOTICE)) { takeItems(player, CONTRIBUTION_OF_TOMA, 1); giveItems(player, RECEIPT_OF_CONTRIBUTION_5TH, 1); htmltext = "30536-03.html"; - } - else if (hasQuestItems(player, RECEIPT_OF_CONTRIBUTION_5TH) && !hasAtLeastOneQuestItem(player, CONTRIBUTION_OF_TOMA, LOCKIRINS_5TH_NOTICE)) - { + } else if (hasQuestItems(player, RECEIPT_OF_CONTRIBUTION_5TH) && !hasAtLeastOneQuestItem(player, CONTRIBUTION_OF_TOMA, LOCKIRINS_5TH_NOTICE)) { htmltext = "30536-04.html"; } } break; } - case MARYSE_REDBONNET: - { - if (hasQuestItems(player, RING_OF_TESTIMONY_1ST, COLLECTION_LICENSE)) - { - if (!hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_2ND, CONTRIBUTION_OF_MARYSE, LOCKIRINS_2ND_NOTICE, MARYSES_REQUEST)) - { + case MARYSE_REDBONNET: { + if (hasQuestItems(player, RING_OF_TESTIMONY_1ST, COLLECTION_LICENSE)) { + if (!hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_2ND, CONTRIBUTION_OF_MARYSE, LOCKIRINS_2ND_NOTICE, MARYSES_REQUEST)) { giveItems(player, MARYSES_REQUEST, 1); htmltext = "30553-01.html"; - } - else if (hasQuestItems(player, MARYSES_REQUEST) && !hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_2ND, CONTRIBUTION_OF_MARYSE, LOCKIRINS_2ND_NOTICE)) - { - if (getQuestItemsCount(player, ANIMAL_SKIN) < 10) - { + } else if (hasQuestItems(player, MARYSES_REQUEST) && !hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_2ND, CONTRIBUTION_OF_MARYSE, LOCKIRINS_2ND_NOTICE)) { + if (getQuestItemsCount(player, ANIMAL_SKIN) < 10) { htmltext = "30553-02.html"; - } - else - { + } else { takeItems(player, ANIMAL_SKIN, 10); giveItems(player, CONTRIBUTION_OF_MARYSE, 1); takeItems(player, MARYSES_REQUEST, 1); htmltext = "30553-03.html"; } - } - else if (hasQuestItems(player, CONTRIBUTION_OF_MARYSE) && !hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_2ND, LOCKIRINS_2ND_NOTICE, MARYSES_REQUEST)) - { + } else if (hasQuestItems(player, CONTRIBUTION_OF_MARYSE) && !hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_2ND, LOCKIRINS_2ND_NOTICE, MARYSES_REQUEST)) { htmltext = "30553-04.html"; } } break; } - case MINER_BOLTER: - { - if (hasQuestItems(player, RING_OF_TESTIMONY_1ST, COLLECTION_LICENSE)) - { - if (!hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_4TH, RECEIPT_OF_BOLTER, LOCKIRINS_4TH_NOTICE)) - { + case MINER_BOLTER: { + if (hasQuestItems(player, RING_OF_TESTIMONY_1ST, COLLECTION_LICENSE)) { + if (!hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_4TH, RECEIPT_OF_BOLTER, LOCKIRINS_4TH_NOTICE)) { giveItems(player, RECEIPT_OF_BOLTER, 1); htmltext = "30554-01.html"; - } - else if (hasQuestItems(player, RECEIPT_OF_BOLTER) && !hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_4TH, LOCKIRINS_4TH_NOTICE)) - { + } else if (hasQuestItems(player, RECEIPT_OF_BOLTER) && !hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_4TH, LOCKIRINS_4TH_NOTICE)) { htmltext = "30554-02.html"; } } break; } - case CARRIER_TOROCCO: - { - if (hasQuestItems(player, RING_OF_TESTIMONY_1ST, COLLECTION_LICENSE)) - { - if (!hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_3RD, PROCURATION_OF_TOROCCO, LOCKIRINS_3RD_NOTICE)) - { + case CARRIER_TOROCCO: { + if (hasQuestItems(player, RING_OF_TESTIMONY_1ST, COLLECTION_LICENSE)) { + if (!hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_3RD, PROCURATION_OF_TOROCCO, LOCKIRINS_3RD_NOTICE)) { htmltext = "30555-01.html"; - } - else if (hasQuestItems(player, PROCURATION_OF_TOROCCO) && !hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_3RD, LOCKIRINS_3RD_NOTICE)) - { + } else if (hasQuestItems(player, PROCURATION_OF_TOROCCO) && !hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_3RD, LOCKIRINS_3RD_NOTICE)) { htmltext = "30555-03.html"; } } break; } - case MASTER_TOMA: - { - if (hasQuestItems(player, RING_OF_TESTIMONY_1ST, COLLECTION_LICENSE)) - { - if (!hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_5TH, CONTRIBUTION_OF_TOMA, LOCKIRINS_5TH_NOTICE)) - { + case MASTER_TOMA: { + if (hasQuestItems(player, RING_OF_TESTIMONY_1ST, COLLECTION_LICENSE)) { + if (!hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_5TH, CONTRIBUTION_OF_TOMA, LOCKIRINS_5TH_NOTICE)) { giveItems(player, CONTRIBUTION_OF_TOMA, 1); htmltext = "30556-01.html"; - } - else if (hasQuestItems(player, CONTRIBUTION_OF_TOMA) && !hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_5TH, LOCKIRINS_5TH_NOTICE)) - { + } else if (hasQuestItems(player, CONTRIBUTION_OF_TOMA) && !hasAtLeastOneQuestItem(player, RECEIPT_OF_CONTRIBUTION_5TH, LOCKIRINS_5TH_NOTICE)) { htmltext = "30556-02.html"; } } break; } - case PIOTUR: - { - if (hasQuestItems(player, RING_OF_TESTIMONY_1ST)) - { - if (!hasQuestItems(player, BLESSED_SEED)) - { + case PIOTUR: { + if (hasQuestItems(player, RING_OF_TESTIMONY_1ST)) { + if (!hasQuestItems(player, BLESSED_SEED)) { htmltext = "30597-01.html"; - } - else - { + } else { htmltext = "30597-03.html"; } - } - else if (hasQuestItems(player, RING_OF_TESTIMONY_2ND)) - { + } else if (hasQuestItems(player, RING_OF_TESTIMONY_2ND)) { htmltext = "30597-04.html"; } break; } - case EMILY: - { - if (hasQuestItems(player, RING_OF_TESTIMONY_1ST)) - { - if (hasQuestItems(player, MANDRAGORA_BOUGUET) && !hasAtLeastOneQuestItem(player, EMILYS_RECIPE, BRIGHTS_LIST)) - { + case EMILY: { + if (hasQuestItems(player, RING_OF_TESTIMONY_1ST)) { + if (hasQuestItems(player, MANDRAGORA_BOUGUET) && !hasAtLeastOneQuestItem(player, EMILYS_RECIPE, BRIGHTS_LIST)) { htmltext = "30620-01.html"; - } - else if (hasQuestItems(player, EMILYS_RECIPE)) - { + } else if (hasQuestItems(player, EMILYS_RECIPE)) { htmltext = "30620-04.html"; } - } - else if (hasQuestItems(player, RING_OF_TESTIMONY_2ND)) - { + } else if (hasQuestItems(player, RING_OF_TESTIMONY_2ND)) { htmltext = "30620-05.html"; } break; } - case MAESTRO_NIKOLA: - { - if (hasQuestItems(player, RING_OF_TESTIMONY_2ND)) - { - if (!hasAtLeastOneQuestItem(player, CLAY_DOUGH, PATTERN_OF_KEYHOLE, NIKOLAS_LIST, MAPHR_TABLET_FRAGMENT)) - { + case MAESTRO_NIKOLA: { + if (hasQuestItems(player, RING_OF_TESTIMONY_2ND)) { + if (!hasAtLeastOneQuestItem(player, CLAY_DOUGH, PATTERN_OF_KEYHOLE, NIKOLAS_LIST, MAPHR_TABLET_FRAGMENT)) { takeItems(player, PARMANS_LETTER, 1); htmltext = "30621-01.html"; - } - else if (hasQuestItems(player, CLAY_DOUGH) && !hasAtLeastOneQuestItem(player, PATTERN_OF_KEYHOLE, NIKOLAS_LIST, MAPHR_TABLET_FRAGMENT)) - { + } else if (hasQuestItems(player, CLAY_DOUGH) && !hasAtLeastOneQuestItem(player, PATTERN_OF_KEYHOLE, NIKOLAS_LIST, MAPHR_TABLET_FRAGMENT)) { htmltext = "30621-05.html"; - } - else if (hasQuestItems(player, PATTERN_OF_KEYHOLE) && !hasAtLeastOneQuestItem(player, CLAY_DOUGH, NIKOLAS_LIST, MAPHR_TABLET_FRAGMENT)) - { + } else if (hasQuestItems(player, PATTERN_OF_KEYHOLE) && !hasAtLeastOneQuestItem(player, CLAY_DOUGH, NIKOLAS_LIST, MAPHR_TABLET_FRAGMENT)) { giveItems(player, RECIPE_TITAN_KEY, 1); takeItems(player, PATTERN_OF_KEYHOLE, 1); giveItems(player, NIKOLAS_LIST, 1); qs.setCond(7, true); htmltext = "30621-06.html"; - } - else if (hasQuestItems(player, NIKOLAS_LIST) && !hasAtLeastOneQuestItem(player, CLAY_DOUGH, PATTERN_OF_KEYHOLE, MAPHR_TABLET_FRAGMENT, KEY_OF_TITAN)) - { + } else if (hasQuestItems(player, NIKOLAS_LIST) && !hasAtLeastOneQuestItem(player, CLAY_DOUGH, PATTERN_OF_KEYHOLE, MAPHR_TABLET_FRAGMENT, KEY_OF_TITAN)) { htmltext = "30621-07.html"; - } - else if (hasQuestItems(player, NIKOLAS_LIST, KEY_OF_TITAN) && !hasAtLeastOneQuestItem(player, CLAY_DOUGH, PATTERN_OF_KEYHOLE, MAPHR_TABLET_FRAGMENT)) - { + } else if (hasQuestItems(player, NIKOLAS_LIST, KEY_OF_TITAN) && !hasAtLeastOneQuestItem(player, CLAY_DOUGH, PATTERN_OF_KEYHOLE, MAPHR_TABLET_FRAGMENT)) { htmltext = "30621-08.html"; - } - else if (hasQuestItems(player, MAPHR_TABLET_FRAGMENT) && !hasAtLeastOneQuestItem(player, CLAY_DOUGH, PATTERN_OF_KEYHOLE, NIKOLAS_LIST)) - { + } else if (hasQuestItems(player, MAPHR_TABLET_FRAGMENT) && !hasAtLeastOneQuestItem(player, CLAY_DOUGH, PATTERN_OF_KEYHOLE, NIKOLAS_LIST)) { htmltext = "30621-09.html"; } } break; } - case BOX_OF_TITAN: - { - if (hasQuestItems(player, RING_OF_TESTIMONY_2ND)) - { - if (hasQuestItems(player, CLAY_DOUGH) && !hasQuestItems(player, PATTERN_OF_KEYHOLE)) - { + case BOX_OF_TITAN: { + if (hasQuestItems(player, RING_OF_TESTIMONY_2ND)) { + if (hasQuestItems(player, CLAY_DOUGH) && !hasQuestItems(player, PATTERN_OF_KEYHOLE)) { htmltext = "30622-01.html"; - } - else if (hasQuestItems(player, KEY_OF_TITAN) && !hasQuestItems(player, MAPHR_TABLET_FRAGMENT)) - { + } else if (hasQuestItems(player, KEY_OF_TITAN) && !hasQuestItems(player, MAPHR_TABLET_FRAGMENT)) { htmltext = "30622-03.html"; - } - else if (!hasAtLeastOneQuestItem(player, KEY_OF_TITAN, CLAY_DOUGH)) - { + } else if (!hasAtLeastOneQuestItem(player, KEY_OF_TITAN, CLAY_DOUGH)) { htmltext = "30622-05.html"; } } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == WAREHOUSE_KEEPER_PARMAN) - { + } else if (qs.isCompleted()) { + if (npc.getId() == WAREHOUSE_KEEPER_PARMAN) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00222_TestOfTheDuelist/Q00222_TestOfTheDuelist.java b/src/main/java/com/l2jserver/datapack/quests/Q00222_TestOfTheDuelist/Q00222_TestOfTheDuelist.java index e0827e84fe..758fef16bc 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00222_TestOfTheDuelist/Q00222_TestOfTheDuelist.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00222_TestOfTheDuelist/Q00222_TestOfTheDuelist.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.util.Util; * Test Of The Duelist (222) * @author ivantotov */ -public final class Q00222_TestOfTheDuelist extends Quest -{ +public final class Q00222_TestOfTheDuelist extends Quest { // NPC private static final int DUELIST_KAIEN = 30623; // Items @@ -80,8 +79,7 @@ public final class Q00222_TestOfTheDuelist extends Quest // Misc private static final int MIN_LEVEL = 39; - public Q00222_TestOfTheDuelist() - { + public Q00222_TestOfTheDuelist() { super(222, Q00222_TestOfTheDuelist.class.getSimpleName(), "Test Of The Duelist"); addStartNpc(DUELIST_KAIEN); addTalkId(DUELIST_KAIEN); @@ -90,21 +88,16 @@ public final class Q00222_TestOfTheDuelist extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (qs.isCreated()) - { + switch (event) { + case "ACCEPT": { + if (qs.isCreated()) { qs.startQuest(); qs.setMemoState(1); giveItems(player, ORDER_GLUDIO, 1); @@ -113,34 +106,24 @@ public final class Q00222_TestOfTheDuelist extends Quest giveItems(player, ORDER_OREN, 1); giveItems(player, ORDER_ADEN, 1); playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); - if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) - { - if (player.getClassId() == ClassId.palusKnight) - { + if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) { + if (player.getClassId() == ClassId.palusKnight) { giveItems(player, DIMENSIONAL_DIAMOND, 104); - } - else - { + } else { giveItems(player, DIMENSIONAL_DIAMOND, 72); } player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1); htmltext = "30623-07a.htm"; - } - else - { + } else { htmltext = "30623-07.htm"; } } break; } - case "30623-04.htm": - { - if (player.getRace() != Race.ORC) - { + case "30623-04.htm": { + if (player.getRace() != Race.ORC) { htmltext = event; - } - else - { + } else { htmltext = "30623-05.htm"; } break; @@ -151,19 +134,16 @@ public final class Q00222_TestOfTheDuelist extends Quest case "30623-10.html": case "30623-11.html": case "30623-12.html": - case "30623-15.html": - { + case "30623-15.html": { htmltext = event; break; } - case "30623-08.html": - { + case "30623-08.html": { qs.setCond(2, true); htmltext = event; break; } - case "30623-16.html": - { + case "30623-16.html": { takeItems(player, PUNCHERS_SHARD, -1); takeItems(player, NOBLE_ANTS_FEELER, -1); takeItems(player, DEAD_SEEKER_FANG, -1); @@ -190,23 +170,16 @@ public final class Q00222_TestOfTheDuelist extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case PUNCHER: - { - if (qs.isMemoState(1) && hasQuestItems(killer, ORDER_GLUDIO)) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case PUNCHER: { + if (qs.isMemoState(1) && hasQuestItems(killer, ORDER_GLUDIO)) { final int i0 = qs.getMemoStateEx(1); qs.setMemoStateEx(1, i0 + 1); - if (giveItemRandomly(killer, npc, PUNCHERS_SHARD, 1, 10, 1.0, true) && (getQuestItemsCount(killer, NOBLE_ANTS_FEELER, DRONES_CHITIN, DEAD_SEEKER_FANG, OVERLORD_NECKLACE, FETTERED_SOULS_CHAIN, CHIEDS_AMULET, ENCHANTED_EYE_MEAT, TAMRIN_ORCS_RING, TAMRIN_ORCS_ARROW) == 90)) - { - if (i0 >= 9) - { + if (giveItemRandomly(killer, npc, PUNCHERS_SHARD, 1, 10, 1.0, true) && (getQuestItemsCount(killer, NOBLE_ANTS_FEELER, DRONES_CHITIN, DEAD_SEEKER_FANG, OVERLORD_NECKLACE, FETTERED_SOULS_CHAIN, CHIEDS_AMULET, ENCHANTED_EYE_MEAT, TAMRIN_ORCS_RING, TAMRIN_ORCS_ARROW) == 90)) { + if (i0 >= 9) { qs.setCond(3); } qs.setMemoStateEx(1, 0); @@ -214,16 +187,12 @@ public final class Q00222_TestOfTheDuelist extends Quest } break; } - case NOBLE_ANT_LEADER: - { - if (qs.isMemoState(1) && hasQuestItems(killer, ORDER_GLUDIO)) - { + case NOBLE_ANT_LEADER: { + if (qs.isMemoState(1) && hasQuestItems(killer, ORDER_GLUDIO)) { final int i0 = qs.getMemoStateEx(1); qs.setMemoStateEx(1, i0 + 1); - if (giveItemRandomly(killer, npc, NOBLE_ANTS_FEELER, 1, 10, 1.0, true) && (getQuestItemsCount(killer, PUNCHERS_SHARD, DRONES_CHITIN, DEAD_SEEKER_FANG, OVERLORD_NECKLACE, FETTERED_SOULS_CHAIN, CHIEDS_AMULET, ENCHANTED_EYE_MEAT, TAMRIN_ORCS_RING, TAMRIN_ORCS_ARROW) == 90)) - { - if (i0 >= 9) - { + if (giveItemRandomly(killer, npc, NOBLE_ANTS_FEELER, 1, 10, 1.0, true) && (getQuestItemsCount(killer, PUNCHERS_SHARD, DRONES_CHITIN, DEAD_SEEKER_FANG, OVERLORD_NECKLACE, FETTERED_SOULS_CHAIN, CHIEDS_AMULET, ENCHANTED_EYE_MEAT, TAMRIN_ORCS_RING, TAMRIN_ORCS_ARROW) == 90)) { + if (i0 >= 9) { qs.setCond(3); } qs.setMemoStateEx(1, 0); @@ -231,16 +200,12 @@ public final class Q00222_TestOfTheDuelist extends Quest } break; } - case DEAD_SEEKER: - { - if (qs.isMemoState(1) && hasQuestItems(killer, ORDER_DION)) - { + case DEAD_SEEKER: { + if (qs.isMemoState(1) && hasQuestItems(killer, ORDER_DION)) { final int i0 = qs.getMemoStateEx(1); qs.setMemoStateEx(1, i0 + 1); - if (giveItemRandomly(killer, npc, DEAD_SEEKER_FANG, 1, 10, 1.0, true) && (getQuestItemsCount(killer, PUNCHERS_SHARD, NOBLE_ANTS_FEELER, DRONES_CHITIN, OVERLORD_NECKLACE, FETTERED_SOULS_CHAIN, CHIEDS_AMULET, ENCHANTED_EYE_MEAT, TAMRIN_ORCS_RING, TAMRIN_ORCS_ARROW) == 90)) - { - if (i0 >= 9) - { + if (giveItemRandomly(killer, npc, DEAD_SEEKER_FANG, 1, 10, 1.0, true) && (getQuestItemsCount(killer, PUNCHERS_SHARD, NOBLE_ANTS_FEELER, DRONES_CHITIN, OVERLORD_NECKLACE, FETTERED_SOULS_CHAIN, CHIEDS_AMULET, ENCHANTED_EYE_MEAT, TAMRIN_ORCS_RING, TAMRIN_ORCS_ARROW) == 90)) { + if (i0 >= 9) { qs.setCond(3); } qs.setMemoStateEx(1, 0); @@ -248,17 +213,13 @@ public final class Q00222_TestOfTheDuelist extends Quest } break; } - case EXCURO: - { + case EXCURO: { - if (qs.isMemoState(2) && hasQuestItems(killer, FINAL_ORDER)) - { + if (qs.isMemoState(2) && hasQuestItems(killer, FINAL_ORDER)) { final int i0 = qs.getMemoStateEx(1); qs.setMemoStateEx(1, i0 + 1); - if (giveItemRandomly(killer, npc, EXCUROS_SKIN, 1, 3, 1.0, true) && (getQuestItemsCount(killer, KRATORS_SHARD, LAKINS_MACE, GRANDIS_SKIN, TIMAK_ORCS_BELT) == 12)) - { - if (i0 >= 5) - { + if (giveItemRandomly(killer, npc, EXCUROS_SKIN, 1, 3, 1.0, true) && (getQuestItemsCount(killer, KRATORS_SHARD, LAKINS_MACE, GRANDIS_SKIN, TIMAK_ORCS_BELT) == 12)) { + if (i0 >= 5) { qs.setCond(5); } qs.setMemoStateEx(1, 0); @@ -266,16 +227,12 @@ public final class Q00222_TestOfTheDuelist extends Quest } break; } - case KRATOR: - { - if (qs.isMemoState(2) && hasQuestItems(killer, FINAL_ORDER)) - { + case KRATOR: { + if (qs.isMemoState(2) && hasQuestItems(killer, FINAL_ORDER)) { final int i0 = qs.getMemoStateEx(1); qs.setMemoStateEx(1, i0 + 1); - if (giveItemRandomly(killer, npc, KRATORS_SHARD, 1, 3, 1.0, true) && (getQuestItemsCount(killer, EXCUROS_SKIN, LAKINS_MACE, GRANDIS_SKIN, TIMAK_ORCS_BELT) == 12)) - { - if (i0 >= 5) - { + if (giveItemRandomly(killer, npc, KRATORS_SHARD, 1, 3, 1.0, true) && (getQuestItemsCount(killer, EXCUROS_SKIN, LAKINS_MACE, GRANDIS_SKIN, TIMAK_ORCS_BELT) == 12)) { + if (i0 >= 5) { qs.setCond(5); } qs.setMemoStateEx(1, 0); @@ -283,16 +240,12 @@ public final class Q00222_TestOfTheDuelist extends Quest } break; } - case MARSH_STAKATO_DRONE: - { - if (qs.isMemoState(1) && hasQuestItems(killer, ORDER_DION)) - { + case MARSH_STAKATO_DRONE: { + if (qs.isMemoState(1) && hasQuestItems(killer, ORDER_DION)) { final int i0 = qs.getMemoStateEx(1); qs.setMemoStateEx(1, i0 + 1); - if (giveItemRandomly(killer, npc, DRONES_CHITIN, 1, 10, 1.0, true) && (getQuestItemsCount(killer, PUNCHERS_SHARD, NOBLE_ANTS_FEELER, DEAD_SEEKER_FANG, OVERLORD_NECKLACE, FETTERED_SOULS_CHAIN, CHIEDS_AMULET, ENCHANTED_EYE_MEAT, TAMRIN_ORCS_RING, TAMRIN_ORCS_ARROW) == 90)) - { - if (i0 >= 9) - { + if (giveItemRandomly(killer, npc, DRONES_CHITIN, 1, 10, 1.0, true) && (getQuestItemsCount(killer, PUNCHERS_SHARD, NOBLE_ANTS_FEELER, DEAD_SEEKER_FANG, OVERLORD_NECKLACE, FETTERED_SOULS_CHAIN, CHIEDS_AMULET, ENCHANTED_EYE_MEAT, TAMRIN_ORCS_RING, TAMRIN_ORCS_ARROW) == 90)) { + if (i0 >= 9) { qs.setCond(3); } qs.setMemoStateEx(1, 0); @@ -300,16 +253,12 @@ public final class Q00222_TestOfTheDuelist extends Quest } break; } - case BREKA_ORC_OVERLORD: - { - if (qs.isMemoState(1) && hasQuestItems(killer, ORDER_GIRAN)) - { + case BREKA_ORC_OVERLORD: { + if (qs.isMemoState(1) && hasQuestItems(killer, ORDER_GIRAN)) { final int i0 = qs.getMemoStateEx(1); qs.setMemoStateEx(1, i0 + 1); - if (giveItemRandomly(killer, npc, OVERLORD_NECKLACE, 1, 10, 1.0, true) && (getQuestItemsCount(killer, PUNCHERS_SHARD, NOBLE_ANTS_FEELER, DRONES_CHITIN, DEAD_SEEKER_FANG, FETTERED_SOULS_CHAIN, CHIEDS_AMULET, ENCHANTED_EYE_MEAT, TAMRIN_ORCS_RING, TAMRIN_ORCS_ARROW) == 90)) - { - if (i0 >= 9) - { + if (giveItemRandomly(killer, npc, OVERLORD_NECKLACE, 1, 10, 1.0, true) && (getQuestItemsCount(killer, PUNCHERS_SHARD, NOBLE_ANTS_FEELER, DRONES_CHITIN, DEAD_SEEKER_FANG, FETTERED_SOULS_CHAIN, CHIEDS_AMULET, ENCHANTED_EYE_MEAT, TAMRIN_ORCS_RING, TAMRIN_ORCS_ARROW) == 90)) { + if (i0 >= 9) { qs.setCond(3); } qs.setMemoStateEx(1, 0); @@ -317,16 +266,12 @@ public final class Q00222_TestOfTheDuelist extends Quest } break; } - case FETTERED_SOUL: - { - if (qs.isMemoState(1) && hasQuestItems(killer, ORDER_GIRAN)) - { + case FETTERED_SOUL: { + if (qs.isMemoState(1) && hasQuestItems(killer, ORDER_GIRAN)) { final int i0 = qs.getMemoStateEx(1); qs.setMemoStateEx(1, i0 + 1); - if (giveItemRandomly(killer, npc, FETTERED_SOULS_CHAIN, 1, 10, 1.0, true) && (getQuestItemsCount(killer, PUNCHERS_SHARD, NOBLE_ANTS_FEELER, DRONES_CHITIN, DEAD_SEEKER_FANG, OVERLORD_NECKLACE, CHIEDS_AMULET, ENCHANTED_EYE_MEAT, TAMRIN_ORCS_RING, TAMRIN_ORCS_ARROW) == 90)) - { - if (i0 >= 9) - { + if (giveItemRandomly(killer, npc, FETTERED_SOULS_CHAIN, 1, 10, 1.0, true) && (getQuestItemsCount(killer, PUNCHERS_SHARD, NOBLE_ANTS_FEELER, DRONES_CHITIN, DEAD_SEEKER_FANG, OVERLORD_NECKLACE, CHIEDS_AMULET, ENCHANTED_EYE_MEAT, TAMRIN_ORCS_RING, TAMRIN_ORCS_ARROW) == 90)) { + if (i0 >= 9) { qs.setCond(3); } qs.setMemoStateEx(1, 0); @@ -334,16 +279,12 @@ public final class Q00222_TestOfTheDuelist extends Quest } break; } - case GRANDIS: - { - if (qs.isMemoState(2) && hasQuestItems(killer, FINAL_ORDER)) - { + case GRANDIS: { + if (qs.isMemoState(2) && hasQuestItems(killer, FINAL_ORDER)) { final int i0 = qs.getMemoStateEx(1); qs.setMemoStateEx(1, i0 + 1); - if (giveItemRandomly(killer, npc, GRANDIS_SKIN, 1, 3, 1.0, true) && (getQuestItemsCount(killer, EXCUROS_SKIN, KRATORS_SHARD, LAKINS_MACE, TIMAK_ORCS_BELT) == 12)) - { - if (i0 >= 5) - { + if (giveItemRandomly(killer, npc, GRANDIS_SKIN, 1, 3, 1.0, true) && (getQuestItemsCount(killer, EXCUROS_SKIN, KRATORS_SHARD, LAKINS_MACE, TIMAK_ORCS_BELT) == 12)) { + if (i0 >= 5) { qs.setCond(5); } qs.setMemoStateEx(1, 0); @@ -351,16 +292,12 @@ public final class Q00222_TestOfTheDuelist extends Quest } break; } - case ENCHANTED_MONSTEREYE: - { - if (qs.isMemoState(1) && hasQuestItems(killer, ORDER_OREN)) - { + case ENCHANTED_MONSTEREYE: { + if (qs.isMemoState(1) && hasQuestItems(killer, ORDER_OREN)) { final int i0 = qs.getMemoStateEx(1); qs.setMemoStateEx(1, i0 + 1); - if (giveItemRandomly(killer, npc, ENCHANTED_EYE_MEAT, 1, 10, 1.0, true) && (getQuestItemsCount(killer, PUNCHERS_SHARD, NOBLE_ANTS_FEELER, DRONES_CHITIN, DEAD_SEEKER_FANG, OVERLORD_NECKLACE, FETTERED_SOULS_CHAIN, CHIEDS_AMULET, TAMRIN_ORCS_RING, TAMRIN_ORCS_ARROW) == 90)) - { - if (i0 >= 9) - { + if (giveItemRandomly(killer, npc, ENCHANTED_EYE_MEAT, 1, 10, 1.0, true) && (getQuestItemsCount(killer, PUNCHERS_SHARD, NOBLE_ANTS_FEELER, DRONES_CHITIN, DEAD_SEEKER_FANG, OVERLORD_NECKLACE, FETTERED_SOULS_CHAIN, CHIEDS_AMULET, TAMRIN_ORCS_RING, TAMRIN_ORCS_ARROW) == 90)) { + if (i0 >= 9) { qs.setCond(3); } qs.setMemoStateEx(1, 0); @@ -368,16 +305,12 @@ public final class Q00222_TestOfTheDuelist extends Quest } break; } - case LETO_LIZARDMAN_OVERLORD: - { - if (qs.isMemoState(1) && hasQuestItems(killer, ORDER_OREN)) - { + case LETO_LIZARDMAN_OVERLORD: { + if (qs.isMemoState(1) && hasQuestItems(killer, ORDER_OREN)) { final int i0 = qs.getMemoStateEx(1); qs.setMemoStateEx(1, i0 + 1); - if (giveItemRandomly(killer, npc, CHIEDS_AMULET, 1, 10, 1.0, true) && (getQuestItemsCount(killer, PUNCHERS_SHARD, NOBLE_ANTS_FEELER, DRONES_CHITIN, DEAD_SEEKER_FANG, OVERLORD_NECKLACE, FETTERED_SOULS_CHAIN, ENCHANTED_EYE_MEAT, TAMRIN_ORCS_RING, TAMRIN_ORCS_ARROW) == 90)) - { - if (i0 >= 9) - { + if (giveItemRandomly(killer, npc, CHIEDS_AMULET, 1, 10, 1.0, true) && (getQuestItemsCount(killer, PUNCHERS_SHARD, NOBLE_ANTS_FEELER, DRONES_CHITIN, DEAD_SEEKER_FANG, OVERLORD_NECKLACE, FETTERED_SOULS_CHAIN, ENCHANTED_EYE_MEAT, TAMRIN_ORCS_RING, TAMRIN_ORCS_ARROW) == 90)) { + if (i0 >= 9) { qs.setCond(3); } qs.setMemoStateEx(1, 0); @@ -385,16 +318,12 @@ public final class Q00222_TestOfTheDuelist extends Quest } break; } - case TIMAK_ORC_OVERLORD: - { - if (qs.isMemoState(2) && hasQuestItems(killer, FINAL_ORDER)) - { + case TIMAK_ORC_OVERLORD: { + if (qs.isMemoState(2) && hasQuestItems(killer, FINAL_ORDER)) { final int i0 = qs.getMemoStateEx(1); qs.setMemoStateEx(1, i0 + 1); - if (giveItemRandomly(killer, npc, TIMAK_ORCS_BELT, 1, 3, 1.0, true) && (getQuestItemsCount(killer, EXCUROS_SKIN, KRATORS_SHARD, LAKINS_MACE, GRANDIS_SKIN) == 12)) - { - if (i0 >= 5) - { + if (giveItemRandomly(killer, npc, TIMAK_ORCS_BELT, 1, 3, 1.0, true) && (getQuestItemsCount(killer, EXCUROS_SKIN, KRATORS_SHARD, LAKINS_MACE, GRANDIS_SKIN) == 12)) { + if (i0 >= 5) { qs.setCond(5); } qs.setMemoStateEx(1, 0); @@ -402,16 +331,12 @@ public final class Q00222_TestOfTheDuelist extends Quest } break; } - case TAMLIN_ORC: - { - if (qs.isMemoState(1) && hasQuestItems(killer, ORDER_ADEN)) - { + case TAMLIN_ORC: { + if (qs.isMemoState(1) && hasQuestItems(killer, ORDER_ADEN)) { final int i0 = qs.getMemoStateEx(1); qs.setMemoStateEx(1, i0 + 1); - if (giveItemRandomly(killer, npc, TAMRIN_ORCS_RING, 1, 10, 1.0, true) && (getQuestItemsCount(killer, PUNCHERS_SHARD, NOBLE_ANTS_FEELER, DRONES_CHITIN, DEAD_SEEKER_FANG, OVERLORD_NECKLACE, FETTERED_SOULS_CHAIN, CHIEDS_AMULET, ENCHANTED_EYE_MEAT, TAMRIN_ORCS_ARROW) == 90)) - { - if (i0 >= 9) - { + if (giveItemRandomly(killer, npc, TAMRIN_ORCS_RING, 1, 10, 1.0, true) && (getQuestItemsCount(killer, PUNCHERS_SHARD, NOBLE_ANTS_FEELER, DRONES_CHITIN, DEAD_SEEKER_FANG, OVERLORD_NECKLACE, FETTERED_SOULS_CHAIN, CHIEDS_AMULET, ENCHANTED_EYE_MEAT, TAMRIN_ORCS_ARROW) == 90)) { + if (i0 >= 9) { qs.setCond(3); } qs.setMemoStateEx(1, 0); @@ -419,16 +344,12 @@ public final class Q00222_TestOfTheDuelist extends Quest } break; } - case TAMLIN_ORC_ARCHER: - { - if (qs.isMemoState(1) && hasQuestItems(killer, ORDER_ADEN)) - { + case TAMLIN_ORC_ARCHER: { + if (qs.isMemoState(1) && hasQuestItems(killer, ORDER_ADEN)) { final int i0 = qs.getMemoStateEx(1); qs.setMemoStateEx(1, i0 + 1); - if (giveItemRandomly(killer, npc, TAMRIN_ORCS_ARROW, 1, 10, 1.0, true) && (getQuestItemsCount(killer, PUNCHERS_SHARD, NOBLE_ANTS_FEELER, DRONES_CHITIN, DEAD_SEEKER_FANG, OVERLORD_NECKLACE, FETTERED_SOULS_CHAIN, CHIEDS_AMULET, ENCHANTED_EYE_MEAT, TAMRIN_ORCS_RING) == 90)) - { - if (i0 >= 9) - { + if (giveItemRandomly(killer, npc, TAMRIN_ORCS_ARROW, 1, 10, 1.0, true) && (getQuestItemsCount(killer, PUNCHERS_SHARD, NOBLE_ANTS_FEELER, DRONES_CHITIN, DEAD_SEEKER_FANG, OVERLORD_NECKLACE, FETTERED_SOULS_CHAIN, CHIEDS_AMULET, ENCHANTED_EYE_MEAT, TAMRIN_ORCS_RING) == 90)) { + if (i0 >= 9) { qs.setCond(3); } qs.setMemoStateEx(1, 0); @@ -436,16 +357,12 @@ public final class Q00222_TestOfTheDuelist extends Quest } break; } - case LAKIN: - { - if (qs.isMemoState(2) && hasQuestItems(killer, FINAL_ORDER)) - { + case LAKIN: { + if (qs.isMemoState(2) && hasQuestItems(killer, FINAL_ORDER)) { final int i0 = qs.getMemoStateEx(1); qs.setMemoStateEx(1, i0 + 1); - if (giveItemRandomly(killer, npc, LAKINS_MACE, 1, 3, 1.0, true) && (getQuestItemsCount(killer, EXCUROS_SKIN, KRATORS_SHARD, GRANDIS_SKIN, TIMAK_ORCS_BELT) == 12)) - { - if (i0 >= 5) - { + if (giveItemRandomly(killer, npc, LAKINS_MACE, 1, 3, 1.0, true) && (getQuestItemsCount(killer, EXCUROS_SKIN, KRATORS_SHARD, GRANDIS_SKIN, TIMAK_ORCS_BELT) == 12)) { + if (i0 >= 5) { qs.setCond(5); } qs.setMemoStateEx(1, 0); @@ -459,60 +376,39 @@ public final class Q00222_TestOfTheDuelist extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if ((player.getClassId() == ClassId.warrior) || (player.getClassId() == ClassId.elvenKnight) || (player.getClassId() == ClassId.palusKnight) || (player.getClassId() == ClassId.orcMonk)) - { - if (player.getLevel() >= MIN_LEVEL) - { + if (qs.isCreated()) { + if ((player.getClassId() == ClassId.warrior) || (player.getClassId() == ClassId.elvenKnight) || (player.getClassId() == ClassId.palusKnight) || (player.getClassId() == ClassId.orcMonk)) { + if (player.getLevel() >= MIN_LEVEL) { htmltext = "30623-03.htm"; - } - else - { + } else { htmltext = "30623-01.html"; } - } - else - { + } else { htmltext = "30623-02.html"; } - } - else if (qs.isStarted()) - { - if (hasQuestItems(player, ORDER_GLUDIO, ORDER_DION, ORDER_GIRAN, ORDER_OREN, ORDER_ADEN)) - { - if (getQuestItemsCount(player, PUNCHERS_SHARD, NOBLE_ANTS_FEELER, DRONES_CHITIN, DEAD_SEEKER_FANG, OVERLORD_NECKLACE, FETTERED_SOULS_CHAIN, CHIEDS_AMULET, ENCHANTED_EYE_MEAT, TAMRIN_ORCS_RING, TAMRIN_ORCS_ARROW) == 100) - { + } else if (qs.isStarted()) { + if (hasQuestItems(player, ORDER_GLUDIO, ORDER_DION, ORDER_GIRAN, ORDER_OREN, ORDER_ADEN)) { + if (getQuestItemsCount(player, PUNCHERS_SHARD, NOBLE_ANTS_FEELER, DRONES_CHITIN, DEAD_SEEKER_FANG, OVERLORD_NECKLACE, FETTERED_SOULS_CHAIN, CHIEDS_AMULET, ENCHANTED_EYE_MEAT, TAMRIN_ORCS_RING, TAMRIN_ORCS_ARROW) == 100) { htmltext = "30623-13.html"; - } - else - { + } else { htmltext = "30623-14.html"; } - } - else if (hasQuestItems(player, FINAL_ORDER)) - { - if (getQuestItemsCount(player, EXCUROS_SKIN, KRATORS_SHARD, LAKINS_MACE, GRANDIS_SKIN, TIMAK_ORCS_BELT) == 15) - { + } else if (hasQuestItems(player, FINAL_ORDER)) { + if (getQuestItemsCount(player, EXCUROS_SKIN, KRATORS_SHARD, LAKINS_MACE, GRANDIS_SKIN, TIMAK_ORCS_BELT) == 15) { giveAdena(player, 161806, true); giveItems(player, MARK_OF_DUELIST, 1); addExpAndSp(player, 894888, 61408); qs.exitQuest(false, true); player.sendPacket(new SocialAction(player.getObjectId(), 3)); htmltext = "30623-18.html"; - } - else - { + } else { htmltext = "30623-17.html"; } } - } - else if (qs.isCompleted()) - { + } else if (qs.isCompleted()) { htmltext = getAlreadyCompletedMsg(player); } return htmltext; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00223_TestOfTheChampion/Q00223_TestOfTheChampion.java b/src/main/java/com/l2jserver/datapack/quests/Q00223_TestOfTheChampion/Q00223_TestOfTheChampion.java index b3a9d86c1e..74ebd893c7 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00223_TestOfTheChampion/Q00223_TestOfTheChampion.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00223_TestOfTheChampion/Q00223_TestOfTheChampion.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Test Of The Champion (223) * @author ivantotov */ -public final class Q00223_TestOfTheChampion extends Quest -{ +public final class Q00223_TestOfTheChampion extends Quest { // NPCs private static final int TRADER_GROOT = 30093; private static final int CAPTAIN_MOUEN = 30196; @@ -76,8 +75,7 @@ public final class Q00223_TestOfTheChampion extends Quest // Misc private static final int MIN_LEVEL = 39; - public Q00223_TestOfTheChampion() - { + public Q00223_TestOfTheChampion() { super(223, Q00223_TestOfTheChampion.class.getSimpleName(), "Test Of The Champion"); addStartNpc(VETERAN_ASCALON); addTalkId(VETERAN_ASCALON, TRADER_GROOT, CAPTAIN_MOUEN, MASON); @@ -87,39 +85,28 @@ public final class Q00223_TestOfTheChampion extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (qs.isCreated()) - { + switch (event) { + case "ACCEPT": { + if (qs.isCreated()) { qs.startQuest(); playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); giveItems(player, ASCALONS_1ST_LETTER, 1); - if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) - { - if (player.getClassId() == ClassId.warrior) - { + if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) { + if (player.getClassId() == ClassId.warrior) { giveItems(player, DIMENSIONAL_DIAMOND, 72); - } - else - { + } else { giveItems(player, DIMENSIONAL_DIAMOND, 64); } player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1); htmltext = "30624-06a.htm"; - } - else - { + } else { htmltext = "30624-06.htm"; } } @@ -127,15 +114,12 @@ public final class Q00223_TestOfTheChampion extends Quest } case "30624-05.htm": case "30196-02.html": - case "30625-02.html": - { + case "30625-02.html": { htmltext = event; break; } - case "30624-10.html": - { - if (hasQuestItems(player, MASONS_LETTER)) - { + case "30624-10.html": { + if (hasQuestItems(player, MASONS_LETTER)) { takeItems(player, MASONS_LETTER, 1); giveItems(player, ASCALONS_2ND_LETTER, 1); qs.setCond(5, true); @@ -143,10 +127,8 @@ public final class Q00223_TestOfTheChampion extends Quest } break; } - case "30624-14.html": - { - if (hasQuestItems(player, GROOTS_LETTER)) - { + case "30624-14.html": { + if (hasQuestItems(player, GROOTS_LETTER)) { takeItems(player, GROOTS_LETTER, 1); giveItems(player, ASCALONS_3RD_LETTER, 1); qs.setCond(9, true); @@ -154,10 +136,8 @@ public final class Q00223_TestOfTheChampion extends Quest } break; } - case "30093-02.html": - { - if (hasQuestItems(player, ASCALONS_2ND_LETTER)) - { + case "30093-02.html": { + if (hasQuestItems(player, ASCALONS_2ND_LETTER)) { takeItems(player, ASCALONS_2ND_LETTER, 1); giveItems(player, WHITE_ROSE_INSIGNIA, 1); qs.setCond(6, true); @@ -165,10 +145,8 @@ public final class Q00223_TestOfTheChampion extends Quest } break; } - case "30196-03.html": - { - if (hasQuestItems(player, ASCALONS_3RD_LETTER)) - { + case "30196-03.html": { + if (hasQuestItems(player, ASCALONS_3RD_LETTER)) { takeItems(player, ASCALONS_3RD_LETTER, 1); giveItems(player, MOUENS_1ST_ORDER, 1); qs.setCond(10, true); @@ -176,10 +154,8 @@ public final class Q00223_TestOfTheChampion extends Quest } break; } - case "30196-06.html": - { - if (getQuestItemsCount(player, ROAD_RATMAN_HEAD) >= 10) - { + case "30196-06.html": { + if (getQuestItemsCount(player, ROAD_RATMAN_HEAD) >= 10) { takeItems(player, MOUENS_1ST_ORDER, 1); giveItems(player, MOUENS_2ND_ORDER, 1); takeItems(player, ROAD_RATMAN_HEAD, -1); @@ -188,10 +164,8 @@ public final class Q00223_TestOfTheChampion extends Quest } break; } - case "30625-03.html": - { - if (hasQuestItems(player, ASCALONS_1ST_LETTER)) - { + case "30625-03.html": { + if (hasQuestItems(player, ASCALONS_1ST_LETTER)) { takeItems(player, ASCALONS_1ST_LETTER, 1); giveItems(player, IRON_ROSE_RING, 1); qs.setCond(2, true); @@ -204,30 +178,19 @@ public final class Q00223_TestOfTheChampion extends Quest } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { final QuestState qs = getQuestState(attacker, false); - if ((qs != null) && qs.isStarted()) - { - switch (npc.getId()) - { - case HARPY: - { - switch (npc.getScriptValue()) - { - case 0: - { + if ((qs != null) && qs.isStarted()) { + switch (npc.getId()) { + case HARPY: { + switch (npc.getScriptValue()) { + case 0: { npc.getVariables().set("lastAttacker", attacker.getObjectId()); - if (hasQuestItems(attacker, WHITE_ROSE_INSIGNIA) && (getQuestItemsCount(attacker, HARPYS_EGG) < 30)) - { - if (getRandomBoolean()) - { - if (getRandom(10) < 7) - { + if (hasQuestItems(attacker, WHITE_ROSE_INSIGNIA) && (getQuestItemsCount(attacker, HARPYS_EGG) < 30)) { + if (getRandomBoolean()) { + if (getRandom(10) < 7) { addAttackDesire(addSpawn(HARPY_MATRIARCH, npc, true, 0, false), attacker); - } - else - { + } else { addAttackDesire(addSpawn(HARPY_MATRIARCH, npc, true, 0, false), attacker); addAttackDesire(addSpawn(HARPY_MATRIARCH, npc, true, 0, false), attacker); } @@ -236,31 +199,22 @@ public final class Q00223_TestOfTheChampion extends Quest npc.setScriptValue(1); break; } - case 1: - { + case 1: { npc.setScriptValue(2); break; } } break; } - case ROAD_SCAVENGER: - { - switch (npc.getScriptValue()) - { - case 0: - { + case ROAD_SCAVENGER: { + switch (npc.getScriptValue()) { + case 0: { npc.getVariables().set("lastAttacker", attacker.getObjectId()); - if (hasQuestItems(attacker, MOUENS_1ST_ORDER) && (getQuestItemsCount(attacker, ROAD_RATMAN_HEAD) < 10)) - { - if (getRandomBoolean()) - { - if (getRandom(10) < 7) - { + if (hasQuestItems(attacker, MOUENS_1ST_ORDER) && (getQuestItemsCount(attacker, ROAD_RATMAN_HEAD) < 10)) { + if (getRandomBoolean()) { + if (getRandom(10) < 7) { addAttackDesire(addSpawn(ROAD_COLLECTOR, npc, true, 0, false), attacker); - } - else - { + } else { addAttackDesire(addSpawn(ROAD_COLLECTOR, npc, true, 0, false), attacker); addAttackDesire(addSpawn(ROAD_COLLECTOR, npc, true, 0, false), attacker); } @@ -269,33 +223,26 @@ public final class Q00223_TestOfTheChampion extends Quest npc.setScriptValue(1); break; } - case 1: - { + case 1: { npc.setScriptValue(2); break; } } break; } - case BLOODY_AXE_ELITE: - { - switch (npc.getScriptValue()) - { - case 0: - { + case BLOODY_AXE_ELITE: { + switch (npc.getScriptValue()) { + case 0: { npc.getVariables().set("lastAttacker", attacker.getObjectId()); - if (hasQuestItems(attacker, IRON_ROSE_RING) && (getQuestItemsCount(attacker, BLOODY_AXE_HEAD) < 10)) - { - if (getRandomBoolean()) - { + if (hasQuestItems(attacker, IRON_ROSE_RING) && (getQuestItemsCount(attacker, BLOODY_AXE_HEAD) < 10)) { + if (getRandomBoolean()) { addAttackDesire(addSpawn(BLOODY_AXE_ELITE, npc, true, 0, false), attacker); } } npc.setScriptValue(1); break; } - case 1: - { + case 1: { npc.setScriptValue(2); break; } @@ -308,71 +255,50 @@ public final class Q00223_TestOfTheChampion extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { case HARPY: - case HARPY_MATRIARCH: - { - if (hasQuestItems(killer, WHITE_ROSE_INSIGNIA) && (getQuestItemsCount(killer, HARPYS_EGG) < 30)) - { - if (getQuestItemsCount(killer, HARPYS_EGG) >= 28) - { + case HARPY_MATRIARCH: { + if (hasQuestItems(killer, WHITE_ROSE_INSIGNIA) && (getQuestItemsCount(killer, HARPYS_EGG) < 30)) { + if (getQuestItemsCount(killer, HARPYS_EGG) >= 28) { giveItems(killer, HARPYS_EGG, 2); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if ((getQuestItemsCount(killer, MEDUSA_VENOM) >= 30) && (getQuestItemsCount(killer, WINDSUS_BILE) >= 30)) - { + if ((getQuestItemsCount(killer, MEDUSA_VENOM) >= 30) && (getQuestItemsCount(killer, WINDSUS_BILE) >= 30)) { qs.setCond(7); } - } - else - { + } else { giveItems(killer, HARPYS_EGG, 2); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case MEDUSA: - { - if (hasQuestItems(killer, WHITE_ROSE_INSIGNIA) && (getQuestItemsCount(killer, MEDUSA_VENOM) < 30)) - { - if (getQuestItemsCount(killer, MEDUSA_VENOM) >= 27) - { + case MEDUSA: { + if (hasQuestItems(killer, WHITE_ROSE_INSIGNIA) && (getQuestItemsCount(killer, MEDUSA_VENOM) < 30)) { + if (getQuestItemsCount(killer, MEDUSA_VENOM) >= 27) { giveItems(killer, MEDUSA_VENOM, 3); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if ((getQuestItemsCount(killer, HARPYS_EGG) >= 30) && (getQuestItemsCount(killer, WINDSUS_BILE) >= 30)) - { + if ((getQuestItemsCount(killer, HARPYS_EGG) >= 30) && (getQuestItemsCount(killer, WINDSUS_BILE) >= 30)) { qs.setCond(7); } - } - else - { + } else { giveItems(killer, MEDUSA_VENOM, 3); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case WINDSUS: - { - if (hasQuestItems(killer, WHITE_ROSE_INSIGNIA) && (getQuestItemsCount(killer, WINDSUS_BILE) < 30)) - { - if (getQuestItemsCount(killer, WINDSUS_BILE) >= 27) - { + case WINDSUS: { + if (hasQuestItems(killer, WHITE_ROSE_INSIGNIA) && (getQuestItemsCount(killer, WINDSUS_BILE) < 30)) { + if (getQuestItemsCount(killer, WINDSUS_BILE) >= 27) { giveItems(killer, WINDSUS_BILE, 3); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if ((getQuestItemsCount(killer, HARPYS_EGG) >= 30) && (getQuestItemsCount(killer, MEDUSA_VENOM) >= 30)) - { + if ((getQuestItemsCount(killer, HARPYS_EGG) >= 30) && (getQuestItemsCount(killer, MEDUSA_VENOM) >= 30)) { qs.setCond(7); } - } - else - { + } else { giveItems(killer, WINDSUS_BILE, 3); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -380,17 +306,12 @@ public final class Q00223_TestOfTheChampion extends Quest break; } case ROAD_SCAVENGER: - case ROAD_COLLECTOR: - { - if (hasQuestItems(killer, MOUENS_1ST_ORDER) && (getQuestItemsCount(killer, ROAD_RATMAN_HEAD) < 10)) - { - if (getQuestItemsCount(killer, ROAD_RATMAN_HEAD) >= 9) - { + case ROAD_COLLECTOR: { + if (hasQuestItems(killer, MOUENS_1ST_ORDER) && (getQuestItemsCount(killer, ROAD_RATMAN_HEAD) < 10)) { + if (getQuestItemsCount(killer, ROAD_RATMAN_HEAD) >= 9) { giveItems(killer, ROAD_RATMAN_HEAD, 1); qs.setCond(11, true); - } - else - { + } else { giveItems(killer, ROAD_RATMAN_HEAD, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -402,34 +323,24 @@ public final class Q00223_TestOfTheChampion extends Quest case LETO_LIZARDMAN_SOLDIER: case LETO_LIZARDMAN_WARRIOR: case LETO_LIZARDMAN_SHAMAN: - case LETO_LIZARDMAN_OCERLORD: - { - if (hasQuestItems(killer, MOUENS_2ND_ORDER) && (getQuestItemsCount(killer, LETO_LIZARDMAN_FANG) < 10)) - { - if (getQuestItemsCount(killer, LETO_LIZARDMAN_FANG) >= 9) - { + case LETO_LIZARDMAN_OCERLORD: { + if (hasQuestItems(killer, MOUENS_2ND_ORDER) && (getQuestItemsCount(killer, LETO_LIZARDMAN_FANG) < 10)) { + if (getQuestItemsCount(killer, LETO_LIZARDMAN_FANG) >= 9) { giveItems(killer, LETO_LIZARDMAN_FANG, 1); qs.setCond(13, true); - } - else - { + } else { giveItems(killer, LETO_LIZARDMAN_FANG, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case BLOODY_AXE_ELITE: - { - if (hasQuestItems(killer, IRON_ROSE_RING) && (getQuestItemsCount(killer, BLOODY_AXE_HEAD) < 10)) - { - if (getQuestItemsCount(killer, BLOODY_AXE_HEAD) >= 9) - { + case BLOODY_AXE_ELITE: { + if (hasQuestItems(killer, IRON_ROSE_RING) && (getQuestItemsCount(killer, BLOODY_AXE_HEAD) < 10)) { + if (getQuestItemsCount(killer, BLOODY_AXE_HEAD) >= 9) { giveItems(killer, BLOODY_AXE_HEAD, 1); qs.setCond(3, true); - } - else - { + } else { giveItems(killer, BLOODY_AXE_HEAD, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -442,78 +353,45 @@ public final class Q00223_TestOfTheChampion extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == VETERAN_ASCALON) - { - if ((player.getClassId() == ClassId.warrior) || (player.getClassId() == ClassId.orcRaider)) - { - if (player.getLevel() >= MIN_LEVEL) - { - if (player.getClassId() == ClassId.warrior) - { + if (qs.isCreated()) { + if (npc.getId() == VETERAN_ASCALON) { + if ((player.getClassId() == ClassId.warrior) || (player.getClassId() == ClassId.orcRaider)) { + if (player.getLevel() >= MIN_LEVEL) { + if (player.getClassId() == ClassId.warrior) { htmltext = "30624-03.htm"; - } - else - { + } else { htmltext = "30624-04.html"; } - } - else - { + } else { htmltext = "30624-01.html"; } - } - else - { + } else { htmltext = "30624-02.html"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case VETERAN_ASCALON: - { - if (hasQuestItems(player, ASCALONS_1ST_LETTER)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case VETERAN_ASCALON: { + if (hasQuestItems(player, ASCALONS_1ST_LETTER)) { htmltext = "30624-07.html"; - } - else if (hasQuestItems(player, IRON_ROSE_RING)) - { + } else if (hasQuestItems(player, IRON_ROSE_RING)) { htmltext = "30624-08.html"; - } - else if (hasQuestItems(player, MASONS_LETTER)) - { + } else if (hasQuestItems(player, MASONS_LETTER)) { htmltext = "30624-09.html"; - } - else if (hasQuestItems(player, ASCALONS_2ND_LETTER)) - { + } else if (hasQuestItems(player, ASCALONS_2ND_LETTER)) { htmltext = "30624-11.html"; - } - else if (hasQuestItems(player, WHITE_ROSE_INSIGNIA)) - { + } else if (hasQuestItems(player, WHITE_ROSE_INSIGNIA)) { htmltext = "30624-12.html"; - } - else if (hasQuestItems(player, GROOTS_LETTER)) - { + } else if (hasQuestItems(player, GROOTS_LETTER)) { htmltext = "30624-13.html"; - } - else if (hasQuestItems(player, ASCALONS_3RD_LETTER)) - { + } else if (hasQuestItems(player, ASCALONS_3RD_LETTER)) { htmltext = "30624-15.html"; - } - else if (hasAtLeastOneQuestItem(player, MOUENS_1ST_ORDER, MOUENS_2ND_ORDER)) - { + } else if (hasAtLeastOneQuestItem(player, MOUENS_1ST_ORDER, MOUENS_2ND_ORDER)) { htmltext = "30624-16.html"; - } - else if (hasQuestItems(player, MOUENS_LETTER)) - { + } else if (hasQuestItems(player, MOUENS_LETTER)) { giveAdena(player, 229764, true); giveItems(player, MARK_OF_CHAMPION, 1); addExpAndSp(player, 1270742, 87200); @@ -523,16 +401,11 @@ public final class Q00223_TestOfTheChampion extends Quest } break; } - case TRADER_GROOT: - { - if (hasQuestItems(player, ASCALONS_2ND_LETTER)) - { + case TRADER_GROOT: { + if (hasQuestItems(player, ASCALONS_2ND_LETTER)) { htmltext = "30093-01.html"; - } - else if (hasQuestItems(player, WHITE_ROSE_INSIGNIA)) - { - if ((getQuestItemsCount(player, HARPYS_EGG) >= 30) && (getQuestItemsCount(player, MEDUSA_VENOM) >= 30) && (getQuestItemsCount(player, WINDSUS_BILE) >= 30)) - { + } else if (hasQuestItems(player, WHITE_ROSE_INSIGNIA)) { + if ((getQuestItemsCount(player, HARPYS_EGG) >= 30) && (getQuestItemsCount(player, MEDUSA_VENOM) >= 30) && (getQuestItemsCount(player, WINDSUS_BILE) >= 30)) { takeItems(player, WHITE_ROSE_INSIGNIA, 1); giveItems(player, GROOTS_LETTER, 1); takeItems(player, HARPYS_EGG, -1); @@ -540,97 +413,63 @@ public final class Q00223_TestOfTheChampion extends Quest takeItems(player, WINDSUS_BILE, -1); qs.setCond(8, true); htmltext = "30093-04.html"; - } - else - { + } else { htmltext = "30093-03.html"; } - } - else if (hasQuestItems(player, GROOTS_LETTER)) - { + } else if (hasQuestItems(player, GROOTS_LETTER)) { htmltext = "30093-05.html"; - } - else if (hasAtLeastOneQuestItem(player, ASCALONS_3RD_LETTER, MOUENS_1ST_ORDER, MOUENS_2ND_ORDER, MOUENS_LETTER)) - { + } else if (hasAtLeastOneQuestItem(player, ASCALONS_3RD_LETTER, MOUENS_1ST_ORDER, MOUENS_2ND_ORDER, MOUENS_LETTER)) { htmltext = "30093-06.html"; } break; } - case CAPTAIN_MOUEN: - { - if (hasQuestItems(player, ASCALONS_3RD_LETTER)) - { + case CAPTAIN_MOUEN: { + if (hasQuestItems(player, ASCALONS_3RD_LETTER)) { htmltext = "30196-01.html"; - } - else if (hasQuestItems(player, MOUENS_1ST_ORDER)) - { - if (getQuestItemsCount(player, ROAD_RATMAN_HEAD) < 10) - { + } else if (hasQuestItems(player, MOUENS_1ST_ORDER)) { + if (getQuestItemsCount(player, ROAD_RATMAN_HEAD) < 10) { htmltext = "30196-04.html"; - } - else - { + } else { htmltext = "30196-05.html"; } - } - else if (hasQuestItems(player, MOUENS_2ND_ORDER)) - { - if (getQuestItemsCount(player, LETO_LIZARDMAN_FANG) < 10) - { + } else if (hasQuestItems(player, MOUENS_2ND_ORDER)) { + if (getQuestItemsCount(player, LETO_LIZARDMAN_FANG) < 10) { htmltext = "30196-07.html"; - } - else - { + } else { takeItems(player, MOUENS_2ND_ORDER, 1); giveItems(player, MOUENS_LETTER, 1); takeItems(player, LETO_LIZARDMAN_FANG, -1); qs.setCond(14, true); htmltext = "30196-08.html"; } - } - else if (hasQuestItems(player, MOUENS_LETTER)) - { + } else if (hasQuestItems(player, MOUENS_LETTER)) { htmltext = "30196-09.html"; } break; } - case MASON: - { - if (hasQuestItems(player, ASCALONS_1ST_LETTER)) - { + case MASON: { + if (hasQuestItems(player, ASCALONS_1ST_LETTER)) { htmltext = "30625-01.html"; - } - else if (hasQuestItems(player, IRON_ROSE_RING)) - { - if (getQuestItemsCount(player, BLOODY_AXE_HEAD) < 10) - { + } else if (hasQuestItems(player, IRON_ROSE_RING)) { + if (getQuestItemsCount(player, BLOODY_AXE_HEAD) < 10) { htmltext = "30625-04.html"; - } - else - { + } else { giveItems(player, MASONS_LETTER, 1); takeItems(player, IRON_ROSE_RING, 1); takeItems(player, BLOODY_AXE_HEAD, -1); qs.setCond(4, true); htmltext = "30625-05.html"; } - } - else if (hasQuestItems(player, MASONS_LETTER)) - { + } else if (hasQuestItems(player, MASONS_LETTER)) { htmltext = "30625-06.html"; - } - else if (hasAtLeastOneQuestItem(player, ASCALONS_2ND_LETTER, WHITE_ROSE_INSIGNIA, GROOTS_LETTER, ASCALONS_3RD_LETTER, MOUENS_1ST_ORDER, MOUENS_2ND_ORDER, MOUENS_LETTER)) - { + } else if (hasAtLeastOneQuestItem(player, ASCALONS_2ND_LETTER, WHITE_ROSE_INSIGNIA, GROOTS_LETTER, ASCALONS_3RD_LETTER, MOUENS_1ST_ORDER, MOUENS_2ND_ORDER, MOUENS_LETTER)) { htmltext = "30625-07.html"; } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == VETERAN_ASCALON) - { + } else if (qs.isCompleted()) { + if (npc.getId() == VETERAN_ASCALON) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00224_TestOfSagittarius/Q00224_TestOfSagittarius.java b/src/main/java/com/l2jserver/datapack/quests/Q00224_TestOfSagittarius/Q00224_TestOfSagittarius.java index bf33c3b2b0..64456ccca6 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00224_TestOfSagittarius/Q00224_TestOfSagittarius.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00224_TestOfSagittarius/Q00224_TestOfSagittarius.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Test Of Sagittarius (224) * @author ivantotov */ -public final class Q00224_TestOfSagittarius extends Quest -{ +public final class Q00224_TestOfSagittarius extends Quest { // NPCs private static final int PREFECT_VOKIAN = 30514; private static final int SAGITTARIUS_HAMIL = 30626; @@ -86,8 +85,7 @@ public final class Q00224_TestOfSagittarius extends Quest // Misc private static final int MIN_LEVEL = 39; - public Q00224_TestOfSagittarius() - { + public Q00224_TestOfSagittarius() { super(224, Q00224_TestOfSagittarius.class.getSimpleName(), "Test Of Sagittarius"); addStartNpc(GUILD_PRESIDENT_BERNARD); addTalkId(GUILD_PRESIDENT_BERNARD, PREFECT_VOKIAN, SAGITTARIUS_HAMIL, SIR_ARON_TANFORD, MAGISTER_GAUEN); @@ -96,42 +94,32 @@ public final class Q00224_TestOfSagittarius extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (qs.isCreated()) - { + switch (event) { + case "ACCEPT": { + if (qs.isCreated()) { qs.startQuest(); qs.setMemoState(1); playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); giveItems(player, BERNARDS_INTRODUCTION, 1); - if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) - { + if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) { giveItems(player, DIMENSIONAL_DIAMOND, 96); player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1); htmltext = "30702-04a.htm"; - } - else - { + } else { htmltext = "30702-04.htm"; } } break; } - case "30514-02.html": - { - if (hasQuestItems(player, HAMILS_2ND_LETTER)) - { + case "30514-02.html": { + if (hasQuestItems(player, HAMILS_2ND_LETTER)) { takeItems(player, HAMILS_2ND_LETTER, 1); qs.setMemoState(6); qs.setCond(6, true); @@ -140,15 +128,12 @@ public final class Q00224_TestOfSagittarius extends Quest break; } case "30626-02.html": - case "30626-06.html": - { + case "30626-06.html": { htmltext = event; break; } - case "30626-03.html": - { - if (hasQuestItems(player, BERNARDS_INTRODUCTION)) - { + case "30626-03.html": { + if (hasQuestItems(player, BERNARDS_INTRODUCTION)) { takeItems(player, BERNARDS_INTRODUCTION, 1); giveItems(player, HAMILS_1ST_LETTER, 1); qs.setMemoState(2); @@ -157,10 +142,8 @@ public final class Q00224_TestOfSagittarius extends Quest } break; } - case "30626-07.html": - { - if (getQuestItemsCount(player, HUNTERS_1ST_RUNE) >= 10) - { + case "30626-07.html": { + if (getQuestItemsCount(player, HUNTERS_1ST_RUNE) >= 10) { giveItems(player, HAMILS_2ND_LETTER, 1); takeItems(player, HUNTERS_1ST_RUNE, -1); qs.setMemoState(5); @@ -169,10 +152,8 @@ public final class Q00224_TestOfSagittarius extends Quest } break; } - case "30653-02.html": - { - if (hasQuestItems(player, HAMILS_1ST_LETTER)) - { + case "30653-02.html": { + if (hasQuestItems(player, HAMILS_1ST_LETTER)) { takeItems(player, HAMILS_1ST_LETTER, 1); qs.setMemoState(3); qs.setCond(3, true); @@ -185,13 +166,10 @@ public final class Q00224_TestOfSagittarius extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { case ANT: case ANT_CAPTAIN: case ANT_OVERSEER: @@ -199,18 +177,13 @@ public final class Q00224_TestOfSagittarius extends Quest case ANT_PATROL: case ANT_GUARD: case NOBLE_ANT: - case NOBLE_ANT_LEADER: - { - if (qs.isMemoState(3) && (getQuestItemsCount(killer, HUNTERS_1ST_RUNE) < 10)) - { - if (getQuestItemsCount(killer, HUNTERS_1ST_RUNE) == 9) - { + case NOBLE_ANT_LEADER: { + if (qs.isMemoState(3) && (getQuestItemsCount(killer, HUNTERS_1ST_RUNE) < 10)) { + if (getQuestItemsCount(killer, HUNTERS_1ST_RUNE) == 9) { giveItems(killer, HUNTERS_1ST_RUNE, 1); qs.setMemoState(4); qs.setCond(4, true); - } - else - { + } else { giveItems(killer, HUNTERS_1ST_RUNE, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -219,36 +192,26 @@ public final class Q00224_TestOfSagittarius extends Quest } case MARSH_STAKATO_WORKER: case MARSH_STAKATO_SOLDIER: - case MARSH_STAKATO_DRONE: - { - if (qs.isMemoState(10) && !hasQuestItems(killer, STAKATO_CHITIN)) - { - if (hasQuestItems(killer, MITHRIL_CLIP, REINFORCED_BOWSTRING, MANASHENS_HORN)) - { + case MARSH_STAKATO_DRONE: { + if (qs.isMemoState(10) && !hasQuestItems(killer, STAKATO_CHITIN)) { + if (hasQuestItems(killer, MITHRIL_CLIP, REINFORCED_BOWSTRING, MANASHENS_HORN)) { giveItems(killer, STAKATO_CHITIN, 1); qs.setMemoState(11); qs.setCond(11, true); - } - else - { + } else { giveItems(killer, STAKATO_CHITIN, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case MARSH_SPIDER: - { - if (qs.isMemoState(10) && !hasQuestItems(killer, REINFORCED_BOWSTRING)) - { - if (hasQuestItems(killer, MITHRIL_CLIP, MANASHENS_HORN, STAKATO_CHITIN)) - { + case MARSH_SPIDER: { + if (qs.isMemoState(10) && !hasQuestItems(killer, REINFORCED_BOWSTRING)) { + if (hasQuestItems(killer, MITHRIL_CLIP, MANASHENS_HORN, STAKATO_CHITIN)) { giveItems(killer, REINFORCED_BOWSTRING, 1); qs.setMemoState(11); qs.setCond(11, true); - } - else - { + } else { giveItems(killer, REINFORCED_BOWSTRING, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -256,55 +219,40 @@ public final class Q00224_TestOfSagittarius extends Quest break; } case BREKA_ORC_SHAMAN: - case BREKA_ORC_OVERLORD: - { - if (qs.isMemoState(6) && (getQuestItemsCount(killer, HUNTERS_2ND_RUNE) < 10)) - { - if (getQuestItemsCount(killer, HUNTERS_2ND_RUNE) == 9) - { + case BREKA_ORC_OVERLORD: { + if (qs.isMemoState(6) && (getQuestItemsCount(killer, HUNTERS_2ND_RUNE) < 10)) { + if (getQuestItemsCount(killer, HUNTERS_2ND_RUNE) == 9) { giveItems(killer, HUNTERS_2ND_RUNE, 1); giveItems(killer, TALISMAN_OF_SNAKE, 1); qs.setMemoState(7); qs.setCond(7, true); - } - else - { + } else { giveItems(killer, HUNTERS_2ND_RUNE, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case ROAD_SCAVENGER: - { - if (qs.isMemoState(10) && !hasQuestItems(killer, MITHRIL_CLIP)) - { - if (hasQuestItems(killer, REINFORCED_BOWSTRING, MANASHENS_HORN, STAKATO_CHITIN)) - { + case ROAD_SCAVENGER: { + if (qs.isMemoState(10) && !hasQuestItems(killer, MITHRIL_CLIP)) { + if (hasQuestItems(killer, REINFORCED_BOWSTRING, MANASHENS_HORN, STAKATO_CHITIN)) { giveItems(killer, MITHRIL_CLIP, 1); qs.setMemoState(11); qs.setCond(11, true); - } - else - { + } else { giveItems(killer, MITHRIL_CLIP, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case MANASHEN_GARGOYLE: - { - if (qs.isMemoState(10) && !hasQuestItems(killer, MANASHENS_HORN)) - { - if (hasQuestItems(killer, MITHRIL_CLIP, REINFORCED_BOWSTRING, STAKATO_CHITIN)) - { + case MANASHEN_GARGOYLE: { + if (qs.isMemoState(10) && !hasQuestItems(killer, MANASHENS_HORN)) { + if (hasQuestItems(killer, MITHRIL_CLIP, REINFORCED_BOWSTRING, STAKATO_CHITIN)) { giveItems(killer, MANASHENS_HORN, 1); qs.setMemoState(11); qs.setCond(11, true); - } - else - { + } else { giveItems(killer, MANASHENS_HORN, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -316,36 +264,26 @@ public final class Q00224_TestOfSagittarius extends Quest case LETO_LIZARDMAN_SOLDIER: case LETO_LIZARDMAN_WARRIOR: case LETO_LIZARDMAN_SHAMAN: - case LETO_LIZARDMAN_OVERLORD: - { - if (qs.isMemoState(13) && (getQuestItemsCount(killer, BLOOD_OF_LIZARDMAN) < 140)) - { - if (((getQuestItemsCount(killer, BLOOD_OF_LIZARDMAN) - 10) * 5) > getRandom(100)) - { + case LETO_LIZARDMAN_OVERLORD: { + if (qs.isMemoState(13) && (getQuestItemsCount(killer, BLOOD_OF_LIZARDMAN) < 140)) { + if (((getQuestItemsCount(killer, BLOOD_OF_LIZARDMAN) - 10) * 5) > getRandom(100)) { addSpawn(SERPENT_DEMON_KADESH, npc, true, 300000); takeItems(killer, BLOOD_OF_LIZARDMAN, -1); playSound(killer, Sound.ITEMSOUND_QUEST_BEFORE_BATTLE); - } - else - { + } else { giveItems(killer, BLOOD_OF_LIZARDMAN, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case SERPENT_DEMON_KADESH: - { - if (qs.isMemoState(13) && !hasQuestItems(killer, TALISMAN_OF_KADESH)) - { - if (npc.getKillingBlowWeapon() == CRESCENT_MOON_BOW) - { + case SERPENT_DEMON_KADESH: { + if (qs.isMemoState(13) && !hasQuestItems(killer, TALISMAN_OF_KADESH)) { + if (npc.getKillingBlowWeapon() == CRESCENT_MOON_BOW) { giveItems(killer, TALISMAN_OF_KADESH, 1); qs.setMemoState(14); qs.setCond(14, true); - } - else - { + } else { addSpawn(SERPENT_DEMON_KADESH, npc, true, 300000); } } @@ -357,135 +295,86 @@ public final class Q00224_TestOfSagittarius extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); final int memoState = qs.getMemoState(); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == GUILD_PRESIDENT_BERNARD) - { - if ((player.getClassId() == ClassId.rogue) || (player.getClassId() == ClassId.elvenScout) || (player.getClassId() == ClassId.assassin)) - { - if (player.getLevel() >= MIN_LEVEL) - { + if (qs.isCreated()) { + if (npc.getId() == GUILD_PRESIDENT_BERNARD) { + if ((player.getClassId() == ClassId.rogue) || (player.getClassId() == ClassId.elvenScout) || (player.getClassId() == ClassId.assassin)) { + if (player.getLevel() >= MIN_LEVEL) { htmltext = "30702-03.htm"; - } - else - { + } else { htmltext = "30702-01.html"; } - } - else - { + } else { htmltext = "30702-02.html"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case GUILD_PRESIDENT_BERNARD: - { - if (hasQuestItems(player, BERNARDS_INTRODUCTION)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case GUILD_PRESIDENT_BERNARD: { + if (hasQuestItems(player, BERNARDS_INTRODUCTION)) { htmltext = "30702-05.html"; } break; } - case PREFECT_VOKIAN: - { - if (memoState == 5) - { - if (hasQuestItems(player, HAMILS_2ND_LETTER)) - { + case PREFECT_VOKIAN: { + if (memoState == 5) { + if (hasQuestItems(player, HAMILS_2ND_LETTER)) { htmltext = "30514-01.html"; } - } - else if (memoState == 6) - { + } else if (memoState == 6) { htmltext = "30514-03.html"; - } - else if (memoState == 7) - { - if (hasQuestItems(player, TALISMAN_OF_SNAKE)) - { + } else if (memoState == 7) { + if (hasQuestItems(player, TALISMAN_OF_SNAKE)) { takeItems(player, TALISMAN_OF_SNAKE, 1); qs.setMemoState(8); qs.setCond(8, true); htmltext = "30514-04.html"; } - } - else if (memoState == 8) - { + } else if (memoState == 8) { htmltext = "30514-05.html"; } break; } - case SAGITTARIUS_HAMIL: - { - if (memoState == 1) - { - if (hasQuestItems(player, BERNARDS_INTRODUCTION)) - { + case SAGITTARIUS_HAMIL: { + if (memoState == 1) { + if (hasQuestItems(player, BERNARDS_INTRODUCTION)) { htmltext = "30626-01.html"; } - } - else if (memoState == 2) - { - if (hasQuestItems(player, HAMILS_1ST_LETTER)) - { + } else if (memoState == 2) { + if (hasQuestItems(player, HAMILS_1ST_LETTER)) { htmltext = "30626-04.html"; } - } - else if (memoState == 4) - { - if (getQuestItemsCount(player, HUNTERS_1ST_RUNE) == 10) - { + } else if (memoState == 4) { + if (getQuestItemsCount(player, HUNTERS_1ST_RUNE) == 10) { htmltext = "30626-05.html"; } - } - else if (memoState == 5) - { - if (hasQuestItems(player, HAMILS_2ND_LETTER)) - { + } else if (memoState == 5) { + if (hasQuestItems(player, HAMILS_2ND_LETTER)) { htmltext = "30626-08.html"; } - } - else if (memoState == 8) - { + } else if (memoState == 8) { giveItems(player, HAMILS_3RD_LETTER, 1); takeItems(player, HUNTERS_2ND_RUNE, -1); qs.setMemoState(9); qs.setCond(9, true); htmltext = "30626-09.html"; - } - else if (memoState == 9) - { - if (hasQuestItems(player, HAMILS_3RD_LETTER)) - { + } else if (memoState == 9) { + if (hasQuestItems(player, HAMILS_3RD_LETTER)) { htmltext = "30626-10.html"; } - } - else if (memoState == 12) - { - if (hasQuestItems(player, CRESCENT_MOON_BOW)) - { + } else if (memoState == 12) { + if (hasQuestItems(player, CRESCENT_MOON_BOW)) { qs.setCond(13, true); qs.setMemoState(13); htmltext = "30626-11.html"; } - } - else if (memoState == 13) - { + } else if (memoState == 13) { htmltext = "30626-12.html"; - } - else if (memoState == 14) - { - if (hasQuestItems(player, TALISMAN_OF_KADESH)) - { + } else if (memoState == 14) { + if (hasQuestItems(player, TALISMAN_OF_KADESH)) { giveAdena(player, 161806, true); giveItems(player, MARK_OF_SAGITTARIUS, 1); addExpAndSp(player, 894888, 61408); @@ -496,45 +385,30 @@ public final class Q00224_TestOfSagittarius extends Quest } break; } - case SIR_ARON_TANFORD: - { - if (memoState == 2) - { - if (hasQuestItems(player, HAMILS_1ST_LETTER)) - { + case SIR_ARON_TANFORD: { + if (memoState == 2) { + if (hasQuestItems(player, HAMILS_1ST_LETTER)) { htmltext = "30653-01.html"; } - } - else if (memoState == 3) - { + } else if (memoState == 3) { htmltext = "30653-03.html"; } break; } - case MAGISTER_GAUEN: - { - if (memoState == 9) - { - if (hasQuestItems(player, HAMILS_3RD_LETTER)) - { + case MAGISTER_GAUEN: { + if (memoState == 9) { + if (hasQuestItems(player, HAMILS_3RD_LETTER)) { takeItems(player, HAMILS_3RD_LETTER, 1); qs.setMemoState(10); qs.setCond(10, true); htmltext = "30717-01.html"; } - } - else if (memoState == 10) - { + } else if (memoState == 10) { htmltext = "30717-03.html"; - } - else if (memoState == 12) - { + } else if (memoState == 12) { htmltext = "30717-04.html"; - } - else if (memoState == 11) - { - if (hasQuestItems(player, STAKATO_CHITIN, MITHRIL_CLIP, REINFORCED_BOWSTRING, MANASHENS_HORN)) - { + } else if (memoState == 11) { + if (hasQuestItems(player, STAKATO_CHITIN, MITHRIL_CLIP, REINFORCED_BOWSTRING, MANASHENS_HORN)) { giveItems(player, WOODEN_ARROW, 10); giveItems(player, CRESCENT_MOON_BOW, 1); takeItems(player, MITHRIL_CLIP, 1); @@ -549,11 +423,8 @@ public final class Q00224_TestOfSagittarius extends Quest break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == GUILD_PRESIDENT_BERNARD) - { + } else if (qs.isCompleted()) { + if (npc.getId() == GUILD_PRESIDENT_BERNARD) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00225_TestOfTheSearcher/Q00225_TestOfTheSearcher.java b/src/main/java/com/l2jserver/datapack/quests/Q00225_TestOfTheSearcher/Q00225_TestOfTheSearcher.java index 6f0fc7fd14..4f68866fd9 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00225_TestOfTheSearcher/Q00225_TestOfTheSearcher.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00225_TestOfTheSearcher/Q00225_TestOfTheSearcher.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Test Of The Searcher (225) * @author ivantotov */ -public final class Q00225_TestOfTheSearcher extends Quest -{ +public final class Q00225_TestOfTheSearcher extends Quest { // NPCs private static final int CAPTAIN_ALEX = 30291; private static final int TYRA = 30420; @@ -82,8 +81,7 @@ public final class Q00225_TestOfTheSearcher extends Quest // Misc private static final int MIN_LEVEL = 39; - public Q00225_TestOfTheSearcher() - { + public Q00225_TestOfTheSearcher() { super(225, Q00225_TestOfTheSearcher.class.getSimpleName(), "Test Of The Searcher"); addStartNpc(MASTER_LUTHER); addTalkId(MASTER_LUTHER, CAPTAIN_ALEX, TYRA, TREE, STRONG_WOODEN_CHEST, MILITIAMAN_LEIRYNN, DRUNKARD_BORYS, BODYGUARD_JAX); @@ -93,40 +91,29 @@ public final class Q00225_TestOfTheSearcher extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (qs.isCreated()) - { + switch (event) { + case "ACCEPT": { + if (qs.isCreated()) { qs.startQuest(); qs.setMemoState(1); playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); giveItems(player, LUTHERS_LETTER, 1); - if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) - { - if (player.getClassId() == ClassId.scavenger) - { + if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) { + if (player.getClassId() == ClassId.scavenger) { giveItems(player, DIMENSIONAL_DIAMOND, 82); - } - else - { + } else { giveItems(player, DIMENSIONAL_DIAMOND, 96); } player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1); htmltext = "30690-05a.htm"; - } - else - { + } else { htmltext = "30690-05.htm"; } } @@ -140,15 +127,12 @@ public final class Q00225_TestOfTheSearcher extends Quest case "30730-01c.html": case "30730-02.html": case "30730-02a.html": - case "30730-02b.html": - { + case "30730-02b.html": { htmltext = event; break; } - case "30291-07.html": - { - if (hasQuestItems(player, LEIRYNNS_REPORT, STRINGE_MAP)) - { + case "30291-07.html": { + if (hasQuestItems(player, LEIRYNNS_REPORT, STRINGE_MAP)) { takeItems(player, LEIRYNNS_REPORT, 1); takeItems(player, STRINGE_MAP, 1); giveItems(player, LAMBERTS_MAP, 1); @@ -159,10 +143,8 @@ public final class Q00225_TestOfTheSearcher extends Quest } break; } - case "30420-01a.html": - { - if (hasQuestItems(player, WINE_CATALOG)) - { + case "30420-01a.html": { + if (hasQuestItems(player, WINE_CATALOG)) { takeItems(player, WINE_CATALOG, 1); giveItems(player, TYRAS_CONTRACT, 1); qs.setCond(10, true); @@ -170,10 +152,8 @@ public final class Q00225_TestOfTheSearcher extends Quest } break; } - case "30627-01a.html": - { - if (npc.getSummonedNpcCount() < 5) - { + case "30627-01a.html": { + if (npc.getSummonedNpcCount() < 5) { giveItems(player, RUSTED_KEY, 1); addSpawn(npc, STRONG_WOODEN_CHEST, npc, true, 0); qs.setCond(17, true); @@ -181,8 +161,7 @@ public final class Q00225_TestOfTheSearcher extends Quest } break; } - case "30628-01a.html": - { + case "30628-01a.html": { takeItems(player, RUSTED_KEY, 1); giveItems(player, GOLD_BAR, 20); qs.setCond(18, true); @@ -190,10 +169,8 @@ public final class Q00225_TestOfTheSearcher extends Quest htmltext = event; break; } - case "30730-01d.html": - { - if (hasQuestItems(player, OLD_ORDER)) - { + case "30730-01d.html": { + if (hasQuestItems(player, OLD_ORDER)) { takeItems(player, OLD_ORDER, 1); giveItems(player, JAXS_DIARY, 1); qs.setCond(14, true); @@ -206,13 +183,10 @@ public final class Q00225_TestOfTheSearcher extends Quest } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { final QuestState qs = getQuestState(attacker, false); - if ((qs != null) && qs.isStarted()) - { - if (npc.isScriptValue(0) && hasQuestItems(attacker, LEIRYNNS_1ST_ORDER)) - { + if ((qs != null) && qs.isStarted()) { + if (npc.isScriptValue(0) && hasQuestItems(attacker, LEIRYNNS_1ST_ORDER)) { npc.setScriptValue(1); addAttackDesire(addSpawn(NEER_BODYGUARD, npc, true, 200000), attacker); } @@ -221,96 +195,68 @@ public final class Q00225_TestOfTheSearcher extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case HANGMAN_TREE: - { - if (hasQuestItems(killer, JAXS_DIARY) && !hasQuestItems(killer, MAKELS_MAP) && (getQuestItemsCount(killer, TORN_MAP_PIECE_2ND) < 4)) - { - if (getQuestItemsCount(killer, TORN_MAP_PIECE_2ND) < 3) - { - if (getRandom(100) < 50) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case HANGMAN_TREE: { + if (hasQuestItems(killer, JAXS_DIARY) && !hasQuestItems(killer, MAKELS_MAP) && (getQuestItemsCount(killer, TORN_MAP_PIECE_2ND) < 4)) { + if (getQuestItemsCount(killer, TORN_MAP_PIECE_2ND) < 3) { + if (getRandom(100) < 50) { giveItems(killer, TORN_MAP_PIECE_2ND, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } - } - else if (getRandom(100) < 50) - { + } else if (getRandom(100) < 50) { takeItems(killer, TORN_MAP_PIECE_2ND, -1); giveItems(killer, MAKELS_MAP, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if (getQuestItemsCount(killer, SOLTS_MAP) >= 1) - { + if (getQuestItemsCount(killer, SOLTS_MAP) >= 1) { qs.setCond(15); } } } break; } - case ROAD_SCAVENGER: - { - if (hasQuestItems(killer, JAXS_DIARY) && !hasQuestItems(killer, SOLTS_MAP) && (getQuestItemsCount(killer, TORN_MAP_PIECE_1ST) < 4)) - { - if (getQuestItemsCount(killer, TORN_MAP_PIECE_1ST) < 3) - { + case ROAD_SCAVENGER: { + if (hasQuestItems(killer, JAXS_DIARY) && !hasQuestItems(killer, SOLTS_MAP) && (getQuestItemsCount(killer, TORN_MAP_PIECE_1ST) < 4)) { + if (getQuestItemsCount(killer, TORN_MAP_PIECE_1ST) < 3) { giveItems(killer, TORN_MAP_PIECE_1ST, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); - } - else - { + } else { takeItems(killer, TORN_MAP_PIECE_1ST, -1); giveItems(killer, SOLTS_MAP, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if (getQuestItemsCount(killer, MAKELS_MAP) >= 1) - { + if (getQuestItemsCount(killer, MAKELS_MAP) >= 1) { qs.setCond(15); } } } break; } - case GIANT_FUNGUS: - { - if (hasQuestItems(killer, TYRAS_CONTRACT) && (getQuestItemsCount(killer, RED_SPORE_DUST) < 10)) - { + case GIANT_FUNGUS: { + if (hasQuestItems(killer, TYRAS_CONTRACT) && (getQuestItemsCount(killer, RED_SPORE_DUST) < 10)) { giveItems(killer, RED_SPORE_DUST, 1); - if (getQuestItemsCount(killer, RED_SPORE_DUST) >= 10) - { + if (getQuestItemsCount(killer, RED_SPORE_DUST) >= 10) { qs.setCond(11, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case DELU_lIZARDMAN_SHAMAN: - { - if (hasQuestItems(killer, LEIRYNNS_1ST_ORDER) && (getQuestItemsCount(killer, DELU_TOTEM) < 10)) - { + case DELU_lIZARDMAN_SHAMAN: { + if (hasQuestItems(killer, LEIRYNNS_1ST_ORDER) && (getQuestItemsCount(killer, DELU_TOTEM) < 10)) { giveItems(killer, DELU_TOTEM, 1); - if (getQuestItemsCount(killer, RED_SPORE_DUST) >= 10) - { + if (getQuestItemsCount(killer, RED_SPORE_DUST) >= 10) { qs.setCond(4, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case DELU_CHIEF_KALKIS: - { - if (hasQuestItems(killer, LEIRYNNS_2ND_ORDER) && !hasAtLeastOneQuestItem(killer, CHIEF_KALKIS_FANG, STRINGE_MAP)) - { + case DELU_CHIEF_KALKIS: { + if (hasQuestItems(killer, LEIRYNNS_2ND_ORDER) && !hasAtLeastOneQuestItem(killer, CHIEF_KALKIS_FANG, STRINGE_MAP)) { giveItems(killer, CHIEF_KALKIS_FANG, 1); giveItems(killer, STRINGE_MAP, 1); qs.setCond(6, true); @@ -323,54 +269,33 @@ public final class Q00225_TestOfTheSearcher extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == MASTER_LUTHER) - { - if ((player.getClassId() == ClassId.rogue) || (player.getClassId() == ClassId.elvenScout) || (player.getClassId() == ClassId.assassin) || (player.getClassId() == ClassId.scavenger)) - { - if (player.getLevel() >= MIN_LEVEL) - { - if (player.getClassId() == ClassId.scavenger) - { + if (qs.isCreated()) { + if (npc.getId() == MASTER_LUTHER) { + if ((player.getClassId() == ClassId.rogue) || (player.getClassId() == ClassId.elvenScout) || (player.getClassId() == ClassId.assassin) || (player.getClassId() == ClassId.scavenger)) { + if (player.getLevel() >= MIN_LEVEL) { + if (player.getClassId() == ClassId.scavenger) { htmltext = "30690-04.htm"; - } - else - { + } else { htmltext = "30690-03.htm"; } - } - else - { + } else { htmltext = "30690-02.html"; } - } - else - { + } else { htmltext = "30690-01.html"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case MASTER_LUTHER: - { - if (hasQuestItems(player, LUTHERS_LETTER) && !hasQuestItems(player, ALEXS_RECOMMEND)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case MASTER_LUTHER: { + if (hasQuestItems(player, LUTHERS_LETTER) && !hasQuestItems(player, ALEXS_RECOMMEND)) { htmltext = "30690-06.html"; - } - else if (!hasAtLeastOneQuestItem(player, LUTHERS_LETTER, ALEXS_RECOMMEND)) - { + } else if (!hasAtLeastOneQuestItem(player, LUTHERS_LETTER, ALEXS_RECOMMEND)) { htmltext = "30690-07.html"; - } - else if (!hasQuestItems(player, LUTHERS_LETTER) && hasQuestItems(player, ALEXS_RECOMMEND)) - { + } else if (!hasQuestItems(player, LUTHERS_LETTER) && hasQuestItems(player, ALEXS_RECOMMEND)) { giveAdena(player, 161806, true); giveItems(player, MARK_OF_SEARCHER, 1); addExpAndSp(player, 894888, 61408); @@ -380,41 +305,25 @@ public final class Q00225_TestOfTheSearcher extends Quest } break; } - case CAPTAIN_ALEX: - { - if (hasQuestItems(player, LUTHERS_LETTER)) - { + case CAPTAIN_ALEX: { + if (hasQuestItems(player, LUTHERS_LETTER)) { takeItems(player, LUTHERS_LETTER, 1); giveItems(player, ALEXS_WARRANT, 1); qs.setCond(2, true); htmltext = "30291-01.html"; - } - else if (hasQuestItems(player, ALEXS_WARRANT)) - { + } else if (hasQuestItems(player, ALEXS_WARRANT)) { htmltext = "30291-02.html"; - } - else if (hasAtLeastOneQuestItem(player, LEIRYNNS_1ST_ORDER, LEIRYNNS_2ND_ORDER)) - { + } else if (hasAtLeastOneQuestItem(player, LEIRYNNS_1ST_ORDER, LEIRYNNS_2ND_ORDER)) { htmltext = "30291-03.html"; - } - else if (hasQuestItems(player, LEIRYNNS_REPORT)) - { + } else if (hasQuestItems(player, LEIRYNNS_REPORT)) { htmltext = "30291-04.html"; - } - else if (hasQuestItems(player, ALEXS_ORDER)) - { - if (hasQuestItems(player, ALEXS_LETTER)) - { + } else if (hasQuestItems(player, ALEXS_ORDER)) { + if (hasQuestItems(player, ALEXS_LETTER)) { htmltext = "30291-08.html"; - } - else if (hasAtLeastOneQuestItem(player, OLD_ORDER, JAXS_DIARY)) - { + } else if (hasAtLeastOneQuestItem(player, OLD_ORDER, JAXS_DIARY)) { htmltext = "30291-09.html"; - } - else if (hasQuestItems(player, COMBINED_MAP)) - { - if (getQuestItemsCount(player, GOLD_BAR) == 20) - { + } else if (hasQuestItems(player, COMBINED_MAP)) { + if (getQuestItemsCount(player, GOLD_BAR) == 20) { takeItems(player, ALEXS_ORDER, 1); takeItems(player, COMBINED_MAP, 1); takeItems(player, GOLD_BAR, -1); @@ -422,162 +331,109 @@ public final class Q00225_TestOfTheSearcher extends Quest player.getRadar().removeMarker(10133, 157155, -2383); qs.setCond(19, true); htmltext = "30291-11.html"; - } - else - { + } else { htmltext = "30291-10.html"; } } - } - else if (hasQuestItems(player, ALEXS_RECOMMEND)) - { + } else if (hasQuestItems(player, ALEXS_RECOMMEND)) { htmltext = "30291-12.html"; } break; } - case TYRA: - { - if (hasQuestItems(player, WINE_CATALOG)) - { + case TYRA: { + if (hasQuestItems(player, WINE_CATALOG)) { htmltext = "30420-01.html"; - } - else if (hasQuestItems(player, TYRAS_CONTRACT)) - { - if (getQuestItemsCount(player, RED_SPORE_DUST) < 10) - { + } else if (hasQuestItems(player, TYRAS_CONTRACT)) { + if (getQuestItemsCount(player, RED_SPORE_DUST) < 10) { htmltext = "30420-02.html"; - } - else - { + } else { takeItems(player, TYRAS_CONTRACT, 1); takeItems(player, RED_SPORE_DUST, -1); giveItems(player, MALRUKIAN_WINE, 1); qs.setCond(12, true); htmltext = "30420-03.html"; } - } - else if (hasAtLeastOneQuestItem(player, JAXS_DIARY, OLD_ORDER, COMBINED_MAP, ALEXS_RECOMMEND, MALRUKIAN_WINE)) - { + } else if (hasAtLeastOneQuestItem(player, JAXS_DIARY, OLD_ORDER, COMBINED_MAP, ALEXS_RECOMMEND, MALRUKIAN_WINE)) { htmltext = "30420-04.html"; } break; } - case TREE: - { - if (hasQuestItems(player, COMBINED_MAP)) - { - if (!hasAtLeastOneQuestItem(player, RUSTED_KEY, GOLD_BAR)) - { + case TREE: { + if (hasQuestItems(player, COMBINED_MAP)) { + if (!hasAtLeastOneQuestItem(player, RUSTED_KEY, GOLD_BAR)) { htmltext = "30627-01.html"; - } - else if (hasQuestItems(player, RUSTED_KEY) && (getQuestItemsCount(player, GOLD_BAR) >= 20)) - { + } else if (hasQuestItems(player, RUSTED_KEY) && (getQuestItemsCount(player, GOLD_BAR) >= 20)) { htmltext = "30627-01.html"; } } break; } - case STRONG_WOODEN_CHEST: - { - if (hasQuestItems(player, RUSTED_KEY)) - { + case STRONG_WOODEN_CHEST: { + if (hasQuestItems(player, RUSTED_KEY)) { htmltext = "30628-01.html"; } break; } - case MILITIAMAN_LEIRYNN: - { - if (hasQuestItems(player, ALEXS_WARRANT)) - { + case MILITIAMAN_LEIRYNN: { + if (hasQuestItems(player, ALEXS_WARRANT)) { takeItems(player, ALEXS_WARRANT, 1); giveItems(player, LEIRYNNS_1ST_ORDER, 1); qs.setCond(3, true); htmltext = "30728-01.html"; - } - else if (hasQuestItems(player, LEIRYNNS_1ST_ORDER)) - { - if (getQuestItemsCount(player, DELU_TOTEM) < 10) - { + } else if (hasQuestItems(player, LEIRYNNS_1ST_ORDER)) { + if (getQuestItemsCount(player, DELU_TOTEM) < 10) { htmltext = "30728-02.html"; - } - else - { + } else { takeItems(player, LEIRYNNS_1ST_ORDER, 1); takeItems(player, DELU_TOTEM, -1); giveItems(player, LEIRYNNS_2ND_ORDER, 1); qs.setCond(5, true); htmltext = "30728-03.html"; } - } - else if (hasQuestItems(player, LEIRYNNS_2ND_ORDER)) - { - if (!hasQuestItems(player, CHIEF_KALKIS_FANG)) - { + } else if (hasQuestItems(player, LEIRYNNS_2ND_ORDER)) { + if (!hasQuestItems(player, CHIEF_KALKIS_FANG)) { htmltext = "30728-04.html"; - } - else - { + } else { takeItems(player, LEIRYNNS_2ND_ORDER, 1); takeItems(player, CHIEF_KALKIS_FANG, 1); giveItems(player, LEIRYNNS_REPORT, 1); qs.setCond(7, true); htmltext = "30728-05.html"; } - } - else if (hasQuestItems(player, LEIRYNNS_REPORT)) - { + } else if (hasQuestItems(player, LEIRYNNS_REPORT)) { htmltext = "30728-06.html"; - } - else if (hasAtLeastOneQuestItem(player, ALEXS_RECOMMEND, ALEXS_ORDER)) - { + } else if (hasAtLeastOneQuestItem(player, ALEXS_RECOMMEND, ALEXS_ORDER)) { htmltext = "30728-07.html"; } break; } - case DRUNKARD_BORYS: - { - if (hasQuestItems(player, ALEXS_LETTER)) - { + case DRUNKARD_BORYS: { + if (hasQuestItems(player, ALEXS_LETTER)) { takeItems(player, ALEXS_LETTER, 1); giveItems(player, WINE_CATALOG, 1); qs.setCond(9, true); htmltext = "30729-01.html"; - } - else if (hasQuestItems(player, WINE_CATALOG) && !hasQuestItems(player, MALRUKIAN_WINE)) - { + } else if (hasQuestItems(player, WINE_CATALOG) && !hasQuestItems(player, MALRUKIAN_WINE)) { htmltext = "30729-02.html"; - } - else if (hasQuestItems(player, MALRUKIAN_WINE) && !hasQuestItems(player, WINE_CATALOG)) - { + } else if (hasQuestItems(player, MALRUKIAN_WINE) && !hasQuestItems(player, WINE_CATALOG)) { takeItems(player, MALRUKIAN_WINE, 1); giveItems(player, OLD_ORDER, 1); qs.setCond(13, true); htmltext = "30729-03.html"; - } - else if (hasQuestItems(player, OLD_ORDER)) - { + } else if (hasQuestItems(player, OLD_ORDER)) { htmltext = "30729-04.html"; - } - else if (hasAtLeastOneQuestItem(player, JAXS_DIARY, COMBINED_MAP, ALEXS_RECOMMEND)) - { + } else if (hasAtLeastOneQuestItem(player, JAXS_DIARY, COMBINED_MAP, ALEXS_RECOMMEND)) { htmltext = "30729-05.html"; } break; } - case BODYGUARD_JAX: - { - if (hasQuestItems(player, OLD_ORDER)) - { + case BODYGUARD_JAX: { + if (hasQuestItems(player, OLD_ORDER)) { htmltext = "30730-01.html"; - } - else if (hasQuestItems(player, JAXS_DIARY)) - { - if (((getQuestItemsCount(player, SOLTS_MAP) + getQuestItemsCount(player, MAKELS_MAP)) < 2)) - { + } else if (hasQuestItems(player, JAXS_DIARY)) { + if (((getQuestItemsCount(player, SOLTS_MAP) + getQuestItemsCount(player, MAKELS_MAP)) < 2)) { htmltext = "30730-02.html"; - } - else if (((getQuestItemsCount(player, SOLTS_MAP) + getQuestItemsCount(player, MAKELS_MAP)) == 2)) - { + } else if (((getQuestItemsCount(player, SOLTS_MAP) + getQuestItemsCount(player, MAKELS_MAP)) == 2)) { takeItems(player, LAMBERTS_MAP, 1); takeItems(player, JAXS_DIARY, 1); takeItems(player, SOLTS_MAP, 1); @@ -586,19 +442,14 @@ public final class Q00225_TestOfTheSearcher extends Quest qs.setCond(16, true); htmltext = "30730-03.html"; } - } - else if (hasAtLeastOneQuestItem(player, COMBINED_MAP, ALEXS_RECOMMEND)) - { + } else if (hasAtLeastOneQuestItem(player, COMBINED_MAP, ALEXS_RECOMMEND)) { htmltext = "30730-04.html"; } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == MASTER_LUTHER) - { + } else if (qs.isCompleted()) { + if (npc.getId() == MASTER_LUTHER) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00226_TestOfTheHealer/Q00226_TestOfTheHealer.java b/src/main/java/com/l2jserver/datapack/quests/Q00226_TestOfTheHealer/Q00226_TestOfTheHealer.java index daeeed98de..94ca720789 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00226_TestOfTheHealer/Q00226_TestOfTheHealer.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00226_TestOfTheHealer/Q00226_TestOfTheHealer.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.util.Util; * Test Of The Healer(226) * @author ivantotov */ -public final class Q00226_TestOfTheHealer extends Quest -{ +public final class Q00226_TestOfTheHealer extends Quest { // NPCs private static final int MASTER_SORIUS = 30327; private static final int ALLANA = 30424; @@ -74,8 +73,7 @@ public final class Q00226_TestOfTheHealer extends Quest // Misc private static final int MIN_LEVEL = 39; - public Q00226_TestOfTheHealer() - { + public Q00226_TestOfTheHealer() { super(226, Q00226_TestOfTheHealer.class.getSimpleName(), "Test Of The Healer"); addStartNpc(PRIEST_BANDELLOS); addTalkId(PRIEST_BANDELLOS, MASTER_SORIUS, ALLANA, PERRIN, FATHER_GUPU, ORPHAN_GIRL, WINDY_SHAORING, MYSTERIOUS_DARK_ELF, PIPER_LONGBOW, SLEIN_SHINING_BLADE, CAIN_FLYING_KNIFE, SAINT_KRISTINA, DAURIN_HAMMERCRUSH); @@ -84,65 +82,46 @@ public final class Q00226_TestOfTheHealer extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (qs.isCreated()) - { + switch (event) { + case "ACCEPT": { + if (qs.isCreated()) { qs.startQuest(); qs.setMemoState(1); playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); giveItems(player, REPORT_OF_PERRIN, 1); - if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) - { - if (player.getClassId() == ClassId.cleric) - { + if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) { + if (player.getClassId() == ClassId.cleric) { giveItems(player, DIMENSIONAL_DIAMOND, 60); - } - else if (player.getClassId() == ClassId.knight) - { + } else if (player.getClassId() == ClassId.knight) { giveItems(player, DIMENSIONAL_DIAMOND, 104); - } - else if (player.getClassId() == ClassId.oracle) - { + } else if (player.getClassId() == ClassId.oracle) { giveItems(player, DIMENSIONAL_DIAMOND, 45); - } - else - { + } else { giveItems(player, DIMENSIONAL_DIAMOND, 72); } player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1); htmltext = "30473-04a.htm"; - } - else - { + } else { htmltext = "30473-04.htm"; } } break; } - case "30473-08.html": - { - if (qs.isMemoState(10) && hasQuestItems(player, GOLDEN_STATUE)) - { + case "30473-08.html": { + if (qs.isMemoState(10) && hasQuestItems(player, GOLDEN_STATUE)) { htmltext = event; } break; } - case "30473-09.html": - { - if (qs.isMemoState(10) && hasQuestItems(player, GOLDEN_STATUE)) - { + case "30473-09.html": { + if (qs.isMemoState(10) && hasQuestItems(player, GOLDEN_STATUE)) { giveAdena(player, 233490, true); giveItems(player, MARK_OF_HEALER, 1); addExpAndSp(player, 738283, 50662); @@ -152,63 +131,48 @@ public final class Q00226_TestOfTheHealer extends Quest } break; } - case "30428-02.html": - { - if (qs.isMemoState(1) && hasQuestItems(player, REPORT_OF_PERRIN)) - { + case "30428-02.html": { + if (qs.isMemoState(1) && hasQuestItems(player, REPORT_OF_PERRIN)) { qs.setCond(2, true); - if (npc.getSummonedNpcCount() < 1) - { + if (npc.getSummonedNpcCount() < 1) { addAttackDesire(addSpawn(npc, TATOMA, npc, true, 200000), player); } } htmltext = event; break; } - case "30658-02.html": - { - if (qs.isMemoState(4) && !hasAtLeastOneQuestItem(player, PICTURE_OF_WINDY, WINDYS_PEBBLES, GOLDEN_STATUE)) - { - if (getQuestItemsCount(player, ADENA) >= 100000) - { + case "30658-02.html": { + if (qs.isMemoState(4) && !hasAtLeastOneQuestItem(player, PICTURE_OF_WINDY, WINDYS_PEBBLES, GOLDEN_STATUE)) { + if (getQuestItemsCount(player, ADENA) >= 100000) { takeItems(player, ADENA, 100000); giveItems(player, PICTURE_OF_WINDY, 1); qs.setCond(7, true); htmltext = event; - } - else - { + } else { htmltext = "30658-05.html"; } } break; } - case "30658-03.html": - { - if (qs.isMemoState(4) && !hasAtLeastOneQuestItem(player, PICTURE_OF_WINDY, WINDYS_PEBBLES, GOLDEN_STATUE)) - { + case "30658-03.html": { + if (qs.isMemoState(4) && !hasAtLeastOneQuestItem(player, PICTURE_OF_WINDY, WINDYS_PEBBLES, GOLDEN_STATUE)) { qs.setMemoState(5); htmltext = event; } break; } - case "30658-07.html": - { + case "30658-07.html": { htmltext = event; break; } - case "30660-02.html": - { - if (hasQuestItems(player, PICTURE_OF_WINDY)) - { + case "30660-02.html": { + if (hasQuestItems(player, PICTURE_OF_WINDY)) { htmltext = event; } break; } - case "30660-03.html": - { - if (hasQuestItems(player, PICTURE_OF_WINDY)) - { + case "30660-03.html": { + if (hasQuestItems(player, PICTURE_OF_WINDY)) { takeItems(player, PICTURE_OF_WINDY, 1); giveItems(player, WINDYS_PEBBLES, 1); qs.setCond(8, true); @@ -217,10 +181,8 @@ public final class Q00226_TestOfTheHealer extends Quest } break; } - case "30665-02.html": - { - if ((getQuestItemsCount(player, SECRET_LETTER1) + getQuestItemsCount(player, SECRET_LETTER2) + getQuestItemsCount(player, SECRET_LETTER3) + getQuestItemsCount(player, SECRET_LETTER4)) == 4) - { + case "30665-02.html": { + if ((getQuestItemsCount(player, SECRET_LETTER1) + getQuestItemsCount(player, SECRET_LETTER2) + getQuestItemsCount(player, SECRET_LETTER3) + getQuestItemsCount(player, SECRET_LETTER4)) == 4) { giveItems(player, CRISTINAS_LETTER, 1); takeItems(player, SECRET_LETTER1, 1); takeItems(player, SECRET_LETTER2, 1); @@ -232,10 +194,8 @@ public final class Q00226_TestOfTheHealer extends Quest } break; } - case "30674-02.html": - { - if (qs.isMemoState(6)) - { + case "30674-02.html": { + if (qs.isMemoState(6)) { qs.setCond(11); takeItems(player, ORDER_OF_SORIUS, 1); addSpawn(npc, LERO_LIZARDMAN_AGENT, npc, true, 200000); @@ -251,53 +211,40 @@ public final class Q00226_TestOfTheHealer extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case LERO_LIZARDMAN_LEADER: - { - if (qs.isMemoState(6) && !hasQuestItems(killer, SECRET_LETTER1)) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case LERO_LIZARDMAN_LEADER: { + if (qs.isMemoState(6) && !hasQuestItems(killer, SECRET_LETTER1)) { giveItems(killer, SECRET_LETTER1, 1); qs.setCond(12, true); } break; } - case LERO_LIZARDMAN_ASSASSIN: - { - if (qs.isMemoState(8) && hasQuestItems(killer, SECRET_LETTER1) && !hasQuestItems(killer, SECRET_LETTER2)) - { + case LERO_LIZARDMAN_ASSASSIN: { + if (qs.isMemoState(8) && hasQuestItems(killer, SECRET_LETTER1) && !hasQuestItems(killer, SECRET_LETTER2)) { giveItems(killer, SECRET_LETTER2, 1); qs.setCond(15, true); } break; } - case LERO_LIZARDMAN_SNIPER: - { - if (qs.isMemoState(8) && hasQuestItems(killer, SECRET_LETTER1) && !hasQuestItems(killer, SECRET_LETTER3)) - { + case LERO_LIZARDMAN_SNIPER: { + if (qs.isMemoState(8) && hasQuestItems(killer, SECRET_LETTER1) && !hasQuestItems(killer, SECRET_LETTER3)) { giveItems(killer, SECRET_LETTER3, 1); qs.setCond(17, true); } break; } - case LERO_LIZARDMAN_LORD: - { - if (qs.isMemoState(8) && hasQuestItems(killer, SECRET_LETTER1) && !hasQuestItems(killer, SECRET_LETTER4)) - { + case LERO_LIZARDMAN_LORD: { + if (qs.isMemoState(8) && hasQuestItems(killer, SECRET_LETTER1) && !hasQuestItems(killer, SECRET_LETTER4)) { giveItems(killer, SECRET_LETTER4, 1); qs.setCond(19, true); } break; } - case TATOMA: - { - if (qs.isMemoState(1)) - { + case TATOMA: { + if (qs.isMemoState(1)) { qs.setMemoState(2); qs.setCond(3, true); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); @@ -310,50 +257,31 @@ public final class Q00226_TestOfTheHealer extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); final int memoState = qs.getMemoState(); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == PRIEST_BANDELLOS) - { - if (player.isInCategory(CategoryType.WHITE_MAGIC_GROUP)) - { - if (player.getLevel() >= MIN_LEVEL) - { + if (qs.isCreated()) { + if (npc.getId() == PRIEST_BANDELLOS) { + if (player.isInCategory(CategoryType.WHITE_MAGIC_GROUP)) { + if (player.getLevel() >= MIN_LEVEL) { htmltext = "30473-03.htm"; - } - else - { + } else { htmltext = "30473-01.html"; } - } - else - { + } else { htmltext = "30473-02.html"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case PRIEST_BANDELLOS: - { - if ((memoState >= 1) && (memoState < 10)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case PRIEST_BANDELLOS: { + if ((memoState >= 1) && (memoState < 10)) { htmltext = "30473-05.html"; - } - else if (memoState == 10) - { - if (hasQuestItems(player, GOLDEN_STATUE)) - { + } else if (memoState == 10) { + if (hasQuestItems(player, GOLDEN_STATUE)) { htmltext = "30473-07.html"; - } - else - { + } else { giveAdena(player, 266980, true); giveItems(player, MARK_OF_HEALER, 1); addExpAndSp(player, 1476566, 101324); @@ -364,152 +292,108 @@ public final class Q00226_TestOfTheHealer extends Quest } break; } - case MASTER_SORIUS: - { - if (memoState == 5) - { + case MASTER_SORIUS: { + if (memoState == 5) { giveItems(player, ORDER_OF_SORIUS, 1); qs.setMemoState(6); qs.setCond(10, true); htmltext = "30327-01.html"; - } - else if ((memoState >= 6) && (memoState < 9)) - { + } else if ((memoState >= 6) && (memoState < 9)) { htmltext = "30327-02.html"; - } - else if (memoState == 9) - { - if (hasQuestItems(player, CRISTINAS_LETTER)) - { + } else if (memoState == 9) { + if (hasQuestItems(player, CRISTINAS_LETTER)) { takeItems(player, CRISTINAS_LETTER, 1); qs.setMemoState(10); qs.setCond(23, true); htmltext = "30327-03.html"; } - } - else if (memoState >= 10) - { + } else if (memoState >= 10) { htmltext = "30327-04.html"; } break; } - case ALLANA: - { - if (memoState == 3) - { + case ALLANA: { + if (memoState == 3) { qs.setMemoState(4); qs.setCond(5, true); htmltext = "30424-01.html"; - } - else if (memoState == 4) - { + } else if (memoState == 4) { qs.setMemoState(4); htmltext = "30424-02.html"; } break; } - case PERRIN: - { - if (memoState == 1) - { - if (hasQuestItems(player, REPORT_OF_PERRIN)) - { + case PERRIN: { + if (memoState == 1) { + if (hasQuestItems(player, REPORT_OF_PERRIN)) { htmltext = "30428-01.html"; } - } - else if (memoState == 2) - { + } else if (memoState == 2) { takeItems(player, REPORT_OF_PERRIN, 1); qs.setMemoState(3); qs.setCond(4, true); htmltext = "30428-03.html"; - } - else if (memoState == 3) - { + } else if (memoState == 3) { htmltext = "30428-04.html"; } break; } - case FATHER_GUPU: - { - if (memoState == 4) - { - if (!hasAtLeastOneQuestItem(player, PICTURE_OF_WINDY, WINDYS_PEBBLES, GOLDEN_STATUE)) - { + case FATHER_GUPU: { + if (memoState == 4) { + if (!hasAtLeastOneQuestItem(player, PICTURE_OF_WINDY, WINDYS_PEBBLES, GOLDEN_STATUE)) { qs.setCond(6, true); htmltext = "30658-01.html"; - } - else if (hasQuestItems(player, PICTURE_OF_WINDY)) - { + } else if (hasQuestItems(player, PICTURE_OF_WINDY)) { htmltext = "30658-04.html"; - } - else if (hasQuestItems(player, WINDYS_PEBBLES)) - { + } else if (hasQuestItems(player, WINDYS_PEBBLES)) { giveItems(player, GOLDEN_STATUE, 1); takeItems(player, WINDYS_PEBBLES, 1); qs.setMemoState(5); htmltext = "30658-06.html"; } - } - else if (memoState == 5) - { + } else if (memoState == 5) { qs.setCond(9, true); htmltext = "30658-07.html"; } break; } - case ORPHAN_GIRL: - { - switch (getRandom(5)) - { - case 0: - { + case ORPHAN_GIRL: { + switch (getRandom(5)) { + case 0: { htmltext = "30659-01.html"; break; } - case 1: - { + case 1: { htmltext = "30659-02.html"; break; } - case 2: - { + case 2: { htmltext = "30659-03.html"; break; } - case 3: - { + case 3: { htmltext = "30659-04.html"; break; } - case 4: - { + case 4: { htmltext = "30659-05.html"; break; } } break; } - case WINDY_SHAORING: - { - if (hasQuestItems(player, PICTURE_OF_WINDY)) - { + case WINDY_SHAORING: { + if (hasQuestItems(player, PICTURE_OF_WINDY)) { htmltext = "30660-01.html"; - } - else if (hasQuestItems(player, WINDYS_PEBBLES)) - { + } else if (hasQuestItems(player, WINDYS_PEBBLES)) { htmltext = "30660-04.html"; } break; } - case MYSTERIOUS_DARK_ELF: - { - if (memoState == 8) - { - if (hasQuestItems(player, SECRET_LETTER1) && !hasQuestItems(player, SECRET_LETTER2)) - { - if (npc.getSummonedNpcCount() < 36) - { + case MYSTERIOUS_DARK_ELF: { + if (memoState == 8) { + if (hasQuestItems(player, SECRET_LETTER1) && !hasQuestItems(player, SECRET_LETTER2)) { + if (npc.getSummonedNpcCount() < 36) { addSpawn(npc, LERO_LIZARDMAN_ASSASSIN, npc, true, 200000); addSpawn(npc, LERO_LIZARDMAN_ASSASSIN, npc, true, 200000); addSpawn(npc, LERO_LIZARDMAN_ASSASSIN, npc, true, 200000); @@ -518,11 +402,8 @@ public final class Q00226_TestOfTheHealer extends Quest qs.setCond(14); npc.deleteMe(); htmltext = "30661-01.html"; - } - else if (hasQuestItems(player, SECRET_LETTER1, SECRET_LETTER2) && !hasQuestItems(player, SECRET_LETTER3)) - { - if (npc.getSummonedNpcCount() < 36) - { + } else if (hasQuestItems(player, SECRET_LETTER1, SECRET_LETTER2) && !hasQuestItems(player, SECRET_LETTER3)) { + if (npc.getSummonedNpcCount() < 36) { addSpawn(npc, LERO_LIZARDMAN_SNIPER, npc, true, 200000); addSpawn(npc, LERO_LIZARDMAN_SNIPER, npc, true, 200000); addSpawn(npc, LERO_LIZARDMAN_SNIPER, npc, true, 200000); @@ -531,11 +412,8 @@ public final class Q00226_TestOfTheHealer extends Quest qs.setCond(16); npc.deleteMe(); htmltext = "30661-02.html"; - } - else if (hasQuestItems(player, SECRET_LETTER1, SECRET_LETTER2, SECRET_LETTER3) && !hasQuestItems(player, SECRET_LETTER4)) - { - if (npc.getSummonedNpcCount() < 36) - { + } else if (hasQuestItems(player, SECRET_LETTER1, SECRET_LETTER2, SECRET_LETTER3) && !hasQuestItems(player, SECRET_LETTER4)) { + if (npc.getSummonedNpcCount() < 36) { addSpawn(npc, LERO_LIZARDMAN_WIZARD, npc, true, 200000); addSpawn(npc, LERO_LIZARDMAN_WIZARD, npc, true, 200000); addSpawn(npc, LERO_LIZARDMAN_LORD, npc, true, 200000); @@ -544,130 +422,87 @@ public final class Q00226_TestOfTheHealer extends Quest qs.setCond(18); npc.deleteMe(); htmltext = "30661-03.html"; - } - else if ((getQuestItemsCount(player, SECRET_LETTER1) + getQuestItemsCount(player, SECRET_LETTER2) + getQuestItemsCount(player, SECRET_LETTER3) + getQuestItemsCount(player, SECRET_LETTER4)) == 4) - { + } else if ((getQuestItemsCount(player, SECRET_LETTER1) + getQuestItemsCount(player, SECRET_LETTER2) + getQuestItemsCount(player, SECRET_LETTER3) + getQuestItemsCount(player, SECRET_LETTER4)) == 4) { qs.setCond(20, true); htmltext = "30661-04.html"; } } break; } - case PIPER_LONGBOW: - { - if (memoState == 8) - { - if (hasQuestItems(player, SECRET_LETTER1) && !hasQuestItems(player, SECRET_LETTER2)) - { + case PIPER_LONGBOW: { + if (memoState == 8) { + if (hasQuestItems(player, SECRET_LETTER1) && !hasQuestItems(player, SECRET_LETTER2)) { htmltext = "30662-01.html"; - } - else if (hasQuestItems(player, SECRET_LETTER2) && !hasQuestItems(player, SECRET_LETTER3, SECRET_LETTER4)) - { + } else if (hasQuestItems(player, SECRET_LETTER2) && !hasQuestItems(player, SECRET_LETTER3, SECRET_LETTER4)) { htmltext = "30662-02.html"; - } - else if (hasQuestItems(player, SECRET_LETTER2, SECRET_LETTER3, SECRET_LETTER4)) - { + } else if (hasQuestItems(player, SECRET_LETTER2, SECRET_LETTER3, SECRET_LETTER4)) { qs.setCond(21, true); htmltext = "30662-03.html"; } } break; } - case SLEIN_SHINING_BLADE: - { - if (memoState == 8) - { - if (hasQuestItems(player, SECRET_LETTER1) && !hasQuestItems(player, SECRET_LETTER2)) - { + case SLEIN_SHINING_BLADE: { + if (memoState == 8) { + if (hasQuestItems(player, SECRET_LETTER1) && !hasQuestItems(player, SECRET_LETTER2)) { htmltext = "30663-01.html"; - } - else if (hasQuestItems(player, SECRET_LETTER2) && !hasQuestItems(player, SECRET_LETTER3, SECRET_LETTER4)) - { + } else if (hasQuestItems(player, SECRET_LETTER2) && !hasQuestItems(player, SECRET_LETTER3, SECRET_LETTER4)) { htmltext = "30663-02.html"; - } - else if (hasQuestItems(player, SECRET_LETTER2, SECRET_LETTER3, SECRET_LETTER4)) - { + } else if (hasQuestItems(player, SECRET_LETTER2, SECRET_LETTER3, SECRET_LETTER4)) { qs.setCond(21, true); htmltext = "30663-03.html"; } } break; } - case CAIN_FLYING_KNIFE: - { - if (memoState == 8) - { - if (hasQuestItems(player, SECRET_LETTER1) && !hasQuestItems(player, SECRET_LETTER4)) - { + case CAIN_FLYING_KNIFE: { + if (memoState == 8) { + if (hasQuestItems(player, SECRET_LETTER1) && !hasQuestItems(player, SECRET_LETTER4)) { htmltext = "30664-01.html"; - } - else if (hasQuestItems(player, SECRET_LETTER2) && !hasQuestItems(player, SECRET_LETTER3, SECRET_LETTER4)) - { + } else if (hasQuestItems(player, SECRET_LETTER2) && !hasQuestItems(player, SECRET_LETTER3, SECRET_LETTER4)) { htmltext = "30664-02.html"; - } - else if (hasQuestItems(player, SECRET_LETTER2, SECRET_LETTER3, SECRET_LETTER4)) - { + } else if (hasQuestItems(player, SECRET_LETTER2, SECRET_LETTER3, SECRET_LETTER4)) { qs.setCond(21, true); htmltext = "30664-03.html"; } } break; } - case SAINT_KRISTINA: - { - if ((getQuestItemsCount(player, SECRET_LETTER1) + getQuestItemsCount(player, SECRET_LETTER2) + getQuestItemsCount(player, SECRET_LETTER3) + getQuestItemsCount(player, SECRET_LETTER4)) == 4) - { + case SAINT_KRISTINA: { + if ((getQuestItemsCount(player, SECRET_LETTER1) + getQuestItemsCount(player, SECRET_LETTER2) + getQuestItemsCount(player, SECRET_LETTER3) + getQuestItemsCount(player, SECRET_LETTER4)) == 4) { htmltext = "30665-01.html"; - } - else if (memoState < 9) - { - if ((getQuestItemsCount(player, SECRET_LETTER1) + getQuestItemsCount(player, SECRET_LETTER2) + getQuestItemsCount(player, SECRET_LETTER3) + getQuestItemsCount(player, SECRET_LETTER4)) < 4) - { + } else if (memoState < 9) { + if ((getQuestItemsCount(player, SECRET_LETTER1) + getQuestItemsCount(player, SECRET_LETTER2) + getQuestItemsCount(player, SECRET_LETTER3) + getQuestItemsCount(player, SECRET_LETTER4)) < 4) { htmltext = "30665-03.html"; } - } - else if (memoState >= 9) - { + } else if (memoState >= 9) { htmltext = "30665-04.html"; } break; } - case DAURIN_HAMMERCRUSH: - { - if (memoState == 6) - { - if (hasQuestItems(player, ORDER_OF_SORIUS)) - { + case DAURIN_HAMMERCRUSH: { + if (memoState == 6) { + if (hasQuestItems(player, ORDER_OF_SORIUS)) { htmltext = "30674-01.html"; - } - else if (!hasAtLeastOneQuestItem(player, SECRET_LETTER1, ORDER_OF_SORIUS)) - { - if (npc.getSummonedNpcCount() < 4) - { + } else if (!hasAtLeastOneQuestItem(player, SECRET_LETTER1, ORDER_OF_SORIUS)) { + if (npc.getSummonedNpcCount() < 4) { addSpawn(npc, LERO_LIZARDMAN_AGENT, npc, true, 200000); addSpawn(npc, LERO_LIZARDMAN_LEADER, npc, true, 200000); } htmltext = "30674-02a.html"; - } - else if (hasQuestItems(player, SECRET_LETTER1)) - { + } else if (hasQuestItems(player, SECRET_LETTER1)) { qs.setMemoState(8); qs.setCond(13, true); htmltext = "30674-03.html"; } - } - else if (memoState >= 8) - { + } else if (memoState >= 8) { htmltext = "30674-04.html"; } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == PRIEST_BANDELLOS) - { + } else if (qs.isCompleted()) { + if (npc.getId() == PRIEST_BANDELLOS) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00227_TestOfTheReformer/Q00227_TestOfTheReformer.java b/src/main/java/com/l2jserver/datapack/quests/Q00227_TestOfTheReformer/Q00227_TestOfTheReformer.java index 041198966f..47a616f37d 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00227_TestOfTheReformer/Q00227_TestOfTheReformer.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00227_TestOfTheReformer/Q00227_TestOfTheReformer.java @@ -41,8 +41,7 @@ import com.l2jserver.gameserver.util.Util; * Test Of The Reformer (227) * @author ivantotov */ -public final class Q00227_TestOfTheReformer extends Quest -{ +public final class Q00227_TestOfTheReformer extends Quest { // NPCs private static final int PRIESTESS_PUPINA = 30118; private static final int PREACHER_SLA = 30666; @@ -104,8 +103,7 @@ public final class Q00227_TestOfTheReformer extends Quest // Misc private static final int MIN_LEVEL = 39; - public Q00227_TestOfTheReformer() - { + public Q00227_TestOfTheReformer() { super(227, Q00227_TestOfTheReformer.class.getSimpleName(), "Test Of The Reformer"); addStartNpc(PRIESTESS_PUPINA); addTalkId(PRIESTESS_PUPINA, PREACHER_SLA, RAMUS, KATARI, KAKAN, NYAKURI, OL_MAHUM_PILGRIM); @@ -116,56 +114,42 @@ public final class Q00227_TestOfTheReformer extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if ("DESPAWN".equals(event)) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if ("DESPAWN".equals(event)) { final int SPAWNED = npc.getVariables().getInt("SPAWNED", 0); - if (SPAWNED < 60) - { + if (SPAWNED < 60) { npc.getVariables().set("SPAWNED", SPAWNED + 1); - } - else - { + } else { npc.deleteMe(); } return super.onAdvEvent(event, npc, player); } final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (qs.isCreated()) - { + switch (event) { + case "ACCEPT": { + if (qs.isCreated()) { qs.startQuest(); qs.setMemoState(1); playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); giveItems(player, BOOK_OF_REFORM, 1); - if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) - { + if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) { giveItems(player, DIMENSIONAL_DIAMOND, 60); player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1); htmltext = "30118-04b.htm"; - } - else - { + } else { htmltext = "30118-04.htm"; } } break; } - case "30118-06.html": - { - if (hasQuestItems(player, BOOK_OF_REFORM)) - { + case "30118-06.html": { + if (hasQuestItems(player, BOOK_OF_REFORM)) { takeItems(player, BOOK_OF_REFORM, 1); giveItems(player, LETTER_OF_INTRODUCTION, 1); takeItems(player, HUGE_NAIL, 1); @@ -179,13 +163,11 @@ public final class Q00227_TestOfTheReformer extends Quest case "30666-03.html": case "30669-02.html": case "30669-05.html": - case "30670-02.html": - { + case "30670-02.html": { htmltext = event; break; } - case "30666-04.html": - { + case "30666-04.html": { takeItems(player, LETTER_OF_INTRODUCTION, 1); giveItems(player, SLAS_LETTER, 1); qs.setMemoState(5); @@ -193,11 +175,9 @@ public final class Q00227_TestOfTheReformer extends Quest htmltext = event; break; } - case "30669-03.html": - { + case "30669-03.html": { qs.setCond(12, true); - if (npc.getSummonedNpcCount() < 1) - { + if (npc.getSummonedNpcCount() < 1) { L2Npc pilgrim = addSpawn(OL_MAHUM_PILGRIM, -9282, -89975, -2331, 0, false, 0); L2Npc wolf = addSpawn(CRIMSON_WEREWOLF, -9382, -89852, -2333, 0, false, 0); ((L2Attackable) wolf).addDamageHate(pilgrim, 99999, 99999); @@ -206,11 +186,9 @@ public final class Q00227_TestOfTheReformer extends Quest htmltext = event; break; } - case "30670-03.html": - { + case "30670-03.html": { qs.setCond(15, true); - if (npc.getSummonedNpcCount() < 1) - { + if (npc.getSummonedNpcCount() < 1) { L2Npc pilgrim = addSpawn(OL_MAHUM_PILGRIM, 125947, -180049, -1778, 0, false, 0); L2Npc lizard = addSpawn(KRUDEL_LIZARDMAN, 126019, -179983, -1781, 0, false, 0); ((L2Attackable) lizard).addDamageHate(pilgrim, 99999, 99999); @@ -224,37 +202,26 @@ public final class Q00227_TestOfTheReformer extends Quest } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) { final QuestState qs = getQuestState(attacker, false); - if ((qs != null) && qs.isStarted()) - { - switch (npc.getId()) - { - case NAMELESS_REVENANT: - { - if (skill != null) - { - if (skill.getId() == DISRUPT_UNDEAD) - { + if ((qs != null) && qs.isStarted()) { + switch (npc.getId()) { + case NAMELESS_REVENANT: { + if (skill != null) { + if (skill.getId() == DISRUPT_UNDEAD) { npc.setScriptValue(1); - } - else - { + } else { npc.setScriptValue(2); } } break; } - case CRIMSON_WEREWOLF: - { - if ((skill == null) || !SKILLS.contains(skill.getId())) - { + case CRIMSON_WEREWOLF: { + if ((skill == null) || !SKILLS.contains(skill.getId())) { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.COWARDLY_GUY)); npc.deleteMe(); } - if (attacker.isPlayer()) - { + if (attacker.isPlayer()) { npc.setScriptValue(attacker.getObjectId()); } break; @@ -265,105 +232,80 @@ public final class Q00227_TestOfTheReformer extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case MISERY_SKELETON: - { - if (qs.isMemoState(16) && !hasQuestItems(killer, BONE_FRAGMENT7)) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case MISERY_SKELETON: { + if (qs.isMemoState(16) && !hasQuestItems(killer, BONE_FRAGMENT7)) { giveItems(killer, BONE_FRAGMENT7, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); - if (hasQuestItems(killer, BONE_FRAGMENT4, BONE_FRAGMENT5, BONE_FRAGMENT6, BONE_FRAGMENT8)) - { + if (hasQuestItems(killer, BONE_FRAGMENT4, BONE_FRAGMENT5, BONE_FRAGMENT6, BONE_FRAGMENT8)) { qs.setMemoState(17); qs.setCond(19); } } break; } - case SKELETON_ARCHER: - { - if (qs.isMemoState(16) && !hasQuestItems(killer, BONE_FRAGMENT8)) - { + case SKELETON_ARCHER: { + if (qs.isMemoState(16) && !hasQuestItems(killer, BONE_FRAGMENT8)) { giveItems(killer, BONE_FRAGMENT8, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); - if (hasQuestItems(killer, BONE_FRAGMENT4, BONE_FRAGMENT5, BONE_FRAGMENT6, BONE_FRAGMENT7)) - { + if (hasQuestItems(killer, BONE_FRAGMENT4, BONE_FRAGMENT5, BONE_FRAGMENT6, BONE_FRAGMENT7)) { qs.setMemoState(17); qs.setCond(19); } } break; } - case SKELETON_MARKSMAN: - { - if (qs.isMemoState(16) && !hasQuestItems(killer, BONE_FRAGMENT6)) - { + case SKELETON_MARKSMAN: { + if (qs.isMemoState(16) && !hasQuestItems(killer, BONE_FRAGMENT6)) { giveItems(killer, BONE_FRAGMENT6, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); - if (hasQuestItems(killer, BONE_FRAGMENT4, BONE_FRAGMENT5, BONE_FRAGMENT7, BONE_FRAGMENT8)) - { + if (hasQuestItems(killer, BONE_FRAGMENT4, BONE_FRAGMENT5, BONE_FRAGMENT7, BONE_FRAGMENT8)) { qs.setMemoState(17); qs.setCond(19); } } break; } - case SKELETON_LORD: - { - if (qs.isMemoState(16) && !hasQuestItems(killer, BONE_FRAGMENT5)) - { + case SKELETON_LORD: { + if (qs.isMemoState(16) && !hasQuestItems(killer, BONE_FRAGMENT5)) { giveItems(killer, BONE_FRAGMENT5, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); - if (hasQuestItems(killer, BONE_FRAGMENT4, BONE_FRAGMENT6, BONE_FRAGMENT7, BONE_FRAGMENT8)) - { + if (hasQuestItems(killer, BONE_FRAGMENT4, BONE_FRAGMENT6, BONE_FRAGMENT7, BONE_FRAGMENT8)) { qs.setMemoState(17); qs.setCond(19); } } break; } - case SILENT_HORROR: - { - if (qs.isMemoState(16) && !hasQuestItems(killer, BONE_FRAGMENT4)) - { + case SILENT_HORROR: { + if (qs.isMemoState(16) && !hasQuestItems(killer, BONE_FRAGMENT4)) { giveItems(killer, BONE_FRAGMENT4, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); - if (hasQuestItems(killer, BONE_FRAGMENT5, BONE_FRAGMENT6, BONE_FRAGMENT7, BONE_FRAGMENT8)) - { + if (hasQuestItems(killer, BONE_FRAGMENT5, BONE_FRAGMENT6, BONE_FRAGMENT7, BONE_FRAGMENT8)) { qs.setMemoState(17); qs.setCond(19); } } break; } - case NAMELESS_REVENANT: - { - if (qs.isMemoState(1) && npc.isScriptValue(1) && !hasQuestItems(killer, HUGE_NAIL) && hasQuestItems(killer, BOOK_OF_REFORM) && (getQuestItemsCount(killer, RIPPED_DIARY) < 7)) - { - if (getQuestItemsCount(killer, RIPPED_DIARY) == 6) - { + case NAMELESS_REVENANT: { + if (qs.isMemoState(1) && npc.isScriptValue(1) && !hasQuestItems(killer, HUGE_NAIL) && hasQuestItems(killer, BOOK_OF_REFORM) && (getQuestItemsCount(killer, RIPPED_DIARY) < 7)) { + if (getQuestItemsCount(killer, RIPPED_DIARY) == 6) { addSpawn(ARURAUNE, npc, true, 0, false); takeItems(killer, RIPPED_DIARY, -1); qs.setCond(2); - } - else - { + } else { giveItems(killer, RIPPED_DIARY, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case ARURAUNE: - { - if (!hasQuestItems(killer, HUGE_NAIL)) - { + case ARURAUNE: { + if (!hasQuestItems(killer, HUGE_NAIL)) { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.THE_CONCEALED_TRUTH_WILL_ALWAYS_BE_REVEALED)); giveItems(killer, HUGE_NAIL, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); @@ -372,19 +314,15 @@ public final class Q00227_TestOfTheReformer extends Quest } break; } - case OL_MAHUM_INSPECTOR: - { - if (qs.isMemoState(6)) - { + case OL_MAHUM_INSPECTOR: { + if (qs.isMemoState(6)) { qs.setMemoState(7); qs.setCond(7, true); } break; } - case OL_MAHUM_BETRAYER: - { - if (qs.isMemoState(8)) - { + case OL_MAHUM_BETRAYER: { + if (qs.isMemoState(8)) { qs.setMemoState(9); qs.setCond(9); giveItems(killer, LETTER_OF_BETRAYER, 1); @@ -392,19 +330,15 @@ public final class Q00227_TestOfTheReformer extends Quest } break; } - case CRIMSON_WEREWOLF: - { - if (npc.isScriptValue(killer.getObjectId()) && qs.isMemoState(11)) - { + case CRIMSON_WEREWOLF: { + if (npc.isScriptValue(killer.getObjectId()) && qs.isMemoState(11)) { qs.setMemoState(12); qs.setCond(13, true); } break; } - case KRUDEL_LIZARDMAN: - { - if (qs.isMemoState(13)) - { + case KRUDEL_LIZARDMAN: { + if (qs.isMemoState(13)) { qs.setMemoState(14); qs.setCond(16, true); } @@ -416,79 +350,49 @@ public final class Q00227_TestOfTheReformer extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); final int memoState = qs.getMemoState(); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == PRIESTESS_PUPINA) - { - if ((player.getClassId() == ClassId.cleric) || (player.getClassId() == ClassId.shillienOracle)) - { - if (player.getLevel() >= MIN_LEVEL) - { + if (qs.isCreated()) { + if (npc.getId() == PRIESTESS_PUPINA) { + if ((player.getClassId() == ClassId.cleric) || (player.getClassId() == ClassId.shillienOracle)) { + if (player.getLevel() >= MIN_LEVEL) { htmltext = "30118-03.htm"; - } - else - { + } else { htmltext = "30118-01.html"; } - } - else - { + } else { htmltext = "30118-02.html"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case PRIESTESS_PUPINA: - { - if (memoState == 3) - { - if (hasQuestItems(player, HUGE_NAIL)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case PRIESTESS_PUPINA: { + if (memoState == 3) { + if (hasQuestItems(player, HUGE_NAIL)) { htmltext = "30118-05.html"; } - } - else if ((memoState >= 1) && (memoState < 3)) - { + } else if ((memoState >= 1) && (memoState < 3)) { htmltext = "30118-04a.html"; - } - else if (memoState >= 4) - { + } else if (memoState >= 4) { htmltext = "30118-07.html"; } break; } - case PREACHER_SLA: - { - if (memoState == 4) - { - if (hasQuestItems(player, LETTER_OF_INTRODUCTION)) - { + case PREACHER_SLA: { + if (memoState == 4) { + if (hasQuestItems(player, LETTER_OF_INTRODUCTION)) { htmltext = "30666-01.html"; } - } - else if ((memoState >= 11) && (memoState < 18)) - { + } else if ((memoState >= 11) && (memoState < 18)) { htmltext = "30666-06b.html"; - } - else if (memoState == 5) - { - if (hasQuestItems(player, SLAS_LETTER)) - { + } else if (memoState == 5) { + if (hasQuestItems(player, SLAS_LETTER)) { htmltext = "30666-05.html"; } - } - else if (memoState == 10) - { - if (hasQuestItems(player, Ol_MAHUM_MONEY)) - { + } else if (memoState == 10) { + if (hasQuestItems(player, Ol_MAHUM_MONEY)) { takeItems(player, Ol_MAHUM_MONEY, 1); giveItems(player, GREETINGS, 1); giveItems(player, LETTER_GREETINGS1, 1); @@ -496,9 +400,7 @@ public final class Q00227_TestOfTheReformer extends Quest qs.setMemoState(11); qs.setCond(11, true); htmltext = "30666-06.html"; - } - else - { + } else { giveItems(player, GREETINGS, 1); giveItems(player, LETTER_GREETINGS1, 1); giveItems(player, LETTER_GREETINGS2, 1); @@ -506,11 +408,8 @@ public final class Q00227_TestOfTheReformer extends Quest qs.setCond(11, true); htmltext = "30666-06a.html"; } - } - else if (memoState == 18) - { - if (hasQuestItems(player, KATARIS_LETTER, KAKANS_LETTER, NYAKURIS_LETTER, RAMUSS_LETTER)) - { + } else if (memoState == 18) { + if (hasQuestItems(player, KATARIS_LETTER, KAKANS_LETTER, NYAKURIS_LETTER, RAMUSS_LETTER)) { giveAdena(player, 226528, true); giveItems(player, MARK_OF_REFORMER, 1); addExpAndSp(player, 1252844, 85972); @@ -521,27 +420,19 @@ public final class Q00227_TestOfTheReformer extends Quest } break; } - case RAMUS: - { - if (memoState == 15) - { - if (hasQuestItems(player, LETTER_GREETINGS2) && !hasQuestItems(player, UNDEAD_LIST)) - { + case RAMUS: { + if (memoState == 15) { + if (hasQuestItems(player, LETTER_GREETINGS2) && !hasQuestItems(player, UNDEAD_LIST)) { giveItems(player, UNDEAD_LIST, 1); takeItems(player, LETTER_GREETINGS2, 1); qs.setMemoState(16); qs.setCond(18, true); htmltext = "30667-01.html"; } - } - else if (memoState == 16) - { + } else if (memoState == 16) { htmltext = "30667-02.html"; - } - else if (memoState == 17) - { - if (hasQuestItems(player, UNDEAD_LIST)) - { + } else if (memoState == 17) { + if (hasQuestItems(player, UNDEAD_LIST)) { takeItems(player, UNDEAD_LIST, 1); giveItems(player, RAMUSS_LETTER, 1); takeItems(player, BONE_FRAGMENT4, 1); @@ -556,65 +447,47 @@ public final class Q00227_TestOfTheReformer extends Quest } break; } - case KATARI: - { - if ((memoState == 5) || (memoState == 6)) - { + case KATARI: { + if ((memoState == 5) || (memoState == 6)) { takeItems(player, SLAS_LETTER, 1); qs.setMemoState(6); qs.setCond(6, true); - if (npc.getSummonedNpcCount() < 1) - { + if (npc.getSummonedNpcCount() < 1) { L2Npc pilgrim = addSpawn(OL_MAHUM_PILGRIM, -4015, 40141, -3664, 0, false, 0); L2Npc inspector = addSpawn(OL_MAHUM_INSPECTOR, -4034, 40201, -3665, 0, false, 0); ((L2Attackable) inspector).addDamageHate(pilgrim, 99999, 99999); inspector.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, pilgrim); } htmltext = "30668-01.html"; - } - else if ((memoState == 7) || (memoState == 8)) - { - if (memoState == 7) - { + } else if ((memoState == 7) || (memoState == 8)) { + if (memoState == 7) { qs.setMemoState(8); } qs.setCond(8, true); - if (npc.getSummonedNpcCount() < 3) - { + if (npc.getSummonedNpcCount() < 3) { addSpawn(OL_MAHUM_BETRAYER, -4106, 40174, -3660, 0, false, 0); } htmltext = "30668-02.html"; - } - else if (memoState == 9) - { - if (hasQuestItems(player, LETTER_OF_BETRAYER)) - { + } else if (memoState == 9) { + if (hasQuestItems(player, LETTER_OF_BETRAYER)) { giveItems(player, KATARIS_LETTER, 1); takeItems(player, LETTER_OF_BETRAYER, 1); qs.setMemoState(10); qs.setCond(10, true); htmltext = "30668-03.html"; } - } - else if (memoState >= 10) - { + } else if (memoState >= 10) { htmltext = "30668-04.html"; } break; } - case KAKAN: - { - if (memoState == 11) - { - if (hasQuestItems(player, GREETINGS)) - { + case KAKAN: { + if (memoState == 11) { + if (hasQuestItems(player, GREETINGS)) { htmltext = "30669-01.html"; } - } - else if (memoState == 12) - { - if (hasQuestItems(player, GREETINGS) && !hasQuestItems(player, KAKANS_LETTER)) - { + } else if (memoState == 12) { + if (hasQuestItems(player, GREETINGS) && !hasQuestItems(player, KAKANS_LETTER)) { takeItems(player, GREETINGS, 1); giveItems(player, KAKANS_LETTER, 1); qs.setMemoState(13); @@ -624,19 +497,13 @@ public final class Q00227_TestOfTheReformer extends Quest } break; } - case NYAKURI: - { - if (memoState == 13) - { - if (hasQuestItems(player, LETTER_GREETINGS1)) - { + case NYAKURI: { + if (memoState == 13) { + if (hasQuestItems(player, LETTER_GREETINGS1)) { htmltext = "30670-01.html"; } - } - else if (memoState == 14) - { - if (hasQuestItems(player, LETTER_GREETINGS1) && !hasQuestItems(player, NYAKURIS_LETTER)) - { + } else if (memoState == 14) { + if (hasQuestItems(player, LETTER_GREETINGS1) && !hasQuestItems(player, NYAKURIS_LETTER)) { giveItems(player, NYAKURIS_LETTER, 1); takeItems(player, LETTER_GREETINGS1, 1); qs.setMemoState(15); @@ -646,10 +513,8 @@ public final class Q00227_TestOfTheReformer extends Quest } break; } - case OL_MAHUM_PILGRIM: - { - if (memoState == 7) - { + case OL_MAHUM_PILGRIM: { + if (memoState == 7) { giveItems(player, Ol_MAHUM_MONEY, 1); qs.setMemoState(8); htmltext = "30732-01.html"; @@ -657,11 +522,8 @@ public final class Q00227_TestOfTheReformer extends Quest break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == PRIESTESS_PUPINA) - { + } else if (qs.isCompleted()) { + if (npc.getId() == PRIESTESS_PUPINA) { htmltext = getAlreadyCompletedMsg(player); } } @@ -669,21 +531,17 @@ public final class Q00227_TestOfTheReformer extends Quest } @Override - public String onSpawn(L2Npc npc) - { - switch (npc.getId()) - { + public String onSpawn(L2Npc npc) { + switch (npc.getId()) { case OL_MAHUM_INSPECTOR: case CRIMSON_WEREWOLF: case KRUDEL_LIZARDMAN: - case OL_MAHUM_PILGRIM: - { + case OL_MAHUM_PILGRIM: { startQuestTimer("DESPAWN", 5000, npc, null, true); npc.getVariables().set("SPAWNED", 0); break; } - case OL_MAHUM_BETRAYER: - { + case OL_MAHUM_BETRAYER: { startQuestTimer("DESPAWN", 5000, npc, null, true); npc.setIsRunning(true); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, MOVE_TO); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00228_TestOfMagus/Q00228_TestOfMagus.java b/src/main/java/com/l2jserver/datapack/quests/Q00228_TestOfMagus/Q00228_TestOfMagus.java index 8fef325e1b..bf2ea82825 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00228_TestOfMagus/Q00228_TestOfMagus.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00228_TestOfMagus/Q00228_TestOfMagus.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.util.Util; * Test Of Magus (228) * @author ivantotov */ -public final class Q00228_TestOfMagus extends Quest -{ +public final class Q00228_TestOfMagus extends Quest { // NPCs private static final int PARINA = 30391; private static final int EARTH_SNAKE = 30409; @@ -91,8 +90,7 @@ public final class Q00228_TestOfMagus extends Quest // Misc private static final int MIN_LVL = 39; - public Q00228_TestOfMagus() - { + public Q00228_TestOfMagus() { super(228, Q00228_TestOfMagus.class.getSimpleName(), "Test Of Magus"); addStartNpc(BARD_RUKAL); addTalkId(BARD_RUKAL, PARINA, EARTH_SNAKE, FLAME_SALAMANDER, WIND_SYLPH, WATER_UNDINE, ELDER_CASIAN); @@ -101,47 +99,36 @@ public final class Q00228_TestOfMagus extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (qs.isCreated()) - { + switch (event) { + case "ACCEPT": { + if (qs.isCreated()) { qs.startQuest(); playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); giveItems(player, RUKALS_LETTER, 1); - if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) - { + if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) { giveItems(player, DIMENSIONAL_DIAMOND, 122); player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1); htmltext = "30629-04a.htm"; - } - else - { + } else { htmltext = "30629-04.htm"; } } break; } case "30629-09.html": - case "30409-02.html": - { + case "30409-02.html": { htmltext = event; break; } - case "30629-10.html": - { - if (hasQuestItems(player, GOLDEN_SEED_3RD)) - { + case "30629-10.html": { + if (hasQuestItems(player, GOLDEN_SEED_3RD)) { takeItems(player, LILAC_CHARM, 1); takeItems(player, GOLDEN_SEED_1ST, 1); takeItems(player, GOLDEN_SEED_2ND, 1); @@ -152,10 +139,8 @@ public final class Q00228_TestOfMagus extends Quest } break; } - case "30391-02.html": - { - if (hasQuestItems(player, RUKALS_LETTER)) - { + case "30391-02.html": { + if (hasQuestItems(player, RUKALS_LETTER)) { takeItems(player, RUKALS_LETTER, 1); giveItems(player, PARINAS_LETTER, 1); qs.setCond(2, true); @@ -163,20 +148,17 @@ public final class Q00228_TestOfMagus extends Quest } break; } - case "30409-03.html": - { + case "30409-03.html": { giveItems(player, SERPENT_CHARM, 1); htmltext = event; break; } - case "30412-02.html": - { + case "30412-02.html": { giveItems(player, SYLPH_CHARM, 1); htmltext = event; break; } - case "30612-02.html": - { + case "30612-02.html": { takeItems(player, PARINAS_LETTER, 1); giveItems(player, LILAC_CHARM, 1); qs.setCond(3, true); @@ -188,24 +170,16 @@ public final class Q00228_TestOfMagus extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case HARPY: - { - if (hasQuestItems(killer, SCORE_OF_ELEMENTS, SYLPH_CHARM) && (getQuestItemsCount(killer, HARPYS_FEATHER) < 20)) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case HARPY: { + if (hasQuestItems(killer, SCORE_OF_ELEMENTS, SYLPH_CHARM) && (getQuestItemsCount(killer, HARPYS_FEATHER) < 20)) { giveItems(killer, HARPYS_FEATHER, 1); - if (getQuestItemsCount(killer, HARPYS_FEATHER) >= 20) - { + if (getQuestItemsCount(killer, HARPYS_FEATHER) >= 20) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -215,163 +189,116 @@ public final class Q00228_TestOfMagus extends Quest case MARSH_STAKATO_WORKER: case TOAD_LORD: case MARSH_STAKATO_SOLDIER: - case MARSH_STAKATO_DRONE: - { - if (hasQuestItems(killer, SCORE_OF_ELEMENTS, UNDINE_CHARM) && (getQuestItemsCount(killer, DAZZLING_DROP) < 20)) - { + case MARSH_STAKATO_DRONE: { + if (hasQuestItems(killer, SCORE_OF_ELEMENTS, UNDINE_CHARM) && (getQuestItemsCount(killer, DAZZLING_DROP) < 20)) { giveItems(killer, DAZZLING_DROP, 1); - if (getQuestItemsCount(killer, DAZZLING_DROP) >= 20) - { + if (getQuestItemsCount(killer, DAZZLING_DROP) >= 20) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case WYRM: - { - if (hasQuestItems(killer, SCORE_OF_ELEMENTS, SYLPH_CHARM) && (getQuestItemsCount(killer, WYRMS_WINGBONE) < 10)) - { - if (getRandom(100) < 50) - { + case WYRM: { + if (hasQuestItems(killer, SCORE_OF_ELEMENTS, SYLPH_CHARM) && (getQuestItemsCount(killer, WYRMS_WINGBONE) < 10)) { + if (getRandom(100) < 50) { giveItems(killer, WYRMS_WINGBONE, 1); - if (getQuestItemsCount(killer, WYRMS_WINGBONE) >= 10) - { + if (getQuestItemsCount(killer, WYRMS_WINGBONE) >= 10) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case WINDSUS: - { - if (hasQuestItems(killer, SCORE_OF_ELEMENTS, SYLPH_CHARM) && (getQuestItemsCount(killer, WINDSUS_MANE) < 10)) - { - if (getRandom(100) < 50) - { + case WINDSUS: { + if (hasQuestItems(killer, SCORE_OF_ELEMENTS, SYLPH_CHARM) && (getQuestItemsCount(killer, WINDSUS_MANE) < 10)) { + if (getRandom(100) < 50) { giveItems(killer, WINDSUS_MANE, 1); - if (getQuestItemsCount(killer, WINDSUS_MANE) >= 10) - { + if (getQuestItemsCount(killer, WINDSUS_MANE) >= 10) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case ENCHANTED_MONSTEREYE: - { - if (hasQuestItems(killer, SCORE_OF_ELEMENTS, SERPENT_CHARM) && (getQuestItemsCount(killer, ENCHANTED_MONSTER_EYE_SHELL) < 10)) - { + case ENCHANTED_MONSTEREYE: { + if (hasQuestItems(killer, SCORE_OF_ELEMENTS, SERPENT_CHARM) && (getQuestItemsCount(killer, ENCHANTED_MONSTER_EYE_SHELL) < 10)) { giveItems(killer, ENCHANTED_MONSTER_EYE_SHELL, 1); - if (getQuestItemsCount(killer, ENCHANTED_MONSTER_EYE_SHELL) >= 10) - { + if (getQuestItemsCount(killer, ENCHANTED_MONSTER_EYE_SHELL) >= 10) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case ENCHANTED_STOLEN_GOLEM: - { - if (hasQuestItems(killer, SCORE_OF_ELEMENTS, SERPENT_CHARM) && (getQuestItemsCount(killer, ENCHANTED_GOLEM_POWDER) < 10)) - { + case ENCHANTED_STOLEN_GOLEM: { + if (hasQuestItems(killer, SCORE_OF_ELEMENTS, SERPENT_CHARM) && (getQuestItemsCount(killer, ENCHANTED_GOLEM_POWDER) < 10)) { giveItems(killer, ENCHANTED_GOLEM_POWDER, 1); - if (getQuestItemsCount(killer, ENCHANTED_GOLEM_POWDER) >= 10) - { + if (getQuestItemsCount(killer, ENCHANTED_GOLEM_POWDER) >= 10) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case ENCHANTED_IRON_GOLEM: - { - if (hasQuestItems(killer, SCORE_OF_ELEMENTS, SERPENT_CHARM) && (getQuestItemsCount(killer, ENCHANTED_IRON_GOLEM_SCRAP) < 10)) - { + case ENCHANTED_IRON_GOLEM: { + if (hasQuestItems(killer, SCORE_OF_ELEMENTS, SERPENT_CHARM) && (getQuestItemsCount(killer, ENCHANTED_IRON_GOLEM_SCRAP) < 10)) { giveItems(killer, ENCHANTED_IRON_GOLEM_SCRAP, 1); - if (getQuestItemsCount(killer, ENCHANTED_IRON_GOLEM_SCRAP) >= 10) - { + if (getQuestItemsCount(killer, ENCHANTED_IRON_GOLEM_SCRAP) >= 10) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case SINGING_FLOWER_PHANTASM: - { - if (hasQuestItems(killer, LILAC_CHARM) && !hasQuestItems(killer, GOLDEN_SEED_1ST)) - { + case SINGING_FLOWER_PHANTASM: { + if (hasQuestItems(killer, LILAC_CHARM) && !hasQuestItems(killer, GOLDEN_SEED_1ST)) { giveItems(killer, GOLDEN_SEED_1ST, 1); npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.I_AM_A_TREE_OF_NOTHING_A_TREE_THAT_KNOWS_WHERE_TO_RETURN)); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if (hasQuestItems(killer, GOLDEN_SEED_2ND, GOLDEN_SEED_3RD)) - { + if (hasQuestItems(killer, GOLDEN_SEED_2ND, GOLDEN_SEED_3RD)) { qs.setCond(4); } } break; } - case SINGING_FLOWER_NIGTMATE: - { - if (hasQuestItems(killer, LILAC_CHARM) && !hasQuestItems(killer, GOLDEN_SEED_2ND)) - { + case SINGING_FLOWER_NIGTMATE: { + if (hasQuestItems(killer, LILAC_CHARM) && !hasQuestItems(killer, GOLDEN_SEED_2ND)) { giveItems(killer, GOLDEN_SEED_2ND, 1); npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.I_AM_A_CREATURE_THAT_SHOWS_THE_TRUTH_OF_THE_PLACE_DEEP_IN_MY_HEART)); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if (hasQuestItems(killer, GOLDEN_SEED_1ST, GOLDEN_SEED_3RD)) - { + if (hasQuestItems(killer, GOLDEN_SEED_1ST, GOLDEN_SEED_3RD)) { qs.setCond(4); } } break; } - case SINGING_FLOWER_DARKLING: - { - if (hasQuestItems(killer, LILAC_CHARM) && !hasQuestItems(killer, GOLDEN_SEED_3RD)) - { + case SINGING_FLOWER_DARKLING: { + if (hasQuestItems(killer, LILAC_CHARM) && !hasQuestItems(killer, GOLDEN_SEED_3RD)) { giveItems(killer, GOLDEN_SEED_3RD, 1); npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.I_AM_A_MIRROR_OF_DARKNESS_A_VIRTUAL_IMAGE_OF_DARKNESS)); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if (hasQuestItems(killer, GOLDEN_SEED_1ST, GOLDEN_SEED_2ND)) - { + if (hasQuestItems(killer, GOLDEN_SEED_1ST, GOLDEN_SEED_2ND)) { qs.setCond(4); } } break; } - case GHOST_FIRE: - { - if (hasQuestItems(killer, SCORE_OF_ELEMENTS, SALAMANDER_CHARM) && (getQuestItemsCount(killer, FLAME_CRYSTAL) < 5)) - { - if (getRandom(100) < 50) - { + case GHOST_FIRE: { + if (hasQuestItems(killer, SCORE_OF_ELEMENTS, SALAMANDER_CHARM) && (getQuestItemsCount(killer, FLAME_CRYSTAL) < 5)) { + if (getRandom(100) < 50) { giveItems(killer, FLAME_CRYSTAL, 1); - if (getQuestItemsCount(killer, FLAME_CRYSTAL) >= 5) - { + if (getQuestItemsCount(killer, FLAME_CRYSTAL) >= 5) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -384,261 +311,171 @@ public final class Q00228_TestOfMagus extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == BARD_RUKAL) - { - if ((player.getClassId() == ClassId.wizard) || (player.getClassId() == ClassId.elvenWizard) || ((player.getClassId() == ClassId.darkWizard))) - { - if (player.getLevel() < MIN_LVL) - { + if (qs.isCreated()) { + if (npc.getId() == BARD_RUKAL) { + if ((player.getClassId() == ClassId.wizard) || (player.getClassId() == ClassId.elvenWizard) || ((player.getClassId() == ClassId.darkWizard))) { + if (player.getLevel() < MIN_LVL) { htmltext = "30629-02.html"; - } - else - { + } else { htmltext = "30629-03.htm"; } - } - else - { + } else { htmltext = "30629-01.html"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case BARD_RUKAL: - { - if (hasQuestItems(player, RUKALS_LETTER)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case BARD_RUKAL: { + if (hasQuestItems(player, RUKALS_LETTER)) { htmltext = "30629-05.html"; - } - else if (hasQuestItems(player, PARINAS_LETTER)) - { + } else if (hasQuestItems(player, PARINAS_LETTER)) { htmltext = "30629-06.html"; - } - else if (hasQuestItems(player, LILAC_CHARM)) - { - if (hasQuestItems(player, GOLDEN_SEED_1ST, GOLDEN_SEED_2ND, GOLDEN_SEED_3RD)) - { + } else if (hasQuestItems(player, LILAC_CHARM)) { + if (hasQuestItems(player, GOLDEN_SEED_1ST, GOLDEN_SEED_2ND, GOLDEN_SEED_3RD)) { htmltext = "30629-08.html"; - } - else - { + } else { htmltext = "30629-07.html"; } - } - else if (hasQuestItems(player, SCORE_OF_ELEMENTS)) - { - if (hasQuestItems(player, TONE_OF_WATER, TONE_OF_FIRE, TONE_OF_WIND, TONE_OF_EARTH)) - { + } else if (hasQuestItems(player, SCORE_OF_ELEMENTS)) { + if (hasQuestItems(player, TONE_OF_WATER, TONE_OF_FIRE, TONE_OF_WIND, TONE_OF_EARTH)) { giveAdena(player, 372154, true); giveItems(player, MARK_OF_MAGUS, 1); addExpAndSp(player, 2058244, 141240); qs.exitQuest(false, true); player.sendPacket(new SocialAction(player.getObjectId(), 3)); htmltext = "30629-12.html"; - } - else - { + } else { htmltext = "30629-11.html"; } } break; } - case PARINA: - { - if (hasQuestItems(player, RUKALS_LETTER)) - { + case PARINA: { + if (hasQuestItems(player, RUKALS_LETTER)) { htmltext = "30391-01.html"; - } - else if (hasQuestItems(player, PARINAS_LETTER)) - { + } else if (hasQuestItems(player, PARINAS_LETTER)) { htmltext = "30391-03.html"; - } - else if (hasQuestItems(player, LILAC_CHARM)) - { + } else if (hasQuestItems(player, LILAC_CHARM)) { htmltext = "30391-04.html"; - } - else if (hasQuestItems(player, SCORE_OF_ELEMENTS)) - { + } else if (hasQuestItems(player, SCORE_OF_ELEMENTS)) { htmltext = "30391-05.html"; } break; } - case EARTH_SNAKE: - { - if (hasQuestItems(player, SCORE_OF_ELEMENTS)) - { - if (!hasAtLeastOneQuestItem(player, TONE_OF_EARTH, SERPENT_CHARM)) - { + case EARTH_SNAKE: { + if (hasQuestItems(player, SCORE_OF_ELEMENTS)) { + if (!hasAtLeastOneQuestItem(player, TONE_OF_EARTH, SERPENT_CHARM)) { htmltext = "30409-01.html"; - } - else if (hasQuestItems(player, SERPENT_CHARM)) - { - if ((getQuestItemsCount(player, ENCHANTED_MONSTER_EYE_SHELL) >= 10) && (getQuestItemsCount(player, ENCHANTED_GOLEM_POWDER) >= 10) && (getQuestItemsCount(player, ENCHANTED_IRON_GOLEM_SCRAP) >= 10)) - { + } else if (hasQuestItems(player, SERPENT_CHARM)) { + if ((getQuestItemsCount(player, ENCHANTED_MONSTER_EYE_SHELL) >= 10) && (getQuestItemsCount(player, ENCHANTED_GOLEM_POWDER) >= 10) && (getQuestItemsCount(player, ENCHANTED_IRON_GOLEM_SCRAP) >= 10)) { takeItems(player, ENCHANTED_MONSTER_EYE_SHELL, -1); takeItems(player, ENCHANTED_GOLEM_POWDER, -1); takeItems(player, ENCHANTED_IRON_GOLEM_SCRAP, -1); giveItems(player, TONE_OF_EARTH, 1); takeItems(player, SERPENT_CHARM, 1); - if (hasQuestItems(player, TONE_OF_FIRE, TONE_OF_WATER, TONE_OF_WIND)) - { + if (hasQuestItems(player, TONE_OF_FIRE, TONE_OF_WATER, TONE_OF_WIND)) { qs.setCond(6, true); } htmltext = "30409-05.html"; - } - else - { + } else { htmltext = "30409-04.html"; } - } - else if (hasQuestItems(player, TONE_OF_EARTH) && !hasQuestItems(player, SERPENT_CHARM)) - { + } else if (hasQuestItems(player, TONE_OF_EARTH) && !hasQuestItems(player, SERPENT_CHARM)) { htmltext = "30409-06.html"; } } break; } - case FLAME_SALAMANDER: - { - if (hasQuestItems(player, SCORE_OF_ELEMENTS)) - { - if (!hasAtLeastOneQuestItem(player, TONE_OF_FIRE, SALAMANDER_CHARM)) - { + case FLAME_SALAMANDER: { + if (hasQuestItems(player, SCORE_OF_ELEMENTS)) { + if (!hasAtLeastOneQuestItem(player, TONE_OF_FIRE, SALAMANDER_CHARM)) { htmltext = "30411-01.html"; giveItems(player, SALAMANDER_CHARM, 1); - } - else if (hasQuestItems(player, SALAMANDER_CHARM)) - { - if (getQuestItemsCount(player, FLAME_CRYSTAL) < 5) - { + } else if (hasQuestItems(player, SALAMANDER_CHARM)) { + if (getQuestItemsCount(player, FLAME_CRYSTAL) < 5) { htmltext = "30411-02.html"; - } - else - { + } else { takeItems(player, FLAME_CRYSTAL, -1); giveItems(player, TONE_OF_FIRE, 1); takeItems(player, SALAMANDER_CHARM, 1); - if (hasQuestItems(player, TONE_OF_WATER, TONE_OF_WIND, TONE_OF_EARTH)) - { + if (hasQuestItems(player, TONE_OF_WATER, TONE_OF_WIND, TONE_OF_EARTH)) { qs.setCond(6, true); } htmltext = "30411-03.html"; } - } - else if (hasQuestItems(player, TONE_OF_FIRE) && !hasQuestItems(player, SALAMANDER_CHARM)) - { + } else if (hasQuestItems(player, TONE_OF_FIRE) && !hasQuestItems(player, SALAMANDER_CHARM)) { htmltext = "30411-04.html"; } } break; } - case WIND_SYLPH: - { - if (hasQuestItems(player, SCORE_OF_ELEMENTS)) - { - if (!hasAtLeastOneQuestItem(player, TONE_OF_WIND, SYLPH_CHARM)) - { + case WIND_SYLPH: { + if (hasQuestItems(player, SCORE_OF_ELEMENTS)) { + if (!hasAtLeastOneQuestItem(player, TONE_OF_WIND, SYLPH_CHARM)) { htmltext = "30412-01.html"; - } - else if (hasQuestItems(player, SYLPH_CHARM)) - { - if ((getQuestItemsCount(player, HARPYS_FEATHER) >= 20) && (getQuestItemsCount(player, WYRMS_WINGBONE) >= 10) && (getQuestItemsCount(player, WINDSUS_MANE) >= 10)) - { + } else if (hasQuestItems(player, SYLPH_CHARM)) { + if ((getQuestItemsCount(player, HARPYS_FEATHER) >= 20) && (getQuestItemsCount(player, WYRMS_WINGBONE) >= 10) && (getQuestItemsCount(player, WINDSUS_MANE) >= 10)) { takeItems(player, HARPYS_FEATHER, -1); takeItems(player, WYRMS_WINGBONE, -1); takeItems(player, WINDSUS_MANE, -1); giveItems(player, TONE_OF_WIND, 1); takeItems(player, SYLPH_CHARM, 1); - if (hasQuestItems(player, TONE_OF_WATER, TONE_OF_FIRE, TONE_OF_EARTH)) - { + if (hasQuestItems(player, TONE_OF_WATER, TONE_OF_FIRE, TONE_OF_EARTH)) { qs.setCond(6, true); } htmltext = "30412-04.html"; - } - else - { + } else { htmltext = "30412-03.html"; } - } - else if (hasQuestItems(player, TONE_OF_WIND) && !hasQuestItems(player, SYLPH_CHARM)) - { + } else if (hasQuestItems(player, TONE_OF_WIND) && !hasQuestItems(player, SYLPH_CHARM)) { htmltext = "30412-05.html"; } } break; } - case WATER_UNDINE: - { - if (hasQuestItems(player, SCORE_OF_ELEMENTS)) - { - if (!hasAtLeastOneQuestItem(player, TONE_OF_WATER, UNDINE_CHARM)) - { + case WATER_UNDINE: { + if (hasQuestItems(player, SCORE_OF_ELEMENTS)) { + if (!hasAtLeastOneQuestItem(player, TONE_OF_WATER, UNDINE_CHARM)) { htmltext = "30413-01.html"; giveItems(player, UNDINE_CHARM, 1); - } - else if (hasQuestItems(player, UNDINE_CHARM)) - { - if (getQuestItemsCount(player, DAZZLING_DROP) < 20) - { + } else if (hasQuestItems(player, UNDINE_CHARM)) { + if (getQuestItemsCount(player, DAZZLING_DROP) < 20) { htmltext = "30413-02.html"; - } - else - { + } else { takeItems(player, DAZZLING_DROP, -1); giveItems(player, TONE_OF_WATER, 1); takeItems(player, UNDINE_CHARM, 1); - if (hasQuestItems(player, TONE_OF_FIRE, TONE_OF_WIND, TONE_OF_EARTH)) - { + if (hasQuestItems(player, TONE_OF_FIRE, TONE_OF_WIND, TONE_OF_EARTH)) { qs.setCond(6, true); } htmltext = "30413-03.html"; } - } - else if (hasQuestItems(player, TONE_OF_WATER) && !hasQuestItems(player, UNDINE_CHARM)) - { + } else if (hasQuestItems(player, TONE_OF_WATER) && !hasQuestItems(player, UNDINE_CHARM)) { htmltext = "30413-04.html"; } } break; } - case ELDER_CASIAN: - { - if (hasQuestItems(player, PARINAS_LETTER)) - { + case ELDER_CASIAN: { + if (hasQuestItems(player, PARINAS_LETTER)) { htmltext = "30612-01.html"; - } - else if (hasQuestItems(player, LILAC_CHARM)) - { - if (hasQuestItems(player, GOLDEN_SEED_1ST, GOLDEN_SEED_2ND, GOLDEN_SEED_3RD)) - { + } else if (hasQuestItems(player, LILAC_CHARM)) { + if (hasQuestItems(player, GOLDEN_SEED_1ST, GOLDEN_SEED_2ND, GOLDEN_SEED_3RD)) { htmltext = "30612-04.html"; - } - else - { + } else { htmltext = "30612-03.html"; } - } - else if (hasQuestItems(player, SCORE_OF_ELEMENTS)) - { + } else if (hasQuestItems(player, SCORE_OF_ELEMENTS)) { htmltext = "30612-05.html"; } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == BARD_RUKAL) - { + } else if (qs.isCompleted()) { + if (npc.getId() == BARD_RUKAL) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00229_TestOfWitchcraft/Q00229_TestOfWitchcraft.java b/src/main/java/com/l2jserver/datapack/quests/Q00229_TestOfWitchcraft/Q00229_TestOfWitchcraft.java index 357daf90e1..08790e7a50 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00229_TestOfWitchcraft/Q00229_TestOfWitchcraft.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00229_TestOfWitchcraft/Q00229_TestOfWitchcraft.java @@ -36,8 +36,7 @@ import com.l2jserver.gameserver.util.Util; * Test Of Witchcraft (229) * @author ivantotov */ -public final class Q00229_TestOfWitchcraft extends Quest -{ +public final class Q00229_TestOfWitchcraft extends Quest { // NPCs private static final int GROCER_LARA = 30063; private static final int TRADER_ALEXANDRIA = 30098; @@ -104,8 +103,7 @@ public final class Q00229_TestOfWitchcraft extends Quest // Locations private static final Location DREVANUL_PRINCE_ZERUEL_SPAWN = new Location(13395, 169807, -3708); - public Q00229_TestOfWitchcraft() - { + public Q00229_TestOfWitchcraft() { super(229, Q00229_TestOfWitchcraft.class.getSimpleName(), "Test Of Witchcraft"); { addStartNpc(SHADOW_ORIM); @@ -117,39 +115,28 @@ public final class Q00229_TestOfWitchcraft extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (qs.isCreated()) - { + switch (event) { + case "ACCEPT": { + if (qs.isCreated()) { qs.startQuest(); playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); giveItems(player, ORIMS_DIAGRAM, 1); - if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) - { - if (player.getClassId() == ClassId.wizard) - { + if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) { + if (player.getClassId() == ClassId.wizard) { giveItems(player, DIMENSIONAL_DIAMOND, 122); - } - else - { + } else { giveItems(player, DIMENSIONAL_DIAMOND, 104); } player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1); htmltext = "30630-08a.htm"; - } - else - { + } else { htmltext = "30630-08.htm"; } } @@ -164,15 +151,12 @@ public final class Q00229_TestOfWitchcraft extends Quest case "30630-21.htm": case "30098-02.htm": case "30110-02.htm": - case "30417-02.htm": - { + case "30417-02.htm": { htmltext = event; break; } - case "30630-14.htm": - { - if (hasQuestItems(player, ALEXANDRIAS_BOOK)) - { + case "30630-14.htm": { + if (hasQuestItems(player, ALEXANDRIAS_BOOK)) { takeItems(player, ALEXANDRIAS_BOOK, 1); takeItems(player, AKLANTOTH_1ST_GEM, 1); takeItems(player, AKLANTOTH_2ND_GEM, 1); @@ -187,10 +171,8 @@ public final class Q00229_TestOfWitchcraft extends Quest } break; } - case "30630-16.htm": - { - if (hasQuestItems(player, BRIMSTONE_1ST)) - { + case "30630-16.htm": { + if (hasQuestItems(player, BRIMSTONE_1ST)) { takeItems(player, BRIMSTONE_1ST, 1); giveItems(player, ORIMS_INSTRUCTIONS, 1); giveItems(player, ORIMS_1ST_LETTER, 1); @@ -200,10 +182,8 @@ public final class Q00229_TestOfWitchcraft extends Quest } break; } - case "30630-22.htm": - { - if (hasQuestItems(player, ZERUEL_BIND_CRYSTAL)) - { + case "30630-22.htm": { + if (hasQuestItems(player, ZERUEL_BIND_CRYSTAL)) { giveAdena(player, 372154, true); giveItems(player, MARK_OF_WITCHCRAFT, 1); addExpAndSp(player, 2058244, 141240); @@ -213,16 +193,13 @@ public final class Q00229_TestOfWitchcraft extends Quest } break; } - case "30063-02.htm": - { + case "30063-02.htm": { giveItems(player, LARAS_MEMO, 1); htmltext = event; break; } - case "30098-03.htm": - { - if (hasQuestItems(player, ORIMS_DIAGRAM)) - { + case "30098-03.htm": { + if (hasQuestItems(player, ORIMS_DIAGRAM)) { takeItems(player, ORIMS_DIAGRAM, 1); giveItems(player, ALEXANDRIAS_BOOK, 1); qs.setCond(2, true); @@ -230,66 +207,54 @@ public final class Q00229_TestOfWitchcraft extends Quest } break; } - case "30110-03.htm": - { + case "30110-03.htm": { giveItems(player, IKERS_LIST, 1); htmltext = event; break; } - case "30110-08.htm": - { + case "30110-08.htm": { takeItems(player, ORIMS_2ND_LETTER, 1); giveItems(player, IKERS_AMULET, 1); giveItems(player, SOULTRAP_CRYSTAL, 1); - if (hasQuestItems(player, SWORD_OF_BINDING)) - { + if (hasQuestItems(player, SWORD_OF_BINDING)) { qs.setCond(7, true); } htmltext = event; break; } - case "30314-02.htm": - { + case "30314-02.htm": { giveItems(player, NESTLES_MEMO, 1); htmltext = event; break; } - case "30417-03.htm": - { - if (hasQuestItems(player, ORIMS_1ST_LETTER)) - { + case "30417-03.htm": { + if (hasQuestItems(player, ORIMS_1ST_LETTER)) { takeItems(player, ORIMS_1ST_LETTER, 1); giveItems(player, SIR_VASPERS_LETTER, 1); htmltext = event; } break; } - case "30435-02.htm": - { - if (hasQuestItems(player, NESTLES_MEMO)) - { + case "30435-02.htm": { + if (hasQuestItems(player, NESTLES_MEMO)) { takeItems(player, NESTLES_MEMO, 1); giveItems(player, LEOPOLDS_JOURNAL, 1); htmltext = event; } break; } - case "30476-02.htm": - { + case "30476-02.htm": { giveItems(player, AKLANTOTH_2ND_GEM, 1); - if (hasQuestItems(player, AKLANTOTH_1ST_GEM, AKLANTOTH_3RD_GEM, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM)) - { + if (hasQuestItems(player, AKLANTOTH_1ST_GEM, AKLANTOTH_3RD_GEM, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM)) { qs.setCond(3, true); } htmltext = event; break; } - case "30633-02.htm": - { + case "30633-02.htm": { giveItems(player, BRIMSTONE_2ND, 1); qs.setCond(9, true); - if (npc.getSummonedNpcCount() < 1) - { + if (npc.getSummonedNpcCount() < 1) { addSpawn(npc, DREVANUL_PRINCE_ZERUEL, DREVANUL_PRINCE_ZERUEL_SPAWN, false, 0); } htmltext = event; @@ -300,43 +265,31 @@ public final class Q00229_TestOfWitchcraft extends Quest } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { final QuestState qs = getQuestState(attacker, false); - if ((qs != null) && qs.isStarted()) - { - switch (npc.getId()) - { - case NAMELESS_REVENANT: - { - if (npc.isScriptValue(0) && hasQuestItems(attacker, ALEXANDRIAS_BOOK, LARAS_MEMO) && !hasQuestItems(attacker, AKLANTOTH_3RD_GEM)) - { + if ((qs != null) && qs.isStarted()) { + switch (npc.getId()) { + case NAMELESS_REVENANT: { + if (npc.isScriptValue(0) && hasQuestItems(attacker, ALEXANDRIAS_BOOK, LARAS_MEMO) && !hasQuestItems(attacker, AKLANTOTH_3RD_GEM)) { npc.setScriptValue(1); npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.I_ABSOLUTELY_CANNOT_GIVE_IT_TO_YOU_IT_IS_MY_PRECIOUS_JEWEL)); } break; } - case SKELETAL_MERCENARY: - { - if (npc.isScriptValue(0) && hasQuestItems(attacker, LEOPOLDS_JOURNAL) && !hasQuestItems(attacker, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM)) - { + case SKELETAL_MERCENARY: { + if (npc.isScriptValue(0) && hasQuestItems(attacker, LEOPOLDS_JOURNAL) && !hasQuestItems(attacker, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM)) { npc.setScriptValue(1); npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.I_ABSOLUTELY_CANNOT_GIVE_IT_TO_YOU_IT_IS_MY_PRECIOUS_JEWEL)); } break; } - case DREVANUL_PRINCE_ZERUEL: - { - if (hasQuestItems(attacker, BRIMSTONE_1ST)) - { + case DREVANUL_PRINCE_ZERUEL: { + if (hasQuestItems(attacker, BRIMSTONE_1ST)) { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.ILL_TAKE_YOUR_LIVES_LATER)); npc.deleteMe(); qs.setCond(5, true); - } - else if (hasQuestItems(attacker, ORIMS_INSTRUCTIONS, BRIMSTONE_2ND, SWORD_OF_BINDING, SOULTRAP_CRYSTAL)) - { - if (npc.isScriptValue(0) && checkWeapon(attacker)) - { + } else if (hasQuestItems(attacker, ORIMS_INSTRUCTIONS, BRIMSTONE_2ND, SWORD_OF_BINDING, SOULTRAP_CRYSTAL)) { + if (npc.isScriptValue(0) && checkWeapon(attacker)) { npc.setScriptValue(1); npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.THAT_SWORD_IS_REALLY)); } @@ -349,45 +302,30 @@ public final class Q00229_TestOfWitchcraft extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case DIRE_WYRM: - { - if (hasQuestItems(killer, ALEXANDRIAS_BOOK, IKERS_LIST)) - { - if (getQuestItemsCount(killer, DIRE_WYRM_FANG) < 20) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case DIRE_WYRM: { + if (hasQuestItems(killer, ALEXANDRIAS_BOOK, IKERS_LIST)) { + if (getQuestItemsCount(killer, DIRE_WYRM_FANG) < 20) { giveItems(killer, DIRE_WYRM_FANG, 1); - if (getQuestItemsCount(killer, DIRE_WYRM_FANG) >= 20) - { + if (getQuestItemsCount(killer, DIRE_WYRM_FANG) >= 20) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case ENCHANTED_STONE_GOLEM: - { - if (hasQuestItems(killer, ALEXANDRIAS_BOOK, IKERS_LIST)) - { - if (getQuestItemsCount(killer, ENCHANTED_STONE_GOLEM_HEARTSTONE) < 20) - { + case ENCHANTED_STONE_GOLEM: { + if (hasQuestItems(killer, ALEXANDRIAS_BOOK, IKERS_LIST)) { + if (getQuestItemsCount(killer, ENCHANTED_STONE_GOLEM_HEARTSTONE) < 20) { giveItems(killer, ENCHANTED_STONE_GOLEM_HEARTSTONE, 1); - if (getQuestItemsCount(killer, ENCHANTED_STONE_GOLEM_HEARTSTONE) >= 20) - { + if (getQuestItemsCount(killer, ENCHANTED_STONE_GOLEM_HEARTSTONE) >= 20) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -399,19 +337,13 @@ public final class Q00229_TestOfWitchcraft extends Quest case LETO_LIZARDMAN_SOLDIER: case LETO_LIZARDMAN_WARRIOR: case LETO_LIZARDMAN_SHAMAN: - case LETO_LIZARDMAN_OVERLORD: - { - if (hasQuestItems(killer, ALEXANDRIAS_BOOK, IKERS_LIST)) - { - if (getQuestItemsCount(killer, LETO_LIZARDMAN_CHARM) < 20) - { + case LETO_LIZARDMAN_OVERLORD: { + if (hasQuestItems(killer, ALEXANDRIAS_BOOK, IKERS_LIST)) { + if (getQuestItemsCount(killer, LETO_LIZARDMAN_CHARM) < 20) { giveItems(killer, LETO_LIZARDMAN_CHARM, 1); - if (getQuestItemsCount(killer, LETO_LIZARDMAN_CHARM) >= 20) - { + if (getQuestItemsCount(killer, LETO_LIZARDMAN_CHARM) >= 20) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -419,72 +351,52 @@ public final class Q00229_TestOfWitchcraft extends Quest break; } case TAMLIN_ORC: - case TAMLIN_ORC_ARCHER: - { - if (hasQuestItems(killer, VADINS_CRUCIFIX)) - { - if ((getRandom(100) < 50) && (getQuestItemsCount(killer, TAMLIN_ORC_AMULET) < 20)) - { + case TAMLIN_ORC_ARCHER: { + if (hasQuestItems(killer, VADINS_CRUCIFIX)) { + if ((getRandom(100) < 50) && (getQuestItemsCount(killer, TAMLIN_ORC_AMULET) < 20)) { giveItems(killer, TAMLIN_ORC_AMULET, 1); - if (getQuestItemsCount(killer, TAMLIN_ORC_AMULET) >= 20) - { + if (getQuestItemsCount(killer, TAMLIN_ORC_AMULET) >= 20) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case NAMELESS_REVENANT: - { - if (hasQuestItems(killer, ALEXANDRIAS_BOOK, LARAS_MEMO) && !hasQuestItems(killer, AKLANTOTH_3RD_GEM)) - { + case NAMELESS_REVENANT: { + if (hasQuestItems(killer, ALEXANDRIAS_BOOK, LARAS_MEMO) && !hasQuestItems(killer, AKLANTOTH_3RD_GEM)) { takeItems(killer, LARAS_MEMO, 1); giveItems(killer, AKLANTOTH_3RD_GEM, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); - if (hasQuestItems(killer, AKLANTOTH_1ST_GEM, AKLANTOTH_2ND_GEM, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM)) - { + if (hasQuestItems(killer, AKLANTOTH_1ST_GEM, AKLANTOTH_2ND_GEM, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM)) { qs.setCond(3); } } break; } - case SKELETAL_MERCENARY: - { - if (hasQuestItems(killer, LEOPOLDS_JOURNAL) && !hasQuestItems(killer, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM)) - { - if (!hasQuestItems(killer, AKLANTOTH_4TH_GEM)) - { + case SKELETAL_MERCENARY: { + if (hasQuestItems(killer, LEOPOLDS_JOURNAL) && !hasQuestItems(killer, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM)) { + if (!hasQuestItems(killer, AKLANTOTH_4TH_GEM)) { giveItems(killer, AKLANTOTH_4TH_GEM, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); - } - else if (!hasQuestItems(killer, AKLANTOTH_5TH_GEM)) - { + } else if (!hasQuestItems(killer, AKLANTOTH_5TH_GEM)) { giveItems(killer, AKLANTOTH_5TH_GEM, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); - } - else if (!hasQuestItems(killer, AKLANTOTH_6TH_GEM)) - { + } else if (!hasQuestItems(killer, AKLANTOTH_6TH_GEM)) { takeItems(killer, LEOPOLDS_JOURNAL, 1); giveItems(killer, AKLANTOTH_6TH_GEM, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); - if (hasQuestItems(killer, AKLANTOTH_1ST_GEM, AKLANTOTH_2ND_GEM, AKLANTOTH_3RD_GEM)) - { + if (hasQuestItems(killer, AKLANTOTH_1ST_GEM, AKLANTOTH_2ND_GEM, AKLANTOTH_3RD_GEM)) { qs.setCond(3); } } } break; } - case DREVANUL_PRINCE_ZERUEL: - { - if (hasQuestItems(killer, ORIMS_INSTRUCTIONS, BRIMSTONE_2ND, SWORD_OF_BINDING, SOULTRAP_CRYSTAL)) - { - if (npc.getKillingBlowWeapon() == SWORD_OF_BINDING) - { + case DREVANUL_PRINCE_ZERUEL: { + if (hasQuestItems(killer, ORIMS_INSTRUCTIONS, BRIMSTONE_2ND, SWORD_OF_BINDING, SOULTRAP_CRYSTAL)) { + if (npc.getKillingBlowWeapon() == SWORD_OF_BINDING) { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.NO_I_HAVENT_COMPLETELY_FINISHED_THE_COMMAND_FOR_DESTRUCTION_AND_SLAUGHTER_YET)); takeItems(killer, SOULTRAP_CRYSTAL, 1); giveItems(killer, PURGATORY_KEY, 1); @@ -502,345 +414,222 @@ public final class Q00229_TestOfWitchcraft extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == SHADOW_ORIM) - { - if ((player.getClassId() == ClassId.wizard) || (player.getClassId() == ClassId.knight) || (player.getClassId() == ClassId.palusKnight)) - { - if (player.getLevel() >= MIN_LEVEL) - { - if (player.getClassId() == ClassId.wizard) - { + if (qs.isCreated()) { + if (npc.getId() == SHADOW_ORIM) { + if ((player.getClassId() == ClassId.wizard) || (player.getClassId() == ClassId.knight) || (player.getClassId() == ClassId.palusKnight)) { + if (player.getLevel() >= MIN_LEVEL) { + if (player.getClassId() == ClassId.wizard) { htmltext = "30630-03.htm"; - } - else - { + } else { htmltext = "30630-05.htm"; } - } - else - { + } else { htmltext = "30630-02.htm"; } - } - else - { + } else { htmltext = "30630-01.htm"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case SHADOW_ORIM: - { - if (hasQuestItems(player, ORIMS_DIAGRAM)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case SHADOW_ORIM: { + if (hasQuestItems(player, ORIMS_DIAGRAM)) { htmltext = "30630-09.htm"; - } - else if (hasQuestItems(player, ALEXANDRIAS_BOOK)) - { - if (hasQuestItems(player, AKLANTOTH_1ST_GEM, AKLANTOTH_2ND_GEM, AKLANTOTH_3RD_GEM, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM)) - { + } else if (hasQuestItems(player, ALEXANDRIAS_BOOK)) { + if (hasQuestItems(player, AKLANTOTH_1ST_GEM, AKLANTOTH_2ND_GEM, AKLANTOTH_3RD_GEM, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM)) { htmltext = "30630-11.htm"; - } - else - { + } else { htmltext = "30630-10.htm"; } - } - else if (hasQuestItems(player, BRIMSTONE_1ST)) - { + } else if (hasQuestItems(player, BRIMSTONE_1ST)) { htmltext = "30630-15.htm"; - } - else if (hasQuestItems(player, ORIMS_INSTRUCTIONS) && !hasAtLeastOneQuestItem(player, SWORD_OF_BINDING, SOULTRAP_CRYSTAL)) - { + } else if (hasQuestItems(player, ORIMS_INSTRUCTIONS) && !hasAtLeastOneQuestItem(player, SWORD_OF_BINDING, SOULTRAP_CRYSTAL)) { htmltext = "30630-17.htm"; } - if (hasQuestItems(player, SWORD_OF_BINDING, SOULTRAP_CRYSTAL)) - { + if (hasQuestItems(player, SWORD_OF_BINDING, SOULTRAP_CRYSTAL)) { qs.setCond(8, true); htmltext = "30630-18.htm"; - } - else if (hasQuestItems(player, SWORD_OF_BINDING, ZERUEL_BIND_CRYSTAL)) - { + } else if (hasQuestItems(player, SWORD_OF_BINDING, ZERUEL_BIND_CRYSTAL)) { htmltext = "30630-19.htm"; } break; } - case GROCER_LARA: - { - if (hasQuestItems(player, ALEXANDRIAS_BOOK)) - { - if (!hasAtLeastOneQuestItem(player, LARAS_MEMO, AKLANTOTH_3RD_GEM)) - { + case GROCER_LARA: { + if (hasQuestItems(player, ALEXANDRIAS_BOOK)) { + if (!hasAtLeastOneQuestItem(player, LARAS_MEMO, AKLANTOTH_3RD_GEM)) { htmltext = "30063-01.htm"; - } - else if (!hasQuestItems(player, AKLANTOTH_3RD_GEM) && hasQuestItems(player, LARAS_MEMO)) - { + } else if (!hasQuestItems(player, AKLANTOTH_3RD_GEM) && hasQuestItems(player, LARAS_MEMO)) { htmltext = "30063-03.htm"; - } - else if (!hasQuestItems(player, LARAS_MEMO) && hasQuestItems(player, AKLANTOTH_3RD_GEM)) - { + } else if (!hasQuestItems(player, LARAS_MEMO) && hasQuestItems(player, AKLANTOTH_3RD_GEM)) { htmltext = "30063-04.htm"; } - } - else if (hasAtLeastOneQuestItem(player, BRIMSTONE_1ST, ORIMS_INSTRUCTIONS)) - { + } else if (hasAtLeastOneQuestItem(player, BRIMSTONE_1ST, ORIMS_INSTRUCTIONS)) { htmltext = "30063-05.htm"; } break; } - case TRADER_ALEXANDRIA: - { - if (hasQuestItems(player, ORIMS_DIAGRAM)) - { + case TRADER_ALEXANDRIA: { + if (hasQuestItems(player, ORIMS_DIAGRAM)) { htmltext = "30098-01.htm"; - } - else if (hasQuestItems(player, ALEXANDRIAS_BOOK)) - { + } else if (hasQuestItems(player, ALEXANDRIAS_BOOK)) { htmltext = "30098-04.htm"; - } - else if (hasQuestItems(player, ORIMS_INSTRUCTIONS, BRIMSTONE_1ST)) - { + } else if (hasQuestItems(player, ORIMS_INSTRUCTIONS, BRIMSTONE_1ST)) { htmltext = "30098-05.htm"; } break; } - case MAGISTER_IKER: - { - if (hasQuestItems(player, ALEXANDRIAS_BOOK)) - { - if (!hasAtLeastOneQuestItem(player, IKERS_LIST, AKLANTOTH_1ST_GEM)) - { + case MAGISTER_IKER: { + if (hasQuestItems(player, ALEXANDRIAS_BOOK)) { + if (!hasAtLeastOneQuestItem(player, IKERS_LIST, AKLANTOTH_1ST_GEM)) { htmltext = "30110-01.htm"; - } - else if (hasQuestItems(player, IKERS_LIST)) - { - if ((getQuestItemsCount(player, DIRE_WYRM_FANG) >= 20) && (getQuestItemsCount(player, LETO_LIZARDMAN_CHARM) >= 20) && (getQuestItemsCount(player, ENCHANTED_STONE_GOLEM_HEARTSTONE) >= 20)) - { + } else if (hasQuestItems(player, IKERS_LIST)) { + if ((getQuestItemsCount(player, DIRE_WYRM_FANG) >= 20) && (getQuestItemsCount(player, LETO_LIZARDMAN_CHARM) >= 20) && (getQuestItemsCount(player, ENCHANTED_STONE_GOLEM_HEARTSTONE) >= 20)) { takeItems(player, IKERS_LIST, 1); takeItems(player, DIRE_WYRM_FANG, -1); takeItems(player, LETO_LIZARDMAN_CHARM, -1); takeItems(player, ENCHANTED_STONE_GOLEM_HEARTSTONE, -1); giveItems(player, AKLANTOTH_1ST_GEM, 1); - if (hasQuestItems(player, AKLANTOTH_2ND_GEM, AKLANTOTH_3RD_GEM, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM)) - { + if (hasQuestItems(player, AKLANTOTH_2ND_GEM, AKLANTOTH_3RD_GEM, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM)) { qs.setCond(3, true); } htmltext = "30110-05.htm"; - } - else - { + } else { htmltext = "30110-04.htm"; } - } - else if (!hasQuestItems(player, IKERS_LIST) && hasQuestItems(player, AKLANTOTH_1ST_GEM)) - { + } else if (!hasQuestItems(player, IKERS_LIST) && hasQuestItems(player, AKLANTOTH_1ST_GEM)) { htmltext = "30110-06.htm"; } - } - else if (hasQuestItems(player, ORIMS_INSTRUCTIONS)) - { - if (!hasAtLeastOneQuestItem(player, SOULTRAP_CRYSTAL, ZERUEL_BIND_CRYSTAL)) - { + } else if (hasQuestItems(player, ORIMS_INSTRUCTIONS)) { + if (!hasAtLeastOneQuestItem(player, SOULTRAP_CRYSTAL, ZERUEL_BIND_CRYSTAL)) { htmltext = "30110-07.htm"; - } - else if (!hasQuestItems(player, ZERUEL_BIND_CRYSTAL) && hasQuestItems(player, SOULTRAP_CRYSTAL)) - { + } else if (!hasQuestItems(player, ZERUEL_BIND_CRYSTAL) && hasQuestItems(player, SOULTRAP_CRYSTAL)) { htmltext = "30110-09.htm"; - } - else if (!hasQuestItems(player, SOULTRAP_CRYSTAL) && hasQuestItems(player, ZERUEL_BIND_CRYSTAL)) - { + } else if (!hasQuestItems(player, SOULTRAP_CRYSTAL) && hasQuestItems(player, ZERUEL_BIND_CRYSTAL)) { htmltext = "30110-10.htm"; } } break; } - case PRIEST_VADIN: - { - if (hasQuestItems(player, ORIMS_INSTRUCTIONS, SIR_VASPERS_LETTER)) - { + case PRIEST_VADIN: { + if (hasQuestItems(player, ORIMS_INSTRUCTIONS, SIR_VASPERS_LETTER)) { takeItems(player, SIR_VASPERS_LETTER, 1); giveItems(player, VADINS_CRUCIFIX, 1); htmltext = "30188-01.htm"; - } - else if (hasQuestItems(player, VADINS_CRUCIFIX)) - { - if (getQuestItemsCount(player, TAMLIN_ORC_AMULET) < 20) - { + } else if (hasQuestItems(player, VADINS_CRUCIFIX)) { + if (getQuestItemsCount(player, TAMLIN_ORC_AMULET) < 20) { htmltext = "30188-02.htm"; - } - else - { + } else { takeItems(player, VADINS_CRUCIFIX, 1); takeItems(player, TAMLIN_ORC_AMULET, -1); giveItems(player, VADINS_SANCTIONS, 1); htmltext = "30188-03.htm"; } - } - else if (hasQuestItems(player, ORIMS_INSTRUCTIONS)) - { - if (hasQuestItems(player, VADINS_SANCTIONS)) - { + } else if (hasQuestItems(player, ORIMS_INSTRUCTIONS)) { + if (hasQuestItems(player, VADINS_SANCTIONS)) { htmltext = "30188-04.htm"; - } - else if (hasQuestItems(player, SWORD_OF_BINDING)) - { + } else if (hasQuestItems(player, SWORD_OF_BINDING)) { htmltext = "30188-05.htm"; } } break; } - case TRADER_NESTLE: - { - if (hasQuestItems(player, ALEXANDRIAS_BOOK)) - { - if (!hasAtLeastOneQuestItem(player, LEOPOLDS_JOURNAL, NESTLES_MEMO, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM)) - { + case TRADER_NESTLE: { + if (hasQuestItems(player, ALEXANDRIAS_BOOK)) { + if (!hasAtLeastOneQuestItem(player, LEOPOLDS_JOURNAL, NESTLES_MEMO, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM)) { htmltext = "30314-01.htm"; - } - else if (hasQuestItems(player, NESTLES_MEMO) && !hasQuestItems(player, LEOPOLDS_JOURNAL)) - { + } else if (hasQuestItems(player, NESTLES_MEMO) && !hasQuestItems(player, LEOPOLDS_JOURNAL)) { htmltext = "30314-03.htm"; - } - else if (!hasQuestItems(player, NESTLES_MEMO) && hasAtLeastOneQuestItem(player, LEOPOLDS_JOURNAL, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM)) - { + } else if (!hasQuestItems(player, NESTLES_MEMO) && hasAtLeastOneQuestItem(player, LEOPOLDS_JOURNAL, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM)) { htmltext = "30314-04.htm"; } } break; } - case SIR_KLAUS_VASPER: - { - if (hasQuestItems(player, ORIMS_INSTRUCTIONS)) - { - if (hasQuestItems(player, ORIMS_1ST_LETTER)) - { + case SIR_KLAUS_VASPER: { + if (hasQuestItems(player, ORIMS_INSTRUCTIONS)) { + if (hasQuestItems(player, ORIMS_1ST_LETTER)) { htmltext = "30417-01.htm"; - } - else if (hasQuestItems(player, SIR_VASPERS_LETTER)) - { + } else if (hasQuestItems(player, SIR_VASPERS_LETTER)) { htmltext = "30417-04.htm"; - } - else if (hasQuestItems(player, VADINS_SANCTIONS)) - { + } else if (hasQuestItems(player, VADINS_SANCTIONS)) { giveItems(player, SWORD_OF_BINDING, 1); takeItems(player, VADINS_SANCTIONS, 1); - if (hasQuestItems(player, SOULTRAP_CRYSTAL)) - { + if (hasQuestItems(player, SOULTRAP_CRYSTAL)) { qs.setCond(7, true); } htmltext = "30417-05.htm"; - } - else if (hasQuestItems(player, SWORD_OF_BINDING)) - { + } else if (hasQuestItems(player, SWORD_OF_BINDING)) { htmltext = "30417-06.htm"; } } break; } - case LEOPOLD: - { - if (hasQuestItems(player, ALEXANDRIAS_BOOK)) - { - if (hasQuestItems(player, NESTLES_MEMO) && !hasQuestItems(player, LEOPOLDS_JOURNAL)) - { + case LEOPOLD: { + if (hasQuestItems(player, ALEXANDRIAS_BOOK)) { + if (hasQuestItems(player, NESTLES_MEMO) && !hasQuestItems(player, LEOPOLDS_JOURNAL)) { htmltext = "30435-01.htm"; - } - else if (hasQuestItems(player, LEOPOLDS_JOURNAL) && !hasQuestItems(player, NESTLES_MEMO)) - { + } else if (hasQuestItems(player, LEOPOLDS_JOURNAL) && !hasQuestItems(player, NESTLES_MEMO)) { htmltext = "30435-03.htm"; - } - else if (hasQuestItems(player, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM)) - { + } else if (hasQuestItems(player, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM)) { htmltext = "30435-04.htm"; } - } - else if (hasAtLeastOneQuestItem(player, BRIMSTONE_1ST, ORIMS_INSTRUCTIONS)) - { + } else if (hasAtLeastOneQuestItem(player, BRIMSTONE_1ST, ORIMS_INSTRUCTIONS)) { htmltext = "30435-05.htm"; } break; } - case MAGISTER_KAIRA: - { - if (hasQuestItems(player, ALEXANDRIAS_BOOK)) - { - if (!hasQuestItems(player, AKLANTOTH_2ND_GEM)) - { + case MAGISTER_KAIRA: { + if (hasQuestItems(player, ALEXANDRIAS_BOOK)) { + if (!hasQuestItems(player, AKLANTOTH_2ND_GEM)) { htmltext = "30476-01.htm"; - } - else - { + } else { htmltext = "30476-03.htm"; } - } - else if (hasAtLeastOneQuestItem(player, BRIMSTONE_1ST, ORIMS_INSTRUCTIONS)) - { + } else if (hasAtLeastOneQuestItem(player, BRIMSTONE_1ST, ORIMS_INSTRUCTIONS)) { htmltext = "30476-04.htm"; } break; } - case WARDEN_RODERIK: - { - if (hasQuestItems(player, ALEXANDRIAS_BOOK) && hasAtLeastOneQuestItem(player, LARAS_MEMO, AKLANTOTH_3RD_GEM)) - { + case WARDEN_RODERIK: { + if (hasQuestItems(player, ALEXANDRIAS_BOOK) && hasAtLeastOneQuestItem(player, LARAS_MEMO, AKLANTOTH_3RD_GEM)) { htmltext = "30631-01.htm"; } break; } - case WARDEN_ENDRIGO: - { - if (hasQuestItems(player, ALEXANDRIAS_BOOK) && hasAtLeastOneQuestItem(player, LARAS_MEMO, AKLANTOTH_3RD_GEM)) - { + case WARDEN_ENDRIGO: { + if (hasQuestItems(player, ALEXANDRIAS_BOOK) && hasAtLeastOneQuestItem(player, LARAS_MEMO, AKLANTOTH_3RD_GEM)) { htmltext = "30632-01.htm"; } break; } - case FISHER_EVERT: - { - if (hasQuestItems(player, ORIMS_INSTRUCTIONS)) - { - if (hasQuestItems(player, SOULTRAP_CRYSTAL, SWORD_OF_BINDING) && !hasQuestItems(player, BRIMSTONE_2ND)) - { + case FISHER_EVERT: { + if (hasQuestItems(player, ORIMS_INSTRUCTIONS)) { + if (hasQuestItems(player, SOULTRAP_CRYSTAL, SWORD_OF_BINDING) && !hasQuestItems(player, BRIMSTONE_2ND)) { htmltext = "30633-01.htm"; - } - else if (hasQuestItems(player, SOULTRAP_CRYSTAL, BRIMSTONE_2ND) && !hasQuestItems(player, ZERUEL_BIND_CRYSTAL)) - { - if (npc.getSummonedNpcCount() < 1) - { + } else if (hasQuestItems(player, SOULTRAP_CRYSTAL, BRIMSTONE_2ND) && !hasQuestItems(player, ZERUEL_BIND_CRYSTAL)) { + if (npc.getSummonedNpcCount() < 1) { addSpawn(npc, DREVANUL_PRINCE_ZERUEL, DREVANUL_PRINCE_ZERUEL_SPAWN, false, 0); } htmltext = "30633-02.htm"; - } - else if (hasQuestItems(player, ZERUEL_BIND_CRYSTAL) && !hasAtLeastOneQuestItem(player, SOULTRAP_CRYSTAL, BRIMSTONE_2ND)) - { + } else if (hasQuestItems(player, ZERUEL_BIND_CRYSTAL) && !hasAtLeastOneQuestItem(player, SOULTRAP_CRYSTAL, BRIMSTONE_2ND)) { htmltext = "30633-03.htm"; } } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == SHADOW_ORIM) - { + } else if (qs.isCompleted()) { + if (npc.getId() == SHADOW_ORIM) { htmltext = getAlreadyCompletedMsg(player); } } return htmltext; } - private boolean checkWeapon(L2PcInstance player) - { + private boolean checkWeapon(L2PcInstance player) { L2ItemInstance weapon = player.getActiveWeaponInstance(); return ((weapon != null) && ((weapon.getId() == SWORD_OF_BINDING))); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00230_TestOfTheSummoner/Q00230_TestOfTheSummoner.java b/src/main/java/com/l2jserver/datapack/quests/Q00230_TestOfTheSummoner/Q00230_TestOfTheSummoner.java index 421ce05024..337c57a208 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00230_TestOfTheSummoner/Q00230_TestOfTheSummoner.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00230_TestOfTheSummoner/Q00230_TestOfTheSummoner.java @@ -40,8 +40,7 @@ import com.l2jserver.gameserver.util.Util; * Test Of The Summoner (230) * @author ivantotov */ -public final class Q00230_TestOfTheSummoner extends Quest -{ +public final class Q00230_TestOfTheSummoner extends Quest { // NPCs private static final int GROCER_LARA = 30063; private static final int HIGH_SUMMONER_GALATEA = 30634; @@ -143,8 +142,7 @@ public final class Q00230_TestOfTheSummoner extends Quest private static final int MIN_LEVEL = 39; private static final Map<Integer, MonsterData> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(PAKO_THE_CAT, new MonsterData(CRYSTAL_OF_INPROGRESS_1ST, CRYSTAL_OF_VICTORY_1ST, NpcStringId.IM_SORRY_LORD)); MONSTERS.put(UNICORN_RACER, new MonsterData(CRYSTAL_OF_INPROGRESS_3RD, CRYSTAL_OF_VICTORY_3RD, NpcStringId.I_LOSE)); MONSTERS.put(SHADOW_TUREN, new MonsterData(CRYSTAL_OF_INPROGRESS_5TH, CRYSTAL_OF_VICTORY_5TH, NpcStringId.UGH_I_LOST)); @@ -153,8 +151,7 @@ public final class Q00230_TestOfTheSummoner extends Quest MONSTERS.put(SILHOUETTE_TILFO, new MonsterData(CRYSTAL_OF_INPROGRESS_6TH, CRYSTAL_OF_VICTORY_6TH, NpcStringId.UGH_CAN_THIS_BE_HAPPENING)); } - public Q00230_TestOfTheSummoner() - { + public Q00230_TestOfTheSummoner() { super(230, Q00230_TestOfTheSummoner.class.getSimpleName(), "Test Of The Summoner"); addStartNpc(HIGH_SUMMONER_GALATEA); addTalkId(HIGH_SUMMONER_GALATEA, GROCER_LARA, SUMMONER_ALMORS, SUMMONER_CAMONIELL, SUMMONER_BELTHUS, SUMMONER_BASILLA, SUMMONER_CELESTIEL, SUMMONER_BRYNTHEA); @@ -165,24 +162,17 @@ public final class Q00230_TestOfTheSummoner extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { - case "DESPAWN": - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { + case "DESPAWN": { npc.deleteMe(); break; } - case "KILLED_ATTACKER": - { + case "KILLED_ATTACKER": { final L2Summon summon = npc.getVariables().getObject("ATTACKER", L2Summon.class); - if ((summon != null) && summon.isDead()) - { + if ((summon != null) && summon.isDead()) { npc.deleteMe(); - } - else - { + } else { startQuestTimer("KILLED_ATTACKER", 5000, npc, null); } break; @@ -190,35 +180,27 @@ public final class Q00230_TestOfTheSummoner extends Quest } // For NPC-only timers, player is null and no further checks or actions are required. - if (player == null) - { + if (player == null) { return null; } final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (qs.isCreated()) - { + switch (event) { + case "ACCEPT": { + if (qs.isCreated()) { qs.startQuest(); playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); giveItems(player, GALATEAS_LETTER, 1); - if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) - { + if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) { giveItems(player, DIMENSIONAL_DIAMOND, 122); player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1); htmltext = "30634-08a.htm"; - } - else - { + } else { htmltext = "30634-08.htm"; } } @@ -232,37 +214,29 @@ public final class Q00230_TestOfTheSummoner extends Quest case "30634-11a.html": case "30634-11b.html": case "30634-11c.html": - case "30634-11d.html": - { + case "30634-11d.html": { htmltext = event; break; } - case "30063-02.html": - { - switch (getRandom(5)) - { - case 0: - { + case "30063-02.html": { + switch (getRandom(5)) { + case 0: { giveItems(player, LARAS_1ST_LIST, 1); break; } - case 1: - { + case 1: { giveItems(player, LARAS_2ND_LIST, 1); break; } - case 2: - { + case 2: { giveItems(player, LARAS_3RD_LIST, 1); break; } - case 3: - { + case 3: { giveItems(player, LARAS_4TH_LIST, 1); break; } - case 4: - { + case 4: { giveItems(player, LARAS_5TH_LIST, 1); break; } @@ -272,32 +246,25 @@ public final class Q00230_TestOfTheSummoner extends Quest htmltext = event; break; } - case "30063-04.html": - { - switch (getRandom(5)) - { - case 0: - { + case "30063-04.html": { + switch (getRandom(5)) { + case 0: { giveItems(player, LARAS_1ST_LIST, 1); break; } - case 1: - { + case 1: { giveItems(player, LARAS_2ND_LIST, 1); break; } - case 2: - { + case 2: { giveItems(player, LARAS_3RD_LIST, 1); break; } - case 3: - { + case 3: { giveItems(player, LARAS_4TH_LIST, 1); break; } - case 4: - { + case 4: { giveItems(player, LARAS_5TH_LIST, 1); break; } @@ -305,20 +272,15 @@ public final class Q00230_TestOfTheSummoner extends Quest htmltext = event; break; } - case "30635-03.html": - { - if (hasQuestItems(player, BEGINNERS_ARCANA)) - { + case "30635-03.html": { + if (hasQuestItems(player, BEGINNERS_ARCANA)) { htmltext = event; - } - else - { + } else { htmltext = "30635-02.html"; } break; } - case "30635-04.html": - { + case "30635-04.html": { addSkillCastDesire(npc, player, REDUCTION_IN_RECOVERY_TIME, 1000000); takeItems(player, BEGINNERS_ARCANA, 1); giveItems(player, CRYSTAL_OF_STARTING_1ST, 1); @@ -327,20 +289,15 @@ public final class Q00230_TestOfTheSummoner extends Quest htmltext = event; break; } - case "30636-03.html": - { - if (hasQuestItems(player, BEGINNERS_ARCANA)) - { + case "30636-03.html": { + if (hasQuestItems(player, BEGINNERS_ARCANA)) { htmltext = event; - } - else - { + } else { htmltext = "30636-02.html"; } break; } - case "30636-04.html": - { + case "30636-04.html": { addSkillCastDesire(npc, player, REDUCTION_IN_RECOVERY_TIME, 1000000); takeItems(player, BEGINNERS_ARCANA, 1); giveItems(player, CRYSTAL_OF_STARTING_3RD, 1); @@ -349,20 +306,15 @@ public final class Q00230_TestOfTheSummoner extends Quest htmltext = event; break; } - case "30637-03.html": - { - if (hasQuestItems(player, BEGINNERS_ARCANA)) - { + case "30637-03.html": { + if (hasQuestItems(player, BEGINNERS_ARCANA)) { htmltext = event; - } - else - { + } else { htmltext = "30637-02.html"; } break; } - case "30637-04.html": - { + case "30637-04.html": { addSkillCastDesire(npc, player, REDUCTION_IN_RECOVERY_TIME, 1000000); takeItems(player, BEGINNERS_ARCANA, 1); giveItems(player, CRYSTAL_OF_STARTING_5TH, 1); @@ -371,20 +323,15 @@ public final class Q00230_TestOfTheSummoner extends Quest htmltext = event; break; } - case "30638-03.html": - { - if (hasQuestItems(player, BEGINNERS_ARCANA)) - { + case "30638-03.html": { + if (hasQuestItems(player, BEGINNERS_ARCANA)) { htmltext = event; - } - else - { + } else { htmltext = "30638-02.html"; } break; } - case "30638-04.html": - { + case "30638-04.html": { addSkillCastDesire(npc, player, REDUCTION_IN_RECOVERY_TIME, 1000000); takeItems(player, BEGINNERS_ARCANA, 1); giveItems(player, CRYSTAL_OF_STARTING_2ND, 1); @@ -393,20 +340,15 @@ public final class Q00230_TestOfTheSummoner extends Quest htmltext = event; break; } - case "30639-03.html": - { - if (hasQuestItems(player, BEGINNERS_ARCANA)) - { + case "30639-03.html": { + if (hasQuestItems(player, BEGINNERS_ARCANA)) { htmltext = event; - } - else - { + } else { htmltext = "30639-02.html"; } break; } - case "30639-04.html": - { + case "30639-04.html": { addSkillCastDesire(npc, player, REDUCTION_IN_RECOVERY_TIME, 1000000); takeItems(player, BEGINNERS_ARCANA, 1); giveItems(player, CRYSTAL_OF_STARTING_4TH, 1); @@ -415,20 +357,15 @@ public final class Q00230_TestOfTheSummoner extends Quest htmltext = event; break; } - case "30640-03.html": - { - if (hasQuestItems(player, BEGINNERS_ARCANA)) - { + case "30640-03.html": { + if (hasQuestItems(player, BEGINNERS_ARCANA)) { htmltext = event; - } - else - { + } else { htmltext = "30640-02.html"; } break; } - case "30640-04.html": - { + case "30640-04.html": { addSkillCastDesire(npc, player, REDUCTION_IN_RECOVERY_TIME, 1000000); takeItems(player, BEGINNERS_ARCANA, 1); giveItems(player, CRYSTAL_OF_STARTING_6TH, 1); @@ -442,26 +379,19 @@ public final class Q00230_TestOfTheSummoner extends Quest } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - switch (npc.getId()) - { - case PAKO_THE_CAT: - { - switch (npc.getScriptValue()) - { - case 0: - { - if (isSummon) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + switch (npc.getId()) { + case PAKO_THE_CAT: { + switch (npc.getScriptValue()) { + case 0: { + if (isSummon) { npc.getVariables().set("ATTACKER", attacker.getSummon()); npc.setScriptValue(1); startQuestTimer("DESPAWN", 120000, npc, null); startQuestTimer("KILLED_ATTACKER", 5000, npc, null); final QuestState qs = getQuestState(attacker, false); - if (hasQuestItems(attacker, CRYSTAL_OF_STARTING_1ST) && (qs != null) && qs.isStarted()) - { + if (hasQuestItems(attacker, CRYSTAL_OF_STARTING_1ST) && (qs != null) && qs.isStarted()) { Broadcast.toKnownPlayers(npc, new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getTemplate().getDisplayId(), NpcStringId.WHHIISSHH)); takeItems(attacker, CRYSTAL_OF_STARTING_1ST, -1); giveItems(attacker, CRYSTAL_OF_INPROGRESS_1ST, 1); @@ -470,13 +400,10 @@ public final class Q00230_TestOfTheSummoner extends Quest } break; } - case 1: - { - if (!isSummon || (npc.getVariables().getObject("ATTACKER", L2Summon.class) != attacker.getSummon())) - { + case 1: { + if (!isSummon || (npc.getVariables().getObject("ATTACKER", L2Summon.class) != attacker.getSummon())) { final QuestState qs = getQuestState(attacker, false); - if (!hasQuestItems(attacker, CRYSTAL_OF_STARTING_1ST) && hasQuestItems(attacker, CRYSTAL_OF_INPROGRESS_1ST) && (qs != null) && qs.isStarted()) - { + if (!hasQuestItems(attacker, CRYSTAL_OF_STARTING_1ST) && hasQuestItems(attacker, CRYSTAL_OF_INPROGRESS_1ST) && (qs != null) && qs.isStarted()) { npc.setScriptValue(2); Broadcast.toKnownPlayers(npc, new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getTemplate().getDisplayId(), NpcStringId.RULE_VIOLATION)); takeItems(attacker, CRYSTAL_OF_INPROGRESS_1ST, -1); @@ -490,22 +417,17 @@ public final class Q00230_TestOfTheSummoner extends Quest } break; } - case UNICORN_RACER: - { - switch (npc.getScriptValue()) - { - case 0: - { - if (isSummon) - { + case UNICORN_RACER: { + switch (npc.getScriptValue()) { + case 0: { + if (isSummon) { npc.getVariables().set("ATTACKER", attacker.getSummon()); npc.setScriptValue(1); startQuestTimer("DESPAWN", 120000, npc, null); startQuestTimer("KILLED_ATTACKER", 5000, npc, null); final QuestState qs = getQuestState(attacker, false); - if (hasQuestItems(attacker, CRYSTAL_OF_STARTING_3RD) && (qs != null) && qs.isStarted()) - { + if (hasQuestItems(attacker, CRYSTAL_OF_STARTING_3RD) && (qs != null) && qs.isStarted()) { Broadcast.toKnownPlayers(npc, new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getTemplate().getDisplayId(), NpcStringId.START_DUEL)); takeItems(attacker, CRYSTAL_OF_STARTING_3RD, -1); giveItems(attacker, CRYSTAL_OF_INPROGRESS_3RD, 1); @@ -514,13 +436,10 @@ public final class Q00230_TestOfTheSummoner extends Quest } break; } - case 1: - { - if (!isSummon || (npc.getVariables().getObject("ATTACKER", L2Summon.class) != attacker.getSummon())) - { + case 1: { + if (!isSummon || (npc.getVariables().getObject("ATTACKER", L2Summon.class) != attacker.getSummon())) { final QuestState qs = getQuestState(attacker, false); - if (!hasQuestItems(attacker, CRYSTAL_OF_STARTING_3RD) && hasQuestItems(attacker, CRYSTAL_OF_INPROGRESS_3RD) && (qs != null) && qs.isStarted()) - { + if (!hasQuestItems(attacker, CRYSTAL_OF_STARTING_3RD) && hasQuestItems(attacker, CRYSTAL_OF_INPROGRESS_3RD) && (qs != null) && qs.isStarted()) { npc.setScriptValue(2); Broadcast.toKnownPlayers(npc, new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getTemplate().getDisplayId(), NpcStringId.RULE_VIOLATION)); takeItems(attacker, CRYSTAL_OF_INPROGRESS_3RD, -1); @@ -533,22 +452,17 @@ public final class Q00230_TestOfTheSummoner extends Quest } } } - case SHADOW_TUREN: - { - switch (npc.getScriptValue()) - { - case 0: - { - if (isSummon) - { + case SHADOW_TUREN: { + switch (npc.getScriptValue()) { + case 0: { + if (isSummon) { npc.getVariables().set("ATTACKER", attacker.getSummon()); npc.setScriptValue(1); startQuestTimer("DESPAWN", 120000, npc, null); startQuestTimer("KILLED_ATTACKER", 5000, npc, null); final QuestState qs = getQuestState(attacker, false); - if (hasQuestItems(attacker, CRYSTAL_OF_STARTING_5TH) && (qs != null) && qs.isStarted()) - { + if (hasQuestItems(attacker, CRYSTAL_OF_STARTING_5TH) && (qs != null) && qs.isStarted()) { Broadcast.toKnownPlayers(npc, new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getTemplate().getDisplayId(), NpcStringId.SO_SHALL_WE_START)); takeItems(attacker, CRYSTAL_OF_STARTING_5TH, -1); giveItems(attacker, CRYSTAL_OF_INPROGRESS_5TH, 1); @@ -557,13 +471,10 @@ public final class Q00230_TestOfTheSummoner extends Quest } break; } - case 1: - { - if (!isSummon || (npc.getVariables().getObject("ATTACKER", L2Summon.class) != attacker.getSummon())) - { + case 1: { + if (!isSummon || (npc.getVariables().getObject("ATTACKER", L2Summon.class) != attacker.getSummon())) { final QuestState qs = getQuestState(attacker, false); - if (!hasQuestItems(attacker, CRYSTAL_OF_STARTING_5TH) && hasQuestItems(attacker, CRYSTAL_OF_INPROGRESS_5TH) && (qs != null) && qs.isStarted()) - { + if (!hasQuestItems(attacker, CRYSTAL_OF_STARTING_5TH) && hasQuestItems(attacker, CRYSTAL_OF_INPROGRESS_5TH) && (qs != null) && qs.isStarted()) { npc.setScriptValue(2); Broadcast.toKnownPlayers(npc, new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getTemplate().getDisplayId(), NpcStringId.RULE_VIOLATION)); takeItems(attacker, CRYSTAL_OF_INPROGRESS_5TH, -1); @@ -576,22 +487,17 @@ public final class Q00230_TestOfTheSummoner extends Quest } } } - case MIMI_THE_CAT: - { - switch (npc.getScriptValue()) - { - case 0: - { - if (isSummon) - { + case MIMI_THE_CAT: { + switch (npc.getScriptValue()) { + case 0: { + if (isSummon) { npc.getVariables().set("ATTACKER", attacker.getSummon()); npc.setScriptValue(1); startQuestTimer("DESPAWN", 120000, npc, null); startQuestTimer("KILLED_ATTACKER", 5000, npc, null); final QuestState qs = getQuestState(attacker, false); - if (hasQuestItems(attacker, CRYSTAL_OF_STARTING_2ND) && (qs != null) && qs.isStarted()) - { + if (hasQuestItems(attacker, CRYSTAL_OF_STARTING_2ND) && (qs != null) && qs.isStarted()) { Broadcast.toKnownPlayers(npc, new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getTemplate().getDisplayId(), NpcStringId.WHISH_FIGHT)); takeItems(attacker, CRYSTAL_OF_STARTING_2ND, -1); giveItems(attacker, CRYSTAL_OF_INPROGRESS_2ND, 1); @@ -600,13 +506,10 @@ public final class Q00230_TestOfTheSummoner extends Quest } break; } - case 1: - { - if (!isSummon || (npc.getVariables().getObject("ATTACKER", L2Summon.class) != attacker.getSummon())) - { + case 1: { + if (!isSummon || (npc.getVariables().getObject("ATTACKER", L2Summon.class) != attacker.getSummon())) { final QuestState qs = getQuestState(attacker, false); - if (!hasQuestItems(attacker, CRYSTAL_OF_STARTING_2ND) && hasQuestItems(attacker, CRYSTAL_OF_INPROGRESS_2ND) && (qs != null) && qs.isStarted()) - { + if (!hasQuestItems(attacker, CRYSTAL_OF_STARTING_2ND) && hasQuestItems(attacker, CRYSTAL_OF_INPROGRESS_2ND) && (qs != null) && qs.isStarted()) { npc.setScriptValue(2); Broadcast.toKnownPlayers(npc, new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getTemplate().getDisplayId(), NpcStringId.RULE_VIOLATION)); takeItems(attacker, CRYSTAL_OF_INPROGRESS_2ND, -1); @@ -619,22 +522,17 @@ public final class Q00230_TestOfTheSummoner extends Quest } } } - case UNICORN_PHANTASM: - { - switch (npc.getScriptValue()) - { - case 0: - { - if (isSummon) - { + case UNICORN_PHANTASM: { + switch (npc.getScriptValue()) { + case 0: { + if (isSummon) { npc.getVariables().set("ATTACKER", attacker.getSummon()); npc.setScriptValue(1); startQuestTimer("DESPAWN", 120000, npc, null); startQuestTimer("KILLED_ATTACKER", 5000, npc, null); final QuestState qs = getQuestState(attacker, false); - if (hasQuestItems(attacker, CRYSTAL_OF_STARTING_4TH) && (qs != null) && qs.isStarted()) - { + if (hasQuestItems(attacker, CRYSTAL_OF_STARTING_4TH) && (qs != null) && qs.isStarted()) { Broadcast.toKnownPlayers(npc, new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getTemplate().getDisplayId(), NpcStringId.START_DUEL)); takeItems(attacker, CRYSTAL_OF_STARTING_4TH, -1); giveItems(attacker, CRYSTAL_OF_INPROGRESS_4TH, 1); @@ -643,13 +541,10 @@ public final class Q00230_TestOfTheSummoner extends Quest } break; } - case 1: - { - if (!isSummon || (npc.getVariables().getObject("ATTACKER", L2Summon.class) != attacker.getSummon())) - { + case 1: { + if (!isSummon || (npc.getVariables().getObject("ATTACKER", L2Summon.class) != attacker.getSummon())) { final QuestState qs = getQuestState(attacker, false); - if (!hasQuestItems(attacker, CRYSTAL_OF_STARTING_4TH) && hasQuestItems(attacker, CRYSTAL_OF_INPROGRESS_4TH) && (qs != null) && qs.isStarted()) - { + if (!hasQuestItems(attacker, CRYSTAL_OF_STARTING_4TH) && hasQuestItems(attacker, CRYSTAL_OF_INPROGRESS_4TH) && (qs != null) && qs.isStarted()) { npc.setScriptValue(2); Broadcast.toKnownPlayers(npc, new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getTemplate().getDisplayId(), NpcStringId.RULE_VIOLATION)); takeItems(attacker, CRYSTAL_OF_INPROGRESS_4TH, -1); @@ -662,22 +557,17 @@ public final class Q00230_TestOfTheSummoner extends Quest } } } - case SILHOUETTE_TILFO: - { - switch (npc.getScriptValue()) - { - case 0: - { - if (isSummon) - { + case SILHOUETTE_TILFO: { + switch (npc.getScriptValue()) { + case 0: { + if (isSummon) { npc.getVariables().set("ATTACKER", attacker.getSummon()); npc.setScriptValue(1); startQuestTimer("DESPAWN", 120000, npc, null); startQuestTimer("KILLED_ATTACKER", 5000, npc, null); final QuestState qs = getQuestState(attacker, false); - if (hasQuestItems(attacker, CRYSTAL_OF_STARTING_6TH) && (qs != null) && qs.isStarted()) - { + if (hasQuestItems(attacker, CRYSTAL_OF_STARTING_6TH) && (qs != null) && qs.isStarted()) { Broadcast.toKnownPlayers(npc, new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getTemplate().getDisplayId(), NpcStringId.ILL_WALK_ALL_OVER_YOU)); takeItems(attacker, CRYSTAL_OF_STARTING_6TH, -1); giveItems(attacker, CRYSTAL_OF_INPROGRESS_6TH, 1); @@ -686,13 +576,10 @@ public final class Q00230_TestOfTheSummoner extends Quest } break; } - case 1: - { - if (!isSummon || (npc.getVariables().getObject("ATTACKER", L2Summon.class) != attacker.getSummon())) - { + case 1: { + if (!isSummon || (npc.getVariables().getObject("ATTACKER", L2Summon.class) != attacker.getSummon())) { final QuestState qs = getQuestState(attacker, false); - if (!hasQuestItems(attacker, CRYSTAL_OF_STARTING_6TH) && hasQuestItems(attacker, CRYSTAL_OF_INPROGRESS_6TH) && (qs != null) && qs.isStarted()) - { + if (!hasQuestItems(attacker, CRYSTAL_OF_STARTING_6TH) && hasQuestItems(attacker, CRYSTAL_OF_INPROGRESS_6TH) && (qs != null) && qs.isStarted()) { npc.setScriptValue(2); Broadcast.toKnownPlayers(npc, new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getTemplate().getDisplayId(), NpcStringId.RULE_VIOLATION)); takeItems(attacker, CRYSTAL_OF_INPROGRESS_6TH, -1); @@ -710,86 +597,65 @@ public final class Q00230_TestOfTheSummoner extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { case NOBLE_ANT: - case NOBLE_ANT_LEADER: - { - if (!hasQuestItems(killer, GALATEAS_LETTER) && hasQuestItems(killer, LARAS_5TH_LIST)) - { + case NOBLE_ANT_LEADER: { + if (!hasQuestItems(killer, GALATEAS_LETTER) && hasQuestItems(killer, LARAS_5TH_LIST)) { giveItemRandomly(killer, npc, WINGS_OF_DRONEANT, 2, 30, 1.0, true); } break; } - case WYRM: - { - if (!hasQuestItems(killer, GALATEAS_LETTER) && hasQuestItems(killer, LARAS_5TH_LIST)) - { + case WYRM: { + if (!hasQuestItems(killer, GALATEAS_LETTER) && hasQuestItems(killer, LARAS_5TH_LIST)) { giveItemRandomly(killer, npc, FANGS_OF_WYRM, 3, 30, 1.0, true); } break; } case TYRANT: - case TYRANT_KINGPIN: - { - if (!hasQuestItems(killer, GALATEAS_LETTER) && hasQuestItems(killer, LARAS_4TH_LIST)) - { + case TYRANT_KINGPIN: { + if (!hasQuestItems(killer, GALATEAS_LETTER) && hasQuestItems(killer, LARAS_4TH_LIST)) { giveItemRandomly(killer, npc, TALONS_OF_TYRANT, 3, 30, 1.0, true); } break; } case BREKA_ORC: case BREKA_ORC_ARCHER: - case BREKA_ORC_WARRIOR: - { - if (!hasQuestItems(killer, GALATEAS_LETTER) && hasQuestItems(killer, LARAS_3RD_LIST)) - { + case BREKA_ORC_WARRIOR: { + if (!hasQuestItems(killer, GALATEAS_LETTER) && hasQuestItems(killer, LARAS_3RD_LIST)) { giveItemRandomly(killer, npc, BREKAORC_TOTEM, 1, 30, 1.0, true); } break; } case BREKA_ORC_SHAMAN: - case BREKA_ORC_OVERLORD: - { - if (!hasQuestItems(killer, GALATEAS_LETTER) && hasQuestItems(killer, LARAS_3RD_LIST)) - { + case BREKA_ORC_OVERLORD: { + if (!hasQuestItems(killer, GALATEAS_LETTER) && hasQuestItems(killer, LARAS_3RD_LIST)) { giveItemRandomly(killer, npc, BREKAORC_TOTEM, 2, 30, 1.0, true); } break; } - case FETTERED_SOUL: - { - if (!hasQuestItems(killer, GALATEAS_LETTER) && hasQuestItems(killer, LARAS_3RD_LIST)) - { + case FETTERED_SOUL: { + if (!hasQuestItems(killer, GALATEAS_LETTER) && hasQuestItems(killer, LARAS_3RD_LIST)) { giveItemRandomly(killer, npc, CRIMSON_BLOODSTONE, 6, 30, 1.0, true); } break; } - case WINDSUS: - { - if (!hasQuestItems(killer, GALATEAS_LETTER) && hasQuestItems(killer, LARAS_4TH_LIST)) - { + case WINDSUS: { + if (!hasQuestItems(killer, GALATEAS_LETTER) && hasQuestItems(killer, LARAS_4TH_LIST)) { giveItemRandomly(killer, npc, TUSK_OF_WINDSUS, 3, 30, 1.0, true); } break; } - case GIANT_FUNGUS: - { - if (!hasQuestItems(killer, GALATEAS_LETTER) && hasQuestItems(killer, LARAS_1ST_LIST)) - { + case GIANT_FUNGUS: { + if (!hasQuestItems(killer, GALATEAS_LETTER) && hasQuestItems(killer, LARAS_1ST_LIST)) { giveItemRandomly(killer, npc, SAC_OF_REDSPORES, 2, 30, 1.0, true); } break; } - case MANASHEN_GARGOYLE: - { - if (!hasQuestItems(killer, GALATEAS_LETTER) && hasQuestItems(killer, LARAS_2ND_LIST)) - { + case MANASHEN_GARGOYLE: { + if (!hasQuestItems(killer, GALATEAS_LETTER) && hasQuestItems(killer, LARAS_2ND_LIST)) { giveItemRandomly(killer, npc, SHARDS_OF_MANASHEN, 2, 30, 1.0, true); } break; @@ -797,27 +663,21 @@ public final class Q00230_TestOfTheSummoner extends Quest case LETO_LIZARDMAN: case LETO_LIZARDMAN_ARCHER: case LETO_LIZARDMAN_SOLDIER: - case LETO_LIZARDMAN_WARRIOR: - { - if (!hasQuestItems(killer, GALATEAS_LETTER) && hasQuestItems(killer, LARAS_1ST_LIST)) - { + case LETO_LIZARDMAN_WARRIOR: { + if (!hasQuestItems(killer, GALATEAS_LETTER) && hasQuestItems(killer, LARAS_1ST_LIST)) { giveItemRandomly(killer, npc, LETOLIZARDMAN_AMULET, 1, 30, 1.0, true); } break; } case LETO_LIZARDMAN_SHAMAN: - case LETO_LIZARDMAN_OVERLORD: - { - if (!hasQuestItems(killer, GALATEAS_LETTER) && hasQuestItems(killer, LARAS_1ST_LIST)) - { + case LETO_LIZARDMAN_OVERLORD: { + if (!hasQuestItems(killer, GALATEAS_LETTER) && hasQuestItems(killer, LARAS_1ST_LIST)) { giveItemRandomly(killer, npc, LETOLIZARDMAN_AMULET, 2, 30, 1.0, true); } break; } - case KARUL_BUGBEAR: - { - if (!hasQuestItems(killer, GALATEAS_LETTER) && hasQuestItems(killer, LARAS_2ND_LIST)) - { + case KARUL_BUGBEAR: { + if (!hasQuestItems(killer, GALATEAS_LETTER) && hasQuestItems(killer, LARAS_2ND_LIST)) { giveItemRandomly(killer, npc, KARULBUGBEAR_TOTEM, 2, 30, 1.0, true); } break; @@ -827,11 +687,9 @@ public final class Q00230_TestOfTheSummoner extends Quest case MIMI_THE_CAT: case SHADOW_TUREN: case UNICORN_RACER: - case PAKO_THE_CAT: - { + case PAKO_THE_CAT: { final MonsterData data = MONSTERS.get(npc.getId()); - if (hasQuestItems(killer, data.getCrystalOfInprogress())) - { + if (hasQuestItems(killer, data.getCrystalOfInprogress())) { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, data.getNpcStringId())); takeItems(killer, data.getCrystalOfInprogress(), 1); giveItems(killer, data.getCrystalOfVictory(), 1); @@ -845,53 +703,32 @@ public final class Q00230_TestOfTheSummoner extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == HIGH_SUMMONER_GALATEA) - { - if ((player.getClassId() == ClassId.wizard) || (player.getClassId() == ClassId.elvenWizard) || (player.getClassId() == ClassId.darkWizard)) - { - if (player.getLevel() >= MIN_LEVEL) - { + if (qs.isCreated()) { + if (npc.getId() == HIGH_SUMMONER_GALATEA) { + if ((player.getClassId() == ClassId.wizard) || (player.getClassId() == ClassId.elvenWizard) || (player.getClassId() == ClassId.darkWizard)) { + if (player.getLevel() >= MIN_LEVEL) { htmltext = "30634-03.htm"; - } - else - { + } else { htmltext = "30634-02.html"; } - } - else - { + } else { htmltext = "30634-01.html"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case HIGH_SUMMONER_GALATEA: - { - if (hasQuestItems(player, GALATEAS_LETTER)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case HIGH_SUMMONER_GALATEA: { + if (hasQuestItems(player, GALATEAS_LETTER)) { htmltext = "30634-09.html"; - } - else if (!hasQuestItems(player, GALATEAS_LETTER)) - { - if (!hasQuestItems(player, ALMORS_ARCANA, BASILLIA_ARCANA, CAMONIELL_ARCANA, CELESTIEL_ARCANA, BELTHUS_ARCANA, BRYNTHEA_ARCANA) && !hasQuestItems(player, BEGINNERS_ARCANA)) - { + } else if (!hasQuestItems(player, GALATEAS_LETTER)) { + if (!hasQuestItems(player, ALMORS_ARCANA, BASILLIA_ARCANA, CAMONIELL_ARCANA, CELESTIEL_ARCANA, BELTHUS_ARCANA, BRYNTHEA_ARCANA) && !hasQuestItems(player, BEGINNERS_ARCANA)) { htmltext = "30634-10.html"; - } - else if (!hasQuestItems(player, ALMORS_ARCANA, BASILLIA_ARCANA, CAMONIELL_ARCANA, CELESTIEL_ARCANA, BELTHUS_ARCANA, BRYNTHEA_ARCANA) && hasQuestItems(player, BEGINNERS_ARCANA)) - { + } else if (!hasQuestItems(player, ALMORS_ARCANA, BASILLIA_ARCANA, CAMONIELL_ARCANA, CELESTIEL_ARCANA, BELTHUS_ARCANA, BRYNTHEA_ARCANA) && hasQuestItems(player, BEGINNERS_ARCANA)) { htmltext = "30634-11.html"; - } - else if (hasQuestItems(player, ALMORS_ARCANA, BASILLIA_ARCANA, CAMONIELL_ARCANA, CELESTIEL_ARCANA, BELTHUS_ARCANA, BRYNTHEA_ARCANA)) - { + } else if (hasQuestItems(player, ALMORS_ARCANA, BASILLIA_ARCANA, CAMONIELL_ARCANA, CELESTIEL_ARCANA, BELTHUS_ARCANA, BRYNTHEA_ARCANA)) { giveAdena(player, 300960, true); giveItems(player, MARK_OF_SUMMONER, 1); addExpAndSp(player, 1664494, 114220); @@ -902,384 +739,250 @@ public final class Q00230_TestOfTheSummoner extends Quest } break; } - case GROCER_LARA: - { - if (hasQuestItems(player, GALATEAS_LETTER)) - { + case GROCER_LARA: { + if (hasQuestItems(player, GALATEAS_LETTER)) { htmltext = "30063-01.html"; - } - else if (!hasQuestItems(player, GALATEAS_LETTER)) - { - if (!hasAtLeastOneQuestItem(player, LARAS_1ST_LIST, LARAS_2ND_LIST, LARAS_3RD_LIST, LARAS_4TH_LIST, LARAS_5TH_LIST)) - { + } else if (!hasQuestItems(player, GALATEAS_LETTER)) { + if (!hasAtLeastOneQuestItem(player, LARAS_1ST_LIST, LARAS_2ND_LIST, LARAS_3RD_LIST, LARAS_4TH_LIST, LARAS_5TH_LIST)) { htmltext = "30063-03.html"; - } - else if (hasQuestItems(player, LARAS_1ST_LIST)) - { - if ((getQuestItemsCount(player, LETOLIZARDMAN_AMULET) >= 30) && (getQuestItemsCount(player, SAC_OF_REDSPORES) >= 30)) - { + } else if (hasQuestItems(player, LARAS_1ST_LIST)) { + if ((getQuestItemsCount(player, LETOLIZARDMAN_AMULET) >= 30) && (getQuestItemsCount(player, SAC_OF_REDSPORES) >= 30)) { takeItems(player, LETOLIZARDMAN_AMULET, -1); takeItems(player, SAC_OF_REDSPORES, -1); takeItems(player, LARAS_1ST_LIST, 1); giveItems(player, BEGINNERS_ARCANA, 2); qs.setCond(3, true); htmltext = "30063-06.html"; - } - else - { + } else { htmltext = "30063-05.html"; } - } - else if (hasQuestItems(player, LARAS_2ND_LIST)) - { - if ((getQuestItemsCount(player, KARULBUGBEAR_TOTEM) >= 30) && (getQuestItemsCount(player, SHARDS_OF_MANASHEN) >= 30)) - { + } else if (hasQuestItems(player, LARAS_2ND_LIST)) { + if ((getQuestItemsCount(player, KARULBUGBEAR_TOTEM) >= 30) && (getQuestItemsCount(player, SHARDS_OF_MANASHEN) >= 30)) { takeItems(player, KARULBUGBEAR_TOTEM, -1); takeItems(player, SHARDS_OF_MANASHEN, -1); takeItems(player, LARAS_2ND_LIST, 1); giveItems(player, BEGINNERS_ARCANA, 2); qs.setCond(3, true); htmltext = "30063-08.html"; - } - else - { + } else { htmltext = "30063-07.html"; } - } - else if (hasQuestItems(player, LARAS_3RD_LIST)) - { - if ((getQuestItemsCount(player, BREKAORC_TOTEM) >= 30) && (getQuestItemsCount(player, CRIMSON_BLOODSTONE) >= 30)) - { + } else if (hasQuestItems(player, LARAS_3RD_LIST)) { + if ((getQuestItemsCount(player, BREKAORC_TOTEM) >= 30) && (getQuestItemsCount(player, CRIMSON_BLOODSTONE) >= 30)) { takeItems(player, BREKAORC_TOTEM, -1); takeItems(player, CRIMSON_BLOODSTONE, -1); takeItems(player, LARAS_3RD_LIST, 1); giveItems(player, BEGINNERS_ARCANA, 2); qs.setCond(3, true); htmltext = "30063-10.html"; - } - else - { + } else { htmltext = "30063-09.html"; } - } - else if (hasQuestItems(player, LARAS_4TH_LIST)) - { - if ((getQuestItemsCount(player, TALONS_OF_TYRANT) >= 30) && (getQuestItemsCount(player, TUSK_OF_WINDSUS) >= 30)) - { + } else if (hasQuestItems(player, LARAS_4TH_LIST)) { + if ((getQuestItemsCount(player, TALONS_OF_TYRANT) >= 30) && (getQuestItemsCount(player, TUSK_OF_WINDSUS) >= 30)) { takeItems(player, TALONS_OF_TYRANT, -1); takeItems(player, TUSK_OF_WINDSUS, -1); takeItems(player, LARAS_4TH_LIST, 1); giveItems(player, BEGINNERS_ARCANA, 2); qs.setCond(3, true); htmltext = "30063-12.html"; - } - else - { + } else { htmltext = "30063-11.html"; } - } - else if (hasQuestItems(player, LARAS_5TH_LIST)) - { - if ((getQuestItemsCount(player, WINGS_OF_DRONEANT) >= 30) && (getQuestItemsCount(player, FANGS_OF_WYRM) >= 30)) - { + } else if (hasQuestItems(player, LARAS_5TH_LIST)) { + if ((getQuestItemsCount(player, WINGS_OF_DRONEANT) >= 30) && (getQuestItemsCount(player, FANGS_OF_WYRM) >= 30)) { takeItems(player, WINGS_OF_DRONEANT, -1); takeItems(player, FANGS_OF_WYRM, -1); takeItems(player, LARAS_5TH_LIST, 1); giveItems(player, BEGINNERS_ARCANA, 2); qs.setCond(3, true); htmltext = "30063-14.html"; - } - else - { + } else { htmltext = "30063-13.html"; } } } break; } - case SUMMONER_ALMORS: - { - if (!hasQuestItems(player, ALMORS_ARCANA)) - { - if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_1ST, CRYSTAL_OF_INPROGRESS_1ST, CRYSTAL_OF_FOUL_1ST, CRYSTAL_OF_DEFEAT_1ST, CRYSTAL_OF_VICTORY_1ST)) - { + case SUMMONER_ALMORS: { + if (!hasQuestItems(player, ALMORS_ARCANA)) { + if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_1ST, CRYSTAL_OF_INPROGRESS_1ST, CRYSTAL_OF_FOUL_1ST, CRYSTAL_OF_DEFEAT_1ST, CRYSTAL_OF_VICTORY_1ST)) { htmltext = "30635-01.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_1ST, CRYSTAL_OF_INPROGRESS_1ST, CRYSTAL_OF_FOUL_1ST, CRYSTAL_OF_VICTORY_1ST) && hasQuestItems(player, CRYSTAL_OF_DEFEAT_1ST)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_1ST, CRYSTAL_OF_INPROGRESS_1ST, CRYSTAL_OF_FOUL_1ST, CRYSTAL_OF_VICTORY_1ST) && hasQuestItems(player, CRYSTAL_OF_DEFEAT_1ST)) { htmltext = "30635-05.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_1ST, CRYSTAL_OF_INPROGRESS_1ST, CRYSTAL_OF_DEFEAT_1ST, CRYSTAL_OF_VICTORY_1ST) && hasQuestItems(player, CRYSTAL_OF_FOUL_1ST)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_1ST, CRYSTAL_OF_INPROGRESS_1ST, CRYSTAL_OF_DEFEAT_1ST, CRYSTAL_OF_VICTORY_1ST) && hasQuestItems(player, CRYSTAL_OF_FOUL_1ST)) { htmltext = "30635-06.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_1ST, CRYSTAL_OF_INPROGRESS_1ST, CRYSTAL_OF_FOUL_1ST, CRYSTAL_OF_DEFEAT_1ST) && hasQuestItems(player, CRYSTAL_OF_VICTORY_1ST)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_1ST, CRYSTAL_OF_INPROGRESS_1ST, CRYSTAL_OF_FOUL_1ST, CRYSTAL_OF_DEFEAT_1ST) && hasQuestItems(player, CRYSTAL_OF_VICTORY_1ST)) { giveItems(player, ALMORS_ARCANA, 1); takeItems(player, CRYSTAL_OF_VICTORY_1ST, 1); - if (hasQuestItems(player, BASILLIA_ARCANA, CAMONIELL_ARCANA, CELESTIEL_ARCANA, BELTHUS_ARCANA, BRYNTHEA_ARCANA)) - { + if (hasQuestItems(player, BASILLIA_ARCANA, CAMONIELL_ARCANA, CELESTIEL_ARCANA, BELTHUS_ARCANA, BRYNTHEA_ARCANA)) { qs.setCond(4, true); } htmltext = "30635-07.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_INPROGRESS_1ST, CRYSTAL_OF_FOUL_1ST, CRYSTAL_OF_DEFEAT_1ST, CRYSTAL_OF_VICTORY_1ST) && hasQuestItems(player, CRYSTAL_OF_STARTING_1ST)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_INPROGRESS_1ST, CRYSTAL_OF_FOUL_1ST, CRYSTAL_OF_DEFEAT_1ST, CRYSTAL_OF_VICTORY_1ST) && hasQuestItems(player, CRYSTAL_OF_STARTING_1ST)) { htmltext = "30635-08.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_1ST, CRYSTAL_OF_FOUL_1ST, CRYSTAL_OF_DEFEAT_1ST, CRYSTAL_OF_VICTORY_1ST) && hasQuestItems(player, CRYSTAL_OF_INPROGRESS_1ST)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_1ST, CRYSTAL_OF_FOUL_1ST, CRYSTAL_OF_DEFEAT_1ST, CRYSTAL_OF_VICTORY_1ST) && hasQuestItems(player, CRYSTAL_OF_INPROGRESS_1ST)) { htmltext = "30635-09.html"; } - } - else - { + } else { htmltext = "30635-10.html"; } break; } - case SUMMONER_CAMONIELL: - { - if (!hasQuestItems(player, CAMONIELL_ARCANA)) - { - if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_3RD, CRYSTAL_OF_INPROGRESS_3RD, CRYSTAL_OF_FOUL_3RD, CRYSTAL_OF_DEFEAT_3RD, CRYSTAL_OF_VICTORY_3RD)) - { + case SUMMONER_CAMONIELL: { + if (!hasQuestItems(player, CAMONIELL_ARCANA)) { + if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_3RD, CRYSTAL_OF_INPROGRESS_3RD, CRYSTAL_OF_FOUL_3RD, CRYSTAL_OF_DEFEAT_3RD, CRYSTAL_OF_VICTORY_3RD)) { htmltext = "30636-01.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_3RD, CRYSTAL_OF_INPROGRESS_3RD, CRYSTAL_OF_FOUL_3RD, CRYSTAL_OF_VICTORY_3RD) && hasQuestItems(player, CRYSTAL_OF_DEFEAT_3RD)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_3RD, CRYSTAL_OF_INPROGRESS_3RD, CRYSTAL_OF_FOUL_3RD, CRYSTAL_OF_VICTORY_3RD) && hasQuestItems(player, CRYSTAL_OF_DEFEAT_3RD)) { htmltext = "30636-05.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_3RD, CRYSTAL_OF_INPROGRESS_3RD, CRYSTAL_OF_DEFEAT_3RD, CRYSTAL_OF_VICTORY_3RD) && hasQuestItems(player, CRYSTAL_OF_FOUL_3RD)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_3RD, CRYSTAL_OF_INPROGRESS_3RD, CRYSTAL_OF_DEFEAT_3RD, CRYSTAL_OF_VICTORY_3RD) && hasQuestItems(player, CRYSTAL_OF_FOUL_3RD)) { htmltext = "30636-06.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_3RD, CRYSTAL_OF_INPROGRESS_3RD, CRYSTAL_OF_FOUL_3RD, CRYSTAL_OF_DEFEAT_3RD) && hasQuestItems(player, CRYSTAL_OF_VICTORY_3RD)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_3RD, CRYSTAL_OF_INPROGRESS_3RD, CRYSTAL_OF_FOUL_3RD, CRYSTAL_OF_DEFEAT_3RD) && hasQuestItems(player, CRYSTAL_OF_VICTORY_3RD)) { giveItems(player, CAMONIELL_ARCANA, 1); takeItems(player, CRYSTAL_OF_VICTORY_3RD, 1); - if (hasQuestItems(player, ALMORS_ARCANA, BASILLIA_ARCANA, CELESTIEL_ARCANA, BELTHUS_ARCANA, BRYNTHEA_ARCANA)) - { + if (hasQuestItems(player, ALMORS_ARCANA, BASILLIA_ARCANA, CELESTIEL_ARCANA, BELTHUS_ARCANA, BRYNTHEA_ARCANA)) { qs.setCond(4, true); } htmltext = "30636-07.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_INPROGRESS_3RD, CRYSTAL_OF_FOUL_3RD, CRYSTAL_OF_DEFEAT_3RD, CRYSTAL_OF_VICTORY_3RD) && hasQuestItems(player, CRYSTAL_OF_STARTING_3RD)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_INPROGRESS_3RD, CRYSTAL_OF_FOUL_3RD, CRYSTAL_OF_DEFEAT_3RD, CRYSTAL_OF_VICTORY_3RD) && hasQuestItems(player, CRYSTAL_OF_STARTING_3RD)) { htmltext = "30636-08.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_3RD, CRYSTAL_OF_FOUL_3RD, CRYSTAL_OF_DEFEAT_3RD, CRYSTAL_OF_VICTORY_3RD) && hasQuestItems(player, CRYSTAL_OF_INPROGRESS_3RD)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_3RD, CRYSTAL_OF_FOUL_3RD, CRYSTAL_OF_DEFEAT_3RD, CRYSTAL_OF_VICTORY_3RD) && hasQuestItems(player, CRYSTAL_OF_INPROGRESS_3RD)) { htmltext = "30636-09.html"; } - } - else - { + } else { htmltext = "30636-10.html"; } break; } - case SUMMONER_BELTHUS: - { - if (!hasQuestItems(player, BELTHUS_ARCANA)) - { - if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_5TH, CRYSTAL_OF_INPROGRESS_5TH, CRYSTAL_OF_FOUL_5TH, CRYSTAL_OF_DEFEAT_5TH, CRYSTAL_OF_VICTORY_5TH)) - { + case SUMMONER_BELTHUS: { + if (!hasQuestItems(player, BELTHUS_ARCANA)) { + if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_5TH, CRYSTAL_OF_INPROGRESS_5TH, CRYSTAL_OF_FOUL_5TH, CRYSTAL_OF_DEFEAT_5TH, CRYSTAL_OF_VICTORY_5TH)) { htmltext = "30637-01.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_5TH, CRYSTAL_OF_INPROGRESS_5TH, CRYSTAL_OF_FOUL_5TH, CRYSTAL_OF_VICTORY_5TH) && hasQuestItems(player, CRYSTAL_OF_DEFEAT_5TH)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_5TH, CRYSTAL_OF_INPROGRESS_5TH, CRYSTAL_OF_FOUL_5TH, CRYSTAL_OF_VICTORY_5TH) && hasQuestItems(player, CRYSTAL_OF_DEFEAT_5TH)) { htmltext = "30637-05.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_5TH, CRYSTAL_OF_INPROGRESS_5TH, CRYSTAL_OF_DEFEAT_5TH, CRYSTAL_OF_VICTORY_5TH) && hasQuestItems(player, CRYSTAL_OF_FOUL_5TH)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_5TH, CRYSTAL_OF_INPROGRESS_5TH, CRYSTAL_OF_DEFEAT_5TH, CRYSTAL_OF_VICTORY_5TH) && hasQuestItems(player, CRYSTAL_OF_FOUL_5TH)) { htmltext = "30637-06.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_5TH, CRYSTAL_OF_INPROGRESS_5TH, CRYSTAL_OF_FOUL_5TH, CRYSTAL_OF_DEFEAT_5TH) && hasQuestItems(player, CRYSTAL_OF_VICTORY_5TH)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_5TH, CRYSTAL_OF_INPROGRESS_5TH, CRYSTAL_OF_FOUL_5TH, CRYSTAL_OF_DEFEAT_5TH) && hasQuestItems(player, CRYSTAL_OF_VICTORY_5TH)) { giveItems(player, BELTHUS_ARCANA, 1); takeItems(player, CRYSTAL_OF_VICTORY_5TH, 1); - if (hasQuestItems(player, ALMORS_ARCANA, BASILLIA_ARCANA, CAMONIELL_ARCANA, CELESTIEL_ARCANA, BRYNTHEA_ARCANA)) - { + if (hasQuestItems(player, ALMORS_ARCANA, BASILLIA_ARCANA, CAMONIELL_ARCANA, CELESTIEL_ARCANA, BRYNTHEA_ARCANA)) { qs.setCond(4, true); } htmltext = "30637-07.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_INPROGRESS_5TH, CRYSTAL_OF_FOUL_5TH, CRYSTAL_OF_DEFEAT_5TH, CRYSTAL_OF_VICTORY_5TH) && hasQuestItems(player, CRYSTAL_OF_STARTING_5TH)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_INPROGRESS_5TH, CRYSTAL_OF_FOUL_5TH, CRYSTAL_OF_DEFEAT_5TH, CRYSTAL_OF_VICTORY_5TH) && hasQuestItems(player, CRYSTAL_OF_STARTING_5TH)) { htmltext = "30637-08.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_5TH, CRYSTAL_OF_FOUL_5TH, CRYSTAL_OF_DEFEAT_5TH, CRYSTAL_OF_VICTORY_5TH) && hasQuestItems(player, CRYSTAL_OF_INPROGRESS_5TH)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_5TH, CRYSTAL_OF_FOUL_5TH, CRYSTAL_OF_DEFEAT_5TH, CRYSTAL_OF_VICTORY_5TH) && hasQuestItems(player, CRYSTAL_OF_INPROGRESS_5TH)) { htmltext = "30637-09.html"; } - } - else - { + } else { htmltext = "30637-10.html"; } break; } - case SUMMONER_BASILLA: - { - if (!hasQuestItems(player, BASILLIA_ARCANA)) - { - if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_2ND, CRYSTAL_OF_INPROGRESS_2ND, CRYSTAL_OF_FOUL_2ND, CRYSTAL_OF_DEFEAT_2ND, CRYSTAL_OF_VICTORY_2ND)) - { + case SUMMONER_BASILLA: { + if (!hasQuestItems(player, BASILLIA_ARCANA)) { + if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_2ND, CRYSTAL_OF_INPROGRESS_2ND, CRYSTAL_OF_FOUL_2ND, CRYSTAL_OF_DEFEAT_2ND, CRYSTAL_OF_VICTORY_2ND)) { htmltext = "30638-01.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_2ND, CRYSTAL_OF_INPROGRESS_2ND, CRYSTAL_OF_FOUL_2ND, CRYSTAL_OF_VICTORY_2ND) && hasQuestItems(player, CRYSTAL_OF_DEFEAT_2ND)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_2ND, CRYSTAL_OF_INPROGRESS_2ND, CRYSTAL_OF_FOUL_2ND, CRYSTAL_OF_VICTORY_2ND) && hasQuestItems(player, CRYSTAL_OF_DEFEAT_2ND)) { htmltext = "30638-05.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_2ND, CRYSTAL_OF_INPROGRESS_2ND, CRYSTAL_OF_DEFEAT_2ND, CRYSTAL_OF_VICTORY_2ND) && hasQuestItems(player, CRYSTAL_OF_FOUL_2ND)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_2ND, CRYSTAL_OF_INPROGRESS_2ND, CRYSTAL_OF_DEFEAT_2ND, CRYSTAL_OF_VICTORY_2ND) && hasQuestItems(player, CRYSTAL_OF_FOUL_2ND)) { htmltext = "30638-06.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_2ND, CRYSTAL_OF_INPROGRESS_2ND, CRYSTAL_OF_FOUL_2ND, CRYSTAL_OF_DEFEAT_2ND) && hasQuestItems(player, CRYSTAL_OF_VICTORY_2ND)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_2ND, CRYSTAL_OF_INPROGRESS_2ND, CRYSTAL_OF_FOUL_2ND, CRYSTAL_OF_DEFEAT_2ND) && hasQuestItems(player, CRYSTAL_OF_VICTORY_2ND)) { giveItems(player, BASILLIA_ARCANA, 1); takeItems(player, CRYSTAL_OF_VICTORY_2ND, 1); - if (hasQuestItems(player, ALMORS_ARCANA, CAMONIELL_ARCANA, CELESTIEL_ARCANA, BELTHUS_ARCANA, BRYNTHEA_ARCANA)) - { + if (hasQuestItems(player, ALMORS_ARCANA, CAMONIELL_ARCANA, CELESTIEL_ARCANA, BELTHUS_ARCANA, BRYNTHEA_ARCANA)) { qs.setCond(4, true); } htmltext = "30638-07.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_INPROGRESS_2ND, CRYSTAL_OF_FOUL_2ND, CRYSTAL_OF_DEFEAT_2ND, CRYSTAL_OF_VICTORY_2ND) && hasQuestItems(player, CRYSTAL_OF_STARTING_2ND)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_INPROGRESS_2ND, CRYSTAL_OF_FOUL_2ND, CRYSTAL_OF_DEFEAT_2ND, CRYSTAL_OF_VICTORY_2ND) && hasQuestItems(player, CRYSTAL_OF_STARTING_2ND)) { htmltext = "30638-08.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_2ND, CRYSTAL_OF_FOUL_2ND, CRYSTAL_OF_DEFEAT_2ND, CRYSTAL_OF_VICTORY_2ND) && hasQuestItems(player, CRYSTAL_OF_INPROGRESS_2ND)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_2ND, CRYSTAL_OF_FOUL_2ND, CRYSTAL_OF_DEFEAT_2ND, CRYSTAL_OF_VICTORY_2ND) && hasQuestItems(player, CRYSTAL_OF_INPROGRESS_2ND)) { htmltext = "30638-09.html"; } - } - else - { + } else { htmltext = "30638-10.html"; } break; } - case SUMMONER_CELESTIEL: - { - if (!hasQuestItems(player, CELESTIEL_ARCANA)) - { - if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_4TH, CRYSTAL_OF_INPROGRESS_4TH, CRYSTAL_OF_FOUL_4TH, CRYSTAL_OF_DEFEAT_4TH, CRYSTAL_OF_VICTORY_4TH)) - { + case SUMMONER_CELESTIEL: { + if (!hasQuestItems(player, CELESTIEL_ARCANA)) { + if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_4TH, CRYSTAL_OF_INPROGRESS_4TH, CRYSTAL_OF_FOUL_4TH, CRYSTAL_OF_DEFEAT_4TH, CRYSTAL_OF_VICTORY_4TH)) { htmltext = "30639-01.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_4TH, CRYSTAL_OF_INPROGRESS_4TH, CRYSTAL_OF_FOUL_4TH, CRYSTAL_OF_VICTORY_4TH) && hasQuestItems(player, CRYSTAL_OF_DEFEAT_4TH)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_4TH, CRYSTAL_OF_INPROGRESS_4TH, CRYSTAL_OF_FOUL_4TH, CRYSTAL_OF_VICTORY_4TH) && hasQuestItems(player, CRYSTAL_OF_DEFEAT_4TH)) { htmltext = "30639-05.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_4TH, CRYSTAL_OF_INPROGRESS_4TH, CRYSTAL_OF_DEFEAT_4TH, CRYSTAL_OF_VICTORY_4TH) && hasQuestItems(player, CRYSTAL_OF_FOUL_4TH)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_4TH, CRYSTAL_OF_INPROGRESS_4TH, CRYSTAL_OF_DEFEAT_4TH, CRYSTAL_OF_VICTORY_4TH) && hasQuestItems(player, CRYSTAL_OF_FOUL_4TH)) { htmltext = "30639-06.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_4TH, CRYSTAL_OF_INPROGRESS_4TH, CRYSTAL_OF_FOUL_4TH, CRYSTAL_OF_DEFEAT_4TH) && hasQuestItems(player, CRYSTAL_OF_VICTORY_4TH)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_4TH, CRYSTAL_OF_INPROGRESS_4TH, CRYSTAL_OF_FOUL_4TH, CRYSTAL_OF_DEFEAT_4TH) && hasQuestItems(player, CRYSTAL_OF_VICTORY_4TH)) { giveItems(player, CELESTIEL_ARCANA, 1); takeItems(player, CRYSTAL_OF_VICTORY_4TH, 1); - if (hasQuestItems(player, ALMORS_ARCANA, BASILLIA_ARCANA, CAMONIELL_ARCANA, BELTHUS_ARCANA, BRYNTHEA_ARCANA)) - { + if (hasQuestItems(player, ALMORS_ARCANA, BASILLIA_ARCANA, CAMONIELL_ARCANA, BELTHUS_ARCANA, BRYNTHEA_ARCANA)) { qs.setCond(4, true); } htmltext = "30639-07.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_INPROGRESS_4TH, CRYSTAL_OF_FOUL_4TH, CRYSTAL_OF_DEFEAT_4TH, CRYSTAL_OF_VICTORY_4TH) && hasQuestItems(player, CRYSTAL_OF_STARTING_4TH)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_INPROGRESS_4TH, CRYSTAL_OF_FOUL_4TH, CRYSTAL_OF_DEFEAT_4TH, CRYSTAL_OF_VICTORY_4TH) && hasQuestItems(player, CRYSTAL_OF_STARTING_4TH)) { htmltext = "30639-08.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_4TH, CRYSTAL_OF_FOUL_4TH, CRYSTAL_OF_DEFEAT_4TH, CRYSTAL_OF_VICTORY_4TH) && hasQuestItems(player, CRYSTAL_OF_INPROGRESS_4TH)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_4TH, CRYSTAL_OF_FOUL_4TH, CRYSTAL_OF_DEFEAT_4TH, CRYSTAL_OF_VICTORY_4TH) && hasQuestItems(player, CRYSTAL_OF_INPROGRESS_4TH)) { htmltext = "30639-09.html"; } - } - else - { + } else { htmltext = "30639-10.html"; } break; } - case SUMMONER_BRYNTHEA: - { - if (!hasQuestItems(player, BRYNTHEA_ARCANA)) - { - if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_6TH, CRYSTAL_OF_INPROGRESS_6TH, CRYSTAL_OF_FOUL_6TH, CRYSTAL_OF_DEFEAT_6TH, CRYSTAL_OF_VICTORY_6TH)) - { + case SUMMONER_BRYNTHEA: { + if (!hasQuestItems(player, BRYNTHEA_ARCANA)) { + if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_6TH, CRYSTAL_OF_INPROGRESS_6TH, CRYSTAL_OF_FOUL_6TH, CRYSTAL_OF_DEFEAT_6TH, CRYSTAL_OF_VICTORY_6TH)) { htmltext = "30640-01.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_6TH, CRYSTAL_OF_INPROGRESS_6TH, CRYSTAL_OF_FOUL_6TH, CRYSTAL_OF_VICTORY_6TH) && hasQuestItems(player, CRYSTAL_OF_DEFEAT_6TH)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_6TH, CRYSTAL_OF_INPROGRESS_6TH, CRYSTAL_OF_FOUL_6TH, CRYSTAL_OF_VICTORY_6TH) && hasQuestItems(player, CRYSTAL_OF_DEFEAT_6TH)) { htmltext = "30640-05.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_6TH, CRYSTAL_OF_INPROGRESS_6TH, CRYSTAL_OF_DEFEAT_6TH, CRYSTAL_OF_VICTORY_6TH) && hasQuestItems(player, CRYSTAL_OF_FOUL_6TH)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_6TH, CRYSTAL_OF_INPROGRESS_6TH, CRYSTAL_OF_DEFEAT_6TH, CRYSTAL_OF_VICTORY_6TH) && hasQuestItems(player, CRYSTAL_OF_FOUL_6TH)) { htmltext = "30640-06.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_6TH, CRYSTAL_OF_INPROGRESS_6TH, CRYSTAL_OF_FOUL_6TH, CRYSTAL_OF_DEFEAT_6TH) && hasQuestItems(player, CRYSTAL_OF_VICTORY_6TH)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_6TH, CRYSTAL_OF_INPROGRESS_6TH, CRYSTAL_OF_FOUL_6TH, CRYSTAL_OF_DEFEAT_6TH) && hasQuestItems(player, CRYSTAL_OF_VICTORY_6TH)) { giveItems(player, BRYNTHEA_ARCANA, 1); takeItems(player, CRYSTAL_OF_VICTORY_6TH, 1); - if (hasQuestItems(player, ALMORS_ARCANA, BASILLIA_ARCANA, CAMONIELL_ARCANA, CELESTIEL_ARCANA, BELTHUS_ARCANA)) - { + if (hasQuestItems(player, ALMORS_ARCANA, BASILLIA_ARCANA, CAMONIELL_ARCANA, CELESTIEL_ARCANA, BELTHUS_ARCANA)) { qs.setCond(4, true); } htmltext = "30640-07.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_INPROGRESS_6TH, CRYSTAL_OF_FOUL_6TH, CRYSTAL_OF_DEFEAT_6TH, CRYSTAL_OF_VICTORY_6TH) && hasQuestItems(player, CRYSTAL_OF_STARTING_6TH)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_INPROGRESS_6TH, CRYSTAL_OF_FOUL_6TH, CRYSTAL_OF_DEFEAT_6TH, CRYSTAL_OF_VICTORY_6TH) && hasQuestItems(player, CRYSTAL_OF_STARTING_6TH)) { htmltext = "30640-08.html"; - } - else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_6TH, CRYSTAL_OF_FOUL_6TH, CRYSTAL_OF_DEFEAT_6TH, CRYSTAL_OF_VICTORY_6TH) && hasQuestItems(player, CRYSTAL_OF_INPROGRESS_6TH)) - { + } else if (!hasAtLeastOneQuestItem(player, CRYSTAL_OF_STARTING_6TH, CRYSTAL_OF_FOUL_6TH, CRYSTAL_OF_DEFEAT_6TH, CRYSTAL_OF_VICTORY_6TH) && hasQuestItems(player, CRYSTAL_OF_INPROGRESS_6TH)) { htmltext = "30640-09.html"; } - } - else - { + } else { htmltext = "30640-10.html"; } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == HIGH_SUMMONER_GALATEA) - { + } else if (qs.isCompleted()) { + if (npc.getId() == HIGH_SUMMONER_GALATEA) { htmltext = getAlreadyCompletedMsg(player); } } return htmltext; } - private static class MonsterData - { + private static class MonsterData { private final int _crystalOfInprogress; private final int _crystalOfVictory; private final NpcStringId _npcStringId; - protected MonsterData(int crystalOfInprogress, int crystalOfVictory, NpcStringId npcStringId) - { + protected MonsterData(int crystalOfInprogress, int crystalOfVictory, NpcStringId npcStringId) { _crystalOfInprogress = crystalOfInprogress; _crystalOfVictory = crystalOfVictory; _npcStringId = npcStringId; } - protected int getCrystalOfInprogress() - { + protected int getCrystalOfInprogress() { return _crystalOfInprogress; } - protected int getCrystalOfVictory() - { + protected int getCrystalOfVictory() { return _crystalOfVictory; } - protected NpcStringId getNpcStringId() - { + protected NpcStringId getNpcStringId() { return _npcStringId; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00231_TestOfTheMaestro/Q00231_TestOfTheMaestro.java b/src/main/java/com/l2jserver/datapack/quests/Q00231_TestOfTheMaestro/Q00231_TestOfTheMaestro.java index 988e502646..c2d6fec26a 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00231_TestOfTheMaestro/Q00231_TestOfTheMaestro.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00231_TestOfTheMaestro/Q00231_TestOfTheMaestro.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Test Of The Maestro (231) * @author ivantotov */ -public final class Q00231_TestOfTheMaestro extends Quest -{ +public final class Q00231_TestOfTheMaestro extends Quest { // NPCs private static final int IRON_GATES_LOCKIRIN = 30531; private static final int GOLDEN_WHEELS_SPIRON = 30532; @@ -73,8 +72,7 @@ public final class Q00231_TestOfTheMaestro extends Quest // Misc private static final int MIN_LEVEL = 39; - public Q00231_TestOfTheMaestro() - { + public Q00231_TestOfTheMaestro() { super(231, Q00231_TestOfTheMaestro.class.getSimpleName(), "Test Of The Maestro"); addStartNpc(IRON_GATES_LOCKIRIN); addTalkId(IRON_GATES_LOCKIRIN, GOLDEN_WHEELS_SPIRON, SILVER_SCALES_BALANKI, BRONZE_KEYS_KEEF, GRAY_PILLAR_MEMBER_FILAUR, BLACK_ANVILS_ARIN, MASTER_TOMA, CHIEF_CROTO, JAILER_DUBABAH, RESEARCHER_LORAIN); @@ -83,54 +81,42 @@ public final class Q00231_TestOfTheMaestro extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (qs.isCreated()) - { + switch (event) { + case "ACCEPT": { + if (qs.isCreated()) { qs.startQuest(); qs.setMemoState(1); playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); - if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) - { + if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) { giveItems(player, DIMENSIONAL_DIAMOND, 23); player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1); htmltext = "30531-04a.htm"; - } - else - { + } else { htmltext = "30531-04.htm"; } } break; } - case "30533-02.html": - { + case "30533-02.html": { qs.setMemoState(2); htmltext = event; break; } case "30556-02.html": case "30556-03.html": - case "30556-04.html": - { + case "30556-04.html": { htmltext = event; break; } - case "30556-05.html": - { - if (hasQuestItems(player, PAINT_OF_TELEPORT_DEVICE)) - { + case "30556-05.html": { + if (hasQuestItems(player, PAINT_OF_TELEPORT_DEVICE)) { giveItems(player, BROKEN_TELEPORT_DEVICE, 1); takeItems(player, PAINT_OF_TELEPORT_DEVICE, 1); player.teleToLocation(140352, -194133, -3146); @@ -139,16 +125,13 @@ public final class Q00231_TestOfTheMaestro extends Quest } break; } - case "30671-02.html": - { + case "30671-02.html": { giveItems(player, PAINT_OF_KAMURU, 1); htmltext = event; break; } - case "30673-04.html": - { - if (hasQuestItems(player, INGREDIENTS_OF_ANTIDOTE) && (getQuestItemsCount(player, STINGER_WASP_NEEDLE) >= 10) && (getQuestItemsCount(player, MARSH_SPIDERS_WEB) >= 10) && (getQuestItemsCount(player, BLOOD_OF_LEECH) >= 10)) - { + case "30673-04.html": { + if (hasQuestItems(player, INGREDIENTS_OF_ANTIDOTE) && (getQuestItemsCount(player, STINGER_WASP_NEEDLE) >= 10) && (getQuestItemsCount(player, MARSH_SPIDERS_WEB) >= 10) && (getQuestItemsCount(player, BLOOD_OF_LEECH) >= 10)) { giveItems(player, REPORT_OF_CRUMA, 1); takeItems(player, STINGER_WASP_NEEDLE, -1); takeItems(player, MARSH_SPIDERS_WEB, -1); @@ -158,8 +141,7 @@ public final class Q00231_TestOfTheMaestro extends Quest } break; } - case "SPAWN_KING_BUGBEAR": - { + case "SPAWN_KING_BUGBEAR": { addAttackDesire(addSpawn(KING_BUGBEAR, 140395, -194147, -3146, 0, false, 200000, false), player); addAttackDesire(addSpawn(KING_BUGBEAR, 140395, -194147, -3146, 0, false, 200000, false), player); addAttackDesire(addSpawn(KING_BUGBEAR, 140395, -194147, -3146, 0, false, 200000, false), player); @@ -170,65 +152,45 @@ public final class Q00231_TestOfTheMaestro extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case GIANT_MIST_LEECH: - { - if (qs.isMemoState(4) && hasQuestItems(killer, INGREDIENTS_OF_ANTIDOTE) && (getQuestItemsCount(killer, BLOOD_OF_LEECH) < 10)) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case GIANT_MIST_LEECH: { + if (qs.isMemoState(4) && hasQuestItems(killer, INGREDIENTS_OF_ANTIDOTE) && (getQuestItemsCount(killer, BLOOD_OF_LEECH) < 10)) { giveItems(killer, BLOOD_OF_LEECH, 1); - if (getQuestItemsCount(killer, BLOOD_OF_LEECH) >= 10) - { + if (getQuestItemsCount(killer, BLOOD_OF_LEECH) >= 10) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case STINGER_WASP: - { - if (qs.isMemoState(4) && hasQuestItems(killer, INGREDIENTS_OF_ANTIDOTE) && (getQuestItemsCount(killer, STINGER_WASP_NEEDLE) < 10)) - { + case STINGER_WASP: { + if (qs.isMemoState(4) && hasQuestItems(killer, INGREDIENTS_OF_ANTIDOTE) && (getQuestItemsCount(killer, STINGER_WASP_NEEDLE) < 10)) { giveItems(killer, STINGER_WASP_NEEDLE, 1); - if (getQuestItemsCount(killer, STINGER_WASP_NEEDLE) >= 10) - { + if (getQuestItemsCount(killer, STINGER_WASP_NEEDLE) >= 10) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case MARSH_SPIDER: - { - if (qs.isMemoState(4) && hasQuestItems(killer, INGREDIENTS_OF_ANTIDOTE) && (getQuestItemsCount(killer, MARSH_SPIDERS_WEB) < 10)) - { + case MARSH_SPIDER: { + if (qs.isMemoState(4) && hasQuestItems(killer, INGREDIENTS_OF_ANTIDOTE) && (getQuestItemsCount(killer, MARSH_SPIDERS_WEB) < 10)) { giveItems(killer, MARSH_SPIDERS_WEB, 1); - if (getQuestItemsCount(killer, MARSH_SPIDERS_WEB) >= 10) - { + if (getQuestItemsCount(killer, MARSH_SPIDERS_WEB) >= 10) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case EVIL_EYE_LORD: - { - if (qs.isMemoState(2) && hasQuestItems(killer, PAINT_OF_KAMURU) && !hasQuestItems(killer, NECKLACE_OF_KAMUTU)) - { + case EVIL_EYE_LORD: { + if (qs.isMemoState(2) && hasQuestItems(killer, PAINT_OF_KAMURU) && !hasQuestItems(killer, NECKLACE_OF_KAMUTU)) { giveItems(killer, NECKLACE_OF_KAMUTU, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); } @@ -240,44 +202,28 @@ public final class Q00231_TestOfTheMaestro extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); final int memoState = qs.getMemoState(); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == IRON_GATES_LOCKIRIN) - { - if (player.getClassId() == ClassId.artisan) - { - if (player.getLevel() >= MIN_LEVEL) - { + if (qs.isCreated()) { + if (npc.getId() == IRON_GATES_LOCKIRIN) { + if (player.getClassId() == ClassId.artisan) { + if (player.getLevel() >= MIN_LEVEL) { htmltext = "30531-03.htm"; - } - else - { + } else { htmltext = "30531-01.html"; } - } - else - { + } else { htmltext = "30531-02.html"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case IRON_GATES_LOCKIRIN: - { - if ((memoState >= 1) && !hasQuestItems(player, RECOMMENDATION_OF_BALANKI, RECOMMENDATION_OF_FILAUR, RECOMMENDATION_OF_ARIN)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case IRON_GATES_LOCKIRIN: { + if ((memoState >= 1) && !hasQuestItems(player, RECOMMENDATION_OF_BALANKI, RECOMMENDATION_OF_FILAUR, RECOMMENDATION_OF_ARIN)) { htmltext = "30531-05.html"; - } - else if (hasQuestItems(player, RECOMMENDATION_OF_BALANKI, RECOMMENDATION_OF_FILAUR, RECOMMENDATION_OF_ARIN)) - { + } else if (hasQuestItems(player, RECOMMENDATION_OF_BALANKI, RECOMMENDATION_OF_FILAUR, RECOMMENDATION_OF_ARIN)) { giveAdena(player, 372154, true); giveItems(player, MARK_OF_MAESTRO, 1); addExpAndSp(player, 2085244, 141240); @@ -287,196 +233,134 @@ public final class Q00231_TestOfTheMaestro extends Quest } break; } - case GOLDEN_WHEELS_SPIRON: - { + case GOLDEN_WHEELS_SPIRON: { htmltext = "30532-01.html"; break; } - case SILVER_SCALES_BALANKI: - { - if ((memoState == 1) && !hasQuestItems(player, RECOMMENDATION_OF_BALANKI)) - { + case SILVER_SCALES_BALANKI: { + if ((memoState == 1) && !hasQuestItems(player, RECOMMENDATION_OF_BALANKI)) { htmltext = "30533-01.html"; - } - else if (memoState == 2) - { - if (!hasQuestItems(player, LETTER_OF_SOLDER_DERACHMENT)) - { + } else if (memoState == 2) { + if (!hasQuestItems(player, LETTER_OF_SOLDER_DERACHMENT)) { htmltext = "30533-03.html"; - } - else - { + } else { giveItems(player, RECOMMENDATION_OF_BALANKI, 1); takeItems(player, LETTER_OF_SOLDER_DERACHMENT, 1); qs.setMemoState(1); - if (hasQuestItems(player, RECOMMENDATION_OF_ARIN, RECOMMENDATION_OF_FILAUR)) - { + if (hasQuestItems(player, RECOMMENDATION_OF_ARIN, RECOMMENDATION_OF_FILAUR)) { qs.setCond(2, true); } htmltext = "30533-04.html"; } - } - else if (hasQuestItems(player, RECOMMENDATION_OF_BALANKI)) - { + } else if (hasQuestItems(player, RECOMMENDATION_OF_BALANKI)) { htmltext = "30533-05.html"; } break; } - case BRONZE_KEYS_KEEF: - { + case BRONZE_KEYS_KEEF: { htmltext = "30534-01.html"; break; } - case GRAY_PILLAR_MEMBER_FILAUR: - { - if ((memoState == 1) && !hasQuestItems(player, RECOMMENDATION_OF_FILAUR)) - { + case GRAY_PILLAR_MEMBER_FILAUR: { + if ((memoState == 1) && !hasQuestItems(player, RECOMMENDATION_OF_FILAUR)) { giveItems(player, ARCHITECTURE_OF_CRUMA, 1); qs.setMemoState(4); htmltext = "30535-01.html"; - } - else if (memoState == 4) - { - if (hasQuestItems(player, ARCHITECTURE_OF_CRUMA) && !hasQuestItems(player, REPORT_OF_CRUMA)) - { + } else if (memoState == 4) { + if (hasQuestItems(player, ARCHITECTURE_OF_CRUMA) && !hasQuestItems(player, REPORT_OF_CRUMA)) { htmltext = "30535-02.html"; - } - else if (hasQuestItems(player, REPORT_OF_CRUMA) && !hasQuestItems(player, ARCHITECTURE_OF_CRUMA)) - { + } else if (hasQuestItems(player, REPORT_OF_CRUMA) && !hasQuestItems(player, ARCHITECTURE_OF_CRUMA)) { giveItems(player, RECOMMENDATION_OF_FILAUR, 1); takeItems(player, REPORT_OF_CRUMA, 1); qs.setMemoState(1); - if (hasQuestItems(player, RECOMMENDATION_OF_BALANKI, RECOMMENDATION_OF_ARIN)) - { + if (hasQuestItems(player, RECOMMENDATION_OF_BALANKI, RECOMMENDATION_OF_ARIN)) { qs.setCond(2, true); } htmltext = "30535-03.html"; } - } - else if (hasQuestItems(player, RECOMMENDATION_OF_FILAUR)) - { + } else if (hasQuestItems(player, RECOMMENDATION_OF_FILAUR)) { htmltext = "30535-04.html"; } break; } - case BLACK_ANVILS_ARIN: - { - if ((memoState == 1) && !hasQuestItems(player, RECOMMENDATION_OF_ARIN)) - { + case BLACK_ANVILS_ARIN: { + if ((memoState == 1) && !hasQuestItems(player, RECOMMENDATION_OF_ARIN)) { giveItems(player, PAINT_OF_TELEPORT_DEVICE, 1); qs.setMemoState(3); htmltext = "30536-01.html"; - } - else if (memoState == 3) - { - if (hasQuestItems(player, PAINT_OF_TELEPORT_DEVICE) && !hasQuestItems(player, TELEPORT_DEVICE)) - { + } else if (memoState == 3) { + if (hasQuestItems(player, PAINT_OF_TELEPORT_DEVICE) && !hasQuestItems(player, TELEPORT_DEVICE)) { htmltext = "30536-02.html"; - } - else if (getQuestItemsCount(player, TELEPORT_DEVICE) >= 5) - { + } else if (getQuestItemsCount(player, TELEPORT_DEVICE) >= 5) { giveItems(player, RECOMMENDATION_OF_ARIN, 1); takeItems(player, TELEPORT_DEVICE, -1); qs.setMemoState(1); - if (hasQuestItems(player, RECOMMENDATION_OF_BALANKI, RECOMMENDATION_OF_FILAUR)) - { + if (hasQuestItems(player, RECOMMENDATION_OF_BALANKI, RECOMMENDATION_OF_FILAUR)) { qs.setCond(2, true); } htmltext = "30536-03.html"; } - } - else if (hasQuestItems(player, RECOMMENDATION_OF_ARIN)) - { + } else if (hasQuestItems(player, RECOMMENDATION_OF_ARIN)) { htmltext = "30536-04.html"; } break; } - case MASTER_TOMA: - { - if (memoState == 3) - { - if (hasQuestItems(player, PAINT_OF_TELEPORT_DEVICE)) - { + case MASTER_TOMA: { + if (memoState == 3) { + if (hasQuestItems(player, PAINT_OF_TELEPORT_DEVICE)) { htmltext = "30556-01.html"; - } - else if (hasQuestItems(player, BROKEN_TELEPORT_DEVICE)) - { + } else if (hasQuestItems(player, BROKEN_TELEPORT_DEVICE)) { giveItems(player, TELEPORT_DEVICE, 5); takeItems(player, BROKEN_TELEPORT_DEVICE, 1); htmltext = "30556-06.html"; - } - else if (getQuestItemsCount(player, TELEPORT_DEVICE) == 5) - { + } else if (getQuestItemsCount(player, TELEPORT_DEVICE) == 5) { htmltext = "30556-07.html"; } } break; } - case CHIEF_CROTO: - { - if ((memoState == 2) && !hasAtLeastOneQuestItem(player, PAINT_OF_KAMURU, NECKLACE_OF_KAMUTU, LETTER_OF_SOLDER_DERACHMENT)) - { + case CHIEF_CROTO: { + if ((memoState == 2) && !hasAtLeastOneQuestItem(player, PAINT_OF_KAMURU, NECKLACE_OF_KAMUTU, LETTER_OF_SOLDER_DERACHMENT)) { htmltext = "30671-01.html"; - } - else if (hasQuestItems(player, PAINT_OF_KAMURU) && !hasQuestItems(player, NECKLACE_OF_KAMUTU)) - { + } else if (hasQuestItems(player, PAINT_OF_KAMURU) && !hasQuestItems(player, NECKLACE_OF_KAMUTU)) { htmltext = "30671-03.html"; - } - else if (hasQuestItems(player, NECKLACE_OF_KAMUTU)) - { + } else if (hasQuestItems(player, NECKLACE_OF_KAMUTU)) { giveItems(player, LETTER_OF_SOLDER_DERACHMENT, 1); takeItems(player, NECKLACE_OF_KAMUTU, 1); takeItems(player, PAINT_OF_KAMURU, 1); htmltext = "30671-04.html"; - } - else if (hasQuestItems(player, LETTER_OF_SOLDER_DERACHMENT)) - { + } else if (hasQuestItems(player, LETTER_OF_SOLDER_DERACHMENT)) { htmltext = "30671-05.html"; } break; } - case JAILER_DUBABAH: - { - if (hasQuestItems(player, PAINT_OF_KAMURU)) - { + case JAILER_DUBABAH: { + if (hasQuestItems(player, PAINT_OF_KAMURU)) { htmltext = "30672-01.html"; } break; } - case RESEARCHER_LORAIN: - { - if (memoState == 4) - { - if (hasQuestItems(player, ARCHITECTURE_OF_CRUMA) && !hasAtLeastOneQuestItem(player, INGREDIENTS_OF_ANTIDOTE, REPORT_OF_CRUMA)) - { + case RESEARCHER_LORAIN: { + if (memoState == 4) { + if (hasQuestItems(player, ARCHITECTURE_OF_CRUMA) && !hasAtLeastOneQuestItem(player, INGREDIENTS_OF_ANTIDOTE, REPORT_OF_CRUMA)) { giveItems(player, INGREDIENTS_OF_ANTIDOTE, 1); takeItems(player, ARCHITECTURE_OF_CRUMA, 1); htmltext = "30673-01.html"; - } - else if (hasQuestItems(player, INGREDIENTS_OF_ANTIDOTE) && !hasQuestItems(player, REPORT_OF_CRUMA)) - { - if ((getQuestItemsCount(player, STINGER_WASP_NEEDLE) >= 10) && (getQuestItemsCount(player, MARSH_SPIDERS_WEB) >= 10) && (getQuestItemsCount(player, BLOOD_OF_LEECH) >= 10)) - { + } else if (hasQuestItems(player, INGREDIENTS_OF_ANTIDOTE) && !hasQuestItems(player, REPORT_OF_CRUMA)) { + if ((getQuestItemsCount(player, STINGER_WASP_NEEDLE) >= 10) && (getQuestItemsCount(player, MARSH_SPIDERS_WEB) >= 10) && (getQuestItemsCount(player, BLOOD_OF_LEECH) >= 10)) { htmltext = "30673-03.html"; - } - else - { + } else { htmltext = "30673-02.html"; } - } - else if (hasQuestItems(player, REPORT_OF_CRUMA)) - { + } else if (hasQuestItems(player, REPORT_OF_CRUMA)) { htmltext = "30673-05.html"; } } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == IRON_GATES_LOCKIRIN) - { + } else if (qs.isCompleted()) { + if (npc.getId() == IRON_GATES_LOCKIRIN) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00232_TestOfTheLord/Q00232_TestOfTheLord.java b/src/main/java/com/l2jserver/datapack/quests/Q00232_TestOfTheLord/Q00232_TestOfTheLord.java index b7b29eccfb..fe3f67198d 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00232_TestOfTheLord/Q00232_TestOfTheLord.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00232_TestOfTheLord/Q00232_TestOfTheLord.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.util.Util; * Test Of The Lord (232) * @author ivantotov */ -public final class Q00232_TestOfTheLord extends Quest -{ +public final class Q00232_TestOfTheLord extends Quest { // NPCs private static final int SEER_SOMAK = 30510; private static final int SEER_MANAKIA = 30515; @@ -98,8 +97,7 @@ public final class Q00232_TestOfTheLord extends Quest // Locations private static final Location FIRST_ORC_SPAWN = new Location(21036, -107690, -3038); - public Q00232_TestOfTheLord() - { + public Q00232_TestOfTheLord() { super(232, Q00232_TestOfTheLord.class.getSimpleName(), "Test Of The Lord"); addStartNpc(FLAME_LORD_KAKAI); addTalkId(FLAME_LORD_KAKAI, SEER_SOMAK, SEER_MANAKIA, TRADER_JAKAL, BLACKSMITH_SUMARI, ATUBA_CHIEF_VARKEES, NERUGA_CHIEF_TANTUS, URUTU_CHIEF_HATOS, DUDA_MARA_CHIEF_TAKUNA, GANDI_CHIEF_CHIANTA, FIRST_ORC, ANCESTOR_MARTANKUS); @@ -108,31 +106,23 @@ public final class Q00232_TestOfTheLord extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (qs.isCreated()) - { + switch (event) { + case "ACCEPT": { + if (qs.isCreated()) { qs.startQuest(); giveItems(player, ORDEAL_NECKLACE, 1); - if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) - { + if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) { giveItems(player, DIMENSIONAL_DIAMOND, 92); player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1); htmltext = "30565-05b.htm"; - } - else - { + } else { htmltext = "30565-05.htm"; } } @@ -143,15 +133,12 @@ public final class Q00232_TestOfTheLord extends Quest case "30643-02.html": case "30643-03.html": case "30649-02.html": - case "30649-03.html": - { + case "30649-03.html": { htmltext = event; break; } - case "30565-08.html": - { - if (hasQuestItems(player, HUGE_ORC_FANG)) - { + case "30565-08.html": { + if (hasQuestItems(player, HUGE_ORC_FANG)) { takeItems(player, ORDEAL_NECKLACE, 1); takeItems(player, HUGE_ORC_FANG, 1); takeItems(player, SWORD_INTO_SKULL, 1); @@ -164,50 +151,41 @@ public final class Q00232_TestOfTheLord extends Quest } break; } - case "30558-02.html": - { - if (getQuestItemsCount(player, ADENA) >= 1000) - { + case "30558-02.html": { + if (getQuestItemsCount(player, ADENA) >= 1000) { takeItems(player, ADENA, 1000); giveItems(player, NERUGA_AXE_BLADE, 1); htmltext = event; } break; } - case "30566-02.html": - { + case "30566-02.html": { giveItems(player, VARKEES_CHARM, 1); htmltext = event; break; } - case "30567-02.html": - { + case "30567-02.html": { giveItems(player, TANTUS_CHARM, 1); htmltext = event; break; } - case "30568-02.html": - { + case "30568-02.html": { giveItems(player, HATOS_CHARM, 1); htmltext = event; break; } - case "30641-02.html": - { + case "30641-02.html": { giveItems(player, TAKUNA_CHARM, 1); htmltext = event; break; } - case "30642-02.html": - { + case "30642-02.html": { giveItems(player, CHIANTA_CHARM, 1); htmltext = event; break; } - case "30649-04.html": - { - if (hasQuestItems(player, BEAR_FANG_NECKLACE)) - { + case "30649-04.html": { + if (hasQuestItems(player, BEAR_FANG_NECKLACE)) { takeItems(player, BEAR_FANG_NECKLACE, 1); giveItems(player, MARTANKUS_CHARM, 1); qs.setCond(4, true); @@ -215,10 +193,8 @@ public final class Q00232_TestOfTheLord extends Quest } break; } - case "30649-07.html": - { - if (npc.getSummonedNpcCount() < 1) - { + case "30649-07.html": { + if (npc.getSummonedNpcCount() < 1) { addSpawn(npc, FIRST_ORC, FIRST_ORC_SPAWN, false, 10000); } htmltext = event; @@ -229,38 +205,24 @@ public final class Q00232_TestOfTheLord extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case MARSH_SPIDER: - { - if (hasQuestItems(killer, ORDEAL_NECKLACE, TAKUNA_CHARM) && !hasQuestItems(killer, HANDIWORK_SPIDER_BROOCH)) - { - if (getQuestItemsCount(killer, MARSH_SPIDER_FEELER) < 10) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case MARSH_SPIDER: { + if (hasQuestItems(killer, ORDEAL_NECKLACE, TAKUNA_CHARM) && !hasQuestItems(killer, HANDIWORK_SPIDER_BROOCH)) { + if (getQuestItemsCount(killer, MARSH_SPIDER_FEELER) < 10) { giveItems(killer, MARSH_SPIDER_FEELER, 2); - if (getQuestItemsCount(killer, MARSH_SPIDER_FEELER) >= 10) - { + if (getQuestItemsCount(killer, MARSH_SPIDER_FEELER) >= 10) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } - } - else if (getQuestItemsCount(killer, MARSH_SPIDER_FEET) < 10) - { + } else if (getQuestItemsCount(killer, MARSH_SPIDER_FEET) < 10) { giveItems(killer, MARSH_SPIDER_FEET, 2); - if (getQuestItemsCount(killer, MARSH_SPIDER_FEET) >= 10) - { + if (getQuestItemsCount(killer, MARSH_SPIDER_FEET) >= 10) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -268,38 +230,26 @@ public final class Q00232_TestOfTheLord extends Quest break; } case BREKA_ORC_SHAMAN: - case BREKA_ORC_OVERLORD: - { - if (hasQuestItems(killer, ORDEAL_NECKLACE, VARKEES_CHARM, MANAKIAS_ORDERS) && !hasAtLeastOneQuestItem(killer, HUGE_ORC_FANG, MANAKIAS_AMULET)) - { - if (getQuestItemsCount(killer, BREKA_ORC_FANG) < 20) - { + case BREKA_ORC_OVERLORD: { + if (hasQuestItems(killer, ORDEAL_NECKLACE, VARKEES_CHARM, MANAKIAS_ORDERS) && !hasAtLeastOneQuestItem(killer, HUGE_ORC_FANG, MANAKIAS_AMULET)) { + if (getQuestItemsCount(killer, BREKA_ORC_FANG) < 20) { giveItems(killer, BREKA_ORC_FANG, 2); - if (getQuestItemsCount(killer, BREKA_ORC_FANG) >= 20) - { + if (getQuestItemsCount(killer, BREKA_ORC_FANG) >= 20) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case ENCHANTED_MONSTEREYE: - { - if (hasQuestItems(killer, ORDEAL_NECKLACE, CHIANTA_CHARM) && !hasQuestItems(killer, MONSTER_EYE_WOODCARVING)) - { - if (getQuestItemsCount(killer, ENCHANTED_MONSTER_CORNEA) < 20) - { + case ENCHANTED_MONSTEREYE: { + if (hasQuestItems(killer, ORDEAL_NECKLACE, CHIANTA_CHARM) && !hasQuestItems(killer, MONSTER_EYE_WOODCARVING)) { + if (getQuestItemsCount(killer, ENCHANTED_MONSTER_CORNEA) < 20) { giveItems(killer, ENCHANTED_MONSTER_CORNEA, 1); - if (getQuestItemsCount(killer, ENCHANTED_MONSTER_CORNEA) >= 20) - { + if (getQuestItemsCount(killer, ENCHANTED_MONSTER_CORNEA) >= 20) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -311,19 +261,13 @@ public final class Q00232_TestOfTheLord extends Quest case TIMAK_ORC_SOLDIER: case TIMAK_ORC_WARRIOR: case TIMAK_ORC_SHAMAN: - case TIMAK_ORC_OVERLORD: - { - if (hasQuestItems(killer, ORDEAL_NECKLACE, HATOS_CHARM) && !hasQuestItems(killer, SWORD_INTO_SKULL)) - { - if (getQuestItemsCount(killer, TIMAK_ORC_SKULL) < 10) - { + case TIMAK_ORC_OVERLORD: { + if (hasQuestItems(killer, ORDEAL_NECKLACE, HATOS_CHARM) && !hasQuestItems(killer, SWORD_INTO_SKULL)) { + if (getQuestItemsCount(killer, TIMAK_ORC_SKULL) < 10) { giveItems(killer, TIMAK_ORC_SKULL, 1); - if (getQuestItemsCount(killer, TIMAK_ORC_SKULL) >= 10) - { + if (getQuestItemsCount(killer, TIMAK_ORC_SKULL) >= 10) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -331,17 +275,12 @@ public final class Q00232_TestOfTheLord extends Quest break; } case RAGNA_ORC_OVERLORD: - case RAGNA_ORC_SEER: - { - if (hasQuestItems(killer, MARTANKUS_CHARM)) - { - if (!hasQuestItems(killer, RAGNA_CHIEF_NOTICE)) - { + case RAGNA_ORC_SEER: { + if (hasQuestItems(killer, MARTANKUS_CHARM)) { + if (!hasQuestItems(killer, RAGNA_CHIEF_NOTICE)) { giveItems(killer, RAGNA_CHIEF_NOTICE, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else if (!hasQuestItems(killer, RAGNA_ORC_HEAD)) - { + } else if (!hasQuestItems(killer, RAGNA_ORC_HEAD)) { giveItems(killer, RAGNA_ORC_HEAD, 1); qs.setCond(5, true); } @@ -354,59 +293,35 @@ public final class Q00232_TestOfTheLord extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == FLAME_LORD_KAKAI) - { - if (player.getRace() != Race.ORC) - { + if (qs.isCreated()) { + if (npc.getId() == FLAME_LORD_KAKAI) { + if (player.getRace() != Race.ORC) { htmltext = "30565-01.html"; - } - else if (player.getClassId() != ClassId.orcShaman) - { + } else if (player.getClassId() != ClassId.orcShaman) { htmltext = "30565-02.html"; - } - else if (player.getLevel() < MIN_LEVEL) - { + } else if (player.getLevel() < MIN_LEVEL) { htmltext = "30565-03.html"; - } - else - { + } else { htmltext = "30565-04.htm"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case FLAME_LORD_KAKAI: - { - if (hasQuestItems(player, ORDEAL_NECKLACE)) - { - if (hasQuestItems(player, HUGE_ORC_FANG, SWORD_INTO_SKULL, AXE_OF_CEREMONY, MONSTER_EYE_WOODCARVING, HANDIWORK_SPIDER_BROOCH)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case FLAME_LORD_KAKAI: { + if (hasQuestItems(player, ORDEAL_NECKLACE)) { + if (hasQuestItems(player, HUGE_ORC_FANG, SWORD_INTO_SKULL, AXE_OF_CEREMONY, MONSTER_EYE_WOODCARVING, HANDIWORK_SPIDER_BROOCH)) { htmltext = "30565-07.html"; - } - else - { + } else { htmltext = "30565-06.html"; } - } - else if (hasQuestItems(player, BEAR_FANG_NECKLACE)) - { + } else if (hasQuestItems(player, BEAR_FANG_NECKLACE)) { htmltext = "30565-09.html"; - } - else if (hasQuestItems(player, MARTANKUS_CHARM)) - { + } else if (hasQuestItems(player, MARTANKUS_CHARM)) { htmltext = "30565-10.html"; - } - else if (hasQuestItems(player, IMMORTAL_FLAME)) - { + } else if (hasQuestItems(player, IMMORTAL_FLAME)) { giveAdena(player, 161806, true); giveItems(player, MARK_OF_LORD, 1); addExpAndSp(player, 894888, 61408); @@ -416,281 +331,187 @@ public final class Q00232_TestOfTheLord extends Quest } break; } - case SEER_SOMAK: - { - if (hasQuestItems(player, ORDEAL_NECKLACE, HATOS_CHARM, SUMARIS_LETTER) && !hasAtLeastOneQuestItem(player, SWORD_INTO_SKULL, URUTU_BLADE)) - { + case SEER_SOMAK: { + if (hasQuestItems(player, ORDEAL_NECKLACE, HATOS_CHARM, SUMARIS_LETTER) && !hasAtLeastOneQuestItem(player, SWORD_INTO_SKULL, URUTU_BLADE)) { takeItems(player, SUMARIS_LETTER, 1); giveItems(player, URUTU_BLADE, 1); htmltext = "30510-01.html"; - } - else if (hasQuestItems(player, ORDEAL_NECKLACE, HATOS_CHARM, URUTU_BLADE) && !hasAtLeastOneQuestItem(player, SWORD_INTO_SKULL, SUMARIS_LETTER)) - { + } else if (hasQuestItems(player, ORDEAL_NECKLACE, HATOS_CHARM, URUTU_BLADE) && !hasAtLeastOneQuestItem(player, SWORD_INTO_SKULL, SUMARIS_LETTER)) { htmltext = "30510-02.html"; - } - else if (hasQuestItems(player, ORDEAL_NECKLACE, SWORD_INTO_SKULL) && !hasAtLeastOneQuestItem(player, HATOS_CHARM, URUTU_BLADE, SUMARIS_LETTER)) - { + } else if (hasQuestItems(player, ORDEAL_NECKLACE, SWORD_INTO_SKULL) && !hasAtLeastOneQuestItem(player, HATOS_CHARM, URUTU_BLADE, SUMARIS_LETTER)) { htmltext = "30510-03.html"; } break; } - case SEER_MANAKIA: - { - if (hasQuestItems(player, ORDEAL_NECKLACE, VARKEES_CHARM) && !hasAtLeastOneQuestItem(player, HUGE_ORC_FANG, MANAKIAS_AMULET, MANAKIAS_ORDERS)) - { + case SEER_MANAKIA: { + if (hasQuestItems(player, ORDEAL_NECKLACE, VARKEES_CHARM) && !hasAtLeastOneQuestItem(player, HUGE_ORC_FANG, MANAKIAS_AMULET, MANAKIAS_ORDERS)) { giveItems(player, MANAKIAS_ORDERS, 1); htmltext = "30515-01.html"; - } - else if (hasQuestItems(player, VARKEES_CHARM, ORDEAL_NECKLACE, MANAKIAS_ORDERS) && !hasAtLeastOneQuestItem(player, HUGE_ORC_FANG, MANAKIAS_AMULET)) - { - if (getQuestItemsCount(player, BREKA_ORC_FANG) < 20) - { + } else if (hasQuestItems(player, VARKEES_CHARM, ORDEAL_NECKLACE, MANAKIAS_ORDERS) && !hasAtLeastOneQuestItem(player, HUGE_ORC_FANG, MANAKIAS_AMULET)) { + if (getQuestItemsCount(player, BREKA_ORC_FANG) < 20) { htmltext = "30515-02.html"; - } - else - { + } else { takeItems(player, MANAKIAS_ORDERS, 1); takeItems(player, BREKA_ORC_FANG, -1); giveItems(player, MANAKIAS_AMULET, 1); htmltext = "30515-03.html"; } - } - else if (hasQuestItems(player, ORDEAL_NECKLACE, VARKEES_CHARM, MANAKIAS_AMULET) && !hasAtLeastOneQuestItem(player, HUGE_ORC_FANG, MANAKIAS_ORDERS)) - { + } else if (hasQuestItems(player, ORDEAL_NECKLACE, VARKEES_CHARM, MANAKIAS_AMULET) && !hasAtLeastOneQuestItem(player, HUGE_ORC_FANG, MANAKIAS_ORDERS)) { htmltext = "30515-04.html"; - } - else if (hasQuestItems(player, ORDEAL_NECKLACE, HUGE_ORC_FANG) && !hasAtLeastOneQuestItem(player, VARKEES_CHARM, MANAKIAS_AMULET, MANAKIAS_ORDERS)) - { + } else if (hasQuestItems(player, ORDEAL_NECKLACE, HUGE_ORC_FANG) && !hasAtLeastOneQuestItem(player, VARKEES_CHARM, MANAKIAS_AMULET, MANAKIAS_ORDERS)) { htmltext = "30515-05.html"; } break; } - case TRADER_JAKAL: - { - if (hasQuestItems(player, ORDEAL_NECKLACE, TANTUS_CHARM) && !hasAtLeastOneQuestItem(player, AXE_OF_CEREMONY, NERUGA_AXE_BLADE)) - { - if (getQuestItemsCount(player, ADENA) >= 1000) - { + case TRADER_JAKAL: { + if (hasQuestItems(player, ORDEAL_NECKLACE, TANTUS_CHARM) && !hasAtLeastOneQuestItem(player, AXE_OF_CEREMONY, NERUGA_AXE_BLADE)) { + if (getQuestItemsCount(player, ADENA) >= 1000) { htmltext = "30558-01.html"; - } - else - { + } else { htmltext = "30558-03.html"; } - } - else if (hasQuestItems(player, ORDEAL_NECKLACE, TANTUS_CHARM, NERUGA_AXE_BLADE) && !hasQuestItems(player, AXE_OF_CEREMONY)) - { + } else if (hasQuestItems(player, ORDEAL_NECKLACE, TANTUS_CHARM, NERUGA_AXE_BLADE) && !hasQuestItems(player, AXE_OF_CEREMONY)) { htmltext = "30558-04.html"; - } - else if (hasQuestItems(player, ORDEAL_NECKLACE, AXE_OF_CEREMONY) && !hasQuestItems(player, TANTUS_CHARM)) - { + } else if (hasQuestItems(player, ORDEAL_NECKLACE, AXE_OF_CEREMONY) && !hasQuestItems(player, TANTUS_CHARM)) { htmltext = "30558-05.html"; } break; } - case BLACKSMITH_SUMARI: - { - if (hasQuestItems(player, HATOS_CHARM, ORDEAL_NECKLACE) && !hasAtLeastOneQuestItem(player, SWORD_INTO_SKULL, URUTU_BLADE, SUMARIS_LETTER)) - { + case BLACKSMITH_SUMARI: { + if (hasQuestItems(player, HATOS_CHARM, ORDEAL_NECKLACE) && !hasAtLeastOneQuestItem(player, SWORD_INTO_SKULL, URUTU_BLADE, SUMARIS_LETTER)) { giveItems(player, SUMARIS_LETTER, 1); htmltext = "30564-01.html"; - } - else if (hasQuestItems(player, ORDEAL_NECKLACE, HATOS_CHARM, SUMARIS_LETTER) && !hasAtLeastOneQuestItem(player, SWORD_INTO_SKULL, URUTU_BLADE)) - { + } else if (hasQuestItems(player, ORDEAL_NECKLACE, HATOS_CHARM, SUMARIS_LETTER) && !hasAtLeastOneQuestItem(player, SWORD_INTO_SKULL, URUTU_BLADE)) { htmltext = "30564-02.html"; - } - else if (hasQuestItems(player, ORDEAL_NECKLACE, HATOS_CHARM, URUTU_BLADE) && !hasAtLeastOneQuestItem(player, SUMARIS_LETTER, SWORD_INTO_SKULL)) - { + } else if (hasQuestItems(player, ORDEAL_NECKLACE, HATOS_CHARM, URUTU_BLADE) && !hasAtLeastOneQuestItem(player, SUMARIS_LETTER, SWORD_INTO_SKULL)) { htmltext = "30564-03.html"; - } - else if (hasQuestItems(player, ORDEAL_NECKLACE, SWORD_INTO_SKULL) && !hasAtLeastOneQuestItem(player, HATOS_CHARM, URUTU_BLADE, SUMARIS_LETTER)) - { + } else if (hasQuestItems(player, ORDEAL_NECKLACE, SWORD_INTO_SKULL) && !hasAtLeastOneQuestItem(player, HATOS_CHARM, URUTU_BLADE, SUMARIS_LETTER)) { htmltext = "30564-04.html"; } break; } - case ATUBA_CHIEF_VARKEES: - { - if (hasQuestItems(player, ORDEAL_NECKLACE) && !hasAtLeastOneQuestItem(player, HUGE_ORC_FANG, VARKEES_CHARM)) - { + case ATUBA_CHIEF_VARKEES: { + if (hasQuestItems(player, ORDEAL_NECKLACE) && !hasAtLeastOneQuestItem(player, HUGE_ORC_FANG, VARKEES_CHARM)) { htmltext = "30566-01.html"; - } - else if (hasQuestItems(player, ORDEAL_NECKLACE, VARKEES_CHARM) && !hasAtLeastOneQuestItem(player, HUGE_ORC_FANG, MANAKIAS_AMULET)) - { + } else if (hasQuestItems(player, ORDEAL_NECKLACE, VARKEES_CHARM) && !hasAtLeastOneQuestItem(player, HUGE_ORC_FANG, MANAKIAS_AMULET)) { htmltext = "30566-03.html"; - } - else if (hasQuestItems(player, ORDEAL_NECKLACE, VARKEES_CHARM, MANAKIAS_AMULET) && !hasQuestItems(player, HUGE_ORC_FANG)) - { + } else if (hasQuestItems(player, ORDEAL_NECKLACE, VARKEES_CHARM, MANAKIAS_AMULET) && !hasQuestItems(player, HUGE_ORC_FANG)) { takeItems(player, VARKEES_CHARM, 1); takeItems(player, MANAKIAS_AMULET, 1); giveItems(player, HUGE_ORC_FANG, 1); - if (hasQuestItems(player, AXE_OF_CEREMONY, SWORD_INTO_SKULL, HANDIWORK_SPIDER_BROOCH, MONSTER_EYE_WOODCARVING)) - { + if (hasQuestItems(player, AXE_OF_CEREMONY, SWORD_INTO_SKULL, HANDIWORK_SPIDER_BROOCH, MONSTER_EYE_WOODCARVING)) { qs.setCond(2, true); } htmltext = "30566-04.html"; - } - else if (hasQuestItems(player, ORDEAL_NECKLACE, HUGE_ORC_FANG) && !hasQuestItems(player, VARKEES_CHARM)) - { + } else if (hasQuestItems(player, ORDEAL_NECKLACE, HUGE_ORC_FANG) && !hasQuestItems(player, VARKEES_CHARM)) { htmltext = "30566-05.html"; } break; } - case NERUGA_CHIEF_TANTUS: - { - if (hasQuestItems(player, ORDEAL_NECKLACE) && !hasAtLeastOneQuestItem(player, AXE_OF_CEREMONY, TANTUS_CHARM)) - { + case NERUGA_CHIEF_TANTUS: { + if (hasQuestItems(player, ORDEAL_NECKLACE) && !hasAtLeastOneQuestItem(player, AXE_OF_CEREMONY, TANTUS_CHARM)) { htmltext = "30567-01.html"; - } - else if (hasQuestItems(player, ORDEAL_NECKLACE, TANTUS_CHARM) && !hasQuestItems(player, AXE_OF_CEREMONY)) - { - if (!hasQuestItems(player, NERUGA_AXE_BLADE) || (getQuestItemsCount(player, BONE_ARROW) < 1000)) - { + } else if (hasQuestItems(player, ORDEAL_NECKLACE, TANTUS_CHARM) && !hasQuestItems(player, AXE_OF_CEREMONY)) { + if (!hasQuestItems(player, NERUGA_AXE_BLADE) || (getQuestItemsCount(player, BONE_ARROW) < 1000)) { htmltext = "30567-03.html"; - } - else - { + } else { takeItems(player, BONE_ARROW, 1000); takeItems(player, TANTUS_CHARM, 1); takeItems(player, NERUGA_AXE_BLADE, 1); giveItems(player, AXE_OF_CEREMONY, 1); - if (hasQuestItems(player, HUGE_ORC_FANG, SWORD_INTO_SKULL, HANDIWORK_SPIDER_BROOCH, MONSTER_EYE_WOODCARVING)) - { + if (hasQuestItems(player, HUGE_ORC_FANG, SWORD_INTO_SKULL, HANDIWORK_SPIDER_BROOCH, MONSTER_EYE_WOODCARVING)) { qs.setCond(2, true); } htmltext = "30567-04.html"; } - } - else if (hasQuestItems(player, ORDEAL_NECKLACE, AXE_OF_CEREMONY) && !hasQuestItems(player, TANTUS_CHARM)) - { + } else if (hasQuestItems(player, ORDEAL_NECKLACE, AXE_OF_CEREMONY) && !hasQuestItems(player, TANTUS_CHARM)) { htmltext = "30567-05.html"; } break; } - case URUTU_CHIEF_HATOS: - { - if (hasQuestItems(player, ORDEAL_NECKLACE) && !hasAtLeastOneQuestItem(player, SWORD_INTO_SKULL, HATOS_CHARM)) - { + case URUTU_CHIEF_HATOS: { + if (hasQuestItems(player, ORDEAL_NECKLACE) && !hasAtLeastOneQuestItem(player, SWORD_INTO_SKULL, HATOS_CHARM)) { htmltext = "30568-01.html"; - } - else if (hasQuestItems(player, ORDEAL_NECKLACE, HATOS_CHARM) && !hasQuestItems(player, SWORD_INTO_SKULL)) - { - if (hasQuestItems(player, URUTU_BLADE) && (getQuestItemsCount(player, TIMAK_ORC_SKULL) >= 10)) - { + } else if (hasQuestItems(player, ORDEAL_NECKLACE, HATOS_CHARM) && !hasQuestItems(player, SWORD_INTO_SKULL)) { + if (hasQuestItems(player, URUTU_BLADE) && (getQuestItemsCount(player, TIMAK_ORC_SKULL) >= 10)) { takeItems(player, HATOS_CHARM, 1); takeItems(player, URUTU_BLADE, 1); takeItems(player, TIMAK_ORC_SKULL, -1); giveItems(player, SWORD_INTO_SKULL, 1); - if (hasQuestItems(player, HUGE_ORC_FANG, AXE_OF_CEREMONY, HANDIWORK_SPIDER_BROOCH, MONSTER_EYE_WOODCARVING)) - { + if (hasQuestItems(player, HUGE_ORC_FANG, AXE_OF_CEREMONY, HANDIWORK_SPIDER_BROOCH, MONSTER_EYE_WOODCARVING)) { qs.setCond(2, true); } htmltext = "30568-04.html"; - } - else - { + } else { htmltext = "30568-03.html"; } - } - else if (hasQuestItems(player, ORDEAL_NECKLACE, SWORD_INTO_SKULL) && !hasQuestItems(player, HATOS_CHARM)) - { + } else if (hasQuestItems(player, ORDEAL_NECKLACE, SWORD_INTO_SKULL) && !hasQuestItems(player, HATOS_CHARM)) { htmltext = "30568-05.html"; } break; } - case DUDA_MARA_CHIEF_TAKUNA: - { - if (hasQuestItems(player, ORDEAL_NECKLACE) && !hasAtLeastOneQuestItem(player, HANDIWORK_SPIDER_BROOCH, TAKUNA_CHARM)) - { + case DUDA_MARA_CHIEF_TAKUNA: { + if (hasQuestItems(player, ORDEAL_NECKLACE) && !hasAtLeastOneQuestItem(player, HANDIWORK_SPIDER_BROOCH, TAKUNA_CHARM)) { htmltext = "30641-01.html"; - } - else if (hasQuestItems(player, ORDEAL_NECKLACE, TAKUNA_CHARM) && !hasQuestItems(player, HANDIWORK_SPIDER_BROOCH)) - { - if ((getQuestItemsCount(player, MARSH_SPIDER_FEELER) >= 10) && (getQuestItemsCount(player, MARSH_SPIDER_FEET) >= 10)) - { + } else if (hasQuestItems(player, ORDEAL_NECKLACE, TAKUNA_CHARM) && !hasQuestItems(player, HANDIWORK_SPIDER_BROOCH)) { + if ((getQuestItemsCount(player, MARSH_SPIDER_FEELER) >= 10) && (getQuestItemsCount(player, MARSH_SPIDER_FEET) >= 10)) { takeItems(player, TAKUNA_CHARM, 1); takeItems(player, MARSH_SPIDER_FEELER, -1); takeItems(player, MARSH_SPIDER_FEET, -1); giveItems(player, HANDIWORK_SPIDER_BROOCH, 1); - if (hasQuestItems(player, HUGE_ORC_FANG, AXE_OF_CEREMONY, SWORD_INTO_SKULL, MONSTER_EYE_WOODCARVING)) - { + if (hasQuestItems(player, HUGE_ORC_FANG, AXE_OF_CEREMONY, SWORD_INTO_SKULL, MONSTER_EYE_WOODCARVING)) { qs.setCond(2, true); } htmltext = "30641-04.html"; - } - else - { + } else { htmltext = "30641-03.html"; } - } - else if (hasQuestItems(player, ORDEAL_NECKLACE, HANDIWORK_SPIDER_BROOCH) && !hasQuestItems(player, TAKUNA_CHARM)) - { + } else if (hasQuestItems(player, ORDEAL_NECKLACE, HANDIWORK_SPIDER_BROOCH) && !hasQuestItems(player, TAKUNA_CHARM)) { htmltext = "30641-05.html"; } break; } - case GANDI_CHIEF_CHIANTA: - { - if (hasQuestItems(player, ORDEAL_NECKLACE) && !hasAtLeastOneQuestItem(player, MONSTER_EYE_WOODCARVING, CHIANTA_CHARM)) - { + case GANDI_CHIEF_CHIANTA: { + if (hasQuestItems(player, ORDEAL_NECKLACE) && !hasAtLeastOneQuestItem(player, MONSTER_EYE_WOODCARVING, CHIANTA_CHARM)) { htmltext = "30642-01.html"; - } - else if (hasQuestItems(player, ORDEAL_NECKLACE, CHIANTA_CHARM) && !hasQuestItems(player, MONSTER_EYE_WOODCARVING)) - { - if (getQuestItemsCount(player, ENCHANTED_MONSTER_CORNEA) < 20) - { + } else if (hasQuestItems(player, ORDEAL_NECKLACE, CHIANTA_CHARM) && !hasQuestItems(player, MONSTER_EYE_WOODCARVING)) { + if (getQuestItemsCount(player, ENCHANTED_MONSTER_CORNEA) < 20) { htmltext = "30642-03.html"; - } - else - { + } else { takeItems(player, CHIANTA_CHARM, 1); takeItems(player, ENCHANTED_MONSTER_CORNEA, -1); giveItems(player, MONSTER_EYE_WOODCARVING, 1); - if (hasQuestItems(player, HUGE_ORC_FANG, AXE_OF_CEREMONY, SWORD_INTO_SKULL, HANDIWORK_SPIDER_BROOCH)) - { + if (hasQuestItems(player, HUGE_ORC_FANG, AXE_OF_CEREMONY, SWORD_INTO_SKULL, HANDIWORK_SPIDER_BROOCH)) { qs.setCond(2, true); } htmltext = "30642-04.html"; } - } - else if (hasQuestItems(player, ORDEAL_NECKLACE, MONSTER_EYE_WOODCARVING) && !hasQuestItems(player, CHIANTA_CHARM)) - { + } else if (hasQuestItems(player, ORDEAL_NECKLACE, MONSTER_EYE_WOODCARVING) && !hasQuestItems(player, CHIANTA_CHARM)) { htmltext = "30642-05.html"; } break; } - case FIRST_ORC: - { - if (hasAtLeastOneQuestItem(player, MARTANKUS_CHARM, IMMORTAL_FLAME)) - { + case FIRST_ORC: { + if (hasAtLeastOneQuestItem(player, MARTANKUS_CHARM, IMMORTAL_FLAME)) { qs.setCond(7, true); htmltext = "30643-01.html"; } break; } - case ANCESTOR_MARTANKUS: - { - if (hasQuestItems(player, BEAR_FANG_NECKLACE)) - { + case ANCESTOR_MARTANKUS: { + if (hasQuestItems(player, BEAR_FANG_NECKLACE)) { htmltext = "30649-01.html"; - } - else if (hasQuestItems(player, MARTANKUS_CHARM) && !hasAtLeastOneQuestItem(player, RAGNA_CHIEF_NOTICE, RAGNA_ORC_HEAD)) - { + } else if (hasQuestItems(player, MARTANKUS_CHARM) && !hasAtLeastOneQuestItem(player, RAGNA_CHIEF_NOTICE, RAGNA_ORC_HEAD)) { htmltext = "30649-05.html"; - } - else if (hasQuestItems(player, MARTANKUS_CHARM, RAGNA_CHIEF_NOTICE, RAGNA_ORC_HEAD)) - { + } else if (hasQuestItems(player, MARTANKUS_CHARM, RAGNA_CHIEF_NOTICE, RAGNA_ORC_HEAD)) { takeItems(player, MARTANKUS_CHARM, 1); takeItems(player, RAGNA_ORC_HEAD, 1); takeItems(player, RAGNA_CHIEF_NOTICE, 1); giveItems(player, IMMORTAL_FLAME, 1); qs.setCond(6, true); htmltext = "30649-06.html"; - } - else if (hasQuestItems(player, IMMORTAL_FLAME)) - { - if (npc.getSummonedNpcCount() < 1) - { + } else if (hasQuestItems(player, IMMORTAL_FLAME)) { + if (npc.getSummonedNpcCount() < 1) { addSpawn(npc, FIRST_ORC, FIRST_ORC_SPAWN, false, 10000); } htmltext = "30649-08.html"; @@ -698,11 +519,8 @@ public final class Q00232_TestOfTheLord extends Quest break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == FLAME_LORD_KAKAI) - { + } else if (qs.isCompleted()) { + if (npc.getId() == FLAME_LORD_KAKAI) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00233_TestOfTheWarSpirit/Q00233_TestOfTheWarSpirit.java b/src/main/java/com/l2jserver/datapack/quests/Q00233_TestOfTheWarSpirit/Q00233_TestOfTheWarSpirit.java index fbabdeef56..9bb6b36eb7 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00233_TestOfTheWarSpirit/Q00233_TestOfTheWarSpirit.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00233_TestOfTheWarSpirit/Q00233_TestOfTheWarSpirit.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.util.Util; * Test Of The War Spirit (233) * @author ivantotov */ -public final class Q00233_TestOfTheWarSpirit extends Quest -{ +public final class Q00233_TestOfTheWarSpirit extends Quest { // NPCs private static final int PRIESTESS_VIVYAN = 30030; private static final int TRADER_SARIEN = 30436; @@ -98,8 +97,7 @@ public final class Q00233_TestOfTheWarSpirit extends Quest // Misc private static final int MIN_LEVEL = 39; - public Q00233_TestOfTheWarSpirit() - { + public Q00233_TestOfTheWarSpirit() { super(233, Q00233_TestOfTheWarSpirit.class.getSimpleName(), "Test Of The War Spirit"); addStartNpc(SEER_SOMAK); addTalkId(SEER_SOMAK, PRIESTESS_VIVYAN, TRADER_SARIEN, SEER_RACOY, SEER_MANAKIA, SHADOW_ORIM, ANCESTOR_MARTANKUS, SEER_PEKIRON); @@ -108,30 +106,22 @@ public final class Q00233_TestOfTheWarSpirit extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (qs.isCreated()) - { + switch (event) { + case "ACCEPT": { + if (qs.isCreated()) { qs.startQuest(); - if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) - { + if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) { giveItems(player, DIMENSIONAL_DIAMOND, 92); player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1); htmltext = "30510-05e.htm"; - } - else - { + } else { htmltext = "30510-05.htm"; } } @@ -146,39 +136,32 @@ public final class Q00233_TestOfTheWarSpirit extends Quest case "30030-03.html": case "30630-02.html": case "30630-03.html": - case "30649-02.html": - { + case "30649-02.html": { htmltext = event; break; } - case "30030-04.html": - { + case "30030-04.html": { giveItems(player, VIVIANTES_LETTER, 1); htmltext = event; break; } - case "30507-02.html": - { + case "30507-02.html": { giveItems(player, RACOYS_TOTEM, 1); htmltext = event; break; } - case "30515-02.html": - { + case "30515-02.html": { giveItems(player, MANAKIAS_TOTEM, 1); htmltext = event; break; } - case "30630-04.html": - { + case "30630-04.html": { giveItems(player, ORIMS_CONTRACT, 1); htmltext = event; break; } - case "30649-03.html": - { - if (hasQuestItems(player, TONARS_REMAINS2)) - { + case "30649-03.html": { + if (hasQuestItems(player, TONARS_REMAINS2)) { giveAdena(player, 161806, true); giveItems(player, MARK_OF_WARSPIRIT, 1); addExpAndSp(player, 894888, 61408); @@ -188,8 +171,7 @@ public final class Q00233_TestOfTheWarSpirit extends Quest } break; } - case "30682-02.html": - { + case "30682-02.html": { giveItems(player, PEKIRONS_TOTEM, 1); htmltext = event; break; @@ -199,49 +181,32 @@ public final class Q00233_TestOfTheWarSpirit extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { case NOBLE_ANT: - case NOBLE_ANT_LEADER: - { - if (hasQuestItems(killer, RACOYS_TOTEM, INSECT_DIAGRAM_BOOK)) - { + case NOBLE_ANT_LEADER: { + if (hasQuestItems(killer, RACOYS_TOTEM, INSECT_DIAGRAM_BOOK)) { final int i0 = getRandom(100); - if (i0 > 65) - { - if (!hasQuestItems(killer, KIRUNAS_THIGH_BONE)) - { + if (i0 > 65) { + if (!hasQuestItems(killer, KIRUNAS_THIGH_BONE)) { giveItems(killer, KIRUNAS_THIGH_BONE, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else if (!hasQuestItems(killer, KIRUNAS_ARM_BONE)) - { + } else if (!hasQuestItems(killer, KIRUNAS_ARM_BONE)) { giveItems(killer, KIRUNAS_ARM_BONE, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); } - } - else if (i0 > 30) - { - if (!hasQuestItems(killer, KIRUNAS_SPINE)) - { + } else if (i0 > 30) { + if (!hasQuestItems(killer, KIRUNAS_SPINE)) { giveItems(killer, KIRUNAS_SPINE, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else if (!hasQuestItems(killer, KIRUNAS_RIB_BONE)) - { + } else if (!hasQuestItems(killer, KIRUNAS_RIB_BONE)) { giveItems(killer, KIRUNAS_RIB_BONE, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); } - } - else if (i0 > 0) - { - if (!hasQuestItems(killer, KIRUNAS_SKULL)) - { + } else if (i0 > 0) { + if (!hasQuestItems(killer, KIRUNAS_SKULL)) { giveItems(killer, KIRUNAS_SKULL, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); } @@ -249,84 +214,58 @@ public final class Q00233_TestOfTheWarSpirit extends Quest } break; } - case MEDUSA: - { - if (hasQuestItems(killer, MANAKIAS_TOTEM)) - { - if (!hasQuestItems(killer, HERMODTS_RIB_BONE)) - { + case MEDUSA: { + if (hasQuestItems(killer, MANAKIAS_TOTEM)) { + if (!hasQuestItems(killer, HERMODTS_RIB_BONE)) { giveItems(killer, HERMODTS_RIB_BONE, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else if (!hasQuestItems(killer, HERMODTS_SPINE)) - { + } else if (!hasQuestItems(killer, HERMODTS_SPINE)) { giveItems(killer, HERMODTS_SPINE, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else if (!hasQuestItems(killer, HERMODTS_ARM_BONE)) - { + } else if (!hasQuestItems(killer, HERMODTS_ARM_BONE)) { giveItems(killer, HERMODTS_ARM_BONE, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else if (!hasQuestItems(killer, HERMODTS_THIGH_BONE)) - { + } else if (!hasQuestItems(killer, HERMODTS_THIGH_BONE)) { giveItems(killer, HERMODTS_THIGH_BONE, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); } } break; } - case PORTA: - { - if (hasQuestItems(killer, ORIMS_CONTRACT)) - { + case PORTA: { + if (hasQuestItems(killer, ORIMS_CONTRACT)) { giveItemRandomly(killer, npc, PORTAS_EYE, 2, 10, 1.0, true); } break; } - case EXCURO: - { - if (hasQuestItems(killer, ORIMS_CONTRACT)) - { + case EXCURO: { + if (hasQuestItems(killer, ORIMS_CONTRACT)) { giveItemRandomly(killer, npc, EXCUROS_SCALE, 5, 10, 1.0, true); } break; } - case MORDERO: - { - if (hasQuestItems(killer, ORIMS_CONTRACT)) - { + case MORDERO: { + if (hasQuestItems(killer, ORIMS_CONTRACT)) { giveItemRandomly(killer, npc, MORDEOS_TALON, 5, 10, 1.0, true); } break; } case LETO_LIZARDMAN_SHAMAN: - case LETO_LIZARDMAN_OVERLORD: - { - if (hasQuestItems(killer, PEKIRONS_TOTEM)) - { - if (!hasQuestItems(killer, TONARS_SKULL)) - { + case LETO_LIZARDMAN_OVERLORD: { + if (hasQuestItems(killer, PEKIRONS_TOTEM)) { + if (!hasQuestItems(killer, TONARS_SKULL)) { giveItems(killer, TONARS_SKULL, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else if (!hasQuestItems(killer, TONARS_RIB_BONE)) - { + } else if (!hasQuestItems(killer, TONARS_RIB_BONE)) { giveItems(killer, TONARS_RIB_BONE, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else if (!hasQuestItems(killer, TONARS_SPINE)) - { + } else if (!hasQuestItems(killer, TONARS_SPINE)) { giveItems(killer, TONARS_SPINE, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else if (!hasQuestItems(killer, TONARS_ARM_BONE)) - { + } else if (!hasQuestItems(killer, TONARS_ARM_BONE)) { giveItems(killer, TONARS_ARM_BONE, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else if (!hasQuestItems(killer, TONARS_THIGH_BONE)) - { + } else if (!hasQuestItems(killer, TONARS_THIGH_BONE)) { giveItems(killer, TONARS_THIGH_BONE, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); } @@ -334,21 +273,16 @@ public final class Q00233_TestOfTheWarSpirit extends Quest break; } case TAMLIN_ORC: - case TAMLIN_ORC_ARCHER: - { - if (hasQuestItems(killer, VENDETTA_TOTEM)) - { - if (giveItemRandomly(killer, npc, TAMLIN_ORC_HEAD, 1, 13, 1.0, true)) - { + case TAMLIN_ORC_ARCHER: { + if (hasQuestItems(killer, VENDETTA_TOTEM)) { + if (giveItemRandomly(killer, npc, TAMLIN_ORC_HEAD, 1, 13, 1.0, true)) { qs.setCond(4, true); } } break; } - case STENOA_GORGON_QUEEN: - { - if (hasQuestItems(killer, MANAKIAS_TOTEM) && !hasQuestItems(killer, HERMODTS_SKULL)) - { + case STENOA_GORGON_QUEEN: { + if (hasQuestItems(killer, MANAKIAS_TOTEM) && !hasQuestItems(killer, HERMODTS_SKULL)) { giveItems(killer, HERMODTS_SKULL, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); } @@ -360,48 +294,30 @@ public final class Q00233_TestOfTheWarSpirit extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == SEER_SOMAK) - { - if (player.getRace() == Race.ORC) - { - if (player.getClassId() == ClassId.orcShaman) - { - if (player.getLevel() < MIN_LEVEL) - { + if (qs.isCreated()) { + if (npc.getId() == SEER_SOMAK) { + if (player.getRace() == Race.ORC) { + if (player.getClassId() == ClassId.orcShaman) { + if (player.getLevel() < MIN_LEVEL) { htmltext = "30510-03.html"; - } - else - { + } else { htmltext = "30510-04.htm"; } - } - else - { + } else { htmltext = "30510-02.html"; } - } - else - { + } else { htmltext = "30510-01.html"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case SEER_SOMAK: - { - if (!hasAtLeastOneQuestItem(player, VENDETTA_TOTEM, WARSPIRIT_TOTEM)) - { - if (hasQuestItems(player, BRAKIS_REMAINS1, HERMODTS_REMAINS1, KIRUNAS_REMAINS1, TONARS_REMAINS1)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case SEER_SOMAK: { + if (!hasAtLeastOneQuestItem(player, VENDETTA_TOTEM, WARSPIRIT_TOTEM)) { + if (hasQuestItems(player, BRAKIS_REMAINS1, HERMODTS_REMAINS1, KIRUNAS_REMAINS1, TONARS_REMAINS1)) { giveItems(player, VENDETTA_TOTEM, 1); takeItems(player, BRAKIS_REMAINS1, 1); takeItems(player, TONARS_REMAINS1, 1); @@ -409,20 +325,13 @@ public final class Q00233_TestOfTheWarSpirit extends Quest takeItems(player, KIRUNAS_REMAINS1, 1); qs.setCond(3); htmltext = "30510-07.html"; - } - else - { + } else { htmltext = "30510-06.html"; } - } - else if (hasQuestItems(player, VENDETTA_TOTEM)) - { - if (getQuestItemsCount(player, TAMLIN_ORC_HEAD) < 13) - { + } else if (hasQuestItems(player, VENDETTA_TOTEM)) { + if (getQuestItemsCount(player, TAMLIN_ORC_HEAD) < 13) { htmltext = "30510-08.html"; - } - else - { + } else { takeItems(player, VENDETTA_TOTEM, 1); giveItems(player, WARSPIRIT_TOTEM, 1); giveItems(player, BRAKIS_REMAINS2, 1); @@ -432,69 +341,44 @@ public final class Q00233_TestOfTheWarSpirit extends Quest qs.setCond(5); htmltext = "30510-09.html"; } - } - else if (hasQuestItems(player, WARSPIRIT_TOTEM)) - { + } else if (hasQuestItems(player, WARSPIRIT_TOTEM)) { htmltext = "30510-10.html"; } break; } - case PRIESTESS_VIVYAN: - { - if (hasQuestItems(player, RACOYS_TOTEM) && !hasAtLeastOneQuestItem(player, VIVIANTES_LETTER, INSECT_DIAGRAM_BOOK)) - { + case PRIESTESS_VIVYAN: { + if (hasQuestItems(player, RACOYS_TOTEM) && !hasAtLeastOneQuestItem(player, VIVIANTES_LETTER, INSECT_DIAGRAM_BOOK)) { htmltext = "30030-01.html"; - } - else if (hasQuestItems(player, RACOYS_TOTEM, VIVIANTES_LETTER) && !hasQuestItems(player, INSECT_DIAGRAM_BOOK)) - { + } else if (hasQuestItems(player, RACOYS_TOTEM, VIVIANTES_LETTER) && !hasQuestItems(player, INSECT_DIAGRAM_BOOK)) { htmltext = "30030-05.html"; - } - else if (hasQuestItems(player, RACOYS_TOTEM, INSECT_DIAGRAM_BOOK) && !hasQuestItems(player, VIVIANTES_LETTER)) - { + } else if (hasQuestItems(player, RACOYS_TOTEM, INSECT_DIAGRAM_BOOK) && !hasQuestItems(player, VIVIANTES_LETTER)) { htmltext = "30030-06.html"; - } - else if (!hasQuestItems(player, RACOYS_TOTEM) && hasAtLeastOneQuestItem(player, KIRUNAS_REMAINS1, KIRUNAS_REMAINS2, VENDETTA_TOTEM)) - { + } else if (!hasQuestItems(player, RACOYS_TOTEM) && hasAtLeastOneQuestItem(player, KIRUNAS_REMAINS1, KIRUNAS_REMAINS2, VENDETTA_TOTEM)) { htmltext = "30030-07.html"; } break; } - case TRADER_SARIEN: - { - if (hasQuestItems(player, RACOYS_TOTEM, VIVIANTES_LETTER) && !hasQuestItems(player, INSECT_DIAGRAM_BOOK)) - { + case TRADER_SARIEN: { + if (hasQuestItems(player, RACOYS_TOTEM, VIVIANTES_LETTER) && !hasQuestItems(player, INSECT_DIAGRAM_BOOK)) { takeItems(player, VIVIANTES_LETTER, 1); giveItems(player, INSECT_DIAGRAM_BOOK, 1); htmltext = "30436-01.html"; - } - else if (hasQuestItems(player, RACOYS_TOTEM, INSECT_DIAGRAM_BOOK) && !hasQuestItems(player, VIVIANTES_LETTER)) - { + } else if (hasQuestItems(player, RACOYS_TOTEM, INSECT_DIAGRAM_BOOK) && !hasQuestItems(player, VIVIANTES_LETTER)) { htmltext = "30436-02.html"; - } - else if (!hasQuestItems(player, RACOYS_TOTEM) && hasAtLeastOneQuestItem(player, KIRUNAS_REMAINS1, KIRUNAS_REMAINS2, VENDETTA_TOTEM)) - { + } else if (!hasQuestItems(player, RACOYS_TOTEM) && hasAtLeastOneQuestItem(player, KIRUNAS_REMAINS1, KIRUNAS_REMAINS2, VENDETTA_TOTEM)) { htmltext = "30436-03.html"; } break; } - case SEER_RACOY: - { - if (!hasAtLeastOneQuestItem(player, RACOYS_TOTEM, KIRUNAS_REMAINS1, KIRUNAS_REMAINS2, VENDETTA_TOTEM)) - { + case SEER_RACOY: { + if (!hasAtLeastOneQuestItem(player, RACOYS_TOTEM, KIRUNAS_REMAINS1, KIRUNAS_REMAINS2, VENDETTA_TOTEM)) { htmltext = "30507-01.html"; - } - else if (hasQuestItems(player, RACOYS_TOTEM) && !hasAtLeastOneQuestItem(player, VIVIANTES_LETTER, INSECT_DIAGRAM_BOOK)) - { + } else if (hasQuestItems(player, RACOYS_TOTEM) && !hasAtLeastOneQuestItem(player, VIVIANTES_LETTER, INSECT_DIAGRAM_BOOK)) { htmltext = "30507-03.html"; - } - else if (hasQuestItems(player, RACOYS_TOTEM, VIVIANTES_LETTER) && !hasQuestItems(player, INSECT_DIAGRAM_BOOK)) - { + } else if (hasQuestItems(player, RACOYS_TOTEM, VIVIANTES_LETTER) && !hasQuestItems(player, INSECT_DIAGRAM_BOOK)) { htmltext = "30507-04.html"; - } - else if (hasQuestItems(player, RACOYS_TOTEM, INSECT_DIAGRAM_BOOK) && !hasQuestItems(player, VIVIANTES_LETTER)) - { - if (hasQuestItems(player, KIRUNAS_SKULL, KIRUNAS_RIB_BONE, KIRUNAS_SPINE, KIRUNAS_ARM_BONE, KIRUNAS_THIGH_BONE)) - { + } else if (hasQuestItems(player, RACOYS_TOTEM, INSECT_DIAGRAM_BOOK) && !hasQuestItems(player, VIVIANTES_LETTER)) { + if (hasQuestItems(player, KIRUNAS_SKULL, KIRUNAS_RIB_BONE, KIRUNAS_SPINE, KIRUNAS_ARM_BONE, KIRUNAS_THIGH_BONE)) { takeItems(player, RACOYS_TOTEM, 1); takeItems(player, INSECT_DIAGRAM_BOOK, 1); takeItems(player, KIRUNAS_SKULL, 1); @@ -503,33 +387,23 @@ public final class Q00233_TestOfTheWarSpirit extends Quest takeItems(player, KIRUNAS_ARM_BONE, 1); takeItems(player, KIRUNAS_THIGH_BONE, 1); giveItems(player, KIRUNAS_REMAINS1, 1); - if (hasQuestItems(player, BRAKIS_REMAINS1, HERMODTS_REMAINS1, TONARS_REMAINS1)) - { + if (hasQuestItems(player, BRAKIS_REMAINS1, HERMODTS_REMAINS1, TONARS_REMAINS1)) { qs.setCond(2); } htmltext = "30507-06.html"; - } - else - { + } else { htmltext = "30507-05.html"; } - } - else if (!hasQuestItems(player, RACOYS_TOTEM) && hasAtLeastOneQuestItem(player, KIRUNAS_REMAINS1, KIRUNAS_REMAINS2, VENDETTA_TOTEM)) - { + } else if (!hasQuestItems(player, RACOYS_TOTEM) && hasAtLeastOneQuestItem(player, KIRUNAS_REMAINS1, KIRUNAS_REMAINS2, VENDETTA_TOTEM)) { htmltext = "30507-07.html"; } break; } - case SEER_MANAKIA: - { - if (!hasAtLeastOneQuestItem(player, MANAKIAS_TOTEM, HERMODTS_REMAINS2, VENDETTA_TOTEM, HERMODTS_REMAINS1)) - { + case SEER_MANAKIA: { + if (!hasAtLeastOneQuestItem(player, MANAKIAS_TOTEM, HERMODTS_REMAINS2, VENDETTA_TOTEM, HERMODTS_REMAINS1)) { htmltext = "30515-01.html"; - } - else if (hasQuestItems(player, MANAKIAS_TOTEM)) - { - if (hasQuestItems(player, HERMODTS_SKULL, HERMODTS_RIB_BONE, HERMODTS_SPINE, HERMODTS_ARM_BONE, HERMODTS_THIGH_BONE)) - { + } else if (hasQuestItems(player, MANAKIAS_TOTEM)) { + if (hasQuestItems(player, HERMODTS_SKULL, HERMODTS_RIB_BONE, HERMODTS_SPINE, HERMODTS_ARM_BONE, HERMODTS_THIGH_BONE)) { takeItems(player, MANAKIAS_TOTEM, 1); takeItems(player, HERMODTS_SKULL, 1); takeItems(player, HERMODTS_RIB_BONE, 1); @@ -537,73 +411,51 @@ public final class Q00233_TestOfTheWarSpirit extends Quest takeItems(player, HERMODTS_ARM_BONE, 1); takeItems(player, HERMODTS_THIGH_BONE, 1); giveItems(player, HERMODTS_REMAINS1, 1); - if (hasQuestItems(player, BRAKIS_REMAINS1, KIRUNAS_REMAINS1, TONARS_REMAINS1)) - { + if (hasQuestItems(player, BRAKIS_REMAINS1, KIRUNAS_REMAINS1, TONARS_REMAINS1)) { qs.setCond(2); } htmltext = "30515-04.html"; - } - else - { + } else { htmltext = "30515-03.html"; } - } - else if (!hasQuestItems(player, MANAKIAS_TOTEM) && hasAtLeastOneQuestItem(player, HERMODTS_REMAINS1, HERMODTS_REMAINS2, VENDETTA_TOTEM)) - { + } else if (!hasQuestItems(player, MANAKIAS_TOTEM) && hasAtLeastOneQuestItem(player, HERMODTS_REMAINS1, HERMODTS_REMAINS2, VENDETTA_TOTEM)) { htmltext = "30515-05.html"; } break; } - case SHADOW_ORIM: - { - if (!hasAtLeastOneQuestItem(player, ORIMS_CONTRACT, BRAKIS_REMAINS1, BRAKIS_REMAINS2, VENDETTA_TOTEM)) - { + case SHADOW_ORIM: { + if (!hasAtLeastOneQuestItem(player, ORIMS_CONTRACT, BRAKIS_REMAINS1, BRAKIS_REMAINS2, VENDETTA_TOTEM)) { htmltext = "30630-01.html"; - } - else if (hasQuestItems(player, ORIMS_CONTRACT)) - { - if ((getQuestItemsCount(player, PORTAS_EYE) + getQuestItemsCount(player, EXCUROS_SCALE) + getQuestItemsCount(player, MORDEOS_TALON)) < 30) - { + } else if (hasQuestItems(player, ORIMS_CONTRACT)) { + if ((getQuestItemsCount(player, PORTAS_EYE) + getQuestItemsCount(player, EXCUROS_SCALE) + getQuestItemsCount(player, MORDEOS_TALON)) < 30) { htmltext = "30630-05.html"; - } - else - { + } else { takeItems(player, ORIMS_CONTRACT, 1); takeItems(player, PORTAS_EYE, -1); takeItems(player, EXCUROS_SCALE, -1); takeItems(player, MORDEOS_TALON, -1); giveItems(player, BRAKIS_REMAINS1, 1); - if (hasQuestItems(player, HERMODTS_REMAINS1, KIRUNAS_REMAINS1, TONARS_REMAINS1)) - { + if (hasQuestItems(player, HERMODTS_REMAINS1, KIRUNAS_REMAINS1, TONARS_REMAINS1)) { qs.setCond(2); } htmltext = "30630-06.html"; } - } - else if (!hasQuestItems(player, ORIMS_CONTRACT) && hasAtLeastOneQuestItem(player, BRAKIS_REMAINS1, BRAKIS_REMAINS2, VENDETTA_TOTEM)) - { + } else if (!hasQuestItems(player, ORIMS_CONTRACT) && hasAtLeastOneQuestItem(player, BRAKIS_REMAINS1, BRAKIS_REMAINS2, VENDETTA_TOTEM)) { htmltext = "30630-07.html"; } break; } - case ANCESTOR_MARTANKUS: - { - if (hasQuestItems(player, WARSPIRIT_TOTEM)) - { + case ANCESTOR_MARTANKUS: { + if (hasQuestItems(player, WARSPIRIT_TOTEM)) { htmltext = "30649-01.html"; } break; } - case SEER_PEKIRON: - { - if (!hasAtLeastOneQuestItem(player, PEKIRONS_TOTEM, TONARS_REMAINS1, TONARS_REMAINS2, VENDETTA_TOTEM)) - { + case SEER_PEKIRON: { + if (!hasAtLeastOneQuestItem(player, PEKIRONS_TOTEM, TONARS_REMAINS1, TONARS_REMAINS2, VENDETTA_TOTEM)) { htmltext = "30682-01.html"; - } - else if (hasQuestItems(player, PEKIRONS_TOTEM)) - { - if (hasQuestItems(player, TONARS_SKULL, TONARS_RIB_BONE, TONARS_SPINE, TONARS_ARM_BONE, TONARS_THIGH_BONE)) - { + } else if (hasQuestItems(player, PEKIRONS_TOTEM)) { + if (hasQuestItems(player, TONARS_SKULL, TONARS_RIB_BONE, TONARS_SPINE, TONARS_ARM_BONE, TONARS_THIGH_BONE)) { takeItems(player, PEKIRONS_TOTEM, 1); takeItems(player, TONARS_SKULL, 1); takeItems(player, TONARS_RIB_BONE, 1); @@ -611,29 +463,21 @@ public final class Q00233_TestOfTheWarSpirit extends Quest takeItems(player, TONARS_ARM_BONE, 1); takeItems(player, TONARS_THIGH_BONE, 1); giveItems(player, TONARS_REMAINS1, 1); - if (hasQuestItems(player, BRAKIS_REMAINS1, HERMODTS_REMAINS1, KIRUNAS_REMAINS1)) - { + if (hasQuestItems(player, BRAKIS_REMAINS1, HERMODTS_REMAINS1, KIRUNAS_REMAINS1)) { qs.setCond(2); } htmltext = "30682-04.html"; - } - else - { + } else { htmltext = "30682-03.html"; } - } - else if (!hasQuestItems(player, PEKIRONS_TOTEM) && hasAtLeastOneQuestItem(player, TONARS_REMAINS1, TONARS_REMAINS2, VENDETTA_TOTEM)) - { + } else if (!hasQuestItems(player, PEKIRONS_TOTEM) && hasAtLeastOneQuestItem(player, TONARS_REMAINS1, TONARS_REMAINS2, VENDETTA_TOTEM)) { htmltext = "30682-05.html"; } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == SEER_SOMAK) - { + } else if (qs.isCompleted()) { + if (npc.getId() == SEER_SOMAK) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00234_FatesWhisper/Q00234_FatesWhisper.java b/src/main/java/com/l2jserver/datapack/quests/Q00234_FatesWhisper/Q00234_FatesWhisper.java index 85c137495f..ddbdf9b1ca 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00234_FatesWhisper/Q00234_FatesWhisper.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00234_FatesWhisper/Q00234_FatesWhisper.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * Fate's Whisper (234) * @author Zealar */ -public final class Q00234_FatesWhisper extends Quest -{ +public final class Q00234_FatesWhisper extends Quest { // NPCs private static final int ZENKIN = 30178; private static final int CLIFF = 30182; @@ -139,8 +138,7 @@ public final class Q00234_FatesWhisper extends Quest private static final int EYE_OF_SOUL = 7894; private static final int HAMMER_OF_DESTROYER = 7899; - public Q00234_FatesWhisper() - { + public Q00234_FatesWhisper() { super(234, Q00234_FatesWhisper.class.getSimpleName(), "Fate's Whisper"); addStartNpc(MAESTRO_LEORIN); addTalkId(ZENKIN, CLIFF, MASTER_KASPAR, HEAD_BLACKSMITH_FERRIS, MAESTRO_LEORIN); @@ -155,27 +153,21 @@ public final class Q00234_FatesWhisper extends Quest } @Override - public String onSpawn(L2Npc npc) - { - switch (npc.getId()) - { - case COFFER_OF_THE_DEAD: - { + public String onSpawn(L2Npc npc) { + switch (npc.getId()) { + case COFFER_OF_THE_DEAD: { startQuestTimer("23401", 1000 * 120, npc, null); break; } - case CHEST_OF_KERNON: - { + case CHEST_OF_KERNON: { startQuestTimer("23402", 1000 * 120, npc, null); break; } - case CHEST_OF_HALLATE: - { + case CHEST_OF_HALLATE: { startQuestTimer("23403", 1000 * 120, npc, null); break; } - case CHEST_OF_GOLKONDA: - { + case CHEST_OF_GOLKONDA: { startQuestTimer("23404", 1000 * 120, npc, null); break; } @@ -184,16 +176,12 @@ public final class Q00234_FatesWhisper extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (npc.getId()) - { - case ZENKIN: - { - switch (qs.getMemoState()) - { + switch (npc.getId()) { + case ZENKIN: { + switch (qs.getMemoState()) { case 6: return "30178-01.html"; case 7: @@ -203,37 +191,29 @@ public final class Q00234_FatesWhisper extends Quest } break; } - case CLIFF: - { - if (qs.isMemoState(4) && !qs.hasQuestItems(Q_INFERNIUM_VARNISH)) - { + case CLIFF: { + if (qs.isMemoState(4) && !qs.hasQuestItems(Q_INFERNIUM_VARNISH)) { return "30182-01.html"; } - if (qs.isMemoState(4) && qs.hasQuestItems(Q_INFERNIUM_VARNISH)) - { + if (qs.isMemoState(4) && qs.hasQuestItems(Q_INFERNIUM_VARNISH)) { return "30182-05.html"; } - if (qs.getMemoState() >= 5) - { + if (qs.getMemoState() >= 5) { return "30182-06.html"; } } - case MASTER_KASPAR: - { - if (qs.isMemoState(7)) - { + case MASTER_KASPAR: { + if (qs.isMemoState(7)) { return "30833-01.html"; } final long bloodyFabricCount = qs.getQuestItemsCount(Q_BLOODY_FABRIC_Q0234); final long whiteFabricCount = qs.getQuestItemsCount(Q_WHITE_FABRIC_Q0234); final long whiteBloodyFabricCount = bloodyFabricCount + whiteFabricCount; - if (qs.isMemoState(8) && !qs.hasQuestItems(Q_RED_PIPETTE_KNIFE) && (whiteBloodyFabricCount <= 0)) - { + if (qs.isMemoState(8) && !qs.hasQuestItems(Q_RED_PIPETTE_KNIFE) && (whiteBloodyFabricCount <= 0)) { return "30833-03.html"; } - if (qs.isMemoState(8) && qs.hasQuestItems(Q_RED_PIPETTE_KNIFE) && (whiteBloodyFabricCount <= 0)) - { + if (qs.isMemoState(8) && qs.hasQuestItems(Q_RED_PIPETTE_KNIFE) && (whiteBloodyFabricCount <= 0)) { qs.giveItems(Q_MAESTRO_REORINS_MOLD, 1); qs.takeItems(Q_RED_PIPETTE_KNIFE, 1); qs.setMemoState(9); @@ -241,12 +221,10 @@ public final class Q00234_FatesWhisper extends Quest qs.showQuestionMark(234); return "30833-04.html"; } - if (qs.isMemoState(8) && !qs.hasQuestItems(Q_RED_PIPETTE_KNIFE) && (bloodyFabricCount < 30) && (whiteBloodyFabricCount >= 30)) - { + if (qs.isMemoState(8) && !qs.hasQuestItems(Q_RED_PIPETTE_KNIFE) && (bloodyFabricCount < 30) && (whiteBloodyFabricCount >= 30)) { return "30833-03c.html"; } - if (qs.isMemoState(8) && !qs.hasQuestItems(Q_RED_PIPETTE_KNIFE) && (bloodyFabricCount >= 30) && (whiteBloodyFabricCount >= 30)) - { + if (qs.isMemoState(8) && !qs.hasQuestItems(Q_RED_PIPETTE_KNIFE) && (bloodyFabricCount >= 30) && (whiteBloodyFabricCount >= 30)) { qs.giveItems(Q_MAESTRO_REORINS_MOLD, 1); qs.takeItems(Q_BLOODY_FABRIC_Q0234, -1); qs.setMemoState(9); @@ -254,232 +232,184 @@ public final class Q00234_FatesWhisper extends Quest qs.showQuestionMark(234); return "30833-03d.html"; } - if (qs.isMemoState(8) && !qs.hasQuestItems(Q_RED_PIPETTE_KNIFE) && (whiteBloodyFabricCount < 30) && (whiteBloodyFabricCount > 0)) - { + if (qs.isMemoState(8) && !qs.hasQuestItems(Q_RED_PIPETTE_KNIFE) && (whiteBloodyFabricCount < 30) && (whiteBloodyFabricCount > 0)) { qs.giveItems(Q_WHITE_FABRIC_Q0234, 30 - whiteFabricCount); qs.takeItems(Q_BLOODY_FABRIC_Q0234, -1); return "30833-03e.html"; } - if (qs.getMemoState() >= 9) - { + if (qs.getMemoState() >= 9) { return "30833-05.html"; } break; } - case HEAD_BLACKSMITH_FERRIS: - { - if (qs.isMemoState(5)) - { - if (qs.hasQuestItems(Q_MAESTRO_REORINS_HAMMER)) - { + case HEAD_BLACKSMITH_FERRIS: { + if (qs.isMemoState(5)) { + if (qs.hasQuestItems(Q_MAESTRO_REORINS_HAMMER)) { return "30847-02.html"; } qs.giveItems(Q_MAESTRO_REORINS_HAMMER, 1); return "30847-01.html"; } - if (qs.getMemoState() >= 6) - { + if (qs.getMemoState() >= 6) { return "30847-03.html"; } break; } - case MAESTRO_LEORIN: - { - if (qs.isCreated() && (player.getLevel() >= 75)) - { + case MAESTRO_LEORIN: { + if (qs.isCreated() && (player.getLevel() >= 75)) { return "31002-01.htm"; } - if (qs.isCreated() && (player.getLevel() < 75)) - { + if (qs.isCreated() && (player.getLevel() < 75)) { return "31002-01a.htm"; } - if (qs.isCompleted()) - { + if (qs.isCompleted()) { return getAlreadyCompletedMsg(player); } - if (qs.isMemoState(1) && !qs.hasQuestItems(Q_REIRIAS_SOULORB)) - { + if (qs.isMemoState(1) && !qs.hasQuestItems(Q_REIRIAS_SOULORB)) { return "31002-09.html"; } - if (qs.isMemoState(1) && qs.hasQuestItems(Q_REIRIAS_SOULORB)) - { + if (qs.isMemoState(1) && qs.hasQuestItems(Q_REIRIAS_SOULORB)) { return "31002-10.html"; } - if (qs.isMemoState(2) && !qs.hasQuestItems(Q_INFERNIUM_SCEPTER_1, Q_INFERNIUM_SCEPTER_2, Q_INFERNIUM_SCEPTER_3)) - { + if (qs.isMemoState(2) && !qs.hasQuestItems(Q_INFERNIUM_SCEPTER_1, Q_INFERNIUM_SCEPTER_2, Q_INFERNIUM_SCEPTER_3)) { return "31002-12.html"; } - if (qs.isMemoState(2) && qs.hasQuestItems(Q_INFERNIUM_SCEPTER_1, Q_INFERNIUM_SCEPTER_2, Q_INFERNIUM_SCEPTER_3)) - { + if (qs.isMemoState(2) && qs.hasQuestItems(Q_INFERNIUM_SCEPTER_1, Q_INFERNIUM_SCEPTER_2, Q_INFERNIUM_SCEPTER_3)) { return "31002-13.html"; } - if (qs.isMemoState(4) && !qs.hasQuestItems(Q_INFERNIUM_VARNISH)) - { + if (qs.isMemoState(4) && !qs.hasQuestItems(Q_INFERNIUM_VARNISH)) { return "31002-15.html"; } - if (qs.isMemoState(4) && qs.hasQuestItems(Q_INFERNIUM_VARNISH)) - { + if (qs.isMemoState(4) && qs.hasQuestItems(Q_INFERNIUM_VARNISH)) { return "31002-16.html"; } - if (qs.isMemoState(5) && !qs.hasQuestItems(Q_MAESTRO_REORINS_HAMMER)) - { + if (qs.isMemoState(5) && !qs.hasQuestItems(Q_MAESTRO_REORINS_HAMMER)) { return "31002-18.html"; } - if (qs.isMemoState(5) && qs.hasQuestItems(Q_MAESTRO_REORINS_HAMMER)) - { + if (qs.isMemoState(5) && qs.hasQuestItems(Q_MAESTRO_REORINS_HAMMER)) { return "31002-19.html"; } - if ((qs.getMemoState() < 9) && (qs.getMemoState() >= 6)) - { + if ((qs.getMemoState() < 9) && (qs.getMemoState() >= 6)) { return "31002-21.html"; } - if (qs.isMemoState(9) && qs.hasQuestItems(Q_MAESTRO_REORINS_MOLD)) - { + if (qs.isMemoState(9) && qs.hasQuestItems(Q_MAESTRO_REORINS_MOLD)) { return "31002-22.html"; } - if (qs.isMemoState(10) && (qs.getQuestItemsCount(CRYSTAL_B) < 984)) - { + if (qs.isMemoState(10) && (qs.getQuestItemsCount(CRYSTAL_B) < 984)) { return "31002-24.html"; } - if (qs.isMemoState(10) && (qs.getQuestItemsCount(CRYSTAL_B) >= 984)) - { + if (qs.isMemoState(10) && (qs.getQuestItemsCount(CRYSTAL_B) >= 984)) { return "31002-25.html"; } - switch (qs.getMemoState()) - { + switch (qs.getMemoState()) { case 11: - if (hasAtLeastOneQuestItem(player, SWORD_OF_DAMASCUS, SWORD_OF_DAMASCUS_FOCUS, SWORD_OF_DAMASCUS_CRT_DAMAGE, SWORD_OF_DAMASCUS_HASTE)) - { + if (hasAtLeastOneQuestItem(player, SWORD_OF_DAMASCUS, SWORD_OF_DAMASCUS_FOCUS, SWORD_OF_DAMASCUS_CRT_DAMAGE, SWORD_OF_DAMASCUS_HASTE)) { return "31002-35.html"; } return "31002-35a.html"; case 12: - if (hasAtLeastOneQuestItem(player, HAZARD_BOW_GUIDENCE, HAZARD_BOW_QUICKRECOVERY, HAZARD_BOW_CHEAPSHOT, HAZARD_BOW)) - { + if (hasAtLeastOneQuestItem(player, HAZARD_BOW_GUIDENCE, HAZARD_BOW_QUICKRECOVERY, HAZARD_BOW_CHEAPSHOT, HAZARD_BOW)) { return "31002-36.html"; } return "31002-36a.html"; case 13: - if (hasAtLeastOneQuestItem(player, LANCIA_ANGER, LANCIA_CRT_STUN, LANCIA_LONGBLOW, LANCIA)) - { + if (hasAtLeastOneQuestItem(player, LANCIA_ANGER, LANCIA_CRT_STUN, LANCIA_LONGBLOW, LANCIA)) { return "31002-37.html"; } return "31002-37a.html"; case 14: - if (hasAtLeastOneQuestItem(player, ART_OF_BATTLE_AXE_HEALTH, ART_OF_BATTLE_AXE_RSK_FOCUS, ART_OF_BATTLE_AXE_HASTE, ART_OF_BATTLE_AXE)) - { + if (hasAtLeastOneQuestItem(player, ART_OF_BATTLE_AXE_HEALTH, ART_OF_BATTLE_AXE_RSK_FOCUS, ART_OF_BATTLE_AXE_HASTE, ART_OF_BATTLE_AXE)) { return "31002-38.html"; } return "31002-38a.html"; case 15: - if (hasAtLeastOneQuestItem(player, STAFF_OF_EVIL_SPRIT_MAGICFOCUS, STAFF_OF_EVIL_SPRIT_MAGICBLESSTHEBODY, STAFF_OF_EVIL_SPRIT_MAGICPOISON, STAFF_OF_EVIL_SPRIT)) - { + if (hasAtLeastOneQuestItem(player, STAFF_OF_EVIL_SPRIT_MAGICFOCUS, STAFF_OF_EVIL_SPRIT_MAGICBLESSTHEBODY, STAFF_OF_EVIL_SPRIT_MAGICPOISON, STAFF_OF_EVIL_SPRIT)) { return "31002-39.html"; } return "31002-39a.html"; case 16: - if (hasAtLeastOneQuestItem(player, DEMONS_SWORD_CRT_BLEED, DEMONS_SWORD_CRT_POISON, DEMONS_SWORD_MIGHTMOTAL, DEMONS_SWORD)) - { + if (hasAtLeastOneQuestItem(player, DEMONS_SWORD_CRT_BLEED, DEMONS_SWORD_CRT_POISON, DEMONS_SWORD_MIGHTMOTAL, DEMONS_SWORD)) { return "31002-40.html"; } return "31002-40a.html"; case 17: - if (hasAtLeastOneQuestItem(player, BELLION_CESTUS_CRT_DRAIN, BELLION_CESTUS_CRT_POISON, BELLION_CESTUS_RSK_HASTE, BELLION_CESTUS)) - { + if (hasAtLeastOneQuestItem(player, BELLION_CESTUS_CRT_DRAIN, BELLION_CESTUS_CRT_POISON, BELLION_CESTUS_RSK_HASTE, BELLION_CESTUS)) { return "31002-41.html"; } return "31002-41a.html"; case 18: - if (hasAtLeastOneQuestItem(player, DEADMANS_GLORY_ANGER, DEADMANS_GLORY_HEALTH, DEADMANS_GLORY_HASTE, DEADMANS_GLORY)) - { + if (hasAtLeastOneQuestItem(player, DEADMANS_GLORY_ANGER, DEADMANS_GLORY_HEALTH, DEADMANS_GLORY_HASTE, DEADMANS_GLORY)) { return "31002-42.html"; } return "31002-42a.html"; case 19: - if (hasAtLeastOneQuestItem(player, SAMURAI_LONGSWORD_SAMURAI_LONGSWORD)) - { + if (hasAtLeastOneQuestItem(player, SAMURAI_LONGSWORD_SAMURAI_LONGSWORD)) { return "31002-43.html"; } return "31002-43a.html"; case 41: - if (hasAtLeastOneQuestItem(player, GUARDIANS_SWORD, GUARDIANS_SWORD_CRT_DRAIN, GUARDIANS_SWORD_HEALTH, GUARDIANS_SWORD_CRT_BLEED)) - { + if (hasAtLeastOneQuestItem(player, GUARDIANS_SWORD, GUARDIANS_SWORD_CRT_DRAIN, GUARDIANS_SWORD_HEALTH, GUARDIANS_SWORD_CRT_BLEED)) { return "31002-43b.html"; } return "31002-43c.html"; case 42: - if (hasAtLeastOneQuestItem(player, TEARS_OF_WIZARD, TEARS_OF_WIZARD_ACUMEN, TEARS_OF_WIZARD_MAGICPOWER, TEARS_OF_WIZARD_UPDOWN)) - { + if (hasAtLeastOneQuestItem(player, TEARS_OF_WIZARD, TEARS_OF_WIZARD_ACUMEN, TEARS_OF_WIZARD_MAGICPOWER, TEARS_OF_WIZARD_UPDOWN)) { return "31002-43d.html"; } return "31002-43e.html"; case 43: - if (hasAtLeastOneQuestItem(player, STAR_BUSTER, STAR_BUSTER_HEALTH, STAR_BUSTER_HASTE, STAR_BUSTER_RSK_FOCUS)) - { + if (hasAtLeastOneQuestItem(player, STAR_BUSTER, STAR_BUSTER_HEALTH, STAR_BUSTER_HASTE, STAR_BUSTER_RSK_FOCUS)) { return "31002-43f.html"; } return "31002-43g.html"; case 44: - if (hasAtLeastOneQuestItem(player, BONE_OF_KAIM_VANUL, BONE_OF_KAIM_VANUL_MANAUP, BONE_OF_KAIM_VANUL_MAGICSILENCE, BONE_OF_KAIM_VANUL_UPDOWN)) - { + if (hasAtLeastOneQuestItem(player, BONE_OF_KAIM_VANUL, BONE_OF_KAIM_VANUL_MANAUP, BONE_OF_KAIM_VANUL_MAGICSILENCE, BONE_OF_KAIM_VANUL_UPDOWN)) { return "31002-43h.html"; } return "31002-43i.html"; } break; } - case COFFER_OF_THE_DEAD: - { - if (qs.isMemoState(1) && !qs.hasQuestItems(Q_REIRIAS_SOULORB)) - { + case COFFER_OF_THE_DEAD: { + if (qs.isMemoState(1) && !qs.hasQuestItems(Q_REIRIAS_SOULORB)) { qs.giveItems(Q_REIRIAS_SOULORB, 1); qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); return "31027-01.html"; } - if ((qs.getMemoState() > 1) || qs.hasQuestItems(Q_REIRIAS_SOULORB)) - { + if ((qs.getMemoState() > 1) || qs.hasQuestItems(Q_REIRIAS_SOULORB)) { return "31027-02.html"; } break; } - case CHEST_OF_KERNON: - { - if (qs.isMemoState(2) && !qs.hasQuestItems(Q_INFERNIUM_SCEPTER_1)) - { + case CHEST_OF_KERNON: { + if (qs.isMemoState(2) && !qs.hasQuestItems(Q_INFERNIUM_SCEPTER_1)) { qs.giveItems(Q_INFERNIUM_SCEPTER_1, 1); qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); return "31028-01.html"; } - if (!qs.isMemoState(2) || qs.hasQuestItems(Q_INFERNIUM_SCEPTER_1)) - { + if (!qs.isMemoState(2) || qs.hasQuestItems(Q_INFERNIUM_SCEPTER_1)) { return "31028-02.html"; } break; } - case CHEST_OF_GOLKONDA: - { - if (qs.isMemoState(2) && !qs.hasQuestItems(Q_INFERNIUM_SCEPTER_2)) - { + case CHEST_OF_GOLKONDA: { + if (qs.isMemoState(2) && !qs.hasQuestItems(Q_INFERNIUM_SCEPTER_2)) { qs.giveItems(Q_INFERNIUM_SCEPTER_2, 1); qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); return "31029-01.html"; } - if (!qs.isMemoState(2) || qs.hasQuestItems(Q_INFERNIUM_SCEPTER_2)) - { + if (!qs.isMemoState(2) || qs.hasQuestItems(Q_INFERNIUM_SCEPTER_2)) { return "31029-02.html"; } break; } - case CHEST_OF_HALLATE: - { - if (qs.isMemoState(2) && !qs.hasQuestItems(Q_INFERNIUM_SCEPTER_3)) - { + case CHEST_OF_HALLATE: { + if (qs.isMemoState(2) && !qs.hasQuestItems(Q_INFERNIUM_SCEPTER_3)) { qs.giveItems(Q_INFERNIUM_SCEPTER_3, 1); qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); return "31030-01.html"; } - if (!qs.isMemoState(2) || qs.hasQuestItems(Q_INFERNIUM_SCEPTER_3)) - { + if (!qs.isMemoState(2) || qs.hasQuestItems(Q_INFERNIUM_SCEPTER_3)) { return "31030-02.html"; } break; @@ -489,49 +419,39 @@ public final class Q00234_FatesWhisper extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (player == null) - { - if (event.equals("23401") || event.equals("23402") || event.equals("23403") || event.equals("23404")) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (player == null) { + if (event.equals("23401") || event.equals("23402") || event.equals("23403") || event.equals("23404")) { npc.decayMe(); } return super.onAdvEvent(event, npc, player); } final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - if (event.equals("QUEST_ACCEPTED")) - { + if (event.equals("QUEST_ACCEPTED")) { qs.setMemoState(1); qs.startQuest(); qs.showQuestionMark(234); qs.playSound(Sound.ITEMSOUND_QUEST_ACCEPT); return "31002-06.html"; } - if (event.contains(".htm")) - { + if (event.contains(".htm")) { return event; } int npcId = npc.getId(); int eventID = Integer.parseInt(event); - switch (npcId) - { - case ZENKIN: - { - switch (eventID) - { - case 1: - { + switch (npcId) { + case ZENKIN: { + switch (eventID) { + case 1: { qs.setMemoState(7); qs.setCond(6); qs.showQuestionMark(234); @@ -540,22 +460,16 @@ public final class Q00234_FatesWhisper extends Quest } } } - case CLIFF: - { - switch (eventID) - { - case 1: - { + case CLIFF: { + switch (eventID) { + case 1: { return "30182-02.html"; } - case 2: - { + case 2: { return "30182-03.html"; } - case 3: - { - if (qs.isMemoState(4) && !qs.hasQuestItems(Q_INFERNIUM_VARNISH)) - { + case 3: { + if (qs.isMemoState(4) && !qs.hasQuestItems(Q_INFERNIUM_VARNISH)) { qs.giveItems(Q_INFERNIUM_VARNISH, 1); return "30182-04.html"; } @@ -563,22 +477,16 @@ public final class Q00234_FatesWhisper extends Quest } break; } - case MASTER_KASPAR: - { - switch (eventID) - { - case 1: - { - if (qs.isMemoState(7)) - { + case MASTER_KASPAR: { + switch (eventID) { + case 1: { + if (qs.isMemoState(7)) { return "30833-02.html"; } break; } - case 2: - { - if (qs.isMemoState(7)) - { + case 2: { + if (qs.isMemoState(7)) { qs.giveItems(Q_PIPETTE_KNIFE, 1); qs.setMemoState(8); qs.setCond(7, true); @@ -587,10 +495,8 @@ public final class Q00234_FatesWhisper extends Quest } break; } - case 3: - { - if (qs.isMemoState(7)) - { + case 3: { + if (qs.isMemoState(7)) { qs.giveItems(Q_WHITE_FABRIC_Q0234, 30); qs.setMemoState(8); qs.setCond(8, true); @@ -602,28 +508,22 @@ public final class Q00234_FatesWhisper extends Quest } break; } - case MAESTRO_LEORIN: - { - switch (eventID) - { + case MAESTRO_LEORIN: { + switch (eventID) { case 1: return "31002-02.htm"; case 2: return "31002-03.html"; case 3: return "31002-04.html"; - case 4: - { - if (!qs.isCompleted() && (player.getLevel() >= 75)) - { + case 4: { + if (!qs.isCompleted() && (player.getLevel() >= 75)) { return "31002-05.html"; } break; } - case 5: - { - if (qs.isMemoState(1) && qs.hasQuestItems(Q_REIRIAS_SOULORB)) - { + case 5: { + if (qs.isMemoState(1) && qs.hasQuestItems(Q_REIRIAS_SOULORB)) { qs.takeItems(Q_REIRIAS_SOULORB, 1); qs.setMemoState(2); qs.setCond(2, true); @@ -632,10 +532,8 @@ public final class Q00234_FatesWhisper extends Quest } break; } - case 6: - { - if (qs.isMemoState(2) && qs.hasQuestItems(Q_INFERNIUM_SCEPTER_1, Q_INFERNIUM_SCEPTER_2, Q_INFERNIUM_SCEPTER_3)) - { + case 6: { + if (qs.isMemoState(2) && qs.hasQuestItems(Q_INFERNIUM_SCEPTER_1, Q_INFERNIUM_SCEPTER_2, Q_INFERNIUM_SCEPTER_3)) { qs.takeItems(Q_INFERNIUM_SCEPTER_1, -1); qs.takeItems(Q_INFERNIUM_SCEPTER_2, -1); qs.takeItems(Q_INFERNIUM_SCEPTER_3, -1); @@ -646,10 +544,8 @@ public final class Q00234_FatesWhisper extends Quest } break; } - case 7: - { - if (qs.isMemoState(4) && qs.hasQuestItems(Q_INFERNIUM_VARNISH)) - { + case 7: { + if (qs.isMemoState(4) && qs.hasQuestItems(Q_INFERNIUM_VARNISH)) { qs.takeItems(Q_INFERNIUM_VARNISH, 1); qs.setMemoState(5); qs.setCond(4, true); @@ -658,10 +554,8 @@ public final class Q00234_FatesWhisper extends Quest } break; } - case 8: - { - if (qs.isMemoState(5) && qs.hasQuestItems(Q_MAESTRO_REORINS_HAMMER)) - { + case 8: { + if (qs.isMemoState(5) && qs.hasQuestItems(Q_MAESTRO_REORINS_HAMMER)) { qs.takeItems(Q_MAESTRO_REORINS_HAMMER, 1); qs.setMemoState(6); qs.setCond(5, true); @@ -670,10 +564,8 @@ public final class Q00234_FatesWhisper extends Quest } break; } - case 9: - { - if (qs.isMemoState(9) && qs.hasQuestItems(Q_MAESTRO_REORINS_MOLD)) - { + case 9: { + if (qs.isMemoState(9) && qs.hasQuestItems(Q_MAESTRO_REORINS_MOLD)) { qs.takeItems(Q_MAESTRO_REORINS_MOLD, 1); qs.setMemoState(10); qs.setCond(11, true); @@ -682,12 +574,9 @@ public final class Q00234_FatesWhisper extends Quest } break; } - case 10: - { - if (qs.isMemoState(10)) - { - if (qs.getQuestItemsCount(CRYSTAL_B) >= 984) - { + case 10: { + if (qs.isMemoState(10)) { + if (qs.getQuestItemsCount(CRYSTAL_B) >= 984) { qs.takeItems(CRYSTAL_B, 984); qs.setMemoState(11); qs.setCond(12, true); @@ -698,12 +587,9 @@ public final class Q00234_FatesWhisper extends Quest } break; } - case 11: - { - if (qs.isMemoState(10)) - { - if (qs.getQuestItemsCount(CRYSTAL_B) >= 984) - { + case 11: { + if (qs.isMemoState(10)) { + if (qs.getQuestItemsCount(CRYSTAL_B) >= 984) { qs.takeItems(CRYSTAL_B, 984); qs.setMemoState(19); qs.setCond(12, true); @@ -714,12 +600,9 @@ public final class Q00234_FatesWhisper extends Quest } break; } - case 12: - { - if (qs.isMemoState(10)) - { - if (qs.getQuestItemsCount(CRYSTAL_B) >= 984) - { + case 12: { + if (qs.isMemoState(10)) { + if (qs.getQuestItemsCount(CRYSTAL_B) >= 984) { qs.takeItems(CRYSTAL_B, 984); qs.setMemoState(12); qs.setCond(12, true); @@ -730,12 +613,9 @@ public final class Q00234_FatesWhisper extends Quest } break; } - case 13: - { - if (qs.isMemoState(10)) - { - if (qs.getQuestItemsCount(CRYSTAL_B) >= 984) - { + case 13: { + if (qs.isMemoState(10)) { + if (qs.getQuestItemsCount(CRYSTAL_B) >= 984) { qs.takeItems(CRYSTAL_B, 984); qs.setMemoState(13); qs.setCond(12, true); @@ -746,12 +626,9 @@ public final class Q00234_FatesWhisper extends Quest } break; } - case 14: - { - if (qs.isMemoState(10)) - { - if (qs.getQuestItemsCount(CRYSTAL_B) >= 984) - { + case 14: { + if (qs.isMemoState(10)) { + if (qs.getQuestItemsCount(CRYSTAL_B) >= 984) { qs.takeItems(CRYSTAL_B, 984); qs.setMemoState(14); qs.setCond(12, true); @@ -762,12 +639,9 @@ public final class Q00234_FatesWhisper extends Quest } break; } - case 15: - { - if (qs.isMemoState(10)) - { - if (qs.getQuestItemsCount(CRYSTAL_B) >= 984) - { + case 15: { + if (qs.isMemoState(10)) { + if (qs.getQuestItemsCount(CRYSTAL_B) >= 984) { qs.takeItems(CRYSTAL_B, 984); qs.setMemoState(15); qs.setCond(12, true); @@ -778,12 +652,9 @@ public final class Q00234_FatesWhisper extends Quest } break; } - case 16: - { - if (qs.isMemoState(10)) - { - if (qs.getQuestItemsCount(CRYSTAL_B) >= 984) - { + case 16: { + if (qs.isMemoState(10)) { + if (qs.getQuestItemsCount(CRYSTAL_B) >= 984) { qs.takeItems(CRYSTAL_B, 984); qs.setMemoState(16); qs.setCond(12, true); @@ -794,12 +665,9 @@ public final class Q00234_FatesWhisper extends Quest } break; } - case 17: - { - if (qs.isMemoState(10)) - { - if (qs.getQuestItemsCount(CRYSTAL_B) >= 984) - { + case 17: { + if (qs.isMemoState(10)) { + if (qs.getQuestItemsCount(CRYSTAL_B) >= 984) { qs.takeItems(CRYSTAL_B, 984); qs.setMemoState(17); qs.setCond(12, true); @@ -810,12 +678,9 @@ public final class Q00234_FatesWhisper extends Quest } break; } - case 18: - { - if (qs.isMemoState(10)) - { - if (qs.getQuestItemsCount(CRYSTAL_B) >= 984) - { + case 18: { + if (qs.isMemoState(10)) { + if (qs.getQuestItemsCount(CRYSTAL_B) >= 984) { qs.takeItems(CRYSTAL_B, 984); qs.setMemoState(18); qs.setCond(12, true); @@ -826,12 +691,9 @@ public final class Q00234_FatesWhisper extends Quest } break; } - case 41: - { - if (qs.isMemoState(10)) - { - if (qs.getQuestItemsCount(CRYSTAL_B) >= 984) - { + case 41: { + if (qs.isMemoState(10)) { + if (qs.getQuestItemsCount(CRYSTAL_B) >= 984) { qs.takeItems(CRYSTAL_B, 984); qs.setMemoState(41); qs.setCond(12, true); @@ -842,12 +704,9 @@ public final class Q00234_FatesWhisper extends Quest } break; } - case 42: - { - if (qs.isMemoState(10)) - { - if (qs.getQuestItemsCount(CRYSTAL_B) >= 984) - { + case 42: { + if (qs.isMemoState(10)) { + if (qs.getQuestItemsCount(CRYSTAL_B) >= 984) { qs.takeItems(CRYSTAL_B, 984); qs.setMemoState(42); qs.setCond(12, true); @@ -858,12 +717,9 @@ public final class Q00234_FatesWhisper extends Quest } break; } - case 43: - { - if (qs.isMemoState(10)) - { - if (qs.getQuestItemsCount(CRYSTAL_B) >= 984) - { + case 43: { + if (qs.isMemoState(10)) { + if (qs.getQuestItemsCount(CRYSTAL_B) >= 984) { qs.takeItems(CRYSTAL_B, 984); qs.setMemoState(43); qs.setCond(12, true); @@ -874,12 +730,9 @@ public final class Q00234_FatesWhisper extends Quest } break; } - case 44: - { - if (qs.isMemoState(10)) - { - if (qs.getQuestItemsCount(CRYSTAL_B) >= 984) - { + case 44: { + if (qs.isMemoState(10)) { + if (qs.getQuestItemsCount(CRYSTAL_B) >= 984) { qs.takeItems(CRYSTAL_B, 984); qs.setMemoState(44); qs.setCond(12, true); @@ -890,98 +743,74 @@ public final class Q00234_FatesWhisper extends Quest } break; } - case 21: - { - if (calculateReward(qs, player, TALLUM_BLADE)) - { + case 21: { + if (calculateReward(qs, player, TALLUM_BLADE)) { return "31002-44.html"; } break; } - case 22: - { - if (calculateReward(qs, player, CARNIUM_BOW)) - { + case 22: { + if (calculateReward(qs, player, CARNIUM_BOW)) { return "31002-44.html"; } break; } - case 23: - { - if (calculateReward(qs, player, HALBARD)) - { + case 23: { + if (calculateReward(qs, player, HALBARD)) { return "31002-44.html"; } break; } - case 24: - { - if (calculateReward(qs, player, ELEMENTAL_SWORD)) - { + case 24: { + if (calculateReward(qs, player, ELEMENTAL_SWORD)) { return "31002-44.html"; } break; } - case 25: - { - if (calculateReward(qs, player, DASPARIONS_STAFF)) - { + case 25: { + if (calculateReward(qs, player, DASPARIONS_STAFF)) { return "31002-44.html"; } break; } - case 26: - { - if (calculateReward(qs, player, BLOODY_ORCHID)) - { + case 26: { + if (calculateReward(qs, player, BLOODY_ORCHID)) { return "31002-44.html"; } break; } - case 27: - { - if (calculateReward(qs, player, BLOOD_TORNADO)) - { + case 27: { + if (calculateReward(qs, player, BLOOD_TORNADO)) { return "31002-44.html"; } break; } - case 28: - { - if (calculateReward(qs, player, METEOR_SHOWER)) - { + case 28: { + if (calculateReward(qs, player, METEOR_SHOWER)) { return "31002-44.html"; } break; } - case 29: - { - if (calculateReward(qs, player, KSHANBERK_KSHANBERK)) - { + case 29: { + if (calculateReward(qs, player, KSHANBERK_KSHANBERK)) { return "31002-44.html"; } break; } - case 30: - { - if (calculateReward(qs, player, INFERNO_MASTER)) - { + case 30: { + if (calculateReward(qs, player, INFERNO_MASTER)) { return "31002-44.html"; } break; } - case 31: - { - if (calculateReward(qs, player, EYE_OF_SOUL)) - { + case 31: { + if (calculateReward(qs, player, EYE_OF_SOUL)) { return "31002-44.html"; } break; } - case 32: - { - if (calculateReward(qs, player, HAMMER_OF_DESTROYER)) - { + case 32: { + if (calculateReward(qs, player, HAMMER_OF_DESTROYER)) { return "31002-44.html"; } break; @@ -992,10 +821,8 @@ public final class Q00234_FatesWhisper extends Quest return htmltext; } - private boolean calculateReward(QuestState qs, L2PcInstance player, int reward) - { - switch (qs.getMemoState()) - { + private boolean calculateReward(QuestState qs, L2PcInstance player, int reward) { + switch (qs.getMemoState()) { case 11: return getReward(qs, player, SWORD_OF_DAMASCUS, SWORD_OF_DAMASCUS_FOCUS, SWORD_OF_DAMASCUS_CRT_DAMAGE, SWORD_OF_DAMASCUS_HASTE, reward); case 12: @@ -1026,26 +853,17 @@ public final class Q00234_FatesWhisper extends Quest return false; } - private boolean getReward(QuestState qs, L2PcInstance player, int item1, int item2, int item3, int item4, int reward) - { - if (hasAtLeastOneQuestItem(player, item1, item2, item3, item4)) - { + private boolean getReward(QuestState qs, L2PcInstance player, int item1, int item2, int item3, int item4, int reward) { + if (hasAtLeastOneQuestItem(player, item1, item2, item3, item4)) { qs.giveItems(reward, 1); qs.giveItems(Q_STAR_OF_DESTINY, 1); - if (qs.hasQuestItems(item1)) - { + if (qs.hasQuestItems(item1)) { qs.takeItems(item1, 1); - } - else if (qs.hasQuestItems(item2)) - { + } else if (qs.hasQuestItems(item2)) { qs.takeItems(item2, 1); - } - else if (qs.hasQuestItems(item3)) - { + } else if (qs.hasQuestItems(item3)) { qs.takeItems(item3, 1); - } - else if (qs.hasQuestItems(item4)) - { + } else if (qs.hasQuestItems(item4)) { qs.takeItems(item4, 1); } qs.exitQuest(false, true); @@ -1056,37 +874,29 @@ public final class Q00234_FatesWhisper extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - switch (npc.getId()) - { - case DOMB_DEATH_CABRIO: - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + switch (npc.getId()) { + case DOMB_DEATH_CABRIO: { addSpawn(COFFER_OF_THE_DEAD, npc.getLocation()); return super.onKill(npc, killer, isSummon); } - case KERNON: - { + case KERNON: { addSpawn(CHEST_OF_KERNON, npc.getLocation()); return super.onKill(npc, killer, isSummon); } - case GOLKONDA_LONGHORN: - { + case GOLKONDA_LONGHORN: { addSpawn(CHEST_OF_GOLKONDA, npc.getLocation()); return super.onKill(npc, killer, isSummon); } - case HALLATE_THE_DEATH_LORD: - { + case HALLATE_THE_DEATH_LORD: { addSpawn(CHEST_OF_HALLATE, npc.getLocation()); return super.onKill(npc, killer, isSummon); } } final QuestState qs = getRandomPartyMemberState(killer, -1, 2, npc); - if (qs != null) - { - switch (npc.getId()) - { + if (qs != null) { + switch (npc.getId()) { case PLATINUM_TRIBE_GRUNT: case PLATINUM_TRIBE_ARCHER: case PLATINUM_TRIBE_WARRIOR: @@ -1094,17 +904,13 @@ public final class Q00234_FatesWhisper extends Quest case PLATINUM_TRIBE_LORD: case GUARDIAN_ANGEL: case SEAL_ANGEL: - case SEAL_ANGEL_R: - { + case SEAL_ANGEL_R: { giveItemRandomly(qs.getPlayer(), npc, Q_BLOODY_FABRIC_Q0234, 1, 0, 1, false); qs.takeItems(Q_WHITE_FABRIC_Q0234, 1); - if (qs.getQuestItemsCount(Q_BLOODY_FABRIC_Q0234) >= 29) - { + if (qs.getQuestItemsCount(Q_BLOODY_FABRIC_Q0234) >= 29) { qs.setCond(9, true); qs.showQuestionMark(234); - } - else - { + } else { qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } break; @@ -1116,13 +922,10 @@ public final class Q00234_FatesWhisper extends Quest } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { QuestState qs = getQuestState(attacker, false); - if ((qs != null) && (npc.getId() == BAIUM)) - { - if ((attacker.getActiveWeaponItem() != null) && (attacker.getActiveWeaponItem().getId() == Q_PIPETTE_KNIFE)) - { + if ((qs != null) && (npc.getId() == BAIUM)) { + if ((attacker.getActiveWeaponItem() != null) && (attacker.getActiveWeaponItem().getId() == Q_PIPETTE_KNIFE)) { qs.takeItems(Q_PIPETTE_KNIFE, 1); qs.giveItems(Q_RED_PIPETTE_KNIFE, 1); qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); @@ -1133,8 +936,7 @@ public final class Q00234_FatesWhisper extends Quest } @Override - public boolean checkPartyMember(QuestState qs, L2Npc npc) - { + public boolean checkPartyMember(QuestState qs, L2Npc npc) { return qs.hasQuestItems(Q_WHITE_FABRIC_Q0234) && qs.isMemoState(8); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00235_MimirsElixir/Q00235_MimirsElixir.java b/src/main/java/com/l2jserver/datapack/quests/Q00235_MimirsElixir/Q00235_MimirsElixir.java index 1758cf5a80..f2a29355b5 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00235_MimirsElixir/Q00235_MimirsElixir.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00235_MimirsElixir/Q00235_MimirsElixir.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.network.serverpackets.SocialAction; * Mimir's Elixir (235) * @author Adry_85 */ -public final class Q00235_MimirsElixir extends Quest -{ +public final class Q00235_MimirsElixir extends Quest { // NPCs private static final int JOAN = 30718; private static final int LADD = 30721; @@ -56,14 +55,12 @@ public final class Q00235_MimirsElixir extends Quest private static final SkillHolder QUEST_MIMIRS_ELIXIR = new SkillHolder(4339); // Mobs private static final Map<Integer, QuestItemHolder> MOBS = new HashMap<>(); - static - { + static { MOBS.put(20965, new QuestItemHolder(SAGES_STONE, 4, 1)); // chimera_piece MOBS.put(21090, new QuestItemHolder(BLOOD_FIRE, 7, 1)); // bloody_guardian } - public Q00235_MimirsElixir() - { + public Q00235_MimirsElixir() { super(235, Q00235_MimirsElixir.class.getSimpleName(), "Mimir's Elixir"); addStartNpc(LADD); addTalkId(LADD, JOAN, ALCHEMISTS_MIXING_URN); @@ -72,53 +69,43 @@ public final class Q00235_MimirsElixir extends Quest } @Override - public boolean checkPartyMember(L2PcInstance member, L2Npc npc) - { + public boolean checkPartyMember(L2PcInstance member, L2Npc npc) { final QuestState st = getQuestState(member, false); return ((st != null) && (st.isMemoState(3) || st.isMemoState(6))); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "30721-02.htm": case "30721-03.htm": case "30721-04.htm": - case "30721-05.htm": - { + case "30721-05.htm": { htmltext = event; break; } - case "30721-06.htm": - { + case "30721-06.htm": { st.setMemoState(1); st.startQuest(); htmltext = event; break; } - case "30721-12.html": - { - if (st.isMemoState(1)) - { + case "30721-12.html": { + if (st.isMemoState(1)) { st.setMemoState(2); st.setCond(2); htmltext = event; } break; } - case "30721-15.html": - { - if (st.isMemoState(5)) - { + case "30721-15.html": { + if (st.isMemoState(5)) { giveItems(player, MAGISTERS_MIXING_STONE, 1); st.setMemoState(6); st.setCond(6); @@ -126,18 +113,14 @@ public final class Q00235_MimirsElixir extends Quest } break; } - case "30721-18.html": - { - if (st.isMemoState(8)) - { + case "30721-18.html": { + if (st.isMemoState(8)) { htmltext = event; } break; } - case "30721-19.html": - { - if (st.isMemoState(8) && hasQuestItems(player, MAGISTERS_MIXING_STONE, MIMIRS_ELIXIR)) - { + case "30721-19.html": { + if (st.isMemoState(8) && hasQuestItems(player, MAGISTERS_MIXING_STONE, MIMIRS_ELIXIR)) { npc.setTarget(player); npc.doCast(QUEST_MIMIRS_ELIXIR); takeItems(player, STAR_OF_DESTINY, -1); @@ -148,28 +131,22 @@ public final class Q00235_MimirsElixir extends Quest } break; } - case "30718-02.html": - { - if (st.isMemoState(2)) - { + case "30718-02.html": { + if (st.isMemoState(2)) { htmltext = event; } break; } - case "30718-03.html": - { - if (st.isMemoState(2)) - { + case "30718-03.html": { + if (st.isMemoState(2)) { st.setMemoState(3); st.setCond(3, true); htmltext = event; } break; } - case "30718-06.html": - { - if (st.isMemoState(4) && hasQuestItems(player, SAGES_STONE)) - { + case "30718-06.html": { + if (st.isMemoState(4) && hasQuestItems(player, SAGES_STONE)) { giveItems(player, TRUE_GOLD, 1); takeItems(player, SAGES_STONE, -1); st.setMemoState(5); @@ -182,42 +159,32 @@ public final class Q00235_MimirsElixir extends Quest case "31149-05.html": case "31149-07.html": case "31149-09.html": - case "31149-10.html": - { - if (st.isMemoState(7)) - { + case "31149-10.html": { + if (st.isMemoState(7)) { htmltext = event; } break; } - case "PURE_SILVER": - { - if (st.isMemoState(7)) - { + case "PURE_SILVER": { + if (st.isMemoState(7)) { htmltext = ((hasQuestItems(player, PURE_SILVER)) ? "31149-04.html" : "31149-03.html"); } break; } - case "TRUE_GOLD": - { - if (st.isMemoState(7)) - { + case "TRUE_GOLD": { + if (st.isMemoState(7)) { htmltext = ((hasQuestItems(player, TRUE_GOLD)) ? "31149-06.html" : "31149-03.html"); } break; } - case "BLOOD_FIRE": - { - if (st.isMemoState(7)) - { + case "BLOOD_FIRE": { + if (st.isMemoState(7)) { htmltext = ((hasQuestItems(player, BLOOD_FIRE)) ? "31149-08.html" : "31149-03.html"); } break; } - case "31149-11.html": - { - if (st.isMemoState(7) && hasQuestItems(player, BLOOD_FIRE, PURE_SILVER, TRUE_GOLD)) - { + case "31149-11.html": { + if (st.isMemoState(7) && hasQuestItems(player, BLOOD_FIRE, PURE_SILVER, TRUE_GOLD)) { giveItems(player, MIMIRS_ELIXIR, 1); takeItems(player, -1, BLOOD_FIRE, PURE_SILVER, TRUE_GOLD); st.setMemoState(8); @@ -231,16 +198,12 @@ public final class Q00235_MimirsElixir extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { - if (getRandom(5) == 0) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { + if (getRandom(5) == 0) { L2PcInstance luckyPlayer = getRandomPartyMember(player, npc); - if (luckyPlayer != null) - { + if (luckyPlayer != null) { final QuestItemHolder item = MOBS.get(npc.getId()); - if (giveItemRandomly(luckyPlayer, npc, item.getId(), item.getCount(), item.getCount(), 1.0, true)) - { + if (giveItemRandomly(luckyPlayer, npc, item.getId(), item.getCount(), item.getCount(), 1.0, true)) { final QuestState st = luckyPlayer.getQuestState(getName()); st.setMemoState(item.getChance()); st.setCond(item.getChance()); @@ -251,103 +214,75 @@ public final class Q00235_MimirsElixir extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCreated()) - { - if (npc.getId() == LADD) - { - if (player.getRace() == Race.KAMAEL) - { + if (st.isCreated()) { + if (npc.getId() == LADD) { + if (player.getRace() == Race.KAMAEL) { htmltext = "30721-09.html"; - } - else if (player.getLevel() < MIN_LEVEL) - { + } else if (player.getLevel() < MIN_LEVEL) { htmltext = "30721-08.html"; - } - else - { + } else { htmltext = ((hasQuestItems(player, STAR_OF_DESTINY)) ? "30721-01.htm" : "30721-07.html"); } } - } - else if (st.isStarted()) - { - switch (npc.getId()) - { - case LADD: - { - switch (st.getMemoState()) - { - case 1: - { + } else if (st.isStarted()) { + switch (npc.getId()) { + case LADD: { + switch (st.getMemoState()) { + case 1: { htmltext = ((hasQuestItems(player, PURE_SILVER)) ? "30721-11.html" : "30721-10.html"); break; } case 2: case 3: - case 4: - { + case 4: { htmltext = "30721-13.html"; break; } - case 5: - { + case 5: { htmltext = "30721-14.html"; break; } case 6: - case 7: - { + case 7: { htmltext = "30721-16.html"; break; } - case 8: - { + case 8: { htmltext = "30721-17.html"; break; } } break; } - case JOAN: - { - switch (st.getMemoState()) - { - case 2: - { + case JOAN: { + switch (st.getMemoState()) { + case 2: { htmltext = "30718-01.html"; break; } - case 3: - { + case 3: { htmltext = "30718-04.html"; break; } - case 4: - { + case 4: { htmltext = "30718-05.html"; break; } } break; } - case ALCHEMISTS_MIXING_URN: - { - if (st.isMemoState(7) && hasQuestItems(player, MAGISTERS_MIXING_STONE)) - { + case ALCHEMISTS_MIXING_URN: { + if (st.isMemoState(7) && hasQuestItems(player, MAGISTERS_MIXING_STONE)) { htmltext = "31149-01.html"; } break; } } - } - else if (st.isCompleted()) - { - if (npc.getId() == LADD) - { + } else if (st.isCompleted()) { + if (npc.getId() == LADD) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00236_SeedsOfChaos/Q00236_SeedsOfChaos.java b/src/main/java/com/l2jserver/datapack/quests/Q00236_SeedsOfChaos/Q00236_SeedsOfChaos.java index 0a9216feef..92d0ddc1c6 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00236_SeedsOfChaos/Q00236_SeedsOfChaos.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00236_SeedsOfChaos/Q00236_SeedsOfChaos.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.util.Util; * Seeds Of Chaos (236) * @author ivantotov */ -public final class Q00236_SeedsOfChaos extends Quest -{ +public final class Q00236_SeedsOfChaos extends Quest { // NPCs private static final int KURSTIN = 31387; private static final int MYSTERIOU_WIZARD = 31522; @@ -72,8 +71,7 @@ public final class Q00236_SeedsOfChaos extends Quest // Misc private static final int MIN_LEVEL = 75; - public Q00236_SeedsOfChaos() - { + public Q00236_SeedsOfChaos() { super(236, Q00236_SeedsOfChaos.class.getSimpleName(), "Seeds Of Chaos"); addStartNpc(HIERARCH_KEKROPUS); addTalkId(HIERARCH_KEKROPUS, KURSTIN, MYSTERIOU_WIZARD, VICE_HIERARCH_MAO, KATENAR, HARKILGAMED, RODENPICULA, ROCK, MOTHER_NORNIL, KATENAR_A, KATENAR_B, HARKILGAMED_A); @@ -83,83 +81,60 @@ public final class Q00236_SeedsOfChaos extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if ("KATENAR_120".equals(event)) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if ("KATENAR_120".equals(event)) { final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class); final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class); - if (npc0 != null) - { - if (npc0.getVariables().getBoolean("SPAWNED")) - { + if (npc0 != null) { + if (npc0.getVariables().getBoolean("SPAWNED")) { npc0.getVariables().set("SPAWNED", false); - if (c0 != null) - { + if (c0 != null) { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.HMM_WHERE_DID_MY_FRIEND_GO)); } } } npc.deleteMe(); return super.onAdvEvent(event, npc, player); - } - else if ("HARKILGAMED_120".equals(event)) - { + } else if ("HARKILGAMED_120".equals(event)) { final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class); - if (npc0 != null) - { - if (npc0.getVariables().getBoolean("SPAWNED")) - { + if (npc0 != null) { + if (npc0.getVariables().getBoolean("SPAWNED")) { npc0.getVariables().set("SPAWNED", false); npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.GRAAAH_WERE_BEING_ATTACKED)); } } npc.deleteMe(); return super.onAdvEvent(event, npc, player); - } - else if ("KATENAR_A_120".equals(event)) - { + } else if ("KATENAR_A_120".equals(event)) { final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class); final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class); - if (npc0 != null) - { - if (npc0.getVariables().getBoolean("SPAWNED")) - { + if (npc0 != null) { + if (npc0.getVariables().getBoolean("SPAWNED")) { npc0.getVariables().set("SPAWNED", false); - if (c0 != null) - { + if (c0 != null) { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.HMM_WHERE_DID_MY_FRIEND_GO)); } } } npc.deleteMe(); return super.onAdvEvent(event, npc, player); - } - else if ("KATENAR_B_120".equals(event)) - { + } else if ("KATENAR_B_120".equals(event)) { final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class); final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class); - if (npc0 != null) - { - if (npc0.getVariables().getBoolean("SPAWNED")) - { + if (npc0 != null) { + if (npc0.getVariables().getBoolean("SPAWNED")) { npc0.getVariables().set("SPAWNED", false); - if (c0 != null) - { + if (c0 != null) { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.HMM_WHERE_DID_MY_FRIEND_GO)); } } } npc.deleteMe(); return super.onAdvEvent(event, npc, player); - } - else if ("HARKILGAMED_A_120".equals(event)) - { + } else if ("HARKILGAMED_A_120".equals(event)) { final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class); - if (npc0 != null) - { - if (npc0.getVariables().getBoolean("SPAWNED")) - { + if (npc0 != null) { + if (npc0.getVariables().getBoolean("SPAWNED")) { npc0.getVariables().set("SPAWNED", false); npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.GRAAAH_WERE_BEING_ATTACKED)); } @@ -169,104 +144,79 @@ public final class Q00236_SeedsOfChaos extends Quest } final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "32138-04.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "32138-04.htm": { + if (qs.isCreated()) { qs.setMemoState(1); qs.startQuest(); htmltext = event; } break; } - case "32138-03.htm": - { - if ((player.getLevel() >= MIN_LEVEL) && (player.getRace() == Race.KAMAEL) && hasQuestItems(player, STAR_OF_DESTINY)) - { + case "32138-03.htm": { + if ((player.getLevel() >= MIN_LEVEL) && (player.getRace() == Race.KAMAEL) && hasQuestItems(player, STAR_OF_DESTINY)) { htmltext = event; } break; } - case "32138-12.html": - { - if (qs.isMemoState(30)) - { + case "32138-12.html": { + if (qs.isMemoState(30)) { qs.setMemoState(40); qs.setCond(15, true); htmltext = event; } break; } - case "31387-03.html": - { - if (qs.isMemoState(11)) - { + case "31387-03.html": { + if (qs.isMemoState(11)) { takeItems(player, BLOOD_JEWEL, -1); qs.setMemoState(12); htmltext = event; } break; } - case "31387-05a.html": - { - if (qs.isMemoState(12)) - { - if (player.hasQuestCompleted(Q00025_HidingBehindTheTruth.class.getSimpleName())) - { + case "31387-05a.html": { + if (qs.isMemoState(12)) { + if (player.hasQuestCompleted(Q00025_HidingBehindTheTruth.class.getSimpleName())) { htmltext = event; - } - else - { + } else { htmltext = "31387-05b.html"; } } break; } - case "31387-10.html": - { - if (qs.isMemoState(12)) - { + case "31387-10.html": { + if (qs.isMemoState(12)) { qs.setMemoState(20); qs.setMemoStateEx(1, 1); qs.setCond(11, true); htmltext = event; - } - else if (qs.isMemoState(20) && (qs.getMemoStateEx(1) == 1)) - { + } else if (qs.isMemoState(20) && (qs.getMemoStateEx(1) == 1)) { htmltext = event; } break; } - case "31522-04a.html": - { - if (qs.isMemoState(1)) - { + case "31522-04a.html": { + if (qs.isMemoState(1)) { htmltext = event; } break; } - case "31522-05a.html": - { - if (qs.isMemoState(1)) - { + case "31522-05a.html": { + if (qs.isMemoState(1)) { qs.setMemoState(2); qs.setCond(2, true); htmltext = event; } break; } - case "31522-05b.html": - { - if (qs.isMemoState(1)) - { + case "31522-05b.html": { + if (qs.isMemoState(1)) { qs.setMemoState(3); qs.setMemoStateEx(1, 0); qs.setCond(6, true); @@ -274,10 +224,8 @@ public final class Q00236_SeedsOfChaos extends Quest } break; } - case "31522-09a.html": - { - if (qs.isMemoState(2) && hasQuestItems(player, BLACK_ECHO_CRYSTAL)) - { + case "31522-09a.html": { + if (qs.isMemoState(2) && hasQuestItems(player, BLACK_ECHO_CRYSTAL)) { takeItems(player, BLACK_ECHO_CRYSTAL, -1); qs.setMemoState(6); qs.setCond(4, true); @@ -285,82 +233,59 @@ public final class Q00236_SeedsOfChaos extends Quest } break; } - case "31522-12a.html": - { - if (qs.isMemoState(6)) - { - if (!npc.getVariables().getBoolean("SPAWNED", false)) - { + case "31522-12a.html": { + if (qs.isMemoState(6)) { + if (!npc.getVariables().getBoolean("SPAWNED", false)) { npc.getVariables().set("SPAWNED", true); npc.getVariables().set("PLAYER_ID", player.getObjectId()); final L2Npc katenar = addSpawn(KATENAR, player.getX() + 10, player.getY() + 10, player.getZ(), +10, false, 0); katenar.getVariables().set("npc0", npc); katenar.getVariables().set("player0", player); htmltext = event; - } - else if (npc.getVariables().getInt("PLAYER_ID") == player.getObjectId()) - { + } else if (npc.getVariables().getInt("PLAYER_ID") == player.getObjectId()) { htmltext = "31522-13a.html"; - } - else - { + } else { htmltext = "31522-14a.html"; } } break; } - case "31522-09b.html": - { - if (qs.isMemoState(3) && (qs.getMemoStateEx(1) == 2)) - { - if (!npc.getVariables().getBoolean("SPAWNED", false)) - { + case "31522-09b.html": { + if (qs.isMemoState(3) && (qs.getMemoStateEx(1) == 2)) { + if (!npc.getVariables().getBoolean("SPAWNED", false)) { npc.getVariables().set("SPAWNED", true); npc.getVariables().set("PLAYER_ID", player.getObjectId()); final L2Npc katenar = addSpawn(KATENAR_A, player.getX() + 10, player.getY() + 10, player.getZ(), +10, false, 0); katenar.getVariables().set("npc0", npc); katenar.getVariables().set("player0", player); htmltext = event; - } - else if (npc.getVariables().getInt("PLAYER_ID") == player.getObjectId()) - { + } else if (npc.getVariables().getInt("PLAYER_ID") == player.getObjectId()) { htmltext = "31522-10b.html"; - } - else - { + } else { htmltext = "31522-11b.html"; } } break; } - case "31522-14b.html": - { - if (qs.isMemoState(7) && hasQuestItems(player, BLOOD_JEWEL)) - { - if (!npc.getVariables().getBoolean("SPAWNED", false)) - { + case "31522-14b.html": { + if (qs.isMemoState(7) && hasQuestItems(player, BLOOD_JEWEL)) { + if (!npc.getVariables().getBoolean("SPAWNED", false)) { npc.getVariables().set("SPAWNED", true); npc.getVariables().set("PLAYER_ID", player.getObjectId()); final L2Npc katenar = addSpawn(KATENAR_B, player.getX() + 10, player.getY() + 10, player.getZ(), +10, false, 0); katenar.getVariables().set("npc0", npc); katenar.getVariables().set("player0", player); htmltext = event; - } - else if (npc.getVariables().getInt("PLAYER_ID") == player.getObjectId()) - { + } else if (npc.getVariables().getInt("PLAYER_ID") == player.getObjectId()) { htmltext = "31522-15b.html"; - } - else - { + } else { htmltext = "31522-15bz.html"; } } break; } - case "32235-09a.html": - { - if (qs.isMemoState(6)) - { + case "32235-09a.html": { + if (qs.isMemoState(6)) { qs.setMemoState(20); qs.setMemoStateEx(1, 0); qs.setCond(5, true); @@ -368,13 +293,10 @@ public final class Q00236_SeedsOfChaos extends Quest } break; } - case "32236-07.html": - { - if (qs.isMemoState(20)) - { + case "32236-07.html": { + if (qs.isMemoState(20)) { final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class); - if (c0 != null) - { + if (c0 != null) { qs.setMemoState(21); qs.setMemoStateEx(1, 0); qs.setCond(12, true); @@ -383,38 +305,30 @@ public final class Q00236_SeedsOfChaos extends Quest } break; } - case "32237-10.html": - { - if (qs.isMemoState(40)) - { + case "32237-10.html": { + if (qs.isMemoState(40)) { htmltext = event; } break; } - case "32237-11.html": - { - if (qs.isMemoState(40)) - { + case "32237-11.html": { + if (qs.isMemoState(40)) { qs.setMemoState(42); qs.setCond(17, true); htmltext = event; } break; } - case "32237-13.html": - { - if (qs.isMemoState(43)) - { + case "32237-13.html": { + if (qs.isMemoState(43)) { qs.setMemoState(44); qs.setCond(19, true); htmltext = event; } break; } - case "32237-17.html": - { - if (qs.isMemoState(45)) - { + case "32237-17.html": { + if (qs.isMemoState(45)) { giveItems(player, SCROLL_ENCHANT_WEAPON_A_GRADE, 1); takeItems(player, STAR_OF_DESTINY, 1); qs.exitQuest(false, true); @@ -422,81 +336,60 @@ public final class Q00236_SeedsOfChaos extends Quest } break; } - case "32238-02.html": - { - if (qs.isMemoState(20)) - { - if (!npc.getVariables().getBoolean("SPAWNED", false)) - { + case "32238-02.html": { + if (qs.isMemoState(20)) { + if (!npc.getVariables().getBoolean("SPAWNED", false)) { npc.getVariables().set("SPAWNED", true); npc.getVariables().set("PLAYER_ID", player.getObjectId()); final L2Npc kamael = addSpawn(HARKILGAMED, 71722, -78853, -4464, 0, false, 0); kamael.getVariables().set("npc0", npc); kamael.getVariables().set("player0", player); htmltext = event; - } - else if (npc.getVariables().getInt("PLAYER_ID") == player.getObjectId()) - { + } else if (npc.getVariables().getInt("PLAYER_ID") == player.getObjectId()) { htmltext = "32238-03.html"; - } - else - { + } else { htmltext = "32238-04z.html"; } } break; } - case "32238-06.html": - { - if (qs.isMemoState(22)) - { - if (!npc.getVariables().getBoolean("SPAWNED", false)) - { + case "32238-06.html": { + if (qs.isMemoState(22)) { + if (!npc.getVariables().getBoolean("SPAWNED", false)) { npc.getVariables().set("SPAWNED", true); npc.getVariables().set("PLAYER_ID", player.getObjectId()); final L2Npc kamael = addSpawn(HARKILGAMED_A, 71722, -78853, -4464, 0, false, 0); kamael.getVariables().set("npc0", npc); kamael.getVariables().set("player0", player); htmltext = event; - } - else if (npc.getVariables().getInt("PLAYER_ID") == player.getObjectId()) - { + } else if (npc.getVariables().getInt("PLAYER_ID") == player.getObjectId()) { htmltext = "32238-07.html"; - } - else - { + } else { htmltext = "32238-08.html"; } } break; } - case "32239-04.html": - { - if (qs.isMemoState(42)) - { + case "32239-04.html": { + if (qs.isMemoState(42)) { qs.setMemoState(43); qs.setCond(18, true); htmltext = event; } break; } - case "32239-08.html": - { - if (qs.isMemoState(44)) - { + case "32239-08.html": { + if (qs.isMemoState(44)) { qs.setMemoState(45); qs.setCond(20, true); htmltext = event; } break; } - case "32332-05b.html": - { - if (qs.isMemoState(3) && (qs.getMemoStateEx(1) == 2)) - { + case "32332-05b.html": { + if (qs.isMemoState(3) && (qs.getMemoStateEx(1) == 2)) { final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class); - if (c0 != null) - { + if (c0 != null) { qs.setMemoState(7); qs.setMemoStateEx(1, 0); qs.setCond(8, true); @@ -505,13 +398,10 @@ public final class Q00236_SeedsOfChaos extends Quest } break; } - case "32334-17.html": - { - if (qs.isMemoState(22)) - { + case "32334-17.html": { + if (qs.isMemoState(22)) { final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class); - if (c0 != null) - { + if (c0 != null) { takeItems(player, SHINING_MEDALLION, -1); qs.setMemoState(30); qs.setCond(14, true); @@ -520,16 +410,12 @@ public final class Q00236_SeedsOfChaos extends Quest } break; } - case "KEITNAR_DESPAWN": - { - if (qs.isMemoState(20) && (qs.getMemoStateEx(1) == 0)) - { + case "KEITNAR_DESPAWN": { + if (qs.isMemoState(20) && (qs.getMemoStateEx(1) == 0)) { final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class); final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class); - if (player == c0) - { - if (npc0 != null) - { + if (player == c0) { + if (npc0 != null) { npc0.getVariables().set("SPAWNED", false); } npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.BEST_OF_LUCK_WITH_YOUR_FUTURE_ENDEAVOURS)); @@ -538,16 +424,12 @@ public final class Q00236_SeedsOfChaos extends Quest } break; } - case "HARKILGAMED_DESPAWN": - { - if (qs.isMemoState(21)) - { + case "HARKILGAMED_DESPAWN": { + if (qs.isMemoState(21)) { final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class); final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class); - if (player == c0) - { - if (npc0 != null) - { + if (player == c0) { + if (npc0 != null) { npc0.getVariables().set("SPAWNED", false); } npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.IN_THAT_CASE_I_WISH_YOU_GOOD_LUCK)); @@ -556,14 +438,11 @@ public final class Q00236_SeedsOfChaos extends Quest } break; } - case "KEITNAR_A_DESPAWN": - { + case "KEITNAR_A_DESPAWN": { final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class); final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class); - if (player == c0) - { - if (npc0 != null) - { + if (player == c0) { + if (npc0 != null) { npc0.getVariables().set("SPAWNED", false); } npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.BEST_OF_LUCK_WITH_YOUR_FUTURE_ENDEAVOURS)); @@ -571,16 +450,12 @@ public final class Q00236_SeedsOfChaos extends Quest } break; } - case "KEITNAR_B_DESPAWN": - { - if (qs.isMemoState(11) && hasQuestItems(player, BLOOD_JEWEL)) - { + case "KEITNAR_B_DESPAWN": { + if (qs.isMemoState(11) && hasQuestItems(player, BLOOD_JEWEL)) { final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class); final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class); - if (player == c0) - { - if (npc0 != null) - { + if (player == c0) { + if (npc0 != null) { npc0.getVariables().set("SPAWNED", false); } npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.BEST_OF_LUCK_WITH_YOUR_FUTURE_ENDEAVOURS)); @@ -589,16 +464,12 @@ public final class Q00236_SeedsOfChaos extends Quest } break; } - case "HARKILGAMED_A_DESPAWN": - { - if (qs.isMemoState(30)) - { + case "HARKILGAMED_A_DESPAWN": { + if (qs.isMemoState(30)) { final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class); final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class); - if (player == c0) - { - if (npc0 != null) - { + if (player == c0) { + if (npc0 != null) { npc0.getVariables().set("SPAWNED", false); } npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.SAFE_TRAVELS)); @@ -653,8 +524,7 @@ public final class Q00236_SeedsOfChaos extends Quest case "32334-13.html": case "32334-14.html": case "32334-15.html": - case "32334-16.html": - { + case "32334-16.html": { htmltext = event; break; } @@ -663,19 +533,13 @@ public final class Q00236_SeedsOfChaos extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case NEEDLE_STAKATO_DRONE: - { - if (qs.isMemoState(2) && !hasQuestItems(killer, BLACK_ECHO_CRYSTAL)) - { - if (getRandom(100) < 20) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case NEEDLE_STAKATO_DRONE: { + if (qs.isMemoState(2) && !hasQuestItems(killer, BLACK_ECHO_CRYSTAL)) { + if (getRandom(100) < 20) { giveItems(killer, BLACK_ECHO_CRYSTAL, 1); qs.setCond(3, true); } @@ -690,20 +554,14 @@ public final class Q00236_SeedsOfChaos extends Quest case FANG_OF_SPLENDOR: case FANG_OF_SPLENDOR_1: case WAILINGOF_SPLENDOR: - case WAILINGOF_SPLENDOR_1: - { - if (qs.isMemoState(21) && (getQuestItemsCount(killer, SHINING_MEDALLION) < 62)) - { - if (getRandom(100) < 70) - { + case WAILINGOF_SPLENDOR_1: { + if (qs.isMemoState(21) && (getQuestItemsCount(killer, SHINING_MEDALLION) < 62)) { + if (getRandom(100) < 70) { giveItems(killer, SHINING_MEDALLION, 1); - if (getQuestItemsCount(killer, SHINING_MEDALLION) == 62) - { + if (getQuestItemsCount(killer, SHINING_MEDALLION) == 62) { qs.setMemoState(22); qs.setCond(13, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -711,12 +569,9 @@ public final class Q00236_SeedsOfChaos extends Quest break; } case VAMPIRE_WIZARD: - case VAMPIRE_WIZARD_A: - { - if (qs.isMemoState(7) && !hasQuestItems(killer, BLOOD_JEWEL)) - { - if (getRandom(100) < 8) - { + case VAMPIRE_WIZARD_A: { + if (qs.isMemoState(7) && !hasQuestItems(killer, BLOOD_JEWEL)) { + if (getRandom(100) < 8) { giveItems(killer, BLOOD_JEWEL, 1); qs.setCond(9, true); } @@ -729,82 +584,56 @@ public final class Q00236_SeedsOfChaos extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == HIERARCH_KEKROPUS) - { - if (player.getLevel() >= MIN_LEVEL) - { - if (player.getRace() == Race.KAMAEL) - { - if (hasQuestItems(player, STAR_OF_DESTINY)) - { + if (qs.isCreated()) { + if (npc.getId() == HIERARCH_KEKROPUS) { + if (player.getLevel() >= MIN_LEVEL) { + if (player.getRace() == Race.KAMAEL) { + if (hasQuestItems(player, STAR_OF_DESTINY)) { htmltext = "32138-01.htm"; - } - else - { + } else { htmltext = "32138-01x.html"; } - } - else - { + } else { htmltext = "32138-01y.html"; } - } - else - { + } else { htmltext = "32138-01z.html"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case HIERARCH_KEKROPUS: - { - switch (qs.getMemoState()) - { - case 1: - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case HIERARCH_KEKROPUS: { + switch (qs.getMemoState()) { + case 1: { htmltext = "32138-05.html"; break; } - case 30: - { + case 30: { htmltext = "32138-06.html"; break; } - case 40: - { + case 40: { htmltext = "32138-13.html"; break; } } break; } - case KURSTIN: - { - switch (qs.getMemoState()) - { - case 11: - { + case KURSTIN: { + switch (qs.getMemoState()) { + case 11: { htmltext = "31387-01.html"; break; } - case 12: - { + case 12: { htmltext = "31387-04.html"; break; } - case 20: - { - if (qs.getMemoStateEx(1) == 1) - { + case 20: { + if (qs.getMemoStateEx(1) == 1) { htmltext = "31387-11.html"; } break; @@ -812,110 +641,79 @@ public final class Q00236_SeedsOfChaos extends Quest } break; } - case MYSTERIOU_WIZARD: - { - switch (qs.getMemoState()) - { - case 1: - { + case MYSTERIOU_WIZARD: { + switch (qs.getMemoState()) { + case 1: { htmltext = "31522-01.html"; break; } - case 2: - { - if (!hasQuestItems(player, BLACK_ECHO_CRYSTAL)) - { + case 2: { + if (!hasQuestItems(player, BLACK_ECHO_CRYSTAL)) { htmltext = "31522-06a.html"; - } - else - { + } else { htmltext = "31522-07a.html"; } break; } - case 6: - { + case 6: { htmltext = "31522-10a.html"; break; } - case 20: - { - if (qs.getMemoStateEx(1) == 0) - { + case 20: { + if (qs.getMemoStateEx(1) == 0) { htmltext = "31522-15a.html"; } break; } - case 3: - { - if (qs.getMemoStateEx(1) == 0) - { + case 3: { + if (qs.getMemoStateEx(1) == 0) { qs.setMemoStateEx(1, 1); htmltext = "31522-06b.html"; - } - else if (qs.getMemoStateEx(1) == 1) - { + } else if (qs.getMemoStateEx(1) == 1) { qs.setMemoStateEx(1, 2); qs.setCond(7, true); htmltext = "31522-07b.html"; - } - else if (qs.getMemoStateEx(1) == 2) - { + } else if (qs.getMemoStateEx(1) == 2) { htmltext = "31522-08b.html"; } break; } - case 7: - { - if (!hasQuestItems(player, BLOOD_JEWEL)) - { + case 7: { + if (!hasQuestItems(player, BLOOD_JEWEL)) { htmltext = "31522-12b.html"; - } - else - { + } else { htmltext = "31522-13b.html"; } break; } - case 11: - { + case 11: { htmltext = "31522-16b.html"; break; } } break; } - case VICE_HIERARCH_MAO: - { - if ((qs.getMemoState() >= 40) && (qs.getMemoState() <= 45)) - { + case VICE_HIERARCH_MAO: { + if ((qs.getMemoState() >= 40) && (qs.getMemoState() <= 45)) { htmltext = "32190-01.html"; } break; } - case KATENAR: - { - switch (qs.getMemoState()) - { - case 6: - { + case KATENAR: { + switch (qs.getMemoState()) { + case 6: { final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class); final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class); npc0.getVariables().set("SPAWNED", false); - if (player == c0) - { + if (player == c0) { htmltext = "32235-01a.html"; - } - else - { + } else { htmltext = "32235-01z.html"; } break; } - case 20: - { - if (qs.getMemoStateEx(1) == 0) - { + case 20: { + if (qs.getMemoStateEx(1) == 0) { htmltext = "32235-09z.html"; } break; @@ -923,155 +721,118 @@ public final class Q00236_SeedsOfChaos extends Quest } break; } - case HARKILGAMED: - { - switch (qs.getMemoState()) - { - case 20: - { + case HARKILGAMED: { + switch (qs.getMemoState()) { + case 20: { final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class); final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class); npc0.getVariables().set("SPAWNED", false); - if (player == c0) - { + if (player == c0) { htmltext = "32236-01.html"; - } - else - { + } else { htmltext = "32236-02.html"; } break; } - case 21: - { + case 21: { htmltext = "32236-07z.html"; break; } - case 22: - { + case 22: { htmltext = "32236-08z.html"; break; } } break; } - case RODENPICULA: - { - switch (qs.getMemoState()) - { - case 40: - { + case RODENPICULA: { + switch (qs.getMemoState()) { + case 40: { htmltext = "32237-01.html"; break; } - case 42: - { + case 42: { htmltext = "32237-11a.html"; break; } - case 43: - { + case 43: { htmltext = "32237-12.html"; break; } - case 44: - { + case 44: { htmltext = "32237-14.html"; break; } - case 45: - { + case 45: { htmltext = "32237-15.html"; break; } } break; } - case ROCK: - { - switch (qs.getMemoState()) - { - case 20: - { + case ROCK: { + switch (qs.getMemoState()) { + case 20: { htmltext = "32238-01.html"; break; } - case 21: - { + case 21: { htmltext = "32238-04.html"; break; } - case 22: - { + case 22: { htmltext = "32238-05.html"; break; } - case 30: - { + case 30: { htmltext = "32238-09.html"; break; } } break; } - case MOTHER_NORNIL: - { - switch (qs.getMemoState()) - { - case 40: - { + case MOTHER_NORNIL: { + switch (qs.getMemoState()) { + case 40: { htmltext = "32239-01.html"; break; } - case 42: - { + case 42: { htmltext = "32239-02.html"; break; } - case 43: - { + case 43: { htmltext = "32239-05.html"; break; } - case 44: - { + case 44: { htmltext = "32239-06.html"; break; } - case 45: - { + case 45: { htmltext = "32239-09.html"; break; } } break; } - case KATENAR_A: - { - switch (qs.getMemoState()) - { - case 3: - { - if (qs.getMemoStateEx(1) == 2) - { + case KATENAR_A: { + switch (qs.getMemoState()) { + case 3: { + if (qs.getMemoStateEx(1) == 2) { final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class); final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class); npc0.getVariables().set("SPAWNED", false); - if (player == c0) - { + if (player == c0) { htmltext = "32332-01b.html"; - } - else - { + } else { htmltext = "32332-01z.html"; } } break; } - case 7: - { - if (!hasQuestItems(player, BLOOD_JEWEL)) - { + case 7: { + if (!hasQuestItems(player, BLOOD_JEWEL)) { htmltext = "32332-05z.html"; } break; @@ -1079,25 +840,18 @@ public final class Q00236_SeedsOfChaos extends Quest } break; } - case KATENAR_B: - { - switch (qs.getMemoState()) - { - case 7: - { - if (hasQuestItems(player, BLOOD_JEWEL)) - { + case KATENAR_B: { + switch (qs.getMemoState()) { + case 7: { + if (hasQuestItems(player, BLOOD_JEWEL)) { final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class); final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class); npc0.getVariables().set("SPAWNED", false); - if (player == c0) - { + if (player == c0) { qs.setMemoState(11); qs.setCond(10, true); htmltext = "32333-06bz.html"; - } - else - { + } else { qs.setMemoState(11); qs.setCond(10, true); htmltext = "32333-06b.html"; @@ -1105,35 +859,27 @@ public final class Q00236_SeedsOfChaos extends Quest } break; } - case 11: - { + case 11: { htmltext = "32333-06b.html"; break; } } break; } - case HARKILGAMED_A: - { - switch (qs.getMemoState()) - { - case 22: - { + case HARKILGAMED_A: { + switch (qs.getMemoState()) { + case 22: { final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class); final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class); npc0.getVariables().set("SPAWNED", false); - if (player == c0) - { + if (player == c0) { htmltext = "32334-08.html"; - } - else - { + } else { htmltext = "32334-09.html"; } break; } - case 30: - { + case 30: { htmltext = "32334-18.html"; break; } @@ -1141,11 +887,8 @@ public final class Q00236_SeedsOfChaos extends Quest break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == HIERARCH_KEKROPUS) - { + } else if (qs.isCompleted()) { + if (npc.getId() == HIERARCH_KEKROPUS) { htmltext = getAlreadyCompletedMsg(player); } } @@ -1153,52 +896,41 @@ public final class Q00236_SeedsOfChaos extends Quest } @Override - public String onSpawn(L2Npc npc) - { - switch (npc.getId()) - { - case KATENAR: - { + public String onSpawn(L2Npc npc) { + switch (npc.getId()) { + case KATENAR: { final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class); startQuestTimer("KATENAR_120", 120000, npc, null); - if (c0 != null) - { + if (c0 != null) { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.S1_FINALLY_WE_MEET).addStringParameter(c0.getAppearance().getVisibleName())); } break; } - case HARKILGAMED: - { + case HARKILGAMED: { startQuestTimer("HARKILGAMED_120", 120000, npc, null); npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.HMM_IS_SOMEONE_APPROACHING)); break; } - case KATENAR_A: - { + case KATENAR_A: { final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class); startQuestTimer("KATENAR_A_120", 120000, npc, null); - if (c0 != null) - { + if (c0 != null) { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.S1_DID_YOU_WAIT_FOR_LONG).addStringParameter(c0.getAppearance().getVisibleName())); } break; } - case KATENAR_B: - { + case KATENAR_B: { final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class); startQuestTimer("KATENAR_B_120", 120000, npc, null); - if (c0 != null) - { + if (c0 != null) { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.DID_YOU_BRING_WHAT_I_ASKED_S1).addStringParameter(c0.getAppearance().getVisibleName())); } break; } - case HARKILGAMED_A: - { + case HARKILGAMED_A: { final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class); startQuestTimer("HARKILGAMED_A_120", 120000, npc, null); - if (c0 != null) - { + if (c0 != null) { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.S1_HAS_EVERYTHING_BEEN_FOUND).addStringParameter(c0.getAppearance().getVisibleName())); } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00237_WindsOfChange/Q00237_WindsOfChange.java b/src/main/java/com/l2jserver/datapack/quests/Q00237_WindsOfChange/Q00237_WindsOfChange.java index 972eb60f9c..5bd27c04fc 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00237_WindsOfChange/Q00237_WindsOfChange.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00237_WindsOfChange/Q00237_WindsOfChange.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by Bloodshed. * @author Joxit */ -public class Q00237_WindsOfChange extends Quest -{ +public class Q00237_WindsOfChange extends Quest { // NPCs private static final int FLAUEN = 30899; private static final int IASON = 30969; @@ -49,8 +48,7 @@ public class Q00237_WindsOfChange extends Quest // Misc private static final int MIN_LEVEL = 82; - public Q00237_WindsOfChange() - { + public Q00237_WindsOfChange() { super(237, Q00237_WindsOfChange.class.getSimpleName(), "Winds of Change"); addStartNpc(FLAUEN); addTalkId(FLAUEN, IASON, ROMAN, MORELYN, HELVETICA, ATHENIA); @@ -58,17 +56,14 @@ public class Q00237_WindsOfChange extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "30899-02.htm":// FLAUEN case "30899-03.htm": case "30899-04.htm": @@ -95,37 +90,32 @@ public class Q00237_WindsOfChange extends Quest htmltext = event; break; case "30969-05.html": - if (st.isCond(1)) - { + if (st.isCond(1)) { st.setCond(2, true); htmltext = event; } break; case "30897-03.html": - if (st.isCond(2)) - { + if (st.isCond(2)) { st.setCond(3, true); htmltext = event; } break; case "30925-03.html": - if (st.isCond(3)) - { + if (st.isCond(3)) { st.setCond(4, true); htmltext = event; } break; case "30969-09.html": - if (st.isCond(4)) - { + if (st.isCond(4)) { st.giveItems(DOSKOZER_LETTER, 1); st.setCond(5, true); htmltext = event; } break; case "30969-10.html": - if (st.isCond(4)) - { + if (st.isCond(4)) { st.giveItems(ATHENIA_LETTER, 1); st.setCond(6, true); htmltext = event; @@ -150,15 +140,12 @@ public class Q00237_WindsOfChange extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { String htmltext = getNoQuestMsg(talker); final QuestState st = getQuestState(talker, true); - switch (npc.getId()) - { + switch (npc.getId()) { case FLAUEN: - switch (st.getState()) - { + switch (st.getState()) { case State.COMPLETED: htmltext = "30899-09.html"; break; @@ -166,8 +153,7 @@ public class Q00237_WindsOfChange extends Quest htmltext = (talker.getLevel() >= MIN_LEVEL) ? "30899-01.htm" : "30899-00.html"; break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: case 4: htmltext = "30899-07.html"; @@ -186,14 +172,10 @@ public class Q00237_WindsOfChange extends Quest } break; case IASON: - if (st.isCompleted()) - { + if (st.isCompleted()) { htmltext = Quest.getNoQuestMsg(talker); - } - else - { - switch (st.getCond()) - { + } else { + switch (st.getCond()) { case 1: htmltext = "30969-01.html"; break; @@ -211,8 +193,7 @@ public class Q00237_WindsOfChange extends Quest } break; case ROMAN: - switch (st.getCond()) - { + switch (st.getCond()) { case 2: htmltext = "30897-01.html"; break; @@ -223,8 +204,7 @@ public class Q00237_WindsOfChange extends Quest } break; case MORELYN: - switch (st.getCond()) - { + switch (st.getCond()) { case 3: htmltext = "30925-01.html"; break; @@ -234,30 +214,20 @@ public class Q00237_WindsOfChange extends Quest } break; case HELVETICA: - if (st.isCompleted()) - { + if (st.isCompleted()) { htmltext = (st.hasQuestItems(VICINITY_OF_FOS) || st.getPlayer().hasQuestCompleted(Q00238_SuccessFailureOfBusiness.class.getSimpleName())) ? "32641-03.html" : "32641-05.html"; - } - else if (st.isCond(5)) - { + } else if (st.isCond(5)) { htmltext = "32641-01.html"; - } - else if (st.isCond(6)) - { + } else if (st.isCond(6)) { htmltext = "32641-04.html"; } break; case ATHENIA: - if (st.isCompleted()) - { + if (st.isCompleted()) { htmltext = (st.hasQuestItems(SUPPORT_CERTIFICATE) || st.getPlayer().hasQuestCompleted(Q00239_WontYouJoinUs.class.getSimpleName())) ? "32643-03.html" : "32643-05.html"; - } - else if (st.isCond(5)) - { + } else if (st.isCond(5)) { htmltext = "32643-04.html"; - } - else if (st.isCond(6)) - { + } else if (st.isCond(6)) { htmltext = "32643-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00238_SuccessFailureOfBusiness/Q00238_SuccessFailureOfBusiness.java b/src/main/java/com/l2jserver/datapack/quests/Q00238_SuccessFailureOfBusiness/Q00238_SuccessFailureOfBusiness.java index 4170467e24..52b8a35c1a 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00238_SuccessFailureOfBusiness/Q00238_SuccessFailureOfBusiness.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00238_SuccessFailureOfBusiness/Q00238_SuccessFailureOfBusiness.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by Bloodshed. * @author Joxit */ -public class Q00238_SuccessFailureOfBusiness extends Quest -{ +public class Q00238_SuccessFailureOfBusiness extends Quest { // NPCs private static final int HELVETICA = 32641; // Mobs @@ -49,8 +48,7 @@ public class Q00238_SuccessFailureOfBusiness extends Quest private static final int CHANCE_FOR_FRAGMENT = 80; private static final int MIN_LEVEL = 82; - public Q00238_SuccessFailureOfBusiness() - { + public Q00238_SuccessFailureOfBusiness() { super(238, Q00238_SuccessFailureOfBusiness.class.getSimpleName(), "Success/Failure Of Business"); addStartNpc(HELVETICA); addTalkId(HELVETICA); @@ -59,17 +57,14 @@ public class Q00238_SuccessFailureOfBusiness extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "32461-02.htm": htmltext = event; break; @@ -78,8 +73,7 @@ public class Q00238_SuccessFailureOfBusiness extends Quest htmltext = event; break; case "32461-06.html": - if (st.isCond(2)) - { + if (st.isCond(2)) { st.setCond(3, true); htmltext = event; } @@ -89,44 +83,30 @@ public class Q00238_SuccessFailureOfBusiness extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (npc.getId() == BRAZIER_OF_PURITY) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (npc.getId() == BRAZIER_OF_PURITY) { final L2PcInstance partyMember = getRandomPartyMember(killer, 1); - if (partyMember != null) - { + if (partyMember != null) { final QuestState st = getQuestState(partyMember, false); - if (st.getQuestItemsCount(BROKEN_PIECE_OF_MAGIC_FORCE) < BROKEN_PIECE_OF_MAGIC_FORCE_NEEDED) - { + if (st.getQuestItemsCount(BROKEN_PIECE_OF_MAGIC_FORCE) < BROKEN_PIECE_OF_MAGIC_FORCE_NEEDED) { st.giveItems(BROKEN_PIECE_OF_MAGIC_FORCE, 1); } - if (st.getQuestItemsCount(BROKEN_PIECE_OF_MAGIC_FORCE) == BROKEN_PIECE_OF_MAGIC_FORCE_NEEDED) - { + if (st.getQuestItemsCount(BROKEN_PIECE_OF_MAGIC_FORCE) == BROKEN_PIECE_OF_MAGIC_FORCE_NEEDED) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } - } - else - { + } else { final L2PcInstance partyMember = getRandomPartyMember(killer, 3); - if ((partyMember != null) && (getRandom(100) < CHANCE_FOR_FRAGMENT)) - { + if ((partyMember != null) && (getRandom(100) < CHANCE_FOR_FRAGMENT)) { final QuestState st = getQuestState(partyMember, false); - if (st.getQuestItemsCount(GUARDIAN_SPIRIT_FRAGMENT) < GUARDIAN_SPIRIT_FRAGMENT_NEEDED) - { + if (st.getQuestItemsCount(GUARDIAN_SPIRIT_FRAGMENT) < GUARDIAN_SPIRIT_FRAGMENT_NEEDED) { st.giveItems(GUARDIAN_SPIRIT_FRAGMENT, 1); } - if (st.getQuestItemsCount(GUARDIAN_SPIRIT_FRAGMENT) == GUARDIAN_SPIRIT_FRAGMENT_NEEDED) - { + if (st.getQuestItemsCount(GUARDIAN_SPIRIT_FRAGMENT) == GUARDIAN_SPIRIT_FRAGMENT_NEEDED) { st.setCond(4, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -135,38 +115,29 @@ public class Q00238_SuccessFailureOfBusiness extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { String htmltext = getNoQuestMsg(talker); final QuestState st = getQuestState(talker, true); - switch (st.getState()) - { + switch (st.getState()) { case State.COMPLETED: htmltext = "32461-09.html"; break; case State.CREATED: - if (st.getPlayer().hasQuestCompleted(Q00239_WontYouJoinUs.class.getSimpleName())) - { + if (st.getPlayer().hasQuestCompleted(Q00239_WontYouJoinUs.class.getSimpleName())) { htmltext = "32461-10.html"; - } - else if (st.getPlayer().hasQuestCompleted(Q00239_WontYouJoinUs.class.getSimpleName()) && (talker.getLevel() >= MIN_LEVEL) && st.hasQuestItems(VICINITY_OF_FOS)) - { + } else if (st.getPlayer().hasQuestCompleted(Q00239_WontYouJoinUs.class.getSimpleName()) && (talker.getLevel() >= MIN_LEVEL) && st.hasQuestItems(VICINITY_OF_FOS)) { htmltext = "32461-01.htm"; - } - else - { + } else { htmltext = "32461-00.html"; } break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "32461-04.html"; break; case 2: - if (st.getQuestItemsCount(BROKEN_PIECE_OF_MAGIC_FORCE) == BROKEN_PIECE_OF_MAGIC_FORCE_NEEDED) - { + if (st.getQuestItemsCount(BROKEN_PIECE_OF_MAGIC_FORCE) == BROKEN_PIECE_OF_MAGIC_FORCE_NEEDED) { htmltext = "32461-05.html"; st.takeItems(BROKEN_PIECE_OF_MAGIC_FORCE, -1); } @@ -175,8 +146,7 @@ public class Q00238_SuccessFailureOfBusiness extends Quest htmltext = "32461-07.html"; break; case 4: - if (st.getQuestItemsCount(GUARDIAN_SPIRIT_FRAGMENT) == GUARDIAN_SPIRIT_FRAGMENT_NEEDED) - { + if (st.getQuestItemsCount(GUARDIAN_SPIRIT_FRAGMENT) == GUARDIAN_SPIRIT_FRAGMENT_NEEDED) { htmltext = "32461-08.html"; st.giveAdena(283346, true); st.takeItems(VICINITY_OF_FOS, 1); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00239_WontYouJoinUs/Q00239_WontYouJoinUs.java b/src/main/java/com/l2jserver/datapack/quests/Q00239_WontYouJoinUs/Q00239_WontYouJoinUs.java index 711d8e57db..8781878ecd 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00239_WontYouJoinUs/Q00239_WontYouJoinUs.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00239_WontYouJoinUs/Q00239_WontYouJoinUs.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by Bloodshed. * @author Joxit */ -public class Q00239_WontYouJoinUs extends Quest -{ +public class Q00239_WontYouJoinUs extends Quest { // NPC private static final int ATHENIA = 32643; // Mobs @@ -50,8 +49,7 @@ public class Q00239_WontYouJoinUs extends Quest private static final int CHANCE_FOR_FRAGMENT = 80; private static final int MIN_LEVEL = 82; - public Q00239_WontYouJoinUs() - { + public Q00239_WontYouJoinUs() { super(239, Q00239_WontYouJoinUs.class.getSimpleName(), "Won't You Join Us?"); addStartNpc(ATHENIA); addTalkId(ATHENIA); @@ -60,17 +58,14 @@ public class Q00239_WontYouJoinUs extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "32643-02.htm": htmltext = event; break; @@ -79,8 +74,7 @@ public class Q00239_WontYouJoinUs extends Quest htmltext = event; break; case "32643-07.html": - if (st.isCond(2)) - { + if (st.isCond(2)) { st.setCond(3, true); htmltext = event; } @@ -90,44 +84,30 @@ public class Q00239_WontYouJoinUs extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (npc.getId() == WASTE_LANDFILL_MACHINE) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (npc.getId() == WASTE_LANDFILL_MACHINE) { final L2PcInstance partyMember = getRandomPartyMember(killer, 1); - if (partyMember != null) - { + if (partyMember != null) { final QuestState st = getQuestState(partyMember, false); - if (st.getQuestItemsCount(DESTROYED_MACHINE_PIECE) < DESTROYED_MACHINE_PIECE_NEEDED) - { + if (st.getQuestItemsCount(DESTROYED_MACHINE_PIECE) < DESTROYED_MACHINE_PIECE_NEEDED) { st.giveItems(DESTROYED_MACHINE_PIECE, 1); } - if (st.getQuestItemsCount(DESTROYED_MACHINE_PIECE) == DESTROYED_MACHINE_PIECE_NEEDED) - { + if (st.getQuestItemsCount(DESTROYED_MACHINE_PIECE) == DESTROYED_MACHINE_PIECE_NEEDED) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } - } - else - { + } else { final L2PcInstance partyMember = getRandomPartyMember(killer, 3); - if ((partyMember != null) && (getRandom(100) < CHANCE_FOR_FRAGMENT)) - { + if ((partyMember != null) && (getRandom(100) < CHANCE_FOR_FRAGMENT)) { final QuestState st = getQuestState(partyMember, false); - if (st.getQuestItemsCount(ENCHANTED_GOLEM_FRAGMENT) < ENCHANTED_GOLEM_FRAGMENT_NEEDED) - { + if (st.getQuestItemsCount(ENCHANTED_GOLEM_FRAGMENT) < ENCHANTED_GOLEM_FRAGMENT_NEEDED) { st.giveItems(ENCHANTED_GOLEM_FRAGMENT, 1); } - if (st.getQuestItemsCount(ENCHANTED_GOLEM_FRAGMENT) == ENCHANTED_GOLEM_FRAGMENT_NEEDED) - { + if (st.getQuestItemsCount(ENCHANTED_GOLEM_FRAGMENT) == ENCHANTED_GOLEM_FRAGMENT_NEEDED) { st.setCond(4, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -136,39 +116,30 @@ public class Q00239_WontYouJoinUs extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { String htmltext = getNoQuestMsg(talker); final QuestState st = getQuestState(talker, true); - switch (st.getState()) - { + switch (st.getState()) { case State.COMPLETED: htmltext = "32643-11.html"; break; case State.CREATED: - if (st.getPlayer().hasQuestCompleted(Q00238_SuccessFailureOfBusiness.class.getSimpleName())) - { + if (st.getPlayer().hasQuestCompleted(Q00238_SuccessFailureOfBusiness.class.getSimpleName())) { htmltext = "32643-12.html"; - } - else if (st.getPlayer().hasQuestCompleted(Q00237_WindsOfChange.class.getSimpleName()) && (talker.getLevel() >= MIN_LEVEL) && st.hasQuestItems(SUPPORT_CERTIFICATE)) - { + } else if (st.getPlayer().hasQuestCompleted(Q00237_WindsOfChange.class.getSimpleName()) && (talker.getLevel() >= MIN_LEVEL) && st.hasQuestItems(SUPPORT_CERTIFICATE)) { htmltext = "32643-01.htm"; - } - else - { + } else { htmltext = "32643-00.html"; } break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = (st.hasQuestItems(DESTROYED_MACHINE_PIECE)) ? "32643-05.html" : "32643-04.html"; break; case 2: - if (st.getQuestItemsCount(DESTROYED_MACHINE_PIECE) == DESTROYED_MACHINE_PIECE_NEEDED) - { + if (st.getQuestItemsCount(DESTROYED_MACHINE_PIECE) == DESTROYED_MACHINE_PIECE_NEEDED) { htmltext = "32643-06.html"; st.takeItems(DESTROYED_MACHINE_PIECE, -1); } @@ -177,8 +148,7 @@ public class Q00239_WontYouJoinUs extends Quest htmltext = (st.hasQuestItems(ENCHANTED_GOLEM_FRAGMENT)) ? "32643-08.html" : "32643-09.html"; break; case 4: - if (st.getQuestItemsCount(ENCHANTED_GOLEM_FRAGMENT) == ENCHANTED_GOLEM_FRAGMENT_NEEDED) - { + if (st.getQuestItemsCount(ENCHANTED_GOLEM_FRAGMENT) == ENCHANTED_GOLEM_FRAGMENT_NEEDED) { htmltext = "32643-10.html"; st.giveAdena(283346, true); st.takeItems(SUPPORT_CERTIFICATE, 1); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00240_ImTheOnlyOneYouCanTrust/Q00240_ImTheOnlyOneYouCanTrust.java b/src/main/java/com/l2jserver/datapack/quests/Q00240_ImTheOnlyOneYouCanTrust/Q00240_ImTheOnlyOneYouCanTrust.java index f7da2bd564..d56449d230 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00240_ImTheOnlyOneYouCanTrust/Q00240_ImTheOnlyOneYouCanTrust.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00240_ImTheOnlyOneYouCanTrust/Q00240_ImTheOnlyOneYouCanTrust.java @@ -29,13 +29,11 @@ import com.l2jserver.gameserver.model.quest.State; * I'm the Only One You Can Trust (240) * @author malyelfik */ -public class Q00240_ImTheOnlyOneYouCanTrust extends Quest -{ +public class Q00240_ImTheOnlyOneYouCanTrust extends Quest { // NPC private static final int KINTAIJIN = 32640; // Monster - private static final int[] MOBS = - { + private static final int[] MOBS = { 22617, 22618, 22619, @@ -57,8 +55,7 @@ public class Q00240_ImTheOnlyOneYouCanTrust extends Quest // Item private static final int STAKATO_FANG = 14879; - public Q00240_ImTheOnlyOneYouCanTrust() - { + public Q00240_ImTheOnlyOneYouCanTrust() { super(240, Q00240_ImTheOnlyOneYouCanTrust.class.getSimpleName(), "I'm the Only One You Can Trust"); addStartNpc(KINTAIJIN); addTalkId(KINTAIJIN); @@ -67,62 +64,50 @@ public class Q00240_ImTheOnlyOneYouCanTrust extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - if (event.equalsIgnoreCase("32640-3.htm")) - { + if (event.equalsIgnoreCase("32640-3.htm")) { st.startQuest(); } return event; } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(player, 1); - if (partyMember == null) - { + if (partyMember == null) { return super.onKill(npc, player, isSummon); } final QuestState st = getQuestState(partyMember, false); st.giveItems(STAKATO_FANG, 1); - if (st.getQuestItemsCount(STAKATO_FANG) >= 25) - { + if (st.getQuestItemsCount(STAKATO_FANG) >= 25) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } return super.onKill(npc, player, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= 81) ? "32640-1.htm" : "32640-0.htm"; break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = (!st.hasQuestItems(STAKATO_FANG)) ? "32640-8.html" : "32640-9.html"; break; case 2: - if (st.getQuestItemsCount(STAKATO_FANG) >= 25) - { + if (st.getQuestItemsCount(STAKATO_FANG) >= 25) { st.giveAdena(147200, true); st.takeItems(STAKATO_FANG, -1); st.addExpAndSp(589542, 36800); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00241_PossessorOfAPreciousSoul1/Q00241_PossessorOfAPreciousSoul1.java b/src/main/java/com/l2jserver/datapack/quests/Q00241_PossessorOfAPreciousSoul1/Q00241_PossessorOfAPreciousSoul1.java index 82e5a46c7e..06de8836b0 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00241_PossessorOfAPreciousSoul1/Q00241_PossessorOfAPreciousSoul1.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00241_PossessorOfAPreciousSoul1/Q00241_PossessorOfAPreciousSoul1.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by disKret. * @author Joxit */ -public class Q00241_PossessorOfAPreciousSoul1 extends Quest -{ +public class Q00241_PossessorOfAPreciousSoul1 extends Quest { // NPCs private static final int STEDMIEL = 30692; private static final int GABRIELLE = 30753; @@ -62,8 +61,7 @@ public class Q00241_PossessorOfAPreciousSoul1 extends Quest private static final int CRIMSON_MOSS_CHANCE = 30; private static final int MALRUK_SUCCUBUS_CLAW_CHANCE = 60; - public Q00241_PossessorOfAPreciousSoul1() - { + public Q00241_PossessorOfAPreciousSoul1() { super(241, Q00241_PossessorOfAPreciousSoul1.class.getSimpleName(), "Possessor Of A Precious Soul 1"); addStartNpc(TALIEN); addTalkId(TALIEN, STEDMIEL, GABRIELLE, GILMORE, KANTABILON, RAHORAKTI, CARADINE, KASSANDRA, VIRGIL, OGMAR); @@ -72,119 +70,100 @@ public class Q00241_PossessorOfAPreciousSoul1 extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - if (!player.isSubClassActive()) - { + if (!player.isSubClassActive()) { return "no_sub.html"; } - switch (event) - { + switch (event) { case "31739-02.html": st.startQuest(); break; case "30753-02.html": - if (st.isCond(1)) - { + if (st.isCond(1)) { st.setCond(2, true); } break; case "30754-02.html": - if (st.isCond(2)) - { + if (st.isCond(2)) { st.setCond(3, true); } break; case "31739-05.html": - if (st.isCond(4) && st.hasQuestItems(LEGEND_OF_SEVENTEEN)) - { + if (st.isCond(4) && st.hasQuestItems(LEGEND_OF_SEVENTEEN)) { st.takeItems(LEGEND_OF_SEVENTEEN, -1); st.setCond(5, true); } break; case "31042-02.html": - if (st.isCond(5)) - { + if (st.isCond(5)) { st.setCond(6, true); } break; case "31042-05.html": - if (st.isCond(7) && (st.getQuestItemsCount(MALRUK_SUCCUBUS_CLAW) >= 10)) - { + if (st.isCond(7) && (st.getQuestItemsCount(MALRUK_SUCCUBUS_CLAW) >= 10)) { st.takeItems(MALRUK_SUCCUBUS_CLAW, -1); st.giveItems(ECHO_CRYSTAL, 1); st.setCond(8, true); } break; case "31739-08.html": - if (st.isCond(8) && st.hasQuestItems(ECHO_CRYSTAL)) - { + if (st.isCond(8) && st.hasQuestItems(ECHO_CRYSTAL)) { st.takeItems(ECHO_CRYSTAL, -1); st.setCond(9, true); } break; case "30692-02.html": - if (st.isCond(9) && !st.hasQuestItems(POETRY_BOOK)) - { + if (st.isCond(9) && !st.hasQuestItems(POETRY_BOOK)) { st.giveItems(POETRY_BOOK, 1); st.setCond(10, true); } break; case "31739-11.html": - if (st.isCond(10) && st.hasQuestItems(POETRY_BOOK)) - { + if (st.isCond(10) && st.hasQuestItems(POETRY_BOOK)) { st.takeItems(POETRY_BOOK, -1); st.setCond(11, true); } break; case "31742-02.html": - if (st.isCond(11)) - { + if (st.isCond(11)) { st.setCond(12, true); } break; case "31744-02.html": - if (st.isCond(12)) - { + if (st.isCond(12)) { st.setCond(13, true); } break; case "31336-02.html": - if (st.isCond(13)) - { + if (st.isCond(13)) { st.setCond(14, true); } break; case "31336-05.html": - if (st.isCond(15) && (st.getQuestItemsCount(CRIMSON_MOSS) >= 5)) - { + if (st.isCond(15) && (st.getQuestItemsCount(CRIMSON_MOSS) >= 5)) { st.takeItems(CRIMSON_MOSS, -1); st.giveItems(RAHORAKTIS_MEDICINE, 1); st.setCond(16, true); } break; case "31743-02.html": - if (st.isCond(16) && st.hasQuestItems(RAHORAKTIS_MEDICINE)) - { + if (st.isCond(16) && st.hasQuestItems(RAHORAKTIS_MEDICINE)) { st.takeItems(RAHORAKTIS_MEDICINE, -1); st.setCond(17, true); } break; case "31742-05.html": - if (st.isCond(17)) - { + if (st.isCond(17)) { st.setCond(18, true); } break; case "31740-05.html": - if (st.getCond() >= 18) - { + if (st.getCond() >= 18) { st.giveItems(VIRGILS_LETTER, 1); st.addExpAndSp(263043, 0); st.exitQuest(false, true); @@ -195,16 +174,13 @@ public class Q00241_PossessorOfAPreciousSoul1 extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance partyMember; final QuestState st; - switch (npc.getId()) - { + switch (npc.getId()) { case BARAHAM: partyMember = getRandomPartyMember(player, 3); - if (partyMember == null) - { + if (partyMember == null) { return null; } @@ -217,40 +193,30 @@ public class Q00241_PossessorOfAPreciousSoul1 extends Quest case MALRUK_SUCCUBUS_2: case MALRUK_SUCCUBUS_TUREN_2: partyMember = getRandomPartyMember(player, 6); - if (partyMember == null) - { + if (partyMember == null) { return null; } st = getQuestState(partyMember, false); - if ((MALRUK_SUCCUBUS_CLAW_CHANCE >= getRandom(100)) && (st.getQuestItemsCount(MALRUK_SUCCUBUS_CLAW) < 10)) - { + if ((MALRUK_SUCCUBUS_CLAW_CHANCE >= getRandom(100)) && (st.getQuestItemsCount(MALRUK_SUCCUBUS_CLAW) < 10)) { st.giveItems(MALRUK_SUCCUBUS_CLAW, 1); - if (st.getQuestItemsCount(MALRUK_SUCCUBUS_CLAW) == 10) - { + if (st.getQuestItemsCount(MALRUK_SUCCUBUS_CLAW) == 10) { st.setCond(7, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } break; case TAIK_ORC_SUPPLY_LEADER: partyMember = getRandomPartyMember(player, 14); - if (partyMember == null) - { + if (partyMember == null) { return null; } st = getQuestState(partyMember, false); - if ((CRIMSON_MOSS_CHANCE >= getRandom(100)) && (st.getQuestItemsCount(CRIMSON_MOSS) < 5)) - { + if ((CRIMSON_MOSS_CHANCE >= getRandom(100)) && (st.getQuestItemsCount(CRIMSON_MOSS) < 5)) { st.giveItems(CRIMSON_MOSS, 1); - if (st.getQuestItemsCount(CRIMSON_MOSS) == 5) - { + if (st.getQuestItemsCount(CRIMSON_MOSS) == 5) { st.setCond(15, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -260,32 +226,26 @@ public class Q00241_PossessorOfAPreciousSoul1 extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); - if (st.isStarted() && !player.isSubClassActive()) - { + if (st.isStarted() && !player.isSubClassActive()) { return "no_sub.html"; } String htmltext = getNoQuestMsg(player); - switch (npc.getId()) - { + switch (npc.getId()) { case TALIEN: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (((player.getLevel() >= 50) && player.isSubClassActive()) ? "31739-01.htm" : "31739-00.htm"); break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "31739-03.html"; break; case 4: - if (st.hasQuestItems(LEGEND_OF_SEVENTEEN)) - { + if (st.hasQuestItems(LEGEND_OF_SEVENTEEN)) { htmltext = "31739-04.html"; } break; @@ -293,8 +253,7 @@ public class Q00241_PossessorOfAPreciousSoul1 extends Quest htmltext = "31739-06.html"; break; case 8: - if (st.hasQuestItems(ECHO_CRYSTAL)) - { + if (st.hasQuestItems(ECHO_CRYSTAL)) { htmltext = "31739-07.html"; } break; @@ -302,8 +261,7 @@ public class Q00241_PossessorOfAPreciousSoul1 extends Quest htmltext = "31739-09.html"; break; case 10: - if (st.hasQuestItems(POETRY_BOOK)) - { + if (st.hasQuestItems(POETRY_BOOK)) { htmltext = "31739-10.html"; } break; @@ -318,8 +276,7 @@ public class Q00241_PossessorOfAPreciousSoul1 extends Quest } break; case GABRIELLE: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "30753-01.html"; break; @@ -329,8 +286,7 @@ public class Q00241_PossessorOfAPreciousSoul1 extends Quest } break; case GILMORE: - switch (st.getCond()) - { + switch (st.getCond()) { case 2: htmltext = "30754-01.html"; break; @@ -340,8 +296,7 @@ public class Q00241_PossessorOfAPreciousSoul1 extends Quest } break; case KANTABILON: - switch (st.getCond()) - { + switch (st.getCond()) { case 5: htmltext = "31042-01.html"; break; @@ -349,8 +304,7 @@ public class Q00241_PossessorOfAPreciousSoul1 extends Quest htmltext = "31042-04.html"; break; case 7: - if (st.getQuestItemsCount(MALRUK_SUCCUBUS_CLAW) >= 10) - { + if (st.getQuestItemsCount(MALRUK_SUCCUBUS_CLAW) >= 10) { htmltext = "31042-03.html"; } break; @@ -360,8 +314,7 @@ public class Q00241_PossessorOfAPreciousSoul1 extends Quest } break; case STEDMIEL: - switch (st.getCond()) - { + switch (st.getCond()) { case 9: htmltext = "30692-01.html"; break; @@ -371,8 +324,7 @@ public class Q00241_PossessorOfAPreciousSoul1 extends Quest } break; case VIRGIL: - switch (st.getCond()) - { + switch (st.getCond()) { case 11: htmltext = "31742-01.html"; break; @@ -388,8 +340,7 @@ public class Q00241_PossessorOfAPreciousSoul1 extends Quest } break; case OGMAR: - switch (st.getCond()) - { + switch (st.getCond()) { case 12: htmltext = "31744-01.html"; break; @@ -399,8 +350,7 @@ public class Q00241_PossessorOfAPreciousSoul1 extends Quest } break; case RAHORAKTI: - switch (st.getCond()) - { + switch (st.getCond()) { case 13: htmltext = "31336-01.html"; break; @@ -408,8 +358,7 @@ public class Q00241_PossessorOfAPreciousSoul1 extends Quest htmltext = "31336-04.html"; break; case 15: - if (st.getQuestItemsCount(CRIMSON_MOSS) >= 5) - { + if (st.getQuestItemsCount(CRIMSON_MOSS) >= 5) { htmltext = "31336-03.html"; } break; @@ -419,11 +368,9 @@ public class Q00241_PossessorOfAPreciousSoul1 extends Quest } break; case KASSANDRA: - switch (st.getCond()) - { + switch (st.getCond()) { case 16: - if (st.hasQuestItems(RAHORAKTIS_MEDICINE)) - { + if (st.hasQuestItems(RAHORAKTIS_MEDICINE)) { htmltext = "31743-01.html"; } break; @@ -433,8 +380,7 @@ public class Q00241_PossessorOfAPreciousSoul1 extends Quest } break; case CARADINE: - if (st.getCond() >= 18) - { + if (st.getCond() >= 18) { htmltext = "31740-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00242_PossessorOfAPreciousSoul2/Q00242_PossessorOfAPreciousSoul2.java b/src/main/java/com/l2jserver/datapack/quests/Q00242_PossessorOfAPreciousSoul2/Q00242_PossessorOfAPreciousSoul2.java index e70c620d26..53ac32c2df 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00242_PossessorOfAPreciousSoul2/Q00242_PossessorOfAPreciousSoul2.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00242_PossessorOfAPreciousSoul2/Q00242_PossessorOfAPreciousSoul2.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by disKret. * @author mjaniko, Joxit */ -public class Q00242_PossessorOfAPreciousSoul2 extends Quest -{ +public class Q00242_PossessorOfAPreciousSoul2 extends Quest { // NPCs private static final int VIRGIL = 31742; private static final int KASSANDRA = 31743; @@ -57,8 +56,7 @@ public class Q00242_PossessorOfAPreciousSoul2 extends Quest // Skill private static final SkillHolder QUEST_COMMUNE_TO_SLATE = new SkillHolder(4546); - public Q00242_PossessorOfAPreciousSoul2() - { + public Q00242_PossessorOfAPreciousSoul2() { super(242, Q00242_PossessorOfAPreciousSoul2.class.getSimpleName(), "Possessor Of A Precious Soul 2"); addStartNpc(VIRGIL); addTalkId(VIRGIL, KASSANDRA, OGMAR, MYSTERIOUS_KNIGHT, ANGEL_CORPSE, KALIS, MATILD, FALLEN_UNICORN, CORNERSTONE, PURE_UNICORN); @@ -67,58 +65,48 @@ public class Q00242_PossessorOfAPreciousSoul2 extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - if (!player.isSubClassActive()) - { + if (!player.isSubClassActive()) { return "no_sub.html"; } - switch (event) - { + switch (event) { case "31742-02.html": st.startQuest(); st.takeItems(VIRGILS_LETTER, -1); break; case "31743-05.html": - if (st.isCond(1)) - { + if (st.isCond(1)) { st.setCond(2, true); } break; case "31744-02.html": - if (st.isCond(2)) - { + if (st.isCond(2)) { st.setCond(3, true); } break; case "31751-02.html": - if (st.isCond(3)) - { + if (st.isCond(3)) { st.setCond(4, true); } break; case "30759-02.html": - if (st.isCond(6)) - { + if (st.isCond(6)) { st.setCond(7, true); } break; case "30738-02.html": - if (st.isCond(7)) - { + if (st.isCond(7)) { st.setCond(8, true); st.giveItems(SORCERY_INGREDIENT, 1); } break; case "30759-05.html": - if (st.isCond(8)) - { + if (st.isCond(8)) { st.takeItems(GOLDEN_HAIR, -1); st.takeItems(SORCERY_INGREDIENT, -1); st.set("awaitsDrops", "1"); @@ -141,51 +129,41 @@ public class Q00242_PossessorOfAPreciousSoul2 extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(player, "awaitsDrops", "1"); - if (partyMember == null) - { + if (partyMember == null) { return super.onKill(npc, player, isSummon); } final QuestState st = getQuestState(partyMember, false); - if (st.isCond(9) && (st.getQuestItemsCount(ORB_OF_BINDING) < 4)) - { + if (st.isCond(9) && (st.getQuestItemsCount(ORB_OF_BINDING) < 4)) { st.giveItems(ORB_OF_BINDING, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } - if (st.getQuestItemsCount(ORB_OF_BINDING) >= 4) - { + if (st.getQuestItemsCount(ORB_OF_BINDING) >= 4) { st.unset("awaitsDrops"); } return super.onKill(npc, player, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - if (st.isStarted() && !player.isSubClassActive()) - { + if (st.isStarted() && !player.isSubClassActive()) { return "no_sub.html"; } - switch (npc.getId()) - { + switch (npc.getId()) { case VIRGIL: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: - if (player.hasQuestCompleted(Q00241_PossessorOfAPreciousSoul1.class.getSimpleName())) - { + if (player.hasQuestCompleted(Q00241_PossessorOfAPreciousSoul1.class.getSimpleName())) { htmltext = (player.isSubClassActive() && (player.getLevel() >= 60)) ? "31742-01.htm" : "31742-00.htm"; } break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "31742-03.html"; break; @@ -203,8 +181,7 @@ public class Q00242_PossessorOfAPreciousSoul2 extends Quest } break; case KASSANDRA: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "31743-01.html"; break; @@ -217,8 +194,7 @@ public class Q00242_PossessorOfAPreciousSoul2 extends Quest } break; case OGMAR: - switch (st.getCond()) - { + switch (st.getCond()) { case 2: htmltext = "31744-01.html"; break; @@ -228,8 +204,7 @@ public class Q00242_PossessorOfAPreciousSoul2 extends Quest } break; case MYSTERIOUS_KNIGHT: - switch (st.getCond()) - { + switch (st.getCond()) { case 3: htmltext = "31751-01.html"; break; @@ -237,8 +212,7 @@ public class Q00242_PossessorOfAPreciousSoul2 extends Quest htmltext = "31751-03.html"; break; case 5: - if (st.hasQuestItems(GOLDEN_HAIR)) - { + if (st.hasQuestItems(GOLDEN_HAIR)) { st.setCond(6, true); htmltext = "31751-04.html"; } @@ -249,18 +223,14 @@ public class Q00242_PossessorOfAPreciousSoul2 extends Quest } break; case ANGEL_CORPSE: - switch (st.getCond()) - { + switch (st.getCond()) { case 4: npc.doDie(npc); - if (CHANCE_FOR_HAIR >= getRandom(100)) - { + if (CHANCE_FOR_HAIR >= getRandom(100)) { st.giveItems(GOLDEN_HAIR, 1); st.setCond(5, true); htmltext = "31752-01.html"; - } - else - { + } else { htmltext = "31752-02.html"; } break; @@ -270,8 +240,7 @@ public class Q00242_PossessorOfAPreciousSoul2 extends Quest } break; case KALIS: - switch (st.getCond()) - { + switch (st.getCond()) { case 6: htmltext = "30759-01.html"; break; @@ -279,8 +248,7 @@ public class Q00242_PossessorOfAPreciousSoul2 extends Quest htmltext = "30759-03.html"; break; case 8: - if (st.hasQuestItems(SORCERY_INGREDIENT)) - { + if (st.hasQuestItems(SORCERY_INGREDIENT)) { htmltext = "30759-04.html"; } break; @@ -290,8 +258,7 @@ public class Q00242_PossessorOfAPreciousSoul2 extends Quest } break; case MATILD: - switch (st.getCond()) - { + switch (st.getCond()) { case 7: htmltext = "30738-01.html"; break; @@ -301,32 +268,26 @@ public class Q00242_PossessorOfAPreciousSoul2 extends Quest } break; case CORNERSTONE: - if (st.isCond(9)) - { - if (st.hasQuestItems(ORB_OF_BINDING)) - { + if (st.isCond(9)) { + if (st.hasQuestItems(ORB_OF_BINDING)) { htmltext = "31748-02.html"; st.takeItems(ORB_OF_BINDING, 1); npc.doDie(npc); st.set("cornerstones", Integer.toString(st.getInt("cornerstones") + 1)); - if (st.getInt("cornerstones") == 4) - { + if (st.getInt("cornerstones") == 4) { st.setCond(10); } st.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); npc.setTarget(player); npc.doCast(QUEST_COMMUNE_TO_SLATE); - } - else - { + } else { htmltext = "31748-01.html"; } } break; case FALLEN_UNICORN: - switch (st.getCond()) - { + switch (st.getCond()) { case 9: htmltext = "31746-01.html"; break; @@ -337,8 +298,7 @@ public class Q00242_PossessorOfAPreciousSoul2 extends Quest } break; case PURE_UNICORN: - switch (st.getCond()) - { + switch (st.getCond()) { case 10: st.setCond(11, true); htmltext = "31747-01.html"; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00246_PossessorOfAPreciousSoul3/Q00246_PossessorOfAPreciousSoul3.java b/src/main/java/com/l2jserver/datapack/quests/Q00246_PossessorOfAPreciousSoul3/Q00246_PossessorOfAPreciousSoul3.java index fc95fb7052..e40abc8390 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00246_PossessorOfAPreciousSoul3/Q00246_PossessorOfAPreciousSoul3.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00246_PossessorOfAPreciousSoul3/Q00246_PossessorOfAPreciousSoul3.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.util.Util; * Original Jython script by disKret. * @author nonom */ -public class Q00246_PossessorOfAPreciousSoul3 extends Quest -{ +public class Q00246_PossessorOfAPreciousSoul3 extends Quest { // NPCs private static final int LADD = 30721; private static final int CARADINE = 31740; @@ -41,8 +40,7 @@ public class Q00246_PossessorOfAPreciousSoul3 extends Quest private static final int PILGRIM_OF_SPLENDOR = 21541; private static final int JUDGE_OF_SPLENDOR = 21544; private static final int BARAKIEL = 25325; - private static final int[] MOBS = - { + private static final int[] MOBS = { 21535, // Signet of Splendor 21536, // Crown of Splendor 21537, // Fang of Splendor @@ -62,8 +60,7 @@ public class Q00246_PossessorOfAPreciousSoul3 extends Quest private static final int CHANCE_FOR_DROP = 30; private static final int CHANCE_FOR_DROP_FRAGMENTS = 60; - public Q00246_PossessorOfAPreciousSoul3() - { + public Q00246_PossessorOfAPreciousSoul3() { super(246, Q00246_PossessorOfAPreciousSoul3.class.getSimpleName(), "Possessor Of A Precious Soul 3"); addStartNpc(CARADINE); addTalkId(LADD, CARADINE, OSSIAN); @@ -73,59 +70,48 @@ public class Q00246_PossessorOfAPreciousSoul3 extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - if (!player.isSubClassActive()) - { + if (!player.isSubClassActive()) { return "no_sub.html"; } - switch (event) - { + switch (event) { case "31740-4.html": - if (st.isCreated()) - { + if (st.isCreated()) { st.takeItems(CARADINE_LETTER, -1); st.startQuest(); } break; case "31741-2.html": - if (st.isStarted() && st.isCond(1)) - { + if (st.isStarted() && st.isCond(1)) { st.set("awaitsWaterbinder", "1"); st.set("awaitsEvergreen", "1"); st.setCond(2, true); } break; case "31741-5.html": - if (st.isCond(3) && st.hasQuestItems(WATERBINDER) && st.hasQuestItems(EVERGREEN)) - { + if (st.isCond(3) && st.hasQuestItems(WATERBINDER) && st.hasQuestItems(EVERGREEN)) { st.takeItems(WATERBINDER, 1); st.takeItems(EVERGREEN, 1); st.setCond(4, true); } break; case "31741-9.html": - if (st.isCond(5) && (st.hasQuestItems(RAIN_SONG) || (st.getQuestItemsCount(FRAGMENTS) >= 100))) - { + if (st.isCond(5) && (st.hasQuestItems(RAIN_SONG) || (st.getQuestItemsCount(FRAGMENTS) >= 100))) { st.takeItems(RAIN_SONG, -1); st.takeItems(FRAGMENTS, -1); st.giveItems(RELIC_BOX, 1); st.setCond(6, true); - } - else - { + } else { return "31741-8.html"; } break; case "30721-2.html": - if (st.isCond(6) && st.hasQuestItems(RELIC_BOX)) - { + if (st.isCond(6) && st.hasQuestItems(RELIC_BOX)) { st.takeItems(RELIC_BOX, -1); st.giveItems(CARADINE_LETTER_LAST, 1); st.addExpAndSp(719843, 0); @@ -137,31 +123,23 @@ public class Q00246_PossessorOfAPreciousSoul3 extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance partyMember; final QuestState st; - switch (npc.getId()) - { + switch (npc.getId()) { case PILGRIM_OF_SPLENDOR: partyMember = getRandomPartyMember(player, "awaitsWaterbinder", "1"); - if (partyMember != null) - { + if (partyMember != null) { st = getQuestState(partyMember, false); final int chance = getRandom(100); - if (st.isCond(2) && !st.hasQuestItems(WATERBINDER)) - { - if (chance < CHANCE_FOR_DROP) - { + if (st.isCond(2) && !st.hasQuestItems(WATERBINDER)) { + if (chance < CHANCE_FOR_DROP) { st.giveItems(WATERBINDER, 1); st.unset("awaitsWaterbinder"); - if (st.hasQuestItems(EVERGREEN)) - { + if (st.hasQuestItems(EVERGREEN)) { st.setCond(3, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -170,22 +148,16 @@ public class Q00246_PossessorOfAPreciousSoul3 extends Quest break; case JUDGE_OF_SPLENDOR: partyMember = getRandomPartyMember(player, "awaitsEvergreen", "1"); - if (partyMember != null) - { + if (partyMember != null) { st = getQuestState(partyMember, false); final long chance = getRandom(100); - if (st.isCond(2) && !st.hasQuestItems(EVERGREEN)) - { - if (chance < CHANCE_FOR_DROP) - { + if (st.isCond(2) && !st.hasQuestItems(EVERGREEN)) { + if (chance < CHANCE_FOR_DROP) { st.giveItems(EVERGREEN, 1); st.unset("awaitsEvergreen"); - if (st.hasQuestItems(WATERBINDER)) - { + if (st.hasQuestItems(WATERBINDER)) { st.setCond(3, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -194,28 +166,20 @@ public class Q00246_PossessorOfAPreciousSoul3 extends Quest break; case BARAKIEL: QuestState pst; - if ((player.getParty() != null) && !player.getParty().getMembers().isEmpty()) - { - for (L2PcInstance member : player.getParty().getMembers()) - { + if ((player.getParty() != null) && !player.getParty().getMembers().isEmpty()) { + for (L2PcInstance member : player.getParty().getMembers()) { pst = getQuestState(member, false); - if (pst != null) - { - if (pst.isCond(4) && !pst.hasQuestItems(RAIN_SONG)) - { + if (pst != null) { + if (pst.isCond(4) && !pst.hasQuestItems(RAIN_SONG)) { pst.giveItems(RAIN_SONG, 1); pst.setCond(5, true); } } } - } - else - { + } else { pst = getQuestState(player, false); - if (pst != null) - { - if (pst.isCond(4) && !pst.hasQuestItems(RAIN_SONG)) - { + if (pst != null) { + if (pst.isCond(4) && !pst.hasQuestItems(RAIN_SONG)) { pst.giveItems(RAIN_SONG, 1); pst.setCond(5, true); } @@ -224,22 +188,16 @@ public class Q00246_PossessorOfAPreciousSoul3 extends Quest break; default: st = getQuestState(player, false); - if ((st == null)) - { + if ((st == null)) { return super.onKill(npc, player, isSummon); } - if (Util.contains(MOBS, npc.getId()) && (st.getQuestItemsCount(FRAGMENTS) < 100) && (st.isCond(4))) - { - if (getRandom(100) < CHANCE_FOR_DROP_FRAGMENTS) - { + if (Util.contains(MOBS, npc.getId()) && (st.getQuestItemsCount(FRAGMENTS) < 100) && (st.isCond(4))) { + if (getRandom(100) < CHANCE_FOR_DROP_FRAGMENTS) { st.giveItems(FRAGMENTS, 1); - if (st.getQuestItemsCount(FRAGMENTS) < 100) - { + if (st.getQuestItemsCount(FRAGMENTS) < 100) { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - } - else - { + } else { st.setCond(5, true); } } @@ -250,20 +208,16 @@ public class Q00246_PossessorOfAPreciousSoul3 extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - if (st.isStarted() && !player.isSubClassActive()) - { + if (st.isStarted() && !player.isSubClassActive()) { return "no_sub.html"; } - switch (npc.getId()) - { + switch (npc.getId()) { case CARADINE: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = ((player.getLevel() >= 65) && player.hasQuestCompleted(Q00242_PossessorOfAPreciousSoul2.class.getSimpleName())) ? "31740-1.htm" : "31740-2.html"; break; @@ -273,11 +227,9 @@ public class Q00246_PossessorOfAPreciousSoul3 extends Quest } break; case OSSIAN: - switch (st.getState()) - { + switch (st.getState()) { case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "31741-1.html"; break; @@ -285,8 +237,7 @@ public class Q00246_PossessorOfAPreciousSoul3 extends Quest htmltext = "31741-4.html"; break; case 3: - if (st.hasQuestItems(WATERBINDER) && st.hasQuestItems(EVERGREEN)) - { + if (st.hasQuestItems(WATERBINDER) && st.hasQuestItems(EVERGREEN)) { htmltext = "31741-3.html"; } break; @@ -294,18 +245,14 @@ public class Q00246_PossessorOfAPreciousSoul3 extends Quest htmltext = "31741-8.html"; break; case 5: - if (st.hasQuestItems(RAIN_SONG) || (st.getQuestItemsCount(FRAGMENTS) >= 100)) - { + if (st.hasQuestItems(RAIN_SONG) || (st.getQuestItemsCount(FRAGMENTS) >= 100)) { htmltext = "31741-7.html"; - } - else - { + } else { htmltext = "31741-8.html"; } break; case 6: - if (st.getQuestItemsCount(RELIC_BOX) == 1) - { + if (st.getQuestItemsCount(RELIC_BOX) == 1) { htmltext = "31741-11.html"; } break; @@ -313,11 +260,9 @@ public class Q00246_PossessorOfAPreciousSoul3 extends Quest } break; case LADD: - switch (st.getState()) - { + switch (st.getState()) { case State.STARTED: - if (st.isCond(6)) - { + if (st.isCond(6)) { htmltext = "30721-1.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00247_PossessorOfAPreciousSoul4/Q00247_PossessorOfAPreciousSoul4.java b/src/main/java/com/l2jserver/datapack/quests/Q00247_PossessorOfAPreciousSoul4/Q00247_PossessorOfAPreciousSoul4.java index 996e0ceb48..d63ca3a03c 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00247_PossessorOfAPreciousSoul4/Q00247_PossessorOfAPreciousSoul4.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00247_PossessorOfAPreciousSoul4/Q00247_PossessorOfAPreciousSoul4.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.network.serverpackets.SocialAction; * Original Jython script by disKret. * @author nonom */ -public class Q00247_PossessorOfAPreciousSoul4 extends Quest -{ +public class Q00247_PossessorOfAPreciousSoul4 extends Quest { // NPCs private static final int CARADINE = 31740; private static final int LADY_OF_LAKE = 31745; @@ -46,42 +45,35 @@ public class Q00247_PossessorOfAPreciousSoul4 extends Quest // Skill private static final SkillHolder MIMIRS_ELIXIR = new SkillHolder(4339); - public Q00247_PossessorOfAPreciousSoul4() - { + public Q00247_PossessorOfAPreciousSoul4() { super(247, Q00247_PossessorOfAPreciousSoul4.class.getSimpleName(), "Possessor Of A Precious Soul 4"); addStartNpc(CARADINE); addTalkId(CARADINE, LADY_OF_LAKE); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - if (!player.isSubClassActive()) - { + if (!player.isSubClassActive()) { return "no_sub.html"; } - switch (event) - { + switch (event) { case "31740-3.html": st.startQuest(); st.takeItems(CARADINE_LETTER_LAST, -1); break; case "31740-5.html": - if (st.isCond(1)) - { + if (st.isCond(1)) { st.setCond(2, true); player.teleToLocation(CARADINE_LOC, 0); } break; case "31745-5.html": - if (st.isCond(2)) - { + if (st.isCond(2)) { player.setNoble(true); st.addExpAndSp(93836, 0); st.giveItems(NOBLESS_TIARA, 1); @@ -96,30 +88,23 @@ public class Q00247_PossessorOfAPreciousSoul4 extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - if (st.isStarted() && !player.isSubClassActive()) - { + if (st.isStarted() && !player.isSubClassActive()) { return "no_sub.html"; } - switch (npc.getId()) - { - case CARADINE: - { - switch (st.getState()) - { + switch (npc.getId()) { + case CARADINE: { + switch (st.getState()) { case State.CREATED: - if (player.hasQuestCompleted(Q00246_PossessorOfAPreciousSoul3.class.getSimpleName())) - { + if (player.hasQuestCompleted(Q00246_PossessorOfAPreciousSoul3.class.getSimpleName())) { htmltext = ((player.getLevel() >= 75) ? "31740-1.htm" : "31740-2.html"); } break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "31740-6.html"; } break; @@ -129,10 +114,8 @@ public class Q00247_PossessorOfAPreciousSoul4 extends Quest } break; } - case LADY_OF_LAKE: - { - if (st.isCond(2)) - { + case LADY_OF_LAKE: { + if (st.isCond(2)) { htmltext = "31745-1.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00249_PoisonedPlainsOfTheLizardmen/Q00249_PoisonedPlainsOfTheLizardmen.java b/src/main/java/com/l2jserver/datapack/quests/Q00249_PoisonedPlainsOfTheLizardmen/Q00249_PoisonedPlainsOfTheLizardmen.java index d63cfa3842..966103680b 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00249_PoisonedPlainsOfTheLizardmen/Q00249_PoisonedPlainsOfTheLizardmen.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00249_PoisonedPlainsOfTheLizardmen/Q00249_PoisonedPlainsOfTheLizardmen.java @@ -29,38 +29,30 @@ import com.l2jserver.gameserver.model.quest.State; * @author Gnacik * @version 2010-08-04 Based on Freya PTS */ -public class Q00249_PoisonedPlainsOfTheLizardmen extends Quest -{ +public class Q00249_PoisonedPlainsOfTheLizardmen extends Quest { // NPCs private static final int MOUEN = 30196; private static final int JOHNNY = 32744; - public Q00249_PoisonedPlainsOfTheLizardmen() - { + public Q00249_PoisonedPlainsOfTheLizardmen() { super(249, Q00249_PoisonedPlainsOfTheLizardmen.class.getSimpleName(), "Poisoned Plains of the Lizardmen"); addStartNpc(MOUEN); addTalkId(MOUEN, JOHNNY); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return htmltext; } - if (npc.getId() == MOUEN) - { - if (event.equalsIgnoreCase("30196-03.htm")) - { + if (npc.getId() == MOUEN) { + if (event.equalsIgnoreCase("30196-03.htm")) { st.startQuest(); } - } - else if ((npc.getId() == JOHNNY) && event.equalsIgnoreCase("32744-03.htm")) - { + } else if ((npc.getId() == JOHNNY) && event.equalsIgnoreCase("32744-03.htm")) { st.giveAdena(83056, true); st.addExpAndSp(477496, 58743); st.exitQuest(false, true); @@ -69,20 +61,16 @@ public class Q00249_PoisonedPlainsOfTheLizardmen extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - if (npc.getId() == MOUEN) - { - switch (st.getState()) - { + if (npc.getId() == MOUEN) { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= 82) ? "30196-01.htm" : "30196-00.htm"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "30196-04.htm"; } break; @@ -90,15 +78,10 @@ public class Q00249_PoisonedPlainsOfTheLizardmen extends Quest htmltext = "30196-05.htm"; break; } - } - else if (npc.getId() == JOHNNY) - { - if (st.isCond(1)) - { + } else if (npc.getId() == JOHNNY) { + if (st.isCond(1)) { htmltext = "32744-01.htm"; - } - else if (st.isCompleted()) - { + } else if (st.isCompleted()) { htmltext = "32744-04.htm"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00250_WatchWhatYouEat/Q00250_WatchWhatYouEat.java b/src/main/java/com/l2jserver/datapack/quests/Q00250_WatchWhatYouEat/Q00250_WatchWhatYouEat.java index 1f834db591..8f0dd0af49 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00250_WatchWhatYouEat/Q00250_WatchWhatYouEat.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00250_WatchWhatYouEat/Q00250_WatchWhatYouEat.java @@ -30,13 +30,11 @@ import com.l2jserver.gameserver.model.quest.State; * @author Gnacik * @version 2010-08-05 Based on Freya PTS */ -public class Q00250_WatchWhatYouEat extends Quest -{ +public class Q00250_WatchWhatYouEat extends Quest { // NPCs private static final int SALLY = 32743; // Mobs - Items - private static final int[][] MOBS = - { + private static final int[][] MOBS = { { 18864, 15493 @@ -51,44 +49,34 @@ public class Q00250_WatchWhatYouEat extends Quest } }; - public Q00250_WatchWhatYouEat() - { + public Q00250_WatchWhatYouEat() { super(250, Q00250_WatchWhatYouEat.class.getSimpleName(), "Watch What You Eat"); addStartNpc(SALLY); addFirstTalkId(SALLY); addTalkId(SALLY); - for (int[] mob : MOBS) - { + for (int[] mob : MOBS) { addKillId(mob[0]); } registerQuestItems(15493, 15494, 15495); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return htmltext; } - if (npc.getId() == SALLY) - { - if (event.equalsIgnoreCase("32743-03.htm")) - { + if (npc.getId() == SALLY) { + if (event.equalsIgnoreCase("32743-03.htm")) { st.startQuest(); - } - else if (event.equalsIgnoreCase("32743-end.htm")) - { + } else if (event.equalsIgnoreCase("32743-end.htm")) { st.giveAdena(135661, true); st.addExpAndSp(698334, 76369); st.exitQuest(false, true); - } - else if (event.equalsIgnoreCase("32743-22.html") && st.isCompleted()) - { + } else if (event.equalsIgnoreCase("32743-22.html") && st.isCompleted()) { htmltext = "32743-23.html"; } } @@ -96,10 +84,8 @@ public class Q00250_WatchWhatYouEat extends Quest } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { - if (npc.getId() == SALLY) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { + if (npc.getId() == SALLY) { return "32743-20.html"; } @@ -107,28 +93,21 @@ public class Q00250_WatchWhatYouEat extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } - if (st.isStarted() && st.isCond(1)) - { - for (int[] mob : MOBS) - { - if (npc.getId() == mob[0]) - { - if (!st.hasQuestItems(mob[1])) - { + if (st.isStarted() && st.isCond(1)) { + for (int[] mob : MOBS) { + if (npc.getId() == mob[0]) { + if (!st.hasQuestItems(mob[1])) { st.giveItems(mob[1], 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } } - if (st.hasQuestItems(MOBS[0][1]) && st.hasQuestItems(MOBS[1][1]) && st.hasQuestItems(MOBS[2][1])) - { + if (st.hasQuestItems(MOBS[0][1]) && st.hasQuestItems(MOBS[1][1]) && st.hasQuestItems(MOBS[2][1])) { st.setCond(2, true); } } @@ -136,34 +115,24 @@ public class Q00250_WatchWhatYouEat extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - if (npc.getId() == SALLY) - { - switch (st.getState()) - { + if (npc.getId() == SALLY) { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= 82) ? "32743-01.htm" : "32743-00.htm"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "32743-04.htm"; - } - else if (st.isCond(2)) - { - if (st.hasQuestItems(MOBS[0][1]) && st.hasQuestItems(MOBS[1][1]) && st.hasQuestItems(MOBS[2][1])) - { + } else if (st.isCond(2)) { + if (st.hasQuestItems(MOBS[0][1]) && st.hasQuestItems(MOBS[1][1]) && st.hasQuestItems(MOBS[2][1])) { htmltext = "32743-05.htm"; - for (int items[] : MOBS) - { + for (int items[] : MOBS) { st.takeItems(items[1], -1); } - } - else - { + } else { htmltext = "32743-06.htm"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00251_NoSecrets/Q00251_NoSecrets.java b/src/main/java/com/l2jserver/datapack/quests/Q00251_NoSecrets/Q00251_NoSecrets.java index d0533138bd..df4681b537 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00251_NoSecrets/Q00251_NoSecrets.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00251_NoSecrets/Q00251_NoSecrets.java @@ -30,14 +30,12 @@ import com.l2jserver.gameserver.util.Util; * No Secrets (251) * @author Dumpster */ -public class Q00251_NoSecrets extends Quest -{ +public class Q00251_NoSecrets extends Quest { public static final int PINAPS = 30201; public static final int DIARY = 15508; public static final int TABLE = 15509; - private static final int[] MOBS = - { + private static final int[] MOBS = { 22783, 22785, 22780, @@ -45,15 +43,13 @@ public class Q00251_NoSecrets extends Quest 22784 }; - private static final int[] MOBS2 = - { + private static final int[] MOBS2 = { 22775, 22776, 22778 }; - public Q00251_NoSecrets() - { + public Q00251_NoSecrets() { super(251, Q00251_NoSecrets.class.getSimpleName(), "No Secrets"); addStartNpc(PINAPS); addTalkId(PINAPS); @@ -63,50 +59,36 @@ public class Q00251_NoSecrets extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - if (event.equals("30201-03.htm")) - { + if (event.equals("30201-03.htm")) { st.startQuest(); } return event; } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isStarted() && st.isCond(1)) - { + if ((st != null) && st.isStarted() && st.isCond(1)) { final int npcId = npc.getId(); - if (Util.contains(MOBS, npcId) && (getRandom(100) < 10) && (st.getQuestItemsCount(DIARY) < 10)) - { + if (Util.contains(MOBS, npcId) && (getRandom(100) < 10) && (st.getQuestItemsCount(DIARY) < 10)) { st.giveItems(DIARY, 1); - if ((st.getQuestItemsCount(DIARY) >= 10) && (st.getQuestItemsCount(TABLE) >= 5)) - { + if ((st.getQuestItemsCount(DIARY) >= 10) && (st.getQuestItemsCount(TABLE) >= 5)) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } - } - else if (Util.contains(MOBS2, npcId) && (getRandom(100) < 5) && (st.getQuestItemsCount(TABLE) < 5)) - { + } else if (Util.contains(MOBS2, npcId) && (getRandom(100) < 5) && (st.getQuestItemsCount(TABLE) < 5)) { st.giveItems(TABLE, 1); - if ((st.getQuestItemsCount(DIARY) >= 10) && (st.getQuestItemsCount(TABLE) >= 5)) - { + if ((st.getQuestItemsCount(DIARY) >= 10) && (st.getQuestItemsCount(TABLE) >= 5)) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -115,22 +97,17 @@ public class Q00251_NoSecrets extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() > 81) ? "30201-01.htm" : "30201-00.htm"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "30201-05.htm"; - } - else if ((st.isCond(2)) && (st.getQuestItemsCount(DIARY) >= 10) && (st.getQuestItemsCount(TABLE) >= 5)) - { + } else if ((st.isCond(2)) && (st.getQuestItemsCount(DIARY) >= 10) && (st.getQuestItemsCount(TABLE) >= 5)) { htmltext = "30201-04.htm"; st.giveAdena(313355, true); st.addExpAndSp(56787, 160578); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00252_ItSmellsDelicious/Q00252_ItSmellsDelicious.java b/src/main/java/com/l2jserver/datapack/quests/Q00252_ItSmellsDelicious/Q00252_ItSmellsDelicious.java index 1210357f22..3edf8d06e7 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00252_ItSmellsDelicious/Q00252_ItSmellsDelicious.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00252_ItSmellsDelicious/Q00252_ItSmellsDelicious.java @@ -28,16 +28,14 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Updated by corbin12, thanks VlLight for help. * @author Dumpster, jurchiks */ -public class Q00252_ItSmellsDelicious extends Quest -{ +public class Q00252_ItSmellsDelicious extends Quest { // NPC public static final int STAN = 30200; // Items public static final int DIARY = 15500; public static final int COOKBOOK_PAGE = 15501; // Monsters - private static final int[] MOBS = - { + private static final int[] MOBS = { 22786, 22787, 22788 @@ -49,8 +47,7 @@ public class Q00252_ItSmellsDelicious extends Quest private static final double COOKBOOK_PAGE_CHANCE = 0.36; private static final int COOKBOOK_PAGE_MAX_COUNT = 5; - public Q00252_ItSmellsDelicious() - { + public Q00252_ItSmellsDelicious() { super(252, Q00252_ItSmellsDelicious.class.getSimpleName(), "It Smells Delicious!"); addStartNpc(STAN); addTalkId(STAN); @@ -60,30 +57,25 @@ public class Q00252_ItSmellsDelicious extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { + switch (event) { case "30200-04.htm": htmltext = event; break; case "30200-05.htm": - if (qs.isCreated()) - { + if (qs.isCreated()) { qs.startQuest(); htmltext = event; } break; case "30200-08.html": - if (qs.isCond(2)) - { + if (qs.isCond(2)) { giveAdena(player, 147656, true); addExpAndSp(player, 716238, 78324); qs.exitQuest(false, true); @@ -95,32 +87,23 @@ public class Q00252_ItSmellsDelicious extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs; if (npc.getId() == CHEF) // only the killer gets quest items from the chef { qs = getQuestState(killer, false); - if ((qs != null) && qs.isCond(1)) - { - if (giveItemRandomly(killer, npc, COOKBOOK_PAGE, 1, COOKBOOK_PAGE_MAX_COUNT, COOKBOOK_PAGE_CHANCE, true)) - { - if (hasMaxDiaries(qs)) - { + if ((qs != null) && qs.isCond(1)) { + if (giveItemRandomly(killer, npc, COOKBOOK_PAGE, 1, COOKBOOK_PAGE_MAX_COUNT, COOKBOOK_PAGE_CHANCE, true)) { + if (hasMaxDiaries(qs)) { qs.setCond(2, true); } } } - } - else - { + } else { qs = getRandomPartyMemberState(killer, 1, 3, npc); - if (qs != null) - { - if (giveItemRandomly(qs.getPlayer(), npc, DIARY, 1, DIARY_MAX_COUNT, DIARY_CHANCE, true)) - { - if (hasMaxCookbookPages(qs)) - { + if (qs != null) { + if (giveItemRandomly(qs.getPlayer(), npc, DIARY, 1, DIARY_MAX_COUNT, DIARY_CHANCE, true)) { + if (hasMaxCookbookPages(qs)) { qs.setCond(2, true); } } @@ -130,50 +113,39 @@ public class Q00252_ItSmellsDelicious extends Quest } @Override - public boolean checkPartyMember(QuestState qs, L2Npc npc) - { + public boolean checkPartyMember(QuestState qs, L2Npc npc) { return !hasMaxDiaries(qs); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { + if (qs.isCreated()) { htmltext = ((player.getLevel() >= 82) ? "30200-01.htm" : "30200-02.htm"); - } - else if (qs.isStarted()) - { - switch (qs.getCond()) - { + } else if (qs.isStarted()) { + switch (qs.getCond()) { case 1: htmltext = "30200-06.html"; break; case 2: - if (hasMaxDiaries(qs) && hasMaxCookbookPages(qs)) - { + if (hasMaxDiaries(qs) && hasMaxCookbookPages(qs)) { htmltext = "30200-07.html"; } break; } - } - else - { + } else { htmltext = "30200-03.html"; } return htmltext; } - private static boolean hasMaxDiaries(QuestState qs) - { + private static boolean hasMaxDiaries(QuestState qs) { return (getQuestItemsCount(qs.getPlayer(), DIARY) >= DIARY_MAX_COUNT); } - private static boolean hasMaxCookbookPages(QuestState qs) - { + private static boolean hasMaxCookbookPages(QuestState qs) { return (getQuestItemsCount(qs.getPlayer(), COOKBOOK_PAGE) >= COOKBOOK_PAGE_MAX_COUNT); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00254_LegendaryTales/Q00254_LegendaryTales.java b/src/main/java/com/l2jserver/datapack/quests/Q00254_LegendaryTales/Q00254_LegendaryTales.java index 7684cd5ad4..b8675105d7 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00254_LegendaryTales/Q00254_LegendaryTales.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00254_LegendaryTales/Q00254_LegendaryTales.java @@ -29,14 +29,12 @@ import com.l2jserver.gameserver.model.quest.State; * Legendary Tales (254) * @author nonom */ -public class Q00254_LegendaryTales extends Quest -{ +public class Q00254_LegendaryTales extends Quest { // NPC private static final int GILMORE = 30754; // Monsters - public enum Bosses - { + public enum Bosses { EMERALD_HORN(25718), DUST_RIDER(25719), BLEEDING_FLY(25720), @@ -48,28 +46,22 @@ public class Q00254_LegendaryTales extends Quest private final int _bossId; private final int _mask; - private Bosses(int bossId) - { + private Bosses(int bossId) { _bossId = bossId; _mask = 1 << ordinal(); } - public int getId() - { + public int getId() { return _bossId; } - public int getMask() - { + public int getMask() { return _mask; } - public static Bosses valueOf(int npcId) - { - for (Bosses val : values()) - { - if (val.getId() == npcId) - { + public static Bosses valueOf(int npcId) { + for (Bosses val : values()) { + if (val.getId() == npcId) { return val; } } @@ -92,8 +84,7 @@ public class Q00254_LegendaryTales extends Quest // Misc private static final int MIN_LEVEL = 80; - public Q00254_LegendaryTales() - { + public Q00254_LegendaryTales() { super(254, Q00254_LegendaryTales.class.getSimpleName(), "Legendary Tales"); addStartNpc(GILMORE); addTalkId(GILMORE); @@ -102,23 +93,18 @@ public class Q00254_LegendaryTales extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() < MIN_LEVEL) ? "30754-00.htm" : "30754-01.htm"; break; case State.STARTED: long count = getQuestItemsCount(player, LARGE_DRAGON_SKULL); - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = ((count > 0) ? "30754-14.htm" : "30754-06.html"); - } - else if (st.isCond(2)) - { + } else if (st.isCond(2)) { htmltext = ((count < 7) ? "30754-12.htm" : "30754-07.html"); } break; @@ -130,18 +116,15 @@ public class Q00254_LegendaryTales extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { + switch (event) { case "30754-05.html": st.startQuest(); st.set("raids", 0); @@ -186,8 +169,7 @@ public class Q00254_LegendaryTales extends Quest case "13460": // Vesper Sharper case "13461": // Vesper Fighter case "13462": // Vesper Stormer - if (st.isCond(2) && (getQuestItemsCount(player, LARGE_DRAGON_SKULL) >= 7)) - { + if (st.isCond(2) && (getQuestItemsCount(player, LARGE_DRAGON_SKULL) >= 7)) { htmltext = "30754-09.html"; rewardItems(player, Integer.parseInt(event), 1); st.exitQuest(false, true); @@ -198,51 +180,39 @@ public class Q00254_LegendaryTales extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) - { - if (player.isInParty()) - { - for (L2PcInstance partyMember : player.getParty().getMembers()) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) { + if (player.isInParty()) { + for (L2PcInstance partyMember : player.getParty().getMembers()) { actionForEachPlayer(partyMember, npc, false); } - } - else - { + } else { actionForEachPlayer(player, npc, false); } return super.onKill(npc, player, isPet); } @Override - public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) - { + public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) { final QuestState st = player.getQuestState(Q00254_LegendaryTales.class.getSimpleName()); - if ((st != null) && st.isCond(1)) - { + if ((st != null) && st.isCond(1)) { int raids = st.getInt("raids"); Bosses boss = Bosses.valueOf(npc.getId()); - if (!checkMask(st, boss)) - { + if (!checkMask(st, boss)) { st.set("raids", raids | boss.getMask()); st.giveItems(LARGE_DRAGON_SKULL, 1); - if (st.getQuestItemsCount(LARGE_DRAGON_SKULL) < 7) - { + if (st.getQuestItemsCount(LARGE_DRAGON_SKULL) < 7) { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - } - else - { + } else { st.setCond(2, true); } } } } - private static boolean checkMask(QuestState qs, Bosses boss) - { + private static boolean checkMask(QuestState qs, Bosses boss) { int pos = boss.getMask(); return ((qs.getInt("raids") & pos) == pos); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00255_Tutorial/Q00255_Tutorial.java b/src/main/java/com/l2jserver/datapack/quests/Q00255_Tutorial/Q00255_Tutorial.java index 12bd7fd891..44f11a7197 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00255_Tutorial/Q00255_Tutorial.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00255_Tutorial/Q00255_Tutorial.java @@ -42,8 +42,7 @@ import com.l2jserver.gameserver.model.quest.State; * @author Zealar * @since 2.6.0.0 */ -public class Q00255_Tutorial extends Quest -{ +public class Q00255_Tutorial extends Quest { // Npc private static final int ROIEN = 30008; private static final int NEWBIE_HELPER_HUMAN_FIGHTER = 30009; @@ -128,19 +127,16 @@ public class Q00255_Tutorial extends Quest private static final int Q728_TERRITORY_WAR = 728; // Quests - public Q00255_Tutorial() - { + public Q00255_Tutorial() { super(255, Q00255_Tutorial.class.getSimpleName(), "Tutorial"); - if (character().tutorial()) - { + if (character().tutorial()) { setOnEnterWorld(true); registerTutorialEvent(); registerTutorialClientEvent(); registerTutorialQuestionMark(); registerTutorialCmd(); - int[] list = - { + int[] list = { ROIEN, NEWBIE_HELPER_HUMAN_FIGHTER, GALLINT, @@ -167,17 +163,14 @@ public class Q00255_Tutorial extends Quest * Handle only tutorial_close_ */ @Override - public void onTutorialEvent(L2PcInstance player, String event) - { + public void onTutorialEvent(L2PcInstance player, String event) { // Prevent codes from custom class master - if (event.startsWith("CO")) - { + if (event.startsWith("CO")) { return; } int pass = Integer.parseInt(event.substring(15)); - if (pass < 302) - { + if (pass < 302) { pass = -pass; } tutorialEvent(player, pass); @@ -187,106 +180,80 @@ public class Q00255_Tutorial extends Quest * Handle client events 1, 2, 8 */ @Override - public void onTutorialClientEvent(L2PcInstance player, int event) - { + public void onTutorialClientEvent(L2PcInstance player, int event) { tutorialEvent(player, event); } @Override - public String onTutorialQuestionMark(L2PcInstance player, int number) - { + public String onTutorialQuestionMark(L2PcInstance player, int number) { questionMarkClicked(player, number); return super.onTutorialQuestionMark(player, number); } @Override - public String onTutorialCmd(L2PcInstance player, String command) - { + public String onTutorialCmd(L2PcInstance player, String command) { selectFromMenu(player, Integer.parseInt(command)); return super.onTutorialCmd(player, command); } @Override - public String onEnterWorld(L2PcInstance player) - { + public String onEnterWorld(L2PcInstance player) { userConnected(player); - player.addListener(new ConsumerEventListener(player, EventType.ON_PLAYER_LEVEL_CHANGED, (OnPlayerLevelChanged event) -> - { + player.addListener(new ConsumerEventListener(player, EventType.ON_PLAYER_LEVEL_CHANGED, (OnPlayerLevelChanged event) -> { levelUp(event.getActiveChar(), event.getNewLevel()); }, player)); return super.onEnterWorld(player); } - private void enableTutorialEvent(QuestState qs, int eventStatus) - { + private void enableTutorialEvent(QuestState qs, int eventStatus) { L2PcInstance player = qs.getPlayer(); - if (((eventStatus & (1048576 | 2097152)) != 0)) - { - if (!player.hasListener(EventType.ON_PLAYER_ITEM_PICKUP)) - { - player.addListener(new ConsumerEventListener(player, EventType.ON_PLAYER_ITEM_PICKUP, (OnPlayerItemPickup event) -> - { - if ((event.getItem().getId() == BLUE_GEMSTONE) && ((qs.getMemoState() & 1048576) != 0)) - { + if (((eventStatus & (1048576 | 2097152)) != 0)) { + if (!player.hasListener(EventType.ON_PLAYER_ITEM_PICKUP)) { + player.addListener(new ConsumerEventListener(player, EventType.ON_PLAYER_ITEM_PICKUP, (OnPlayerItemPickup event) -> { + if ((event.getItem().getId() == BLUE_GEMSTONE) && ((qs.getMemoState() & 1048576) != 0)) { tutorialEvent(event.getActiveChar(), 1048576); } - if ((event.getItem().getId() == 57) && ((qs.getMemoState() & 2097152) != 0)) - { + if ((event.getItem().getId() == 57) && ((qs.getMemoState() & 2097152) != 0)) { tutorialEvent(event.getActiveChar(), 2097152); } }, player)); } - } - else if (player.hasListener(EventType.ON_PLAYER_ITEM_PICKUP)) - { + } else if (player.hasListener(EventType.ON_PLAYER_ITEM_PICKUP)) { player.removeListenerIf(EventType.ON_PLAYER_ITEM_PICKUP, listener -> listener.getOwner() == player); } - if ((eventStatus & 8388608) != 0) - { - if (!player.hasListener(EventType.ON_PLAYER_SIT)) - { - player.addListener(new ConsumerEventListener(player, EventType.ON_PLAYER_SIT, (OnPlayerSit event) -> - { + if ((eventStatus & 8388608) != 0) { + if (!player.hasListener(EventType.ON_PLAYER_SIT)) { + player.addListener(new ConsumerEventListener(player, EventType.ON_PLAYER_SIT, (OnPlayerSit event) -> { tutorialEvent(player, 8388608); }, player)); } - } - else if (player.hasListener(EventType.ON_PLAYER_SIT)) - { + } else if (player.hasListener(EventType.ON_PLAYER_SIT)) { player.removeListenerIf(EventType.ON_PLAYER_SIT, listener -> listener.getOwner() == player); } - if ((eventStatus & 256) != 0) - { - if (!player.hasListener(EventType.ON_CREATURE_ATTACKED)) - { - player.addListener(new ConsumerEventListener(player, EventType.ON_CREATURE_ATTACKED, (OnCreatureAttacked event) -> - { + if ((eventStatus & 256) != 0) { + if (!player.hasListener(EventType.ON_CREATURE_ATTACKED)) { + player.addListener(new ConsumerEventListener(player, EventType.ON_CREATURE_ATTACKED, (OnCreatureAttacked event) -> { L2PcInstance pp = event.getTarget().getActingPlayer(); - if ((pp != null) && (pp.getCurrentHp() <= (pp.getStat().getMaxHp() * 0.3))) - { + if ((pp != null) && (pp.getCurrentHp() <= (pp.getStat().getMaxHp() * 0.3))) { tutorialEvent(pp, 256); } }, player)); } - } - else - { + } else { player.removeListenerIf(EventType.ON_CREATURE_ATTACKED, listener -> listener.getOwner() == player); } qs.enableTutorialEvent(player, eventStatus); } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance talker) - { + public String onFirstTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); - switch (npc.getId()) - { + switch (npc.getId()) { case ROIEN: talkRoien(talker, qs); break; @@ -320,16 +287,14 @@ public class Q00255_Tutorial extends Quest case VULKUS: talkGuardianVullkus(talker, qs); break; - case NEWBIE_HELPER_ORC: - { + case NEWBIE_HELPER_ORC: { talkShelaPriestess(npc, talker, qs); break; } case PERWAN: talkSubelderPerwan(talker, qs); break; - case NEWBIE_HELPER_KAMAEL: - { + case NEWBIE_HELPER_KAMAEL: { talkHelperKrenisk(npc, talker, qs); break; } @@ -338,28 +303,22 @@ public class Q00255_Tutorial extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance talker) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance talker) { final int eventId = Integer.parseInt(event); - if (eventId > 1000000) - { + if (eventId > 1000000) { fireEvent(eventId, talker); return super.onAdvEvent(event, npc, talker); } - if (talker.isDead()) - { + if (talker.isDead()) { return super.onAdvEvent(event, npc, talker); } final QuestState qs = getQuestState(talker, true); - switch (npc.getId()) - { - case NEWBIE_HELPER_HUMAN_FIGHTER: - { - switch (qs.getMemoStateEx(1)) - { + switch (npc.getId()) { + case NEWBIE_HELPER_HUMAN_FIGHTER: { + switch (qs.getMemoStateEx(1)) { case 0: qs.playSound(Voice.TUTORIAL_VOICE_009A); qs.setMemoStateEx(1, 1); @@ -369,10 +328,8 @@ public class Q00255_Tutorial extends Quest } break; } - case NEWBIE_HELPER_HUMAN_MAGE: - { - switch (qs.getMemoStateEx(1)) - { + case NEWBIE_HELPER_HUMAN_MAGE: { + switch (qs.getMemoStateEx(1)) { case 0: qs.playSound(Voice.TUTORIAL_VOICE_009B); qs.setMemoStateEx(1, 1); @@ -382,17 +339,12 @@ public class Q00255_Tutorial extends Quest } break; } - case NEWBIE_HELPER_DARK_ELF: - { - switch (qs.getMemoStateEx(1)) - { + case NEWBIE_HELPER_DARK_ELF: { + switch (qs.getMemoStateEx(1)) { case 0: - if (!talker.isMageClass()) - { + if (!talker.isMageClass()) { qs.playSound(Voice.TUTORIAL_VOICE_009A); - } - else - { + } else { qs.playSound(Voice.TUTORIAL_VOICE_009B); } qs.setMemoStateEx(1, 1); @@ -402,17 +354,12 @@ public class Q00255_Tutorial extends Quest } break; } - case NEWBIE_HELPER_ELF: - { - switch (qs.getMemoStateEx(1)) - { + case NEWBIE_HELPER_ELF: { + switch (qs.getMemoStateEx(1)) { case 0: - if (!talker.isMageClass()) - { + if (!talker.isMageClass()) { qs.playSound(Voice.TUTORIAL_VOICE_009A); - } - else - { + } else { qs.playSound(Voice.TUTORIAL_VOICE_009B); } qs.setMemoStateEx(1, 1); @@ -422,10 +369,8 @@ public class Q00255_Tutorial extends Quest } break; } - case NEWBIE_HELPER_DWARF: - { - switch (qs.getMemoStateEx(1)) - { + case NEWBIE_HELPER_DWARF: { + switch (qs.getMemoStateEx(1)) { case 0: qs.playSound(Voice.TUTORIAL_VOICE_009A); qs.setMemoStateEx(1, 1); @@ -435,17 +380,12 @@ public class Q00255_Tutorial extends Quest } break; } - case NEWBIE_HELPER_ORC: - { - switch (qs.getMemoStateEx(1)) - { + case NEWBIE_HELPER_ORC: { + switch (qs.getMemoStateEx(1)) { case 0: - if (!talker.isMageClass()) - { + if (!talker.isMageClass()) { qs.playSound(Voice.TUTORIAL_VOICE_009A); - } - else - { + } else { qs.playSound(Voice.TUTORIAL_VOICE_009C); } qs.setMemoStateEx(1, 1); @@ -455,10 +395,8 @@ public class Q00255_Tutorial extends Quest } break; } - case NEWBIE_HELPER_KAMAEL: - { - switch (qs.getMemoStateEx(1)) - { + case NEWBIE_HELPER_KAMAEL: { + switch (qs.getMemoStateEx(1)) { case 0: qs.playSound(Voice.TUTORIAL_VOICE_009A); qs.setMemoStateEx(1, 1); @@ -468,12 +406,9 @@ public class Q00255_Tutorial extends Quest } break; } - case ROIEN: - { - if (eventId == ROIEN) - { - if (qs.getMemoStateEx(1) >= 4) - { + case ROIEN: { + if (eventId == ROIEN) { + if (qs.getMemoStateEx(1) >= 4) { qs.showQuestionMark(talker, 7); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); qs.playSound(Voice.TUTORIAL_VOICE_025_1000); @@ -483,17 +418,13 @@ public class Q00255_Tutorial extends Quest eventRoien(eventId, talker, npc, qs); break; } - case GALLINT: - { + case GALLINT: { eventGallin(eventId, talker, npc, qs); break; } - case MITRAELL: - { - if (eventId == MITRAELL) - { - if (qs.getMemoStateEx(1) >= 4) - { + case MITRAELL: { + if (eventId == MITRAELL) { + if (qs.getMemoStateEx(1) >= 4) { qs.showQuestionMark(talker, 7); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); qs.playSound(Voice.TUTORIAL_VOICE_025_1000); @@ -503,12 +434,9 @@ public class Q00255_Tutorial extends Quest eventJundin(eventId, talker, npc, qs); break; } - case NERUPA: - { - if (eventId == NERUPA) - { - if (qs.getMemoStateEx(1) >= 4) - { + case NERUPA: { + if (eventId == NERUPA) { + if (qs.getMemoStateEx(1) >= 4) { qs.showQuestionMark(talker, 7); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); qs.playSound(Voice.TUTORIAL_VOICE_025_1000); @@ -518,12 +446,9 @@ public class Q00255_Tutorial extends Quest eventNerupa(eventId, talker, npc, qs); break; } - case LAFERON: - { - if (eventId == LAFERON) - { - if (qs.getMemoStateEx(1) >= 4) - { + case LAFERON: { + if (eventId == LAFERON) { + if (qs.getMemoStateEx(1) >= 4) { qs.showQuestionMark(talker, 7); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); qs.playSound(Voice.TUTORIAL_VOICE_025_1000); @@ -533,12 +458,9 @@ public class Q00255_Tutorial extends Quest eventForemanLaferon(eventId, talker, npc, qs); break; } - case VULKUS: - { - if (eventId == VULKUS) - { - if (qs.getMemoStateEx(1) >= 4) - { + case VULKUS: { + if (eventId == VULKUS) { + if (qs.getMemoStateEx(1) >= 4) { qs.showQuestionMark(talker, 7); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); qs.playSound(Voice.TUTORIAL_VOICE_025_1000); @@ -548,12 +470,9 @@ public class Q00255_Tutorial extends Quest eventGuardianVullkus(eventId, talker, npc, qs); break; } - case PERWAN: - { - if (eventId == PERWAN) - { - if (qs.getMemoStateEx(1) >= 4) - { + case PERWAN: { + if (eventId == PERWAN) { + if (qs.getMemoStateEx(1) >= 4) { qs.showQuestionMark(talker, 7); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); qs.playSound(Voice.TUTORIAL_VOICE_025_1000); @@ -567,21 +486,16 @@ public class Q00255_Tutorial extends Quest return ""; } - private void fireEvent(int timer_id, L2PcInstance talker) - { - if ((talker == null) || talker.isDead() || !talker.isPlayer() || (timer_id <= 1000000)) - { + private void fireEvent(int timer_id, L2PcInstance talker) { + if ((talker == null) || talker.isDead() || !talker.isPlayer() || (timer_id <= 1000000)) { return; } final QuestState qs = talker.getQuestState(Q00255_Tutorial.class.getSimpleName()); - switch (qs.getMemoStateEx(1)) - { - case -2: - { - switch (talker.getClassId()) - { + switch (qs.getMemoStateEx(1)) { + case -2: { + switch (talker.getClassId()) { case fighter: qs.playSound(Voice.TUTORIAL_VOICE_001A_2000); showTutorialHTML(talker, "tutorial-human-fighter-001.htm"); @@ -624,8 +538,7 @@ public class Q00255_Tutorial extends Quest showTutorialHTML(talker, "tutorial-kamael-001.htm"); break; } - if (!qs.hasQuestItems(TUTORIAL_GUIDE)) - { + if (!qs.hasQuestItems(TUTORIAL_GUIDE)) { qs.giveItems(TUTORIAL_GUIDE, 1); } qs.startQuestTimer((talker.getObjectId() + 1000000) + "", 30000); @@ -642,16 +555,13 @@ public class Q00255_Tutorial extends Quest } } - private void tutorialEvent(L2PcInstance talker, int event_id) - { + private void tutorialEvent(L2PcInstance talker, int event_id) { final QuestState qs = talker.getQuestState(this.getClass().getSimpleName()); - if (qs == null) - { + if (qs == null) { return; } // TODO is custom! - if (event_id == 0) - { + if (event_id == 0) { qs.closeTutorialHtml(talker); return; } @@ -659,18 +569,15 @@ public class Q00255_Tutorial extends Quest int memoState = qs.getMemoState(); int memoFlag = memoState & 2147483632; - if (event_id < 0) - { - switch (Math.abs(event_id)) - { + if (event_id < 0) { + switch (Math.abs(event_id)) { case 1: qs.closeTutorialHtml(talker); qs.playSound(Voice.TUTORIAL_VOICE_006_3500); qs.showQuestionMark(talker, 1); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); qs.startQuestTimer((talker.getObjectId() + 1000000) + "", 30000); - if (qs.getMemoStateEx(1) < 0) - { + if (qs.getMemoStateEx(1) < 0) { qs.setMemoStateEx(1, -4); } break; @@ -679,8 +586,7 @@ public class Q00255_Tutorial extends Quest showTutorialHTML(talker, "tutorial-02.htm"); enableTutorialEvent(qs, memoFlag | 1); - if (qs.getMemoStateEx(1) < 0) - { + if (qs.getMemoStateEx(1) < 0) { qs.setMemoStateEx(1, -5); } break; @@ -726,11 +632,9 @@ public class Q00255_Tutorial extends Quest } return; } - switch (event_id) - { + switch (event_id) { case 1: - if (talker.getLevel() < 6) - { + if (talker.getLevel() < 6) { qs.playSound(Voice.TUTORIAL_VOICE_004_5000); showTutorialHTML(talker, "tutorial-03.htm"); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); @@ -738,8 +642,7 @@ public class Q00255_Tutorial extends Quest } break; case 2: - if (talker.getLevel() < 6) - { + if (talker.getLevel() < 6) { qs.playSound(Voice.TUTORIAL_VOICE_005_5000); showTutorialHTML(talker, "tutorial-05.htm"); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); @@ -747,12 +650,10 @@ public class Q00255_Tutorial extends Quest } break; case 8: - if (talker.getLevel() < 6) - { + if (talker.getLevel() < 6) { showTutorialHTML(talker, "tutorial-human-fighter-007.htm"); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); - switch (talker.getClassId()) - { + switch (talker.getClassId()) { case fighter: qs.addRadar(-71424, 258336, -3109); break; @@ -781,15 +682,13 @@ public class Q00255_Tutorial extends Quest } qs.playSound(Voice.TUTORIAL_VOICE_007_3500); qs.setMemoState(memoFlag | 2); - if (qs.getMemoStateEx(1) < 0) - { + if (qs.getMemoStateEx(1) < 0) { qs.setMemoStateEx(1, -5); } } break; case 256: - if (talker.getLevel() < 6) - { + if (talker.getLevel() < 6) { qs.playSound(Voice.TUTORIAL_VOICE_017_1000); qs.showQuestionMark(talker, 10); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); @@ -805,8 +704,7 @@ public class Q00255_Tutorial extends Quest break; case 1024: qs.setMemoState(memoState & ~1024); - switch (talker.getClassId()) - { + switch (talker.getClassId()) { case fighter: qs.addRadar(-83020, 242553, -3718); break; @@ -827,8 +725,7 @@ public class Q00255_Tutorial extends Quest qs.addRadar(-118132, 42788, 723); break; } - if (!talker.isMageClass()) - { + if (!talker.isMageClass()) { qs.playSound(Voice.TUTORIAL_VOICE_014_1000); qs.showQuestionMark(talker, 9); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); @@ -845,13 +742,11 @@ public class Q00255_Tutorial extends Quest enableTutorialEvent(qs, memoFlag | 2048); break; case 2048: - if (talker.isMageClass()) - { + if (talker.isMageClass()) { qs.playSound(Voice.TUTORIAL_VOICE_019_1000); qs.showQuestionMark(talker, 11); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); - switch (talker.getClassId()) - { + switch (talker.getClassId()) { case mage: qs.addRadar(-84981, 244764, -3726); break; @@ -870,8 +765,7 @@ public class Q00255_Tutorial extends Quest enableTutorialEvent(qs, memoFlag | 268435456); break; case 268435456: - if (talker.getClassId() == ClassId.fighter) - { + if (talker.getClassId() == ClassId.fighter) { qs.playSound(Voice.TUTORIAL_VOICE_021_1000); qs.showQuestionMark(talker, 25); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); @@ -880,8 +774,7 @@ public class Q00255_Tutorial extends Quest enableTutorialEvent(qs, memoFlag | 536870912); break; case 536870912: - switch (talker.getClassId()) - { + switch (talker.getClassId()) { case dwarvenFighter: case mage: case elvenFighter: @@ -904,8 +797,7 @@ public class Q00255_Tutorial extends Quest enableTutorialEvent(qs, memoFlag | 1073741824); break; case 1073741824: - switch (talker.getClassId()) - { + switch (talker.getClassId()) { case orcFighter: case orcMage: qs.playSound(Voice.TUTORIAL_VOICE_021_1000); @@ -928,8 +820,7 @@ public class Q00255_Tutorial extends Quest enableTutorialEvent(qs, memoFlag | 16777216); break; case 16777216: - if (talker.getClassId().getRace() != Race.KAMAEL) - { + if (talker.getClassId().getRace() != Race.KAMAEL) { qs.playSound(Voice.TUTORIAL_VOICE_023_1000); qs.showQuestionMark(talker, 15); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); @@ -937,10 +828,8 @@ public class Q00255_Tutorial extends Quest } enableTutorialEvent(qs, memoFlag | 32); break; - case 16384: - { - if ((talker.getClassId().getRace() == Race.KAMAEL) && (talker.getClassId().level() == 1)) - { + case 16384: { + if ((talker.getClassId().getRace() == Race.KAMAEL) && (talker.getClassId().level() == 1)) { qs.playSound(Voice.TUTORIAL_VOICE_028_1000); qs.showQuestionMark(talker, 15); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); @@ -949,10 +838,8 @@ public class Q00255_Tutorial extends Quest enableTutorialEvent(qs, memoFlag | 64); break; } - case 33554432: - { - if (getOneTimeQuestFlag(talker, Q234_FATES_WHISPER) == 0) - { + case 33554432: { + if (getOneTimeQuestFlag(talker, Q234_FATES_WHISPER) == 0) { qs.playSound(Voice.TUTORIAL_VOICE_024_1000); qs.showQuestionMark(talker, 16); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); @@ -961,20 +848,16 @@ public class Q00255_Tutorial extends Quest enableTutorialEvent(qs, memoFlag | 32768); break; } - case 32768: - { - if (getOneTimeQuestFlag(talker, Q234_FATES_WHISPER) == 1) - { + case 32768: { + if (getOneTimeQuestFlag(talker, Q234_FATES_WHISPER) == 1) { qs.showQuestionMark(talker, 29); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); qs.setMemoState(memoState & ~32768); } break; } - case 32: - { - if (getOneTimeQuestFlag(talker, Q128_PAILAKA_SONG_OF_ICE_AND_FIRE) == 0) - { + case 32: { + if (getOneTimeQuestFlag(talker, Q128_PAILAKA_SONG_OF_ICE_AND_FIRE) == 0) { qs.showQuestionMark(talker, 30); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); qs.setMemoState(memoState & ~32); @@ -982,10 +865,8 @@ public class Q00255_Tutorial extends Quest enableTutorialEvent(qs, memoFlag | 16384); break; } - case 64: - { - if (getOneTimeQuestFlag(talker, Q129_PAILAKA_DEVILS_LEGACY) == 0) - { + case 64: { + if (getOneTimeQuestFlag(talker, Q129_PAILAKA_DEVILS_LEGACY) == 0) { qs.showQuestionMark(talker, 31); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); qs.setMemoState(memoState & ~64); @@ -993,10 +874,8 @@ public class Q00255_Tutorial extends Quest enableTutorialEvent(qs, memoFlag | 128); break; } - case 128: - { - if (getOneTimeQuestFlag(talker, Q144_PAIRAKA_WOUNDED_DRAGON) == 0) - { + case 128: { + if (getOneTimeQuestFlag(talker, Q144_PAIRAKA_WOUNDED_DRAGON) == 0) { qs.showQuestionMark(talker, 32); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); qs.setMemoState(memoState & ~128); @@ -1004,10 +883,8 @@ public class Q00255_Tutorial extends Quest enableTutorialEvent(qs, memoFlag | 33554432); break; } - case 2097152: - { - if (talker.getLevel() < 6) - { + case 2097152: { + if (talker.getLevel() < 6) { qs.showQuestionMark(talker, 23); qs.playSound(Voice.TUTORIAL_VOICE_012_1000); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); @@ -1015,10 +892,8 @@ public class Q00255_Tutorial extends Quest } break; } - case 1048576: - { - if (talker.getLevel() < 6) - { + case 1048576: { + if (talker.getLevel() < 6) { qs.showQuestionMark(talker, 5); qs.playSound(Voice.TUTORIAL_VOICE_013_1000); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); @@ -1026,10 +901,8 @@ public class Q00255_Tutorial extends Quest } break; } - case 8388608: - { - if (talker.getLevel() < 6) - { + case 8388608: { + if (talker.getLevel() < 6) { qs.playSound(Voice.TUTORIAL_VOICE_018_1000); showTutorialHTML(talker, "tutorial-21z.htm"); qs.setMemoState(memoState & ~8388608); @@ -1040,10 +913,8 @@ public class Q00255_Tutorial extends Quest } } - private void levelUp(L2PcInstance player, int level) - { - switch (level) - { + private void levelUp(L2PcInstance player, int level) { + switch (level) { case 5: tutorialEvent(player, 1024); break; @@ -1067,16 +938,14 @@ public class Q00255_Tutorial extends Quest break; case 18: tutorialEvent(player, 4096); - if (!haveMemo(player, Q10276_MUTATED_KANEUS_GLUDIO) || (getOneTimeQuestFlag(player, Q10276_MUTATED_KANEUS_GLUDIO) == 0)) - { + if (!haveMemo(player, Q10276_MUTATED_KANEUS_GLUDIO) || (getOneTimeQuestFlag(player, Q10276_MUTATED_KANEUS_GLUDIO) == 0)) { showTutorialHTML(player, "tw-gludio.htm"); playSound(player, Sound.ITEMSOUND_QUEST_TUTORIAL); showRadar(player, -13900, 123822, -3112, 2); } break; case 28: - if (!haveMemo(player, Q10277_MUTATED_KANEUS_DION) || (getOneTimeQuestFlag(player, Q10277_MUTATED_KANEUS_DION) == 0)) - { + if (!haveMemo(player, Q10277_MUTATED_KANEUS_DION) || (getOneTimeQuestFlag(player, Q10277_MUTATED_KANEUS_DION) == 0)) { showTutorialHTML(player, "tw-dion.htm"); playSound(player, Sound.ITEMSOUND_QUEST_TUTORIAL); showRadar(player, 18199, 146081, -3080, 2); @@ -1089,30 +958,26 @@ public class Q00255_Tutorial extends Quest tutorialEvent(player, 32); break; case 38: - if (!haveMemo(player, Q10278_MUTATED_KANEUS_HEINE) || (getOneTimeQuestFlag(player, Q10278_MUTATED_KANEUS_HEINE) == 0)) - { + if (!haveMemo(player, Q10278_MUTATED_KANEUS_HEINE) || (getOneTimeQuestFlag(player, Q10278_MUTATED_KANEUS_HEINE) == 0)) { showTutorialHTML(player, "tw-heine.htm"); playSound(player, Sound.ITEMSOUND_QUEST_TUTORIAL); showRadar(player, 108384, 221563, -3592, 2); } break; case 39: - if (player.getRace() == Race.KAMAEL) - { + if (player.getRace() == Race.KAMAEL) { tutorialEvent(player, 16384); } break; case 48: - if (!haveMemo(player, Q10279_MUTATED_KANEUS_OREN) || (getOneTimeQuestFlag(player, Q10279_MUTATED_KANEUS_OREN) == 0)) - { + if (!haveMemo(player, Q10279_MUTATED_KANEUS_OREN) || (getOneTimeQuestFlag(player, Q10279_MUTATED_KANEUS_OREN) == 0)) { showTutorialHTML(player, "tw-oren.htm"); playSound(player, Sound.ITEMSOUND_QUEST_TUTORIAL); showRadar(player, 81023, 56456, -1552, 2); } break; case 58: - if (!haveMemo(player, Q10280_MUTATED_KANEUS_SCHUTTGART) || (getOneTimeQuestFlag(player, Q10280_MUTATED_KANEUS_SCHUTTGART) == 0)) - { + if (!haveMemo(player, Q10280_MUTATED_KANEUS_SCHUTTGART) || (getOneTimeQuestFlag(player, Q10280_MUTATED_KANEUS_SCHUTTGART) == 0)) { showTutorialHTML(player, "tw-schuttgart.htm"); playSound(player, Sound.ITEMSOUND_QUEST_TUTORIAL); showRadar(player, 85868, -142164, -1342, 2); @@ -1122,8 +987,7 @@ public class Q00255_Tutorial extends Quest tutorialEvent(player, 64); break; case 68: - if (!haveMemo(player, Q10281_MUTATED_KANEUS_RUNE) || (getOneTimeQuestFlag(player, Q10281_MUTATED_KANEUS_RUNE) == 0)) - { + if (!haveMemo(player, Q10281_MUTATED_KANEUS_RUNE) || (getOneTimeQuestFlag(player, Q10281_MUTATED_KANEUS_RUNE) == 0)) { showTutorialHTML(player, "tw-rune.htm"); playSound(player, Sound.ITEMSOUND_QUEST_TUTORIAL); showRadar(player, 42596, -47988, -800, 2); @@ -1133,16 +997,14 @@ public class Q00255_Tutorial extends Quest tutorialEvent(player, 128); break; case 79: - if (!haveMemo(player, Q192_SEVEN_SIGNS_SERIES_OF_DOUBT) || (getOneTimeQuestFlag(player, Q192_SEVEN_SIGNS_SERIES_OF_DOUBT) == 0)) - { + if (!haveMemo(player, Q192_SEVEN_SIGNS_SERIES_OF_DOUBT) || (getOneTimeQuestFlag(player, Q192_SEVEN_SIGNS_SERIES_OF_DOUBT) == 0)) { showTutorialHTML(player, "tutorial-ss-79.htm"); playSound(player, Sound.ITEMSOUND_QUEST_TUTORIAL); showRadar(player, 81655, 54736, -1509, 2); } break; case 81: - if (!haveMemo(player, Q10292_SEVEN_SIGNS_GIRL_OF_DOUBT) || (getOneTimeQuestFlag(player, Q10292_SEVEN_SIGNS_GIRL_OF_DOUBT) == 0)) - { + if (!haveMemo(player, Q10292_SEVEN_SIGNS_GIRL_OF_DOUBT) || (getOneTimeQuestFlag(player, Q10292_SEVEN_SIGNS_GIRL_OF_DOUBT) == 0)) { showTutorialHTML(player, "tutorial-ss-81.htm"); playSound(player, Sound.ITEMSOUND_QUEST_TUTORIAL); showRadar(player, 146995, 23755, -1984, 2); @@ -1151,10 +1013,8 @@ public class Q00255_Tutorial extends Quest } } - private void selectFromMenu(L2PcInstance talker, int reply) - { - switch (reply) - { + private void selectFromMenu(L2PcInstance talker, int reply) { + switch (reply) { case 1: showTutorialHTML(talker, "tutorial-22g.htm"); break; @@ -1231,8 +1091,7 @@ public class Q00255_Tutorial extends Quest showTutorialHTML(talker, "tutorial-22pp.htm"); break; case 26: - switch (talker.getClassId()) - { + switch (talker.getClassId()) { case warrior: showTutorialHTML(talker, "tutorial-22.htm"); break; @@ -1304,8 +1163,7 @@ public class Q00255_Tutorial extends Quest showTutorialHTML(talker, "tutorial-07b.htm"); break; case 31: - switch (talker.getClassId()) - { + switch (talker.getClassId()) { case trooper: showTutorialHTML(talker, "tutorial-28a.htm"); break; @@ -1318,8 +1176,7 @@ public class Q00255_Tutorial extends Quest showTutorialHTML(talker, "tutorial-22qa.htm"); break; case 33: - switch (talker.getClassId()) - { + switch (talker.getClassId()) { case trooper: showTutorialHTML(talker, "tutorial-22qb.htm"); break; @@ -1334,21 +1191,17 @@ public class Q00255_Tutorial extends Quest } } - private void questionMarkClicked(L2PcInstance talker, int question_id) - { + private void questionMarkClicked(L2PcInstance talker, int question_id) { QuestState qs = talker.getQuestState(this.getClass().getSimpleName()); final int memoFlag = qs.getMemoState() & 2147483392; - switch (question_id) - { + switch (question_id) { case 1: qs.playSound(Voice.TUTORIAL_VOICE_007_3500); - if (qs.getMemoStateEx(1) < 0) - { + if (qs.getMemoStateEx(1) < 0) { qs.setMemoStateEx(1, -5); } - switch (talker.getClassId()) - { + switch (talker.getClassId()) { case fighter: showTutorialHTML(talker, "tutorial-human-fighter-007.htm"); qs.addRadar(-71424, 258336, -3109); @@ -1385,8 +1238,7 @@ public class Q00255_Tutorial extends Quest qs.setMemoState(memoFlag | 2); break; case 2: - switch (talker.getClassId()) - { + switch (talker.getClassId()) { case fighter: showTutorialHTML(talker, "tutorial-human-fighter-008.htm"); break; @@ -1424,8 +1276,7 @@ public class Q00255_Tutorial extends Quest showTutorialHTML(talker, "tutorial-10.htm"); break; case 5: - switch (talker.getClassId()) - { + switch (talker.getClassId()) { case fighter: qs.addRadar(-71424, 258336, -3109); break; @@ -1462,10 +1313,8 @@ public class Q00255_Tutorial extends Quest showTutorialHTML(talker, "tutorial-18.htm"); break; case 9: - if (!talker.isMageClass()) - { - switch (talker.getRace()) - { + if (!talker.isMageClass()) { + switch (talker.getRace()) { case HUMAN: case ELF: case DARK_ELF: @@ -1486,8 +1335,7 @@ public class Q00255_Tutorial extends Quest showTutorialHTML(talker, "tutorial-19.htm"); break; case 11: - switch (talker.getRace()) - { + switch (talker.getRace()) { case HUMAN: showTutorialHTML(talker, "tutorial-mage-020.htm"); break; @@ -1504,8 +1352,7 @@ public class Q00255_Tutorial extends Quest showTutorialHTML(talker, "tutorial-15.htm"); break; case 13: - switch (talker.getClassId()) - { + switch (talker.getClassId()) { case fighter: showTutorialHTML(talker, "tutorial-21.htm"); break; @@ -1542,16 +1389,11 @@ public class Q00255_Tutorial extends Quest } break; case 15: - if (talker.getRace() != Race.KAMAEL) - { + if (talker.getRace() != Race.KAMAEL) { showTutorialHTML(talker, "tutorial-28.htm"); - } - else if (talker.getClassId() == ClassId.trooper) - { + } else if (talker.getClassId() == ClassId.trooper) { showTutorialHTML(talker, "tutorial-28a.htm"); - } - else if (talker.getClassId() == ClassId.warder) - { + } else if (talker.getClassId() == ClassId.warder) { showTutorialHTML(talker, "tutorial-28b.htm"); } break; @@ -1577,8 +1419,7 @@ public class Q00255_Tutorial extends Quest showTutorialHTML(talker, "tutorial-24.htm"); break; case 24: - switch (talker.getRace()) - { + switch (talker.getRace()) { case HUMAN: showTutorialHTML(talker, "tutorial-newbie-003a.htm"); break; @@ -1599,8 +1440,7 @@ public class Q00255_Tutorial extends Quest } break; case 25: - switch (talker.getClassId()) - { + switch (talker.getClassId()) { case fighter: showTutorialHTML(talker, "tutorial-newbie-002a.htm"); break; @@ -1631,18 +1471,14 @@ public class Q00255_Tutorial extends Quest } break; case 26: - if (!talker.isMageClass() || (talker.getClassId() == ClassId.orcMage)) - { + if (!talker.isMageClass() || (talker.getClassId() == ClassId.orcMage)) { showTutorialHTML(talker, "tutorial-newbie-004a.htm"); - } - else - { + } else { showTutorialHTML(talker, "tutorial-newbie-004b.htm"); } break; case 27: - switch (talker.getClassId()) - { + switch (talker.getClassId()) { case fighter: case orcMage: case orcFighter: @@ -1665,8 +1501,7 @@ public class Q00255_Tutorial extends Quest showTutorialHTML(talker, "tutorial-35.htm"); break; case 33: - switch (talker.getLevel()) - { + switch (talker.getLevel()) { case 18: showTutorialHTML(talker, "tw-gludio.htm"); break; @@ -1688,54 +1523,43 @@ public class Q00255_Tutorial extends Quest } break; case 34: - if (talker.getLevel() == 79) - { + if (talker.getLevel() == 79) { showTutorialHTML(talker, "tutorial-ss-79.htm"); } break; } } - private void userConnected(L2PcInstance talker) - { + private void userConnected(L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); - if (qs == null) - { + if (qs == null) { return; } - if (!qs.isStarted()) - { + if (!qs.isStarted()) { qs.setState(State.STARTED); } - if (talker.getLevel() < 6) - { - if (getOneTimeQuestFlag(talker, 255) != 0) - { + if (talker.getLevel() < 6) { + if (getOneTimeQuestFlag(talker, 255) != 0) { return; } int memoState = qs.getMemoState(); int memoFlag; - if (memoState == -1) - { + if (memoState == -1) { memoState = 0; memoFlag = 0; - } - else - { + } else { memoFlag = memoState & 255; memoState = memoState & 2147483392; } - switch (memoFlag) - { + switch (memoFlag) { case 0: qs.startQuestTimer((talker.getObjectId() + 1000000) + "", 10000); memoState = 2147483392 & ~(8388608 | 1048576); qs.setMemoState(1 | memoState); - if (qs.getMemoStateEx(1) < 0) - { + if (qs.getMemoStateEx(1) < 0) { qs.setMemoStateEx(1, -2); } break; @@ -1745,30 +1569,23 @@ public class Q00255_Tutorial extends Quest qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); break; case 2: - if (haveMemo(talker, Q201_TUTORIAL_HUMAN_FIGHTER) || haveMemo(talker, Q202_TUTORIAL_HUMAN_MAGE) || haveMemo(talker, Q203_TUTORIAL_ELF) || haveMemo(talker, Q204_TUTORIAL_DARK_ELF) || haveMemo(talker, Q205_TUTORIAL_ORC) || haveMemo(talker, Q206_TUTORIAL_DWARF)) - { + if (haveMemo(talker, Q201_TUTORIAL_HUMAN_FIGHTER) || haveMemo(talker, Q202_TUTORIAL_HUMAN_MAGE) || haveMemo(talker, Q203_TUTORIAL_ELF) || haveMemo(talker, Q204_TUTORIAL_DARK_ELF) || haveMemo(talker, Q205_TUTORIAL_ORC) || haveMemo(talker, Q206_TUTORIAL_DWARF)) { qs.showQuestionMark(talker, 6); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); - } - else - { + } else { qs.showQuestionMark(talker, 2); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); } break; case 3: int stateMark = 1; - if (qs.getQuestItemsCount(BLUE_GEMSTONE) == 1) - { + if (qs.getQuestItemsCount(BLUE_GEMSTONE) == 1) { stateMark = 3; - } - else if (qs.getMemoStateEx(1) == 2) - { + } else if (qs.getMemoStateEx(1) == 2) { stateMark = 2; } - switch (stateMark) - { + switch (stateMark) { case 1: qs.showQuestionMark(talker, 3); break; @@ -1787,56 +1604,46 @@ public class Q00255_Tutorial extends Quest break; } enableTutorialEvent(qs, memoState); - } - else - { - switch (talker.getLevel()) - { + } else { + switch (talker.getLevel()) { case 18: - if (haveMemo(talker, 10276) && (getOneTimeQuestFlag(talker, 10276) == 0)) - { + if (haveMemo(talker, 10276) && (getOneTimeQuestFlag(talker, 10276) == 0)) { qs.showQuestionMark(talker, 33); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); } break; case 28: - if (haveMemo(talker, 10277) && (getOneTimeQuestFlag(talker, 10277) == 0)) - { + if (haveMemo(talker, 10277) && (getOneTimeQuestFlag(talker, 10277) == 0)) { qs.showQuestionMark(talker, 33); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); } break; case 38: - if (haveMemo(talker, 10278) && (getOneTimeQuestFlag(talker, 10278) == 0)) - { + if (haveMemo(talker, 10278) && (getOneTimeQuestFlag(talker, 10278) == 0)) { qs.showQuestionMark(talker, 33); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); } break; case 48: - if (haveMemo(talker, 10279) && (getOneTimeQuestFlag(talker, 10279) == 0)) - { + if (haveMemo(talker, 10279) && (getOneTimeQuestFlag(talker, 10279) == 0)) { qs.showQuestionMark(talker, 33); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); } break; case 58: - if (haveMemo(talker, 10280) && (getOneTimeQuestFlag(talker, 10280) == 0)) - { + if (haveMemo(talker, 10280) && (getOneTimeQuestFlag(talker, 10280) == 0)) { qs.showQuestionMark(talker, 33); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); } break; case 68: - if (haveMemo(talker, 10281) && (getOneTimeQuestFlag(talker, 10281) == 0)) - { + if (haveMemo(talker, 10281) && (getOneTimeQuestFlag(talker, 10281) == 0)) { qs.showQuestionMark(talker, 33); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); } break; case 79: - if (haveMemo(talker, 192) && (getOneTimeQuestFlag(talker, 192) == 0)) - { + if (haveMemo(talker, 192) && (getOneTimeQuestFlag(talker, 192) == 0)) { qs.showQuestionMark(talker, 34); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); } @@ -1846,222 +1653,170 @@ public class Q00255_Tutorial extends Quest int territoryWarId = qs.getDominionSiegeID(talker); int territoryWarState = qs.getNRMemoStateEx(talker, 728, 1); - if ((territoryWarId > 0) && (qs.getDominionWarState(territoryWarId) == 5)) - { - if (!qs.haveNRMemo(talker, 728)) - { + if ((territoryWarId > 0) && (qs.getDominionWarState(territoryWarId) == 5)) { + if (!qs.haveNRMemo(talker, 728)) { qs.setNRMemo(talker, 728); qs.setNRMemoState(talker, 728, 0); qs.setNRMemoStateEx(talker, 728, 1, territoryWarId); - } - else if (territoryWarId != territoryWarState) - { + } else if (territoryWarId != territoryWarState) { qs.setNRMemoState(talker, 728, 0); qs.setNRMemoStateEx(talker, 728, 1, territoryWarId); } - switch (territoryWarId) - { + switch (territoryWarId) { case 81: - if (qs.getDominionWarState(TW_GLUDIO) == 5) - { - if (!qs.haveNRMemo(talker, Q717_FOR_THE_SAKE_OF_THE_TERRITORY_GLUDIO)) - { + if (qs.getDominionWarState(TW_GLUDIO) == 5) { + if (!qs.haveNRMemo(talker, Q717_FOR_THE_SAKE_OF_THE_TERRITORY_GLUDIO)) { qs.setNRMemo(talker, Q717_FOR_THE_SAKE_OF_THE_TERRITORY_GLUDIO); qs.setNRMemoState(talker, Q717_FOR_THE_SAKE_OF_THE_TERRITORY_GLUDIO, 0); qs.setNRFlagJournal(talker, Q717_FOR_THE_SAKE_OF_THE_TERRITORY_GLUDIO, 1); qs.showQuestionMark(talker, Q717_FOR_THE_SAKE_OF_THE_TERRITORY_GLUDIO); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { qs.showQuestionMark(talker, Q717_FOR_THE_SAKE_OF_THE_TERRITORY_GLUDIO); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); } } break; case 82: - if (qs.getDominionWarState(TW_DION) == 5) - { - if (!qs.haveNRMemo(talker, Q718_FOR_THE_SAKE_OF_THE_TERRITORY_DION)) - { + if (qs.getDominionWarState(TW_DION) == 5) { + if (!qs.haveNRMemo(talker, Q718_FOR_THE_SAKE_OF_THE_TERRITORY_DION)) { qs.setNRMemo(talker, Q718_FOR_THE_SAKE_OF_THE_TERRITORY_DION); qs.setNRMemoState(talker, Q718_FOR_THE_SAKE_OF_THE_TERRITORY_DION, 0); qs.setNRFlagJournal(talker, Q718_FOR_THE_SAKE_OF_THE_TERRITORY_DION, 1); qs.showQuestionMark(talker, Q718_FOR_THE_SAKE_OF_THE_TERRITORY_DION); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { qs.showQuestionMark(talker, Q718_FOR_THE_SAKE_OF_THE_TERRITORY_DION); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); } } break; case 83: - if (qs.getDominionWarState(TW_GIRAN) == 5) - { - if (!qs.haveNRMemo(talker, Q719_FOR_THE_SAKE_OF_THE_TERRITORY_GIRAN)) - { + if (qs.getDominionWarState(TW_GIRAN) == 5) { + if (!qs.haveNRMemo(talker, Q719_FOR_THE_SAKE_OF_THE_TERRITORY_GIRAN)) { qs.setNRMemo(talker, Q719_FOR_THE_SAKE_OF_THE_TERRITORY_GIRAN); qs.setNRMemoState(talker, Q719_FOR_THE_SAKE_OF_THE_TERRITORY_GIRAN, 0); qs.setNRFlagJournal(talker, Q719_FOR_THE_SAKE_OF_THE_TERRITORY_GIRAN, 1); qs.showQuestionMark(talker, Q719_FOR_THE_SAKE_OF_THE_TERRITORY_GIRAN); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { qs.showQuestionMark(talker, Q719_FOR_THE_SAKE_OF_THE_TERRITORY_GIRAN); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); } } break; case 84: - if (qs.getDominionWarState(TW_OREN) == 5) - { - if (!qs.haveNRMemo(talker, Q720_FOR_THE_SAKE_OF_THE_TERRITORY_OREN)) - { + if (qs.getDominionWarState(TW_OREN) == 5) { + if (!qs.haveNRMemo(talker, Q720_FOR_THE_SAKE_OF_THE_TERRITORY_OREN)) { qs.setNRMemo(talker, Q720_FOR_THE_SAKE_OF_THE_TERRITORY_OREN); qs.setNRMemoState(talker, Q720_FOR_THE_SAKE_OF_THE_TERRITORY_OREN, 0); qs.setNRFlagJournal(talker, Q720_FOR_THE_SAKE_OF_THE_TERRITORY_OREN, 1); qs.showQuestionMark(talker, Q720_FOR_THE_SAKE_OF_THE_TERRITORY_OREN); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { qs.showQuestionMark(talker, Q720_FOR_THE_SAKE_OF_THE_TERRITORY_OREN); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); } } break; case 85: - if (qs.getDominionWarState(TW_ADEN) == 5) - { - if (!qs.haveNRMemo(talker, Q721_FOR_THE_SAKE_OF_THE_TERRITORY_ADEN)) - { + if (qs.getDominionWarState(TW_ADEN) == 5) { + if (!qs.haveNRMemo(talker, Q721_FOR_THE_SAKE_OF_THE_TERRITORY_ADEN)) { qs.setNRMemo(talker, Q721_FOR_THE_SAKE_OF_THE_TERRITORY_ADEN); qs.setNRMemoState(talker, Q721_FOR_THE_SAKE_OF_THE_TERRITORY_ADEN, 0); qs.setNRFlagJournal(talker, Q721_FOR_THE_SAKE_OF_THE_TERRITORY_ADEN, 1); qs.showQuestionMark(talker, Q721_FOR_THE_SAKE_OF_THE_TERRITORY_ADEN); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { qs.showQuestionMark(talker, Q721_FOR_THE_SAKE_OF_THE_TERRITORY_ADEN); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); } } break; case 86: - if (qs.getDominionWarState(TW_HEINE) == 5) - { - if (!qs.haveNRMemo(talker, Q722_FOR_THE_SAKE_OF_THE_TERRITORY_INNADRIL)) - { + if (qs.getDominionWarState(TW_HEINE) == 5) { + if (!qs.haveNRMemo(talker, Q722_FOR_THE_SAKE_OF_THE_TERRITORY_INNADRIL)) { qs.setNRMemo(talker, Q722_FOR_THE_SAKE_OF_THE_TERRITORY_INNADRIL); qs.setNRMemoState(talker, Q722_FOR_THE_SAKE_OF_THE_TERRITORY_INNADRIL, 0); qs.setNRFlagJournal(talker, Q722_FOR_THE_SAKE_OF_THE_TERRITORY_INNADRIL, 1); qs.showQuestionMark(talker, Q722_FOR_THE_SAKE_OF_THE_TERRITORY_INNADRIL); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { qs.showQuestionMark(talker, Q722_FOR_THE_SAKE_OF_THE_TERRITORY_INNADRIL); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); } } break; case 87: - if (qs.getDominionWarState(TW_GODDARD) == 5) - { - if (!qs.haveNRMemo(talker, Q723_FOR_THE_SAKE_OF_THE_TERRITORY_GODDARD)) - { + if (qs.getDominionWarState(TW_GODDARD) == 5) { + if (!qs.haveNRMemo(talker, Q723_FOR_THE_SAKE_OF_THE_TERRITORY_GODDARD)) { qs.setNRMemo(talker, Q723_FOR_THE_SAKE_OF_THE_TERRITORY_GODDARD); qs.setNRMemoState(talker, Q723_FOR_THE_SAKE_OF_THE_TERRITORY_GODDARD, 0); qs.setNRFlagJournal(talker, Q723_FOR_THE_SAKE_OF_THE_TERRITORY_GODDARD, 1); qs.showQuestionMark(talker, Q723_FOR_THE_SAKE_OF_THE_TERRITORY_GODDARD); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { qs.showQuestionMark(talker, Q723_FOR_THE_SAKE_OF_THE_TERRITORY_GODDARD); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); } } break; case 88: - if (qs.getDominionWarState(TW_RUNE) == 5) - { - if (!qs.haveNRMemo(talker, Q724_FOR_THE_SAKE_OF_THE_TERRITORY_RUNE)) - { + if (qs.getDominionWarState(TW_RUNE) == 5) { + if (!qs.haveNRMemo(talker, Q724_FOR_THE_SAKE_OF_THE_TERRITORY_RUNE)) { qs.setNRMemo(talker, Q724_FOR_THE_SAKE_OF_THE_TERRITORY_RUNE); qs.setNRMemoState(talker, Q724_FOR_THE_SAKE_OF_THE_TERRITORY_RUNE, 0); qs.setNRFlagJournal(talker, Q724_FOR_THE_SAKE_OF_THE_TERRITORY_RUNE, 1); qs.showQuestionMark(talker, Q724_FOR_THE_SAKE_OF_THE_TERRITORY_RUNE); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { qs.showQuestionMark(talker, Q724_FOR_THE_SAKE_OF_THE_TERRITORY_RUNE); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); } } break; case 89: - if (qs.getDominionWarState(TW_SCHUTTGART) == 5) - { - if (!qs.haveNRMemo(talker, Q725_FOR_THE_SAKE_OF_THE_TERRITORY_SCHUTTGART)) - { + if (qs.getDominionWarState(TW_SCHUTTGART) == 5) { + if (!qs.haveNRMemo(talker, Q725_FOR_THE_SAKE_OF_THE_TERRITORY_SCHUTTGART)) { qs.setNRMemo(talker, Q725_FOR_THE_SAKE_OF_THE_TERRITORY_SCHUTTGART); qs.setNRMemoState(talker, Q725_FOR_THE_SAKE_OF_THE_TERRITORY_SCHUTTGART, 0); qs.setNRFlagJournal(talker, Q725_FOR_THE_SAKE_OF_THE_TERRITORY_SCHUTTGART, 1); qs.showQuestionMark(talker, Q725_FOR_THE_SAKE_OF_THE_TERRITORY_SCHUTTGART); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { qs.showQuestionMark(talker, Q725_FOR_THE_SAKE_OF_THE_TERRITORY_SCHUTTGART); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); } } break; } - } - else - { - if (qs.haveNRMemo(talker, Q728_TERRITORY_WAR)) - { - if ((territoryWarState >= 81) && (territoryWarState <= 89)) - { + } else { + if (qs.haveNRMemo(talker, Q728_TERRITORY_WAR)) { + if ((territoryWarState >= 81) && (territoryWarState <= 89)) { int twNRState = qs.getNRMemoState(talker, Q728_TERRITORY_WAR); int twNRStateForCurrentWar = qs.getNRMemoState(talker, 636 + territoryWarState); - if (twNRStateForCurrentWar >= 0) - { + if (twNRStateForCurrentWar >= 0) { qs.setNRMemoState(talker, Q728_TERRITORY_WAR, twNRStateForCurrentWar + twNRState); qs.removeNRMemo(talker, 636 + territoryWarState); } } } - if (qs.haveNRMemo(talker, 739) && (qs.getNRMemoState(talker, 739) > 0)) - { + if (qs.haveNRMemo(talker, 739) && (qs.getNRMemoState(talker, 739) > 0)) { qs.setNRMemoState(talker, 739, 0); } - if (qs.haveNRMemo(talker, Q729_PROTECT_THE_TERRITORY_CATAPULT)) - { + if (qs.haveNRMemo(talker, Q729_PROTECT_THE_TERRITORY_CATAPULT)) { qs.removeNRMemo(talker, 729); } - if (qs.haveNRMemo(talker, Q730_PROTECT_THE_SUPPLIES_SAFE)) - { + if (qs.haveNRMemo(talker, Q730_PROTECT_THE_SUPPLIES_SAFE)) { qs.removeNRMemo(talker, 730); } - if (qs.haveNRMemo(talker, Q731_PROTECT_THE_MILITARY_ASSOCIATION_LEADER)) - { + if (qs.haveNRMemo(talker, Q731_PROTECT_THE_MILITARY_ASSOCIATION_LEADER)) { qs.removeNRMemo(talker, 731); } - if (qs.haveNRMemo(talker, Q732_PROTECT_THE_RELIGIOUS_ASSOCIATION_LEADER)) - { + if (qs.haveNRMemo(talker, Q732_PROTECT_THE_RELIGIOUS_ASSOCIATION_LEADER)) { qs.removeNRMemo(talker, 732); } - if (qs.haveNRMemo(talker, Q733_PROTECT_THE_ECONOMIC_ASSOCIATION_LEADER)) - { + if (qs.haveNRMemo(talker, Q733_PROTECT_THE_ECONOMIC_ASSOCIATION_LEADER)) { qs.removeNRMemo(talker, 733); } } @@ -2070,29 +1825,21 @@ public class Q00255_Tutorial extends Quest // ---------------------------------- Event - private void eventRoien(int event, L2PcInstance talker, L2Npc npc, QuestState qs) - { - switch (event) - { + private void eventRoien(int event, L2PcInstance talker, L2Npc npc, QuestState qs) { + switch (event) { case 31: - if (qs.hasQuestItems(RECOMMENDATION_1)) - { - if (!talker.isMageClass() && (qs.getMemoStateEx(1) <= 3)) - { + if (qs.hasQuestItems(RECOMMENDATION_1)) { + if (!talker.isMageClass() && (qs.getMemoStateEx(1) <= 3)) { qs.giveItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS, 200); qs.playSound(Voice.TUTORIAL_VOICE_026_1000); qs.addExpAndSp(0, 50); qs.setMemoStateEx(1, 4); } - if (talker.isMageClass() && (qs.getMemoStateEx(1) <= 3)) - { - if (talker.getClassId() == ClassId.orcMage) - { + if (talker.isMageClass() && (qs.getMemoStateEx(1) <= 3)) { + if (talker.getClassId() == ClassId.orcMage) { qs.giveItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS, 200); qs.playSound(Voice.TUTORIAL_VOICE_026_1000); - } - else - { + } else { qs.giveItems(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS, 100); qs.playSound(Voice.TUTORIAL_VOICE_027_1000); } @@ -2114,28 +1861,20 @@ public class Q00255_Tutorial extends Quest } } - private void eventGallin(int event, L2PcInstance talker, L2Npc npc, QuestState qs) - { - switch (event) - { + private void eventGallin(int event, L2PcInstance talker, L2Npc npc, QuestState qs) { + switch (event) { case 31: - if (qs.hasQuestItems(RECOMMENDATION_2)) - { - if (!talker.isMageClass() && (qs.getQuestItemsCount(SOULSHOT_NO_GRADE_FOR_BEGINNERS) <= 200)) - { + if (qs.hasQuestItems(RECOMMENDATION_2)) { + if (!talker.isMageClass() && (qs.getQuestItemsCount(SOULSHOT_NO_GRADE_FOR_BEGINNERS) <= 200)) { qs.playSound(Voice.TUTORIAL_VOICE_026_1000); qs.giveItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS, 200); qs.addExpAndSp(0, 50); } - if (talker.isMageClass() && (qs.getQuestItemsCount(SOULSHOT_NO_GRADE_FOR_BEGINNERS) <= 200) && (qs.getQuestItemsCount(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS) <= 100)) - { - if (talker.getClassId() == ClassId.orcMage) - { + if (talker.isMageClass() && (qs.getQuestItemsCount(SOULSHOT_NO_GRADE_FOR_BEGINNERS) <= 200) && (qs.getQuestItemsCount(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS) <= 100)) { + if (talker.getClassId() == ClassId.orcMage) { qs.playSound(Voice.TUTORIAL_VOICE_026_1000); qs.giveItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS, 200); - } - else - { + } else { qs.playSound(Voice.TUTORIAL_VOICE_027_1000); qs.giveItems(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS, 200); } @@ -2143,8 +1882,7 @@ public class Q00255_Tutorial extends Quest } qs.takeItems(RECOMMENDATION_2, 1); startQuestTimer(npc.getId() + "", 60000, npc, talker); - if (qs.getMemoStateEx(1) <= 3) - { + if (qs.getMemoStateEx(1) <= 3) { qs.setMemoStateEx(1, 4); } showPage(talker, "30017-002.htm"); @@ -2161,28 +1899,20 @@ public class Q00255_Tutorial extends Quest } } - private void eventJundin(int event, L2PcInstance talker, L2Npc npc, QuestState qs) - { - switch (event) - { + private void eventJundin(int event, L2PcInstance talker, L2Npc npc, QuestState qs) { + switch (event) { case 31: - if (qs.hasQuestItems(BLOOD_OF_MITRAELL)) - { - if (!talker.isMageClass() && (qs.getQuestItemsCount(SOULSHOT_NO_GRADE_FOR_BEGINNERS) <= 200)) - { + if (qs.hasQuestItems(BLOOD_OF_MITRAELL)) { + if (!talker.isMageClass() && (qs.getQuestItemsCount(SOULSHOT_NO_GRADE_FOR_BEGINNERS) <= 200)) { qs.playSound(Voice.TUTORIAL_VOICE_026_1000); qs.giveItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS, 200); qs.addExpAndSp(0, 50); } - if (talker.isMageClass() && (qs.getQuestItemsCount(SOULSHOT_NO_GRADE_FOR_BEGINNERS) <= 200) && (qs.getQuestItemsCount(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS) <= 100)) - { - if (talker.getClassId() == ClassId.orcMage) - { + if (talker.isMageClass() && (qs.getQuestItemsCount(SOULSHOT_NO_GRADE_FOR_BEGINNERS) <= 200) && (qs.getQuestItemsCount(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS) <= 100)) { + if (talker.getClassId() == ClassId.orcMage) { qs.playSound(Voice.TUTORIAL_VOICE_026_1000); qs.giveItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS, 200); - } - else - { + } else { qs.playSound(Voice.TUTORIAL_VOICE_027_1000); qs.giveItems(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS, 200); } @@ -2190,8 +1920,7 @@ public class Q00255_Tutorial extends Quest } qs.takeItems(BLOOD_OF_MITRAELL, 1); startQuestTimer(npc.getId() + "", 60000, npc, talker); - if (qs.getMemoStateEx(1) <= 3) - { + if (qs.getMemoStateEx(1) <= 3) { qs.setMemoStateEx(1, 4); } showPage(talker, "30129-002.htm"); @@ -2208,30 +1937,24 @@ public class Q00255_Tutorial extends Quest } } - private void eventNerupa(int event, L2PcInstance talker, L2Npc npc, QuestState qs) - { - switch (event) - { + private void eventNerupa(int event, L2PcInstance talker, L2Npc npc, QuestState qs) { + switch (event) { case 31: - if (qs.hasQuestItems(LEAF_OF_THE_MOTHER_TREE)) - { - if (!talker.isMageClass() && (qs.getQuestItemsCount(SOULSHOT_NO_GRADE_FOR_BEGINNERS) <= 200)) - { + if (qs.hasQuestItems(LEAF_OF_THE_MOTHER_TREE)) { + if (!talker.isMageClass() && (qs.getQuestItemsCount(SOULSHOT_NO_GRADE_FOR_BEGINNERS) <= 200)) { qs.playSound(Voice.TUTORIAL_VOICE_026_1000); qs.giveItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS, 200); qs.addExpAndSp(0, 50); } - if (talker.isMageClass() && (qs.getQuestItemsCount(SOULSHOT_NO_GRADE_FOR_BEGINNERS) <= 200) && (qs.getQuestItemsCount(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS) <= 100)) - { + if (talker.isMageClass() && (qs.getQuestItemsCount(SOULSHOT_NO_GRADE_FOR_BEGINNERS) <= 200) && (qs.getQuestItemsCount(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS) <= 100)) { qs.playSound(Voice.TUTORIAL_VOICE_027_1000); qs.giveItems(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS, 200); qs.addExpAndSp(0, 50); } qs.takeItems(LEAF_OF_THE_MOTHER_TREE, 1); startQuestTimer(npc.getId() + "", 60000, npc, talker); - if (qs.getMemoStateEx(1) <= 3) - { + if (qs.getMemoStateEx(1) <= 3) { qs.setMemoStateEx(1, 4); } showPage(talker, "30370-002.htm"); @@ -2249,30 +1972,24 @@ public class Q00255_Tutorial extends Quest } } - private void eventForemanLaferon(int event, L2PcInstance talker, L2Npc npc, QuestState qs) - { - switch (event) - { + private void eventForemanLaferon(int event, L2PcInstance talker, L2Npc npc, QuestState qs) { + switch (event) { case 31: - if (qs.hasQuestItems(LICENSE_OF_MINER)) - { - if (!talker.isMageClass() && (qs.getQuestItemsCount(SOULSHOT_NO_GRADE_FOR_BEGINNERS) <= 200)) - { + if (qs.hasQuestItems(LICENSE_OF_MINER)) { + if (!talker.isMageClass() && (qs.getQuestItemsCount(SOULSHOT_NO_GRADE_FOR_BEGINNERS) <= 200)) { qs.playSound(Voice.TUTORIAL_VOICE_026_1000); qs.giveItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS, 200); qs.addExpAndSp(0, 50); } - if (talker.isMageClass() && (qs.getQuestItemsCount(SOULSHOT_NO_GRADE_FOR_BEGINNERS) <= 200) && (qs.getQuestItemsCount(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS) <= 100)) - { + if (talker.isMageClass() && (qs.getQuestItemsCount(SOULSHOT_NO_GRADE_FOR_BEGINNERS) <= 200) && (qs.getQuestItemsCount(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS) <= 100)) { qs.playSound(Voice.TUTORIAL_VOICE_027_1000); qs.giveItems(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS, 100); qs.addExpAndSp(0, 50); } qs.takeItems(LICENSE_OF_MINER, 1); startQuestTimer(npc.getId() + "", 60000, npc, talker); - if (qs.getMemoStateEx(1) <= 3) - { + if (qs.getMemoStateEx(1) <= 3) { qs.setMemoStateEx(1, 4); } showPage(talker, "30528-002.htm"); @@ -2290,21 +2007,16 @@ public class Q00255_Tutorial extends Quest } } - private void eventGuardianVullkus(int event, L2PcInstance talker, L2Npc npc, QuestState qs) - { - switch (event) - { + private void eventGuardianVullkus(int event, L2PcInstance talker, L2Npc npc, QuestState qs) { + switch (event) { case 31: - if (qs.hasQuestItems(VOUCHER_OF_FLAME)) - { + if (qs.hasQuestItems(VOUCHER_OF_FLAME)) { qs.takeItems(VOUCHER_OF_FLAME, 1); startQuestTimer(npc.getId() + "", 60000, npc, talker); - if (qs.getMemoStateEx(1) <= 3) - { + if (qs.getMemoStateEx(1) <= 3) { qs.setMemoStateEx(1, 4); } - if (qs.getQuestItemsCount(SOULSHOT_NO_GRADE_FOR_BEGINNERS) <= 200) - { + if (qs.getQuestItemsCount(SOULSHOT_NO_GRADE_FOR_BEGINNERS) <= 200) { qs.giveItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS, 200); qs.addExpAndSp(0, 50); } @@ -2322,12 +2034,9 @@ public class Q00255_Tutorial extends Quest } } - private void eventSubelderPerwan(int event, L2PcInstance talker, L2Npc npc, QuestState qs) - { - if ((event == 31) && qs.hasQuestItems(DIPLOMA)) - { - if ((talker.getRace() == Race.KAMAEL) && (talker.getClassId().level() == 0) && (qs.getMemoStateEx(1) <= 3)) - { + private void eventSubelderPerwan(int event, L2PcInstance talker, L2Npc npc, QuestState qs) { + if ((event == 31) && qs.hasQuestItems(DIPLOMA)) { + if ((talker.getRace() == Race.KAMAEL) && (talker.getClassId().level() == 0) && (qs.getMemoStateEx(1) <= 3)) { qs.giveItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS, 200); qs.playSound(Voice.TUTORIAL_VOICE_026_1000); qs.addExpAndSp(0, 50); @@ -2342,223 +2051,151 @@ public class Q00255_Tutorial extends Quest // ---------------------------------- Talks - private void talkRoien(L2PcInstance talker, QuestState qs) - { - if (qs.hasQuestItems(RECOMMENDATION_1)) - { + private void talkRoien(L2PcInstance talker, QuestState qs) { + if (qs.hasQuestItems(RECOMMENDATION_1)) { showPage(talker, "30008-001.htm", true); - } - else - { - if (qs.getMemoStateEx(1) > 3) - { + } else { + if (qs.getMemoStateEx(1) > 3) { showPage(talker, "30008-004.htm", true); - } - else if (qs.getMemoStateEx(1) <= 3) - { + } else if (qs.getMemoStateEx(1) <= 3) { showPage(talker, "30008-003.htm", true); } } } - private void talkCarl(L2Npc npc, L2PcInstance talker, QuestState qs) - { - if (qs.getMemoStateEx(1) < 0) - { - if ((talker.getClassId() == ClassId.fighter) && (talker.getRace() == Race.HUMAN)) - { + private void talkCarl(L2Npc npc, L2PcInstance talker, QuestState qs) { + if (qs.getMemoStateEx(1) < 0) { + if ((talker.getClassId() == ClassId.fighter) && (talker.getRace() == Race.HUMAN)) { qs.removeRadar(-71424, 258336, -3109); startQuestTimer(npc.getId() + "", 30000, npc, talker); qs.setMemoStateEx(1, 0); enableTutorialEvent(qs, (qs.getMemoState() & 2147483392) | 1048576); showPage(talker, "30009-001.htm"); - } - else - { + } else { showPage(talker, "30009-006.htm"); } - } - else if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && !qs.hasQuestItems(BLUE_GEMSTONE)) - { + } else if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && !qs.hasQuestItems(BLUE_GEMSTONE)) { showPage(talker, "30009-002.htm"); - } - else if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && qs.hasQuestItems(BLUE_GEMSTONE)) - { + } else if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && qs.hasQuestItems(BLUE_GEMSTONE)) { qs.takeItems(BLUE_GEMSTONE, -1); qs.setMemoStateEx(1, 3); qs.giveItems(RECOMMENDATION_1, 1); startQuestTimer(npc.getId() + "", 30000, npc, talker); qs.setMemoState((qs.getMemoState() & 2147483392) | 4); - if (!talker.isMageClass() && !qs.hasQuestItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS)) - { + if (!talker.isMageClass() && !qs.hasQuestItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS)) { qs.giveItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS, 200); qs.playSound(Voice.TUTORIAL_VOICE_026_1000); } - if (talker.isMageClass() && !qs.hasQuestItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS) && !qs.hasQuestItems(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS)) - { - if (talker.getClassId() == ClassId.orcMage) - { + if (talker.isMageClass() && !qs.hasQuestItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS) && !qs.hasQuestItems(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS)) { + if (talker.getClassId() == ClassId.orcMage) { qs.playSound(Voice.TUTORIAL_VOICE_026_1000); qs.giveItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS, 200); - } - else - { + } else { qs.playSound(Voice.TUTORIAL_VOICE_027_1000); qs.giveItems(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS, 100); } } showPage(talker, "30009-003.htm"); - } - else if (qs.getMemoStateEx(1) == 3) - { + } else if (qs.getMemoStateEx(1) == 3) { showPage(talker, "30009-004.htm"); - } - else if (qs.getMemoStateEx(1) > 3) - { + } else if (qs.getMemoStateEx(1) > 3) { showPage(talker, "30009-005.htm"); } } - private void talkGallin(L2PcInstance talker, QuestState qs) - { - if (qs.hasQuestItems(RECOMMENDATION_2)) - { + private void talkGallin(L2PcInstance talker, QuestState qs) { + if (qs.hasQuestItems(RECOMMENDATION_2)) { showPage(talker, "30017-001.htm", true); - } - else if (!qs.hasQuestItems(RECOMMENDATION_2) && (qs.getMemoStateEx(1) > 3)) - { + } else if (!qs.hasQuestItems(RECOMMENDATION_2) && (qs.getMemoStateEx(1) > 3)) { showPage(talker, "30017-004.htm", true); - } - else if (!qs.hasQuestItems(RECOMMENDATION_2) && (qs.getMemoStateEx(1) <= 3)) - { + } else if (!qs.hasQuestItems(RECOMMENDATION_2) && (qs.getMemoStateEx(1) <= 3)) { showPage(talker, "30017-003.htm", true); } } - private void talkDoff(L2Npc npc, L2PcInstance talker, QuestState qs) - { - if (qs.getMemoStateEx(1) < 0) - { - if ((talker.getClassId() == ClassId.mage) && (talker.getRace() == Race.HUMAN)) - { + private void talkDoff(L2Npc npc, L2PcInstance talker, QuestState qs) { + if (qs.getMemoStateEx(1) < 0) { + if ((talker.getClassId() == ClassId.mage) && (talker.getRace() == Race.HUMAN)) { qs.removeRadar(-91036, 248044, -3568); startQuestTimer(npc.getId() + "", 30000, npc, talker); qs.setMemoStateEx(1, 0); enableTutorialEvent(qs, (qs.getMemoState() & 2147483392) | 1048576); showPage(talker, "30019-001.htm"); - } - else - { + } else { showPage(talker, "30009-006.htm"); } - } - else if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && !qs.hasQuestItems(BLUE_GEMSTONE)) - { + } else if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && !qs.hasQuestItems(BLUE_GEMSTONE)) { showPage(talker, "30019-002.htm"); } - if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && qs.hasQuestItems(BLUE_GEMSTONE)) - { + if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && qs.hasQuestItems(BLUE_GEMSTONE)) { qs.takeItems(BLUE_GEMSTONE, -1); qs.setMemoStateEx(1, 3); qs.giveItems(RECOMMENDATION_2, 1); startQuestTimer(npc.getId() + "", 30000, npc, talker); qs.setMemoState((qs.getMemoState() & 2147483392) | 4); - if (!talker.isMageClass() && !qs.hasQuestItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS)) - { + if (!talker.isMageClass() && !qs.hasQuestItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS)) { qs.giveItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS, 200); qs.playSound(Voice.TUTORIAL_VOICE_026_1000); } - if (talker.isMageClass() && !qs.hasQuestItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS) && !qs.hasQuestItems(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS)) - { - if (talker.getClassId() == ClassId.orcMage) - { + if (talker.isMageClass() && !qs.hasQuestItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS) && !qs.hasQuestItems(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS)) { + if (talker.getClassId() == ClassId.orcMage) { qs.playSound(Voice.TUTORIAL_VOICE_026_1000); qs.giveItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS, 200); - } - else - { + } else { qs.playSound(Voice.TUTORIAL_VOICE_027_1000); qs.giveItems(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS, 100); } } showPage(talker, "30019-003.htm"); - } - else if (qs.getMemoStateEx(1) == 3) - { + } else if (qs.getMemoStateEx(1) == 3) { showPage(talker, "30019-004.htm"); - } - else if (qs.getMemoStateEx(1) > 3) - { + } else if (qs.getMemoStateEx(1) > 3) { showPage(talker, "30009-005.htm"); } } - private void talkJundin(L2PcInstance talker, QuestState qs) - { - if (qs.hasQuestItems(BLOOD_OF_MITRAELL)) - { + private void talkJundin(L2PcInstance talker, QuestState qs) { + if (qs.hasQuestItems(BLOOD_OF_MITRAELL)) { showPage(talker, "30129-001.htm", true); - } - else if (!qs.hasQuestItems(BLOOD_OF_MITRAELL) && (qs.getMemoStateEx(1) > 3)) - { + } else if (!qs.hasQuestItems(BLOOD_OF_MITRAELL) && (qs.getMemoStateEx(1) > 3)) { showPage(talker, "30129-004.htm", true); - } - else if (!qs.hasQuestItems(BLOOD_OF_MITRAELL) && (qs.getMemoStateEx(1) <= 3)) - { + } else if (!qs.hasQuestItems(BLOOD_OF_MITRAELL) && (qs.getMemoStateEx(1) <= 3)) { showPage(talker, "30129-003.htm", true); } } - private void talkPoeny(L2Npc npc, L2PcInstance talker, QuestState qs) - { - if (qs.getMemoStateEx(1) < 0) - { - if (talker.getRace() == Race.DARK_ELF) - { + private void talkPoeny(L2Npc npc, L2PcInstance talker, QuestState qs) { + if (qs.getMemoStateEx(1) < 0) { + if (talker.getRace() == Race.DARK_ELF) { qs.removeRadar(28384, 11056, -4233); startQuestTimer(npc.getId() + "", 30000, npc, talker); - if (!talker.isMageClass()) - { + if (!talker.isMageClass()) { showPage(talker, "30009-001.htm"); - } - else - { + } else { showPage(talker, "30019-001.htm"); } qs.setMemoStateEx(1, 0); enableTutorialEvent(qs, (qs.getMemoState() & 2147483392) | 1048576); - } - else - { + } else { showPage(talker, "30009-006.htm"); } - } - else if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && !qs.hasQuestItems(BLUE_GEMSTONE)) - { - if (!talker.isMageClass()) - { + } else if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && !qs.hasQuestItems(BLUE_GEMSTONE)) { + if (!talker.isMageClass()) { showPage(talker, "30009-002.htm"); - } - else - { + } else { showPage(talker, "30019-002.htm"); } - } - else if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && qs.hasQuestItems(BLUE_GEMSTONE)) - { + } else if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && qs.hasQuestItems(BLUE_GEMSTONE)) { - if (!talker.isMageClass()) - { + if (!talker.isMageClass()) { showPage(talker, "30131-003f.htm"); - } - else - { + } else { showPage(talker, "30131-003m.htm"); } @@ -2569,279 +2206,183 @@ public class Q00255_Tutorial extends Quest qs.setMemoState((qs.getMemoState() & 2147483392) | 4); - if (!talker.isMageClass() && !qs.hasQuestItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS)) - { + if (!talker.isMageClass() && !qs.hasQuestItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS)) { qs.playSound(Voice.TUTORIAL_VOICE_026_1000); qs.giveItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS, 200); } - if (talker.isMageClass() && !qs.hasQuestItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS) && !qs.hasQuestItems(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS)) - { - if (talker.getClassId() == ClassId.orcMage) - { + if (talker.isMageClass() && !qs.hasQuestItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS) && !qs.hasQuestItems(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS)) { + if (talker.getClassId() == ClassId.orcMage) { qs.playSound(Voice.TUTORIAL_VOICE_026_1000); qs.giveItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS, 100); - } - else - { + } else { qs.playSound(Voice.TUTORIAL_VOICE_027_1000); qs.giveItems(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS, 100); } } - } - else if (qs.getMemoStateEx(1) == 3) - { + } else if (qs.getMemoStateEx(1) == 3) { showPage(talker, "30131-004.htm"); - } - else if (qs.getMemoStateEx(1) > 3) - { + } else if (qs.getMemoStateEx(1) > 3) { showPage(talker, "30009-005.htm"); } } - private void talkNerupa(L2PcInstance talker, QuestState qs) - { - if (qs.hasQuestItems(LEAF_OF_THE_MOTHER_TREE)) - { + private void talkNerupa(L2PcInstance talker, QuestState qs) { + if (qs.hasQuestItems(LEAF_OF_THE_MOTHER_TREE)) { showPage(talker, "30370-001.htm", true); - } - else if (!qs.hasQuestItems(LEAF_OF_THE_MOTHER_TREE) && (qs.getMemoStateEx(1) > 3)) - { + } else if (!qs.hasQuestItems(LEAF_OF_THE_MOTHER_TREE) && (qs.getMemoStateEx(1) > 3)) { showPage(talker, "30370-004.htm", true); - } - else if (!qs.hasQuestItems(LEAF_OF_THE_MOTHER_TREE) && (qs.getMemoStateEx(1) <= 3)) - { + } else if (!qs.hasQuestItems(LEAF_OF_THE_MOTHER_TREE) && (qs.getMemoStateEx(1) <= 3)) { showPage(talker, "30370-003.htm", true); } } - private void talkMotherTemp(L2Npc npc, L2PcInstance talker, QuestState qs) - { - if (qs.getMemoStateEx(1) < 0) - { - if (talker.getRace() == Race.ELF) - { + private void talkMotherTemp(L2Npc npc, L2PcInstance talker, QuestState qs) { + if (qs.getMemoStateEx(1) < 0) { + if (talker.getRace() == Race.ELF) { qs.removeRadar(46112, 41200, -3504); startQuestTimer(npc.getId() + "", 30000, npc, talker); qs.setMemoStateEx(1, 0); enableTutorialEvent(qs, (qs.getMemoState() & 2147483392) | 1048576); - if (!talker.isMageClass()) - { + if (!talker.isMageClass()) { showPage(talker, "30009-001.htm"); - } - else - { + } else { showPage(talker, "30019-001.htm"); } - } - else - { + } else { showPage(talker, "30009-006.htm"); } - } - else if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && !qs.hasQuestItems(BLUE_GEMSTONE)) - { - if (!talker.isMageClass()) - { + } else if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && !qs.hasQuestItems(BLUE_GEMSTONE)) { + if (!talker.isMageClass()) { showPage(talker, "30009-002.htm"); - } - else - { + } else { showPage(talker, "30019-002.htm"); } - } - else if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && qs.hasQuestItems(BLUE_GEMSTONE)) - { + } else if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && qs.hasQuestItems(BLUE_GEMSTONE)) { qs.takeItems(BLUE_GEMSTONE, -1); qs.setMemoStateEx(1, 3); qs.giveItems(LEAF_OF_THE_MOTHER_TREE, 1); startQuestTimer(npc.getId() + "", 30000, npc, talker); qs.setMemoState((qs.getMemoState() & 2147483392) | 4); - if (!talker.isMageClass() && !qs.hasQuestItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS)) - { + if (!talker.isMageClass() && !qs.hasQuestItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS)) { qs.playSound(Voice.TUTORIAL_VOICE_026_1000); qs.giveItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS, 200); } - if (talker.isMageClass() && !qs.hasQuestItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS) && !qs.hasQuestItems(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS)) - { - if (talker.getClassId() == ClassId.orcMage) - { + if (talker.isMageClass() && !qs.hasQuestItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS) && !qs.hasQuestItems(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS)) { + if (talker.getClassId() == ClassId.orcMage) { qs.playSound(Voice.TUTORIAL_VOICE_026_1000); qs.giveItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS, 200); - } - else - { + } else { qs.playSound(Voice.TUTORIAL_VOICE_027_1000); qs.giveItems(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS, 100); } } - if (!talker.isMageClass()) - { + if (!talker.isMageClass()) { showPage(talker, "30400-003f.htm"); - } - else - { + } else { showPage(talker, "30400-003m.htm"); } - } - else if (qs.getMemoStateEx(1) == 3) - { + } else if (qs.getMemoStateEx(1) == 3) { showPage(talker, "30400-004.htm"); - } - else if (qs.getMemoStateEx(1) > 3) - { + } else if (qs.getMemoStateEx(1) > 3) { showPage(talker, "30009-005.htm"); } } - private void talkForemanLaferon(L2PcInstance talker, QuestState qs) - { - if (qs.hasQuestItems(LICENSE_OF_MINER)) - { + private void talkForemanLaferon(L2PcInstance talker, QuestState qs) { + if (qs.hasQuestItems(LICENSE_OF_MINER)) { showPage(talker, "30528-001.htm", true); - } - else if (!qs.hasQuestItems(LICENSE_OF_MINER) && (qs.getMemoStateEx(1) > 3)) - { + } else if (!qs.hasQuestItems(LICENSE_OF_MINER) && (qs.getMemoStateEx(1) > 3)) { showPage(talker, "30528-004.htm", true); - } - else if (!qs.hasQuestItems(LICENSE_OF_MINER) && (qs.getMemoStateEx(1) <= 3)) - { + } else if (!qs.hasQuestItems(LICENSE_OF_MINER) && (qs.getMemoStateEx(1) <= 3)) { showPage(talker, "30528-003.htm", true); } } - private void talkMinerMai(L2Npc npc, L2PcInstance talker, QuestState qs) - { - if (qs.getMemoStateEx(1) < 0) - { - if (talker.getRace() == Race.DWARF) - { + private void talkMinerMai(L2Npc npc, L2PcInstance talker, QuestState qs) { + if (qs.getMemoStateEx(1) < 0) { + if (talker.getRace() == Race.DWARF) { qs.removeRadar(108567, -173994, -406); startQuestTimer(npc.getId() + "", 30000, npc, talker); qs.setMemoStateEx(1, 0); enableTutorialEvent(qs, (qs.getMemoState() & 2147483392) | 1048576); - if (!talker.isMageClass()) - { + if (!talker.isMageClass()) { showPage(talker, "30009-001.htm"); - } - else - { + } else { showPage(talker, "30019-001.htm"); } - } - else - { + } else { showPage(talker, "30009-006.htm"); } - } - else if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && !qs.hasQuestItems(BLUE_GEMSTONE)) - { + } else if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && !qs.hasQuestItems(BLUE_GEMSTONE)) { showPage(talker, "30009-002.htm"); - } - else if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && qs.hasQuestItems(BLUE_GEMSTONE)) - { + } else if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && qs.hasQuestItems(BLUE_GEMSTONE)) { qs.takeItems(BLUE_GEMSTONE, -1); qs.setMemoStateEx(1, 3); qs.giveItems(LICENSE_OF_MINER, 1); startQuestTimer(npc.getId() + "", 30000, npc, talker); qs.setMemoState((qs.getMemoState() & 2147483392) | 4); - if (!talker.isMageClass() && !qs.hasQuestItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS)) - { + if (!talker.isMageClass() && !qs.hasQuestItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS)) { qs.playSound(Voice.TUTORIAL_VOICE_026_1000); qs.giveItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS, 200); } - if (talker.isMageClass() && !qs.hasQuestItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS) && !qs.hasQuestItems(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS)) - { - if (talker.getClassId() == ClassId.orcMage) - { + if (talker.isMageClass() && !qs.hasQuestItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS) && !qs.hasQuestItems(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS)) { + if (talker.getClassId() == ClassId.orcMage) { qs.playSound(Voice.TUTORIAL_VOICE_026_1000); qs.giveItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS, 200); - } - else - { + } else { qs.playSound(Voice.TUTORIAL_VOICE_027_1000); qs.giveItems(SPIRITSHOT_NO_GRADE_FOR_BEGINNERS, 100); } - } - else - { + } else { showPage(talker, "30530-003.htm"); } - } - else if (qs.getMemoStateEx(1) == 3) - { + } else if (qs.getMemoStateEx(1) == 3) { showPage(talker, "30530-004.htm"); - } - else if (qs.getMemoStateEx(1) > 3) - { + } else if (qs.getMemoStateEx(1) > 3) { showPage(talker, "30009-005.htm"); } } - private void talkGuardianVullkus(L2PcInstance talker, QuestState qs) - { - if (qs.hasQuestItems(VOUCHER_OF_FLAME)) - { + private void talkGuardianVullkus(L2PcInstance talker, QuestState qs) { + if (qs.hasQuestItems(VOUCHER_OF_FLAME)) { showPage(talker, "30573-001.htm", true); - } - else - { - if (qs.getMemoStateEx(1) > 3) - { + } else { + if (qs.getMemoStateEx(1) > 3) { showPage(talker, "30573-004.htm", true); - } - else - { + } else { showPage(talker, "30573-003.htm", true); } } } - private void talkShelaPriestess(L2Npc npc, L2PcInstance talker, QuestState qs) - { - if (qs.getMemoStateEx(1) < 0) - { - if (talker.getRace() == Race.ORC) - { + private void talkShelaPriestess(L2Npc npc, L2PcInstance talker, QuestState qs) { + if (qs.getMemoStateEx(1) < 0) { + if (talker.getRace() == Race.ORC) { qs.removeRadar(-56736, -113680, -672); startQuestTimer(npc.getId() + "", 30000, npc, talker); qs.setMemoStateEx(1, 0); enableTutorialEvent(qs, (qs.getMemoState() & 2147483392) | 1048576); - if (!talker.isMageClass()) - { + if (!talker.isMageClass()) { showPage(talker, "30009-001.htm"); - } - else - { + } else { showPage(talker, "30575-001.htm"); } - } - else - { + } else { showPage(talker, "30009-006.htm"); } - } - else if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && !qs.hasQuestItems(BLUE_GEMSTONE)) - { - if (!talker.isMageClass()) - { + } else if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && !qs.hasQuestItems(BLUE_GEMSTONE)) { + if (!talker.isMageClass()) { showPage(talker, "30009-002.htm"); - } - else - { + } else { showPage(talker, "30575-002.htm"); } - } - else if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && qs.hasQuestItems(BLUE_GEMSTONE)) - { - if (!talker.isMageClass()) - { + } else if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && qs.hasQuestItems(BLUE_GEMSTONE)) { + if (!talker.isMageClass()) { showPage(talker, "30575-003f.htm"); - } - else - { + } else { showPage(talker, "30575-003m.htm"); } @@ -2850,101 +2391,71 @@ public class Q00255_Tutorial extends Quest qs.giveItems(VOUCHER_OF_FLAME, 1); startQuestTimer(npc.getId() + "", 30000, npc, talker); qs.setMemoState((qs.getMemoState() & 2147483392) | 4); - if (!qs.hasQuestItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS)) - { + if (!qs.hasQuestItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS)) { qs.giveItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS, 200); } qs.playSound(Voice.TUTORIAL_VOICE_026_1000); - } - else if (qs.getMemoStateEx(1) == 3) - { + } else if (qs.getMemoStateEx(1) == 3) { showPage(talker, "30575-004.htm"); - } - else if (qs.getMemoStateEx(1) > 3) - { + } else if (qs.getMemoStateEx(1) > 3) { showPage(talker, "30009-005.htm"); } } - private void talkSubelderPerwan(L2PcInstance talker, QuestState qs) - { - if (qs.hasQuestItems(DIPLOMA)) - { + private void talkSubelderPerwan(L2PcInstance talker, QuestState qs) { + if (qs.hasQuestItems(DIPLOMA)) { showPage(talker, "32133-001.htm", true); - } - else - { - if ((qs.getMemoStateEx(1) > 3)) - { + } else { + if ((qs.getMemoStateEx(1) > 3)) { showPage(talker, "32133-004.htm", true); - } - else if (qs.getMemoStateEx(1) <= 3) - { + } else if (qs.getMemoStateEx(1) <= 3) { showPage(talker, "32133-003.htm", true); } } } - private void talkHelperKrenisk(L2Npc npc, L2PcInstance talker, QuestState qs) - { - if (qs.getMemoStateEx(1) < 0) - { - if (talker.getRace() == Race.KAMAEL) - { + private void talkHelperKrenisk(L2Npc npc, L2PcInstance talker, QuestState qs) { + if (qs.getMemoStateEx(1) < 0) { + if (talker.getRace() == Race.KAMAEL) { qs.removeRadar(-125872, 38016, 1251); qs.setMemoStateEx(1, 0); startQuestTimer(npc.getId() + "", 30000, npc, talker); enableTutorialEvent(qs, (qs.getMemoState() & 2147483392) | 1048576); showPage(talker, "32134-001.htm"); - } - else - { + } else { showPage(talker, "30009-006.htm"); } - } - else if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && !qs.hasQuestItems(BLUE_GEMSTONE)) - { + } else if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && !qs.hasQuestItems(BLUE_GEMSTONE)) { showPage(talker, "32134-002.htm"); - } - else if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && qs.hasQuestItems(BLUE_GEMSTONE)) - { + } else if (((qs.getMemoStateEx(1) == 0) || (qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2)) && qs.hasQuestItems(BLUE_GEMSTONE)) { showPage(talker, "32134-003.htm"); qs.takeItems(BLUE_GEMSTONE, -1); qs.setMemoStateEx(1, 3); qs.giveItems(DIPLOMA, 1); startQuestTimer(npc.getId() + "", 30000, npc, talker); qs.setMemoState((qs.getMemoState() & 2147483392) | 4); - if ((talker.getRace() == Race.KAMAEL) && (talker.getClassId().level() == 0) && !qs.hasQuestItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS)) - { + if ((talker.getRace() == Race.KAMAEL) && (talker.getClassId().level() == 0) && !qs.hasQuestItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS)) { qs.giveItems(SOULSHOT_NO_GRADE_FOR_BEGINNERS, 200); qs.playSound(Voice.TUTORIAL_VOICE_026_1000); } - } - else if (qs.getMemoStateEx(1) == 3) - { + } else if (qs.getMemoStateEx(1) == 3) { showPage(talker, "32134-004.htm"); - } - else if (qs.getMemoStateEx(1) > 3) - { + } else if (qs.getMemoStateEx(1) > 3) { showPage(talker, "32134-005.htm"); } } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if (npc.getId() == TUTORIAL_GREMLIN) - { - if ((qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 0)) - { + if (npc.getId() == TUTORIAL_GREMLIN) { + if ((qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 0)) { qs.playSound(Voice.TUTORIAL_VOICE_011_1000); qs.showQuestionMark(killer.getActingPlayer(), 3); qs.setMemoStateEx(1, 2); } - if (((qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2) || (qs.getMemoStateEx(1) == 0)) && !qs.hasQuestItems(BLUE_GEMSTONE) && (getRandom(2) <= 1)) - { + if (((qs.getMemoStateEx(1) == 1) || (qs.getMemoStateEx(1) == 2) || (qs.getMemoStateEx(1) == 0)) && !qs.hasQuestItems(BLUE_GEMSTONE) && (getRandom(2) <= 1)) { npc.dropItem(killer, BLUE_GEMSTONE, 1); qs.playSound(Sound.ITEMSOUND_QUEST_TUTORIAL); } @@ -2953,8 +2464,7 @@ public class Q00255_Tutorial extends Quest } @Override - public boolean isVisibleInQuestWindow() - { + public boolean isVisibleInQuestWindow() { return false; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00257_TheGuardIsBusy/Q00257_TheGuardIsBusy.java b/src/main/java/com/l2jserver/datapack/quests/Q00257_TheGuardIsBusy/Q00257_TheGuardIsBusy.java index 413eabcf3b..f2cfa307df 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00257_TheGuardIsBusy/Q00257_TheGuardIsBusy.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00257_TheGuardIsBusy/Q00257_TheGuardIsBusy.java @@ -36,22 +36,18 @@ import com.l2jserver.gameserver.model.quest.State; * The Guard is Busy (257) * @author xban1x */ -public final class Q00257_TheGuardIsBusy extends Quest -{ - public final static class MobDrop extends ItemHolder - { +public final class Q00257_TheGuardIsBusy extends Quest { + public final static class MobDrop extends ItemHolder { private final int _chance; private final int _random; - public MobDrop(int random, int chance, int id, long count) - { + public MobDrop(int random, int chance, int id, long count) { super(id, count); _random = random; _chance = chance; } - public boolean getDrop() - { + public boolean getDrop() { return (getRandom(_random) < _chance); } } @@ -68,8 +64,7 @@ public final class Q00257_TheGuardIsBusy extends Quest private static final int ORC_NECKLACE = 1085; private static final int WEREWOLF_FANG = 1086; - static - { + static { MONSTERS.put(20006, Arrays.asList(new MobDrop(10, 2, ORC_AMULET, 2), new MobDrop(10, 10, ORC_AMULET, 1))); // Orc Archer MONSTERS.put(20093, Arrays.asList(new MobDrop(100, 85, ORC_NECKLACE, 1))); // Orc Fighter MONSTERS.put(20096, Arrays.asList(new MobDrop(100, 95, ORC_NECKLACE, 1))); // Orc Fighter Sub Leader @@ -81,8 +76,7 @@ public final class Q00257_TheGuardIsBusy extends Quest MONSTERS.put(20343, Arrays.asList(new MobDrop(100, 85, WEREWOLF_FANG, 1))); // Werewolf Hunter } - public Q00257_TheGuardIsBusy() - { + public Q00257_TheGuardIsBusy() { super(257, Q00257_TheGuardIsBusy.class.getSimpleName(), "The Guard is Busy"); addStartNpc(GILBERT); addTalkId(GILBERT); @@ -91,32 +85,26 @@ public final class Q00257_TheGuardIsBusy extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { - case "30039-03.htm": - { + switch (event) { + case "30039-03.htm": { st.startQuest(); st.giveItems(GLUDIO_LORDS_MARK, 1); htmltext = event; break; } - case "30039-05.html": - { + case "30039-05.html": { st.exitQuest(true, true); htmltext = event; break; } - case "30039-06.html": - { + case "30039-06.html": { htmltext = event; break; } @@ -125,18 +113,14 @@ public final class Q00257_TheGuardIsBusy extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if (st == null) - { + if (st == null) { return super.onKill(npc, killer, isSummon); } - for (MobDrop drop : MONSTERS.get(npc.getId())) - { - if (drop.getDrop()) - { + for (MobDrop drop : MONSTERS.get(npc.getId())) { + if (drop.getDrop()) { st.giveItems(drop); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); break; @@ -146,30 +130,23 @@ public final class Q00257_TheGuardIsBusy extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getLevel() >= MIN_LVL) ? "30039-02.htm" : "30039-01.html"; break; } - case State.STARTED: - { - if (hasAtLeastOneQuestItem(player, ORC_AMULET, ORC_NECKLACE, WEREWOLF_FANG)) - { + case State.STARTED: { + if (hasAtLeastOneQuestItem(player, ORC_AMULET, ORC_NECKLACE, WEREWOLF_FANG)) { final long amulets = st.getQuestItemsCount(ORC_AMULET); final long common = getQuestItemsCount(player, ORC_NECKLACE, WEREWOLF_FANG); st.giveAdena(((amulets * 10) + (common * 20) + (((amulets + common) >= 10) ? 1000 : 0)), true); takeItems(player, -1, ORC_AMULET, ORC_NECKLACE, WEREWOLF_FANG); Q00281_HeadForTheHills.giveNewbieReward(player); htmltext = "30039-07.html"; - } - else - { + } else { htmltext = "30039-04.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00258_BringWolfPelts/Q00258_BringWolfPelts.java b/src/main/java/com/l2jserver/datapack/quests/Q00258_BringWolfPelts/Q00258_BringWolfPelts.java index d7660adf5d..55d90bb860 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00258_BringWolfPelts/Q00258_BringWolfPelts.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00258_BringWolfPelts/Q00258_BringWolfPelts.java @@ -32,22 +32,19 @@ import com.l2jserver.gameserver.model.quest.State; * Bring Wolf Pelts (258) * @author xban1x */ -public final class Q00258_BringWolfPelts extends Quest -{ +public final class Q00258_BringWolfPelts extends Quest { // Npc private static final int LECTOR = 30001; // Item private static final int WOLF_PELT = 702; // Monsters - private static final int[] MONSTERS = new int[] - { + private static final int[] MONSTERS = new int[] { 20120, // Wolf 20442, // Elder Wolf }; // Rewards private static final Map<Integer, Integer> REWARDS = new HashMap<>(); - static - { + static { REWARDS.put(390, 1); // Cotton Shirt REWARDS.put(29, 6); // Leather Pants REWARDS.put(22, 9); // Leather Shirt @@ -58,8 +55,7 @@ public final class Q00258_BringWolfPelts extends Quest private static final int MIN_LVL = 3; private static final int WOLF_PELT_COUNT = 40; - public Q00258_BringWolfPelts() - { + public Q00258_BringWolfPelts() { super(258, Q00258_BringWolfPelts.class.getSimpleName(), "Bring Wolf Pelts"); addStartNpc(LECTOR); addTalkId(LECTOR); @@ -68,11 +64,9 @@ public final class Q00258_BringWolfPelts extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && event.equalsIgnoreCase("30001-03.html")) - { + if ((st != null) && event.equalsIgnoreCase("30001-03.html")) { st.startQuest(); return event; } @@ -80,18 +74,13 @@ public final class Q00258_BringWolfPelts extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isCond(1)) - { + if ((st != null) && st.isCond(1)) { st.giveItems(WOLF_PELT, 1); - if (st.getQuestItemsCount(WOLF_PELT) >= WOLF_PELT_COUNT) - { + if (st.getQuestItemsCount(WOLF_PELT) >= WOLF_PELT_COUNT) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -99,35 +88,25 @@ public final class Q00258_BringWolfPelts extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getLevel() >= MIN_LVL) ? "30001-02.htm" : "30001-01.html"; break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "30001-04.html"; break; } - case 2: - { - if (st.getQuestItemsCount(WOLF_PELT) >= WOLF_PELT_COUNT) - { + case 2: { + if (st.getQuestItemsCount(WOLF_PELT) >= WOLF_PELT_COUNT) { final int chance = getRandom(16); - for (Map.Entry<Integer, Integer> reward : REWARDS.entrySet()) - { - if (chance < reward.getValue()) - { + for (Map.Entry<Integer, Integer> reward : REWARDS.entrySet()) { + if (chance < reward.getValue()) { st.giveItems(reward.getKey(), 1); break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00259_RequestFromTheFarmOwner/Q00259_RequestFromTheFarmOwner.java b/src/main/java/com/l2jserver/datapack/quests/Q00259_RequestFromTheFarmOwner/Q00259_RequestFromTheFarmOwner.java index 25c694f27e..262f09ac19 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00259_RequestFromTheFarmOwner/Q00259_RequestFromTheFarmOwner.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00259_RequestFromTheFarmOwner/Q00259_RequestFromTheFarmOwner.java @@ -33,14 +33,12 @@ import com.l2jserver.gameserver.model.quest.State; * Request from the Farm Owner (259) * @author xban1x */ -public final class Q00259_RequestFromTheFarmOwner extends Quest -{ +public final class Q00259_RequestFromTheFarmOwner extends Quest { // Npcs private static final int EDMOND = 30497; private static final int MARIUS = 30405; // Monsters - private static final int[] MONSTERS = new int[] - { + private static final int[] MONSTERS = new int[] { 20103, // Giant Spider 20106, // Talon Spider 20108, // Blade Spider @@ -53,16 +51,14 @@ public final class Q00259_RequestFromTheFarmOwner extends Quest private static final int SKIN_REWARD = 25; private static final int SKIN_BONUS = 250; private static final Map<String, ItemHolder> CONSUMABLES = new HashMap<>(); - static - { + static { CONSUMABLES.put("30405-04.html", new ItemHolder(1061, 2)); // Greater Healing Potion CONSUMABLES.put("30405-05.html", new ItemHolder(17, 250)); // Wooden Arrow CONSUMABLES.put("30405-05a.html", new ItemHolder(1835, 60)); // Soulshot: No Grade CONSUMABLES.put("30405-05c.html", new ItemHolder(2509, 30)); // Spiritshot: No Grade } - public Q00259_RequestFromTheFarmOwner() - { + public Q00259_RequestFromTheFarmOwner() { super(259, Q00259_RequestFromTheFarmOwner.class.getSimpleName(), "Request from the Farm Owner"); addStartNpc(EDMOND); addTalkId(EDMOND, MARIUS); @@ -71,51 +67,42 @@ public final class Q00259_RequestFromTheFarmOwner extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { + switch (event) { case "30405-03.html": case "30405-05b.html": case "30405-05d.html": - case "30497-07.html": - { + case "30497-07.html": { htmltext = event; break; } case "30405-04.html": case "30405-05.html": case "30405-05a.html": - case "30405-05c.html": - { - if (st.getQuestItemsCount(SPIDER_SKIN) >= SKIN_COUNT) - { + case "30405-05c.html": { + if (st.getQuestItemsCount(SPIDER_SKIN) >= SKIN_COUNT) { st.giveItems(CONSUMABLES.get(event)); st.takeItems(SPIDER_SKIN, SKIN_COUNT); htmltext = event; } break; } - case "30405-06.html": - { + case "30405-06.html": { htmltext = (st.getQuestItemsCount(SPIDER_SKIN) >= SKIN_COUNT) ? event : "30405-07.html"; break; } - case "30497-03.html": - { + case "30497-03.html": { st.startQuest(); htmltext = event; break; } - case "30497-06.html": - { + case "30497-06.html": { st.exitQuest(true, true); htmltext = event; break; @@ -125,11 +112,9 @@ public final class Q00259_RequestFromTheFarmOwner extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if (st != null) - { + if (st != null) { st.giveItems(SPIDER_SKIN, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -137,32 +122,23 @@ public final class Q00259_RequestFromTheFarmOwner extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (npc.getId()) - { - case EDMOND: - { - switch (st.getState()) - { - case State.CREATED: - { + switch (npc.getId()) { + case EDMOND: { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getLevel() >= MIN_LVL) ? "30497-02.htm" : "30497-01.html"; break; } - case State.STARTED: - { - if (st.hasQuestItems(SPIDER_SKIN)) - { + case State.STARTED: { + if (st.hasQuestItems(SPIDER_SKIN)) { final long skins = st.getQuestItemsCount(SPIDER_SKIN); st.giveAdena((skins * SKIN_REWARD) + ((skins >= 10) ? SKIN_BONUS : 0), true); st.takeItems(SPIDER_SKIN, -1); htmltext = "30497-05.html"; - } - else - { + } else { htmltext = "30497-04.html"; } break; @@ -170,8 +146,7 @@ public final class Q00259_RequestFromTheFarmOwner extends Quest } break; } - case MARIUS: - { + case MARIUS: { htmltext = (st.getQuestItemsCount(SPIDER_SKIN) >= SKIN_COUNT) ? "30405-02.html" : "30405-01.html"; break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00260_OrcHunting/Q00260_OrcHunting.java b/src/main/java/com/l2jserver/datapack/quests/Q00260_OrcHunting/Q00260_OrcHunting.java index c1e92801e9..6617edf1da 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00260_OrcHunting/Q00260_OrcHunting.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00260_OrcHunting/Q00260_OrcHunting.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.model.quest.State; * Orc Hunting (260) * @author xban1x */ -public final class Q00260_OrcHunting extends Quest -{ +public final class Q00260_OrcHunting extends Quest { // NPC private static final int RAYEN = 30221; // Items @@ -43,8 +42,7 @@ public final class Q00260_OrcHunting extends Quest private static final int ORC_NECKLACE = 1115; // Monsters private static final Map<Integer, Integer> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(20468, ORC_AMULET); // Kaboo Orc MONSTERS.put(20469, ORC_AMULET); // Kaboo Orc Archer MONSTERS.put(20470, ORC_AMULET); // Kaboo Orc Grunt @@ -55,8 +53,7 @@ public final class Q00260_OrcHunting extends Quest // Misc private static final int MIN_LVL = 6; - public Q00260_OrcHunting() - { + public Q00260_OrcHunting() { super(260, Q00260_OrcHunting.class.getSimpleName(), "Orc Hunting"); addStartNpc(RAYEN); addTalkId(RAYEN); @@ -65,31 +62,25 @@ public final class Q00260_OrcHunting extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { - case "30221-04.htm": - { + switch (event) { + case "30221-04.htm": { st.startQuest(); htmltext = event; break; } - case "30221-07.html": - { + case "30221-07.html": { st.exitQuest(true, true); htmltext = event; break; } - case "30221-08.html": - { + case "30221-08.html": { htmltext = event; break; } @@ -98,11 +89,9 @@ public final class Q00260_OrcHunting extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && (getRandom(10) > 4)) - { + if ((st != null) && (getRandom(10) > 4)) { st.giveItems(MONSTERS.get(npc.getId()), 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -110,30 +99,23 @@ public final class Q00260_OrcHunting extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getRace() == Race.ELF) ? (player.getLevel() >= MIN_LVL) ? "30221-03.htm" : "30221-02.html" : "30221-01.html"; break; } - case State.STARTED: - { - if (hasAtLeastOneQuestItem(player, getRegisteredItemIds())) - { + case State.STARTED: { + if (hasAtLeastOneQuestItem(player, getRegisteredItemIds())) { final long amulets = st.getQuestItemsCount(ORC_AMULET); final long necklaces = st.getQuestItemsCount(ORC_NECKLACE); st.giveAdena(((amulets * 12) + (necklaces * 30) + ((amulets + necklaces) >= 10 ? 1000 : 0)), true); takeItems(player, -1, getRegisteredItemIds()); Q00281_HeadForTheHills.giveNewbieReward(player); htmltext = "30221-06.html"; - } - else - { + } else { htmltext = "30221-05.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00261_CollectorsDream/Q00261_CollectorsDream.java b/src/main/java/com/l2jserver/datapack/quests/Q00261_CollectorsDream/Q00261_CollectorsDream.java index 50e3366878..12c201a22a 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00261_CollectorsDream/Q00261_CollectorsDream.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00261_CollectorsDream/Q00261_CollectorsDream.java @@ -32,13 +32,11 @@ import com.l2jserver.gameserver.util.Util; * Collector's Dream (261) * @author xban1x */ -public final class Q00261_CollectorsDream extends Quest -{ +public final class Q00261_CollectorsDream extends Quest { // Npc private static final int ALSHUPES = 30222; // Monsters - private static final int[] MONSTERS = new int[] - { + private static final int[] MONSTERS = new int[] { 20308, // Hook Spider 20460, // Crimson Spider 20466, // Pincer Spider @@ -51,8 +49,7 @@ public final class Q00261_CollectorsDream extends Quest // Message private static final ExShowScreenMessage MESSAGE = new ExShowScreenMessage(NpcStringId.LAST_DUTY_COMPLETE_N_GO_FIND_THE_NEWBIE_GUIDE, 2, 5000); - public Q00261_CollectorsDream() - { + public Q00261_CollectorsDream() { super(261, Q00261_CollectorsDream.class.getSimpleName(), "Collector's Dream"); addStartNpc(ALSHUPES); addTalkId(ALSHUPES); @@ -61,11 +58,9 @@ public final class Q00261_CollectorsDream extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && event.equals("30222-03.htm")) - { + if ((st != null) && event.equals("30222-03.htm")) { st.startQuest(); return event; } @@ -73,13 +68,10 @@ public final class Q00261_CollectorsDream extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, killer, true)) - { - if (st.giveItemRandomly(SPIDER_LEG, 1, MAX_LEG_COUNT, 1, true)) - { + if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, killer, true)) { + if (st.giveItemRandomly(SPIDER_LEG, 1, MAX_LEG_COUNT, 1, true)) { st.setCond(2); } } @@ -87,30 +79,22 @@ public final class Q00261_CollectorsDream extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getLevel() >= MIN_LVL) ? "30222-02.htm" : "30222-01.htm"; break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "30222-04.html"; break; } - case 2: - { - if (st.getQuestItemsCount(SPIDER_LEG) >= MAX_LEG_COUNT) - { + case 2: { + if (st.getQuestItemsCount(SPIDER_LEG) >= MAX_LEG_COUNT) { giveNewbieReward(player); st.giveAdena(1000, true); st.addExpAndSp(2000, 0); @@ -126,16 +110,12 @@ public final class Q00261_CollectorsDream extends Quest return htmltext; } - public static void giveNewbieReward(L2PcInstance player) - { + public static void giveNewbieReward(L2PcInstance player) { final PlayerVariables vars = player.getVariables(); - if (vars.getString("GUIDE_MISSION", null) == null) - { + if (vars.getString("GUIDE_MISSION", null) == null) { vars.set("GUIDE_MISSION", 100000); player.sendPacket(MESSAGE); - } - else if (((vars.getInt("GUIDE_MISSION") % 100000000) / 10000000) != 1) - { + } else if (((vars.getInt("GUIDE_MISSION") % 100000000) / 10000000) != 1) { vars.set("GUIDE_MISSION", vars.getInt("GUIDE_MISSION") + 10000000); player.sendPacket(MESSAGE); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00262_TradeWithTheIvoryTower/Q00262_TradeWithTheIvoryTower.java b/src/main/java/com/l2jserver/datapack/quests/Q00262_TradeWithTheIvoryTower/Q00262_TradeWithTheIvoryTower.java index 118b1989db..a8756ee335 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00262_TradeWithTheIvoryTower/Q00262_TradeWithTheIvoryTower.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00262_TradeWithTheIvoryTower/Q00262_TradeWithTheIvoryTower.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.model.quest.State; * Trade With The Ivory Tower (262) * @author ivantotov */ -public final class Q00262_TradeWithTheIvoryTower extends Quest -{ +public final class Q00262_TradeWithTheIvoryTower extends Quest { // NPCs private static final int VOLLODOS = 30137; // Items @@ -46,14 +45,12 @@ public final class Q00262_TradeWithTheIvoryTower extends Quest // Monsters private static final Map<Integer, Integer> MOBS_SAC = new HashMap<>(); - static - { + static { MOBS_SAC.put(20007, 3); // Green Fungus MOBS_SAC.put(20400, 4); // Blood Fungus } - public Q00262_TradeWithTheIvoryTower() - { + public Q00262_TradeWithTheIvoryTower() { super(262, Q00262_TradeWithTheIvoryTower.class.getSimpleName(), "Trade With The Ivory Tower"); addStartNpc(VOLLODOS); addTalkId(VOLLODOS); @@ -62,11 +59,9 @@ public final class Q00262_TradeWithTheIvoryTower extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && event.equalsIgnoreCase("30137-03.htm")) - { + if ((st != null) && event.equalsIgnoreCase("30137-03.htm")) { st.startQuest(); return event; } @@ -74,25 +69,19 @@ public final class Q00262_TradeWithTheIvoryTower extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(player, 1); - if (partyMember == null) - { + if (partyMember == null) { return super.onKill(npc, player, isSummon); } final QuestState st = getQuestState(partyMember, false); double chance = MOBS_SAC.get(npc.getId()) * rates().getRateQuestDrop(); - if (getRandom(10) < chance) - { + if (getRandom(10) < chance) { st.rewardItems(SPORE_SAC, 1); - if (st.getQuestItemsCount(SPORE_SAC) >= REQUIRED_ITEM_COUNT) - { + if (st.getQuestItemsCount(SPORE_SAC) >= REQUIRED_ITEM_COUNT) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -100,33 +89,24 @@ public final class Q00262_TradeWithTheIvoryTower extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = player.getLevel() >= MIN_LEVEL ? "30137-02.htm" : "30137-01.htm"; break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { - if (st.getQuestItemsCount(SPORE_SAC) < REQUIRED_ITEM_COUNT) - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { + if (st.getQuestItemsCount(SPORE_SAC) < REQUIRED_ITEM_COUNT) { htmltext = "30137-04.html"; } break; } - case 2: - { - if (st.getQuestItemsCount(SPORE_SAC) >= REQUIRED_ITEM_COUNT) - { + case 2: { + if (st.getQuestItemsCount(SPORE_SAC) >= REQUIRED_ITEM_COUNT) { htmltext = "30137-05.html"; st.giveAdena(3000, true); st.exitQuest(true, true); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00263_OrcSubjugation/Q00263_OrcSubjugation.java b/src/main/java/com/l2jserver/datapack/quests/Q00263_OrcSubjugation/Q00263_OrcSubjugation.java index ba5024b843..bc1e5aba7f 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00263_OrcSubjugation/Q00263_OrcSubjugation.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00263_OrcSubjugation/Q00263_OrcSubjugation.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.model.quest.State; * Orc Subjugation (263) * @author ivantotov */ -public final class Q00263_OrcSubjugation extends Quest -{ +public final class Q00263_OrcSubjugation extends Quest { // NPCs private static final int KAYLEEN = 30346; // Items @@ -44,16 +43,14 @@ public final class Q00263_OrcSubjugation extends Quest private static final int MIN_LEVEL = 8; // Monsters private static final Map<Integer, Integer> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(20385, ORC_AMULET); // Balor Orc Archer MONSTERS.put(20386, ORC_NECKLACE); // Balor Orc Fighter MONSTERS.put(20387, ORC_NECKLACE); // Balor Orc Fighter Leader MONSTERS.put(20388, ORC_NECKLACE); // Balor Orc Lieutenant } - public Q00263_OrcSubjugation() - { + public Q00263_OrcSubjugation() { super(263, Q00263_OrcSubjugation.class.getSimpleName(), "Orc Subjugation"); addStartNpc(KAYLEEN); addTalkId(KAYLEEN); @@ -62,31 +59,25 @@ public final class Q00263_OrcSubjugation extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { - case "30346-04.htm": - { + switch (event) { + case "30346-04.htm": { st.startQuest(); htmltext = event; break; } - case "30346-07.html": - { + case "30346-07.html": { st.exitQuest(true, true); htmltext = event; break; } - case "30346-08.html": - { + case "30346-08.html": { htmltext = event; break; } @@ -95,11 +86,9 @@ public final class Q00263_OrcSubjugation extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && (getRandom(10) > 4)) - { + if ((st != null) && (getRandom(10) > 4)) { st.giveItems(MONSTERS.get(npc.getId()), 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -107,29 +96,22 @@ public final class Q00263_OrcSubjugation extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getRace() == Race.DARK_ELF) ? (player.getLevel() >= MIN_LEVEL) ? "30346-03.htm" : "30346-02.htm" : "30346-01.htm"; break; } - case State.STARTED: - { - if (hasAtLeastOneQuestItem(player, getRegisteredItemIds())) - { + case State.STARTED: { + if (hasAtLeastOneQuestItem(player, getRegisteredItemIds())) { final long amulets = st.getQuestItemsCount(ORC_AMULET); final long necklaces = st.getQuestItemsCount(ORC_NECKLACE); st.giveAdena(((amulets * 20) + (necklaces * 30) + ((amulets + necklaces) >= 10 ? 1100 : 0)), true); takeItems(player, -1, getRegisteredItemIds()); htmltext = "30346-06.html"; - } - else - { + } else { htmltext = "30346-05.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00264_KeenClaws/Q00264_KeenClaws.java b/src/main/java/com/l2jserver/datapack/quests/Q00264_KeenClaws/Q00264_KeenClaws.java index 8f3d4b3792..9b51d54cd9 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00264_KeenClaws/Q00264_KeenClaws.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00264_KeenClaws/Q00264_KeenClaws.java @@ -35,8 +35,7 @@ import com.l2jserver.gameserver.model.quest.State; * Keen Claws (264) * @author xban1x */ -public final class Q00264_KeenClaws extends Quest -{ +public final class Q00264_KeenClaws extends Quest { // Npc private static final int PAINT = 30136; // Item @@ -48,8 +47,7 @@ public final class Q00264_KeenClaws extends Quest // Misc private static final int MIN_LVL = 3; private static final int WOLF_CLAW_COUNT = 50; - static - { + static { MONSTER_CHANCES.put(20003, Arrays.asList(new ItemHolder(2, 25), new ItemHolder(8, 50))); MONSTER_CHANCES.put(20456, Arrays.asList(new ItemHolder(1, 80), new ItemHolder(2, 100))); @@ -62,8 +60,7 @@ public final class Q00264_KeenClaws extends Quest REWARDS.put(17, Arrays.asList(new ItemHolder(35, 1), new ItemHolder(57, 50))); } - public Q00264_KeenClaws() - { + public Q00264_KeenClaws() { super(264, Q00264_KeenClaws.class.getSimpleName(), "Keen Claws"); addStartNpc(PAINT); addTalkId(PAINT); @@ -72,11 +69,9 @@ public final class Q00264_KeenClaws extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && event.equals("30136-03.htm")) - { + if ((st != null) && event.equals("30136-03.htm")) { st.startQuest(); return event; } @@ -84,18 +79,13 @@ public final class Q00264_KeenClaws extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isCond(1)) - { + if ((st != null) && st.isCond(1)) { final int random = getRandom(100); - for (ItemHolder drop : MONSTER_CHANCES.get(npc.getId())) - { - if (random < drop.getCount()) - { - if (st.giveItemRandomly(WOLF_CLAW, drop.getId(), WOLF_CLAW_COUNT, 1, true)) - { + for (ItemHolder drop : MONSTER_CHANCES.get(npc.getId())) { + if (random < drop.getCount()) { + if (st.giveItemRandomly(WOLF_CLAW, drop.getId(), WOLF_CLAW_COUNT, 1, true)) { st.setCond(2); } break; @@ -106,41 +96,29 @@ public final class Q00264_KeenClaws extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getLevel() >= MIN_LVL) ? "30136-02.htm" : "30136-01.htm"; break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "30136-04.html"; break; } - case 2: - { - if (st.getQuestItemsCount(WOLF_CLAW) >= WOLF_CLAW_COUNT) - { + case 2: { + if (st.getQuestItemsCount(WOLF_CLAW) >= WOLF_CLAW_COUNT) { final int chance = getRandom(17); - for (Map.Entry<Integer, List<ItemHolder>> reward : REWARDS.entrySet()) - { - if (chance < reward.getKey()) - { - for (ItemHolder item : reward.getValue()) - { + for (Map.Entry<Integer, List<ItemHolder>> reward : REWARDS.entrySet()) { + if (chance < reward.getKey()) { + for (ItemHolder item : reward.getValue()) { st.rewardItems(item); } - if (chance == 0) - { + if (chance == 0) { st.playSound(Sound.ITEMSOUND_QUEST_JACKPOT); } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00265_BondsOfSlavery/Q00265_BondsOfSlavery.java b/src/main/java/com/l2jserver/datapack/quests/Q00265_BondsOfSlavery/Q00265_BondsOfSlavery.java index c3a01e6cc9..39794ddd8f 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00265_BondsOfSlavery/Q00265_BondsOfSlavery.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00265_BondsOfSlavery/Q00265_BondsOfSlavery.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.model.quest.State; * Bonds of Slavery (265) * @author xban1x */ -public final class Q00265_BondsOfSlavery extends Quest -{ +public final class Q00265_BondsOfSlavery extends Quest { // Item private static final int IMP_SHACKLES = 1368; // NPC @@ -44,14 +43,12 @@ public final class Q00265_BondsOfSlavery extends Quest private static final int MIN_LVL = 6; // Monsters private static final Map<Integer, Integer> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(20004, 5); // Imp MONSTERS.put(20005, 6); // Imp Elder } - public Q00265_BondsOfSlavery() - { + public Q00265_BondsOfSlavery() { super(265, Q00265_BondsOfSlavery.class.getSimpleName(), "Bonds of Slavery"); addStartNpc(KRISTIN); addTalkId(KRISTIN); @@ -60,31 +57,25 @@ public final class Q00265_BondsOfSlavery extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { - case "30357-04.htm": - { + switch (event) { + case "30357-04.htm": { st.startQuest(); htmltext = event; break; } - case "30357-07.html": - { + case "30357-07.html": { st.exitQuest(true, true); htmltext = event; break; } - case "30357-08.html": - { + case "30357-08.html": { htmltext = event; break; } @@ -93,11 +84,9 @@ public final class Q00265_BondsOfSlavery extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && (getRandom(10) < MONSTERS.get(npc.getId()))) - { + if ((st != null) && (getRandom(10) < MONSTERS.get(npc.getId()))) { st.giveItems(IMP_SHACKLES, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -105,29 +94,22 @@ public final class Q00265_BondsOfSlavery extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getRace() == Race.DARK_ELF) ? (player.getLevel() >= MIN_LVL) ? "30357-03.htm" : "30357-02.html" : "30357-01.html"; break; } - case State.STARTED: - { - if (st.hasQuestItems(IMP_SHACKLES)) - { + case State.STARTED: { + if (st.hasQuestItems(IMP_SHACKLES)) { final long shackles = st.getQuestItemsCount(IMP_SHACKLES); st.giveAdena((shackles * 12) + (shackles >= 10 ? 500 : 0), true); st.takeItems(IMP_SHACKLES, -1); Q00281_HeadForTheHills.giveNewbieReward(player); htmltext = "30357-06.html"; - } - else - { + } else { htmltext = "30357-05.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00266_PleasOfPixies/Q00266_PleasOfPixies.java b/src/main/java/com/l2jserver/datapack/quests/Q00266_PleasOfPixies/Q00266_PleasOfPixies.java index fd95f458f4..234d34f9f1 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00266_PleasOfPixies/Q00266_PleasOfPixies.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00266_PleasOfPixies/Q00266_PleasOfPixies.java @@ -36,16 +36,14 @@ import com.l2jserver.gameserver.model.quest.State; * Pleas of Pixies (266) * @author xban1x */ -public final class Q00266_PleasOfPixies extends Quest -{ +public final class Q00266_PleasOfPixies extends Quest { // NPC private static final int PIXY_MURIKA = 31852; // Items private static final int PREDATORS_FANG = 1334; // Monsters private static final Map<Integer, List<ItemHolder>> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(20537, Arrays.asList(new ItemHolder(10, 2))); // Elder Red Keltir MONSTERS.put(20525, Arrays.asList(new ItemHolder(5, 2), new ItemHolder(10, 3))); // Gray Wolf MONSTERS.put(20534, Arrays.asList(new ItemHolder(6, 1))); // Red Keltir @@ -53,8 +51,7 @@ public final class Q00266_PleasOfPixies extends Quest } // Rewards private static final Map<Integer, List<ItemHolder>> REWARDS = new HashMap<>(); - static - { + static { REWARDS.put(0, Arrays.asList(new ItemHolder(1337, 1), new ItemHolder(3032, 1))); // Emerald, Recipe: Spiritshot D REWARDS.put(1, Arrays.asList(new ItemHolder(2176, 1), new ItemHolder(1338, 1))); // Recipe: Leather Boots, Blue Onyx REWARDS.put(2, Arrays.asList(new ItemHolder(1339, 1), new ItemHolder(1061, 1))); // Onyx, Greater Healing Potion @@ -63,8 +60,7 @@ public final class Q00266_PleasOfPixies extends Quest // Misc private static final int MIN_LVL = 3; - public Q00266_PleasOfPixies() - { + public Q00266_PleasOfPixies() { super(266, Q00266_PleasOfPixies.class.getSimpleName(), "Pleas of Pixies"); addStartNpc(PIXY_MURIKA); addTalkId(PIXY_MURIKA); @@ -73,11 +69,9 @@ public final class Q00266_PleasOfPixies extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && event.equals("31852-04.htm")) - { + if ((st != null) && event.equals("31852-04.htm")) { st.startQuest(); return event; } @@ -85,18 +79,13 @@ public final class Q00266_PleasOfPixies extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isCond(1)) - { + if ((st != null) && st.isCond(1)) { final int chance = getRandom(10); - for (ItemHolder mob : MONSTERS.get(npc.getId())) - { - if (chance < mob.getId()) - { - if (st.giveItemRandomly(npc, PREDATORS_FANG, mob.getCount(), 100, 1.0, true)) - { + for (ItemHolder mob : MONSTERS.get(npc.getId())) { + if (chance < mob.getId()) { + if (st.giveItemRandomly(npc, PREDATORS_FANG, mob.getCount(), 100, 1.0, true)) { st.setCond(2); } break; @@ -107,62 +96,41 @@ public final class Q00266_PleasOfPixies extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { - if (player.getRace() != Race.ELF) - { + switch (st.getState()) { + case State.CREATED: { + if (player.getRace() != Race.ELF) { htmltext = "31852-01.htm"; - } - else if (player.getLevel() < MIN_LVL) - { + } else if (player.getLevel() < MIN_LVL) { htmltext = "31852-02.htm"; - } - else - { + } else { htmltext = "31852-03.htm"; } break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "31852-05.html"; break; } - case 2: - { - if (st.getQuestItemsCount(PREDATORS_FANG) >= 100) - { + case 2: { + if (st.getQuestItemsCount(PREDATORS_FANG) >= 100) { final int chance = getRandom(100); int reward; - if (chance < 2) - { + if (chance < 2) { reward = 0; st.playSound(Sound.ITEMSOUND_QUEST_JACKPOT); - } - else if (chance < 20) - { + } else if (chance < 20) { reward = 1; - } - else if (chance < 45) - { + } else if (chance < 45) { reward = 2; - } - else - { + } else { reward = 3; } - for (ItemHolder item : REWARDS.get(reward)) - { + for (ItemHolder item : REWARDS.get(reward)) { st.rewardItems(item); } st.exitQuest(true, true); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00267_WrathOfVerdure/Q00267_WrathOfVerdure.java b/src/main/java/com/l2jserver/datapack/quests/Q00267_WrathOfVerdure/Q00267_WrathOfVerdure.java index 174caf4376..e509e9b3a5 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00267_WrathOfVerdure/Q00267_WrathOfVerdure.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00267_WrathOfVerdure/Q00267_WrathOfVerdure.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.State; * Wrath of Verdure (267) * @author xban1x */ -public final class Q00267_WrathOfVerdure extends Quest -{ +public final class Q00267_WrathOfVerdure extends Quest { // NPC private static final int TREANT_BREMEC = 31853; // Item @@ -43,8 +42,7 @@ public final class Q00267_WrathOfVerdure extends Quest // Misc private static final int MIN_LVL = 4; - public Q00267_WrathOfVerdure() - { + public Q00267_WrathOfVerdure() { super(267, Q00267_WrathOfVerdure.class.getSimpleName(), "Wrath of Verdure"); addStartNpc(TREANT_BREMEC); addTalkId(TREANT_BREMEC); @@ -53,28 +51,22 @@ public final class Q00267_WrathOfVerdure extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st != null) - { - switch (event) - { - case "31853-04.htm": - { + if (st != null) { + switch (event) { + case "31853-04.htm": { st.startQuest(); htmltext = event; break; } - case "31853-07.html": - { + case "31853-07.html": { st.exitQuest(true, true); htmltext = event; break; } - case "31853-08.html": - { + case "31853-08.html": { htmltext = event; break; } @@ -84,11 +76,9 @@ public final class Q00267_WrathOfVerdure extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && (getRandom(10) < 5)) - { + if ((st != null) && (getRandom(10) < 5)) { st.giveItems(GOBLIN_CLUB, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -96,32 +86,24 @@ public final class Q00267_WrathOfVerdure extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getRace() == Race.ELF) ? (player.getLevel() >= MIN_LVL) ? "31853-03.htm" : "31853-02.htm" : "31853-01.htm"; break; } - case State.STARTED: - { - if (st.hasQuestItems(GOBLIN_CLUB)) - { + case State.STARTED: { + if (st.hasQuestItems(GOBLIN_CLUB)) { final long count = st.getQuestItemsCount(GOBLIN_CLUB); st.rewardItems(SILVERY_LEAF, count); - if (count >= 10) - { + if (count >= 10) { st.giveAdena(600, true); } st.takeItems(GOBLIN_CLUB, -1); htmltext = "31853-06.html"; - } - else - { + } else { htmltext = "31853-05.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00268_TracesOfEvil/Q00268_TracesOfEvil.java b/src/main/java/com/l2jserver/datapack/quests/Q00268_TracesOfEvil/Q00268_TracesOfEvil.java index f2190b2cdc..bdc567c8ec 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00268_TracesOfEvil/Q00268_TracesOfEvil.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00268_TracesOfEvil/Q00268_TracesOfEvil.java @@ -29,15 +29,13 @@ import com.l2jserver.gameserver.model.quest.State; * Traces of Evil (268) * @author xban1x */ -public final class Q00268_TracesOfEvil extends Quest -{ +public final class Q00268_TracesOfEvil extends Quest { // NPC private static final int KUNAI = 30559; // Item private static final int CONTAMINATED_KASHA_SPIDER_VENOM = 10869; // Monsters - private static final int[] MONSTERS = new int[] - { + private static final int[] MONSTERS = new int[] { 20474, // Kasha Spider 20476, // Kasha Fang Spider 20478, // Kasha Blade Spider @@ -45,8 +43,7 @@ public final class Q00268_TracesOfEvil extends Quest // Misc private static final int MIN_LVL = 15; - public Q00268_TracesOfEvil() - { + public Q00268_TracesOfEvil() { super(268, Q00268_TracesOfEvil.class.getSimpleName(), "Traces of Evil"); addStartNpc(KUNAI); addTalkId(KUNAI); @@ -55,11 +52,9 @@ public final class Q00268_TracesOfEvil extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && event.equalsIgnoreCase("30559-03.htm")) - { + if ((st != null) && event.equalsIgnoreCase("30559-03.htm")) { st.startQuest(); return event; } @@ -67,18 +62,13 @@ public final class Q00268_TracesOfEvil extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isCond(1)) - { + if ((st != null) && st.isCond(1)) { st.giveItems(CONTAMINATED_KASHA_SPIDER_VENOM, 1); - if (st.getQuestItemsCount(CONTAMINATED_KASHA_SPIDER_VENOM) >= 30) - { + if (st.getQuestItemsCount(CONTAMINATED_KASHA_SPIDER_VENOM) >= 30) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -86,30 +76,22 @@ public final class Q00268_TracesOfEvil extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getLevel() >= MIN_LVL) ? "30559-02.htm" : "30559-01.htm"; break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = (!st.hasQuestItems(CONTAMINATED_KASHA_SPIDER_VENOM)) ? "30559-04.html" : "30559-05.html"; break; } - case 2: - { - if (st.getQuestItemsCount(CONTAMINATED_KASHA_SPIDER_VENOM) >= 30) - { + case 2: { + if (st.getQuestItemsCount(CONTAMINATED_KASHA_SPIDER_VENOM) >= 30) { st.giveAdena(2474, true); st.addExpAndSp(8738, 409); st.exitQuest(true, true); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00269_InventionAmbition/Q00269_InventionAmbition.java b/src/main/java/com/l2jserver/datapack/quests/Q00269_InventionAmbition/Q00269_InventionAmbition.java index 1e608f9a29..b47841a572 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00269_InventionAmbition/Q00269_InventionAmbition.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00269_InventionAmbition/Q00269_InventionAmbition.java @@ -30,16 +30,14 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Invention Ambition (269) * @author xban1x */ -public final class Q00269_InventionAmbition extends Quest -{ +public final class Q00269_InventionAmbition extends Quest { // NPC private static final int INVENTOR_MARU = 32486; // Items private static final int ENERGY_ORE = 10866; // Monsters private static final Map<Integer, Double> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(21124, 0.46); // Red Eye Barbed Bat MONSTERS.put(21125, 0.48); // Northern Trimden MONSTERS.put(21126, 0.5); // Kerope Werewolf @@ -52,8 +50,7 @@ public final class Q00269_InventionAmbition extends Quest // Misc private static final int MIN_LVL = 18; - public Q00269_InventionAmbition() - { + public Q00269_InventionAmbition() { super(269, Q00269_InventionAmbition.class.getSimpleName(), "Invention Ambition"); addStartNpc(INVENTOR_MARU); addTalkId(INVENTOR_MARU); @@ -62,42 +59,33 @@ public final class Q00269_InventionAmbition extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "32486-03.htm": - { - if (player.getLevel() >= MIN_LVL) - { + switch (event) { + case "32486-03.htm": { + if (player.getLevel() >= MIN_LVL) { htmltext = event; } break; } - case "32486-04.htm": - { - if (player.getLevel() >= MIN_LVL) - { + case "32486-04.htm": { + if (player.getLevel() >= MIN_LVL) { st.startQuest(); htmltext = event; } break; } - case "32486-07.html": - { + case "32486-07.html": { st.exitQuest(true, true); htmltext = event; break; } - case "32486-08.html": - { + case "32486-08.html": { htmltext = event; break; } @@ -106,36 +94,27 @@ public final class Q00269_InventionAmbition extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getRandomPartyMemberState(killer, -1, 3, npc); - if (st != null) - { + if (st != null) { giveItemRandomly(st.getPlayer(), npc, ENERGY_ORE, 1, 0, MONSTERS.get(npc.getId()), true); } return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCreated()) - { + if (st.isCreated()) { htmltext = (player.getLevel() >= MIN_LVL) ? "32486-01.htm" : "32486-02.html"; - } - else if (st.isStarted()) - { - if (st.hasQuestItems(ENERGY_ORE)) - { + } else if (st.isStarted()) { + if (st.hasQuestItems(ENERGY_ORE)) { final long count = getQuestItemsCount(player, ENERGY_ORE); giveAdena(player, (count * 50) + (count >= 10 ? 2044 : 0), true); takeItems(player, ENERGY_ORE, -1); htmltext = "32486-06.html"; - } - else - { + } else { htmltext = "32486-05.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00270_TheOneWhoEndsSilence/Q00270_TheOneWhoEndsSilence.java b/src/main/java/com/l2jserver/datapack/quests/Q00270_TheOneWhoEndsSilence/Q00270_TheOneWhoEndsSilence.java index 76a3347d4e..89b59f7535 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00270_TheOneWhoEndsSilence/Q00270_TheOneWhoEndsSilence.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00270_TheOneWhoEndsSilence/Q00270_TheOneWhoEndsSilence.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * The One Who Ends Silence (270) * @author Zoey76 */ -public class Q00270_TheOneWhoEndsSilence extends Quest -{ +public class Q00270_TheOneWhoEndsSilence extends Quest { // NPC private static final int FAKE_GREYMORE = 32757; // Monsters @@ -51,8 +50,7 @@ public class Q00270_TheOneWhoEndsSilence extends Quest // Misc private static final int MIN_LEVEL = 82; - public Q00270_TheOneWhoEndsSilence() - { + public Q00270_TheOneWhoEndsSilence() { super(270, Q00270_TheOneWhoEndsSilence.class.getSimpleName(), "The One Who Ends Silence"); addStartNpc(FAKE_GREYMORE); addTalkId(FAKE_GREYMORE); @@ -61,96 +59,67 @@ public class Q00270_TheOneWhoEndsSilence extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; final long ragsCount = st.getQuestItemsCount(TATTERED_MONK_CLOTHES); - switch (event) - { - case "32757-02.htm": - { + switch (event) { + case "32757-02.htm": { final QuestState qs = player.getQuestState(Q10288_SecretMission.class.getSimpleName()); - if ((player.getLevel() >= MIN_LEVEL) && (qs != null) && qs.isCompleted()) - { + if ((player.getLevel() >= MIN_LEVEL) && (qs != null) && qs.isCompleted()) { htmltext = event; } break; } - case "32757-04.html": - { + case "32757-04.html": { final QuestState qs = player.getQuestState(Q10288_SecretMission.class.getSimpleName()); - if ((player.getLevel() >= MIN_LEVEL) && (qs != null) && qs.isCompleted()) - { + if ((player.getLevel() >= MIN_LEVEL) && (qs != null) && qs.isCompleted()) { st.startQuest(); htmltext = event; } break; } - case "32757-08.html": - { - if (st.isCond(1)) - { - if (ragsCount == 0) - { + case "32757-08.html": { + if (st.isCond(1)) { + if (ragsCount == 0) { htmltext = "32757-06.html"; - } - else if (ragsCount < 100) - { + } else if (ragsCount < 100) { htmltext = "32757-07.html"; - } - else - { + } else { htmltext = event; } } break; } - case "rags100": - { - if (ragsCount >= 100) - { - if (getRandom(10) < 5) - { - if (getRandom(1000) < 438) - { + case "rags100": { + if (ragsCount >= 100) { + if (getRandom(10) < 5) { + if (getRandom(1000) < 438) { st.giveItems(10373 + getRandom(9), 1); - } - else - { + } else { st.giveItems(10397 + getRandom(9), 1); } - } - else - { + } else { rewardScroll(st, 1); } st.takeItems(TATTERED_MONK_CLOTHES, 100); st.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); htmltext = "32757-09.html"; - } - else - { + } else { htmltext = "32757-10.html"; } break; } - case "rags200": - { - if (ragsCount >= 200) - { - if (getRandom(1000) < 549) - { + case "rags200": { + if (ragsCount >= 200) { + if (getRandom(1000) < 549) { st.giveItems(10373 + getRandom(9), 1); - } - else - { + } else { st.giveItems(10397 + getRandom(9), 1); } rewardScroll(st, 2); @@ -158,17 +127,13 @@ public class Q00270_TheOneWhoEndsSilence extends Quest st.takeItems(TATTERED_MONK_CLOTHES, 200); st.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); htmltext = "32757-09.html"; - } - else - { + } else { htmltext = "32757-10.html"; } break; } - case "rags300": - { - if (ragsCount >= 300) - { + case "rags300": { + if (ragsCount >= 300) { st.giveItems(10373 + getRandom(9), 1); st.giveItems(10397 + getRandom(9), 1); rewardScroll(st, 3); @@ -176,61 +141,44 @@ public class Q00270_TheOneWhoEndsSilence extends Quest st.takeItems(TATTERED_MONK_CLOTHES, 300); st.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); htmltext = "32757-09.html"; - } - else - { + } else { htmltext = "32757-10.html"; } break; } - case "rags400": - { - if (ragsCount >= 400) - { + case "rags400": { + if (ragsCount >= 400) { st.giveItems(10373 + getRandom(9), 1); st.giveItems(10397 + getRandom(9), 1); rewardScroll(st, 3); - if (getRandom(10) < 5) - { - if (getRandom(1000) < 438) - { + if (getRandom(10) < 5) { + if (getRandom(1000) < 438) { st.giveItems(10373 + getRandom(9), 1); - } - else - { + } else { st.giveItems(10397 + getRandom(9), 1); } - } - else - { + } else { rewardScroll(st, 1); } st.takeItems(TATTERED_MONK_CLOTHES, 400); st.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); htmltext = "32757-09.html"; - } - else - { + } else { htmltext = "32757-10.html"; } break; } - case "rags500": - { - if (ragsCount >= 500) - { + case "rags500": { + if (ragsCount >= 500) { st.giveItems(10373 + getRandom(9), 1); st.giveItems(10397 + getRandom(9), 1); rewardScroll(st, 3); - if (getRandom(1000) < 549) - { + if (getRandom(1000) < 549) { st.giveItems(10373 + getRandom(9), 1); - } - else - { + } else { st.giveItems(10397 + getRandom(9), 1); } @@ -238,33 +186,24 @@ public class Q00270_TheOneWhoEndsSilence extends Quest st.takeItems(TATTERED_MONK_CLOTHES, 500); st.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); htmltext = "32757-09.html"; - } - else - { + } else { htmltext = "32757-10.html"; } break; } - case "exit1": - { - if (st.isCond(1)) - { - if (ragsCount >= 1) - { + case "exit1": { + if (st.isCond(1)) { + if (ragsCount >= 1) { htmltext = "32757-12.html"; - } - else - { + } else { st.exitQuest(true, true); htmltext = "32757-13.html"; } } break; } - case "exit2": - { - if (st.isCond(1)) - { + case "exit2": { + if (st.isCond(1)) { st.exitQuest(true, true); htmltext = "32757-13.html"; } @@ -275,57 +214,45 @@ public class Q00270_TheOneWhoEndsSilence extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - switch (npc.getId()) - { - case SEEKER_SOLINA: - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + switch (npc.getId()) { + case SEEKER_SOLINA: { giveItem(getRandomPartyMember(killer, 1), npc, 57, false); break; } - case SAVIOR_SOLINA: - { + case SAVIOR_SOLINA: { giveItem(getRandomPartyMember(killer, 1), npc, 55, false); break; } - case ASCETIC_SOLINA: - { + case ASCETIC_SOLINA: { giveItem(getRandomPartyMember(killer, 1), npc, 59, false); break; } - case DIVINITY_JUDGE: - { + case DIVINITY_JUDGE: { giveItem(getRandomPartyMember(killer, 1), npc, 698, false); break; } - case DIVINITY_MANAGER: - { + case DIVINITY_MANAGER: { giveItem(getRandomPartyMember(killer, 1), npc, 735, false); break; } - case DIVINITY_SUPERVISOR: - { + case DIVINITY_SUPERVISOR: { giveItem(getRandomPartyMember(killer, 1), npc, 903, false); break; } - case DIVINITY_WORSHIPPER: - { + case DIVINITY_WORSHIPPER: { giveItem(getRandomPartyMember(killer, 1), npc, 811, false); break; } - case DIVINITY_PROTECTOR: - { + case DIVINITY_PROTECTOR: { giveItem(getRandomPartyMember(killer, 1), npc, 884, true); break; } - case DIVINITY_FIGHTER: - { + case DIVINITY_FIGHTER: { giveItem(getRandomPartyMember(killer, 1), npc, 893, true); break; } - case DIVINITY_MAGUS: - { + case DIVINITY_MAGUS: { giveItem(getRandomPartyMember(killer, 1), npc, 953, true); break; } @@ -334,18 +261,15 @@ public class Q00270_TheOneWhoEndsSilence extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = ((player.getLevel() >= MIN_LEVEL) && player.hasQuestCompleted(Q10288_SecretMission.class.getSimpleName())) ? "32757-01.htm" : "32757-03.html"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "32757-05.html"; } break; @@ -358,66 +282,43 @@ public class Q00270_TheOneWhoEndsSilence extends Quest * @param qs the player's quest state. * @param type the type. */ - private void rewardScroll(QuestState qs, int type) - { + private void rewardScroll(QuestState qs, int type) { int chance; int scrollId = 5593; - switch (type) - { + switch (type) { case 1: chance = getRandom(100); - if (chance < 1) - { + if (chance < 1) { scrollId = 5593; - } - else if (chance < 28) - { + } else if (chance < 28) { scrollId = 5594; - } - else if (chance < 61) - { + } else if (chance < 61) { scrollId = 5595; - } - else - { + } else { scrollId = 9898; } break; case 2: chance = getRandom(100); - if (chance < 20) - { + if (chance < 20) { scrollId = 5593; - } - else if (chance < 40) - { + } else if (chance < 40) { scrollId = 5594; - } - else if (chance < 70) - { + } else if (chance < 70) { scrollId = 5595; - } - else - { + } else { scrollId = 9898; } break; case 3: chance = getRandom(1000); - if (chance < 242) - { + if (chance < 242) { scrollId = 5593; - } - else if (chance < 486) - { + } else if (chance < 486) { scrollId = 5594; - } - else if (chance < 742) - { + } else if (chance < 742) { scrollId = 5595; - } - else - { + } else { scrollId = 9898; } break; @@ -432,13 +333,10 @@ public class Q00270_TheOneWhoEndsSilence extends Quest * @param chance the reward chance * @param atLeastOne if {@code true} it will reward two items if the chance is meet and one if the chance is not meet, if {@code false} if the chance is not meet doesn't reward, otherwise reward one item */ - private static void giveItem(L2PcInstance player, L2Npc npc, int chance, boolean atLeastOne) - { - if ((player != null) && Util.checkIfInRange(1500, npc, player, false)) - { + private static void giveItem(L2PcInstance player, L2Npc npc, int chance, boolean atLeastOne) { + if ((player != null) && Util.checkIfInRange(1500, npc, player, false)) { final int count = ((getRandom(1000) < chance) ? 1 : 0) + (atLeastOne ? 1 : 0); - if (count > 0) - { + if (count > 0) { final QuestState qs = player.getQuestState(Q00270_TheOneWhoEndsSilence.class.getSimpleName()); qs.giveItems(TATTERED_MONK_CLOTHES, count); qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00271_ProofOfValor/Q00271_ProofOfValor.java b/src/main/java/com/l2jserver/datapack/quests/Q00271_ProofOfValor/Q00271_ProofOfValor.java index c1dd474d55..6e52433a6c 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00271_ProofOfValor/Q00271_ProofOfValor.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00271_ProofOfValor/Q00271_ProofOfValor.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.State; * Proof of Valor (271) * @author xban1x */ -public final class Q00271_ProofOfValor extends Quest -{ +public final class Q00271_ProofOfValor extends Quest { // NPC private static final int RUKAIN = 30577; // Items @@ -45,8 +44,7 @@ public final class Q00271_ProofOfValor extends Quest // Misc private static final int MIN_LVL = 4; - public Q00271_ProofOfValor() - { + public Q00271_ProofOfValor() { super(271, Q00271_ProofOfValor.class.getSimpleName(), "Proof of Valor"); addStartNpc(RUKAIN); addTalkId(RUKAIN); @@ -55,11 +53,9 @@ public final class Q00271_ProofOfValor extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && event.equalsIgnoreCase("30577-04.htm")) - { + if ((st != null) && event.equalsIgnoreCase("30577-04.htm")) { st.startQuest(); return hasAtLeastOneQuestItem(player, NECKLACE_OF_VALOR, NECKLACE_OF_COURAGE) ? "30577-08.html" : event; } @@ -67,20 +63,15 @@ public final class Q00271_ProofOfValor extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isCond(1)) - { + if ((st != null) && st.isCond(1)) { final long count = st.getQuestItemsCount(KASHA_WOLF_FANG); int amount = ((getRandom(100) < 25) && (count < 49)) ? 2 : 1; st.giveItems(KASHA_WOLF_FANG, amount); - if ((count + amount) >= 50) - { + if ((count + amount) >= 50) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -88,37 +79,26 @@ public final class Q00271_ProofOfValor extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = null; - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getRace() == Race.ORC) ? (player.getLevel() >= MIN_LVL) ? (hasAtLeastOneQuestItem(player, NECKLACE_OF_VALOR, NECKLACE_OF_COURAGE)) ? "30577-07.htm" : "30577-03.htm" : "30577-02.htm" : "30577-01.htm"; break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "30577-05.html"; break; } - case 2: - { - if (st.getQuestItemsCount(KASHA_WOLF_FANG) >= 50) - { - if (getRandom(100) <= 13) - { + case 2: { + if (st.getQuestItemsCount(KASHA_WOLF_FANG) >= 50) { + if (getRandom(100) <= 13) { st.rewardItems(NECKLACE_OF_VALOR, 1); st.rewardItems(HEALING_POTION, 10); - } - else - { + } else { st.rewardItems(NECKLACE_OF_COURAGE, 1); } st.takeItems(KASHA_WOLF_FANG, -1); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00272_WrathOfAncestors/Q00272_WrathOfAncestors.java b/src/main/java/com/l2jserver/datapack/quests/Q00272_WrathOfAncestors/Q00272_WrathOfAncestors.java index f0ac4d871c..2f49a9aa80 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00272_WrathOfAncestors/Q00272_WrathOfAncestors.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00272_WrathOfAncestors/Q00272_WrathOfAncestors.java @@ -30,23 +30,20 @@ import com.l2jserver.gameserver.model.quest.State; * Wrath of Ancestors (272) * @author xban1x */ -public final class Q00272_WrathOfAncestors extends Quest -{ +public final class Q00272_WrathOfAncestors extends Quest { // NPC private static final int LIVINA = 30572; // Items private static final int GRAVE_ROBBERS_HEAD = 1474; // Monsters - private static final int[] MONSTERS = new int[] - { + private static final int[] MONSTERS = new int[] { 20319, // Goblin Grave Robber 20320, // Goblin Tomb Raider Leader }; // Misc private static final int MIN_LVL = 5; - public Q00272_WrathOfAncestors() - { + public Q00272_WrathOfAncestors() { super(272, Q00272_WrathOfAncestors.class.getSimpleName(), "Wrath of Ancestors"); addStartNpc(LIVINA); addTalkId(LIVINA); @@ -55,11 +52,9 @@ public final class Q00272_WrathOfAncestors extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && event.equalsIgnoreCase("30572-04.htm")) - { + if ((st != null) && event.equalsIgnoreCase("30572-04.htm")) { st.startQuest(); return event; } @@ -67,18 +62,13 @@ public final class Q00272_WrathOfAncestors extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isCond(1)) - { + if ((st != null) && st.isCond(1)) { st.giveItems(GRAVE_ROBBERS_HEAD, 1); - if (st.getQuestItemsCount(GRAVE_ROBBERS_HEAD) >= 50) - { + if (st.getQuestItemsCount(GRAVE_ROBBERS_HEAD) >= 50) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -86,28 +76,21 @@ public final class Q00272_WrathOfAncestors extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = null; - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getRace() == Race.ORC) ? (player.getLevel() >= MIN_LVL) ? "30572-03.htm" : "30572-02.htm" : "30572-01.htm"; break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "30572-05.html"; break; } - case 2: - { + case 2: { st.giveAdena(1500, true); st.exitQuest(true, true); htmltext = "30572-06.html"; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00273_InvadersOfTheHolyLand/Q00273_InvadersOfTheHolyLand.java b/src/main/java/com/l2jserver/datapack/quests/Q00273_InvadersOfTheHolyLand/Q00273_InvadersOfTheHolyLand.java index d4c3c5fd25..325fb5162c 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00273_InvadersOfTheHolyLand/Q00273_InvadersOfTheHolyLand.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00273_InvadersOfTheHolyLand/Q00273_InvadersOfTheHolyLand.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.model.quest.State; * Invaders of the Holy Land (273) * @author xban1x */ -public final class Q00273_InvadersOfTheHolyLand extends Quest -{ +public final class Q00273_InvadersOfTheHolyLand extends Quest { // NPC private static final int VARKEES = 30566; // Items @@ -43,8 +42,7 @@ public final class Q00273_InvadersOfTheHolyLand extends Quest private static final int RED_SOULSTONE = 1476; // Monsters private static final Map<Integer, Integer> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(20311, 90); // Rakeclaw Imp MONSTERS.put(20312, 87); // Rakeclaw Imp Hunter MONSTERS.put(20313, 77); // Rakeclaw Imp Chieftain @@ -52,8 +50,7 @@ public final class Q00273_InvadersOfTheHolyLand extends Quest // Misc private static final int MIN_LVL = 6; - public Q00273_InvadersOfTheHolyLand() - { + public Q00273_InvadersOfTheHolyLand() { super(273, Q00273_InvadersOfTheHolyLand.class.getSimpleName(), "Invaders of the Holy Land"); addStartNpc(VARKEES); addTalkId(VARKEES); @@ -62,28 +59,22 @@ public final class Q00273_InvadersOfTheHolyLand extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st != null) - { - switch (event) - { - case "30566-04.htm": - { + if (st != null) { + switch (event) { + case "30566-04.htm": { st.startQuest(); htmltext = event; break; } - case "30566-08.html": - { + case "30566-08.html": { st.exitQuest(true, true); htmltext = event; break; } - case "30566-09.html": - { + case "30566-09.html": { htmltext = event; break; } @@ -93,17 +84,12 @@ public final class Q00273_InvadersOfTheHolyLand extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if (st != null) - { - if (getRandom(100) <= MONSTERS.get(npc.getId())) - { + if (st != null) { + if (getRandom(100) <= MONSTERS.get(npc.getId())) { st.giveItems(BLACK_SOULSTONE, 1); - } - else - { + } else { st.giveItems(RED_SOULSTONE, 1); } st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); @@ -112,30 +98,23 @@ public final class Q00273_InvadersOfTheHolyLand extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = null; - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getRace() == Race.ORC) ? (player.getLevel() >= MIN_LVL) ? "30566-03.htm" : "30566-02.htm" : "30566-01.htm"; break; } - case State.STARTED: - { - if (hasAtLeastOneQuestItem(player, BLACK_SOULSTONE, RED_SOULSTONE)) - { + case State.STARTED: { + if (hasAtLeastOneQuestItem(player, BLACK_SOULSTONE, RED_SOULSTONE)) { final long black = st.getQuestItemsCount(BLACK_SOULSTONE); final long red = st.getQuestItemsCount(RED_SOULSTONE); st.giveAdena((red * 10) + (black * 3) + ((red > 0) ? (((red + black) >= 10) ? 1800 : 0) : ((black >= 10) ? 1500 : 0)), true); takeItems(player, -1, BLACK_SOULSTONE, RED_SOULSTONE); Q00281_HeadForTheHills.giveNewbieReward(player); htmltext = (red > 0) ? "30566-07.html" : "30566-06.html"; - } - else - { + } else { htmltext = "30566-05.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00274_SkirmishWithTheWerewolves/Q00274_SkirmishWithTheWerewolves.java b/src/main/java/com/l2jserver/datapack/quests/Q00274_SkirmishWithTheWerewolves/Q00274_SkirmishWithTheWerewolves.java index e0b5f00c88..801afee8fb 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00274_SkirmishWithTheWerewolves/Q00274_SkirmishWithTheWerewolves.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00274_SkirmishWithTheWerewolves/Q00274_SkirmishWithTheWerewolves.java @@ -30,13 +30,11 @@ import com.l2jserver.gameserver.model.quest.State; * Skirmish with the Werewolves (274) * @author xban1x */ -public final class Q00274_SkirmishWithTheWerewolves extends Quest -{ +public final class Q00274_SkirmishWithTheWerewolves extends Quest { // NPC private static final int BRUKURSE = 30569; // Monsters - private static final int[] MONSTERS = new int[] - { + private static final int[] MONSTERS = new int[] { 20363, // Maraku Werewolf 20364, // Maraku Werewolf Chieftain }; @@ -48,8 +46,7 @@ public final class Q00274_SkirmishWithTheWerewolves extends Quest // Misc private static final int MIN_LVL = 9; - public Q00274_SkirmishWithTheWerewolves() - { + public Q00274_SkirmishWithTheWerewolves() { super(274, Q00274_SkirmishWithTheWerewolves.class.getSimpleName(), "Skirmish with the Werewolves"); addStartNpc(BRUKURSE); addTalkId(BRUKURSE); @@ -58,11 +55,9 @@ public final class Q00274_SkirmishWithTheWerewolves extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && event.equalsIgnoreCase("30569-04.htm")) - { + if ((st != null) && event.equalsIgnoreCase("30569-04.htm")) { st.startQuest(); return event; } @@ -70,22 +65,16 @@ public final class Q00274_SkirmishWithTheWerewolves extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isCond(1)) - { + if ((st != null) && st.isCond(1)) { st.giveItems(WEREWOLF_HEAD, 1); - if (getRandom(100) <= 5) - { + if (getRandom(100) <= 5) { st.giveItems(WEREWOLF_TOTEM, 1); } - if (st.getQuestItemsCount(WEREWOLF_HEAD) >= 40) - { + if (st.getQuestItemsCount(WEREWOLF_HEAD) >= 40) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -93,38 +82,27 @@ public final class Q00274_SkirmishWithTheWerewolves extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { - if (hasAtLeastOneQuestItem(player, NECKLACE_OF_VALOR, NECKLACE_OF_COURAGE)) - { + switch (st.getState()) { + case State.CREATED: { + if (hasAtLeastOneQuestItem(player, NECKLACE_OF_VALOR, NECKLACE_OF_COURAGE)) { htmltext = (player.getRace() == Race.ORC) ? (player.getLevel() >= MIN_LVL) ? "30569-03.htm" : "30569-02.html" : "30569-01.html"; - } - else - { + } else { htmltext = "30569-08.html"; } break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "30569-05.html"; break; } - case 2: - { + case 2: { final long heads = st.getQuestItemsCount(WEREWOLF_HEAD); - if (heads >= 40) - { + if (heads >= 40) { final long totems = st.getQuestItemsCount(WEREWOLF_TOTEM); st.giveAdena((heads * 30) + (totems * 600) + 2300, true); st.exitQuest(true, true); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00275_DarkWingedSpies/Q00275_DarkWingedSpies.java b/src/main/java/com/l2jserver/datapack/quests/Q00275_DarkWingedSpies/Q00275_DarkWingedSpies.java index 1e2d4b43d7..7de40b12ea 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00275_DarkWingedSpies/Q00275_DarkWingedSpies.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00275_DarkWingedSpies/Q00275_DarkWingedSpies.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.util.Util; * Dark Winged Spies (275) * @author xban1x */ -public final class Q00275_DarkWingedSpies extends Quest -{ +public final class Q00275_DarkWingedSpies extends Quest { // Npc private static final int NERUGA_CHIEF_TANTUS = 30567; // Items @@ -48,8 +47,7 @@ public final class Q00275_DarkWingedSpies extends Quest private static final int FANG_PRICE = 60; private static final int MAX_BAT_FANG_COUNT = 70; - public Q00275_DarkWingedSpies() - { + public Q00275_DarkWingedSpies() { super(275, Q00275_DarkWingedSpies.class.getSimpleName(), "Dark Winged Spies"); addStartNpc(NERUGA_CHIEF_TANTUS); addTalkId(NERUGA_CHIEF_TANTUS); @@ -59,11 +57,9 @@ public final class Q00275_DarkWingedSpies extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && event.equals("30567-03.htm")) - { + if ((st != null) && event.equals("30567-03.htm")) { st.startQuest(); return event; } @@ -71,35 +67,25 @@ public final class Q00275_DarkWingedSpies extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, killer, true)) - { + if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, killer, true)) { final long count = st.getQuestItemsCount(DARKWING_BAT_FANG); - switch (npc.getId()) - { - case DARKWING_BAT: - { - if (st.giveItemRandomly(DARKWING_BAT_FANG, 1, MAX_BAT_FANG_COUNT, 1, true)) - { + switch (npc.getId()) { + case DARKWING_BAT: { + if (st.giveItemRandomly(DARKWING_BAT_FANG, 1, MAX_BAT_FANG_COUNT, 1, true)) { st.setCond(2); - } - else if ((count > 10) && (count < 66) && (getRandom(100) < 10)) - { + } else if ((count > 10) && (count < 66) && (getRandom(100) < 10)) { st.addSpawn(VARANGKAS_TRACKER); st.giveItems(VARANGKAS_PARASITE, 1); } break; } - case VARANGKAS_TRACKER: - { - if ((count < 66) && st.hasQuestItems(VARANGKAS_PARASITE)) - { - if (st.giveItemRandomly(DARKWING_BAT_FANG, 5, MAX_BAT_FANG_COUNT, 1, true)) - { + case VARANGKAS_TRACKER: { + if ((count < 66) && st.hasQuestItems(VARANGKAS_PARASITE)) { + if (st.giveItemRandomly(DARKWING_BAT_FANG, 5, MAX_BAT_FANG_COUNT, 1, true)) { st.setCond(2); } st.takeItems(VARANGKAS_PARASITE, -1); @@ -113,10 +99,8 @@ public final class Q00275_DarkWingedSpies extends Quest } @Override - public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) - { - if (creature.isPlayer()) - { + public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) { + if (creature.isPlayer()) { npc.setRunning(); ((L2Attackable) npc).addDamageHate(creature, 0, 1); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, creature); @@ -125,31 +109,23 @@ public final class Q00275_DarkWingedSpies extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState st = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (talker.getRace() == Race.ORC) ? (talker.getLevel() >= MIN_LVL) ? "30567-02.htm" : "30567-01.htm" : "30567-00.htm"; break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "30567-05.html"; break; } - case 2: - { + case 2: { final long count = st.getQuestItemsCount(DARKWING_BAT_FANG); - if (count >= MAX_BAT_FANG_COUNT) - { + if (count >= MAX_BAT_FANG_COUNT) { st.giveAdena(count * FANG_PRICE, true); st.exitQuest(true, true); htmltext = "30567-05.html"; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00276_TotemOfTheHestui/Q00276_TotemOfTheHestui.java b/src/main/java/com/l2jserver/datapack/quests/Q00276_TotemOfTheHestui/Q00276_TotemOfTheHestui.java index 30ec55b5df..5e6864fee1 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00276_TotemOfTheHestui/Q00276_TotemOfTheHestui.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00276_TotemOfTheHestui/Q00276_TotemOfTheHestui.java @@ -35,8 +35,7 @@ import com.l2jserver.gameserver.util.Util; * Totem of the Hestui (276) * @author xban1x */ -public final class Q00276_TotemOfTheHestui extends Quest -{ +public final class Q00276_TotemOfTheHestui extends Quest { // Npc private static final int TANAPI = 30571; // Items @@ -46,8 +45,7 @@ public final class Q00276_TotemOfTheHestui extends Quest private static final int KASHA_BEAR = 20479; private static final int KASHA_BEAR_TOTEM = 27044; // Rewards - private static final int[] REWARDS = new int[] - { + private static final int[] REWARDS = new int[] { 29, 1500, }; @@ -55,8 +53,7 @@ public final class Q00276_TotemOfTheHestui extends Quest private static final List<ItemHolder> SPAWN_CHANCES = new ArrayList<>(); private static final int MIN_LVL = 15; - static - { + static { SPAWN_CHANCES.add(new ItemHolder(79, 100)); SPAWN_CHANCES.add(new ItemHolder(69, 20)); SPAWN_CHANCES.add(new ItemHolder(59, 15)); @@ -64,8 +61,7 @@ public final class Q00276_TotemOfTheHestui extends Quest SPAWN_CHANCES.add(new ItemHolder(39, 2)); } - public Q00276_TotemOfTheHestui() - { + public Q00276_TotemOfTheHestui() { super(276, Q00276_TotemOfTheHestui.class.getSimpleName(), "Totem of the Hestui"); addStartNpc(TANAPI); addTalkId(TANAPI); @@ -74,11 +70,9 @@ public final class Q00276_TotemOfTheHestui extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && event.equals("30571-03.htm")) - { + if ((st != null) && event.equals("30571-03.htm")) { st.startQuest(); return event; } @@ -86,38 +80,29 @@ public final class Q00276_TotemOfTheHestui extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, killer, npc, true)) - { - switch (npc.getId()) - { - case KASHA_BEAR: - { + if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, killer, npc, true)) { + switch (npc.getId()) { + case KASHA_BEAR: { final long chance1 = st.getQuestItemsCount(KASHA_PARASITE); final int chance2 = getRandom(100); boolean chance3 = true; - for (ItemHolder spawnChance : SPAWN_CHANCES) - { - if ((chance1 >= spawnChance.getId()) && (chance2 <= spawnChance.getCount())) - { + for (ItemHolder spawnChance : SPAWN_CHANCES) { + if ((chance1 >= spawnChance.getId()) && (chance2 <= spawnChance.getCount())) { st.addSpawn(KASHA_BEAR_TOTEM); st.takeItems(KASHA_PARASITE, -1); chance3 = false; break; } } - if (chance3) - { + if (chance3) { st.giveItemRandomly(KASHA_PARASITE, 1, 0, 1, true); } break; } - case KASHA_BEAR_TOTEM: - { - if (st.giveItemRandomly(KASHA_CRYSTAL, 1, 1, 1, true)) - { + case KASHA_BEAR_TOTEM: { + if (st.giveItemRandomly(KASHA_CRYSTAL, 1, 1, 1, true)) { st.setCond(2); } break; @@ -128,33 +113,24 @@ public final class Q00276_TotemOfTheHestui extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getRace() == Race.ORC) ? (player.getLevel() >= MIN_LVL) ? "30571-02.htm" : "30571-01.htm" : "30571-00.htm"; break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "30571-04.html"; break; } - case 2: - { - if (st.hasQuestItems(KASHA_CRYSTAL)) - { + case 2: { + if (st.hasQuestItems(KASHA_CRYSTAL)) { Q00261_CollectorsDream.giveNewbieReward(player); - for (int reward : REWARDS) - { + for (int reward : REWARDS) { st.rewardItems(reward, 1); } st.exitQuest(true, true); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00277_GatekeepersOffering/Q00277_GatekeepersOffering.java b/src/main/java/com/l2jserver/datapack/quests/Q00277_GatekeepersOffering/Q00277_GatekeepersOffering.java index 2921ddb859..7ab4df0368 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00277_GatekeepersOffering/Q00277_GatekeepersOffering.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00277_GatekeepersOffering/Q00277_GatekeepersOffering.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * Gatekeeper's Offering (277) * @author malyelfik */ -public class Q00277_GatekeepersOffering extends Quest -{ +public class Q00277_GatekeepersOffering extends Quest { // NPC private static final int TAMIL = 30576; // Monster @@ -42,8 +41,7 @@ public class Q00277_GatekeepersOffering extends Quest private static final int MIN_LEVEL = 15; private static final int STARSTONE_COUT = 20; - public Q00277_GatekeepersOffering() - { + public Q00277_GatekeepersOffering() { super(277, Q00277_GatekeepersOffering.class.getSimpleName(), "Gatekeeper's Offering"); addStartNpc(TAMIL); addTalkId(TAMIL); @@ -52,13 +50,10 @@ public class Q00277_GatekeepersOffering extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && event.equalsIgnoreCase("30576-03.htm")) - { - if (player.getLevel() < MIN_LEVEL) - { + if ((st != null) && event.equalsIgnoreCase("30576-03.htm")) { + if (player.getLevel() < MIN_LEVEL) { return "30576-01.htm"; } st.startQuest(); @@ -68,18 +63,13 @@ public class Q00277_GatekeepersOffering extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isStarted() && (st.getQuestItemsCount(STARSTONE) < STARSTONE_COUT)) - { + if ((st != null) && st.isStarted() && (st.getQuestItemsCount(STARSTONE) < STARSTONE_COUT)) { st.giveItems(STARSTONE, 1); - if (st.getQuestItemsCount(STARSTONE) >= STARSTONE_COUT) - { + if (st.getQuestItemsCount(STARSTONE) >= STARSTONE_COUT) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -87,22 +77,17 @@ public class Q00277_GatekeepersOffering extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = "30576-02.htm"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "30576-04.html"; - } - else if (st.isCond(2) && (st.getQuestItemsCount(STARSTONE) >= STARSTONE_COUT)) - { + } else if (st.isCond(2) && (st.getQuestItemsCount(STARSTONE) >= STARSTONE_COUT)) { st.giveItems(GATEKEEPER_CHARM, 2); st.exitQuest(true, true); htmltext = "30576-05.html"; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00278_HomeSecurity/Q00278_HomeSecurity.java b/src/main/java/com/l2jserver/datapack/quests/Q00278_HomeSecurity/Q00278_HomeSecurity.java index 2eab7c33f6..d59f3e2fbd 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00278_HomeSecurity/Q00278_HomeSecurity.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00278_HomeSecurity/Q00278_HomeSecurity.java @@ -27,12 +27,10 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Home Security (278) * @author malyelfik */ -public class Q00278_HomeSecurity extends Quest -{ +public class Q00278_HomeSecurity extends Quest { // NPC private static final int TUNATUN = 31537; - private static final int[] MONSTER = - { + private static final int[] MONSTER = { 18905, 18906, 18907 @@ -42,8 +40,7 @@ public class Q00278_HomeSecurity extends Quest // Misc private static final int SEL_MAHUM_MANE_COUNT = 300; - public Q00278_HomeSecurity() - { + public Q00278_HomeSecurity() { super(278, Q00278_HomeSecurity.class.getSimpleName(), "Home Security"); addStartNpc(TUNATUN); addTalkId(TUNATUN); @@ -52,81 +49,50 @@ public class Q00278_HomeSecurity extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { - case "31537-02.htm": - { + switch (event) { + case "31537-02.htm": { htmltext = (player.getLevel() >= 82) ? "31537-02.htm" : "31537-03.html"; break; } - case "31537-04.htm": - { + case "31537-04.htm": { st.startQuest(); break; } - case "31537-07.html": - { + case "31537-07.html": { int i0 = getRandom(100); - if (i0 < 10) - { + if (i0 < 10) { st.giveItems(960, 1); - } - else if (i0 < 19) - { + } else if (i0 < 19) { st.giveItems(960, 2); - } - else if (i0 < 27) - { + } else if (i0 < 27) { st.giveItems(960, 3); - } - else if (i0 < 34) - { + } else if (i0 < 34) { st.giveItems(960, 4); - } - else if (i0 < 40) - { + } else if (i0 < 40) { st.giveItems(960, 5); - } - else if (i0 < 45) - { + } else if (i0 < 45) { st.giveItems(960, 6); - } - else if (i0 < 49) - { + } else if (i0 < 49) { st.giveItems(960, 7); - } - else if (i0 < 52) - { + } else if (i0 < 52) { st.giveItems(960, 8); - } - else if (i0 < 54) - { + } else if (i0 < 54) { st.giveItems(960, 9); - } - else if (i0 < 55) - { + } else if (i0 < 55) { st.giveItems(960, 10); - } - else if (i0 < 75) - { + } else if (i0 < 75) { st.giveItems(9553, 1); - } - else if (i0 < 90) - { + } else if (i0 < 90) { st.giveItems(9553, 2); - } - else - { + } else { st.giveItems(959, 1); } @@ -139,18 +105,14 @@ public class Q00278_HomeSecurity extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getRandomPartyMemberState(player, 1, 3, npc); - if (st != null) - { - switch (npc.getId()) - { + if (st != null) { + switch (npc.getId()) { case 18905: // Farm Ravager (Crazy) { final int itemCount = ((getRandom(1000) < 486) ? getRandom(6) + 1 : getRandom(5) + 1); - if (st.giveItemRandomly(npc, SEL_MAHUM_MANE, itemCount, SEL_MAHUM_MANE_COUNT, 1.0, true)) - { + if (st.giveItemRandomly(npc, SEL_MAHUM_MANE, itemCount, SEL_MAHUM_MANE_COUNT, 1.0, true)) { st.setCond(2, true); } break; @@ -158,8 +120,7 @@ public class Q00278_HomeSecurity extends Quest case 18906: // Farm Bandit case 18907: // Beast Devourer { - if (st.giveItemRandomly(npc, SEL_MAHUM_MANE, 1, SEL_MAHUM_MANE_COUNT, 0.85, true)) - { + if (st.giveItemRandomly(npc, SEL_MAHUM_MANE, 1, SEL_MAHUM_MANE_COUNT, 0.85, true)) { st.setCond(2, true); } break; @@ -170,22 +131,15 @@ public class Q00278_HomeSecurity extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - if (st.isCreated()) - { + if (st.isCreated()) { htmltext = "31537-01.htm"; - } - else if (st.isStarted()) - { - if (st.isCond(1) || (getQuestItemsCount(player, SEL_MAHUM_MANE) < SEL_MAHUM_MANE_COUNT)) - { + } else if (st.isStarted()) { + if (st.isCond(1) || (getQuestItemsCount(player, SEL_MAHUM_MANE) < SEL_MAHUM_MANE_COUNT)) { htmltext = "31537-06.html"; - } - else if (st.isCond(2) && (getQuestItemsCount(player, SEL_MAHUM_MANE) >= SEL_MAHUM_MANE_COUNT)) - { + } else if (st.isCond(2) && (getQuestItemsCount(player, SEL_MAHUM_MANE) >= SEL_MAHUM_MANE_COUNT)) { htmltext = "31537-05.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00279_TargetOfOpportunity/Q00279_TargetOfOpportunity.java b/src/main/java/com/l2jserver/datapack/quests/Q00279_TargetOfOpportunity/Q00279_TargetOfOpportunity.java index 6bb912c05d..4dc908c152 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00279_TargetOfOpportunity/Q00279_TargetOfOpportunity.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00279_TargetOfOpportunity/Q00279_TargetOfOpportunity.java @@ -33,33 +33,28 @@ import com.l2jserver.gameserver.model.quest.State; * Target of Opportunity (279) * @author GKR */ -public final class Q00279_TargetOfOpportunity extends Quest -{ +public final class Q00279_TargetOfOpportunity extends Quest { // NPCs private static final int JERIAN = 32302; - private static final int[] MONSTERS = - { + private static final int[] MONSTERS = { 22373, 22374, 22375, 22376 }; // Items - private static final int[] SEAL_COMPONENTS = - { + private static final int[] SEAL_COMPONENTS = { 15517, 15518, 15519, 15520 }; - private static final int[] SEAL_BREAKERS = - { + private static final int[] SEAL_BREAKERS = { 15515, 15516 }; - public Q00279_TargetOfOpportunity() - { + public Q00279_TargetOfOpportunity() { super(279, Q00279_TargetOfOpportunity.class.getSimpleName(), "Target of Opportunity"); addStartNpc(JERIAN); addTalkId(JERIAN); @@ -68,22 +63,17 @@ public final class Q00279_TargetOfOpportunity extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; final QuestState st = getQuestState(player, false); - if ((st == null) || (player.getLevel() < 82)) - { + if ((st == null) || (player.getLevel() < 82)) { return getNoQuestMsg(player); } - if (event.equalsIgnoreCase("32302-05.html")) - { + if (event.equalsIgnoreCase("32302-05.html")) { st.startQuest(); st.set("progress", "1"); - } - else if (event.equalsIgnoreCase("32302-08.html") && (st.getInt("progress") == 1) && st.hasQuestItems(SEAL_COMPONENTS[0]) && st.hasQuestItems(SEAL_COMPONENTS[1]) && st.hasQuestItems(SEAL_COMPONENTS[2]) && st.hasQuestItems(SEAL_COMPONENTS[3])) - { + } else if (event.equalsIgnoreCase("32302-08.html") && (st.getInt("progress") == 1) && st.hasQuestItems(SEAL_COMPONENTS[0]) && st.hasQuestItems(SEAL_COMPONENTS[1]) && st.hasQuestItems(SEAL_COMPONENTS[2]) && st.hasQuestItems(SEAL_COMPONENTS[3])) { st.giveItems(SEAL_BREAKERS[0], 1); st.giveItems(SEAL_BREAKERS[1], 1); st.exitQuest(true, true); @@ -92,27 +82,20 @@ public final class Q00279_TargetOfOpportunity extends Quest } @Override - public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { L2PcInstance pl = getRandomPartyMember(player, "progress", "1"); final int idx = Arrays.binarySearch(MONSTERS, npc.getId()); - if ((pl == null) || (idx < 0)) - { + if ((pl == null) || (idx < 0)) { return null; } final QuestState st = getQuestState(pl, false); - if (getRandom(1000) < (int) (311 * rates().getRateQuestDrop())) - { - if (!st.hasQuestItems(SEAL_COMPONENTS[idx])) - { + if (getRandom(1000) < (int) (311 * rates().getRateQuestDrop())) { + if (!st.hasQuestItems(SEAL_COMPONENTS[idx])) { st.giveItems(SEAL_COMPONENTS[idx], 1); - if (haveAllExceptThis(st, idx)) - { + if (haveAllExceptThis(st, idx)) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -121,32 +104,24 @@ public final class Q00279_TargetOfOpportunity extends Quest } @Override - public final String onTalk(L2Npc npc, L2PcInstance player) - { + public final String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - if (st.getState() == State.CREATED) - { + if (st.getState() == State.CREATED) { htmltext = (player.getLevel() >= 82) ? "32302-01.htm" : "32302-02.html"; - } - else if ((st.getState() == State.STARTED) && (st.getInt("progress") == 1)) - { + } else if ((st.getState() == State.STARTED) && (st.getInt("progress") == 1)) { htmltext = (st.hasQuestItems(SEAL_COMPONENTS[0]) && st.hasQuestItems(SEAL_COMPONENTS[1]) && st.hasQuestItems(SEAL_COMPONENTS[2]) && st.hasQuestItems(SEAL_COMPONENTS[3])) ? "32302-07.html" : "32302-06.html"; } return htmltext; } - private static final boolean haveAllExceptThis(QuestState st, int idx) - { - for (int i = 0; i < SEAL_COMPONENTS.length; i++) - { - if (i == idx) - { + private static final boolean haveAllExceptThis(QuestState st, int idx) { + for (int i = 0; i < SEAL_COMPONENTS.length; i++) { + if (i == idx) { continue; } - if (!st.hasQuestItems(SEAL_COMPONENTS[i])) - { + if (!st.hasQuestItems(SEAL_COMPONENTS[i])) { return false; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00280_TheFoodChain/Q00280_TheFoodChain.java b/src/main/java/com/l2jserver/datapack/quests/Q00280_TheFoodChain/Q00280_TheFoodChain.java index 7299472a0f..254db4eb1f 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00280_TheFoodChain/Q00280_TheFoodChain.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00280_TheFoodChain/Q00280_TheFoodChain.java @@ -35,8 +35,7 @@ import com.l2jserver.gameserver.util.Util; * The Food Chain (280) * @author xban1x */ -public final class Q00280_TheFoodChain extends Quest -{ +public final class Q00280_TheFoodChain extends Quest { // Npc private static final int BIXON = 32175; // Items @@ -45,8 +44,7 @@ public final class Q00280_TheFoodChain extends Quest // Monsters private static final Map<Integer, Integer> MONSTER_ITEM = new HashMap<>(); private static final Map<Integer, List<ItemHolder>> MONSTER_CHANCE = new HashMap<>(); - static - { + static { MONSTER_ITEM.put(22229, GREY_KELTIR_TOOTH); MONSTER_ITEM.put(22230, GREY_KELTIR_TOOTH); MONSTER_ITEM.put(22231, GREY_KELTIR_TOOTH); @@ -59,8 +57,7 @@ public final class Q00280_TheFoodChain extends Quest MONSTER_CHANCE.put(22233, Arrays.asList(new ItemHolder(500, 3), new ItemHolder(1000, 4))); } // Rewards - private static final int[] REWARDS = new int[] - { + private static final int[] REWARDS = new int[] { 28, 35, 41, @@ -71,8 +68,7 @@ public final class Q00280_TheFoodChain extends Quest private static final int MIN_LVL = 3; private static final int TEETH_COUNT = 25; - public Q00280_TheFoodChain() - { + public Q00280_TheFoodChain() { super(280, Q00280_TheFoodChain.class.getSimpleName(), "The Food Chain"); addStartNpc(BIXON); addTalkId(BIXON); @@ -81,69 +77,52 @@ public final class Q00280_TheFoodChain extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { - case "32175-03.htm": - { + switch (event) { + case "32175-03.htm": { st.startQuest(); htmltext = event; break; } - case "32175-06.html": - { - if (hasAtLeastOneQuestItem(player, getRegisteredItemIds())) - { + case "32175-06.html": { + if (hasAtLeastOneQuestItem(player, getRegisteredItemIds())) { final long greyTeeth = st.getQuestItemsCount(GREY_KELTIR_TOOTH); final long blackTeeth = st.getQuestItemsCount(BLACK_WOLF_TOOTH); st.giveAdena(2 * (greyTeeth + blackTeeth), true); takeItems(player, -1, GREY_KELTIR_TOOTH, BLACK_WOLF_TOOTH); htmltext = event; - } - else - { + } else { htmltext = "32175-07.html"; } } - case "32175-08.html": - { + case "32175-08.html": { htmltext = event; break; } - case "32175-09.html": - { + case "32175-09.html": { st.exitQuest(true, true); htmltext = event; break; } - case "32175-11.html": - { + case "32175-11.html": { final long greyTeeth = st.getQuestItemsCount(GREY_KELTIR_TOOTH); final long blackTeeth = st.getQuestItemsCount(BLACK_WOLF_TOOTH); - if ((greyTeeth + blackTeeth) >= TEETH_COUNT) - { - if (greyTeeth >= TEETH_COUNT) - { + if ((greyTeeth + blackTeeth) >= TEETH_COUNT) { + if (greyTeeth >= TEETH_COUNT) { st.takeItems(GREY_KELTIR_TOOTH, TEETH_COUNT); - } - else - { + } else { st.takeItems(GREY_KELTIR_TOOTH, greyTeeth); st.takeItems(BLACK_WOLF_TOOTH, TEETH_COUNT - greyTeeth); } st.rewardItems(REWARDS[getRandom(5)], 1); htmltext = event; - } - else - { + } else { htmltext = "32175-10.html"; } break; @@ -153,16 +132,12 @@ public final class Q00280_TheFoodChain extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && Util.checkIfInRange(1500, npc, killer, true)) - { + if ((st != null) && Util.checkIfInRange(1500, npc, killer, true)) { final int chance = getRandom(1000); - for (ItemHolder dropChance : MONSTER_CHANCE.get(npc.getId())) - { - if (chance < dropChance.getId()) - { + for (ItemHolder dropChance : MONSTER_CHANCE.get(npc.getId())) { + if (chance < dropChance.getId()) { st.giveItemRandomly(MONSTER_ITEM.get(npc.getId()), dropChance.getCount(), 0, 1, true); break; } @@ -172,25 +147,18 @@ public final class Q00280_TheFoodChain extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState st = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (talker.getLevel() >= MIN_LVL) ? "32175-01.htm" : "32175-02.htm"; break; } - case State.STARTED: - { - if (hasAtLeastOneQuestItem(talker, getRegisteredItemIds())) - { + case State.STARTED: { + if (hasAtLeastOneQuestItem(talker, getRegisteredItemIds())) { htmltext = "32175-05.html"; - } - else - { + } else { htmltext = "32175-04.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00281_HeadForTheHills/Q00281_HeadForTheHills.java b/src/main/java/com/l2jserver/datapack/quests/Q00281_HeadForTheHills/Q00281_HeadForTheHills.java index ced1f281d0..e31c080985 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00281_HeadForTheHills/Q00281_HeadForTheHills.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00281_HeadForTheHills/Q00281_HeadForTheHills.java @@ -37,8 +37,7 @@ import com.l2jserver.gameserver.network.serverpackets.ExShowScreenMessage; * Head for the Hills! (281) * @author xban1x */ -public final class Q00281_HeadForTheHills extends Quest -{ +public final class Q00281_HeadForTheHills extends Quest { // Item private static final int CLAWS = 9796; // NPC @@ -50,8 +49,7 @@ public final class Q00281_HeadForTheHills extends Quest // Monsters private static final Map<Integer, Integer> MONSTERS = new HashMap<>(); // Rewards - private static final int[] REWARDS = new int[] - { + private static final int[] REWARDS = new int[] { 115, // Earring of Wisdom 876, // Ring of Anguish 907, // Necklace of Anguish @@ -66,8 +64,7 @@ public final class Q00281_HeadForTheHills extends Quest private static final ItemHolder SOULSHOTS_NO_GRADE_FOR_ROOKIES = new ItemHolder(5789, 6000); private static final ItemHolder SPIRITSHOTS_NO_GRADE_FOR_ROOKIES = new ItemHolder(5790, 3000); - static - { + static { MONSTERS.put(22234, 390); // Green Goblin MONSTERS.put(22235, 450); // Mountain Werewolf MONSTERS.put(22236, 650); // Muertos Archer @@ -76,8 +73,7 @@ public final class Q00281_HeadForTheHills extends Quest MONSTERS.put(22239, 990); // Muertos Guard } - public Q00281_HeadForTheHills() - { + public Q00281_HeadForTheHills() { super(281, Q00281_HeadForTheHills.class.getSimpleName(), "Head for the Hills!"); addStartNpc(MERCELA); addTalkId(MERCELA); @@ -86,68 +82,51 @@ public final class Q00281_HeadForTheHills extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { - case "32173-03.htm": - { + switch (event) { + case "32173-03.htm": { st.startQuest(); htmltext = event; break; } - case "32173-06.html": - { - if (st.hasQuestItems(CLAWS)) - { + case "32173-06.html": { + if (st.hasQuestItems(CLAWS)) { final long claws = st.getQuestItemsCount(CLAWS); st.giveAdena(((claws * 23) + (claws >= 10 ? 400 : 0)), true); st.takeItems(CLAWS, -1); giveNewbieReward(player); htmltext = event; - } - else - { + } else { htmltext = "32173-07.html"; } break; } - case "32173-08.html": - { + case "32173-08.html": { htmltext = event; break; } - case "32173-09.html": - { + case "32173-09.html": { st.exitQuest(true, true); htmltext = event; break; } - case "32173-11.html": - { - if (st.getQuestItemsCount(CLAWS) >= 50) - { - if (getRandom(1000) <= 360) - { + case "32173-11.html": { + if (st.getQuestItemsCount(CLAWS) >= 50) { + if (getRandom(1000) <= 360) { st.giveItems(REWARDS[getRandom(9)], 1); - } - else - { + } else { st.giveItems(REWARDS[9], 1); } st.takeItems(CLAWS, 50); giveNewbieReward(player); htmltext = event; - } - else - { + } else { htmltext = "32173-10.html"; } break; @@ -157,11 +136,9 @@ public final class Q00281_HeadForTheHills extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && (getRandom(1000) <= MONSTERS.get(npc.getId()))) - { + if ((st != null) && (getRandom(1000) <= MONSTERS.get(npc.getId()))) { st.giveItems(CLAWS, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -169,19 +146,15 @@ public final class Q00281_HeadForTheHills extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getLevel() >= MIN_LVL) ? "32173-01.htm" : "32173-02.htm"; break; } - case State.STARTED: - { + case State.STARTED: { htmltext = st.hasQuestItems(CLAWS) ? "32173-05.html" : "32173-04.html"; break; } @@ -193,30 +166,22 @@ public final class Q00281_HeadForTheHills extends Quest * Give basic newbie reward. * @param player the player to reward */ - public static final void giveNewbieReward(L2PcInstance player) - { + public static final void giveNewbieReward(L2PcInstance player) { final PlayerVariables vars = player.getVariables(); - if ((player.getLevel() < 25) && !vars.getBoolean("NEWBIE_SHOTS", false)) - { - if (player.isMageClass()) - { + if ((player.getLevel() < 25) && !vars.getBoolean("NEWBIE_SHOTS", false)) { + if (player.isMageClass()) { giveItems(player, SPIRITSHOTS_NO_GRADE_FOR_ROOKIES); playSound(player, Voice.TUTORIAL_VOICE_027_1000); - } - else - { + } else { giveItems(player, SOULSHOTS_NO_GRADE_FOR_ROOKIES); playSound(player, Voice.TUTORIAL_VOICE_026_1000); } vars.set("NEWBIE_SHOTS", true); } - if (vars.getString("GUIDE_MISSION", null) == null) - { + if (vars.getString("GUIDE_MISSION", null) == null) { vars.set("GUIDE_MISSION", 1000); player.sendPacket(MESSAGE); - } - else if (((vars.getInt("GUIDE_MISSION") % 10000) / 1000) != 1) - { + } else if (((vars.getInt("GUIDE_MISSION") % 10000) / 1000) != 1) { vars.set("GUIDE_MISSION", vars.getInt("GUIDE_MISSION") + 1000); player.sendPacket(MESSAGE); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00283_TheFewTheProudTheBrave/Q00283_TheFewTheProudTheBrave.java b/src/main/java/com/l2jserver/datapack/quests/Q00283_TheFewTheProudTheBrave/Q00283_TheFewTheProudTheBrave.java index d5c5de9870..a22f63166c 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00283_TheFewTheProudTheBrave/Q00283_TheFewTheProudTheBrave.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00283_TheFewTheProudTheBrave/Q00283_TheFewTheProudTheBrave.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * The Few, The Proud, The Brave (283) * @author xban1x */ -public final class Q00283_TheFewTheProudTheBrave extends Quest -{ +public final class Q00283_TheFewTheProudTheBrave extends Quest { // NPC private static final int PERWAN = 32133; // Item @@ -42,8 +41,7 @@ public final class Q00283_TheFewTheProudTheBrave extends Quest private static final int BONUS = 2187; private static final int MIN_LVL = 15; - public Q00283_TheFewTheProudTheBrave() - { + public Q00283_TheFewTheProudTheBrave() { super(283, Q00283_TheFewTheProudTheBrave.class.getSimpleName(), "The Few, The Proud, The Brave"); addKillId(CRIMSON_SPIDER); addStartNpc(PERWAN); @@ -52,46 +50,36 @@ public final class Q00283_TheFewTheProudTheBrave extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { - case "32133-03.htm": - { + switch (event) { + case "32133-03.htm": { st.startQuest(); htmltext = event; break; } - case "32133-06.html": - { + case "32133-06.html": { htmltext = event; break; } - case "32133-08.html": - { - if (st.hasQuestItems(CRIMSON_SPIDER_CLAW)) - { + case "32133-08.html": { + if (st.hasQuestItems(CRIMSON_SPIDER_CLAW)) { final long claws = st.getQuestItemsCount(CRIMSON_SPIDER_CLAW); st.giveAdena((claws * CLAW_PRICE) + ((claws >= 10) ? BONUS : 0), true); st.takeItems(CRIMSON_SPIDER_CLAW, -1); Q00261_CollectorsDream.giveNewbieReward(player); htmltext = event; - } - else - { + } else { htmltext = "32133-07.html"; } break; } - case "32133-09.html": - { + case "32133-09.html": { st.exitQuest(true, true); htmltext = event; break; @@ -101,30 +89,24 @@ public final class Q00283_TheFewTheProudTheBrave extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getRandomPartyMemberState(killer, -1, 3, npc); - if (st != null) - { + if (st != null) { st.giveItemRandomly(npc, CRIMSON_SPIDER_CLAW, 1, 0, 0.6, true); } return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState st = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (talker.getLevel() >= MIN_LVL) ? "32133-01.htm" : "32133-02.htm"; break; } - case State.STARTED: - { + case State.STARTED: { htmltext = st.hasQuestItems(CRIMSON_SPIDER_CLAW) ? "32133-04.html" : "32133-05.html"; break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00284_MuertosFeather/Q00284_MuertosFeather.java b/src/main/java/com/l2jserver/datapack/quests/Q00284_MuertosFeather/Q00284_MuertosFeather.java index 6fd44759e7..381bd4aef7 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00284_MuertosFeather/Q00284_MuertosFeather.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00284_MuertosFeather/Q00284_MuertosFeather.java @@ -30,16 +30,14 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Muertos Feather (284). * @author xban1x */ -public final class Q00284_MuertosFeather extends Quest -{ +public final class Q00284_MuertosFeather extends Quest { // NPC private static final int TREVOR = 32166; // Item private static final int MUERTOS_FEATHER = 9748; // Monsters private static final Map<Integer, Double> MOB_DROP_CHANCE = new HashMap<>(); - static - { + static { MOB_DROP_CHANCE.put(22239, 0.500); // Muertos Guard MOB_DROP_CHANCE.put(22240, 0.533); // Muertos Scout MOB_DROP_CHANCE.put(22242, 0.566); // Muertos Warrior @@ -50,8 +48,7 @@ public final class Q00284_MuertosFeather extends Quest // Misc private static final int MIN_LVL = 11; - public Q00284_MuertosFeather() - { + public Q00284_MuertosFeather() { super(284, Q00284_MuertosFeather.class.getSimpleName(), "Muertos Feather"); addStartNpc(TREVOR); addTalkId(TREVOR); @@ -60,43 +57,33 @@ public final class Q00284_MuertosFeather extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String html = null; - if (qs == null) - { + if (qs == null) { return html; } - switch (event) - { - case "32166-03.htm": - { + switch (event) { + case "32166-03.htm": { qs.startQuest(); html = event; break; } - case "32166-06.html": - { + case "32166-06.html": { html = event; break; } - case "32166-08.html": - { - if (hasQuestItems(player, MUERTOS_FEATHER)) - { + case "32166-08.html": { + if (hasQuestItems(player, MUERTOS_FEATHER)) { giveAdena(player, getQuestItemsCount(player, MUERTOS_FEATHER) * 45, true); takeItems(player, MUERTOS_FEATHER, -1); html = event; - } - else - { + } else { html = "32166-07.html"; } break; } - case "32166-09.html": - { + case "32166-09.html": { qs.exitQuest(true, true); html = event; break; @@ -106,27 +93,21 @@ public final class Q00284_MuertosFeather extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc); - if (qs != null) - { + if (qs != null) { giveItemRandomly(qs.getPlayer(), npc, MUERTOS_FEATHER, 1, 0, MOB_DROP_CHANCE.get(npc.getId()), true); } return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String html = getNoQuestMsg(player); - if (qs.isCreated()) - { + if (qs.isCreated()) { html = ((player.getLevel() >= MIN_LVL) ? "32166-01.htm" : "32166-02.htm"); - } - else if (qs.isStarted()) - { + } else if (qs.isStarted()) { html = (hasQuestItems(player, MUERTOS_FEATHER) ? "32166-05.html" : "32166-04.html"); } return html; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00286_FabulousFeathers/Q00286_FabulousFeathers.java b/src/main/java/com/l2jserver/datapack/quests/Q00286_FabulousFeathers/Q00286_FabulousFeathers.java index fb96eaba1d..8f99d4a0df 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00286_FabulousFeathers/Q00286_FabulousFeathers.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00286_FabulousFeathers/Q00286_FabulousFeathers.java @@ -31,16 +31,14 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Fabulous Feathers (286). * @author xban1x */ -public final class Q00286_FabulousFeathers extends Quest -{ +public final class Q00286_FabulousFeathers extends Quest { // NPC private static final int ERINU = 32164; // Item private static final ItemHolder COMMANDERS_FEATHER = new ItemHolder(9746, 80); // Monsters private static final Map<Integer, Double> MOB_DROP_CHANCES = new HashMap<>(); - static - { + static { MOB_DROP_CHANCES.put(22251, 0.748); // Shady Muertos Captain MOB_DROP_CHANCES.put(22253, 0.772); // Shady Muertos Warrior MOB_DROP_CHANCES.put(22254, 0.772); // Shady Muertos Archer @@ -50,8 +48,7 @@ public final class Q00286_FabulousFeathers extends Quest // Misc private static final int MIN_LVL = 17; - public Q00286_FabulousFeathers() - { + public Q00286_FabulousFeathers() { super(286, Q00286_FabulousFeathers.class.getSimpleName(), "Fabulous Feathers"); addStartNpc(ERINU); addTalkId(ERINU); @@ -60,33 +57,25 @@ public final class Q00286_FabulousFeathers extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String html = null; - if (qs == null) - { + if (qs == null) { return html; } - switch (event) - { - case "32164-03.htm": - { + switch (event) { + case "32164-03.htm": { qs.startQuest(); html = event; break; } - case "32164-06.html": - { - if (qs.isCond(2) && hasItem(player, COMMANDERS_FEATHER)) - { + case "32164-06.html": { + if (qs.isCond(2) && hasItem(player, COMMANDERS_FEATHER)) { takeItem(player, COMMANDERS_FEATHER); giveAdena(player, 4160, true); qs.exitQuest(true, true); html = event; - } - else - { + } else { html = "32164-07.html"; } break; @@ -96,13 +85,10 @@ public final class Q00286_FabulousFeathers extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc); - if (qs != null) - { - if (giveItemRandomly(qs.getPlayer(), npc, COMMANDERS_FEATHER.getId(), 1, COMMANDERS_FEATHER.getCount(), MOB_DROP_CHANCES.get(npc.getId()), true)) - { + if (qs != null) { + if (giveItemRandomly(qs.getPlayer(), npc, COMMANDERS_FEATHER.getId(), 1, COMMANDERS_FEATHER.getCount(), MOB_DROP_CHANCES.get(npc.getId()), true)) { qs.setCond(2); } } @@ -110,16 +96,12 @@ public final class Q00286_FabulousFeathers extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String html = getNoQuestMsg(player); - if (qs.isCreated()) - { + if (qs.isCreated()) { html = ((player.getLevel() >= MIN_LVL) ? "32164-01.htm" : "32164-02.htm"); - } - else if (qs.isStarted()) - { + } else if (qs.isStarted()) { html = ((qs.isCond(2) && hasItem(player, COMMANDERS_FEATHER)) ? "32164-04.html" : "32164-05.html"); } return html; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00287_FiguringItOut/Q00287_FiguringItOut.java b/src/main/java/com/l2jserver/datapack/quests/Q00287_FiguringItOut/Q00287_FiguringItOut.java index 822db3ccd3..642fe443ab 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00287_FiguringItOut/Q00287_FiguringItOut.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00287_FiguringItOut/Q00287_FiguringItOut.java @@ -34,14 +34,12 @@ import com.l2jserver.gameserver.model.quest.State; * Figuring It Out! (287) * @author malyelfik */ -public class Q00287_FiguringItOut extends Quest -{ +public class Q00287_FiguringItOut extends Quest { // NPCs private static final int LAKI = 32742; private static final Map<Integer, Integer> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(22768, 509); // Tanta Lizardman Scout MONSTERS.put(22769, 689); // Tanta Lizardman Warrior MONSTERS.put(22770, 123); // Tanta Lizardman Soldier @@ -54,8 +52,7 @@ public class Q00287_FiguringItOut extends Quest // Items private static final int VIAL_OF_TANTA_BLOOD = 15499; // Rewards - private static final ItemHolder[] MOIRAI = - { + private static final ItemHolder[] MOIRAI = { new ItemHolder(15776, 1), new ItemHolder(15779, 1), new ItemHolder(15782, 1), @@ -74,8 +71,7 @@ public class Q00287_FiguringItOut extends Quest new ItemHolder(15774, 1) }; - private static final ItemHolder[] ICARUS = - { + private static final ItemHolder[] ICARUS = { new ItemHolder(10381, 1), new ItemHolder(10405, 1), new ItemHolder(10405, 4), @@ -86,8 +82,7 @@ public class Q00287_FiguringItOut extends Quest // Misc private static final int MIN_LEVEL = 82; - public Q00287_FiguringItOut() - { + public Q00287_FiguringItOut() { super(287, Q00287_FiguringItOut.class.getSimpleName(), "Figuring It Out!"); addStartNpc(LAKI); addTalkId(LAKI); @@ -96,52 +91,42 @@ public class Q00287_FiguringItOut extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "32742-03.htm": st.startQuest(); break; case "Icarus": - if (st.getQuestItemsCount(VIAL_OF_TANTA_BLOOD) >= 500) - { + if (st.getQuestItemsCount(VIAL_OF_TANTA_BLOOD) >= 500) { final ItemHolder holder = ICARUS[getRandom(ICARUS.length)]; st.giveItems(holder); st.takeItems(VIAL_OF_TANTA_BLOOD, 500); st.playSound(Sound.ITEMSOUND_QUEST_FINISH); htmltext = "32742-06.html"; - } - else - { + } else { htmltext = "32742-07.html"; } break; case "Moirai": - if (st.getQuestItemsCount(VIAL_OF_TANTA_BLOOD) >= 100) - { + if (st.getQuestItemsCount(VIAL_OF_TANTA_BLOOD) >= 100) { final ItemHolder holder = MOIRAI[getRandom(MOIRAI.length)]; st.giveItems(holder); st.takeItems(VIAL_OF_TANTA_BLOOD, 100); st.playSound(Sound.ITEMSOUND_QUEST_FINISH); htmltext = "32742-08.html"; - } - else - { + } else { htmltext = "32742-09.html"; } break; case "32742-11.html": - if (!st.hasQuestItems(VIAL_OF_TANTA_BLOOD)) - { + if (!st.hasQuestItems(VIAL_OF_TANTA_BLOOD)) { st.exitQuest(true, true); htmltext = "32742-12.html"; } @@ -160,17 +145,14 @@ public class Q00287_FiguringItOut extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(player, 1); - if (partyMember == null) - { + if (partyMember == null) { return super.onKill(npc, player, isSummon); } final QuestState st = getQuestState(partyMember, false); - if (getRandom(1000) < MONSTERS.get(npc.getId())) - { + if (getRandom(1000) < MONSTERS.get(npc.getId())) { st.giveItems(VIAL_OF_TANTA_BLOOD, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -178,12 +160,10 @@ public class Q00287_FiguringItOut extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = ((player.getLevel() >= MIN_LEVEL) && player.hasQuestCompleted(Q00250_WatchWhatYouEat.class.getSimpleName())) ? "32742-01.htm" : "32742-14.htm"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00288_HandleWithCare/Q00288_HandleWithCare.java b/src/main/java/com/l2jserver/datapack/quests/Q00288_HandleWithCare/Q00288_HandleWithCare.java index 5cff1f2c16..b0fef807c0 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00288_HandleWithCare/Q00288_HandleWithCare.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00288_HandleWithCare/Q00288_HandleWithCare.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Handle With Care (288) * @author Zoey76 */ -public class Q00288_HandleWithCare extends Quest -{ +public class Q00288_HandleWithCare extends Quest { // NPC private static final int ANKUMI = 32741; // Monster @@ -43,8 +42,7 @@ public class Q00288_HandleWithCare extends Quest private static final int SCROLL_ENCHANT_WEAPON_S_GRADE = 959; private static final int SCROLL_ENCHANT_ARMOR_S_GRADE = 960; private static final int HOLY_CRYSTAL = 9557; - private static final ItemHolder[] REWARDS = - { + private static final ItemHolder[] REWARDS = { new ItemHolder(SCROLL_ENCHANT_WEAPON_S_GRADE, 1), new ItemHolder(SCROLL_ENCHANT_ARMOR_S_GRADE, 1), new ItemHolder(SCROLL_ENCHANT_ARMOR_S_GRADE, 2), @@ -55,8 +53,7 @@ public class Q00288_HandleWithCare extends Quest // Misc private static final int MIN_LEVEL = 82; - public Q00288_HandleWithCare() - { + public Q00288_HandleWithCare() { super(288, Q00288_HandleWithCare.class.getSimpleName(), "Handle With Care"); addStartNpc(ANKUMI); addTalkId(ANKUMI); @@ -65,92 +62,61 @@ public class Q00288_HandleWithCare extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "32741-03.htm": - { - if (player.getLevel() >= MIN_LEVEL) - { + switch (event) { + case "32741-03.htm": { + if (player.getLevel() >= MIN_LEVEL) { htmltext = event; } break; } - case "32741-04.html": - { - if (player.getLevel() >= MIN_LEVEL) - { + case "32741-04.html": { + if (player.getLevel() >= MIN_LEVEL) { st.startQuest(); htmltext = event; } break; } - case "32741-08.html": - { - if (st.isCond(2) || st.isCond(3)) - { + case "32741-08.html": { + if (st.isCond(2) || st.isCond(3)) { ItemHolder reward = null; - if (st.hasQuestItems(MIDDLE_GRADE_LIZARD_SCALE)) - { + if (st.hasQuestItems(MIDDLE_GRADE_LIZARD_SCALE)) { st.takeItems(MIDDLE_GRADE_LIZARD_SCALE, 1); final int rnd = getRandom(10); - if (rnd == 0) - { + if (rnd == 0) { reward = REWARDS[0]; - } - else if (rnd < 4) - { + } else if (rnd < 4) { reward = REWARDS[1]; - } - else if (rnd < 6) - { + } else if (rnd < 6) { reward = REWARDS[2]; - } - else if (rnd < 7) - { + } else if (rnd < 7) { reward = REWARDS[3]; - } - else if (rnd < 9) - { + } else if (rnd < 9) { reward = REWARDS[4]; - } - else - { + } else { reward = REWARDS[5]; } - } - else if (st.hasQuestItems(HIGH_GRADE_LIZARD_SCALE)) - { + } else if (st.hasQuestItems(HIGH_GRADE_LIZARD_SCALE)) { st.takeItems(HIGH_GRADE_LIZARD_SCALE, 1); final int rnd = getRandom(10); - if (rnd == 0) - { + if (rnd == 0) { reward = REWARDS[0]; - } - else if (rnd < 5) - { + } else if (rnd < 5) { reward = REWARDS[1]; - } - else if (rnd < 8) - { + } else if (rnd < 8) { reward = REWARDS[2]; - } - else - { + } else { reward = REWARDS[3]; } st.giveItems(REWARDS[4]); } - if (reward != null) - { + if (reward != null) { st.giveItems(reward); } st.exitQuest(true, true); @@ -163,19 +129,14 @@ public class Q00288_HandleWithCare extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, killer, false)) - { - if (!st.hasQuestItems(MIDDLE_GRADE_LIZARD_SCALE)) - { + if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, killer, false)) { + if (!st.hasQuestItems(MIDDLE_GRADE_LIZARD_SCALE)) { st.giveItems(MIDDLE_GRADE_LIZARD_SCALE, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); st.setCond(2, true); - } - else if (!st.hasQuestItems(HIGH_GRADE_LIZARD_SCALE)) - { + } else if (!st.hasQuestItems(HIGH_GRADE_LIZARD_SCALE)) { st.giveItems(HIGH_GRADE_LIZARD_SCALE, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); st.setCond(3, true); @@ -185,27 +146,21 @@ public class Q00288_HandleWithCare extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() < MIN_LEVEL) ? "32741-01.html" : "32741-02.htm"; break; case State.STARTED: - if (st.isCond(1) && !st.hasQuestItems(HIGH_GRADE_LIZARD_SCALE) && !st.hasQuestItems(MIDDLE_GRADE_LIZARD_SCALE)) - { + if (st.isCond(1) && !st.hasQuestItems(HIGH_GRADE_LIZARD_SCALE) && !st.hasQuestItems(MIDDLE_GRADE_LIZARD_SCALE)) { htmltext = "32741-05.html"; - } - else if (st.isCond(2) && st.hasQuestItems(MIDDLE_GRADE_LIZARD_SCALE)) - { + } else if (st.isCond(2) && st.hasQuestItems(MIDDLE_GRADE_LIZARD_SCALE)) { htmltext = "32741-06.html"; } - if (st.isCond(2) && st.hasQuestItems(HIGH_GRADE_LIZARD_SCALE)) - { + if (st.isCond(2) && st.hasQuestItems(HIGH_GRADE_LIZARD_SCALE)) { htmltext = "32741-07.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00289_NoMoreSoupForYou/Q00289_NoMoreSoupForYou.java b/src/main/java/com/l2jserver/datapack/quests/Q00289_NoMoreSoupForYou/Q00289_NoMoreSoupForYou.java index 9a7d9fcead..928dcfbc2c 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00289_NoMoreSoupForYou/Q00289_NoMoreSoupForYou.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00289_NoMoreSoupForYou/Q00289_NoMoreSoupForYou.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * No More Soup For You (289) * @author kostantinos */ -public class Q00289_NoMoreSoupForYou extends Quest -{ +public class Q00289_NoMoreSoupForYou extends Quest { // NPC public static final int STAN = 30200; // Item @@ -40,8 +39,7 @@ public class Q00289_NoMoreSoupForYou extends Quest // Misc public static final int RATE = 5; - private static final int[] MOBS = - { + private static final int[] MOBS = { 18908, 22779, 22786, @@ -49,8 +47,7 @@ public class Q00289_NoMoreSoupForYou extends Quest 22788 }; - private static final int[][] WEAPONS = - { + private static final int[][] WEAPONS = { { 10377, 1 @@ -81,8 +78,7 @@ public class Q00289_NoMoreSoupForYou extends Quest } }; - private static final int[][] ARMORS = - { + private static final int[][] ARMORS = { { 15812, 1 @@ -157,8 +153,7 @@ public class Q00289_NoMoreSoupForYou extends Quest } }; - public Q00289_NoMoreSoupForYou() - { + public Q00289_NoMoreSoupForYou() { super(289, Q00289_NoMoreSoupForYou.class.getSimpleName(), "No More Soup For You"); addStartNpc(STAN); addTalkId(STAN); @@ -166,48 +161,34 @@ public class Q00289_NoMoreSoupForYou extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return htmltext; } int b = getRandom(18); int c = getRandom(7); - if (npc.getId() == STAN) - { - if (event.equalsIgnoreCase("30200-03.htm")) - { + if (npc.getId() == STAN) { + if (event.equalsIgnoreCase("30200-03.htm")) { st.startQuest(); - } - else if (event.equalsIgnoreCase("30200-05.htm")) - { - if (st.getQuestItemsCount(SOUP) >= 500) - { + } else if (event.equalsIgnoreCase("30200-05.htm")) { + if (st.getQuestItemsCount(SOUP) >= 500) { st.giveItems(WEAPONS[c][0], WEAPONS[c][1]); st.takeItems(SOUP, 500); st.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); htmltext = "30200-04.htm"; - } - else - { + } else { htmltext = "30200-07.htm"; } - } - else if (event.equalsIgnoreCase("30200-06.htm")) - { - if (st.getQuestItemsCount(SOUP) >= 100) - { + } else if (event.equalsIgnoreCase("30200-06.htm")) { + if (st.getQuestItemsCount(SOUP) >= 100) { st.giveItems(ARMORS[b][0], ARMORS[b][1]); st.takeItems(SOUP, 100); st.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); htmltext = "30200-04.htm"; - } - else - { + } else { htmltext = "30200-07.htm"; } } @@ -216,16 +197,13 @@ public class Q00289_NoMoreSoupForYou extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { QuestState st = getQuestState(player, false); int npcId = npc.getId(); - if ((st == null) || (st.getState() != State.STARTED)) - { + if ((st == null) || (st.getState() != State.STARTED)) { return null; } - if (Util.contains(MOBS, npcId)) - { + if (Util.contains(MOBS, npcId)) { st.giveItems(SOUP, 1 * RATE); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -233,20 +211,16 @@ public class Q00289_NoMoreSoupForYou extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - if (npc.getId() == STAN) - { - switch (st.getState()) - { + if (npc.getId() == STAN) { + switch (st.getState()) { case State.CREATED: htmltext = (player.hasQuestCompleted(Q00252_ItSmellsDelicious.class.getSimpleName()) && (player.getLevel() >= 82)) ? "30200-01.htm" : "30200-00.htm"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = (st.getQuestItemsCount(SOUP) >= 100) ? "30200-04.htm" : "30200-03.htm"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00290_ThreatRemoval/Q00290_ThreatRemoval.java b/src/main/java/com/l2jserver/datapack/quests/Q00290_ThreatRemoval/Q00290_ThreatRemoval.java index 2bf6d53c6d..c4021c1a1b 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00290_ThreatRemoval/Q00290_ThreatRemoval.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00290_ThreatRemoval/Q00290_ThreatRemoval.java @@ -35,8 +35,7 @@ import com.l2jserver.gameserver.model.quest.State; * Threat Removal (290) * @author Adry_85 */ -public class Q00290_ThreatRemoval extends Quest -{ +public class Q00290_ThreatRemoval extends Quest { // NPC private static final int PINAPS = 30201; // Items @@ -49,8 +48,7 @@ public class Q00290_ThreatRemoval extends Quest private static final Map<Integer, Integer> MOBS_TAG = new HashMap<>(); - static - { + static { MOBS_TAG.put(22775, 932); // Sel Mahum Drill Sergeant MOBS_TAG.put(22776, 397); // Sel Mahum Training Officer MOBS_TAG.put(22777, 932); // Sel Mahum Drill Sergeant @@ -63,8 +61,7 @@ public class Q00290_ThreatRemoval extends Quest MOBS_TAG.put(22785, 169); // Sel Mahum Soldier } - public Q00290_ThreatRemoval() - { + public Q00290_ThreatRemoval() { super(290, Q00290_ThreatRemoval.class.getSimpleName(), "Threat Removal"); addStartNpc(PINAPS); addTalkId(PINAPS); @@ -73,62 +70,49 @@ public class Q00290_ThreatRemoval extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "30201-02.html": - { + switch (event) { + case "30201-02.html": { st.startQuest(); htmltext = event; break; } - case "30201-06.html": - { - if (st.isCond(1)) - { + case "30201-06.html": { + if (st.isCond(1)) { st.takeItems(SEL_MAHUM_ID_TAG, 400); - switch (getRandom(10)) - { - case 0: - { + switch (getRandom(10)) { + case 0: { st.rewardItems(ENCHANT_WEAPON_S, 1); break; } case 1: case 2: - case 3: - { + case 3: { st.rewardItems(ENCHANT_ARMOR_S, 1); break; } case 4: - case 5: - { + case 5: { st.rewardItems(ENCHANT_ARMOR_S, 2); break; } - case 6: - { + case 6: { st.rewardItems(ENCHANT_ARMOR_S, 3); break; } case 7: - case 8: - { + case 8: { st.rewardItems(FIRE_CRYSTAL, 1); break; } case 9: - case 10: - { + case 10: { st.rewardItems(FIRE_CRYSTAL, 2); break; } @@ -137,34 +121,25 @@ public class Q00290_ThreatRemoval extends Quest } break; } - case "30201-07.html": - { - if (st.isCond(1)) - { + case "30201-07.html": { + if (st.isCond(1)) { htmltext = event; } break; } - case "exit": - { - if (st.isCond(1)) - { - if (st.hasQuestItems(SEL_MAHUM_ID_TAG)) - { + case "exit": { + if (st.isCond(1)) { + if (st.hasQuestItems(SEL_MAHUM_ID_TAG)) { htmltext = "30201-08.html"; - } - else - { + } else { st.exitQuest(true, true); htmltext = "30201-09.html"; } } break; } - case "30201-10.html": - { - if (st.isCond(1)) - { + case "30201-10.html": { + if (st.isCond(1)) { st.exitQuest(true, true); htmltext = event; } @@ -175,19 +150,16 @@ public class Q00290_ThreatRemoval extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(player, 1); - if (partyMember == null) - { + if (partyMember == null) { return super.onKill(npc, player, isSummon); } final QuestState st = getQuestState(partyMember, false); int npcId = npc.getId(); double chance = MOBS_TAG.get(npcId) * rates().getRateQuestDrop(); - if (getRandom(1000) < chance) - { + if (getRandom(1000) < chance) { st.rewardItems(SEL_MAHUM_ID_TAG, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -195,21 +167,16 @@ public class Q00290_ThreatRemoval extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = ((player.getLevel() >= MIN_LEVEL) && player.hasQuestCompleted(Q00251_NoSecrets.class.getSimpleName())) ? "30201-01.htm" : "30201-03.html"; break; } - case State.STARTED: - { - if (st.isCond(1)) - { + case State.STARTED: { + if (st.isCond(1)) { htmltext = (st.getQuestItemsCount(SEL_MAHUM_ID_TAG) < 400) ? "30201-04.html" : "30201-05.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00291_RevengeOfTheRedbonnet/Q00291_RevengeOfTheRedbonnet.java b/src/main/java/com/l2jserver/datapack/quests/Q00291_RevengeOfTheRedbonnet/Q00291_RevengeOfTheRedbonnet.java index 60f144f920..7f4ee38cae 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00291_RevengeOfTheRedbonnet/Q00291_RevengeOfTheRedbonnet.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00291_RevengeOfTheRedbonnet/Q00291_RevengeOfTheRedbonnet.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.util.Util; * Revenge of the Redbonnet (291). * @author xban1x */ -public final class Q00291_RevengeOfTheRedbonnet extends Quest -{ +public final class Q00291_RevengeOfTheRedbonnet extends Quest { // NPC private static final int MARYSE_REDBONNET = 30553; // Item @@ -46,8 +45,7 @@ public final class Q00291_RevengeOfTheRedbonnet extends Quest // Misc private static final int MIN_LVL = 4; - public Q00291_RevengeOfTheRedbonnet() - { + public Q00291_RevengeOfTheRedbonnet() { super(291, Q00291_RevengeOfTheRedbonnet.class.getSimpleName(), "Revenge of the Redbonnet"); addStartNpc(MARYSE_REDBONNET); addTalkId(MARYSE_REDBONNET); @@ -56,11 +54,9 @@ public final class Q00291_RevengeOfTheRedbonnet extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if ((qs != null) && event.equals("30553-03.htm")) - { + if ((qs != null) && event.equals("30553-03.htm")) { qs.startQuest(); return event; } @@ -68,13 +64,10 @@ public final class Q00291_RevengeOfTheRedbonnet extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isCond(1) && Util.checkIfInRange(1500, npc, killer, true)) - { - if (giveItemRandomly(qs.getPlayer(), npc, BLACK_WOLF_PELT.getId(), 1, BLACK_WOLF_PELT.getCount(), 1.0, true)) - { + if ((qs != null) && qs.isCond(1) && Util.checkIfInRange(1500, npc, killer, true)) { + if (giveItemRandomly(qs.getPlayer(), npc, BLACK_WOLF_PELT.getId(), 1, BLACK_WOLF_PELT.getCount(), 1.0, true)) { qs.setCond(2); } } @@ -82,42 +75,28 @@ public final class Q00291_RevengeOfTheRedbonnet extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String html = getNoQuestMsg(player); - if (qs.isCreated()) - { + if (qs.isCreated()) { html = ((player.getLevel() >= MIN_LVL) ? "30553-02.htm" : "30553-01.htm"); - } - else if (qs.isStarted()) - { - if (qs.isCond(2) && hasItem(player, BLACK_WOLF_PELT)) - { + } else if (qs.isStarted()) { + if (qs.isCond(2) && hasItem(player, BLACK_WOLF_PELT)) { takeItem(player, BLACK_WOLF_PELT); final int chance = getRandom(100); - if (chance <= 2) - { + if (chance <= 2) { giveItems(player, GRANDMAS_PEARL, 1); - } - else if (chance <= 20) - { + } else if (chance <= 20) { giveItems(player, GRANDMAS_MIRROR, 1); - } - else if (chance <= 45) - { + } else if (chance <= 45) { giveItems(player, GRANDMAS_NECKLACE, 1); - } - else - { + } else { giveItems(player, GRANDMAS_HAIRPIN, 1); giveItems(player, SCROLL_OF_ESCAPE, 1); } qs.exitQuest(true, true); html = "30553-05.html"; - } - else - { + } else { html = "30553-04.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00292_BrigandsSweep/Q00292_BrigandsSweep.java b/src/main/java/com/l2jserver/datapack/quests/Q00292_BrigandsSweep/Q00292_BrigandsSweep.java index 3dbb44e1af..11710ffe18 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00292_BrigandsSweep/Q00292_BrigandsSweep.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00292_BrigandsSweep/Q00292_BrigandsSweep.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.util.Util; * Brigands Sweep (292) * @author xban1x */ -public final class Q00292_BrigandsSweep extends Quest -{ +public final class Q00292_BrigandsSweep extends Quest { // NPC's private static final int SPIRON = 30532; private static final int BALANKI = 30533; @@ -47,8 +46,7 @@ public final class Q00292_BrigandsSweep extends Quest private static final int SUSPICIOUS_CONTRACT = 1487; // Monsters private static final Map<Integer, Integer> MOB_ITEM_DROP = new HashMap<>(); - static - { + static { MOB_ITEM_DROP.put(20322, GOBLIN_NECKLACE); // Goblin Brigand MOB_ITEM_DROP.put(20323, GOBLIN_PENDANT); // Goblin Brigand Leader MOB_ITEM_DROP.put(20324, GOBLIN_NECKLACE); // Goblin Brigand Lieutenant @@ -58,8 +56,7 @@ public final class Q00292_BrigandsSweep extends Quest // Misc private static final int MIN_LVL = 5; - public Q00292_BrigandsSweep() - { + public Q00292_BrigandsSweep() { super(292, Q00292_BrigandsSweep.class.getSimpleName(), "Brigands Sweep"); addStartNpc(SPIRON); addTalkId(SPIRON, BALANKI); @@ -68,39 +65,30 @@ public final class Q00292_BrigandsSweep extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String html = null; - if (qs == null) - { + if (qs == null) { return html; } - switch (event) - { - case "30532-03.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "30532-03.htm": { + if (qs.isCreated()) { qs.startQuest(); html = event; } break; } - case "30532-06.html": - { - if (qs.isStarted()) - { + case "30532-06.html": { + if (qs.isStarted()) { qs.exitQuest(true, true); html = event; } break; } - case "30532-07.html": - { - if (qs.isStarted()) - { + case "30532-07.html": { + if (qs.isStarted()) { html = event; } break; @@ -110,30 +98,21 @@ public final class Q00292_BrigandsSweep extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { final int chance = getRandom(10); - if (chance > 5) - { + if (chance > 5) { giveItemRandomly(killer, npc, MOB_ITEM_DROP.get(npc.getId()), 1, 0, 1.0, true); - } - else if (qs.isCond(1) && (chance > 4) && !hasQuestItems(killer, SUSPICIOUS_CONTRACT)) - { + } else if (qs.isCond(1) && (chance > 4) && !hasQuestItems(killer, SUSPICIOUS_CONTRACT)) { final long memos = getQuestItemsCount(killer, SUSPICIOUS_MEMO); - if (memos < 3) - { - if (giveItemRandomly(killer, npc, SUSPICIOUS_MEMO, 1, 3, 1.0, false)) - { + if (memos < 3) { + if (giveItemRandomly(killer, npc, SUSPICIOUS_MEMO, 1, 3, 1.0, false)) { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); giveItems(killer, SUSPICIOUS_CONTRACT, 1); takeItems(killer, SUSPICIOUS_MEMO, -1); qs.setCond(2, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -143,59 +122,40 @@ public final class Q00292_BrigandsSweep extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String html = getNoQuestMsg(talker); - switch (npc.getId()) - { - case SPIRON: - { - switch (qs.getState()) - { - case State.CREATED: - { + switch (npc.getId()) { + case SPIRON: { + switch (qs.getState()) { + case State.CREATED: { html = (talker.getRace() == Race.DWARF) ? (talker.getLevel() >= MIN_LVL) ? "30532-02.htm" : "30532-01.htm" : "30532-00.htm"; break; } - case State.STARTED: - { - if (!hasAtLeastOneQuestItem(talker, getRegisteredItemIds())) - { + case State.STARTED: { + if (!hasAtLeastOneQuestItem(talker, getRegisteredItemIds())) { html = "30532-04.html"; - } - else - { + } else { final long necklaces = getQuestItemsCount(talker, GOBLIN_NECKLACE); final long pendants = getQuestItemsCount(talker, GOBLIN_PENDANT); final long lordPendants = getQuestItemsCount(talker, GOBLIN_LORD_PENDANT); final long sum = necklaces + pendants + lordPendants; - if (sum > 0) - { + if (sum > 0) { giveAdena(talker, (necklaces * 12) + (pendants * 36) + (lordPendants * 33) + (sum >= 10 ? 1000 : 0), true); takeItems(talker, -1, GOBLIN_NECKLACE, GOBLIN_PENDANT, GOBLIN_LORD_PENDANT); } - if ((sum > 0) && !hasAtLeastOneQuestItem(talker, SUSPICIOUS_MEMO, SUSPICIOUS_CONTRACT)) - { + if ((sum > 0) && !hasAtLeastOneQuestItem(talker, SUSPICIOUS_MEMO, SUSPICIOUS_CONTRACT)) { html = "30532-05.html"; - } - else - { + } else { final long memos = getQuestItemsCount(talker, SUSPICIOUS_MEMO); - if ((memos == 0) && hasQuestItems(talker, SUSPICIOUS_CONTRACT)) - { + if ((memos == 0) && hasQuestItems(talker, SUSPICIOUS_CONTRACT)) { giveAdena(talker, 1120, true); takeItems(talker, -1, SUSPICIOUS_CONTRACT); // Retail like, reward is given in 2 pieces if both conditions are meet. html = "30532-10.html"; - } - else - { - if (memos == 1) - { + } else { + if (memos == 1) { html = "30532-08.html"; - } - else if (memos >= 2) - { + } else if (memos >= 2) { html = "30532-09.html"; } } @@ -205,18 +165,13 @@ public final class Q00292_BrigandsSweep extends Quest } break; } - case BALANKI: - { - if (qs.isStarted()) - { - if (hasQuestItems(talker, SUSPICIOUS_CONTRACT)) - { + case BALANKI: { + if (qs.isStarted()) { + if (hasQuestItems(talker, SUSPICIOUS_CONTRACT)) { giveAdena(talker, 620, true); takeItems(talker, 1487, -1); html = "30533-02.html"; - } - else - { + } else { html = "30533-01.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00293_TheHiddenVeins/Q00293_TheHiddenVeins.java b/src/main/java/com/l2jserver/datapack/quests/Q00293_TheHiddenVeins/Q00293_TheHiddenVeins.java index 25dad7104b..de853182c7 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00293_TheHiddenVeins/Q00293_TheHiddenVeins.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00293_TheHiddenVeins/Q00293_TheHiddenVeins.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.State; * The Hidden Veins (293) * @author xban1x */ -public final class Q00293_TheHiddenVeins extends Quest -{ +public final class Q00293_TheHiddenVeins extends Quest { // NPCs private static final int FILAUR = 30535; private static final int CHICHIRIN = 30539; @@ -41,8 +40,7 @@ public final class Q00293_TheHiddenVeins extends Quest private static final int TORN_MAP_FRAGMENT = 1489; private static final int HIDDEN_ORE_MAP = 1490; // Monsters - private static final int[] MONSTERS = new int[] - { + private static final int[] MONSTERS = new int[] { 20446, 20447, 20448, @@ -51,8 +49,7 @@ public final class Q00293_TheHiddenVeins extends Quest private static final int MIN_LVL = 6; private static final int REQUIRED_TORN_MAP_FRAGMENT = 4; - public Q00293_TheHiddenVeins() - { + public Q00293_TheHiddenVeins() { super(293, Q00293_TheHiddenVeins.class.getSimpleName(), "The Hidden Veins"); addStartNpc(FILAUR); addTalkId(FILAUR, CHICHIRIN); @@ -61,44 +58,34 @@ public final class Q00293_TheHiddenVeins extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { - case "30535-04.htm": - { + switch (event) { + case "30535-04.htm": { st.startQuest(); htmltext = event; break; } - case "30535-07.html": - { + case "30535-07.html": { st.exitQuest(true, true); htmltext = event; break; } - case "30535-08.html": - { + case "30535-08.html": { htmltext = event; break; } - case "30539-03.html": - { - if (st.getQuestItemsCount(TORN_MAP_FRAGMENT) >= REQUIRED_TORN_MAP_FRAGMENT) - { + case "30539-03.html": { + if (st.getQuestItemsCount(TORN_MAP_FRAGMENT) >= REQUIRED_TORN_MAP_FRAGMENT) { st.giveItems(HIDDEN_ORE_MAP, 1); st.takeItems(TORN_MAP_FRAGMENT, REQUIRED_TORN_MAP_FRAGMENT); htmltext = event; - } - else - { + } else { htmltext = "30539-02.html"; } } @@ -107,19 +94,14 @@ public final class Q00293_TheHiddenVeins extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if (st != null) - { + if (st != null) { final int chance = getRandom(100); - if (chance > 50) - { + if (chance > 50) { st.giveItems(CHRYSOLITE_ORE, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - } - else if (chance < 5) - { + } else if (chance < 5) { st.giveItems(TORN_MAP_FRAGMENT, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -128,34 +110,25 @@ public final class Q00293_TheHiddenVeins extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (npc.getId()) - { - case FILAUR: - { - switch (st.getState()) - { - case State.CREATED: - { + switch (npc.getId()) { + case FILAUR: { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getRace() == Race.DWARF) ? (player.getLevel() >= MIN_LVL) ? "30535-03.htm" : "30535-02.htm" : "30535-01.htm"; break; } - case State.STARTED: - { - if (hasAtLeastOneQuestItem(player, CHRYSOLITE_ORE, HIDDEN_ORE_MAP)) - { + case State.STARTED: { + if (hasAtLeastOneQuestItem(player, CHRYSOLITE_ORE, HIDDEN_ORE_MAP)) { final long ores = st.getQuestItemsCount(CHRYSOLITE_ORE); final long maps = st.getQuestItemsCount(HIDDEN_ORE_MAP); st.giveAdena((ores * 5) + (maps * 500) + (((ores + maps) >= 10) ? 2000 : 0), true); takeItems(player, -1, CHRYSOLITE_ORE, HIDDEN_ORE_MAP); Q00281_HeadForTheHills.giveNewbieReward(player); htmltext = (ores > 0) ? (maps > 0) ? "30535-10.html" : "30535-06.html" : "30535-09.html"; - } - else - { + } else { htmltext = "30535-05.html"; } break; @@ -163,8 +136,7 @@ public final class Q00293_TheHiddenVeins extends Quest } break; } - case CHICHIRIN: - { + case CHICHIRIN: { htmltext = "30539-01.html"; break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00294_CovertBusiness/Q00294_CovertBusiness.java b/src/main/java/com/l2jserver/datapack/quests/Q00294_CovertBusiness/Q00294_CovertBusiness.java index 91948d8e3c..02bc93b92d 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00294_CovertBusiness/Q00294_CovertBusiness.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00294_CovertBusiness/Q00294_CovertBusiness.java @@ -34,16 +34,14 @@ import com.l2jserver.gameserver.util.Util; * Covert Business (294) * @author xban1x */ -public final class Q00294_CovertBusiness extends Quest -{ +public final class Q00294_CovertBusiness extends Quest { // NPC private static final int KEEF = 30534; // Item private static final int BAT_FANG = 1491; // Monsters private static final Map<Integer, List<Integer>> MONSTER_DROP_CHANCE = new HashMap<>(); - static - { + static { MONSTER_DROP_CHANCE.put(20370, Arrays.asList(6, 3, 1, -1)); MONSTER_DROP_CHANCE.put(20480, Arrays.asList(5, 2, -1)); } @@ -52,8 +50,7 @@ public final class Q00294_CovertBusiness extends Quest // Misc private static final int MIN_LVL = 10; - public Q00294_CovertBusiness() - { + public Q00294_CovertBusiness() { super(294, Q00294_CovertBusiness.class.getSimpleName(), "Covert Business"); addStartNpc(KEEF); addTalkId(KEEF); @@ -62,11 +59,9 @@ public final class Q00294_CovertBusiness extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if ((qs != null) && qs.isCreated() && event.equals("30534-03.htm")) - { + if ((qs != null) && qs.isCreated() && event.equals("30534-03.htm")) { qs.startQuest(); return event; } @@ -74,20 +69,15 @@ public final class Q00294_CovertBusiness extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isCond(1) && Util.checkIfInRange(1500, npc, killer, true)) - { + if ((qs != null) && qs.isCond(1) && Util.checkIfInRange(1500, npc, killer, true)) { final int chance = getRandom(10); int count = 0; - for (int i : MONSTER_DROP_CHANCE.get(npc.getId())) - { + for (int i : MONSTER_DROP_CHANCE.get(npc.getId())) { count++; - if (chance > i) - { - if (giveItemRandomly(killer, npc, BAT_FANG, count, 100, 1.0, true)) - { + if (chance > i) { + if (giveItemRandomly(killer, npc, BAT_FANG, count, 100, 1.0, true)) { qs.setCond(2); } break; @@ -98,33 +88,23 @@ public final class Q00294_CovertBusiness extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String html = getNoQuestMsg(talker); - if (qs.isCreated()) - { + if (qs.isCreated()) { html = (talker.getRace() == Race.DWARF) ? (talker.getLevel() >= MIN_LVL) ? "30534-02.htm" : "30534-01.htm" : "30534-00.htm"; - } - else if (qs.isStarted()) - { - if (qs.isCond(2)) - { - if (hasQuestItems(talker, RING_OF_RACCOON)) - { + } else if (qs.isStarted()) { + if (qs.isCond(2)) { + if (hasQuestItems(talker, RING_OF_RACCOON)) { giveAdena(talker, 2400, true); html = "30534-06.html"; - } - else - { + } else { giveItems(talker, RING_OF_RACCOON, 1); html = "30534-05.html"; } addExpAndSp(talker, 0, 600); qs.exitQuest(true, true); - } - else - { + } else { html = "30534-04.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00295_DreamingOfTheSkies/Q00295_DreamingOfTheSkies.java b/src/main/java/com/l2jserver/datapack/quests/Q00295_DreamingOfTheSkies/Q00295_DreamingOfTheSkies.java index 56a853315b..113031c185 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00295_DreamingOfTheSkies/Q00295_DreamingOfTheSkies.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00295_DreamingOfTheSkies/Q00295_DreamingOfTheSkies.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.util.Util; * Dreaming of the Skies (295) * @author xban1x */ -public final class Q00295_DreamingOfTheSkies extends Quest -{ +public final class Q00295_DreamingOfTheSkies extends Quest { // NPC private static final int ARIN = 30536; // Monster @@ -41,8 +40,7 @@ public final class Q00295_DreamingOfTheSkies extends Quest // Misc private static final int MIN_LVL = 11; - public Q00295_DreamingOfTheSkies() - { + public Q00295_DreamingOfTheSkies() { super(295, Q00295_DreamingOfTheSkies.class.getSimpleName(), "Dreaming of the Skies"); addStartNpc(ARIN); addTalkId(ARIN); @@ -51,11 +49,9 @@ public final class Q00295_DreamingOfTheSkies extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if ((qs != null) && qs.isCreated() && event.equals("30536-03.htm")) - { + if ((qs != null) && qs.isCreated() && event.equals("30536-03.htm")) { qs.startQuest(); return event; } @@ -63,13 +59,10 @@ public final class Q00295_DreamingOfTheSkies extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isCond(1) && Util.checkIfInRange(1500, npc, killer, true)) - { - if (giveItemRandomly(killer, npc, FLOATING_STONE, (getRandom(100) > 25) ? 1 : 2, 50, 1.0, true)) - { + if ((qs != null) && qs.isCond(1) && Util.checkIfInRange(1500, npc, killer, true)) { + if (giveItemRandomly(killer, npc, FLOATING_STONE, (getRandom(100) > 25) ? 1 : 2, 50, 1.0, true)) { qs.setCond(2); } } @@ -77,33 +70,23 @@ public final class Q00295_DreamingOfTheSkies extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String html = getNoQuestMsg(talker); - if (qs.isCreated()) - { + if (qs.isCreated()) { html = (talker.getLevel() >= MIN_LVL) ? "30536-02.htm" : "30536-01.htm"; - } - else if (qs.isStarted()) - { - if (qs.isCond(2)) - { - if (hasQuestItems(talker, RING_OF_FIREFLY)) - { + } else if (qs.isStarted()) { + if (qs.isCond(2)) { + if (hasQuestItems(talker, RING_OF_FIREFLY)) { giveAdena(talker, 2400, true); html = "30536-06.html"; - } - else - { + } else { giveItems(talker, RING_OF_FIREFLY, 1); html = "30536-05.html"; } takeItems(talker, FLOATING_STONE, -1); qs.exitQuest(true, true); - } - else - { + } else { html = "30536-04.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00296_TarantulasSpiderSilk/Q00296_TarantulasSpiderSilk.java b/src/main/java/com/l2jserver/datapack/quests/Q00296_TarantulasSpiderSilk/Q00296_TarantulasSpiderSilk.java index 23b0a2bd41..36ea7ef6a2 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00296_TarantulasSpiderSilk/Q00296_TarantulasSpiderSilk.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00296_TarantulasSpiderSilk/Q00296_TarantulasSpiderSilk.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.util.Util; * Tarantula's Spider Silk (296) * @author xban1x */ -public final class Q00296_TarantulasSpiderSilk extends Quest -{ +public final class Q00296_TarantulasSpiderSilk extends Quest { // NPCs private static final int TRADER_MION = 30519; private static final int DEFENDER_NATHAN = 30548; @@ -38,8 +37,7 @@ public final class Q00296_TarantulasSpiderSilk extends Quest private static final int TARANTULA_SPIDER_SILK = 1493; private static final int TARANTULA_SPINNERETTE = 1494; // Monsters - private static final int[] MONSTERS = new int[] - { + private static final int[] MONSTERS = new int[] { 20394, 20403, 20508, @@ -47,8 +45,7 @@ public final class Q00296_TarantulasSpiderSilk extends Quest // Misc private static final int MIN_LVL = 15; - public Q00296_TarantulasSpiderSilk() - { + public Q00296_TarantulasSpiderSilk() { super(296, Q00296_TarantulasSpiderSilk.class.getSimpleName(), "Tarantula's Spider Silk"); addStartNpc(TRADER_MION); addTalkId(TRADER_MION, DEFENDER_NATHAN); @@ -57,55 +54,41 @@ public final class Q00296_TarantulasSpiderSilk extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String html = null; - if (qs == null) - { + if (qs == null) { return null; } - switch (event) - { - case "30519-03.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "30519-03.htm": { + if (qs.isCreated()) { qs.startQuest(); html = event; } break; } - case "30519-06.html": - { - if (qs.isStarted()) - { + case "30519-06.html": { + if (qs.isStarted()) { qs.exitQuest(true, true); html = event; } break; } - case "30519-07.html": - { - if (qs.isStarted()) - { + case "30519-07.html": { + if (qs.isStarted()) { html = event; } break; } - case "30548-03.html": - { - if (qs.isStarted()) - { - if (hasQuestItems(player, TARANTULA_SPINNERETTE)) - { + case "30548-03.html": { + if (qs.isStarted()) { + if (hasQuestItems(player, TARANTULA_SPINNERETTE)) { giveItems(player, TARANTULA_SPIDER_SILK, (15 + getRandom(9)) * getQuestItemsCount(player, TARANTULA_SPINNERETTE)); takeItems(player, TARANTULA_SPINNERETTE, -1); html = event; - } - else - { + } else { html = "30548-02.html"; } } @@ -116,18 +99,13 @@ public final class Q00296_TarantulasSpiderSilk extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && Util.checkIfInRange(1500, npc, killer, true)) - { + if ((qs != null) && Util.checkIfInRange(1500, npc, killer, true)) { final int chance = getRandom(100); - if (chance > 95) - { + if (chance > 95) { giveItemRandomly(killer, npc, TARANTULA_SPINNERETTE, 1, 0, 1, true); - } - else if (chance > 45) - { + } else if (chance > 45) { giveItemRandomly(killer, npc, TARANTULA_SPIDER_SILK, 1, 0, 1, true); } } @@ -135,33 +113,23 @@ public final class Q00296_TarantulasSpiderSilk extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String html = getNoQuestMsg(talker); - if (qs.isCreated() && (npc.getId() == TRADER_MION)) - { + if (qs.isCreated() && (npc.getId() == TRADER_MION)) { html = (talker.getLevel() >= MIN_LVL ? "30519-02.htm" : "30519-01.htm"); - } - else if (qs.isStarted()) - { - if (npc.getId() == TRADER_MION) - { + } else if (qs.isStarted()) { + if (npc.getId() == TRADER_MION) { final long silk = getQuestItemsCount(talker, TARANTULA_SPIDER_SILK); - if (silk >= 1) - { + if (silk >= 1) { giveAdena(talker, (silk * 30) + (silk >= 10 ? 2000 : 0), true); takeItems(talker, TARANTULA_SPIDER_SILK, -1); Q00281_HeadForTheHills.giveNewbieReward(talker);// TODO: It's using wrong bitmask, need to create a general bitmask for this using EnumIntBitmask class inside Quest class for handling Quest rewards. html = "30519-05.html"; - } - else - { + } else { html = "30519-04.html"; } - } - else if (npc.getId() == DEFENDER_NATHAN) - { + } else if (npc.getId() == DEFENDER_NATHAN) { html = "30548-01.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00297_GatekeepersFavor/Q00297_GatekeepersFavor.java b/src/main/java/com/l2jserver/datapack/quests/Q00297_GatekeepersFavor/Q00297_GatekeepersFavor.java index 2d0946ff21..f2b65fcb19 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00297_GatekeepersFavor/Q00297_GatekeepersFavor.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00297_GatekeepersFavor/Q00297_GatekeepersFavor.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * Gatekeeper's Favor (297) * @author malyelfik */ -public class Q00297_GatekeepersFavor extends Quest -{ +public class Q00297_GatekeepersFavor extends Quest { // NPC private static final int WIRPHY = 30540; // Monster @@ -42,8 +41,7 @@ public class Q00297_GatekeepersFavor extends Quest private static final int MIN_LEVEL = 15; private static final int STARSTONE_COUT = 20; - public Q00297_GatekeepersFavor() - { + public Q00297_GatekeepersFavor() { super(297, Q00297_GatekeepersFavor.class.getSimpleName(), "Gatekeeper's Favor"); addStartNpc(WIRPHY); addTalkId(WIRPHY); @@ -52,13 +50,10 @@ public class Q00297_GatekeepersFavor extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && event.equalsIgnoreCase("30540-03.htm")) - { - if (player.getLevel() < MIN_LEVEL) - { + if ((st != null) && event.equalsIgnoreCase("30540-03.htm")) { + if (player.getLevel() < MIN_LEVEL) { return "30540-01.htm"; } st.startQuest(); @@ -68,18 +63,13 @@ public class Q00297_GatekeepersFavor extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isStarted() && (st.getQuestItemsCount(STARSTONE) < STARSTONE_COUT)) - { + if ((st != null) && st.isStarted() && (st.getQuestItemsCount(STARSTONE) < STARSTONE_COUT)) { st.giveItems(STARSTONE, 1); - if (st.getQuestItemsCount(STARSTONE) >= STARSTONE_COUT) - { + if (st.getQuestItemsCount(STARSTONE) >= STARSTONE_COUT) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -87,22 +77,17 @@ public class Q00297_GatekeepersFavor extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = "30540-02.htm"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "30540-04.html"; - } - else if (st.isCond(2) && (st.getQuestItemsCount(STARSTONE) >= STARSTONE_COUT)) - { + } else if (st.isCond(2) && (st.getQuestItemsCount(STARSTONE) >= STARSTONE_COUT)) { st.giveItems(GATEKEEPER_TOKEN, 2); st.exitQuest(true, true); htmltext = "30540-05.html"; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00298_LizardmensConspiracy/Q00298_LizardmensConspiracy.java b/src/main/java/com/l2jserver/datapack/quests/Q00298_LizardmensConspiracy/Q00298_LizardmensConspiracy.java index 892a800ca4..a9b94ff831 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00298_LizardmensConspiracy/Q00298_LizardmensConspiracy.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00298_LizardmensConspiracy/Q00298_LizardmensConspiracy.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Lizardmen's Conspiracy (298) * @author xban1x */ -public final class Q00298_LizardmensConspiracy extends Quest -{ +public final class Q00298_LizardmensConspiracy extends Quest { // NPCs private static final int GUARD_PRAGA = 30333; private static final int MAGISTER_ROHMER = 30344; @@ -42,8 +41,7 @@ public final class Q00298_LizardmensConspiracy extends Quest private static final int SHINING_RED_GEM = 7184; // Monsters private static final Map<Integer, ItemChanceHolder> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(20922, new ItemChanceHolder(SHINING_GEM, 0.49, 1)); MONSTERS.put(20924, new ItemChanceHolder(SHINING_GEM, 0.75, 1)); MONSTERS.put(20926, new ItemChanceHolder(SHINING_RED_GEM, 0.54, 1)); @@ -53,8 +51,7 @@ public final class Q00298_LizardmensConspiracy extends Quest // Misc private static final int MIN_LVL = 25; - public Q00298_LizardmensConspiracy() - { + public Q00298_LizardmensConspiracy() { super(298, Q00298_LizardmensConspiracy.class.getSimpleName(), "Lizardmen's Conspiracy"); addStartNpc(GUARD_PRAGA); addTalkId(GUARD_PRAGA, MAGISTER_ROHMER); @@ -63,49 +60,37 @@ public final class Q00298_LizardmensConspiracy extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String html = null; - if (qs == null) - { + if (qs == null) { return html; } - switch (event) - { - case "30333-03.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "30333-03.htm": { + if (qs.isCreated()) { qs.startQuest(); giveItems(player, PATROLS_REPORT, 1); html = event; } break; } - case "30344-04.html": - { - if (qs.isCond(1) && hasQuestItems(player, PATROLS_REPORT)) - { + case "30344-04.html": { + if (qs.isCond(1) && hasQuestItems(player, PATROLS_REPORT)) { takeItems(player, PATROLS_REPORT, -1); qs.setCond(2, true); html = event; } break; } - case "30344-06.html": - { - if (qs.isStarted()) - { - if (qs.isCond(3)) - { + case "30344-06.html": { + if (qs.isStarted()) { + if (qs.isCond(3)) { addExpAndSp(player, 0, 42000); qs.exitQuest(true, true); html = event; - } - else - { + } else { html = "30344-07.html"; } } @@ -116,16 +101,13 @@ public final class Q00298_LizardmensConspiracy extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, 2, 3, npc); - if (qs != null) - { + if (qs != null) { final ItemChanceHolder item = MONSTERS.get(npc.getId()); if (giveItemRandomly(qs.getPlayer(), npc, item.getId(), item.getCount(), 50, item.getChance(), true) // && (getQuestItemsCount(qs.getPlayer(), SHINING_GEM) >= 50) // - && (getQuestItemsCount(qs.getPlayer(), SHINING_RED_GEM) >= 50)) - { + && (getQuestItemsCount(qs.getPlayer(), SHINING_RED_GEM) >= 50)) { qs.setCond(3, true); } } @@ -133,36 +115,25 @@ public final class Q00298_LizardmensConspiracy extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String html = getNoQuestMsg(talker); - if (qs.isCreated() && (npc.getId() == GUARD_PRAGA)) - { + if (qs.isCreated() && (npc.getId() == GUARD_PRAGA)) { html = (talker.getLevel() >= MIN_LVL) ? "30333-01.htm" : "30333-02.htm"; - } - else if (qs.isStarted()) - { - if ((npc.getId() == GUARD_PRAGA) && hasQuestItems(talker, PATROLS_REPORT)) - { + } else if (qs.isStarted()) { + if ((npc.getId() == GUARD_PRAGA) && hasQuestItems(talker, PATROLS_REPORT)) { html = "30333-04.html"; - } - else if (npc.getId() == MAGISTER_ROHMER) - { - switch (qs.getCond()) - { - case 1: - { + } else if (npc.getId() == MAGISTER_ROHMER) { + switch (qs.getCond()) { + case 1: { html = "30344-01.html"; break; } - case 2: - { + case 2: { html = "30344-02.html"; break; } - case 3: - { + case 3: { html = "30344-03.html"; break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00299_GatherIngredientsForPie/Q00299_GatherIngredientsForPie.java b/src/main/java/com/l2jserver/datapack/quests/Q00299_GatherIngredientsForPie/Q00299_GatherIngredientsForPie.java index a9f6b93037..4a9638cef8 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00299_GatherIngredientsForPie/Q00299_GatherIngredientsForPie.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00299_GatherIngredientsForPie/Q00299_GatherIngredientsForPie.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.model.quest.State; * Gather Ingredients for Pie (299) * @author xban1x */ -public final class Q00299_GatherIngredientsForPie extends Quest -{ +public final class Q00299_GatherIngredientsForPie extends Quest { // NPCs private static final int LARS = 30063; private static final int BRIGHT = 30466; @@ -50,8 +49,7 @@ public final class Q00299_GatherIngredientsForPie extends Quest private static final List<QuestItemHolder> REWARDS = new ArrayList<>(5); // Misc private static final int MIN_LVL = 34; - static - { + static { MONSTERS_CHANCES.put(20934, 700); // Wasp Worker MONSTERS_CHANCES.put(20935, 770); // Wasp Leader REWARDS.add(new QuestItemHolder(57, 400, 2500)); // Adena @@ -61,8 +59,7 @@ public final class Q00299_GatherIngredientsForPie extends Quest REWARDS.add(new QuestItemHolder(1871, 1000, 50)); // Charcoal } - public Q00299_GatherIngredientsForPie() - { + public Q00299_GatherIngredientsForPie() { super(299, Q00299_GatherIngredientsForPie.class.getSimpleName(), "Gather Ingredients for Pie"); addStartNpc(EMILLY); addTalkId(LARS, BRIGHT, EMILLY); @@ -71,92 +68,69 @@ public final class Q00299_GatherIngredientsForPie extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String html = null; - if (qs == null) - { + if (qs == null) { return html; } - switch (event) - { - case "30063-02.html": - { - if (qs.isCond(3)) - { + switch (event) { + case "30063-02.html": { + if (qs.isCond(3)) { giveItems(player, AVELLAN_SPICE, 1); qs.setCond(4, true); html = event; } break; } - case "30466-02.html": - { - if (qs.isCond(5)) - { + case "30466-02.html": { + if (qs.isCond(5)) { giveItems(player, FRUIT_BASKET, 1); qs.setCond(6, true); html = event; } break; } - case "30620-03.htm": - { - if (qs.isCreated()) - { + case "30620-03.htm": { + if (qs.isCreated()) { qs.startQuest(); html = event; } break; } - case "30620-06.html": - { - if (qs.isCond(2) && (getQuestItemsCount(player, HONEY_POUCH) >= 100)) - { + case "30620-06.html": { + if (qs.isCond(2) && (getQuestItemsCount(player, HONEY_POUCH) >= 100)) { takeItems(player, HONEY_POUCH, -1); qs.setCond(3, true); html = event; - } - else - { + } else { html = "30620-07.html"; } break; } - case "30620-10.html": - { - if (qs.isCond(4) && hasQuestItems(player, AVELLAN_SPICE)) - { + case "30620-10.html": { + if (qs.isCond(4) && hasQuestItems(player, AVELLAN_SPICE)) { takeItems(player, AVELLAN_SPICE, -1); qs.setCond(5, true); html = event; - } - else - { + } else { html = "30620-11.html"; } break; } - case "30620-14.html": - { - if (qs.isCond(6) && hasQuestItems(player, FRUIT_BASKET)) - { + case "30620-14.html": { + if (qs.isCond(6) && hasQuestItems(player, FRUIT_BASKET)) { takeItems(player, FRUIT_BASKET, -1); final int chance = getRandom(1000); - for (QuestItemHolder holder : REWARDS) - { - if (holder.getChance() > chance) - { + for (QuestItemHolder holder : REWARDS) { + if (holder.getChance() > chance) { rewardItems(player, holder); break; } } qs.exitQuest(true, true); html = event; - } - else - { + } else { html = "30620-15.html"; } break; @@ -166,13 +140,10 @@ public final class Q00299_GatherIngredientsForPie extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc); - if ((qs != null) && (getRandom(1000) < MONSTERS_CHANCES.get(npc.getId())) && (getQuestItemsCount(killer, HONEY_POUCH) < 100)) - { - if (giveItemRandomly(killer, npc, HONEY_POUCH, 1, 2, 100, 1, true)) - { + if ((qs != null) && (getRandom(1000) < MONSTERS_CHANCES.get(npc.getId())) && (getQuestItemsCount(killer, HONEY_POUCH) < 100)) { + if (giveItemRandomly(killer, npc, HONEY_POUCH, 1, 2, 100, 1, true)) { qs.setCond(2); } } @@ -180,94 +151,70 @@ public final class Q00299_GatherIngredientsForPie extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String html = getNoQuestMsg(talker); - switch (npc.getId()) - { - case LARS: - { - switch (qs.getCond()) - { - case 3: - { + switch (npc.getId()) { + case LARS: { + switch (qs.getCond()) { + case 3: { html = "30063-01.html"; break; } - case 4: - { + case 4: { html = "30063-03.html"; break; } } break; } - case BRIGHT: - { - switch (qs.getCond()) - { - case 5: - { + case BRIGHT: { + switch (qs.getCond()) { + case 5: { html = "30466-01.html"; break; } - case 6: - { + case 6: { html = "30466-03.html"; break; } } break; } - case EMILLY: - { - switch (qs.getState()) - { - case State.CREATED: - { + case EMILLY: { + switch (qs.getState()) { + case State.CREATED: { html = (talker.getLevel() >= MIN_LVL) ? "30620-01.htm" : "30620-02.htm"; break; } - case State.STARTED: - { - switch (qs.getCond()) - { - case 1: - { + case State.STARTED: { + switch (qs.getCond()) { + case 1: { html = "30620-05.html"; break; } - case 2: - { - if (getQuestItemsCount(talker, HONEY_POUCH) >= 100) - { + case 2: { + if (getQuestItemsCount(talker, HONEY_POUCH) >= 100) { html = "30620-04.html"; } break; } - case 3: - { + case 3: { html = "30620-08.html"; break; } - case 4: - { - if (hasQuestItems(talker, AVELLAN_SPICE)) - { + case 4: { + if (hasQuestItems(talker, AVELLAN_SPICE)) { html = "30620-09.html"; } break; } - case 5: - { + case 5: { html = "30620-12.html"; break; } - case 6: - { - if (hasQuestItems(talker, FRUIT_BASKET)) - { + case 6: { + if (hasQuestItems(talker, FRUIT_BASKET)) { html = "30620-13.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00300_HuntingLetoLizardman/Q00300_HuntingLetoLizardman.java b/src/main/java/com/l2jserver/datapack/quests/Q00300_HuntingLetoLizardman/Q00300_HuntingLetoLizardman.java index bea5c09427..8ac97daf5b 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00300_HuntingLetoLizardman/Q00300_HuntingLetoLizardman.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00300_HuntingLetoLizardman/Q00300_HuntingLetoLizardman.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.model.quest.State; * Hunting Leto Lizardman (300) * @author ivantotov */ -public final class Q00300_HuntingLetoLizardman extends Quest -{ +public final class Q00300_HuntingLetoLizardman extends Quest { // NPCs private static final int RATH = 30126; // Items @@ -49,8 +48,7 @@ public final class Q00300_HuntingLetoLizardman extends Quest // Monsters private static final Map<Integer, Integer> MOBS_SAC = new HashMap<>(); - static - { + static { MOBS_SAC.put(20577, 360); // Leto Lizardman MOBS_SAC.put(20578, 390); // Leto Lizardman Archer MOBS_SAC.put(20579, 410); // Leto Lizardman Soldier @@ -58,8 +56,7 @@ public final class Q00300_HuntingLetoLizardman extends Quest MOBS_SAC.put(20582, 890); // Leto Lizardman Overlord } - public Q00300_HuntingLetoLizardman() - { + public Q00300_HuntingLetoLizardman() { super(300, Q00300_HuntingLetoLizardman.class.getSimpleName(), "Hunting Leto Lizardman"); addStartNpc(RATH); addTalkId(RATH); @@ -68,48 +65,34 @@ public final class Q00300_HuntingLetoLizardman extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "30126-03.htm": - { - if (st.isCreated()) - { + switch (event) { + case "30126-03.htm": { + if (st.isCreated()) { st.startQuest(); htmltext = event; } break; } - case "30126-06.html": - { - if (st.getQuestItemsCount(BRACELET_OF_LIZARDMAN) >= REQUIRED_BRACELET_COUNT) - { + case "30126-06.html": { + if (st.getQuestItemsCount(BRACELET_OF_LIZARDMAN) >= REQUIRED_BRACELET_COUNT) { st.takeItems(BRACELET_OF_LIZARDMAN, -1); int rand = getRandom(1000); - if (rand < 500) - { + if (rand < 500) { giveItems(player, REWARD_ADENA); - } - else if (rand < 750) - { + } else if (rand < 750) { giveItems(player, REWARD_ANIMAL_SKIN); - } - else if (rand < 1000) - { + } else if (rand < 1000) { giveItems(player, REWARD_ANIMAL_BONE); } st.exitQuest(true, true); htmltext = event; - } - else - { + } else { htmltext = "30126-07.html"; } break; @@ -119,21 +102,15 @@ public final class Q00300_HuntingLetoLizardman extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(player, 1); - if (partyMember != null) - { + if (partyMember != null) { final QuestState st = getQuestState(partyMember, false); - if (st.isCond(1) && (getRandom(1000) < MOBS_SAC.get(npc.getId()))) - { + if (st.isCond(1) && (getRandom(1000) < MOBS_SAC.get(npc.getId()))) { st.giveItems(BRACELET_OF_LIZARDMAN, 1); - if (st.getQuestItemsCount(BRACELET_OF_LIZARDMAN) == REQUIRED_BRACELET_COUNT) - { + if (st.getQuestItemsCount(BRACELET_OF_LIZARDMAN) == REQUIRED_BRACELET_COUNT) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -142,30 +119,22 @@ public final class Q00300_HuntingLetoLizardman extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getLevel() >= MIN_LEVEL) ? "30126-01.htm" : "30126-02.htm"; break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "30126-04.html"; break; } - case 2: - { - if (st.getQuestItemsCount(BRACELET_OF_LIZARDMAN) >= REQUIRED_BRACELET_COUNT) - { + case 2: { + if (st.getQuestItemsCount(BRACELET_OF_LIZARDMAN) >= REQUIRED_BRACELET_COUNT) { htmltext = "30126-05.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00303_CollectArrowheads/Q00303_CollectArrowheads.java b/src/main/java/com/l2jserver/datapack/quests/Q00303_CollectArrowheads/Q00303_CollectArrowheads.java index b9ddee4624..71ca7ccd25 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00303_CollectArrowheads/Q00303_CollectArrowheads.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00303_CollectArrowheads/Q00303_CollectArrowheads.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.State; * Collect Arrowheads (303) * @author ivantotov */ -public final class Q00303_CollectArrowheads extends Quest -{ +public final class Q00303_CollectArrowheads extends Quest { // NPC private static final int MINIA = 30029; // Item @@ -40,8 +39,7 @@ public final class Q00303_CollectArrowheads extends Quest // Monster private static final int TUNATH_ORC_MARKSMAN = 20361; - public Q00303_CollectArrowheads() - { + public Q00303_CollectArrowheads() { super(303, Q00303_CollectArrowheads.class.getSimpleName(), "Collect Arrowheads"); addStartNpc(MINIA); addTalkId(MINIA); @@ -50,11 +48,9 @@ public final class Q00303_CollectArrowheads extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && event.equals("30029-04.htm")) - { + if ((st != null) && event.equals("30029-04.htm")) { st.startQuest(); return event; } @@ -62,14 +58,11 @@ public final class Q00303_CollectArrowheads extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(player, 1); - if (partyMember != null) - { + if (partyMember != null) { final QuestState st = getQuestState(partyMember, false); - if (st.giveItemRandomly(npc, ORCISH_ARROWHEAD, 1, REQUIRED_ITEM_COUNT, 0.4, true)) - { + if (st.giveItemRandomly(npc, ORCISH_ARROWHEAD, 1, REQUIRED_ITEM_COUNT, 0.4, true)) { st.setCond(2); } } @@ -77,33 +70,24 @@ public final class Q00303_CollectArrowheads extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = player.getLevel() >= MIN_LEVEL ? "30029-03.htm" : "30029-02.htm"; break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { - if (st.getQuestItemsCount(ORCISH_ARROWHEAD) < REQUIRED_ITEM_COUNT) - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { + if (st.getQuestItemsCount(ORCISH_ARROWHEAD) < REQUIRED_ITEM_COUNT) { htmltext = "30029-05.html"; } break; } - case 2: - { - if (st.getQuestItemsCount(ORCISH_ARROWHEAD) >= REQUIRED_ITEM_COUNT) - { + case 2: { + if (st.getQuestItemsCount(ORCISH_ARROWHEAD) >= REQUIRED_ITEM_COUNT) { st.giveAdena(1000, true); st.addExpAndSp(2000, 0); st.exitQuest(true, true); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00306_CrystalOfFireAndIce/Q00306_CrystalOfFireAndIce.java b/src/main/java/com/l2jserver/datapack/quests/Q00306_CrystalOfFireAndIce/Q00306_CrystalOfFireAndIce.java index adf5f12a98..9f384d2c31 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00306_CrystalOfFireAndIce/Q00306_CrystalOfFireAndIce.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00306_CrystalOfFireAndIce/Q00306_CrystalOfFireAndIce.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.util.Util; * Crystals of Fire and Ice (306) * @author ivantotov */ -public final class Q00306_CrystalOfFireAndIce extends Quest -{ +public final class Q00306_CrystalOfFireAndIce extends Quest { // NPC private static final int KATERINA = 30004; // Items @@ -45,8 +44,7 @@ public final class Q00306_CrystalOfFireAndIce extends Quest // Monsters private static final int UNDINE_NOBLE = 20115; private static final Map<Integer, ItemHolder> MONSTER_DROPS = new HashMap<>(); - static - { + static { MONSTER_DROPS.put(20109, new ItemHolder(FLAME_SHARD, 925)); // Salamander MONSTER_DROPS.put(20110, new ItemHolder(ICE_SHARD, 900)); // Undine MONSTER_DROPS.put(20112, new ItemHolder(FLAME_SHARD, 900)); // Salamander Elder @@ -55,8 +53,7 @@ public final class Q00306_CrystalOfFireAndIce extends Quest MONSTER_DROPS.put(UNDINE_NOBLE, new ItemHolder(ICE_SHARD, 950)); // Undine Noble } - public Q00306_CrystalOfFireAndIce() - { + public Q00306_CrystalOfFireAndIce() { super(306, Q00306_CrystalOfFireAndIce.class.getSimpleName(), "Crystals of Fire and Ice"); addStartNpc(KATERINA); addTalkId(KATERINA); @@ -65,33 +62,26 @@ public final class Q00306_CrystalOfFireAndIce extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "30004-04.htm": - { - if (st.isCreated()) - { + switch (event) { + case "30004-04.htm": { + if (st.isCreated()) { st.startQuest(); htmltext = event; } break; } - case "30004-08.html": - { + case "30004-08.html": { st.exitQuest(true, true); htmltext = event; break; } - case "30004-09.html": - { + case "30004-09.html": { htmltext = event; break; } @@ -100,22 +90,17 @@ public final class Q00306_CrystalOfFireAndIce extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs; if (npc.getId() == UNDINE_NOBLE) // Undine Noble gives quest drops only for the killer { qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted()) - { + if ((qs != null) && qs.isStarted()) { giveKillReward(killer, npc); } - } - else - { + } else { qs = getRandomPartyMemberState(killer, -1, 3, npc); - if (qs != null) - { + if (qs != null) { giveKillReward(qs.getPlayer(), npc); } } @@ -123,29 +108,22 @@ public final class Q00306_CrystalOfFireAndIce extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = player.getLevel() >= MIN_LEVEL ? "30004-03.htm" : "30004-02.htm"; break; } - case State.STARTED: - { - if (hasAtLeastOneQuestItem(player, getRegisteredItemIds())) - { + case State.STARTED: { + if (hasAtLeastOneQuestItem(player, getRegisteredItemIds())) { final long flame = st.getQuestItemsCount(FLAME_SHARD); final long ice = st.getQuestItemsCount(ICE_SHARD); st.giveAdena(((flame * 40) + (ice * 40) + ((flame + ice) >= 10 ? 5000 : 0)), true); takeItems(player, -1, getRegisteredItemIds()); htmltext = "30004-07.html"; - } - else - { + } else { htmltext = "30004-05.html"; } break; @@ -154,10 +132,8 @@ public final class Q00306_CrystalOfFireAndIce extends Quest return htmltext; } - private static final void giveKillReward(L2PcInstance player, L2Npc npc) - { - if (Util.checkIfInRange(1500, npc, player, false)) - { + private static final void giveKillReward(L2PcInstance player, L2Npc npc) { + if (Util.checkIfInRange(1500, npc, player, false)) { final ItemHolder item = MONSTER_DROPS.get(npc.getId()); giveItemRandomly(player, npc, item.getId(), 1, 0, 1000.0 / item.getCount(), true); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00307_ControlDeviceOfTheGiants/Q00307_ControlDeviceOfTheGiants.java b/src/main/java/com/l2jserver/datapack/quests/Q00307_ControlDeviceOfTheGiants/Q00307_ControlDeviceOfTheGiants.java index 0e9b9eb07e..aecd9ea733 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00307_ControlDeviceOfTheGiants/Q00307_ControlDeviceOfTheGiants.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00307_ControlDeviceOfTheGiants/Q00307_ControlDeviceOfTheGiants.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.network.serverpackets.RadarControl; * Control Device of the Giants (307) * @author Gladicek, malyelfik */ -public class Q00307_ControlDeviceOfTheGiants extends Quest -{ +public class Q00307_ControlDeviceOfTheGiants extends Quest { // NPC private final static int DROPH = 32711; // RB @@ -48,8 +47,7 @@ public class Q00307_ControlDeviceOfTheGiants extends Quest private final static int RESPAWN_DELAY = 3600000; // 1 hour private static L2Npc hekaton; - public Q00307_ControlDeviceOfTheGiants() - { + public Q00307_ControlDeviceOfTheGiants() { super(307, Q00307_ControlDeviceOfTheGiants.class.getSimpleName(), "Control Device of the Giants"); addStartNpc(DROPH); addTalkId(DROPH); @@ -57,20 +55,16 @@ public class Q00307_ControlDeviceOfTheGiants extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "32711-04.html": - if (player.getLevel() >= 79) - { + if (player.getLevel() >= 79) { st.startQuest(); htmltext = (st.hasQuestItems(CET_1_SHEET, CET_2_SHEET, CET_3_SHEET)) ? "32711-04a.html" : "32711-04.html"; } @@ -85,18 +79,14 @@ public class Q00307_ControlDeviceOfTheGiants extends Quest player.sendPacket(new RadarControl(0, 2, 193432, 53922, -4368)); break; case "spawn": - if (!hasQuestItems(player, CET_1_SHEET, CET_2_SHEET, CET_3_SHEET)) - { + if (!hasQuestItems(player, CET_1_SHEET, CET_2_SHEET, CET_3_SHEET)) { return getNoQuestMsg(player); - } - else if ((hekaton != null) && !hekaton.isDead()) - { + } else if ((hekaton != null) && !hekaton.isDead()) { return "32711-09.html"; } String respawn = loadGlobalQuestVar("Respawn"); long remain = (!respawn.isEmpty()) ? Long.parseLong(respawn) - System.currentTimeMillis() : 0; - if (remain > 0) - { + if (remain > 0) { return "32711-09a.html"; } st.takeItems(CET_1_SHEET, 1); @@ -117,45 +107,35 @@ public class Q00307_ControlDeviceOfTheGiants extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(player, 1); - if (partyMember == null) - { + if (partyMember == null) { return super.onKill(npc, player, isSummon); } final QuestState st = getQuestState(partyMember, false); - switch (npc.getId()) - { - case GORGOLOS: - { + switch (npc.getId()) { + case GORGOLOS: { st.giveItems(CET_1_SHEET, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); break; } - case LAST_TITAN_UTENUS: - { + case LAST_TITAN_UTENUS: { st.giveItems(CET_2_SHEET, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); break; } - case GIANT_MARPANAK: - { + case GIANT_MARPANAK: { st.giveItems(CET_3_SHEET, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); break; } - case HEKATON_PRIME: - { - if (player.isInParty()) - { - for (L2PcInstance pl : player.getParty().getMembers()) - { + case HEKATON_PRIME: { + if (player.isInParty()) { + for (L2PcInstance pl : player.getParty().getMembers()) { final QuestState qs = getQuestState(pl, false); - if ((qs != null) && qs.isCond(1)) - { + if ((qs != null) && qs.isCond(1)) { qs.setCond(2, true); } } @@ -168,29 +148,20 @@ public class Q00307_ControlDeviceOfTheGiants extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getLevel() >= 79) ? "32711-01.htm" : "32711-02.htm"; break; } - case State.STARTED: - { - if ((hekaton != null) && !hekaton.isDead()) - { + case State.STARTED: { + if ((hekaton != null) && !hekaton.isDead()) { htmltext = "32711-09.html"; - } - else if (st.isCond(1)) - { + } else if (st.isCond(1)) { htmltext = (!hasQuestItems(player, CET_1_SHEET, CET_2_SHEET, CET_3_SHEET)) ? "32711-07.html" : "32711-08.html"; - } - else if (st.isCond(2)) - { + } else if (st.isCond(2)) { st.giveItems(SUPPORT_ITEMS, 1); st.exitQuest(true, true); htmltext = "32711-10.html"; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00308_ReedFieldMaintenance/Q00308_ReedFieldMaintenance.java b/src/main/java/com/l2jserver/datapack/quests/Q00308_ReedFieldMaintenance/Q00308_ReedFieldMaintenance.java index abe5bb8a39..95ea30c4e2 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00308_ReedFieldMaintenance/Q00308_ReedFieldMaintenance.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00308_ReedFieldMaintenance/Q00308_ReedFieldMaintenance.java @@ -38,15 +38,13 @@ import com.l2jserver.gameserver.util.Util; * Original Jython script by Bloodshed. * @author Joxit */ -public class Q00308_ReedFieldMaintenance extends Quest -{ +public class Q00308_ReedFieldMaintenance extends Quest { // NPC private static final int KATENSA = 32646; // Mobs private static final int AWAKENED_MUCROKIAN = 22655; private static final Map<Integer, Integer> MUCROKIAN = new HashMap<>(); - static - { + static { MUCROKIAN.put(22650, 218); // Mucrokian Fanatic MUCROKIAN.put(22651, 258); // Mucrokian Ascetic MUCROKIAN.put(22652, 248); // Mucrokian Savior @@ -64,8 +62,7 @@ public class Q00308_ReedFieldMaintenance extends Quest private static final int REC_DYNASTY_RING_70 = 9987; private static final int REC_DYNASTY_SIGIL_60 = 10115; - private static final int[] MOIRAI_RECIPES = - { + private static final int[] MOIRAI_RECIPES = { 15777, 15780, 15783, @@ -77,8 +74,7 @@ public class Q00308_ReedFieldMaintenance extends Quest 15812 }; - private static final int[] MOIRAI_PIECES = - { + private static final int[] MOIRAI_PIECES = { 15647, 15650, 15653, @@ -93,34 +89,26 @@ public class Q00308_ReedFieldMaintenance extends Quest // Misc private static final int MIN_LEVEL = 82; - public Q00308_ReedFieldMaintenance() - { + public Q00308_ReedFieldMaintenance() { super(308, Q00308_ReedFieldMaintenance.class.getSimpleName(), "Reed Field Maintenance"); addStartNpc(KATENSA); addTalkId(KATENSA); addKillId(MUCROKIAN.keySet()); } - private boolean canGiveItem(QuestState st, int quanty) - { + private boolean canGiveItem(QuestState st, int quanty) { long mucrokian = st.getQuestItemsCount(MUCROKIAN_HIDE); long awakened = st.getQuestItemsCount(AWAKENED_MUCROKIAN_HIDE); - if (awakened > 0) - { - if (awakened >= (quanty / 2)) - { + if (awakened > 0) { + if (awakened >= (quanty / 2)) { st.takeItems(AWAKENED_MUCROKIAN_HIDE, (quanty / 2)); return true; - } - else if (mucrokian >= (quanty - (awakened * 2))) - { + } else if (mucrokian >= (quanty - (awakened * 2))) { st.takeItems(AWAKENED_MUCROKIAN_HIDE, awakened); st.takeItems(MUCROKIAN_HIDE, (quanty - (awakened * 2))); return true; } - } - else if (mucrokian >= quanty) - { + } else if (mucrokian >= quanty) { st.takeItems(MUCROKIAN_HIDE, quanty); return true; } @@ -128,17 +116,14 @@ public class Q00308_ReedFieldMaintenance extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "32646-02.htm": case "32646-03.htm": case "32646-06.html": @@ -187,45 +172,32 @@ public class Q00308_ReedFieldMaintenance extends Quest return htmltext; } - private String onItemExchangeRequest(QuestState st, int item, int quanty) - { + private String onItemExchangeRequest(QuestState st, int item, int quanty) { String htmltext; - if (canGiveItem(st, quanty)) - { - if (Util.contains(MOIRAI_PIECES, item)) - { + if (canGiveItem(st, quanty)) { + if (Util.contains(MOIRAI_PIECES, item)) { st.giveItems(item, getRandom(1, 4)); - } - else - { + } else { st.giveItems(item, 1); } st.playSound(Sound.ITEMSOUND_QUEST_FINISH); htmltext = "32646-14.html"; - } - else - { + } else { htmltext = "32646-13.html"; } return htmltext; } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(killer, 1); - if (partyMember != null) - { + if (partyMember != null) { final QuestState st = getQuestState(partyMember, false); double chance = MUCROKIAN.get(npc.getId()) * rates().getRateQuestDrop(); - if (getRandom(1000) < chance) - { - if (npc.getId() == AWAKENED_MUCROKIAN) - { + if (getRandom(1000) < chance) { + if (npc.getId() == AWAKENED_MUCROKIAN) { st.giveItems(AWAKENED_MUCROKIAN_HIDE, 1); - } - else - { + } else { st.giveItems(MUCROKIAN_HIDE, 1); } st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); @@ -235,21 +207,15 @@ public class Q00308_ReedFieldMaintenance extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { String htmltext = getNoQuestMsg(talker); final QuestState st = getQuestState(talker, true); final QuestState q309 = talker.getQuestState(Q00309_ForAGoodCause.class.getSimpleName()); - if ((q309 != null) && q309.isStarted()) - { + if ((q309 != null) && q309.isStarted()) { htmltext = "32646-15.html"; - } - else if (st.isStarted()) - { + } else if (st.isStarted()) { htmltext = (st.hasQuestItems(MUCROKIAN_HIDE) || st.hasQuestItems(AWAKENED_MUCROKIAN_HIDE)) ? "32646-06.html" : "32646-05.html"; - } - else - { + } else { htmltext = (talker.getLevel() >= MIN_LEVEL) ? "32646-01.htm" : "32646-00.html"; } return htmltext; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00309_ForAGoodCause/Q00309_ForAGoodCause.java b/src/main/java/com/l2jserver/datapack/quests/Q00309_ForAGoodCause/Q00309_ForAGoodCause.java index c2fddf1a7c..8b6b9a6546 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00309_ForAGoodCause/Q00309_ForAGoodCause.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00309_ForAGoodCause/Q00309_ForAGoodCause.java @@ -38,15 +38,13 @@ import com.l2jserver.gameserver.util.Util; * @author nonom, Zoey76, Joxit * @version 2011/09/30 based on official server Naia */ -public class Q00309_ForAGoodCause extends Quest -{ +public class Q00309_ForAGoodCause extends Quest { // NPC private static final int ATRA = 32647; // Mobs private static final int CORRUPTED_MUCROKIAN = 22654; private static final Map<Integer, Integer> MUCROKIANS = new HashMap<>(); - static - { + static { MUCROKIANS.put(22650, 218); // Mucrokian Fanatic MUCROKIANS.put(22651, 258); // Mucrokian Ascetic MUCROKIANS.put(22652, 248); // Mucrokian Savior @@ -64,8 +62,7 @@ public class Q00309_ForAGoodCause extends Quest private static final int REC_DYNASTY_RING_70 = 9987; private static final int REC_DYNASTY_SIGIL_60 = 10115; - private static final int[] MOIRAI_RECIPES = - { + private static final int[] MOIRAI_RECIPES = { 15777, 15780, 15783, @@ -77,8 +74,7 @@ public class Q00309_ForAGoodCause extends Quest 15812 }; - private static final int[] MOIRAI_PIECES = - { + private static final int[] MOIRAI_PIECES = { 15647, 15650, 15653, @@ -93,34 +89,26 @@ public class Q00309_ForAGoodCause extends Quest // Misc private static final int MIN_LEVEL = 82; - public Q00309_ForAGoodCause() - { + public Q00309_ForAGoodCause() { super(309, Q00309_ForAGoodCause.class.getSimpleName(), "For A Good Cause"); addStartNpc(ATRA); addTalkId(ATRA); addKillId(MUCROKIANS.keySet()); } - private boolean canGiveItem(QuestState st, int quanty) - { + private boolean canGiveItem(QuestState st, int quanty) { long mucrokian = st.getQuestItemsCount(MUCROKIAN_HIDE); long fallen = st.getQuestItemsCount(FALLEN_MUCROKIAN_HIDE); - if (fallen > 0) - { - if (fallen >= (quanty / 2)) - { + if (fallen > 0) { + if (fallen >= (quanty / 2)) { st.takeItems(FALLEN_MUCROKIAN_HIDE, (quanty / 2)); return true; - } - else if (mucrokian >= (quanty - (fallen * 2))) - { + } else if (mucrokian >= (quanty - (fallen * 2))) { st.takeItems(FALLEN_MUCROKIAN_HIDE, fallen); st.takeItems(MUCROKIAN_HIDE, (quanty - (fallen * 2))); return true; } - } - else if (mucrokian >= quanty) - { + } else if (mucrokian >= quanty) { st.takeItems(MUCROKIAN_HIDE, quanty); return true; } @@ -128,17 +116,14 @@ public class Q00309_ForAGoodCause extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "32647-02.htm": case "32647-03.htm": case "32647-04.htm": @@ -189,46 +174,33 @@ public class Q00309_ForAGoodCause extends Quest return htmltext; } - private String onItemExchangeRequest(QuestState st, int item, int quanty) - { + private String onItemExchangeRequest(QuestState st, int item, int quanty) { String htmltext; - if (canGiveItem(st, quanty)) - { - if (Util.contains(MOIRAI_PIECES, item)) - { + if (canGiveItem(st, quanty)) { + if (Util.contains(MOIRAI_PIECES, item)) { st.giveItems(item, getRandom(1, 4)); - } - else - { + } else { st.giveItems(item, 1); } st.playSound(Sound.ITEMSOUND_QUEST_FINISH); htmltext = "32646-16.htm"; - } - else - { + } else { htmltext = "32646-15.htm"; } return htmltext; } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(killer, 1); - if (partyMember != null) - { + if (partyMember != null) { final QuestState st = getQuestState(partyMember, false); double chance = MUCROKIANS.get(npc.getId()) * rates().getRateQuestDrop(); - if (getRandom(1000) < chance) - { - if (npc.getId() == CORRUPTED_MUCROKIAN) - { + if (getRandom(1000) < chance) { + if (npc.getId() == CORRUPTED_MUCROKIAN) { st.giveItems(FALLEN_MUCROKIAN_HIDE, 1); st.rewardItems(FALLEN_MUCROKIAN_HIDE, 1); - } - else - { + } else { st.giveItems(MUCROKIAN_HIDE, 1); } st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); @@ -238,21 +210,15 @@ public class Q00309_ForAGoodCause extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { String htmltext = getNoQuestMsg(talker); final QuestState st = getQuestState(talker, true); final QuestState q308 = talker.getQuestState(Q00308_ReedFieldMaintenance.class.getSimpleName()); - if ((q308 != null) && q308.isStarted()) - { + if ((q308 != null) && q308.isStarted()) { htmltext = "32647-17.html"; - } - else if (st.isStarted()) - { + } else if (st.isStarted()) { htmltext = (st.hasQuestItems(MUCROKIAN_HIDE) || st.hasQuestItems(FALLEN_MUCROKIAN_HIDE)) ? "32647-08.html" : "32647-06.html"; - } - else - { + } else { htmltext = (talker.getLevel() >= MIN_LEVEL) ? "32647-01.htm" : "32647-00.html"; } return htmltext; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00310_OnlyWhatRemains/Q00310_OnlyWhatRemains.java b/src/main/java/com/l2jserver/datapack/quests/Q00310_OnlyWhatRemains/Q00310_OnlyWhatRemains.java index 83f5a74861..2217550fc8 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00310_OnlyWhatRemains/Q00310_OnlyWhatRemains.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00310_OnlyWhatRemains/Q00310_OnlyWhatRemains.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by Gnacik * @author malyelfik */ -public class Q00310_OnlyWhatRemains extends Quest -{ +public class Q00310_OnlyWhatRemains extends Quest { // NPC private static final int KINTAIJIN = 32640; // Items @@ -45,8 +44,7 @@ public class Q00310_OnlyWhatRemains extends Quest // Monsters private static final Map<Integer, Integer> MOBS = new HashMap<>(); - static - { + static { MOBS.put(22617, 646); MOBS.put(22618, 646); MOBS.put(22619, 646); @@ -66,8 +64,7 @@ public class Q00310_OnlyWhatRemains extends Quest MOBS.put(22633, 638); } - public Q00310_OnlyWhatRemains() - { + public Q00310_OnlyWhatRemains() { super(310, Q00310_OnlyWhatRemains.class.getSimpleName(), "Only What Remains"); addStartNpc(KINTAIJIN); addTalkId(KINTAIJIN); @@ -76,18 +73,15 @@ public class Q00310_OnlyWhatRemains extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "32640-04.htm": st.startQuest(); break; @@ -108,19 +102,16 @@ public class Q00310_OnlyWhatRemains extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(player, 1); - if (partyMember == null) - { + if (partyMember == null) { return super.onKill(npc, player, isSummon); } final QuestState st = getQuestState(partyMember, false); - if (getRandom(1000) < MOBS.get(npc.getId())) - { + if (getRandom(1000) < MOBS.get(npc.getId())) { st.giveItems(DIRTY_BEAD, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -128,26 +119,19 @@ public class Q00310_OnlyWhatRemains extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = ((player.getLevel() >= 81) && player.hasQuestCompleted(Q00240_ImTheOnlyOneYouCanTrust.class.getSimpleName())) ? "32640-01.htm" : "32640-00.htm"; break; case State.STARTED: - if (!st.hasQuestItems(DIRTY_BEAD)) - { + if (!st.hasQuestItems(DIRTY_BEAD)) { htmltext = "32640-08.html"; - } - else if (st.getQuestItemsCount(DIRTY_BEAD) < 500) - { + } else if (st.getQuestItemsCount(DIRTY_BEAD) < 500) { htmltext = "32640-09.html"; - } - else - { + } else { st.takeItems(DIRTY_BEAD, 500); st.giveItems(GROW_ACCELERATOR, 1); st.giveItems(MULTI_COLORED_JEWEL, 1); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00311_ExpulsionOfEvilSpirits/Q00311_ExpulsionOfEvilSpirits.java b/src/main/java/com/l2jserver/datapack/quests/Q00311_ExpulsionOfEvilSpirits/Q00311_ExpulsionOfEvilSpirits.java index 323fbb2f92..ba019b2586 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00311_ExpulsionOfEvilSpirits/Q00311_ExpulsionOfEvilSpirits.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00311_ExpulsionOfEvilSpirits/Q00311_ExpulsionOfEvilSpirits.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Expulsion of Evil Spirits (311) * @author Zoey76 */ -public final class Q00311_ExpulsionOfEvilSpirits extends Quest -{ +public final class Q00311_ExpulsionOfEvilSpirits extends Quest { // NPC private static final int CHAIREN = 32655; // Items @@ -46,8 +45,7 @@ public final class Q00311_ExpulsionOfEvilSpirits extends Quest private static final int RAGNA_ORCS_AMULET_COUNT = 10; // Monsters private static final Map<Integer, Double> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(22691, 0.694); // Ragna Orc MONSTERS.put(22692, 0.716); // Ragna Orc Warrior MONSTERS.put(22693, 0.736); // Ragna Orc Hero @@ -61,8 +59,7 @@ public final class Q00311_ExpulsionOfEvilSpirits extends Quest MONSTERS.put(22702, 0.662); // Varangka's Destroyer } - public Q00311_ExpulsionOfEvilSpirits() - { + public Q00311_ExpulsionOfEvilSpirits() { super(311, Q00311_ExpulsionOfEvilSpirits.class.getSimpleName(), "Expulsion of Evil Spirits"); addStartNpc(CHAIREN); addTalkId(CHAIREN); @@ -71,57 +68,43 @@ public final class Q00311_ExpulsionOfEvilSpirits extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - if (player.getLevel() < MIN_LEVEL) - { + if (player.getLevel() < MIN_LEVEL) { return null; } - switch (event) - { + switch (event) { case "32655-03.htm": - case "32655-15.html": - { + case "32655-15.html": { htmltext = event; break; } - case "32655-04.htm": - { + case "32655-04.htm": { qs.startQuest(); htmltext = event; break; } - case "32655-11.html": - { - if (getQuestItemsCount(player, SOUL_CORE_CONTAINING_EVIL_SPIRIT) >= SOUL_CORE_COUNT) - { + case "32655-11.html": { + if (getQuestItemsCount(player, SOUL_CORE_CONTAINING_EVIL_SPIRIT) >= SOUL_CORE_COUNT) { takeItems(player, SOUL_CORE_CONTAINING_EVIL_SPIRIT, SOUL_CORE_COUNT); giveItems(player, PROTECTION_SOULS_PENDANT, 1); htmltext = event; - } - else - { + } else { htmltext = "32655-12.html"; } break; } - case "32655-13.html": - { - if (!hasQuestItems(player, SOUL_CORE_CONTAINING_EVIL_SPIRIT) && (getQuestItemsCount(player, RAGNA_ORCS_AMULET) >= RAGNA_ORCS_AMULET_COUNT)) - { + case "32655-13.html": { + if (!hasQuestItems(player, SOUL_CORE_CONTAINING_EVIL_SPIRIT) && (getQuestItemsCount(player, RAGNA_ORCS_AMULET) >= RAGNA_ORCS_AMULET_COUNT)) { qs.exitQuest(true, true); htmltext = event; - } - else - { + } else { htmltext = "32655-14.html"; } break; @@ -131,20 +114,15 @@ public final class Q00311_ExpulsionOfEvilSpirits extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, 1, 2, npc); - if (qs != null) - { + if (qs != null) { final int count = qs.getMemoStateEx(1) + 1; - if ((count >= RAGNA_ORCS_KILLS_COUNT) && (getRandom(20) < ((count % 100) + 1))) - { + if ((count >= RAGNA_ORCS_KILLS_COUNT) && (getRandom(20) < ((count % 100) + 1))) { qs.setMemoStateEx(1, 0); qs.giveItems(SOUL_CORE_CONTAINING_EVIL_SPIRIT, 1); qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - } - else - { + } else { qs.setMemoStateEx(1, count); } @@ -154,16 +132,12 @@ public final class Q00311_ExpulsionOfEvilSpirits extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { + if (qs.isCreated()) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "32655-01.htm" : "32655-02.htm"; - } - else if (qs.isStarted()) - { + } else if (qs.isStarted()) { htmltext = !hasQuestItems(player, SOUL_CORE_CONTAINING_EVIL_SPIRIT, RAGNA_ORCS_AMULET) ? "32655-05.html" : "32655-06.html"; } return htmltext; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00312_TakeAdvantageOfTheCrisis/Q00312_TakeAdvantageOfTheCrisis.java b/src/main/java/com/l2jserver/datapack/quests/Q00312_TakeAdvantageOfTheCrisis/Q00312_TakeAdvantageOfTheCrisis.java index 3b9262ac7f..be3a2cc654 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00312_TakeAdvantageOfTheCrisis/Q00312_TakeAdvantageOfTheCrisis.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00312_TakeAdvantageOfTheCrisis/Q00312_TakeAdvantageOfTheCrisis.java @@ -32,14 +32,12 @@ import com.l2jserver.gameserver.model.quest.State; * Take Advantage of the Crisis! (312) * @author malyelfik */ -public class Q00312_TakeAdvantageOfTheCrisis extends Quest -{ +public class Q00312_TakeAdvantageOfTheCrisis extends Quest { // NPC private static final int FILAUR = 30535; // Monsters private static final Map<Integer, Integer> MOBS = new HashMap<>(); - static - { + static { MOBS.put(22678, 291); // Grave Robber Summoner (Lunatic) MOBS.put(22679, 596); // Grave Robber Magician (Lunatic) MOBS.put(22680, 610); // Grave Robber Worker (Lunatic) @@ -59,8 +57,7 @@ public class Q00312_TakeAdvantageOfTheCrisis extends Quest // Misc private static final int MIN_LEVEL = 80; - public Q00312_TakeAdvantageOfTheCrisis() - { + public Q00312_TakeAdvantageOfTheCrisis() { super(312, Q00312_TakeAdvantageOfTheCrisis.class.getSimpleName(), "Take Advantage of the Crisis!"); addStartNpc(FILAUR); addTalkId(FILAUR); @@ -69,17 +66,14 @@ public class Q00312_TakeAdvantageOfTheCrisis extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "30535-02.html": case "30535-03.html": case "30535-04.html": @@ -101,11 +95,9 @@ public class Q00312_TakeAdvantageOfTheCrisis extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance member = getRandomPartyMember(player, 1); - if ((member != null) && (getRandom(1000) < MOBS.get(npc.getId()))) - { + if ((member != null) && (getRandom(1000) < MOBS.get(npc.getId()))) { final QuestState st = getQuestState(member, false); st.giveItems(MINERAL_FRAGMENT, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); @@ -114,12 +106,10 @@ public class Q00312_TakeAdvantageOfTheCrisis extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? "30535-01.htm" : "30535-00.htm"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00313_CollectSpores/Q00313_CollectSpores.java b/src/main/java/com/l2jserver/datapack/quests/Q00313_CollectSpores/Q00313_CollectSpores.java index dd771741ea..c467c968b6 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00313_CollectSpores/Q00313_CollectSpores.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00313_CollectSpores/Q00313_CollectSpores.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.util.Util; * Collect Spores (313) * @author ivantotov */ -public final class Q00313_CollectSpores extends Quest -{ +public final class Q00313_CollectSpores extends Quest { // NPC private static final int HERBIEL = 30150; // Item @@ -41,8 +40,7 @@ public final class Q00313_CollectSpores extends Quest // Monster private static final int SPORE_FUNGUS = 20509; - public Q00313_CollectSpores() - { + public Q00313_CollectSpores() { super(313, Q00313_CollectSpores.class.getSimpleName(), "Collect Spores"); addStartNpc(HERBIEL); addTalkId(HERBIEL); @@ -51,27 +49,21 @@ public final class Q00313_CollectSpores extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "30150-05.htm": - { - if (st.isCreated()) - { + switch (event) { + case "30150-05.htm": { + if (st.isCreated()) { st.startQuest(); htmltext = event; } break; } - case "30150-04.htm": - { + case "30150-04.htm": { htmltext = event; break; } @@ -80,13 +72,10 @@ public final class Q00313_CollectSpores extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, killer, false)) - { - if (st.giveItemRandomly(npc, SPORE_SAC, 1, REQUIRED_SAC_COUNT, 0.4, true)) - { + if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, killer, false)) { + if (st.giveItemRandomly(npc, SPORE_SAC, 1, REQUIRED_SAC_COUNT, 0.4, true)) { st.setCond(2); } } @@ -94,33 +83,24 @@ public final class Q00313_CollectSpores extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = player.getLevel() >= MIN_LEVEL ? "30150-03.htm" : "30150-02.htm"; break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { - if (st.getQuestItemsCount(SPORE_SAC) < REQUIRED_SAC_COUNT) - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { + if (st.getQuestItemsCount(SPORE_SAC) < REQUIRED_SAC_COUNT) { htmltext = "30150-06.html"; } break; } - case 2: - { - if (st.getQuestItemsCount(SPORE_SAC) >= REQUIRED_SAC_COUNT) - { + case 2: { + if (st.getQuestItemsCount(SPORE_SAC) >= REQUIRED_SAC_COUNT) { st.giveAdena(3500, true); st.exitQuest(true, true); htmltext = "30150-07.html"; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00316_DestroyPlagueCarriers/Q00316_DestroyPlagueCarriers.java b/src/main/java/com/l2jserver/datapack/quests/Q00316_DestroyPlagueCarriers/Q00316_DestroyPlagueCarriers.java index e001ee3d44..a7d18532ab 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00316_DestroyPlagueCarriers/Q00316_DestroyPlagueCarriers.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00316_DestroyPlagueCarriers/Q00316_DestroyPlagueCarriers.java @@ -35,8 +35,7 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * Destroy Plague Carriers (316) * @author ivantotov */ -public final class Q00316_DestroyPlagueCarriers extends Quest -{ +public final class Q00316_DestroyPlagueCarriers extends Quest { // NPC private static final int ELLENIA = 30155; // Items @@ -47,15 +46,13 @@ public final class Q00316_DestroyPlagueCarriers extends Quest // Monsters private static final int VAROOL_FOULCLAW = 27020; private static final Map<Integer, ItemHolder> MONSTER_DROPS = new HashMap<>(); - static - { + static { MONSTER_DROPS.put(20040, new ItemHolder(WERERAT_FANG, 5)); // Sukar Wererat MONSTER_DROPS.put(20047, new ItemHolder(WERERAT_FANG, 5)); // Sukar Wererat Leader MONSTER_DROPS.put(VAROOL_FOULCLAW, new ItemHolder(VAROOL_FOULCLAW_FANG, 7)); // Varool Foulclaw } - public Q00316_DestroyPlagueCarriers() - { + public Q00316_DestroyPlagueCarriers() { super(316, Q00316_DestroyPlagueCarriers.class.getSimpleName(), "Destroy Plague Carriers"); addStartNpc(ELLENIA); addTalkId(ELLENIA); @@ -65,40 +62,32 @@ public final class Q00316_DestroyPlagueCarriers extends Quest } @Override - public boolean checkPartyMember(QuestState qs, L2Npc npc) - { + public boolean checkPartyMember(QuestState qs, L2Npc npc) { return ((npc.getId() != VAROOL_FOULCLAW) || !qs.hasQuestItems(VAROOL_FOULCLAW_FANG)); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { - case "30155-04.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "30155-04.htm": { + if (qs.isCreated()) { qs.startQuest(); htmltext = event; } break; } - case "30155-08.html": - { + case "30155-08.html": { qs.exitQuest(true, true); htmltext = event; break; } - case "30155-09.html": - { + case "30155-09.html": { htmltext = event; break; } @@ -107,10 +96,8 @@ public final class Q00316_DestroyPlagueCarriers extends Quest } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (npc.isScriptValue(0)) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (npc.isScriptValue(0)) { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.WHY_DO_YOU_OPPRESS_US_SO)); npc.setScriptValue(1); } @@ -118,11 +105,9 @@ public final class Q00316_DestroyPlagueCarriers extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc); - if (qs != null) - { + if (qs != null) { final ItemHolder item = MONSTER_DROPS.get(npc.getId()); final int limit = (npc.getId() == VAROOL_FOULCLAW ? 1 : 0); giveItemRandomly(qs.getPlayer(), npc, item.getId(), 1, limit, 10.0 / item.getCount(), true); @@ -131,37 +116,25 @@ public final class Q00316_DestroyPlagueCarriers extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (player.getRace() != Race.ELF) - { + if (qs.isCreated()) { + if (player.getRace() != Race.ELF) { htmltext = "30155-00.htm"; - } - else if (player.getLevel() < MIN_LEVEL) - { + } else if (player.getLevel() < MIN_LEVEL) { htmltext = "30155-02.htm"; - } - else - { + } else { htmltext = "30155-03.htm"; } - } - else if (qs.isStarted()) - { - if (hasAtLeastOneQuestItem(player, getRegisteredItemIds())) - { + } else if (qs.isStarted()) { + if (hasAtLeastOneQuestItem(player, getRegisteredItemIds())) { final long wererars = getQuestItemsCount(player, WERERAT_FANG); final long foulclaws = getQuestItemsCount(player, VAROOL_FOULCLAW_FANG); giveAdena(player, ((wererars * 30) + (foulclaws * 10000) + ((wererars + foulclaws) >= 10 ? 5000 : 0)), true); takeItems(player, -1, getRegisteredItemIds()); htmltext = "30155-07.html"; - } - else - { + } else { htmltext = "30155-05.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00317_CatchTheWind/Q00317_CatchTheWind.java b/src/main/java/com/l2jserver/datapack/quests/Q00317_CatchTheWind/Q00317_CatchTheWind.java index d078a51667..a6b2a51463 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00317_CatchTheWind/Q00317_CatchTheWind.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00317_CatchTheWind/Q00317_CatchTheWind.java @@ -27,8 +27,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Catch The Wind (317) * @author ivantotov */ -public final class Q00317_CatchTheWind extends Quest -{ +public final class Q00317_CatchTheWind extends Quest { // NPC private static final int RIZRAELL = 30361; // Item @@ -37,14 +36,12 @@ public final class Q00317_CatchTheWind extends Quest private static final int MIN_LEVEL = 18; private static final double DROP_CHANCE = 0.5; // Monsters - private static final int[] MONSTERS = - { + private static final int[] MONSTERS = { 20036, // Lirein 20044, // Lirein Elder }; - public Q00317_CatchTheWind() - { + public Q00317_CatchTheWind() { super(317, Q00317_CatchTheWind.class.getSimpleName(), "Catch The Wind"); addStartNpc(RIZRAELL); addTalkId(RIZRAELL); @@ -53,38 +50,30 @@ public final class Q00317_CatchTheWind extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { - case "30361-04.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "30361-04.htm": { + if (qs.isCreated()) { qs.startQuest(); htmltext = event; } break; } case "30361-08.html": - case "30361-09.html": - { + case "30361-09.html": { final long shardCount = getQuestItemsCount(player, WIND_SHARD); - if (shardCount > 0) - { + if (shardCount > 0) { giveAdena(player, ((shardCount * 40) + (shardCount >= 10 ? 2988 : 0)), true); takeItems(player, WIND_SHARD, -1); } - if (event.equals("30361-08.html")) - { + if (event.equals("30361-08.html")) { qs.exitQuest(true, true); } @@ -96,27 +85,21 @@ public final class Q00317_CatchTheWind extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc); - if (qs != null) - { + if (qs != null) { giveItemRandomly(qs.getPlayer(), npc, WIND_SHARD, 1, 0, DROP_CHANCE, true); } return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { + if (qs.isCreated()) { htmltext = ((player.getLevel() >= MIN_LEVEL) ? "30361-03.htm" : "30361-02.htm"); - } - else if (qs.isStarted()) - { + } else if (qs.isStarted()) { htmltext = (hasQuestItems(player, WIND_SHARD) ? "30361-07.html" : "30361-05.html"); } return htmltext; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00319_ScentOfDeath/Q00319_ScentOfDeath.java b/src/main/java/com/l2jserver/datapack/quests/Q00319_ScentOfDeath/Q00319_ScentOfDeath.java index cc6d7f4f83..cded21cd72 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00319_ScentOfDeath/Q00319_ScentOfDeath.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00319_ScentOfDeath/Q00319_ScentOfDeath.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Scent of Death (319) * @author Zoey76 */ -public class Q00319_ScentOfDeath extends Quest -{ +public class Q00319_ScentOfDeath extends Quest { // NPC private static final int MINALESS = 30138; // Monsters @@ -46,8 +45,7 @@ public class Q00319_ScentOfDeath extends Quest private static final int MIN_CHANCE = 7; private static final int REQUIRED_ITEM_COUNT = 5; - public Q00319_ScentOfDeath() - { + public Q00319_ScentOfDeath() { super(319, Q00319_ScentOfDeath.class.getSimpleName(), "Scent of Death"); addStartNpc(MINALESS); addTalkId(MINALESS); @@ -56,21 +54,16 @@ public class Q00319_ScentOfDeath extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - if (player.getLevel() >= MIN_LEVEL) - { - switch (event) - { - case "30138-04.htm": - { + if (player.getLevel() >= MIN_LEVEL) { + switch (event) { + case "30138-04.htm": { st.startQuest(); htmltext = event; break; @@ -81,20 +74,14 @@ public class Q00319_ScentOfDeath extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && Util.checkIfInRange(1500, npc, killer, false) && (st.getQuestItemsCount(ZOMBIES_SKIN) < REQUIRED_ITEM_COUNT)) - { - if (getRandom(10) > MIN_CHANCE) - { + if ((st != null) && Util.checkIfInRange(1500, npc, killer, false) && (st.getQuestItemsCount(ZOMBIES_SKIN) < REQUIRED_ITEM_COUNT)) { + if (getRandom(10) > MIN_CHANCE) { st.giveItems(ZOMBIES_SKIN, 1); - if (st.getQuestItemsCount(ZOMBIES_SKIN) < REQUIRED_ITEM_COUNT) - { + if (st.getQuestItemsCount(ZOMBIES_SKIN) < REQUIRED_ITEM_COUNT) { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - } - else - { + } else { st.setCond(2, true); } } @@ -103,28 +90,21 @@ public class Q00319_ScentOfDeath extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = player.getLevel() >= MIN_LEVEL ? "30138-03.htm" : "30138-02.htm"; break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "30138-05.html"; break; } - case 2: - { + case 2: { st.giveAdena(3350, false); st.giveItems(LESSER_HEALING_POTION); st.takeItems(ZOMBIES_SKIN, -1); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00320_BonesTellTheFuture/Q00320_BonesTellTheFuture.java b/src/main/java/com/l2jserver/datapack/quests/Q00320_BonesTellTheFuture/Q00320_BonesTellTheFuture.java index 6349f3fbff..6481166730 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00320_BonesTellTheFuture/Q00320_BonesTellTheFuture.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00320_BonesTellTheFuture/Q00320_BonesTellTheFuture.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * Bones Tell The Future (320) * @author ivantotov */ -public final class Q00320_BonesTellTheFuture extends Quest -{ +public final class Q00320_BonesTellTheFuture extends Quest { // NPC private static final int TETRACH_KAITAR = 30359; // Item @@ -40,14 +39,12 @@ public final class Q00320_BonesTellTheFuture extends Quest private static final int REQUIRED_BONE_COUNT = 10; private static final double DROP_CHANCE = 0.18; // Monsters - private static final int[] MONSTERS = - { + private static final int[] MONSTERS = { 20517, // Skeleton Hunter 20518, // Skeleton Hunter Archer }; - public Q00320_BonesTellTheFuture() - { + public Q00320_BonesTellTheFuture() { super(320, Q00320_BonesTellTheFuture.class.getSimpleName(), "Bones Tell The Future"); addStartNpc(TETRACH_KAITAR); addTalkId(TETRACH_KAITAR); @@ -56,11 +53,9 @@ public final class Q00320_BonesTellTheFuture extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && event.equals("30359-04.htm")) - { + if ((st != null) && event.equals("30359-04.htm")) { st.startQuest(); return event; } @@ -68,38 +63,29 @@ public final class Q00320_BonesTellTheFuture extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc); - if ((qs != null) && qs.giveItemRandomly(npc, BONE_FRAGMENT, 1, REQUIRED_BONE_COUNT, DROP_CHANCE, true)) - { + if ((qs != null) && qs.giveItemRandomly(npc, BONE_FRAGMENT, 1, REQUIRED_BONE_COUNT, DROP_CHANCE, true)) { qs.setCond(2); } return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getRace() == Race.DARK_ELF) ? (player.getLevel() >= MIN_LEVEL) ? "30359-03.htm" : "30359-02.htm" : "30359-00.htm"; break; } - case State.STARTED: - { - if (st.getQuestItemsCount(BONE_FRAGMENT) >= REQUIRED_BONE_COUNT) - { + case State.STARTED: { + if (st.getQuestItemsCount(BONE_FRAGMENT) >= REQUIRED_BONE_COUNT) { htmltext = "30359-06.html"; st.giveAdena(8470, true); st.exitQuest(true, true); - } - else - { + } else { htmltext = "30359-05.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00324_SweetestVenom/Q00324_SweetestVenom.java b/src/main/java/com/l2jserver/datapack/quests/Q00324_SweetestVenom/Q00324_SweetestVenom.java index f68de8226e..dc83ee6b82 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00324_SweetestVenom/Q00324_SweetestVenom.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00324_SweetestVenom/Q00324_SweetestVenom.java @@ -32,14 +32,12 @@ import com.l2jserver.gameserver.model.quest.State; * Sweetest Venom (324) * @author xban1x */ -public class Q00324_SweetestVenom extends Quest -{ +public class Q00324_SweetestVenom extends Quest { // NPCs private static final int ASTARON = 30351; // Monsters private static final Map<Integer, Integer> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(20034, 26); MONSTERS.put(20038, 29); MONSTERS.put(20043, 30); @@ -51,8 +49,7 @@ public class Q00324_SweetestVenom extends Quest private static final int REQUIRED_COUNT = 10; private static final int ADENA_COUNT = 5810; - public Q00324_SweetestVenom() - { + public Q00324_SweetestVenom() { super(324, Q00324_SweetestVenom.class.getSimpleName(), "Sweetest Venom"); addStartNpc(ASTARON); addTalkId(ASTARON); @@ -61,14 +58,11 @@ public class Q00324_SweetestVenom extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st != null) - { - if (event.equals("30351-04.htm")) - { + if (st != null) { + if (event.equals("30351-04.htm")) { st.startQuest(); htmltext = event; } @@ -77,27 +71,20 @@ public class Q00324_SweetestVenom extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = player.getLevel() < MIN_LVL ? "30351-02.html" : "30351-03.htm"; break; } - case State.STARTED: - { - if (st.isCond(2)) - { + case State.STARTED: { + if (st.isCond(2)) { st.giveAdena(ADENA_COUNT, true); st.exitQuest(true, true); htmltext = "30351-06.html"; - } - else - { + } else { htmltext = "30351-05.html"; } break; @@ -107,23 +94,16 @@ public class Q00324_SweetestVenom extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isCond(1)) - { + if ((st != null) && st.isCond(1)) { long sacs = st.getQuestItemsCount(VENOM_SAC); - if (sacs < REQUIRED_COUNT) - { - if (getRandom(100) < MONSTERS.get(npc.getId())) - { + if (sacs < REQUIRED_COUNT) { + if (getRandom(100) < MONSTERS.get(npc.getId())) { st.giveItems(VENOM_SAC, 1); - if ((++sacs) < REQUIRED_COUNT) - { + if ((++sacs) < REQUIRED_COUNT) { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - } - else - { + } else { st.setCond(2, true); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00325_GrimCollector/Q00325_GrimCollector.java b/src/main/java/com/l2jserver/datapack/quests/Q00325_GrimCollector/Q00325_GrimCollector.java index 5161a02cef..1ace8062c3 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00325_GrimCollector/Q00325_GrimCollector.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00325_GrimCollector/Q00325_GrimCollector.java @@ -35,8 +35,7 @@ import com.l2jserver.gameserver.util.Util; * Grim Collector (325) * @author ivantotov */ -public final class Q00325_GrimCollector extends Quest -{ +public final class Q00325_GrimCollector extends Quest { // NPCs private static final int GUARD_CURTIZ = 30336; private static final int VARSAK = 30342; @@ -56,8 +55,7 @@ public final class Q00325_GrimCollector extends Quest private static final int MIN_LEVEL = 15; // Monsters private static final Map<Integer, List<QuestItemHolder>> MONSTER_DROPS = new HashMap<>(); - static - { + static { MONSTER_DROPS.put(20026, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 30), new QuestItemHolder(ZOMBIE_HEART, 50), new QuestItemHolder(ZOMBIE_LIVER, 75))); MONSTER_DROPS.put(20029, Arrays.asList(new QuestItemHolder(ZOMBIE_HEAD, 30), new QuestItemHolder(ZOMBIE_HEART, 52), new QuestItemHolder(ZOMBIE_LIVER, 75))); MONSTER_DROPS.put(20035, Arrays.asList(new QuestItemHolder(SKULL, 5), new QuestItemHolder(RIB_BONE, 15), new QuestItemHolder(SPINE, 29), new QuestItemHolder(THIGH_BONE, 79))); @@ -70,8 +68,7 @@ public final class Q00325_GrimCollector extends Quest MONSTER_DROPS.put(20515, Arrays.asList(new QuestItemHolder(SKULL, 5), new QuestItemHolder(RIB_BONE, 20), new QuestItemHolder(SPINE, 31), new QuestItemHolder(ARM_BONE, 33), new QuestItemHolder(THIGH_BONE, 69))); } - public Q00325_GrimCollector() - { + public Q00325_GrimCollector() { super(325, Q00325_GrimCollector.class.getSimpleName(), "Grim Collector"); addStartNpc(GUARD_CURTIZ); addTalkId(GUARD_CURTIZ, VARSAK, SAMED); @@ -80,63 +77,47 @@ public final class Q00325_GrimCollector extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "30336-03.htm": - { - if (st.isCreated()) - { + switch (event) { + case "30336-03.htm": { + if (st.isCreated()) { st.startQuest(); htmltext = event; } break; } - case "assembleSkeleton": - { - if (!hasQuestItems(player, SPINE, ARM_BONE, SKULL, RIB_BONE, THIGH_BONE)) - { + case "assembleSkeleton": { + if (!hasQuestItems(player, SPINE, ARM_BONE, SKULL, RIB_BONE, THIGH_BONE)) { htmltext = "30342-02.html"; - } - else - { + } else { takeItems(player, 1, SPINE, ARM_BONE, SKULL, RIB_BONE, THIGH_BONE); - if (getRandom(5) < 4) - { + if (getRandom(5) < 4) { giveItems(player, COMPLETE_SKELETON, 1); htmltext = "30342-03.html"; - } - else - { + } else { htmltext = "30342-04.html"; } } break; } - case "30434-02.htm": - { + case "30434-02.htm": { htmltext = event; break; } - case "30434-03.html": - { + case "30434-03.html": { st.giveItems(ANATOMY_DIAGRAM, 1); htmltext = event; break; } case "30434-06.html": - case "30434-07.html": - { - if (hasQuestItems(player, getRegisteredItemIds())) - { + case "30434-07.html": { + if (hasQuestItems(player, getRegisteredItemIds())) { final long head = st.getQuestItemsCount(ZOMBIE_HEAD); final long heart = st.getQuestItemsCount(ZOMBIE_HEART); final long liver = st.getQuestItemsCount(ZOMBIE_LIVER); @@ -147,17 +128,14 @@ public final class Q00325_GrimCollector extends Quest final long thigh = st.getQuestItemsCount(THIGH_BONE); final long complete = st.getQuestItemsCount(COMPLETE_SKELETON); final long totalCount = (head + heart + liver + skull + rib + spine + arm + thigh + complete); - if (totalCount > 0) - { + if (totalCount > 0) { long sum = ((head * 30) + (heart * 20) + (liver * 20) + (skull * 100) + (rib * 40) + (spine * 14) + (arm * 14) + (thigh * 14)); - if (totalCount >= 10) - { + if (totalCount >= 10) { sum += 1629; } - if (complete > 0) - { + if (complete > 0) { sum += 543 + (complete * 341); } @@ -167,19 +145,16 @@ public final class Q00325_GrimCollector extends Quest takeItems(player, -1, getRegisteredItemIds()); } - if (event.equals("30434-06.html")) - { + if (event.equals("30434-06.html")) { st.exitQuest(true, true); } htmltext = event; break; } - case "30434-09.html": - { + case "30434-09.html": { final long complete = st.getQuestItemsCount(COMPLETE_SKELETON); - if (complete > 0) - { + if (complete > 0) { st.giveAdena(((complete * 341) + 543), true); st.takeItems(COMPLETE_SKELETON, -1); } @@ -190,25 +165,20 @@ public final class Q00325_GrimCollector extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs == null) || !qs.isStarted()) - { + if ((qs == null) || !qs.isStarted()) { return super.onKill(npc, killer, isSummon); } - if (!Util.checkIfInRange(1500, killer, npc, true) || !qs.hasQuestItems(ANATOMY_DIAGRAM)) - { + if (!Util.checkIfInRange(1500, killer, npc, true) || !qs.hasQuestItems(ANATOMY_DIAGRAM)) { return super.onKill(npc, killer, isSummon); } final int rnd = getRandom(100); - for (QuestItemHolder drop : MONSTER_DROPS.get(npc.getId())) - { - if (rnd < drop.getChance()) - { + for (QuestItemHolder drop : MONSTER_DROPS.get(npc.getId())) { + if (rnd < drop.getChance()) { qs.giveItemRandomly(npc, drop.getId(), 1, 0, 1.0, true); break; } @@ -217,57 +187,39 @@ public final class Q00325_GrimCollector extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { - case GUARD_CURTIZ: - { - switch (st.getState()) - { - case State.CREATED: - { + switch (npc.getId()) { + case GUARD_CURTIZ: { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getLevel() >= MIN_LEVEL) ? "30336-02.htm" : "30336-01.htm"; break; } - case State.STARTED: - { + case State.STARTED: { htmltext = st.hasQuestItems(ANATOMY_DIAGRAM) ? "30336-05.html" : "30336-04.html"; break; } } break; } - case VARSAK: - { - if (st.isStarted() && st.hasQuestItems(ANATOMY_DIAGRAM)) - { + case VARSAK: { + if (st.isStarted() && st.hasQuestItems(ANATOMY_DIAGRAM)) { htmltext = "30342-01.html"; } break; } - case SAMED: - { - if (st.isStarted()) - { - if (!st.hasQuestItems(ANATOMY_DIAGRAM)) - { + case SAMED: { + if (st.isStarted()) { + if (!st.hasQuestItems(ANATOMY_DIAGRAM)) { htmltext = "30434-01.html"; - } - else - { - if (!hasAtLeastOneQuestItem(player, getRegisteredItemIds())) - { + } else { + if (!hasAtLeastOneQuestItem(player, getRegisteredItemIds())) { htmltext = "30434-04.html"; - } - else if (!st.hasQuestItems(COMPLETE_SKELETON)) - { + } else if (!st.hasQuestItems(COMPLETE_SKELETON)) { htmltext = "30434-05.html"; - } - else - { + } else { htmltext = "30434-08.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00326_VanquishRemnants/Q00326_VanquishRemnants.java b/src/main/java/com/l2jserver/datapack/quests/Q00326_VanquishRemnants/Q00326_VanquishRemnants.java index 3fcf264de5..ed01b9489c 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00326_VanquishRemnants/Q00326_VanquishRemnants.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00326_VanquishRemnants/Q00326_VanquishRemnants.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.model.quest.State; * Vanquish Remnants (326) * @author xban1x */ -public final class Q00326_VanquishRemnants extends Quest -{ +public final class Q00326_VanquishRemnants extends Quest { // NPC private static final int LEOPOLD = 30435; // Items @@ -60,8 +59,7 @@ public final class Q00326_VanquishRemnants extends Quest // Misc private static final int MIN_LVL = 21; - public Q00326_VanquishRemnants() - { + public Q00326_VanquishRemnants() { super(326, Q00326_VanquishRemnants.class.getSimpleName(), "Vanquish Remnants"); addStartNpc(LEOPOLD); addTalkId(LEOPOLD); @@ -70,28 +68,22 @@ public final class Q00326_VanquishRemnants extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st != null) - { - switch (event) - { - case "30435-03.htm": - { + if (st != null) { + switch (event) { + case "30435-03.htm": { st.startQuest(); htmltext = event; break; } - case "30435-07.html": - { + case "30435-07.html": { st.exitQuest(true, true); htmltext = event; break; } - case "30435-08.html": - { + case "30435-08.html": { htmltext = event; break; } @@ -101,11 +93,9 @@ public final class Q00326_VanquishRemnants extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isStarted() && (getRandom(100) < MONSTERS.get(npc.getId())[0])) - { + if ((st != null) && st.isStarted() && (getRandom(100) < MONSTERS.get(npc.getId())[0])) { st.giveItems(MONSTERS.get(npc.getId())[1], 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -113,35 +103,27 @@ public final class Q00326_VanquishRemnants extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getLevel() >= MIN_LVL) ? "30435-02.htm" : "30435-01.htm"; break; } - case State.STARTED: - { + case State.STARTED: { final long red_badges = st.getQuestItemsCount(RED_CROSS_BADGE); final long blue_badges = st.getQuestItemsCount(BLUE_CROSS_BADGE); final long black_badges = st.getQuestItemsCount(BLACK_CROSS_BADGE); final long sum = red_badges + blue_badges + black_badges; - if (sum > 0) - { - if ((sum >= 100) && !st.hasQuestItems(BLACK_LION_MARK)) - { + if (sum > 0) { + if ((sum >= 100) && !st.hasQuestItems(BLACK_LION_MARK)) { st.giveItems(BLACK_LION_MARK, 1); } st.giveAdena(((red_badges * 46) + (blue_badges * 52) + (black_badges * 58) + ((sum >= 10) ? 4320 : 0)), true); takeItems(player, -1, RED_CROSS_BADGE, BLUE_CROSS_BADGE, BLACK_CROSS_BADGE); htmltext = (sum >= 100) ? (st.hasQuestItems(BLACK_LION_MARK)) ? "30435-09.html" : "30435-06.html" : "30435-05.html"; - } - else - { + } else { htmltext = "30435-04.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00327_RecoverTheFarmland/Q00327_RecoverTheFarmland.java b/src/main/java/com/l2jserver/datapack/quests/Q00327_RecoverTheFarmland/Q00327_RecoverTheFarmland.java index 1fcfea8ed5..548d019b9a 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00327_RecoverTheFarmland/Q00327_RecoverTheFarmland.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00327_RecoverTheFarmland/Q00327_RecoverTheFarmland.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * @author GKR */ -public final class Q00327_RecoverTheFarmland extends Quest -{ +public final class Q00327_RecoverTheFarmland extends Quest { // NPCs private static final int IRIS = 30034; private static final int ASHA = 30313; @@ -73,16 +72,14 @@ public final class Q00327_RecoverTheFarmland extends Quest private static final int MIN_LVL = 25; private static final Map<String, ItemHolder> FRAGMENTS_REWARD_DATA = new HashMap<>(4); private static final Map<Integer, Integer> FRAGMENTS_DROP_PROB = new HashMap<>(7); - private static final ItemHolder[] FULL_REWARD_DATA = - { + private static final ItemHolder[] FULL_REWARD_DATA = { new ItemHolder(ANCIENT_CLAY_URN, 2766), new ItemHolder(ANCIENT_BRASS_TIARA, 3227), new ItemHolder(ANCIENT_BRONZE_MIRROR, 3227), new ItemHolder(ANCIENT_JADE_NECKLACE, 3919) }; - static - { + static { FRAGMENTS_REWARD_DATA.put("30034-03.html", new ItemHolder(CLAY_URN_FRAGMENT, 307)); FRAGMENTS_REWARD_DATA.put("30034-04.html", new ItemHolder(BRASS_TRINKET_PIECE, 368)); FRAGMENTS_REWARD_DATA.put("30034-05.html", new ItemHolder(BRONZE_MIRROR_PIECE, 368)); @@ -97,8 +94,7 @@ public final class Q00327_RecoverTheFarmland extends Quest FRAGMENTS_DROP_PROB.put(TUREK_ORK_WARLORD, 26); } - public Q00327_RecoverTheFarmland() - { + public Q00327_RecoverTheFarmland() { super(327, Q00327_RecoverTheFarmland.class.getSimpleName(), "Recover the Farmland"); addStartNpc(LEIKAN, PIOTUR); addTalkId(LEIKAN, PIOTUR, IRIS, ASHA, NESTLE); @@ -107,18 +103,15 @@ public final class Q00327_RecoverTheFarmland extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String html = null; - switch (event) - { + switch (event) { case "30034-01.html": case "30313-01.html": case "30314-02.html": @@ -127,27 +120,23 @@ public final class Q00327_RecoverTheFarmland extends Quest case "30382-05a.html": case "30382-05b.html": case "30597-03.html": - case "30597-07.html": - { + case "30597-07.html": { html = event; break; } - case "30382-03.htm": - { + case "30382-03.htm": { st.startQuest(); giveItems(player, LEIKANS_LETTER, 1); st.setCond(2); html = event; break; } - case "30597-03.htm": - { + case "30597-03.htm": { st.startQuest(); html = event; break; } - case "30597-06.html": - { + case "30597-06.html": { st.exitQuest(true, true); html = event; break; @@ -155,15 +144,11 @@ public final class Q00327_RecoverTheFarmland extends Quest case "30034-03.html": case "30034-04.html": case "30034-05.html": - case "30034-06.html": - { + case "30034-06.html": { final ItemHolder item = FRAGMENTS_REWARD_DATA.get(event); - if (!hasQuestItems(player, item.getId())) - { + if (!hasQuestItems(player, item.getId())) { html = "30034-02.html"; - } - else - { + } else { addExpAndSp(player, getQuestItemsCount(player, item.getId()) * item.getCount(), 0); takeItems(player, item.getId(), -1); playSound(player, Sound.ITEMSOUND_QUEST_ITEMGET); @@ -171,13 +156,10 @@ public final class Q00327_RecoverTheFarmland extends Quest } break; } - case "30034-07.html": - { + case "30034-07.html": { boolean rewarded = false; - for (ItemHolder it : FULL_REWARD_DATA) - { - if (hasQuestItems(player, it.getId())) - { + for (ItemHolder it : FULL_REWARD_DATA) { + if (hasQuestItems(player, it.getId())) { addExpAndSp(player, getQuestItemsCount(player, it.getId()) * it.getCount(), 0); takeItems(player, it.getId(), -1); playSound(player, Sound.ITEMSOUND_QUEST_ITEMGET); @@ -187,123 +169,82 @@ public final class Q00327_RecoverTheFarmland extends Quest html = rewarded ? event : "30034-02.html"; break; } - case "30313-03.html": - { - if (getQuestItemsCount(player, CLAY_URN_FRAGMENT) < 5) - { + case "30313-03.html": { + if (getQuestItemsCount(player, CLAY_URN_FRAGMENT) < 5) { html = "30313-02.html"; - } - else - { + } else { takeItems(player, CLAY_URN_FRAGMENT, 5); - if (getRandom(6) < 5) - { + if (getRandom(6) < 5) { giveItems(player, ANCIENT_CLAY_URN, 1); html = event; - } - else - { + } else { html = "30313-10.html"; } } break; } - case "30313-05.html": - { - if (getQuestItemsCount(player, BRASS_TRINKET_PIECE) < 5) - { + case "30313-05.html": { + if (getQuestItemsCount(player, BRASS_TRINKET_PIECE) < 5) { html = "30313-04.html"; - } - else - { + } else { takeItems(player, BRASS_TRINKET_PIECE, 5); - if (getRandom(7) < 6) - { + if (getRandom(7) < 6) { giveItems(player, ANCIENT_BRASS_TIARA, 1); html = event; - } - else - { + } else { html = "30313-10.html"; } } break; } - case "30313-07.html": - { - if (getQuestItemsCount(player, BRONZE_MIRROR_PIECE) < 5) - { + case "30313-07.html": { + if (getQuestItemsCount(player, BRONZE_MIRROR_PIECE) < 5) { html = "30313-06.html"; - } - else - { + } else { takeItems(player, BRONZE_MIRROR_PIECE, 5); - if (getRandom(7) < 6) - { + if (getRandom(7) < 6) { giveItems(player, ANCIENT_BRONZE_MIRROR, 1); html = event; - } - else - { + } else { html = "30313-10.html"; } } break; } - case "30313-09.html": - { - if (getQuestItemsCount(player, JADE_NECKLACE_BEAD) < 5) - { + case "30313-09.html": { + if (getQuestItemsCount(player, JADE_NECKLACE_BEAD) < 5) { html = "30313-08.html"; - } - else - { + } else { takeItems(player, JADE_NECKLACE_BEAD, 5); - if (getRandom(8) < 7) - { + if (getRandom(8) < 7) { giveItems(player, ANCIENT_JADE_NECKLACE, 1); html = event; - } - else - { + } else { html = "30313-10.html"; } } break; } - case "30314-03.html": - { - if (!hasQuestItems(player, ANCIENT_CLAY_URN)) - { + case "30314-03.html": { + if (!hasQuestItems(player, ANCIENT_CLAY_URN)) { html = "30314-07.html"; - } - else - { + } else { rewardItems(player, SOULSHOT_D, getRandom(70, 110)); takeItems(player, ANCIENT_CLAY_URN, 1); html = event; } break; } - case "30314-04.html": - { - if (!hasQuestItems(player, ANCIENT_BRASS_TIARA)) - { + case "30314-04.html": { + if (!hasQuestItems(player, ANCIENT_BRASS_TIARA)) { html = "30314-07.html"; - } - else - { + } else { final int rnd = getRandom(100); - if (rnd < 40) - { + if (rnd < 40) { rewardItems(player, HEALING_POTION, 1); - } - else if (rnd < 84) - { + } else if (rnd < 84) { rewardItems(player, QUICK_STEP_POTION, 1); - } - else - { + } else { rewardItems(player, SWIFT_ATTACK_POTION, 1); } takeItems(player, ANCIENT_BRASS_TIARA, 1); @@ -311,28 +252,20 @@ public final class Q00327_RecoverTheFarmland extends Quest } break; } - case "30314-05.html": - { - if (!hasQuestItems(player, ANCIENT_BRONZE_MIRROR)) - { + case "30314-05.html": { + if (!hasQuestItems(player, ANCIENT_BRONZE_MIRROR)) { html = "30314-07.html"; - } - else - { + } else { rewardItems(player, (getRandom(100) < 59) ? SCROLL_OF_ESCAPE : SCROLL_OF_RESURRECTION, 1); takeItems(player, ANCIENT_BRONZE_MIRROR, 1); html = event; } break; } - case "30314-06.html": - { - if (!hasQuestItems(player, ANCIENT_JADE_NECKLACE)) - { + case "30314-06.html": { + if (!hasQuestItems(player, ANCIENT_JADE_NECKLACE)) { html = "30314-07.html"; - } - else - { + } else { rewardItems(player, SPIRITSHOT_D, getRandom(50, 90)); takeItems(player, ANCIENT_JADE_NECKLACE, 1); html = event; @@ -345,22 +278,16 @@ public final class Q00327_RecoverTheFarmland extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if (st != null) - { - if ((npc.getId() == TUREK_ORK_SHAMAN) || (npc.getId() == TUREK_ORK_WARLORD)) - { + if (st != null) { + if ((npc.getId() == TUREK_ORK_SHAMAN) || (npc.getId() == TUREK_ORK_WARLORD)) { giveItems(killer, TUREK_MEDALLION, 1); - } - else - { + } else { giveItems(killer, TUREK_DOG_TAG, 1); } - if (getRandom(100) < FRAGMENTS_DROP_PROB.get(npc.getId())) - { + if (getRandom(100) < FRAGMENTS_DROP_PROB.get(npc.getId())) { giveItems(killer, getRandom(CLAY_URN_FRAGMENT, JADE_NECKLACE_BEAD), 1); } } @@ -368,54 +295,35 @@ public final class Q00327_RecoverTheFarmland extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String html = getNoQuestMsg(player); - switch (npc.getId()) - { - case LEIKAN: - { - if (st.isCreated()) - { + switch (npc.getId()) { + case LEIKAN: { + if (st.isCreated()) { html = ((player.getLevel() >= MIN_LVL) ? "30382-02.htm" : "30382-01.htm"); - } - else if (st.isStarted()) - { - if (hasQuestItems(player, LEIKANS_LETTER)) - { + } else if (st.isStarted()) { + if (hasQuestItems(player, LEIKANS_LETTER)) { html = "30382-04.html"; - } - else - { + } else { html = "30382-05.html"; st.setCond(5, true); } } break; } - case PIOTUR: - { - if (st.isCreated()) - { + case PIOTUR: { + if (st.isCreated()) { html = ((player.getLevel() >= MIN_LVL) ? "30597-02.htm" : "30597-01.htm"); - } - else if (st.isStarted()) - { - if (hasQuestItems(player, LEIKANS_LETTER)) - { + } else if (st.isStarted()) { + if (hasQuestItems(player, LEIKANS_LETTER)) { html = "30597-03a.htm"; takeItems(player, LEIKANS_LETTER, -1); st.setCond(3, true); - } - else - { - if (!hasQuestItems(player, TUREK_DOG_TAG) && !hasQuestItems(player, TUREK_MEDALLION)) - { + } else { + if (!hasQuestItems(player, TUREK_DOG_TAG) && !hasQuestItems(player, TUREK_MEDALLION)) { html = "30597-04.html"; - } - else - { + } else { html = "30597-05.html"; final long dogTags = getQuestItemsCount(player, TUREK_DOG_TAG); final long medallions = getQuestItemsCount(player, TUREK_MEDALLION); @@ -429,26 +337,20 @@ public final class Q00327_RecoverTheFarmland extends Quest } break; } - case IRIS: - { - if (st.isStarted()) - { + case IRIS: { + if (st.isStarted()) { html = "30034-01.html"; } break; } - case ASHA: - { - if (st.isStarted()) - { + case ASHA: { + if (st.isStarted()) { html = "30313-01.html"; } break; } - case NESTLE: - { - if (st.isStarted()) - { + case NESTLE: { + if (st.isStarted()) { html = "30314-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00328_SenseForBusiness/Q00328_SenseForBusiness.java b/src/main/java/com/l2jserver/datapack/quests/Q00328_SenseForBusiness/Q00328_SenseForBusiness.java index cae0bd7be2..f254e361a7 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00328_SenseForBusiness/Q00328_SenseForBusiness.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00328_SenseForBusiness/Q00328_SenseForBusiness.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.model.quest.State; * Sense for Business (328) * @author xban1x */ -public class Q00328_SenseForBusiness extends Quest -{ +public class Q00328_SenseForBusiness extends Quest { // NPCs private static final int SARIEN = 30436; private static final Map<Integer, int[]> MONSTER_EYES = new HashMap<>(); @@ -61,8 +60,7 @@ public class Q00328_SenseForBusiness extends Quest private static final int BONUS_COUNT = 10; private static final int MIN_LVL = 21; - public Q00328_SenseForBusiness() - { + public Q00328_SenseForBusiness() { super(328, Q00328_SenseForBusiness.class.getSimpleName(), "Sense for Business"); addStartNpc(SARIEN); addTalkId(SARIEN); @@ -72,22 +70,17 @@ public class Q00328_SenseForBusiness extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st != null) - { - switch (event) - { - case "30436-03.htm": - { + if (st != null) { + switch (event) { + case "30436-03.htm": { st.startQuest(); htmltext = event; break; } - case "30436-06.html": - { + case "30436-06.html": { st.exitQuest(true, true); htmltext = event; break; @@ -98,30 +91,23 @@ public class Q00328_SenseForBusiness extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = player.getLevel() < MIN_LVL ? "30436-01.htm" : "30436-02.htm"; break; } - case State.STARTED: - { + case State.STARTED: { final long carcass = st.getQuestItemsCount(MONSTER_EYE_CARCASS); final long lens = st.getQuestItemsCount(MONSTER_EYE_LENS); final long gizzards = st.getQuestItemsCount(BASILISK_GIZZARD); - if ((carcass + lens + gizzards) > 0) - { + if ((carcass + lens + gizzards) > 0) { st.giveAdena(((carcass * MONSTER_EYE_CARCASS_ADENA) + (lens * MONSTER_EYE_LENS_ADENA) + (gizzards * BASILISK_GIZZARD_ADENA) + ((carcass + lens + gizzards) >= BONUS_COUNT ? BONUS : 0)), true); takeItems(player, -1, MONSTER_EYE_CARCASS, MONSTER_EYE_LENS, BASILISK_GIZZARD); htmltext = "30436-05.html"; - } - else - { + } else { htmltext = "30436-04.html"; } break; @@ -131,29 +117,20 @@ public class Q00328_SenseForBusiness extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isStarted()) - { + if ((st != null) && st.isStarted()) { final int chance = getRandom(100); - if (MONSTER_EYES.containsKey(npc.getId())) - { - if (chance < MONSTER_EYES.get(npc.getId())[0]) - { + if (MONSTER_EYES.containsKey(npc.getId())) { + if (chance < MONSTER_EYES.get(npc.getId())[0]) { st.giveItems(MONSTER_EYE_CARCASS, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - } - else if (chance < MONSTER_EYES.get(npc.getId())[1]) - { + } else if (chance < MONSTER_EYES.get(npc.getId())[1]) { st.giveItems(MONSTER_EYE_LENS, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } - } - else if (MONSTER_BASILISKS.containsKey(npc.getId())) - { - if (chance < MONSTER_BASILISKS.get(npc.getId())) - { + } else if (MONSTER_BASILISKS.containsKey(npc.getId())) { + if (chance < MONSTER_BASILISKS.get(npc.getId())) { st.giveItems(BASILISK_GIZZARD, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00329_CuriosityOfADwarf/Q00329_CuriosityOfADwarf.java b/src/main/java/com/l2jserver/datapack/quests/Q00329_CuriosityOfADwarf/Q00329_CuriosityOfADwarf.java index d840895eaa..26d45405c2 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00329_CuriosityOfADwarf/Q00329_CuriosityOfADwarf.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00329_CuriosityOfADwarf/Q00329_CuriosityOfADwarf.java @@ -35,8 +35,7 @@ import com.l2jserver.gameserver.util.Util; * Curiosity Of A Dwarf (329) * @author ivantotov */ -public final class Q00329_CuriosityOfADwarf extends Quest -{ +public final class Q00329_CuriosityOfADwarf extends Quest { // NPC private static final int TRADER_ROLENTO = 30437; // Items @@ -46,14 +45,12 @@ public final class Q00329_CuriosityOfADwarf extends Quest private static final int MIN_LEVEL = 33; // Monsters private static final Map<Integer, List<ItemHolder>> MONSTER_DROPS = new HashMap<>(); - static - { + static { MONSTER_DROPS.put(20083, Arrays.asList(new ItemHolder(GOLEM_HEARTSTONE, 3), new ItemHolder(BROKEN_HEARTSTONE, 54))); // Granitic Golem MONSTER_DROPS.put(20085, Arrays.asList(new ItemHolder(GOLEM_HEARTSTONE, 3), new ItemHolder(BROKEN_HEARTSTONE, 58))); // Puncher } - public Q00329_CuriosityOfADwarf() - { + public Q00329_CuriosityOfADwarf() { super(329, Q00329_CuriosityOfADwarf.class.getSimpleName(), "Curiosity Of A Dwarf"); addStartNpc(TRADER_ROLENTO); addTalkId(TRADER_ROLENTO); @@ -62,34 +59,27 @@ public final class Q00329_CuriosityOfADwarf extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { - case "30437-03.htm": - { - if (st.isCreated()) - { + switch (event) { + case "30437-03.htm": { + if (st.isCreated()) { st.startQuest(); htmltext = event; } break; } - case "30437-06.html": - { + case "30437-06.html": { st.exitQuest(true, true); htmltext = event; break; } - case "30437-07.html": - { + case "30437-07.html": { htmltext = event; break; } @@ -98,16 +88,12 @@ public final class Q00329_CuriosityOfADwarf extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && Util.checkIfInRange(1500, npc, killer, true)) - { + if ((st != null) && Util.checkIfInRange(1500, npc, killer, true)) { final int rnd = getRandom(100); - for (ItemHolder drop : MONSTER_DROPS.get(npc.getId())) - { - if (rnd < drop.getCount()) - { + for (ItemHolder drop : MONSTER_DROPS.get(npc.getId())) { + if (rnd < drop.getCount()) { st.giveItemRandomly(npc, drop.getId(), 1, 0, 1.0, true); break; } @@ -117,29 +103,22 @@ public final class Q00329_CuriosityOfADwarf extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = player.getLevel() >= MIN_LEVEL ? "30437-02.htm" : "30437-01.htm"; break; } - case State.STARTED: - { - if (hasAtLeastOneQuestItem(player, getRegisteredItemIds())) - { + case State.STARTED: { + if (hasAtLeastOneQuestItem(player, getRegisteredItemIds())) { final long broken = st.getQuestItemsCount(BROKEN_HEARTSTONE); final long golem = st.getQuestItemsCount(GOLEM_HEARTSTONE); st.giveAdena(((broken * 50) + (golem * 1000) + ((broken + golem) >= 10 ? 1183 : 0)), true); takeItems(player, -1, getRegisteredItemIds()); htmltext = "30437-05.html"; - } - else - { + } else { htmltext = "30437-04.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00330_AdeptOfTaste/Q00330_AdeptOfTaste.java b/src/main/java/com/l2jserver/datapack/quests/Q00330_AdeptOfTaste/Q00330_AdeptOfTaste.java index fa69259ad8..5aeefd12af 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00330_AdeptOfTaste/Q00330_AdeptOfTaste.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00330_AdeptOfTaste/Q00330_AdeptOfTaste.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.util.Util; * Adept Of Taste (330) * @author ivantotov */ -public final class Q00330_AdeptOfTaste extends Quest -{ +public final class Q00330_AdeptOfTaste extends Quest { // NPCs private static final int ACCESSORY_MERCHANT_SONIA = 30062; private static final int PRIESTESS_GLYVKA = 30067; @@ -91,8 +90,7 @@ public final class Q00330_AdeptOfTaste extends Quest // Misc private static final int MIN_LEVEL = 24; - public Q00330_AdeptOfTaste() - { + public Q00330_AdeptOfTaste() { super(330, Q00330_AdeptOfTaste.class.getSimpleName(), "Adept Of Taste"); addStartNpc(JONAS); addTalkId(JONAS, ACCESSORY_MERCHANT_SONIA, PRIESTESS_GLYVKA, MAGISTER_ROLLANT, GUARD_JACOB, GROCER_PANO, MAGISTER_MIRIEN); @@ -101,33 +99,25 @@ public final class Q00330_AdeptOfTaste extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "30469-03.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "30469-03.htm": { + if (qs.isCreated()) { qs.startQuest(); giveItems(player, INGREDIENT_LIST, 1); htmltext = event; } break; } - case "30062-05.html": - { - if (hasQuestItems(player, SONIAS_BOTANY_BOOK) && ((getQuestItemsCount(player, RED_MANDRAGORA_ROOT) + getQuestItemsCount(player, WHITE_MANDRAGORA_ROOT)) >= 40)) - { - if (getQuestItemsCount(player, WHITE_MANDRAGORA_ROOT) < 40) - { + case "30062-05.html": { + if (hasQuestItems(player, SONIAS_BOTANY_BOOK) && ((getQuestItemsCount(player, RED_MANDRAGORA_ROOT) + getQuestItemsCount(player, WHITE_MANDRAGORA_ROOT)) >= 40)) { + if (getQuestItemsCount(player, WHITE_MANDRAGORA_ROOT) < 40) { takeItems(player, SONIAS_BOTANY_BOOK, 1); takeItems(player, RED_MANDRAGORA_ROOT, -1); takeItems(player, WHITE_MANDRAGORA_ROOT, -1); @@ -137,12 +127,9 @@ public final class Q00330_AdeptOfTaste extends Quest } break; } - case "30067-05.html": - { - if (hasQuestItems(player, GLYVKAS_BOTANY_BOOK) && ((getQuestItemsCount(player, GREEN_MARSH_MOSS) + getQuestItemsCount(player, BROWN_MARSH_MOSS)) >= 20)) - { - if (getQuestItemsCount(player, BROWN_MARSH_MOSS) < 20) - { + case "30067-05.html": { + if (hasQuestItems(player, GLYVKAS_BOTANY_BOOK) && ((getQuestItemsCount(player, GREEN_MARSH_MOSS) + getQuestItemsCount(player, BROWN_MARSH_MOSS)) >= 20)) { + if (getQuestItemsCount(player, BROWN_MARSH_MOSS) < 20) { takeItems(player, GLYVKAS_BOTANY_BOOK, 1); takeItems(player, GREEN_MARSH_MOSS, -1); takeItems(player, BROWN_MARSH_MOSS, -1); @@ -152,10 +139,8 @@ public final class Q00330_AdeptOfTaste extends Quest } break; } - case "30073-05.html": - { - if ((hasQuestItems(player, JACOBS_INSECT_BOOK) && (getQuestItemsCount(player, NECTAR) >= 20)) && (getQuestItemsCount(player, ROYAL_JELLY) < 10)) - { + case "30073-05.html": { + if ((hasQuestItems(player, JACOBS_INSECT_BOOK) && (getQuestItemsCount(player, NECTAR) >= 20)) && (getQuestItemsCount(player, ROYAL_JELLY) < 10)) { takeItems(player, JACOBS_INSECT_BOOK, 1); takeItems(player, NECTAR, -1); takeItems(player, ROYAL_JELLY, -1); @@ -172,8 +157,7 @@ public final class Q00330_AdeptOfTaste extends Quest case "30469-04t2.html": case "30469-04t3.html": case "30469-04t4.html": - case "30469-04t5.html": - { + case "30469-04t5.html": { htmltext = event; break; } @@ -182,26 +166,18 @@ public final class Q00330_AdeptOfTaste extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case HOBGOBLIN: - { - if ((getQuestItemsCount(killer, RED_MANDRAGORA_SAP) + getQuestItemsCount(killer, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(killer, HONEY) + getQuestItemsCount(killer, GOLDEN_HONEY) + getQuestItemsCount(killer, DIONIAN_POTATO) + getQuestItemsCount(killer, GREEN_MOSS_BUNDLE) + getQuestItemsCount(killer, BROWN_MOSS_BUNDLE) + getQuestItemsCount(killer, MONSTER_EYE_MEAT)) < 5) - { - if (hasQuestItems(killer, INGREDIENT_LIST, PANOS_CONTRACT) && (getQuestItemsCount(killer, HOBGOBLIN_AMULET) < 30)) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case HOBGOBLIN: { + if ((getQuestItemsCount(killer, RED_MANDRAGORA_SAP) + getQuestItemsCount(killer, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(killer, HONEY) + getQuestItemsCount(killer, GOLDEN_HONEY) + getQuestItemsCount(killer, DIONIAN_POTATO) + getQuestItemsCount(killer, GREEN_MOSS_BUNDLE) + + getQuestItemsCount(killer, BROWN_MOSS_BUNDLE) + getQuestItemsCount(killer, MONSTER_EYE_MEAT)) < 5) { + if (hasQuestItems(killer, INGREDIENT_LIST, PANOS_CONTRACT) && (getQuestItemsCount(killer, HOBGOBLIN_AMULET) < 30)) { giveItems(killer, HOBGOBLIN_AMULET, 1); - if (getQuestItemsCount(killer, HOBGOBLIN_AMULET) == 30) - { + if (getQuestItemsCount(killer, HOBGOBLIN_AMULET) == 30) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -209,39 +185,26 @@ public final class Q00330_AdeptOfTaste extends Quest break; } case MANDRAGORA_SPROUT1: - case MANDRAGORA_SPROUT2: - { - if ((getQuestItemsCount(killer, RED_MANDRAGORA_SAP) + getQuestItemsCount(killer, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(killer, HONEY) + getQuestItemsCount(killer, GOLDEN_HONEY) + getQuestItemsCount(killer, DIONIAN_POTATO) + getQuestItemsCount(killer, GREEN_MOSS_BUNDLE) + getQuestItemsCount(killer, BROWN_MOSS_BUNDLE) + getQuestItemsCount(killer, MONSTER_EYE_MEAT)) < 5) - { - if (hasQuestItems(killer, INGREDIENT_LIST, SONIAS_BOTANY_BOOK) && !hasAtLeastOneQuestItem(killer, RED_MANDRAGORA_SAP, WHITE_MANDRAGORA_SAP)) - { + case MANDRAGORA_SPROUT2: { + if ((getQuestItemsCount(killer, RED_MANDRAGORA_SAP) + getQuestItemsCount(killer, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(killer, HONEY) + getQuestItemsCount(killer, GOLDEN_HONEY) + getQuestItemsCount(killer, DIONIAN_POTATO) + getQuestItemsCount(killer, GREEN_MOSS_BUNDLE) + + getQuestItemsCount(killer, BROWN_MOSS_BUNDLE) + getQuestItemsCount(killer, MONSTER_EYE_MEAT)) < 5) { + if (hasQuestItems(killer, INGREDIENT_LIST, SONIAS_BOTANY_BOOK) && !hasAtLeastOneQuestItem(killer, RED_MANDRAGORA_SAP, WHITE_MANDRAGORA_SAP)) { final int i0 = getRandom(100); - if (i0 < 70) - { - if (getQuestItemsCount(killer, RED_MANDRAGORA_ROOT) < 40) - { + if (i0 < 70) { + if (getQuestItemsCount(killer, RED_MANDRAGORA_ROOT) < 40) { giveItems(killer, RED_MANDRAGORA_ROOT, 1); - if (getQuestItemsCount(killer, RED_MANDRAGORA_ROOT) == 40) - { + if (getQuestItemsCount(killer, RED_MANDRAGORA_ROOT) == 40) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } - } - else if (i0 < 77) - { - if (getQuestItemsCount(killer, WHITE_MANDRAGORA_ROOT) < 40) - { + } else if (i0 < 77) { + if (getQuestItemsCount(killer, WHITE_MANDRAGORA_ROOT) < 40) { giveItems(killer, WHITE_MANDRAGORA_ROOT, 1); - if (getQuestItemsCount(killer, WHITE_MANDRAGORA_ROOT) == 40) - { + if (getQuestItemsCount(killer, WHITE_MANDRAGORA_ROOT) == 40) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -250,39 +213,26 @@ public final class Q00330_AdeptOfTaste extends Quest } break; } - case MANDRAGORA_SAPLING: - { - if ((getQuestItemsCount(killer, RED_MANDRAGORA_SAP) + getQuestItemsCount(killer, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(killer, HONEY) + getQuestItemsCount(killer, GOLDEN_HONEY) + getQuestItemsCount(killer, DIONIAN_POTATO) + getQuestItemsCount(killer, GREEN_MOSS_BUNDLE) + getQuestItemsCount(killer, BROWN_MOSS_BUNDLE) + getQuestItemsCount(killer, MONSTER_EYE_MEAT)) < 5) - { - if (hasQuestItems(killer, INGREDIENT_LIST, SONIAS_BOTANY_BOOK) && !hasAtLeastOneQuestItem(killer, RED_MANDRAGORA_SAP, WHITE_MANDRAGORA_SAP)) - { + case MANDRAGORA_SAPLING: { + if ((getQuestItemsCount(killer, RED_MANDRAGORA_SAP) + getQuestItemsCount(killer, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(killer, HONEY) + getQuestItemsCount(killer, GOLDEN_HONEY) + getQuestItemsCount(killer, DIONIAN_POTATO) + getQuestItemsCount(killer, GREEN_MOSS_BUNDLE) + + getQuestItemsCount(killer, BROWN_MOSS_BUNDLE) + getQuestItemsCount(killer, MONSTER_EYE_MEAT)) < 5) { + if (hasQuestItems(killer, INGREDIENT_LIST, SONIAS_BOTANY_BOOK) && !hasAtLeastOneQuestItem(killer, RED_MANDRAGORA_SAP, WHITE_MANDRAGORA_SAP)) { final int i0 = getRandom(100); - if (i0 < 77) - { - if (getQuestItemsCount(killer, RED_MANDRAGORA_ROOT) < 40) - { + if (i0 < 77) { + if (getQuestItemsCount(killer, RED_MANDRAGORA_ROOT) < 40) { giveItems(killer, RED_MANDRAGORA_ROOT, 1); - if (getQuestItemsCount(killer, RED_MANDRAGORA_ROOT) == 40) - { + if (getQuestItemsCount(killer, RED_MANDRAGORA_ROOT) == 40) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } - } - else if (i0 < 85) - { - if (getQuestItemsCount(killer, WHITE_MANDRAGORA_ROOT) < 40) - { + } else if (i0 < 85) { + if (getQuestItemsCount(killer, WHITE_MANDRAGORA_ROOT) < 40) { giveItems(killer, WHITE_MANDRAGORA_ROOT, 1); - if (getQuestItemsCount(killer, WHITE_MANDRAGORA_ROOT) == 40) - { + if (getQuestItemsCount(killer, WHITE_MANDRAGORA_ROOT) == 40) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -291,39 +241,26 @@ public final class Q00330_AdeptOfTaste extends Quest } break; } - case MANDRAGORA_BLOSSOM: - { - if ((getQuestItemsCount(killer, RED_MANDRAGORA_SAP) + getQuestItemsCount(killer, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(killer, HONEY) + getQuestItemsCount(killer, GOLDEN_HONEY) + getQuestItemsCount(killer, DIONIAN_POTATO) + getQuestItemsCount(killer, GREEN_MOSS_BUNDLE) + getQuestItemsCount(killer, BROWN_MOSS_BUNDLE) + getQuestItemsCount(killer, MONSTER_EYE_MEAT)) < 5) - { - if (hasQuestItems(killer, INGREDIENT_LIST, SONIAS_BOTANY_BOOK) && !hasAtLeastOneQuestItem(killer, RED_MANDRAGORA_SAP, WHITE_MANDRAGORA_SAP)) - { + case MANDRAGORA_BLOSSOM: { + if ((getQuestItemsCount(killer, RED_MANDRAGORA_SAP) + getQuestItemsCount(killer, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(killer, HONEY) + getQuestItemsCount(killer, GOLDEN_HONEY) + getQuestItemsCount(killer, DIONIAN_POTATO) + getQuestItemsCount(killer, GREEN_MOSS_BUNDLE) + + getQuestItemsCount(killer, BROWN_MOSS_BUNDLE) + getQuestItemsCount(killer, MONSTER_EYE_MEAT)) < 5) { + if (hasQuestItems(killer, INGREDIENT_LIST, SONIAS_BOTANY_BOOK) && !hasAtLeastOneQuestItem(killer, RED_MANDRAGORA_SAP, WHITE_MANDRAGORA_SAP)) { final int i0 = getRandom(100); - if (i0 < 87) - { - if (getQuestItemsCount(killer, RED_MANDRAGORA_ROOT) < 40) - { + if (i0 < 87) { + if (getQuestItemsCount(killer, RED_MANDRAGORA_ROOT) < 40) { giveItems(killer, RED_MANDRAGORA_ROOT, 1); - if (getQuestItemsCount(killer, RED_MANDRAGORA_ROOT) == 40) - { + if (getQuestItemsCount(killer, RED_MANDRAGORA_ROOT) == 40) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } - } - else if (i0 < 96) - { - if (getQuestItemsCount(killer, WHITE_MANDRAGORA_ROOT) < 40) - { + } else if (i0 < 96) { + if (getQuestItemsCount(killer, WHITE_MANDRAGORA_ROOT) < 40) { giveItems(killer, WHITE_MANDRAGORA_ROOT, 1); - if (getQuestItemsCount(killer, WHITE_MANDRAGORA_ROOT) == 40) - { + if (getQuestItemsCount(killer, WHITE_MANDRAGORA_ROOT) == 40) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -332,39 +269,26 @@ public final class Q00330_AdeptOfTaste extends Quest } break; } - case BLOODY_BEE: - { - if ((getQuestItemsCount(killer, RED_MANDRAGORA_SAP) + getQuestItemsCount(killer, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(killer, HONEY) + getQuestItemsCount(killer, GOLDEN_HONEY) + getQuestItemsCount(killer, DIONIAN_POTATO) + getQuestItemsCount(killer, GREEN_MOSS_BUNDLE) + getQuestItemsCount(killer, BROWN_MOSS_BUNDLE) + getQuestItemsCount(killer, MONSTER_EYE_MEAT)) < 5) - { - if (hasQuestItems(killer, INGREDIENT_LIST, JACOBS_INSECT_BOOK)) - { + case BLOODY_BEE: { + if ((getQuestItemsCount(killer, RED_MANDRAGORA_SAP) + getQuestItemsCount(killer, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(killer, HONEY) + getQuestItemsCount(killer, GOLDEN_HONEY) + getQuestItemsCount(killer, DIONIAN_POTATO) + getQuestItemsCount(killer, GREEN_MOSS_BUNDLE) + + getQuestItemsCount(killer, BROWN_MOSS_BUNDLE) + getQuestItemsCount(killer, MONSTER_EYE_MEAT)) < 5) { + if (hasQuestItems(killer, INGREDIENT_LIST, JACOBS_INSECT_BOOK)) { final int i0 = getRandom(100); - if (i0 < 80) - { - if (getQuestItemsCount(killer, NECTAR) < 20) - { + if (i0 < 80) { + if (getQuestItemsCount(killer, NECTAR) < 20) { giveItems(killer, NECTAR, 1); - if (getQuestItemsCount(killer, NECTAR) == 20) - { + if (getQuestItemsCount(killer, NECTAR) == 20) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } - } - else if (i0 < 95) - { - if (getQuestItemsCount(killer, ROYAL_JELLY) < 10) - { + } else if (i0 < 95) { + if (getQuestItemsCount(killer, ROYAL_JELLY) < 10) { giveItems(killer, ROYAL_JELLY, 1); - if (getQuestItemsCount(killer, ROYAL_JELLY) == 10) - { + if (getQuestItemsCount(killer, ROYAL_JELLY) == 10) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -373,39 +297,26 @@ public final class Q00330_AdeptOfTaste extends Quest } break; } - case GRAY_ANT: - { - if ((getQuestItemsCount(killer, RED_MANDRAGORA_SAP) + getQuestItemsCount(killer, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(killer, HONEY) + getQuestItemsCount(killer, GOLDEN_HONEY) + getQuestItemsCount(killer, DIONIAN_POTATO) + getQuestItemsCount(killer, GREEN_MOSS_BUNDLE) + getQuestItemsCount(killer, BROWN_MOSS_BUNDLE) + getQuestItemsCount(killer, MONSTER_EYE_MEAT)) < 5) - { - if (hasQuestItems(killer, INGREDIENT_LIST, GLYVKAS_BOTANY_BOOK)) - { + case GRAY_ANT: { + if ((getQuestItemsCount(killer, RED_MANDRAGORA_SAP) + getQuestItemsCount(killer, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(killer, HONEY) + getQuestItemsCount(killer, GOLDEN_HONEY) + getQuestItemsCount(killer, DIONIAN_POTATO) + getQuestItemsCount(killer, GREEN_MOSS_BUNDLE) + + getQuestItemsCount(killer, BROWN_MOSS_BUNDLE) + getQuestItemsCount(killer, MONSTER_EYE_MEAT)) < 5) { + if (hasQuestItems(killer, INGREDIENT_LIST, GLYVKAS_BOTANY_BOOK)) { final int i0 = getRandom(100); - if (i0 < 87) - { - if (getQuestItemsCount(killer, GREEN_MARSH_MOSS) < 20) - { + if (i0 < 87) { + if (getQuestItemsCount(killer, GREEN_MARSH_MOSS) < 20) { giveItems(killer, GREEN_MARSH_MOSS, 1); - if (getQuestItemsCount(killer, GREEN_MARSH_MOSS) == 20) - { + if (getQuestItemsCount(killer, GREEN_MARSH_MOSS) == 20) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } - } - else if (i0 < 96) - { - if (getQuestItemsCount(killer, BROWN_MARSH_MOSS) < 20) - { + } else if (i0 < 96) { + if (getQuestItemsCount(killer, BROWN_MARSH_MOSS) < 20) { giveItems(killer, BROWN_MARSH_MOSS, 1); - if (getQuestItemsCount(killer, BROWN_MARSH_MOSS) == 20) - { + if (getQuestItemsCount(killer, BROWN_MARSH_MOSS) == 20) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -414,39 +325,26 @@ public final class Q00330_AdeptOfTaste extends Quest } break; } - case GIANT_CRIMSON_ANT: - { - if ((getQuestItemsCount(killer, RED_MANDRAGORA_SAP) + getQuestItemsCount(killer, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(killer, HONEY) + getQuestItemsCount(killer, GOLDEN_HONEY) + getQuestItemsCount(killer, DIONIAN_POTATO) + getQuestItemsCount(killer, GREEN_MOSS_BUNDLE) + getQuestItemsCount(killer, BROWN_MOSS_BUNDLE) + getQuestItemsCount(killer, MONSTER_EYE_MEAT)) < 5) - { - if (hasQuestItems(killer, INGREDIENT_LIST, GLYVKAS_BOTANY_BOOK)) - { + case GIANT_CRIMSON_ANT: { + if ((getQuestItemsCount(killer, RED_MANDRAGORA_SAP) + getQuestItemsCount(killer, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(killer, HONEY) + getQuestItemsCount(killer, GOLDEN_HONEY) + getQuestItemsCount(killer, DIONIAN_POTATO) + getQuestItemsCount(killer, GREEN_MOSS_BUNDLE) + + getQuestItemsCount(killer, BROWN_MOSS_BUNDLE) + getQuestItemsCount(killer, MONSTER_EYE_MEAT)) < 5) { + if (hasQuestItems(killer, INGREDIENT_LIST, GLYVKAS_BOTANY_BOOK)) { final int i0 = getRandom(100); - if (i0 < 90) - { - if (getQuestItemsCount(killer, GREEN_MARSH_MOSS) < 20) - { + if (i0 < 90) { + if (getQuestItemsCount(killer, GREEN_MARSH_MOSS) < 20) { giveItems(killer, GREEN_MARSH_MOSS, 1); - if (getQuestItemsCount(killer, GREEN_MARSH_MOSS) == 20) - { + if (getQuestItemsCount(killer, GREEN_MARSH_MOSS) == 20) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } - } - else - { - if (getQuestItemsCount(killer, BROWN_MARSH_MOSS) < 20) - { + } else { + if (getQuestItemsCount(killer, BROWN_MARSH_MOSS) < 20) { giveItems(killer, BROWN_MARSH_MOSS, 1); - if (getQuestItemsCount(killer, BROWN_MARSH_MOSS) == 20) - { + if (getQuestItemsCount(killer, BROWN_MARSH_MOSS) == 20) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -455,39 +353,26 @@ public final class Q00330_AdeptOfTaste extends Quest } break; } - case STINGER_WASP: - { - if ((getQuestItemsCount(killer, RED_MANDRAGORA_SAP) + getQuestItemsCount(killer, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(killer, HONEY) + getQuestItemsCount(killer, GOLDEN_HONEY) + getQuestItemsCount(killer, DIONIAN_POTATO) + getQuestItemsCount(killer, GREEN_MOSS_BUNDLE) + getQuestItemsCount(killer, BROWN_MOSS_BUNDLE) + getQuestItemsCount(killer, MONSTER_EYE_MEAT)) < 5) - { - if (hasQuestItems(killer, INGREDIENT_LIST, JACOBS_INSECT_BOOK)) - { + case STINGER_WASP: { + if ((getQuestItemsCount(killer, RED_MANDRAGORA_SAP) + getQuestItemsCount(killer, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(killer, HONEY) + getQuestItemsCount(killer, GOLDEN_HONEY) + getQuestItemsCount(killer, DIONIAN_POTATO) + getQuestItemsCount(killer, GREEN_MOSS_BUNDLE) + + getQuestItemsCount(killer, BROWN_MOSS_BUNDLE) + getQuestItemsCount(killer, MONSTER_EYE_MEAT)) < 5) { + if (hasQuestItems(killer, INGREDIENT_LIST, JACOBS_INSECT_BOOK)) { final int i0 = getRandom(100); - if (i0 < 92) - { - if (getQuestItemsCount(killer, NECTAR) < 20) - { + if (i0 < 92) { + if (getQuestItemsCount(killer, NECTAR) < 20) { giveItems(killer, NECTAR, 1); - if (getQuestItemsCount(killer, NECTAR) == 20) - { + if (getQuestItemsCount(killer, NECTAR) == 20) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } - } - else - { - if (getQuestItemsCount(killer, ROYAL_JELLY) < 10) - { + } else { + if (getQuestItemsCount(killer, ROYAL_JELLY) < 10) { giveItems(killer, ROYAL_JELLY, 1); - if (getQuestItemsCount(killer, ROYAL_JELLY) == 10) - { + if (getQuestItemsCount(killer, ROYAL_JELLY) == 10) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -496,40 +381,27 @@ public final class Q00330_AdeptOfTaste extends Quest } break; } - case MONSTER_EYE_SEARCHER: - { - if ((getQuestItemsCount(killer, RED_MANDRAGORA_SAP) + getQuestItemsCount(killer, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(killer, HONEY) + getQuestItemsCount(killer, GOLDEN_HONEY) + getQuestItemsCount(killer, DIONIAN_POTATO) + getQuestItemsCount(killer, GREEN_MOSS_BUNDLE) + getQuestItemsCount(killer, BROWN_MOSS_BUNDLE) + getQuestItemsCount(killer, MONSTER_EYE_MEAT)) < 5) - { - if (hasQuestItems(killer, INGREDIENT_LIST, ROLLANTS_CREATURE_BOOK) && (getQuestItemsCount(killer, BODY_OF_MONSTER_EYE) < 30)) - { + case MONSTER_EYE_SEARCHER: { + if ((getQuestItemsCount(killer, RED_MANDRAGORA_SAP) + getQuestItemsCount(killer, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(killer, HONEY) + getQuestItemsCount(killer, GOLDEN_HONEY) + getQuestItemsCount(killer, DIONIAN_POTATO) + getQuestItemsCount(killer, GREEN_MOSS_BUNDLE) + + getQuestItemsCount(killer, BROWN_MOSS_BUNDLE) + getQuestItemsCount(killer, MONSTER_EYE_MEAT)) < 5) { + if (hasQuestItems(killer, INGREDIENT_LIST, ROLLANTS_CREATURE_BOOK) && (getQuestItemsCount(killer, BODY_OF_MONSTER_EYE) < 30)) { final int i0 = getRandom(100); - if (i0 < 77) - { - if (getQuestItemsCount(killer, BODY_OF_MONSTER_EYE) == 29) - { + if (i0 < 77) { + if (getQuestItemsCount(killer, BODY_OF_MONSTER_EYE) == 29) { giveItems(killer, BODY_OF_MONSTER_EYE, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { giveItems(killer, BODY_OF_MONSTER_EYE, 2); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } - } - else if (i0 < 97) - { - if (getQuestItemsCount(killer, BROWN_MARSH_MOSS) == 28) - { + } else if (i0 < 97) { + if (getQuestItemsCount(killer, BROWN_MARSH_MOSS) == 28) { giveItems(killer, BODY_OF_MONSTER_EYE, 2); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else if (getQuestItemsCount(killer, BROWN_MARSH_MOSS) == 29) - { + } else if (getQuestItemsCount(killer, BROWN_MARSH_MOSS) == 29) { giveItems(killer, BODY_OF_MONSTER_EYE, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { giveItems(killer, BODY_OF_MONSTER_EYE, 3); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -539,34 +411,23 @@ public final class Q00330_AdeptOfTaste extends Quest } break; } - case MONSTER_EYE_GAZER: - { - if ((getQuestItemsCount(killer, RED_MANDRAGORA_SAP) + getQuestItemsCount(killer, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(killer, HONEY) + getQuestItemsCount(killer, GOLDEN_HONEY) + getQuestItemsCount(killer, DIONIAN_POTATO) + getQuestItemsCount(killer, GREEN_MOSS_BUNDLE) + getQuestItemsCount(killer, BROWN_MOSS_BUNDLE) + getQuestItemsCount(killer, MONSTER_EYE_MEAT)) < 5) - { - if (hasQuestItems(killer, INGREDIENT_LIST, ROLLANTS_CREATURE_BOOK) && (getQuestItemsCount(killer, BODY_OF_MONSTER_EYE) < 30)) - { + case MONSTER_EYE_GAZER: { + if ((getQuestItemsCount(killer, RED_MANDRAGORA_SAP) + getQuestItemsCount(killer, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(killer, HONEY) + getQuestItemsCount(killer, GOLDEN_HONEY) + getQuestItemsCount(killer, DIONIAN_POTATO) + getQuestItemsCount(killer, GREEN_MOSS_BUNDLE) + + getQuestItemsCount(killer, BROWN_MOSS_BUNDLE) + getQuestItemsCount(killer, MONSTER_EYE_MEAT)) < 5) { + if (hasQuestItems(killer, INGREDIENT_LIST, ROLLANTS_CREATURE_BOOK) && (getQuestItemsCount(killer, BODY_OF_MONSTER_EYE) < 30)) { final int i0 = getRandom(10); - if (i0 < 7) - { + if (i0 < 7) { giveItems(killer, BODY_OF_MONSTER_EYE, 1); - if (getQuestItemsCount(killer, BODY_OF_MONSTER_EYE) == 30) - { + if (getQuestItemsCount(killer, BODY_OF_MONSTER_EYE) == 30) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } - } - else - { - if (getQuestItemsCount(killer, BROWN_MARSH_MOSS) == 29) - { + } else { + if (getQuestItemsCount(killer, BROWN_MARSH_MOSS) == 29) { giveItems(killer, BODY_OF_MONSTER_EYE, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { giveItems(killer, BODY_OF_MONSTER_EYE, 2); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -582,42 +443,27 @@ public final class Q00330_AdeptOfTaste extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == JONAS) - { - if (player.getLevel() < MIN_LEVEL) - { + if (qs.isCreated()) { + if (npc.getId() == JONAS) { + if (player.getLevel() < MIN_LEVEL) { htmltext = "30469-01.htm"; - } - else - { + } else { htmltext = "30469-02.htm"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case JONAS: - { - if (hasQuestItems(player, INGREDIENT_LIST)) - { - if ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case JONAS: { + if (hasQuestItems(player, INGREDIENT_LIST)) { + if ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5) { htmltext = "30469-04.html"; - } - else - { - if ((getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE)) == 0) - { - if (getRandom(10) < 5) - { + } else { + if ((getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE)) == 0) { + if (getRandom(10) < 5) { takeItems(player, INGREDIENT_LIST, -1); takeItems(player, RED_MANDRAGORA_SAP, -1); takeItems(player, WHITE_MANDRAGORA_SAP, -1); @@ -629,9 +475,7 @@ public final class Q00330_AdeptOfTaste extends Quest takeItems(player, MONSTER_EYE_MEAT, -1); giveItems(player, JONASS_2ND_STEAK_DISH, 1); htmltext = "30469-05t2.html"; - } - else - { + } else { takeItems(player, INGREDIENT_LIST, -1); takeItems(player, RED_MANDRAGORA_SAP, -1); takeItems(player, WHITE_MANDRAGORA_SAP, -1); @@ -646,10 +490,8 @@ public final class Q00330_AdeptOfTaste extends Quest } } - if ((getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE)) == 1) - { - if (getRandom(10) < 5) - { + if ((getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE)) == 1) { + if (getRandom(10) < 5) { takeItems(player, INGREDIENT_LIST, -1); takeItems(player, RED_MANDRAGORA_SAP, -1); takeItems(player, WHITE_MANDRAGORA_SAP, -1); @@ -661,9 +503,7 @@ public final class Q00330_AdeptOfTaste extends Quest takeItems(player, MONSTER_EYE_MEAT, -1); giveItems(player, JONASS_3RD_STEAK_DISH, 1); htmltext = "30469-05t3.html"; - } - else - { + } else { takeItems(player, INGREDIENT_LIST, -1); takeItems(player, RED_MANDRAGORA_SAP, -1); takeItems(player, WHITE_MANDRAGORA_SAP, -1); @@ -678,10 +518,8 @@ public final class Q00330_AdeptOfTaste extends Quest } } - if ((getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE)) == 2) - { - if (getRandom(10) < 5) - { + if ((getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE)) == 2) { + if (getRandom(10) < 5) { takeItems(player, INGREDIENT_LIST, -1); takeItems(player, RED_MANDRAGORA_SAP, -1); takeItems(player, WHITE_MANDRAGORA_SAP, -1); @@ -693,9 +531,7 @@ public final class Q00330_AdeptOfTaste extends Quest takeItems(player, MONSTER_EYE_MEAT, -1); giveItems(player, JONASS_4TH_STEAK_DISH, 1); htmltext = "30469-05t4.html"; - } - else - { + } else { takeItems(player, INGREDIENT_LIST, -1); takeItems(player, RED_MANDRAGORA_SAP, -1); takeItems(player, WHITE_MANDRAGORA_SAP, -1); @@ -710,10 +546,8 @@ public final class Q00330_AdeptOfTaste extends Quest } } - if ((getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE)) == 3) - { - if (getRandom(10) < 5) - { + if ((getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE)) == 3) { + if (getRandom(10) < 5) { takeItems(player, INGREDIENT_LIST, -1); takeItems(player, RED_MANDRAGORA_SAP, -1); takeItems(player, WHITE_MANDRAGORA_SAP, -1); @@ -726,9 +560,7 @@ public final class Q00330_AdeptOfTaste extends Quest giveItems(player, JONASS_5TH_STEAK_DISH, 1); playSound(player, Sound.ITEMSOUND_QUEST_JACKPOT); htmltext = "30469-05t5.html"; - } - else - { + } else { takeItems(player, INGREDIENT_LIST, -1); takeItems(player, RED_MANDRAGORA_SAP, -1); takeItems(player, WHITE_MANDRAGORA_SAP, -1); @@ -743,54 +575,42 @@ public final class Q00330_AdeptOfTaste extends Quest } } } - } - else - { - if ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) == 0) - { - if ((getQuestItemsCount(player, JONASS_1ST_STEAK_DISH) + getQuestItemsCount(player, JONASS_2ND_STEAK_DISH) + getQuestItemsCount(player, JONASS_3RD_STEAK_DISH) + getQuestItemsCount(player, JONASS_4TH_STEAK_DISH) + getQuestItemsCount(player, JONASS_5TH_STEAK_DISH)) == 1) - { - if ((getQuestItemsCount(player, MIRIENS_REVIEW_1) + getQuestItemsCount(player, MIRIENS_REVIEW_2) + getQuestItemsCount(player, MIRIENS_REVIEW_3) + getQuestItemsCount(player, MIRIENS_REVIEW_4) + getQuestItemsCount(player, MIRIENS_REVIEW_5)) == 0) - { + } else { + if ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) == 0) { + if ((getQuestItemsCount(player, JONASS_1ST_STEAK_DISH) + getQuestItemsCount(player, JONASS_2ND_STEAK_DISH) + getQuestItemsCount(player, JONASS_3RD_STEAK_DISH) + getQuestItemsCount(player, JONASS_4TH_STEAK_DISH) + getQuestItemsCount(player, JONASS_5TH_STEAK_DISH)) == 1) { + if ((getQuestItemsCount(player, MIRIENS_REVIEW_1) + getQuestItemsCount(player, MIRIENS_REVIEW_2) + getQuestItemsCount(player, MIRIENS_REVIEW_3) + getQuestItemsCount(player, MIRIENS_REVIEW_4) + getQuestItemsCount(player, MIRIENS_REVIEW_5)) == 0) { htmltext = "30469-06.html"; } - } - else - { - if ((getQuestItemsCount(player, MIRIENS_REVIEW_1) + getQuestItemsCount(player, MIRIENS_REVIEW_2) + getQuestItemsCount(player, MIRIENS_REVIEW_3) + getQuestItemsCount(player, MIRIENS_REVIEW_4) + getQuestItemsCount(player, MIRIENS_REVIEW_5)) == 1) - { - if (hasQuestItems(player, MIRIENS_REVIEW_1)) - { + } else { + if ((getQuestItemsCount(player, MIRIENS_REVIEW_1) + getQuestItemsCount(player, MIRIENS_REVIEW_2) + getQuestItemsCount(player, MIRIENS_REVIEW_3) + getQuestItemsCount(player, MIRIENS_REVIEW_4) + getQuestItemsCount(player, MIRIENS_REVIEW_5)) == 1) { + if (hasQuestItems(player, MIRIENS_REVIEW_1)) { takeItems(player, MIRIENS_REVIEW_1, 1); giveAdena(player, 10000, true); htmltext = "30469-06t1.html"; } - if (hasQuestItems(player, MIRIENS_REVIEW_2)) - { + if (hasQuestItems(player, MIRIENS_REVIEW_2)) { takeItems(player, MIRIENS_REVIEW_2, 1); giveAdena(player, 14870, true); htmltext = "30469-06t2.html"; } - if (hasQuestItems(player, MIRIENS_REVIEW_3)) - { + if (hasQuestItems(player, MIRIENS_REVIEW_3)) { takeItems(player, MIRIENS_REVIEW_3, 1); giveAdena(player, 6490, true); giveItems(player, JONASS_SALAD_RECIPE, 1); htmltext = "30469-06t3.html"; } - if (hasQuestItems(player, MIRIENS_REVIEW_4)) - { + if (hasQuestItems(player, MIRIENS_REVIEW_4)) { takeItems(player, MIRIENS_REVIEW_4, 1); giveAdena(player, 12220, true); giveItems(player, JONASS_SAUCE_RECIPE, 1); htmltext = "30469-06t4.html"; } - if (hasQuestItems(player, MIRIENS_REVIEW_5)) - { + if (hasQuestItems(player, MIRIENS_REVIEW_5)) { takeItems(player, MIRIENS_REVIEW_5, 1); giveAdena(player, 16540, true); giveItems(player, JONASS_STEAK_RECIPE, 1); @@ -804,27 +624,19 @@ public final class Q00330_AdeptOfTaste extends Quest } break; } - case ACCESSORY_MERCHANT_SONIA: - { - if (hasQuestItems(player, INGREDIENT_LIST) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5) && !hasAtLeastOneQuestItem(player, SONIAS_BOTANY_BOOK, RED_MANDRAGORA_SAP, WHITE_MANDRAGORA_SAP)) - { + case ACCESSORY_MERCHANT_SONIA: { + if (hasQuestItems(player, INGREDIENT_LIST) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5) && !hasAtLeastOneQuestItem(player, SONIAS_BOTANY_BOOK, RED_MANDRAGORA_SAP, WHITE_MANDRAGORA_SAP)) { giveItems(player, SONIAS_BOTANY_BOOK, 1); htmltext = "30062-01.html"; - } - else if (hasQuestItems(player, INGREDIENT_LIST, SONIAS_BOTANY_BOOK) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5) && !hasAtLeastOneQuestItem(player, RED_MANDRAGORA_SAP, WHITE_MANDRAGORA_SAP)) - { - if ((getQuestItemsCount(player, RED_MANDRAGORA_ROOT) + getQuestItemsCount(player, WHITE_MANDRAGORA_ROOT)) < 40) - { + } else if (hasQuestItems(player, INGREDIENT_LIST, SONIAS_BOTANY_BOOK) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5) && !hasAtLeastOneQuestItem(player, RED_MANDRAGORA_SAP, WHITE_MANDRAGORA_SAP)) { + if ((getQuestItemsCount(player, RED_MANDRAGORA_ROOT) + getQuestItemsCount(player, WHITE_MANDRAGORA_ROOT)) < 40) { htmltext = "30062-02.html"; - } - else - { - if (getQuestItemsCount(player, WHITE_MANDRAGORA_ROOT) < 40) - { + } else { + if (getQuestItemsCount(player, WHITE_MANDRAGORA_ROOT) < 40) { htmltext = "30062-03.html"; - } - else - { + } else { takeItems(player, SONIAS_BOTANY_BOOK, 1); takeItems(player, RED_MANDRAGORA_ROOT, -1); takeItems(player, WHITE_MANDRAGORA_ROOT, -1); @@ -832,34 +644,25 @@ public final class Q00330_AdeptOfTaste extends Quest htmltext = "30062-06.html"; } } - } - else if (hasQuestItems(player, INGREDIENT_LIST) && !hasQuestItems(player, SONIAS_BOTANY_BOOK) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5) && hasAtLeastOneQuestItem(player, RED_MANDRAGORA_SAP, WHITE_MANDRAGORA_SAP)) - { + } else if (hasQuestItems(player, INGREDIENT_LIST) && !hasQuestItems(player, SONIAS_BOTANY_BOOK) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5) && hasAtLeastOneQuestItem(player, RED_MANDRAGORA_SAP, WHITE_MANDRAGORA_SAP)) { htmltext = "30062-07.html"; } break; } - case PRIESTESS_GLYVKA: - { - if (hasQuestItems(player, INGREDIENT_LIST) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5) && !hasAtLeastOneQuestItem(player, GLYVKAS_BOTANY_BOOK, GREEN_MOSS_BUNDLE, BROWN_MOSS_BUNDLE)) - { + case PRIESTESS_GLYVKA: { + if (hasQuestItems(player, INGREDIENT_LIST) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5) && !hasAtLeastOneQuestItem(player, GLYVKAS_BOTANY_BOOK, GREEN_MOSS_BUNDLE, BROWN_MOSS_BUNDLE)) { giveItems(player, GLYVKAS_BOTANY_BOOK, 1); htmltext = "30067-01.html"; - } - else if (hasQuestItems(player, INGREDIENT_LIST, GLYVKAS_BOTANY_BOOK) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5)) - { - if ((getQuestItemsCount(player, GREEN_MARSH_MOSS) + getQuestItemsCount(player, BROWN_MARSH_MOSS)) < 20) - { + } else if (hasQuestItems(player, INGREDIENT_LIST, GLYVKAS_BOTANY_BOOK) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5)) { + if ((getQuestItemsCount(player, GREEN_MARSH_MOSS) + getQuestItemsCount(player, BROWN_MARSH_MOSS)) < 20) { htmltext = "30067-02.html"; - } - else - { - if (getQuestItemsCount(player, BROWN_MARSH_MOSS) < 20) - { + } else { + if (getQuestItemsCount(player, BROWN_MARSH_MOSS) < 20) { htmltext = "30067-03.html"; - } - else - { + } else { takeItems(player, GLYVKAS_BOTANY_BOOK, 1); takeItems(player, GREEN_MARSH_MOSS, -1); takeItems(player, BROWN_MARSH_MOSS, -1); @@ -867,61 +670,46 @@ public final class Q00330_AdeptOfTaste extends Quest htmltext = "30067-06.html"; } } - } - else if (hasQuestItems(player, INGREDIENT_LIST) && !hasQuestItems(player, GLYVKAS_BOTANY_BOOK) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5) && hasAtLeastOneQuestItem(player, GREEN_MOSS_BUNDLE, BROWN_MOSS_BUNDLE)) - { + } else if (hasQuestItems(player, INGREDIENT_LIST) && !hasQuestItems(player, GLYVKAS_BOTANY_BOOK) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5) && hasAtLeastOneQuestItem(player, GREEN_MOSS_BUNDLE, BROWN_MOSS_BUNDLE)) { htmltext = "30067-07.html"; } break; } - case MAGISTER_ROLLANT: - { - if (hasQuestItems(player, INGREDIENT_LIST) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5) && !hasAtLeastOneQuestItem(player, ROLLANTS_CREATURE_BOOK, MONSTER_EYE_MEAT)) - { + case MAGISTER_ROLLANT: { + if (hasQuestItems(player, INGREDIENT_LIST) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5) && !hasAtLeastOneQuestItem(player, ROLLANTS_CREATURE_BOOK, MONSTER_EYE_MEAT)) { giveItems(player, ROLLANTS_CREATURE_BOOK, 1); htmltext = "30069-01.html"; - } - else if (hasQuestItems(player, INGREDIENT_LIST, ROLLANTS_CREATURE_BOOK) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5)) - { - if (getQuestItemsCount(player, BODY_OF_MONSTER_EYE) < 30) - { + } else if (hasQuestItems(player, INGREDIENT_LIST, ROLLANTS_CREATURE_BOOK) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5)) { + if (getQuestItemsCount(player, BODY_OF_MONSTER_EYE) < 30) { htmltext = "30069-02.html"; - } - else - { + } else { takeItems(player, ROLLANTS_CREATURE_BOOK, 1); takeItems(player, BODY_OF_MONSTER_EYE, -1); giveItems(player, MONSTER_EYE_MEAT, 1); htmltext = "30069-03.html"; } - } - else if (hasQuestItems(player, INGREDIENT_LIST, MONSTER_EYE_MEAT) && !hasQuestItems(player, ROLLANTS_CREATURE_BOOK) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5)) - { + } else if (hasQuestItems(player, INGREDIENT_LIST, MONSTER_EYE_MEAT) && !hasQuestItems(player, ROLLANTS_CREATURE_BOOK) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5)) { htmltext = "30069-04.html"; } break; } - case GUARD_JACOB: - { - if (hasQuestItems(player, INGREDIENT_LIST) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5) && !hasAtLeastOneQuestItem(player, JACOBS_INSECT_BOOK, HONEY, GOLDEN_HONEY)) - { + case GUARD_JACOB: { + if (hasQuestItems(player, INGREDIENT_LIST) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5) && !hasAtLeastOneQuestItem(player, JACOBS_INSECT_BOOK, HONEY, GOLDEN_HONEY)) { giveItems(player, JACOBS_INSECT_BOOK, 1); htmltext = "30073-01.html"; - } - else if (hasQuestItems(player, INGREDIENT_LIST, JACOBS_INSECT_BOOK) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5)) - { - if (getQuestItemsCount(player, NECTAR) < 20) - { + } else if (hasQuestItems(player, INGREDIENT_LIST, JACOBS_INSECT_BOOK) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5)) { + if (getQuestItemsCount(player, NECTAR) < 20) { htmltext = "30073-02.html"; - } - else - { - if (getQuestItemsCount(player, ROYAL_JELLY) < 10) - { + } else { + if (getQuestItemsCount(player, ROYAL_JELLY) < 10) { htmltext = "30073-03.html"; - } - else - { + } else { takeItems(player, JACOBS_INSECT_BOOK, 1); takeItems(player, NECTAR, -1); takeItems(player, ROYAL_JELLY, -1); @@ -929,94 +717,73 @@ public final class Q00330_AdeptOfTaste extends Quest htmltext = "30073-06.html"; } } - } - else if (hasQuestItems(player, INGREDIENT_LIST) && !hasQuestItems(player, JACOBS_INSECT_BOOK) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5) && hasAtLeastOneQuestItem(player, HONEY, GOLDEN_HONEY)) - { + } else if (hasQuestItems(player, INGREDIENT_LIST) && !hasQuestItems(player, JACOBS_INSECT_BOOK) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5) && hasAtLeastOneQuestItem(player, HONEY, GOLDEN_HONEY)) { htmltext = "30073-07.html"; } break; } - case GROCER_PANO: - { - if (hasQuestItems(player, INGREDIENT_LIST) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5) && !hasAtLeastOneQuestItem(player, PANOS_CONTRACT, DIONIAN_POTATO)) - { + case GROCER_PANO: { + if (hasQuestItems(player, INGREDIENT_LIST) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5) && !hasAtLeastOneQuestItem(player, PANOS_CONTRACT, DIONIAN_POTATO)) { giveItems(player, PANOS_CONTRACT, 1); htmltext = "30078-01.html"; - } - else if (hasQuestItems(player, INGREDIENT_LIST, PANOS_CONTRACT) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5)) - { - if (getQuestItemsCount(player, HOBGOBLIN_AMULET) < 30) - { + } else if (hasQuestItems(player, INGREDIENT_LIST, PANOS_CONTRACT) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5)) { + if (getQuestItemsCount(player, HOBGOBLIN_AMULET) < 30) { htmltext = "30078-02.html"; - } - else - { + } else { takeItems(player, PANOS_CONTRACT, 1); takeItems(player, HOBGOBLIN_AMULET, -1); giveItems(player, DIONIAN_POTATO, 1); htmltext = "30078-03.html"; } - } - else if (hasQuestItems(player, INGREDIENT_LIST, DIONIAN_POTATO) && !hasQuestItems(player, PANOS_CONTRACT) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5)) - { + } else if (hasQuestItems(player, INGREDIENT_LIST, DIONIAN_POTATO) && !hasQuestItems(player, PANOS_CONTRACT) && ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) < 5)) { htmltext = "30078-04.html"; } break; } - case MAGISTER_MIRIEN: - { - if (hasQuestItems(player, INGREDIENT_LIST)) - { + case MAGISTER_MIRIEN: { + if (hasQuestItems(player, INGREDIENT_LIST)) { htmltext = "30461-01.html"; - } - else - { - if ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) == 0) - { - if ((getQuestItemsCount(player, JONASS_1ST_STEAK_DISH) + getQuestItemsCount(player, JONASS_2ND_STEAK_DISH) + getQuestItemsCount(player, JONASS_3RD_STEAK_DISH) + getQuestItemsCount(player, JONASS_4TH_STEAK_DISH) + getQuestItemsCount(player, JONASS_5TH_STEAK_DISH)) == 1) - { - if ((getQuestItemsCount(player, MIRIENS_REVIEW_1) + getQuestItemsCount(player, MIRIENS_REVIEW_2) + getQuestItemsCount(player, MIRIENS_REVIEW_3) + getQuestItemsCount(player, MIRIENS_REVIEW_4) + getQuestItemsCount(player, MIRIENS_REVIEW_5)) == 0) - { - if (hasQuestItems(player, JONASS_1ST_STEAK_DISH)) - { + } else { + if ((getQuestItemsCount(player, RED_MANDRAGORA_SAP) + getQuestItemsCount(player, WHITE_MANDRAGORA_SAP) + getQuestItemsCount(player, HONEY) + getQuestItemsCount(player, GOLDEN_HONEY) + getQuestItemsCount(player, DIONIAN_POTATO) + getQuestItemsCount(player, GREEN_MOSS_BUNDLE) + + getQuestItemsCount(player, BROWN_MOSS_BUNDLE) + getQuestItemsCount(player, MONSTER_EYE_MEAT)) == 0) { + if ((getQuestItemsCount(player, JONASS_1ST_STEAK_DISH) + getQuestItemsCount(player, JONASS_2ND_STEAK_DISH) + getQuestItemsCount(player, JONASS_3RD_STEAK_DISH) + getQuestItemsCount(player, JONASS_4TH_STEAK_DISH) + getQuestItemsCount(player, JONASS_5TH_STEAK_DISH)) == 1) { + if ((getQuestItemsCount(player, MIRIENS_REVIEW_1) + getQuestItemsCount(player, MIRIENS_REVIEW_2) + getQuestItemsCount(player, MIRIENS_REVIEW_3) + getQuestItemsCount(player, MIRIENS_REVIEW_4) + getQuestItemsCount(player, MIRIENS_REVIEW_5)) == 0) { + if (hasQuestItems(player, JONASS_1ST_STEAK_DISH)) { takeItems(player, JONASS_1ST_STEAK_DISH, 1); giveItems(player, MIRIENS_REVIEW_1, 1); htmltext = "30461-02t1.html"; } - if (hasQuestItems(player, JONASS_2ND_STEAK_DISH)) - { + if (hasQuestItems(player, JONASS_2ND_STEAK_DISH)) { takeItems(player, JONASS_2ND_STEAK_DISH, 1); giveItems(player, MIRIENS_REVIEW_2, 1); htmltext = "30461-02t2.html"; } - if (hasQuestItems(player, JONASS_3RD_STEAK_DISH)) - { + if (hasQuestItems(player, JONASS_3RD_STEAK_DISH)) { takeItems(player, JONASS_3RD_STEAK_DISH, 1); giveItems(player, MIRIENS_REVIEW_3, 1); htmltext = "30461-02t3.html"; } - if (hasQuestItems(player, JONASS_4TH_STEAK_DISH)) - { + if (hasQuestItems(player, JONASS_4TH_STEAK_DISH)) { takeItems(player, JONASS_4TH_STEAK_DISH, 1); giveItems(player, MIRIENS_REVIEW_4, 1); htmltext = "30461-02t4.html"; } - if (hasQuestItems(player, JONASS_5TH_STEAK_DISH)) - { + if (hasQuestItems(player, JONASS_5TH_STEAK_DISH)) { takeItems(player, JONASS_5TH_STEAK_DISH, 1); giveItems(player, MIRIENS_REVIEW_5, 1); htmltext = "30461-02t5.html"; } } - } - else - { - if ((getQuestItemsCount(player, MIRIENS_REVIEW_1) + getQuestItemsCount(player, MIRIENS_REVIEW_2) + getQuestItemsCount(player, MIRIENS_REVIEW_3) + getQuestItemsCount(player, MIRIENS_REVIEW_4) + getQuestItemsCount(player, MIRIENS_REVIEW_5)) == 1) - { + } else { + if ((getQuestItemsCount(player, MIRIENS_REVIEW_1) + getQuestItemsCount(player, MIRIENS_REVIEW_2) + getQuestItemsCount(player, MIRIENS_REVIEW_3) + getQuestItemsCount(player, MIRIENS_REVIEW_4) + getQuestItemsCount(player, MIRIENS_REVIEW_5)) == 1) { htmltext = "30461-04.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00331_ArrowOfVengeance/Q00331_ArrowOfVengeance.java b/src/main/java/com/l2jserver/datapack/quests/Q00331_ArrowOfVengeance/Q00331_ArrowOfVengeance.java index 4159914c5c..509139c08e 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00331_ArrowOfVengeance/Q00331_ArrowOfVengeance.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00331_ArrowOfVengeance/Q00331_ArrowOfVengeance.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.model.quest.State; * Arrow for Vengeance (331) * @author xban1x */ -public class Q00331_ArrowOfVengeance extends Quest -{ +public class Q00331_ArrowOfVengeance extends Quest { // NPCs private static final int BELTON = 30125; // Items @@ -42,8 +41,7 @@ public class Q00331_ArrowOfVengeance extends Quest private static final int WYRMS_TOOTH = 1454; // Monster private static final Map<Integer, Integer> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(20145, 59); // Harpy MONSTERS.put(20158, 61); // Medusa MONSTERS.put(20176, 60); // Wyrm @@ -56,8 +54,7 @@ public class Q00331_ArrowOfVengeance extends Quest private static final int BONUS = 3100; private static final int BONUS_COUNT = 10; - public Q00331_ArrowOfVengeance() - { + public Q00331_ArrowOfVengeance() { super(331, Q00331_ArrowOfVengeance.class.getSimpleName(), "Arrow for Vengeance"); addStartNpc(BELTON); addTalkId(BELTON); @@ -66,28 +63,22 @@ public class Q00331_ArrowOfVengeance extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st != null) - { - switch (event) - { - case "30125-03.htm": - { + if (st != null) { + switch (event) { + case "30125-03.htm": { st.startQuest(); htmltext = event; break; } - case "30125-06.html": - { + case "30125-06.html": { st.exitQuest(true, true); htmltext = event; break; } - case "30125-07.html": - { + case "30125-07.html": { htmltext = event; break; } @@ -97,30 +88,23 @@ public class Q00331_ArrowOfVengeance extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = player.getLevel() < MIN_LVL ? "30125-01.htm" : "30125-02.htm"; break; } - case State.STARTED: - { + case State.STARTED: { final long harpyFeathers = st.getQuestItemsCount(HARPY_FEATHER); final long medusaVenoms = st.getQuestItemsCount(MEDUSA_VENOM); final long wyrmsTeeth = st.getQuestItemsCount(WYRMS_TOOTH); - if ((harpyFeathers + medusaVenoms + wyrmsTeeth) > 0) - { + if ((harpyFeathers + medusaVenoms + wyrmsTeeth) > 0) { st.giveAdena(((harpyFeathers * HARPY_FEATHER_ADENA) + (medusaVenoms * MEDUSA_VENOM_ADENA) + (wyrmsTeeth * WYRMS_TOOTH_ADENA) + ((harpyFeathers + medusaVenoms + wyrmsTeeth) >= BONUS_COUNT ? BONUS : 0)), true); takeItems(player, -1, HARPY_FEATHER, MEDUSA_VENOM, WYRMS_TOOTH); htmltext = "30125-05.html"; - } - else - { + } else { htmltext = "30125-04.html"; } break; @@ -130,27 +114,20 @@ public class Q00331_ArrowOfVengeance extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) { final QuestState st = getQuestState(player, false); - if (st != null) - { - if (getRandom(100) < MONSTERS.get(npc.getId())) - { - switch (npc.getId()) - { - case 20145: - { + if (st != null) { + if (getRandom(100) < MONSTERS.get(npc.getId())) { + switch (npc.getId()) { + case 20145: { st.giveItems(HARPY_FEATHER, 1); break; } - case 20158: - { + case 20158: { st.giveItems(MEDUSA_VENOM, 1); break; } - case 20176: - { + case 20176: { st.giveItems(WYRMS_TOOTH, 1); break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00333_HuntOfTheBlackLion/Q00333_HuntOfTheBlackLion.java b/src/main/java/com/l2jserver/datapack/quests/Q00333_HuntOfTheBlackLion/Q00333_HuntOfTheBlackLion.java index 778e381021..7b361d8fd2 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00333_HuntOfTheBlackLion/Q00333_HuntOfTheBlackLion.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00333_HuntOfTheBlackLion/Q00333_HuntOfTheBlackLion.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Hunt Of The Black Lion (333) * @author ivantotov */ -public final class Q00333_HuntOfTheBlackLion extends Quest -{ +public final class Q00333_HuntOfTheBlackLion extends Quest { // NPCs private static final int ABYSSAL_CELEBRANT_UNDRIAS = 30130; private static final int BLACKSMITH_RUPIO = 30471; @@ -111,8 +110,7 @@ public final class Q00333_HuntOfTheBlackLion extends Quest // Misc private static final int MIN_LEVEL = 25; - public Q00333_HuntOfTheBlackLion() - { + public Q00333_HuntOfTheBlackLion() { super(333, Q00333_HuntOfTheBlackLion.class.getSimpleName(), "Hunt Of The Black Lion"); addStartNpc(MERCENARY_CAPTAIN_SOPHYA); addTalkId(MERCENARY_CAPTAIN_SOPHYA, ABYSSAL_CELEBRANT_UNDRIAS, BLACKSMITH_RUPIO, IRON_GATES_LOCKIRIN, MERCENARY_REEDFOOT, GUILDSMAN_MORGON); @@ -121,23 +119,18 @@ public final class Q00333_HuntOfTheBlackLion extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); final int chance = getRandom(100); final int chance1 = getRandom(100); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "30735-04.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "30735-04.htm": { + if (qs.isCreated()) { qs.startQuest(); htmltext = event; } @@ -155,135 +148,88 @@ public final class Q00333_HuntOfTheBlackLion extends Quest case "30735-25b.html": case "30736-06.html": case "30736-09.html": - case "30737-07.html": - { + case "30737-07.html": { htmltext = event; break; } - case "30735-10.html": - { - if (!hasQuestItems(player, SOPHYAS_1ST_ORDER)) - { + case "30735-10.html": { + if (!hasQuestItems(player, SOPHYAS_1ST_ORDER)) { giveItems(player, SOPHYAS_1ST_ORDER, 1); htmltext = event; } break; } - case "30735-11.html": - { - if (!hasQuestItems(player, SOPHYAS_2ND_ORDER)) - { + case "30735-11.html": { + if (!hasQuestItems(player, SOPHYAS_2ND_ORDER)) { giveItems(player, SOPHYAS_2ND_ORDER, 1); htmltext = event; } break; } - case "30735-12.html": - { - if (!hasQuestItems(player, SOPHYAS_3RD_ORDER)) - { + case "30735-12.html": { + if (!hasQuestItems(player, SOPHYAS_3RD_ORDER)) { giveItems(player, SOPHYAS_3RD_ORDER, 1); htmltext = event; } break; } - case "30735-13.html": - { - if (!hasQuestItems(player, SOPHYAS_4TH_ORDER)) - { + case "30735-13.html": { + if (!hasQuestItems(player, SOPHYAS_4TH_ORDER)) { giveItems(player, SOPHYAS_4TH_ORDER, 1); htmltext = event; } break; } - case "30735-16.html": - { - if (getQuestItemsCount(player, LIONS_CLAW) < 10) - { + case "30735-16.html": { + if (getQuestItemsCount(player, LIONS_CLAW) < 10) { htmltext = event; - } - else if ((getQuestItemsCount(player, LIONS_CLAW) >= 10) && (getQuestItemsCount(player, LIONS_EYE) < 4)) - { + } else if ((getQuestItemsCount(player, LIONS_CLAW) >= 10) && (getQuestItemsCount(player, LIONS_EYE) < 4)) { giveItems(player, LIONS_EYE, 1); - if (chance < 25) - { + if (chance < 25) { giveItems(player, HEALING_POTION, 20); - } - else if (chance < 50) - { - if (player.isInCategory(CategoryType.FIGHTER_GROUP)) - { + } else if (chance < 50) { + if (player.isInCategory(CategoryType.FIGHTER_GROUP)) { giveItems(player, SOULSHOT_D_GRADE, 100); - } - else if (player.isInCategory(CategoryType.MAGE_GROUP)) - { + } else if (player.isInCategory(CategoryType.MAGE_GROUP)) { giveItems(player, SPIRITSHOT_D_GRADE, 50); } - } - else if (chance < 75) - { + } else if (chance < 75) { giveItems(player, SCROLL_OF_ESCAPE, 20); - } - else - { + } else { giveItems(player, ALACRITY_POTION, 3); } takeItems(player, LIONS_CLAW, 10); htmltext = "30735-17a.html"; - } - else if ((getQuestItemsCount(player, LIONS_CLAW) >= 10) && (getQuestItemsCount(player, LIONS_EYE) >= 4) && (getQuestItemsCount(player, LIONS_EYE) <= 7)) - { + } else if ((getQuestItemsCount(player, LIONS_CLAW) >= 10) && (getQuestItemsCount(player, LIONS_EYE) >= 4) && (getQuestItemsCount(player, LIONS_EYE) <= 7)) { giveItems(player, LIONS_EYE, 1); - if (chance < 25) - { + if (chance < 25) { giveItems(player, HEALING_POTION, 25); - } - else if (chance < 50) - { - if (player.isInCategory(CategoryType.FIGHTER_GROUP)) - { + } else if (chance < 50) { + if (player.isInCategory(CategoryType.FIGHTER_GROUP)) { giveItems(player, SOULSHOT_D_GRADE, 200); - } - else if (player.isInCategory(CategoryType.MAGE_GROUP)) - { + } else if (player.isInCategory(CategoryType.MAGE_GROUP)) { giveItems(player, SPIRITSHOT_D_GRADE, 100); } - } - else if (chance < 75) - { + } else if (chance < 75) { giveItems(player, SCROLL_OF_ESCAPE, 20); - } - else - { + } else { giveItems(player, ALACRITY_POTION, 3); } takeItems(player, LIONS_CLAW, 10); htmltext = "30735-18b.html"; - } - else if ((getQuestItemsCount(player, LIONS_CLAW) >= 10) && (getQuestItemsCount(player, LIONS_EYE) >= 8)) - { + } else if ((getQuestItemsCount(player, LIONS_CLAW) >= 10) && (getQuestItemsCount(player, LIONS_EYE) >= 8)) { takeItems(player, LIONS_EYE, 8); - if (chance < 25) - { + if (chance < 25) { giveItems(player, HEALING_POTION, 50); - } - else if (chance < 50) - { - if (player.isInCategory(CategoryType.FIGHTER_GROUP)) - { + } else if (chance < 50) { + if (player.isInCategory(CategoryType.FIGHTER_GROUP)) { giveItems(player, SOULSHOT_D_GRADE, 400); - } - else if (player.isInCategory(CategoryType.MAGE_GROUP)) - { + } else if (player.isInCategory(CategoryType.MAGE_GROUP)) { giveItems(player, SPIRITSHOT_D_GRADE, 200); } - } - else if (chance < 75) - { + } else if (chance < 75) { giveItems(player, SCROLL_OF_ESCAPE, 30); - } - else - { + } else { giveItems(player, ALACRITY_POTION, 4); } takeItems(player, LIONS_CLAW, 10); @@ -291,8 +237,7 @@ public final class Q00333_HuntOfTheBlackLion extends Quest } break; } - case "30735-20.html": - { + case "30735-20.html": { takeItems(player, SOPHYAS_1ST_ORDER, -1); takeItems(player, SOPHYAS_2ND_ORDER, -1); takeItems(player, SOPHYAS_3RD_ORDER, -1); @@ -300,45 +245,34 @@ public final class Q00333_HuntOfTheBlackLion extends Quest htmltext = event; break; } - case "30735-26.html": - { - if (hasQuestItems(player, BLACK_LION_MARK)) - { + case "30735-26.html": { + if (hasQuestItems(player, BLACK_LION_MARK)) { giveAdena(player, 12400, true); qs.exitQuest(true, true); htmltext = event; } break; } - case "30130-04.html": - { - if (hasQuestItems(player, COMPLETE_STATUE_OF_SHILEN)) - { + case "30130-04.html": { + if (hasQuestItems(player, COMPLETE_STATUE_OF_SHILEN)) { giveAdena(player, 30000, true); takeItems(player, COMPLETE_STATUE_OF_SHILEN, 1); htmltext = event; } break; } - case "30471-03.html": - { - if (!hasQuestItems(player, STATUE_OF_SHILEN_HEAD, STATUE_OF_SHILEN_TORSO, STATUE_OF_SHILEN_ARM, STATUE_OF_SHILEN_LEG)) - { + case "30471-03.html": { + if (!hasQuestItems(player, STATUE_OF_SHILEN_HEAD, STATUE_OF_SHILEN_TORSO, STATUE_OF_SHILEN_ARM, STATUE_OF_SHILEN_LEG)) { htmltext = event; - } - else - { - if (getRandom(100) < 50) - { + } else { + if (getRandom(100) < 50) { giveItems(player, COMPLETE_STATUE_OF_SHILEN, 1); takeItems(player, STATUE_OF_SHILEN_HEAD, 1); takeItems(player, STATUE_OF_SHILEN_TORSO, 1); takeItems(player, STATUE_OF_SHILEN_ARM, 1); takeItems(player, STATUE_OF_SHILEN_LEG, 1); htmltext = "30471-04.html"; - } - else - { + } else { takeItems(player, STATUE_OF_SHILEN_HEAD, 1); takeItems(player, STATUE_OF_SHILEN_TORSO, 1); takeItems(player, STATUE_OF_SHILEN_ARM, 1); @@ -348,25 +282,18 @@ public final class Q00333_HuntOfTheBlackLion extends Quest } break; } - case "30471-06.html": - { - if (!hasQuestItems(player, FRAGMENT_OF_ANCIENT_TABLET_1ST_PIECE, FRAGMENT_OF_ANCIENT_TABLET_2ND_PIECE, FRAGMENT_OF_ANCIENT_TABLET_3RD_PIECE, FRAGMENT_OF_ANCIENT_TABLET_4TH_PIECE)) - { + case "30471-06.html": { + if (!hasQuestItems(player, FRAGMENT_OF_ANCIENT_TABLET_1ST_PIECE, FRAGMENT_OF_ANCIENT_TABLET_2ND_PIECE, FRAGMENT_OF_ANCIENT_TABLET_3RD_PIECE, FRAGMENT_OF_ANCIENT_TABLET_4TH_PIECE)) { htmltext = event; - } - else - { - if (getRandom(100) < 50) - { + } else { + if (getRandom(100) < 50) { giveItems(player, COMPLETE_ANCIENT_TABLET, 1); takeItems(player, FRAGMENT_OF_ANCIENT_TABLET_1ST_PIECE, 1); takeItems(player, FRAGMENT_OF_ANCIENT_TABLET_2ND_PIECE, 1); takeItems(player, FRAGMENT_OF_ANCIENT_TABLET_3RD_PIECE, 1); takeItems(player, FRAGMENT_OF_ANCIENT_TABLET_4TH_PIECE, 1); htmltext = "30471-07.html"; - } - else - { + } else { takeItems(player, FRAGMENT_OF_ANCIENT_TABLET_1ST_PIECE, 1); takeItems(player, FRAGMENT_OF_ANCIENT_TABLET_2ND_PIECE, 1); takeItems(player, FRAGMENT_OF_ANCIENT_TABLET_3RD_PIECE, 1); @@ -376,256 +303,149 @@ public final class Q00333_HuntOfTheBlackLion extends Quest } break; } - case "30531-04.html": - { - if (hasQuestItems(player, COMPLETE_ANCIENT_TABLET)) - { + case "30531-04.html": { + if (hasQuestItems(player, COMPLETE_ANCIENT_TABLET)) { giveAdena(player, 30000, true); takeItems(player, COMPLETE_ANCIENT_TABLET, 1); htmltext = event; } break; } - case "30736-03.html": - { - if ((getQuestItemsCount(player, Inventory.ADENA_ID) < 650) && ((getQuestItemsCount(player, CARGO_BOX_1ST) + getQuestItemsCount(player, CARGO_BOX_2ND) + getQuestItemsCount(player, CARGO_BOX_3RD) + getQuestItemsCount(player, CARGO_BOX_4TH)) >= 1)) - { + case "30736-03.html": { + if ((getQuestItemsCount(player, Inventory.ADENA_ID) < 650) && ((getQuestItemsCount(player, CARGO_BOX_1ST) + getQuestItemsCount(player, CARGO_BOX_2ND) + getQuestItemsCount(player, CARGO_BOX_3RD) + getQuestItemsCount(player, CARGO_BOX_4TH)) >= 1)) { htmltext = event; - } - else if ((getQuestItemsCount(player, Inventory.ADENA_ID) >= 650) && ((getQuestItemsCount(player, CARGO_BOX_1ST) + getQuestItemsCount(player, CARGO_BOX_2ND) + getQuestItemsCount(player, CARGO_BOX_3RD) + getQuestItemsCount(player, CARGO_BOX_4TH)) >= 1)) - { + } else if ((getQuestItemsCount(player, Inventory.ADENA_ID) >= 650) && ((getQuestItemsCount(player, CARGO_BOX_1ST) + getQuestItemsCount(player, CARGO_BOX_2ND) + getQuestItemsCount(player, CARGO_BOX_3RD) + getQuestItemsCount(player, CARGO_BOX_4TH)) >= 1)) { takeItems(player, Inventory.ADENA_ID, 650); - if (hasQuestItems(player, CARGO_BOX_1ST)) - { + if (hasQuestItems(player, CARGO_BOX_1ST)) { takeItems(player, CARGO_BOX_1ST, 1); - } - else if (hasQuestItems(player, CARGO_BOX_2ND)) - { + } else if (hasQuestItems(player, CARGO_BOX_2ND)) { takeItems(player, CARGO_BOX_2ND, 1); - } - else if (hasQuestItems(player, CARGO_BOX_3RD)) - { + } else if (hasQuestItems(player, CARGO_BOX_3RD)) { takeItems(player, CARGO_BOX_3RD, 1); - } - else if (hasQuestItems(player, CARGO_BOX_4TH)) - { + } else if (hasQuestItems(player, CARGO_BOX_4TH)) { takeItems(player, CARGO_BOX_4TH, 1); } - if (chance < 40) - { - if (chance1 < 33) - { + if (chance < 40) { + if (chance1 < 33) { giveItems(player, GLUDIO_APPLES, 1); htmltext = "30736-04a.html"; - } - else if (chance1 < 66) - { + } else if (chance1 < 66) { giveItems(player, DION_CORN_MEAL, 1); htmltext = "30736-04b.html"; - } - else - { + } else { giveItems(player, DIRE_WOLF_PELTS, 1); htmltext = "30736-04c.html"; } - } - else if (chance < 60) - { - if (chance1 < 33) - { + } else if (chance < 60) { + if (chance1 < 33) { giveItems(player, MOONSTONE, 1); htmltext = "30736-04d.html"; - } - else if (chance1 < 66) - { + } else if (chance1 < 66) { giveItems(player, GLUDIO_WHEAT_FLOUR, 1); htmltext = "30736-04e.html"; - } - else - { + } else { giveItems(player, SPIDERSILK_ROPE, 1); htmltext = "30736-04f.html"; } - } - else if (chance < 70) - { - if (chance1 < 33) - { + } else if (chance < 70) { + if (chance1 < 33) { giveItems(player, ALEXANDRITE, 1); htmltext = "30736-04g.html"; - } - else if (chance1 < 66) - { + } else if (chance1 < 66) { giveItems(player, SILVER_TEA_SERVICE, 1); htmltext = "30736-04h.html"; - } - else - { + } else { giveItems(player, MECHANIC_GOLEM_SPACE_PARTS, 1); htmltext = "30736-04i.html"; } - } - else if (chance < 75) - { - if (chance1 < 33) - { + } else if (chance < 75) { + if (chance1 < 33) { giveItems(player, FIRE_EMERALD, 1); htmltext = "30736-04j.html"; - } - else if (chance1 < 66) - { + } else if (chance1 < 66) { giveItems(player, AVELLAN_SILK_FROCK, 1); htmltext = "30736-04k.html"; - } - else - { + } else { giveItems(player, FERIOTIC_PORCELAIN_URM, 1); htmltext = "30736-04l.html"; } - } - else if (chance < 76) - { + } else if (chance < 76) { giveItems(player, IMPERIAL_DIAMOND, 1); htmltext = "30736-04m.html"; - } - else if (getRandom(100) < 50) - { - if (chance1 < 25) - { + } else if (getRandom(100) < 50) { + if (chance1 < 25) { giveItems(player, STATUE_OF_SHILEN_HEAD, 1); - } - else if (chance1 < 50) - { + } else if (chance1 < 50) { giveItems(player, STATUE_OF_SHILEN_TORSO, 1); - } - else if (chance1 < 75) - { + } else if (chance1 < 75) { giveItems(player, STATUE_OF_SHILEN_ARM, 1); - } - else - { + } else { giveItems(player, STATUE_OF_SHILEN_LEG, 1); } htmltext = "30736-04n.html"; - } - else - { - if (chance1 < 25) - { + } else { + if (chance1 < 25) { giveItems(player, FRAGMENT_OF_ANCIENT_TABLET_1ST_PIECE, 1); - } - else if (chance1 < 50) - { + } else if (chance1 < 50) { giveItems(player, FRAGMENT_OF_ANCIENT_TABLET_2ND_PIECE, 1); - } - else if (chance1 < 75) - { + } else if (chance1 < 75) { giveItems(player, FRAGMENT_OF_ANCIENT_TABLET_3RD_PIECE, 1); - } - else - { + } else { giveItems(player, FRAGMENT_OF_ANCIENT_TABLET_4TH_PIECE, 1); } htmltext = "30736-04o.html"; } - } - else if ((getQuestItemsCount(player, CARGO_BOX_1ST) + getQuestItemsCount(player, CARGO_BOX_2ND) + getQuestItemsCount(player, CARGO_BOX_3RD) + getQuestItemsCount(player, CARGO_BOX_4TH)) < 1) - { + } else if ((getQuestItemsCount(player, CARGO_BOX_1ST) + getQuestItemsCount(player, CARGO_BOX_2ND) + getQuestItemsCount(player, CARGO_BOX_3RD) + getQuestItemsCount(player, CARGO_BOX_4TH)) < 1) { htmltext = "30736-05.html"; } break; } - case "30736-07.html": - { - if (player.getAdena() < (200 + (qs.getMemoState() * 200))) - { + case "30736-07.html": { + if (player.getAdena() < (200 + (qs.getMemoState() * 200))) { htmltext = event; - } - else if ((qs.getMemoState() * 100) > 200) - { + } else if ((qs.getMemoState() * 100) > 200) { htmltext = "30736-08.html"; - } - else - { - if (chance < 5) - { + } else { + if (chance < 5) { htmltext = "30736-08a.html"; - } - else if (chance < 10) - { + } else if (chance < 10) { htmltext = "30736-08b.html"; - } - else if (chance < 15) - { + } else if (chance < 15) { htmltext = "30736-08c.html"; - } - else if (chance < 20) - { + } else if (chance < 20) { htmltext = "30736-08d.html"; - } - else if (chance < 25) - { + } else if (chance < 25) { htmltext = "30736-08e.html"; - } - else if (chance < 30) - { + } else if (chance < 30) { htmltext = "30736-08f.html"; - } - else if (chance < 35) - { + } else if (chance < 35) { htmltext = "30736-08g.html"; - } - else if (chance < 40) - { + } else if (chance < 40) { htmltext = "30736-08h.html"; - } - else if (chance < 45) - { + } else if (chance < 45) { htmltext = "30736-08i.html"; - } - else if (chance < 50) - { + } else if (chance < 50) { htmltext = "30736-08j.html"; - } - else if (chance < 55) - { + } else if (chance < 55) { htmltext = "30736-08k.html"; - } - else if (chance < 60) - { + } else if (chance < 60) { htmltext = "30736-08l.html"; - } - else if (chance < 65) - { + } else if (chance < 65) { htmltext = "30736-08m.html"; - } - else if (chance < 70) - { + } else if (chance < 70) { htmltext = "30736-08n.html"; - } - else if (chance < 75) - { + } else if (chance < 75) { htmltext = "30736-08o.html"; - } - else if (chance < 80) - { + } else if (chance < 80) { htmltext = "30736-08p.html"; - } - else if (chance < 85) - { + } else if (chance < 85) { htmltext = "30736-08q.html"; - } - else if (chance < 90) - { + } else if (chance < 90) { htmltext = "30736-08r.html"; - } - else if (chance < 95) - { + } else if (chance < 95) { htmltext = "30736-08s.html"; - } - else - { + } else { htmltext = "30736-08t.html"; } takeItems(player, Inventory.ADENA_ID, 200 + (qs.getMemoState() * 200)); @@ -633,52 +453,33 @@ public final class Q00333_HuntOfTheBlackLion extends Quest } break; } - case "30737-06.html": - { - if ((getQuestItemsCount(player, CARGO_BOX_1ST) + getQuestItemsCount(player, CARGO_BOX_2ND) + getQuestItemsCount(player, CARGO_BOX_3RD) + getQuestItemsCount(player, CARGO_BOX_4TH)) < 1) - { + case "30737-06.html": { + if ((getQuestItemsCount(player, CARGO_BOX_1ST) + getQuestItemsCount(player, CARGO_BOX_2ND) + getQuestItemsCount(player, CARGO_BOX_3RD) + getQuestItemsCount(player, CARGO_BOX_4TH)) < 1) { htmltext = event; - } - else - { - if (hasQuestItems(player, CARGO_BOX_1ST)) - { + } else { + if (hasQuestItems(player, CARGO_BOX_1ST)) { takeItems(player, CARGO_BOX_1ST, 1); - } - else if (hasQuestItems(player, CARGO_BOX_2ND)) - { + } else if (hasQuestItems(player, CARGO_BOX_2ND)) { takeItems(player, CARGO_BOX_2ND, 1); - } - else if (hasQuestItems(player, CARGO_BOX_3RD)) - { + } else if (hasQuestItems(player, CARGO_BOX_3RD)) { takeItems(player, CARGO_BOX_3RD, 1); - } - else if (hasQuestItems(player, CARGO_BOX_4TH)) - { + } else if (hasQuestItems(player, CARGO_BOX_4TH)) { takeItems(player, CARGO_BOX_4TH, 1); } - if (getQuestItemsCount(player, GUILD_COIN) < 80) - { + if (getQuestItemsCount(player, GUILD_COIN) < 80) { giveItems(player, GUILD_COIN, 1); - } - else - { + } else { takeItems(player, GUILD_COIN, 80); } - if (getQuestItemsCount(player, GUILD_COIN) < 40) - { + if (getQuestItemsCount(player, GUILD_COIN) < 40) { giveAdena(player, 100, true); htmltext = "30737-03.html"; - } - else if ((getQuestItemsCount(player, GUILD_COIN) >= 40) && (getQuestItemsCount(player, GUILD_COIN) < 80)) - { + } else if ((getQuestItemsCount(player, GUILD_COIN) >= 40) && (getQuestItemsCount(player, GUILD_COIN) < 80)) { giveAdena(player, 200, true); htmltext = "30737-04.html"; - } - else - { + } else { giveAdena(player, 300, true); htmltext = "30737-05.html"; } @@ -690,308 +491,227 @@ public final class Q00333_HuntOfTheBlackLion extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case MARSH_STAKATO: - { - if (hasQuestItems(killer, SOPHYAS_4TH_ORDER)) - { - if (getRandom(100) < 55) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case MARSH_STAKATO: { + if (hasQuestItems(killer, SOPHYAS_4TH_ORDER)) { + if (getRandom(100) < 55) { giveItems(killer, STAKATO_TALON, 1); } - if (getRandom(100) < 12) - { + if (getRandom(100) < 12) { giveItems(killer, CARGO_BOX_4TH, 1); } - if ((getRandom(100) < 2) && hasQuestItems(killer, SOPHYAS_4TH_ORDER)) - { + if ((getRandom(100) < 2) && hasQuestItems(killer, SOPHYAS_4TH_ORDER)) { addSpawn(MARSH_STAKATO_MARQUESS, npc, true, 0, false); } } break; } - case NEER_CRAWLER: - { - if (hasQuestItems(killer, SOPHYAS_1ST_ORDER)) - { - if (getRandom(2) == 0) - { + case NEER_CRAWLER: { + if (hasQuestItems(killer, SOPHYAS_1ST_ORDER)) { + if (getRandom(2) == 0) { giveItems(killer, UNDEAD_ASH, 1); } - if (getRandom(100) < 11) - { + if (getRandom(100) < 11) { giveItems(killer, CARGO_BOX_1ST, 1); } } break; } - case SPECTER: - { - if (hasQuestItems(killer, SOPHYAS_1ST_ORDER)) - { - if (getRandom(100) < 60) - { + case SPECTER: { + if (hasQuestItems(killer, SOPHYAS_1ST_ORDER)) { + if (getRandom(100) < 60) { giveItems(killer, UNDEAD_ASH, 1); } - if (getRandom(100) < 8) - { + if (getRandom(100) < 8) { giveItems(killer, CARGO_BOX_1ST, 1); } } break; } - case SORROW_MAIDEN: - { - if (hasQuestItems(killer, SOPHYAS_1ST_ORDER)) - { - if (getRandom(100) < 60) - { + case SORROW_MAIDEN: { + if (hasQuestItems(killer, SOPHYAS_1ST_ORDER)) { + if (getRandom(100) < 60) { giveItems(killer, UNDEAD_ASH, 1); } - if (getRandom(100) < 9) - { + if (getRandom(100) < 9) { giveItems(killer, CARGO_BOX_1ST, 1); } } break; } - case NEER_CRAWLER_BERSERKER: - { - if (hasQuestItems(killer, SOPHYAS_1ST_ORDER)) - { - if (getRandom(2) == 0) - { + case NEER_CRAWLER_BERSERKER: { + if (hasQuestItems(killer, SOPHYAS_1ST_ORDER)) { + if (getRandom(2) == 0) { giveItems(killer, UNDEAD_ASH, 1); } - if (getRandom(100) < 12) - { + if (getRandom(100) < 12) { giveItems(killer, CARGO_BOX_1ST, 1); } } break; } - case STRAIN: - { - if (hasQuestItems(killer, SOPHYAS_1ST_ORDER)) - { - if (getRandom(2) == 0) - { + case STRAIN: { + if (hasQuestItems(killer, SOPHYAS_1ST_ORDER)) { + if (getRandom(2) == 0) { giveItems(killer, UNDEAD_ASH, 1); } - if (getRandom(100) < 13) - { + if (getRandom(100) < 13) { giveItems(killer, CARGO_BOX_1ST, 1); } } break; } - case GHOUL: - { - if (hasQuestItems(killer, SOPHYAS_1ST_ORDER)) - { - if (getRandom(2) == 0) - { + case GHOUL: { + if (hasQuestItems(killer, SOPHYAS_1ST_ORDER)) { + if (getRandom(2) == 0) { giveItems(killer, UNDEAD_ASH, 1); } - if (getRandom(100) < 15) - { + if (getRandom(100) < 15) { giveItems(killer, CARGO_BOX_1ST, 1); } } break; } - case OL_MAHUM_GUERILLA: - { - if (hasQuestItems(killer, SOPHYAS_2ND_ORDER)) - { - if (getRandom(2) == 0) - { + case OL_MAHUM_GUERILLA: { + if (hasQuestItems(killer, SOPHYAS_2ND_ORDER)) { + if (getRandom(2) == 0) { giveItems(killer, BLOODY_AXE_INSIGNIA, 1); } - if (getRandom(100) < 9) - { + if (getRandom(100) < 9) { giveItems(killer, CARGO_BOX_2ND, 1); } } break; } - case OL_MAHUM_RAIDER: - { - if (hasQuestItems(killer, SOPHYAS_2ND_ORDER)) - { - if (getRandom(2) == 0) - { + case OL_MAHUM_RAIDER: { + if (hasQuestItems(killer, SOPHYAS_2ND_ORDER)) { + if (getRandom(2) == 0) { giveItems(killer, BLOODY_AXE_INSIGNIA, 1); } - if (getRandom(100) < 10) - { + if (getRandom(100) < 10) { giveItems(killer, CARGO_BOX_2ND, 1); } } break; } - case OL_MAHUM_MARKSMAN: - { - if (hasQuestItems(killer, SOPHYAS_2ND_ORDER)) - { - if (getRandom(2) == 0) - { + case OL_MAHUM_MARKSMAN: { + if (hasQuestItems(killer, SOPHYAS_2ND_ORDER)) { + if (getRandom(2) == 0) { giveItems(killer, BLOODY_AXE_INSIGNIA, 1); } - if (getRandom(100) < 11) - { + if (getRandom(100) < 11) { giveItems(killer, CARGO_BOX_2ND, 1); } } break; } - case OL_MAHUM_SERGEANT: - { - if (hasQuestItems(killer, SOPHYAS_2ND_ORDER)) - { - if (getRandom(2) == 0) - { + case OL_MAHUM_SERGEANT: { + if (hasQuestItems(killer, SOPHYAS_2ND_ORDER)) { + if (getRandom(2) == 0) { giveItems(killer, BLOODY_AXE_INSIGNIA, 1); } - if (getRandom(100) < 12) - { + if (getRandom(100) < 12) { giveItems(killer, CARGO_BOX_2ND, 1); } } break; } - case OL_MAHUM_CAPTAIN: - { - if (hasQuestItems(killer, SOPHYAS_2ND_ORDER)) - { - if (getRandom(2) == 0) - { + case OL_MAHUM_CAPTAIN: { + if (hasQuestItems(killer, SOPHYAS_2ND_ORDER)) { + if (getRandom(2) == 0) { giveItems(killer, BLOODY_AXE_INSIGNIA, 1); } - if (getRandom(100) < 13) - { + if (getRandom(100) < 13) { giveItems(killer, CARGO_BOX_2ND, 1); } } break; } - case MARSH_STAKATO_WORKER: - { - if (hasQuestItems(killer, SOPHYAS_4TH_ORDER)) - { - if (getRandom(100) < 60) - { + case MARSH_STAKATO_WORKER: { + if (hasQuestItems(killer, SOPHYAS_4TH_ORDER)) { + if (getRandom(100) < 60) { giveItems(killer, STAKATO_TALON, 1); } - if (getRandom(100) < 13) - { + if (getRandom(100) < 13) { giveItems(killer, CARGO_BOX_4TH, 1); } - if ((getRandom(100) < 2) && hasQuestItems(killer, SOPHYAS_4TH_ORDER)) - { + if ((getRandom(100) < 2) && hasQuestItems(killer, SOPHYAS_4TH_ORDER)) { addSpawn(MARSH_STAKATO_MARQUESS, npc, true, 0, false); } } break; } - case MARSH_STAKATO_SOLDIER: - { - if (hasQuestItems(killer, SOPHYAS_4TH_ORDER)) - { - if (getRandom(100) < 56) - { + case MARSH_STAKATO_SOLDIER: { + if (hasQuestItems(killer, SOPHYAS_4TH_ORDER)) { + if (getRandom(100) < 56) { giveItems(killer, STAKATO_TALON, 1); } - if (getRandom(100) < 14) - { + if (getRandom(100) < 14) { giveItems(killer, CARGO_BOX_4TH, 1); } - if ((getRandom(100) < 2) && hasQuestItems(killer, SOPHYAS_4TH_ORDER)) - { + if ((getRandom(100) < 2) && hasQuestItems(killer, SOPHYAS_4TH_ORDER)) { addSpawn(MARSH_STAKATO_MARQUESS, npc, true, 0, false); } } break; } - case MARSH_STAKATO_DRONE: - { - if (hasQuestItems(killer, SOPHYAS_4TH_ORDER)) - { - if (getRandom(100) < 60) - { + case MARSH_STAKATO_DRONE: { + if (hasQuestItems(killer, SOPHYAS_4TH_ORDER)) { + if (getRandom(100) < 60) { giveItems(killer, STAKATO_TALON, 1); } - if (getRandom(100) < 15) - { + if (getRandom(100) < 15) { giveItems(killer, CARGO_BOX_4TH, 1); } - if ((getRandom(100) < 2) && hasQuestItems(killer, SOPHYAS_4TH_ORDER)) - { + if ((getRandom(100) < 2) && hasQuestItems(killer, SOPHYAS_4TH_ORDER)) { addSpawn(MARSH_STAKATO_MARQUESS, npc, true, 0, false); } } break; } case DELU_LIZARDMAN: - case DELU_LIZARDMAN_SCOUT: - { - if (hasQuestItems(killer, SOPHYAS_3RD_ORDER)) - { - if (getRandom(2) == 0) - { + case DELU_LIZARDMAN_SCOUT: { + if (hasQuestItems(killer, SOPHYAS_3RD_ORDER)) { + if (getRandom(2) == 0) { giveItems(killer, DELU_LIZARDMAN_FANG, 1); } - if (getRandom(100) < 14) - { + if (getRandom(100) < 14) { giveItems(killer, CARGO_BOX_3RD, 1); } } - if ((getRandom(100) < 3) && hasQuestItems(killer, SOPHYAS_3RD_ORDER)) - { + if ((getRandom(100) < 3) && hasQuestItems(killer, SOPHYAS_3RD_ORDER)) { addSpawn(DELU_LIZARDMAN_HEADHUNTER, npc, true, 0, false); addSpawn(DELU_LIZARDMAN_HEADHUNTER, npc, true, 0, false); } break; } - case DELU_LIZARDMAN_WARRIOR: - { - if (hasQuestItems(killer, SOPHYAS_3RD_ORDER)) - { - if (getRandom(2) == 0) - { + case DELU_LIZARDMAN_WARRIOR: { + if (hasQuestItems(killer, SOPHYAS_3RD_ORDER)) { + if (getRandom(2) == 0) { giveItems(killer, DELU_LIZARDMAN_FANG, 1); } - if (getRandom(100) < 15) - { + if (getRandom(100) < 15) { giveItems(killer, CARGO_BOX_3RD, 1); } } - if ((getRandom(100) < 3) && hasQuestItems(killer, SOPHYAS_3RD_ORDER)) - { + if ((getRandom(100) < 3) && hasQuestItems(killer, SOPHYAS_3RD_ORDER)) { addSpawn(DELU_LIZARDMAN_HEADHUNTER, npc, true, 0, false); addSpawn(DELU_LIZARDMAN_HEADHUNTER, npc, true, 0, false); } break; } - case DELU_LIZARDMAN_HEADHUNTER: - { - if (hasQuestItems(killer, SOPHYAS_3RD_ORDER)) - { + case DELU_LIZARDMAN_HEADHUNTER: { + if (hasQuestItems(killer, SOPHYAS_3RD_ORDER)) { giveItems(killer, DELU_LIZARDMAN_FANG, 4); playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); } break; } - case MARSH_STAKATO_MARQUESS: - { - if (hasQuestItems(killer, SOPHYAS_4TH_ORDER)) - { + case MARSH_STAKATO_MARQUESS: { + if (hasQuestItems(killer, SOPHYAS_4TH_ORDER)) { giveItems(killer, STAKATO_TALON, 8); playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -1003,72 +723,45 @@ public final class Q00333_HuntOfTheBlackLion extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == MERCENARY_CAPTAIN_SOPHYA) - { - if (player.getLevel() < MIN_LEVEL) - { + if (qs.isCreated()) { + if (npc.getId() == MERCENARY_CAPTAIN_SOPHYA) { + if (player.getLevel() < MIN_LEVEL) { htmltext = "30735-01.htm"; - } - else - { - if (!hasQuestItems(player, BLACK_LION_MARK)) - { + } else { + if (!hasQuestItems(player, BLACK_LION_MARK)) { htmltext = "30735-02.htm"; - } - else - { + } else { htmltext = "30735-03.htm"; } } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case MERCENARY_CAPTAIN_SOPHYA: - { - if ((getQuestItemsCount(player, SOPHYAS_1ST_ORDER) + getQuestItemsCount(player, SOPHYAS_2ND_ORDER) + getQuestItemsCount(player, SOPHYAS_3RD_ORDER) + getQuestItemsCount(player, SOPHYAS_4TH_ORDER)) == 0) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case MERCENARY_CAPTAIN_SOPHYA: { + if ((getQuestItemsCount(player, SOPHYAS_1ST_ORDER) + getQuestItemsCount(player, SOPHYAS_2ND_ORDER) + getQuestItemsCount(player, SOPHYAS_3RD_ORDER) + getQuestItemsCount(player, SOPHYAS_4TH_ORDER)) == 0) { htmltext = "30735-14.html"; - } - else if (((getQuestItemsCount(player, SOPHYAS_1ST_ORDER) + getQuestItemsCount(player, SOPHYAS_2ND_ORDER) + getQuestItemsCount(player, SOPHYAS_3RD_ORDER) + getQuestItemsCount(player, SOPHYAS_4TH_ORDER)) == 1) + } else if (((getQuestItemsCount(player, SOPHYAS_1ST_ORDER) + getQuestItemsCount(player, SOPHYAS_2ND_ORDER) + getQuestItemsCount(player, SOPHYAS_3RD_ORDER) + getQuestItemsCount(player, SOPHYAS_4TH_ORDER)) == 1) && ((getQuestItemsCount(player, UNDEAD_ASH) + getQuestItemsCount(player, BLOODY_AXE_INSIGNIA) + getQuestItemsCount(player, DELU_LIZARDMAN_FANG) + getQuestItemsCount(player, STAKATO_TALON)) < 1) - && ((getQuestItemsCount(player, CARGO_BOX_1ST) + getQuestItemsCount(player, CARGO_BOX_2ND) + getQuestItemsCount(player, CARGO_BOX_3RD) + getQuestItemsCount(player, CARGO_BOX_4TH)) < 1)) - { + && ((getQuestItemsCount(player, CARGO_BOX_1ST) + getQuestItemsCount(player, CARGO_BOX_2ND) + getQuestItemsCount(player, CARGO_BOX_3RD) + getQuestItemsCount(player, CARGO_BOX_4TH)) < 1)) { htmltext = "30735-15.html"; - } - else if (((getQuestItemsCount(player, SOPHYAS_1ST_ORDER) + getQuestItemsCount(player, SOPHYAS_2ND_ORDER) + getQuestItemsCount(player, SOPHYAS_3RD_ORDER) + getQuestItemsCount(player, SOPHYAS_4TH_ORDER)) == 1) + } else if (((getQuestItemsCount(player, SOPHYAS_1ST_ORDER) + getQuestItemsCount(player, SOPHYAS_2ND_ORDER) + getQuestItemsCount(player, SOPHYAS_3RD_ORDER) + getQuestItemsCount(player, SOPHYAS_4TH_ORDER)) == 1) && ((getQuestItemsCount(player, UNDEAD_ASH) + getQuestItemsCount(player, BLOODY_AXE_INSIGNIA) + getQuestItemsCount(player, DELU_LIZARDMAN_FANG) + getQuestItemsCount(player, STAKATO_TALON)) < 1) - && ((getQuestItemsCount(player, CARGO_BOX_1ST) + getQuestItemsCount(player, CARGO_BOX_2ND) + getQuestItemsCount(player, CARGO_BOX_3RD) + getQuestItemsCount(player, CARGO_BOX_4TH)) >= 1)) - { + && ((getQuestItemsCount(player, CARGO_BOX_1ST) + getQuestItemsCount(player, CARGO_BOX_2ND) + getQuestItemsCount(player, CARGO_BOX_3RD) + getQuestItemsCount(player, CARGO_BOX_4TH)) >= 1)) { htmltext = "30735-15a.html"; - } - else if (((getQuestItemsCount(player, SOPHYAS_1ST_ORDER) + getQuestItemsCount(player, SOPHYAS_2ND_ORDER) + getQuestItemsCount(player, SOPHYAS_3RD_ORDER) + getQuestItemsCount(player, SOPHYAS_4TH_ORDER)) == 1) + } else if (((getQuestItemsCount(player, SOPHYAS_1ST_ORDER) + getQuestItemsCount(player, SOPHYAS_2ND_ORDER) + getQuestItemsCount(player, SOPHYAS_3RD_ORDER) + getQuestItemsCount(player, SOPHYAS_4TH_ORDER)) == 1) && ((getQuestItemsCount(player, UNDEAD_ASH) + getQuestItemsCount(player, BLOODY_AXE_INSIGNIA) + getQuestItemsCount(player, DELU_LIZARDMAN_FANG) + getQuestItemsCount(player, STAKATO_TALON)) >= 1) - && ((getQuestItemsCount(player, CARGO_BOX_1ST) + getQuestItemsCount(player, CARGO_BOX_2ND) + getQuestItemsCount(player, CARGO_BOX_3RD) + getQuestItemsCount(player, CARGO_BOX_4TH)) == 0)) - { + && ((getQuestItemsCount(player, CARGO_BOX_1ST) + getQuestItemsCount(player, CARGO_BOX_2ND) + getQuestItemsCount(player, CARGO_BOX_3RD) + getQuestItemsCount(player, CARGO_BOX_4TH)) == 0)) { final long itemcount = getQuestItemsCount(player, UNDEAD_ASH) + getQuestItemsCount(player, BLOODY_AXE_INSIGNIA) + getQuestItemsCount(player, DELU_LIZARDMAN_FANG) + getQuestItemsCount(player, STAKATO_TALON); - if (itemcount < 20) - { - - } - else if (itemcount < 50) - { + if (itemcount < 20) { + + } else if (itemcount < 50) { giveItems(player, LIONS_CLAW, 1); - } - else if (itemcount < 100) - { + } else if (itemcount < 100) { giveItems(player, LIONS_CLAW, 2); - } - else - { + } else { giveItems(player, LIONS_CLAW, 3); } final long ash = getQuestItemsCount(player, UNDEAD_ASH); @@ -1082,26 +775,17 @@ public final class Q00333_HuntOfTheBlackLion extends Quest takeItems(player, STAKATO_TALON, -1); qs.setMemoState(0); htmltext = "30735-22.html"; - } - else if (((getQuestItemsCount(player, SOPHYAS_1ST_ORDER) + getQuestItemsCount(player, SOPHYAS_2ND_ORDER) + getQuestItemsCount(player, SOPHYAS_3RD_ORDER) + getQuestItemsCount(player, SOPHYAS_4TH_ORDER)) == 1) + } else if (((getQuestItemsCount(player, SOPHYAS_1ST_ORDER) + getQuestItemsCount(player, SOPHYAS_2ND_ORDER) + getQuestItemsCount(player, SOPHYAS_3RD_ORDER) + getQuestItemsCount(player, SOPHYAS_4TH_ORDER)) == 1) && ((getQuestItemsCount(player, UNDEAD_ASH) + getQuestItemsCount(player, BLOODY_AXE_INSIGNIA) + getQuestItemsCount(player, DELU_LIZARDMAN_FANG) + getQuestItemsCount(player, STAKATO_TALON)) >= 1) - && ((getQuestItemsCount(player, CARGO_BOX_1ST) + getQuestItemsCount(player, CARGO_BOX_2ND) + getQuestItemsCount(player, CARGO_BOX_3RD) + getQuestItemsCount(player, CARGO_BOX_4TH)) >= 1)) - { + && ((getQuestItemsCount(player, CARGO_BOX_1ST) + getQuestItemsCount(player, CARGO_BOX_2ND) + getQuestItemsCount(player, CARGO_BOX_3RD) + getQuestItemsCount(player, CARGO_BOX_4TH)) >= 1)) { final long itemcount = getQuestItemsCount(player, UNDEAD_ASH) + getQuestItemsCount(player, BLOODY_AXE_INSIGNIA) + getQuestItemsCount(player, DELU_LIZARDMAN_FANG) + getQuestItemsCount(player, STAKATO_TALON); - if (itemcount < 20) - { - - } - else if (itemcount < 50) - { + if (itemcount < 20) { + + } else if (itemcount < 50) { giveItems(player, LIONS_CLAW, 1); - } - else if (itemcount < 100) - { + } else if (itemcount < 100) { giveItems(player, LIONS_CLAW, 2); - } - else - { + } else { giveItems(player, LIONS_CLAW, 3); } giveAdena(player, (getQuestItemsCount(player, UNDEAD_ASH) * 35), true); @@ -1117,79 +801,53 @@ public final class Q00333_HuntOfTheBlackLion extends Quest } break; } - case ABYSSAL_CELEBRANT_UNDRIAS: - { - if (!hasQuestItems(player, COMPLETE_STATUE_OF_SHILEN)) - { - if ((getQuestItemsCount(player, STATUE_OF_SHILEN_HEAD) + getQuestItemsCount(player, STATUE_OF_SHILEN_TORSO) + getQuestItemsCount(player, STATUE_OF_SHILEN_ARM) + getQuestItemsCount(player, STATUE_OF_SHILEN_LEG)) >= 1) - { + case ABYSSAL_CELEBRANT_UNDRIAS: { + if (!hasQuestItems(player, COMPLETE_STATUE_OF_SHILEN)) { + if ((getQuestItemsCount(player, STATUE_OF_SHILEN_HEAD) + getQuestItemsCount(player, STATUE_OF_SHILEN_TORSO) + getQuestItemsCount(player, STATUE_OF_SHILEN_ARM) + getQuestItemsCount(player, STATUE_OF_SHILEN_LEG)) >= 1) { htmltext = "30130-02.html"; - } - else - { + } else { htmltext = "30130-01.html"; } - } - else - { + } else { htmltext = "30130-03.html"; } break; } - case BLACKSMITH_RUPIO: - { + case BLACKSMITH_RUPIO: { if (((getQuestItemsCount(player, STATUE_OF_SHILEN_HEAD) + getQuestItemsCount(player, STATUE_OF_SHILEN_TORSO) + getQuestItemsCount(player, STATUE_OF_SHILEN_ARM) + getQuestItemsCount(player, STATUE_OF_SHILEN_LEG)) >= 1) || ((getQuestItemsCount(player, FRAGMENT_OF_ANCIENT_TABLET_1ST_PIECE) + getQuestItemsCount(player, FRAGMENT_OF_ANCIENT_TABLET_2ND_PIECE) + getQuestItemsCount(player, FRAGMENT_OF_ANCIENT_TABLET_3RD_PIECE) - + getQuestItemsCount(player, FRAGMENT_OF_ANCIENT_TABLET_4TH_PIECE)) >= 1)) - { + + getQuestItemsCount(player, FRAGMENT_OF_ANCIENT_TABLET_4TH_PIECE)) >= 1)) { htmltext = "30471-02.html"; - } - else - { + } else { htmltext = "30471-01.html"; } break; } - case IRON_GATES_LOCKIRIN: - { - if (!hasQuestItems(player, COMPLETE_ANCIENT_TABLET)) - { + case IRON_GATES_LOCKIRIN: { + if (!hasQuestItems(player, COMPLETE_ANCIENT_TABLET)) { if ((getQuestItemsCount(player, FRAGMENT_OF_ANCIENT_TABLET_1ST_PIECE) + getQuestItemsCount(player, FRAGMENT_OF_ANCIENT_TABLET_2ND_PIECE) + getQuestItemsCount(player, FRAGMENT_OF_ANCIENT_TABLET_3RD_PIECE) - + getQuestItemsCount(player, FRAGMENT_OF_ANCIENT_TABLET_4TH_PIECE)) >= 1) - { + + getQuestItemsCount(player, FRAGMENT_OF_ANCIENT_TABLET_4TH_PIECE)) >= 1) { htmltext = "30531-02.html"; - } - else - { + } else { htmltext = "30531-01.html"; } - } - else - { + } else { htmltext = "30531-03.html"; } break; } - case MERCENARY_REEDFOOT: - { - if ((getQuestItemsCount(player, CARGO_BOX_1ST) + getQuestItemsCount(player, CARGO_BOX_2ND) + getQuestItemsCount(player, CARGO_BOX_3RD) + getQuestItemsCount(player, CARGO_BOX_4TH)) >= 1) - { + case MERCENARY_REEDFOOT: { + if ((getQuestItemsCount(player, CARGO_BOX_1ST) + getQuestItemsCount(player, CARGO_BOX_2ND) + getQuestItemsCount(player, CARGO_BOX_3RD) + getQuestItemsCount(player, CARGO_BOX_4TH)) >= 1) { htmltext = "30736-02.html"; - } - else - { + } else { htmltext = "30736-01.html"; } break; } - case GUILDSMAN_MORGON: - { - if ((getQuestItemsCount(player, CARGO_BOX_1ST) + getQuestItemsCount(player, CARGO_BOX_2ND) + getQuestItemsCount(player, CARGO_BOX_3RD) + getQuestItemsCount(player, CARGO_BOX_4TH)) >= 1) - { + case GUILDSMAN_MORGON: { + if ((getQuestItemsCount(player, CARGO_BOX_1ST) + getQuestItemsCount(player, CARGO_BOX_2ND) + getQuestItemsCount(player, CARGO_BOX_3RD) + getQuestItemsCount(player, CARGO_BOX_4TH)) >= 1) { htmltext = "30737-02.html"; - } - else - { + } else { htmltext = "30737-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00334_TheWishingPotion/Q00334_TheWishingPotion.java b/src/main/java/com/l2jserver/datapack/quests/Q00334_TheWishingPotion/Q00334_TheWishingPotion.java index 6aab857ca8..6b5067f6dd 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00334_TheWishingPotion/Q00334_TheWishingPotion.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00334_TheWishingPotion/Q00334_TheWishingPotion.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.util.Util; * The Wishing Potion (334) * @author Zealar */ -public final class Q00334_TheWishingPotion extends Quest -{ +public final class Q00334_TheWishingPotion extends Quest { // NPCs private static final int TORAI = 30557; private static final int ALCHEMIST_MATILD = 30738; @@ -104,8 +103,7 @@ public final class Q00334_TheWishingPotion extends Quest private static final String EXCHANGE = "Exchange"; // Reward - public Q00334_TheWishingPotion() - { + public Q00334_TheWishingPotion() { super(334, Q00334_TheWishingPotion.class.getSimpleName(), "The Wishing Potion"); addStartNpc(ALCHEMIST_MATILD); addTalkId(ALCHEMIST_MATILD, TORAI, FAIRY_RUPINA, WISDOM_CHEST); @@ -118,16 +116,12 @@ public final class Q00334_TheWishingPotion extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (npc.getId()) - { - case TORAI: - { - if (qs.hasQuestItems(Q_FOBBIDEN_LOVE_SCROLL)) - { + switch (npc.getId()) { + case TORAI: { + if (qs.hasQuestItems(Q_FOBBIDEN_LOVE_SCROLL)) { qs.giveAdena(500000, true); qs.takeItems(Q_FOBBIDEN_LOVE_SCROLL, 1); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); @@ -135,72 +129,54 @@ public final class Q00334_TheWishingPotion extends Quest } break; } - case ALCHEMIST_MATILD: - { - if (qs.isCreated()) - { - if (player.getLevel() < 30) - { + case ALCHEMIST_MATILD: { + if (qs.isCreated()) { + if (player.getLevel() < 30) { return "30738-01.htm"; } return "30738-02.html"; } - if (!qs.hasQuestItems(Q_SECRET_BOOK_OF_POTION) && qs.hasQuestItems(Q_ALCHEMY_TEXT)) - { + if (!qs.hasQuestItems(Q_SECRET_BOOK_OF_POTION) && qs.hasQuestItems(Q_ALCHEMY_TEXT)) { return "30738-05.html"; } - if (qs.hasQuestItems(Q_SECRET_BOOK_OF_POTION) && qs.hasQuestItems(Q_ALCHEMY_TEXT)) - { + if (qs.hasQuestItems(Q_SECRET_BOOK_OF_POTION) && qs.hasQuestItems(Q_ALCHEMY_TEXT)) { return "30738-06.html"; } if (qs.hasQuestItems(Q_POTION_RECIPE_1, Q_POTION_RECIPE_2) && (!qs.hasQuestItems(Q_AMBER_SCALE) || (qs.hasQuestItems(Q_WIND_SOULSTONE) && !qs.hasQuestItems(Q_GLASS_EYE)) - || (!qs.hasQuestItems(Q_HORROR_ECTOPLASM) || !qs.hasQuestItems(Q_SILENOS_HORN) || !qs.hasQuestItems(Q_ANT_SOLDIER_APHID) || !qs.hasQuestItems(Q_TYRANTS_CHITIN) || !qs.hasQuestItems(Q_BUGBEAR_BLOOD)))) - { + || (!qs.hasQuestItems(Q_HORROR_ECTOPLASM) || !qs.hasQuestItems(Q_SILENOS_HORN) || !qs.hasQuestItems(Q_ANT_SOLDIER_APHID) || !qs.hasQuestItems(Q_TYRANTS_CHITIN) || !qs.hasQuestItems(Q_BUGBEAR_BLOOD)))) { return "30738-08.html"; } - if (qs.hasQuestItems(Q_POTION_RECIPE_1, Q_POTION_RECIPE_2, Q_AMBER_SCALE, Q_WIND_SOULSTONE, Q_WIND_SOULSTONE, Q_GLASS_EYE, Q_GLASS_EYE, Q_HORROR_ECTOPLASM, Q_SILENOS_HORN, Q_ANT_SOLDIER_APHID, Q_TYRANTS_CHITIN, Q_BUGBEAR_BLOOD)) - { + if (qs.hasQuestItems(Q_POTION_RECIPE_1, Q_POTION_RECIPE_2, Q_AMBER_SCALE, Q_WIND_SOULSTONE, Q_WIND_SOULSTONE, Q_GLASS_EYE, Q_GLASS_EYE, Q_HORROR_ECTOPLASM, Q_SILENOS_HORN, Q_ANT_SOLDIER_APHID, Q_TYRANTS_CHITIN, Q_BUGBEAR_BLOOD)) { return "30738-09.html"; } if (qs.hasQuestItems(Q_MATILDS_ORB) && !qs.hasQuestItems(Q_POTION_RECIPE_1) && !qs.hasQuestItems(Q_POTION_RECIPE_2) && (!qs.hasQuestItems(Q_AMBER_SCALE) || (qs.hasQuestItems(Q_WIND_SOULSTONE) && !qs.hasQuestItems(Q_GLASS_EYE)) || !qs.hasQuestItems(Q_HORROR_ECTOPLASM) - || !qs.hasQuestItems(Q_SILENOS_HORN) || !qs.hasQuestItems(Q_ANT_SOLDIER_APHID) || !qs.hasQuestItems(Q_TYRANTS_CHITIN) || !qs.hasQuestItems(Q_BUGBEAR_BLOOD))) - { + || !qs.hasQuestItems(Q_SILENOS_HORN) || !qs.hasQuestItems(Q_ANT_SOLDIER_APHID) || !qs.hasQuestItems(Q_TYRANTS_CHITIN) || !qs.hasQuestItems(Q_BUGBEAR_BLOOD))) { return "30738-12.html"; } break; } - case FAIRY_RUPINA: - { - if (qs.getInt(FLAG) == 1) - { + case FAIRY_RUPINA: { + if (qs.getInt(FLAG) == 1) { String html = null; - if ((getRandom(4) < 4)) - { + if ((getRandom(4) < 4)) { qs.giveItems(NECKLACE_OF_GRACE, 1); qs.set(FLAG, 0); html = "30742-01.html"; - } - else - { - switch (getRandom(4)) - { - case 0: - { + } else { + switch (getRandom(4)) { + case 0: { qs.giveItems(DEMONS_TUNIC_FABRIC, 1); break; } - case 1: - { + case 1: { qs.giveItems(DEMONS_HOSE_PATTERN, 1); break; } - case 2: - { + case 2: { qs.giveItems(DEMONS_BOOTS_FABRIC, 1); break; } - case 3: - { + case 3: { qs.giveItems(DEMONS_GLOVES_FABRIC, 1); } } @@ -212,99 +188,72 @@ public final class Q00334_TheWishingPotion extends Quest } break; } - case WISDOM_CHEST: - { - if (qs.getInt(FLAG) == 4) - { + case WISDOM_CHEST: { + if (qs.getInt(FLAG) == 4) { int random = getRandom(100); String html = null; - if (random < 10) - { + if (random < 10) { qs.giveItems(Q_FOBBIDEN_LOVE_SCROLL, 1); html = "30743-02.html"; - } - else if ((random >= 10) && (random < 50)) - { - switch (getRandom(4)) - { - case 0: - { + } else if ((random >= 10) && (random < 50)) { + switch (getRandom(4)) { + case 0: { qs.giveItems(DEMONS_TUNIC_FABRIC, 1); break; } - case 1: - { + case 1: { qs.giveItems(DEMONS_HOSE_PATTERN, 1); break; } - case 2: - { + case 2: { qs.giveItems(DEMONS_BOOTS_FABRIC, 1); break; } - case 3: - { + case 3: { qs.giveItems(DEMONS_GLOVES_FABRIC, 1); break; } } html = "30743-03.html"; - } - else if ((random >= 50) && (random < 100)) - { - switch (getRandom(2)) - { - case 0: - { + } else if ((random >= 50) && (random < 100)) { + switch (getRandom(2)) { + case 0: { qs.giveItems(Q_MUSICNOTE_LOVE, 1); break; } - case 1: - { + case 1: { qs.giveItems(Q_MUSICNOTE_BATTLE, 1); break; } } html = "30743-04.html"; - } - else if ((random >= 85) && (random < 95)) - { - switch (getRandom(4)) - { - case 0: - { + } else if ((random >= 85) && (random < 95)) { + switch (getRandom(4)) { + case 0: { qs.giveItems(DEMONS_TUNIC, 1); break; } - case 1: - { + case 1: { qs.giveItems(DEMONS_HOSE, 1); break; } - case 2: - { + case 2: { qs.giveItems(DEMONS_BOOTS, 1); break; } - case 3: - { + case 3: { qs.giveItems(DEMONS_GLOVES, 1); break; } } html = "30743-05.html"; - } - else if (random >= 95) - { - switch (getRandom(2)) - { - case 0: - { + } else if (random >= 95) { + switch (getRandom(2)) { + case 0: { qs.giveItems(Q_GOLD_CIRCLET, 1); break; } - case 1: - { + case 1: { qs.giveItems(Q_SILVER_CIRCLET, 1); } } @@ -321,54 +270,44 @@ public final class Q00334_TheWishingPotion extends Quest } @Override - public String onSpawn(L2Npc npc) - { - switch (npc.getId()) - { - case GRIMA: - { + public String onSpawn(L2Npc npc) { + switch (npc.getId()) { + case GRIMA: { startQuestTimer("2336002", 1000 * 200, npc, null); npc.say(NpcStringId.OH_OH_OH); break; } - case SUCCUBUS_OF_SEDUCTION: - { + case SUCCUBUS_OF_SEDUCTION: { startQuestTimer("2336003", 1000 * 200, npc, null); npc.say(NpcStringId.DO_YOU_WANT_US_TO_LOVE_YOU_OH); break; } - case GREAT_DEMON_KING: - { + case GREAT_DEMON_KING: { startQuestTimer("2336007", 1000 * 600, npc, null); npc.say(NpcStringId.WHO_KILLED_MY_UNDERLING_DEVIL); break; } - case DLORD_ALEXANDROSANCHES: - { + case DLORD_ALEXANDROSANCHES: { startQuestTimer("2336004", 1000 * 200, npc, null); npc.say(NpcStringId.WHO_IS_CALLING_THE_LORD_OF_DARKNESS); break; } - case ABYSSKING_BONAPARTERIUS: - { + case ABYSSKING_BONAPARTERIUS: { startQuestTimer("2336005", 1000 * 200, npc, null); npc.say(NpcStringId.I_AM_A_GREAT_EMPIRE_BONAPARTERIUS); break; } - case EVILOVERLORD_RAMSEBALIUS: - { + case EVILOVERLORD_RAMSEBALIUS: { startQuestTimer("2336006", 1000 * 200, npc, null); npc.say(NpcStringId.LET_YOUR_HEAD_DOWN_BEFORE_THE_LORD); break; } - case FAIRY_RUPINA: - { + case FAIRY_RUPINA: { startQuestTimer("2336001", 120 * 1000, npc, null); npc.say(NpcStringId.I_WILL_MAKE_YOUR_LOVE_COME_TRUE_LOVE_LOVE_LOVE); break; } - case WISDOM_CHEST: - { + case WISDOM_CHEST: { startQuestTimer("2336007", 120 * 1000, npc, null); npc.say(NpcStringId.I_HAVE_WISDOM_IN_ME_I_AM_THE_BOX_OF_WISDOM); break; @@ -378,70 +317,57 @@ public final class Q00334_TheWishingPotion extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (npc.getId()) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (npc.getId()) { case FAIRY_RUPINA: case GRIMA: case SUCCUBUS_OF_SEDUCTION: - case GREAT_DEMON_KING: - { + case GREAT_DEMON_KING: { npc.deleteMe(); break; } - case DLORD_ALEXANDROSANCHES: - { + case DLORD_ALEXANDROSANCHES: { npc.say(NpcStringId.OH_ITS_NOT_AN_OPPONENT_OF_MINE_HA_HA_HA); npc.deleteMe(); break; } - case ABYSSKING_BONAPARTERIUS: - { + case ABYSSKING_BONAPARTERIUS: { npc.say(NpcStringId.OH_ITS_NOT_AN_OPPONENT_OF_MINE_HA_HA_HA); npc.deleteMe(); break; } - case EVILOVERLORD_RAMSEBALIUS: - { + case EVILOVERLORD_RAMSEBALIUS: { npc.say(NpcStringId.OH_ITS_NOT_AN_OPPONENT_OF_MINE_HA_HA_HA); npc.deleteMe(); break; } - case WISDOM_CHEST: - { + case WISDOM_CHEST: { npc.say(NpcStringId.DONT_INTERRUPT_MY_REST_AGAIN); npc.say(NpcStringId.YOURE_A_GREAT_DEVIL_NOW); npc.deleteMe(); break; } - case ALCHEMIST_MATILD: - { + case ALCHEMIST_MATILD: { final QuestState qs = getQuestState(player, false); - if (event.equals("QUEST_ACCEPTED")) - { + if (event.equals("QUEST_ACCEPTED")) { qs.playSound(Sound.ITEMSOUND_QUEST_ACCEPT); qs.startQuest(); qs.setMemoState(1); qs.setCond(1); qs.showQuestionMark(334); - if (!qs.hasQuestItems(Q_ALCHEMY_TEXT)) - { + if (!qs.hasQuestItems(Q_ALCHEMY_TEXT)) { qs.giveItems(Q_ALCHEMY_TEXT, 1); } qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); return "30738-04.htm"; } - switch (Integer.parseInt(event)) - { - case 1: - { + switch (Integer.parseInt(event)) { + case 1: { return "30738-03.htm"; } - case 2: - { + case 2: { qs.takeItems(Q_SECRET_BOOK_OF_POTION, -1); qs.takeItems(Q_ALCHEMY_TEXT, -1); qs.giveItems(Q_POTION_RECIPE_1, 1); @@ -451,17 +377,13 @@ public final class Q00334_TheWishingPotion extends Quest qs.showQuestionMark(334); return "30738-07.html"; } - case 3: - { + case 3: { return "30738-10.html"; } - case 4: - { - if (qs.hasQuestItems(Q_AMBER_SCALE, Q_GLASS_EYE, Q_HORROR_ECTOPLASM, Q_SILENOS_HORN, Q_ANT_SOLDIER_APHID, Q_TYRANTS_CHITIN, Q_BUGBEAR_BLOOD, Q_WIND_SOULSTONE, Q_POTION_RECIPE_1, Q_POTION_RECIPE_2)) - { + case 4: { + if (qs.hasQuestItems(Q_AMBER_SCALE, Q_GLASS_EYE, Q_HORROR_ECTOPLASM, Q_SILENOS_HORN, Q_ANT_SOLDIER_APHID, Q_TYRANTS_CHITIN, Q_BUGBEAR_BLOOD, Q_WIND_SOULSTONE, Q_POTION_RECIPE_1, Q_POTION_RECIPE_2)) { qs.giveItems(Q_WISH_POTION, 1); - if (!qs.hasQuestItems(Q_MATILDS_ORB)) - { + if (!qs.hasQuestItems(Q_MATILDS_ORB)) { qs.giveItems(Q_MATILDS_ORB, 1); } qs.takeItems(Q_AMBER_SCALE, 1); @@ -482,34 +404,26 @@ public final class Q00334_TheWishingPotion extends Quest } break; } - case 5: - { - if (qs.hasQuestItems(Q_WISH_POTION)) - { - if (qs.getInt(I_QUEST0) != 1) - { + case 5: { + if (qs.hasQuestItems(Q_WISH_POTION)) { + if (qs.getInt(I_QUEST0) != 1) { qs.set(I_QUEST0, 0); } return "30738-13.html"; } return "30738-14.html"; } - case 6: - { - if (qs.hasQuestItems(Q_WISH_POTION)) - { + case 6: { + if (qs.hasQuestItems(Q_WISH_POTION)) { return "30738-15a.html"; } qs.giveItems(Q_POTION_RECIPE_1, 1); qs.giveItems(Q_POTION_RECIPE_2, 1); return "30738-15.html"; } - case 7: - { - if (qs.hasQuestItems(Q_WISH_POTION)) - { - if (qs.getInt(EXCHANGE) == 0) - { + case 7: { + if (qs.hasQuestItems(Q_WISH_POTION)) { + if (qs.getInt(EXCHANGE) == 0) { qs.takeItems(Q_WISH_POTION, 1); qs.set(I_QUEST0, 1); @@ -521,12 +435,9 @@ public final class Q00334_TheWishingPotion extends Quest } return "30738-14.html"; } - case 8: - { - if (qs.hasQuestItems(Q_WISH_POTION)) - { - if (qs.getInt(EXCHANGE) == 0) - { + case 8: { + if (qs.hasQuestItems(Q_WISH_POTION)) { + if (qs.getInt(EXCHANGE) == 0) { qs.takeItems(Q_WISH_POTION, 1); qs.set(I_QUEST0, 2); @@ -538,12 +449,9 @@ public final class Q00334_TheWishingPotion extends Quest } return "30738-14.html"; } - case 9: - { - if (qs.hasQuestItems(Q_WISH_POTION)) - { - if (qs.getInt(EXCHANGE) == 0) - { + case 9: { + if (qs.hasQuestItems(Q_WISH_POTION)) { + if (qs.getInt(EXCHANGE) == 0) { qs.takeItems(Q_WISH_POTION, 1); qs.set(I_QUEST0, 3); @@ -555,12 +463,9 @@ public final class Q00334_TheWishingPotion extends Quest } return "30738-14.html"; } - case 10: - { - if (qs.hasQuestItems(Q_WISH_POTION)) - { - if (qs.getInt(EXCHANGE) == 0) - { + case 10: { + if (qs.hasQuestItems(Q_WISH_POTION)) { + if (qs.getInt(EXCHANGE) == 0) { qs.takeItems(Q_WISH_POTION, 1); qs.set(I_QUEST0, 4); @@ -572,24 +477,20 @@ public final class Q00334_TheWishingPotion extends Quest } return "30738-14.html"; } - case 2336008: - { + case 2336008: { npc.say(NpcStringId.OK_EVERYBODY_PRAY_FERVENTLY); startQuestTimer("2336009", 4 * 1000, npc, player); break; } - case 2336009: - { + case 2336009: { npc.say(NpcStringId.BOTH_HANDS_TO_HEAVEN_EVERYBODY_YELL_TOGETHER); startQuestTimer("2336010", 4 * 1000, npc, player); break; } - case 2336010: - { + case 2336010: { npc.say(NpcStringId.ONE_TWO_MAY_YOUR_DREAMS_COME_TRUE); int i0 = 0; - switch (qs.getInt(I_QUEST0)) - { + switch (qs.getInt(I_QUEST0)) { case 1: i0 = getRandom(2); break; @@ -599,34 +500,27 @@ public final class Q00334_TheWishingPotion extends Quest i0 = getRandom(3); break; } - switch (i0) - { - case 0: - { - switch (qs.getInt(I_QUEST0)) - { - case 1: - { + switch (i0) { + case 0: { + switch (qs.getInt(I_QUEST0)) { + case 1: { addSpawn(FAIRY_RUPINA, npc, true, 0, false); qs.set("Exchange", 0); break; } - case 2: - { + case 2: { addSpawn(GRIMA, npc, true, 0, false); addSpawn(GRIMA, npc, true, 0, false); addSpawn(GRIMA, npc, true, 0, false); qs.set("Exchange", 0); break; } - case 3: - { + case 3: { qs.giveItems(Q_CERTIFICATE_OF_ROYALTY, 1); qs.set("Exchange", 0); break; } - case 4: - { + case 4: { addSpawn(WISDOM_CHEST, npc, true, 0, false); qs.set("Exchange", 0); break; @@ -634,12 +528,9 @@ public final class Q00334_TheWishingPotion extends Quest } break; } - case 1: - { - switch (qs.getInt(I_QUEST0)) - { - case 1: - { + case 1: { + switch (qs.getInt(I_QUEST0)) { + case 1: { addSpawn(SUCCUBUS_OF_SEDUCTION, npc, true, 0, false); addSpawn(SUCCUBUS_OF_SEDUCTION, npc, true, 0, false); addSpawn(SUCCUBUS_OF_SEDUCTION, npc, true, 0, false); @@ -647,20 +538,17 @@ public final class Q00334_TheWishingPotion extends Quest qs.set("Exchange", 0); break; } - case 2: - { + case 2: { qs.giveAdena(10000, true); qs.set("Exchange", 0); break; } - case 3: - { + case 3: { addSpawn(DLORD_ALEXANDROSANCHES, npc, true, 0, false); qs.set("Exchange", 0); break; } - case 4: - { + case 4: { addSpawn(WISDOM_CHEST, npc, true, 0, false); qs.set("Exchange", 0); break; @@ -668,24 +556,19 @@ public final class Q00334_TheWishingPotion extends Quest } break; } - case 2: - { - switch (qs.getInt(I_QUEST0)) - { - case 2: - { + case 2: { + switch (qs.getInt(I_QUEST0)) { + case 2: { qs.giveAdena(10000, true); qs.set("Exchange", 0); break; } - case 3: - { + case 3: { qs.giveItems(Q_ANCIENT_CROWN, 1); qs.set("Exchange", 0); break; } - case 4: - { + case 4: { addSpawn(WISDOM_CHEST, npc, true, 0, false); qs.set("Exchange", 0); break; @@ -704,28 +587,19 @@ public final class Q00334_TheWishingPotion extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPlayerFromParty(killer, npc); - if (qs != null) - { - switch (npc.getId()) - { - case WHISPERING_WIND: - { - if (qs.hasQuestItems(Q_POTION_RECIPE_1, Q_POTION_RECIPE_2) && !qs.hasQuestItems(Q_WIND_SOULSTONE)) - { - if (getRandom(10) == 0) - { + if (qs != null) { + switch (npc.getId()) { + case WHISPERING_WIND: { + if (qs.hasQuestItems(Q_POTION_RECIPE_1, Q_POTION_RECIPE_2) && !qs.hasQuestItems(Q_WIND_SOULSTONE)) { + if (getRandom(10) == 0) { qs.giveItems(Q_WIND_SOULSTONE, 1); qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - if (qs.hasQuestItems(Q_AMBER_SCALE, Q_GLASS_EYE, Q_HORROR_ECTOPLASM, Q_SILENOS_HORN, Q_ANT_SOLDIER_APHID, Q_TYRANTS_CHITIN, Q_BUGBEAR_BLOOD)) - { + if (qs.hasQuestItems(Q_AMBER_SCALE, Q_GLASS_EYE, Q_HORROR_ECTOPLASM, Q_SILENOS_HORN, Q_ANT_SOLDIER_APHID, Q_TYRANTS_CHITIN, Q_BUGBEAR_BLOOD)) { qs.setCond(4, true); qs.showQuestionMark(334); - } - else - { + } else { qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -733,42 +607,30 @@ public final class Q00334_TheWishingPotion extends Quest break; } case ANT_SOLDIER: - case ANT_WARRIOR_CAPTAIN: - { - if (qs.hasQuestItems(Q_POTION_RECIPE_1, Q_POTION_RECIPE_2) && !qs.hasQuestItems(Q_ANT_SOLDIER_APHID)) - { - if (getRandom(10) == 0) - { + case ANT_WARRIOR_CAPTAIN: { + if (qs.hasQuestItems(Q_POTION_RECIPE_1, Q_POTION_RECIPE_2) && !qs.hasQuestItems(Q_ANT_SOLDIER_APHID)) { + if (getRandom(10) == 0) { qs.giveItems(Q_ANT_SOLDIER_APHID, 1); qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - if (qs.hasQuestItems(Q_AMBER_SCALE, Q_WIND_SOULSTONE, Q_GLASS_EYE, Q_HORROR_ECTOPLASM, Q_SILENOS_HORN, Q_ANT_SOLDIER_APHID, Q_TYRANTS_CHITIN, Q_BUGBEAR_BLOOD)) - { + if (qs.hasQuestItems(Q_AMBER_SCALE, Q_WIND_SOULSTONE, Q_GLASS_EYE, Q_HORROR_ECTOPLASM, Q_SILENOS_HORN, Q_ANT_SOLDIER_APHID, Q_TYRANTS_CHITIN, Q_BUGBEAR_BLOOD)) { qs.setCond(4, true); qs.showQuestionMark(334); - } - else - { + } else { qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case SILENOS: - { - if (qs.hasQuestItems(Q_POTION_RECIPE_1, Q_POTION_RECIPE_2) && !qs.hasQuestItems(Q_SILENOS_HORN)) - { - if (getRandom(10) == 0) - { + case SILENOS: { + if (qs.hasQuestItems(Q_POTION_RECIPE_1, Q_POTION_RECIPE_2) && !qs.hasQuestItems(Q_SILENOS_HORN)) { + if (getRandom(10) == 0) { qs.giveItems(Q_SILENOS_HORN, 1); qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - if (qs.hasQuestItems(Q_AMBER_SCALE, Q_WIND_SOULSTONE, Q_GLASS_EYE, Q_HORROR_ECTOPLASM, Q_ANT_SOLDIER_APHID, Q_TYRANTS_CHITIN, Q_BUGBEAR_BLOOD)) - { + if (qs.hasQuestItems(Q_AMBER_SCALE, Q_WIND_SOULSTONE, Q_GLASS_EYE, Q_HORROR_ECTOPLASM, Q_ANT_SOLDIER_APHID, Q_TYRANTS_CHITIN, Q_BUGBEAR_BLOOD)) { qs.setCond(4, true); qs.showQuestionMark(334); - } - else - { + } else { qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -776,63 +638,45 @@ public final class Q00334_TheWishingPotion extends Quest break; } case TYRANT: - case TYRANT_KINGPIN: - { - if (qs.hasQuestItems(Q_POTION_RECIPE_1, Q_POTION_RECIPE_2) && !qs.hasQuestItems(Q_TYRANTS_CHITIN)) - { - if (getRandom(10) == 0) - { + case TYRANT_KINGPIN: { + if (qs.hasQuestItems(Q_POTION_RECIPE_1, Q_POTION_RECIPE_2) && !qs.hasQuestItems(Q_TYRANTS_CHITIN)) { + if (getRandom(10) == 0) { qs.giveItems(Q_TYRANTS_CHITIN, 1); qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - if (qs.hasQuestItems(Q_AMBER_SCALE, Q_WIND_SOULSTONE, Q_GLASS_EYE, Q_HORROR_ECTOPLASM, Q_SILENOS_HORN, Q_ANT_SOLDIER_APHID, Q_TYRANTS_CHITIN, Q_BUGBEAR_BLOOD)) - { + if (qs.hasQuestItems(Q_AMBER_SCALE, Q_WIND_SOULSTONE, Q_GLASS_EYE, Q_HORROR_ECTOPLASM, Q_SILENOS_HORN, Q_ANT_SOLDIER_APHID, Q_TYRANTS_CHITIN, Q_BUGBEAR_BLOOD)) { qs.setCond(4, true); qs.showQuestionMark(334); - } - else - { + } else { qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case AMBER_BASILISK: - { - if (qs.hasQuestItems(Q_POTION_RECIPE_1, Q_POTION_RECIPE_2) && !qs.hasQuestItems(Q_AMBER_SCALE)) - { - if (getRandom(10) == 0) - { + case AMBER_BASILISK: { + if (qs.hasQuestItems(Q_POTION_RECIPE_1, Q_POTION_RECIPE_2) && !qs.hasQuestItems(Q_AMBER_SCALE)) { + if (getRandom(10) == 0) { qs.giveItems(Q_AMBER_SCALE, 1); qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - if (qs.hasQuestItems(Q_WIND_SOULSTONE, Q_GLASS_EYE, Q_HORROR_ECTOPLASM, Q_SILENOS_HORN, Q_ANT_SOLDIER_APHID, Q_TYRANTS_CHITIN, Q_BUGBEAR_BLOOD)) - { + if (qs.hasQuestItems(Q_WIND_SOULSTONE, Q_GLASS_EYE, Q_HORROR_ECTOPLASM, Q_SILENOS_HORN, Q_ANT_SOLDIER_APHID, Q_TYRANTS_CHITIN, Q_BUGBEAR_BLOOD)) { qs.setCond(4, true); qs.showQuestionMark(334); - } - else - { + } else { qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case MIST_HORROR_RIPPER: - { - if (qs.hasQuestItems(Q_POTION_RECIPE_1, Q_POTION_RECIPE_2) && !qs.hasQuestItems(Q_HORROR_ECTOPLASM)) - { - if (getRandom(10) == 0) - { + case MIST_HORROR_RIPPER: { + if (qs.hasQuestItems(Q_POTION_RECIPE_1, Q_POTION_RECIPE_2) && !qs.hasQuestItems(Q_HORROR_ECTOPLASM)) { + if (getRandom(10) == 0) { qs.giveItems(Q_HORROR_ECTOPLASM, 1); qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - if (qs.hasQuestItems(Q_AMBER_SCALE, Q_WIND_SOULSTONE, Q_GLASS_EYE, Q_HORROR_ECTOPLASM, Q_SILENOS_HORN, Q_ANT_SOLDIER_APHID, Q_TYRANTS_CHITIN, Q_BUGBEAR_BLOOD)) - { + if (qs.hasQuestItems(Q_AMBER_SCALE, Q_WIND_SOULSTONE, Q_GLASS_EYE, Q_HORROR_ECTOPLASM, Q_SILENOS_HORN, Q_ANT_SOLDIER_APHID, Q_TYRANTS_CHITIN, Q_BUGBEAR_BLOOD)) { qs.setCond(4, true); qs.showQuestionMark(334); - } - else - { + } else { qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -840,60 +684,42 @@ public final class Q00334_TheWishingPotion extends Quest break; } case TURAK_BUGBEAR: - case TURAK_BUGBEAR_WARRIOR: - { - if (qs.hasQuestItems(Q_POTION_RECIPE_1, Q_POTION_RECIPE_2) && !qs.hasQuestItems(Q_BUGBEAR_BLOOD)) - { - if (getRandom(10) == 0) - { + case TURAK_BUGBEAR_WARRIOR: { + if (qs.hasQuestItems(Q_POTION_RECIPE_1, Q_POTION_RECIPE_2) && !qs.hasQuestItems(Q_BUGBEAR_BLOOD)) { + if (getRandom(10) == 0) { qs.giveItems(Q_BUGBEAR_BLOOD, 1); qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - if (qs.hasQuestItems(Q_AMBER_SCALE, Q_WIND_SOULSTONE, Q_GLASS_EYE, Q_HORROR_ECTOPLASM, Q_SILENOS_HORN, Q_ANT_SOLDIER_APHID, Q_TYRANTS_CHITIN, Q_BUGBEAR_BLOOD)) - { + if (qs.hasQuestItems(Q_AMBER_SCALE, Q_WIND_SOULSTONE, Q_GLASS_EYE, Q_HORROR_ECTOPLASM, Q_SILENOS_HORN, Q_ANT_SOLDIER_APHID, Q_TYRANTS_CHITIN, Q_BUGBEAR_BLOOD)) { qs.setCond(4, true); qs.showQuestionMark(334); - } - else - { + } else { qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case GLASS_JAGUAR: - { - if (qs.hasQuestItems(Q_POTION_RECIPE_1, Q_POTION_RECIPE_2) && !qs.hasQuestItems(Q_GLASS_EYE)) - { - if (getRandom(10) == 0) - { + case GLASS_JAGUAR: { + if (qs.hasQuestItems(Q_POTION_RECIPE_1, Q_POTION_RECIPE_2) && !qs.hasQuestItems(Q_GLASS_EYE)) { + if (getRandom(10) == 0) { qs.giveItems(Q_GLASS_EYE, 1); qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - if (qs.hasQuestItems(Q_AMBER_SCALE, Q_WIND_SOULSTONE, Q_GLASS_EYE, Q_HORROR_ECTOPLASM, Q_SILENOS_HORN, Q_ANT_SOLDIER_APHID, Q_TYRANTS_CHITIN, Q_BUGBEAR_BLOOD)) - { + if (qs.hasQuestItems(Q_AMBER_SCALE, Q_WIND_SOULSTONE, Q_GLASS_EYE, Q_HORROR_ECTOPLASM, Q_SILENOS_HORN, Q_ANT_SOLDIER_APHID, Q_TYRANTS_CHITIN, Q_BUGBEAR_BLOOD)) { qs.setCond(4, true); qs.showQuestionMark(334); - } - else - { + } else { qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case GRIMA: - { - if (qs.isMemoState(2) && (qs.getInt(FLAG) == 2)) - { - if (getRandom(1000) < 33) - { - if (getRandom(1000) == 0) - { + case GRIMA: { + if (qs.isMemoState(2) && (qs.getInt(FLAG) == 2)) { + if (getRandom(1000) < 33) { + if (getRandom(1000) == 0) { qs.giveAdena(100_000_000, true); - } - else - { + } else { qs.giveAdena(900_000, true); } qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); @@ -902,30 +728,24 @@ public final class Q00334_TheWishingPotion extends Quest } break; } - case SUCCUBUS_OF_SEDUCTION: - { - if (qs.isMemoState(2) && !qs.hasQuestItems(Q_FOBBIDEN_LOVE_SCROLL) && (qs.getInt(FLAG) == 1) && (getRandom(1000) < 28)) - { + case SUCCUBUS_OF_SEDUCTION: { + if (qs.isMemoState(2) && !qs.hasQuestItems(Q_FOBBIDEN_LOVE_SCROLL) && (qs.getInt(FLAG) == 1) && (getRandom(1000) < 28)) { qs.giveItems(Q_FOBBIDEN_LOVE_SCROLL, 1); qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); qs.set(FLAG, 0); } break; } - case GREAT_DEMON_KING: - { - if (qs.isMemoState(2) && (qs.getInt(FLAG) == 3)) - { + case GREAT_DEMON_KING: { + if (qs.isMemoState(2) && (qs.getInt(FLAG) == 3)) { qs.giveAdena(1_406_956, true); qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); qs.set(FLAG, 0); } break; } - case SECRET_KEEPER_TREE: - { - if (qs.isMemoState(1) && !qs.hasQuestItems(Q_SECRET_BOOK_OF_POTION)) - { + case SECRET_KEEPER_TREE: { + if (qs.isMemoState(1) && !qs.hasQuestItems(Q_SECRET_BOOK_OF_POTION)) { qs.giveItems(Q_SECRET_BOOK_OF_POTION, 1); qs.setCond(2, true); qs.showQuestionMark(334); @@ -933,36 +753,26 @@ public final class Q00334_TheWishingPotion extends Quest } break; } - case DLORD_ALEXANDROSANCHES: - { - if (qs.isMemoState(2) && (qs.getInt(FLAG) == 3)) - { + case DLORD_ALEXANDROSANCHES: { + if (qs.isMemoState(2) && (qs.getInt(FLAG) == 3)) { npc.say(NpcStringId.BONAPARTERIUS_ABYSS_KING_WILL_PUNISH_YOU); - if (getRandom(2) == 0) - { + if (getRandom(2) == 0) { addSpawn(ABYSSKING_BONAPARTERIUS, npc, true, 0, false); - } - else - { - switch (getRandom(4)) - { - case 0: - { + } else { + switch (getRandom(4)) { + case 0: { qs.giveItems(DEMONS_TUNIC_FABRIC, 1); break; } - case 1: - { + case 1: { qs.giveItems(DEMONS_HOSE_PATTERN, 1); break; } - case 2: - { + case 2: { qs.giveItems(DEMONS_BOOTS_FABRIC, 1); break; } - case 3: - { + case 3: { qs.giveItems(DEMONS_GLOVES_FABRIC, 1); } } @@ -970,36 +780,26 @@ public final class Q00334_TheWishingPotion extends Quest break; } } - case ABYSSKING_BONAPARTERIUS: - { - if (qs.isMemoState(2) && (qs.getInt(FLAG) == 3)) - { + case ABYSSKING_BONAPARTERIUS: { + if (qs.isMemoState(2) && (qs.getInt(FLAG) == 3)) { npc.say(NpcStringId.REVENGE_IS_OVERLORD_RAMSEBALIUS_OF_THE_EVIL_WORLD); - if (getRandom(2) == 0) - { + if (getRandom(2) == 0) { addSpawn(EVILOVERLORD_RAMSEBALIUS, npc, true, 0, false); - } - else - { - switch (getRandom(4)) - { - case 0: - { + } else { + switch (getRandom(4)) { + case 0: { qs.giveItems(DEMONS_TUNIC_FABRIC, 1); break; } - case 1: - { + case 1: { qs.giveItems(DEMONS_HOSE_PATTERN, 1); break; } - case 2: - { + case 2: { qs.giveItems(DEMONS_BOOTS_FABRIC, 1); break; } - case 3: - { + case 3: { qs.giveItems(DEMONS_GLOVES_FABRIC, 1); break; } @@ -1009,36 +809,26 @@ public final class Q00334_TheWishingPotion extends Quest } break; } - case EVILOVERLORD_RAMSEBALIUS: - { - if (qs.isMemoState(2) && (qs.getInt(FLAG) == 3)) - { + case EVILOVERLORD_RAMSEBALIUS: { + if (qs.isMemoState(2) && (qs.getInt(FLAG) == 3)) { npc.say(NpcStringId.OH_GREAT_DEMON_KING); - if (getRandom(2) == 0) - { + if (getRandom(2) == 0) { addSpawn(GREAT_DEMON_KING, npc, true, 0, false); - } - else - { - switch (getRandom(4)) - { - case 0: - { + } else { + switch (getRandom(4)) { + case 0: { qs.giveItems(DEMONS_TUNIC_FABRIC, 1); break; } - case 1: - { + case 1: { qs.giveItems(DEMONS_HOSE_PATTERN, 1); break; } - case 2: - { + case 2: { qs.giveItems(DEMONS_BOOTS_FABRIC, 1); break; } - case 3: - { + case 3: { qs.giveItems(DEMONS_GLOVES_FABRIC, 1); break; } @@ -1054,25 +844,20 @@ public final class Q00334_TheWishingPotion extends Quest return super.onKill(npc, killer, isSummon); } - private QuestState getRandomPlayerFromParty(L2PcInstance player, L2Npc npc) - { + private QuestState getRandomPlayerFromParty(L2PcInstance player, L2Npc npc) { QuestState qs = player.getQuestState(getName()); final List<QuestState> candidates = new ArrayList<>(); - if ((qs != null) && qs.isStarted()) - { + if ((qs != null) && qs.isStarted()) { candidates.add(qs); candidates.add(qs); } - if (player.isInParty()) - { - player.getParty().getMembers().stream().forEach(pm -> - { + if (player.isInParty()) { + player.getParty().getMembers().stream().forEach(pm -> { QuestState qss = pm.getQuestState(getName()); - if ((qss != null) && qss.isStarted() && Util.checkIfInRange(1500, npc, pm, true)) - { + if ((qss != null) && qss.isStarted() && Util.checkIfInRange(1500, npc, pm, true)) { candidates.add(qss); } }); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00335_TheSongOfTheHunter/Q00335_TheSongOfTheHunter.java b/src/main/java/com/l2jserver/datapack/quests/Q00335_TheSongOfTheHunter/Q00335_TheSongOfTheHunter.java index d65f9fdf2c..1e2a2a6f81 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00335_TheSongOfTheHunter/Q00335_TheSongOfTheHunter.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00335_TheSongOfTheHunter/Q00335_TheSongOfTheHunter.java @@ -37,8 +37,7 @@ import com.l2jserver.gameserver.network.serverpackets.CreatureSay; * @author Zoey76 * @since 2.6.0.0 */ -public class Q00335_TheSongOfTheHunter extends Quest -{ +public class Q00335_TheSongOfTheHunter extends Quest { // NPCs private static final int GREY = 30744; private static final int TOR = 30745; @@ -377,8 +376,7 @@ public class Q00335_TheSongOfTheHunter extends Quest // Links private static final Map<Integer, String> LINKS = new HashMap<>(); - static - { + static { LINKS.put(33520, "<a action=\"bypass -h Quest Q00335_TheSongOfTheHunter 30745-10a.html\">C: 40 Totems of Kadesh</a><br>"); LINKS.put(33521, "<a action=\"bypass -h Quest Q00335_TheSongOfTheHunter 30745-10b.html\">C: 50 Jade Necklaces of Timak</a><br>"); LINKS.put(33522, "<a action=\"bypass -h Quest Q00335_TheSongOfTheHunter 30745-10c.html\">C: 50 Enchanted Golem Shards</a><br>"); @@ -420,8 +418,7 @@ public class Q00335_TheSongOfTheHunter extends Quest LINKS.put(33558, "<a action=\"bypass -h Quest Q00335_TheSongOfTheHunter 30745-14f.html\">B: Kerunos's Gold Mane</a><br>"); } - public Q00335_TheSongOfTheHunter() - { + public Q00335_TheSongOfTheHunter() { super(335, Q00335_TheSongOfTheHunter.class.getSimpleName(), "The Song of the Hunter"); addStartNpc(GREY); addTalkId(GREY, TOR, CYBELLIN); @@ -430,30 +427,20 @@ public class Q00335_TheSongOfTheHunter extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { + if (qs.isCreated()) { htmltext = player.getLevel() < MIN_LEVEL ? "30744-01.htm" : "30744-02.htm"; - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case GREY: - { - if (hasQuestItems(player, TEST_INSTRUCTIONS_1)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case GREY: { + if (hasQuestItems(player, TEST_INSTRUCTIONS_1)) { final long count = Arrays.asList(getQuestItemsCount(player, GUARDIAN_BASILISK_SCALE) >= 40, getQuestItemsCount(player, KARUT_WEED) >= 20, (getQuestItemsCount(player, HAKAS_HEAD) + getQuestItemsCount(player, JAKAS_HEAD) + getQuestItemsCount(player, MARKAS_HEAD)) >= 3, hasQuestItems(player, WINDSUS_ALEPH_SKIN), getQuestItemsCount(player, INDIGO_SPIRIT_ORE) >= 20, getQuestItemsCount(player, SPORESEA_SEED) >= 30).stream().filter(b -> b).count(); - if (count < 3) - { + if (count < 3) { htmltext = "30744-05.html"; - } - else - { + } else { qs.setCond(2, true); giveItems(player, FIRST_CIRCLE_HUNTER_LICENSE, 1); takeItems(player, GUARDIAN_BASILISK_SCALE, -1); @@ -469,28 +456,20 @@ public class Q00335_TheSongOfTheHunter extends Quest } } - if (hasQuestItems(player, FIRST_CIRCLE_HUNTER_LICENSE)) - { - if (player.getLevel() < MAX_LEVEL) - { + if (hasQuestItems(player, FIRST_CIRCLE_HUNTER_LICENSE)) { + if (player.getLevel() < MAX_LEVEL) { htmltext = "30744-07.html"; - } - else if (!hasQuestItems(player, TEST_INSTRUCTIONS_2)) - { + } else if (!hasQuestItems(player, TEST_INSTRUCTIONS_2)) { htmltext = "30744-08.html"; } } - if (hasQuestItems(player, TEST_INSTRUCTIONS_2)) - { + if (hasQuestItems(player, TEST_INSTRUCTIONS_2)) { final long count = Arrays.asList(getQuestItemsCount(player, TIMAK_ORC_TOTEM) >= 20, getQuestItemsCount(player, TRISALIM_SILK) >= 20, getQuestItemsCount(player, AMBROSIUS_FRUIT) >= 30, getQuestItemsCount(player, BALEFIRE_CRYSTAL) >= 20, getQuestItemsCount(player, IMPERIAL_ARROWHEAD) >= 20, ((getQuestItemsCount(player, ATHUS_HEAD) + getQuestItemsCount(player, LANKAS_HEAD) + getQuestItemsCount(player, TRISKAS_HEAD) + getQuestItemsCount(player, MOTURAS_HEAD) + getQuestItemsCount(player, KALATHS_HEAD)) >= 5)).stream().filter(b -> b).count(); - if (count < 3) - { + if (count < 3) { htmltext = "30744-11.html"; - } - else - { + } else { qs.setCond(3, true); giveItems(player, SECOND_CIRCLE_HUNTER_LICENSE, 1); takeItems(player, TRISALIM_SILK, -1); @@ -509,90 +488,56 @@ public class Q00335_TheSongOfTheHunter extends Quest } } - if (hasQuestItems(player, SECOND_CIRCLE_HUNTER_LICENSE)) - { + if (hasQuestItems(player, SECOND_CIRCLE_HUNTER_LICENSE)) { htmltext = "30744-14.html"; } break; } - case CYBELLIN: - { - if (!hasQuestItems(player, SECOND_CIRCLE_HUNTER_LICENSE) && !hasQuestItems(player, FIRST_CIRCLE_HUNTER_LICENSE)) - { + case CYBELLIN: { + if (!hasQuestItems(player, SECOND_CIRCLE_HUNTER_LICENSE) && !hasQuestItems(player, FIRST_CIRCLE_HUNTER_LICENSE)) { htmltext = "30746-01.html"; - } - else if (!hasQuestItems(player, CYBELLINS_REQUEST)) - { + } else if (!hasQuestItems(player, CYBELLINS_REQUEST)) { htmltext = "30746-02.html"; - } - else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_1)) - { + } else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_1)) { htmltext = "30746-04.html"; - } - else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_2) || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_3) || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_4) || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_5) || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_6) - || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_7) || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_8) || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_9)) - { + } else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_2) || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_3) || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_4) || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_5) || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_6) + || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_7) || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_8) || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_9)) { htmltext = "30746-05.html"; - } - else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_10)) - { + } else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_10)) { giveAdena(player, 870400, true); takeItems(player, BLOOD_CRYSTAL_PURITY_10, -1); htmltext = "30746-05a.html"; - } - else if (!hasQuestItems(player, BROKEN_BLOOD_CRYSTAL)) - { + } else if (!hasQuestItems(player, BROKEN_BLOOD_CRYSTAL)) { htmltext = "30746-08.html"; - } - else - { + } else { takeItems(player, BROKEN_BLOOD_CRYSTAL, -1); htmltext = "30746-09.html"; } break; } - case TOR: - { - if (!hasQuestItems(player, SECOND_CIRCLE_HUNTER_LICENSE) && !hasQuestItems(player, FIRST_CIRCLE_HUNTER_LICENSE)) - { + case TOR: { + if (!hasQuestItems(player, SECOND_CIRCLE_HUNTER_LICENSE) && !hasQuestItems(player, FIRST_CIRCLE_HUNTER_LICENSE)) { htmltext = "30745-01a.html"; - } - else - { + } else { final long requestCount = getQuestItemsCount(player, FIRST_CIRCLE_REQUEST_1C, FIRST_CIRCLE_REQUEST_2C, FIRST_CIRCLE_REQUEST_3C, FIRST_CIRCLE_REQUEST_4C, FIRST_CIRCLE_REQUEST_5C, FIRST_CIRCLE_REQUEST_6C, FIRST_CIRCLE_REQUEST_7C, FIRST_CIRCLE_REQUEST_8C, FIRST_CIRCLE_REQUEST_9C, FIRST_CIRCLE_REQUEST_10C, FIRST_CIRCLE_REQUEST_11C, FIRST_CIRCLE_REQUEST_12C, FIRST_CIRCLE_REQUEST_1B, FIRST_CIRCLE_REQUEST_2B, FIRST_CIRCLE_REQUEST_3B, FIRST_CIRCLE_REQUEST_4B, FIRST_CIRCLE_REQUEST_5B, FIRST_CIRCLE_REQUEST_6B, FIRST_CIRCLE_REQUEST_1A, FIRST_CIRCLE_REQUEST_2A, FIRST_CIRCLE_REQUEST_3A, SECOND_CIRCLE_REQUEST_1C, SECOND_CIRCLE_REQUEST_2C, SECOND_CIRCLE_REQUEST_3C, SECOND_CIRCLE_REQUEST_4C, SECOND_CIRCLE_REQUEST_5C, SECOND_CIRCLE_REQUEST_6C, SECOND_CIRCLE_REQUEST_7C, SECOND_CIRCLE_REQUEST_8C, SECOND_CIRCLE_REQUEST_9C, SECOND_CIRCLE_REQUEST_10C, SECOND_CIRCLE_REQUEST_11C, SECOND_CIRCLE_REQUEST_12C, SECOND_CIRCLE_REQUEST_1B, SECOND_CIRCLE_REQUEST_2B, SECOND_CIRCLE_REQUEST_3B, SECOND_CIRCLE_REQUEST_4B, SECOND_CIRCLE_REQUEST_5B, SECOND_CIRCLE_REQUEST_6B, SECOND_CIRCLE_REQUEST_1A, SECOND_CIRCLE_REQUEST_2A, SECOND_CIRCLE_REQUEST_3A); - if (hasQuestItems(player, FIRST_CIRCLE_HUNTER_LICENSE)) - { - if (requestCount == 0) - { - if (player.getLevel() < MAX_LEVEL) - { + if (hasQuestItems(player, FIRST_CIRCLE_HUNTER_LICENSE)) { + if (requestCount == 0) { + if (player.getLevel() < MAX_LEVEL) { htmltext = "30745-01b.html"; - } - else - { - if (hasQuestItems(player, SECOND_CIRCLE_HUNTER_LICENSE)) - { + } else { + if (hasQuestItems(player, SECOND_CIRCLE_HUNTER_LICENSE)) { htmltext = "30745-03.html"; - } - else - { + } else { htmltext = "30745-03a.html"; } } - } - else - { + } else { htmltext = reward(player, qs, REWARDS); } - } - else if (hasQuestItems(player, SECOND_CIRCLE_HUNTER_LICENSE)) - { - if (requestCount == 0) - { + } else if (hasQuestItems(player, SECOND_CIRCLE_HUNTER_LICENSE)) { + if (requestCount == 0) { htmltext = "30745-03b.html"; - } - else - { + } else { htmltext = reward(player, qs, REWARDS); } } @@ -605,22 +550,17 @@ public class Q00335_TheSongOfTheHunter extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "30744-03.htm": - { + switch (event) { + case "30744-03.htm": { qs.startQuest(); - if (!hasQuestItems(player, TEST_INSTRUCTIONS_1)) - { + if (!hasQuestItems(player, TEST_INSTRUCTIONS_1)) { giveItems(player, TEST_INSTRUCTIONS_1, 1); } qs.setMemoState(0); @@ -655,62 +595,48 @@ public class Q00335_TheSongOfTheHunter extends Quest case "30746-07.html": case "30745-04.html": case "30745-05a.html": - case "30745-05c.html": - { + case "30745-05c.html": { htmltext = event; break; } - case "30744-09.html": - { + case "30744-09.html": { if ((getQuestItemsCount(player, FIRST_CIRCLE_REQUEST_1C) + getQuestItemsCount(player, FIRST_CIRCLE_REQUEST_2C) + getQuestItemsCount(player, FIRST_CIRCLE_REQUEST_3C) + // getQuestItemsCount(player, FIRST_CIRCLE_REQUEST_4C) + getQuestItemsCount(player, FIRST_CIRCLE_REQUEST_4C) + getQuestItemsCount(player, FIRST_CIRCLE_REQUEST_6C) + // getQuestItemsCount(player, FIRST_CIRCLE_REQUEST_7C) + getQuestItemsCount(player, FIRST_CIRCLE_REQUEST_8C) + getQuestItemsCount(player, FIRST_CIRCLE_REQUEST_9C) + // getQuestItemsCount(player, FIRST_CIRCLE_REQUEST_10C) + getQuestItemsCount(player, FIRST_CIRCLE_REQUEST_11C) + getQuestItemsCount(player, FIRST_CIRCLE_REQUEST_12C) + // getQuestItemsCount(player, FIRST_CIRCLE_REQUEST_1B) + getQuestItemsCount(player, FIRST_CIRCLE_REQUEST_2B) + getQuestItemsCount(player, FIRST_CIRCLE_REQUEST_3B) + // getQuestItemsCount(player, FIRST_CIRCLE_REQUEST_4B) + getQuestItemsCount(player, FIRST_CIRCLE_REQUEST_5B) + getQuestItemsCount(player, FIRST_CIRCLE_REQUEST_6B) + // - getQuestItemsCount(player, FIRST_CIRCLE_REQUEST_1A) + getQuestItemsCount(player, FIRST_CIRCLE_REQUEST_2A) + getQuestItemsCount(player, FIRST_CIRCLE_REQUEST_3A)) == 0) - { + getQuestItemsCount(player, FIRST_CIRCLE_REQUEST_1A) + getQuestItemsCount(player, FIRST_CIRCLE_REQUEST_2A) + getQuestItemsCount(player, FIRST_CIRCLE_REQUEST_3A)) == 0) { giveItems(player, TEST_INSTRUCTIONS_2, 1); htmltext = event; - } - else - { + } else { htmltext = "30744-09a.html"; } break; } - case "30744-16.html": - { + case "30744-16.html": { qs.exitQuest(true, true); takeItems(player, -1, FIRST_CIRCLE_HUNTER_LICENSE, SECOND_CIRCLE_HUNTER_LICENSE, LAUREL_LEAF_PIN, TEST_INSTRUCTIONS_1, TEST_INSTRUCTIONS_2, CYBELLINS_REQUEST, BLOOD_CRYSTAL_PURITY_1, BLOOD_CRYSTAL_PURITY_2, BLOOD_CRYSTAL_PURITY_3, BLOOD_CRYSTAL_PURITY_4, BLOOD_CRYSTAL_PURITY_5, BLOOD_CRYSTAL_PURITY_6, BLOOD_CRYSTAL_PURITY_7, BLOOD_CRYSTAL_PURITY_8, BLOOD_CRYSTAL_PURITY_9, BLOOD_CRYSTAL_PURITY_10, BROKEN_BLOOD_CRYSTAL, CYBELLINS_DAGGER, GUARDIAN_BASILISK_SCALE, KARUT_WEED, HAKAS_HEAD, JAKAS_HEAD, MARKAS_HEAD, WINDSUS_ALEPH_SKIN, INDIGO_SPIRIT_ORE, SPORESEA_SEED, TIMAK_ORC_TOTEM, TRISALIM_SILK, AMBROSIUS_FRUIT, BALEFIRE_CRYSTAL, IMPERIAL_ARROWHEAD, ATHUS_HEAD, LANKAS_HEAD, TRISKAS_HEAD, MOTURAS_HEAD, KALATHS_HEAD, FIRST_CIRCLE_REQUEST_1C, FIRST_CIRCLE_REQUEST_2C, FIRST_CIRCLE_REQUEST_3C, FIRST_CIRCLE_REQUEST_4C, FIRST_CIRCLE_REQUEST_5C, FIRST_CIRCLE_REQUEST_6C, FIRST_CIRCLE_REQUEST_7C, FIRST_CIRCLE_REQUEST_8C, FIRST_CIRCLE_REQUEST_9C, FIRST_CIRCLE_REQUEST_10C, FIRST_CIRCLE_REQUEST_11C, FIRST_CIRCLE_REQUEST_12C, FIRST_CIRCLE_REQUEST_1B, FIRST_CIRCLE_REQUEST_2B, FIRST_CIRCLE_REQUEST_3B, FIRST_CIRCLE_REQUEST_4B, FIRST_CIRCLE_REQUEST_5B, FIRST_CIRCLE_REQUEST_6B, FIRST_CIRCLE_REQUEST_1A, FIRST_CIRCLE_REQUEST_2A, FIRST_CIRCLE_REQUEST_3A, SECOND_CIRCLE_REQUEST_1C, SECOND_CIRCLE_REQUEST_2C, SECOND_CIRCLE_REQUEST_3C, SECOND_CIRCLE_REQUEST_4C, SECOND_CIRCLE_REQUEST_5C, SECOND_CIRCLE_REQUEST_6C, SECOND_CIRCLE_REQUEST_7C, SECOND_CIRCLE_REQUEST_8C, SECOND_CIRCLE_REQUEST_9C, SECOND_CIRCLE_REQUEST_10C, SECOND_CIRCLE_REQUEST_11C, SECOND_CIRCLE_REQUEST_12C, SECOND_CIRCLE_REQUEST_1B, SECOND_CIRCLE_REQUEST_2B, SECOND_CIRCLE_REQUEST_3B, SECOND_CIRCLE_REQUEST_4B, SECOND_CIRCLE_REQUEST_5B, SECOND_CIRCLE_REQUEST_6B, SECOND_CIRCLE_REQUEST_1A, SECOND_CIRCLE_REQUEST_2A, SECOND_CIRCLE_REQUEST_3A, CHARM_OF_KADESH, TIMAK_JADE_NECKLACE, ENCHANTED_GOLEM_SHARD, GIANT_MONSTER_EYE_MEAT, DIRE_WYRM_EGG, GUARDIAN_BASILISK_TALON, REVENANTS_CHAINS, WINDSUS_TUSK, GRANDISS_SKULL, TAIK_OBSIDIAN_AMULET, KARUL_BUGBEAR_HEAD, TAMLIN_IVORY_CHARM, FANG_OF_NARAK, ENCHANTED_GARGOYLES_HORN, COILED_SERPENT_TOTEM, TOTEM_OF_KADESH, KAIKIS_HEAD, KRONBE_VENOM_SAC, EVAS_CHARM, TITANS_TABLET, BOOK_OF_SHUNAIMAN, ROTTING_TREE_SPORES, TRISALIM_VENOM_SAC, TAIK_ORC_TOTEM, HARIT_BARBED_NECKLACE, COIN_OF_OLD_EMPIRE, SKIN_OF_FARCRAN, TEMPEST_SHARD, TSUNAMI_SHARD, SATYR_MANE, HAMADRYAD_SHARD, VANOR_SILENOS_MANE, TALK_BUGBEAR_TOTEM, OKUNS_HEAD, KAKRANS_HEAD, NARCISSUSS_SOULSTONE, DEPRIVE_EYE, UNICORNS_HORN, KERUNOSS_GOLD_MANE, SKULL_OF_EXECUTED, BUST_OF_TRAVIS, SWORD_OF_CADMUS); // TODO(Zoey76): This is dead code. - if (getQuestItemsCount(player, LAUREL_LEAF_PIN) < 20) - { + if (getQuestItemsCount(player, LAUREL_LEAF_PIN) < 20) { htmltext = event; - } - else - { + } else { giveAdena(player, 20000, true); htmltext = "30744-17.html"; } break; } - case "30745-02.html": - { - if (!hasQuestItems(player, TEST_INSTRUCTIONS_2)) - { + case "30745-02.html": { + if (!hasQuestItems(player, TEST_INSTRUCTIONS_2)) { htmltext = event; - } - else - { + } else { htmltext = "30745-03.html"; } break; } - case "LIST_1": - { + case "LIST_1": { int i0 = 0; int i1 = 0; int i2 = 0; @@ -718,32 +644,24 @@ public class Q00335_TheSongOfTheHunter extends Quest int i4 = 0; int i5 = 0; - if (qs.isMemoState(0)) - { - while ((i0 == i1) || (i1 == i2) || (i2 == i3) || (i3 == i4) || (i0 == i4) || (i0 == i2) || (i0 == i3) || (i1 == i3) || (i1 == i4) || (i2 == i4)) - { - if (!hasQuestItems(player, LAUREL_LEAF_PIN)) - { + if (qs.isMemoState(0)) { + while ((i0 == i1) || (i1 == i2) || (i2 == i3) || (i3 == i4) || (i0 == i4) || (i0 == i2) || (i0 == i3) || (i1 == i3) || (i1 == i4) || (i2 == i4)) { + if (!hasQuestItems(player, LAUREL_LEAF_PIN)) { i0 = getRandom(12); i1 = getRandom(12); i2 = getRandom(12); i3 = getRandom(12); i4 = getRandom(12); qs.setMemoState((i0 * 32 * 32 * 32 * 32) + (i1 * 32 * 32 * 32) + (i2 * 32 * 32) + (i3 * 32 * 1) + (i4 * 1 * 1)); - } - else if (getQuestItemsCount(player, LAUREL_LEAF_PIN) < 4) - { - if (getRandom(100) < 20) - { + } else if (getQuestItemsCount(player, LAUREL_LEAF_PIN) < 4) { + if (getRandom(100) < 20) { i0 = getRandom(6) + 12; i1 = getRandom(12); i2 = getRandom(6); i3 = getRandom(6) + 6; i4 = getRandom(12); qs.setMemoState((i0 * 32 * 32 * 32 * 32) + (i1 * 32 * 32 * 32) + (i2 * 32 * 32) + (i3 * 32 * 1) + (i4 * 1 * 1)); - } - else - { + } else { i0 = getRandom(12); i1 = getRandom(12); i2 = getRandom(12); @@ -751,32 +669,22 @@ public class Q00335_TheSongOfTheHunter extends Quest i4 = getRandom(12); qs.setMemoState((i0 * 32 * 32 * 32 * 32) + (i1 * 32 * 32 * 32) + (i2 * 32 * 32) + (i3 * 32 * 1) + (i4 * 1 * 1)); } - } - else if (getRandom(100) < 20) - { + } else if (getRandom(100) < 20) { i0 = getRandom(6) + 12; - if (getRandom(20) == 0) - { + if (getRandom(20) == 0) { i1 = getRandom(2) + 18; - } - else - { + } else { i1 = getRandom(12); } i2 = getRandom(6); i3 = getRandom(6) + 6; i4 = getRandom(12); qs.setMemoState((i0 * 32 * 32 * 32 * 32) + (i1 * 32 * 32 * 32) + (i2 * 32 * 32) + (i3 * 32 * 1) + (i4 * 1 * 1)); - } - else - { + } else { i0 = getRandom(12); - if (getRandom(20) == 0) - { + if (getRandom(20) == 0) { i1 = getRandom(2) + 18; - } - else - { + } else { i1 = getRandom(12); } i2 = getRandom(6); @@ -793,9 +701,7 @@ public class Q00335_TheSongOfTheHunter extends Quest i4 = 33520 + i4; htmltext = getHtml(player, "30745-16.html", i0, i1, i2, i3, i4); - } - else - { + } else { i5 = qs.getMemoState(); i0 = i5 % 32; i5 = i5 / 32; @@ -817,8 +723,7 @@ public class Q00335_TheSongOfTheHunter extends Quest } break; } - case "LIST_2": - { + case "LIST_2": { int i0 = 0; int i1 = 0; int i2 = 0; @@ -826,32 +731,24 @@ public class Q00335_TheSongOfTheHunter extends Quest int i4 = 0; int i5 = 0; - if (qs.isMemoState(0)) - { - while ((i0 == i1) || (i1 == i2) || (i2 == i3) || (i3 == i4) || (i0 == i4) || (i0 == i2) || (i0 == i3) || (i1 == i3) || (i1 == i4) || (i2 == i4)) - { - if (!hasQuestItems(player, LAUREL_LEAF_PIN)) - { + if (qs.isMemoState(0)) { + while ((i0 == i1) || (i1 == i2) || (i2 == i3) || (i3 == i4) || (i0 == i4) || (i0 == i2) || (i0 == i3) || (i1 == i3) || (i1 == i4) || (i2 == i4)) { + if (!hasQuestItems(player, LAUREL_LEAF_PIN)) { i0 = getRandom(10); i1 = getRandom(10); i2 = getRandom(5); i3 = getRandom(5) + 5; i4 = getRandom(10); qs.setMemoState((i0 * 32 * 32 * 32 * 32) + (i1 * 32 * 32 * 32) + (i2 * 32 * 32) + (i3 * 32 * 1) + (i4 * 1 * 1)); - } - else if (getQuestItemsCount(player, LAUREL_LEAF_PIN) < 4) - { - if (getRandom(100) < 20) - { + } else if (getQuestItemsCount(player, LAUREL_LEAF_PIN) < 4) { + if (getRandom(100) < 20) { i0 = getRandom(6) + 10; i1 = getRandom(10); i2 = getRandom(5); i3 = getRandom(5) + 5; i4 = getRandom(10); qs.setMemoState((i0 * 32 * 32 * 32 * 32) + (i1 * 32 * 32 * 32) + (i2 * 32 * 32) + (i3 * 32 * 1) + (i4 * 1 * 1)); - } - else - { + } else { i0 = getRandom(10); i1 = getRandom(10); i2 = getRandom(5); @@ -859,32 +756,22 @@ public class Q00335_TheSongOfTheHunter extends Quest i4 = getRandom(10); qs.setMemoState((i0 * 32 * 32 * 32 * 32) + (i1 * 32 * 32 * 32) + (i2 * 32 * 32) + (i3 * 32 * 1) + (i4 * 1 * 1)); } - } - else if (getRandom(100) < 20) - { + } else if (getRandom(100) < 20) { i0 = getRandom(6) + 10; - if (getRandom(20) == 0) - { + if (getRandom(20) == 0) { i1 = getRandom(3) + 16; - } - else - { + } else { i1 = getRandom(10); } i2 = getRandom(5); i3 = getRandom(5) + 5; i4 = getRandom(10); qs.setMemoState((i0 * 32 * 32 * 32 * 32) + (i1 * 32 * 32 * 32) + (i2 * 32 * 32) + (i3 * 32 * 1) + (i4 * 1 * 1)); - } - else - { + } else { i0 = getRandom(10); - if (getRandom(20) == 0) - { + if (getRandom(20) == 0) { i1 = getRandom(3) + 16; - } - else - { + } else { i1 = getRandom(10); } i2 = getRandom(5); @@ -901,9 +788,7 @@ public class Q00335_TheSongOfTheHunter extends Quest i4 = 33520 + (i4 + 20); htmltext = getHtml(player, "30745-16.html", i0, i1, i2, i3, i4); - } - else - { + } else { i5 = qs.getMemoState(); i0 = i5 % 32; i5 = i5 / 32; @@ -925,60 +810,38 @@ public class Q00335_TheSongOfTheHunter extends Quest } break; } - case "30746-03.html": - { - if (!hasQuestItems(player, CYBELLINS_DAGGER)) - { + case "30746-03.html": { + if (!hasQuestItems(player, CYBELLINS_DAGGER)) { giveItems(player, CYBELLINS_DAGGER, 1); } - if (getQuestItemsCount(player, CYBELLINS_REQUEST) == 0) - { + if (getQuestItemsCount(player, CYBELLINS_REQUEST) == 0) { giveItems(player, CYBELLINS_REQUEST, 1); } giveItems(player, BLOOD_CRYSTAL_PURITY_1, 1); - if (hasQuestItems(player, BROKEN_BLOOD_CRYSTAL)) - { + if (hasQuestItems(player, BROKEN_BLOOD_CRYSTAL)) { takeItems(player, BROKEN_BLOOD_CRYSTAL, -1); } htmltext = event; break; } - case "30746-06.html": - { - if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_2)) - { + case "30746-06.html": { + if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_2)) { giveAdena(player, 3400, true); - } - else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_3)) - { + } else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_3)) { giveAdena(player, 6800, true); - } - else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_4)) - { + } else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_4)) { giveAdena(player, 13600, true); - } - else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_5)) - { + } else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_5)) { giveAdena(player, 27200, true); - } - else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_6)) - { + } else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_6)) { giveAdena(player, 54400, true); - } - else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_7)) - { + } else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_7)) { giveAdena(player, 108800, true); - } - else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_8)) - { + } else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_8)) { giveAdena(player, 217600, true); - } - else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_9)) - { + } else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_9)) { giveAdena(player, 435200, true); - } - else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_10)) - { + } else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_10)) { giveAdena(player, 870400, true); } takeItems(player, BLOOD_CRYSTAL_PURITY_2, -1); @@ -993,19 +856,16 @@ public class Q00335_TheSongOfTheHunter extends Quest htmltext = event; break; } - case "30746-10.html": - { + case "30746-10.html": { takeItems(player, BLOOD_CRYSTAL_PURITY_1, -1); takeItems(player, CYBELLINS_DAGGER, -1); takeItems(player, CYBELLINS_REQUEST, -1); htmltext = event; break; } - case "30745-05b.html": - { + case "30745-05b.html": { htmltext = event; - if (hasQuestItems(player, LAUREL_LEAF_PIN)) - { + if (hasQuestItems(player, LAUREL_LEAF_PIN)) { takeItems(player, LAUREL_LEAF_PIN, 1); } @@ -1024,230 +884,192 @@ public class Q00335_TheSongOfTheHunter extends Quest takeItems(player, -1, DEPRIVE_EYE, UNICORNS_HORN, KERUNOSS_GOLD_MANE, SKULL_OF_EXECUTED, BUST_OF_TRAVIS, SWORD_OF_CADMUS); break; } - case "30745-10a.html": - { + case "30745-10a.html": { giveItems(player, FIRST_CIRCLE_REQUEST_1C, 1); htmltext = event; break; } - case "30745-10b.html": - { + case "30745-10b.html": { giveItems(player, FIRST_CIRCLE_REQUEST_2C, 1); htmltext = event; break; } - case "30745-10c.html": - { + case "30745-10c.html": { giveItems(player, FIRST_CIRCLE_REQUEST_3C, 1); htmltext = event; break; } - case "30745-10d.html": - { + case "30745-10d.html": { giveItems(player, FIRST_CIRCLE_REQUEST_4C, 1); htmltext = event; break; } - case "30745-10e.html": - { + case "30745-10e.html": { giveItems(player, FIRST_CIRCLE_REQUEST_5C, 1); htmltext = event; break; } - case "30745-10f.html": - { + case "30745-10f.html": { giveItems(player, FIRST_CIRCLE_REQUEST_6C, 1); htmltext = event; break; } - case "30745-10g.html": - { + case "30745-10g.html": { giveItems(player, FIRST_CIRCLE_REQUEST_7C, 1); htmltext = event; break; } - case "30745-10h.html": - { + case "30745-10h.html": { giveItems(player, FIRST_CIRCLE_REQUEST_8C, 1); htmltext = event; break; } - case "30745-10i.html": - { + case "30745-10i.html": { giveItems(player, FIRST_CIRCLE_REQUEST_9C, 1); htmltext = event; break; } - case "30745-10j.html": - { + case "30745-10j.html": { giveItems(player, FIRST_CIRCLE_REQUEST_10C, 1); htmltext = event; break; } - case "30745-10k.html": - { + case "30745-10k.html": { giveItems(player, FIRST_CIRCLE_REQUEST_11C, 1); htmltext = event; break; } - case "30745-10l.html": - { + case "30745-10l.html": { giveItems(player, FIRST_CIRCLE_REQUEST_12C, 1); htmltext = event; break; } - case "30745-11a.html": - { + case "30745-11a.html": { giveItems(player, FIRST_CIRCLE_REQUEST_1B, 1); htmltext = event; break; } - case "30745-11b.html": - { + case "30745-11b.html": { giveItems(player, FIRST_CIRCLE_REQUEST_2B, 1); htmltext = event; break; } - case "30745-11c.html": - { + case "30745-11c.html": { giveItems(player, FIRST_CIRCLE_REQUEST_3B, 1); htmltext = event; break; } - case "30745-11d.html": - { + case "30745-11d.html": { giveItems(player, FIRST_CIRCLE_REQUEST_4B, 1); htmltext = event; break; } - case "30745-11e.html": - { + case "30745-11e.html": { giveItems(player, FIRST_CIRCLE_REQUEST_5B, 1); htmltext = event; break; } - case "30745-11f.html": - { + case "30745-11f.html": { giveItems(player, FIRST_CIRCLE_REQUEST_6B, 1); htmltext = event; break; } - case "30745-12a.html": - { + case "30745-12a.html": { giveItems(player, FIRST_CIRCLE_REQUEST_1A, 1); htmltext = event; break; } - case "30745-12b.html": - { + case "30745-12b.html": { giveItems(player, FIRST_CIRCLE_REQUEST_2A, 1); htmltext = event; break; } - case "30745-12c.html": - { + case "30745-12c.html": { giveItems(player, FIRST_CIRCLE_REQUEST_3A, 1); htmltext = event; break; } - case "30745-13a.html": - { + case "30745-13a.html": { giveItems(player, SECOND_CIRCLE_REQUEST_1C, 1); htmltext = event; break; } - case "30745-13b.html": - { + case "30745-13b.html": { giveItems(player, SECOND_CIRCLE_REQUEST_2C, 1); htmltext = event; break; } - case "30745-13c.html": - { + case "30745-13c.html": { giveItems(player, SECOND_CIRCLE_REQUEST_3C, 1); htmltext = event; break; } - case "30745-13d.html": - { + case "30745-13d.html": { giveItems(player, SECOND_CIRCLE_REQUEST_4C, 1); htmltext = event; break; } - case "30745-13e.html": - { + case "30745-13e.html": { giveItems(player, SECOND_CIRCLE_REQUEST_5C, 1); htmltext = event; break; } - case "30745-13f.html": - { + case "30745-13f.html": { giveItems(player, SECOND_CIRCLE_REQUEST_6C, 1); htmltext = event; break; } - case "30745-13g.html": - { + case "30745-13g.html": { giveItems(player, SECOND_CIRCLE_REQUEST_7C, 1); htmltext = event; break; } - case "30745-13k.html": - { + case "30745-13k.html": { giveItems(player, SECOND_CIRCLE_REQUEST_11C, 1); htmltext = event; break; } - case "30745-13i.html": - { + case "30745-13i.html": { giveItems(player, SECOND_CIRCLE_REQUEST_9C, 1); htmltext = event; break; } - case "30745-13j.html": - { + case "30745-13j.html": { giveItems(player, SECOND_CIRCLE_REQUEST_10C, 1); htmltext = event; break; } - case "30745-13l.html": - { + case "30745-13l.html": { giveItems(player, SECOND_CIRCLE_REQUEST_12C, 1); htmltext = event; break; } - case "30745-14a.html": - { + case "30745-14a.html": { giveItems(player, SECOND_CIRCLE_REQUEST_1B, 1); htmltext = event; break; } - case "30745-14b.html": - { + case "30745-14b.html": { giveItems(player, SECOND_CIRCLE_REQUEST_2B, 1); htmltext = event; break; } - case "30745-14c.html": - { + case "30745-14c.html": { giveItems(player, SECOND_CIRCLE_REQUEST_3B, 1); htmltext = event; break; } - case "30745-14d.html": - { + case "30745-14d.html": { giveItems(player, SECOND_CIRCLE_REQUEST_4B, 1); htmltext = event; break; } - case "30745-14e.html": - { + case "30745-14e.html": { giveItems(player, SECOND_CIRCLE_REQUEST_5B, 1); htmltext = event; break; } - case "30745-14f.html": - { + case "30745-14f.html": { giveItems(player, SECOND_CIRCLE_REQUEST_6B, 1); htmltext = event; break; @@ -1257,251 +1079,185 @@ public class Q00335_TheSongOfTheHunter extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(player, -1, 3, npc); - if (qs != null) - { - for (int i = DROPLIST.length - 1; i >= 0; i--) - { + if (qs != null) { + for (int i = DROPLIST.length - 1; i >= 0; i--) { final int[] droplist = DROPLIST[i]; - if (npc.getId() == droplist[0]) - { - if (hasQuestItems(qs.getPlayer(), droplist[1]) && giveItemRandomly(qs.getPlayer(), npc, droplist[2], droplist[3], droplist[4], droplist[5] / 100d, true)) - { + if (npc.getId() == droplist[0]) { + if (hasQuestItems(qs.getPlayer(), droplist[1]) && giveItemRandomly(qs.getPlayer(), npc, droplist[2], droplist[3], droplist[4], droplist[5] / 100d, true)) { playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); } } } - switch (npc.getId()) - { - case BREKA_ORC_WARRIOR: - { - if (hasQuestItems(qs.getPlayer(), TEST_INSTRUCTIONS_1) && ((getQuestItemsCount(qs.getPlayer(), HAKAS_HEAD) + getQuestItemsCount(qs.getPlayer(), JAKAS_HEAD) + getQuestItemsCount(qs.getPlayer(), MARKAS_HEAD)) < 3)) - { - if (getRandom(10) < 2) - { - if (!hasQuestItems(qs.getPlayer(), HAKAS_HEAD)) - { + switch (npc.getId()) { + case BREKA_ORC_WARRIOR: { + if (hasQuestItems(qs.getPlayer(), TEST_INSTRUCTIONS_1) && ((getQuestItemsCount(qs.getPlayer(), HAKAS_HEAD) + getQuestItemsCount(qs.getPlayer(), JAKAS_HEAD) + getQuestItemsCount(qs.getPlayer(), MARKAS_HEAD)) < 3)) { + if (getRandom(10) < 2) { + if (!hasQuestItems(qs.getPlayer(), HAKAS_HEAD)) { addSpawn(BREKA_OVERLORD_HAKA, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); - } - else if (!hasQuestItems(qs.getPlayer(), JAKAS_HEAD)) - { + } else if (!hasQuestItems(qs.getPlayer(), JAKAS_HEAD)) { addSpawn(BREKA_OVERLORD_JAKA, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); - } - else if (!hasQuestItems(qs.getPlayer(), MARKAS_HEAD)) - { + } else if (!hasQuestItems(qs.getPlayer(), MARKAS_HEAD)) { addSpawn(BREKA_OVERLORD_MARKA, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); } } } break; } - case WINDSUS: - { - if (hasQuestItems(qs.getPlayer(), TEST_INSTRUCTIONS_1) && !hasQuestItems(qs.getPlayer(), WINDSUS_ALEPH_SKIN) && (getRandom(10) < 2)) - { + case WINDSUS: { + if (hasQuestItems(qs.getPlayer(), TEST_INSTRUCTIONS_1) && !hasQuestItems(qs.getPlayer(), WINDSUS_ALEPH_SKIN) && (getRandom(10) < 2)) { addSpawn(WINDSUS_ALEPH, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); } break; } - case GRANDIS: - { - if (hasQuestItems(qs.getPlayer(), FIRST_CIRCLE_REQUEST_2A) && !hasQuestItems(qs.getPlayer(), TITANS_TABLET) && (getRandom(10) < 2)) - { + case GRANDIS: { + if (hasQuestItems(qs.getPlayer(), FIRST_CIRCLE_REQUEST_2A) && !hasQuestItems(qs.getPlayer(), TITANS_TABLET) && (getRandom(10) < 2)) { addSpawn(GOK_MAGOK, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); } break; } - case TARLK_BUGBEAR_WARRIOR: - { + case TARLK_BUGBEAR_WARRIOR: { if (hasQuestItems(qs.getPlayer(), TEST_INSTRUCTIONS_2) - && ((getQuestItemsCount(qs.getPlayer(), ATHUS_HEAD) + getQuestItemsCount(qs.getPlayer(), LANKAS_HEAD) + getQuestItemsCount(qs.getPlayer(), TRISKAS_HEAD) + getQuestItemsCount(qs.getPlayer(), MOTURAS_HEAD) + getQuestItemsCount(qs.getPlayer(), KALATHS_HEAD)) < 5)) - { - if (getRandom(10) < 2) - { - if (!hasQuestItems(qs.getPlayer(), ATHUS_HEAD)) - { + && ((getQuestItemsCount(qs.getPlayer(), ATHUS_HEAD) + getQuestItemsCount(qs.getPlayer(), LANKAS_HEAD) + getQuestItemsCount(qs.getPlayer(), TRISKAS_HEAD) + getQuestItemsCount(qs.getPlayer(), MOTURAS_HEAD) + getQuestItemsCount(qs.getPlayer(), KALATHS_HEAD)) < 5)) { + if (getRandom(10) < 2) { + if (!hasQuestItems(qs.getPlayer(), ATHUS_HEAD)) { addSpawn(TARLK_RAIDER_ATHU, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); - } - else if (!hasQuestItems(qs.getPlayer(), LANKAS_HEAD)) - { + } else if (!hasQuestItems(qs.getPlayer(), LANKAS_HEAD)) { addSpawn(TARLK_RAIDER_LANKA, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); - } - else if (!hasQuestItems(qs.getPlayer(), TRISKAS_HEAD)) - { + } else if (!hasQuestItems(qs.getPlayer(), TRISKAS_HEAD)) { addSpawn(TARLK_RAIDER_TRISKA, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); - } - else if (!hasQuestItems(qs.getPlayer(), MOTURAS_HEAD)) - { + } else if (!hasQuestItems(qs.getPlayer(), MOTURAS_HEAD)) { addSpawn(TARLK_RAIDER_MOTURA, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); - } - else if (!hasQuestItems(qs.getPlayer(), KALATHS_HEAD)) - { + } else if (!hasQuestItems(qs.getPlayer(), KALATHS_HEAD)) { addSpawn(TARLK_RAIDER_KALATH, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); } } } break; } - case LETO_LIZARDMAN_SHAMAN: - { - if (hasQuestItems(qs.getPlayer(), FIRST_CIRCLE_REQUEST_4B) && !hasQuestItems(qs.getPlayer(), TOTEM_OF_KADESH) && (getRandom(10) < 2)) - { + case LETO_LIZARDMAN_SHAMAN: { + if (hasQuestItems(qs.getPlayer(), FIRST_CIRCLE_REQUEST_4B) && !hasQuestItems(qs.getPlayer(), TOTEM_OF_KADESH) && (getRandom(10) < 2)) { addSpawn(LETO_SHAMAN_KETZ, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); } evolveBloodCrystal(qs.getPlayer()); break; } - case LETO_LIZARDMAN_OVERLORD: - { - if (hasQuestItems(qs.getPlayer(), FIRST_CIRCLE_REQUEST_1B) && !hasQuestItems(qs.getPlayer(), FANG_OF_NARAK) && (getRandom(10) < 2)) - { + case LETO_LIZARDMAN_OVERLORD: { + if (hasQuestItems(qs.getPlayer(), FIRST_CIRCLE_REQUEST_1B) && !hasQuestItems(qs.getPlayer(), FANG_OF_NARAK) && (getRandom(10) < 2)) { addSpawn(LETO_CHIEF_NARAK, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); } evolveBloodCrystal(qs.getPlayer()); break; } - case TIMAK_ORC_WARRIOR: - { - if (hasQuestItems(qs.getPlayer(), FIRST_CIRCLE_REQUEST_5B) && !hasQuestItems(qs.getPlayer(), KAIKIS_HEAD) && (getRandom(10) < 2)) - { + case TIMAK_ORC_WARRIOR: { + if (hasQuestItems(qs.getPlayer(), FIRST_CIRCLE_REQUEST_5B) && !hasQuestItems(qs.getPlayer(), KAIKIS_HEAD) && (getRandom(10) < 2)) { addSpawn(TIMAK_RAIDER_KAIKEE, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); } break; } - case TIMAK_ORC_OVERLORD: - { - if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_1B) && !hasQuestItems(qs.getPlayer(), OKUNS_HEAD) && (getRandom(10) == 0)) - { + case TIMAK_ORC_OVERLORD: { + if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_1B) && !hasQuestItems(qs.getPlayer(), OKUNS_HEAD) && (getRandom(10) == 0)) { addSpawn(TIMAK_OVERLORD_OKUN, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); } break; } case FLINE: - case LIELE: - { - if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_7C) && (getQuestItemsCount(qs.getPlayer(), TEMPEST_SHARD) < 40) && (getRandom(20) < 2)) - { + case LIELE: { + if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_7C) && (getQuestItemsCount(qs.getPlayer(), TEMPEST_SHARD) < 40) && (getRandom(20) < 2)) { addSpawn(GREMLIN_FILCHER, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); npc.broadcastPacket(new CreatureSay(npc.getObjectId(), Say2.NPC_ALL, npc.getName(), NpcStringId.SHOW_ME_THE_PRETTY_SPARKLING_THINGS_THEYRE_ALL_MINE)); } break; } - case FOREST_RUNNER: - { - if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_10C) && (getQuestItemsCount(qs.getPlayer(), HAMADRYAD_SHARD) < 40) && (getRandom(20) < 2)) - { + case FOREST_RUNNER: { + if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_10C) && (getQuestItemsCount(qs.getPlayer(), HAMADRYAD_SHARD) < 40) && (getRandom(20) < 2)) { addSpawn(GREMLIN_FILCHER, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); npc.broadcastPacket(new CreatureSay(npc.getObjectId(), Say2.NPC_ALL, npc.getName(), NpcStringId.SHOW_ME_THE_PRETTY_SPARKLING_THINGS_THEYRE_ALL_MINE)); } break; } - case KARUL_BUGBEAR: - { - if (hasQuestItems(qs.getPlayer(), FIRST_CIRCLE_REQUEST_3A) && !hasQuestItems(qs.getPlayer(), BOOK_OF_SHUNAIMAN) && (getRandom(10) < 2)) - { + case KARUL_BUGBEAR: { + if (hasQuestItems(qs.getPlayer(), FIRST_CIRCLE_REQUEST_3A) && !hasQuestItems(qs.getPlayer(), BOOK_OF_SHUNAIMAN) && (getRandom(10) < 2)) { addSpawn(KARUL_CHIEF_OROOTO, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); } break; } - case TAIK_ORC_CAPTAIN: - { - if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_2B) && !hasQuestItems(qs.getPlayer(), KAKRANS_HEAD) && (getRandom(10) < 2)) - { + case TAIK_ORC_CAPTAIN: { + if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_2B) && !hasQuestItems(qs.getPlayer(), KAKRANS_HEAD) && (getRandom(10) < 2)) { addSpawn(TAIK_OVERLORD_KAKRAN, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); } break; } - case MIRROR: - { - if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_3B) && (getQuestItemsCount(qs.getPlayer(), NARCISSUSS_SOULSTONE) < 40) && (getRandom(20) < 2)) - { + case MIRROR: { + if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_3B) && (getQuestItemsCount(qs.getPlayer(), NARCISSUSS_SOULSTONE) < 40) && (getRandom(20) < 2)) { addSpawn(GREMLIN_FILCHER, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); npc.broadcastPacket(new CreatureSay(npc.getObjectId(), Say2.NPC_ALL, npc.getName(), NpcStringId.SHOW_ME_THE_PRETTY_SPARKLING_THINGS_THEYRE_ALL_MINE)); } break; } - case HATAR_RATMAN_THIEF: - { - if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_5C) && (getQuestItemsCount(qs.getPlayer(), COIN_OF_OLD_EMPIRE) < 20) && (getRandom(20) < 2)) - { + case HATAR_RATMAN_THIEF: { + if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_5C) && (getQuestItemsCount(qs.getPlayer(), COIN_OF_OLD_EMPIRE) < 20) && (getRandom(20) < 2)) { addSpawn(GREMLIN_FILCHER, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); npc.broadcastPacket(new CreatureSay(npc.getObjectId(), Say2.NPC_ALL, npc.getName(), NpcStringId.SHOW_ME_THE_PRETTY_SPARKLING_THINGS_THEYRE_ALL_MINE)); } break; } - case HATAR_RATMAN_BOSS: - { - if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_5C) && (getQuestItemsCount(qs.getPlayer(), COIN_OF_OLD_EMPIRE) < 20) && (getRandom(20) < 2)) - { + case HATAR_RATMAN_BOSS: { + if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_5C) && (getQuestItemsCount(qs.getPlayer(), COIN_OF_OLD_EMPIRE) < 20) && (getRandom(20) < 2)) { addSpawn(GREMLIN_FILCHER, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); npc.broadcastPacket(new CreatureSay(npc.getObjectId(), Say2.NPC_ALL, npc.getName(), NpcStringId.SHOW_ME_THE_PRETTY_SPARKLING_THINGS_THEYRE_ALL_MINE)); } - if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_2A) && !hasQuestItems(qs.getPlayer(), BUST_OF_TRAVIS) && (getRandom(10) < 2)) - { + if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_2A) && !hasQuestItems(qs.getPlayer(), BUST_OF_TRAVIS) && (getRandom(10) < 2)) { addSpawn(HATAR_CHIEFTAIN_KUBEL, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); } break; } - case VANOR_SILENOS_CHIEFTAIN: - { - if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_6B) && !hasQuestItems(qs.getPlayer(), KERUNOSS_GOLD_MANE) && (getRandom(10) < 2)) - { + case VANOR_SILENOS_CHIEFTAIN: { + if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_6B) && !hasQuestItems(qs.getPlayer(), KERUNOSS_GOLD_MANE) && (getRandom(10) < 2)) { addSpawn(VANOR_ELDER_KERUNOS, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); } break; } - case GREMLIN_FILCHER: - { - if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_7C) && (getQuestItemsCount(qs.getPlayer(), TEMPEST_SHARD) < 40)) - { - if (giveItemRandomly(qs.getPlayer(), npc, TEMPEST_SHARD, 5, 40, 1.0, true)) - { + case GREMLIN_FILCHER: { + if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_7C) && (getQuestItemsCount(qs.getPlayer(), TEMPEST_SHARD) < 40)) { + if (giveItemRandomly(qs.getPlayer(), npc, TEMPEST_SHARD, 5, 40, 1.0, true)) { playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); } npc.broadcastPacket(new CreatureSay(npc.getObjectId(), Say2.NPC_ALL, npc.getName(), NpcStringId.PRETTY_GOOD)); } - if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_8C) && (getQuestItemsCount(qs.getPlayer(), TSUNAMI_SHARD) < 40)) - { - if (giveItemRandomly(qs.getPlayer(), npc, TSUNAMI_SHARD, 5, 40, 1.0, true)) - { + if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_8C) && (getQuestItemsCount(qs.getPlayer(), TSUNAMI_SHARD) < 40)) { + if (giveItemRandomly(qs.getPlayer(), npc, TSUNAMI_SHARD, 5, 40, 1.0, true)) { playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); } npc.broadcastPacket(new CreatureSay(npc.getObjectId(), Say2.NPC_ALL, npc.getName(), NpcStringId.PRETTY_GOOD)); } - if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_10C) && (getQuestItemsCount(qs.getPlayer(), HAMADRYAD_SHARD) < 40)) - { - if (giveItemRandomly(qs.getPlayer(), npc, HAMADRYAD_SHARD, 5, 40, 1.0, true)) - { + if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_10C) && (getQuestItemsCount(qs.getPlayer(), HAMADRYAD_SHARD) < 40)) { + if (giveItemRandomly(qs.getPlayer(), npc, HAMADRYAD_SHARD, 5, 40, 1.0, true)) { playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); } npc.broadcastPacket(new CreatureSay(npc.getObjectId(), Say2.NPC_ALL, npc.getName(), NpcStringId.PRETTY_GOOD)); } - if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_3B) && (getQuestItemsCount(qs.getPlayer(), NARCISSUSS_SOULSTONE) < 40)) - { - if (giveItemRandomly(qs.getPlayer(), npc, NARCISSUSS_SOULSTONE, 5, 40, 1.0, true)) - { + if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_3B) && (getQuestItemsCount(qs.getPlayer(), NARCISSUSS_SOULSTONE) < 40)) { + if (giveItemRandomly(qs.getPlayer(), npc, NARCISSUSS_SOULSTONE, 5, 40, 1.0, true)) { playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); } npc.broadcastPacket(new CreatureSay(npc.getObjectId(), Say2.NPC_ALL, npc.getName(), NpcStringId.PRETTY_GOOD)); } - if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_5C) && (getQuestItemsCount(qs.getPlayer(), COIN_OF_OLD_EMPIRE) < 20)) - { - if (giveItemRandomly(qs.getPlayer(), npc, COIN_OF_OLD_EMPIRE, 3, 20, 1.0, true)) - { + if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_5C) && (getQuestItemsCount(qs.getPlayer(), COIN_OF_OLD_EMPIRE) < 20)) { + if (giveItemRandomly(qs.getPlayer(), npc, COIN_OF_OLD_EMPIRE, 3, 20, 1.0, true)) { playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); } @@ -1509,30 +1265,24 @@ public class Q00335_TheSongOfTheHunter extends Quest } break; } - case GOK_MAGOK: - { - if (hasQuestItems(qs.getPlayer(), FIRST_CIRCLE_REQUEST_2A) && !hasQuestItems(qs.getPlayer(), TITANS_TABLET) && (getRandom(2) == 0)) - { + case GOK_MAGOK: { + if (hasQuestItems(qs.getPlayer(), FIRST_CIRCLE_REQUEST_2A) && !hasQuestItems(qs.getPlayer(), TITANS_TABLET) && (getRandom(2) == 0)) { addSpawn(BLACK_LEGION_STORMTROOPER, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); addSpawn(BLACK_LEGION_STORMTROOPER, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); npc.broadcastPacket(new CreatureSay(npc.getObjectId(), Say2.NPC_ALL, npc.getName(), NpcStringId.WELL_TAKE_THE_PROPERTY_OF_THE_ANCIENT_EMPIRE)); } break; } - case HATAR_CHIEFTAIN_KUBEL: - { - if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_2A) && !hasQuestItems(qs.getPlayer(), BUST_OF_TRAVIS) && (getRandom(2) == 0)) - { + case HATAR_CHIEFTAIN_KUBEL: { + if (hasQuestItems(qs.getPlayer(), SECOND_CIRCLE_REQUEST_2A) && !hasQuestItems(qs.getPlayer(), BUST_OF_TRAVIS) && (getRandom(2) == 0)) { addSpawn(BLACK_LEGION_STORMTROOPER, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); addSpawn(BLACK_LEGION_STORMTROOPER, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); npc.broadcastPacket(new CreatureSay(npc.getObjectId(), Say2.NPC_ALL, npc.getName(), NpcStringId.WELL_TAKE_THE_PROPERTY_OF_THE_ANCIENT_EMPIRE)); } break; } - case KARUL_CHIEF_OROOTO: - { - if (hasQuestItems(qs.getPlayer(), FIRST_CIRCLE_REQUEST_3A) && !hasQuestItems(qs.getPlayer(), BOOK_OF_SHUNAIMAN) && (getRandom(2) == 0)) - { + case KARUL_CHIEF_OROOTO: { + if (hasQuestItems(qs.getPlayer(), FIRST_CIRCLE_REQUEST_3A) && !hasQuestItems(qs.getPlayer(), BOOK_OF_SHUNAIMAN) && (getRandom(2) == 0)) { addSpawn(BLACK_LEGION_STORMTROOPER, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); addSpawn(BLACK_LEGION_STORMTROOPER, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true); npc.broadcastPacket(new CreatureSay(npc.getObjectId(), Say2.NPC_ALL, npc.getName(), NpcStringId.WELL_TAKE_THE_PROPERTY_OF_THE_ANCIENT_EMPIRE)); @@ -1543,8 +1293,7 @@ public class Q00335_TheSongOfTheHunter extends Quest case LETO_LIZARDMAN_SOLDIER: case HARIT_LIZARDMAN_GRUNT: case HARIT_LIZARDMAN_ARCHER: - case HARIT_LIZARDMAN_WARRIOR: - { + case HARIT_LIZARDMAN_WARRIOR: { evolveBloodCrystal(qs.getPlayer()); break; } @@ -1553,26 +1302,19 @@ public class Q00335_TheSongOfTheHunter extends Quest return super.onKill(npc, player, isSummon); } - private String reward(L2PcInstance player, QuestState qs, int[][] rewards) - { - for (int i = rewards.length - 1; i >= 0; i--) - { + private String reward(L2PcInstance player, QuestState qs, int[][] rewards) { + for (int i = rewards.length - 1; i >= 0; i--) { final int[] reward = rewards[i]; - if (hasQuestItems(player, reward[0])) - { - if (getQuestItemsCount(player, reward[1]) >= reward[2]) - { + if (hasQuestItems(player, reward[0])) { + if (getQuestItemsCount(player, reward[1]) >= reward[2]) { giveItems(player, LAUREL_LEAF_PIN, 1); giveAdena(player, reward[3], true); playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); qs.setMemoState(0); takeItems(player, reward[0], -1); - if (reward[1] == GIANT_MONSTER_EYE_MEAT) - { + if (reward[1] == GIANT_MONSTER_EYE_MEAT) { takeItems(player, reward[1], reward[2]); - } - else - { + } else { takeItems(player, reward[1], -1); } return (hasQuestItems(player, FIRST_CIRCLE_HUNTER_LICENSE) ? "30745-06a.html" : "30745-06b.html"); @@ -1583,8 +1325,7 @@ public class Q00335_TheSongOfTheHunter extends Quest return null; } - private String getHtml(L2PcInstance player, String htmlName, int i0, int i1, int i2, int i3, int i4) - { + private String getHtml(L2PcInstance player, String htmlName, int i0, int i1, int i2, int i3, int i4) { String html = getHtm(player.getHtmlPrefix(), htmlName); html = html.replace("<?reply1?>", LINKS.get(i0)); html = html.replace("<?reply2?>", LINKS.get(i1)); @@ -1594,69 +1335,46 @@ public class Q00335_TheSongOfTheHunter extends Quest return html; } - private void evolveBloodCrystal(L2PcInstance player) - { + private void evolveBloodCrystal(L2PcInstance player) { final L2Weapon weapon = player.getActiveWeaponItem(); - if ((weapon != null) && (weapon.getId() == CYBELLINS_DAGGER) && (hasQuestItems(player, FIRST_CIRCLE_HUNTER_LICENSE) || hasQuestItems(player, SECOND_CIRCLE_HUNTER_LICENSE))) - { - if (getRandom(100) < 60) - { - if (hasQuestItems(player, CYBELLINS_REQUEST)) - { - if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_1)) - { + if ((weapon != null) && (weapon.getId() == CYBELLINS_DAGGER) && (hasQuestItems(player, FIRST_CIRCLE_HUNTER_LICENSE) || hasQuestItems(player, SECOND_CIRCLE_HUNTER_LICENSE))) { + if (getRandom(100) < 60) { + if (hasQuestItems(player, CYBELLINS_REQUEST)) { + if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_1)) { giveItems(player, BLOOD_CRYSTAL_PURITY_2, 1); takeItems(player, BLOOD_CRYSTAL_PURITY_1, -1); - } - else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_2)) - { + } else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_2)) { giveItems(player, BLOOD_CRYSTAL_PURITY_3, 1); takeItems(player, BLOOD_CRYSTAL_PURITY_2, -1); - } - else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_3)) - { + } else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_3)) { giveItems(player, BLOOD_CRYSTAL_PURITY_4, 1); takeItems(player, BLOOD_CRYSTAL_PURITY_3, -1); - } - else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_4)) - { + } else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_4)) { giveItems(player, BLOOD_CRYSTAL_PURITY_5, 1); takeItems(player, BLOOD_CRYSTAL_PURITY_4, -1); - } - else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_5)) - { + } else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_5)) { giveItems(player, BLOOD_CRYSTAL_PURITY_6, 1); takeItems(player, BLOOD_CRYSTAL_PURITY_5, -1); - } - else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_6)) - { + } else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_6)) { giveItems(player, BLOOD_CRYSTAL_PURITY_7, 1); playSound(player, Sound.ITEMSOUND_QUEST_JACKPOT); takeItems(player, BLOOD_CRYSTAL_PURITY_6, -1); - } - else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_7)) - { + } else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_7)) { giveItems(player, BLOOD_CRYSTAL_PURITY_8, 1); playSound(player, Sound.ITEMSOUND_QUEST_JACKPOT); takeItems(player, BLOOD_CRYSTAL_PURITY_7, -1); - } - else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_8)) - { + } else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_8)) { giveItems(player, BLOOD_CRYSTAL_PURITY_9, 1); playSound(player, Sound.ITEMSOUND_QUEST_JACKPOT); takeItems(player, BLOOD_CRYSTAL_PURITY_8, -1); - } - else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_9)) - { + } else if (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_9)) { giveItems(player, BLOOD_CRYSTAL_PURITY_10, 1); playSound(player, Sound.ITEMSOUND_QUEST_JACKPOT); takeItems(player, BLOOD_CRYSTAL_PURITY_9, -1); } } - } - else if (hasQuestItems(player, CYBELLINS_REQUEST) && (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_1) || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_2) || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_3) || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_4) - || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_5) || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_6) || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_7) || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_8) || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_9))) - { + } else if (hasQuestItems(player, CYBELLINS_REQUEST) && (hasQuestItems(player, BLOOD_CRYSTAL_PURITY_1) || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_2) || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_3) || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_4) + || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_5) || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_6) || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_7) || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_8) || hasQuestItems(player, BLOOD_CRYSTAL_PURITY_9))) { takeItems(player, -1, BLOOD_CRYSTAL_PURITY_1, BLOOD_CRYSTAL_PURITY_2, BLOOD_CRYSTAL_PURITY_3, BLOOD_CRYSTAL_PURITY_4, BLOOD_CRYSTAL_PURITY_5, BLOOD_CRYSTAL_PURITY_6, BLOOD_CRYSTAL_PURITY_7, BLOOD_CRYSTAL_PURITY_8, BLOOD_CRYSTAL_PURITY_9); giveItems(player, BROKEN_BLOOD_CRYSTAL, 1); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00336_CoinsOfMagic/Q00336_CoinsOfMagic.java b/src/main/java/com/l2jserver/datapack/quests/Q00336_CoinsOfMagic/Q00336_CoinsOfMagic.java index 278aa98c15..c33bca7851 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00336_CoinsOfMagic/Q00336_CoinsOfMagic.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00336_CoinsOfMagic/Q00336_CoinsOfMagic.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.util.Util; * Coin Of Magic (336) * @author Zealar */ -public final class Q00336_CoinsOfMagic extends Quest -{ +public final class Q00336_CoinsOfMagic extends Quest { // NPCs private static final int PANO = 30078; private static final int COLLOB = 30092; @@ -151,8 +150,7 @@ public final class Q00336_CoinsOfMagic extends Quest private static final String PARAM_3 = "param3"; private static final String FLAG = "flag"; - public Q00336_CoinsOfMagic() - { + public Q00336_CoinsOfMagic() { super(336, Q00336_CoinsOfMagic.class.getSimpleName(), "Coins of Magic"); addStartNpc(WAREHOUSE_KEEPER_SORINT); addTalkId(PANO, COLLOB, RAPIN, HAGGER, STAN, RESEARCHER_LORAIN, BLACKSMITH_DUNING, MAGISTER_PAGE, UNION_PRESIDENT_BERNARD, HEAD_BLACKSMITH_FERRIS); @@ -161,86 +159,66 @@ public final class Q00336_CoinsOfMagic extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (npc.getId()) - { + switch (npc.getId()) { case PANO: case COLLOB: - case HEAD_BLACKSMITH_FERRIS: - { - if (qs.hasQuestItems(Q_CC_MEMBERSHIP_1)) - { + case HEAD_BLACKSMITH_FERRIS: { + if (qs.hasQuestItems(Q_CC_MEMBERSHIP_1)) { resetParams(qs); return npc.getId() + "-01.html"; } - if (qs.hasQuestItems(Q_CC_MEMBERSHIP_2) || qs.hasQuestItems(Q_CC_MEMBERSHIP_3)) - { + if (qs.hasQuestItems(Q_CC_MEMBERSHIP_2) || qs.hasQuestItems(Q_CC_MEMBERSHIP_3)) { return npc.getId() + "-54.html"; } break; } case RAPIN: case STAN: - case BLACKSMITH_DUNING: - { - if (qs.hasQuestItems(Q_CC_MEMBERSHIP_1) || qs.hasQuestItems(Q_CC_MEMBERSHIP_2)) - { + case BLACKSMITH_DUNING: { + if (qs.hasQuestItems(Q_CC_MEMBERSHIP_1) || qs.hasQuestItems(Q_CC_MEMBERSHIP_2)) { resetParams(qs); return npc.getId() + "-01.html"; } - if (qs.hasQuestItems(Q_CC_MEMBERSHIP_3)) - { + if (qs.hasQuestItems(Q_CC_MEMBERSHIP_3)) { return npc.getId() + "-54.html"; } break; } case HAGGER: case MAGISTER_PAGE: - case RESEARCHER_LORAIN: - { - if (qs.hasQuestItems(Q_CC_MEMBERSHIP_1) || qs.hasQuestItems(Q_CC_MEMBERSHIP_2) || qs.hasQuestItems(Q_CC_MEMBERSHIP_3)) - { + case RESEARCHER_LORAIN: { + if (qs.hasQuestItems(Q_CC_MEMBERSHIP_1) || qs.hasQuestItems(Q_CC_MEMBERSHIP_2) || qs.hasQuestItems(Q_CC_MEMBERSHIP_3)) { resetParams(qs); return npc.getId() + "-01.html"; } break; } - case UNION_PRESIDENT_BERNARD: - { - if ((qs.getMemoState() == 1) && qs.hasQuestItems(Q_COIN_DIAGRAM)) - { + case UNION_PRESIDENT_BERNARD: { + if ((qs.getMemoState() == 1) && qs.hasQuestItems(Q_COIN_DIAGRAM)) { return "30702-01.html"; } - if (qs.getMemoState() >= 3) - { + if (qs.getMemoState() >= 3) { return "30702-05.html"; } - if (qs.getMemoState() == 2) - { + if (qs.getMemoState() == 2) { return "30702-02a.html"; } } - case WAREHOUSE_KEEPER_SORINT: - { - if (qs.isCreated()) - { - if (player.getLevel() < 40) - { + case WAREHOUSE_KEEPER_SORINT: { + if (qs.isCreated()) { + if (player.getLevel() < 40) { return "30232-01.htm"; } return "30232-02.htm"; } - if (qs.isStarted()) - { - if (!qs.hasQuestItems(Q_KALDIS_GOLD_DRAGON) && ((qs.getMemoState() == 1) || (qs.getMemoState() == 2))) - { + if (qs.isStarted()) { + if (!qs.hasQuestItems(Q_KALDIS_GOLD_DRAGON) && ((qs.getMemoState() == 1) || (qs.getMemoState() == 2))) { return "30232-06.html"; } - if (qs.hasQuestItems(Q_KALDIS_GOLD_DRAGON) && ((qs.getMemoState() == 1) || (qs.getMemoState() == 2))) - { + if (qs.hasQuestItems(Q_KALDIS_GOLD_DRAGON) && ((qs.getMemoState() == 1) || (qs.getMemoState() == 2))) { qs.giveItems(Q_CC_MEMBERSHIP_3, 1); qs.takeItems(Q_COIN_DIAGRAM, -1); qs.takeItems(Q_KALDIS_GOLD_DRAGON, 1); @@ -250,16 +228,13 @@ public final class Q00336_CoinsOfMagic extends Quest qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); return "30232-07.html"; } - if (qs.hasQuestItems(Q_CC_MEMBERSHIP_3) && (qs.getMemoState() == 3)) - { + if (qs.hasQuestItems(Q_CC_MEMBERSHIP_3) && (qs.getMemoState() == 3)) { return "30232-10.html"; } - if (qs.hasQuestItems(Q_CC_MEMBERSHIP_2) && (qs.getMemoState() == 3)) - { + if (qs.hasQuestItems(Q_CC_MEMBERSHIP_2) && (qs.getMemoState() == 3)) { return "30232-11.html"; } - if (qs.hasQuestItems(Q_CC_MEMBERSHIP_1) && (qs.getMemoState() == 3)) - { + if (qs.hasQuestItems(Q_CC_MEMBERSHIP_1) && (qs.getMemoState() == 3)) { return "30232-12.html"; } } @@ -269,21 +244,17 @@ public final class Q00336_CoinsOfMagic extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - if (event.equals("QUEST_ACCEPTED")) - { + if (event.equals("QUEST_ACCEPTED")) { qs.playSound(Sound.ITEMSOUND_QUEST_ACCEPT); - if (!qs.hasQuestItems(Q_COIN_DIAGRAM)) - { + if (!qs.hasQuestItems(Q_COIN_DIAGRAM)) { qs.giveItems(Q_COIN_DIAGRAM, 1); } qs.setMemoState(1); @@ -292,15 +263,13 @@ public final class Q00336_CoinsOfMagic extends Quest qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); return "30232-05.htm"; } - if (event.contains(".htm")) - { + if (event.contains(".htm")) { return event; } int npcId = npc.getId(); int eventID = Integer.parseInt(event); - switch (npcId) - { + switch (npcId) { case PANO: case COLLOB: case RAPIN: @@ -309,502 +278,378 @@ public final class Q00336_CoinsOfMagic extends Quest case RESEARCHER_LORAIN: case BLACKSMITH_DUNING: case MAGISTER_PAGE: - case HEAD_BLACKSMITH_FERRIS: - { - switch (eventID) - { - case 1: - { + case HEAD_BLACKSMITH_FERRIS: { + switch (eventID) { + case 1: { qs.set(PARAM_2, 11); return npcId + "-02.html"; } - case 2: - { + case 2: { qs.set(PARAM_2, 21); return npcId + "-03.html"; } - case 3: - { + case 3: { qs.set(PARAM_2, 31); return npcId + "-04.html"; } - case 4: - { + case 4: { qs.set(PARAM_2, 42); return npcId + "-05.html"; } - case 5: - { + case 5: { return npcId + "-06.html"; } - case 9: - { + case 9: { return npcId + "-53.html"; } - case 13: - { - if (qs.getInt(FLAG) == 1) - { + case 13: { + if (qs.getInt(FLAG) == 1) { qs.set(FLAG, 16); return npcId + "-14.html"; } break; } - case 14: - { - if (qs.getInt(FLAG) == 1) - { + case 14: { + if (qs.getInt(FLAG) == 1) { qs.set(FLAG, 32); return npcId + "-15.html"; } break; } - case 15: - { - if (qs.getInt(FLAG) == 1) - { + case 15: { + if (qs.getInt(FLAG) == 1) { qs.set(FLAG, 48); return npcId + "-16.html"; } break; } - case 16: - { + case 16: { qs.set(FLAG, qs.getInt(FLAG) + 4); return npcId + "-17.html"; } - case 17: - { + case 17: { qs.set(FLAG, qs.getInt(FLAG) + 8); return npcId + "-18.html"; } - case 18: - { + case 18: { qs.set(FLAG, qs.getInt(FLAG) + 12); return npcId + "-19.html"; } - case 22: - { + case 22: { return npcId + "-01.html"; } } } } - switch (npcId) - { - case PANO: - { - switch (eventID) - { - case 6: - { + switch (npcId) { + case PANO: { + switch (eventID) { + case 6: { return shortFirstSteps(qs, PANO, 1, 4, Q_SILVER_DRYAD, Q_SILVER_UNDINE, 1, Q_GOLD_GIANT, Q_SILVER_DRYAD, Q_BLOOD_BASILISK); } - case 7: - { + case 7: { return shortFirstSteps(qs, PANO, 2, 8, Q_SILVER_DRYAD, Q_SILVER_UNDINE, 1, Q_GOLD_GIANT, Q_SILVER_DRYAD, Q_BLOOD_BASILISK); } - case 8: - { + case 8: { return shortFirstSteps(qs, PANO, 3, 9, Q_SILVER_DRYAD, Q_SILVER_UNDINE, 1, Q_GOLD_GIANT, Q_SILVER_DRYAD, Q_BLOOD_BASILISK); } - case 10: - { + case 10: { return shortSecondStepTwoItems(qs, PANO, 1, Q_SILVER_DRYAD, Q_SILVER_UNDINE, Q_BERETHS_SILVER_DRAGON, Q_GOLD_GIANT, Q_GOLD_WYRM, Q_GOLD_DRAGON, Q_SILVER_DRYAD, Q_SILVER_UNDINE, Q_SILVER_DRAGON, Q_BLOOD_BASILISK, Q_BLOOD_SUCCUBUS, Q_BLOOD_DRAGON); } - case 11: - { + case 11: { return shortSecondStepTwoItems(qs, PANO, 5, Q_SILVER_DRYAD, Q_SILVER_UNDINE, Q_BERETHS_SILVER_DRAGON, Q_GOLD_GIANT, Q_GOLD_WYRM, Q_GOLD_DRAGON, Q_SILVER_DRYAD, Q_SILVER_UNDINE, Q_SILVER_DRAGON, Q_BLOOD_BASILISK, Q_BLOOD_SUCCUBUS, Q_BLOOD_DRAGON); } - case 12: - { + case 12: { return shortSecondStepTwoItems(qs, PANO, 10, Q_SILVER_DRYAD, Q_SILVER_UNDINE, Q_BERETHS_SILVER_DRAGON, Q_GOLD_GIANT, Q_GOLD_WYRM, Q_GOLD_DRAGON, Q_SILVER_DRYAD, Q_SILVER_UNDINE, Q_SILVER_DRAGON, Q_BLOOD_BASILISK, Q_BLOOD_SUCCUBUS, Q_BLOOD_DRAGON); } - case 19: - { + case 19: { return shortThirdStep(qs, PANO, 1, Q_BERETHS_SILVER_DRAGON, Q_GOLD_DRAGON, Q_SILVER_DRAGON, Q_SILVER_DRAGON); } - case 20: - { + case 20: { return shortThirdStep(qs, PANO, 2, Q_BERETHS_SILVER_DRAGON, Q_GOLD_DRAGON, Q_SILVER_DRAGON, Q_SILVER_DRAGON); } - case 21: - { + case 21: { return shortThirdStep(qs, PANO, 3, Q_BERETHS_SILVER_DRAGON, Q_GOLD_DRAGON, Q_SILVER_DRAGON, Q_SILVER_DRAGON); } } break; } - case COLLOB: - { - switch (eventID) - { - case 6: - { + case COLLOB: { + switch (eventID) { + case 6: { return shortFirstSteps(qs, COLLOB, 1, 4, Q_GOLD_WYRM, Q_GOLD_GIANT, 1, Q_GOLD_WYRM, Q_SILVER_UNDINE, Q_BLOOD_SUCCUBUS); } - case 7: - { + case 7: { return shortFirstSteps(qs, COLLOB, 2, 8, Q_GOLD_WYRM, Q_GOLD_GIANT, 1, Q_GOLD_WYRM, Q_SILVER_UNDINE, Q_BLOOD_SUCCUBUS); } - case 8: - { + case 8: { return shortFirstSteps(qs, COLLOB, 3, 9, Q_GOLD_WYRM, Q_GOLD_GIANT, 1, Q_GOLD_WYRM, Q_SILVER_UNDINE, Q_BLOOD_SUCCUBUS); } - case 10: - { + case 10: { return shortSecondStepTwoItems(qs, COLLOB, 1, Q_GOLD_GIANT, Q_GOLD_WYRM, Q_BERETHS_GOLD_DRAGON, Q_GOLD_GIANT, Q_GOLD_WYRM, Q_GOLD_DRAGON, Q_SILVER_DRYAD, Q_SILVER_UNDINE, Q_SILVER_DRAGON, Q_BLOOD_BASILISK, Q_BLOOD_SUCCUBUS, Q_BLOOD_DRAGON); } - case 11: - { + case 11: { return shortSecondStepTwoItems(qs, COLLOB, 5, Q_GOLD_GIANT, Q_GOLD_WYRM, Q_BERETHS_GOLD_DRAGON, Q_GOLD_GIANT, Q_GOLD_WYRM, Q_GOLD_DRAGON, Q_SILVER_DRYAD, Q_SILVER_UNDINE, Q_SILVER_DRAGON, Q_BLOOD_BASILISK, Q_BLOOD_SUCCUBUS, Q_BLOOD_DRAGON); } - case 12: - { + case 12: { return shortSecondStepTwoItems(qs, COLLOB, 10, Q_GOLD_GIANT, Q_GOLD_WYRM, Q_BERETHS_GOLD_DRAGON, Q_GOLD_GIANT, Q_GOLD_WYRM, Q_GOLD_DRAGON, Q_SILVER_DRYAD, Q_SILVER_UNDINE, Q_SILVER_DRAGON, Q_BLOOD_BASILISK, Q_BLOOD_SUCCUBUS, Q_BLOOD_DRAGON); } - case 19: - { + case 19: { return shortThirdStep(qs, COLLOB, 1, Q_BERETHS_GOLD_DRAGON, Q_GOLD_DRAGON, Q_SILVER_DRAGON, Q_BLOOD_DRAGON); } - case 20: - { + case 20: { return shortThirdStep(qs, COLLOB, 2, Q_BERETHS_GOLD_DRAGON, Q_GOLD_DRAGON, Q_SILVER_DRAGON, Q_BLOOD_DRAGON); } - case 21: - { + case 21: { return shortThirdStep(qs, COLLOB, 3, Q_BERETHS_GOLD_DRAGON, Q_GOLD_DRAGON, Q_SILVER_DRAGON, Q_BLOOD_DRAGON); } } break; } - case RAPIN: - { - switch (eventID) - { - case 6: - { + case RAPIN: { + switch (eventID) { + case 6: { return shortFirstSteps(qs, RAPIN, 1, 3, Q_BLOOD_WEREWOLF, Q_BLOOD_DREVANUL, 1, Q_SILVER_GOLEM, Q_SILVER_FAIRY, Q_GOLD_DRAKE); } - case 7: - { + case 7: { return shortFirstSteps(qs, RAPIN, 2, 7, Q_BLOOD_WEREWOLF, Q_BLOOD_DREVANUL, 1, Q_SILVER_GOLEM, Q_SILVER_FAIRY, Q_GOLD_DRAKE); } - case 8: - { + case 8: { return shortFirstSteps(qs, RAPIN, 3, 9, Q_BLOOD_WEREWOLF, Q_BLOOD_DREVANUL, 1, Q_SILVER_GOLEM, Q_SILVER_FAIRY, Q_GOLD_DRAKE); } - case 10: - { + case 10: { return shortSecondStepTwoItems(qs, RAPIN, 1, Q_BLOOD_WEREWOLF, Q_BLOOD_DREVANUL, Q_MANAKS_BLOOD_WEREWOLF, Q_SILVER_GOLEM, Q_SILVER_FAIRY, Q_SILVER_UNDINE, Q_SILVER_GOLEM, Q_SILVER_FAIRY, Q_SILVER_DRYAD, Q_GOLD_DRAKE, Q_GOLD_KNIGHT, Q_GOLD_WYRM); } - case 11: - { + case 11: { return shortSecondStepTwoItems(qs, RAPIN, 5, Q_BLOOD_WEREWOLF, Q_BLOOD_DREVANUL, Q_MANAKS_BLOOD_WEREWOLF, Q_SILVER_GOLEM, Q_SILVER_FAIRY, Q_SILVER_UNDINE, Q_SILVER_GOLEM, Q_SILVER_FAIRY, Q_SILVER_DRYAD, Q_GOLD_DRAKE, Q_GOLD_KNIGHT, Q_GOLD_WYRM); } - case 12: - { + case 12: { return shortSecondStepTwoItems(qs, RAPIN, 10, Q_BLOOD_WEREWOLF, Q_BLOOD_DREVANUL, Q_MANAKS_BLOOD_WEREWOLF, Q_SILVER_GOLEM, Q_SILVER_FAIRY, Q_SILVER_UNDINE, Q_SILVER_GOLEM, Q_SILVER_FAIRY, Q_SILVER_DRYAD, Q_GOLD_DRAKE, Q_GOLD_KNIGHT, Q_GOLD_WYRM); } - case 19: - { + case 19: { return shortThirdStep(qs, RAPIN, 1, Q_MANAKS_BLOOD_WEREWOLF, Q_SILVER_UNDINE, Q_SILVER_DRYAD, Q_GOLD_WYRM); } - case 20: - { + case 20: { return shortThirdStep(qs, RAPIN, 2, Q_MANAKS_BLOOD_WEREWOLF, Q_SILVER_UNDINE, Q_SILVER_DRYAD, Q_GOLD_WYRM); } - case 21: - { + case 21: { return shortThirdStep(qs, RAPIN, 3, Q_MANAKS_BLOOD_WEREWOLF, Q_SILVER_UNDINE, Q_SILVER_DRYAD, Q_GOLD_WYRM); } } break; } - case HAGGER: - { - switch (eventID) - { - case 6: - { + case HAGGER: { + switch (eventID) { + case 6: { return shortFirstSteps(qs, HAGGER, 1, 4, Q_SILVER_UNICORN, 0, 2, Q_BLOOD_MEDUSA, Q_SILVER_UNICORN, Q_GOLD_WYVERN); } - case 7: - { + case 7: { return shortFirstSteps(qs, HAGGER, 2, 8, Q_SILVER_UNICORN, 0, 2, Q_BLOOD_MEDUSA, Q_SILVER_UNICORN, Q_GOLD_WYVERN); } - case 8: - { + case 8: { return shortFirstSteps(qs, HAGGER, 3, 9, Q_SILVER_UNICORN, 0, 2, Q_BLOOD_MEDUSA, Q_SILVER_UNICORN, Q_GOLD_WYVERN); } - case 10: - { + case 10: { return shortSecondStepOneItem(qs, HAGGER, 1, Q_SILVER_UNICORN, 2, Q_NIAS_SILVER_FAIRY, Q_BLOOD_MEDUSA, Q_BLOOD_WEREWOLF, Q_SILVER_UNICORN, Q_SILVER_GOLEM, Q_GOLD_WYVERN, Q_GOLD_DRAKE); } - case 11: - { + case 11: { return shortSecondStepOneItem(qs, HAGGER, 5, Q_SILVER_UNICORN, 2, Q_NIAS_SILVER_FAIRY, Q_BLOOD_MEDUSA, Q_BLOOD_WEREWOLF, Q_SILVER_UNICORN, Q_SILVER_GOLEM, Q_GOLD_WYVERN, Q_GOLD_DRAKE); } - case 12: - { + case 12: { return shortSecondStepOneItem(qs, HAGGER, 10, Q_SILVER_UNICORN, 2, Q_NIAS_SILVER_FAIRY, Q_BLOOD_MEDUSA, Q_BLOOD_WEREWOLF, Q_SILVER_UNICORN, Q_SILVER_GOLEM, Q_GOLD_WYVERN, Q_GOLD_DRAKE); } - case 19: - { + case 19: { return shortThirdStep(qs, HAGGER, 1, Q_NIAS_SILVER_FAIRY, Q_BLOOD_WEREWOLF, Q_SILVER_GOLEM, Q_GOLD_DRAKE); } - case 20: - { + case 20: { return shortThirdStep(qs, HAGGER, 2, Q_NIAS_SILVER_FAIRY, Q_BLOOD_WEREWOLF, Q_SILVER_GOLEM, Q_GOLD_DRAKE); } - case 21: - { + case 21: { return shortThirdStep(qs, HAGGER, 3, Q_NIAS_SILVER_FAIRY, Q_BLOOD_WEREWOLF, Q_SILVER_GOLEM, Q_GOLD_DRAKE); } } break; } - case STAN: - { - switch (eventID) - { - case 6: - { + case STAN: { + switch (eventID) { + case 6: { return shortFirstSteps(qs, STAN, 1, 3, Q_SILVER_FAIRY, Q_SILVER_GOLEM, 1, Q_SILVER_FAIRY, Q_BLOOD_WEREWOLF, Q_GOLD_KNIGHT); } - case 7: - { + case 7: { return shortFirstSteps(qs, STAN, 2, 7, Q_SILVER_FAIRY, Q_SILVER_GOLEM, 1, Q_SILVER_FAIRY, Q_BLOOD_WEREWOLF, Q_GOLD_KNIGHT); } - case 8: - { + case 8: { return shortFirstSteps(qs, STAN, 3, 9, Q_SILVER_FAIRY, Q_SILVER_GOLEM, 1, Q_SILVER_FAIRY, Q_BLOOD_WEREWOLF, Q_GOLD_KNIGHT); } - case 10: - { + case 10: { return shortSecondStepTwoItems(qs, STAN, 1, Q_SILVER_FAIRY, Q_SILVER_GOLEM, Q_MANAKS_SILVER_DRYAD, Q_SILVER_FAIRY, Q_SILVER_GOLEM, Q_SILVER_DRYAD, Q_BLOOD_WEREWOLF, Q_BLOOD_DREVANUL, Q_BLOOD_BASILISK, Q_GOLD_KNIGHT, Q_GOLD_DRAKE, Q_GOLD_GIANT); } - case 11: - { + case 11: { return shortSecondStepTwoItems(qs, STAN, 5, Q_SILVER_FAIRY, Q_SILVER_GOLEM, Q_MANAKS_SILVER_DRYAD, Q_SILVER_FAIRY, Q_SILVER_GOLEM, Q_SILVER_DRYAD, Q_BLOOD_WEREWOLF, Q_BLOOD_DREVANUL, Q_BLOOD_BASILISK, Q_GOLD_KNIGHT, Q_GOLD_DRAKE, Q_GOLD_GIANT); } - case 12: - { + case 12: { return shortSecondStepTwoItems(qs, STAN, 10, Q_SILVER_FAIRY, Q_SILVER_GOLEM, Q_MANAKS_SILVER_DRYAD, Q_SILVER_FAIRY, Q_SILVER_GOLEM, Q_SILVER_DRYAD, Q_BLOOD_WEREWOLF, Q_BLOOD_DREVANUL, Q_BLOOD_BASILISK, Q_GOLD_KNIGHT, Q_GOLD_DRAKE, Q_GOLD_GIANT); } - case 19: - { + case 19: { return shortThirdStep(qs, STAN, 1, Q_MANAKS_SILVER_DRYAD, Q_SILVER_DRYAD, Q_BLOOD_BASILISK, Q_GOLD_GIANT); } - case 20: - { + case 20: { return shortThirdStep(qs, STAN, 2, Q_MANAKS_SILVER_DRYAD, Q_SILVER_DRYAD, Q_BLOOD_BASILISK, Q_GOLD_GIANT); } - case 21: - { + case 21: { return shortThirdStep(qs, STAN, 3, Q_MANAKS_SILVER_DRYAD, Q_SILVER_DRYAD, Q_BLOOD_BASILISK, Q_GOLD_GIANT); } } break; } - case RESEARCHER_LORAIN: - { - switch (eventID) - { - case 6: - { + case RESEARCHER_LORAIN: { + switch (eventID) { + case 6: { return shortFirstSteps(qs, RESEARCHER_LORAIN, 1, 4, Q_GOLD_WYVERN, 0, 2, Q_BLOOD_MEDUSA, Q_SILVER_UNICORN, Q_GOLD_WYVERN); } - case 7: - { + case 7: { return shortFirstSteps(qs, RESEARCHER_LORAIN, 2, 8, Q_GOLD_WYVERN, 0, 2, Q_BLOOD_MEDUSA, Q_SILVER_UNICORN, Q_GOLD_WYVERN); } - case 8: - { + case 8: { return shortFirstSteps(qs, RESEARCHER_LORAIN, 3, 9, Q_GOLD_WYVERN, 0, 2, Q_BLOOD_MEDUSA, Q_SILVER_UNICORN, Q_GOLD_WYVERN); } - case 10: - { + case 10: { return shortSecondStepOneItem(qs, RESEARCHER_LORAIN, 1, Q_GOLD_WYVERN, 2, Q_NIAS_GOLD_WYVERN, Q_BLOOD_MEDUSA, Q_BLOOD_DREVANUL, Q_SILVER_UNICORN, Q_SILVER_GOLEM, Q_GOLD_WYVERN, Q_GOLD_KNIGHT); } - case 11: - { + case 11: { return shortSecondStepOneItem(qs, RESEARCHER_LORAIN, 5, Q_GOLD_WYVERN, 2, Q_NIAS_GOLD_WYVERN, Q_BLOOD_MEDUSA, Q_BLOOD_DREVANUL, Q_SILVER_UNICORN, Q_SILVER_GOLEM, Q_GOLD_WYVERN, Q_GOLD_KNIGHT); } - case 12: - { + case 12: { return shortSecondStepOneItem(qs, RESEARCHER_LORAIN, 10, Q_GOLD_WYVERN, 2, Q_NIAS_GOLD_WYVERN, Q_BLOOD_MEDUSA, Q_BLOOD_DREVANUL, Q_SILVER_UNICORN, Q_SILVER_GOLEM, Q_GOLD_WYVERN, Q_GOLD_KNIGHT); } - case 19: - { + case 19: { return shortThirdStep(qs, RESEARCHER_LORAIN, 1, Q_NIAS_GOLD_WYVERN, Q_BLOOD_DREVANUL, Q_SILVER_GOLEM, Q_GOLD_KNIGHT); } - case 20: - { + case 20: { return shortThirdStep(qs, RESEARCHER_LORAIN, 2, Q_NIAS_GOLD_WYVERN, Q_BLOOD_DREVANUL, Q_SILVER_GOLEM, Q_GOLD_KNIGHT); } - case 21: - { + case 21: { return shortThirdStep(qs, RESEARCHER_LORAIN, 3, Q_NIAS_GOLD_WYVERN, Q_BLOOD_DREVANUL, Q_SILVER_GOLEM, Q_GOLD_KNIGHT); } } break; } - case BLACKSMITH_DUNING: - { - switch (eventID) - { - case 6: - { + case BLACKSMITH_DUNING: { + switch (eventID) { + case 6: { return shortFirstSteps(qs, BLACKSMITH_DUNING, 1, 3, Q_GOLD_DRAKE, Q_GOLD_KNIGHT, 1, Q_SILVER_GOLEM, Q_BLOOD_DREVANUL, Q_GOLD_DRAKE); } - case 7: - { + case 7: { return shortFirstSteps(qs, BLACKSMITH_DUNING, 2, 7, Q_GOLD_DRAKE, Q_GOLD_KNIGHT, 1, Q_SILVER_GOLEM, Q_BLOOD_DREVANUL, Q_GOLD_DRAKE); } - case 8: - { + case 8: { return shortFirstSteps(qs, BLACKSMITH_DUNING, 3, 9, Q_GOLD_DRAKE, Q_GOLD_KNIGHT, 1, Q_SILVER_GOLEM, Q_BLOOD_DREVANUL, Q_GOLD_DRAKE); } - case 10: - { + case 10: { return shortSecondStepTwoItems(qs, BLACKSMITH_DUNING, 1, Q_GOLD_KNIGHT, Q_GOLD_DRAKE, Q_MANAKS_GOLD_GIANT, Q_SILVER_GOLEM, Q_SILVER_FAIRY, Q_SILVER_UNDINE, Q_BLOOD_DREVANUL, Q_BLOOD_WEREWOLF, Q_BLOOD_SUCCUBUS, Q_GOLD_DRAKE, Q_GOLD_KNIGHT, Q_GOLD_GIANT); } - case 11: - { + case 11: { return shortSecondStepTwoItems(qs, BLACKSMITH_DUNING, 5, Q_GOLD_KNIGHT, Q_GOLD_DRAKE, Q_MANAKS_GOLD_GIANT, Q_SILVER_GOLEM, Q_SILVER_FAIRY, Q_SILVER_UNDINE, Q_BLOOD_DREVANUL, Q_BLOOD_WEREWOLF, Q_BLOOD_SUCCUBUS, Q_GOLD_DRAKE, Q_GOLD_KNIGHT, Q_GOLD_GIANT); } - case 12: - { + case 12: { return shortSecondStepTwoItems(qs, BLACKSMITH_DUNING, 10, Q_GOLD_KNIGHT, Q_GOLD_DRAKE, Q_MANAKS_GOLD_GIANT, Q_SILVER_GOLEM, Q_SILVER_FAIRY, Q_SILVER_UNDINE, Q_BLOOD_DREVANUL, Q_BLOOD_WEREWOLF, Q_BLOOD_SUCCUBUS, Q_GOLD_DRAKE, Q_GOLD_KNIGHT, Q_GOLD_GIANT); } - case 19: - { + case 19: { return shortThirdStep(qs, BLACKSMITH_DUNING, 1, Q_MANAKS_GOLD_GIANT, Q_SILVER_UNDINE, Q_BLOOD_SUCCUBUS, Q_GOLD_GIANT); } - case 20: - { + case 20: { return shortThirdStep(qs, BLACKSMITH_DUNING, 2, Q_MANAKS_GOLD_GIANT, Q_SILVER_UNDINE, Q_BLOOD_SUCCUBUS, Q_GOLD_GIANT); } - case 21: - { + case 21: { return shortThirdStep(qs, BLACKSMITH_DUNING, 3, Q_MANAKS_GOLD_GIANT, Q_SILVER_UNDINE, Q_BLOOD_SUCCUBUS, Q_GOLD_GIANT); } } break; } - case MAGISTER_PAGE: - { - switch (eventID) - { - case 6: - { + case MAGISTER_PAGE: { + switch (eventID) { + case 6: { return shortFirstSteps(qs, MAGISTER_PAGE, 1, 4, Q_BLOOD_MEDUSA, 0, 2, Q_BLOOD_MEDUSA, Q_SILVER_UNICORN, Q_GOLD_WYVERN); } - case 7: - { + case 7: { return shortFirstSteps(qs, MAGISTER_PAGE, 2, 8, Q_BLOOD_MEDUSA, 0, 2, Q_BLOOD_MEDUSA, Q_SILVER_UNICORN, Q_GOLD_WYVERN); } - case 8: - { + case 8: { return shortFirstSteps(qs, MAGISTER_PAGE, 3, 9, Q_BLOOD_MEDUSA, 0, 2, Q_BLOOD_MEDUSA, Q_SILVER_UNICORN, Q_GOLD_WYVERN); } - case 10: - { + case 10: { return shortSecondStepOneItem(qs, MAGISTER_PAGE, 1, Q_BLOOD_MEDUSA, 2, Q_NIAS_BLOOD_MEDUSA, Q_BLOOD_MEDUSA, Q_BLOOD_WEREWOLF, Q_SILVER_UNICORN, Q_SILVER_FAIRY, Q_GOLD_WYVERN, Q_GOLD_KNIGHT); } - case 11: - { + case 11: { return shortSecondStepOneItem(qs, MAGISTER_PAGE, 5, Q_BLOOD_MEDUSA, 2, Q_NIAS_BLOOD_MEDUSA, Q_BLOOD_MEDUSA, Q_BLOOD_WEREWOLF, Q_SILVER_UNICORN, Q_SILVER_FAIRY, Q_GOLD_WYVERN, Q_GOLD_KNIGHT); } - case 12: - { + case 12: { return shortSecondStepOneItem(qs, MAGISTER_PAGE, 10, Q_BLOOD_MEDUSA, 2, Q_NIAS_BLOOD_MEDUSA, Q_BLOOD_MEDUSA, Q_BLOOD_WEREWOLF, Q_SILVER_UNICORN, Q_SILVER_FAIRY, Q_GOLD_WYVERN, Q_GOLD_KNIGHT); } - case 19: - { + case 19: { return shortThirdStep(qs, MAGISTER_PAGE, 1, Q_NIAS_BLOOD_MEDUSA, Q_BLOOD_WEREWOLF, Q_SILVER_FAIRY, Q_GOLD_KNIGHT); } - case 20: - { + case 20: { return shortThirdStep(qs, MAGISTER_PAGE, 2, Q_NIAS_BLOOD_MEDUSA, Q_BLOOD_WEREWOLF, Q_SILVER_FAIRY, Q_GOLD_KNIGHT); } - case 21: - { + case 21: { return shortThirdStep(qs, MAGISTER_PAGE, 3, Q_NIAS_BLOOD_MEDUSA, Q_BLOOD_WEREWOLF, Q_SILVER_FAIRY, Q_GOLD_KNIGHT); } } break; } - case HEAD_BLACKSMITH_FERRIS: - { - switch (Integer.parseInt(event)) - { - case 6: - { + case HEAD_BLACKSMITH_FERRIS: { + switch (Integer.parseInt(event)) { + case 6: { return shortFirstSteps(qs, HEAD_BLACKSMITH_FERRIS, 1, 4, Q_BLOOD_BASILISK, Q_BLOOD_SUCCUBUS, 1, Q_GOLD_GIANT, Q_SILVER_DRYAD, Q_BLOOD_BASILISK); } - case 7: - { + case 7: { return shortFirstSteps(qs, HEAD_BLACKSMITH_FERRIS, 2, 8, Q_BLOOD_BASILISK, Q_BLOOD_SUCCUBUS, 1, Q_GOLD_GIANT, Q_SILVER_DRYAD, Q_BLOOD_BASILISK); } - case 8: - { + case 8: { return shortFirstSteps(qs, HEAD_BLACKSMITH_FERRIS, 3, 9, Q_BLOOD_BASILISK, Q_BLOOD_SUCCUBUS, 1, Q_GOLD_GIANT, Q_SILVER_DRYAD, Q_BLOOD_BASILISK); } - case 10: - { + case 10: { return shortSecondStepTwoItems(qs, HEAD_BLACKSMITH_FERRIS, 1, Q_BLOOD_BASILISK, Q_BLOOD_SUCCUBUS, Q_BERETHS_BLOOD_DRAGON, Q_GOLD_GIANT, Q_GOLD_WYRM, Q_GOLD_DRAGON, Q_SILVER_DRYAD, Q_SILVER_UNDINE, Q_SILVER_DRAGON, Q_BLOOD_BASILISK, Q_BLOOD_SUCCUBUS, Q_BLOOD_DRAGON); } - case 11: - { + case 11: { return shortSecondStepTwoItems(qs, HEAD_BLACKSMITH_FERRIS, 5, Q_BLOOD_BASILISK, Q_BLOOD_SUCCUBUS, Q_BERETHS_BLOOD_DRAGON, Q_GOLD_GIANT, Q_GOLD_WYRM, Q_GOLD_DRAGON, Q_SILVER_DRYAD, Q_SILVER_UNDINE, Q_SILVER_DRAGON, Q_BLOOD_BASILISK, Q_BLOOD_SUCCUBUS, Q_BLOOD_DRAGON); } - case 12: - { + case 12: { return shortSecondStepTwoItems(qs, HEAD_BLACKSMITH_FERRIS, 10, Q_BLOOD_BASILISK, Q_BLOOD_SUCCUBUS, Q_BERETHS_BLOOD_DRAGON, Q_GOLD_GIANT, Q_GOLD_WYRM, Q_GOLD_DRAGON, Q_SILVER_DRYAD, Q_SILVER_UNDINE, Q_SILVER_DRAGON, Q_BLOOD_BASILISK, Q_BLOOD_SUCCUBUS, Q_BLOOD_DRAGON); } - case 19: - { + case 19: { return shortThirdStep(qs, HEAD_BLACKSMITH_FERRIS, 1, Q_BERETHS_BLOOD_DRAGON, Q_GOLD_DRAGON, Q_SILVER_DRAGON, Q_BLOOD_DRAGON); } - case 20: - { + case 20: { return shortThirdStep(qs, HEAD_BLACKSMITH_FERRIS, 2, Q_BERETHS_BLOOD_DRAGON, Q_GOLD_DRAGON, Q_SILVER_DRAGON, Q_BLOOD_DRAGON); } - case 21: - { + case 21: { return shortThirdStep(qs, HEAD_BLACKSMITH_FERRIS, 3, Q_BERETHS_BLOOD_DRAGON, Q_GOLD_DRAGON, Q_SILVER_DRAGON, Q_BLOOD_DRAGON); } } break; } - case UNION_PRESIDENT_BERNARD: - { - switch (eventID) - { - case 1: - { + case UNION_PRESIDENT_BERNARD: { + switch (eventID) { + case 1: { return "30702-02.html"; } - case 2: - { + case 2: { qs.setMemoState(2); qs.setCond(2); qs.showQuestionMark(336); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); return "30702-03.html"; } - case 3: - { + case 3: { qs.setMemoState(2); qs.setCond(2); qs.showQuestionMark(336); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); return "30702-04.html"; } - case 4: - { + case 4: { qs.setCond(7); qs.showQuestionMark(336); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); @@ -813,32 +658,23 @@ public final class Q00336_CoinsOfMagic extends Quest } break; } - case WAREHOUSE_KEEPER_SORINT: - { - switch (eventID) - { - case 1: - { + case WAREHOUSE_KEEPER_SORINT: { + switch (eventID) { + case 1: { return "30232-03.html"; } - case 2: - { + case 2: { return "30232-04.html"; } - case 3: - { + case 3: { return "30232-08.html"; } - case 4: - { + case 4: { return "30232-09.html"; } - case 5: - { - if (qs.hasQuestItems(Q_CC_MEMBERSHIP_3)) - { - if (qs.hasQuestItems(Q_BLOOD_DREVANUL, Q_BLOOD_WEREWOLF, Q_GOLD_KNIGHT, Q_GOLD_DRAKE, Q_SILVER_FAIRY, Q_SILVER_GOLEM)) - { + case 5: { + if (qs.hasQuestItems(Q_CC_MEMBERSHIP_3)) { + if (qs.hasQuestItems(Q_BLOOD_DREVANUL, Q_BLOOD_WEREWOLF, Q_GOLD_KNIGHT, Q_GOLD_DRAKE, Q_SILVER_FAIRY, Q_SILVER_GOLEM)) { qs.setCond(9); qs.showQuestionMark(336); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); @@ -857,10 +693,8 @@ public final class Q00336_CoinsOfMagic extends Quest qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); return "30232-13.html"; } - if (qs.hasQuestItems(Q_CC_MEMBERSHIP_2)) - { - if (qs.hasQuestItems(Q_BLOOD_BASILISK, Q_BLOOD_SUCCUBUS, Q_GOLD_GIANT, Q_GOLD_WYRM, Q_SILVER_UNDINE, Q_SILVER_DRYAD)) - { + if (qs.hasQuestItems(Q_CC_MEMBERSHIP_2)) { + if (qs.hasQuestItems(Q_BLOOD_BASILISK, Q_BLOOD_SUCCUBUS, Q_GOLD_GIANT, Q_GOLD_WYRM, Q_SILVER_UNDINE, Q_SILVER_DRYAD)) { qs.setCond(11); qs.showQuestionMark(336); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); @@ -879,46 +713,37 @@ public final class Q00336_CoinsOfMagic extends Quest qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); return "30232-14.html"; } - if (qs.hasQuestItems(Q_CC_MEMBERSHIP_1)) - { + if (qs.hasQuestItems(Q_CC_MEMBERSHIP_1)) { return "30232-15.html"; } break; } - case 6: - { + case 6: { return "30232-18.html"; } - case 7: - { + case 7: { return "30232-19.html"; } - case 8: - { + case 8: { return "30232-20.html"; } - case 9: - { + case 9: { return "30232-21.html"; } - case 10: - { + case 10: { qs.setCond(6); qs.showQuestionMark(336); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); return "30232-22.html"; } - case 11: - { + case 11: { qs.setCond(5); qs.showQuestionMark(336); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); return "30232-23.html"; } - case 20: - { - if (qs.hasQuestItems(Q_BERETHS_BLOOD_DRAGON) && qs.hasQuestItems(Q_SILVER_DRAGON) && (qs.getQuestItemsCount(Q_GOLD_WYRM) >= 13)) - { + case 20: { + if (qs.hasQuestItems(Q_BERETHS_BLOOD_DRAGON) && qs.hasQuestItems(Q_SILVER_DRAGON) && (qs.getQuestItemsCount(Q_GOLD_WYRM) >= 13)) { qs.takeItems(Q_BERETHS_BLOOD_DRAGON, 1); qs.takeItems(Q_SILVER_DRAGON, 1); qs.takeItems(Q_GOLD_WYRM, 13); @@ -928,10 +753,8 @@ public final class Q00336_CoinsOfMagic extends Quest } return "30232-24.html"; } - case 21: - { - if (qs.hasQuestItems(Q_BERETHS_GOLD_DRAGON) && qs.hasQuestItems(Q_BLOOD_DRAGON) && qs.hasQuestItems(Q_SILVER_DRYAD) && qs.hasQuestItems(Q_GOLD_GIANT)) - { + case 21: { + if (qs.hasQuestItems(Q_BERETHS_GOLD_DRAGON) && qs.hasQuestItems(Q_BLOOD_DRAGON) && qs.hasQuestItems(Q_SILVER_DRYAD) && qs.hasQuestItems(Q_GOLD_GIANT)) { qs.takeItems(Q_BERETHS_GOLD_DRAGON, 1); qs.takeItems(Q_BLOOD_DRAGON, 1); qs.takeItems(Q_SILVER_DRYAD, 1); @@ -942,10 +765,8 @@ public final class Q00336_CoinsOfMagic extends Quest } return "30232-24.html"; } - case 22: - { - if (qs.hasQuestItems(Q_BERETHS_SILVER_DRAGON) && qs.hasQuestItems(Q_GOLD_DRAGON) && qs.hasQuestItems(Q_BLOOD_SUCCUBUS) && (qs.getQuestItemsCount(Q_BLOOD_BASILISK) >= 2)) - { + case 22: { + if (qs.hasQuestItems(Q_BERETHS_SILVER_DRAGON) && qs.hasQuestItems(Q_GOLD_DRAGON) && qs.hasQuestItems(Q_BLOOD_SUCCUBUS) && (qs.getQuestItemsCount(Q_BLOOD_BASILISK) >= 2)) { qs.takeItems(Q_BERETHS_SILVER_DRAGON, 1); qs.takeItems(Q_GOLD_DRAGON, 1); qs.takeItems(Q_BLOOD_SUCCUBUS, 1); @@ -956,10 +777,8 @@ public final class Q00336_CoinsOfMagic extends Quest } return "30232-24.html"; } - case 23: - { - if (qs.hasQuestItems(Q_GOLD_DRAGON) && qs.hasQuestItems(Q_SILVER_DRAGON) && qs.hasQuestItems(Q_BLOOD_DRAGON) && qs.hasQuestItems(Q_SILVER_UNDINE)) - { + case 23: { + if (qs.hasQuestItems(Q_GOLD_DRAGON) && qs.hasQuestItems(Q_SILVER_DRAGON) && qs.hasQuestItems(Q_BLOOD_DRAGON) && qs.hasQuestItems(Q_SILVER_UNDINE)) { qs.takeItems(Q_GOLD_DRAGON, 1); qs.takeItems(Q_SILVER_DRAGON, 1); qs.takeItems(Q_BLOOD_DRAGON, 1); @@ -970,10 +789,8 @@ public final class Q00336_CoinsOfMagic extends Quest } return "30232-24.html"; } - case 24: - { - if (qs.hasQuestItems(Q_MANAKS_GOLD_GIANT)) - { + case 24: { + if (qs.hasQuestItems(Q_MANAKS_GOLD_GIANT)) { qs.takeItems(Q_MANAKS_GOLD_GIANT, 1); qs.giveItems(DEMONS_BOOTS, 1); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); @@ -981,10 +798,8 @@ public final class Q00336_CoinsOfMagic extends Quest } return "30232-24.html"; } - case 25: - { - if (qs.hasQuestItems(Q_MANAKS_SILVER_DRYAD) && qs.hasQuestItems(Q_SILVER_DRYAD)) - { + case 25: { + if (qs.hasQuestItems(Q_MANAKS_SILVER_DRYAD) && qs.hasQuestItems(Q_SILVER_DRYAD)) { qs.takeItems(Q_MANAKS_SILVER_DRYAD, 1); qs.takeItems(Q_SILVER_DRYAD, 1); qs.giveItems(DEMONS_HOSE, 1); @@ -993,10 +808,8 @@ public final class Q00336_CoinsOfMagic extends Quest } return "30232-24.html"; } - case 26: - { - if (qs.hasQuestItems(Q_MANAKS_GOLD_GIANT)) - { + case 26: { + if (qs.hasQuestItems(Q_MANAKS_GOLD_GIANT)) { qs.takeItems(Q_MANAKS_GOLD_GIANT, 1); qs.giveItems(DEMONS_GLOVES, 1); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); @@ -1004,10 +817,8 @@ public final class Q00336_CoinsOfMagic extends Quest } return "30232-24.html"; } - case 27: - { - if (qs.hasQuestItems(Q_MANAKS_BLOOD_WEREWOLF) && qs.hasQuestItems(Q_GOLD_GIANT) && qs.hasQuestItems(Q_GOLD_WYRM)) - { + case 27: { + if (qs.hasQuestItems(Q_MANAKS_BLOOD_WEREWOLF) && qs.hasQuestItems(Q_GOLD_GIANT) && qs.hasQuestItems(Q_GOLD_WYRM)) { qs.takeItems(Q_MANAKS_BLOOD_WEREWOLF, 1); qs.takeItems(Q_GOLD_GIANT, 1); qs.takeItems(Q_GOLD_WYRM, 1); @@ -1017,10 +828,8 @@ public final class Q00336_CoinsOfMagic extends Quest } return "30232-24.html"; } - case 28: - { - if ((qs.getQuestItemsCount(Q_NIAS_BLOOD_MEDUSA) >= 2) && (qs.getQuestItemsCount(Q_GOLD_DRAKE) >= 2) && (qs.getQuestItemsCount(Q_BLOOD_DREVANUL) >= 2) && (qs.getQuestItemsCount(Q_GOLD_KNIGHT) >= 3)) - { + case 28: { + if ((qs.getQuestItemsCount(Q_NIAS_BLOOD_MEDUSA) >= 2) && (qs.getQuestItemsCount(Q_GOLD_DRAKE) >= 2) && (qs.getQuestItemsCount(Q_BLOOD_DREVANUL) >= 2) && (qs.getQuestItemsCount(Q_GOLD_KNIGHT) >= 3)) { qs.takeItems(Q_NIAS_BLOOD_MEDUSA, 2); qs.takeItems(Q_GOLD_DRAKE, 2); qs.takeItems(Q_BLOOD_DREVANUL, 2); @@ -1031,10 +840,8 @@ public final class Q00336_CoinsOfMagic extends Quest } return "30232-24.html"; } - case 29: - { - if ((qs.getQuestItemsCount(Q_NIAS_BLOOD_MEDUSA) >= 7) && (qs.getQuestItemsCount(Q_GOLD_KNIGHT) >= 5) && (qs.getQuestItemsCount(Q_BLOOD_DREVANUL) >= 5) && (qs.getQuestItemsCount(Q_SILVER_GOLEM) >= 5)) - { + case 29: { + if ((qs.getQuestItemsCount(Q_NIAS_BLOOD_MEDUSA) >= 7) && (qs.getQuestItemsCount(Q_GOLD_KNIGHT) >= 5) && (qs.getQuestItemsCount(Q_BLOOD_DREVANUL) >= 5) && (qs.getQuestItemsCount(Q_SILVER_GOLEM) >= 5)) { qs.takeItems(Q_NIAS_BLOOD_MEDUSA, 7); qs.takeItems(Q_GOLD_KNIGHT, 5); qs.takeItems(Q_BLOOD_DREVANUL, 5); @@ -1045,10 +852,8 @@ public final class Q00336_CoinsOfMagic extends Quest } return "30232-24.html"; } - case 30: - { - if ((qs.getQuestItemsCount(Q_NIAS_GOLD_WYVERN) >= 5) && (qs.getQuestItemsCount(Q_SILVER_GOLEM) >= 4) && (qs.getQuestItemsCount(Q_GOLD_DRAKE) >= 4) && (qs.getQuestItemsCount(Q_BLOOD_DREVANUL) >= 4)) - { + case 30: { + if ((qs.getQuestItemsCount(Q_NIAS_GOLD_WYVERN) >= 5) && (qs.getQuestItemsCount(Q_SILVER_GOLEM) >= 4) && (qs.getQuestItemsCount(Q_GOLD_DRAKE) >= 4) && (qs.getQuestItemsCount(Q_BLOOD_DREVANUL) >= 4)) { qs.takeItems(Q_NIAS_GOLD_WYVERN, 5); qs.takeItems(Q_SILVER_GOLEM, 4); qs.takeItems(Q_GOLD_DRAKE, 4); @@ -1059,10 +864,8 @@ public final class Q00336_CoinsOfMagic extends Quest } return "30232-24.html"; } - case 31: - { - if ((qs.getQuestItemsCount(Q_NIAS_SILVER_FAIRY) >= 5) && (qs.getQuestItemsCount(Q_SILVER_FAIRY) >= 3) && (qs.getQuestItemsCount(Q_GOLD_KNIGHT) >= 3) && (qs.getQuestItemsCount(Q_BLOOD_DREVANUL) >= 3)) - { + case 31: { + if ((qs.getQuestItemsCount(Q_NIAS_SILVER_FAIRY) >= 5) && (qs.getQuestItemsCount(Q_SILVER_FAIRY) >= 3) && (qs.getQuestItemsCount(Q_GOLD_KNIGHT) >= 3) && (qs.getQuestItemsCount(Q_BLOOD_DREVANUL) >= 3)) { qs.takeItems(Q_NIAS_SILVER_FAIRY, 5); qs.takeItems(Q_SILVER_FAIRY, 3); qs.takeItems(Q_GOLD_KNIGHT, 3); @@ -1073,8 +876,7 @@ public final class Q00336_CoinsOfMagic extends Quest } return "30232-24.html"; } - case 100: - { + case 100: { qs.takeItems(Q_CC_MEMBERSHIP_1, -1); qs.takeItems(Q_CC_MEMBERSHIP_2, -1); qs.takeItems(Q_CC_MEMBERSHIP_3, -1); @@ -1090,19 +892,14 @@ public final class Q00336_CoinsOfMagic extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { - switch (npc.getId()) - { + switch (npc.getId()) { case HARIT_LIZARDMAN_SHAMAN: - case HARIT_LIZARDM_MATRIARCH: - { + case HARIT_LIZARDM_MATRIARCH: { QuestState qs = getRandomPlayerFromPartyCoin(killer, npc, 2); - if (qs != null) - { - if (getRandom(1000) < 63) - { + if (qs != null) { + if (getRandom(1000) < 63) { giveItemRandomly(qs.getPlayer(), npc, Q_KALDIS_GOLD_DRAGON, 1, 0, 1, true); qs.setCond(3); qs.showQuestionMark(336); @@ -1112,32 +909,24 @@ public final class Q00336_CoinsOfMagic extends Quest } } final QuestState qs = getRandomPlayerFromParty(killer, npc, 3); - if (qs != null) - { - switch (npc.getId()) - { + if (qs != null) { + switch (npc.getId()) { case SHACKLE: - case SHACKLE_HOLD: - { - if (getRandom(1000) < 70) - { + case SHACKLE_HOLD: { + if (getRandom(1000) < 70) { giveItemRandomly(qs.getPlayer(), npc, Q_GOLD_WYVERN, 1, 0, 1, true); } break; } case HEADLESS_KNIGHT: - case TIMAK_ORC: - { - if (getRandom(1000) < 80) - { + case TIMAK_ORC: { + if (getRandom(1000) < 80) { giveItemRandomly(qs.getPlayer(), npc, Q_GOLD_WYVERN, 1, 0, 1, true); } break; } - case HEADLESS_KNIGHT_HOLD: - { - if (getRandom(1000) < 85) - { + case HEADLESS_KNIGHT_HOLD: { + if (getRandom(1000) < 85) { giveItemRandomly(qs.getPlayer(), npc, Q_GOLD_WYVERN, 1, 0, 1, true); } break; @@ -1149,10 +938,8 @@ public final class Q00336_CoinsOfMagic extends Quest case ANTELOPE: case ANTELOPE_A: case ANTELOPE_B: - case H_MALRUK_SUCCUBUS_TUREN: - { - if (getRandom(1000) < 100) - { + case H_MALRUK_SUCCUBUS_TUREN: { + if (getRandom(1000) < 100) { giveItemRandomly(qs.getPlayer(), npc, Q_GOLD_WYVERN, 1, 0, 1, true); } break; @@ -1161,170 +948,130 @@ public final class Q00336_CoinsOfMagic extends Quest case BUFFALO_A: case BUFFALO_B: case KUKABURO: - case KUKABURO_A: - { - if (getRandom(1000) < 110) - { + case KUKABURO_A: { + if (getRandom(1000) < 110) { giveItemRandomly(qs.getPlayer(), npc, Q_GOLD_WYVERN, 1, 0, 1, true); } break; } - case DOOM_SERVANT: - { - if (getRandom(1000) < 140) - { + case DOOM_SERVANT: { + if (getRandom(1000) < 140) { giveItemRandomly(qs.getPlayer(), npc, Q_GOLD_WYVERN, 1, 0, 1, true); } break; } - case DOOM_KNIGHT: - { - if (getRandom(1000) < 210) - { + case DOOM_KNIGHT: { + if (getRandom(1000) < 210) { giveItemRandomly(qs.getPlayer(), npc, Q_GOLD_WYVERN, 1, 0, 1, true); } break; } - case VANOR_SILENOS_SHAMAN: - { - if (getRandom(1000) < 70) - { + case VANOR_SILENOS_SHAMAN: { + if (getRandom(1000) < 70) { giveItemRandomly(qs.getPlayer(), npc, Q_SILVER_UNICORN, 1, 0, 1, true); } break; } case BLOODY_GHOST: case TARLK_BUGBEAR_BOSS: - case OEL_MAHUM: - { - if (getRandom(1000) < 80) - { + case OEL_MAHUM: { + if (getRandom(1000) < 80) { giveItemRandomly(qs.getPlayer(), npc, Q_SILVER_UNICORN, 1, 0, 1, true); } break; } - case OEL_MAHUM_WARRIOR: - { - if (getRandom(1000) < 90) - { + case OEL_MAHUM_WARRIOR: { + if (getRandom(1000) < 90) { giveItemRandomly(qs.getPlayer(), npc, Q_SILVER_UNICORN, 1, 0, 1, true); } break; } - case HUNGRY_CORPSE: - { - if (getRandom(1000) < 100) - { + case HUNGRY_CORPSE: { + if (getRandom(1000) < 100) { giveItemRandomly(qs.getPlayer(), npc, Q_SILVER_UNICORN, 1, 0, 1, true); } break; } - case BYFOOT: - { - if (getRandom(1000) < 110) - { + case BYFOOT: { + if (getRandom(1000) < 110) { giveItemRandomly(qs.getPlayer(), npc, Q_SILVER_UNICORN, 1, 0, 1, true); } break; } - case BYFOOT_SIGEL: - { - if (getRandom(1000) < 120) - { + case BYFOOT_SIGEL: { + if (getRandom(1000) < 120) { giveItemRandomly(qs.getPlayer(), npc, Q_SILVER_UNICORN, 1, 0, 1, true); } break; } case DARK_GUARD: case BRILLIANT_CLAW: - case BRILLIANT_CLAW_1: - { - if (getRandom(1000) < 150) - { + case BRILLIANT_CLAW_1: { + if (getRandom(1000) < 150) { giveItemRandomly(qs.getPlayer(), npc, Q_SILVER_UNICORN, 1, 0, 1, true); } break; } - case OEL_MAHUM_WITCH_DOCTOR: - { - if (getRandom(1000) < 200) - { + case OEL_MAHUM_WITCH_DOCTOR: { + if (getRandom(1000) < 200) { giveItemRandomly(qs.getPlayer(), npc, Q_SILVER_UNICORN, 1, 0, 1, true); } break; } case BRILLIANT_ANGUISH: - case BRILLIANT_ANGUISH_1: - { - if (getRandom(1000) < 210) - { + case BRILLIANT_ANGUISH_1: { + if (getRandom(1000) < 210) { giveItemRandomly(qs.getPlayer(), npc, Q_SILVER_UNICORN, 1, 0, 1, true); } break; } - case LAKIN: - { - if (getRandom(1000) < 60) - { + case LAKIN: { + if (getRandom(1000) < 60) { giveItemRandomly(qs.getPlayer(), npc, Q_BLOOD_MEDUSA, 1, 0, 1, true); } break; } - case HATAR_HANISHEE: - { - if (getRandom(1000) < 70) - { + case HATAR_HANISHEE: { + if (getRandom(1000) < 70) { giveItemRandomly(qs.getPlayer(), npc, Q_BLOOD_MEDUSA, 1, 0, 1, true); } break; } - case PUNISHMENT_OF_UNDEAD: - { - if (getRandom(1000) < 80) - { + case PUNISHMENT_OF_UNDEAD: { + if (getRandom(1000) < 80) { giveItemRandomly(qs.getPlayer(), npc, Q_BLOOD_MEDUSA, 1, 0, 1, true); } break; } case FLOAT_OF_GRAVE: case BANDERSNATCH_A: - case BANDERSNATCH_B: - { - if (getRandom(1000) < 90) - { + case BANDERSNATCH_B: { + if (getRandom(1000) < 90) { giveItemRandomly(qs.getPlayer(), npc, Q_BLOOD_MEDUSA, 1, 0, 1, true); } break; } - case BANDERSNATCH: - { - if (getRandom(1000) < 100) - { + case BANDERSNATCH: { + if (getRandom(1000) < 100) { giveItemRandomly(qs.getPlayer(), npc, Q_BLOOD_MEDUSA, 1, 0, 1, true); } break; } - case NIHIL_INVADER: - { - if (getRandom(1000) < 110) - { + case NIHIL_INVADER: { + if (getRandom(1000) < 110) { giveItemRandomly(qs.getPlayer(), npc, Q_BLOOD_MEDUSA, 1, 0, 1, true); } break; } - case TIMAK_ORC_SHAMAN: - { - if (getRandom(1000) < 130) - { + case TIMAK_ORC_SHAMAN: { + if (getRandom(1000) < 130) { giveItemRandomly(qs.getPlayer(), npc, Q_BLOOD_MEDUSA, 1, 0, 1, true); } break; } case TIMAK_ORC_ARCHER: - case TIMAK_ORC_SOLDIER: - { - if (getRandom(1000) < 140) - { + case TIMAK_ORC_SOLDIER: { + if (getRandom(1000) < 140) { giveItemRandomly(qs.getPlayer(), npc, Q_BLOOD_MEDUSA, 1, 0, 1, true); } break; @@ -1332,10 +1079,8 @@ public final class Q00336_CoinsOfMagic extends Quest case DOOM_ARCHER: case BRILLIANT_WISDOM: case BRILLIANT_VENGEANCE: - case BRILLIANT_VENGEANCE_1: - { - if (getRandom(1000) < 160) - { + case BRILLIANT_VENGEANCE_1: { + if (getRandom(1000) < 160) { giveItemRandomly(qs.getPlayer(), npc, Q_BLOOD_MEDUSA, 1, 0, 1, true); } break; @@ -1349,8 +1094,7 @@ public final class Q00336_CoinsOfMagic extends Quest /** * @param qs */ - private void resetParams(QuestState qs) - { + private void resetParams(QuestState qs) { qs.set(WEIGHT_POINT, 0); qs.set(PARAM_1, 0); qs.set(PARAM_2, 0); @@ -1371,18 +1115,13 @@ public final class Q00336_CoinsOfMagic extends Quest * @param ITEM_4 * @return */ - private String shortFirstSteps(QuestState qs, int npcId, int weightPoint, int base, int ITEM_1_1, int ITEM_1_2, int ITEM_1_MUL, int ITEM_2, int ITEM_3, int ITEM_4) - { - switch (qs.getInt(PARAM_2)) - { - case 42: - { - if ((qs.getQuestItemsCount(ITEM_1_1) >= (base * ITEM_1_MUL)) && ((ITEM_1_2 == 0) || (qs.getQuestItemsCount(ITEM_1_2) >= base))) - { + private String shortFirstSteps(QuestState qs, int npcId, int weightPoint, int base, int ITEM_1_1, int ITEM_1_2, int ITEM_1_MUL, int ITEM_2, int ITEM_3, int ITEM_4) { + switch (qs.getInt(PARAM_2)) { + case 42: { + if ((qs.getQuestItemsCount(ITEM_1_1) >= (base * ITEM_1_MUL)) && ((ITEM_1_2 == 0) || (qs.getQuestItemsCount(ITEM_1_2) >= base))) { qs.set(FLAG, 1); qs.takeItems(ITEM_1_1, base * ITEM_1_MUL); - if (ITEM_1_2 > 0) - { + if (ITEM_1_2 > 0) { qs.takeItems(ITEM_1_2, base); } qs.set(WEIGHT_POINT, weightPoint); @@ -1394,10 +1133,8 @@ public final class Q00336_CoinsOfMagic extends Quest } break; } - case 31: - { - if (qs.getQuestItemsCount(ITEM_2) >= base) - { + case 31: { + if (qs.getQuestItemsCount(ITEM_2) >= base) { qs.set(FLAG, 1); qs.takeItems(ITEM_2, base); qs.set(WEIGHT_POINT, weightPoint); @@ -1409,10 +1146,8 @@ public final class Q00336_CoinsOfMagic extends Quest } break; } - case 21: - { - if (qs.getQuestItemsCount(ITEM_3) >= base) - { + case 21: { + if (qs.getQuestItemsCount(ITEM_3) >= base) { qs.set(FLAG, 1); qs.takeItems(ITEM_3, base); qs.set(WEIGHT_POINT, weightPoint); @@ -1424,10 +1159,8 @@ public final class Q00336_CoinsOfMagic extends Quest } break; } - case 11: - { - if (qs.getQuestItemsCount(ITEM_4) >= base) - { + case 11: { + if (qs.getQuestItemsCount(ITEM_4) >= base) { qs.set(FLAG, 1); qs.takeItems(ITEM_4, base); qs.set(WEIGHT_POINT, weightPoint); @@ -1458,14 +1191,10 @@ public final class Q00336_CoinsOfMagic extends Quest * @param REWARD_4 * @return */ - private String shortSecondStepOneItem(QuestState qs, int npcId, int mul, int ITEM_1, int ITEM_1_MUL, int REWARD_1, int ITEM_2, int REWARD_2, int ITEM_3, int REWARD_3, int ITEM_4, int REWARD_4) - { - switch (qs.getInt(PARAM_2)) - { - case 42: - { - if ((qs.getQuestItemsCount(ITEM_1) >= (10 * mul * ITEM_1_MUL))) - { + private String shortSecondStepOneItem(QuestState qs, int npcId, int mul, int ITEM_1, int ITEM_1_MUL, int REWARD_1, int ITEM_2, int REWARD_2, int ITEM_3, int REWARD_3, int ITEM_4, int REWARD_4) { + switch (qs.getInt(PARAM_2)) { + case 42: { + if ((qs.getQuestItemsCount(ITEM_1) >= (10 * mul * ITEM_1_MUL))) { qs.takeItems(ITEM_1, 10 * mul * ITEM_1_MUL); qs.giveItems(REWARD_1, 1 * mul); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); @@ -1473,10 +1202,8 @@ public final class Q00336_CoinsOfMagic extends Quest } break; } - case 31: - { - if (qs.getQuestItemsCount(ITEM_2) >= (5 * mul)) - { + case 31: { + if (qs.getQuestItemsCount(ITEM_2) >= (5 * mul)) { qs.takeItems(ITEM_2, 5 * mul); qs.giveItems(REWARD_2, 1 * mul); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); @@ -1484,10 +1211,8 @@ public final class Q00336_CoinsOfMagic extends Quest } break; } - case 21: - { - if (qs.getQuestItemsCount(ITEM_3) >= (5 * mul)) - { + case 21: { + if (qs.getQuestItemsCount(ITEM_3) >= (5 * mul)) { qs.takeItems(ITEM_3, 5 * mul); qs.giveItems(REWARD_3, 1 * mul); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); @@ -1495,10 +1220,8 @@ public final class Q00336_CoinsOfMagic extends Quest } break; } - case 11: - { - if (qs.getQuestItemsCount(ITEM_4) >= (5 * mul)) - { + case 11: { + if (qs.getQuestItemsCount(ITEM_4) >= (5 * mul)) { qs.takeItems(ITEM_4, 5 * mul); qs.giveItems(REWARD_4, 1 * mul); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); @@ -1528,14 +1251,10 @@ public final class Q00336_CoinsOfMagic extends Quest * @param REWARD_4 * @return */ - private String shortSecondStepTwoItems(QuestState qs, int npcId, int mul, int ITEM_1_1, int ITEM_1_2, int REWARD_1, int ITEM_2_1, int ITEM_2_2, int REWARD_2, int ITEM_3_1, int ITEM_3_2, int REWARD_3, int ITEM_4_1, int ITEM_4_2, int REWARD_4) - { - switch (qs.getInt(PARAM_2)) - { - case 42: - { - if ((qs.getQuestItemsCount(ITEM_1_1) >= (10 * mul)) && (qs.getQuestItemsCount(ITEM_1_2) >= (10 * mul))) - { + private String shortSecondStepTwoItems(QuestState qs, int npcId, int mul, int ITEM_1_1, int ITEM_1_2, int REWARD_1, int ITEM_2_1, int ITEM_2_2, int REWARD_2, int ITEM_3_1, int ITEM_3_2, int REWARD_3, int ITEM_4_1, int ITEM_4_2, int REWARD_4) { + switch (qs.getInt(PARAM_2)) { + case 42: { + if ((qs.getQuestItemsCount(ITEM_1_1) >= (10 * mul)) && (qs.getQuestItemsCount(ITEM_1_2) >= (10 * mul))) { qs.takeItems(ITEM_1_1, 10 * mul); qs.takeItems(ITEM_1_2, 10 * mul); qs.giveItems(REWARD_1, 1 * mul); @@ -1544,10 +1263,8 @@ public final class Q00336_CoinsOfMagic extends Quest } break; } - case 31: - { - if ((qs.getQuestItemsCount(ITEM_2_1) >= (5 * mul)) && (qs.getQuestItemsCount(ITEM_2_2) >= (5 * mul))) - { + case 31: { + if ((qs.getQuestItemsCount(ITEM_2_1) >= (5 * mul)) && (qs.getQuestItemsCount(ITEM_2_2) >= (5 * mul))) { qs.takeItems(ITEM_2_1, 5 * mul); qs.takeItems(ITEM_2_2, 5 * mul); qs.giveItems(REWARD_2, 1 * mul); @@ -1556,10 +1273,8 @@ public final class Q00336_CoinsOfMagic extends Quest } break; } - case 21: - { - if ((qs.getQuestItemsCount(ITEM_3_1) >= (5 * mul)) && (qs.getQuestItemsCount(ITEM_3_2) >= (5 * mul))) - { + case 21: { + if ((qs.getQuestItemsCount(ITEM_3_1) >= (5 * mul)) && (qs.getQuestItemsCount(ITEM_3_2) >= (5 * mul))) { qs.takeItems(ITEM_3_1, 5 * mul); qs.takeItems(ITEM_3_2, 5 * mul); qs.giveItems(REWARD_3, 1 * mul); @@ -1568,10 +1283,8 @@ public final class Q00336_CoinsOfMagic extends Quest } break; } - case 11: - { - if ((qs.getQuestItemsCount(ITEM_4_1) >= (5 * mul)) && (qs.getQuestItemsCount(ITEM_4_2) >= (5 * mul))) - { + case 11: { + if ((qs.getQuestItemsCount(ITEM_4_1) >= (5 * mul)) && (qs.getQuestItemsCount(ITEM_4_2) >= (5 * mul))) { qs.takeItems(ITEM_4_1, 5 * mul); qs.takeItems(ITEM_4_2, 5 * mul); qs.giveItems(REWARD_4, 1 * mul); @@ -1594,156 +1307,117 @@ public final class Q00336_CoinsOfMagic extends Quest * @param ITEM_4 * @return */ - private String shortThirdStep(QuestState qs, int npcId, int flag, int ITEM_1, int ITEM_2, int ITEM_3, int ITEM_4) - { + private String shortThirdStep(QuestState qs, int npcId, int flag, int ITEM_1, int ITEM_2, int ITEM_3, int ITEM_4) { qs.set(PARAM_3, 0); qs.set(FLAG, qs.getInt(FLAG) + flag); - if ((qs.getInt(PARAM_1) == qs.getInt(FLAG)) && (qs.getInt(WEIGHT_POINT) >= 0)) - { + if ((qs.getInt(PARAM_1) == qs.getInt(FLAG)) && (qs.getInt(WEIGHT_POINT) >= 0)) { qs.set(WEIGHT_POINT, 0); - switch (qs.getInt(PARAM_2)) - { - case 42: - { + switch (qs.getInt(PARAM_2)) { + case 42: { qs.giveItems(ITEM_1, 1); break; } - case 31: - { + case 31: { qs.giveItems(ITEM_2, 1); break; } - case 21: - { + case 21: { qs.giveItems(ITEM_3, 1); break; } - case 11: - { + case 11: { qs.giveItems(ITEM_4, 1); break; } } qs.set(PARAM_1, 0); return npcId + "-20.html"; - } - else if (qs.getInt(WEIGHT_POINT) == 0) - { - switch (qs.getInt(PARAM_1)) - { - case 21: - { + } else if (qs.getInt(WEIGHT_POINT) == 0) { + switch (qs.getInt(PARAM_1)) { + case 21: { return npcId + "-23.html"; } - case 25: - { + case 25: { return npcId + "-24.html"; } - case 37: - { + case 37: { return npcId + "-25.html"; } - case 41: - { + case 41: { return npcId + "-26.html"; } - case 61: - { + case 61: { return npcId + "-27.html"; } - case 29: - { + case 29: { return npcId + "-28.html"; } - case 45: - { + case 45: { return npcId + "-29.html"; } - case 53: - { + case 53: { return npcId + "-30.html"; } - case 57: - { + case 57: { return npcId + "-31.html"; } - case 22: - { + case 22: { return npcId + "-32.html"; } - case 26: - { + case 26: { return npcId + "-33.html"; } - case 38: - { + case 38: { return npcId + "-34.html"; } - case 42: - { + case 42: { return npcId + "-35.html"; } - case 62: - { + case 62: { return npcId + "-36.html"; } - case 30: - { + case 30: { return npcId + "-37.html"; } - case 46: - { + case 46: { return npcId + "-38.html"; } - case 54: - { + case 54: { return npcId + "-39.html"; } - case 58: - { + case 58: { return npcId + "-40.html"; } - case 23: - { + case 23: { return npcId + "-41.html"; } - case 27: - { + case 27: { return npcId + "-42.html"; } - case 39: - { + case 39: { return npcId + "-43.html"; } - case 43: - { + case 43: { return npcId + "-44.html"; } - case 63: - { + case 63: { return npcId + "-45.html"; } - case 31: - { + case 31: { return npcId + "-46.html"; } - case 47: - { + case 47: { return npcId + "-47.html"; } - case 55: - { + case 55: { return npcId + "-48.html"; } - case 59: - { + case 59: { return npcId + "-49.html"; } } qs.set(PARAM_1, 0); - } - else - { + } else { int i0 = qs.getInt(PARAM_1) % 4; int i1 = qs.getInt(PARAM_1) / 4; int i2 = i1 / 4; @@ -1754,32 +1428,25 @@ public final class Q00336_CoinsOfMagic extends Quest int i5 = i4 / 4; i4 = i4 % 4; - if (i0 == i3) - { + if (i0 == i3) { qs.set(PARAM_3, qs.getInt(PARAM_3) + 1); } - if (i1 == i4) - { + if (i1 == i4) { qs.set(PARAM_3, qs.getInt(PARAM_3) + 1); } - if (i2 == i5) - { + if (i2 == i5) { qs.set(PARAM_3, qs.getInt(PARAM_3) + 1); } qs.set(FLAG, 1); qs.set(WEIGHT_POINT, qs.getInt(WEIGHT_POINT) - 1); - switch (qs.getInt(PARAM_3)) - { - case 0: - { + switch (qs.getInt(PARAM_3)) { + case 0: { return npcId + "-52.html"; } - case 1: - { + case 1: { return npcId + "-50.html"; } - case 2: - { + case 2: { return npcId + "-51.html"; } } @@ -1787,25 +1454,20 @@ public final class Q00336_CoinsOfMagic extends Quest return null; } - private QuestState getRandomPlayerFromParty(L2PcInstance player, L2Npc npc, int memoState) - { + private QuestState getRandomPlayerFromParty(L2PcInstance player, L2Npc npc, int memoState) { QuestState qs = getQuestState(player, false); final List<QuestState> candidates = new ArrayList<>(); - if ((qs != null) && qs.isStarted() && (qs.getMemoState() == memoState)) - { + if ((qs != null) && qs.isStarted() && (qs.getMemoState() == memoState)) { candidates.add(qs); candidates.add(qs); } - if (player.isInParty()) - { - player.getParty().getMembers().stream().forEach(pm -> - { + if (player.isInParty()) { + player.getParty().getMembers().stream().forEach(pm -> { QuestState qss = getQuestState(pm, false); - if ((qss != null) && qss.isStarted() && (qss.getMemoState() == memoState) && Util.checkIfInRange(1500, npc, pm, true)) - { + if ((qss != null) && qss.isStarted() && (qss.getMemoState() == memoState) && Util.checkIfInRange(1500, npc, pm, true)) { candidates.add(qss); } }); @@ -1813,24 +1475,19 @@ public final class Q00336_CoinsOfMagic extends Quest return candidates.isEmpty() ? null : candidates.get(getRandom(candidates.size())); } - private QuestState getRandomPlayerFromPartyCoin(L2PcInstance player, L2Npc npc, int memoState) - { + private QuestState getRandomPlayerFromPartyCoin(L2PcInstance player, L2Npc npc, int memoState) { QuestState qs = getQuestState(player, false); final List<QuestState> candidates = new ArrayList<>(); - if ((qs != null) && qs.isStarted() && (qs.getMemoState() == memoState) && !qs.hasQuestItems(Q_KALDIS_GOLD_DRAGON)) - { + if ((qs != null) && qs.isStarted() && (qs.getMemoState() == memoState) && !qs.hasQuestItems(Q_KALDIS_GOLD_DRAGON)) { candidates.add(qs); candidates.add(qs); } - if (player.isInParty()) - { - player.getParty().getMembers().stream().forEach(pm -> - { + if (player.isInParty()) { + player.getParty().getMembers().stream().forEach(pm -> { QuestState qss = getQuestState(pm, false); - if ((qss != null) && qss.isStarted() && (qss.getMemoState() == memoState) && !qss.hasQuestItems(Q_KALDIS_GOLD_DRAGON) && Util.checkIfInRange(1500, npc, pm, true)) - { + if ((qss != null) && qss.isStarted() && (qss.getMemoState() == memoState) && !qss.hasQuestItems(Q_KALDIS_GOLD_DRAGON) && Util.checkIfInRange(1500, npc, pm, true)) { candidates.add(qss); } }); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00337_AudienceWithTheLandDragon/Q00337_AudienceWithTheLandDragon.java b/src/main/java/com/l2jserver/datapack/quests/Q00337_AudienceWithTheLandDragon/Q00337_AudienceWithTheLandDragon.java index ca04971c7d..6058503a76 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00337_AudienceWithTheLandDragon/Q00337_AudienceWithTheLandDragon.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00337_AudienceWithTheLandDragon/Q00337_AudienceWithTheLandDragon.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.util.Util; * Audience With The Land Dragon (337) * @author ivantotov */ -public final class Q00337_AudienceWithTheLandDragon extends Quest -{ +public final class Q00337_AudienceWithTheLandDragon extends Quest { // NPCs private static final int WAREHOUSE_CHIEF_MOKE = 30498; private static final int BLACKSMITH_HELTON = 30678; @@ -82,8 +81,7 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest // Misc private static final int MIN_LEVEL = 50; - public Q00337_AudienceWithTheLandDragon() - { + public Q00337_AudienceWithTheLandDragon() { super(337, Q00337_AudienceWithTheLandDragon.class.getSimpleName(), "Audience With The Land Dragon"); addStartNpc(GABRIELLE); addTalkId(GABRIELLE, WAREHOUSE_CHIEF_MOKE, BLACKSMITH_HELTON, PREFECT_CHAKIRIS, MAGISTER_KAIENA, ANTHARAS_WATCHMAN_GILMORE, ANTHARAS_WATCHMAN_THEODRIC, MASTER_KENDRA, HIGH_PRIEST_ORVEN); @@ -93,32 +91,24 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if ("DESPAWN".equals(event)) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if ("DESPAWN".equals(event)) { npc.deleteMe(); return super.onAdvEvent(event, npc, player); - } - else if ("DESPAWN_240".equals(event)) - { + } else if ("DESPAWN_240".equals(event)) { npc.deleteMe(); return super.onAdvEvent(event, npc, player); } final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "30753-05.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "30753-05.htm": { + if (qs.isCreated()) { giveItems(player, FEATHER_OF_GABRIELLE, 1); qs.startQuest(); qs.setMemoState(20000); @@ -126,25 +116,21 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest } break; } - case "30753-09.html": - { + case "30753-09.html": { takeItems(player, MARK_OF_WATCHMAN, -1); qs.setMemoState(40000); qs.setCond(2, true); htmltext = event; break; } - case "30754-03.html": - { + case "30754-03.html": { qs.setMemoState(70000); qs.setCond(4, true); htmltext = event; break; } - case "30755-05.html": - { - if (qs.isMemoState(70000) && hasQuestItems(player, FRAGMENT_OF_ABYSS_JEWEL_3RD)) - { + case "30755-05.html": { + if (qs.isMemoState(70000) && hasQuestItems(player, FRAGMENT_OF_ABYSS_JEWEL_3RD)) { giveItems(player, PORTAL_STONE, 1); qs.exitQuest(true, true); htmltext = event; @@ -156,8 +142,7 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest case "30753-01a.html": case "30753-03.htm": case "30753-04.htm": - case "30753-06a.html": - { + case "30753-06a.html": { htmltext = event; break; } @@ -166,75 +151,57 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { final QuestState qs = getQuestState(attacker, false); - if ((qs != null) && qs.isStarted()) - { - switch (npc.getId()) - { - case ABYSSAL_JEWEL_1: - { - if (qs.isMemoState(40000) || (qs.isMemoState(40001))) - { - if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.8)) && (npc.getVariables().getInt("i_quest0") == 0)) - { - for (int i = 0; i < 20; i++) - { + if ((qs != null) && qs.isStarted()) { + switch (npc.getId()) { + case ABYSSAL_JEWEL_1: { + if (qs.isMemoState(40000) || (qs.isMemoState(40001))) { + if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.8)) && (npc.getVariables().getInt("i_quest0") == 0)) { + for (int i = 0; i < 20; i++) { addAttackDesire(addSpawn(JEWEL_GUARDIAN_MARA, npc, true, 180000), attacker); } npc.getVariables().set("i_quest0", 1); startQuestTimer("DESPAWN", 900000, npc, attacker); } - if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.4)) && !hasQuestItems(attacker, FRAGMENT_OF_ABYSS_JEWEL_1ST)) - { + if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.4)) && !hasQuestItems(attacker, FRAGMENT_OF_ABYSS_JEWEL_1ST)) { giveItems(attacker, FRAGMENT_OF_ABYSS_JEWEL_1ST, 1); playSound(attacker, Sound.ITEMSOUND_QUEST_ITEMGET); startQuestTimer("DESPAWN_240", 240000, npc, attacker); } } - if (npc.getCurrentHp() < (npc.getMaxHp() * 0.1)) - { + if (npc.getCurrentHp() < (npc.getMaxHp() * 0.1)) { npc.deleteMe(); } break; } - case ABYSSAL_JEWEL_2: - { - if (qs.isMemoState(40000) || (qs.isMemoState(40010))) - { - if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.8)) && (npc.getVariables().getInt("i_quest0") == 0)) - { - for (int i = 0; i < 20; i++) - { + case ABYSSAL_JEWEL_2: { + if (qs.isMemoState(40000) || (qs.isMemoState(40010))) { + if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.8)) && (npc.getVariables().getInt("i_quest0") == 0)) { + for (int i = 0; i < 20; i++) { addAttackDesire(addSpawn(JEWEL_GUARDIAN_MUSFEL, npc, true, 180000), attacker); } npc.getVariables().set("i_quest0", 1); startQuestTimer("DESPAWN", 900000, npc, attacker); } - if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.4)) && !hasQuestItems(attacker, FRAGMENT_OF_ABYSS_JEWEL_2ND)) - { + if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.4)) && !hasQuestItems(attacker, FRAGMENT_OF_ABYSS_JEWEL_2ND)) { giveItems(attacker, FRAGMENT_OF_ABYSS_JEWEL_2ND, 1); playSound(attacker, Sound.ITEMSOUND_QUEST_ITEMGET); startQuestTimer("DESPAWN_240", 240000, npc, attacker); } } - if (npc.getCurrentHp() < (npc.getMaxHp() * 0.1)) - { + if (npc.getCurrentHp() < (npc.getMaxHp() * 0.1)) { npc.deleteMe(); } break; } - case ABYSSAL_JEWEL_3: - { - if (qs.isMemoState(70000)) - { - if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.8)) && (npc.getVariables().getInt("i_quest0") == 0)) - { + case ABYSSAL_JEWEL_3: { + if (qs.isMemoState(70000)) { + if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.8)) && (npc.getVariables().getInt("i_quest0") == 0)) { addAttackDesire(addSpawn(JEWEL_GUARDIAN_PYTON, npc, true, 180000), attacker); addAttackDesire(addSpawn(JEWEL_GUARDIAN_PYTON, npc, true, 180000), attacker); addAttackDesire(addSpawn(JEWEL_GUARDIAN_PYTON, npc, true, 180000), attacker); @@ -242,15 +209,13 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest npc.getVariables().set("i_quest0", 1); } - if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.4)) && !hasQuestItems(attacker, FRAGMENT_OF_ABYSS_JEWEL_3RD)) - { + if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.4)) && !hasQuestItems(attacker, FRAGMENT_OF_ABYSS_JEWEL_3RD)) { giveItems(attacker, FRAGMENT_OF_ABYSS_JEWEL_3RD, 1); playSound(attacker, Sound.ITEMSOUND_QUEST_ITEMGET); } } - if (npc.getCurrentHp() < (npc.getMaxHp() * 0.1)) - { + if (npc.getCurrentHp() < (npc.getMaxHp() * 0.1)) { npc.deleteMe(); } break; @@ -261,17 +226,12 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case BLOOD_QUEEN: - { - switch (qs.getMemoState()) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case BLOOD_QUEEN: { + switch (qs.getMemoState()) { case 21011: case 21010: case 21001: @@ -279,12 +239,9 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest case 20011: case 20010: case 20001: - case 20000: - { - if (!hasQuestItems(killer, REMAINS_OF_SACRAFICE)) - { - for (int i = 0; i < 8; i++) - { + case 20000: { + if (!hasQuestItems(killer, REMAINS_OF_SACRAFICE)) { + for (int i = 0; i < 8; i++) { addSpawn(GHOST_OF_OFFERING, npc, true, 180000); } } @@ -296,21 +253,16 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest case CAVE_MAIDEN: case CAVE_KEEPER: case CAVE_KEEPER_HOLD: - case CAVE_MAIDEN_HOLD: - { - if (qs.isMemoState(70000) && !hasQuestItems(killer, FRAGMENT_OF_ABYSS_JEWEL_3RD)) - { - if (getRandom(5) == 0) - { + case CAVE_MAIDEN_HOLD: { + if (qs.isMemoState(70000) && !hasQuestItems(killer, FRAGMENT_OF_ABYSS_JEWEL_3RD)) { + if (getRandom(5) == 0) { addSpawn(ABYSSAL_JEWEL_3, npc, true, 180000); } } break; } - case HARIT_LIZARDMAN_SHAMAN: - { - switch (qs.getMemoState()) - { + case HARIT_LIZARDMAN_SHAMAN: { + switch (qs.getMemoState()) { case 21110: case 21100: case 21010: @@ -318,10 +270,8 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest case 20110: case 20100: case 20010: - case 20000: - { - if (!hasQuestItems(killer, TOTEM_OF_LAND_DRAGON)) - { + case 20000: { + if (!hasQuestItems(killer, TOTEM_OF_LAND_DRAGON)) { addAttackDesire(addSpawn(HARIT_LIZARDMAN_ZEALOT, npc, true, 180000), killer); addAttackDesire(addSpawn(HARIT_LIZARDMAN_ZEALOT, npc, true, 180000), killer); addAttackDesire(addSpawn(HARIT_LIZARDMAN_ZEALOT, npc, true, 180000), killer); @@ -331,10 +281,8 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest } break; } - case HARIT_LIZARDMAN_MATRIARCH: - { - switch (qs.getMemoState()) - { + case HARIT_LIZARDMAN_MATRIARCH: { + switch (qs.getMemoState()) { case 21110: case 21100: case 21010: @@ -342,12 +290,9 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest case 20110: case 20100: case 20010: - case 20000: - { - if (!hasQuestItems(killer, TOTEM_OF_LAND_DRAGON)) - { - if (getRandom(5) == 0) - { + case 20000: { + if (!hasQuestItems(killer, TOTEM_OF_LAND_DRAGON)) { + if (getRandom(5) == 0) { addAttackDesire(addSpawn(HARIT_LIZARDMAN_ZEALOT, npc, true, 180000), killer); addAttackDesire(addSpawn(HARIT_LIZARDMAN_ZEALOT, npc, true, 180000), killer); addAttackDesire(addSpawn(HARIT_LIZARDMAN_ZEALOT, npc, true, 180000), killer); @@ -358,10 +303,8 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest } break; } - case HAMRUT: - { - switch (qs.getMemoState()) - { + case HAMRUT: { + switch (qs.getMemoState()) { case 21101: case 21100: case 21001: @@ -369,10 +312,8 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest case 20101: case 20100: case 20001: - case 20000: - { - if (!hasQuestItems(killer, HAMRUT_LEG)) - { + case 20000: { + if (!hasQuestItems(killer, HAMRUT_LEG)) { giveItems(killer, HAMRUT_LEG, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -381,10 +322,8 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest } break; } - case KRANROT: - { - switch (qs.getMemoState()) - { + case KRANROT: { + switch (qs.getMemoState()) { case 21101: case 21100: case 21001: @@ -392,10 +331,8 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest case 20101: case 20100: case 20001: - case 20000: - { - if (!hasQuestItems(killer, KRANROT_SKIN)) - { + case 20000: { + if (!hasQuestItems(killer, KRANROT_SKIN)) { giveItems(killer, KRANROT_SKIN, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -404,10 +341,8 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest } break; } - case MARSH_STALKER: - { - switch (qs.getMemoState()) - { + case MARSH_STALKER: { + switch (qs.getMemoState()) { case 20111: case 20110: case 20101: @@ -415,10 +350,8 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest case 20011: case 20010: case 20001: - case 20000: - { - if (!hasQuestItems(killer, MARSH_STALKER_HORN)) - { + case 20000: { + if (!hasQuestItems(killer, MARSH_STALKER_HORN)) { giveItems(killer, MARSH_STALKER_HORN, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -427,10 +360,8 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest } break; } - case MARSH_DRAKE: - { - switch (qs.getMemoState()) - { + case MARSH_DRAKE: { + switch (qs.getMemoState()) { case 20111: case 20110: case 20101: @@ -438,10 +369,8 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest case 20011: case 20010: case 20001: - case 20000: - { - if (!hasQuestItems(killer, MARSH_DRAKE_TALONS)) - { + case 20000: { + if (!hasQuestItems(killer, MARSH_DRAKE_TALONS)) { giveItems(killer, MARSH_DRAKE_TALONS, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -450,34 +379,26 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest } break; } - case JEWEL_GUARDIAN_MARA: - { - if (qs.isMemoState(40000) || (qs.isMemoState(40001))) - { - if (!hasQuestItems(killer, MARA_FANG)) - { + case JEWEL_GUARDIAN_MARA: { + if (qs.isMemoState(40000) || (qs.isMemoState(40001))) { + if (!hasQuestItems(killer, MARA_FANG)) { giveItems(killer, MARA_FANG, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case JEWEL_GUARDIAN_MUSFEL: - { - if (qs.isMemoState(40000) || (qs.isMemoState(40010))) - { - if (!hasQuestItems(killer, MUSFEL_FANG)) - { + case JEWEL_GUARDIAN_MUSFEL: { + if (qs.isMemoState(40000) || (qs.isMemoState(40010))) { + if (!hasQuestItems(killer, MUSFEL_FANG)) { giveItems(killer, MUSFEL_FANG, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case GHOST_OF_OFFERING: - { - switch (qs.getMemoState()) - { + case GHOST_OF_OFFERING: { + switch (qs.getMemoState()) { case 21011: case 21010: case 21001: @@ -485,10 +406,8 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest case 20011: case 20010: case 20001: - case 20000: - { - if (!hasQuestItems(killer, REMAINS_OF_SACRAFICE)) - { + case 20000: { + if (!hasQuestItems(killer, REMAINS_OF_SACRAFICE)) { giveItems(killer, REMAINS_OF_SACRAFICE, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -497,10 +416,8 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest } break; } - case HARIT_LIZARDMAN_ZEALOT: - { - switch (qs.getMemoState()) - { + case HARIT_LIZARDMAN_ZEALOT: { + switch (qs.getMemoState()) { case 21110: case 21100: case 21010: @@ -508,10 +425,8 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest case 20110: case 20100: case 20010: - case 20000: - { - if (!hasQuestItems(killer, TOTEM_OF_LAND_DRAGON)) - { + case 20000: { + if (!hasQuestItems(killer, TOTEM_OF_LAND_DRAGON)) { giveItems(killer, TOTEM_OF_LAND_DRAGON, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -526,134 +441,87 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); final int memoState = qs.getMemoState(); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == GABRIELLE) - { - if (player.getLevel() < MIN_LEVEL) - { + if (qs.isCreated()) { + if (npc.getId() == GABRIELLE) { + if (player.getLevel() < MIN_LEVEL) { htmltext = "30753-01.htm"; - } - else - { + } else { htmltext = "30753-02.htm"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case GABRIELLE: - { - if ((memoState >= 20000) && (memoState < 30000)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case GABRIELLE: { + if ((memoState >= 20000) && (memoState < 30000)) { htmltext = "30753-06.html"; - } - else if (memoState == 30000) - { + } else if (memoState == 30000) { htmltext = "30753-08.html"; - } - else if ((memoState >= 40000) && (memoState < 50000)) - { + } else if ((memoState >= 40000) && (memoState < 50000)) { htmltext = "30753-10.html"; - } - else if (memoState == 50000) - { + } else if (memoState == 50000) { takeItems(player, FEATHER_OF_GABRIELLE, -1); takeItems(player, MARK_OF_WATCHMAN, -1); giveItems(player, HERALD_OF_SLAYER, 1); qs.setMemoState(60000); qs.setCond(3, true); htmltext = "30753-11.html"; - } - else if (memoState == 60000) - { + } else if (memoState == 60000) { htmltext = "30753-12.html"; - } - else if (memoState == 70000) - { + } else if (memoState == 70000) { htmltext = "30753-13.html"; } break; } - case WAREHOUSE_CHIEF_MOKE: - { - if ((memoState == 40000) || (memoState == 40001)) - { - if (hasQuestItems(player, FRAGMENT_OF_ABYSS_JEWEL_1ST, MARA_FANG)) - { + case WAREHOUSE_CHIEF_MOKE: { + if ((memoState == 40000) || (memoState == 40001)) { + if (hasQuestItems(player, FRAGMENT_OF_ABYSS_JEWEL_1ST, MARA_FANG)) { takeItems(player, FRAGMENT_OF_ABYSS_JEWEL_1ST, -1); takeItems(player, MARA_FANG, -1); giveItems(player, MARK_OF_WATCHMAN, 1); - if (qs.getMemoState() == 40001) - { + if (qs.getMemoState() == 40001) { qs.setMemoState(50000); - } - else - { + } else { qs.setMemoState(40010); } htmltext = "30498-03.html"; - } - else - { + } else { htmltext = "30498-01.html"; } - } - else if (memoState == 40010) - { + } else if (memoState == 40010) { htmltext = "30498-04.html"; - } - else if (memoState >= 50000) - { + } else if (memoState >= 50000) { htmltext = "30498-05.html"; } break; } - case BLACKSMITH_HELTON: - { - if ((memoState == 40000) || (memoState == 40010)) - { - if (hasQuestItems(player, FRAGMENT_OF_ABYSS_JEWEL_2ND, MUSFEL_FANG)) - { + case BLACKSMITH_HELTON: { + if ((memoState == 40000) || (memoState == 40010)) { + if (hasQuestItems(player, FRAGMENT_OF_ABYSS_JEWEL_2ND, MUSFEL_FANG)) { takeItems(player, FRAGMENT_OF_ABYSS_JEWEL_2ND, -1); takeItems(player, MUSFEL_FANG, -1); giveItems(player, MARK_OF_WATCHMAN, 1); - if (qs.getMemoState() == 40010) - { + if (qs.getMemoState() == 40010) { qs.setMemoState(50000); - } - else - { + } else { qs.setMemoState(40001); } htmltext = "30678-02.html"; - } - else - { + } else { htmltext = "30678-01.html"; } - } - else if (memoState == 40001) - { + } else if (memoState == 40001) { htmltext = "30678-03.html"; - } - else if (memoState >= 50000) - { + } else if (memoState >= 50000) { htmltext = "30678-04.html"; } break; } - case PREFECT_CHAKIRIS: - { - switch (qs.getMemoState()) - { + case PREFECT_CHAKIRIS: { + switch (qs.getMemoState()) { case 21101: case 21000: case 21100: @@ -661,25 +529,18 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest case 20101: case 20100: case 20001: - case 20000: - { - if (hasQuestItems(player, KRANROT_SKIN, HAMRUT_LEG)) - { + case 20000: { + if (hasQuestItems(player, KRANROT_SKIN, HAMRUT_LEG)) { takeItems(player, KRANROT_SKIN, -1); takeItems(player, HAMRUT_LEG, -1); giveItems(player, MARK_OF_WATCHMAN, 1); - if ((qs.getMemoState() + 10) == 21111) - { + if ((qs.getMemoState() + 10) == 21111) { qs.setMemoState(30000); - } - else - { + } else { qs.setMemoState(qs.getMemoState() + 10); } htmltext = "30705-02.html"; - } - else - { + } else { htmltext = "30705-01.html"; } break; @@ -690,22 +551,18 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest case 20111: case 20110: case 20011: - case 20010: - { + case 20010: { htmltext = "30705-03.html"; break; } } - if (memoState >= 30000) - { + if (memoState >= 30000) { htmltext = "30705-04.html"; } break; } - case MAGISTER_KAIENA: - { - switch (qs.getMemoState()) - { + case MAGISTER_KAIENA: { + switch (qs.getMemoState()) { case 20111: case 20110: case 20101: @@ -713,25 +570,18 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest case 20010: case 20011: case 20001: - case 20000: - { - if (hasQuestItems(player, MARSH_STALKER_HORN, MARSH_DRAKE_TALONS)) - { + case 20000: { + if (hasQuestItems(player, MARSH_STALKER_HORN, MARSH_DRAKE_TALONS)) { takeItems(player, MARSH_STALKER_HORN, -1); takeItems(player, MARSH_DRAKE_TALONS, -1); giveItems(player, MARK_OF_WATCHMAN, 1); - if ((qs.getMemoState() + 1000) == 21111) - { + if ((qs.getMemoState() + 1000) == 21111) { qs.setMemoState(30000); - } - else - { + } else { qs.setMemoState(qs.getMemoState() + 1000); } htmltext = "30720-02.html"; - } - else - { + } else { htmltext = "30720-01.html"; } break; @@ -742,68 +592,46 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest case 21011: case 21010: case 21001: - case 21000: - { + case 21000: { htmltext = "30720-03.html"; break; } } - if (memoState >= 30000) - { + if (memoState >= 30000) { htmltext = "30720-04.html"; } break; } - case ANTHARAS_WATCHMAN_GILMORE: - { - if (memoState < 60000) - { + case ANTHARAS_WATCHMAN_GILMORE: { + if (memoState < 60000) { htmltext = "30754-01.html"; - } - else if (memoState == 60000) - { + } else if (memoState == 60000) { htmltext = "30754-02.html"; - } - else if (memoState == 70000) - { - if (hasQuestItems(player, FRAGMENT_OF_ABYSS_JEWEL_3RD)) - { + } else if (memoState == 70000) { + if (hasQuestItems(player, FRAGMENT_OF_ABYSS_JEWEL_3RD)) { htmltext = "30754-05.html"; - } - else - { + } else { htmltext = "30754-04.html"; } } break; } - case ANTHARAS_WATCHMAN_THEODRIC: - { - if (memoState < 60000) - { + case ANTHARAS_WATCHMAN_THEODRIC: { + if (memoState < 60000) { htmltext = "30755-01.html"; - } - else if (memoState == 60000) - { + } else if (memoState == 60000) { htmltext = "30755-02.html"; - } - else if (memoState == 70000) - { - if (!hasQuestItems(player, FRAGMENT_OF_ABYSS_JEWEL_3RD)) - { + } else if (memoState == 70000) { + if (!hasQuestItems(player, FRAGMENT_OF_ABYSS_JEWEL_3RD)) { htmltext = "30755-03.html"; - } - else - { + } else { htmltext = "30755-04.html"; } } break; } - case MASTER_KENDRA: - { - switch (qs.getMemoState()) - { + case MASTER_KENDRA: { + switch (qs.getMemoState()) { case 21110: case 21100: case 21010: @@ -811,22 +639,15 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest case 20110: case 20100: case 20010: - case 20000: - { - if (!hasQuestItems(player, TOTEM_OF_LAND_DRAGON)) - { + case 20000: { + if (!hasQuestItems(player, TOTEM_OF_LAND_DRAGON)) { htmltext = "30851-01.html"; - } - else - { + } else { takeItems(player, TOTEM_OF_LAND_DRAGON, -1); giveItems(player, MARK_OF_WATCHMAN, 1); - if ((qs.getMemoState() + 1) == 21111) - { + if ((qs.getMemoState() + 1) == 21111) { qs.setMemoState(30000); - } - else - { + } else { qs.setMemoState(qs.getMemoState() + 1); } htmltext = "30851-02.html"; @@ -839,22 +660,18 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest case 20111: case 20101: case 20011: - case 20001: - { + case 20001: { htmltext = "30851-03.html"; break; } } - if (memoState >= 30000) - { + if (memoState >= 30000) { htmltext = "30851-04.html"; } break; } - case HIGH_PRIEST_ORVEN: - { - switch (qs.getMemoState()) - { + case HIGH_PRIEST_ORVEN: { + switch (qs.getMemoState()) { case 21011: case 21010: case 21001: @@ -862,22 +679,15 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest case 20011: case 20010: case 20001: - case 20000: - { - if (!hasQuestItems(player, REMAINS_OF_SACRAFICE)) - { + case 20000: { + if (!hasQuestItems(player, REMAINS_OF_SACRAFICE)) { htmltext = "30857-01.html"; - } - else - { + } else { takeItems(player, REMAINS_OF_SACRAFICE, -1); giveItems(player, MARK_OF_WATCHMAN, 1); - if ((qs.getMemoState() + 100) == 21111) - { + if ((qs.getMemoState() + 100) == 21111) { qs.setMemoState(30000); - } - else - { + } else { qs.setMemoState(qs.getMemoState() + 100); } htmltext = "30857-02.html"; @@ -890,14 +700,12 @@ public final class Q00337_AudienceWithTheLandDragon extends Quest case 20111: case 20110: case 20101: - case 20100: - { + case 20100: { htmltext = "30857-03.html"; break; } } - if (memoState >= 30000) - { + if (memoState >= 30000) { htmltext = "30857-04.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00338_AlligatorHunter/Q00338_AlligatorHunter.java b/src/main/java/com/l2jserver/datapack/quests/Q00338_AlligatorHunter/Q00338_AlligatorHunter.java index 3379564ab6..c2607e93a2 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00338_AlligatorHunter/Q00338_AlligatorHunter.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00338_AlligatorHunter/Q00338_AlligatorHunter.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * Alligator Hunter (338) * @author malyelfik */ -public class Q00338_AlligatorHunter extends Quest -{ +public class Q00338_AlligatorHunter extends Quest { // NPC private static final int ENVERUN = 30892; // Monster @@ -41,8 +40,7 @@ public class Q00338_AlligatorHunter extends Quest private static final int MIN_LEVEL = 40; private static final int SECOND_CHANCE = 19; - public Q00338_AlligatorHunter() - { + public Q00338_AlligatorHunter() { super(338, Q00338_AlligatorHunter.class.getSimpleName(), "Alligator Hunter"); addStartNpc(ENVERUN); addTalkId(ENVERUN); @@ -51,23 +49,19 @@ public class Q00338_AlligatorHunter extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "30892-03.htm": st.startQuest(); break; case "30892-06.html": - if (!st.hasQuestItems(ALLIGATOR_LEATHER)) - { + if (!st.hasQuestItems(ALLIGATOR_LEATHER)) { return "30892-05.html"; } int amount = (st.getQuestItemsCount(ALLIGATOR_LEATHER) >= 10) ? 3430 : 0; @@ -90,14 +84,11 @@ public class Q00338_AlligatorHunter extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getQuestState(player, false); - if (st != null) - { + if (st != null) { st.giveItems(ALLIGATOR_LEATHER, 1); - if (getRandom(100) < SECOND_CHANCE) - { + if (getRandom(100) < SECOND_CHANCE) { st.giveItems(ALLIGATOR_LEATHER, 1); } st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); @@ -106,12 +97,10 @@ public class Q00338_AlligatorHunter extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? "30892-02.htm" : "30892-01.htm"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00340_SubjugationOfLizardmen/Q00340_SubjugationOfLizardmen.java b/src/main/java/com/l2jserver/datapack/quests/Q00340_SubjugationOfLizardmen/Q00340_SubjugationOfLizardmen.java index b5ce0d80f0..baae9e308e 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00340_SubjugationOfLizardmen/Q00340_SubjugationOfLizardmen.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00340_SubjugationOfLizardmen/Q00340_SubjugationOfLizardmen.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.util.Util; * Subjugation Of Lizardmen (340) * @author ivantotov */ -public final class Q00340_SubjugationOfLizardmen extends Quest -{ +public final class Q00340_SubjugationOfLizardmen extends Quest { // NPCs private static final int HIGH_PRIESTESS_LEVIAN = 30037; private static final int PRIEST_ADONIUS = 30375; @@ -53,8 +52,7 @@ public final class Q00340_SubjugationOfLizardmen extends Quest // Misc private static final int MIN_LEVEL = 17; - public Q00340_SubjugationOfLizardmen() - { + public Q00340_SubjugationOfLizardmen() { super(340, Q00340_SubjugationOfLizardmen.class.getSimpleName(), "Subjugation Of Lizardmen"); addStartNpc(GUARD_WEISZ); addTalkId(GUARD_WEISZ, HIGH_PRIESTESS_LEVIAN, PRIEST_ADONIUS, CHEST_OF_BIFRONS); @@ -63,21 +61,16 @@ public final class Q00340_SubjugationOfLizardmen extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "30385-03.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "30385-03.htm": { + if (qs.isCreated()) { qs.startQuest(); qs.setMemoState(1); htmltext = event; @@ -85,23 +78,19 @@ public final class Q00340_SubjugationOfLizardmen extends Quest break; } case "30385-04.html": - case "30385-08.html": - { + case "30385-08.html": { htmltext = event; break; } - case "30385-07.html": - { + case "30385-07.html": { takeItems(player, TRADE_CARGO, -1); qs.setMemoState(2); qs.setCond(2, true); htmltext = event; break; } - case "30385-09.html": - { - if (getQuestItemsCount(player, TRADE_CARGO) >= 30) - { + case "30385-09.html": { + if (getQuestItemsCount(player, TRADE_CARGO) >= 30) { giveAdena(player, 4090, true); takeItems(player, TRADE_CARGO, -1); qs.setMemoState(1); @@ -109,10 +98,8 @@ public final class Q00340_SubjugationOfLizardmen extends Quest } break; } - case "30385-10.html": - { - if (getQuestItemsCount(player, TRADE_CARGO) >= 30) - { + case "30385-10.html": { + if (getQuestItemsCount(player, TRADE_CARGO) >= 30) { giveAdena(player, 4090, true); takeItems(player, TRADE_CARGO, -1); qs.exitQuest(false, true); @@ -120,31 +107,25 @@ public final class Q00340_SubjugationOfLizardmen extends Quest } break; } - case "30037-02.html": - { + case "30037-02.html": { qs.setMemoState(5); qs.setCond(5, true); htmltext = event; break; } - case "30375-02.html": - { + case "30375-02.html": { qs.setMemoState(3); qs.setCond(3, true); htmltext = event; break; } - case "30989-02.html": - { - if (qs.isMemoState(5)) - { + case "30989-02.html": { + if (qs.isMemoState(5)) { qs.setMemoState(6); qs.setCond(6, true); giveItems(player, SINISTER_TOTEM, 1); htmltext = event; - } - else - { + } else { htmltext = "30989-03.html"; } break; @@ -154,41 +135,29 @@ public final class Q00340_SubjugationOfLizardmen extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { case FELIM_LIZARDMAN: - case FELIM_LIZARDMAN_SCOUT: - { - if (qs.isMemoState(1)) - { + case FELIM_LIZARDMAN_SCOUT: { + if (qs.isMemoState(1)) { giveItemRandomly(killer, npc, TRADE_CARGO, 1, 30, 0.63, true); } break; } - case FELIM_LIZARDMAN_WARRIOR: - { - if (qs.isMemoState(1)) - { + case FELIM_LIZARDMAN_WARRIOR: { + if (qs.isMemoState(1)) { giveItemRandomly(killer, npc, TRADE_CARGO, 1, 30, 0.68, true); } break; } - case LANGK_LIZARDMAN_WARRIOR: - { - if (qs.isMemoState(3)) - { - if (!hasQuestItems(killer, AGNESS_HOLY_SYMBOL) && (getRandom(100) <= 19)) - { + case LANGK_LIZARDMAN_WARRIOR: { + if (qs.isMemoState(3)) { + if (!hasQuestItems(killer, AGNESS_HOLY_SYMBOL) && (getRandom(100) <= 19)) { giveItems(killer, AGNESS_HOLY_SYMBOL, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); - } - else if (hasQuestItems(killer, AGNESS_HOLY_SYMBOL) && !hasQuestItems(killer, AGNESS_ROSARY) && (getRandom(100) <= 18)) - { + } else if (hasQuestItems(killer, AGNESS_HOLY_SYMBOL) && !hasQuestItems(killer, AGNESS_ROSARY) && (getRandom(100) <= 18)) { giveItems(killer, AGNESS_ROSARY, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -196,25 +165,19 @@ public final class Q00340_SubjugationOfLizardmen extends Quest break; } case LANGK_LIZARDMAN_SCOUT: - case LANGK_LIZARDMAN: - { - if (qs.isMemoState(3)) - { - if (!hasQuestItems(killer, AGNESS_HOLY_SYMBOL) && (getRandom(100) <= 18)) - { + case LANGK_LIZARDMAN: { + if (qs.isMemoState(3)) { + if (!hasQuestItems(killer, AGNESS_HOLY_SYMBOL) && (getRandom(100) <= 18)) { giveItems(killer, AGNESS_HOLY_SYMBOL, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); - } - else if (hasQuestItems(killer, AGNESS_HOLY_SYMBOL) && !hasQuestItems(killer, AGNESS_ROSARY) && (getRandom(100) <= 18)) - { + } else if (hasQuestItems(killer, AGNESS_HOLY_SYMBOL) && !hasQuestItems(killer, AGNESS_ROSARY) && (getRandom(100) <= 18)) { giveItems(killer, AGNESS_ROSARY, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case SERPENT_DEMON_BIFRONS: - { + case SERPENT_DEMON_BIFRONS: { addSpawn(CHEST_OF_BIFRONS, npc, true, 30000); break; } @@ -224,119 +187,78 @@ public final class Q00340_SubjugationOfLizardmen extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); final int memoState = qs.getMemoState(); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == GUARD_WEISZ) - { + if (qs.isCreated()) { + if (npc.getId() == GUARD_WEISZ) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "30385-02.htm" : "30385-01.htm"; } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case GUARD_WEISZ: - { - if (memoState == 1) - { - if (getQuestItemsCount(player, TRADE_CARGO) < 30) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case GUARD_WEISZ: { + if (memoState == 1) { + if (getQuestItemsCount(player, TRADE_CARGO) < 30) { htmltext = "30385-05.html"; - } - else - { + } else { htmltext = "30385-06.html"; } - } - else if (memoState == 2) - { + } else if (memoState == 2) { htmltext = "30385-11.html"; - } - else if ((memoState >= 3) && (memoState < 7)) - { + } else if ((memoState >= 3) && (memoState < 7)) { htmltext = "30385-12.html"; - } - else if (memoState == 7) - { + } else if (memoState == 7) { giveAdena(player, 14700, true); qs.exitQuest(false, true); htmltext = "30385-13.html"; } break; } - case HIGH_PRIESTESS_LEVIAN: - { - if (memoState == 4) - { + case HIGH_PRIESTESS_LEVIAN: { + if (memoState == 4) { htmltext = "30037-01.html"; - } - else if (memoState == 5) - { + } else if (memoState == 5) { htmltext = "30037-03.html"; - } - else if (memoState == 6) - { + } else if (memoState == 6) { takeItems(player, SINISTER_TOTEM, 1); qs.setMemoState(7); qs.setCond(7, true); htmltext = "30037-04.html"; - } - else if (memoState == 7) - { + } else if (memoState == 7) { htmltext = "30037-05.html"; } break; } - case PRIEST_ADONIUS: - { - if (memoState == 2) - { + case PRIEST_ADONIUS: { + if (memoState == 2) { htmltext = "30375-01.html"; - } - else if (memoState == 3) - { - if (hasQuestItems(player, AGNESS_HOLY_SYMBOL, AGNESS_ROSARY)) - { + } else if (memoState == 3) { + if (hasQuestItems(player, AGNESS_HOLY_SYMBOL, AGNESS_ROSARY)) { takeItems(player, AGNESS_HOLY_SYMBOL, 1); takeItems(player, AGNESS_ROSARY, 1); qs.setMemoState(4); qs.setCond(4, true); htmltext = "30375-04.html"; - } - else - { + } else { htmltext = "30375-03.html"; } - } - else if (memoState == 4) - { + } else if (memoState == 4) { htmltext = "30375-05.html"; - } - else if (memoState >= 5) - { + } else if (memoState >= 5) { htmltext = "30375-06.html"; } break; } - case CHEST_OF_BIFRONS: - { - if (memoState == 5) - { + case CHEST_OF_BIFRONS: { + if (memoState == 5) { htmltext = "30989-01.html"; } break; } } - } - else if (qs.isCompleted()) - { - if (npc.getId() == GUARD_WEISZ) - { + } else if (qs.isCompleted()) { + if (npc.getId() == GUARD_WEISZ) { htmltext = getAlreadyCompletedMsg(player); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00341_HuntingForWildBeasts/Q00341_HuntingForWildBeasts.java b/src/main/java/com/l2jserver/datapack/quests/Q00341_HuntingForWildBeasts/Q00341_HuntingForWildBeasts.java index 58486438f2..c41490e184 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00341_HuntingForWildBeasts/Q00341_HuntingForWildBeasts.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00341_HuntingForWildBeasts/Q00341_HuntingForWildBeasts.java @@ -32,14 +32,12 @@ import com.l2jserver.gameserver.model.quest.State; * Hunting for Wild Beasts (341) * @author xban1x */ -public class Q00341_HuntingForWildBeasts extends Quest -{ +public class Q00341_HuntingForWildBeasts extends Quest { // NPCs private static final int PANO = 30078; // Monsters private static final Map<Integer, Integer> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(20203, 99); MONSTERS.put(20310, 87); MONSTERS.put(20021, 83); @@ -52,8 +50,7 @@ public class Q00341_HuntingForWildBeasts extends Quest private static final int ADENA_COUNT = 3710; private static final int REQUIRED_COUNT = 20; - public Q00341_HuntingForWildBeasts() - { + public Q00341_HuntingForWildBeasts() { super(341, Q00341_HuntingForWildBeasts.class.getSimpleName(), "Hunting for Wild Beasts"); addStartNpc(PANO); addTalkId(PANO); @@ -62,21 +59,16 @@ public class Q00341_HuntingForWildBeasts extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st != null) - { - switch (event) - { - case "30078-03.htm": - { + if (st != null) { + switch (event) { + case "30078-03.htm": { htmltext = event; break; } - case "30078-04.htm": - { + case "30078-04.htm": { st.startQuest(); htmltext = event; break; @@ -87,27 +79,20 @@ public class Q00341_HuntingForWildBeasts extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (qs.getState()) - { - case State.CREATED: - { + switch (qs.getState()) { + case State.CREATED: { htmltext = player.getLevel() >= MIN_LVL ? "30078-01.html" : "30078-02.htm"; break; } - case State.STARTED: - { - if (qs.isCond(2) && (qs.getQuestItemsCount(BEAR_SKIN) >= REQUIRED_COUNT)) - { + case State.STARTED: { + if (qs.isCond(2) && (qs.getQuestItemsCount(BEAR_SKIN) >= REQUIRED_COUNT)) { qs.giveAdena(ADENA_COUNT, true); qs.exitQuest(true, true); htmltext = "30078-05.html"; - } - else - { + } else { htmltext = "30078-06.html"; } break; @@ -117,23 +102,16 @@ public class Q00341_HuntingForWildBeasts extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isCond(1)) - { + if ((st != null) && st.isCond(1)) { long skins = st.getQuestItemsCount(BEAR_SKIN); - if (skins < REQUIRED_COUNT) - { - if (getRandom(100) < MONSTERS.get(npc.getId())) - { + if (skins < REQUIRED_COUNT) { + if (getRandom(100) < MONSTERS.get(npc.getId())) { st.giveItems(BEAR_SKIN, 1); - if ((++skins) < REQUIRED_COUNT) - { + if ((++skins) < REQUIRED_COUNT) { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - } - else - { + } else { st.setCond(2, true); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00343_UnderTheShadowOfTheIvoryTower/Q00343_UnderTheShadowOfTheIvoryTower.java b/src/main/java/com/l2jserver/datapack/quests/Q00343_UnderTheShadowOfTheIvoryTower/Q00343_UnderTheShadowOfTheIvoryTower.java index eaa95ba7af..c454fa45d0 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00343_UnderTheShadowOfTheIvoryTower/Q00343_UnderTheShadowOfTheIvoryTower.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00343_UnderTheShadowOfTheIvoryTower/Q00343_UnderTheShadowOfTheIvoryTower.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.util.Util; * Under The Shadow Of The Ivory Tower (343) * @author ivantotov */ -public final class Q00343_UnderTheShadowOfTheIvoryTower extends Quest -{ +public final class Q00343_UnderTheShadowOfTheIvoryTower extends Quest { // NPCs private static final int MAGIC_TRADER_CEMA = 30834; private static final int LICH_KING_ICARUS = 30835; @@ -60,8 +59,7 @@ public final class Q00343_UnderTheShadowOfTheIvoryTower extends Quest // Misc private static final int MIN_LEVEL = 40; - public Q00343_UnderTheShadowOfTheIvoryTower() - { + public Q00343_UnderTheShadowOfTheIvoryTower() { super(343, Q00343_UnderTheShadowOfTheIvoryTower.class.getSimpleName(), "Under The Shadow Of The Ivory Tower"); addStartNpc(MAGIC_TRADER_CEMA); addTalkId(MAGIC_TRADER_CEMA, LICH_KING_ICARUS, COLLECTOR_MARSHA, COLLECTOR_TRUMPIN); @@ -69,21 +67,16 @@ public final class Q00343_UnderTheShadowOfTheIvoryTower extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "30834-05.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "30834-05.htm": { + if (qs.isCreated()) { qs.setMemoState(1); qs.setMemoStateEx(1, 0); qs.startQuest(); @@ -91,86 +84,54 @@ public final class Q00343_UnderTheShadowOfTheIvoryTower extends Quest } break; } - case "30834-04.htm": - { - if (player.isInCategory(CategoryType.WIZARD_GROUP) && (player.getLevel() >= MIN_LEVEL)) - { + case "30834-04.htm": { + if (player.isInCategory(CategoryType.WIZARD_GROUP) && (player.getLevel() >= MIN_LEVEL)) { htmltext = event; } break; } - case "30834-08.html": - { - if (hasQuestItems(player, NEBULITE_ORB)) - { + case "30834-08.html": { + if (hasQuestItems(player, NEBULITE_ORB)) { giveAdena(player, (getQuestItemsCount(player, NEBULITE_ORB) * 120), true); takeItems(player, NEBULITE_ORB, -1); htmltext = event; - } - else - { + } else { htmltext = "30834-08a.html"; } break; } - case "30834-11.html": - { + case "30834-11.html": { qs.exitQuest(true, true); htmltext = event; break; } - case "30835-02.html": - { - if (!hasQuestItems(player, ECTOPLASM_LIQUEUR)) - { + case "30835-02.html": { + if (!hasQuestItems(player, ECTOPLASM_LIQUEUR)) { htmltext = event; - } - else - { + } else { final int chance = getRandom(1000); - if (chance <= 119) - { + if (chance <= 119) { giveItems(player, SCROLL_ENCHANT_WEAPON_D_GRADE, 1); - } - else if (chance <= 169) - { + } else if (chance <= 169) { giveItems(player, SCROLL_ENCHANT_WEAPON_C_GRADE, 1); - } - else if (chance <= 329) - { + } else if (chance <= 329) { giveItems(player, SPIRITSHOT_C_GRADE, getRandom(200) + 401); - } - else if (chance <= 559) - { + } else if (chance <= 559) { giveItems(player, SPIRITSHOT_D_GRADE, getRandom(200) + 401); - } - else if (chance <= 561) - { + } else if (chance <= 561) { giveItems(player, SAGES_BLOOD, 1); - } - else if (chance <= 578) - { + } else if (chance <= 578) { giveItems(player, SQUARE_SHIELD, 1); - } - else if (chance <= 579) - { + } else if (chance <= 579) { giveItems(player, NICKLACE_OF_MAGIC, 1); - } - else if (chance <= 581) - { + } else if (chance <= 581) { giveItems(player, RING_OF_AGES, 1); - } - else if (chance <= 582) - { + } else if (chance <= 582) { giveItems(player, TOWER_SHIELD, 1); - } - else if (chance <= 584) - { + } else if (chance <= 584) { giveItems(player, NICKLACE_OF_MERMAID, 1); - } - else - { + } else { giveItems(player, SCROLL_OF_ESCAPE, 1); } @@ -179,20 +140,13 @@ public final class Q00343_UnderTheShadowOfTheIvoryTower extends Quest } break; } - case "30934-05.html": - { - if (qs.isMemoState(1)) - { - if (qs.getMemoStateEx(1) >= 25) - { + case "30934-05.html": { + if (qs.isMemoState(1)) { + if (qs.getMemoStateEx(1) >= 25) { htmltext = event; - } - else if ((qs.getMemoStateEx(1) >= 1) && (qs.getMemoStateEx(1) < 25) && (getQuestItemsCount(player, NEBULITE_ORB) < 10)) - { + } else if ((qs.getMemoStateEx(1) >= 1) && (qs.getMemoStateEx(1) < 25) && (getQuestItemsCount(player, NEBULITE_ORB) < 10)) { htmltext = "30934-06.html"; - } - else if ((qs.getMemoStateEx(1) >= 1) && (qs.getMemoStateEx(1) < 25) && (getQuestItemsCount(player, NEBULITE_ORB) > 10)) - { + } else if ((qs.getMemoStateEx(1) >= 1) && (qs.getMemoStateEx(1) < 25) && (getQuestItemsCount(player, NEBULITE_ORB) > 10)) { qs.setMemoState(2); takeItems(player, NEBULITE_ORB, 10); htmltext = "30934-07.html"; @@ -200,89 +154,58 @@ public final class Q00343_UnderTheShadowOfTheIvoryTower extends Quest } break; } - case "30934-08a.html": - { - if (qs.isMemoState(2)) - { + case "30934-08a.html": { + if (qs.isMemoState(2)) { final int i0 = getRandom(100); final int i1 = getRandom(3); - if ((i0 < 20) && (i1 == 0)) - { + if ((i0 < 20) && (i1 == 0)) { qs.setMemoStateEx(1, qs.getMemoStateEx(1) + 4); qs.set("param1", 0); htmltext = event; - } - else if ((i0 < 20) && (i1 == 1)) - { + } else if ((i0 < 20) && (i1 == 1)) { qs.set("param1", 1); htmltext = "30934-08b.html"; - } - else if ((i0 < 20) && (i1 == 2)) - { + } else if ((i0 < 20) && (i1 == 2)) { qs.set("param1", 2); htmltext = "30934-08c.html"; - } - else if ((i0 >= 20) && (i0 < 50) && (i1 == 0)) - { - if (getRandom(2) == 0) - { + } else if ((i0 >= 20) && (i0 < 50) && (i1 == 0)) { + if (getRandom(2) == 0) { qs.set("param1", 0); - } - else - { + } else { qs.set("param1", 1); } htmltext = "30934-09a.html"; - } - else if ((i0 >= 20) && (i0 < 50) && (i1 == 1)) - { - if (getRandom(2) == 0) - { + } else if ((i0 >= 20) && (i0 < 50) && (i1 == 1)) { + if (getRandom(2) == 0) { qs.set("param1", 1); - } - else - { + } else { qs.set("param1", 2); } htmltext = "30934-09b.html"; - } - else if ((i0 >= 20) && (i0 < 50) && (i1 == 2)) - { - if (getRandom(2) == 0) - { + } else if ((i0 >= 20) && (i0 < 50) && (i1 == 2)) { + if (getRandom(2) == 0) { qs.set("param1", 2); - } - else - { + } else { qs.set("param1", 0); } htmltext = "30934-09c.html"; - } - else - { + } else { qs.set("param1", getRandom(3)); htmltext = "30934-10.html"; } } break; } - case "30934-11a.html": - { - if (qs.isMemoState(2)) - { - if (qs.getInt("param1") == 0) - { + case "30934-11a.html": { + if (qs.isMemoState(2)) { + if (qs.getInt("param1") == 0) { giveItems(player, NEBULITE_ORB, 10); qs.set("param1", 4); htmltext = event; - } - else if (qs.getInt("param1") == 1) - { + } else if (qs.getInt("param1") == 1) { htmltext = "30934-11b.html"; - } - else if (qs.getInt("param1") == 2) - { + } else if (qs.getInt("param1") == 2) { giveItems(player, NEBULITE_ORB, 20); qs.set("param1", 4); htmltext = "30934-11c.html"; @@ -291,46 +214,32 @@ public final class Q00343_UnderTheShadowOfTheIvoryTower extends Quest } break; } - case "30934-12a.html": - { - if (qs.isMemoState(2)) - { - if (qs.getInt("param1") == 0) - { + case "30934-12a.html": { + if (qs.isMemoState(2)) { + if (qs.getInt("param1") == 0) { giveItems(player, NEBULITE_ORB, 20); qs.set("param1", 4); htmltext = event; - } - else if (qs.getInt("param1") == 1) - { + } else if (qs.getInt("param1") == 1) { giveItems(player, NEBULITE_ORB, 10); qs.set("param1", 4); htmltext = "30934-12b.html"; - } - else if (qs.getInt("param1") == 2) - { + } else if (qs.getInt("param1") == 2) { htmltext = "30934-12c.html"; } qs.setMemoState(1); } break; } - case "30934-13a.html": - { - if (qs.isMemoState(2)) - { - if (qs.getInt("param1") == 0) - { + case "30934-13a.html": { + if (qs.isMemoState(2)) { + if (qs.getInt("param1") == 0) { htmltext = event; - } - else if (qs.getInt("param1") == 1) - { + } else if (qs.getInt("param1") == 1) { giveItems(player, NEBULITE_ORB, 20); qs.set("param1", 4); htmltext = "30934-13b.html"; - } - else if (qs.getInt("param1") == 2) - { + } else if (qs.getInt("param1") == 2) { giveItems(player, NEBULITE_ORB, 10); qs.set("param1", 4); htmltext = "30934-13c.html"; @@ -339,136 +248,96 @@ public final class Q00343_UnderTheShadowOfTheIvoryTower extends Quest } break; } - case "30935-03.html": - { - if (getQuestItemsCount(player, NEBULITE_ORB) < 10) - { + case "30935-03.html": { + if (getQuestItemsCount(player, NEBULITE_ORB) < 10) { htmltext = event; - } - else - { + } else { qs.set("param2", getRandom(2)); htmltext = "30935-04.html"; } break; } - case "30935-05.html": - { - if ((qs.getInt("param1") == 0) && (qs.getInt("param2") == 0) && (qs.getQuestItemsCount(NEBULITE_ORB) >= 10)) - { + case "30935-05.html": { + if ((qs.getInt("param1") == 0) && (qs.getInt("param2") == 0) && (qs.getQuestItemsCount(NEBULITE_ORB) >= 10)) { qs.set("param1", 1); qs.set("param2", 2); htmltext = event; - } - else if ((qs.getInt("param1") == 1) && (qs.getInt("param2") == 0) && (qs.getQuestItemsCount(NEBULITE_ORB) >= 10)) - { + } else if ((qs.getInt("param1") == 1) && (qs.getInt("param2") == 0) && (qs.getQuestItemsCount(NEBULITE_ORB) >= 10)) { qs.set("param1", 2); qs.set("param2", 2); htmltext = "30935-05a.html"; - } - else if ((qs.getInt("param1") == 2) && (qs.getInt("param2") == 0) && (qs.getQuestItemsCount(NEBULITE_ORB) >= 10)) - { + } else if ((qs.getInt("param1") == 2) && (qs.getInt("param2") == 0) && (qs.getQuestItemsCount(NEBULITE_ORB) >= 10)) { qs.set("param1", 3); qs.set("param2", 2); htmltext = "30935-05b.html"; - } - else if ((qs.getInt("param1") == 3) && (qs.getInt("param2") == 0) && (qs.getQuestItemsCount(NEBULITE_ORB) >= 10)) - { + } else if ((qs.getInt("param1") == 3) && (qs.getInt("param2") == 0) && (qs.getQuestItemsCount(NEBULITE_ORB) >= 10)) { qs.set("param1", 4); qs.set("param2", 2); htmltext = "30935-05c.html"; - } - else if ((qs.getInt("param1") == 4) && (qs.getInt("param2") == 0) && (qs.getQuestItemsCount(NEBULITE_ORB) >= 10)) - { + } else if ((qs.getInt("param1") == 4) && (qs.getInt("param2") == 0) && (qs.getQuestItemsCount(NEBULITE_ORB) >= 10)) { qs.set("param1", 0); qs.set("param2", 2); giveItems(player, NEBULITE_ORB, 310); htmltext = "30935-05d.html"; - } - else if ((qs.getInt("param2") == 1) && (qs.getQuestItemsCount(NEBULITE_ORB) >= 10)) - { + } else if ((qs.getInt("param2") == 1) && (qs.getQuestItemsCount(NEBULITE_ORB) >= 10)) { takeItems(player, NEBULITE_ORB, 10); qs.set("param1", 0); qs.set("param2", 2); htmltext = "30935-06.html"; - } - else if (qs.getQuestItemsCount(NEBULITE_ORB) < 10) - { + } else if (qs.getQuestItemsCount(NEBULITE_ORB) < 10) { htmltext = "30935-03.html"; } break; } - case "30935-07.html": - { - if ((qs.getInt("param2") == 0) && (qs.getQuestItemsCount(NEBULITE_ORB) >= 10)) - { + case "30935-07.html": { + if ((qs.getInt("param2") == 0) && (qs.getQuestItemsCount(NEBULITE_ORB) >= 10)) { takeItems(player, NEBULITE_ORB, 10); qs.set("param1", 0); qs.set("param2", 2); htmltext = event; - } - else if ((qs.getInt("param1") == 0) && (qs.getInt("param2") == 1) && (qs.getQuestItemsCount(NEBULITE_ORB) >= 10)) - { + } else if ((qs.getInt("param1") == 0) && (qs.getInt("param2") == 1) && (qs.getQuestItemsCount(NEBULITE_ORB) >= 10)) { qs.set("param1", 1); qs.set("param2", 2); htmltext = "30935-08.html"; - } - else if ((qs.getInt("param1") == 1) && (qs.getInt("param2") == 1) && (qs.getQuestItemsCount(NEBULITE_ORB) >= 10)) - { + } else if ((qs.getInt("param1") == 1) && (qs.getInt("param2") == 1) && (qs.getQuestItemsCount(NEBULITE_ORB) >= 10)) { qs.set("param1", 2); qs.set("param2", 2); htmltext = "30935-08a.html"; - } - else if ((qs.getInt("param1") == 2) && (qs.getInt("param2") == 1) && (qs.getQuestItemsCount(NEBULITE_ORB) >= 10)) - { + } else if ((qs.getInt("param1") == 2) && (qs.getInt("param2") == 1) && (qs.getQuestItemsCount(NEBULITE_ORB) >= 10)) { qs.set("param1", 3); qs.set("param2", 2); htmltext = "30935-08b.html"; - } - else if ((qs.getInt("param1") == 3) && (qs.getInt("param2") == 1) && (qs.getQuestItemsCount(NEBULITE_ORB) >= 10)) - { + } else if ((qs.getInt("param1") == 3) && (qs.getInt("param2") == 1) && (qs.getQuestItemsCount(NEBULITE_ORB) >= 10)) { qs.set("param1", 4); qs.set("param2", 2); htmltext = "30935-08c.html"; - } - else if ((qs.getInt("param1") == 4) && (qs.getInt("param2") == 1) && (qs.getQuestItemsCount(NEBULITE_ORB) >= 10)) - { + } else if ((qs.getInt("param1") == 4) && (qs.getInt("param2") == 1) && (qs.getQuestItemsCount(NEBULITE_ORB) >= 10)) { qs.set("param1", 0); qs.set("param2", 2); giveItems(player, NEBULITE_ORB, 310); htmltext = "30935-08d.html"; - } - else if (qs.getQuestItemsCount(NEBULITE_ORB) < 10) - { + } else if (qs.getQuestItemsCount(NEBULITE_ORB) < 10) { htmltext = "30935-03.html"; } break; } - case "30935-09.html": - { - if (qs.getInt("param1") == 1) - { + case "30935-09.html": { + if (qs.getInt("param1") == 1) { qs.set("param1", 0); qs.set("param2", 2); giveItems(player, NEBULITE_ORB, 10); htmltext = event; - } - else if (qs.getInt("param1") == 2) - { + } else if (qs.getInt("param1") == 2) { qs.set("param1", 0); qs.set("param2", 2); giveItems(player, NEBULITE_ORB, 30); htmltext = "30935-09a.html"; - } - else if (qs.getInt("param1") == 3) - { + } else if (qs.getInt("param1") == 3) { qs.set("param1", 0); qs.set("param2", 2); giveItems(player, NEBULITE_ORB, 70); htmltext = "30935-09b.html"; - } - else if (qs.getInt("param1") == 4) - { + } else if (qs.getInt("param1") == 4) { qs.set("param1", 0); qs.set("param2", 2); giveItems(player, NEBULITE_ORB, 150); @@ -476,8 +345,7 @@ public final class Q00343_UnderTheShadowOfTheIvoryTower extends Quest } break; } - case "30935-10.html": - { + case "30935-10.html": { qs.set("param1", 0); qs.set("param2", 2); htmltext = event; @@ -495,8 +363,7 @@ public final class Q00343_UnderTheShadowOfTheIvoryTower extends Quest case "30934-03a.html": case "30935-01.html": case "30935-01a.html": - case "30935-01b.html": - { + case "30935-01b.html": { htmltext = event; break; } @@ -505,60 +372,45 @@ public final class Q00343_UnderTheShadowOfTheIvoryTower extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { case MANASHEN_GARGOYLE: - case ENCHANTED_MONSTEREYE: - { - if (getRandom(100) < 63) - { + case ENCHANTED_MONSTEREYE: { + if (getRandom(100) < 63) { giveItems(killer, NEBULITE_ORB, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } - if (qs.getMemoStateEx(1) > 1) - { - if (getRandom(100) <= 12) - { + if (qs.getMemoStateEx(1) > 1) { + if (getRandom(100) <= 12) { qs.setMemoStateEx(1, qs.getMemoStateEx(1) - 1); } } break; } - case ENCHANTED_STONE_GOLEM: - { - if (getRandom(100) < 65) - { + case ENCHANTED_STONE_GOLEM: { + if (getRandom(100) < 65) { giveItems(killer, NEBULITE_ORB, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } - if (qs.getMemoStateEx(1) > 1) - { - if (getRandom(100) <= 12) - { + if (qs.getMemoStateEx(1) > 1) { + if (getRandom(100) <= 12) { qs.setMemoStateEx(1, qs.getMemoStateEx(1) - 1); } } break; } - case ENCHANTED_IRON_GOLEM: - { - if (getRandom(100) < 68) - { + case ENCHANTED_IRON_GOLEM: { + if (getRandom(100) < 68) { giveItems(killer, NEBULITE_ORB, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } - if (qs.getMemoStateEx(1) > 1) - { - if (getRandom(100) <= 13) - { + if (qs.getMemoStateEx(1) > 1) { + if (getRandom(100) <= 13) { qs.setMemoStateEx(1, qs.getMemoStateEx(1) - 1); } } @@ -570,68 +422,46 @@ public final class Q00343_UnderTheShadowOfTheIvoryTower extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == MAGIC_TRADER_CEMA) - { - if (player.isInCategory(CategoryType.WIZARD_GROUP)) - { - if (player.getLevel() >= MIN_LEVEL) - { + if (qs.isCreated()) { + if (npc.getId() == MAGIC_TRADER_CEMA) { + if (player.isInCategory(CategoryType.WIZARD_GROUP)) { + if (player.getLevel() >= MIN_LEVEL) { htmltext = "30834-03.htm"; - } - else - { + } else { htmltext = "30834-02.htm"; } - } - else - { + } else { htmltext = "30834-01.htm"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case MAGIC_TRADER_CEMA: - { - if (!hasQuestItems(player, NEBULITE_ORB)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case MAGIC_TRADER_CEMA: { + if (!hasQuestItems(player, NEBULITE_ORB)) { htmltext = "30834-06.html"; - } - else - { + } else { htmltext = "30834-07.html"; } break; } - case LICH_KING_ICARUS: - { + case LICH_KING_ICARUS: { htmltext = "30835-01.html"; break; } - case COLLECTOR_MARSHA: - { - if (qs.getMemoStateEx(1) == 0) - { + case COLLECTOR_MARSHA: { + if (qs.getMemoStateEx(1) == 0) { qs.setMemoStateEx(1, 1); htmltext = "30934-03.html"; - } - else - { + } else { qs.setMemoState(1); htmltext = "30934-04.html"; } break; } - case COLLECTOR_TRUMPIN: - { + case COLLECTOR_TRUMPIN: { qs.set("param1", 0); htmltext = "30935-01.html"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java b/src/main/java/com/l2jserver/datapack/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java index 2fb2b93572..4a049b18c5 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * 1000 years, the End of Lamentation (344) * @author Pandragon */ -public final class Q00344_1000YearsTheEndOfLamentation extends Quest -{ +public final class Q00344_1000YearsTheEndOfLamentation extends Quest { // NPCs private static final int KAIEN = 30623; private static final int GARVARENTZ = 30704; @@ -75,8 +74,7 @@ public final class Q00344_1000YearsTheEndOfLamentation extends Quest // Misc private static final int MIN_LVL = 48; - public Q00344_1000YearsTheEndOfLamentation() - { + public Q00344_1000YearsTheEndOfLamentation() { super(344, Q00344_1000YearsTheEndOfLamentation.class.getSimpleName(), "1000 years, the End of Lamentation"); addStartNpc(GILMORE); addTalkId(KAIEN, GARVARENTZ, GILMORE, RODEMAI, ORVEN); @@ -85,74 +83,55 @@ public final class Q00344_1000YearsTheEndOfLamentation extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { + switch (event) { case "30754-03.htm": - case "30754-16.html": - { + case "30754-16.html": { htmltext = event; break; } - case "30754-04.htm": - { - if (qs.isCreated()) - { + case "30754-04.htm": { + if (qs.isCreated()) { qs.startQuest(); htmltext = event; } break; } - case "30754-08.html": - { - if (qs.isCond(1)) - { + case "30754-08.html": { + if (qs.isCond(1)) { final long count = getQuestItemsCount(player, ARTICLES); - if (count < 1) - { + if (count < 1) { htmltext = "30754-07.html"; - } - else - { + } else { takeItems(player, ARTICLES, -1); - if (getRandom(1000) >= count) - { + if (getRandom(1000) >= count) { giveAdena(player, count * 60, true); htmltext = event; - } - else - { + } else { qs.setCond(2, true); - switch (getRandom(4)) - { - case 0: - { + switch (getRandom(4)) { + case 0: { qs.setMemoState(1); giveItems(player, OLD_HILT); break; } - case 1: - { + case 1: { qs.setMemoState(2); giveItems(player, OLD_KEY); break; } - case 2: - { + case 2: { qs.setMemoState(3); giveItems(player, TOTEM_NECKLACE); break; } - case 3: - { + case 3: { qs.setMemoState(4); giveItems(player, CRUCIFIX); break; @@ -164,36 +143,28 @@ public final class Q00344_1000YearsTheEndOfLamentation extends Quest } break; } - case "30754-17.html": - { - if (qs.isCond(1)) - { + case "30754-17.html": { + if (qs.isCond(1)) { htmltext = event; qs.exitQuest(true, true); } break; } - case "relic_info": - { - switch (qs.getMemoState()) - { - case 1: - { + case "relic_info": { + switch (qs.getMemoState()) { + case 1: { htmltext = "30754-10.html"; break; } - case 2: - { + case 2: { htmltext = "30754-11.html"; break; } - case 3: - { + case 3: { htmltext = "30754-12.html"; break; } - case 4: - { + case 4: { htmltext = "30754-13.html"; break; } @@ -205,159 +176,104 @@ public final class Q00344_1000YearsTheEndOfLamentation extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (npc.getId()) - { - case GILMORE: - { - if (qs.isCreated()) - { + switch (npc.getId()) { + case GILMORE: { + if (qs.isCreated()) { htmltext = (talker.getLevel() >= MIN_LVL) ? "30754-02.htm" : "30754-01.htm"; - } - else if (qs.isStarted()) - { - if (qs.isCond(1)) - { + } else if (qs.isStarted()) { + if (qs.isCond(1)) { htmltext = (hasQuestItems(talker, ARTICLES)) ? "30754-06.html" : "30754-05.html"; - } - else if (hasItem(talker, OLD_KEY) || hasItem(talker, OLD_HILT) || hasItem(talker, TOTEM_NECKLACE) || hasItem(talker, CRUCIFIX)) - { + } else if (hasItem(talker, OLD_KEY) || hasItem(talker, OLD_HILT) || hasItem(talker, TOTEM_NECKLACE) || hasItem(talker, CRUCIFIX)) { htmltext = "30754-14.html"; - } - else - { + } else { qs.setCond(1); htmltext = "30754-15.html"; } - } - else - { + } else { htmltext = getAlreadyCompletedMsg(talker); } break; } - case KAIEN: - { - if (qs.getMemoState() == 1) - { - if (hasItem(talker, OLD_HILT)) - { + case KAIEN: { + if (qs.getMemoState() == 1) { + if (hasItem(talker, OLD_HILT)) { takeItems(talker, OLD_HILT.getId(), -1); final int rand = getRandom(100); - if (rand <= 52) - { + if (rand <= 52) { rewardItems(talker, ORIHARUKON_ORE); - } - else if (rand <= 76) - { + } else if (rand <= 76) { rewardItems(talker, VARNISH_OF_PURITY); - } - else if (rand <= 98) - { + } else if (rand <= 98) { rewardItems(talker, SCROLL_EWC); - } - else - { + } else { rewardItems(talker, RAID_SWORD); } qs.setCond(1); htmltext = "30623-01.html"; - } - else - { + } else { htmltext = "30623-02.html"; } } break; } - case RODEMAI: - { - if (qs.getMemoState() == 2) - { - if (hasItem(talker, OLD_KEY)) - { + case RODEMAI: { + if (qs.getMemoState() == 2) { + if (hasItem(talker, OLD_KEY)) { takeItems(talker, OLD_KEY.getId(), -1); final int rand = getRandom(100); - if (rand <= 39) - { + if (rand <= 39) { rewardItems(talker, COKES); - } - else if (rand <= 89) - { + } else if (rand <= 89) { rewardItems(talker, SCROLL_EWC); - } - else - { + } else { rewardItems(talker, RING_OF_AGES); } qs.setCond(1); htmltext = "30756-01.html"; - } - else - { + } else { htmltext = "30756-02.html"; } } break; } - case GARVARENTZ: - { - if (qs.getMemoState() == 3) - { - if (hasItem(talker, TOTEM_NECKLACE)) - { + case GARVARENTZ: { + if (qs.getMemoState() == 3) { + if (hasItem(talker, TOTEM_NECKLACE)) { takeItems(talker, TOTEM_NECKLACE.getId(), -1); final int rand = getRandom(100); - if (rand <= 47) - { + if (rand <= 47) { rewardItems(talker, LEATHER); - } - else if (rand <= 97) - { + } else if (rand <= 97) { rewardItems(talker, COARSE_BONE_POWDER); - } - else - { + } else { rewardItems(talker, HEAVY_DOOM_HAMMER); } qs.setCond(1); htmltext = "30704-01.html"; - } - else - { + } else { htmltext = "30704-02.html"; } } break; } - case ORVEN: - { - if (qs.getMemoState() == 4) - { - if (hasItem(talker, CRUCIFIX)) - { + case ORVEN: { + if (qs.getMemoState() == 4) { + if (hasItem(talker, CRUCIFIX)) { takeItems(talker, CRUCIFIX.getId(), -1); final int rand = getRandom(100); - if (rand <= 49) - { + if (rand <= 49) { rewardItems(talker, STONE_OF_PURITY); - } - else if (rand <= 69) - { + } else if (rand <= 69) { rewardItems(talker, SCROLL_EAC); - } - else - { + } else { rewardItems(talker, DRAKE_LEATHER_BOOTS); } qs.setCond(1); htmltext = "30857-01.html"; - } - else - { + } else { htmltext = "30857-02.html"; } } @@ -368,11 +284,9 @@ public final class Q00344_1000YearsTheEndOfLamentation extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc); - if (qs != null) - { + if (qs != null) { giveItemRandomly(qs.getPlayer(), npc, ARTICLES, 1, 0, MONSTER_CHANCES.get(npc.getId()), true); } return super.onKill(npc, killer, isSummon); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00345_MethodToRaiseTheDead/Q00345_MethodToRaiseTheDead.java b/src/main/java/com/l2jserver/datapack/quests/Q00345_MethodToRaiseTheDead/Q00345_MethodToRaiseTheDead.java index ad0c998713..e55a710a30 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00345_MethodToRaiseTheDead/Q00345_MethodToRaiseTheDead.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00345_MethodToRaiseTheDead/Q00345_MethodToRaiseTheDead.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.util.Util; * Method to Raise the Dead (345) * @author Adry_85 */ -public final class Q00345_MethodToRaiseTheDead extends Quest -{ +public final class Q00345_MethodToRaiseTheDead extends Quest { // NPCs private static final int XENOVIA = 30912; private static final int DOROTHY = 30970; @@ -53,8 +52,7 @@ public final class Q00345_MethodToRaiseTheDead extends Quest private static final int CROKIAN = 20789; private static final int CROKIAN_WARRIOR = 20791; - public Q00345_MethodToRaiseTheDead() - { + public Q00345_MethodToRaiseTheDead() { super(345, Q00345_MethodToRaiseTheDead.class.getSimpleName(), "Method to Raise the Dead"); addStartNpc(DOROTHY); addTalkId(DOROTHY, ORPHEUS, MEDIUM_JAR, XENOVIA); @@ -63,33 +61,26 @@ public final class Q00345_MethodToRaiseTheDead extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "30970-02.htm": - { + switch (event) { + case "30970-02.htm": { qs.startQuest(); htmltext = event; break; } - case "30970-03.html": - { + case "30970-03.html": { qs.setMemoState(1); htmltext = event; break; } - case "30970-07.html": - { - if (hasQuestItems(player, VICTIMS_ARM_BONE, VICTIMS_THIGH_BONE, VICTIMS_SKULL, VICTIMS_RIB_BONE, VICTIMS_SPINE)) - { + case "30970-07.html": { + if (hasQuestItems(player, VICTIMS_ARM_BONE, VICTIMS_THIGH_BONE, VICTIMS_SKULL, VICTIMS_RIB_BONE, VICTIMS_SPINE)) { qs.setMemoState(2); qs.setCond(2, true); htmltext = event; @@ -97,93 +88,71 @@ public final class Q00345_MethodToRaiseTheDead extends Quest break; } case "30971-02.html": - case "30912-05.html": - { + case "30912-05.html": { htmltext = event; break; } - case "30971-03.html": - { + case "30971-03.html": { final long uselessBonePiecesCount = getQuestItemsCount(player, USELESS_BONE_PIECES); - if (uselessBonePiecesCount > 0) - { + if (uselessBonePiecesCount > 0) { giveAdena(player, uselessBonePiecesCount * 104, true); takeItems(player, USELESS_BONE_PIECES, -1); htmltext = event; } break; } - case "30973-02.html": - { + case "30973-02.html": { final int memoStateEx = qs.getMemoStateEx(1); - if (memoStateEx == 1) - { + if (memoStateEx == 1) { htmltext = event; - } - else if (memoStateEx == 2) - { + } else if (memoStateEx == 2) { htmltext = "30973-04.html"; - } - else if (memoStateEx == 3) - { + } else if (memoStateEx == 3) { htmltext = "30973-06.html"; } break; } - case "30973-03.html": - { - if (qs.isMemoState(7) && (qs.getMemoStateEx(1) == 1)) - { + case "30973-03.html": { + if (qs.isMemoState(7) && (qs.getMemoStateEx(1) == 1)) { qs.setMemoState(8); qs.setCond(6, true); htmltext = event; } break; } - case "30973-05.html": - { - if (qs.isMemoState(7) && (qs.getMemoStateEx(1) == 2)) - { + case "30973-05.html": { + if (qs.isMemoState(7) && (qs.getMemoStateEx(1) == 2)) { qs.setMemoState(8); qs.setCond(6, true); htmltext = event; } break; } - case "30973-07.html": - { - if (qs.isMemoState(7) && (qs.getMemoStateEx(1) == 3)) - { + case "30973-07.html": { + if (qs.isMemoState(7) && (qs.getMemoStateEx(1) == 3)) { qs.setMemoState(8); qs.setCond(7, true); htmltext = event; } break; } - case "30912-02.html": - { - if (qs.isMemoState(2)) - { + case "30912-02.html": { + if (qs.isMemoState(2)) { htmltext = event; } break; } - case "30912-03.html": - { - if (qs.isMemoState(2)) - { - if (player.getAdena() >= 1000) - { + case "30912-03.html": { + if (qs.isMemoState(2)) { + if (player.getAdena() >= 1000) { giveItems(player, POWDER_TO_SUMMON_DEAD_SOULS, 1); takeItems(player, Inventory.ADENA_ID, 1000); qs.setMemoState(3); qs.setCond(3, true); htmltext = event; - } - else - { + } else { htmltext = "30912-04.html"; } } @@ -194,150 +163,103 @@ public final class Q00345_MethodToRaiseTheDead extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc); - if ((qs == null) || !Util.checkIfInRange(1500, npc, killer, true)) - { + if ((qs == null) || !Util.checkIfInRange(1500, npc, killer, true)) { return null; } final int random = getRandom(100); - if (random <= 5) - { - if (!hasQuestItems(qs.getPlayer(), VICTIMS_ARM_BONE)) - { + if (random <= 5) { + if (!hasQuestItems(qs.getPlayer(), VICTIMS_ARM_BONE)) { giveItems(qs.getPlayer(), VICTIMS_ARM_BONE, 1); - } - else - { + } else { giveItems(qs.getPlayer(), USELESS_BONE_PIECES, 1); } playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); - } - else if (random <= 11) - { - if (!hasQuestItems(qs.getPlayer(), VICTIMS_THIGH_BONE)) - { + } else if (random <= 11) { + if (!hasQuestItems(qs.getPlayer(), VICTIMS_THIGH_BONE)) { giveItems(qs.getPlayer(), VICTIMS_THIGH_BONE, 1); - } - else - { + } else { giveItems(qs.getPlayer(), USELESS_BONE_PIECES, 1); } playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); - } - else if (random <= 17) - { - if (!hasQuestItems(qs.getPlayer(), VICTIMS_SKULL)) - { + } else if (random <= 17) { + if (!hasQuestItems(qs.getPlayer(), VICTIMS_SKULL)) { giveItems(qs.getPlayer(), VICTIMS_SKULL, 1); - } - else - { + } else { giveItems(qs.getPlayer(), USELESS_BONE_PIECES, 1); } playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); - } - else if (random <= 23) - { - if (!hasQuestItems(qs.getPlayer(), VICTIMS_RIB_BONE)) - { + } else if (random <= 23) { + if (!hasQuestItems(qs.getPlayer(), VICTIMS_RIB_BONE)) { giveItems(qs.getPlayer(), VICTIMS_RIB_BONE, 1); - } - else - { + } else { giveItems(qs.getPlayer(), USELESS_BONE_PIECES, 1); } playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); - } - else if (random <= 29) - { - if (!hasQuestItems(qs.getPlayer(), VICTIMS_SPINE)) - { + } else if (random <= 29) { + if (!hasQuestItems(qs.getPlayer(), VICTIMS_SPINE)) { giveItems(qs.getPlayer(), VICTIMS_SPINE, 1); - } - else - { + } else { giveItems(qs.getPlayer(), USELESS_BONE_PIECES, 1); } playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); - } - else if (random <= 60) - { + } else if (random <= 60) { giveItems(qs.getPlayer(), USELESS_BONE_PIECES, 1); } return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { + if (qs.isCreated()) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "30970-01.htm" : "30970-04.htm"; - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case DOROTHY: - { - switch (qs.getMemoState()) - { - case 0: - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case DOROTHY: { + switch (qs.getMemoState()) { + case 0: { htmltext = "30970-03.html"; qs.setMemoState(1); break; } - case 1: - { + case 1: { htmltext = (!hasQuestItems(player, VICTIMS_ARM_BONE, VICTIMS_THIGH_BONE, VICTIMS_SKULL, VICTIMS_RIB_BONE, VICTIMS_SPINE)) ? "30970-05.html" : "30970-06.html"; break; } - case 2: - { + case 2: { htmltext = "30970-08.html"; break; } - case 3: - { + case 3: { htmltext = "30970-09.html"; break; } - case 7: - { + case 7: { htmltext = "30970-10.html"; break; } - case 8: - { + case 8: { final int memoStateEx = qs.getMemoStateEx(1); final long uselessBonePiecesCount = getQuestItemsCount(player, USELESS_BONE_PIECES); - if ((memoStateEx == 1) || (memoStateEx == 2)) - { + if ((memoStateEx == 1) || (memoStateEx == 2)) { giveItems(player, BILL_OF_IASON_HEINE, 3); giveAdena(player, 5390 + (70 * uselessBonePiecesCount), true); htmltext = "30970-11.html"; - } - else if (memoStateEx == 3) - { - if (getRandom(100) <= 92) - { + } else if (memoStateEx == 3) { + if (getRandom(100) <= 92) { giveItems(player, BILL_OF_IASON_HEINE, 5); - } - else - { + } else { giveItems(player, IMPERIAL_DIAMOND, 1); } @@ -351,75 +273,54 @@ public final class Q00345_MethodToRaiseTheDead extends Quest } break; } - case ORPHEUS: - { - if (hasQuestItems(player, USELESS_BONE_PIECES)) - { + case ORPHEUS: { + if (hasQuestItems(player, USELESS_BONE_PIECES)) { htmltext = "30971-01.html"; } break; } - case MEDIUM_JAR: - { - switch (qs.getMemoState()) - { - case 3: - { + case MEDIUM_JAR: { + switch (qs.getMemoState()) { + case 3: { takeItems(player, -1, POWDER_TO_SUMMON_DEAD_SOULS, VICTIMS_ARM_BONE, VICTIMS_THIGH_BONE, VICTIMS_SKULL, VICTIMS_RIB_BONE, VICTIMS_SPINE); qs.setMemoState(7); final int random = getRandom(100); - if (random <= 39) - { + if (random <= 39) { qs.setMemoStateEx(1, 1); - } - else if (random <= 79) - { + } else if (random <= 79) { qs.setMemoStateEx(1, 2); - } - else - { + } else { qs.setMemoStateEx(1, 3); } htmltext = "30973-01.html"; break; } - case 7: - { + case 7: { final int memoStateEx = qs.getMemoStateEx(1); - if (memoStateEx == 1) - { + if (memoStateEx == 1) { htmltext = "30973-08.html"; - } - else if (memoStateEx == 2) - { + } else if (memoStateEx == 2) { htmltext = "30973-09.html"; - } - else if (memoStateEx == 3) - { + } else if (memoStateEx == 3) { htmltext = "30973-10.html"; } break; } - case 8: - { + case 8: { htmltext = "30973-11.html"; break; } } break; } - case XENOVIA: - { - if (qs.isMemoState(2)) - { + case XENOVIA: { + if (qs.isMemoState(2)) { htmltext = "30912-01.html"; - } - else if (qs.isMemoState(7) || qs.isMemoState(8) || hasQuestItems(player, POWDER_TO_SUMMON_DEAD_SOULS)) - { + } else if (qs.isMemoState(7) || qs.isMemoState(8) || hasQuestItems(player, POWDER_TO_SUMMON_DEAD_SOULS)) { htmltext = "30912-06.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00347_GoGetTheCalculator/Q00347_GoGetTheCalculator.java b/src/main/java/com/l2jserver/datapack/quests/Q00347_GoGetTheCalculator/Q00347_GoGetTheCalculator.java index 2852b2b513..57acb2616a 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00347_GoGetTheCalculator/Q00347_GoGetTheCalculator.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00347_GoGetTheCalculator/Q00347_GoGetTheCalculator.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * Go Get the Calculator (347) * @author Pandragon */ -public final class Q00347_GoGetTheCalculator extends Quest -{ +public final class Q00347_GoGetTheCalculator extends Quest { // NPCs private static final int BRUNON = 30526; private static final int SILVERA = 30527; @@ -47,8 +46,7 @@ public final class Q00347_GoGetTheCalculator extends Quest // Misc private static final int MIN_LVL = 12; - public Q00347_GoGetTheCalculator() - { + public Q00347_GoGetTheCalculator() { super(347, Q00347_GoGetTheCalculator.class.getSimpleName(), "Go Get the Calculator"); addStartNpc(BRUNON); addTalkId(BRUNON, SILVERA, SPIRON, BALANKI); @@ -57,56 +55,44 @@ public final class Q00347_GoGetTheCalculator extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { + switch (event) { case "30526-03.htm": case "30526-04.htm": case "30526-05.htm": case "30526-06.htm": case "30526-07.htm": case "30532-03.html": - case "30532-04.html": - { + case "30532-04.html": { htmltext = event; break; } - case "30526-08.htm": - { - if (qs.isCreated()) - { + case "30526-08.htm": { + if (qs.isCreated()) { qs.startQuest(); htmltext = event; } break; } - case "30526-10.html": - { - if (qs.isCond(6)) - { + case "30526-10.html": { + if (qs.isCond(6)) { takeItems(player, STOLEN_CALCULATOR, -1); rewardItems(player, CALCULATOR, 1); qs.exitQuest(true, true); htmltext = event; - } - else - { + } else { htmltext = "30526-09.html"; } break; } - case "30526-11.html": - { - if (qs.isCond(6)) - { + case "30526-11.html": { + if (qs.isCond(6)) { takeItems(player, STOLEN_CALCULATOR, -1); giveAdena(player, ADENA, true); qs.exitQuest(true, true); @@ -114,19 +100,15 @@ public final class Q00347_GoGetTheCalculator extends Quest } break; } - case "30532-02.html": - { - if (qs.isCond(1)) - { + case "30532-02.html": { + if (qs.isCond(1)) { qs.setCond(2, true); htmltext = event; } break; } - case "30533-02.html": - { - if ((qs.isCond(2)) && (player.getAdena() > 100)) - { + case "30533-02.html": { + if ((qs.isCond(2)) && (player.getAdena() > 100)) { takeItems(player, Inventory.ADENA_ID, 100); qs.setCond(3, true); htmltext = event; @@ -138,109 +120,82 @@ public final class Q00347_GoGetTheCalculator extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (qs.getState()) - { - case State.CREATED: - { - if (npc.getId() == BRUNON) - { + switch (qs.getState()) { + case State.CREATED: { + if (npc.getId() == BRUNON) { htmltext = (talker.getLevel() >= MIN_LVL) ? "30526-01.htm" : "30526-02.html"; } break; } - case State.STARTED: - { - switch (npc.getId()) - { - case BRUNON: - { - if (hasQuestItems(talker, CALCULATOR)) - { + case State.STARTED: { + switch (npc.getId()) { + case BRUNON: { + if (hasQuestItems(talker, CALCULATOR)) { qs.setCond(6); } - switch (qs.getCond()) - { + switch (qs.getCond()) { case 1: - case 2: - { + case 2: { htmltext = "30526-13.html"; break; } case 3: - case 4: - { + case 4: { htmltext = "30526-14.html"; break; } - case 5: - { + case 5: { htmltext = "30526-15.html"; break; } - case 6: - { + case 6: { htmltext = "30526-09.html"; break; } } break; } - case SPIRON: - { + case SPIRON: { htmltext = qs.isCond(1) ? "30532-01.html" : "30532-05.html"; break; } - case BALANKI: - { - if (qs.isCond(2)) - { + case BALANKI: { + if (qs.isCond(2)) { htmltext = "30533-01.html"; - } - else if (qs.getCond() > 2) - { + } else if (qs.getCond() > 2) { htmltext = "30533-04.html"; - } - else - { + } else { htmltext = "30533-03.html"; } break; } - case SILVERA: - { - switch (qs.getCond()) - { + case SILVERA: { + switch (qs.getCond()) { case 1: - case 2: - { + case 2: { htmltext = "30527-01.html"; break; } - case 3: - { + case 3: { qs.setCond(4, true); htmltext = "30527-02.html"; break; } - case 4: - { + case 4: { htmltext = "30527-04.html"; break; } - case 5: - { + case 5: { takeItems(talker, GEMSTONE, -1); giveItems(talker, STOLEN_CALCULATOR, 1); qs.setCond(6, true); htmltext = "30527-03.html"; break; } - case 6: - { + case 6: { htmltext = "30527-05.html"; break; } @@ -250,8 +205,7 @@ public final class Q00347_GoGetTheCalculator extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(talker); break; } @@ -260,13 +214,10 @@ public final class Q00347_GoGetTheCalculator extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, 4, 3, npc); - if (qs != null) - { - if (giveItemRandomly(qs.getPlayer(), npc, GEMSTONE, 1, 10, 0.4, true)) - { + if (qs != null) { + if (giveItemRandomly(qs.getPlayer(), npc, GEMSTONE, 1, 10, 0.4, true)) { qs.setCond(5); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00348_AnArrogantSearch/Q00348_AnArrogantSearch.java b/src/main/java/com/l2jserver/datapack/quests/Q00348_AnArrogantSearch/Q00348_AnArrogantSearch.java index d508a1d817..5526efcbf9 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00348_AnArrogantSearch/Q00348_AnArrogantSearch.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00348_AnArrogantSearch/Q00348_AnArrogantSearch.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * @author Adry_85 * @since 2.6.0.0 */ -public class Q00348_AnArrogantSearch extends Quest -{ +public class Q00348_AnArrogantSearch extends Quest { // NPCs private static final int HARNE = 30144; private static final int MARTIEN = 30645; @@ -107,8 +106,7 @@ public class Q00348_AnArrogantSearch extends Quest private static final int SEAL_ANGEL_1 = 20831; private static final int SEAL_ANGEL_2 = 20860; - public Q00348_AnArrogantSearch() - { + public Q00348_AnArrogantSearch() { super(348, Q00348_AnArrogantSearch.class.getSimpleName(), "An Arrogant Search"); addAttackId(ARK_GUARDIAN_ELBEROTH, ARK_GUARDIAN_SHADOWFANG, ANGEL_KILLER, PLATINUM_TRIBE_SHAMAN, PLATINUM_TRIBE_OVERLORD); addSpawnId(ARK_GUARDIAN_ELBEROTH, ARK_GUARDIAN_SHADOWFANG, ANGEL_KILLER); @@ -119,16 +117,12 @@ public class Q00348_AnArrogantSearch extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (npc.getId()) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (npc.getId()) { case ARK_GUARDIAN_ELBEROTH: case ARK_GUARDIAN_SHADOWFANG: - case ANGEL_KILLER: - { - if ("DESPAWN".equals(event)) - { + case ANGEL_KILLER: { + if ("DESPAWN".equals(event)) { npc.deleteMe(); return super.onAdvEvent(event, npc, player); } @@ -136,14 +130,12 @@ public class Q00348_AnArrogantSearch extends Quest } final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "30864-02.htm": case "30864-03.htm": case "30864-10.html": @@ -152,24 +144,20 @@ public class Q00348_AnArrogantSearch extends Quest case "30864-25.html": case "31001-02.html": case "30144-02.html": - case "30645-02.html": - { + case "30645-02.html": { htmltext = event; break; } - case "30864-04.htm": - { + case "30864-04.htm": { st.setMemoState(1); st.startQuest(); st.setCond(2); htmltext = event; break; } - case "30864-08.html": - { + case "30864-08.html": { int memoState = st.getMemoState(); - if (((memoState == 1) && hasAtLeastOneQuestItem(player, TITANS_POWERSTONE, SHELL_OF_MONSTERS)) || (memoState == 2)) - { + if (((memoState == 1) && hasAtLeastOneQuestItem(player, TITANS_POWERSTONE, SHELL_OF_MONSTERS)) || (memoState == 2)) { st.setMemoStateEx(0, 4); st.setMemoStateEx(1, 0); st.setMemoState(4); @@ -178,10 +166,8 @@ public class Q00348_AnArrogantSearch extends Quest } break; } - case "30864-09.html": - { - if (st.isMemoState(4) && (st.getMemoStateEx(1) == 0)) - { + case "30864-09.html": { + if (st.isMemoState(4) && (st.getMemoStateEx(1) == 0)) { giveItems(player, HANELLINS_1ST_LETTER, 1); giveItems(player, HANELLINS_2ND_LETTER, 1); giveItems(player, HANELLINS_3RD_LETTER, 1); @@ -191,33 +177,25 @@ public class Q00348_AnArrogantSearch extends Quest } break; } - case "30864-26.html": - { - if (st.isMemoState(10) && (getQuestItemsCount(player, WHITE_FABRIC_1) == 1)) - { + case "30864-26.html": { + if (st.isMemoState(10) && (getQuestItemsCount(player, WHITE_FABRIC_1) == 1)) { st.setMemoState(11); htmltext = event; } break; } - case "30864-27.html": - { - if (st.isMemoState(11) && (getQuestItemsCount(player, WHITE_FABRIC_1) == 1) && (st.getMemoStateEx(1) > 0)) - { - switch (st.getMemoStateEx(1)) - { - case 1: - { + case "30864-27.html": { + if (st.isMemoState(11) && (getQuestItemsCount(player, WHITE_FABRIC_1) == 1) && (st.getMemoStateEx(1) > 0)) { + switch (st.getMemoStateEx(1)) { + case 1: { giveAdena(player, 43000, true); break; } - case 2: - { + case 2: { giveAdena(player, 4000, true); break; } - case 3: - { + case 3: { giveAdena(player, 13000, true); break; } @@ -227,17 +205,13 @@ public class Q00348_AnArrogantSearch extends Quest st.setMemoStateEx(1, 100); st.setCond(24); htmltext = event; - } - else - { + } else { htmltext = "30864-28.html"; } break; } - case "30864-29.html": - { - if (st.isMemoState(11) && (st.getMemoStateEx(1) == 0) && (getQuestItemsCount(player, WHITE_FABRIC_1) == 1)) - { + case "30864-29.html": { + if (st.isMemoState(11) && (st.getMemoStateEx(1) == 0) && (getQuestItemsCount(player, WHITE_FABRIC_1) == 1)) { giveAdena(player, 49000, true); st.setMemoState(12); // Custom line st.setMemoStateEx(0, 12); @@ -247,10 +221,8 @@ public class Q00348_AnArrogantSearch extends Quest } break; } - case "30864-30.html": - { - if (st.isMemoState(11) && (st.getMemoStateEx(1) == 0) && (getQuestItemsCount(player, WHITE_FABRIC_1) == 1)) - { + case "30864-30.html": { + if (st.isMemoState(11) && (st.getMemoStateEx(1) == 0) && (getQuestItemsCount(player, WHITE_FABRIC_1) == 1)) { st.setMemoState(13); // Custom line st.setMemoStateEx(0, 13); st.setMemoStateEx(1, 20000); @@ -259,25 +231,18 @@ public class Q00348_AnArrogantSearch extends Quest } break; } - case "30864-43.html": - { - if (st.isMemoState(15)) - { + case "30864-43.html": { + if (st.isMemoState(15)) { st.setMemoState(16); htmltext = event; } break; } - case "30864-44.html": - { - if (st.isMemoState(15) || st.isMemoState(16)) - { - if (hasQuestItems(player, BLOODED_FABRIC)) - { + case "30864-44.html": { + if (st.isMemoState(15) || st.isMemoState(16)) { + if (hasQuestItems(player, BLOODED_FABRIC)) { giveItems(player, WHITE_FABRIC_1, 9); - } - else - { + } else { giveItems(player, WHITE_FABRIC_1, 10); } } @@ -289,10 +254,8 @@ public class Q00348_AnArrogantSearch extends Quest htmltext = event; break; } - case "30864-47.html": - { - if (st.isMemoState(17) && (getQuestItemsCount(player, BLOODED_FABRIC) >= 10) && !hasQuestItems(player, WHITE_FABRIC_1)) - { + case "30864-47.html": { + if (st.isMemoState(17) && (getQuestItemsCount(player, BLOODED_FABRIC) >= 10) && !hasQuestItems(player, WHITE_FABRIC_1)) { st.setMemoState(18); // Custom line st.setMemoStateEx(0, 18); st.setMemoStateEx(1, 0); @@ -301,10 +264,8 @@ public class Q00348_AnArrogantSearch extends Quest } break; } - case "30864-50.html": - { - if (st.isMemoState(19)) - { + case "30864-50.html": { + if (st.isMemoState(19)) { giveItems(player, WHITE_FABRIC_1, 10); st.setMemoState(17); // Custom line st.setMemoStateEx(0, 17); @@ -314,8 +275,7 @@ public class Q00348_AnArrogantSearch extends Quest } break; } - case "30864-51.html": - { + case "30864-51.html": { st.exitQuest(true, true); htmltext = event; break; @@ -325,88 +285,64 @@ public class Q00348_AnArrogantSearch extends Quest } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - switch (npc.getId()) - { - case ARK_GUARDIAN_ELBEROTH: - { - if (!npc.getVariables().getBoolean(I_QUEST0, false)) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + switch (npc.getId()) { + case ARK_GUARDIAN_ELBEROTH: { + if (!npc.getVariables().getBoolean(I_QUEST0, false)) { npc.getVariables().set(I_QUEST0, true); npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.SORRY_ABOUT_THIS_BUT_I_MUST_KILL_YOU_NOW)); } break; } - case ARK_GUARDIAN_SHADOWFANG: - { - if (!npc.getVariables().getBoolean(I_QUEST0, false)) - { + case ARK_GUARDIAN_SHADOWFANG: { + if (!npc.getVariables().getBoolean(I_QUEST0, false)) { npc.getVariables().set(I_QUEST0, true); npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.I_SHALL_DRENCH_THIS_MOUNTAIN_WITH_YOUR_BLOOD)); } break; } - case ANGEL_KILLER: - { + case ANGEL_KILLER: { final QuestState st = getQuestState(attacker, false); - if ((st.getMemoStateEx(0) < 8) && !hasQuestItems(attacker, FIRST_KEY_OF_ARK) && !hasQuestItems(attacker, BLOOD_OF_SAINT)) - { - if ((((st.getMemoStateEx(1) % 100) / 10) == 1)) - { - if (npc.getCurrentHp() < (npc.getMaxHp() * MIN_HP_PERCENTAGE)) - { + if ((st.getMemoStateEx(0) < 8) && !hasQuestItems(attacker, FIRST_KEY_OF_ARK) && !hasQuestItems(attacker, BLOOD_OF_SAINT)) { + if ((((st.getMemoStateEx(1) % 100) / 10) == 1)) { + if (npc.getCurrentHp() < (npc.getMaxHp() * MIN_HP_PERCENTAGE)) { st.setMemoStateEx(1, st.getMemoStateEx(1) + 10); - if ((st.getMemoStateEx(1) % 10) == 0) - { + if ((st.getMemoStateEx(1) % 10) == 0) { st.clearRadar(); st.addRadar(-2908, 44128, -2712); - } - else - { + } else { st.setCond(19, true); } npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.HA_THAT_WAS_FUN_IF_YOU_WISH_TO_FIND_THE_KEY_SEARCH_THE_CORPSE)); npc.deleteMe(); } - } - else if ((((st.getMemoStateEx(1) % 100) / 10) == 2)) - { + } else if ((((st.getMemoStateEx(1) % 100) / 10) == 2)) { npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.WE_DONT_HAVE_ANY_FURTHER_BUSINESS_TO_DISCUSS_HAVE_YOU_SEARCHED_THE_CORPSE_FOR_THE_KEY)); npc.deleteMe(); } - } - else if (hasAtLeastOneQuestItem(attacker, FIRST_KEY_OF_ARK, BLOOD_OF_SAINT)) - { + } else if (hasAtLeastOneQuestItem(attacker, FIRST_KEY_OF_ARK, BLOOD_OF_SAINT)) { npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.WE_DONT_HAVE_ANY_FURTHER_BUSINESS_TO_DISCUSS_HAVE_YOU_SEARCHED_THE_CORPSE_FOR_THE_KEY)); npc.deleteMe(); } break; } - case PLATINUM_TRIBE_SHAMAN: - { + case PLATINUM_TRIBE_SHAMAN: { final QuestState st = getRandomPartyMemberState(attacker, -1, 3, npc); - if ((st != null) && npc.isInsideRadius(attacker, 1500, true, false)) - { - if (((st.getMemoStateEx(0) == 12) || (st.getMemoStateEx(0) == 13)) && hasQuestItems(st.getPlayer(), WHITE_FABRIC_1)) - { - if (st.getMemoStateEx(0) == 12) - { + if ((st != null) && npc.isInsideRadius(attacker, 1500, true, false)) { + if (((st.getMemoStateEx(0) == 12) || (st.getMemoStateEx(0) == 13)) && hasQuestItems(st.getPlayer(), WHITE_FABRIC_1)) { + if (st.getMemoStateEx(0) == 12) { st.setMemoStateEx(1, st.getMemoStateEx(1) + 60); - if ((st.getMemoStateEx(1) + 60) > 80000) - { + if ((st.getMemoStateEx(1) + 60) > 80000) { giveItems(st.getPlayer(), BLOODED_FABRIC, 1); takeItems(st.getPlayer(), WHITE_FABRIC_1, 1); st.exitQuest(true, true); } } - if (st.getMemoStateEx(0) == 13) - { + if (st.getMemoStateEx(0) == 13) { st.setMemoStateEx(1, st.getMemoStateEx(1) + 60); - if ((st.getMemoStateEx(1) + 60) > 100000) - { + if ((st.getMemoStateEx(1) + 60) > 100000) { giveItems(st.getPlayer(), BLOODED_FABRIC, 1); takeItems(st.getPlayer(), WHITE_FABRIC_1, 1); st.setMemoState(14); // Custom line @@ -418,29 +354,22 @@ public class Q00348_AnArrogantSearch extends Quest } break; } - case PLATINUM_TRIBE_OVERLORD: - { + case PLATINUM_TRIBE_OVERLORD: { final QuestState st = getRandomPartyMemberState(attacker, -1, 3, npc); - if ((st != null) && npc.isInsideRadius(attacker, 1500, true, false)) - { - if (((st.getMemoStateEx(0) == 12) || (st.getMemoStateEx(0) == 13)) && hasQuestItems(st.getPlayer(), WHITE_FABRIC_1)) - { - if (st.getMemoStateEx(0) == 12) - { + if ((st != null) && npc.isInsideRadius(attacker, 1500, true, false)) { + if (((st.getMemoStateEx(0) == 12) || (st.getMemoStateEx(0) == 13)) && hasQuestItems(st.getPlayer(), WHITE_FABRIC_1)) { + if (st.getMemoStateEx(0) == 12) { st.setMemoStateEx(1, st.getMemoStateEx(1) + 70); - if ((st.getMemoStateEx(1) + 70) > 80000) - { + if ((st.getMemoStateEx(1) + 70) > 80000) { giveItems(st.getPlayer(), BLOODED_FABRIC, 1); takeItems(st.getPlayer(), WHITE_FABRIC_1, 1); st.exitQuest(true, true); } } - if (st.getMemoStateEx(0) == 13) - { + if (st.getMemoStateEx(0) == 13) { st.setMemoStateEx(1, st.getMemoStateEx(1) + 70); - if ((st.getMemoStateEx(1) + 70) > 100000) - { + if ((st.getMemoStateEx(1) + 70) > 100000) { giveItems(st.getPlayer(), BLOODED_FABRIC, 1); takeItems(st.getPlayer(), WHITE_FABRIC_1, 1); st.setMemoState(14); // Custom line @@ -457,22 +386,15 @@ public class Q00348_AnArrogantSearch extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getRandomPartyMemberState(player, -1, 3, npc); - if ((st != null) && npc.isInsideRadius(player, 1500, true, false)) - { - switch (npc.getId()) - { - case ARK_GUARDIAN_ELBEROTH: - { - if (npc.isInsideRadius(player, 1500, true, false)) - { - if ((st.getMemoStateEx(0) < 8) && (((st.getMemoStateEx(1) % 1000) / 100) == 1) && !hasQuestItems(st.getPlayer(), SECOND_KEY_OF_ARK) && !hasQuestItems(st.getPlayer(), BOOK_OF_SAINT)) - { + if ((st != null) && npc.isInsideRadius(player, 1500, true, false)) { + switch (npc.getId()) { + case ARK_GUARDIAN_ELBEROTH: { + if (npc.isInsideRadius(player, 1500, true, false)) { + if ((st.getMemoStateEx(0) < 8) && (((st.getMemoStateEx(1) % 1000) / 100) == 1) && !hasQuestItems(st.getPlayer(), SECOND_KEY_OF_ARK) && !hasQuestItems(st.getPlayer(), BOOK_OF_SAINT)) { st.setMemoStateEx(1, st.getMemoStateEx(1) + 100); - if ((st.getMemoStateEx(1) % 10) != 0) - { + if ((st.getMemoStateEx(1) % 10) != 0) { st.setCond(11); } @@ -483,15 +405,11 @@ public class Q00348_AnArrogantSearch extends Quest } break; } - case ARK_GUARDIAN_SHADOWFANG: - { - if (npc.isInsideRadius(player, 1500, true, false)) - { - if ((st.getMemoStateEx(0) < 8) && (((st.getMemoStateEx(1) % 10000) / 1000) == 1) && !hasQuestItems(st.getPlayer(), THIRD_KEY_OF_ARK) && !hasQuestItems(st.getPlayer(), BOUGH_OF_SAINT)) - { + case ARK_GUARDIAN_SHADOWFANG: { + if (npc.isInsideRadius(player, 1500, true, false)) { + if ((st.getMemoStateEx(0) < 8) && (((st.getMemoStateEx(1) % 10000) / 1000) == 1) && !hasQuestItems(st.getPlayer(), THIRD_KEY_OF_ARK) && !hasQuestItems(st.getPlayer(), BOUGH_OF_SAINT)) { st.setMemoStateEx(1, st.getMemoStateEx(1) + 1000); - if ((st.getMemoStateEx(1) % 10) != 0) - { + if ((st.getMemoStateEx(1) % 10) != 0) { st.setCond(15); } @@ -503,35 +421,27 @@ public class Q00348_AnArrogantSearch extends Quest break; } case YINTZU: - case PALIOTE: - { - if (npc.isInsideRadius(player, 1500, true, false) && st.isMemoState(1) && !hasQuestItems(st.getPlayer(), SHELL_OF_MONSTERS)) - { + case PALIOTE: { + if (npc.isInsideRadius(player, 1500, true, false) && st.isMemoState(1) && !hasQuestItems(st.getPlayer(), SHELL_OF_MONSTERS)) { giveItems(st.getPlayer(), SHELL_OF_MONSTERS, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } break; } - case PLATINUM_TRIBE_SHAMAN: - { - if (((st.getMemoStateEx(0) == 12) || (st.getMemoStateEx(0) == 13)) && hasQuestItems(st.getPlayer(), WHITE_FABRIC_1)) - { - if (st.getMemoStateEx(0) == 12) - { + case PLATINUM_TRIBE_SHAMAN: { + if (((st.getMemoStateEx(0) == 12) || (st.getMemoStateEx(0) == 13)) && hasQuestItems(st.getPlayer(), WHITE_FABRIC_1)) { + if (st.getMemoStateEx(0) == 12) { st.setMemoStateEx(1, st.getMemoStateEx(1) + 600); - if ((st.getMemoStateEx(1) + 600) > 80000) - { + if ((st.getMemoStateEx(1) + 600) > 80000) { giveItems(st.getPlayer(), BLOODED_FABRIC, 1); takeItems(st.getPlayer(), WHITE_FABRIC_1, 1); st.exitQuest(true, true); } } - if (st.getMemoStateEx(0) == 13) - { + if (st.getMemoStateEx(0) == 13) { st.setMemoStateEx(1, st.getMemoStateEx(1) + 600); - if ((st.getMemoStateEx(1) + 600) > 100000) - { + if ((st.getMemoStateEx(1) + 600) > 100000) { giveItems(st.getPlayer(), BLOODED_FABRIC, 1); takeItems(st.getPlayer(), WHITE_FABRIC_1, 1); st.setMemoState(14); // Custom line @@ -542,26 +452,20 @@ public class Q00348_AnArrogantSearch extends Quest } break; } - case PLATINUM_TRIBE_OVERLORD: - { - if (((st.getMemoStateEx(0) == 12) || (st.getMemoStateEx(0) == 13)) && hasQuestItems(st.getPlayer(), WHITE_FABRIC_1)) - { - if (st.getMemoStateEx(0) == 12) - { + case PLATINUM_TRIBE_OVERLORD: { + if (((st.getMemoStateEx(0) == 12) || (st.getMemoStateEx(0) == 13)) && hasQuestItems(st.getPlayer(), WHITE_FABRIC_1)) { + if (st.getMemoStateEx(0) == 12) { st.setMemoStateEx(1, st.getMemoStateEx(1) + 700); - if ((st.getMemoStateEx(1) + 700) > 80000) - { + if ((st.getMemoStateEx(1) + 700) > 80000) { giveItems(st.getPlayer(), BLOODED_FABRIC, 1); takeItems(st.getPlayer(), WHITE_FABRIC_1, 1); st.exitQuest(true, true); } } - if (st.getMemoStateEx(0) == 13) - { + if (st.getMemoStateEx(0) == 13) { st.setMemoStateEx(1, st.getMemoStateEx(1) + 700); - if ((st.getMemoStateEx(1) + 700) > 100000) - { + if ((st.getMemoStateEx(1) + 700) > 100000) { giveItems(st.getPlayer(), BLOODED_FABRIC, 1); takeItems(st.getPlayer(), WHITE_FABRIC_1, 1); st.setMemoState(14); // Custom line @@ -574,14 +478,11 @@ public class Q00348_AnArrogantSearch extends Quest } case GUARDIAN_ANGEL: case SEAL_ANGEL_1: - case SEAL_ANGEL_2: - { - if ((st.getMemoStateEx(0) == 17) && hasQuestItems(st.getPlayer(), WHITE_FABRIC_1)) - { + case SEAL_ANGEL_2: { + if ((st.getMemoStateEx(0) == 17) && hasQuestItems(st.getPlayer(), WHITE_FABRIC_1)) { int i0 = st.getMemoStateEx(1) + getRandom(100) + 100; st.setMemoStateEx(1, i0); - if ((st.getMemoStateEx(1) + i0) > 750) - { + if ((st.getMemoStateEx(1) + i0) > 750) { giveItems(st.getPlayer(), BLOODED_FABRIC, 1); takeItems(st.getPlayer(), WHITE_FABRIC_1, 1); st.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); @@ -596,26 +497,21 @@ public class Q00348_AnArrogantSearch extends Quest } @Override - public String onSpawn(L2Npc npc) - { - switch (npc.getId()) - { - case ARK_GUARDIAN_ELBEROTH: - { + public String onSpawn(L2Npc npc) { + switch (npc.getId()) { + case ARK_GUARDIAN_ELBEROTH: { npc.getVariables().set(I_QUEST0, false); npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.THAT_DOESNT_BELONG_TO_YOU_DONT_TOUCH_IT)); startQuestTimer("DESPAWN", 600000, npc, null); break; } - case ARK_GUARDIAN_SHADOWFANG: - { + case ARK_GUARDIAN_SHADOWFANG: { npc.getVariables().set(I_QUEST0, false); npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.GET_OUT_OF_MY_SIGHT_YOU_INFIDELS)); startQuestTimer("DESPAWN", 600000, npc, null); break; } - case ANGEL_KILLER: - { + case ANGEL_KILLER: { npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.I_HAVE_THE_KEY_WHY_DONT_YOU_COME_AND_TAKE_IT)); startQuestTimer("DESPAWN", 600000, npc, null); } @@ -624,39 +520,26 @@ public class Q00348_AnArrogantSearch extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCreated()) - { + if (st.isCreated()) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "30864-01.htm" : "30864-05.html"; - } - else if (st.isStarted()) - { - switch (npc.getId()) - { - case HANELLIN: - { - switch (st.getMemoState()) - { + } else if (st.isStarted()) { + switch (npc.getId()) { + case HANELLIN: { + switch (st.getMemoState()) { case 1: - case 2: - { + case 2: { int memoState = st.getMemoState(); - if ((memoState == 1) && !hasQuestItems(player, TITANS_POWERSTONE) && !hasQuestItems(player, SHELL_OF_MONSTERS)) - { + if ((memoState == 1) && !hasQuestItems(player, TITANS_POWERSTONE) && !hasQuestItems(player, SHELL_OF_MONSTERS)) { htmltext = "30864-06.html"; - } - else if (((memoState == 1) && hasQuestItems(player, TITANS_POWERSTONE)) || hasQuestItems(player, SHELL_OF_MONSTERS) || (memoState == 2)) - { - if (hasQuestItems(player, SHELL_OF_MONSTERS)) - { + } else if (((memoState == 1) && hasQuestItems(player, TITANS_POWERSTONE)) || hasQuestItems(player, SHELL_OF_MONSTERS) || (memoState == 2)) { + if (hasQuestItems(player, SHELL_OF_MONSTERS)) { takeItems(player, SHELL_OF_MONSTERS, 1); } - if (hasQuestItems(player, TITANS_POWERSTONE)) - { + if (hasQuestItems(player, TITANS_POWERSTONE)) { takeItems(player, TITANS_POWERSTONE, 1); } @@ -665,12 +548,9 @@ public class Q00348_AnArrogantSearch extends Quest } break; } - case 4: - { - switch (st.getMemoStateEx(1)) - { - case 0: - { + case 4: { + switch (st.getMemoStateEx(1)) { + case 0: { st.setMemoState(5); htmltext = "30864-09.html"; giveItems(player, HANELLINS_1ST_LETTER, 1); @@ -679,24 +559,21 @@ public class Q00348_AnArrogantSearch extends Quest st.setCond(5, true); break; } - case 1: - { + case 1: { st.setMemoState(5); htmltext = "30864-13.html"; giveItems(player, HANELLINS_1ST_LETTER, 1); st.setCond(6, true); break; } - case 2: - { + case 2: { st.setMemoState(5); htmltext = "30864-14.html"; giveItems(player, HANELLINS_2ND_LETTER, 1); st.setCond(7, true); break; } - case 3: - { + case 3: { st.setMemoState(5); htmltext = "30864-15.html"; giveItems(player, HANELLINS_3RD_LETTER, 1); @@ -706,28 +583,20 @@ public class Q00348_AnArrogantSearch extends Quest } break; } - case 5: - { - if ((st.getMemoStateEx(1) % 10) == 0) - { + case 5: { + if ((st.getMemoStateEx(1) % 10) == 0) { htmltext = "30864-16.html"; - } - else - { - switch (st.getMemoStateEx(1)) - { - case 1: - { + } else { + switch (st.getMemoStateEx(1)) { + case 1: { htmltext = "30864-17.html"; break; } - case 2: - { + case 2: { htmltext = "30864-18.html"; break; } - case 3: - { + case 3: { htmltext = "30864-19.html"; break; } @@ -735,8 +604,7 @@ public class Q00348_AnArrogantSearch extends Quest } // Custom part - if (hasQuestItems(player, BOOK_OF_SAINT, BLOOD_OF_SAINT, BOUGH_OF_SAINT)) - { + if (hasQuestItems(player, BOOK_OF_SAINT, BLOOD_OF_SAINT, BOUGH_OF_SAINT)) { takeItems(player, 1, BOOK_OF_SAINT, BLOOD_OF_SAINT, BOUGH_OF_SAINT); st.setMemoState(9); htmltext = "30864-21.html"; @@ -745,61 +613,42 @@ public class Q00348_AnArrogantSearch extends Quest break; } case 6: - case 7: - { + case 7: { htmltext = "30864-20.html"; break; } - case 8: - { - if (hasQuestItems(player, BOOK_OF_SAINT, BLOOD_OF_SAINT, BOUGH_OF_SAINT)) - { + case 8: { + if (hasQuestItems(player, BOOK_OF_SAINT, BLOOD_OF_SAINT, BOUGH_OF_SAINT)) { takeItems(player, 1, BOOK_OF_SAINT, BLOOD_OF_SAINT, BOUGH_OF_SAINT); st.setMemoState(9); htmltext = "30864-21.html"; st.setCond(22, true); - } - else - { - switch (st.getMemoStateEx(1)) - { - case 0: - { + } else { + switch (st.getMemoStateEx(1)) { + case 0: { htmltext = "30864-22.html"; break; } - case 1: - { - if (hasQuestItems(player, BLOOD_OF_SAINT) && !hasAtLeastOneQuestItem(player, BOOK_OF_SAINT, BOUGH_OF_SAINT)) - { + case 1: { + if (hasQuestItems(player, BLOOD_OF_SAINT) && !hasAtLeastOneQuestItem(player, BOOK_OF_SAINT, BOUGH_OF_SAINT)) { htmltext = "30864-33.html"; - } - else if (!hasQuestItems(player, BLOOD_OF_SAINT, WHITE_FABRIC_2)) - { + } else if (!hasQuestItems(player, BLOOD_OF_SAINT, WHITE_FABRIC_2)) { htmltext = "30864-36.html"; } break; } - case 2: - { - if (hasQuestItems(player, BOOK_OF_SAINT) && !hasAtLeastOneQuestItem(player, BLOOD_OF_SAINT, BOUGH_OF_SAINT)) - { + case 2: { + if (hasQuestItems(player, BOOK_OF_SAINT) && !hasAtLeastOneQuestItem(player, BLOOD_OF_SAINT, BOUGH_OF_SAINT)) { htmltext = "30864-34.html"; - } - else if (!hasQuestItems(player, BOOK_OF_SAINT, WHITE_FABRIC_2)) - { + } else if (!hasQuestItems(player, BOOK_OF_SAINT, WHITE_FABRIC_2)) { htmltext = "30864-37.html"; } break; } - case 3: - { - if (hasQuestItems(player, BOUGH_OF_SAINT) && !hasAtLeastOneQuestItem(player, BLOOD_OF_SAINT, BOOK_OF_SAINT)) - { + case 3: { + if (hasQuestItems(player, BOUGH_OF_SAINT) && !hasAtLeastOneQuestItem(player, BLOOD_OF_SAINT, BOOK_OF_SAINT)) { htmltext = "30864-35.html"; - } - else if (!hasQuestItems(player, BOUGH_OF_SAINT, WHITE_FABRIC_2)) - { + } else if (!hasQuestItems(player, BOUGH_OF_SAINT, WHITE_FABRIC_2)) { htmltext = "30864-38.html"; } break; @@ -807,13 +656,11 @@ public class Q00348_AnArrogantSearch extends Quest } } - if ((getQuestItemsCount(player, WHITE_FABRIC_2) > 1) && (st.getMemoStateEx(1) > 0)) - { + if ((getQuestItemsCount(player, WHITE_FABRIC_2) > 1) && (st.getMemoStateEx(1) > 0)) { htmltext = "30864-40.html"; } - if ((getQuestItemsCount(player, WHITE_FABRIC_2) == 1) && (st.getMemoStateEx(1) > 0) && !hasQuestItems(player, BOOK_OF_SAINT, BLOOD_OF_SAINT, BOUGH_OF_SAINT)) - { + if ((getQuestItemsCount(player, WHITE_FABRIC_2) == 1) && (st.getMemoStateEx(1) > 0) && !hasQuestItems(player, BOOK_OF_SAINT, BLOOD_OF_SAINT, BOUGH_OF_SAINT)) { giveItems(player, WHITE_FABRIC_1, 1); takeItems(player, WHITE_FABRIC_2, 1); st.setMemoState(10); @@ -821,25 +668,18 @@ public class Q00348_AnArrogantSearch extends Quest } break; } - case 9: - { + case 9: { final long antidoteCount = getQuestItemsCount(player, ANTIDOTE); - if ((antidoteCount < 5) || !hasQuestItems(player, GREATER_HEALING_POTION)) - { + if ((antidoteCount < 5) || !hasQuestItems(player, GREATER_HEALING_POTION)) { htmltext = "30864-23.html"; - } - else if ((antidoteCount >= 5) && hasQuestItems(player, GREATER_HEALING_POTION)) - { - if (st.getMemoStateEx(1) == 0) - { + } else if ((antidoteCount >= 5) && hasQuestItems(player, GREATER_HEALING_POTION)) { + if (st.getMemoStateEx(1) == 0) { htmltext = "30864-24.html"; giveItems(player, WHITE_FABRIC_1, 1); st.setMemoState(10); takeItems(player, ANTIDOTE, 5); takeItems(player, GREATER_HEALING_POTION, 1); - } - else - { + } else { giveItems(player, WHITE_FABRIC_2, 3); takeItems(player, ANTIDOTE, 5); takeItems(player, GREATER_HEALING_POTION, 1); @@ -850,20 +690,16 @@ public class Q00348_AnArrogantSearch extends Quest } break; } - case 10: - { - if (getQuestItemsCount(player, WHITE_FABRIC_1) == 1) - { + case 10: { + if (getQuestItemsCount(player, WHITE_FABRIC_1) == 1) { htmltext = "30864-25.html"; } - if ((getQuestItemsCount(player, WHITE_FABRIC_2) > 1) && (st.getMemoStateEx(1) > 0)) - { + if ((getQuestItemsCount(player, WHITE_FABRIC_2) > 1) && (st.getMemoStateEx(1) > 0)) { htmltext = "30864-40.html"; } - if ((getQuestItemsCount(player, WHITE_FABRIC_2) == 1) && (st.getMemoStateEx(1) > 0) && !hasQuestItems(player, BOOK_OF_SAINT, BLOOD_OF_SAINT, BOUGH_OF_SAINT)) - { + if ((getQuestItemsCount(player, WHITE_FABRIC_2) == 1) && (st.getMemoStateEx(1) > 0) && !hasQuestItems(player, BOOK_OF_SAINT, BLOOD_OF_SAINT, BOUGH_OF_SAINT)) { giveItems(player, WHITE_FABRIC_1, 1); takeItems(player, WHITE_FABRIC_2, 1); st.setMemoState(10); @@ -871,26 +707,19 @@ public class Q00348_AnArrogantSearch extends Quest } break; } - case 11: - { - if (getQuestItemsCount(player, WHITE_FABRIC_1) == 1) - { - if ((st.getMemoStateEx(1) > 0)) - { - switch (st.getMemoStateEx(1)) - { - case 1: - { + case 11: { + if (getQuestItemsCount(player, WHITE_FABRIC_1) == 1) { + if ((st.getMemoStateEx(1) > 0)) { + switch (st.getMemoStateEx(1)) { + case 1: { giveAdena(player, 43000, true); break; } - case 2: - { + case 2: { giveAdena(player, 4000, true); break; } - case 3: - { + case 3: { giveAdena(player, 13000, true); break; } @@ -900,50 +729,38 @@ public class Q00348_AnArrogantSearch extends Quest st.setMemoStateEx(1, 100); st.setCond(24, true); htmltext = "30864-27.html"; - } - else if ((st.getMemoStateEx(1) == 0)) - { + } else if ((st.getMemoStateEx(1) == 0)) { htmltext = "30864-28.html"; } } break; } - case 12: - { - if (getQuestItemsCount(player, WHITE_FABRIC_1) == 1) - { + case 12: { + if (getQuestItemsCount(player, WHITE_FABRIC_1) == 1) { htmltext = "30864-31.html"; } break; } - case 13: - { - if (getQuestItemsCount(player, WHITE_FABRIC_1) == 1) - { + case 13: { + if (getQuestItemsCount(player, WHITE_FABRIC_1) == 1) { htmltext = "30864-32.html"; } break; } - case 14: - { + case 14: { getReward(player); st.setMemoState(15); htmltext = "30864-42.html"; break; } - case 15: - { + case 15: { htmltext = "30864-43.html"; break; } - case 16: - { - if (hasQuestItems(player, BLOODED_FABRIC)) - { + case 16: { + if (hasQuestItems(player, BLOODED_FABRIC)) { giveItems(player, WHITE_FABRIC_1, 9); - } - else - { + } else { giveItems(player, WHITE_FABRIC_1, 10); } @@ -954,21 +771,14 @@ public class Q00348_AnArrogantSearch extends Quest htmltext = "30864-44.html"; break; } - case 17: - { - if (hasQuestItems(player, WHITE_FABRIC_1)) - { + case 17: { + if (hasQuestItems(player, WHITE_FABRIC_1)) { htmltext = "30864-45.html"; - } - else - { + } else { final long bloodedFabricCount = getQuestItemsCount(player, BLOODED_FABRIC); - if (bloodedFabricCount >= 10) - { + if (bloodedFabricCount >= 10) { htmltext = "30864-46.html"; - } - else - { + } else { giveAdena(player, (bloodedFabricCount * 1000) + 4000, true); takeItems(player, BLOODED_FABRIC, -1); st.exitQuest(true, true); @@ -977,60 +787,46 @@ public class Q00348_AnArrogantSearch extends Quest } break; } - case 18: - { + case 18: { final int memoStateEx = st.getMemoStateEx(1); - if ((memoStateEx % 10) < 7) - { + if ((memoStateEx % 10) < 7) { int i1 = 0; int i2 = 0; int i0 = memoStateEx % 10; - if (i0 >= 4) - { + if (i0 >= 4) { i1 = i1 + 6; i0 = i0 - 4; i2 = i2 + 1; } - if (i0 >= 2) - { + if (i0 >= 2) { i0 = i0 - 2; i1 = i1 + 1; i2 = i2 + 1; } - if (i0 >= 1) - { + if (i0 >= 1) { i1 = i1 + 3; i2 = i2 + 1; i0 = i0 - 1; } - if (i0 == 0) - { + if (i0 == 0) { final long bloodedFabricCount = getQuestItemsCount(player, BLOODED_FABRIC); - if ((bloodedFabricCount + i1) >= 10) - { + if ((bloodedFabricCount + i1) >= 10) { htmltext = "30864-52.html"; - } - else - { + } else { htmltext = "30864-53.html"; - if (i2 == 2) - { + if (i2 == 2) { giveAdena(player, 24000, true); - } - else if (i2 == 1) - { + } else if (i2 == 1) { giveAdena(player, 12000, true); } st.exitQuest(true, true); } } - } - else if ((memoStateEx % 10) == 7) - { + } else if ((memoStateEx % 10) == 7) { htmltext = "30864-54.html"; st.setCond(28, true); getReward(player); @@ -1038,388 +834,276 @@ public class Q00348_AnArrogantSearch extends Quest } break; } - case 19: - { + case 19: { htmltext = "30864-49.html"; break; } } break; } - case IASON_HEINE: - { - if (st.getMemoStateEx(0) == 18) - { - if ((st.getMemoStateEx(1) % 8) < 4) - { - if (getQuestItemsCount(player, BLOODED_FABRIC) >= 6) - { + case IASON_HEINE: { + if (st.getMemoStateEx(0) == 18) { + if ((st.getMemoStateEx(1) % 8) < 4) { + if (getQuestItemsCount(player, BLOODED_FABRIC) >= 6) { takeItems(player, BLOODED_FABRIC, 6); st.setMemoStateEx(1, st.getMemoStateEx(1) + 4); htmltext = "30969-01.html"; - } - else - { + } else { htmltext = "30969-02.html"; } - } - else - { + } else { htmltext = "30969-03.html"; } } break; } - case HOLY_ARK_OF_SECRECY_1: - { - if (hasQuestItems(player, FIRST_KEY_OF_ARK)) - { + case HOLY_ARK_OF_SECRECY_1: { + if (hasQuestItems(player, FIRST_KEY_OF_ARK)) { giveItems(player, BLOOD_OF_SAINT, 1); st.clearRadar(); - if ((st.getMemoStateEx(1) % 10) == 0) - { - if (hasQuestItems(player, BOOK_OF_SAINT, BOUGH_OF_SAINT)) - { + if ((st.getMemoStateEx(1) % 10) == 0) { + if (hasQuestItems(player, BOOK_OF_SAINT, BOUGH_OF_SAINT)) { st.setCond(21, true); } - } - else - { + } else { st.setCond(20, true); } takeItems(player, FIRST_KEY_OF_ARK, 1); st.setMemoStateEx(1, st.getMemoStateEx(1) - 20); - if ((((st.getMemoStateEx(1) - 20) % 100) / 10) == 0) - { + if ((((st.getMemoStateEx(1) - 20) % 100) / 10) == 0) { st.setMemoStateEx(0, st.getMemoStateEx(0) + 1); } - if (((st.getMemoStateEx(1) - 20) % 10) == 1) - { + if (((st.getMemoStateEx(1) - 20) % 10) == 1) { st.setMemoStateEx(0, 8); } htmltext = "30977-01.html"; - } - else - { - if ((st.getMemoState() <= 8) && (((st.getMemoStateEx(1) % 100) / 10) == 0) && hasQuestItems(player, BLOOD_OF_SAINT)) - { + } else { + if ((st.getMemoState() <= 8) && (((st.getMemoStateEx(1) % 100) / 10) == 0) && hasQuestItems(player, BLOOD_OF_SAINT)) { htmltext = "30977-02.html"; - } - else if ((st.getMemoState() < 8) && (((st.getMemoStateEx(1) % 100) / 10) == 1) && !hasQuestItems(player, BLOOD_OF_SAINT)) - { + } else if ((st.getMemoState() < 8) && (((st.getMemoStateEx(1) % 100) / 10) == 1) && !hasQuestItems(player, BLOOD_OF_SAINT)) { htmltext = "30977-03.html"; } } break; } - case HOLY_ARK_OF_SECRECY_2: - { - if (hasQuestItems(player, SECOND_KEY_OF_ARK)) - { + case HOLY_ARK_OF_SECRECY_2: { + if (hasQuestItems(player, SECOND_KEY_OF_ARK)) { giveItems(player, BOOK_OF_SAINT, 1); takeItems(player, SECOND_KEY_OF_ARK, 1); st.clearRadar(); - if ((st.getMemoStateEx(1) % 10) == 0) - { - if (hasQuestItems(player, BLOOD_OF_SAINT, BOUGH_OF_SAINT)) - { + if ((st.getMemoStateEx(1) % 10) == 0) { + if (hasQuestItems(player, BLOOD_OF_SAINT, BOUGH_OF_SAINT)) { st.setCond(21, true); } - } - else - { + } else { st.setCond(12, true); } st.setMemoStateEx(1, st.getMemoStateEx(1) - 200); - if ((((st.getMemoStateEx(1) - 200) % 1000) / 100) == 0) - { + if ((((st.getMemoStateEx(1) - 200) % 1000) / 100) == 0) { st.setMemoStateEx(0, st.getMemoStateEx(0) + 1); } - if (((st.getMemoStateEx(1) - 200) % 10) == 2) - { + if (((st.getMemoStateEx(1) - 200) % 10) == 2) { st.setMemoStateEx(0, 8); } htmltext = "30978-01.html"; - } - else - { - if ((st.getMemoState() < 8) && (((st.getMemoStateEx(1) % 1000) / 100) == 1)) - { + } else { + if ((st.getMemoState() < 8) && (((st.getMemoStateEx(1) % 1000) / 100) == 1)) { htmltext = "30978-02.html"; - if ((st.getMemoStateEx(1) % 10) != 0) - { + if ((st.getMemoStateEx(1) % 10) != 0) { st.setCond(10, true); } // TODO (Adry_85): Missing Question Mark st.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); addSpawn(ARK_GUARDIAN_ELBEROTH, player.getX(), player.getY(), player.getZ(), 0, false, 0, false); // ark_guardian_elberoth - } - else if ((st.getMemoState() <= 8) && (((st.getMemoStateEx(1) % 1000) / 100) == 0) && hasQuestItems(player, BOOK_OF_SAINT)) - { + } else if ((st.getMemoState() <= 8) && (((st.getMemoStateEx(1) % 1000) / 100) == 0) && hasQuestItems(player, BOOK_OF_SAINT)) { htmltext = "30978-03.html"; } } break; } - case HOLY_ARK_OF_SECRECY_3: - { - if (hasQuestItems(player, THIRD_KEY_OF_ARK)) - { + case HOLY_ARK_OF_SECRECY_3: { + if (hasQuestItems(player, THIRD_KEY_OF_ARK)) { giveItems(player, BOUGH_OF_SAINT, 1); takeItems(player, THIRD_KEY_OF_ARK, 1); st.clearRadar(); - if ((st.getMemoStateEx(1) % 10) == 0) - { - if (hasQuestItems(player, BLOOD_OF_SAINT, BOOK_OF_SAINT)) - { + if ((st.getMemoStateEx(1) % 10) == 0) { + if (hasQuestItems(player, BLOOD_OF_SAINT, BOOK_OF_SAINT)) { st.setCond(21, true); } - } - else - { + } else { st.setCond(16, true); } st.setMemoStateEx(1, st.getMemoStateEx(1) - 2000); - if ((((st.getMemoStateEx(1) - 2000) % 10000) / 1000) == 0) - { + if ((((st.getMemoStateEx(1) - 2000) % 10000) / 1000) == 0) { st.setMemoStateEx(0, st.getMemoStateEx(0) + 1); } - if (((st.getMemoStateEx(1) - 2000) % 10) == 3) - { + if (((st.getMemoStateEx(1) - 2000) % 10) == 3) { st.setMemoStateEx(0, 8); } htmltext = "30979-01.html"; - } - else - { - if ((st.getMemoState() < 8) && (((st.getMemoStateEx(1) % 10000) / 1000) == 1)) - { + } else { + if ((st.getMemoState() < 8) && (((st.getMemoStateEx(1) % 10000) / 1000) == 1)) { htmltext = "30979-02.html"; - if ((st.getMemoStateEx(1) % 10) != 0) - { + if ((st.getMemoStateEx(1) % 10) != 0) { st.setCond(14, true); } // TODO (Adry_85): Missing Question Mark st.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); addSpawn(ARK_GUARDIAN_SHADOWFANG, player.getX(), player.getY(), player.getZ(), 0, false, 0, false); // ark_guardian_shadowfang - } - else if ((st.getMemoState() <= 8) && (((st.getMemoStateEx(1) % 10000) / 1000) == 0) && hasQuestItems(player, BOUGH_OF_SAINT)) - { + } else if ((st.getMemoState() <= 8) && (((st.getMemoStateEx(1) % 10000) / 1000) == 0) && hasQuestItems(player, BOUGH_OF_SAINT)) { htmltext = "30979-03.html"; } } break; } - case ARK_GUARDIANS_CORPSE: - { - if ((st.getMemoState() < 8) && (((st.getMemoStateEx(1) % 100) / 10) == 1) && !hasQuestItems(player, FIRST_KEY_OF_ARK) && !hasQuestItems(player, BLOOD_OF_SAINT)) - { + case ARK_GUARDIANS_CORPSE: { + if ((st.getMemoState() < 8) && (((st.getMemoStateEx(1) % 100) / 10) == 1) && !hasQuestItems(player, FIRST_KEY_OF_ARK) && !hasQuestItems(player, BLOOD_OF_SAINT)) { htmltext = "30980-02.html"; st.clearRadar(); - if ((st.getMemoStateEx(1) % 10) != 0) - { + if ((st.getMemoStateEx(1) % 10) != 0) { st.setCond(18, true); } // TODO (Adry_85): Missing Question Mark st.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); addSpawn(ANGEL_KILLER, player.getX(), player.getY(), player.getZ(), 0, false, 0, false); // angel_killer - } - else if ((st.getMemoState() < 8) && (((st.getMemoStateEx(1) % 100) / 10) == 2) && !hasQuestItems(player, FIRST_KEY_OF_ARK) && !hasQuestItems(player, BLOOD_OF_SAINT)) - { + } else if ((st.getMemoState() < 8) && (((st.getMemoStateEx(1) % 100) / 10) == 2) && !hasQuestItems(player, FIRST_KEY_OF_ARK) && !hasQuestItems(player, BLOOD_OF_SAINT)) { giveItems(player, FIRST_KEY_OF_ARK, 1); st.addRadar(-418, 44174, -3568); htmltext = "30980-03.html"; - } - else if (hasAtLeastOneQuestItem(player, FIRST_KEY_OF_ARK, BLOOD_OF_SAINT)) - { + } else if (hasAtLeastOneQuestItem(player, FIRST_KEY_OF_ARK, BLOOD_OF_SAINT)) { htmltext = "30980-01.html"; } break; } - case CLAUDIA_ATHEBALDT: - { - if (hasQuestItems(player, HANELLINS_2ND_LETTER)) - { + case CLAUDIA_ATHEBALDT: { + if (hasQuestItems(player, HANELLINS_2ND_LETTER)) { int i0 = st.getMemoStateEx(1) + 100; - if ((i0 % 10) == 0) - { + if ((i0 % 10) == 0) { st.addRadar(181472, 7158, -2725); - } - else - { + } else { st.setCond(9, true); } st.setMemoStateEx(1, i0); takeItems(player, HANELLINS_2ND_LETTER, 1); htmltext = "31001-01.html"; - } - else if ((st.getMemoState() < 8) && (((st.getMemoStateEx(1) % 1000) / 100) == 1) && !hasQuestItems(player, SECOND_KEY_OF_ARK)) - { + } else if ((st.getMemoState() < 8) && (((st.getMemoStateEx(1) % 1000) / 100) == 1) && !hasQuestItems(player, SECOND_KEY_OF_ARK)) { // retail typo - if ((st.getMemoStateEx(1) % 10) == 0) - { + if ((st.getMemoStateEx(1) % 10) == 0) { st.addRadar(181472, 7158, -2725); } htmltext = "31001-03.html"; - } - else if (hasQuestItems(player, SECOND_KEY_OF_ARK)) - { - if ((st.getMemoStateEx(1) % 10) == 0) - { + } else if (hasQuestItems(player, SECOND_KEY_OF_ARK)) { + if ((st.getMemoStateEx(1) % 10) == 0) { st.addRadar(181472, 7158, -2725); } htmltext = "31001-04.html"; - } - else if (hasQuestItems(player, BOOK_OF_SAINT)) - { + } else if (hasQuestItems(player, BOOK_OF_SAINT)) { htmltext = "31001-05.html"; } break; } - case HARNE: - { - if (hasQuestItems(player, HANELLINS_1ST_LETTER)) - { + case HARNE: { + if (hasQuestItems(player, HANELLINS_1ST_LETTER)) { int i0 = st.getMemoStateEx(1) + 10; - if ((i0 % 10) == 0) - { + if ((i0 % 10) == 0) { st.addRadar(2908, 44128, -2712); - } - else - { + } else { st.setCond(17, true); } st.setMemoStateEx(1, i0); takeItems(player, HANELLINS_1ST_LETTER, 1); htmltext = "30144-01.html"; - } - else if ((st.getMemoState() < 8) && (((st.getMemoStateEx(1) % 100) / 10) == 1) && !hasQuestItems(player, FIRST_KEY_OF_ARK)) - { + } else if ((st.getMemoState() < 8) && (((st.getMemoStateEx(1) % 100) / 10) == 1) && !hasQuestItems(player, FIRST_KEY_OF_ARK)) { // retail typo - if ((st.getMemoStateEx(1) % 10) == 0) - { + if ((st.getMemoStateEx(1) % 10) == 0) { st.addRadar(2908, 44128, -2712); } htmltext = "30144-03.html"; - } - else if (hasQuestItems(player, FIRST_KEY_OF_ARK)) - { - if ((st.getMemoStateEx(1) % 10) == 0) - { + } else if (hasQuestItems(player, FIRST_KEY_OF_ARK)) { + if ((st.getMemoStateEx(1) % 10) == 0) { st.addRadar(2908, 44128, -2712); } htmltext = "30144-04.html"; - } - else if (hasQuestItems(player, BLOOD_OF_SAINT)) - { + } else if (hasQuestItems(player, BLOOD_OF_SAINT)) { htmltext = "30144-05.html"; } break; } - case MARTIEN: - { - if (hasQuestItems(player, HANELLINS_3RD_LETTER)) - { + case MARTIEN: { + if (hasQuestItems(player, HANELLINS_3RD_LETTER)) { int i0 = st.getMemoStateEx(1) + 1000; - if ((i0 % 10) == 0) - { + if ((i0 % 10) == 0) { st.addRadar(50693, 158674, 376); - } - else - { + } else { st.setCond(13, true); } st.setMemoStateEx(1, i0); takeItems(player, HANELLINS_3RD_LETTER, 1); htmltext = "30645-01.html"; - } - else if ((st.getMemoState() < 8) && (((st.getMemoStateEx(1) % 10000) / 1000) == 1) && !hasQuestItems(player, THIRD_KEY_OF_ARK)) - { + } else if ((st.getMemoState() < 8) && (((st.getMemoStateEx(1) % 10000) / 1000) == 1) && !hasQuestItems(player, THIRD_KEY_OF_ARK)) { // retail typo - if ((st.getMemoStateEx(1) % 10) == 0) - { + if ((st.getMemoStateEx(1) % 10) == 0) { st.addRadar(50693, 158674, 376); } htmltext = "30645-03.html"; - } - else if (hasQuestItems(player, THIRD_KEY_OF_ARK)) - { - if ((st.getMemoStateEx(1) % 10) == 0) - { + } else if (hasQuestItems(player, THIRD_KEY_OF_ARK)) { + if ((st.getMemoStateEx(1) % 10) == 0) { st.addRadar(50693, 158674, 376); } htmltext = "30645-04.html"; - } - else if (hasQuestItems(player, BOUGH_OF_SAINT)) - { + } else if (hasQuestItems(player, BOUGH_OF_SAINT)) { htmltext = "30645-05.html"; } break; } - case SIR_GUSTAV_ATHEBALDT: - { - if (st.getMemoStateEx(0) == 18) - { - if ((st.getMemoStateEx(1) % 2) == 0) - { - if (getQuestItemsCount(player, BLOODED_FABRIC) >= 3) - { + case SIR_GUSTAV_ATHEBALDT: { + if (st.getMemoStateEx(0) == 18) { + if ((st.getMemoStateEx(1) % 2) == 0) { + if (getQuestItemsCount(player, BLOODED_FABRIC) >= 3) { takeItems(player, BLOODED_FABRIC, 3); st.setMemoStateEx(1, st.getMemoStateEx(1) + 1); htmltext = "30760-01.html"; - } - else - { + } else { htmltext = "30760-02.html"; } - } - else if ((st.getMemoStateEx(1) % 2) == 1) - { + } else if ((st.getMemoStateEx(1) % 2) == 1) { htmltext = "30760-03.html"; } } break; } - case HARDIN: - { - if (st.getMemoStateEx(0) == 18) - { - if ((st.getMemoStateEx(1) % 4) < 2) - { - if (getQuestItemsCount(player, BLOODED_FABRIC) >= 1) - { + case HARDIN: { + if (st.getMemoStateEx(0) == 18) { + if ((st.getMemoStateEx(1) % 4) < 2) { + if (getQuestItemsCount(player, BLOODED_FABRIC) >= 1) { takeItems(player, BLOODED_FABRIC, 1); st.setMemoStateEx(1, st.getMemoStateEx(1) + 2); htmltext = "30832-01.html"; - } - else if (getQuestItemsCount(player, BLOODED_FABRIC) < 3) - { + } else if (getQuestItemsCount(player, BLOODED_FABRIC) < 3) { htmltext = "30832-02.html"; } - } - else - { + } else { htmltext = "30832-03.html"; } } @@ -1430,139 +1114,92 @@ public class Q00348_AnArrogantSearch extends Quest return htmltext; } - private void getReward(L2PcInstance player) - { + private void getReward(L2PcInstance player) { final ClassId playerClassId = player.getClassId(); final int playerLevel = player.getLevel(); if ((playerClassId == ClassId.treasureHunter) || (playerClassId == ClassId.plainsWalker) || (playerClassId == ClassId.abyssWalker) || (playerClassId == ClassId.adventurer) || (playerClassId == ClassId.windRider) || (playerClassId == ClassId.ghostHunter) - || (playerClassId == ClassId.maleSoulbreaker) || (playerClassId == ClassId.femaleSoulbreaker) || (playerClassId == ClassId.maleSoulhound) || (playerClassId == ClassId.femaleSoulhound) || (playerClassId == ClassId.inspector) || (playerClassId == ClassId.judicator)) - { - if (playerLevel < 69) - { + || (playerClassId == ClassId.maleSoulbreaker) || (playerClassId == ClassId.femaleSoulbreaker) || (playerClassId == ClassId.maleSoulhound) || (playerClassId == ClassId.femaleSoulhound) || (playerClassId == ClassId.inspector) || (playerClassId == ClassId.judicator)) { + if (playerLevel < 69) { giveItems(player, KRIS_EDGE, 1); giveItems(player, SYNTHETIC_COKES, 2); - } - else - { + } else { giveItems(player, DEMONS_DAGGER_EDGE, 1); giveItems(player, COKES, 2); } - } - else if ((playerClassId == ClassId.tyrant) || (playerClassId == ClassId.grandKhavatari)) - { - if (playerLevel < 69) - { + } else if ((playerClassId == ClassId.tyrant) || (playerClassId == ClassId.grandKhavatari)) { + if (playerLevel < 69) { giveItems(player, ARTHRO_NAIL_BLADE, 1); giveItems(player, SYNTHETIC_COKES, 2); giveItems(player, COKES, 1); - } - else - { + } else { giveItems(player, BELLION_CESTUS_EDGE, 1); giveItems(player, ORIHARUKON_ORE, 2); } - } - else if ((playerClassId == ClassId.paladin) || (playerClassId == ClassId.darkAvenger) || (playerClassId == ClassId.prophet) || (playerClassId == ClassId.templeKnight) || (playerClassId == ClassId.swordSinger) || (playerClassId == ClassId.shillienKnight) + } else if ((playerClassId == ClassId.paladin) || (playerClassId == ClassId.darkAvenger) || (playerClassId == ClassId.prophet) || (playerClassId == ClassId.templeKnight) || (playerClassId == ClassId.swordSinger) || (playerClassId == ClassId.shillienKnight) || (playerClassId == ClassId.bladedancer) || (playerClassId == ClassId.shillenElder) || (playerClassId == ClassId.phoenixKnight) || (playerClassId == ClassId.hellKnight) || (playerClassId == ClassId.hierophant) || (playerClassId == ClassId.evaTemplar) - || (playerClassId == ClassId.swordMuse) || (playerClassId == ClassId.shillienTemplar) || (playerClassId == ClassId.spectralDancer) || (playerClassId == ClassId.shillienSaint)) - { - if (playerLevel < 69) - { + || (playerClassId == ClassId.swordMuse) || (playerClassId == ClassId.shillienTemplar) || (playerClassId == ClassId.spectralDancer) || (playerClassId == ClassId.shillienSaint)) { + if (playerLevel < 69) { giveItems(player, KESHANBERK_BLADE, 1); giveItems(player, SYNTHETIC_COKES, 2); - } - else - { + } else { giveItems(player, SWORD_OF_DAMASCUS_BLADE, 1); giveItems(player, ORIHARUKON_ORE, 2); } - } - else if ((playerClassId == ClassId.hawkeye) || (playerClassId == ClassId.silverRanger) || (playerClassId == ClassId.phantomRanger) || (playerClassId == ClassId.sagittarius) || (playerClassId == ClassId.moonlightSentinel) || (playerClassId == ClassId.ghostSentinel) - || (playerClassId == ClassId.arbalester) || (playerClassId == ClassId.trickster)) - { - if (playerLevel < 69) - { + } else if ((playerClassId == ClassId.hawkeye) || (playerClassId == ClassId.silverRanger) || (playerClassId == ClassId.phantomRanger) || (playerClassId == ClassId.sagittarius) || (playerClassId == ClassId.moonlightSentinel) || (playerClassId == ClassId.ghostSentinel) + || (playerClassId == ClassId.arbalester) || (playerClassId == ClassId.trickster)) { + if (playerLevel < 69) { giveItems(player, DARK_ELVEN_LONGBOW_SHAFT, 1); giveItems(player, SYNTHETIC_COKES, 2); - } - else - { + } else { giveItems(player, BOW_OF_PERIL_SHAFT, 1); giveItems(player, COARSE_BONE_POWDER, 9); } - } - else if ((playerClassId == ClassId.gladiator) || (playerClassId == ClassId.bishop) || (playerClassId == ClassId.elder) || (playerClassId == ClassId.duelist) || (playerClassId == ClassId.cardinal) || (playerClassId == ClassId.evaSaint)) - { - if (playerLevel < 69) - { + } else if ((playerClassId == ClassId.gladiator) || (playerClassId == ClassId.bishop) || (playerClassId == ClassId.elder) || (playerClassId == ClassId.duelist) || (playerClassId == ClassId.cardinal) || (playerClassId == ClassId.evaSaint)) { + if (playerLevel < 69) { giveItems(player, HEAVY_WAR_AXE_HEAD, 1); giveItems(player, SYNTHETIC_COKES, 2); giveItems(player, COKES, 1); - } - else - { + } else { giveItems(player, ART_OF_BATTLE_AXE_BLADE, 1); giveItems(player, ORIHARUKON_ORE, 2); } - } - else if ((playerClassId == ClassId.warlord) || (playerClassId == ClassId.bountyHunter) || (playerClassId == ClassId.warsmith) || (playerClassId == ClassId.dreadnought) || (playerClassId == ClassId.fortuneSeeker) || (playerClassId == ClassId.maestro)) - { - if (playerLevel < 63) - { + } else if ((playerClassId == ClassId.warlord) || (playerClassId == ClassId.bountyHunter) || (playerClassId == ClassId.warsmith) || (playerClassId == ClassId.dreadnought) || (playerClassId == ClassId.fortuneSeeker) || (playerClassId == ClassId.maestro)) { + if (playerLevel < 63) { giveItems(player, GREAT_AXE_HEAD, 1); giveItems(player, ENRIA, 1); giveItems(player, COKES, 1); - } - else - { + } else { giveItems(player, LANCE_BLADE, 1); giveItems(player, ORIHARUKON_ORE, 2); } - } - else if ((playerClassId == ClassId.sorceror) || (playerClassId == ClassId.spellsinger) || (playerClassId == ClassId.overlord) || (playerClassId == ClassId.archmage) || (playerClassId == ClassId.mysticMuse) || (playerClassId == ClassId.dominator)) - { - if (playerLevel < 63) - { + } else if ((playerClassId == ClassId.sorceror) || (playerClassId == ClassId.spellsinger) || (playerClassId == ClassId.overlord) || (playerClassId == ClassId.archmage) || (playerClassId == ClassId.mysticMuse) || (playerClassId == ClassId.dominator)) { + if (playerLevel < 63) { giveItems(player, SPRITES_STAFF_HEAD, 1); giveItems(player, ORIHARUKON_ORE, 4); giveItems(player, COARSE_BONE_POWDER, 1); - } - else - { + } else { giveItems(player, EVIL_SPIRIT_HEAD, 1); giveItems(player, ANIMAL_BONE, 5); } - } - else if ((playerClassId == ClassId.necromancer) || (playerClassId == ClassId.spellhowler) || (playerClassId == ClassId.soultaker) || (playerClassId == ClassId.stormScreamer)) - { + } else if ((playerClassId == ClassId.necromancer) || (playerClassId == ClassId.spellhowler) || (playerClassId == ClassId.soultaker) || (playerClassId == ClassId.stormScreamer)) { giveItems(player, HELL_KNIFE_EDGE, 1); giveItems(player, SYNTHETIC_COKES, 2); giveItems(player, ANIMAL_BONE, 2); - } - else if ((playerClassId == ClassId.destroyer) || (playerClassId == ClassId.titan) || (playerClassId == ClassId.berserker) || (playerClassId == ClassId.doombringer)) - { + } else if ((playerClassId == ClassId.destroyer) || (playerClassId == ClassId.titan) || (playerClassId == ClassId.berserker) || (playerClassId == ClassId.doombringer)) { giveItems(player, GREAT_SWORD_BLADE, 1); giveItems(player, VARNISH_OF_PURITY, 2); giveItems(player, SYNTHETIC_COKES, 2); - } - else if ((playerClassId == ClassId.elementalSummoner) || (playerClassId == ClassId.phantomSummoner) || (playerClassId == ClassId.elementalMaster) || (playerClassId == ClassId.spectralMaster)) - { + } else if ((playerClassId == ClassId.elementalSummoner) || (playerClassId == ClassId.phantomSummoner) || (playerClassId == ClassId.elementalMaster) || (playerClassId == ClassId.spectralMaster)) { giveItems(player, SWORD_OF_DAMASCUS_BLADE, 1); giveItems(player, ENRIA, 1); - } - else if ((playerClassId == ClassId.warcryer) || (playerClassId == ClassId.doomcryer)) - { + } else if ((playerClassId == ClassId.warcryer) || (playerClassId == ClassId.doomcryer)) { giveItems(player, SWORD_OF_VALHALLA_BLADE, 1); giveItems(player, ORIHARUKON_ORE, 1); giveItems(player, VARNISH_OF_PURITY, 1); - } - else if ((playerClassId == ClassId.warlock) || (playerClassId == ClassId.arcanaLord)) - { + } else if ((playerClassId == ClassId.warlock) || (playerClassId == ClassId.arcanaLord)) { giveItems(player, ART_OF_BATTLE_AXE_BLADE, 1); giveItems(player, ENRIA, 1); - } - else - { + } else { giveAdena(player, 49000, true); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00351_BlackSwan/Q00351_BlackSwan.java b/src/main/java/com/l2jserver/datapack/quests/Q00351_BlackSwan/Q00351_BlackSwan.java index eea800792e..4ff4e625fc 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00351_BlackSwan/Q00351_BlackSwan.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00351_BlackSwan/Q00351_BlackSwan.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.util.Util; * Black Swan (351) * @author Adry_85 */ -public final class Q00351_BlackSwan extends Quest -{ +public final class Q00351_BlackSwan extends Quest { // NPCs private static final int ROMAN = 30897; private static final int GOSTA = 30916; @@ -51,16 +50,14 @@ public final class Q00351_BlackSwan extends Quest private static final int TASABA_LIZARDMAN2 = 21639; private static final int TASABA_LIZARDMAN_SHAMAN2 = 21640; private static final Map<Integer, Integer> MONSTER_DROP_CHANCES = new HashMap<>(); - static - { + static { MONSTER_DROP_CHANCES.put(TASABA_LIZARDMAN1, 4); MONSTER_DROP_CHANCES.put(TASABA_LIZARDMAN_SHAMAN1, 3); MONSTER_DROP_CHANCES.put(TASABA_LIZARDMAN2, 4); MONSTER_DROP_CHANCES.put(TASABA_LIZARDMAN_SHAMAN2, 3); } - public Q00351_BlackSwan() - { + public Q00351_BlackSwan() { super(351, Q00351_BlackSwan.class.getSimpleName(), "Black Swan"); addStartNpc(GOSTA, ROMAN); addTalkId(GOSTA, IASON_HEINE, ROMAN); @@ -69,40 +66,31 @@ public final class Q00351_BlackSwan extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "30916-02.htm": - case "30969-03.html": - { + case "30969-03.html": { htmltext = event; break; } - case "30916-03.htm": - { + case "30916-03.htm": { giveItems(player, ORDER_OF_GOSTA, 1); qs.startQuest(); htmltext = event; break; } - case "30969-02.html": - { + case "30969-02.html": { final long lizardFangCount = getQuestItemsCount(player, LIZARD_FANG); - if (lizardFangCount == 0) - { + if (lizardFangCount == 0) { htmltext = event; - } - else - { + } else { final long adenaBonus = (lizardFangCount >= 10) ? 3880 : 0; giveAdena(player, adenaBonus + (20 * lizardFangCount), true); takeItems(player, LIZARD_FANG, -1); @@ -110,16 +98,12 @@ public final class Q00351_BlackSwan extends Quest } break; } - case "30969-05.html": - { + case "30969-05.html": { final long barrelOfLeagueCount = getQuestItemsCount(player, BARREL_OF_LEAGUE); - if (barrelOfLeagueCount == 0) - { + if (barrelOfLeagueCount == 0) { htmltext = event; - } - else - { + } else { giveItems(player, BILL_OF_IASON_HEINE, barrelOfLeagueCount); giveAdena(player, 3880, true); takeItems(player, BARREL_OF_LEAGUE, -1); @@ -128,13 +112,11 @@ public final class Q00351_BlackSwan extends Quest } break; } - case "30969-07.html": - { + case "30969-07.html": { htmltext = (!hasQuestItems(player, BARREL_OF_LEAGUE, LIZARD_FANG)) ? event : "30969-08.html"; break; } - case "30969-09.html": - { + case "30969-09.html": { htmltext = event; qs.exitQuest(true, true); break; @@ -144,36 +126,27 @@ public final class Q00351_BlackSwan extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc); - if ((qs == null) || !Util.checkIfInRange(1500, npc, killer, true)) - { + if ((qs == null) || !Util.checkIfInRange(1500, npc, killer, true)) { return null; } final int random = getRandom(20); - if (random < 10) - { + if (random < 10) { giveItemRandomly(qs.getPlayer(), npc, LIZARD_FANG, 1, 0, 1.0, true); - if (getRandom(20) == 0) - { + if (getRandom(20) == 0) { giveItemRandomly(qs.getPlayer(), npc, BARREL_OF_LEAGUE, 1, 0, 1.0, false); } - } - else if (random < 15) - { + } else if (random < 15) { giveItemRandomly(qs.getPlayer(), npc, LIZARD_FANG, 2, 0, 1.0, true); - if (getRandom(20) == 0) - { + if (getRandom(20) == 0) { giveItemRandomly(qs.getPlayer(), npc, BARREL_OF_LEAGUE, 1, 0, 1.0, false); } - } - else if (getRandom(100) < MONSTER_DROP_CHANCES.get(npc.getId())) - { + } else if (getRandom(100) < MONSTER_DROP_CHANCES.get(npc.getId())) { giveItemRandomly(qs.getPlayer(), npc, BARREL_OF_LEAGUE, 1, 0, 1.0, true); } @@ -181,37 +154,27 @@ public final class Q00351_BlackSwan extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState qs = getQuestState(player, true); QuestState qs2 = player.getQuestState(Q00345_MethodToRaiseTheDead.class.getSimpleName()); String htmltext = getNoQuestMsg(player); - switch (npc.getId()) - { - case GOSTA: - { - if (qs.isCreated()) - { + switch (npc.getId()) { + case GOSTA: { + if (qs.isCreated()) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "30916-01.htm" : "30916-04.html"; - } - else if (qs.isStarted()) - { + } else if (qs.isStarted()) { htmltext = "30916-05.html"; } break; } - case IASON_HEINE: - { - if (qs.isStarted()) - { + case IASON_HEINE: { + if (qs.isStarted()) { htmltext = "30969-01.html"; } break; } - case ROMAN: - { - if (qs.isStarted() || ((qs2 != null) && qs2.isStarted())) - { + case ROMAN: { + if (qs.isStarted() || ((qs2 != null) && qs2.isStarted())) { htmltext = (hasQuestItems(player, BILL_OF_IASON_HEINE)) ? "30897-01.html" : "30897-02.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00352_HelpRoodRaiseANewPet/Q00352_HelpRoodRaiseANewPet.java b/src/main/java/com/l2jserver/datapack/quests/Q00352_HelpRoodRaiseANewPet/Q00352_HelpRoodRaiseANewPet.java index 508621ca72..96dc8a293c 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00352_HelpRoodRaiseANewPet/Q00352_HelpRoodRaiseANewPet.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00352_HelpRoodRaiseANewPet/Q00352_HelpRoodRaiseANewPet.java @@ -31,26 +31,21 @@ import com.l2jserver.gameserver.util.Util; * Help Rood Raise A New Pet! (352) * @author Adry_85 */ -public final class Q00352_HelpRoodRaiseANewPet extends Quest -{ - private static final class DropInfo - { +public final class Q00352_HelpRoodRaiseANewPet extends Quest { + private static final class DropInfo { public final int _firstChance; public final int _secondChance; - public DropInfo(int firstChance, int secondChance) - { + public DropInfo(int firstChance, int secondChance) { _firstChance = firstChance; _secondChance = secondChance; } - public int getFirstChance() - { + public int getFirstChance() { return _firstChance; } - public int getSecondChance() - { + public int getSecondChance() { return _secondChance; } } @@ -64,15 +59,13 @@ public final class Q00352_HelpRoodRaiseANewPet extends Quest private static final int MIN_LEVEL = 39; private static final Map<Integer, DropInfo> MOBS = new HashMap<>(); - static - { + static { MOBS.put(20786, new DropInfo(46, 48)); // lienrik MOBS.put(21644, new DropInfo(46, 48)); // lienrik_a MOBS.put(21645, new DropInfo(69, 71)); // lienrik_lad_a } - public Q00352_HelpRoodRaiseANewPet() - { + public Q00352_HelpRoodRaiseANewPet() { super(352, Q00352_HelpRoodRaiseANewPet.class.getSimpleName(), "Help Rood Raise A New Pet!"); addStartNpc(ROOD); addTalkId(ROOD); @@ -81,34 +74,28 @@ public final class Q00352_HelpRoodRaiseANewPet extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "31067-02.htm": case "31067-03.htm": case "31067-07.html": - case "31067-10.html": - { + case "31067-10.html": { htmltext = event; break; } - case "31067-04.htm": - { + case "31067-04.htm": { qs.setMemoState(1); qs.startQuest(); htmltext = event; break; } - case "31067-08.html": - { + case "31067-08.html": { qs.exitQuest(true, true); htmltext = event; break; @@ -118,63 +105,46 @@ public final class Q00352_HelpRoodRaiseANewPet extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs == null) || !Util.checkIfInRange(1500, npc, killer, true)) - { + if ((qs == null) || !Util.checkIfInRange(1500, npc, killer, true)) { return null; } final DropInfo info = MOBS.get(npc.getId()); final int random = getRandom(100); - if (random < info.getFirstChance()) - { + if (random < info.getFirstChance()) { qs.giveItemRandomly(npc, LIENRIK_EGG1, 1, 0, 1.0, true); - } - else if (random < info.getSecondChance()) - { + } else if (random < info.getSecondChance()) { qs.giveItemRandomly(npc, LIENRIK_EGG2, 1, 0, 1.0, true); } return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { + if (qs.isCreated()) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "31067-01.htm" : "31067-05.html"; - } - else if (qs.isStarted()) - { + } else if (qs.isStarted()) { final long LienrikEgg1Count = getQuestItemsCount(player, LIENRIK_EGG1); final long LienrikEgg2Count = getQuestItemsCount(player, LIENRIK_EGG2); - if ((LienrikEgg1Count == 0) && (LienrikEgg2Count == 0)) - { + if ((LienrikEgg1Count == 0) && (LienrikEgg2Count == 0)) { htmltext = "31067-06.html"; - } - else if ((LienrikEgg1Count >= 1) && (LienrikEgg2Count == 0)) - { - if (LienrikEgg1Count >= 10) - { + } else if ((LienrikEgg1Count >= 1) && (LienrikEgg2Count == 0)) { + if (LienrikEgg1Count >= 10) { giveAdena(player, (LienrikEgg1Count * 34) + 4000, true); - } - else - { + } else { giveAdena(player, (LienrikEgg1Count * 34) + 2000, true); } takeItems(player, LIENRIK_EGG1, -1); htmltext = "31067-10.html"; - } - else if (LienrikEgg1Count >= 1) - { + } else if (LienrikEgg1Count >= 1) { giveAdena(player, 4000 + ((LienrikEgg1Count * 34) + (LienrikEgg2Count * 1025)), true); takeItems(player, LIENRIK_EGG1, -1); takeItems(player, LIENRIK_EGG2, -1); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00354_ConquestOfAlligatorIsland/Q00354_ConquestOfAlligatorIsland.java b/src/main/java/com/l2jserver/datapack/quests/Q00354_ConquestOfAlligatorIsland/Q00354_ConquestOfAlligatorIsland.java index e0ec320bc3..d6c9bea348 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00354_ConquestOfAlligatorIsland/Q00354_ConquestOfAlligatorIsland.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00354_ConquestOfAlligatorIsland/Q00354_ConquestOfAlligatorIsland.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Conquest of Alligator Island (354) * @author Adry_85 */ -public final class Q00354_ConquestOfAlligatorIsland extends Quest -{ +public final class Q00354_ConquestOfAlligatorIsland extends Quest { // NPC private static final int KLUCK = 30895; // Items @@ -43,8 +42,7 @@ public final class Q00354_ConquestOfAlligatorIsland extends Quest // Mobs private static final Map<Integer, Double> MOB1 = new HashMap<>(); private static final Map<Integer, Integer> MOB2 = new HashMap<>(); - static - { + static { MOB1.put(20804, 0.84); // crokian_lad MOB1.put(20805, 0.91); // dailaon_lad MOB1.put(20806, 0.88); // crokian_lad_warrior @@ -53,8 +51,7 @@ public final class Q00354_ConquestOfAlligatorIsland extends Quest MOB2.put(20991, 69); // tribe_of_swamp } - public Q00354_ConquestOfAlligatorIsland() - { + public Q00354_ConquestOfAlligatorIsland() { super(354, Q00354_ConquestOfAlligatorIsland.class.getSimpleName(), "Conquest of Alligator Island"); addStartNpc(KLUCK); addTalkId(KLUCK); @@ -64,68 +61,52 @@ public final class Q00354_ConquestOfAlligatorIsland extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "30895-04.html": case "30895-05.html": - case "30895-09.html": - { + case "30895-09.html": { htmltext = event; break; } - case "30895-02.html": - { + case "30895-02.html": { st.startQuest(); htmltext = event; break; } - case "ADENA": - { + case "ADENA": { final long count = st.getQuestItemsCount(ALLIGATOR_TOOTH); - if (count >= 100) - { + if (count >= 100) { st.giveAdena((count * 220) + 10700, true); st.takeItems(ALLIGATOR_TOOTH, -1); htmltext = "30895-06.html"; - } - else if (count > 0) - { + } else if (count > 0) { st.giveAdena((count * 220) + 3100, true); st.takeItems(ALLIGATOR_TOOTH, -1); htmltext = "30895-07.html"; - } - else - { + } else { htmltext = "30895-08.html"; } break; } - case "30895-10.html": - { + case "30895-10.html": { st.exitQuest(true, true); htmltext = event; break; } - case "REWARD": - { + case "REWARD": { final long count = st.getQuestItemsCount(MYSTERIOUS_MAP_PIECE); - if (count >= 10) - { + if (count >= 10) { st.giveItems(PIRATES_TREASURE_MAP, 1); st.takeItems(MYSTERIOUS_MAP_PIECE, 10); htmltext = "30895-13.html"; - } - else if (count > 0) - { + } else if (count > 0) { htmltext = "30895-12.html"; } break; @@ -135,18 +116,13 @@ public final class Q00354_ConquestOfAlligatorIsland extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getRandomPartyMemberState(player, -1, 3, npc); - if (st != null) - { + if (st != null) { int npcId = npc.getId(); - if (MOB1.containsKey(npcId)) - { + if (MOB1.containsKey(npcId)) { st.giveItemRandomly(npc, ALLIGATOR_TOOTH, 1, 0, MOB1.get(npcId), true); - } - else - { + } else { final int itemCount = ((getRandom(100) < MOB2.get(npcId)) ? 2 : 1); st.giveItemRandomly(npc, ALLIGATOR_TOOTH, itemCount, 0, 1.0, true); } @@ -157,16 +133,12 @@ public final class Q00354_ConquestOfAlligatorIsland extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCreated()) - { + if (st.isCreated()) { htmltext = ((player.getLevel() >= MIN_LEVEL) ? "30895-01.htm" : "30895-03.html"); - } - else if (st.isStarted()) - { + } else if (st.isStarted()) { htmltext = (st.hasQuestItems(MYSTERIOUS_MAP_PIECE) ? "30895-11.html" : "30895-04.html"); } return htmltext; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00355_FamilyHonor/Q00355_FamilyHonor.java b/src/main/java/com/l2jserver/datapack/quests/Q00355_FamilyHonor/Q00355_FamilyHonor.java index 16882cee90..d075cb7658 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00355_FamilyHonor/Q00355_FamilyHonor.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00355_FamilyHonor/Q00355_FamilyHonor.java @@ -31,26 +31,21 @@ import com.l2jserver.gameserver.util.Util; * Family Honor (355) * @author Adry_85 */ -public final class Q00355_FamilyHonor extends Quest -{ - private static final class DropInfo - { +public final class Q00355_FamilyHonor extends Quest { + private static final class DropInfo { public final int _firstChance; public final int _secondChance; - public DropInfo(int firstChance, int secondChance) - { + public DropInfo(int firstChance, int secondChance) { _firstChance = firstChance; _secondChance = secondChance; } - public int getFirstChance() - { + public int getFirstChance() { return _firstChance; } - public int getSecondChance() - { + public int getSecondChance() { return _secondChance; } } @@ -69,16 +64,14 @@ public final class Q00355_FamilyHonor extends Quest private static final int MIN_LEVEL = 36; private static final Map<Integer, DropInfo> MOBS = new HashMap<>(); - static - { + static { MOBS.put(20767, new DropInfo(560, 684)); // timak_orc_troop_leader MOBS.put(20768, new DropInfo(530, 650)); // timak_orc_troop_shaman MOBS.put(20769, new DropInfo(420, 516)); // timak_orc_troop_warrior MOBS.put(20770, new DropInfo(440, 560)); // timak_orc_troop_archer } - public Q00355_FamilyHonor() - { + public Q00355_FamilyHonor() { super(355, Q00355_FamilyHonor.class.getSimpleName(), "Family Honor"); addStartNpc(GALIBREDO); addTalkId(GALIBREDO, PATRIN); @@ -87,59 +80,46 @@ public final class Q00355_FamilyHonor extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "30181-02.htm": case "30181-09.html": case "30929-01.html": - case "30929-02.html": - { + case "30929-02.html": { htmltext = event; break; } - case "30181-03.htm": - { + case "30181-03.htm": { qs.startQuest(); htmltext = event; break; } - case "30181-06.html": - { + case "30181-06.html": { final long galfredoRomersBustCount = getQuestItemsCount(player, GALFREDO_ROMERS_BUST); - if (galfredoRomersBustCount < 1) - { + if (galfredoRomersBustCount < 1) { htmltext = event; - } - else if (galfredoRomersBustCount >= 100) - { + } else if (galfredoRomersBustCount >= 100) { giveAdena(player, (galfredoRomersBustCount * 120) + 7800, true); takeItems(player, GALFREDO_ROMERS_BUST, -1); htmltext = "30181-07.html"; - } - else - { + } else { giveAdena(player, (galfredoRomersBustCount * 120) + 2800, true); takeItems(player, GALFREDO_ROMERS_BUST, -1); htmltext = "30181-08.html"; } break; } - case "30181-10.html": - { + case "30181-10.html": { final long galfredoRomersBustCount = getQuestItemsCount(player, GALFREDO_ROMERS_BUST); - if (galfredoRomersBustCount > 0) - { + if (galfredoRomersBustCount > 0) { giveAdena(player, galfredoRomersBustCount * 120, true); } @@ -148,41 +128,28 @@ public final class Q00355_FamilyHonor extends Quest htmltext = event; break; } - case "30929-03.html": - { + case "30929-03.html": { final int random = getRandom(100); - if (hasQuestItems(player, SCULPTOR_BERONA)) - { - if (random < 2) - { + if (hasQuestItems(player, SCULPTOR_BERONA)) { + if (random < 2) { giveItems(player, ANCIENT_STATUE_PROTOTYPE, 1); htmltext = event; - } - else if (random < 32) - { + } else if (random < 32) { giveItems(player, ANCIENT_STATUE_ORIGINAL, 1); htmltext = "30929-04.html"; - } - else if (random < 62) - { + } else if (random < 62) { giveItems(player, ANCIENT_STATUE_REPLICA, 1); htmltext = "30929-05.html"; - } - else if (random < 77) - { + } else if (random < 77) { giveItems(player, ANCIENT_STATUE_FORGERY, 1); htmltext = "30929-06.html"; - } - else - { + } else { htmltext = "30929-07.html"; } takeItems(player, SCULPTOR_BERONA, 1); - } - else - { + } else { htmltext = "30929-08.html"; } break; @@ -192,53 +159,38 @@ public final class Q00355_FamilyHonor extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs == null) || !Util.checkIfInRange(1500, npc, killer, true)) - { + if ((qs == null) || !Util.checkIfInRange(1500, npc, killer, true)) { return null; } final DropInfo info = MOBS.get(npc.getId()); final int random = getRandom(1000); - if (random < info.getFirstChance()) - { + if (random < info.getFirstChance()) { qs.giveItemRandomly(npc, GALFREDO_ROMERS_BUST, 1, 0, 1.0, true); - } - else if (random < info.getSecondChance()) - { + } else if (random < info.getSecondChance()) { qs.giveItemRandomly(npc, SCULPTOR_BERONA, 1, 0, 1.0, true); } return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { + if (qs.isCreated()) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "30181-01.htm" : "30181-04.html"; - } - else if (qs.isStarted()) - { - if (npc.getId() == GALIBREDO) - { - if (hasQuestItems(player, SCULPTOR_BERONA)) - { + } else if (qs.isStarted()) { + if (npc.getId() == GALIBREDO) { + if (hasQuestItems(player, SCULPTOR_BERONA)) { htmltext = "30181-11.html"; - } - else - { + } else { htmltext = "30181-05.html"; } - } - else - { + } else { htmltext = "30929-01.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00356_DigUpTheSeaOfSpores/Q00356_DigUpTheSeaOfSpores.java b/src/main/java/com/l2jserver/datapack/quests/Q00356_DigUpTheSeaOfSpores/Q00356_DigUpTheSeaOfSpores.java index 817280eb42..263f881db8 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00356_DigUpTheSeaOfSpores/Q00356_DigUpTheSeaOfSpores.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00356_DigUpTheSeaOfSpores/Q00356_DigUpTheSeaOfSpores.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Dig Up the Sea of Spores! (356) * @author Adry_85 */ -public final class Q00356_DigUpTheSeaOfSpores extends Quest -{ +public final class Q00356_DigUpTheSeaOfSpores extends Quest { // NPC private static final int GAUEN = 30717; // Items @@ -44,14 +43,12 @@ public final class Q00356_DigUpTheSeaOfSpores extends Quest private static final int ROTTING_TREE = 20558; private static final int SPORE_ZOMBIE = 20562; private static final Map<Integer, Double> MONSTER_DROP_CHANCES = new HashMap<>(); - static - { + static { MONSTER_DROP_CHANCES.put(ROTTING_TREE, 0.73); MONSTER_DROP_CHANCES.put(SPORE_ZOMBIE, 0.94); } - public Q00356_DigUpTheSeaOfSpores() - { + public Q00356_DigUpTheSeaOfSpores() { super(356, Q00356_DigUpTheSeaOfSpores.class.getSimpleName(), "Dig Up the Sea of Spores!"); addStartNpc(GAUEN); addTalkId(GAUEN); @@ -60,69 +57,55 @@ public final class Q00356_DigUpTheSeaOfSpores extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "30717-02.htm": case "30717-03.htm": case "30717-04.htm": case "30717-10.html": - case "30717-18.html": - { + case "30717-18.html": { htmltext = event; break; } - case "30717-05.htm": - { + case "30717-05.htm": { qs.startQuest(); htmltext = event; break; } - case "30717-09.html": - { + case "30717-09.html": { addExpAndSp(player, 31850, 0); takeItems(player, CARNIVORE_SPORE, -1); takeItems(player, HERBIVOROUS_SPORE, -1); htmltext = event; break; } - case "30717-11.html": - { + case "30717-11.html": { qs.exitQuest(true, true); htmltext = event; break; } - case "30717-14.html": - { + case "30717-14.html": { addExpAndSp(player, 45500, 2600); qs.exitQuest(true, true); htmltext = event; break; } - case "FINISH": - { + case "FINISH": { final int value = getRandom(100); int adena = 0; - if (value < 20) - { + if (value < 20) { adena = 44000; htmltext = "30717-15.html"; - } - else if (value < 70) - { + } else if (value < 70) { adena = 20950; htmltext = "30717-16.html"; - } - else - { + } else { adena = 10400; htmltext = "30717-17.html"; } @@ -135,26 +118,20 @@ public final class Q00356_DigUpTheSeaOfSpores extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs == null) || !Util.checkIfInRange(1500, npc, killer, true)) - { + if ((qs == null) || !Util.checkIfInRange(1500, npc, killer, true)) { return null; } final int dropItem = ((npc.getId() == ROTTING_TREE) ? HERBIVOROUS_SPORE : CARNIVORE_SPORE); final int otherItem = ((dropItem == HERBIVOROUS_SPORE) ? CARNIVORE_SPORE : HERBIVOROUS_SPORE); - if (giveItemRandomly(qs.getPlayer(), npc, dropItem, 1, 50, MONSTER_DROP_CHANCES.get(npc.getId()), true)) - { - if (getQuestItemsCount(killer, otherItem) >= 50) - { + if (giveItemRandomly(qs.getPlayer(), npc, dropItem, 1, 50, MONSTER_DROP_CHANCES.get(npc.getId()), true)) { + if (getQuestItemsCount(killer, otherItem) >= 50) { qs.setCond(3); - } - else - { + } else { qs.setCond(2); } } @@ -162,33 +139,22 @@ public final class Q00356_DigUpTheSeaOfSpores extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { + if (qs.isCreated()) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "30717-01.htm" : "30717-06.htm"; - } - else if (qs.isStarted()) - { + } else if (qs.isStarted()) { final boolean hasAllHerbSpores = (getQuestItemsCount(player, HERBIVOROUS_SPORE) >= 50); final boolean hasAllCarnSpores = (getQuestItemsCount(player, CARNIVORE_SPORE) >= 50); - if (hasAllHerbSpores && hasAllCarnSpores) - { + if (hasAllHerbSpores && hasAllCarnSpores) { htmltext = "30717-13.html"; - } - else if (hasAllCarnSpores) - { + } else if (hasAllCarnSpores) { htmltext = "30717-12.html"; - } - else if (hasAllHerbSpores) - { + } else if (hasAllHerbSpores) { htmltext = "30717-08.html"; - } - else - { + } else { htmltext = "30717-07.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00357_WarehouseKeepersAmbition/Q00357_WarehouseKeepersAmbition.java b/src/main/java/com/l2jserver/datapack/quests/Q00357_WarehouseKeepersAmbition/Q00357_WarehouseKeepersAmbition.java index 8aeb3625e4..2846ab0301 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00357_WarehouseKeepersAmbition/Q00357_WarehouseKeepersAmbition.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00357_WarehouseKeepersAmbition/Q00357_WarehouseKeepersAmbition.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Warehouse Keeper's Ambition (357) * @author Janiko, Pandragon */ -public final class Q00357_WarehouseKeepersAmbition extends Quest -{ +public final class Q00357_WarehouseKeepersAmbition extends Quest { // NPC private static final int SILVA = 30686; // Item @@ -47,8 +46,7 @@ public final class Q00357_WarehouseKeepersAmbition extends Quest // Misc private static final int MIN_LVL = 47; - public Q00357_WarehouseKeepersAmbition() - { + public Q00357_WarehouseKeepersAmbition() { super(357, Q00357_WarehouseKeepersAmbition.class.getSimpleName(), "Warehouse Keeper's Ambition"); addStartNpc(SILVA); addTalkId(SILVA); @@ -57,44 +55,33 @@ public final class Q00357_WarehouseKeepersAmbition extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs != null) - { - switch (event) - { + if (qs != null) { + switch (event) { case "30686-01.htm": case "30686-03.htm": case "30686-04.htm": - case "30686-10.html": - { + case "30686-10.html": { htmltext = event; break; } - case "30686-05.htm": - { - if (qs.isCreated()) - { + case "30686-05.htm": { + if (qs.isCreated()) { qs.startQuest(); htmltext = event; } break; } - case "30686-09.html": - { + case "30686-09.html": { final long crystalCount = getQuestItemsCount(player, JADE_CRYSTAL); - if (crystalCount > 0) - { + if (crystalCount > 0) { long adenaReward = crystalCount * 425; - if (crystalCount < 100) - { + if (crystalCount < 100) { adenaReward += 13500; htmltext = "30686-08.html"; - } - else - { + } else { adenaReward += 40500; htmltext = event; } @@ -103,11 +90,9 @@ public final class Q00357_WarehouseKeepersAmbition extends Quest } break; } - case "30686-11.html": - { + case "30686-11.html": { final long crystalCount = getQuestItemsCount(player, JADE_CRYSTAL); - if (crystalCount > 0) - { + if (crystalCount > 0) { giveAdena(player, (crystalCount * 425) + ((crystalCount >= 100) ? 40500 : 0), true); takeItems(player, JADE_CRYSTAL, -1); } @@ -121,27 +106,21 @@ public final class Q00357_WarehouseKeepersAmbition extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - if (qs.isCreated()) - { + if (qs.isCreated()) { htmltext = ((talker.getLevel() < MIN_LVL) ? "30686-01.html" : "30686-02.htm"); - } - else if (qs.isStarted()) - { + } else if (qs.isStarted()) { htmltext = (hasQuestItems(talker, JADE_CRYSTAL)) ? "30686-07.html" : "30686-06.html"; } return htmltext; } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc); - if (qs != null) - { + if (qs != null) { giveItemRandomly(qs.getPlayer(), npc, JADE_CRYSTAL, 1, 0, DROP_DATA.get(npc.getId()), true); } return super.onKill(npc, killer, isSummon); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00358_IllegitimateChildOfTheGoddess/Q00358_IllegitimateChildOfTheGoddess.java b/src/main/java/com/l2jserver/datapack/quests/Q00358_IllegitimateChildOfTheGoddess/Q00358_IllegitimateChildOfTheGoddess.java index a0e587d489..050e42433a 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00358_IllegitimateChildOfTheGoddess/Q00358_IllegitimateChildOfTheGoddess.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00358_IllegitimateChildOfTheGoddess/Q00358_IllegitimateChildOfTheGoddess.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Illegitimate Child of the Goddess (358) * @author Adry_85 */ -public final class Q00358_IllegitimateChildOfTheGoddess extends Quest -{ +public final class Q00358_IllegitimateChildOfTheGoddess extends Quest { // NPC private static final int OLTRAN = 30862; // Item @@ -40,8 +39,7 @@ public final class Q00358_IllegitimateChildOfTheGoddess extends Quest private static final int MIN_LEVEL = 63; private static final int SNAKE_SCALE_COUNT = 108; // Rewards - private static final int[] REWARDS = new int[] - { + private static final int[] REWARDS = new int[] { 5364, // Recipe: Sealed Dark Crystal Shield(60%) 5366, // Recipe: Sealed Shield of Nightmare(60%) 6329, // Recipe: Sealed Phoenix Necklace(70%) @@ -53,14 +51,12 @@ public final class Q00358_IllegitimateChildOfTheGoddess extends Quest }; // Mobs private static final Map<Integer, Double> MOBS = new HashMap<>(); - static - { + static { MOBS.put(20672, 0.71); // trives MOBS.put(20673, 0.74); // falibati } - public Q00358_IllegitimateChildOfTheGoddess() - { + public Q00358_IllegitimateChildOfTheGoddess() { super(358, Q00358_IllegitimateChildOfTheGoddess.class.getSimpleName(), "Illegitimate Child of the Goddess"); addStartNpc(OLTRAN); addTalkId(OLTRAN); @@ -69,25 +65,20 @@ public final class Q00358_IllegitimateChildOfTheGoddess extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "30862-02.htm": - case "30862-03.htm": - { + case "30862-03.htm": { htmltext = event; break; } - case "30862-04.htm": - { + case "30862-04.htm": { st.startQuest(); htmltext = event; break; @@ -97,33 +88,24 @@ public final class Q00358_IllegitimateChildOfTheGoddess extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getRandomPartyMemberState(player, 1, 3, npc); - if ((st != null) && st.giveItemRandomly(npc, SNAKE_SCALE, 1, SNAKE_SCALE_COUNT, MOBS.get(npc.getId()), true)) - { + if ((st != null) && st.giveItemRandomly(npc, SNAKE_SCALE, 1, SNAKE_SCALE_COUNT, MOBS.get(npc.getId()), true)) { st.setCond(2, true); } return super.onKill(npc, player, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCreated()) - { + if (st.isCreated()) { htmltext = ((player.getLevel() >= MIN_LEVEL) ? "30862-01.htm" : "30862-05.html"); - } - else if (st.isStarted()) - { - if (getQuestItemsCount(player, SNAKE_SCALE) < SNAKE_SCALE_COUNT) - { + } else if (st.isStarted()) { + if (getQuestItemsCount(player, SNAKE_SCALE) < SNAKE_SCALE_COUNT) { htmltext = "30862-06.html"; - } - else - { + } else { rewardItems(player, REWARDS[getRandom(REWARDS.length)], 1); st.exitQuest(true, true); htmltext = "30862-07.html"; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00359_ForASleeplessDeadman/Q00359_ForASleeplessDeadman.java b/src/main/java/com/l2jserver/datapack/quests/Q00359_ForASleeplessDeadman/Q00359_ForASleeplessDeadman.java index 80faf3c7a9..ba5f40bba1 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00359_ForASleeplessDeadman/Q00359_ForASleeplessDeadman.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00359_ForASleeplessDeadman/Q00359_ForASleeplessDeadman.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * For a Sleepless Deadman (359) * @author Adry_85 */ -public final class Q00359_ForASleeplessDeadman extends Quest -{ +public final class Q00359_ForASleeplessDeadman extends Quest { // NPC private static final int ORVEN = 30857; // Item @@ -40,8 +39,7 @@ public final class Q00359_ForASleeplessDeadman extends Quest private static final int MIN_LEVEL = 60; private static final int REMAINS_COUNT = 60; // Rewards - private static final int[] REWARDS = new int[] - { + private static final int[] REWARDS = new int[] { 5494, // Sealed Dark Crystal Shield Fragment 5495, // Sealed Shield of Nightmare Fragment 6341, // Sealed Phoenix Earring Gemstone @@ -53,15 +51,13 @@ public final class Q00359_ForASleeplessDeadman extends Quest }; // Mobs private static final Map<Integer, Double> MOBS = new HashMap<>(); - static - { + static { MOBS.put(21006, 0.365); // doom_servant MOBS.put(21007, 0.392); // doom_guard MOBS.put(21008, 0.503); // doom_archer } - public Q00359_ForASleeplessDeadman() - { + public Q00359_ForASleeplessDeadman() { super(359, Q00359_ForASleeplessDeadman.class.getSimpleName(), "For a Sleepless Deadman"); addStartNpc(ORVEN); addTalkId(ORVEN); @@ -70,33 +66,27 @@ public final class Q00359_ForASleeplessDeadman extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "30857-02.htm": case "30857-03.htm": - case "30857-04.htm": - { + case "30857-04.htm": { htmltext = event; break; } - case "30857-05.htm": - { + case "30857-05.htm": { st.setMemoState(1); st.startQuest(); htmltext = event; break; } - case "30857-10.html": - { + case "30857-10.html": { rewardItems(player, REWARDS[getRandom(REWARDS.length)], 4); st.exitQuest(true, true); htmltext = event; @@ -107,43 +97,31 @@ public final class Q00359_ForASleeplessDeadman extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getRandomPartyMemberState(player, 1, 3, npc); - if ((st != null) && st.giveItemRandomly(npc, REMAINS_OF_ADEN_RESIDENTS, 1, REMAINS_COUNT, MOBS.get(npc.getId()), true)) - { + if ((st != null) && st.giveItemRandomly(npc, REMAINS_OF_ADEN_RESIDENTS, 1, REMAINS_COUNT, MOBS.get(npc.getId()), true)) { st.setCond(2, true); } return super.onKill(npc, player, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCreated()) - { + if (st.isCreated()) { htmltext = ((player.getLevel() >= MIN_LEVEL) ? "30857-01.htm" : "30857-06.html"); - } - else if (st.isStarted()) - { - if (st.isMemoState(1)) - { - if (getQuestItemsCount(player, REMAINS_OF_ADEN_RESIDENTS) < REMAINS_COUNT) - { + } else if (st.isStarted()) { + if (st.isMemoState(1)) { + if (getQuestItemsCount(player, REMAINS_OF_ADEN_RESIDENTS) < REMAINS_COUNT) { htmltext = "30857-07.html"; - } - else - { + } else { takeItems(player, REMAINS_OF_ADEN_RESIDENTS, -1); st.setMemoState(2); st.setCond(3, true); htmltext = "30857-08.html"; } - } - else if (st.isMemoState(2)) - { + } else if (st.isMemoState(2)) { htmltext = "30857-09.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00360_PlunderTheirSupplies/Q00360_PlunderTheirSupplies.java b/src/main/java/com/l2jserver/datapack/quests/Q00360_PlunderTheirSupplies/Q00360_PlunderTheirSupplies.java index 35b9869881..384fa7abb2 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00360_PlunderTheirSupplies/Q00360_PlunderTheirSupplies.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00360_PlunderTheirSupplies/Q00360_PlunderTheirSupplies.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.util.Util; * Plunder Supplies (360) * @author netvirus */ -public final class Q00360_PlunderTheirSupplies extends Quest -{ +public final class Q00360_PlunderTheirSupplies extends Quest { // Npc private static final int COLEMAN = 30873; // Misc @@ -46,14 +45,12 @@ public final class Q00360_PlunderTheirSupplies extends Quest private static final int SUPPLY_ITEMS = 5872; private static final int SUSPICIOUS_DOCUMENT_PIECE = 5871; - static - { + static { MONSTER_DROP_CHANCES.put(20666, 50); // Taik Orc Seeker MONSTER_DROP_CHANCES.put(20669, 75); // Taik Orc Supply Leader } - public Q00360_PlunderTheirSupplies() - { + public Q00360_PlunderTheirSupplies() { super(360, Q00360_PlunderTheirSupplies.class.getSimpleName(), "Plunder Their Supplies"); addStartNpc(COLEMAN); addTalkId(COLEMAN); @@ -62,31 +59,25 @@ public final class Q00360_PlunderTheirSupplies extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { + switch (event) { case "30873-03.htm": - case "30873-09.html": - { + case "30873-09.html": { htmltext = event; break; } - case "30873-04.htm": - { + case "30873-04.htm": { st.startQuest(); htmltext = event; break; } - case "30873-10.html": - { + case "30873-10.html": { st.exitQuest(false, true); htmltext = event; break; @@ -96,28 +87,21 @@ public final class Q00360_PlunderTheirSupplies extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isPet) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isPet) { final QuestState st = getQuestState(killer, false); - if ((st == null) || !Util.checkIfInRange(1500, npc, killer, false)) - { + if ((st == null) || !Util.checkIfInRange(1500, npc, killer, false)) { return super.onKill(npc, killer, isPet); } - if (getRandom(100) < MONSTER_DROP_CHANCES.get(npc.getId())) - { + if (getRandom(100) < MONSTER_DROP_CHANCES.get(npc.getId())) { st.giveItems(SUPPLY_ITEMS, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } - if (getRandom(100) < 10) - { - if (st.getQuestItemsCount(SUSPICIOUS_DOCUMENT_PIECE) < 4) - { + if (getRandom(100) < 10) { + if (st.getQuestItemsCount(SUSPICIOUS_DOCUMENT_PIECE) < 4) { st.giveItems(SUSPICIOUS_DOCUMENT_PIECE, 1); - } - else - { + } else { st.giveItems(RECIPE_OF_SUPPLY, 1); st.takeItems(SUSPICIOUS_DOCUMENT_PIECE, -1); } @@ -127,44 +111,31 @@ public final class Q00360_PlunderTheirSupplies extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getLevel() >= MIN_LVL) ? "30873-02.htm" : "30873-01.html"; break; } - case State.STARTED: - { + case State.STARTED: { final long supplyCount = st.getQuestItemsCount(SUPPLY_ITEMS); final long recipeCount = st.getQuestItemsCount(RECIPE_OF_SUPPLY); - if (supplyCount == 0) - { - if (recipeCount == 0) - { + if (supplyCount == 0) { + if (recipeCount == 0) { htmltext = "30873-05.html"; - } - else - { + } else { st.giveAdena((recipeCount * 6000), true); st.takeItems(RECIPE_OF_SUPPLY, -1); htmltext = "30873-08.html"; } - } - else - { - if (recipeCount == 0) - { + } else { + if (recipeCount == 0) { st.giveAdena(((supplyCount * 100) + 6000), true); st.takeItems(SUPPLY_ITEMS, -1); htmltext = "30873-06.html"; - } - else - { + } else { st.giveAdena((((supplyCount * 100) + 6000) + (recipeCount * 6000)), true); st.takeItems(SUPPLY_ITEMS, -1); st.takeItems(RECIPE_OF_SUPPLY, -1); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00362_BardsMandolin/Q00362_BardsMandolin.java b/src/main/java/com/l2jserver/datapack/quests/Q00362_BardsMandolin/Q00362_BardsMandolin.java index 5411071935..e2317cad40 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00362_BardsMandolin/Q00362_BardsMandolin.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00362_BardsMandolin/Q00362_BardsMandolin.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.State; * Bard's Mandolin (362) * @author Adry_85 */ -public final class Q00362_BardsMandolin extends Quest -{ +public final class Q00362_BardsMandolin extends Quest { // NPCs private static final int WOODROW = 30837; private static final int NANARIN = 30956; @@ -42,8 +41,7 @@ public final class Q00362_BardsMandolin extends Quest // Misc private static final int MIN_LEVEL = 15; - public Q00362_BardsMandolin() - { + public Q00362_BardsMandolin() { super(362, Q00362_BardsMandolin.class.getSimpleName(), "Bard's Mandolin"); addStartNpc(SWAN); addTalkId(SWAN, GALION, WOODROW, NANARIN); @@ -51,29 +49,23 @@ public final class Q00362_BardsMandolin extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "30957-02.htm": - { + switch (event) { + case "30957-02.htm": { st.startQuest(); st.setMemoState(1); htmltext = event; break; } case "30957-07.html": - case "30957-08.html": - { - if (st.isMemoState(5)) - { + case "30957-08.html": { + if (st.isMemoState(5)) { st.giveAdena(10000, true); st.rewardItems(THEME_OF_JOURNEY, 1); st.exitQuest(true, true); @@ -86,100 +78,74 @@ public final class Q00362_BardsMandolin extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { - if (npc.getId() == SWAN) - { + switch (st.getState()) { + case State.CREATED: { + if (npc.getId() == SWAN) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "30957-01.htm" : "30957-03.html"; } break; } - case State.STARTED: - { - switch (npc.getId()) - { - case SWAN: - { - switch (st.getMemoState()) - { + case State.STARTED: { + switch (npc.getId()) { + case SWAN: { + switch (st.getMemoState()) { case 1: - case 2: - { + case 2: { htmltext = "30957-04.html"; break; } - case 3: - { + case 3: { st.setCond(4, true); st.setMemoState(4); st.giveItems(SWANS_LETTER, 1); htmltext = "30957-05.html"; break; } - case 4: - { + case 4: { htmltext = "30957-05.html"; break; } - case 5: - { + case 5: { htmltext = "30957-06.html"; break; } } break; } - case GALION: - { - if (st.isMemoState(2)) - { + case GALION: { + if (st.isMemoState(2)) { st.setMemoState(3); st.setCond(3, true); st.giveItems(SWANS_FLUTE, 1); htmltext = "30958-01.html"; - } - else if (st.getMemoState() >= 3) - { + } else if (st.getMemoState() >= 3) { htmltext = "30958-02.html"; } break; } - case WOODROW: - { - if (st.isMemoState(1)) - { + case WOODROW: { + if (st.isMemoState(1)) { st.setMemoState(2); st.setCond(2, true); htmltext = "30837-01.html"; - } - else if (st.isMemoState(2)) - { + } else if (st.isMemoState(2)) { htmltext = "30837-02.html"; - } - else if (st.getMemoState() >= 3) - { + } else if (st.getMemoState() >= 3) { htmltext = "30837-03.html"; } break; } - case NANARIN: - { - if (st.isMemoState(4) && st.hasQuestItems(SWANS_FLUTE, SWANS_LETTER)) - { + case NANARIN: { + if (st.isMemoState(4) && st.hasQuestItems(SWANS_FLUTE, SWANS_LETTER)) { st.setMemoState(5); st.setCond(5, true); st.takeItems(SWANS_FLUTE, -1); st.takeItems(SWANS_LETTER, -1); htmltext = "30956-01.html"; - } - else if (st.getMemoState() >= 5) - { + } else if (st.getMemoState() >= 5) { htmltext = "30956-02.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00363_SorrowfulSoundOfFlute/Q00363_SorrowfulSoundOfFlute.java b/src/main/java/com/l2jserver/datapack/quests/Q00363_SorrowfulSoundOfFlute/Q00363_SorrowfulSoundOfFlute.java index 7540ac4650..b973c708bd 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00363_SorrowfulSoundOfFlute/Q00363_SorrowfulSoundOfFlute.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00363_SorrowfulSoundOfFlute/Q00363_SorrowfulSoundOfFlute.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * Sorrowful Sound of Flute (363) * @author Adry_85 */ -public final class Q00363_SorrowfulSoundOfFlute extends Quest -{ +public final class Q00363_SorrowfulSoundOfFlute extends Quest { // NPCs private static final int ALDO = 30057; private static final int HOLVAS = 30058; @@ -47,8 +46,7 @@ public final class Q00363_SorrowfulSoundOfFlute extends Quest // Misc private static final int MIN_LEVEL = 15; - public Q00363_SorrowfulSoundOfFlute() - { + public Q00363_SorrowfulSoundOfFlute() { super(363, Q00363_SorrowfulSoundOfFlute.class.getSimpleName(), "Sorrowful Sound of Flute"); addStartNpc(NANARIN); addTalkId(NANARIN, POITAN, RANSPO, ALDO, HOLVAS, OPIX, BARBADO); @@ -56,49 +54,39 @@ public final class Q00363_SorrowfulSoundOfFlute extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "START": - { - if (player.getLevel() >= MIN_LEVEL) - { + switch (event) { + case "START": { + if (player.getLevel() >= MIN_LEVEL) { st.startQuest(); st.setMemoState(2); htmltext = "30956-02.htm"; - } - else - { + } else { htmltext = "30956-03.htm"; } break; } - case "30956-05.html": - { + case "30956-05.html": { st.giveItems(EVENT_CLOTHES, 1); st.setMemoState(4); st.setCond(3, true); htmltext = event; break; } - case "30956-06.html": - { + case "30956-06.html": { st.giveItems(NANARINS_FLUTE, 1); st.setMemoState(4); st.setCond(3, true); htmltext = event; break; } - case "30956-07.html": - { + case "30956-07.html": { st.giveItems(SABRINS_BLACK_BEER, 1); st.setMemoState(4); st.setCond(3, true); @@ -110,47 +98,35 @@ public final class Q00363_SorrowfulSoundOfFlute extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { - if (npc.getId() == NANARIN) - { + switch (st.getState()) { + case State.CREATED: { + if (npc.getId() == NANARIN) { htmltext = "30956-01.htm"; } break; } - case State.STARTED: - { - switch (npc.getId()) - { - case NANARIN: - { - switch (st.getMemoState()) - { - case 2: - { + case State.STARTED: { + switch (npc.getId()) { + case NANARIN: { + switch (st.getMemoState()) { + case 2: { htmltext = "30956-04.html"; break; } - case 4: - { + case 4: { htmltext = "30956-08.html"; break; } - case 5: - { + case 5: { st.rewardItems(THEME_OF_SOLITUDE, 1); st.exitQuest(true, true); htmltext = "30956-09.html"; break; } - case 6: - { + case 6: { st.exitQuest(true, false); st.playSound(Sound.ITEMSOUND_QUEST_GIVEUP); htmltext = "30956-10.html"; @@ -159,198 +135,146 @@ public final class Q00363_SorrowfulSoundOfFlute extends Quest } break; } - case POITAN: - { - if (st.isMemoState(2) && ((st.getInt("ex") % 100) < 10)) - { + case POITAN: { + if (st.isMemoState(2) && ((st.getInt("ex") % 100) < 10)) { int ex = st.getInt("ex"); st.set("ex", ex + 11); - switch (getRandom(3)) - { - case 0: - { + switch (getRandom(3)) { + case 0: { htmltext = "30458-01.html"; break; } - case 1: - { + case 1: { htmltext = "30458-02.html"; break; } - case 2: - { + case 2: { htmltext = "30458-03.html"; break; } } st.setCond(2, true); - } - else if ((st.getMemoState() >= 2) && ((st.getInt("ex") % 100) >= 10)) - { + } else if ((st.getMemoState() >= 2) && ((st.getInt("ex") % 100) >= 10)) { htmltext = "30458-04.html"; } break; } - case RANSPO: - { - if (st.isMemoState(2) && ((st.getInt("ex") % 10000) < 1000)) - { + case RANSPO: { + if (st.isMemoState(2) && ((st.getInt("ex") % 10000) < 1000)) { int ex = st.getInt("ex"); st.set("ex", ex + 1001); - switch (getRandom(3)) - { - case 0: - { + switch (getRandom(3)) { + case 0: { htmltext = "30594-01.html"; break; } - case 1: - { + case 1: { htmltext = "30594-02.html"; break; } - case 2: - { + case 2: { htmltext = "30594-03.html"; break; } } st.setCond(2, true); - } - else if ((st.getMemoState() >= 2) && ((st.getInt("ex") % 10000) >= 1000)) - { + } else if ((st.getMemoState() >= 2) && ((st.getInt("ex") % 10000) >= 1000)) { htmltext = "30594-04.html"; } break; } - case ALDO: - { - if (st.isMemoState(2) && ((st.getInt("ex") % 100000) < 10000)) - { + case ALDO: { + if (st.isMemoState(2) && ((st.getInt("ex") % 100000) < 10000)) { int ex = st.getInt("ex"); st.set("ex", ex + 10001); - switch (getRandom(3)) - { - case 0: - { + switch (getRandom(3)) { + case 0: { htmltext = "30057-01.html"; break; } - case 1: - { + case 1: { htmltext = "30057-02.html"; break; } - case 2: - { + case 2: { htmltext = "30057-03.html"; break; } } st.setCond(2, true); - } - else if ((st.getMemoState() >= 2) && ((st.getInt("ex") % 100000) >= 10000)) - { + } else if ((st.getMemoState() >= 2) && ((st.getInt("ex") % 100000) >= 10000)) { htmltext = "30057-04.html"; } break; } - case HOLVAS: - { - if (st.isMemoState(2) && ((st.getInt("ex") % 1000) < 100)) - { + case HOLVAS: { + if (st.isMemoState(2) && ((st.getInt("ex") % 1000) < 100)) { int ex = st.getInt("ex"); st.set("ex", ex + 101); - switch (getRandom(3)) - { - case 0: - { + switch (getRandom(3)) { + case 0: { htmltext = "30058-01.html"; break; } - case 1: - { + case 1: { htmltext = "30058-02.html"; break; } - case 2: - { + case 2: { htmltext = "30058-03.html"; break; } } st.setCond(2, true); - } - else if ((st.getMemoState() >= 2) && ((st.getInt("ex") % 1000) >= 100)) - { + } else if ((st.getMemoState() >= 2) && ((st.getInt("ex") % 1000) >= 100)) { htmltext = "30058-04.html"; } break; } - case OPIX: - { - if (st.isMemoState(2) && (st.getInt("ex") < 100000)) - { + case OPIX: { + if (st.isMemoState(2) && (st.getInt("ex") < 100000)) { int ex = st.getInt("ex"); st.set("ex", ex + 100001); - switch (getRandom(3)) - { - case 0: - { + switch (getRandom(3)) { + case 0: { htmltext = "30595-01.html"; break; } - case 1: - { + case 1: { htmltext = "30595-02.html"; break; } - case 2: - { + case 2: { htmltext = "30595-03.html"; break; } } st.setCond(2, true); - } - else if ((st.getMemoState() >= 2) && (st.getInt("ex") >= 100000)) - { + } else if ((st.getMemoState() >= 2) && (st.getInt("ex") >= 100000)) { htmltext = "30595-04.html"; } break; } - case BARBADO: - { - if (st.isMemoState(4)) - { + case BARBADO: { + if (st.isMemoState(4)) { int ex = (st.getInt("ex") % 10) * 20; - if (getRandom(100) < ex) - { - if (st.hasQuestItems(EVENT_CLOTHES)) - { + if (getRandom(100) < ex) { + if (st.hasQuestItems(EVENT_CLOTHES)) { st.takeItems(EVENT_CLOTHES, -1); - } - else if (st.hasQuestItems(NANARINS_FLUTE)) - { + } else if (st.hasQuestItems(NANARINS_FLUTE)) { st.takeItems(NANARINS_FLUTE, -1); - } - else if (st.hasQuestItems(SABRINS_BLACK_BEER)) - { + } else if (st.hasQuestItems(SABRINS_BLACK_BEER)) { st.takeItems(SABRINS_BLACK_BEER, -1); } st.setMemoState(5); st.setCond(4, true); htmltext = "30959-01.html"; - } - else - { + } else { st.setMemoState(6); st.setCond(4, true); htmltext = "30959-02.html"; } - } - else if (st.getMemoState() >= 5) - { + } else if (st.getMemoState() >= 5) { htmltext = "30959-03.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00364_JovialAccordion/Q00364_JovialAccordion.java b/src/main/java/com/l2jserver/datapack/quests/Q00364_JovialAccordion/Q00364_JovialAccordion.java index 0bce4d3f48..e3bef31dd0 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00364_JovialAccordion/Q00364_JovialAccordion.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00364_JovialAccordion/Q00364_JovialAccordion.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * Jovial Accordion (364) * @author Adry_85 */ -public final class Q00364_JovialAccordion extends Quest -{ +public final class Q00364_JovialAccordion extends Quest { // NPCs private static final int SABRIN = 30060; private static final int XABER = 30075; @@ -47,8 +46,7 @@ public final class Q00364_JovialAccordion extends Quest // Misc private static final int MIN_LEVEL = 15; - public Q00364_JovialAccordion() - { + public Q00364_JovialAccordion() { super(364, Q00364_JovialAccordion.class.getSimpleName(), "Jovial Accordion"); addStartNpc(BARBADO); addTalkId(BARBADO, BEER_CHEST, CLOTH_CHEST, SABRIN, XABER, SWAN); @@ -56,75 +54,53 @@ public final class Q00364_JovialAccordion extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "START": - { - if (player.getLevel() >= MIN_LEVEL) - { + switch (event) { + case "START": { + if (player.getLevel() >= MIN_LEVEL) { st.startQuest(); st.setMemoState(1); htmltext = "30959-02.htm"; - } - else - { + } else { htmltext = "30959-03.htm"; } break; } - case "OPEN_CHEST": - { - if (st.hasQuestItems(BEER_CHEST_KEY)) - { - if (getRandomBoolean()) - { + case "OPEN_CHEST": { + if (st.hasQuestItems(BEER_CHEST_KEY)) { + if (getRandomBoolean()) { st.giveItems(STOLEN_BLACK_BEER, 1); htmltext = "30960-02.html"; - } - else - { + } else { htmltext = "30960-03.html"; } st.takeItems(BEER_CHEST_KEY, -1); - } - else - { + } else { htmltext = "30960-04.html"; } break; } - case "OPEN_CLOTH_CHEST": - { - if (st.hasQuestItems(CLOTHES_CHEST_KEY)) - { - if (getRandomBoolean()) - { + case "OPEN_CLOTH_CHEST": { + if (st.hasQuestItems(CLOTHES_CHEST_KEY)) { + if (getRandomBoolean()) { st.giveItems(STOLEN_EVENT_CLOTHES, 1); htmltext = "30961-02.html"; - } - else - { + } else { htmltext = "30961-03.html"; } st.takeItems(CLOTHES_CHEST_KEY, -1); - } - else - { + } else { htmltext = "30961-04.html"; } break; } - case "30957-02.html": - { + case "30957-02.html": { st.giveItems(CLOTHES_CHEST_KEY, 1); st.giveItems(BEER_CHEST_KEY, 1); st.setMemoState(2); @@ -137,38 +113,28 @@ public final class Q00364_JovialAccordion extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { - if (npc.getId() == BARBADO) - { + switch (st.getState()) { + case State.CREATED: { + if (npc.getId() == BARBADO) { htmltext = "30959-01.htm"; } break; } - case State.STARTED: - { - switch (npc.getId()) - { - case BARBADO: - { - switch (st.getMemoState()) - { + case State.STARTED: { + switch (npc.getId()) { + case BARBADO: { + switch (st.getMemoState()) { case 1: case 2: case 3: - case 4: - { + case 4: { htmltext = "30959-04.html"; break; } - case 5: - { + case 5: { st.rewardItems(THEME_OF_THE_FEAST, 1); st.exitQuest(true, true); htmltext = "30959-05.html"; @@ -177,84 +143,58 @@ public final class Q00364_JovialAccordion extends Quest } break; } - case BEER_CHEST: - { + case BEER_CHEST: { htmltext = "30960-01.html"; break; } - case CLOTH_CHEST: - { + case CLOTH_CHEST: { htmltext = "30961-01.html"; break; } - case SABRIN: - { - if (st.hasQuestItems(STOLEN_BLACK_BEER)) - { + case SABRIN: { + if (st.hasQuestItems(STOLEN_BLACK_BEER)) { st.takeItems(STOLEN_BLACK_BEER, -1); htmltext = "30060-01.html"; - if (st.isMemoState(2)) - { + if (st.isMemoState(2)) { st.setMemoState(3); - } - else if (st.isMemoState(3)) - { + } else if (st.isMemoState(3)) { st.setMemoState(4); } - } - else - { + } else { htmltext = "30060-02.html"; } break; } - case XABER: - { - if (st.hasQuestItems(STOLEN_EVENT_CLOTHES)) - { + case XABER: { + if (st.hasQuestItems(STOLEN_EVENT_CLOTHES)) { st.takeItems(STOLEN_EVENT_CLOTHES, -1); htmltext = "30075-01.html"; - if (st.isMemoState(2)) - { + if (st.isMemoState(2)) { st.setMemoState(3); - } - else if (st.isMemoState(3)) - { + } else if (st.isMemoState(3)) { st.setMemoState(4); } - } - else - { + } else { htmltext = "30075-02.html"; } break; } - case SWAN: - { - switch (st.getMemoState()) - { - case 1: - { + case SWAN: { + switch (st.getMemoState()) { + case 1: { htmltext = "30957-01.html"; break; } case 2: - case 3: - { - if (hasAtLeastOneQuestItem(player, BEER_CHEST_KEY, CLOTHES_CHEST_KEY, STOLEN_BLACK_BEER, STOLEN_EVENT_CLOTHES)) - { + case 3: { + if (hasAtLeastOneQuestItem(player, BEER_CHEST_KEY, CLOTHES_CHEST_KEY, STOLEN_BLACK_BEER, STOLEN_EVENT_CLOTHES)) { htmltext = "30957-03.html"; - } - else if (!st.hasQuestItems(BEER_CHEST_KEY, CLOTHES_CHEST_KEY, STOLEN_BLACK_BEER, STOLEN_EVENT_CLOTHES)) - { - if (st.isMemoState(2)) - { + } else if (!st.hasQuestItems(BEER_CHEST_KEY, CLOTHES_CHEST_KEY, STOLEN_BLACK_BEER, STOLEN_EVENT_CLOTHES)) { + if (st.isMemoState(2)) { st.playSound(Sound.ITEMSOUND_QUEST_GIVEUP); st.exitQuest(true, true); htmltext = "30957-06.html"; - } - else - { + } else { st.setMemoState(5); st.setCond(3, true); htmltext = "30957-04.html"; @@ -262,10 +202,8 @@ public final class Q00364_JovialAccordion extends Quest } break; } - case 4: - { - if (!st.hasQuestItems(BEER_CHEST_KEY, CLOTHES_CHEST_KEY, STOLEN_BLACK_BEER, STOLEN_EVENT_CLOTHES)) - { + case 4: { + if (!st.hasQuestItems(BEER_CHEST_KEY, CLOTHES_CHEST_KEY, STOLEN_BLACK_BEER, STOLEN_EVENT_CLOTHES)) { st.setMemoState(5); st.setCond(3, true); st.giveAdena(100, true); @@ -273,8 +211,7 @@ public final class Q00364_JovialAccordion extends Quest } break; } - case 5: - { + case 5: { htmltext = "30957-07.html"; break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00365_DevilsLegacy/Q00365_DevilsLegacy.java b/src/main/java/com/l2jserver/datapack/quests/Q00365_DevilsLegacy/Q00365_DevilsLegacy.java index 6b8ab9fcbb..7f9c31f6fe 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00365_DevilsLegacy/Q00365_DevilsLegacy.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00365_DevilsLegacy/Q00365_DevilsLegacy.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Devil's Legacy (365) * @author Adry_85 */ -public final class Q00365_DevilsLegacy extends Quest -{ +public final class Q00365_DevilsLegacy extends Quest { // NPCs private static final int COLLOB = 30092; private static final int RANDOLF = 30095; @@ -57,16 +56,14 @@ public final class Q00365_DevilsLegacy extends Quest private static final SkillHolder POISON = new SkillHolder(4035, 2); // Mobs private static final Map<Integer, Double> MOBS = new HashMap<>(); - static - { + static { MOBS.put(20836, 0.47); // pirates_zombie MOBS.put(20845, 0.40); // pirates_zombie_captain MOBS.put(21629, 0.40); // pirates_zombie_captain_1 MOBS.put(21630, 0.40); // pirates_zombie_captain_2 } - public Q00365_DevilsLegacy() - { + public Q00365_DevilsLegacy() { super(365, Q00365_DevilsLegacy.class.getSimpleName(), "Devil's Legacy"); addStartNpc(RANDOLF); addTalkId(RANDOLF, COLLOB); @@ -75,111 +72,70 @@ public final class Q00365_DevilsLegacy extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { - case "30095-02.htm": - { + switch (event) { + case "30095-02.htm": { qs.startQuest(); qs.setMemoState(1); htmltext = event; break; } - case "30095-05.html": - { + case "30095-05.html": { qs.exitQuest(true, true); htmltext = event; break; } - case "30095-06.html": - { + case "30095-06.html": { htmltext = event; break; } - case "REWARD": - { - if (!qs.isMemoState(1)) - { + case "REWARD": { + if (!qs.isMemoState(1)) { htmltext = "30092-04.html"; - } - else if (!hasQuestItems(player, PIRATES_TREASURE_CHEST)) - { + } else if (!hasQuestItems(player, PIRATES_TREASURE_CHEST)) { htmltext = "30092-02.html"; - } - else if (player.getAdena() < 600) - { + } else if (player.getAdena() < 600) { htmltext = "30092-03.html"; - } - else - { + } else { final int itemId; final int chance; - if (getRandom(100) < 80) - { + if (getRandom(100) < 80) { chance = getRandom(100); - if (chance < 1) - { + if (chance < 1) { itemId = ENCHANT_WEAPON_D; - } - else if (chance < 4) - { + } else if (chance < 4) { itemId = ENCHANT_ARMOR_D; - } - else if (chance < 36) - { + } else if (chance < 36) { itemId = THREAD; - } - else if (chance < 68) - { + } else if (chance < 68) { itemId = CORD; - } - else - { + } else { itemId = ANIMAL_BONE; } htmltext = "30092-05.html"; - } - else - { + } else { chance = getRandom(1000); - if (chance < 10) - { + if (chance < 10) { itemId = ENCHANT_WEAPON_C; - } - else if (chance < 40) - { + } else if (chance < 40) { itemId = ENCHANT_ARMOR_C; - } - else if (chance < 60) - { + } else if (chance < 60) { itemId = ENCHANT_WEAPON_D; - } - else if (chance < 260) - { + } else if (chance < 260) { itemId = ENCHANT_ARMOR_D; - } - else if (chance < 445) - { + } else if (chance < 445) { itemId = COKES; - } - else if (chance < 630) - { + } else if (chance < 630) { itemId = STEEL; - } - else if (chance < 815) - { + } else if (chance < 815) { itemId = LEATHER; - } - else - { + } else { itemId = COARSE_BONE_POWDER; } npc.setTarget(player); @@ -199,49 +155,36 @@ public final class Q00365_DevilsLegacy extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(player, -1, 3, npc); - if (qs != null) - { + if (qs != null) { giveItemRandomly(qs.getPlayer(), npc, PIRATES_TREASURE_CHEST, 1, 0, MOBS.get(npc.getId()), true); } return super.onKill(npc, player, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (npc.getId()) - { - case RANDOLF: - { - if (qs.isCreated()) - { + switch (npc.getId()) { + case RANDOLF: { + if (qs.isCreated()) { htmltext = ((player.getLevel() >= MIN_LEVEL) ? "30095-01.htm" : "30095-03.html"); - } - else if (qs.isStarted()) - { - if (hasQuestItems(player, PIRATES_TREASURE_CHEST)) - { + } else if (qs.isStarted()) { + if (hasQuestItems(player, PIRATES_TREASURE_CHEST)) { final long chestCount = getQuestItemsCount(player, PIRATES_TREASURE_CHEST); giveAdena(player, (chestCount * 400) + 19800, true); takeItems(player, PIRATES_TREASURE_CHEST, -1); htmltext = "30095-04.html"; - } - else - { + } else { htmltext = "30095-07.html"; } } break; } - case COLLOB: - { - if (qs.isStarted()) - { + case COLLOB: { + if (qs.isStarted()) { htmltext = (qs.isMemoState(1) ? "30092-01.html" : "30092-07.html"); } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00366_SilverHairedShaman/Q00366_SilverHairedShaman.java b/src/main/java/com/l2jserver/datapack/quests/Q00366_SilverHairedShaman/Q00366_SilverHairedShaman.java index 5b131cd781..18ff598f05 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00366_SilverHairedShaman/Q00366_SilverHairedShaman.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00366_SilverHairedShaman/Q00366_SilverHairedShaman.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Silver Haired Shaman (366) * @author Adry_85, jurchiks */ -public final class Q00366_SilverHairedShaman extends Quest -{ +public final class Q00366_SilverHairedShaman extends Quest { // NPC private static final int DIETER = 30111; // Item @@ -40,15 +39,13 @@ public final class Q00366_SilverHairedShaman extends Quest private static final int MIN_LEVEL = 48; // Mobs private static final Map<Integer, Integer> MOBS = new HashMap<>(); - static - { + static { MOBS.put(20986, 80); // saitnn MOBS.put(20987, 73); // saitnn_doll MOBS.put(20988, 80); // saitnn_puppet } - public Q00366_SilverHairedShaman() - { + public Q00366_SilverHairedShaman() { super(366, Q00366_SilverHairedShaman.class.getSimpleName(), "Silver Haired Shaman"); addStartNpc(DIETER); addTalkId(DIETER); @@ -57,38 +54,31 @@ public final class Q00366_SilverHairedShaman extends Quest } @Override - public boolean checkPartyMember(L2PcInstance member, L2Npc npc) - { + public boolean checkPartyMember(L2PcInstance member, L2Npc npc) { final QuestState qs = getQuestState(member, false); return ((qs != null) && qs.isStarted()); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "30111-02.htm": - { + switch (event) { + case "30111-02.htm": { st.startQuest(); htmltext = event; break; } - case "30111-05.html": - { + case "30111-05.html": { st.exitQuest(true, true); htmltext = event; break; } - case "30111-06.html": - { + case "30111-06.html": { htmltext = event; break; } @@ -97,13 +87,10 @@ public final class Q00366_SilverHairedShaman extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { - if (getRandom(100) < MOBS.get(npc.getId())) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { + if (getRandom(100) < MOBS.get(npc.getId())) { L2PcInstance luckyPlayer = getRandomPartyMember(player, npc); - if (luckyPlayer != null) - { + if (luckyPlayer != null) { giveItemRandomly(luckyPlayer, npc, SAIRONS_SILVER_HAIR, 1, 0, 1.0, true); } } @@ -111,25 +98,18 @@ public final class Q00366_SilverHairedShaman extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCreated()) - { + if (st.isCreated()) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "30111-01.htm" : "30111-03.html"; - } - else if (st.isStarted()) - { - if (hasQuestItems(player, SAIRONS_SILVER_HAIR)) - { + } else if (st.isStarted()) { + if (hasQuestItems(player, SAIRONS_SILVER_HAIR)) { final long itemCount = getQuestItemsCount(player, SAIRONS_SILVER_HAIR); giveAdena(player, (itemCount * 500) + 29000, true); takeItems(player, SAIRONS_SILVER_HAIR, -1); htmltext = "30111-04.html"; - } - else - { + } else { htmltext = "30111-07.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00367_ElectrifyingRecharge/Q00367_ElectrifyingRecharge.java b/src/main/java/com/l2jserver/datapack/quests/Q00367_ElectrifyingRecharge/Q00367_ElectrifyingRecharge.java index 7afc1461a1..8f15e421ef 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00367_ElectrifyingRecharge/Q00367_ElectrifyingRecharge.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00367_ElectrifyingRecharge/Q00367_ElectrifyingRecharge.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.skills.Skill; * Electrifying Recharge! (367) * @author Adry_85, jurchiks */ -public final class Q00367_ElectrifyingRecharge extends Quest -{ +public final class Q00367_ElectrifyingRecharge extends Quest { // NPC private static final int LORAIN = 30673; // Monster @@ -48,8 +47,7 @@ public final class Q00367_ElectrifyingRecharge extends Quest // Skill private static final Skill NPC_THUNDER_STORM = new SkillHolder(4072, 4).getSkill(); - public Q00367_ElectrifyingRecharge() - { + public Q00367_ElectrifyingRecharge() { super(367, Q00367_ElectrifyingRecharge.class.getSimpleName(), "Electrifying Recharge!"); addStartNpc(LORAIN); addTalkId(LORAIN); @@ -58,31 +56,25 @@ public final class Q00367_ElectrifyingRecharge extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "30673-02.htm": - { + switch (event) { + case "30673-02.htm": { st.startQuest(); giveItems(player, TITAN_LAMP1, 1); htmltext = event; break; } - case "30673-05.html": - { + case "30673-05.html": { htmltext = event; break; } - case "30673-06.html": - { + case "30673-06.html": { st.exitQuest(true, true); htmltext = event; break; @@ -92,16 +84,13 @@ public final class Q00367_ElectrifyingRecharge extends Quest } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (npc.isScriptValue(367)) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (npc.isScriptValue(367)) { return super.onAttack(npc, attacker, damage, isSummon); } QuestState qs = getQuestState(attacker, false); - if ((qs == null) || !qs.isStarted()) - { + if ((qs == null) || !qs.isStarted()) { return super.onAttack(npc, attacker, damage, isSummon); } @@ -116,44 +105,32 @@ public final class Q00367_ElectrifyingRecharge extends Quest } final L2PcInstance luckyPlayer = getRandomPartyMember(attacker, npc); - if (luckyPlayer == null) - { + if (luckyPlayer == null) { return super.onAttack(npc, attacker, damage, isSummon); } qs = getQuestState(luckyPlayer, false); - if ((qs != null) && qs.isStarted() && !hasQuestItems(luckyPlayer, TITAN_LAMP5)) - { + if ((qs != null) && qs.isStarted() && !hasQuestItems(luckyPlayer, TITAN_LAMP5)) { final int random = getRandom(37); - if (random == 0) - { - if (hasQuestItems(luckyPlayer, TITAN_LAMP1)) - { + if (random == 0) { + if (hasQuestItems(luckyPlayer, TITAN_LAMP1)) { giveItems(luckyPlayer, TITAN_LAMP2, 1); takeItems(luckyPlayer, TITAN_LAMP1, -1); playSound(luckyPlayer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else if (hasQuestItems(luckyPlayer, TITAN_LAMP2)) - { + } else if (hasQuestItems(luckyPlayer, TITAN_LAMP2)) { giveItems(luckyPlayer, TITAN_LAMP3, 1); takeItems(luckyPlayer, TITAN_LAMP2, -1); playSound(luckyPlayer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else if (hasQuestItems(luckyPlayer, TITAN_LAMP3)) - { + } else if (hasQuestItems(luckyPlayer, TITAN_LAMP3)) { giveItems(luckyPlayer, TITAN_LAMP4, 1); takeItems(luckyPlayer, TITAN_LAMP3, -1); playSound(luckyPlayer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else if (hasQuestItems(luckyPlayer, TITAN_LAMP4)) - { + } else if (hasQuestItems(luckyPlayer, TITAN_LAMP4)) { giveItems(luckyPlayer, TITAN_LAMP5, 1); takeItems(luckyPlayer, TITAN_LAMP4, -1); getQuestState(luckyPlayer, false).setCond(2, true); } - } - else if ((random == 1) && !hasQuestItems(luckyPlayer, BROKEN_TITAN_LAMP)) - { + } else if ((random == 1) && !hasQuestItems(luckyPlayer, BROKEN_TITAN_LAMP)) { giveItems(luckyPlayer, BROKEN_TITAN_LAMP, 1); takeItems(luckyPlayer, -1, TITAN_LAMP1, TITAN_LAMP2, TITAN_LAMP3, TITAN_LAMP4); playSound(luckyPlayer, Sound.ITEMSOUND_QUEST_ITEMGET); @@ -163,93 +140,70 @@ public final class Q00367_ElectrifyingRecharge extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCreated()) - { + if (st.isCreated()) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "30673-01.htm" : "30673-03.html"; - } - else if (st.isStarted()) - { - if (!hasAtLeastOneQuestItem(player, TITAN_LAMP5, BROKEN_TITAN_LAMP)) - { + } else if (st.isStarted()) { + if (!hasAtLeastOneQuestItem(player, TITAN_LAMP5, BROKEN_TITAN_LAMP)) { htmltext = "30673-04.html"; - } - else if (hasQuestItems(player, BROKEN_TITAN_LAMP)) - { + } else if (hasQuestItems(player, BROKEN_TITAN_LAMP)) { giveItems(player, TITAN_LAMP1, 1); takeItems(player, BROKEN_TITAN_LAMP, -1); htmltext = "30673-07.html"; - } - else if (hasQuestItems(player, TITAN_LAMP5)) - { + } else if (hasQuestItems(player, TITAN_LAMP5)) { final int itemId; - switch (getRandom(14)) - { - case 0: - { + switch (getRandom(14)) { + case 0: { itemId = 4553; // Greater Dye of STR <Str+1 Con-1> break; } - case 1: - { + case 1: { itemId = 4554; // Greater Dye of STR <Str+1 Dex-1> break; } - case 2: - { + case 2: { itemId = 4555; // Greater Dye of CON <Con+1 Str-1> break; } - case 3: - { + case 3: { itemId = 4556; // Greater Dye of CON <Con+1 Dex-1> break; } - case 4: - { + case 4: { itemId = 4557; // Greater Dye of DEX <Dex+1 Str-1> break; } - case 5: - { + case 5: { itemId = 4558; // Greater Dye of DEX <Dex+1 Con-1> break; } - case 6: - { + case 6: { itemId = 4559; // Greater Dye of INT <Int+1 Men-1> break; } - case 7: - { + case 7: { itemId = 4560; // Greater Dye of INT <Int+1 Wit-1> break; } - case 8: - { + case 8: { itemId = 4561; // Greater Dye of MEN <Men+1 Int-1> break; } - case 9: - { + case 9: { itemId = 4562; // Greater Dye of MEN <Men+1 Wit-1> break; } - case 10: - { + case 10: { itemId = 4563; // Greater Dye of WIT <Wit+1 Int-1> break; } - case 11: - { + case 11: { itemId = 4564; // Greater Dye of WIT <Wit+1 Men-1> break; } - default: - { + default: { itemId = 4445; // Dye of STR <Str+1 Con-3> break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00368_TrespassingIntoTheHolyGround/Q00368_TrespassingIntoTheHolyGround.java b/src/main/java/com/l2jserver/datapack/quests/Q00368_TrespassingIntoTheHolyGround/Q00368_TrespassingIntoTheHolyGround.java index f15efce757..a04146ffac 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00368_TrespassingIntoTheHolyGround/Q00368_TrespassingIntoTheHolyGround.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00368_TrespassingIntoTheHolyGround/Q00368_TrespassingIntoTheHolyGround.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Trespassing into the Holy Ground (368) * @author Adry_85 */ -public final class Q00368_TrespassingIntoTheHolyGround extends Quest -{ +public final class Q00368_TrespassingIntoTheHolyGround extends Quest { // NPC private static final int RESTINA = 30926; // Item @@ -40,16 +39,14 @@ public final class Q00368_TrespassingIntoTheHolyGround extends Quest private static final int MIN_LEVEL = 36; // Mobs private static final Map<Integer, Double> MOBS = new HashMap<>(); - static - { + static { MOBS.put(20794, 0.60); // blade_stakato MOBS.put(20795, 0.57); // blade_stakato_worker MOBS.put(20796, 0.61); // blade_stakato_soldier MOBS.put(20797, 0.93); // blade_stakato_drone } - public Q00368_TrespassingIntoTheHolyGround() - { + public Q00368_TrespassingIntoTheHolyGround() { super(368, Q00368_TrespassingIntoTheHolyGround.class.getSimpleName(), "Trespassing into the Holy Ground"); addStartNpc(RESTINA); addTalkId(RESTINA); @@ -58,31 +55,25 @@ public final class Q00368_TrespassingIntoTheHolyGround extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "30926-02.htm": - { + switch (event) { + case "30926-02.htm": { st.startQuest(); htmltext = event; break; } - case "30926-05.html": - { + case "30926-05.html": { st.exitQuest(true, true); htmltext = event; break; } - case "30926-06.html": - { + case "30926-06.html": { htmltext = event; break; } @@ -91,53 +82,41 @@ public final class Q00368_TrespassingIntoTheHolyGround extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final int i; - switch (npc.getId()) - { + switch (npc.getId()) { case 20795: - case 20797: - { + case 20797: { i = 1; break; } - default: - { + default: { i = 3; break; } } final QuestState st = getRandomPartyMemberState(player, -1, i, npc); - if (st != null) - { + if (st != null) { st.giveItemRandomly(npc, BLADE_STAKATO_FANG, 1, 0, MOBS.get(npc.getId()), true); } return super.onKill(npc, player, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCreated()) - { + if (st.isCreated()) { htmltext = ((player.getLevel() >= MIN_LEVEL) ? "30926-01.htm" : "30926-03.html"); - } - else if (st.isStarted()) - { - if (hasQuestItems(player, BLADE_STAKATO_FANG)) - { + } else if (st.isStarted()) { + if (hasQuestItems(player, BLADE_STAKATO_FANG)) { final long count = getQuestItemsCount(player, BLADE_STAKATO_FANG); final long bonus = (count >= 10 ? 9450 : 2000); giveAdena(player, (count * 250) + bonus, true); takeItems(player, BLADE_STAKATO_FANG, -1); htmltext = "30926-04.html"; - } - else - { + } else { htmltext = "30926-07.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00369_CollectorOfJewels/Q00369_CollectorOfJewels.java b/src/main/java/com/l2jserver/datapack/quests/Q00369_CollectorOfJewels/Q00369_CollectorOfJewels.java index 46d6eea995..9b05a7177c 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00369_CollectorOfJewels/Q00369_CollectorOfJewels.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00369_CollectorOfJewels/Q00369_CollectorOfJewels.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Collector of Jewels (369) * @author Adry_85 */ -public final class Q00369_CollectorOfJewels extends Quest -{ +public final class Q00369_CollectorOfJewels extends Quest { // NPC private static final int NELL = 30376; // Items @@ -42,8 +41,7 @@ public final class Q00369_CollectorOfJewels extends Quest private static final int MIN_LEVEL = 25; // Mobs private static final Map<Integer, QuestItemHolder> MOBS_DROP_CHANCES = new HashMap<>(); - static - { + static { MOBS_DROP_CHANCES.put(20609, new QuestItemHolder(FLARE_SHARD, 75, 1)); // salamander_lakin MOBS_DROP_CHANCES.put(20612, new QuestItemHolder(FLARE_SHARD, 91, 1)); // salamander_rowin MOBS_DROP_CHANCES.put(20749, new QuestItemHolder(FLARE_SHARD, 100, 2)); // death_fire @@ -52,8 +50,7 @@ public final class Q00369_CollectorOfJewels extends Quest MOBS_DROP_CHANCES.put(20747, new QuestItemHolder(FREEZING_SHARD, 100, 2)); // roxide } - public Q00369_CollectorOfJewels() - { + public Q00369_CollectorOfJewels() { super(369, Q00369_CollectorOfJewels.class.getSimpleName(), "Collector of Jewels"); addStartNpc(NELL); addTalkId(NELL); @@ -62,48 +59,39 @@ public final class Q00369_CollectorOfJewels extends Quest } @Override - public boolean checkPartyMember(L2PcInstance member, L2Npc npc) - { + public boolean checkPartyMember(L2PcInstance member, L2Npc npc) { final QuestState st = getQuestState(member, false); return ((st != null) && (st.isMemoState(1) || st.isMemoState(3))); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "30376-02.htm": - { + switch (event) { + case "30376-02.htm": { st.startQuest(); st.setMemoState(1); htmltext = event; break; } - case "30376-05.html": - { + case "30376-05.html": { htmltext = event; break; } - case "30376-06.html": - { - if (st.isMemoState(2)) - { + case "30376-06.html": { + if (st.isMemoState(2)) { st.setMemoState(3); st.setCond(3, true); htmltext = event; } break; } - case "30376-07.html": - { + case "30376-07.html": { st.exitQuest(true, true); htmltext = event; break; @@ -113,20 +101,16 @@ public final class Q00369_CollectorOfJewels extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestItemHolder item = MOBS_DROP_CHANCES.get(npc.getId()); - if (getRandom(100) < item.getChance()) - { + if (getRandom(100) < item.getChance()) { L2PcInstance luckyPlayer = getRandomPartyMember(player, npc); - if (luckyPlayer != null) - { + if (luckyPlayer != null) { final QuestState st = getQuestState(luckyPlayer, false); final int itemCount = (st.isMemoState(1) ? 50 : 200); final int cond = (st.isMemoState(1) ? 2 : 4); if (giveItemRandomly(luckyPlayer, npc, item.getId(), item.getCount(), itemCount, 1.0, true) // - && (getQuestItemsCount(luckyPlayer, FLARE_SHARD, FREEZING_SHARD) >= (itemCount * 2))) - { + && (getQuestItemsCount(luckyPlayer, FLARE_SHARD, FREEZING_SHARD) >= (itemCount * 2))) { st.setCond(cond); } } @@ -135,49 +119,35 @@ public final class Q00369_CollectorOfJewels extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCreated()) - { + if (st.isCreated()) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "30376-01.htm" : "30376-03.html"; - } - else if (st.isStarted()) - { - switch (st.getMemoState()) - { - case 1: - { - if (getQuestItemsCount(player, FLARE_SHARD, FREEZING_SHARD) >= 100) - { + } else if (st.isStarted()) { + switch (st.getMemoState()) { + case 1: { + if (getQuestItemsCount(player, FLARE_SHARD, FREEZING_SHARD) >= 100) { giveAdena(player, 31810, true); takeItems(player, -1, FLARE_SHARD, FREEZING_SHARD); st.setMemoState(2); htmltext = "30376-04.html"; - } - else - { + } else { htmltext = "30376-08.html"; } break; } - case 2: - { + case 2: { htmltext = "30376-09.html"; break; } - case 3: - { - if (getQuestItemsCount(player, FLARE_SHARD, FREEZING_SHARD) >= 400) - { + case 3: { + if (getQuestItemsCount(player, FLARE_SHARD, FREEZING_SHARD) >= 400) { giveAdena(player, 84415, true); takeItems(player, -1, FLARE_SHARD, FREEZING_SHARD); st.exitQuest(true, true); htmltext = "30376-10.html"; - } - else - { + } else { htmltext = "30376-11.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00370_AnElderSowsSeeds/Q00370_AnElderSowsSeeds.java b/src/main/java/com/l2jserver/datapack/quests/Q00370_AnElderSowsSeeds/Q00370_AnElderSowsSeeds.java index 1f9f6f7799..e172087fe2 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00370_AnElderSowsSeeds/Q00370_AnElderSowsSeeds.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00370_AnElderSowsSeeds/Q00370_AnElderSowsSeeds.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * An Elder Sows Seeds (370) * @author Adry_85 */ -public final class Q00370_AnElderSowsSeeds extends Quest -{ +public final class Q00370_AnElderSowsSeeds extends Quest { // NPC private static final int CASIAN = 30612; // Items @@ -46,8 +45,7 @@ public final class Q00370_AnElderSowsSeeds extends Quest // Mobs private static final Map<Integer, Integer> MOBS1 = new HashMap<>(); private static final Map<Integer, Double> MOBS2 = new HashMap<>(); - static - { + static { MOBS1.put(20082, 9); // ant_recruit MOBS1.put(20086, 9); // ant_guard MOBS1.put(20090, 22); // noble_ant_leader @@ -55,8 +53,7 @@ public final class Q00370_AnElderSowsSeeds extends Quest MOBS2.put(20089, 0.100); // noble_ant } - public Q00370_AnElderSowsSeeds() - { + public Q00370_AnElderSowsSeeds() { super(370, Q00370_AnElderSowsSeeds.class.getSimpleName(), "An Elder Sows Seeds"); addStartNpc(CASIAN); addTalkId(CASIAN); @@ -65,58 +62,45 @@ public final class Q00370_AnElderSowsSeeds extends Quest } @Override - public boolean checkPartyMember(L2PcInstance member, L2Npc npc) - { + public boolean checkPartyMember(L2PcInstance member, L2Npc npc) { final QuestState st = getQuestState(member, false); return ((st != null) && st.isStarted()); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "30612-02.htm": case "30612-03.htm": case "30612-06.html": case "30612-07.html": - case "30612-09.html": - { + case "30612-09.html": { htmltext = event; break; } - case "30612-04.htm": - { + case "30612-04.htm": { st.startQuest(); htmltext = event; break; } - case "REWARD": - { - if (st.isStarted()) - { - if (exchangeChapters(player, false)) - { + case "REWARD": { + if (st.isStarted()) { + if (exchangeChapters(player, false)) { htmltext = "30612-08.html"; - } - else - { + } else { htmltext = "30612-11.html"; } } break; } - case "30612-10.html": - { - if (st.isStarted()) - { + case "30612-10.html": { + if (st.isStarted()) { exchangeChapters(player, true); st.exitQuest(true, true); htmltext = event; @@ -128,25 +112,18 @@ public final class Q00370_AnElderSowsSeeds extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { int npcId = npc.getId(); - if (MOBS1.containsKey(npcId)) - { - if (getRandom(100) < MOBS1.get(npcId)) - { + if (MOBS1.containsKey(npcId)) { + if (getRandom(100) < MOBS1.get(npcId)) { L2PcInstance luckyPlayer = getRandomPartyMember(player, npc); - if (luckyPlayer != null) - { + if (luckyPlayer != null) { giveItemRandomly(luckyPlayer, npc, SPELLBOOK_PAGE, 1, 0, 1.0, true); } } - } - else - { + } else { final QuestState st = getRandomPartyMemberState(player, -1, 3, npc); - if (st != null) - { + if (st != null) { giveItemRandomly(st.getPlayer(), npc, SPELLBOOK_PAGE, 1, 0, MOBS2.get(npcId), true); } } @@ -154,30 +131,24 @@ public final class Q00370_AnElderSowsSeeds extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCreated()) - { + if (st.isCreated()) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "30612-01.htm" : "30612-05.html"; - } - else if (st.isStarted()) - { + } else if (st.isStarted()) { htmltext = "30612-06.html"; } return htmltext; } - private final boolean exchangeChapters(L2PcInstance player, boolean takeAllItems) - { + private final boolean exchangeChapters(L2PcInstance player, boolean takeAllItems) { final long waterChapters = getQuestItemsCount(player, CHAPTER_OF_WATER); final long earthChapters = getQuestItemsCount(player, CHAPTER_OF_EARTH); final long windChapters = getQuestItemsCount(player, CHAPTER_OF_WIND); final long fireChapters = getQuestItemsCount(player, CHAPTER_OF_FIRE); final long minCount = Util.min(waterChapters, earthChapters, windChapters, fireChapters); - if (minCount > 0) - { + if (minCount > 0) { giveAdena(player, minCount * 3600, true); } final long countToTake = (takeAllItems ? -1 : minCount); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00371_ShrieksOfGhosts/Q00371_ShrieksOfGhosts.java b/src/main/java/com/l2jserver/datapack/quests/Q00371_ShrieksOfGhosts/Q00371_ShrieksOfGhosts.java index 695ba1793f..b9316b5373 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00371_ShrieksOfGhosts/Q00371_ShrieksOfGhosts.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00371_ShrieksOfGhosts/Q00371_ShrieksOfGhosts.java @@ -31,26 +31,21 @@ import com.l2jserver.gameserver.util.Util; * Shrieks of Ghosts (371) * @author Adry_85 */ -public final class Q00371_ShrieksOfGhosts extends Quest -{ - private static final class DropInfo - { +public final class Q00371_ShrieksOfGhosts extends Quest { + private static final class DropInfo { public final int _firstChance; public final int _secondChance; - public DropInfo(int firstChance, int secondChance) - { + public DropInfo(int firstChance, int secondChance) { _firstChance = firstChance; _secondChance = secondChance; } - public int getFirstChance() - { + public int getFirstChance() { return _firstChance; } - public int getSecondChance() - { + public int getSecondChance() { return _secondChance; } } @@ -69,15 +64,13 @@ public final class Q00371_ShrieksOfGhosts extends Quest private static final int MIN_LEVEL = 59; private static final Map<Integer, DropInfo> MOBS = new HashMap<>(); - static - { + static { MOBS.put(20818, new DropInfo(350, 400)); // hallates_warrior MOBS.put(20820, new DropInfo(583, 673)); // hallates_knight MOBS.put(20824, new DropInfo(458, 538)); // hallates_commander } - public Q00371_ShrieksOfGhosts() - { + public Q00371_ShrieksOfGhosts() { super(371, Q00371_ShrieksOfGhosts.class.getSimpleName(), "Shrieks of Ghosts"); addStartNpc(REVA); addTalkId(REVA, PATRIN); @@ -86,39 +79,29 @@ public final class Q00371_ShrieksOfGhosts extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "30867-02.htm": - { + switch (event) { + case "30867-02.htm": { qs.startQuest(); htmltext = event; break; } - case "30867-05.html": - { + case "30867-05.html": { final long ancientAshUrnCount = getQuestItemsCount(player, ANCIENT_ASH_URN); - if (ancientAshUrnCount < 1) - { + if (ancientAshUrnCount < 1) { htmltext = event; - } - else if (ancientAshUrnCount < 100) - { + } else if (ancientAshUrnCount < 100) { giveAdena(player, (ancientAshUrnCount * 1000) + 15000, true); takeItems(player, ANCIENT_ASH_URN, -1); htmltext = "30867-06.html"; - } - else - { + } else { giveAdena(player, (ancientAshUrnCount * 1000) + 37700, true); takeItems(player, ANCIENT_ASH_URN, -1); htmltext = "30867-07.html"; @@ -127,51 +110,36 @@ public final class Q00371_ShrieksOfGhosts extends Quest } case "30867-08.html": case "30929-01.html": - case "30929-02.html": - { + case "30929-02.html": { htmltext = event; break; } - case "30867-09.html": - { + case "30867-09.html": { giveAdena(player, getQuestItemsCount(player, ANCIENT_ASH_URN) * 1000, true); qs.exitQuest(true, true); htmltext = "30867-09.html"; break; } - case "30929-03.html": - { - if (!hasQuestItems(player, ANCIENT_PORCELAIN)) - { + case "30929-03.html": { + if (!hasQuestItems(player, ANCIENT_PORCELAIN)) { htmltext = event; - } - else - { + } else { final int random = getRandom(100); - if (random < 2) - { + if (random < 2) { giveItems(player, ANCIENT_PORCELAIN_EXCELLENT, 1); htmltext = "30929-04.html"; - } - else if (random < 32) - { + } else if (random < 32) { giveItems(player, ANCIENT_PORCELAIN_HIGH_QUALITY, 1); htmltext = "30929-05.html"; - } - else if (random < 62) - { + } else if (random < 62) { giveItems(player, ANCIENT_PORCELAIN_LOW_QUALITY, 1); htmltext = "30929-06.html"; - } - else if (random < 77) - { + } else if (random < 77) { giveItems(player, ANCIENT_PORCELAIN_LOWEST_QUALITY, 1); htmltext = "30929-07.html"; - } - else - { + } else { htmltext = "30929-08.html"; } @@ -184,46 +152,34 @@ public final class Q00371_ShrieksOfGhosts extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs == null) || !Util.checkIfInRange(1500, npc, killer, true)) - { + if ((qs == null) || !Util.checkIfInRange(1500, npc, killer, true)) { return null; } final DropInfo info = MOBS.get(npc.getId()); final int random = getRandom(1000); - if (random < info.getFirstChance()) - { + if (random < info.getFirstChance()) { qs.giveItemRandomly(npc, ANCIENT_ASH_URN, 1, 0, 1.0, true); - } - else if (random < info.getSecondChance()) - { + } else if (random < info.getSecondChance()) { qs.giveItemRandomly(npc, ANCIENT_PORCELAIN, 1, 0, 1.0, true); } return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { + if (qs.isCreated()) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "30867-01.htm" : "30867-03.htm"; - } - else if (qs.isStarted()) - { - if (npc.getId() == REVA) - { + } else if (qs.isStarted()) { + if (npc.getId() == REVA) { htmltext = (hasQuestItems(player, ANCIENT_PORCELAIN)) ? "30867-04.html" : "30867-10.html"; - } - else - { + } else { htmltext = "30929-01.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00372_LegacyOfInsolence/Q00372_LegacyOfInsolence.java b/src/main/java/com/l2jserver/datapack/quests/Q00372_LegacyOfInsolence/Q00372_LegacyOfInsolence.java index f594e160cc..cd8c8f7447 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00372_LegacyOfInsolence/Q00372_LegacyOfInsolence.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00372_LegacyOfInsolence/Q00372_LegacyOfInsolence.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.util.Util; * Legacy Of Insolence (372) * @author ivantotov */ -public final class Q00372_LegacyOfInsolence extends Quest -{ +public final class Q00372_LegacyOfInsolence extends Quest { // NPCs private static final int TRADER_HOLLY = 30839; private static final int WAREHOUSE_KEEPER_WALDERAL = 30844; @@ -105,8 +104,7 @@ public final class Q00372_LegacyOfInsolence extends Quest private static final int HALLATES_INSPECTOR = 20825; private static final Map<Integer, QuestItemHolder> MONSTER_REWARDS = new HashMap<>(); - static - { + static { MONSTER_REWARDS.put(20817, new QuestItemHolder(ANCIENT_RED_PAPYRUS, 302, 1)); MONSTER_REWARDS.put(20821, new QuestItemHolder(ANCIENT_RED_PAPYRUS, 410, 1)); MONSTER_REWARDS.put(HALLATES_INSPECTOR, new QuestItemHolder(ANCIENT_RED_PAPYRUS, 1, 447)); @@ -118,8 +116,7 @@ public final class Q00372_LegacyOfInsolence extends Quest // Misc private static final int MIN_LEVEL = 59; - public Q00372_LegacyOfInsolence() - { + public Q00372_LegacyOfInsolence() { super(372, Q00372_LegacyOfInsolence.class.getSimpleName(), "Legacy Of Insolence"); addStartNpc(WAREHOUSE_KEEPER_WALDERAL); addTalkId(WAREHOUSE_KEEPER_WALDERAL, TRADER_HOLLY, MAGISTER_DESMOND, ANTIQUE_DEALER_PATRIN, CLAUDIA_ATHEBALDT); @@ -127,56 +124,44 @@ public final class Q00372_LegacyOfInsolence extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); final int chance = getRandom(100); - if (qs == null) - { + if (qs == null) { return super.onAdvEvent(event, npc, player); } String htmltext = null; - switch (event) - { - case "30844-04.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "30844-04.htm": { + if (qs.isCreated()) { qs.startQuest(); htmltext = event; } break; } - case "30844-07.html": - { + case "30844-07.html": { if (hasQuestItems(player, BLUEPRINT_TOWER_OF_INSOLENCE_1ST_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_2ND_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_3RD_FLOOR, // - BLUEPRINT_TOWER_OF_INSOLENCE_4TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_5TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_6TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_7TH_FLOOR, // - BLUEPRINT_TOWER_OF_INSOLENCE_8TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_9TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_10TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_11TH_FLOOR, // - BLUEPRINT_TOWER_OF_INSOLENCE_12TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_13TH_FLOOR)) - { + BLUEPRINT_TOWER_OF_INSOLENCE_4TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_5TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_6TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_7TH_FLOOR, // + BLUEPRINT_TOWER_OF_INSOLENCE_8TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_9TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_10TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_11TH_FLOOR, // + BLUEPRINT_TOWER_OF_INSOLENCE_12TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_13TH_FLOOR)) { htmltext = event; - } - else - { + } else { htmltext = "30844-06.html"; } break; } - case "30844-09.html": - { + case "30844-09.html": { qs.exitQuest(true, true); htmltext = event; break; } - case "30844-07a.html": - { + case "30844-07a.html": { if (hasQuestItems(player, BLUEPRINT_TOWER_OF_INSOLENCE_1ST_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_2ND_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_3RD_FLOOR, // - BLUEPRINT_TOWER_OF_INSOLENCE_4TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_5TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_6TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_7TH_FLOOR, // - BLUEPRINT_TOWER_OF_INSOLENCE_8TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_9TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_10TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_11TH_FLOOR, // - BLUEPRINT_TOWER_OF_INSOLENCE_12TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_13TH_FLOOR)) - { + BLUEPRINT_TOWER_OF_INSOLENCE_4TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_5TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_6TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_7TH_FLOOR, // + BLUEPRINT_TOWER_OF_INSOLENCE_8TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_9TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_10TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_11TH_FLOOR, // + BLUEPRINT_TOWER_OF_INSOLENCE_12TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_13TH_FLOOR)) { takeItems(player, BLUEPRINT_TOWER_OF_INSOLENCE_1ST_FLOOR, 1); takeItems(player, BLUEPRINT_TOWER_OF_INSOLENCE_2ND_FLOOR, 1); takeItems(player, BLUEPRINT_TOWER_OF_INSOLENCE_3RD_FLOOR, 1); @@ -191,57 +176,38 @@ public final class Q00372_LegacyOfInsolence extends Quest takeItems(player, BLUEPRINT_TOWER_OF_INSOLENCE_12TH_FLOOR, 1); takeItems(player, BLUEPRINT_TOWER_OF_INSOLENCE_13TH_FLOOR, 1); - if (chance < 10) - { + if (chance < 10) { giveItems(player, SEALED_DARK_CRYSTAL_BOOTS_LINING, 1); - } - else if (chance < 20) - { + } else if (chance < 20) { giveItems(player, SEALED_DARK_CRYSTAL_GLOVES_DESIGN, 1); - } - else if (chance < 30) - { + } else if (chance < 30) { giveItems(player, SEALED_DARK_CRYSTAL_HELMET_DESIGN, 1); - } - else if (chance < 40) - { + } else if (chance < 40) { giveItems(player, SEALED_DARK_CRYSTAL_BOOTS_LINING, 1); giveItems(player, SEALED_DARK_CRYSTAL_GLOVES_DESIGN, 1); giveItems(player, SEALED_DARK_CRYSTAL_HELMET_DESIGN, 1); - } - else if (chance < 51) - { + } else if (chance < 51) { giveItems(player, RECIPE_SEALED_DARK_CRYSTAL_BOOTS_60, 1); - } - else if (chance < 62) - { + } else if (chance < 62) { giveItems(player, RECIPE_SEALED_DARK_CRYSTAL_GLOVES_60, 1); - } - else if (chance < 79) - { + } else if (chance < 79) { giveItems(player, RECIPE_SEALED_DARK_CRYSTAL_HELMET_60, 1); - } - else if (chance < 100) - { + } else if (chance < 100) { giveItems(player, RECIPE_SEALED_DARK_CRYSTAL_BOOTS_60, 1); giveItems(player, RECIPE_SEALED_DARK_CRYSTAL_GLOVES_60, 1); giveItems(player, RECIPE_SEALED_DARK_CRYSTAL_HELMET_60, 1); } htmltext = event; - } - else - { + } else { htmltext = "30844-07e.html"; } break; } - case "30844-07b.html": - { + case "30844-07b.html": { if (hasQuestItems(player, BLUEPRINT_TOWER_OF_INSOLENCE_1ST_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_2ND_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_3RD_FLOOR, // - BLUEPRINT_TOWER_OF_INSOLENCE_4TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_5TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_6TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_7TH_FLOOR, // - BLUEPRINT_TOWER_OF_INSOLENCE_8TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_9TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_10TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_11TH_FLOOR, // - BLUEPRINT_TOWER_OF_INSOLENCE_12TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_13TH_FLOOR)) - { + BLUEPRINT_TOWER_OF_INSOLENCE_4TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_5TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_6TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_7TH_FLOOR, // + BLUEPRINT_TOWER_OF_INSOLENCE_8TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_9TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_10TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_11TH_FLOOR, // + BLUEPRINT_TOWER_OF_INSOLENCE_12TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_13TH_FLOOR)) { takeItems(player, BLUEPRINT_TOWER_OF_INSOLENCE_1ST_FLOOR, 1); takeItems(player, BLUEPRINT_TOWER_OF_INSOLENCE_2ND_FLOOR, 1); takeItems(player, BLUEPRINT_TOWER_OF_INSOLENCE_3RD_FLOOR, 1); @@ -256,57 +222,38 @@ public final class Q00372_LegacyOfInsolence extends Quest takeItems(player, BLUEPRINT_TOWER_OF_INSOLENCE_12TH_FLOOR, 1); takeItems(player, BLUEPRINT_TOWER_OF_INSOLENCE_13TH_FLOOR, 1); - if (chance < 10) - { + if (chance < 10) { giveItems(player, SEALED_TALLUM_BOOTS_LINING, 1); - } - else if (chance < 20) - { + } else if (chance < 20) { giveItems(player, SEALED_TALLUM_GLOVES_DESIGN, 1); - } - else if (chance < 30) - { + } else if (chance < 30) { giveItems(player, SEALED_TALLUM_HELM_DESIGN, 1); - } - else if (chance < 40) - { + } else if (chance < 40) { giveItems(player, SEALED_TALLUM_BOOTS_LINING, 1); giveItems(player, SEALED_TALLUM_GLOVES_DESIGN, 1); giveItems(player, SEALED_TALLUM_HELM_DESIGN, 1); - } - else if (chance < 51) - { + } else if (chance < 51) { giveItems(player, RECIPE_SEALED_TALLUM_BOOTS_60, 1); - } - else if (chance < 62) - { + } else if (chance < 62) { giveItems(player, RECIPE_SEALED_TALLUM_GLOVES_60, 1); - } - else if (chance < 79) - { + } else if (chance < 79) { giveItems(player, RECIPE_SEALED_TALLUM_HELMET_60, 1); - } - else if (chance < 100) - { + } else if (chance < 100) { giveItems(player, RECIPE_SEALED_TALLUM_BOOTS_60, 1); giveItems(player, RECIPE_SEALED_TALLUM_GLOVES_60, 1); giveItems(player, RECIPE_SEALED_TALLUM_HELMET_60, 1); } htmltext = event; - } - else - { + } else { htmltext = "30844-07e.html"; } break; } - case "30844-07c.html": - { + case "30844-07c.html": { if (hasQuestItems(player, BLUEPRINT_TOWER_OF_INSOLENCE_1ST_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_2ND_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_3RD_FLOOR, // - BLUEPRINT_TOWER_OF_INSOLENCE_4TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_5TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_6TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_7TH_FLOOR, // - BLUEPRINT_TOWER_OF_INSOLENCE_8TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_9TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_10TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_11TH_FLOOR, // - BLUEPRINT_TOWER_OF_INSOLENCE_12TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_13TH_FLOOR)) - { + BLUEPRINT_TOWER_OF_INSOLENCE_4TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_5TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_6TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_7TH_FLOOR, // + BLUEPRINT_TOWER_OF_INSOLENCE_8TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_9TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_10TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_11TH_FLOOR, // + BLUEPRINT_TOWER_OF_INSOLENCE_12TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_13TH_FLOOR)) { takeItems(player, BLUEPRINT_TOWER_OF_INSOLENCE_1ST_FLOOR, 1); takeItems(player, BLUEPRINT_TOWER_OF_INSOLENCE_2ND_FLOOR, 1); takeItems(player, BLUEPRINT_TOWER_OF_INSOLENCE_3RD_FLOOR, 1); @@ -321,57 +268,38 @@ public final class Q00372_LegacyOfInsolence extends Quest takeItems(player, BLUEPRINT_TOWER_OF_INSOLENCE_12TH_FLOOR, 1); takeItems(player, BLUEPRINT_TOWER_OF_INSOLENCE_13TH_FLOOR, 1); - if (chance < 17) - { + if (chance < 17) { giveItems(player, SEALED_BOOTS_OF_NIGHTMARE_LINING, 1); - } - else if (chance < 34) - { + } else if (chance < 34) { giveItems(player, SEALED_GAUNTLETS_OF_NIGHTMARE_DESIGN, 1); - } - else if (chance < 49) - { + } else if (chance < 49) { giveItems(player, SEALED_HELM_OF_NIGHTMARE_DESIGN, 1); - } - else if (chance < 58) - { + } else if (chance < 58) { giveItems(player, SEALED_BOOTS_OF_NIGHTMARE_LINING, 1); giveItems(player, SEALED_GAUNTLETS_OF_NIGHTMARE_DESIGN, 1); giveItems(player, SEALED_HELM_OF_NIGHTMARE_DESIGN, 1); - } - else if (chance < 70) - { + } else if (chance < 70) { giveItems(player, RECIPE_SEALED_BOOTS_OF_NIGHTMARE_60, 1); - } - else if (chance < 82) - { + } else if (chance < 82) { giveItems(player, RECIPE_SEALED_GAUNTLETS_OF_NIGHTMARE_60, 1); - } - else if (chance < 92) - { + } else if (chance < 92) { giveItems(player, RECIPE_SEALED_HELM_OF_NIGHTMARE_60, 1); - } - else if (chance < 100) - { + } else if (chance < 100) { giveItems(player, RECIPE_SEALED_BOOTS_OF_NIGHTMARE_60, 1); giveItems(player, RECIPE_SEALED_GAUNTLETS_OF_NIGHTMARE_60, 1); giveItems(player, RECIPE_SEALED_HELM_OF_NIGHTMARE_60, 1); } htmltext = event; - } - else - { + } else { htmltext = "30844-07e.html"; } break; } - case "30844-07d.html": - { + case "30844-07d.html": { if (hasQuestItems(player, BLUEPRINT_TOWER_OF_INSOLENCE_1ST_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_2ND_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_3RD_FLOOR, // - BLUEPRINT_TOWER_OF_INSOLENCE_4TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_5TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_6TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_7TH_FLOOR, // - BLUEPRINT_TOWER_OF_INSOLENCE_8TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_9TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_10TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_11TH_FLOOR, // - BLUEPRINT_TOWER_OF_INSOLENCE_12TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_13TH_FLOOR)) - { + BLUEPRINT_TOWER_OF_INSOLENCE_4TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_5TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_6TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_7TH_FLOOR, // + BLUEPRINT_TOWER_OF_INSOLENCE_8TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_9TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_10TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_11TH_FLOOR, // + BLUEPRINT_TOWER_OF_INSOLENCE_12TH_FLOOR, BLUEPRINT_TOWER_OF_INSOLENCE_13TH_FLOOR)) { takeItems(player, BLUEPRINT_TOWER_OF_INSOLENCE_1ST_FLOOR, 1); takeItems(player, BLUEPRINT_TOWER_OF_INSOLENCE_2ND_FLOOR, 1); takeItems(player, BLUEPRINT_TOWER_OF_INSOLENCE_3RD_FLOOR, 1); @@ -386,52 +314,34 @@ public final class Q00372_LegacyOfInsolence extends Quest takeItems(player, BLUEPRINT_TOWER_OF_INSOLENCE_12TH_FLOOR, 1); takeItems(player, BLUEPRINT_TOWER_OF_INSOLENCE_13TH_FLOOR, 1); - if (chance < 17) - { + if (chance < 17) { giveItems(player, SEALED_MAJESTIC_BOOTS_LINING, 1); - } - else if (chance < 34) - { + } else if (chance < 34) { giveItems(player, SEALED_MAJESTIC_GAUNTLETS_DESIGN, 1); - } - else if (chance < 49) - { + } else if (chance < 49) { giveItems(player, SEALED_MAJESTIC_CIRCLET_DESIGN, 1); - } - else if (chance < 58) - { + } else if (chance < 58) { giveItems(player, SEALED_MAJESTIC_BOOTS_LINING, 1); giveItems(player, SEALED_MAJESTIC_GAUNTLETS_DESIGN, 1); giveItems(player, SEALED_MAJESTIC_CIRCLET_DESIGN, 1); - } - else if (chance < 70) - { + } else if (chance < 70) { giveItems(player, RECIPE_SEALED_MAJESTIC_BOOTS_60, 1); - } - else if (chance < 82) - { + } else if (chance < 82) { giveItems(player, RECIPE_SEALED_MAJESTIC_GAUNTLETS_60, 1); - } - else if (chance < 92) - { + } else if (chance < 92) { giveItems(player, RECIPE_SEALED_MAJESTIC_CIRCLET_60, 1); - } - else if (chance < 100) - { + } else if (chance < 100) { giveItems(player, RECIPE_SEALED_MAJESTIC_BOOTS_60, 1); giveItems(player, RECIPE_SEALED_MAJESTIC_GAUNTLETS_60, 1); giveItems(player, RECIPE_SEALED_MAJESTIC_CIRCLET_60, 1); } htmltext = event; - } - else - { + } else { htmltext = "30844-07e.html"; } break; } - case "30844-05b.html": - { + case "30844-05b.html": { qs.setCond(2); htmltext = event; break; @@ -441,8 +351,7 @@ public final class Q00372_LegacyOfInsolence extends Quest case "30844-05a.html": case "30844-08.html": case "30844-10.html": - case "30844-11.html": - { + case "30844-11.html": { htmltext = event; break; } @@ -451,16 +360,12 @@ public final class Q00372_LegacyOfInsolence extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestItemHolder item = MONSTER_REWARDS.get(npc.getId()); - if (npc.getId() == HALLATES_INSPECTOR) - { - if (getRandom(1000) < item.getChance()) - { + if (npc.getId() == HALLATES_INSPECTOR) { + if (getRandom(1000) < item.getChance()) { final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc); - if (qs != null) - { + if (qs != null) { giveItems(qs.getPlayer(), item.getId(), item.getCount()); playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -468,28 +373,20 @@ public final class Q00372_LegacyOfInsolence extends Quest return super.onKill(npc, killer, isSummon); } - if (Util.checkIfInRange(1500, npc, killer, true) && (getRandom(1000) < item.getChance())) - { + if (Util.checkIfInRange(1500, npc, killer, true) && (getRandom(1000) < item.getChance())) { L2PcInstance rewardedPlayer = null; - if (!killer.isInParty()) - { + if (!killer.isInParty()) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted()) - { + if ((qs != null) && qs.isStarted()) { rewardedPlayer = killer; } - } - else - { + } else { int chance = 0; - for (L2PcInstance partyMember : killer.getParty().getMembers()) - { + for (L2PcInstance partyMember : killer.getParty().getMembers()) { final QuestState partyMemberQuestState = getQuestState(partyMember, false); - if ((partyMemberQuestState != null) && partyMemberQuestState.isStarted()) - { + if ((partyMemberQuestState != null) && partyMemberQuestState.isStarted()) { final int chance2 = getRandom(1000); - if (chance < chance2) - { + if (chance < chance2) { chance = chance2; rewardedPlayer = partyMember; } @@ -497,8 +394,7 @@ public final class Q00372_LegacyOfInsolence extends Quest } } - if ((rewardedPlayer != null) && Util.checkIfInRange(1500, npc, rewardedPlayer, true)) - { + if ((rewardedPlayer != null) && Util.checkIfInRange(1500, npc, rewardedPlayer, true)) { giveItems(rewardedPlayer, item.getId(), item.getCount()); playSound(rewardedPlayer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -508,80 +404,55 @@ public final class Q00372_LegacyOfInsolence extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); final int chance = getRandom(100); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == WAREHOUSE_KEEPER_WALDERAL) - { - if (player.getLevel() < MIN_LEVEL) - { + if (qs.isCreated()) { + if (npc.getId() == WAREHOUSE_KEEPER_WALDERAL) { + if (player.getLevel() < MIN_LEVEL) { htmltext = "30844-01.htm"; - } - else - { + } else { htmltext = "30844-02.htm"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case WAREHOUSE_KEEPER_WALDERAL: - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case WAREHOUSE_KEEPER_WALDERAL: { htmltext = "30844-05.html"; break; } - case TRADER_HOLLY: - { - if (hasQuestItems(player, IMPERIAL_GENEALOGY_1, IMPERIAL_GENEALOGY_2, IMPERIAL_GENEALOGY_3, IMPERIAL_GENEALOGY_4, IMPERIAL_GENEALOGY_5)) - { + case TRADER_HOLLY: { + if (hasQuestItems(player, IMPERIAL_GENEALOGY_1, IMPERIAL_GENEALOGY_2, IMPERIAL_GENEALOGY_3, IMPERIAL_GENEALOGY_4, IMPERIAL_GENEALOGY_5)) { takeItems(player, IMPERIAL_GENEALOGY_1, 1); takeItems(player, IMPERIAL_GENEALOGY_2, 1); takeItems(player, IMPERIAL_GENEALOGY_3, 1); takeItems(player, IMPERIAL_GENEALOGY_4, 1); takeItems(player, IMPERIAL_GENEALOGY_5, 1); - if (chance < 30) - { + if (chance < 30) { giveItems(player, SEALED_DARK_CRYSTAL_BOOTS_LINING, 1); - } - else if (chance < 60) - { + } else if (chance < 60) { giveItems(player, SEALED_DARK_CRYSTAL_GLOVES_DESIGN, 1); - } - else if (chance < 80) - { + } else if (chance < 80) { giveItems(player, SEALED_DARK_CRYSTAL_HELMET_DESIGN, 1); - } - else if (chance < 90) - { + } else if (chance < 90) { giveItems(player, SEALED_DARK_CRYSTAL_BOOTS_LINING, 1); giveItems(player, SEALED_DARK_CRYSTAL_GLOVES_DESIGN, 1); giveItems(player, SEALED_DARK_CRYSTAL_HELMET_DESIGN, 1); - } - else if (chance < 100) - { + } else if (chance < 100) { giveAdena(player, 4000, true); } htmltext = "30839-02.html"; - } - else - { + } else { htmltext = "30839-01.html"; } break; } - case MAGISTER_DESMOND: - { + case MAGISTER_DESMOND: { if (hasQuestItems(player, REVELATION_OF_THE_SEALS_CHAPTER_OF_AVARICE, REVELATION_OF_THE_SEALS_CHAPTER_OF_GNOSIS, REVELATION_OF_THE_SEALS_CHAPTER_OF_STRIFE, // - REVELATION_OF_THE_SEALS_CHAPTER_OF_VENGEANCE, REVELATION_OF_THE_SEALS_CHAPTER_OF_AWEKENING, REVELATION_OF_THE_SEALS_CHAPTER_OF_CALAMITY, // - REVELATION_OF_THE_SEALS_CHAPTER_OF_DESCENT)) - { + REVELATION_OF_THE_SEALS_CHAPTER_OF_VENGEANCE, REVELATION_OF_THE_SEALS_CHAPTER_OF_AWEKENING, REVELATION_OF_THE_SEALS_CHAPTER_OF_CALAMITY, // + REVELATION_OF_THE_SEALS_CHAPTER_OF_DESCENT)) { takeItems(player, REVELATION_OF_THE_SEALS_CHAPTER_OF_AVARICE, 1); takeItems(player, REVELATION_OF_THE_SEALS_CHAPTER_OF_GNOSIS, 1); takeItems(player, REVELATION_OF_THE_SEALS_CHAPTER_OF_STRIFE, 1); @@ -590,82 +461,56 @@ public final class Q00372_LegacyOfInsolence extends Quest takeItems(player, REVELATION_OF_THE_SEALS_CHAPTER_OF_CALAMITY, 1); takeItems(player, REVELATION_OF_THE_SEALS_CHAPTER_OF_DESCENT, 1); - if (chance < 31) - { + if (chance < 31) { giveItems(player, SEALED_MAJESTIC_BOOTS_LINING, 1); - } - else if (chance < 62) - { + } else if (chance < 62) { giveItems(player, SEALED_MAJESTIC_GAUNTLETS_DESIGN, 1); - } - else if (chance < 75) - { + } else if (chance < 75) { giveItems(player, SEALED_MAJESTIC_CIRCLET_DESIGN, 1); - } - else if (chance < 83) - { + } else if (chance < 83) { giveItems(player, SEALED_MAJESTIC_BOOTS_LINING, 1); giveItems(player, SEALED_MAJESTIC_GAUNTLETS_DESIGN, 1); giveItems(player, SEALED_MAJESTIC_CIRCLET_DESIGN, 1); - } - else if (chance < 100) - { + } else if (chance < 100) { giveAdena(player, 4000, true); } htmltext = "30855-02.html"; - } - else - { + } else { htmltext = "30855-01.html"; } break; } - case ANTIQUE_DEALER_PATRIN: - { - if (hasQuestItems(player, ANCIENT_EPIC_CHAPTER_1, ANCIENT_EPIC_CHAPTER_2, ANCIENT_EPIC_CHAPTER_3, ANCIENT_EPIC_CHAPTER_4, ANCIENT_EPIC_CHAPTER_5)) - { + case ANTIQUE_DEALER_PATRIN: { + if (hasQuestItems(player, ANCIENT_EPIC_CHAPTER_1, ANCIENT_EPIC_CHAPTER_2, ANCIENT_EPIC_CHAPTER_3, ANCIENT_EPIC_CHAPTER_4, ANCIENT_EPIC_CHAPTER_5)) { takeItems(player, ANCIENT_EPIC_CHAPTER_1, 1); takeItems(player, ANCIENT_EPIC_CHAPTER_2, 1); takeItems(player, ANCIENT_EPIC_CHAPTER_3, 1); takeItems(player, ANCIENT_EPIC_CHAPTER_4, 1); takeItems(player, ANCIENT_EPIC_CHAPTER_5, 1); - if (chance < 30) - { + if (chance < 30) { giveItems(player, SEALED_TALLUM_BOOTS_LINING, 1); - } - else if (chance < 60) - { + } else if (chance < 60) { giveItems(player, SEALED_TALLUM_GLOVES_DESIGN, 1); - } - else if (chance < 80) - { + } else if (chance < 80) { giveItems(player, SEALED_TALLUM_HELM_DESIGN, 1); - } - else if (chance < 90) - { + } else if (chance < 90) { giveItems(player, SEALED_TALLUM_BOOTS_LINING, 1); giveItems(player, SEALED_TALLUM_GLOVES_DESIGN, 1); giveItems(player, SEALED_TALLUM_HELM_DESIGN, 1); - } - else if (chance < 100) - { + } else if (chance < 100) { giveAdena(player, 4000, true); } htmltext = "30929-02.html"; - } - else - { + } else { htmltext = "30929-02.html"; } break; } - case CLAUDIA_ATHEBALDT: - { + case CLAUDIA_ATHEBALDT: { if (hasQuestItems(player, REVELATION_OF_THE_SEALS_CHAPTER_OF_AVARICE, REVELATION_OF_THE_SEALS_CHAPTER_OF_GNOSIS, REVELATION_OF_THE_SEALS_CHAPTER_OF_STRIFE, // - REVELATION_OF_THE_SEALS_CHAPTER_OF_VENGEANCE, REVELATION_OF_THE_SEALS_CHAPTER_OF_AWEKENING, REVELATION_OF_THE_SEALS_CHAPTER_OF_CALAMITY, // - REVELATION_OF_THE_SEALS_CHAPTER_OF_DESCENT)) - { + REVELATION_OF_THE_SEALS_CHAPTER_OF_VENGEANCE, REVELATION_OF_THE_SEALS_CHAPTER_OF_AWEKENING, REVELATION_OF_THE_SEALS_CHAPTER_OF_CALAMITY, // + REVELATION_OF_THE_SEALS_CHAPTER_OF_DESCENT)) { takeItems(player, REVELATION_OF_THE_SEALS_CHAPTER_OF_AVARICE, 1); takeItems(player, REVELATION_OF_THE_SEALS_CHAPTER_OF_GNOSIS, 1); takeItems(player, REVELATION_OF_THE_SEALS_CHAPTER_OF_STRIFE, 1); @@ -674,32 +519,21 @@ public final class Q00372_LegacyOfInsolence extends Quest takeItems(player, REVELATION_OF_THE_SEALS_CHAPTER_OF_CALAMITY, 1); takeItems(player, REVELATION_OF_THE_SEALS_CHAPTER_OF_DESCENT, 1); - if (chance < 31) - { + if (chance < 31) { giveItems(player, SEALED_BOOTS_OF_NIGHTMARE_LINING, 1); - } - else if (chance < 62) - { + } else if (chance < 62) { giveItems(player, SEALED_GAUNTLETS_OF_NIGHTMARE_DESIGN, 1); - } - else if (chance < 75) - { + } else if (chance < 75) { giveItems(player, SEALED_HELM_OF_NIGHTMARE_DESIGN, 1); - } - else if (chance < 83) - { + } else if (chance < 83) { giveItems(player, SEALED_BOOTS_OF_NIGHTMARE_LINING, 1); giveItems(player, SEALED_GAUNTLETS_OF_NIGHTMARE_DESIGN, 1); giveItems(player, SEALED_HELM_OF_NIGHTMARE_DESIGN, 1); - } - else if (chance < 100) - { + } else if (chance < 100) { giveAdena(player, 4000, true); } htmltext = "31001-02.html"; - } - else - { + } else { htmltext = "31001-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00373_SupplierOfReagents/Q00373_SupplierOfReagents.java b/src/main/java/com/l2jserver/datapack/quests/Q00373_SupplierOfReagents/Q00373_SupplierOfReagents.java index 13700d1f6e..33aaeffb1a 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00373_SupplierOfReagents/Q00373_SupplierOfReagents.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00373_SupplierOfReagents/Q00373_SupplierOfReagents.java @@ -217,14 +217,12 @@ public final class Q00373_SupplierOfReagents extends Quest { qs.setMemoState(qs.getMemoState() + memoState); htmltext = event; playSound(player, Sound.SKILLSOUND_LIQUID_MIX); - } - else { + } else { // If the player has not the chosen catalyst, we take the ingredient previously saved (if not null) takeItem(player, MEMO_STATE_TO_ITEM.get(qs.getMemoState())); if (event.equals("31149-19.html")) { htmltext = "31149-25.html"; - } - else { + } else { htmltext = "31149-17.html"; } } @@ -233,8 +231,7 @@ public final class Q00373_SupplierOfReagents extends Quest { case "31149-26.html": { if (qs.isMemoState(1324)) { htmltext = "31149-26a.html"; - } - else { + } else { htmltext = event; } break; @@ -247,8 +244,7 @@ public final class Q00373_SupplierOfReagents extends Quest { case "31149-28a.html": { if (getRandom(100) < 33) { qs.setMemoStateEx(1, 3); // Temperature Ifrit - } - else { + } else { qs.setMemoStateEx(1, 0); } htmltext = event; @@ -257,8 +253,7 @@ public final class Q00373_SupplierOfReagents extends Quest { case "31149-29a.html": { if (getRandom(100) < 20) { qs.setMemoStateEx(1, 5); // Temperature Phoenix - } - else { + } else { qs.setMemoStateEx(1, 0); } htmltext = event; @@ -275,8 +270,7 @@ public final class Q00373_SupplierOfReagents extends Quest { takeItem(player, item2); htmltext = (reward == null) ? "31149-44.html" : "31149-45.html"; playSound(player, Sound.SKILLSOUND_LIQUID_FAIL); - } - else if ((memoState != 1324) || ((memoState == 1324) && (q235 != null) && q235.isStarted() && !hasQuestItems(player, reward.getItem()))) { + } else if ((memoState != 1324) || ((memoState == 1324) && (q235 != null) && q235.isStarted() && !hasQuestItems(player, reward.getItem()))) { if ((item1 != null) && (item2 != null) && hasItem(player, item1) && hasItem(player, item2)) { takeItem(player, item1); takeItem(player, item2); @@ -285,13 +279,11 @@ public final class Q00373_SupplierOfReagents extends Quest { qs.setMemoStateEx(1, 0); htmltext = reward.getHtml(); playSound(player, Sound.SKILLSOUND_LIQUID_SUCCESS); - } - else { + } else { htmltext = "31149-44.html"; playSound(player, Sound.SKILLSOUND_LIQUID_FAIL); } - } - else { + } else { htmltext = "31149-44.html"; } break; @@ -309,8 +301,7 @@ public final class Q00373_SupplierOfReagents extends Quest { final int chance = getRandom(1000); if (chance < 766) { giveItemRandomly(qs.getPlayer(), npc, DEMONS_BLOOD, 3, 0, 1, true); - } - else if (chance < 876) { + } else if (chance < 876) { giveItemRandomly(qs.getPlayer(), npc, MOONSTONE_SHARD, 1, 0, 1, true); } break; @@ -319,8 +310,7 @@ public final class Q00373_SupplierOfReagents extends Quest { final int chance = getRandom(100); if (chance < 45) { giveItemRandomly(qs.getPlayer(), npc, REAGENT_POUNCH1, 1, 0, 1, true); - } - else if (chance < 65) { + } else if (chance < 65) { giveItemRandomly(qs.getPlayer(), npc, VOLCANIC_ASH, 1, 0, 1, true); } break; @@ -335,8 +325,7 @@ public final class Q00373_SupplierOfReagents extends Quest { final int chance = getRandom(1000); if (chance < 666) { giveItemRandomly(qs.getPlayer(), npc, WYRM_BLOOD, 1, 0, 1, true); - } - else if (chance < 989) { + } else if (chance < 989) { giveItemRandomly(qs.getPlayer(), npc, LAVA_STONE, 1, 0, 1, true); } break; @@ -344,8 +333,7 @@ public final class Q00373_SupplierOfReagents extends Quest { case CRENDION: { if (getRandom(1000) < 618) { giveItemRandomly(qs.getPlayer(), npc, ROTTEN_BONE, 1, 0, 1, true); - } - else { + } else { giveItemRandomly(qs.getPlayer(), npc, QUICKSILVER, 1, 0, 1, true); } break; @@ -359,8 +347,7 @@ public final class Q00373_SupplierOfReagents extends Quest { case PLATINUM_TRIBE_SHAMAN: { if (getRandom(1000) < 658) { giveItemRandomly(qs.getPlayer(), npc, REAGENT_POUNCH2, 1, 0, 1, true); - } - else { + } else { giveItemRandomly(qs.getPlayer(), npc, QUICKSILVER, 2, 0, 1, true); } break; @@ -377,16 +364,13 @@ public final class Q00373_SupplierOfReagents extends Quest { if (qs.isCreated()) { if (talker.getLevel() < MIN_LVL) { htmltext = "30166-01.html"; - } - else { + } else { htmltext = "30166-02.htm"; } - } - else if (qs.isStarted()) { + } else if (qs.isStarted()) { if (npc.getId() == WESLEY) { htmltext = "30166-05.html"; - } - else { + } else { htmltext = "31149-01.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00376_ExplorationOfTheGiantsCavePart1/Q00376_ExplorationOfTheGiantsCavePart1.java b/src/main/java/com/l2jserver/datapack/quests/Q00376_ExplorationOfTheGiantsCavePart1/Q00376_ExplorationOfTheGiantsCavePart1.java index b277ffc6f9..0ff24c41ae 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00376_ExplorationOfTheGiantsCavePart1/Q00376_ExplorationOfTheGiantsCavePart1.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00376_ExplorationOfTheGiantsCavePart1/Q00376_ExplorationOfTheGiantsCavePart1.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Original Jython script by Gnacik. * @author nonom */ -public class Q00376_ExplorationOfTheGiantsCavePart1 extends Quest -{ +public class Q00376_ExplorationOfTheGiantsCavePart1 extends Quest { // NPC private static final int SOBLING = 31147; // Items @@ -44,8 +43,7 @@ public class Q00376_ExplorationOfTheGiantsCavePart1 extends Quest private static final int BOOK5 = 14840; // Mobs private static final Map<Integer, Double> MOBS = new HashMap<>(); - static - { + static { MOBS.put(22670, 0.314); // const_lord MOBS.put(22671, 0.302); // const_gaurdian MOBS.put(22672, 0.300); // const_seer @@ -56,8 +54,7 @@ public class Q00376_ExplorationOfTheGiantsCavePart1 extends Quest MOBS.put(22677, 0.266); // kranout } - public Q00376_ExplorationOfTheGiantsCavePart1() - { + public Q00376_ExplorationOfTheGiantsCavePart1() { super(376, Q00376_ExplorationOfTheGiantsCavePart1.class.getSimpleName(), "Exploration of the Giants' Cave - Part 1"); addStartNpc(SOBLING); addTalkId(SOBLING); @@ -66,31 +63,25 @@ public class Q00376_ExplorationOfTheGiantsCavePart1 extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { - case "31147-02.htm": - { + switch (event) { + case "31147-02.htm": { qs.startQuest(); htmltext = event; break; } case "31147-04.html": - case "31147-cont.html": - { + case "31147-cont.html": { htmltext = event; break; } - case "31147-quit.html": - { + case "31147-quit.html": { qs.exitQuest(true, true); htmltext = event; break; @@ -100,27 +91,21 @@ public class Q00376_ExplorationOfTheGiantsCavePart1 extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(player, -1, 3, npc); - if (qs != null) - { + if (qs != null) { giveItemRandomly(qs.getPlayer(), npc, ANCIENT_PARCHMENT, 1, 0, MOBS.get(npc.getId()), true); } return super.onKill(npc, player, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { + if (qs.isCreated()) { htmltext = ((player.getLevel() >= 79) ? "31147-01.htm" : "31147-00.html"); - } - else if (qs.isStarted()) - { + } else if (qs.isStarted()) { htmltext = (hasQuestItems(player, BOOK1, BOOK2, BOOK3, BOOK4, BOOK5) ? "31147-03.html" : "31147-02a.html"); } return htmltext; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00377_ExplorationOfTheGiantsCavePart2/Q00377_ExplorationOfTheGiantsCavePart2.java b/src/main/java/com/l2jserver/datapack/quests/Q00377_ExplorationOfTheGiantsCavePart2/Q00377_ExplorationOfTheGiantsCavePart2.java index 1ea1092943..4d9320fe59 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00377_ExplorationOfTheGiantsCavePart2/Q00377_ExplorationOfTheGiantsCavePart2.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00377_ExplorationOfTheGiantsCavePart2/Q00377_ExplorationOfTheGiantsCavePart2.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Original Jython script by Gnacik. * @author nonom */ -public class Q00377_ExplorationOfTheGiantsCavePart2 extends Quest -{ +public class Q00377_ExplorationOfTheGiantsCavePart2 extends Quest { // NPC private static final int SOBLING = 31147; // Items @@ -45,8 +44,7 @@ public class Q00377_ExplorationOfTheGiantsCavePart2 extends Quest // Mobs private static final Map<Integer, Integer> MOBS1 = new HashMap<>(); private static final Map<Integer, Double> MOBS2 = new HashMap<>(); - static - { + static { MOBS1.put(22660, 366); // lesser_giant_re MOBS1.put(22661, 424); // lesser_giant_soldier_re MOBS1.put(22662, 304); // lesser_giant_shooter_re @@ -59,8 +57,7 @@ public class Q00377_ExplorationOfTheGiantsCavePart2 extends Quest MOBS2.put(22669, 0.240); // leogul_re } - public Q00377_ExplorationOfTheGiantsCavePart2() - { + public Q00377_ExplorationOfTheGiantsCavePart2() { super(377, Q00377_ExplorationOfTheGiantsCavePart2.class.getSimpleName(), "Exploration of the Giants' Cave - Part 2"); addStartNpc(SOBLING); addTalkId(SOBLING); @@ -70,31 +67,25 @@ public class Q00377_ExplorationOfTheGiantsCavePart2 extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { - case "31147-02.htm": - { + switch (event) { + case "31147-02.htm": { qs.startQuest(); htmltext = event; break; } case "31147-04.html": - case "31147-cont.html": - { + case "31147-cont.html": { htmltext = event; break; } - case "31147-quit.html": - { + case "31147-quit.html": { qs.exitQuest(true, true); htmltext = event; break; @@ -104,19 +95,14 @@ public class Q00377_ExplorationOfTheGiantsCavePart2 extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(player, -1, 3, npc); - if (qs != null) - { + if (qs != null) { int npcId = npc.getId(); - if (MOBS1.containsKey(npcId)) - { + if (MOBS1.containsKey(npcId)) { final int itemCount = ((getRandom(1000) < MOBS1.get(npcId)) ? 3 : 2); giveItemRandomly(qs.getPlayer(), npc, TITAN_ANCIENT_BOOK, itemCount, 0, 1.0, true); - } - else - { + } else { giveItemRandomly(qs.getPlayer(), npc, TITAN_ANCIENT_BOOK, 1, 0, MOBS2.get(npcId), true); } } @@ -124,16 +110,12 @@ public class Q00377_ExplorationOfTheGiantsCavePart2 extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { + if (qs.isCreated()) { htmltext = ((player.getLevel() >= 79) ? "31147-01.htm" : "31147-00.html"); - } - else if (qs.isStarted()) - { + } else if (qs.isStarted()) { htmltext = (hasQuestItems(player, BOOK1, BOOK2, BOOK3, BOOK4, BOOK5) ? "31147-03.html" : "31147-02a.html"); } return htmltext; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00378_GrandFeast/Q00378_GrandFeast.java b/src/main/java/com/l2jserver/datapack/quests/Q00378_GrandFeast/Q00378_GrandFeast.java index 4405d1fdfb..7e630b55e3 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00378_GrandFeast/Q00378_GrandFeast.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00378_GrandFeast/Q00378_GrandFeast.java @@ -27,8 +27,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Grand Feast (378) * @author Adry_85 */ -public final class Q00378_GrandFeast extends Quest -{ +public final class Q00378_GrandFeast extends Quest { // NPC private static final int RANSPO = 30594; // Items @@ -51,144 +50,110 @@ public final class Q00378_GrandFeast extends Quest // Misc private static final int MIN_LEVEL = 20; - public Q00378_GrandFeast() - { + public Q00378_GrandFeast() { super(378, Q00378_GrandFeast.class.getSimpleName(), "Grand Feast"); addStartNpc(RANSPO); addTalkId(RANSPO); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "30594-02.htm": - { + switch (event) { + case "30594-02.htm": { qs.setMemoStateEx(1, 0); qs.startQuest(); htmltext = event; break; } - case "30594-05.html": - { + case "30594-05.html": { final int i0 = qs.getMemoStateEx(1); - if (hasQuestItems(player, OLD_WINE_15_YEAR)) - { + if (hasQuestItems(player, OLD_WINE_15_YEAR)) { takeItems(player, OLD_WINE_15_YEAR, 1); qs.setMemoStateEx(1, i0 + 10); qs.setCond(2, true); htmltext = event; - } - else - { + } else { htmltext = "30594-08.html"; } break; } - case "30594-06.html": - { + case "30594-06.html": { final int i0 = qs.getMemoStateEx(1); - if (hasQuestItems(player, OLD_WINE_30_YEAR)) - { + if (hasQuestItems(player, OLD_WINE_30_YEAR)) { takeItems(player, OLD_WINE_30_YEAR, 1); qs.setMemoStateEx(1, i0 + 20); qs.setCond(2, true); htmltext = event; - } - else - { + } else { htmltext = "30594-08.html"; } break; } - case "30594-07.html": - { + case "30594-07.html": { final int i0 = qs.getMemoStateEx(1); - if (hasQuestItems(player, OLD_WINE_60_YEAR)) - { + if (hasQuestItems(player, OLD_WINE_60_YEAR)) { takeItems(player, OLD_WINE_60_YEAR, 1); qs.setMemoStateEx(1, i0 + 30); qs.setCond(2, true); htmltext = event; - } - else - { + } else { htmltext = "30594-08.html"; } break; } case "30594-09.html": - case "30594-18.html": - { + case "30594-18.html": { htmltext = event; break; } - case "30594-12.html": - { - if (hasQuestItems(player, THEME_OF_THE_FEAST)) - { + case "30594-12.html": { + if (hasQuestItems(player, THEME_OF_THE_FEAST)) { takeItems(player, THEME_OF_THE_FEAST, 1); qs.setCond(3, true); htmltext = event; - } - else - { + } else { htmltext = "30594-08.html"; } break; } - case "30594-14.html": - { + case "30594-14.html": { final int i0 = qs.getMemoStateEx(1); - if (hasQuestItems(player, JONAS_SALAD_RECIPE)) - { + if (hasQuestItems(player, JONAS_SALAD_RECIPE)) { takeItems(player, JONAS_SALAD_RECIPE, 1); qs.setMemoStateEx(1, i0 + 1); qs.setCond(4, true); htmltext = event; - } - else - { + } else { htmltext = "30594-17.html"; } break; } - case "30594-15.html": - { + case "30594-15.html": { final int i0 = qs.getMemoStateEx(1); - if (hasQuestItems(player, JONAS_SAUCE_RECIPE)) - { + if (hasQuestItems(player, JONAS_SAUCE_RECIPE)) { takeItems(player, JONAS_SAUCE_RECIPE, 1); qs.setMemoStateEx(1, i0 + 2); qs.setCond(4, true); htmltext = event; - } - else - { + } else { htmltext = "30594-17.html"; } break; } - case "30594-16.html": - { + case "30594-16.html": { final int i0 = qs.getMemoStateEx(1); - if (hasQuestItems(player, JONAS_STEAK_RECIPE)) - { + if (hasQuestItems(player, JONAS_STEAK_RECIPE)) { takeItems(player, JONAS_STEAK_RECIPE, 1); qs.setMemoStateEx(1, i0 + 3); qs.setCond(4, true); htmltext = event; - } - else - { + } else { htmltext = "30594-17.html"; } break; @@ -198,98 +163,78 @@ public final class Q00378_GrandFeast extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { + if (qs.isCreated()) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "30594-01.htm" : "30594-03.html"; - } - else if (qs.isStarted()) - { - switch (qs.getCond()) - { - case 1: - { + } else if (qs.isStarted()) { + switch (qs.getCond()) { + case 1: { htmltext = "30594-04.html"; break; } - case 2: - { + case 2: { htmltext = (hasQuestItems(player, THEME_OF_THE_FEAST)) ? "30594-11.html" : "30594-10.html"; break; } - case 3: - { + case 3: { htmltext = "30594-13.html"; break; } - case 4: - { - if (hasQuestItems(player, RITRONS_DESSERT_RECIPE)) - { + case 4: { + if (hasQuestItems(player, RITRONS_DESSERT_RECIPE)) { takeItems(player, RITRONS_DESSERT_RECIPE, 1); int item = 0, adena = 0; long quantity = 0; - switch (qs.getMemoStateEx(1)) - { - case 11: - { + switch (qs.getMemoStateEx(1)) { + case 11: { item = RED_CRESCENT_EARRING; quantity = 1; adena = 5700; break; } - case 12: - { + case 12: { item = CORAL_EARRING; quantity = 2; adena = 1200; break; } - case 13: - { + case 13: { item = ENCHANTED_RING; quantity = 1; adena = 8100; break; } - case 21: - { + case 21: { item = CORAL_EARRING; quantity = 2; break; } - case 22: - { + case 22: { item = ENCHANTED_RING; quantity = 1; adena = 6900; break; } - case 23: - { + case 23: { item = NECKLACE_OF_DEVOTION; quantity = 1; break; } - case 31: - { + case 31: { item = BLUE_DIAMOND_NECKLACE; quantity = 1; adena = 25400; break; } - case 32: - { + case 32: { item = RING_OF_DEVOTION; quantity = 2; adena = 8500; break; } - case 33: - { + case 33: { item = ENCHANTED_EARRING; quantity = 1; adena = 2200; @@ -300,9 +245,7 @@ public final class Q00378_GrandFeast extends Quest giveAdena(player, adena, true); qs.exitQuest(true, true); htmltext = "30594-20.html"; - } - else - { + } else { htmltext = "30594-19.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00379_FantasyWine/Q00379_FantasyWine.java b/src/main/java/com/l2jserver/datapack/quests/Q00379_FantasyWine/Q00379_FantasyWine.java index f71b809d31..c551acaef9 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00379_FantasyWine/Q00379_FantasyWine.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00379_FantasyWine/Q00379_FantasyWine.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.util.Util; * Fantasy Wine (379) * @author Adry_85 */ -public final class Q00379_FantasyWine extends Quest -{ +public final class Q00379_FantasyWine extends Quest { // NPC private static final int HARLAN = 30074; // Items @@ -45,8 +44,7 @@ public final class Q00379_FantasyWine extends Quest // Misc private static final int MIN_LEVEL = 20; - public Q00379_FantasyWine() - { + public Q00379_FantasyWine() { super(379, Q00379_FantasyWine.class.getSimpleName(), "Fantasy Wine"); addStartNpc(HARLAN); addTalkId(HARLAN); @@ -55,49 +53,37 @@ public final class Q00379_FantasyWine extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "30074-02.htm": case "30074-03.htm": - case "30074-05.html": - { + case "30074-05.html": { htmltext = event; break; } - case "30074-04.htm": - { + case "30074-04.htm": { qs.startQuest(); htmltext = event; break; } - case "30074-11.html": - { - if (hasAllItems(player, true, LEAF_OF_EUCALYPTUS, STONE_OF_CHILL)) - { + case "30074-11.html": { + if (hasAllItems(player, true, LEAF_OF_EUCALYPTUS, STONE_OF_CHILL)) { final int random = getRandom(10); final int item; - if (random < 3) - { + if (random < 3) { item = OLD_WINE_15_YEAR; htmltext = event; - } - else if (random < 9) - { + } else if (random < 9) { item = OLD_WINE_30_YEAR; htmltext = "30074-12.html"; - } - else - { + } else { item = OLD_WINE_60_YEAR; htmltext = "30074-13.html"; } @@ -113,52 +99,38 @@ public final class Q00379_FantasyWine extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs == null) || !Util.checkIfInRange(1500, npc, killer, true)) - { + if ((qs == null) || !Util.checkIfInRange(1500, npc, killer, true)) { return null; } final ItemHolder dropItem = ((npc.getId() == ENKU_ORC_CHAMPION) ? LEAF_OF_EUCALYPTUS : STONE_OF_CHILL); - if (giveItemRandomly(killer, npc, dropItem.getId(), 1, dropItem.getCount(), 1.0, true) && hasAllItems(killer, true, LEAF_OF_EUCALYPTUS, STONE_OF_CHILL)) - { + if (giveItemRandomly(killer, npc, dropItem.getId(), 1, dropItem.getCount(), 1.0, true) && hasAllItems(killer, true, LEAF_OF_EUCALYPTUS, STONE_OF_CHILL)) { qs.setCond(2); } return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { + if (qs.isCreated()) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "30074-01.htm" : "30074-06.html"; - } - else if (qs.isStarted()) - { + } else if (qs.isStarted()) { final boolean hasLeafOfEucalyptus = hasItem(player, LEAF_OF_EUCALYPTUS); final boolean hasStoneOfChill = hasItem(player, STONE_OF_CHILL); - if (!hasLeafOfEucalyptus && !hasStoneOfChill) - { + if (!hasLeafOfEucalyptus && !hasStoneOfChill) { htmltext = "30074-07.html"; - } - else if (hasLeafOfEucalyptus && !hasStoneOfChill) - { + } else if (hasLeafOfEucalyptus && !hasStoneOfChill) { htmltext = "30074-08.html"; - } - else if (!hasLeafOfEucalyptus && hasStoneOfChill) - { + } else if (!hasLeafOfEucalyptus && hasStoneOfChill) { htmltext = "30074-09.html"; - } - else - { + } else { htmltext = "30074-10.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00380_BringOutTheFlavorOfIngredients/Q00380_BringOutTheFlavorOfIngredients.java b/src/main/java/com/l2jserver/datapack/quests/Q00380_BringOutTheFlavorOfIngredients/Q00380_BringOutTheFlavorOfIngredients.java index 79ded52963..84205fdb17 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00380_BringOutTheFlavorOfIngredients/Q00380_BringOutTheFlavorOfIngredients.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00380_BringOutTheFlavorOfIngredients/Q00380_BringOutTheFlavorOfIngredients.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.model.quest.State; * Bring Out the Flavor of Ingredients! (380) * @author Pandragon */ -public final class Q00380_BringOutTheFlavorOfIngredients extends Quest -{ +public final class Q00380_BringOutTheFlavorOfIngredients extends Quest { // NPC private static final int ROLLAND = 30069; // Items @@ -56,8 +55,7 @@ public final class Q00380_BringOutTheFlavorOfIngredients extends Quest // Misc private static final int MIN_LVL = 24; - public Q00380_BringOutTheFlavorOfIngredients() - { + public Q00380_BringOutTheFlavorOfIngredients() { super(380, Q00380_BringOutTheFlavorOfIngredients.class.getSimpleName(), "Bring Out the Flavor of Ingredients!"); addStartNpc(ROLLAND); addTalkId(ROLLAND); @@ -66,34 +64,26 @@ public final class Q00380_BringOutTheFlavorOfIngredients extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs != null) - { - switch (event) - { + if (qs != null) { + switch (event) { case "30069-03.htm": case "30069-04.htm": - case "30069-06.html": - { + case "30069-06.html": { htmltext = event; break; } - case "30069-05.htm": - { - if (qs.isCreated()) - { + case "30069-05.htm": { + if (qs.isCreated()) { qs.startQuest(); htmltext = event; } break; } - case "30069-13.html": - { - if (qs.isCond(9)) - { + case "30069-13.html": { + if (qs.isCond(9)) { rewardItems(player, RITRON_RECIPE, 1); qs.exitQuest(true, true); htmltext = event; @@ -106,82 +96,64 @@ public final class Q00380_BringOutTheFlavorOfIngredients extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (qs.getState()) - { - case State.CREATED: - { + switch (qs.getState()) { + case State.CREATED: { htmltext = (talker.getLevel() >= MIN_LVL) ? "30069-02.htm" : "30069-01.htm"; break; } - case State.STARTED: - { - switch (qs.getCond()) - { + case State.STARTED: { + switch (qs.getCond()) { case 1: case 2: case 3: - case 4: - { - if ((getQuestItemsCount(talker, ANTIDOTE) >= 2) && (getQuestItemsCount(talker, RITRON_FRUIT) >= 4) && (getQuestItemsCount(talker, MOON_FLOWER) >= 20) && (getQuestItemsCount(talker, LEECH_FLUIDS) >= 10)) - { + case 4: { + if ((getQuestItemsCount(talker, ANTIDOTE) >= 2) && (getQuestItemsCount(talker, RITRON_FRUIT) >= 4) && (getQuestItemsCount(talker, MOON_FLOWER) >= 20) && (getQuestItemsCount(talker, LEECH_FLUIDS) >= 10)) { takeItems(talker, ANTIDOTE, 2); takeItems(talker, -1, RITRON_FRUIT, MOON_FLOWER, LEECH_FLUIDS); qs.setCond(5, true); htmltext = "30069-08.html"; - } - else - { + } else { htmltext = "30069-07.html"; } break; } - case 5: - { + case 5: { qs.setCond(6, true); htmltext = "30069-09.html"; break; } - case 6: - { + case 6: { qs.setCond(7, true); htmltext = "30069-10.html"; break; } - case 7: - { + case 7: { qs.setCond(8, true); htmltext = "30069-11.html"; break; } - case 8: - { + case 8: { rewardItems(talker, RITRON_DESSERT, 1); - if (getRandom(100) < 56) - { + if (getRandom(100) < 56) { htmltext = "30069-15.html"; qs.exitQuest(true, true); - } - else - { + } else { qs.setCond(9, true); htmltext = "30069-12.html"; } break; } - case 9: - { + case 9: { htmltext = "30069-12.html"; break; } } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(talker); break; } @@ -190,11 +162,9 @@ public final class Q00380_BringOutTheFlavorOfIngredients extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc); - if ((qs != null) && (qs.getCond() < 4)) - { + if ((qs != null) && (qs.getCond() < 4)) { final ItemChanceHolder item = MONSTER_CHANCES.get(npc.getId()); if (giveItemRandomly(qs.getPlayer(), npc, item.getId(), 1, item.getCount(), item.getChance(), false)) { if ((getQuestItemsCount(killer, RITRON_FRUIT) >= 3) && (getQuestItemsCount(killer, MOON_FLOWER) >= 20) && (getQuestItemsCount(killer, LEECH_FLUIDS) >= 10)) { diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00381_LetsBecomeARoyalMember/Q00381_LetsBecomeARoyalMember.java b/src/main/java/com/l2jserver/datapack/quests/Q00381_LetsBecomeARoyalMember/Q00381_LetsBecomeARoyalMember.java index a869b8868e..72f438375c 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00381_LetsBecomeARoyalMember/Q00381_LetsBecomeARoyalMember.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00381_LetsBecomeARoyalMember/Q00381_LetsBecomeARoyalMember.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.util.Util; * Let's Become a Royal Member! (381) * @author Pandragon */ -public final class Q00381_LetsBecomeARoyalMember extends Quest -{ +public final class Q00381_LetsBecomeARoyalMember extends Quest { // NPCs private static final int SANDRA = 30090; private static final int SORINT = 30232; @@ -47,8 +46,7 @@ public final class Q00381_LetsBecomeARoyalMember extends Quest // Misc private static final int MIN_LVL = 55; - public Q00381_LetsBecomeARoyalMember() - { + public Q00381_LetsBecomeARoyalMember() { super(381, Q00381_LetsBecomeARoyalMember.class.getSimpleName(), "Let's Become a Royal Member!"); addStartNpc(SORINT); addTalkId(SORINT, SANDRA); @@ -57,30 +55,23 @@ public final class Q00381_LetsBecomeARoyalMember extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { - case "30232-03.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "30232-03.htm": { + if (qs.isCreated()) { qs.startQuest(); qs.setMemoState(1); htmltext = event; } break; } - case "30090-02.html": - { - if (qs.isMemoState(1) && !hasQuestItems(player, COIN_ALBUM)) - { + case "30090-02.html": { + if (qs.isMemoState(1) && !hasQuestItems(player, COIN_ALBUM)) { qs.setMemoState(2); playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); htmltext = event; @@ -92,74 +83,51 @@ public final class Q00381_LetsBecomeARoyalMember extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (npc.getId()) - { - case SORINT: - { - if (qs.isCreated()) - { - if ((talker.getLevel() < MIN_LVL) || !hasQuestItems(talker, COLLECTOR_MEMBERSHIP_1)) - { + switch (npc.getId()) { + case SORINT: { + if (qs.isCreated()) { + if ((talker.getLevel() < MIN_LVL) || !hasQuestItems(talker, COLLECTOR_MEMBERSHIP_1)) { htmltext = "30232-02.html"; - } - else if (!hasQuestItems(talker, ROYAL_MEMBERSHIP)) - { + } else if (!hasQuestItems(talker, ROYAL_MEMBERSHIP)) { htmltext = "30232-01.htm"; } // TODO this quest is not visible in quest list if neither of these IF blocks are true - } - else if (qs.isStarted()) - { + } else if (qs.isStarted()) { final boolean hasAlbum = hasQuestItems(talker, COIN_ALBUM); final boolean hasCoin = hasQuestItems(talker, KAILS_COIN); - if (hasAlbum && hasCoin) - { + if (hasAlbum && hasCoin) { takeItems(talker, 1, KAILS_COIN, COIN_ALBUM); giveItems(talker, ROYAL_MEMBERSHIP, 1); qs.exitQuest(false, true); htmltext = "30232-06.html"; - } - else if (hasAlbum || hasCoin) - { + } else if (hasAlbum || hasCoin) { htmltext = "30232-05.html"; - } - else - { + } else { htmltext = "30232-04.html"; } - } - else - { + } else { htmltext = getAlreadyCompletedMsg(talker); } break; } - case SANDRA: - { - switch (qs.getMemoState()) - { + case SANDRA: { + switch (qs.getMemoState()) { case 1: htmltext = "30090-01.html"; break; case 2: - if (hasQuestItems(talker, COIN_ALBUM)) - { + if (hasQuestItems(talker, COIN_ALBUM)) { htmltext = "30090-05.html"; - } - else if (hasQuestItems(talker, FOUR_LEAF_COIN)) - { + } else if (hasQuestItems(talker, FOUR_LEAF_COIN)) { takeItems(talker, FOUR_LEAF_COIN, 1); giveItems(talker, COIN_ALBUM, 1); playSound(talker, Sound.ITEMSOUND_QUEST_MIDDLE); htmltext = "30090-04.html"; - } - else - { + } else { htmltext = "30090-03.html"; } break; @@ -171,17 +139,12 @@ public final class Q00381_LetsBecomeARoyalMember extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - if (npc.getId() == ANCIENT_GARGOYLE) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + if (npc.getId() == ANCIENT_GARGOYLE) { giveItemRandomly(killer, npc, KAILS_COIN, 1, 1, 0.05, true); - } - else if (qs.isMemoState(2) && !hasQuestItems(killer, FOUR_LEAF_COIN)) - { + } else if (qs.isMemoState(2) && !hasQuestItems(killer, FOUR_LEAF_COIN)) { giveItems(killer, FOUR_LEAF_COIN, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00382_KailsMagicCoin/Q00382_KailsMagicCoin.java b/src/main/java/com/l2jserver/datapack/quests/Q00382_KailsMagicCoin/Q00382_KailsMagicCoin.java index 9d6a7be820..fdf5f3de91 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00382_KailsMagicCoin/Q00382_KailsMagicCoin.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00382_KailsMagicCoin/Q00382_KailsMagicCoin.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.util.Util; * Kail's Magic Coin (382) * @author Sdw, jurchicks */ -public final class Q00382_KailsMagicCoin extends Quest -{ +public final class Q00382_KailsMagicCoin extends Quest { // NPCs private static final int VERGARA = 30687; // Monsters @@ -49,8 +48,7 @@ public final class Q00382_KailsMagicCoin extends Quest // Drops private static final double ORC_CAPTAIN_DROP_CHANCE = 0.069; private static final Map<Integer, ItemChanceHolder> MONSTER_DROPS = new HashMap<>(); - static - { + static { MONSTER_DROPS.put(FALLEN_ORC, new ItemChanceHolder(KAILS_SILVER_BASILISK, 0.073)); MONSTER_DROPS.put(FALLEN_ORC_ARCHER, new ItemChanceHolder(KAILS_GOLD_GOLEM, 0.075)); MONSTER_DROPS.put(FALLEN_ORC_SHAMAN, new ItemChanceHolder(KAILS_BLOOD_DRAGON, 0.073)); @@ -58,8 +56,7 @@ public final class Q00382_KailsMagicCoin extends Quest // Misc private static final int MIN_LVL = 55; - public Q00382_KailsMagicCoin() - { + public Q00382_KailsMagicCoin() { super(382, Q00382_KailsMagicCoin.class.getSimpleName(), "Kail's Magic Coin"); addStartNpc(VERGARA); addTalkId(VERGARA); @@ -67,31 +64,24 @@ public final class Q00382_KailsMagicCoin extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { - case "30386-03.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "30386-03.htm": { + if (qs.isCreated()) { qs.startQuest(); htmltext = event; } break; } case "30386-05.htm": - case "30386-06.htm": - { - if (qs.isStarted()) - { + case "30386-06.htm": { + if (qs.isStarted()) { htmltext = event; } break; @@ -101,33 +91,24 @@ public final class Q00382_KailsMagicCoin extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - if (qs.isCreated()) - { + if (qs.isCreated()) { htmltext = (((talker.getLevel() >= MIN_LVL) && hasQuestItems(talker, ROYAL_MEMBERSHIP)) ? "30687-02.htm" : "30687-01.htm"); - } - else if (qs.isStarted()) - { + } else if (qs.isStarted()) { htmltext = "30687-04.htm"; } return htmltext; } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && hasQuestItems(killer, ROYAL_MEMBERSHIP) && Util.checkIfInRange(1500, npc, killer, true)) - { - if (npc.getId() == FALLEN_ORC_CAPTAIN) - { + if ((qs != null) && hasQuestItems(killer, ROYAL_MEMBERSHIP) && Util.checkIfInRange(1500, npc, killer, true)) { + if (npc.getId() == FALLEN_ORC_CAPTAIN) { giveItemRandomly(killer, KAILS_SILVER_BASILISK + getRandom(3), 1, 0, ORC_CAPTAIN_DROP_CHANCE, true); - } - else - { + } else { final ItemChanceHolder ih = MONSTER_DROPS.get(npc.getId()); giveItemRandomly(killer, ih.getId(), 1, 0, ih.getChance(), true); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00383_TreasureHunt/Q00383_TreasureHunt.java b/src/main/java/com/l2jserver/datapack/quests/Q00383_TreasureHunt/Q00383_TreasureHunt.java index 943c6f3e4c..73187d8695 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00383_TreasureHunt/Q00383_TreasureHunt.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00383_TreasureHunt/Q00383_TreasureHunt.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Treasure Hunt (383) * @author Adry_85 */ -public final class Q00383_TreasureHunt extends Quest -{ +public final class Q00383_TreasureHunt extends Quest { // NPCs private static final int ESPEN = 30890; private static final int PIRATES_CHEST = 31148; @@ -67,49 +66,39 @@ public final class Q00383_TreasureHunt extends Quest private static final ItemHolder DYE_W1I3_C = new ItemHolder(4491, 1); // Greater Dye of WIT <Wit+1 Int-3> private static final ItemHolder DYE_W1M3_C = new ItemHolder(4492, 1); // Greater Dye of WIT <Wit+1 Men-3> - public Q00383_TreasureHunt() - { + public Q00383_TreasureHunt() { super(383, Q00383_TreasureHunt.class.getSimpleName(), "Treasure Hunt"); addStartNpc(ESPEN); addTalkId(ESPEN, PIRATES_CHEST); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "30890-04.htm": - { + switch (event) { + case "30890-04.htm": { htmltext = event; break; } - case "30890-05.htm": - { - if (hasQuestItems(player, PIRATES_TREASURE_MAP)) - { + case "30890-05.htm": { + if (hasQuestItems(player, PIRATES_TREASURE_MAP)) { giveAdena(player, 1000, false); takeItems(player, PIRATES_TREASURE_MAP, -1); htmltext = event; } break; } - case "30890-06.htm": - { + case "30890-06.htm": { htmltext = (hasQuestItems(player, PIRATES_TREASURE_MAP)) ? event : "30890-12.html"; break; } - case "30890-07.htm": - { - if (hasQuestItems(player, PIRATES_TREASURE_MAP)) - { + case "30890-07.htm": { + if (hasQuestItems(player, PIRATES_TREASURE_MAP)) { qs.startQuest(); takeItems(player, PIRATES_TREASURE_MAP, -1); htmltext = event; @@ -118,29 +107,22 @@ public final class Q00383_TreasureHunt extends Quest } case "30890-08.html": case "30890-09.html": - case "30890-10.html": - { - if (qs.isCond(1)) - { + case "30890-10.html": { + if (qs.isCond(1)) { htmltext = event; } break; } - case "30890-11.html": - { - if (qs.isCond(1)) - { + case "30890-11.html": { + if (qs.isCond(1)) { qs.setCond(2, true); htmltext = event; } break; } - case "31148-02.html": - { - if (qs.isCond(2)) - { - if (hasQuestItems(player, THIEF_KEY)) - { + case "31148-02.html": { + if (qs.isCond(2)) { + if (hasQuestItems(player, THIEF_KEY)) { takeItems(player, THIEF_KEY, 1); qs.exitQuest(true, true); htmltext = event; @@ -148,144 +130,84 @@ public final class Q00383_TreasureHunt extends Quest int bonus = 0; int random = getRandom(100); - if (random < 5) - { + if (random < 5) { rewardItems(player, MITHRIL_GLOVES); - } - else if (random < 6) - { + } else if (random < 6) { rewardItems(player, SAGES_WORN_GLOVES); - } - else if (random < 18) - { + } else if (random < 18) { rewardItems(player, SCROLL_ENCHANT_ARMOR_D); - } - else if (random < 28) - { + } else if (random < 28) { rewardItems(player, SCROLL_ENCHANT_ARMOR_C); - } - else - { + } else { bonus += 500; } random = getRandom(1000); - if (random < 25) - { + if (random < 25) { rewardItems(player, DYE_S1C3_C); - } - else if (random < 50) - { + } else if (random < 50) { rewardItems(player, DYE_S1D3_C); - } - else if (random < 75) - { + } else if (random < 75) { rewardItems(player, DYE_C1S3_C); - } - else if (random < 100) - { + } else if (random < 100) { rewardItems(player, DYE_C1C3_C); - } - else if (random < 125) - { + } else if (random < 125) { rewardItems(player, DYE_D1S3_C); - } - else if (random < 150) - { + } else if (random < 150) { rewardItems(player, DYE_D1C3_C); - } - else if (random < 175) - { + } else if (random < 175) { rewardItems(player, DYE_I1M3_C); - } - else if (random < 200) - { + } else if (random < 200) { rewardItems(player, DYE_I1W3_C); - } - else if (random < 225) - { + } else if (random < 225) { rewardItems(player, DYE_M1I3_C); - } - else if (random < 250) - { + } else if (random < 250) { rewardItems(player, DYE_M1W3_C); - } - else if (random < 275) - { + } else if (random < 275) { rewardItems(player, DYE_W1I3_C); - } - else if (random < 300) - { + } else if (random < 300) { rewardItems(player, DYE_W1M3_C); - } - else - { + } else { bonus += 300; } random = getRandom(100); - if (random < 4) - { + if (random < 4) { rewardItems(player, EMERALD); - } - else if (random < 8) - { + } else if (random < 8) { rewardItems(player, BLUE_ONYX); - } - else if (random < 12) - { + } else if (random < 12) { rewardItems(player, ONYX); - } - else if (random < 16) - { + } else if (random < 16) { rewardItems(player, MOONSTONE); - } - else if (random < 20) - { + } else if (random < 20) { rewardItems(player, ALEXANDRITE); - } - else if (random < 25) - { + } else if (random < 25) { rewardItems(player, FIRE_EMERALD); - } - else if (random < 27) - { + } else if (random < 27) { rewardItems(player, IMPERIAL_DIAMOND); - } - else - { + } else { bonus += 500; } random = getRandom(100); - if (random < 20) - { + if (random < 20) { rewardItems(player, MUSICAL_SCORE_THEME_OF_LOVE); - } - else if (random < 40) - { + } else if (random < 40) { rewardItems(player, MUSICAL_SCORE_THEME_OF_BATTLE); - } - else if (random < 60) - { + } else if (random < 60) { rewardItems(player, MUSICAL_SCORE_THEME_OF_CELEBRATION); - } - else if (random < 80) - { + } else if (random < 80) { rewardItems(player, MUSICAL_SCORE_THEME_OF_COMEDY); - } - else - { + } else { bonus += 500; } giveAdena(player, bonus, true); - } - else - { + } else { htmltext = "31148-03.html"; } } @@ -296,42 +218,26 @@ public final class Q00383_TreasureHunt extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (player.getLevel() < MIN_LEVEL) - { + if (qs.isCreated()) { + if (player.getLevel() < MIN_LEVEL) { htmltext = "30890-01.html"; - } - else if (!hasQuestItems(player, PIRATES_TREASURE_MAP)) - { + } else if (!hasQuestItems(player, PIRATES_TREASURE_MAP)) { htmltext = "30890-02.html"; - } - else - { + } else { htmltext = "30890-03.htm"; } - } - else if (qs.isStarted()) - { - if (npc.getId() == ESPEN) - { - if (qs.isCond(1)) - { + } else if (qs.isStarted()) { + if (npc.getId() == ESPEN) { + if (qs.isCond(1)) { htmltext = "30890-13.html"; - } - else if (qs.isCond(2)) - { + } else if (qs.isCond(2)) { htmltext = "30890-14.html"; } - } - else - { - if (qs.isCond(2)) - { + } else { + if (qs.isCond(2)) { htmltext = "31148-01.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00385_YokeOfThePast/Q00385_YokeOfThePast.java b/src/main/java/com/l2jserver/datapack/quests/Q00385_YokeOfThePast/Q00385_YokeOfThePast.java index 6af96f3f0e..cc373b5cd9 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00385_YokeOfThePast/Q00385_YokeOfThePast.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00385_YokeOfThePast/Q00385_YokeOfThePast.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.State; * Yoke of the Past (385) * @author Pandragon */ -public final class Q00385_YokeOfThePast extends Quest -{ +public final class Q00385_YokeOfThePast extends Quest { // NPCs // @formatter:off private static final int[] ZIGGURATS = @@ -97,8 +96,7 @@ public final class Q00385_YokeOfThePast extends Quest // Misc private static final int MIN_LVL = 20; - public Q00385_YokeOfThePast() - { + public Q00385_YokeOfThePast() { super(385, Q00385_YokeOfThePast.class.getSimpleName(), "Yoke of the Past"); addStartNpc(ZIGGURATS); addTalkId(ZIGGURATS); @@ -107,33 +105,26 @@ public final class Q00385_YokeOfThePast extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs != null) - { - switch (event) - { + if (qs != null) { + switch (event) { case "ziggurat-03.htm": case "ziggurat-04.htm": case "ziggurat-06.htm": - case "ziggurat-07.htm": - { + case "ziggurat-07.htm": { htmltext = event; break; } - case "ziggurat-05.htm": - { - if (qs.isCreated()) - { + case "ziggurat-05.htm": { + if (qs.isCreated()) { qs.startQuest(); htmltext = event; } break; } - case "ziggurat-10.html": - { + case "ziggurat-10.html": { qs.exitQuest(true, true); htmltext = event; break; @@ -144,27 +135,20 @@ public final class Q00385_YokeOfThePast extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (qs.getState()) - { - case State.CREATED: - { + switch (qs.getState()) { + case State.CREATED: { htmltext = (talker.getLevel() >= MIN_LVL) ? "ziggurat-01.htm" : "ziggurat-02.htm"; break; } - case State.STARTED: - { - if (hasQuestItems(talker, SCROLL_OF_ANCIENT_MAGIC)) - { + case State.STARTED: { + if (hasQuestItems(talker, SCROLL_OF_ANCIENT_MAGIC)) { rewardItems(talker, BLANK_SCROLL, getQuestItemsCount(talker, SCROLL_OF_ANCIENT_MAGIC)); takeItems(talker, SCROLL_OF_ANCIENT_MAGIC, -1); htmltext = "ziggurat-09.html"; - } - else - { + } else { htmltext = "ziggurat-08.html"; } break; @@ -174,11 +158,9 @@ public final class Q00385_YokeOfThePast extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc); - if (qs != null) - { + if (qs != null) { giveItemRandomly(qs.getPlayer(), npc, SCROLL_OF_ANCIENT_MAGIC, 1, 0, MONSTER_CHANCES.get(npc.getId()), true); } return super.onKill(npc, killer, isSummon); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00386_StolenDignity/Q00386_StolenDignity.java b/src/main/java/com/l2jserver/datapack/quests/Q00386_StolenDignity/Q00386_StolenDignity.java index 7c0b294d55..367cd8a904 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00386_StolenDignity/Q00386_StolenDignity.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00386_StolenDignity/Q00386_StolenDignity.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.util.Util; * Stolen Dignity (386) * @author Zealar */ -public final class Q00386_StolenDignity extends Quest -{ +public final class Q00386_StolenDignity extends Quest { // NPCs private static final int WAREHOUSE_KEEPER_ROMP = 30843; @@ -103,8 +102,7 @@ public final class Q00386_StolenDignity extends Quest private static final int HAND_OF_CABRIO_HEAD = 8721; private static final int CRYSTAL_OF_DEAMON_PIECE = 8722; - public Q00386_StolenDignity() - { + public Q00386_StolenDignity() { super(386, Q00386_StolenDignity.class.getSimpleName(), "Stolen Dignity"); addStartNpc(WAREHOUSE_KEEPER_ROMP); addTalkId(WAREHOUSE_KEEPER_ROMP); @@ -112,22 +110,17 @@ public final class Q00386_StolenDignity extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (npc.getId() == WAREHOUSE_KEEPER_ROMP) - { - if (qs.isCreated()) - { - if (player.getLevel() >= 58) - { + if (npc.getId() == WAREHOUSE_KEEPER_ROMP) { + if (qs.isCreated()) { + if (player.getLevel() >= 58) { return "30843-01.htm"; } return "30843-04.html"; } - if (qs.getQuestItemsCount(Q_STOLEN_INF_ORE) < 100) - { + if (qs.getQuestItemsCount(Q_STOLEN_INF_ORE) < 100) { return "30843-06.html"; } return "30843-07.html"; @@ -136,13 +129,10 @@ public final class Q00386_StolenDignity extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if ((qs != null) && (npc.getId() == WAREHOUSE_KEEPER_ROMP)) - { - if (event.equals("QUEST_ACCEPTED")) - { + if ((qs != null) && (npc.getId() == WAREHOUSE_KEEPER_ROMP)) { + if (event.equals("QUEST_ACCEPTED")) { qs.playSound(Sound.ITEMSOUND_QUEST_ACCEPT); qs.setMemoState(386); qs.startQuest(); @@ -150,28 +140,23 @@ public final class Q00386_StolenDignity extends Quest qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); return "30843-05.htm"; } - if (event.contains(".html")) - { + if (event.contains(".html")) { return event; } int ask = Integer.parseInt(event); - switch (ask) - { + switch (ask) { case 3: return "30843-09a.html"; case 5: return "30843-03.html"; - case 6: - { + case 6: { qs.exitQuest(true); return "30843-08.html"; } case 9: return "30843-09.htm"; - case 8: - { - if (qs.getQuestItemsCount(Q_STOLEN_INF_ORE) >= 100) - { + case 8: { + if (qs.getQuestItemsCount(Q_STOLEN_INF_ORE) >= 100) { qs.takeItems(Q_STOLEN_INF_ORE, 100); createBingoBoard(qs); return "30843-12.html"; @@ -186,8 +171,7 @@ public final class Q00386_StolenDignity extends Quest case 15: case 16: case 17: - case 18: - { + case 18: { selectBingoNumber(qs, (ask - 9)); return fillBoard(player, qs, getHtm(player.getHtmlPrefix(), "30843-13.html")); } @@ -199,8 +183,7 @@ public final class Q00386_StolenDignity extends Quest case 24: case 25: case 26: - case 27: - { + case 27: { return takeHtml(player, qs, (ask - 18)); } case 55: @@ -211,8 +194,7 @@ public final class Q00386_StolenDignity extends Quest case 60: case 61: case 62: - case 63: - { + case 63: { return beforeReward(player, qs, (ask - 54)); } } @@ -220,74 +202,51 @@ public final class Q00386_StolenDignity extends Quest return super.onAdvEvent(event, npc, player); } - private String takeHtml(L2PcInstance player, QuestState qs, int num) - { + private String takeHtml(L2PcInstance player, QuestState qs, int num) { String html = null; int i3; - if (!isSelectedBingoNumber(qs, num)) - { + if (!isSelectedBingoNumber(qs, num)) { selectBingoNumber(qs, num); i3 = getBingoSelectCount(qs); - if (i3 == 2) - { + if (i3 == 2) { html = getHtm(player.getHtmlPrefix(), "30843-14.html"); - } - else if (i3 == 3) - { + } else if (i3 == 3) { html = getHtm(player.getHtmlPrefix(), "30843-16.html"); - } - else if (i3 == 4) - { + } else if (i3 == 4) { html = getHtm(player.getHtmlPrefix(), "30843-18.html"); - } - else if (i3 == 5) - { + } else if (i3 == 5) { html = getHtm(player.getHtmlPrefix(), "30843-20.html"); } return fillBoard(player, qs, html); } i3 = getBingoSelectCount(qs); - if (i3 == 1) - { + if (i3 == 1) { html = getHtm(player.getHtmlPrefix(), "30843-15.html"); - } - else if (i3 == 2) - { + } else if (i3 == 2) { html = getHtm(player.getHtmlPrefix(), "30843-17.html"); - } - else if (i3 == 3) - { + } else if (i3 == 3) { html = getHtm(player.getHtmlPrefix(), "30843-19.html"); - } - else if (i3 == 4) - { + } else if (i3 == 4) { html = getHtm(player.getHtmlPrefix(), "30843-21.html"); } return fillBoard(player, qs, html); } - private String fillBoard(L2PcInstance player, QuestState qs, String html) - { - for (int i0 = 0; i0 < 9; i0 = i0 + 1) - { + private String fillBoard(L2PcInstance player, QuestState qs, String html) { + for (int i0 = 0; i0 < 9; i0 = i0 + 1) { int i1 = getNumberFromBingoBoard(qs, i0); - if (isSelectedBingoNumber(qs, i1)) - { + if (isSelectedBingoNumber(qs, i1)) { html = html.replace("<?Cell" + (i0 + 1) + "?>", i1 + ""); - } - else - { + } else { html = html.replace("<?Cell" + (i0 + 1) + "?>", "?"); } } return html; } - private String colorBoard(L2PcInstance player, QuestState qs, String html) - { - for (int i0 = 0; i0 < 9; i0 = i0 + 1) - { + private String colorBoard(L2PcInstance player, QuestState qs, String html) { + for (int i0 = 0; i0 < 9; i0 = i0 + 1) { int i1 = getNumberFromBingoBoard(qs, i0); html = html.replace("<?FontColor" + (i0 + 1) + "?>", (isSelectedBingoNumber(qs, i1)) ? "ff0000" : "ffffff"); html = html.replace("<?Cell" + (i0 + 1) + "?>", i1 + ""); @@ -295,25 +254,18 @@ public final class Q00386_StolenDignity extends Quest return html; } - private String beforeReward(L2PcInstance player, QuestState qs, int num) - { - if (!isSelectedBingoNumber(qs, num)) - { + private String beforeReward(L2PcInstance player, QuestState qs, int num) { + if (!isSelectedBingoNumber(qs, num)) { selectBingoNumber(qs, num); int i3 = getMatchedBingoLineCount(qs); String html; - if ((i3 == 3) && ((getBingoSelectCount(qs)) == 6)) - { + if ((i3 == 3) && ((getBingoSelectCount(qs)) == 6)) { reward(player, qs, 4); html = getHtm(player.getHtmlPrefix(), "30843-22.html"); - } - else if ((i3 == 0) && (getBingoSelectCount(qs) == 6)) - { + } else if ((i3 == 0) && (getBingoSelectCount(qs) == 6)) { reward(player, qs, 10); html = getHtm(player.getHtmlPrefix(), "30843-24.html"); - } - else - { + } else { html = getHtm(player.getHtmlPrefix(), "30843-23.html"); } return colorBoard(player, qs, html); @@ -321,172 +273,137 @@ public final class Q00386_StolenDignity extends Quest return fillBoard(player, qs, getHtm(player.getHtmlPrefix(), "30843-25.html")); } - private void reward(L2PcInstance player, QuestState qs, int count) - { - switch (getRandom(33)) - { - case 0: - { + private void reward(L2PcInstance player, QuestState qs, int count) { + switch (getRandom(33)) { + case 0: { qs.giveItems(DRAGON_SLAYER_EDGE, count); break; } - case 1: - { + case 1: { qs.giveItems(METEOR_SHOWER_HEAD, count); break; } - case 2: - { + case 2: { qs.giveItems(ELYSIAN_HEAD, count); break; } - case 3: - { + case 3: { qs.giveItems(SOUL_BOW_SHAFT, count); break; } - case 4: - { + case 4: { qs.giveItems(CARNIUM_BOW_SHAFT, count); break; } - case 5: - { + case 5: { qs.giveItems(BLOODY_ORCHID_HEAD, count); break; } - case 6: - { + case 6: { qs.giveItems(SOUL_SEPARATOR_HEAD, count); break; } - case 7: - { + case 7: { qs.giveItems(DRAGON_GRINDER_EDGE, count); break; } - case 8: - { + case 8: { qs.giveItems(BLOOD_TORNADO_EDGE, count); break; } - case 9: - { + case 9: { qs.giveItems(TALLUM_GLAIVE_EDGE, count); break; } - case 10: - { + case 10: { qs.giveItems(HALBARD_EDGE, count); break; } - case 11: - { + case 11: { qs.giveItems(DASPARIONS_STAFF_HEAD, count); break; } - case 12: - { + case 12: { qs.giveItems(WORLDTREES_BRANCH_HEAD, count); break; } - case 13: - { + case 13: { qs.giveItems(DARK_LEGIONS_EDGE_EDGE, count); break; } - case 14: - { + case 14: { qs.giveItems(SWORD_OF_MIRACLE_EDGE, count); break; } - case 15: - { + case 15: { qs.giveItems(ELEMENTAL_SWORD_EDGE, count); break; } - case 16: - { + case 16: { qs.giveItems(TALLUM_BLADE_EDGE, count); break; } - case 17: - { + case 17: { qs.giveItems(INFERNO_MASTER_BLADE, count); break; } - case 18: - { + case 18: { qs.giveItems(EYE_OF_SOUL_PIECE, count); break; } - case 19: - { + case 19: { qs.giveItems(DRAGON_FLAME_HEAD_PIECE, count); break; } - case 20: - { + case 20: { qs.giveItems(DOOM_CRUSHER_HEAD, count); break; } - case 21: - { + case 21: { qs.giveItems(HAMMER_OF_DESTROYER_PIECE, count); break; } - case 22: - { + case 22: { qs.giveItems(SIRR_BLADE_BLADE, count); break; } - case 23: - { + case 23: { qs.giveItems(SWORD_OF_IPOS_BLADE, count); break; } - case 24: - { + case 24: { qs.giveItems(BARAKIEL_AXE_PIECE, count); break; } - case 25: - { + case 25: { qs.giveItems(TUNING_FORK_OF_BEHEMOTH_PIECE, count); break; } - case 26: - { + case 26: { qs.giveItems(NAGA_STORM_PIECE, count); break; } - case 27: - { + case 27: { qs.giveItems(TIPHON_SPEAR_EDGE, count); break; } - case 28: - { + case 28: { qs.giveItems(SHYID_BOW_SHAFT, count); break; } - case 29: - { + case 29: { qs.giveItems(SOBEKK_HURRICANE_EDGE, count); break; } - case 30: - { + case 30: { qs.giveItems(TONGUE_OF_THEMIS_PIECE, count); break; } - case 31: - { + case 31: { qs.giveItems(HAND_OF_CABRIO_HEAD, count); break; } - case 32: - { + case 32: { qs.giveItems(CRYSTAL_OF_DEAMON_PIECE, count); break; } @@ -496,8 +413,7 @@ public final class Q00386_StolenDignity extends Quest /** * @param qs */ - private void createBingoBoard(QuestState qs) - { + private void createBingoBoard(QuestState qs) { //@formatter:off Integer[] arr = {1,2,3,4,5,6,7,8,9}; //@formatter:on @@ -510,43 +426,34 @@ public final class Q00386_StolenDignity extends Quest * @param qs * @return */ - private int getMatchedBingoLineCount(QuestState qs) - { + private int getMatchedBingoLineCount(QuestState qs) { String[] q = qs.get("selected").split(" "); int found = 0; // Horizontal - if ((q[0] + q[1] + q[2]).matches("\\d+")) - { + if ((q[0] + q[1] + q[2]).matches("\\d+")) { found++; } - if ((q[3] + q[4] + q[5]).matches("\\d+")) - { + if ((q[3] + q[4] + q[5]).matches("\\d+")) { found++; } - if ((q[6] + q[7] + q[8]).matches("\\d+")) - { + if ((q[6] + q[7] + q[8]).matches("\\d+")) { found++; } // Vertical - if ((q[0] + q[3] + q[6]).matches("\\d+")) - { + if ((q[0] + q[3] + q[6]).matches("\\d+")) { found++; } - if ((q[1] + q[4] + q[7]).matches("\\d+")) - { + if ((q[1] + q[4] + q[7]).matches("\\d+")) { found++; } - if ((q[2] + q[5] + q[8]).matches("\\d+")) - { + if ((q[2] + q[5] + q[8]).matches("\\d+")) { found++; } // Diagonal - if ((q[0] + q[4] + q[8]).matches("\\d+")) - { + if ((q[0] + q[4] + q[8]).matches("\\d+")) { found++; } - if ((q[2] + q[4] + q[6]).matches("\\d+")) - { + if ((q[2] + q[4] + q[6]).matches("\\d+")) { found++; } return found; @@ -556,30 +463,24 @@ public final class Q00386_StolenDignity extends Quest * @param qs * @param num */ - private void selectBingoNumber(QuestState qs, int num) - { + private void selectBingoNumber(QuestState qs, int num) { String[] numbers = qs.get("numbers").split(" "); int pos = 0; - for (int i = 0; i < numbers.length; i++) - { - if (Integer.parseInt(numbers[i]) == num) - { + for (int i = 0; i < numbers.length; i++) { + if (Integer.parseInt(numbers[i]) == num) { pos = i; break; } } String[] selected = qs.get("selected").split(" "); - for (int i = 0; i < selected.length; i++) - { - if (i == pos) - { + for (int i = 0; i < selected.length; i++) { + if (i == pos) { selected[i] = num + ""; continue; } } String result = selected[0]; - for (int i = 1; i < selected.length; i++) - { + for (int i = 1; i < selected.length; i++) { result += " " + selected[i]; } qs.set("selected", result); @@ -590,8 +491,7 @@ public final class Q00386_StolenDignity extends Quest * @param num * @return */ - private boolean isSelectedBingoNumber(QuestState qs, int num) - { + private boolean isSelectedBingoNumber(QuestState qs, int num) { return qs.get("selected").contains(num + ""); } @@ -600,8 +500,7 @@ public final class Q00386_StolenDignity extends Quest * @param num * @return */ - private int getNumberFromBingoBoard(QuestState qs, int num) - { + private int getNumberFromBingoBoard(QuestState qs, int num) { return Integer.parseInt(qs.get("numbers").split(" ")[num]); } @@ -609,210 +508,158 @@ public final class Q00386_StolenDignity extends Quest * @param qs * @return */ - private int getBingoSelectCount(QuestState qs) - { + private int getBingoSelectCount(QuestState qs) { String current = qs.get("selected"); return current.replaceAll("\\D", "").length(); } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPlayerFromParty(killer, npc); - if (qs != null) - { - switch (npc.getId()) - { - case CRIMSON_DRAKE: - { - if (getRandom(1000) < 20.200001) - { + if (qs != null) { + switch (npc.getId()) { + case CRIMSON_DRAKE: { + if (getRandom(1000) < 20.200001) { giveItemRandomly(qs.getPlayer(), npc, Q_STOLEN_INF_ORE, 1, 0, 1, true); } break; } - case KADIOS: - { - if (getRandom(1000) < 211) - { + case KADIOS: { + if (getRandom(1000) < 211) { giveItemRandomly(qs.getPlayer(), npc, Q_STOLEN_INF_ORE, 1, 0, 1, true); } break; } - case HUNGRY_CORPSE: - { - if (getRandom(1000) < 184) - { + case HUNGRY_CORPSE: { + if (getRandom(1000) < 184) { giveItemRandomly(qs.getPlayer(), npc, Q_STOLEN_INF_ORE, 1, 0, 1, true); } break; } - case PAST_KNIGHT: - { - if (getRandom(1000) < 216) - { + case PAST_KNIGHT: { + if (getRandom(1000) < 216) { giveItemRandomly(qs.getPlayer(), npc, Q_STOLEN_INF_ORE, 1, 0, 1, true); } break; } - case BLADE_DEATH: - { - if (getRandom(100) < 17) - { + case BLADE_DEATH: { + if (getRandom(100) < 17) { giveItemRandomly(qs.getPlayer(), npc, Q_STOLEN_INF_ORE, 1, 0, 1, true); } break; } - case DARK_GUARD: - { - if (getRandom(1000) < 273) - { + case DARK_GUARD: { + if (getRandom(1000) < 273) { giveItemRandomly(qs.getPlayer(), npc, Q_STOLEN_INF_ORE, 1, 0, 1, true); } break; } - case BLOODY_GHOST: - { - if (getRandom(1000) < 149) - { + case BLOODY_GHOST: { + if (getRandom(1000) < 149) { giveItemRandomly(qs.getPlayer(), npc, Q_STOLEN_INF_ORE, 1, 0, 1, true); } break; } - case BLOODY_LORD: - { - if (getRandom(1000) < 199) - { + case BLOODY_LORD: { + if (getRandom(1000) < 199) { giveItemRandomly(qs.getPlayer(), npc, Q_STOLEN_INF_ORE, 1, 0, 1, true); } break; } - case PAST_CREATURE: - { - if (getRandom(1000) < 257) - { + case PAST_CREATURE: { + if (getRandom(1000) < 257) { giveItemRandomly(qs.getPlayer(), npc, Q_STOLEN_INF_ORE, 1, 0, 1, true); } break; } - case GIANT_SHADOW: - { - if (getRandom(1000) < 205) - { + case GIANT_SHADOW: { + if (getRandom(1000) < 205) { giveItemRandomly(qs.getPlayer(), npc, Q_STOLEN_INF_ORE, 1, 0, 1, true); } break; } - case ANCIENTS_SOLDIER: - { - if (getRandom(1000) < 208) - { + case ANCIENTS_SOLDIER: { + if (getRandom(1000) < 208) { giveItemRandomly(qs.getPlayer(), npc, Q_STOLEN_INF_ORE, 1, 0, 1, true); } break; } - case ANCIENTS_WARRIOR: - { - if (getRandom(1000) < 299) - { + case ANCIENTS_WARRIOR: { + if (getRandom(1000) < 299) { giveItemRandomly(qs.getPlayer(), npc, Q_STOLEN_INF_ORE, 1, 0, 1, true); } break; } - case SPITE_SOUL_LEADER: - { - if (getRandom(100) < 44) - { + case SPITE_SOUL_LEADER: { + if (getRandom(100) < 44) { giveItemRandomly(qs.getPlayer(), npc, Q_STOLEN_INF_ORE, 1, 0, 1, true); } break; } - case SPITE_SOUL_WIZARD: - { - if (getRandom(100) < 39) - { + case SPITE_SOUL_WIZARD: { + if (getRandom(100) < 39) { giveItemRandomly(qs.getPlayer(), npc, Q_STOLEN_INF_ORE, 1, 0, 1, true); } break; } - case WRECKED_ARCHER: - { - if (getRandom(1000) < 214) - { + case WRECKED_ARCHER: { + if (getRandom(1000) < 214) { giveItemRandomly(qs.getPlayer(), npc, Q_STOLEN_INF_ORE, 1, 0, 1, true); } break; } - case FLOAT_OF_GRAVE: - { - if (getRandom(1000) < 173) - { + case FLOAT_OF_GRAVE: { + if (getRandom(1000) < 173) { giveItemRandomly(qs.getPlayer(), npc, Q_STOLEN_INF_ORE, 1, 0, 1, true); } break; } - case GRAVE_PREDATOR: - { - if (getRandom(1000) < 211) - { + case GRAVE_PREDATOR: { + if (getRandom(1000) < 211) { giveItemRandomly(qs.getPlayer(), npc, Q_STOLEN_INF_ORE, 1, 0, 1, true); } break; } - case FALLEN_ORC_SHAMAN: - { - if (getRandom(1000) < 478) - { + case FALLEN_ORC_SHAMAN: { + if (getRandom(1000) < 478) { giveItemRandomly(qs.getPlayer(), npc, Q_STOLEN_INF_ORE, 1, 0, 1, true); } break; } - case SHARP_TALON_TIGER: - { - if (getRandom(1000) < 234) - { + case SHARP_TALON_TIGER: { + if (getRandom(1000) < 234) { giveItemRandomly(qs.getPlayer(), npc, Q_STOLEN_INF_ORE, 1, 0, 1, true); } break; } - case GLOW_WISP: - { - if (getRandom(1000) < 245) - { + case GLOW_WISP: { + if (getRandom(1000) < 245) { giveItemRandomly(qs.getPlayer(), npc, Q_STOLEN_INF_ORE, 1, 0, 1, true); } break; } - case MARSH_PREDATOR: - { - if (getRandom(100) < 26) - { + case MARSH_PREDATOR: { + if (getRandom(100) < 26) { giveItemRandomly(qs.getPlayer(), npc, Q_STOLEN_INF_ORE, 1, 0, 1, true); } break; } - case HAMES_ORC_SNIPER: - { - if (getRandom(100) < 37) - { + case HAMES_ORC_SNIPER: { + if (getRandom(100) < 37) { giveItemRandomly(qs.getPlayer(), npc, Q_STOLEN_INF_ORE, 1, 0, 1, true); } break; } - case CURSED_GUARDIAN: - { - if (getRandom(1000) < 352) - { + case CURSED_GUARDIAN: { + if (getRandom(1000) < 352) { giveItemRandomly(qs.getPlayer(), npc, Q_STOLEN_INF_ORE, 1, 0, 1, true); } break; } case HAMES_ORC_CHIEFTAIN: case FALLEN_ORC_SHAMAN_TRANS: - case SHARP_TALON_TIGER_TRANS: - { - if (getRandom(1000) < 487) - { + case SHARP_TALON_TIGER_TRANS: { + if (getRandom(1000) < 487) { giveItemRandomly(qs.getPlayer(), npc, Q_STOLEN_INF_ORE, 1, 0, 1, true); } break; @@ -823,25 +670,20 @@ public final class Q00386_StolenDignity extends Quest return super.onKill(npc, killer, isSummon); } - private QuestState getRandomPlayerFromParty(L2PcInstance player, L2Npc npc) - { + private QuestState getRandomPlayerFromParty(L2PcInstance player, L2Npc npc) { QuestState qs = getQuestState(player, false); final List<QuestState> candidates = new ArrayList<>(); - if ((qs != null) && qs.isStarted()) - { + if ((qs != null) && qs.isStarted()) { candidates.add(qs); candidates.add(qs); } - if (player.isInParty()) - { - player.getParty().getMembers().stream().forEach(pm -> - { + if (player.isInParty()) { + player.getParty().getMembers().stream().forEach(pm -> { QuestState qss = getQuestState(pm, false); - if ((qss != null) && qss.isStarted() && Util.checkIfInRange(1500, npc, pm, true)) - { + if ((qss != null) && qss.isStarted() && Util.checkIfInRange(1500, npc, pm, true)) { candidates.add(qss); } }); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00401_PathOfTheWarrior/Q00401_PathOfTheWarrior.java b/src/main/java/com/l2jserver/datapack/quests/Q00401_PathOfTheWarrior/Q00401_PathOfTheWarrior.java index 5999e4e09a..1e76de85f9 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00401_PathOfTheWarrior/Q00401_PathOfTheWarrior.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00401_PathOfTheWarrior/Q00401_PathOfTheWarrior.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.util.Util; * Path Of The Warrior (401) * @author ivantotov */ -public final class Q00401_PathOfTheWarrior extends Quest -{ +public final class Q00401_PathOfTheWarrior extends Quest { // NPCs private static final int MASTER_AURON = 30010; private static final int TRADER_SIMPLON = 30253; @@ -55,8 +54,7 @@ public final class Q00401_PathOfTheWarrior extends Quest // Misc private static final int MIN_LEVEL = 18; - public Q00401_PathOfTheWarrior() - { + public Q00401_PathOfTheWarrior() { super(401, Q00401_PathOfTheWarrior.class.getSimpleName(), "Path Of The Warrior"); addStartNpc(MASTER_AURON); addTalkId(MASTER_AURON, TRADER_SIMPLON); @@ -66,67 +64,47 @@ public final class Q00401_PathOfTheWarrior extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (player.getClassId() == ClassId.fighter) - { - if (player.getLevel() >= MIN_LEVEL) - { - if (hasQuestItems(player, MEDALLION_OF_WARRIOR)) - { + switch (event) { + case "ACCEPT": { + if (player.getClassId() == ClassId.fighter) { + if (player.getLevel() >= MIN_LEVEL) { + if (hasQuestItems(player, MEDALLION_OF_WARRIOR)) { htmltext = "30010-04.htm"; - } - else - { + } else { htmltext = "30010-05.htm"; } - } - else - { + } else { htmltext = "30010-02.htm"; } - } - else if (player.getClassId() == ClassId.warrior) - { + } else if (player.getClassId() == ClassId.warrior) { htmltext = "30010-02a.htm"; - } - else - { + } else { htmltext = "30010-03.htm"; } break; } - case "30010-06.htm": - { - if (!hasQuestItems(player, AURONS_LETTER)) - { + case "30010-06.htm": { + if (!hasQuestItems(player, AURONS_LETTER)) { qs.startQuest(); giveItems(player, AURONS_LETTER, 1); htmltext = event; } break; } - case "30010-10.html": - { + case "30010-10.html": { htmltext = event; break; } - case "30010-11.html": - { - if (hasQuestItems(player, SIMPLONS_LETTER, RUSTED_BRONZE_SWORD2)) - { + case "30010-11.html": { + if (hasQuestItems(player, SIMPLONS_LETTER, RUSTED_BRONZE_SWORD2)) { takeItems(player, RUSTED_BRONZE_SWORD2, 1); giveItems(player, RUSTED_BRONZE_SWORD3, 1); takeItems(player, SIMPLONS_LETTER, 1); @@ -135,10 +113,8 @@ public final class Q00401_PathOfTheWarrior extends Quest } break; } - case "30253-02.html": - { - if (hasQuestItems(player, AURONS_LETTER)) - { + case "30253-02.html": { + if (hasQuestItems(player, AURONS_LETTER)) { takeItems(player, AURONS_LETTER, 1); giveItems(player, WARRIOR_GUILD_MARK, 1); qs.setCond(2, true); @@ -151,34 +127,23 @@ public final class Q00401_PathOfTheWarrior extends Quest } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { final QuestState qs = getQuestState(attacker, false); - if ((qs != null) && qs.isStarted()) - { - switch (npc.getScriptValue()) - { - case 0: - { + if ((qs != null) && qs.isStarted()) { + switch (npc.getScriptValue()) { + case 0: { npc.getVariables().set("lastAttacker", attacker.getObjectId()); - if (!checkWeapon(attacker)) - { + if (!checkWeapon(attacker)) { npc.setScriptValue(2); - } - else - { + } else { npc.setScriptValue(1); } break; } - case 1: - { - if (!checkWeapon(attacker)) - { + case 1: { + if (!checkWeapon(attacker)) { npc.setScriptValue(2); - } - else if (npc.getVariables().getInt("lastAttacker") != attacker.getObjectId()) - { + } else if (npc.getVariables().getInt("lastAttacker") != attacker.getObjectId()) { npc.setScriptValue(2); } break; @@ -189,27 +154,18 @@ public final class Q00401_PathOfTheWarrior extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { case TRACKER_SKELETON: - case TRACKER_SKELETON_LIDER: - { - if (hasQuestItems(killer, WARRIOR_GUILD_MARK) && (getQuestItemsCount(killer, RUSTED_BRONZE_SWORD1) < 10)) - { - if (getRandom(10) < 4) - { + case TRACKER_SKELETON_LIDER: { + if (hasQuestItems(killer, WARRIOR_GUILD_MARK) && (getQuestItemsCount(killer, RUSTED_BRONZE_SWORD1) < 10)) { + if (getRandom(10) < 4) { giveItems(killer, RUSTED_BRONZE_SWORD1, 1); - if (getQuestItemsCount(killer, RUSTED_BRONZE_SWORD1) == 10) - { + if (getQuestItemsCount(killer, RUSTED_BRONZE_SWORD1) == 10) { qs.setCond(3, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -217,17 +173,12 @@ public final class Q00401_PathOfTheWarrior extends Quest break; } case VENOMOUS_SPIDERS: - case ARACHNID_TRACKER: - { - if ((getQuestItemsCount(killer, VENOMOUS_SPIDERS_LEG) < 20) && npc.isScriptValue(1)) - { + case ARACHNID_TRACKER: { + if ((getQuestItemsCount(killer, VENOMOUS_SPIDERS_LEG) < 20) && npc.isScriptValue(1)) { giveItems(killer, VENOMOUS_SPIDERS_LEG, 1); - if (getQuestItemsCount(killer, VENOMOUS_SPIDERS_LEG) == 20) - { + if (getQuestItemsCount(killer, VENOMOUS_SPIDERS_LEG) == 20) { qs.setCond(6, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -239,56 +190,34 @@ public final class Q00401_PathOfTheWarrior extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated() || qs.isCompleted()) - { - if (npc.getId() == MASTER_AURON) - { + if (qs.isCreated() || qs.isCompleted()) { + if (npc.getId() == MASTER_AURON) { htmltext = "30010-01.htm"; } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case MASTER_AURON: - { - if (hasQuestItems(player, AURONS_LETTER)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case MASTER_AURON: { + if (hasQuestItems(player, AURONS_LETTER)) { htmltext = "30010-07.html"; - } - else if (hasQuestItems(player, WARRIOR_GUILD_MARK)) - { + } else if (hasQuestItems(player, WARRIOR_GUILD_MARK)) { htmltext = "30010-08.html"; - } - else if (hasQuestItems(player, SIMPLONS_LETTER, RUSTED_BRONZE_SWORD2) && !hasAtLeastOneQuestItem(player, WARRIOR_GUILD_MARK, AURONS_LETTER)) - { + } else if (hasQuestItems(player, SIMPLONS_LETTER, RUSTED_BRONZE_SWORD2) && !hasAtLeastOneQuestItem(player, WARRIOR_GUILD_MARK, AURONS_LETTER)) { htmltext = "30010-09.html"; - } - else if (hasQuestItems(player, RUSTED_BRONZE_SWORD3) && !hasAtLeastOneQuestItem(player, WARRIOR_GUILD_MARK, AURONS_LETTER)) - { - if (getQuestItemsCount(player, VENOMOUS_SPIDERS_LEG) < 20) - { + } else if (hasQuestItems(player, RUSTED_BRONZE_SWORD3) && !hasAtLeastOneQuestItem(player, WARRIOR_GUILD_MARK, AURONS_LETTER)) { + if (getQuestItemsCount(player, VENOMOUS_SPIDERS_LEG) < 20) { htmltext = "30010-12.html"; - } - else - { + } else { giveAdena(player, 163800, true); giveItems(player, MEDALLION_OF_WARRIOR, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 320534, 21012); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 456128, 27710); - } - else - { + } else { addExpAndSp(player, 160267, 34408); } qs.exitQuest(false, true); @@ -299,24 +228,15 @@ public final class Q00401_PathOfTheWarrior extends Quest } break; } - case TRADER_SIMPLON: - { - if (hasQuestItems(player, AURONS_LETTER)) - { + case TRADER_SIMPLON: { + if (hasQuestItems(player, AURONS_LETTER)) { htmltext = "30253-01.html"; - } - else if (hasQuestItems(player, WARRIOR_GUILD_MARK)) - { - if (!hasQuestItems(player, RUSTED_BRONZE_SWORD1)) - { + } else if (hasQuestItems(player, WARRIOR_GUILD_MARK)) { + if (!hasQuestItems(player, RUSTED_BRONZE_SWORD1)) { htmltext = "30253-03.html"; - } - else if (getQuestItemsCount(player, RUSTED_BRONZE_SWORD1) < 10) - { + } else if (getQuestItemsCount(player, RUSTED_BRONZE_SWORD1) < 10) { htmltext = "30253-04.html"; - } - else - { + } else { takeItems(player, WARRIOR_GUILD_MARK, 1); takeItems(player, RUSTED_BRONZE_SWORD1, -1); giveItems(player, RUSTED_BRONZE_SWORD2, 1); @@ -324,9 +244,7 @@ public final class Q00401_PathOfTheWarrior extends Quest qs.setCond(4, true); htmltext = "30253-05.html"; } - } - else if (hasQuestItems(player, SIMPLONS_LETTER)) - { + } else if (hasQuestItems(player, SIMPLONS_LETTER)) { htmltext = "30253-06.html"; } break; @@ -336,8 +254,7 @@ public final class Q00401_PathOfTheWarrior extends Quest return htmltext; } - private static boolean checkWeapon(L2PcInstance player) - { + private static boolean checkWeapon(L2PcInstance player) { L2ItemInstance weapon = player.getActiveWeaponInstance(); return ((weapon != null) && ((weapon.getId() == RUSTED_BRONZE_SWORD3))); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00402_PathOfTheHumanKnight/Q00402_PathOfTheHumanKnight.java b/src/main/java/com/l2jserver/datapack/quests/Q00402_PathOfTheHumanKnight/Q00402_PathOfTheHumanKnight.java index 365783731f..7765195f4a 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00402_PathOfTheHumanKnight/Q00402_PathOfTheHumanKnight.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00402_PathOfTheHumanKnight/Q00402_PathOfTheHumanKnight.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Path Of The Human Knight (402) * @author ivantotov */ -public final class Q00402_PathOfTheHumanKnight extends Quest -{ +public final class Q00402_PathOfTheHumanKnight extends Quest { // NPCs private static final int HIGH_PRIEST_BIOTIN = 30031; private static final int LEVIAN = 30037; @@ -81,8 +80,7 @@ public final class Q00402_PathOfTheHumanKnight extends Quest // Misc private static final int MIN_LEVEL = 18; - public Q00402_PathOfTheHumanKnight() - { + public Q00402_PathOfTheHumanKnight() { super(402, Q00402_PathOfTheHumanKnight.class.getSimpleName(), "Path Of The Human Knight"); addStartNpc(SIR_KLAUS_VASPER); addTalkId(SIR_KLAUS_VASPER, HIGH_PRIEST_BIOTIN, LEVIAN, HIGH_PRIEST_RAYMOND, CAPTAIN_GILBERT, CAPTAIN_BATHIS, CAPTAIN_BEZIQUE, SIR_ARON_TANFORD); @@ -91,51 +89,35 @@ public final class Q00402_PathOfTheHumanKnight extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; final long CoinCount = getQuestItemsCount(player, COIN_OF_LORDS1, COIN_OF_LORDS2, COIN_OF_LORDS3, COIN_OF_LORDS4, COIN_OF_LORDS5, COIN_OF_LORDS6); - switch (event) - { - case "ACCEPT": - { - if (player.getClassId() == ClassId.fighter) - { - if (player.getLevel() >= MIN_LEVEL) - { - if (hasQuestItems(player, SWORD_OF_RITUAL)) - { + switch (event) { + case "ACCEPT": { + if (player.getClassId() == ClassId.fighter) { + if (player.getLevel() >= MIN_LEVEL) { + if (hasQuestItems(player, SWORD_OF_RITUAL)) { htmltext = "30417-04.htm"; - } - else - { + } else { htmltext = "30417-05.htm"; } - } - else - { + } else { htmltext = "30417-02.htm"; } - } - else if (player.getClassId() == ClassId.knight) - { + } else if (player.getClassId() == ClassId.knight) { htmltext = "30417-02a.htm"; - } - else - { + } else { htmltext = "30417-03.htm"; } break; } - case "30417-08.htm": - { + case "30417-08.htm": { qs.startQuest(); giveItems(player, SQUIRES_MARK, 1); htmltext = event; @@ -144,29 +126,21 @@ public final class Q00402_PathOfTheHumanKnight extends Quest case "30289-02.html": case "30417-06.html": case "30417-07.htm": - case "30417-15.html": - { + case "30417-15.html": { htmltext = event; break; } - case "30417-13.html": - { - if (hasQuestItems(player, SQUIRES_MARK) && ((CoinCount) == 3)) - { + case "30417-13.html": { + if (hasQuestItems(player, SQUIRES_MARK) && ((CoinCount) == 3)) { giveAdena(player, 81900, true); giveItems(player, SWORD_OF_RITUAL, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 160267, 11576); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 228064, 14925); - } - else - { + } else { addExpAndSp(player, 295862, 18274); } qs.exitQuest(false, true); @@ -176,24 +150,17 @@ public final class Q00402_PathOfTheHumanKnight extends Quest } break; } - case "30417-14.html": - { - if (hasQuestItems(player, SQUIRES_MARK) && ((CoinCount) > 3) && ((CoinCount) < 6)) - { + case "30417-14.html": { + if (hasQuestItems(player, SQUIRES_MARK) && ((CoinCount) > 3) && ((CoinCount) < 6)) { giveAdena(player, 81900, true); giveItems(player, SWORD_OF_RITUAL, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 160267, 11576); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 228064, 14925); - } - else - { + } else { addExpAndSp(player, 295862, 18274); } qs.exitQuest(false, true); @@ -203,38 +170,32 @@ public final class Q00402_PathOfTheHumanKnight extends Quest } break; } - case "30031-02.html": - { + case "30031-02.html": { giveItems(player, EINHASADS_3RD_TEMPLE_BADGE, 1); htmltext = event; break; } - case "30037-02.html": - { + case "30037-02.html": { giveItems(player, EINHASADS_2ND_TEMPLE_BADGE, 1); htmltext = event; break; } - case "30289-03.html": - { + case "30289-03.html": { giveItems(player, EINHASADS_1ST_TEMPLE_BADGE, 1); htmltext = event; break; } - case "30039-02.html": - { + case "30039-02.html": { giveItems(player, GLUDIO_GUARDS_3RD_BADGE, 1); htmltext = event; break; } - case "30379-02.html": - { + case "30379-02.html": { giveItems(player, GLUDIO_GUARDS_2ND_BADGE, 1); htmltext = event; break; } - case "30332-02.html": - { + case "30332-02.html": { giveItems(player, GLUDIO_GUARDS_1ST_BADGE, 1); htmltext = event; break; @@ -244,26 +205,18 @@ public final class Q00402_PathOfTheHumanKnight extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { case LANGK_LIZARDMAN_WARRIOR: case LANGK_LIZARDMAN_SCOUT: - case LANGK_LIZARDMAN: - { - if (hasQuestItems(killer, EINHASADS_2ND_TEMPLE_BADGE) && (getQuestItemsCount(killer, LIZARDMANS_TOTEM) < 20) && (getRandom(10) < 5)) - { + case LANGK_LIZARDMAN: { + if (hasQuestItems(killer, EINHASADS_2ND_TEMPLE_BADGE) && (getQuestItemsCount(killer, LIZARDMANS_TOTEM) < 20) && (getRandom(10) < 5)) { giveItems(killer, LIZARDMANS_TOTEM, 1); - if (getQuestItemsCount(killer, LIZARDMANS_TOTEM) == 20) - { + if (getQuestItemsCount(killer, LIZARDMANS_TOTEM) == 20) { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -271,17 +224,12 @@ public final class Q00402_PathOfTheHumanKnight extends Quest } case VENOMOUS_SPIDER: case ARACHNID_TRACKER: - case ARACHNID_PREDATOR: - { - if (hasQuestItems(killer, GLUDIO_GUARDS_2ND_BADGE) && (getQuestItemsCount(killer, VENOMOUS_SPIDERS_LEG) < 20)) - { + case ARACHNID_PREDATOR: { + if (hasQuestItems(killer, GLUDIO_GUARDS_2ND_BADGE) && (getQuestItemsCount(killer, VENOMOUS_SPIDERS_LEG) < 20)) { giveItems(killer, VENOMOUS_SPIDERS_LEG, 1); - if (getQuestItemsCount(killer, VENOMOUS_SPIDERS_LEG) == 20) - { + if (getQuestItemsCount(killer, VENOMOUS_SPIDERS_LEG) == 20) { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -289,65 +237,45 @@ public final class Q00402_PathOfTheHumanKnight extends Quest } case GIANT_SPIDER: case TALON_SPIDER: - case BLADE_SPIDER: - { - if (hasQuestItems(killer, GLUDIO_GUARDS_3RD_BADGE) && (getQuestItemsCount(killer, GIANT_SPIDERS_HUSK) < 20) && (getRandom(10) < 4)) - { + case BLADE_SPIDER: { + if (hasQuestItems(killer, GLUDIO_GUARDS_3RD_BADGE) && (getQuestItemsCount(killer, GIANT_SPIDERS_HUSK) < 20) && (getRandom(10) < 4)) { giveItems(killer, GIANT_SPIDERS_HUSK, 1); - if (getQuestItemsCount(killer, GIANT_SPIDERS_HUSK) == 20) - { + if (getQuestItemsCount(killer, GIANT_SPIDERS_HUSK) == 20) { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case SILENT_HORROR: - { - if (hasQuestItems(killer, EINHASADS_3RD_TEMPLE_BADGE) && (getQuestItemsCount(killer, SKULL_OF_SILENT_HORROR) < 10) && (getRandom(10) < 4)) - { + case SILENT_HORROR: { + if (hasQuestItems(killer, EINHASADS_3RD_TEMPLE_BADGE) && (getQuestItemsCount(killer, SKULL_OF_SILENT_HORROR) < 10) && (getRandom(10) < 4)) { giveItems(killer, SKULL_OF_SILENT_HORROR, 1); - if (getQuestItemsCount(killer, SKULL_OF_SILENT_HORROR) == 10) - { + if (getQuestItemsCount(killer, SKULL_OF_SILENT_HORROR) == 10) { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case BUGBEAR_RAIDER: - { - if (hasQuestItems(killer, GLUDIO_GUARDS_1ST_BADGE) && (getQuestItemsCount(killer, BUGBEAR_NECKLACE) < 10)) - { + case BUGBEAR_RAIDER: { + if (hasQuestItems(killer, GLUDIO_GUARDS_1ST_BADGE) && (getQuestItemsCount(killer, BUGBEAR_NECKLACE) < 10)) { giveItems(killer, BUGBEAR_NECKLACE, 1); - if (getQuestItemsCount(killer, BUGBEAR_NECKLACE) == 10) - { + if (getQuestItemsCount(killer, BUGBEAR_NECKLACE) == 10) { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case UNDEAD_PRIEST: - { - if (hasQuestItems(killer, EINHASADS_1ST_TEMPLE_BADGE) && (getQuestItemsCount(killer, EINHASAD_CRUCIFIX) < 12) && (getRandom(10) < 5)) - { + case UNDEAD_PRIEST: { + if (hasQuestItems(killer, EINHASADS_1ST_TEMPLE_BADGE) && (getQuestItemsCount(killer, EINHASAD_CRUCIFIX) < 12) && (getRandom(10) < 5)) { giveItems(killer, EINHASAD_CRUCIFIX, 1); - if (getQuestItemsCount(killer, EINHASAD_CRUCIFIX) == 12) - { + if (getQuestItemsCount(killer, EINHASAD_CRUCIFIX) == 12) { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -359,54 +287,34 @@ public final class Q00402_PathOfTheHumanKnight extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated() || qs.isCompleted()) - { - if (npc.getId() == SIR_KLAUS_VASPER) - { + if (qs.isCreated() || qs.isCompleted()) { + if (npc.getId() == SIR_KLAUS_VASPER) { htmltext = "30417-01.htm"; } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case SIR_KLAUS_VASPER: - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case SIR_KLAUS_VASPER: { final long CoinCount = getQuestItemsCount(player, COIN_OF_LORDS1, COIN_OF_LORDS2, COIN_OF_LORDS3, COIN_OF_LORDS4, COIN_OF_LORDS5, COIN_OF_LORDS6); - if (hasQuestItems(player, SQUIRES_MARK)) - { - if ((CoinCount) < 3) - { + if (hasQuestItems(player, SQUIRES_MARK)) { + if ((CoinCount) < 3) { htmltext = "30417-09.html"; - } - else if ((CoinCount) == 3) - { + } else if ((CoinCount) == 3) { htmltext = "30417-10.html"; - } - else if (((CoinCount) > 3) && ((CoinCount) < 6)) - { + } else if (((CoinCount) > 3) && ((CoinCount) < 6)) { htmltext = "30417-11.html"; - } - else - { + } else { giveAdena(player, 163800, true); giveItems(player, SWORD_OF_RITUAL, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 320534, 23152); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 456128, 29850); - } - else - { + } else { addExpAndSp(player, 591724, 36542); } qs.exitQuest(false, true); @@ -417,166 +325,110 @@ public final class Q00402_PathOfTheHumanKnight extends Quest } break; } - case HIGH_PRIEST_BIOTIN: - { - if (hasQuestItems(player, SQUIRES_MARK) && !hasAtLeastOneQuestItem(player, EINHASADS_3RD_TEMPLE_BADGE, COIN_OF_LORDS6)) - { + case HIGH_PRIEST_BIOTIN: { + if (hasQuestItems(player, SQUIRES_MARK) && !hasAtLeastOneQuestItem(player, EINHASADS_3RD_TEMPLE_BADGE, COIN_OF_LORDS6)) { htmltext = "30031-01.html"; - } - else if (hasQuestItems(player, EINHASADS_3RD_TEMPLE_BADGE)) - { - if (getQuestItemsCount(player, SKULL_OF_SILENT_HORROR) < 10) - { + } else if (hasQuestItems(player, EINHASADS_3RD_TEMPLE_BADGE)) { + if (getQuestItemsCount(player, SKULL_OF_SILENT_HORROR) < 10) { htmltext = "30031-03.html"; - } - else - { + } else { giveItems(player, COIN_OF_LORDS6, 1); takeItems(player, EINHASADS_3RD_TEMPLE_BADGE, 1); takeItems(player, SKULL_OF_SILENT_HORROR, -1); htmltext = "30031-04.html"; } - } - else if (hasQuestItems(player, COIN_OF_LORDS6)) - { + } else if (hasQuestItems(player, COIN_OF_LORDS6)) { htmltext = "30031-05.html"; } break; } - case LEVIAN: - { - if (hasQuestItems(player, SQUIRES_MARK) && !hasAtLeastOneQuestItem(player, EINHASADS_2ND_TEMPLE_BADGE, COIN_OF_LORDS4)) - { + case LEVIAN: { + if (hasQuestItems(player, SQUIRES_MARK) && !hasAtLeastOneQuestItem(player, EINHASADS_2ND_TEMPLE_BADGE, COIN_OF_LORDS4)) { htmltext = "30037-01.html"; - } - else if (hasQuestItems(player, EINHASADS_2ND_TEMPLE_BADGE)) - { - if (getQuestItemsCount(player, LIZARDMANS_TOTEM) < 20) - { + } else if (hasQuestItems(player, EINHASADS_2ND_TEMPLE_BADGE)) { + if (getQuestItemsCount(player, LIZARDMANS_TOTEM) < 20) { htmltext = "30037-03.html"; - } - else - { + } else { giveItems(player, COIN_OF_LORDS4, 1); takeItems(player, EINHASADS_2ND_TEMPLE_BADGE, 1); takeItems(player, LIZARDMANS_TOTEM, -1); htmltext = "30037-04.html"; } - } - else if (hasQuestItems(player, COIN_OF_LORDS4)) - { + } else if (hasQuestItems(player, COIN_OF_LORDS4)) { htmltext = "30037-05.html"; } break; } - case HIGH_PRIEST_RAYMOND: - { - if (hasQuestItems(player, SQUIRES_MARK) && !hasAtLeastOneQuestItem(player, EINHASADS_1ST_TEMPLE_BADGE, COIN_OF_LORDS2)) - { + case HIGH_PRIEST_RAYMOND: { + if (hasQuestItems(player, SQUIRES_MARK) && !hasAtLeastOneQuestItem(player, EINHASADS_1ST_TEMPLE_BADGE, COIN_OF_LORDS2)) { htmltext = "30289-01.html"; - } - else if (hasQuestItems(player, EINHASADS_1ST_TEMPLE_BADGE)) - { - if (getQuestItemsCount(player, EINHASAD_CRUCIFIX) < 12) - { + } else if (hasQuestItems(player, EINHASADS_1ST_TEMPLE_BADGE)) { + if (getQuestItemsCount(player, EINHASAD_CRUCIFIX) < 12) { htmltext = "30289-04.html"; - } - else - { + } else { giveItems(player, COIN_OF_LORDS2, 1); takeItems(player, EINHASADS_1ST_TEMPLE_BADGE, 1); takeItems(player, EINHASAD_CRUCIFIX, -1); htmltext = "30289-05.html"; } - } - else if (hasQuestItems(player, COIN_OF_LORDS2)) - { + } else if (hasQuestItems(player, COIN_OF_LORDS2)) { htmltext = "30289-06.html"; } break; } - case CAPTAIN_GILBERT: - { - if (hasQuestItems(player, SQUIRES_MARK) && !hasAtLeastOneQuestItem(player, GLUDIO_GUARDS_3RD_BADGE, COIN_OF_LORDS5)) - { + case CAPTAIN_GILBERT: { + if (hasQuestItems(player, SQUIRES_MARK) && !hasAtLeastOneQuestItem(player, GLUDIO_GUARDS_3RD_BADGE, COIN_OF_LORDS5)) { htmltext = "30039-01.html"; - } - else if (hasQuestItems(player, GLUDIO_GUARDS_3RD_BADGE)) - { - if (getQuestItemsCount(player, GIANT_SPIDERS_HUSK) < 20) - { + } else if (hasQuestItems(player, GLUDIO_GUARDS_3RD_BADGE)) { + if (getQuestItemsCount(player, GIANT_SPIDERS_HUSK) < 20) { htmltext = "30039-03.html"; - } - else - { + } else { giveItems(player, COIN_OF_LORDS5, 1); takeItems(player, GLUDIO_GUARDS_3RD_BADGE, 1); takeItems(player, GIANT_SPIDERS_HUSK, -1); htmltext = "30039-04.html"; } - } - else if (hasQuestItems(player, COIN_OF_LORDS5)) - { + } else if (hasQuestItems(player, COIN_OF_LORDS5)) { htmltext = "30039-05.html"; } break; } - case CAPTAIN_BEZIQUE: - { - if (hasQuestItems(player, SQUIRES_MARK) && !hasAtLeastOneQuestItem(player, GLUDIO_GUARDS_2ND_BADGE, COIN_OF_LORDS3)) - { + case CAPTAIN_BEZIQUE: { + if (hasQuestItems(player, SQUIRES_MARK) && !hasAtLeastOneQuestItem(player, GLUDIO_GUARDS_2ND_BADGE, COIN_OF_LORDS3)) { htmltext = "30379-01.html"; - } - else if (hasQuestItems(player, GLUDIO_GUARDS_2ND_BADGE)) - { - if (getQuestItemsCount(player, VENOMOUS_SPIDERS_LEG) < 20) - { + } else if (hasQuestItems(player, GLUDIO_GUARDS_2ND_BADGE)) { + if (getQuestItemsCount(player, VENOMOUS_SPIDERS_LEG) < 20) { htmltext = "30379-03.html"; - } - else - { + } else { giveItems(player, COIN_OF_LORDS3, 1); takeItems(player, GLUDIO_GUARDS_2ND_BADGE, 1); takeItems(player, VENOMOUS_SPIDERS_LEG, -1); htmltext = "30379-04.html"; } - } - else if (hasQuestItems(player, COIN_OF_LORDS3)) - { + } else if (hasQuestItems(player, COIN_OF_LORDS3)) { htmltext = "30379-05.html"; } break; } - case CAPTAIN_BATHIS: - { - if (hasQuestItems(player, SQUIRES_MARK) && !hasAtLeastOneQuestItem(player, GLUDIO_GUARDS_1ST_BADGE, COIN_OF_LORDS1)) - { + case CAPTAIN_BATHIS: { + if (hasQuestItems(player, SQUIRES_MARK) && !hasAtLeastOneQuestItem(player, GLUDIO_GUARDS_1ST_BADGE, COIN_OF_LORDS1)) { htmltext = "30332-01.html"; - } - else if (hasQuestItems(player, GLUDIO_GUARDS_1ST_BADGE)) - { - if (getQuestItemsCount(player, BUGBEAR_NECKLACE) < 10) - { + } else if (hasQuestItems(player, GLUDIO_GUARDS_1ST_BADGE)) { + if (getQuestItemsCount(player, BUGBEAR_NECKLACE) < 10) { htmltext = "30332-03.html"; - } - else - { + } else { giveItems(player, COIN_OF_LORDS1, 1); takeItems(player, GLUDIO_GUARDS_1ST_BADGE, 1); takeItems(player, BUGBEAR_NECKLACE, -1); htmltext = "30332-04.html"; } - } - else if (hasQuestItems(player, COIN_OF_LORDS1)) - { + } else if (hasQuestItems(player, COIN_OF_LORDS1)) { htmltext = "30332-05.html"; } break; } - case SIR_ARON_TANFORD: - { - if (hasQuestItems(player, SQUIRES_MARK)) - { + case SIR_ARON_TANFORD: { + if (hasQuestItems(player, SQUIRES_MARK)) { htmltext = "30653-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00403_PathOfTheRogue/Q00403_PathOfTheRogue.java b/src/main/java/com/l2jserver/datapack/quests/Q00403_PathOfTheRogue/Q00403_PathOfTheRogue.java index a846fce710..98d0b29b6f 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00403_PathOfTheRogue/Q00403_PathOfTheRogue.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00403_PathOfTheRogue/Q00403_PathOfTheRogue.java @@ -39,8 +39,7 @@ import com.l2jserver.gameserver.util.Util; * Path Of The Rogue (403) * @author ivantotov */ -public final class Q00403_PathOfTheRogue extends Quest -{ +public final class Q00403_PathOfTheRogue extends Quest { // NPCs private static final int CAPTAIN_BEZIQUE = 30379; private static final int NETI = 30425; @@ -55,8 +54,7 @@ public final class Q00403_PathOfTheRogue extends Quest private static final int STOLEN_TOMES = 1187; private static final int STOLEN_RING = 1188; private static final int STOLEN_NECKLACE = 1189; - private static final int[] STOLEN_ITEMS = - { + private static final int[] STOLEN_ITEMS = { STOLEN_JEWELRY, STOLEN_TOMES, STOLEN_RING, @@ -71,8 +69,7 @@ public final class Q00403_PathOfTheRogue extends Quest private static final int CATS_EYE_BANDIT = 27038; // Monster private static final Map<Integer, ItemChanceHolder> MONSTER_DROPS = new HashMap<>(); - static - { + static { MONSTER_DROPS.put(20035, new ItemChanceHolder(SPARTOIS_BONES, 2)); // Tracker Skeleton MONSTER_DROPS.put(20042, new ItemChanceHolder(SPARTOIS_BONES, 3)); // Tracker Skeleton Leader MONSTER_DROPS.put(20045, new ItemChanceHolder(SPARTOIS_BONES, 2)); // Skeleton Scout @@ -81,8 +78,7 @@ public final class Q00403_PathOfTheRogue extends Quest MONSTER_DROPS.put(20060, new ItemChanceHolder(SPARTOIS_BONES, 8)); // Raging Spartoi } - public Q00403_PathOfTheRogue() - { + public Q00403_PathOfTheRogue() { super(403, Q00403_PathOfTheRogue.class.getSimpleName(), "Path Of The Rogue"); addStartNpc(CAPTAIN_BEZIQUE); addTalkId(CAPTAIN_BEZIQUE, NETI); @@ -94,49 +90,33 @@ public final class Q00403_PathOfTheRogue extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (player.getClassId() == ClassId.fighter) - { - if (player.getLevel() >= MIN_LEVEL) - { - if (hasQuestItems(player, BEZIQUES_RECOMMENDATION)) - { + switch (event) { + case "ACCEPT": { + if (player.getClassId() == ClassId.fighter) { + if (player.getLevel() >= MIN_LEVEL) { + if (hasQuestItems(player, BEZIQUES_RECOMMENDATION)) { htmltext = "30379-04.htm"; - } - else - { + } else { htmltext = "30379-05.htm"; } - } - else - { + } else { htmltext = "30379-03.htm"; } - } - else if (player.getClassId() == ClassId.rogue) - { + } else if (player.getClassId() == ClassId.rogue) { htmltext = "30379-02a.htm"; - } - else - { + } else { htmltext = "30379-02.htm"; } break; } - case "30379-06.htm": - { + case "30379-06.htm": { qs.startQuest(); giveItems(player, BEZIQUES_LETTER, 1); htmltext = event; @@ -144,22 +124,17 @@ public final class Q00403_PathOfTheRogue extends Quest } case "30425-02.html": case "30425-03.html": - case "30425-04.html": - { + case "30425-04.html": { htmltext = event; break; } - case "30425-05.html": - { - if (hasQuestItems(player, BEZIQUES_LETTER)) - { + case "30425-05.html": { + if (hasQuestItems(player, BEZIQUES_LETTER)) { takeItems(player, BEZIQUES_LETTER, 1); - if (!hasQuestItems(player, NETIS_BOW)) - { + if (!hasQuestItems(player, NETIS_BOW)) { giveItems(player, NETIS_BOW, 1); } - if (!hasQuestItems(player, NETIS_DAGGER)) - { + if (!hasQuestItems(player, NETIS_DAGGER)) { giveItems(player, NETIS_DAGGER, 1); } qs.setCond(2, true); @@ -172,38 +147,26 @@ public final class Q00403_PathOfTheRogue extends Quest } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { final QuestState qs = getQuestState(attacker, false); - if ((qs != null) && qs.isStarted()) - { - switch (npc.getScriptValue()) - { - case 0: - { + if ((qs != null) && qs.isStarted()) { + switch (npc.getScriptValue()) { + case 0: { npc.getVariables().set("lastAttacker", attacker.getObjectId()); - if (!checkWeapon(attacker)) - { + if (!checkWeapon(attacker)) { npc.setScriptValue(2); - } - else - { - if (npc.getId() == CATS_EYE_BANDIT) - { + } else { + if (npc.getId() == CATS_EYE_BANDIT) { attacker.sendPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.YOU_CHILDISH_FOOL_DO_YOU_THINK_YOU_CAN_CATCH_ME)); } npc.setScriptValue(1); } break; } - case 1: - { - if (!checkWeapon(attacker)) - { + case 1: { + if (!checkWeapon(attacker)) { npc.setScriptValue(2); - } - else if (npc.getVariables().getInt("lastAttacker") != attacker.getObjectId()) - { + } else if (npc.getVariables().getInt("lastAttacker") != attacker.getObjectId()) { npc.setScriptValue(2); } break; @@ -214,44 +177,30 @@ public final class Q00403_PathOfTheRogue extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && npc.isScriptValue(1) && Util.checkIfInRange(1500, npc, killer, true)) - { - if (npc.getId() == CATS_EYE_BANDIT) - { + if ((qs != null) && qs.isStarted() && npc.isScriptValue(1) && Util.checkIfInRange(1500, npc, killer, true)) { + if (npc.getId() == CATS_EYE_BANDIT) { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.I_MUST_DO_SOMETHING_ABOUT_THIS_SHAMEFUL_INCIDENT)); - if (hasQuestItems(killer, MOST_WANTED_LIST)) - { + if (hasQuestItems(killer, MOST_WANTED_LIST)) { int randomItem = STOLEN_ITEMS[getRandom(STOLEN_ITEMS.length)]; - if (!hasQuestItems(killer, randomItem)) - { + if (!hasQuestItems(killer, randomItem)) { giveItems(killer, randomItem, 1); - if (hasQuestItems(killer, STOLEN_ITEMS)) - { + if (hasQuestItems(killer, STOLEN_ITEMS)) { qs.setCond(6, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } - } - else - { + } else { final ItemChanceHolder reward = MONSTER_DROPS.get(npc.getId()); - if ((getQuestItemsCount(killer, reward.getId()) < REQUIRED_ITEM_COUNT) && npc.isScriptValue(1) && (getRandom(REQUIRED_ITEM_COUNT) < reward.getChance())) - { + if ((getQuestItemsCount(killer, reward.getId()) < REQUIRED_ITEM_COUNT) && npc.isScriptValue(1) && (getRandom(REQUIRED_ITEM_COUNT) < reward.getChance())) { giveItems(killer, reward.getId(), reward.getCount()); - if (getQuestItemsCount(killer, reward.getId()) >= REQUIRED_ITEM_COUNT) - { + if (getQuestItemsCount(killer, reward.getId()) >= REQUIRED_ITEM_COUNT) { qs.setCond(3, true); - } - else - { + } else { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -260,32 +209,23 @@ public final class Q00403_PathOfTheRogue extends Quest return super.onKill(npc, killer, isSummon); } - private boolean checkWeapon(L2PcInstance player) - { + private boolean checkWeapon(L2PcInstance player) { L2ItemInstance weapon = player.getActiveWeaponInstance(); return ((weapon != null) && ((weapon.getId() == NETIS_BOW) || (weapon.getId() == NETIS_DAGGER))); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated() || qs.isCompleted()) - { - if (npc.getId() == CAPTAIN_BEZIQUE) - { + if (qs.isCreated() || qs.isCompleted()) { + if (npc.getId() == CAPTAIN_BEZIQUE) { htmltext = "30379-01.htm"; } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case CAPTAIN_BEZIQUE: - { - if (hasQuestItems(player, STOLEN_JEWELRY, STOLEN_TOMES, STOLEN_RING, STOLEN_NECKLACE)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case CAPTAIN_BEZIQUE: { + if (hasQuestItems(player, STOLEN_JEWELRY, STOLEN_TOMES, STOLEN_RING, STOLEN_NECKLACE)) { giveAdena(player, 163800, true); takeItems(player, NETIS_BOW, 1); takeItems(player, NETIS_DAGGER, 1); @@ -296,70 +236,46 @@ public final class Q00403_PathOfTheRogue extends Quest takeItems(player, STOLEN_NECKLACE, 1); giveItems(player, BEZIQUES_RECOMMENDATION, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 320534, 20232); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 456128, 26930); - } - else - { + } else { addExpAndSp(player, 591724, 33628); } qs.exitQuest(false, true); player.sendPacket(new SocialAction(player.getObjectId(), 3)); qs.saveGlobalQuestVar("1ClassQuestFinished", "1"); htmltext = "30379-09.html"; - } - else if (!hasQuestItems(player, HORSESHOE_OF_LIGHT) && hasQuestItems(player, BEZIQUES_LETTER)) - { + } else if (!hasQuestItems(player, HORSESHOE_OF_LIGHT) && hasQuestItems(player, BEZIQUES_LETTER)) { htmltext = "30379-07.html"; - } - else if (hasQuestItems(player, HORSESHOE_OF_LIGHT)) - { + } else if (hasQuestItems(player, HORSESHOE_OF_LIGHT)) { takeItems(player, HORSESHOE_OF_LIGHT, 1); giveItems(player, MOST_WANTED_LIST, 1); qs.setCond(5, true); htmltext = "30379-08.html"; - } - else if (hasQuestItems(player, NETIS_BOW, NETIS_DAGGER) && !hasQuestItems(player, MOST_WANTED_LIST)) - { + } else if (hasQuestItems(player, NETIS_BOW, NETIS_DAGGER) && !hasQuestItems(player, MOST_WANTED_LIST)) { htmltext = "30379-10.html"; - } - else if (hasQuestItems(player, MOST_WANTED_LIST)) - { + } else if (hasQuestItems(player, MOST_WANTED_LIST)) { htmltext = "30379-11.html"; } break; } - case NETI: - { - if (hasQuestItems(player, BEZIQUES_LETTER)) - { + case NETI: { + if (hasQuestItems(player, BEZIQUES_LETTER)) { htmltext = "30425-01.html"; - } - else if (!hasAtLeastOneQuestItem(player, HORSESHOE_OF_LIGHT, BEZIQUES_LETTER)) - { - if (hasQuestItems(player, MOST_WANTED_LIST)) - { + } else if (!hasAtLeastOneQuestItem(player, HORSESHOE_OF_LIGHT, BEZIQUES_LETTER)) { + if (hasQuestItems(player, MOST_WANTED_LIST)) { htmltext = "30425-08.html"; - } - else if (getQuestItemsCount(player, SPARTOIS_BONES) < REQUIRED_ITEM_COUNT) - { + } else if (getQuestItemsCount(player, SPARTOIS_BONES) < REQUIRED_ITEM_COUNT) { htmltext = "30425-06.html"; - } - else - { + } else { takeItems(player, SPARTOIS_BONES, REQUIRED_ITEM_COUNT); giveItems(player, HORSESHOE_OF_LIGHT, 1); qs.setCond(4, true); htmltext = "30425-07.html"; } - } - else if (hasQuestItems(player, HORSESHOE_OF_LIGHT)) - { + } else if (hasQuestItems(player, HORSESHOE_OF_LIGHT)) { htmltext = "30425-08.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00404_PathOfTheHumanWizard/Q00404_PathOfTheHumanWizard.java b/src/main/java/com/l2jserver/datapack/quests/Q00404_PathOfTheHumanWizard/Q00404_PathOfTheHumanWizard.java index 2726cc449b..7bcc814672 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00404_PathOfTheHumanWizard/Q00404_PathOfTheHumanWizard.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00404_PathOfTheHumanWizard/Q00404_PathOfTheHumanWizard.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Path Of The Human Wizard (404) * @author ivantotov */ -public final class Q00404_PathOfTheHumanWizard extends Quest -{ +public final class Q00404_PathOfTheHumanWizard extends Quest { // NPCs private static final int PARINA = 30391; private static final int EARTH_SNAKE = 30409; @@ -63,8 +62,7 @@ public final class Q00404_PathOfTheHumanWizard extends Quest // Misc private static final int MIN_LEVEL = 18; - public Q00404_PathOfTheHumanWizard() - { + public Q00404_PathOfTheHumanWizard() { super(404, Q00404_PathOfTheHumanWizard.class.getSimpleName(), "Path Of The Human Wizard"); addStartNpc(PARINA); addTalkId(PARINA, EARTH_SNAKE, WASTELAND_LIZARDMAN, FLAME_SALAMANDER, WIND_SYLPH, WATER_UNDINE); @@ -73,55 +71,38 @@ public final class Q00404_PathOfTheHumanWizard extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (player.getClassId() == ClassId.mage) - { - if (player.getLevel() >= MIN_LEVEL) - { - if (hasQuestItems(player, BEAD_OF_SEASON)) - { + switch (event) { + case "ACCEPT": { + if (player.getClassId() == ClassId.mage) { + if (player.getLevel() >= MIN_LEVEL) { + if (hasQuestItems(player, BEAD_OF_SEASON)) { htmltext = "30391-03.htm"; - } - else - { + } else { qs.startQuest(); htmltext = "30391-07.htm"; } - } - else - { + } else { htmltext = "30391-02.htm"; } - } - else if (player.getClassId() == ClassId.wizard) - { + } else if (player.getClassId() == ClassId.wizard) { htmltext = "30391-02a.htm"; - } - else - { + } else { htmltext = "30391-01.htm"; } break; } - case "30410-02.html": - { + case "30410-02.html": { htmltext = event; break; } - case "30410-03.html": - { + case "30410-03.html": { giveItems(player, WIND_FEATHER, 1); qs.setCond(6, true); htmltext = event; @@ -132,42 +113,30 @@ public final class Q00404_PathOfTheHumanWizard extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case RED_BEAR: - { - if (hasQuestItems(killer, RUSTY_COIN) && !hasQuestItems(killer, RED_SOIL) && (getRandom(100) < 20)) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case RED_BEAR: { + if (hasQuestItems(killer, RUSTY_COIN) && !hasQuestItems(killer, RED_SOIL) && (getRandom(100) < 20)) { giveItems(killer, RED_SOIL, 1); qs.setCond(12, true); } break; } - case RATMAN_WARRIOR: - { - if (hasQuestItems(killer, MAP_OF_LUSTER) && !hasQuestItems(killer, KEY_OF_FLAME) && (getRandom(100) < 80)) - { + case RATMAN_WARRIOR: { + if (hasQuestItems(killer, MAP_OF_LUSTER) && !hasQuestItems(killer, KEY_OF_FLAME) && (getRandom(100) < 80)) { giveItems(killer, KEY_OF_FLAME, 1); qs.setCond(3, true); } break; } - case WATER_SEER: - { - if (hasQuestItems(killer, RAMAS_DIARY) && (getQuestItemsCount(killer, SPARKLE_PEBBLE) < 2) && (getRandom(100) < 80)) - { + case WATER_SEER: { + if (hasQuestItems(killer, RAMAS_DIARY) && (getQuestItemsCount(killer, SPARKLE_PEBBLE) < 2) && (getRandom(100) < 80)) { giveItems(killer, SPARKLE_PEBBLE, 1); - if (getQuestItemsCount(killer, SPARKLE_PEBBLE) == 2) - { + if (getQuestItemsCount(killer, SPARKLE_PEBBLE) == 2) { qs.setCond(9, true); - } - else - { + } else { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -179,49 +148,33 @@ public final class Q00404_PathOfTheHumanWizard extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated() || qs.isCompleted()) - { - if (npc.getId() == PARINA) - { + if (qs.isCreated() || qs.isCompleted()) { + if (npc.getId() == PARINA) { htmltext = "30391-04.htm"; } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case PARINA: - { - if (!hasQuestItems(player, FLAME_EARING, WIND_BANGLE, WATER_NECKLACE, EARTH_RING)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case PARINA: { + if (!hasQuestItems(player, FLAME_EARING, WIND_BANGLE, WATER_NECKLACE, EARTH_RING)) { htmltext = "30391-05.html"; - } - else - { + } else { giveAdena(player, 163800, true); takeItems(player, FLAME_EARING, 1); takeItems(player, WIND_BANGLE, 1); takeItems(player, WATER_NECKLACE, 1); takeItems(player, EARTH_RING, 1); - if (!hasQuestItems(player, BEAD_OF_SEASON)) - { + if (!hasQuestItems(player, BEAD_OF_SEASON)) { giveItems(player, BEAD_OF_SEASON, 1); } final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 320534, 23152); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 456128, 29850); - } - else - { + } else { addExpAndSp(player, 591724, 36548); } qs.exitQuest(false, true); @@ -231,157 +184,108 @@ public final class Q00404_PathOfTheHumanWizard extends Quest } break; } - case EARTH_SNAKE: - { - if (hasQuestItems(player, WATER_NECKLACE) && !hasAtLeastOneQuestItem(player, RUSTY_COIN, EARTH_RING)) - { - if (!hasQuestItems(player, RUSTY_COIN)) - { + case EARTH_SNAKE: { + if (hasQuestItems(player, WATER_NECKLACE) && !hasAtLeastOneQuestItem(player, RUSTY_COIN, EARTH_RING)) { + if (!hasQuestItems(player, RUSTY_COIN)) { giveItems(player, RUSTY_COIN, 1); } qs.setCond(11, true); htmltext = "30409-01.html"; - } - else if (hasQuestItems(player, RUSTY_COIN)) - { - if (!hasQuestItems(player, RED_SOIL)) - { + } else if (hasQuestItems(player, RUSTY_COIN)) { + if (!hasQuestItems(player, RED_SOIL)) { htmltext = "30409-02.html"; - } - else - { + } else { takeItems(player, RUSTY_COIN, 1); takeItems(player, RED_SOIL, 1); - if (!hasQuestItems(player, EARTH_RING)) - { + if (!hasQuestItems(player, EARTH_RING)) { giveItems(player, EARTH_RING, 1); } qs.setCond(13, true); htmltext = "30409-03.html"; } - } - else if (hasQuestItems(player, EARTH_RING)) - { + } else if (hasQuestItems(player, EARTH_RING)) { htmltext = "30409-04.html"; } break; } - case WASTELAND_LIZARDMAN: - { - if (hasQuestItems(player, BROKEN_BRONZE_MIRROR)) - { - if (!hasQuestItems(player, WIND_FEATHER)) - { + case WASTELAND_LIZARDMAN: { + if (hasQuestItems(player, BROKEN_BRONZE_MIRROR)) { + if (!hasQuestItems(player, WIND_FEATHER)) { htmltext = "30410-01.html"; - } - else - { + } else { htmltext = "30410-04.html"; } } break; } - case FLAME_SALAMANDER: - { - if (!hasAtLeastOneQuestItem(player, MAP_OF_LUSTER, FLAME_EARING)) - { - if (!hasQuestItems(player, MAP_OF_LUSTER)) - { + case FLAME_SALAMANDER: { + if (!hasAtLeastOneQuestItem(player, MAP_OF_LUSTER, FLAME_EARING)) { + if (!hasQuestItems(player, MAP_OF_LUSTER)) { giveItems(player, MAP_OF_LUSTER, 1); } qs.setCond(2, true); htmltext = "30411-01.html"; - } - else if (hasQuestItems(player, MAP_OF_LUSTER)) - { - if (!hasQuestItems(player, KEY_OF_FLAME)) - { + } else if (hasQuestItems(player, MAP_OF_LUSTER)) { + if (!hasQuestItems(player, KEY_OF_FLAME)) { htmltext = "30411-02.html"; - } - else - { + } else { takeItems(player, MAP_OF_LUSTER, 1); takeItems(player, KEY_OF_FLAME, 1); - if (!hasQuestItems(player, FLAME_EARING)) - { + if (!hasQuestItems(player, FLAME_EARING)) { giveItems(player, FLAME_EARING, 1); } qs.setCond(4, true); htmltext = "30411-03.html"; } - } - else if (hasQuestItems(player, FLAME_EARING)) - { + } else if (hasQuestItems(player, FLAME_EARING)) { htmltext = "30411-04.html"; } break; } - case WIND_SYLPH: - { - if (hasQuestItems(player, FLAME_EARING) && !hasAtLeastOneQuestItem(player, BROKEN_BRONZE_MIRROR, WIND_BANGLE)) - { - if (!hasQuestItems(player, BROKEN_BRONZE_MIRROR)) - { + case WIND_SYLPH: { + if (hasQuestItems(player, FLAME_EARING) && !hasAtLeastOneQuestItem(player, BROKEN_BRONZE_MIRROR, WIND_BANGLE)) { + if (!hasQuestItems(player, BROKEN_BRONZE_MIRROR)) { giveItems(player, BROKEN_BRONZE_MIRROR, 1); } qs.setCond(5, true); htmltext = "30412-01.html"; - } - else if (hasQuestItems(player, BROKEN_BRONZE_MIRROR)) - { - if (!hasQuestItems(player, WIND_FEATHER)) - { + } else if (hasQuestItems(player, BROKEN_BRONZE_MIRROR)) { + if (!hasQuestItems(player, WIND_FEATHER)) { htmltext = "30412-02.html"; - } - else - { + } else { takeItems(player, BROKEN_BRONZE_MIRROR, 1); takeItems(player, WIND_FEATHER, 1); - if (!hasQuestItems(player, WIND_BANGLE)) - { + if (!hasQuestItems(player, WIND_BANGLE)) { giveItems(player, WIND_BANGLE, 1); } qs.setCond(7, true); htmltext = "30412-03.html"; } - } - else if (hasQuestItems(player, WIND_BANGLE)) - { + } else if (hasQuestItems(player, WIND_BANGLE)) { htmltext = "30412-04.html"; } break; } - case WATER_UNDINE: - { - if (hasQuestItems(player, WIND_BANGLE) && !hasAtLeastOneQuestItem(player, RAMAS_DIARY, WATER_NECKLACE)) - { - if (!hasQuestItems(player, RAMAS_DIARY)) - { + case WATER_UNDINE: { + if (hasQuestItems(player, WIND_BANGLE) && !hasAtLeastOneQuestItem(player, RAMAS_DIARY, WATER_NECKLACE)) { + if (!hasQuestItems(player, RAMAS_DIARY)) { giveItems(player, RAMAS_DIARY, 1); } qs.setCond(8, true); htmltext = "30413-01.html"; - } - else if (hasQuestItems(player, RAMAS_DIARY)) - { - if (getQuestItemsCount(player, SPARKLE_PEBBLE) < 2) - { + } else if (hasQuestItems(player, RAMAS_DIARY)) { + if (getQuestItemsCount(player, SPARKLE_PEBBLE) < 2) { htmltext = "30413-02.html"; - } - else - { + } else { takeItems(player, RAMAS_DIARY, 1); takeItems(player, SPARKLE_PEBBLE, -1); - if (!hasQuestItems(player, WATER_NECKLACE)) - { + if (!hasQuestItems(player, WATER_NECKLACE)) { giveItems(player, WATER_NECKLACE, 1); } qs.setCond(10, true); htmltext = "30413-03.html"; } - } - else if (hasQuestItems(player, WATER_NECKLACE)) - { + } else if (hasQuestItems(player, WATER_NECKLACE)) { htmltext = "30413-04.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00405_PathOfTheCleric/Q00405_PathOfTheCleric.java b/src/main/java/com/l2jserver/datapack/quests/Q00405_PathOfTheCleric/Q00405_PathOfTheCleric.java index 282184f584..f459c7e735 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00405_PathOfTheCleric/Q00405_PathOfTheCleric.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00405_PathOfTheCleric/Q00405_PathOfTheCleric.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Path Of The Cleric (405) * @author ivantotov */ -public final class Q00405_PathOfTheCleric extends Quest -{ +public final class Q00405_PathOfTheCleric extends Quest { // NPCs private static final int GALLINT = 30017; private static final int ZIGAUNT = 30022; @@ -59,8 +58,7 @@ public final class Q00405_PathOfTheCleric extends Quest // Misc private static final int MIN_LEVEL = 18; - public Q00405_PathOfTheCleric() - { + public Q00405_PathOfTheCleric() { super(405, Q00405_PathOfTheCleric.class.getSimpleName(), "Path Of The Cleric"); addStartNpc(ZIGAUNT); addTalkId(ZIGAUNT, GALLINT, VIVYAN, TRADER_SIMPLON, GUARD_PRAGA, LIONEL); @@ -69,45 +67,30 @@ public final class Q00405_PathOfTheCleric extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (player.getClassId() == ClassId.mage) - { - if (player.getLevel() >= MIN_LEVEL) - { - if (hasQuestItems(player, MARK_OF_FAITH)) - { + switch (event) { + case "ACCEPT": { + if (player.getClassId() == ClassId.mage) { + if (player.getLevel() >= MIN_LEVEL) { + if (hasQuestItems(player, MARK_OF_FAITH)) { htmltext = "30022-04.htm"; - } - else - { + } else { qs.startQuest(); giveItems(player, LETTER_OF_ORDER_1ST, 1); htmltext = "30022-05.htm"; } - } - else - { + } else { htmltext = "30022-03.htm"; } - } - else if (player.getClassId() == ClassId.cleric) - { + } else if (player.getClassId() == ClassId.cleric) { htmltext = "30022-02a.htm"; - } - else - { + } else { htmltext = "30022-02.htm"; } break; @@ -117,13 +100,10 @@ public final class Q00405_PathOfTheCleric extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - if (hasQuestItems(killer, NECKLACE_OF_MOTHER) && !hasQuestItems(killer, PENDANT_OF_MOTHER)) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + if (hasQuestItems(killer, NECKLACE_OF_MOTHER) && !hasQuestItems(killer, PENDANT_OF_MOTHER)) { giveItems(killer, PENDANT_OF_MOTHER, 1); playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_MIDDLE); } @@ -132,62 +112,41 @@ public final class Q00405_PathOfTheCleric extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated() || qs.isCompleted()) - { - if (npc.getId() == ZIGAUNT) - { - if (!hasQuestItems(player, MARK_OF_FAITH)) - { + if (qs.isCreated() || qs.isCompleted()) { + if (npc.getId() == ZIGAUNT) { + if (!hasQuestItems(player, MARK_OF_FAITH)) { htmltext = "30022-01.htm"; - } - else - { + } else { htmltext = "30022-04.htm"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case ZIGAUNT: - { - if (!hasQuestItems(player, LEMONIELLS_COVENANT) && hasQuestItems(player, LETTER_OF_ORDER_2ND)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case ZIGAUNT: { + if (!hasQuestItems(player, LEMONIELLS_COVENANT) && hasQuestItems(player, LETTER_OF_ORDER_2ND)) { htmltext = "30022-07.html"; - } - else if (hasQuestItems(player, LETTER_OF_ORDER_2ND, LEMONIELLS_COVENANT)) - { + } else if (hasQuestItems(player, LETTER_OF_ORDER_2ND, LEMONIELLS_COVENANT)) { giveAdena(player, 163800, true); takeItems(player, LETTER_OF_ORDER_2ND, 1); takeItems(player, LEMONIELLS_COVENANT, 1); giveItems(player, MARK_OF_FAITH, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 320534, 23152); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 456128, 28630); - } - else - { + } else { addExpAndSp(player, 591724, 35328); } qs.exitQuest(false, true); player.sendPacket(new SocialAction(player.getObjectId(), 3)); qs.saveGlobalQuestVar("1ClassQuestFinished", "1"); htmltext = "30022-09.html"; - } - else if (hasQuestItems(player, LETTER_OF_ORDER_1ST)) - { - if (hasQuestItems(player, BOOK_OF_VIVYAN, BOOK_OF_SIMPLON, BOOK_OF_PRAGA)) - { + } else if (hasQuestItems(player, LETTER_OF_ORDER_1ST)) { + if (hasQuestItems(player, BOOK_OF_VIVYAN, BOOK_OF_SIMPLON, BOOK_OF_PRAGA)) { takeItems(player, LETTER_OF_ORDER_1ST, 1); giveItems(player, LETTER_OF_ORDER_2ND, 1); takeItems(player, BOOK_OF_VIVYAN, 1); @@ -195,128 +154,89 @@ public final class Q00405_PathOfTheCleric extends Quest takeItems(player, BOOK_OF_PRAGA, 1); qs.setCond(3, true); htmltext = "30022-08.html"; - } - else - { + } else { htmltext = "30022-06.html"; } } break; } - case GALLINT: - { - if (!hasQuestItems(player, LEMONIELLS_COVENANT) && hasQuestItems(player, LETTER_OF_ORDER_2ND)) - { - if (!hasQuestItems(player, CERTIFICATE_OF_GALLINT) && hasQuestItems(player, LIONELS_BOOK)) - { + case GALLINT: { + if (!hasQuestItems(player, LEMONIELLS_COVENANT) && hasQuestItems(player, LETTER_OF_ORDER_2ND)) { + if (!hasQuestItems(player, CERTIFICATE_OF_GALLINT) && hasQuestItems(player, LIONELS_BOOK)) { takeItems(player, LIONELS_BOOK, 1); giveItems(player, CERTIFICATE_OF_GALLINT, 1); qs.setCond(5, true); htmltext = "30017-01.html"; - } - else - { + } else { htmltext = "30017-02.html"; } } break; } - case VIVYAN: - { - if (hasQuestItems(player, LETTER_OF_ORDER_1ST)) - { - if (!hasQuestItems(player, BOOK_OF_VIVYAN)) - { + case VIVYAN: { + if (hasQuestItems(player, LETTER_OF_ORDER_1ST)) { + if (!hasQuestItems(player, BOOK_OF_VIVYAN)) { giveItems(player, BOOK_OF_VIVYAN, 1); - if ((getQuestItemsCount(player, BOOK_OF_SIMPLON) >= 3) && (getQuestItemsCount(player, BOOK_OF_VIVYAN) >= 0) && (getQuestItemsCount(player, BOOK_OF_PRAGA) >= 1)) - { + if ((getQuestItemsCount(player, BOOK_OF_SIMPLON) >= 3) && (getQuestItemsCount(player, BOOK_OF_VIVYAN) >= 0) && (getQuestItemsCount(player, BOOK_OF_PRAGA) >= 1)) { qs.setCond(2, true); } htmltext = "30030-01.html"; - } - else - { + } else { htmltext = "30030-02.html"; } } break; } - case TRADER_SIMPLON: - { - if (hasQuestItems(player, LETTER_OF_ORDER_1ST)) - { - if (!hasQuestItems(player, BOOK_OF_SIMPLON)) - { + case TRADER_SIMPLON: { + if (hasQuestItems(player, LETTER_OF_ORDER_1ST)) { + if (!hasQuestItems(player, BOOK_OF_SIMPLON)) { giveItems(player, BOOK_OF_SIMPLON, 3); - if ((getQuestItemsCount(player, BOOK_OF_SIMPLON) >= 0) && (getQuestItemsCount(player, BOOK_OF_VIVYAN) >= 1) && (getQuestItemsCount(player, BOOK_OF_PRAGA) >= 1)) - { + if ((getQuestItemsCount(player, BOOK_OF_SIMPLON) >= 0) && (getQuestItemsCount(player, BOOK_OF_VIVYAN) >= 1) && (getQuestItemsCount(player, BOOK_OF_PRAGA) >= 1)) { qs.setCond(2, true); } htmltext = "30253-01.html"; - } - else - { + } else { htmltext = "30253-02.html"; } } break; } - case GUARD_PRAGA: - { - if (hasQuestItems(player, LETTER_OF_ORDER_1ST)) - { - if (!hasAtLeastOneQuestItem(player, BOOK_OF_PRAGA, NECKLACE_OF_MOTHER)) - { + case GUARD_PRAGA: { + if (hasQuestItems(player, LETTER_OF_ORDER_1ST)) { + if (!hasAtLeastOneQuestItem(player, BOOK_OF_PRAGA, NECKLACE_OF_MOTHER)) { giveItems(player, NECKLACE_OF_MOTHER, 1); htmltext = "30333-01.html"; - } - else if (!hasAtLeastOneQuestItem(player, BOOK_OF_PRAGA, PENDANT_OF_MOTHER) && hasQuestItems(player, NECKLACE_OF_MOTHER)) - { + } else if (!hasAtLeastOneQuestItem(player, BOOK_OF_PRAGA, PENDANT_OF_MOTHER) && hasQuestItems(player, NECKLACE_OF_MOTHER)) { htmltext = "30333-02.html"; - } - else if (!hasQuestItems(player, BOOK_OF_PRAGA) && hasQuestItems(player, NECKLACE_OF_MOTHER, PENDANT_OF_MOTHER)) - { + } else if (!hasQuestItems(player, BOOK_OF_PRAGA) && hasQuestItems(player, NECKLACE_OF_MOTHER, PENDANT_OF_MOTHER)) { giveItems(player, BOOK_OF_PRAGA, 1); takeItems(player, PENDANT_OF_MOTHER, 1); takeItems(player, NECKLACE_OF_MOTHER, 1); - if ((getQuestItemsCount(player, BOOK_OF_SIMPLON) >= 3) && (getQuestItemsCount(player, BOOK_OF_VIVYAN) >= 1) && (getQuestItemsCount(player, BOOK_OF_PRAGA) >= 0)) - { + if ((getQuestItemsCount(player, BOOK_OF_SIMPLON) >= 3) && (getQuestItemsCount(player, BOOK_OF_VIVYAN) >= 1) && (getQuestItemsCount(player, BOOK_OF_PRAGA) >= 0)) { qs.setCond(2, true); } htmltext = "30333-03.html"; - } - else if (hasQuestItems(player, BOOK_OF_PRAGA)) - { + } else if (hasQuestItems(player, BOOK_OF_PRAGA)) { htmltext = "30333-04.html"; } } break; } - case LIONEL: - { - if (!hasQuestItems(player, LETTER_OF_ORDER_2ND)) - { + case LIONEL: { + if (!hasQuestItems(player, LETTER_OF_ORDER_2ND)) { htmltext = "30408-02.html"; - } - else if (!hasAtLeastOneQuestItem(player, LIONELS_BOOK, LEMONIELLS_COVENANT, CERTIFICATE_OF_GALLINT) && hasQuestItems(player, LETTER_OF_ORDER_2ND)) - { + } else if (!hasAtLeastOneQuestItem(player, LIONELS_BOOK, LEMONIELLS_COVENANT, CERTIFICATE_OF_GALLINT) && hasQuestItems(player, LETTER_OF_ORDER_2ND)) { giveItems(player, LIONELS_BOOK, 1); qs.setCond(4, true); htmltext = "30408-01.html"; - } - else if (!hasAtLeastOneQuestItem(player, LEMONIELLS_COVENANT, CERTIFICATE_OF_GALLINT) && hasQuestItems(player, LETTER_OF_ORDER_2ND, LIONELS_BOOK)) - { + } else if (!hasAtLeastOneQuestItem(player, LEMONIELLS_COVENANT, CERTIFICATE_OF_GALLINT) && hasQuestItems(player, LETTER_OF_ORDER_2ND, LIONELS_BOOK)) { htmltext = "30408-03.html"; - } - else if (!hasAtLeastOneQuestItem(player, LIONELS_BOOK, LEMONIELLS_COVENANT) && hasQuestItems(player, LETTER_OF_ORDER_2ND, CERTIFICATE_OF_GALLINT)) - { + } else if (!hasAtLeastOneQuestItem(player, LIONELS_BOOK, LEMONIELLS_COVENANT) && hasQuestItems(player, LETTER_OF_ORDER_2ND, CERTIFICATE_OF_GALLINT)) { takeItems(player, CERTIFICATE_OF_GALLINT, 1); giveItems(player, LEMONIELLS_COVENANT, 1); qs.setCond(6, true); htmltext = "30408-04.html"; - } - else if (!hasAtLeastOneQuestItem(player, LIONELS_BOOK, CERTIFICATE_OF_GALLINT) && hasQuestItems(player, LETTER_OF_ORDER_2ND, LEMONIELLS_COVENANT)) - { + } else if (!hasAtLeastOneQuestItem(player, LIONELS_BOOK, CERTIFICATE_OF_GALLINT) && hasQuestItems(player, LETTER_OF_ORDER_2ND, LEMONIELLS_COVENANT)) { htmltext = "30408-05.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00406_PathOfTheElvenKnight/Q00406_PathOfTheElvenKnight.java b/src/main/java/com/l2jserver/datapack/quests/Q00406_PathOfTheElvenKnight/Q00406_PathOfTheElvenKnight.java index 149589364d..15e9ce0dc2 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00406_PathOfTheElvenKnight/Q00406_PathOfTheElvenKnight.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00406_PathOfTheElvenKnight/Q00406_PathOfTheElvenKnight.java @@ -35,8 +35,7 @@ import com.l2jserver.gameserver.util.Util; * Path Of The Elven Knight (406) * @author ivantotov */ -public final class Q00406_PathOfTheElvenKnight extends Quest -{ +public final class Q00406_PathOfTheElvenKnight extends Quest { // NPCs private static final int BLACKSMITH_KLUTO = 30317; private static final int MASTER_SORIUS = 30327; @@ -53,8 +52,7 @@ public final class Q00406_PathOfTheElvenKnight extends Quest // Mobs private static final int OL_MAHUM_NOVICE = 20782; private static final Map<Integer, ItemChanceHolder> MONSTER_DROPS = new HashMap<>(); - static - { + static { MONSTER_DROPS.put(20035, new ItemChanceHolder(TOPAZ_PIECE, 70)); // Tracker Skeleton MONSTER_DROPS.put(20042, new ItemChanceHolder(TOPAZ_PIECE, 70)); // Tracker Skeleton Leader MONSTER_DROPS.put(20045, new ItemChanceHolder(TOPAZ_PIECE, 70)); // Skeleton Scout @@ -64,8 +62,7 @@ public final class Q00406_PathOfTheElvenKnight extends Quest MONSTER_DROPS.put(OL_MAHUM_NOVICE, new ItemChanceHolder(EMERALD_PIECE, 50)); // Ol Mahum Novice } - public Q00406_PathOfTheElvenKnight() - { + public Q00406_PathOfTheElvenKnight() { super(406, Q00406_PathOfTheElvenKnight.class.getSimpleName(), "Path Of The Elven Knight"); addStartNpc(MASTER_SORIUS); addTalkId(MASTER_SORIUS, BLACKSMITH_KLUTO); @@ -74,55 +71,38 @@ public final class Q00406_PathOfTheElvenKnight extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (player.getClassId() != ClassId.elvenFighter) - { - if (player.getClassId() == ClassId.elvenKnight) - { + switch (event) { + case "ACCEPT": { + if (player.getClassId() != ClassId.elvenFighter) { + if (player.getClassId() == ClassId.elvenKnight) { htmltext = "30327-02a.htm"; - } - else - { + } else { htmltext = "30327-02.htm"; } - } - else if (player.getLevel() < MIN_LEVEL) - { + } else if (player.getLevel() < MIN_LEVEL) { htmltext = "30327-03.htm"; - } - else if (hasQuestItems(player, ELVEN_KNIGHT_BROOCH)) - { + } else if (hasQuestItems(player, ELVEN_KNIGHT_BROOCH)) { htmltext = "30327-04.htm"; - } - else - { + } else { htmltext = "30327-05.htm"; } break; } - case "30327-06.htm": - { + case "30327-06.htm": { qs.startQuest(); htmltext = event; break; } - case "30317-02.html": - { + case "30317-02.html": { takeItems(player, SORIUS_LETTER, 1); - if (!hasQuestItems(player, KLUTO_MEMO)) - { + if (!hasQuestItems(player, KLUTO_MEMO)) { giveItems(player, KLUTO_MEMO, 1); } qs.setCond(4, true); @@ -134,31 +114,24 @@ public final class Q00406_PathOfTheElvenKnight extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); final ItemChanceHolder reward = MONSTER_DROPS.get(npc.getId()); int requiredItemId = KLUTO_BOX; int cond = 2; boolean check = !hasQuestItems(killer, requiredItemId); - if (npc.getId() == OL_MAHUM_NOVICE) - { + if (npc.getId() == OL_MAHUM_NOVICE) { requiredItemId = KLUTO_MEMO; cond = 5; check = hasQuestItems(killer, requiredItemId); } - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, false)) - { - if (check && (getQuestItemsCount(killer, reward.getId()) < 20) && (getRandom(100) < reward.getChance())) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, false)) { + if (check && (getQuestItemsCount(killer, reward.getId()) < 20) && (getRandom(100) < reward.getChance())) { giveItems(killer, reward); - if (getQuestItemsCount(killer, reward.getId()) == 20) - { + if (getQuestItemsCount(killer, reward.getId()) == 20) { qs.setCond(cond, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -167,65 +140,41 @@ public final class Q00406_PathOfTheElvenKnight extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated() || qs.isCompleted()) - { - if (npc.getId() == MASTER_SORIUS) - { + if (qs.isCreated() || qs.isCompleted()) { + if (npc.getId() == MASTER_SORIUS) { htmltext = "30327-01.htm"; } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case MASTER_SORIUS: - { - if (!hasQuestItems(player, KLUTO_BOX)) - { - if (!hasQuestItems(player, TOPAZ_PIECE)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case MASTER_SORIUS: { + if (!hasQuestItems(player, KLUTO_BOX)) { + if (!hasQuestItems(player, TOPAZ_PIECE)) { htmltext = "30327-07.html"; - } - else if (hasQuestItems(player, TOPAZ_PIECE) && (getQuestItemsCount(player, TOPAZ_PIECE) < 20)) - { + } else if (hasQuestItems(player, TOPAZ_PIECE) && (getQuestItemsCount(player, TOPAZ_PIECE) < 20)) { htmltext = "30327-08.html"; - } - else if (!hasAtLeastOneQuestItem(player, KLUTO_MEMO, SORIUS_LETTER) && (getQuestItemsCount(player, TOPAZ_PIECE) >= 20)) - { - if (!hasQuestItems(player, SORIUS_LETTER)) - { + } else if (!hasAtLeastOneQuestItem(player, KLUTO_MEMO, SORIUS_LETTER) && (getQuestItemsCount(player, TOPAZ_PIECE) >= 20)) { + if (!hasQuestItems(player, SORIUS_LETTER)) { giveItems(player, SORIUS_LETTER, 1); } qs.setCond(3, true); htmltext = "30327-09.html"; - } - else if ((getQuestItemsCount(player, TOPAZ_PIECE) >= 20) && hasAtLeastOneQuestItem(player, SORIUS_LETTER, KLUTO_MEMO)) - { + } else if ((getQuestItemsCount(player, TOPAZ_PIECE) >= 20) && hasAtLeastOneQuestItem(player, SORIUS_LETTER, KLUTO_MEMO)) { htmltext = "30327-11.html"; } - } - else - { + } else { giveAdena(player, 163800, true); - if (!hasQuestItems(player, ELVEN_KNIGHT_BROOCH)) - { + if (!hasQuestItems(player, ELVEN_KNIGHT_BROOCH)) { giveItems(player, ELVEN_KNIGHT_BROOCH, 1); } final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 320534, 23152); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 456128, 29850); - } - else - { + } else { addExpAndSp(player, 591724, 33328); } qs.exitQuest(false, true); @@ -235,26 +184,16 @@ public final class Q00406_PathOfTheElvenKnight extends Quest } break; } - case BLACKSMITH_KLUTO: - { - if (!hasQuestItems(player, KLUTO_BOX)) - { - if (hasQuestItems(player, SORIUS_LETTER) && (getQuestItemsCount(player, TOPAZ_PIECE) >= 20)) - { + case BLACKSMITH_KLUTO: { + if (!hasQuestItems(player, KLUTO_BOX)) { + if (hasQuestItems(player, SORIUS_LETTER) && (getQuestItemsCount(player, TOPAZ_PIECE) >= 20)) { htmltext = "30317-01.html"; - } - else if (!hasQuestItems(player, EMERALD_PIECE) && hasQuestItems(player, KLUTO_MEMO) && (getQuestItemsCount(player, TOPAZ_PIECE) >= 20)) - { + } else if (!hasQuestItems(player, EMERALD_PIECE) && hasQuestItems(player, KLUTO_MEMO) && (getQuestItemsCount(player, TOPAZ_PIECE) >= 20)) { htmltext = "30317-03.html"; - } - else if (hasQuestItems(player, KLUTO_MEMO, EMERALD_PIECE) && (getQuestItemsCount(player, TOPAZ_PIECE) >= 20) && (getQuestItemsCount(player, EMERALD_PIECE) < 20)) - { + } else if (hasQuestItems(player, KLUTO_MEMO, EMERALD_PIECE) && (getQuestItemsCount(player, TOPAZ_PIECE) >= 20) && (getQuestItemsCount(player, EMERALD_PIECE) < 20)) { htmltext = "30317-04.html"; - } - else if (hasQuestItems(player, KLUTO_MEMO) && (getQuestItemsCount(player, TOPAZ_PIECE) >= 20) && (getQuestItemsCount(player, EMERALD_PIECE) >= 20)) - { - if (!hasQuestItems(player, KLUTO_BOX)) - { + } else if (hasQuestItems(player, KLUTO_MEMO) && (getQuestItemsCount(player, TOPAZ_PIECE) >= 20) && (getQuestItemsCount(player, EMERALD_PIECE) >= 20)) { + if (!hasQuestItems(player, KLUTO_BOX)) { giveItems(player, KLUTO_BOX, 1); } takeItems(player, TOPAZ_PIECE, -1); @@ -263,9 +202,7 @@ public final class Q00406_PathOfTheElvenKnight extends Quest qs.setCond(6, true); htmltext = "30317-05.html"; } - } - else if (hasQuestItems(player, KLUTO_BOX)) - { + } else if (hasQuestItems(player, KLUTO_BOX)) { htmltext = "30317-06.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00407_PathOfTheElvenScout/Q00407_PathOfTheElvenScout.java b/src/main/java/com/l2jserver/datapack/quests/Q00407_PathOfTheElvenScout/Q00407_PathOfTheElvenScout.java index eaa844db53..221b353652 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00407_PathOfTheElvenScout/Q00407_PathOfTheElvenScout.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00407_PathOfTheElvenScout/Q00407_PathOfTheElvenScout.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Path of the Elven Scout (407) * @author ivantotov */ -public final class Q00407_PathOfTheElvenScout extends Quest -{ +public final class Q00407_PathOfTheElvenScout extends Quest { // NPCs private static final int MASTER_REORIA = 30328; private static final int GUARD_BABENCO = 30334; @@ -57,8 +56,7 @@ public final class Q00407_PathOfTheElvenScout extends Quest // Misc private static final int MIN_LEVEL = 18; - public Q00407_PathOfTheElvenScout() - { + public Q00407_PathOfTheElvenScout() { super(407, Q00407_PathOfTheElvenScout.class.getSimpleName(), "Path of the Elven Scout"); addStartNpc(MASTER_REORIA); addTalkId(MASTER_REORIA, GUARD_BABENCO, GUARD_MORETTI, PRIAS); @@ -68,59 +66,41 @@ public final class Q00407_PathOfTheElvenScout extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (player.getClassId() == ClassId.elvenFighter) - { - if (player.getLevel() >= MIN_LEVEL) - { - if (hasQuestItems(player, REISAS_RECOMMENDATION)) - { + switch (event) { + case "ACCEPT": { + if (player.getClassId() == ClassId.elvenFighter) { + if (player.getLevel() >= MIN_LEVEL) { + if (hasQuestItems(player, REISAS_RECOMMENDATION)) { htmltext = "30328-04.htm"; - } - else - { + } else { qs.startQuest(); qs.unset("variable"); giveItems(player, REISAS_LETTER, 1); htmltext = "30328-05.htm"; } - } - else - { + } else { htmltext = "30328-03.htm"; } - } - else if (player.getClassId() == ClassId.elvenScout) - { + } else if (player.getClassId() == ClassId.elvenScout) { htmltext = "30328-02a.htm"; - } - else - { + } else { htmltext = "30328-02.htm"; } break; } - case "30337-02.html": - { + case "30337-02.html": { htmltext = event; break; } - case "30337-03.html": - { - if (hasQuestItems(player, REISAS_LETTER)) - { + case "30337-03.html": { + if (hasQuestItems(player, REISAS_LETTER)) { takeItems(player, REISAS_LETTER, -1); qs.set("variable", 1); qs.setCond(2, true); @@ -133,62 +113,44 @@ public final class Q00407_PathOfTheElvenScout extends Quest } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { final QuestState qs = getQuestState(attacker, false); - if ((qs != null) && qs.isStarted()) - { + if ((qs != null) && qs.isStarted()) { npc.setScriptValue(attacker.getObjectId()); } return super.onAttack(npc, attacker, damage, isSummon); } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (npc.isScriptValue(killer.getObjectId()) && Util.checkIfInRange(1500, npc, killer, false)) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (npc.isScriptValue(killer.getObjectId()) && Util.checkIfInRange(1500, npc, killer, false)) { final QuestState qs = getQuestState(killer, false); - if (qs == null) - { + if (qs == null) { return null; } - if (npc.getId() == OL_MAHUM_SENTRY) - { - if (qs.isCond(5) && (getRandom(10) < 6)) - { - if (hasQuestItems(qs.getPlayer(), MORETTIES_HERB, MORETTIS_LETTER) && !hasQuestItems(qs.getPlayer(), RUSTED_KEY)) - { + if (npc.getId() == OL_MAHUM_SENTRY) { + if (qs.isCond(5) && (getRandom(10) < 6)) { + if (hasQuestItems(qs.getPlayer(), MORETTIES_HERB, MORETTIS_LETTER) && !hasQuestItems(qs.getPlayer(), RUSTED_KEY)) { giveItems(qs.getPlayer(), RUSTED_KEY, 1); qs.setCond(6, true); } } - } - else if (qs.isCond(2)) - { + } else if (qs.isCond(2)) { final boolean has1stLetter = hasQuestItems(qs.getPlayer(), PRIASS_1ND_TORN_LETTER); final boolean has2ndLetter = hasQuestItems(qs.getPlayer(), PRIASS_2ND_TORN_LETTER); final boolean has3rdLetter = hasQuestItems(qs.getPlayer(), PRIASS_3ND_TORN_LETTER); final boolean has4thLetter = hasQuestItems(qs.getPlayer(), PRIASS_4ND_TORN_LETTER); - if (!(has1stLetter && has2ndLetter && has3rdLetter && has4thLetter)) - { - if (!has1stLetter) - { + if (!(has1stLetter && has2ndLetter && has3rdLetter && has4thLetter)) { + if (!has1stLetter) { giveLetterAndCheckState(PRIASS_1ND_TORN_LETTER, qs); - } - else if (!has2ndLetter) - { + } else if (!has2ndLetter) { giveLetterAndCheckState(PRIASS_2ND_TORN_LETTER, qs); - } - else if (!has3rdLetter) - { + } else if (!has3rdLetter) { giveLetterAndCheckState(PRIASS_3ND_TORN_LETTER, qs); - } - else if (!has4thLetter) - { + } else if (!has4thLetter) { giveLetterAndCheckState(PRIASS_4ND_TORN_LETTER, qs); } } @@ -197,61 +159,40 @@ public final class Q00407_PathOfTheElvenScout extends Quest return super.onKill(npc, killer, isSummon); } - private void giveLetterAndCheckState(int letterId, QuestState qs) - { + private void giveLetterAndCheckState(int letterId, QuestState qs) { giveItems(qs.getPlayer(), letterId, 1); - if (getQuestItemsCount(qs.getPlayer(), PRIASS_1ND_TORN_LETTER, PRIASS_2ND_TORN_LETTER, PRIASS_3ND_TORN_LETTER, PRIASS_4ND_TORN_LETTER) >= 4) - { + if (getQuestItemsCount(qs.getPlayer(), PRIASS_1ND_TORN_LETTER, PRIASS_2ND_TORN_LETTER, PRIASS_3ND_TORN_LETTER, PRIASS_4ND_TORN_LETTER) >= 4) { qs.setCond(3, true); - } - else - { + } else { playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); } } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated() || qs.isCompleted()) - { - if (npc.getId() == MASTER_REORIA) - { + if (qs.isCreated() || qs.isCompleted()) { + if (npc.getId() == MASTER_REORIA) { htmltext = "30328-01.htm"; } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case MASTER_REORIA: - { - if (hasQuestItems(player, REISAS_LETTER)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case MASTER_REORIA: { + if (hasQuestItems(player, REISAS_LETTER)) { htmltext = "30328-06.html"; - } - else if ((qs.getInt("variable") == 1) && !hasAtLeastOneQuestItem(player, REISAS_LETTER, HONORARY_GUARD)) - { + } else if ((qs.getInt("variable") == 1) && !hasAtLeastOneQuestItem(player, REISAS_LETTER, HONORARY_GUARD)) { htmltext = "30328-08.html"; - } - else if (hasQuestItems(player, HONORARY_GUARD)) - { + } else if (hasQuestItems(player, HONORARY_GUARD)) { takeItems(player, HONORARY_GUARD, -1); giveItems(player, REISAS_RECOMMENDATION, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 320534, 19932); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 456128, 26630); - } - else - { + } else { addExpAndSp(player, 591724, 33328); } giveAdena(player, 163800, true); @@ -262,76 +203,52 @@ public final class Q00407_PathOfTheElvenScout extends Quest } break; } - case GUARD_BABENCO: - { - if (qs.getInt("variable") == 1) - { + case GUARD_BABENCO: { + if (qs.getInt("variable") == 1) { htmltext = "30334-01.html"; } break; } - case GUARD_MORETTI: - { + case GUARD_MORETTI: { final long letterCount = getQuestItemsCount(player, PRIASS_1ND_TORN_LETTER, PRIASS_2ND_TORN_LETTER, PRIASS_3ND_TORN_LETTER, PRIASS_4ND_TORN_LETTER); - if (hasQuestItems(player, REISAS_LETTER) && (letterCount == 0)) - { + if (hasQuestItems(player, REISAS_LETTER) && (letterCount == 0)) { htmltext = "30337-01.html"; - } - else if ((qs.getInt("variable") == 1) && !hasAtLeastOneQuestItem(player, MORETTIS_LETTER, PRIASS_LETTER, HONORARY_GUARD)) - { - if (letterCount == 0) - { + } else if ((qs.getInt("variable") == 1) && !hasAtLeastOneQuestItem(player, MORETTIS_LETTER, PRIASS_LETTER, HONORARY_GUARD)) { + if (letterCount == 0) { htmltext = "30337-04.html"; - } - else if (letterCount < 4) - { + } else if (letterCount < 4) { htmltext = "30337-05.html"; - } - else - { + } else { takeItems(player, -1, PRIASS_1ND_TORN_LETTER, PRIASS_2ND_TORN_LETTER, PRIASS_3ND_TORN_LETTER, PRIASS_4ND_TORN_LETTER); giveItems(player, MORETTIES_HERB, 1); giveItems(player, MORETTIS_LETTER, 1); qs.setCond(4, true); htmltext = "30337-06.html"; } - } - else if (hasQuestItems(player, PRIASS_LETTER)) - { + } else if (hasQuestItems(player, PRIASS_LETTER)) { takeItems(player, PRIASS_LETTER, -1); giveItems(player, HONORARY_GUARD, 1); qs.setCond(8, true); htmltext = "30337-07.html"; - } - else if (hasQuestItems(player, MORETTIES_HERB, MORETTIS_LETTER)) - { + } else if (hasQuestItems(player, MORETTIES_HERB, MORETTIS_LETTER)) { htmltext = "30337-09.html"; - } - else if (hasQuestItems(player, HONORARY_GUARD)) - { + } else if (hasQuestItems(player, HONORARY_GUARD)) { htmltext = "30337-08.html"; } break; } - case PRIAS: - { - if (hasQuestItems(player, MORETTIS_LETTER, MORETTIES_HERB)) - { - if (!hasQuestItems(player, RUSTED_KEY)) - { + case PRIAS: { + if (hasQuestItems(player, MORETTIS_LETTER, MORETTIES_HERB)) { + if (!hasQuestItems(player, RUSTED_KEY)) { qs.setCond(5, true); htmltext = "30426-01.html"; - } - else - { + } else { takeItems(player, -1, RUSTED_KEY, MORETTIES_HERB, MORETTIS_LETTER); giveItems(player, PRIASS_LETTER, 1); qs.setCond(7, true); htmltext = "30426-02.html"; } - } - else if (hasQuestItems(player, PRIASS_LETTER)) - { + } else if (hasQuestItems(player, PRIASS_LETTER)) { htmltext = "30426-04.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00408_PathOfTheElvenWizard/Q00408_PathOfTheElvenWizard.java b/src/main/java/com/l2jserver/datapack/quests/Q00408_PathOfTheElvenWizard/Q00408_PathOfTheElvenWizard.java index c53a529942..4ac155e8ac 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00408_PathOfTheElvenWizard/Q00408_PathOfTheElvenWizard.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00408_PathOfTheElvenWizard/Q00408_PathOfTheElvenWizard.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Path Of The Elven Wizard (408) * @author ivantotov */ -public final class Q00408_PathOfTheElvenWizard extends Quest -{ +public final class Q00408_PathOfTheElvenWizard extends Quest { // NPCs private static final int ROSSELA = 30414; private static final int GREENIS = 30157; @@ -61,8 +60,7 @@ public final class Q00408_PathOfTheElvenWizard extends Quest // Misc private static final int MIN_LEVEL = 18; - public Q00408_PathOfTheElvenWizard() - { + public Q00408_PathOfTheElvenWizard() { super(408, Q00408_PathOfTheElvenWizard.class.getSimpleName(), "Path Of The Elven Wizard"); addStartNpc(ROSSELA); addTalkId(ROSSELA, GREENIS, THALIA, NORTHWIND); @@ -71,42 +69,27 @@ public final class Q00408_PathOfTheElvenWizard extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (player.getClassId() != ClassId.elvenMage) - { - if (player.getClassId() == ClassId.elvenWizard) - { + switch (event) { + case "ACCEPT": { + if (player.getClassId() != ClassId.elvenMage) { + if (player.getClassId() == ClassId.elvenWizard) { htmltext = "30414-02a.htm"; - } - else - { + } else { htmltext = "30414-03.htm"; } - } - else if (player.getLevel() < MIN_LEVEL) - { + } else if (player.getLevel() < MIN_LEVEL) { htmltext = "30414-04.htm"; - } - else if (hasQuestItems(player, ETERNITY_DIAMOND)) - { + } else if (hasQuestItems(player, ETERNITY_DIAMOND)) { htmltext = "30414-05.htm"; - } - else - { - if (!hasQuestItems(player, FERTILITY_PERIDOT)) - { + } else { + if (!hasQuestItems(player, FERTILITY_PERIDOT)) { giveItems(player, FERTILITY_PERIDOT, 1); } qs.startQuest(); @@ -114,79 +97,57 @@ public final class Q00408_PathOfTheElvenWizard extends Quest } break; } - case "30414-02.htm": - { + case "30414-02.htm": { htmltext = event; break; } - case "30414-10.html": - { - if (hasQuestItems(player, MAGICAL_POWERS_RUBY)) - { + case "30414-10.html": { + if (hasQuestItems(player, MAGICAL_POWERS_RUBY)) { htmltext = event; - } - else if (!hasQuestItems(player, MAGICAL_POWERS_RUBY) && hasQuestItems(player, FERTILITY_PERIDOT)) - { - if (!hasQuestItems(player, ROSELLAS_LETTER)) - { + } else if (!hasQuestItems(player, MAGICAL_POWERS_RUBY) && hasQuestItems(player, FERTILITY_PERIDOT)) { + if (!hasQuestItems(player, ROSELLAS_LETTER)) { giveItems(player, ROSELLAS_LETTER, 1); } htmltext = "30414-07.html"; } break; } - case "30414-12.html": - { - if (hasQuestItems(player, PURE_AQUAMARINE)) - { + case "30414-12.html": { + if (hasQuestItems(player, PURE_AQUAMARINE)) { htmltext = event; - } - else if (!hasQuestItems(player, PURE_AQUAMARINE) && hasQuestItems(player, FERTILITY_PERIDOT)) - { - if (!hasQuestItems(player, APPETIZING_APPLE)) - { + } else if (!hasQuestItems(player, PURE_AQUAMARINE) && hasQuestItems(player, FERTILITY_PERIDOT)) { + if (!hasQuestItems(player, APPETIZING_APPLE)) { giveItems(player, APPETIZING_APPLE, 1); } htmltext = "30414-13.html"; } break; } - case "30414-16.html": - { - if (hasQuestItems(player, NOBILITY_AMETHYST)) - { + case "30414-16.html": { + if (hasQuestItems(player, NOBILITY_AMETHYST)) { htmltext = event; - } - else if (!hasQuestItems(player, NOBILITY_AMETHYST) && hasQuestItems(player, FERTILITY_PERIDOT)) - { - if (!hasQuestItems(player, IMMORTAL_LOVE)) - { + } else if (!hasQuestItems(player, NOBILITY_AMETHYST) && hasQuestItems(player, FERTILITY_PERIDOT)) { + if (!hasQuestItems(player, IMMORTAL_LOVE)) { giveItems(player, IMMORTAL_LOVE, 1); } htmltext = "30414-17.html"; } break; } - case "30157-02.html": - { - if (hasQuestItems(player, ROSELLAS_LETTER)) - { + case "30157-02.html": { + if (hasQuestItems(player, ROSELLAS_LETTER)) { takeItems(player, ROSELLAS_LETTER, 1); - if (!hasQuestItems(player, GREENISS_CHARM)) - { + if (!hasQuestItems(player, GREENISS_CHARM)) { giveItems(player, GREENISS_CHARM, 1); } } htmltext = event; break; } - case "30371-02.html": - { - if (hasQuestItems(player, APPETIZING_APPLE)) - { + case "30371-02.html": { + if (hasQuestItems(player, APPETIZING_APPLE)) { takeItems(player, APPETIZING_APPLE, 1); - if (!hasQuestItems(player, SAP_OF_THE_MOTHER_TREE)) - { + if (!hasQuestItems(player, SAP_OF_THE_MOTHER_TREE)) { giveItems(player, SAP_OF_THE_MOTHER_TREE, 1); } } @@ -198,56 +159,38 @@ public final class Q00408_PathOfTheElvenWizard extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case DRYAD_ELDER: - { - if (hasQuestItems(killer, SAP_OF_THE_MOTHER_TREE) && (getQuestItemsCount(killer, GOLD_LEAVES) < 5) && (getRandom(100) < 40)) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case DRYAD_ELDER: { + if (hasQuestItems(killer, SAP_OF_THE_MOTHER_TREE) && (getQuestItemsCount(killer, GOLD_LEAVES) < 5) && (getRandom(100) < 40)) { giveItems(killer, GOLD_LEAVES, 1); - if (getQuestItemsCount(killer, GOLD_LEAVES) == 5) - { + if (getQuestItemsCount(killer, GOLD_LEAVES) == 5) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case SUKAR_WERERAT_LEADER: - { - if (hasQuestItems(killer, LUCKY_POTPOURRI) && (getQuestItemsCount(killer, AMETHYST) < 2) && (getRandom(100) < 40)) - { + case SUKAR_WERERAT_LEADER: { + if (hasQuestItems(killer, LUCKY_POTPOURRI) && (getQuestItemsCount(killer, AMETHYST) < 2) && (getRandom(100) < 40)) { giveItems(killer, AMETHYST, 1); - if (getQuestItemsCount(killer, AMETHYST) == 2) - { + if (getQuestItemsCount(killer, AMETHYST) == 2) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case PINCER_SPIDER: - { - if (hasQuestItems(killer, GREENISS_CHARM) && (getQuestItemsCount(killer, RED_DOWN) < 5) && (getRandom(100) < 70)) - { + case PINCER_SPIDER: { + if (hasQuestItems(killer, GREENISS_CHARM) && (getQuestItemsCount(killer, RED_DOWN) < 5) && (getRandom(100) < 70)) { giveItems(killer, RED_DOWN, 1); - if (getQuestItemsCount(killer, RED_DOWN) == 5) - { + if (getQuestItemsCount(killer, RED_DOWN) == 5) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -259,92 +202,54 @@ public final class Q00408_PathOfTheElvenWizard extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated() || qs.isCompleted()) - { - if (npc.getId() == ROSSELA) - { + if (qs.isCreated() || qs.isCompleted()) { + if (npc.getId() == ROSSELA) { htmltext = "30414-01.htm"; } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case ROSSELA: - { - if (!hasAtLeastOneQuestItem(player, ROSELLAS_LETTER, APPETIZING_APPLE, IMMORTAL_LOVE, GREENISS_CHARM, SAP_OF_THE_MOTHER_TREE, LUCKY_POTPOURRI) && hasQuestItems(player, FERTILITY_PERIDOT) && !hasQuestItems(player, MAGICAL_POWERS_RUBY, NOBILITY_AMETHYST, PURE_AQUAMARINE)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case ROSSELA: { + if (!hasAtLeastOneQuestItem(player, ROSELLAS_LETTER, APPETIZING_APPLE, IMMORTAL_LOVE, GREENISS_CHARM, SAP_OF_THE_MOTHER_TREE, LUCKY_POTPOURRI) && hasQuestItems(player, FERTILITY_PERIDOT) && !hasQuestItems(player, MAGICAL_POWERS_RUBY, NOBILITY_AMETHYST, PURE_AQUAMARINE)) { htmltext = "30414-11.html"; - } - else if (hasQuestItems(player, ROSELLAS_LETTER)) - { + } else if (hasQuestItems(player, ROSELLAS_LETTER)) { htmltext = "30414-08.html"; - } - else if (hasQuestItems(player, GREENISS_CHARM)) - { - if (getQuestItemsCount(player, RED_DOWN) < 5) - { + } else if (hasQuestItems(player, GREENISS_CHARM)) { + if (getQuestItemsCount(player, RED_DOWN) < 5) { htmltext = "30414-09.html"; - } - else - { + } else { htmltext = "30414-21.html"; } - } - else if (hasQuestItems(player, APPETIZING_APPLE)) - { + } else if (hasQuestItems(player, APPETIZING_APPLE)) { htmltext = "30414-14.html"; - } - else if (hasQuestItems(player, SAP_OF_THE_MOTHER_TREE)) - { - if (getQuestItemsCount(player, GOLD_LEAVES) < 5) - { + } else if (hasQuestItems(player, SAP_OF_THE_MOTHER_TREE)) { + if (getQuestItemsCount(player, GOLD_LEAVES) < 5) { htmltext = "30414-15.html"; - } - else - { + } else { htmltext = "30414-22.html"; } - } - else if (hasQuestItems(player, IMMORTAL_LOVE)) - { + } else if (hasQuestItems(player, IMMORTAL_LOVE)) { htmltext = "30414-18.html"; - } - else if (hasQuestItems(player, LUCKY_POTPOURRI)) - { - if (getQuestItemsCount(player, AMETHYST) < 2) - { + } else if (hasQuestItems(player, LUCKY_POTPOURRI)) { + if (getQuestItemsCount(player, AMETHYST) < 2) { htmltext = "30414-19.html"; - } - else - { + } else { htmltext = "30414-23.html"; } - } - else - { - if (!hasAtLeastOneQuestItem(player, ROSELLAS_LETTER, APPETIZING_APPLE, IMMORTAL_LOVE, GREENISS_CHARM, SAP_OF_THE_MOTHER_TREE, LUCKY_POTPOURRI) && hasQuestItems(player, FERTILITY_PERIDOT, MAGICAL_POWERS_RUBY, NOBILITY_AMETHYST, PURE_AQUAMARINE)) - { + } else { + if (!hasAtLeastOneQuestItem(player, ROSELLAS_LETTER, APPETIZING_APPLE, IMMORTAL_LOVE, GREENISS_CHARM, SAP_OF_THE_MOTHER_TREE, LUCKY_POTPOURRI) && hasQuestItems(player, FERTILITY_PERIDOT, MAGICAL_POWERS_RUBY, NOBILITY_AMETHYST, PURE_AQUAMARINE)) { giveAdena(player, 163800, true); - if (!hasQuestItems(player, ETERNITY_DIAMOND)) - { + if (!hasQuestItems(player, ETERNITY_DIAMOND)) { giveItems(player, ETERNITY_DIAMOND, 1); } final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 320534, 22532); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 456128, 29230); - } - else - { + } else { addExpAndSp(player, 591724, 35928); } qs.exitQuest(false, true); @@ -355,23 +260,15 @@ public final class Q00408_PathOfTheElvenWizard extends Quest } break; } - case GREENIS: - { - if (hasQuestItems(player, ROSELLAS_LETTER)) - { + case GREENIS: { + if (hasQuestItems(player, ROSELLAS_LETTER)) { htmltext = "30157-01.html"; - } - else if (hasQuestItems(player, GREENISS_CHARM)) - { - if (getQuestItemsCount(player, RED_DOWN) < 5) - { + } else if (hasQuestItems(player, GREENISS_CHARM)) { + if (getQuestItemsCount(player, RED_DOWN) < 5) { htmltext = "30157-03.html"; - } - else - { + } else { takeItems(player, RED_DOWN, -1); - if (!hasQuestItems(player, MAGICAL_POWERS_RUBY)) - { + if (!hasQuestItems(player, MAGICAL_POWERS_RUBY)) { giveItems(player, MAGICAL_POWERS_RUBY, 1); } takeItems(player, GREENISS_CHARM, 1); @@ -380,22 +277,14 @@ public final class Q00408_PathOfTheElvenWizard extends Quest } break; } - case THALIA: - { - if (hasQuestItems(player, APPETIZING_APPLE)) - { + case THALIA: { + if (hasQuestItems(player, APPETIZING_APPLE)) { htmltext = "30371-01.html"; - } - else if (hasQuestItems(player, SAP_OF_THE_MOTHER_TREE)) - { - if (getQuestItemsCount(player, GOLD_LEAVES) < 5) - { + } else if (hasQuestItems(player, SAP_OF_THE_MOTHER_TREE)) { + if (getQuestItemsCount(player, GOLD_LEAVES) < 5) { htmltext = "30371-03.html"; - } - else - { - if (!hasQuestItems(player, PURE_AQUAMARINE)) - { + } else { + if (!hasQuestItems(player, PURE_AQUAMARINE)) { giveItems(player, PURE_AQUAMARINE, 1); } takeItems(player, GOLD_LEAVES, -1); @@ -405,28 +294,19 @@ public final class Q00408_PathOfTheElvenWizard extends Quest } break; } - case NORTHWIND: - { - if (hasQuestItems(player, IMMORTAL_LOVE)) - { + case NORTHWIND: { + if (hasQuestItems(player, IMMORTAL_LOVE)) { takeItems(player, IMMORTAL_LOVE, 1); - if (!hasQuestItems(player, LUCKY_POTPOURRI)) - { + if (!hasQuestItems(player, LUCKY_POTPOURRI)) { giveItems(player, LUCKY_POTPOURRI, 1); } htmltext = "30423-01.html"; - } - else if (hasQuestItems(player, LUCKY_POTPOURRI)) - { - if (getQuestItemsCount(player, AMETHYST) < 2) - { + } else if (hasQuestItems(player, LUCKY_POTPOURRI)) { + if (getQuestItemsCount(player, AMETHYST) < 2) { htmltext = "30423-02.html"; - } - else - { + } else { takeItems(player, AMETHYST, -1); - if (!hasQuestItems(player, NOBILITY_AMETHYST)) - { + if (!hasQuestItems(player, NOBILITY_AMETHYST)) { giveItems(player, NOBILITY_AMETHYST, 1); } takeItems(player, LUCKY_POTPOURRI, 1); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00409_PathOfTheElvenOracle/Q00409_PathOfTheElvenOracle.java b/src/main/java/com/l2jserver/datapack/quests/Q00409_PathOfTheElvenOracle/Q00409_PathOfTheElvenOracle.java index 7dc8933d5f..0075385139 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00409_PathOfTheElvenOracle/Q00409_PathOfTheElvenOracle.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00409_PathOfTheElvenOracle/Q00409_PathOfTheElvenOracle.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.util.Util; * Path of the Elven Oracle (409) * @author ivantotov */ -public final class Q00409_PathOfTheElvenOracle extends Quest -{ +public final class Q00409_PathOfTheElvenOracle extends Quest { // NPCs private static final int PRIEST_MANUEL = 30293; private static final int ALLANA = 30424; @@ -56,8 +55,7 @@ public final class Q00409_PathOfTheElvenOracle extends Quest private static final int LIZARDMAN_SOLDIER = 27034; private static final int TAMIL = 27035; - public Q00409_PathOfTheElvenOracle() - { + public Q00409_PathOfTheElvenOracle() { super(409, Q00409_PathOfTheElvenOracle.class.getSimpleName(), "Path of the Elven Oracle"); addStartNpc(PRIEST_MANUEL); addTalkId(PRIEST_MANUEL, ALLANA, PERRIN); @@ -67,66 +65,47 @@ public final class Q00409_PathOfTheElvenOracle extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (player.getClassId() == ClassId.elvenMage) - { - if (player.getLevel() >= MIN_LEVEL) - { - if (hasQuestItems(player, LEAF_OF_ORACLE)) - { + switch (event) { + case "ACCEPT": { + if (player.getClassId() == ClassId.elvenMage) { + if (player.getLevel() >= MIN_LEVEL) { + if (hasQuestItems(player, LEAF_OF_ORACLE)) { htmltext = "30293-04.htm"; - } - else - { + } else { qs.startQuest(); qs.setMemoState(1); giveItems(player, CRYSTAL_MEDALLION, 1); htmltext = "30293-05.htm"; } - } - else - { + } else { htmltext = "30293-03.htm"; } - } - else if (player.getClassId() == ClassId.oracle) - { + } else if (player.getClassId() == ClassId.oracle) { htmltext = "30293-02a.htm"; - } - else - { + } else { htmltext = "30293-02.htm"; } break; } case "30424-08.html": - case "30424-09.html": - { + case "30424-09.html": { htmltext = event; break; } - case "30424-07.html": - { - if (qs.isMemoState(1)) - { + case "30424-07.html": { + if (qs.isMemoState(1)) { htmltext = event; } break; } - case "replay_1": - { + case "replay_1": { qs.setMemoState(2); addAttackDesire(addSpawn(lIZARDMAN_WARRIOR, npc, true, 0, false), player); addAttackDesire(addSpawn(LIZARDMAN_SCOUT, npc, true, 0, false), player); @@ -134,18 +113,14 @@ public final class Q00409_PathOfTheElvenOracle extends Quest break; } case "30428-02.html": - case "30428-03.html": - { - if (qs.isMemoState(2)) - { + case "30428-03.html": { + if (qs.isMemoState(2)) { htmltext = event; } break; } - case "replay_2": - { - if (qs.isMemoState(2)) - { + case "replay_2": { + if (qs.isMemoState(2)) { qs.setMemoState(3); addAttackDesire(addSpawn(TAMIL, npc, true, 0, true), player); } @@ -156,33 +131,24 @@ public final class Q00409_PathOfTheElvenOracle extends Quest } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { - if (getQuestState(attacker, false) != null) - { - switch (npc.getScriptValue()) - { - case 0: - { - switch (npc.getId()) - { - case lIZARDMAN_WARRIOR: - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { + if (getQuestState(attacker, false) != null) { + switch (npc.getScriptValue()) { + case 0: { + switch (npc.getId()) { + case lIZARDMAN_WARRIOR: { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.THE_SACRED_FLAME_IS_OURS)); break; } - case LIZARDMAN_SCOUT: - { + case LIZARDMAN_SCOUT: { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.THE_SACRED_FLAME_IS_OURS)); break; } - case LIZARDMAN_SOLDIER: - { + case LIZARDMAN_SOLDIER: { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.THE_SACRED_FLAME_IS_OURS)); break; } - case TAMIL: - { + case TAMIL: { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.AS_YOU_WISH_MASTER)); break; } @@ -192,10 +158,8 @@ public final class Q00409_PathOfTheElvenOracle extends Quest npc.getVariables().set("firstAttacker", attacker.getObjectId()); break; } - case 1: - { - if (npc.getVariables().getInt("firstAttacker") != attacker.getObjectId()) - { + case 1: { + if (npc.getVariables().getInt("firstAttacker") != attacker.getObjectId()) { npc.setScriptValue(2); } break; @@ -206,17 +170,12 @@ public final class Q00409_PathOfTheElvenOracle extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && npc.isScriptValue(1) && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case lIZARDMAN_WARRIOR: - { - if (!hasQuestItems(killer, LIZARD_CAPTAIN_ORDER)) - { + if ((qs != null) && qs.isStarted() && npc.isScriptValue(1) && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case lIZARDMAN_WARRIOR: { + if (!hasQuestItems(killer, LIZARD_CAPTAIN_ORDER)) { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.ARRGHHWE_SHALL_NEVER_SURRENDER)); giveItems(killer, LIZARD_CAPTAIN_ORDER, 1); qs.setCond(3, true); @@ -224,19 +183,15 @@ public final class Q00409_PathOfTheElvenOracle extends Quest break; } case LIZARDMAN_SCOUT: - case LIZARDMAN_SOLDIER: - { - if (!hasQuestItems(killer, LIZARD_CAPTAIN_ORDER)) - { + case LIZARDMAN_SOLDIER: { + if (!hasQuestItems(killer, LIZARD_CAPTAIN_ORDER)) { giveItems(killer, LIZARD_CAPTAIN_ORDER, 1); qs.setCond(3, true); } break; } - case TAMIL: - { - if (!hasQuestItems(killer, TAMIL_NECKLACE)) - { + case TAMIL: { + if (!hasQuestItems(killer, TAMIL_NECKLACE)) { giveItems(killer, TAMIL_NECKLACE, 1); qs.setCond(5, true); } @@ -248,63 +203,40 @@ public final class Q00409_PathOfTheElvenOracle extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated() || qs.isCompleted()) - { - if (npc.getId() == PRIEST_MANUEL) - { - if (!hasQuestItems(player, LEAF_OF_ORACLE)) - { + if (qs.isCreated() || qs.isCompleted()) { + if (npc.getId() == PRIEST_MANUEL) { + if (!hasQuestItems(player, LEAF_OF_ORACLE)) { htmltext = "30293-01.htm"; - } - else - { + } else { htmltext = "30293-04.htm"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case PRIEST_MANUEL: - { - if (hasQuestItems(player, CRYSTAL_MEDALLION)) - { - if (!hasAtLeastOneQuestItem(player, SWINDLERS_MONEY, ALLANA_OF_DAIRY, LIZARD_CAPTAIN_ORDER, HALF_OF_DAIRY)) - { - if (qs.isMemoState(2)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case PRIEST_MANUEL: { + if (hasQuestItems(player, CRYSTAL_MEDALLION)) { + if (!hasAtLeastOneQuestItem(player, SWINDLERS_MONEY, ALLANA_OF_DAIRY, LIZARD_CAPTAIN_ORDER, HALF_OF_DAIRY)) { + if (qs.isMemoState(2)) { qs.setMemoState(1); qs.setCond(8); htmltext = "30293-09.html"; - } - else - { + } else { qs.setMemoState(1); htmltext = "30293-06.html"; } - } - else if (hasQuestItems(player, SWINDLERS_MONEY, ALLANA_OF_DAIRY, LIZARD_CAPTAIN_ORDER)) - { - if (!hasQuestItems(player, HALF_OF_DAIRY)) - { + } else if (hasQuestItems(player, SWINDLERS_MONEY, ALLANA_OF_DAIRY, LIZARD_CAPTAIN_ORDER)) { + if (!hasQuestItems(player, HALF_OF_DAIRY)) { giveAdena(player, 163800, true); giveItems(player, LEAF_OF_ORACLE, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 320534, 20392); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 456128, 27090); - } - else - { + } else { addExpAndSp(player, 591724, 33788); } qs.exitQuest(false, true); @@ -312,86 +244,58 @@ public final class Q00409_PathOfTheElvenOracle extends Quest qs.saveGlobalQuestVar("1ClassQuestFinished", "1"); htmltext = "30293-08.html"; } - } - else - { + } else { htmltext = "30293-07.html"; } } break; } - case ALLANA: - { - if (hasQuestItems(player, CRYSTAL_MEDALLION)) - { - if (!hasAtLeastOneQuestItem(player, SWINDLERS_MONEY, ALLANA_OF_DAIRY, LIZARD_CAPTAIN_ORDER, HALF_OF_DAIRY)) - { - if (qs.isMemoState(2)) - { + case ALLANA: { + if (hasQuestItems(player, CRYSTAL_MEDALLION)) { + if (!hasAtLeastOneQuestItem(player, SWINDLERS_MONEY, ALLANA_OF_DAIRY, LIZARD_CAPTAIN_ORDER, HALF_OF_DAIRY)) { + if (qs.isMemoState(2)) { htmltext = "30424-05.html"; - } - else if (qs.isMemoState(1)) - { + } else if (qs.isMemoState(1)) { qs.setCond(2, true); htmltext = "30424-01.html"; } - } - else if (!hasAtLeastOneQuestItem(player, SWINDLERS_MONEY, ALLANA_OF_DAIRY, HALF_OF_DAIRY) && hasQuestItems(player, LIZARD_CAPTAIN_ORDER)) - { + } else if (!hasAtLeastOneQuestItem(player, SWINDLERS_MONEY, ALLANA_OF_DAIRY, HALF_OF_DAIRY) && hasQuestItems(player, LIZARD_CAPTAIN_ORDER)) { qs.setMemoState(2); giveItems(player, HALF_OF_DAIRY, 1); qs.setCond(4, true); htmltext = "30424-02.html"; - } - else if (!hasAtLeastOneQuestItem(player, SWINDLERS_MONEY, ALLANA_OF_DAIRY) && hasQuestItems(player, LIZARD_CAPTAIN_ORDER, HALF_OF_DAIRY)) - { - if ((qs.isMemoState(3)) && !hasQuestItems(player, TAMIL_NECKLACE)) - { + } else if (!hasAtLeastOneQuestItem(player, SWINDLERS_MONEY, ALLANA_OF_DAIRY) && hasQuestItems(player, LIZARD_CAPTAIN_ORDER, HALF_OF_DAIRY)) { + if ((qs.isMemoState(3)) && !hasQuestItems(player, TAMIL_NECKLACE)) { qs.setMemoState(2); qs.setCond(4, true); htmltext = "30424-06.html"; - } - else - { + } else { htmltext = "30424-03.html"; } - } - else if (hasQuestItems(player, SWINDLERS_MONEY, LIZARD_CAPTAIN_ORDER, HALF_OF_DAIRY) && !hasQuestItems(player, ALLANA_OF_DAIRY)) - { + } else if (hasQuestItems(player, SWINDLERS_MONEY, LIZARD_CAPTAIN_ORDER, HALF_OF_DAIRY) && !hasQuestItems(player, ALLANA_OF_DAIRY)) { giveItems(player, ALLANA_OF_DAIRY, 1); takeItems(player, HALF_OF_DAIRY, 1); qs.setCond(9, true); htmltext = "30424-04.html"; - } - else if (hasQuestItems(player, SWINDLERS_MONEY, LIZARD_CAPTAIN_ORDER, ALLANA_OF_DAIRY)) - { + } else if (hasQuestItems(player, SWINDLERS_MONEY, LIZARD_CAPTAIN_ORDER, ALLANA_OF_DAIRY)) { qs.setCond(7, true); htmltext = "30424-05.html"; } } break; } - case PERRIN: - { - if (hasQuestItems(player, CRYSTAL_MEDALLION, LIZARD_CAPTAIN_ORDER, HALF_OF_DAIRY)) - { - if (hasQuestItems(player, TAMIL_NECKLACE)) - { + case PERRIN: { + if (hasQuestItems(player, CRYSTAL_MEDALLION, LIZARD_CAPTAIN_ORDER, HALF_OF_DAIRY)) { + if (hasQuestItems(player, TAMIL_NECKLACE)) { giveItems(player, SWINDLERS_MONEY, 1); takeItems(player, TAMIL_NECKLACE, 1); qs.setCond(6, true); htmltext = "30428-04.html"; - } - else if (hasQuestItems(player, SWINDLERS_MONEY)) - { + } else if (hasQuestItems(player, SWINDLERS_MONEY)) { htmltext = "30428-05.html"; - } - else if (qs.isMemoState(3)) - { + } else if (qs.isMemoState(3)) { htmltext = "30428-06.html"; - } - else - { + } else { htmltext = "30428-01.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00410_PathOfThePalusKnight/Q00410_PathOfThePalusKnight.java b/src/main/java/com/l2jserver/datapack/quests/Q00410_PathOfThePalusKnight/Q00410_PathOfThePalusKnight.java index 57b3d5497c..7d538f3a89 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00410_PathOfThePalusKnight/Q00410_PathOfThePalusKnight.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00410_PathOfThePalusKnight/Q00410_PathOfThePalusKnight.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Path Of The Palus Knight (410) * @author ivantotov */ -public final class Q00410_PathOfThePalusKnight extends Quest -{ +public final class Q00410_PathOfThePalusKnight extends Quest { // NPCs private static final int MASTER_VIRGIL = 30329; private static final int KALINTA = 30422; @@ -53,8 +52,7 @@ public final class Q00410_PathOfThePalusKnight extends Quest // Misc private static final int MIN_LEVEL = 18; - public Q00410_PathOfThePalusKnight() - { + public Q00410_PathOfThePalusKnight() { super(410, Q00410_PathOfThePalusKnight.class.getSimpleName(), "Path Of The Palus Knight"); addStartNpc(MASTER_VIRGIL); addTalkId(MASTER_VIRGIL, KALINTA); @@ -63,58 +61,40 @@ public final class Q00410_PathOfThePalusKnight extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (player.getClassId() == ClassId.darkFighter) - { - if (player.getLevel() >= MIN_LEVEL) - { - if (hasQuestItems(player, GAZE_OF_ABYSS)) - { + switch (event) { + case "ACCEPT": { + if (player.getClassId() == ClassId.darkFighter) { + if (player.getLevel() >= MIN_LEVEL) { + if (hasQuestItems(player, GAZE_OF_ABYSS)) { htmltext = "30329-04.htm"; - } - else - { + } else { htmltext = "30329-05.htm"; } - } - else - { + } else { htmltext = "30329-02.htm"; } - } - else if (player.getClassId() == ClassId.palusKnight) - { + } else if (player.getClassId() == ClassId.palusKnight) { htmltext = "30329-02a.htm"; - } - else - { + } else { htmltext = "30329-03.htm"; } break; } - case "30329-06.htm": - { + case "30329-06.htm": { qs.startQuest(); giveItems(player, PALLUS_TALISMAN, 1); htmltext = event; break; } - case "30329-10.html": - { - if (hasQuestItems(player, PALLUS_TALISMAN, LYCANTHROPE_SKULL)) - { + case "30329-10.html": { + if (hasQuestItems(player, PALLUS_TALISMAN, LYCANTHROPE_SKULL)) { takeItems(player, PALLUS_TALISMAN, 1); takeItems(player, LYCANTHROPE_SKULL, -1); giveItems(player, VIRGILS_LETTER, 1); @@ -123,10 +103,8 @@ public final class Q00410_PathOfThePalusKnight extends Quest } break; } - case "30422-02.html": - { - if (hasQuestItems(player, VIRGILS_LETTER)) - { + case "30422-02.html": { + if (hasQuestItems(player, VIRGILS_LETTER)) { takeItems(player, VIRGILS_LETTER, 1); giveItems(player, MORTE_TALISMAN, 1); qs.setCond(4, true); @@ -134,10 +112,8 @@ public final class Q00410_PathOfThePalusKnight extends Quest } break; } - case "30422-06.html": - { - if (hasQuestItems(player, MORTE_TALISMAN, ARACHNID_TRACKER_SILK, VENOMOUS_SPIDERS_CARAPACE)) - { + case "30422-06.html": { + if (hasQuestItems(player, MORTE_TALISMAN, ARACHNID_TRACKER_SILK, VENOMOUS_SPIDERS_CARAPACE)) { takeItems(player, MORTE_TALISMAN, 1); takeItems(player, VENOMOUS_SPIDERS_CARAPACE, 1); takeItems(player, ARACHNID_TRACKER_SILK, -1); @@ -152,55 +128,38 @@ public final class Q00410_PathOfThePalusKnight extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case VENOMOUS_SPIDER: - { - if (hasQuestItems(killer, MORTE_TALISMAN) && (getQuestItemsCount(killer, VENOMOUS_SPIDERS_CARAPACE) < 1)) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case VENOMOUS_SPIDER: { + if (hasQuestItems(killer, MORTE_TALISMAN) && (getQuestItemsCount(killer, VENOMOUS_SPIDERS_CARAPACE) < 1)) { giveItems(killer, VENOMOUS_SPIDERS_CARAPACE, 1); - if (getQuestItemsCount(killer, ARACHNID_TRACKER_SILK) >= 5) - { + if (getQuestItemsCount(killer, ARACHNID_TRACKER_SILK) >= 5) { qs.setCond(5, true); } } break; } - case ARACHNID_TRACKER: - { - if (hasQuestItems(killer, MORTE_TALISMAN) && (getQuestItemsCount(killer, ARACHNID_TRACKER_SILK) < 5)) - { + case ARACHNID_TRACKER: { + if (hasQuestItems(killer, MORTE_TALISMAN) && (getQuestItemsCount(killer, ARACHNID_TRACKER_SILK) < 5)) { giveItems(killer, ARACHNID_TRACKER_SILK, 1); - if (getQuestItemsCount(killer, ARACHNID_TRACKER_SILK) == 5) - { - if ((getQuestItemsCount(killer, ARACHNID_TRACKER_SILK) >= 4) && hasQuestItems(killer, VENOMOUS_SPIDERS_CARAPACE)) - { + if (getQuestItemsCount(killer, ARACHNID_TRACKER_SILK) == 5) { + if ((getQuestItemsCount(killer, ARACHNID_TRACKER_SILK) >= 4) && hasQuestItems(killer, VENOMOUS_SPIDERS_CARAPACE)) { qs.setCond(5, true); } - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case LYCANTHROPE: - { - if (hasQuestItems(killer, PALLUS_TALISMAN) && (getQuestItemsCount(killer, LYCANTHROPE_SKULL) < 13)) - { + case LYCANTHROPE: { + if (hasQuestItems(killer, PALLUS_TALISMAN) && (getQuestItemsCount(killer, LYCANTHROPE_SKULL) < 13)) { giveItems(killer, LYCANTHROPE_SKULL, 1); - if (getQuestItemsCount(killer, LYCANTHROPE_SKULL) == 13) - { + if (getQuestItemsCount(killer, LYCANTHROPE_SKULL) == 13) { qs.setCond(2, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -212,93 +171,58 @@ public final class Q00410_PathOfThePalusKnight extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated() || qs.isCompleted()) - { - if (npc.getId() == MASTER_VIRGIL) - { + if (qs.isCreated() || qs.isCompleted()) { + if (npc.getId() == MASTER_VIRGIL) { htmltext = "30329-01.htm"; } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case MASTER_VIRGIL: - { - if (hasQuestItems(player, PALLUS_TALISMAN)) - { - if (!hasQuestItems(player, LYCANTHROPE_SKULL)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case MASTER_VIRGIL: { + if (hasQuestItems(player, PALLUS_TALISMAN)) { + if (!hasQuestItems(player, LYCANTHROPE_SKULL)) { htmltext = "30329-07.html"; - } - else if (hasQuestItems(player, LYCANTHROPE_SKULL) && (getQuestItemsCount(player, LYCANTHROPE_SKULL) < 13)) - { + } else if (hasQuestItems(player, LYCANTHROPE_SKULL) && (getQuestItemsCount(player, LYCANTHROPE_SKULL) < 13)) { htmltext = "30329-08.html"; - } - else - { + } else { htmltext = "30329-09.html"; } - } - else if (hasQuestItems(player, COFFIN_OF_ETERNAL_REST)) - { + } else if (hasQuestItems(player, COFFIN_OF_ETERNAL_REST)) { giveAdena(player, 163800, true); giveItems(player, GAZE_OF_ABYSS, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 320534, 26212); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 456128, 32910); - } - else - { + } else { addExpAndSp(player, 591724, 39608); } qs.exitQuest(false, true); player.sendPacket(new SocialAction(player.getObjectId(), 3)); qs.saveGlobalQuestVar("1ClassQuestFinished", "1"); htmltext = "30329-11.html"; - } - else if (hasAtLeastOneQuestItem(player, VIRGILS_LETTER, MORTE_TALISMAN)) - { + } else if (hasAtLeastOneQuestItem(player, VIRGILS_LETTER, MORTE_TALISMAN)) { htmltext = "30329-12.html"; } break; } - case KALINTA: - { - if (hasQuestItems(player, VIRGILS_LETTER)) - { + case KALINTA: { + if (hasQuestItems(player, VIRGILS_LETTER)) { htmltext = "30422-01.html"; - } - else if (hasQuestItems(player, MORTE_TALISMAN)) - { - if (!hasQuestItems(player, ARACHNID_TRACKER_SILK, VENOMOUS_SPIDERS_CARAPACE)) - { + } else if (hasQuestItems(player, MORTE_TALISMAN)) { + if (!hasQuestItems(player, ARACHNID_TRACKER_SILK, VENOMOUS_SPIDERS_CARAPACE)) { htmltext = "30422-03.html"; - } - else if (!hasQuestItems(player, ARACHNID_TRACKER_SILK) && hasQuestItems(player, VENOMOUS_SPIDERS_CARAPACE)) - { + } else if (!hasQuestItems(player, ARACHNID_TRACKER_SILK) && hasQuestItems(player, VENOMOUS_SPIDERS_CARAPACE)) { htmltext = "30422-04.html"; - } - else if ((getQuestItemsCount(player, ARACHNID_TRACKER_SILK) >= 5) && hasQuestItems(player, VENOMOUS_SPIDERS_CARAPACE)) - { + } else if ((getQuestItemsCount(player, ARACHNID_TRACKER_SILK) >= 5) && hasQuestItems(player, VENOMOUS_SPIDERS_CARAPACE)) { htmltext = "30422-05.html"; - } - else if (hasQuestItems(player, ARACHNID_TRACKER_SILK, VENOMOUS_SPIDERS_CARAPACE)) - { + } else if (hasQuestItems(player, ARACHNID_TRACKER_SILK, VENOMOUS_SPIDERS_CARAPACE)) { htmltext = "30422-04.html"; } - } - else if (hasQuestItems(player, COFFIN_OF_ETERNAL_REST)) - { + } else if (hasQuestItems(player, COFFIN_OF_ETERNAL_REST)) { htmltext = "30422-06.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00411_PathOfTheAssassin/Q00411_PathOfTheAssassin.java b/src/main/java/com/l2jserver/datapack/quests/Q00411_PathOfTheAssassin/Q00411_PathOfTheAssassin.java index 0b78c4946a..e7e8f57dd0 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00411_PathOfTheAssassin/Q00411_PathOfTheAssassin.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00411_PathOfTheAssassin/Q00411_PathOfTheAssassin.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Path Of The Assassin (411) * @author ivantotov */ -public final class Q00411_PathOfTheAssassin extends Quest -{ +public final class Q00411_PathOfTheAssassin extends Quest { // NPCs private static final int TRISKEL = 30416; private static final int GUARD_LEIKAN = 30382; @@ -53,8 +52,7 @@ public final class Q00411_PathOfTheAssassin extends Quest // Misc private static final int MIN_LEVEL = 18; - public Q00411_PathOfTheAssassin() - { + public Q00411_PathOfTheAssassin() { super(411, Q00411_PathOfTheAssassin.class.getSimpleName(), "Path Of The Assassin"); addStartNpc(TRISKEL); addTalkId(TRISKEL, GUARD_LEIKAN, ARKENIA); @@ -63,59 +61,41 @@ public final class Q00411_PathOfTheAssassin extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (player.getClassId() == ClassId.darkFighter) - { - if (player.getLevel() >= MIN_LEVEL) - { - if (hasQuestItems(player, IRON_HEART)) - { + switch (event) { + case "ACCEPT": { + if (player.getClassId() == ClassId.darkFighter) { + if (player.getLevel() >= MIN_LEVEL) { + if (hasQuestItems(player, IRON_HEART)) { htmltext = "30416-04.htm"; - } - else - { + } else { qs.startQuest(); giveItems(player, SHILENS_CALL, 1); htmltext = "30416-05.htm"; } - } - else - { + } else { htmltext = "30416-03.htm"; } - } - else if (player.getClassId() == ClassId.assassin) - { + } else if (player.getClassId() == ClassId.assassin) { htmltext = "30416-02a.htm"; - } - else - { + } else { htmltext = "30416-02.htm"; } break; } case "30382-02.html": - case "30382-04.html": - { + case "30382-04.html": { htmltext = event; break; } - case "30382-03.html": - { - if (hasQuestItems(player, ARKENIAS_LETTER)) - { + case "30382-03.html": { + if (hasQuestItems(player, ARKENIAS_LETTER)) { takeItems(player, ARKENIAS_LETTER, 1); giveItems(player, LEIKANS_NOTE, 1); qs.setCond(3, true); @@ -126,15 +106,12 @@ public final class Q00411_PathOfTheAssassin extends Quest case "30419-02.html": case "30419-03.html": case "30419-04.html": - case "30419-06.html": - { + case "30419-06.html": { htmltext = event; break; } - case "30419-05.html": - { - if (hasQuestItems(player, SHILENS_CALL)) - { + case "30419-05.html": { + if (hasQuestItems(player, SHILENS_CALL)) { takeItems(player, SHILENS_CALL, 1); giveItems(player, ARKENIAS_LETTER, 1); qs.setCond(2, true); @@ -147,33 +124,23 @@ public final class Q00411_PathOfTheAssassin extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case MOONSTONE_BEAST: - { - if (hasQuestItems(killer, LEIKANS_NOTE) && (getQuestItemsCount(killer, MOONSTONE_BEASTS_MOLAR) < 10)) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case MOONSTONE_BEAST: { + if (hasQuestItems(killer, LEIKANS_NOTE) && (getQuestItemsCount(killer, MOONSTONE_BEASTS_MOLAR) < 10)) { giveItems(killer, MOONSTONE_BEASTS_MOLAR, 1); - if (getQuestItemsCount(killer, MOONSTONE_BEASTS_MOLAR) == 10) - { + if (getQuestItemsCount(killer, MOONSTONE_BEASTS_MOLAR) == 10) { qs.setCond(4, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case CALPICO: - { - if (!hasQuestItems(killer, SHILENS_TEARS)) - { + case CALPICO: { + if (!hasQuestItems(killer, SHILENS_TEARS)) { giveItems(killer, SHILENS_TEARS, 1); qs.setCond(6, true); } @@ -185,135 +152,84 @@ public final class Q00411_PathOfTheAssassin extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated() || qs.isCompleted()) - { - if (npc.getId() == TRISKEL) - { - if (!hasQuestItems(player, IRON_HEART)) - { + if (qs.isCreated() || qs.isCompleted()) { + if (npc.getId() == TRISKEL) { + if (!hasQuestItems(player, IRON_HEART)) { htmltext = "30416-01.htm"; - } - else - { + } else { htmltext = "30416-04.htm"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case TRISKEL: - { - if (!hasAtLeastOneQuestItem(player, ARKENIAS_LETTER, LEIKANS_NOTE, SHILENS_TEARS, IRON_HEART) && hasQuestItems(player, ARKENIAS_RECOMMENDATION)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case TRISKEL: { + if (!hasAtLeastOneQuestItem(player, ARKENIAS_LETTER, LEIKANS_NOTE, SHILENS_TEARS, IRON_HEART) && hasQuestItems(player, ARKENIAS_RECOMMENDATION)) { giveAdena(player, 163800, true); giveItems(player, IRON_HEART, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 320534, 35830); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 456128, 35830); - } - else - { + } else { addExpAndSp(player, 591724, 42528); } qs.exitQuest(false, true); player.sendPacket(new SocialAction(player.getObjectId(), 3)); qs.saveGlobalQuestVar("1ClassQuestFinished", "1"); htmltext = "30416-06.html"; - } - else if (!hasAtLeastOneQuestItem(player, LEIKANS_NOTE, SHILENS_TEARS, ARKENIAS_RECOMMENDATION, IRON_HEART, SHILENS_CALL) && hasQuestItems(player, ARKENIAS_LETTER)) - { + } else if (!hasAtLeastOneQuestItem(player, LEIKANS_NOTE, SHILENS_TEARS, ARKENIAS_RECOMMENDATION, IRON_HEART, SHILENS_CALL) && hasQuestItems(player, ARKENIAS_LETTER)) { htmltext = "30416-07.html"; - } - else if (!hasAtLeastOneQuestItem(player, ARKENIAS_LETTER, SHILENS_TEARS, ARKENIAS_RECOMMENDATION, IRON_HEART, SHILENS_CALL) && hasQuestItems(player, LEIKANS_NOTE)) - { + } else if (!hasAtLeastOneQuestItem(player, ARKENIAS_LETTER, SHILENS_TEARS, ARKENIAS_RECOMMENDATION, IRON_HEART, SHILENS_CALL) && hasQuestItems(player, LEIKANS_NOTE)) { htmltext = "30416-08.html"; - } - else if (!hasAtLeastOneQuestItem(player, ARKENIAS_LETTER, LEIKANS_NOTE, SHILENS_TEARS, ARKENIAS_RECOMMENDATION, IRON_HEART, SHILENS_CALL)) - { + } else if (!hasAtLeastOneQuestItem(player, ARKENIAS_LETTER, LEIKANS_NOTE, SHILENS_TEARS, ARKENIAS_RECOMMENDATION, IRON_HEART, SHILENS_CALL)) { htmltext = "30416-09.html"; - } - else if (!hasAtLeastOneQuestItem(player, ARKENIAS_LETTER, LEIKANS_NOTE, ARKENIAS_RECOMMENDATION, IRON_HEART, SHILENS_CALL) && hasQuestItems(player, SHILENS_TEARS)) - { + } else if (!hasAtLeastOneQuestItem(player, ARKENIAS_LETTER, LEIKANS_NOTE, ARKENIAS_RECOMMENDATION, IRON_HEART, SHILENS_CALL) && hasQuestItems(player, SHILENS_TEARS)) { htmltext = "30416-10.html"; - } - else if (!hasAtLeastOneQuestItem(player, ARKENIAS_LETTER, LEIKANS_NOTE, SHILENS_TEARS, ARKENIAS_RECOMMENDATION, IRON_HEART) && hasQuestItems(player, SHILENS_CALL)) - { + } else if (!hasAtLeastOneQuestItem(player, ARKENIAS_LETTER, LEIKANS_NOTE, SHILENS_TEARS, ARKENIAS_RECOMMENDATION, IRON_HEART) && hasQuestItems(player, SHILENS_CALL)) { htmltext = "30416-11.html"; } break; } - case GUARD_LEIKAN: - { - if (!hasAtLeastOneQuestItem(player, LEIKANS_NOTE, SHILENS_TEARS, ARKENIAS_RECOMMENDATION, IRON_HEART, SHILENS_CALL, MOONSTONE_BEASTS_MOLAR) && hasQuestItems(player, ARKENIAS_LETTER)) - { + case GUARD_LEIKAN: { + if (!hasAtLeastOneQuestItem(player, LEIKANS_NOTE, SHILENS_TEARS, ARKENIAS_RECOMMENDATION, IRON_HEART, SHILENS_CALL, MOONSTONE_BEASTS_MOLAR) && hasQuestItems(player, ARKENIAS_LETTER)) { htmltext = "30382-01.html"; - } - else if (!hasAtLeastOneQuestItem(player, ARKENIAS_LETTER, SHILENS_TEARS, ARKENIAS_RECOMMENDATION, IRON_HEART, SHILENS_CALL, MOONSTONE_BEASTS_MOLAR) && hasQuestItems(player, LEIKANS_NOTE)) - { + } else if (!hasAtLeastOneQuestItem(player, ARKENIAS_LETTER, SHILENS_TEARS, ARKENIAS_RECOMMENDATION, IRON_HEART, SHILENS_CALL, MOONSTONE_BEASTS_MOLAR) && hasQuestItems(player, LEIKANS_NOTE)) { htmltext = "30382-05.html"; - } - else if (!hasAtLeastOneQuestItem(player, ARKENIAS_LETTER, SHILENS_TEARS, ARKENIAS_RECOMMENDATION, IRON_HEART, SHILENS_CALL) && hasQuestItems(player, LEIKANS_NOTE)) - { - if (hasQuestItems(player, MOONSTONE_BEASTS_MOLAR) && (getQuestItemsCount(player, MOONSTONE_BEASTS_MOLAR) < 10)) - { + } else if (!hasAtLeastOneQuestItem(player, ARKENIAS_LETTER, SHILENS_TEARS, ARKENIAS_RECOMMENDATION, IRON_HEART, SHILENS_CALL) && hasQuestItems(player, LEIKANS_NOTE)) { + if (hasQuestItems(player, MOONSTONE_BEASTS_MOLAR) && (getQuestItemsCount(player, MOONSTONE_BEASTS_MOLAR) < 10)) { htmltext = "30382-06.html"; - } - else - { + } else { takeItems(player, LEIKANS_NOTE, 1); takeItems(player, MOONSTONE_BEASTS_MOLAR, -1); qs.setCond(5, true); htmltext = "30382-07.html"; } - } - else if (hasQuestItems(player, SHILENS_TEARS)) - { + } else if (hasQuestItems(player, SHILENS_TEARS)) { htmltext = "30382-08.html"; - } - else if (!hasAtLeastOneQuestItem(player, ARKENIAS_LETTER, LEIKANS_NOTE, SHILENS_TEARS, ARKENIAS_RECOMMENDATION, IRON_HEART, SHILENS_CALL, MOONSTONE_BEASTS_MOLAR)) - { + } else if (!hasAtLeastOneQuestItem(player, ARKENIAS_LETTER, LEIKANS_NOTE, SHILENS_TEARS, ARKENIAS_RECOMMENDATION, IRON_HEART, SHILENS_CALL, MOONSTONE_BEASTS_MOLAR)) { htmltext = "30382-09.html"; } break; } - case ARKENIA: - { - if (!hasAtLeastOneQuestItem(player, ARKENIAS_LETTER, LEIKANS_NOTE, SHILENS_TEARS, ARKENIAS_RECOMMENDATION, IRON_HEART) && hasQuestItems(player, SHILENS_CALL)) - { + case ARKENIA: { + if (!hasAtLeastOneQuestItem(player, ARKENIAS_LETTER, LEIKANS_NOTE, SHILENS_TEARS, ARKENIAS_RECOMMENDATION, IRON_HEART) && hasQuestItems(player, SHILENS_CALL)) { htmltext = "30419-01.html"; - } - else if (!hasAtLeastOneQuestItem(player, LEIKANS_NOTE, SHILENS_TEARS, ARKENIAS_RECOMMENDATION, IRON_HEART, SHILENS_CALL) && hasQuestItems(player, ARKENIAS_LETTER)) - { + } else if (!hasAtLeastOneQuestItem(player, LEIKANS_NOTE, SHILENS_TEARS, ARKENIAS_RECOMMENDATION, IRON_HEART, SHILENS_CALL) && hasQuestItems(player, ARKENIAS_LETTER)) { htmltext = "30419-07.html"; - } - else if (!hasAtLeastOneQuestItem(player, ARKENIAS_LETTER, LEIKANS_NOTE, ARKENIAS_RECOMMENDATION, IRON_HEART, SHILENS_CALL) && hasQuestItems(player, SHILENS_TEARS)) - { + } else if (!hasAtLeastOneQuestItem(player, ARKENIAS_LETTER, LEIKANS_NOTE, ARKENIAS_RECOMMENDATION, IRON_HEART, SHILENS_CALL) && hasQuestItems(player, SHILENS_TEARS)) { takeItems(player, SHILENS_TEARS, 1); giveItems(player, ARKENIAS_RECOMMENDATION, 1); qs.setCond(7, true); htmltext = "30419-08.html"; - } - else if (!hasAtLeastOneQuestItem(player, ARKENIAS_LETTER, LEIKANS_NOTE, SHILENS_TEARS, IRON_HEART, SHILENS_CALL) && hasQuestItems(player, ARKENIAS_RECOMMENDATION)) - { + } else if (!hasAtLeastOneQuestItem(player, ARKENIAS_LETTER, LEIKANS_NOTE, SHILENS_TEARS, IRON_HEART, SHILENS_CALL) && hasQuestItems(player, ARKENIAS_RECOMMENDATION)) { htmltext = "30419-09.html"; - } - else if (!hasAtLeastOneQuestItem(player, ARKENIAS_LETTER, SHILENS_TEARS, ARKENIAS_RECOMMENDATION, IRON_HEART, SHILENS_CALL) && hasQuestItems(player, LEIKANS_NOTE)) - { + } else if (!hasAtLeastOneQuestItem(player, ARKENIAS_LETTER, SHILENS_TEARS, ARKENIAS_RECOMMENDATION, IRON_HEART, SHILENS_CALL) && hasQuestItems(player, LEIKANS_NOTE)) { htmltext = "30419-10.html"; - } - else if (!hasAtLeastOneQuestItem(player, ARKENIAS_LETTER, LEIKANS_NOTE, SHILENS_TEARS, ARKENIAS_RECOMMENDATION, IRON_HEART, SHILENS_CALL)) - { + } else if (!hasAtLeastOneQuestItem(player, ARKENIAS_LETTER, LEIKANS_NOTE, SHILENS_TEARS, ARKENIAS_RECOMMENDATION, IRON_HEART, SHILENS_CALL)) { htmltext = "30419-11.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00412_PathOfTheDarkWizard/Q00412_PathOfTheDarkWizard.java b/src/main/java/com/l2jserver/datapack/quests/Q00412_PathOfTheDarkWizard/Q00412_PathOfTheDarkWizard.java index cd043f8793..79ad4bcc61 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00412_PathOfTheDarkWizard/Q00412_PathOfTheDarkWizard.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00412_PathOfTheDarkWizard/Q00412_PathOfTheDarkWizard.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Path Of The Dark Wizard (412) * @author ivantotov */ -public final class Q00412_PathOfTheDarkWizard extends Quest -{ +public final class Q00412_PathOfTheDarkWizard extends Quest { // NPCs private static final int CHARKEREN = 30415; private static final int ANNIKA = 30418; @@ -60,8 +59,7 @@ public final class Q00412_PathOfTheDarkWizard extends Quest // Misc private static final int MIN_LEVEL = 18; - public Q00412_PathOfTheDarkWizard() - { + public Q00412_PathOfTheDarkWizard() { super(412, Q00412_PathOfTheDarkWizard.class.getSimpleName(), "Path Of The Dark Wizard"); addStartNpc(VARIKA); addTalkId(VARIKA, CHARKEREN, ANNIKA, ARKENIA); @@ -70,99 +68,69 @@ public final class Q00412_PathOfTheDarkWizard extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (player.getClassId() == ClassId.darkMage) - { - if (player.getLevel() >= MIN_LEVEL) - { - if (hasQuestItems(player, JEWEL_OF_DARKNESS)) - { + switch (event) { + case "ACCEPT": { + if (player.getClassId() == ClassId.darkMage) { + if (player.getLevel() >= MIN_LEVEL) { + if (hasQuestItems(player, JEWEL_OF_DARKNESS)) { htmltext = "30421-04.htm"; - } - else - { + } else { qs.startQuest(); giveItems(player, SEEDS_OF_DESPAIR, 1); htmltext = "30421-05.htm"; } - } - else - { + } else { htmltext = "30421-02.htm"; } - } - else if (player.getClassId() == ClassId.darkWizard) - { + } else if (player.getClassId() == ClassId.darkWizard) { htmltext = "30421-02a.htm"; - } - else - { + } else { htmltext = "30421-03.htm"; } break; } - case "30421-06.html": - { - if (hasQuestItems(player, SEEDS_OF_ANGER)) - { + case "30421-06.html": { + if (hasQuestItems(player, SEEDS_OF_ANGER)) { htmltext = event; - } - else - { + } else { htmltext = "30421-07.html"; } break; } - case "30421-09.html": - { - if (hasQuestItems(player, SEEDS_OF_HORROR)) - { + case "30421-09.html": { + if (hasQuestItems(player, SEEDS_OF_HORROR)) { htmltext = event; - } - else - { + } else { htmltext = "30421-10.html"; } break; } - case "30421-11.html": - { - if (hasQuestItems(player, SEEDS_OF_LUNACY)) - { + case "30421-11.html": { + if (hasQuestItems(player, SEEDS_OF_LUNACY)) { htmltext = event; - } - else if (!hasQuestItems(player, SEEDS_OF_LUNACY) && hasQuestItems(player, SEEDS_OF_DESPAIR)) - { + } else if (!hasQuestItems(player, SEEDS_OF_LUNACY) && hasQuestItems(player, SEEDS_OF_DESPAIR)) { htmltext = "30421-12.html"; } break; } case "30421-08.html": - case "30415-02.html": - { + case "30415-02.html": { htmltext = event; break; } - case "30415-03.html": - { + case "30415-03.html": { giveItems(player, LUCKY_KEY, 1); htmltext = event; break; } - case "30418-02.html": - { + case "30418-02.html": { giveItems(player, CANDLE, 1); htmltext = event; break; @@ -172,26 +140,17 @@ public final class Q00412_PathOfTheDarkWizard extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case MARSH_ZOMBIE: - { - if (hasQuestItems(killer, LUCKY_KEY) && (getQuestItemsCount(killer, FAMILYS_REMAINS) < 3)) - { - if (getRandom(2) == 0) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case MARSH_ZOMBIE: { + if (hasQuestItems(killer, LUCKY_KEY) && (getQuestItemsCount(killer, FAMILYS_REMAINS) < 3)) { + if (getRandom(2) == 0) { giveItems(killer, FAMILYS_REMAINS, 1); - if (getQuestItemsCount(killer, FAMILYS_REMAINS) == 3) - { + if (getQuestItemsCount(killer, FAMILYS_REMAINS) == 3) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -200,38 +159,26 @@ public final class Q00412_PathOfTheDarkWizard extends Quest } case MISERY_SKELETON: case SKELETON_HUNTER: - case SKELETON_HUNTER_ARCHER: - { - if (hasQuestItems(killer, CANDLE) && (getQuestItemsCount(killer, KNEE_BONE) < 2)) - { - if (getRandom(2) == 0) - { + case SKELETON_HUNTER_ARCHER: { + if (hasQuestItems(killer, CANDLE) && (getQuestItemsCount(killer, KNEE_BONE) < 2)) { + if (getRandom(2) == 0) { giveItems(killer, KNEE_BONE, 1); - if (getQuestItemsCount(killer, KNEE_BONE) == 2) - { + if (getQuestItemsCount(killer, KNEE_BONE) == 2) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case SKELETON_SCOUT: - { - if (hasQuestItems(killer, HUB_SCENT) && (getQuestItemsCount(killer, HEART_OF_LUNACY) < 3)) - { - if (getRandom(2) == 0) - { + case SKELETON_SCOUT: { + if (hasQuestItems(killer, HUB_SCENT) && (getQuestItemsCount(killer, HEART_OF_LUNACY) < 3)) { + if (getRandom(2) == 0) { giveItems(killer, HEART_OF_LUNACY, 1); - if (getQuestItemsCount(killer, HEART_OF_LUNACY) == 3) - { + if (getQuestItemsCount(killer, HEART_OF_LUNACY) == 3) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -244,113 +191,72 @@ public final class Q00412_PathOfTheDarkWizard extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated() || qs.isCompleted()) - { - if (npc.getId() == VARIKA) - { - if (!hasQuestItems(player, JEWEL_OF_DARKNESS)) - { + if (qs.isCreated() || qs.isCompleted()) { + if (npc.getId() == VARIKA) { + if (!hasQuestItems(player, JEWEL_OF_DARKNESS)) { htmltext = "30421-01.htm"; - } - else - { + } else { htmltext = "30421-04.htm"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case VARIKA: - { - if (hasQuestItems(player, SEEDS_OF_DESPAIR, SEEDS_OF_HORROR, SEEDS_OF_LUNACY, SEEDS_OF_ANGER)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case VARIKA: { + if (hasQuestItems(player, SEEDS_OF_DESPAIR, SEEDS_OF_HORROR, SEEDS_OF_LUNACY, SEEDS_OF_ANGER)) { giveAdena(player, 163800, true); giveItems(player, JEWEL_OF_DARKNESS, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 320534, 28630); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 456128, 28630); - } - else - { + } else { addExpAndSp(player, 591724, 35328); } qs.exitQuest(false, true); player.sendPacket(new SocialAction(player.getObjectId(), 3)); qs.saveGlobalQuestVar("1ClassQuestFinished", "1"); htmltext = "30421-13.html"; - } - else if (hasQuestItems(player, SEEDS_OF_DESPAIR)) - { - if (!hasAtLeastOneQuestItem(player, FAMILYS_REMAINS, LUCKY_KEY, CANDLE, HUB_SCENT, KNEE_BONE, HEART_OF_LUNACY)) - { + } else if (hasQuestItems(player, SEEDS_OF_DESPAIR)) { + if (!hasAtLeastOneQuestItem(player, FAMILYS_REMAINS, LUCKY_KEY, CANDLE, HUB_SCENT, KNEE_BONE, HEART_OF_LUNACY)) { htmltext = "30421-14.html"; - } - else if (!hasQuestItems(player, SEEDS_OF_ANGER)) - { + } else if (!hasQuestItems(player, SEEDS_OF_ANGER)) { htmltext = "30421-08.html"; - } - else if (!hasQuestItems(player, SEEDS_OF_HORROR)) - { + } else if (!hasQuestItems(player, SEEDS_OF_HORROR)) { htmltext = "30421-15.html"; - } - else if (!hasQuestItems(player, SEEDS_OF_LUNACY)) - { + } else if (!hasQuestItems(player, SEEDS_OF_LUNACY)) { htmltext = "30421-12.html"; } } break; } - case CHARKEREN: - { - if (!hasQuestItems(player, SEEDS_OF_ANGER) && hasQuestItems(player, SEEDS_OF_DESPAIR)) - { - if (!hasAtLeastOneQuestItem(player, FAMILYS_REMAINS, LUCKY_KEY)) - { + case CHARKEREN: { + if (!hasQuestItems(player, SEEDS_OF_ANGER) && hasQuestItems(player, SEEDS_OF_DESPAIR)) { + if (!hasAtLeastOneQuestItem(player, FAMILYS_REMAINS, LUCKY_KEY)) { htmltext = "30415-01.html"; - } - else if (hasQuestItems(player, LUCKY_KEY) && (getQuestItemsCount(player, FAMILYS_REMAINS) < 3)) - { + } else if (hasQuestItems(player, LUCKY_KEY) && (getQuestItemsCount(player, FAMILYS_REMAINS) < 3)) { htmltext = "30415-04.html"; - } - else - { + } else { giveItems(player, SEEDS_OF_ANGER, 1); takeItems(player, FAMILYS_REMAINS, -1); takeItems(player, LUCKY_KEY, 1); htmltext = "30415-05.html"; } - } - else - { + } else { htmltext = "30415-06.html"; } break; } - case ANNIKA: - { - if (!hasQuestItems(player, SEEDS_OF_HORROR) && hasQuestItems(player, SEEDS_OF_DESPAIR)) - { - if (!hasAtLeastOneQuestItem(player, CANDLE, KNEE_BONE)) - { + case ANNIKA: { + if (!hasQuestItems(player, SEEDS_OF_HORROR) && hasQuestItems(player, SEEDS_OF_DESPAIR)) { + if (!hasAtLeastOneQuestItem(player, CANDLE, KNEE_BONE)) { htmltext = "30418-01.html"; - } - else if (hasQuestItems(player, CANDLE) && (getQuestItemsCount(player, KNEE_BONE) < 2)) - { + } else if (hasQuestItems(player, CANDLE) && (getQuestItemsCount(player, KNEE_BONE) < 2)) { htmltext = "30418-03.html"; - } - else - { + } else { giveItems(player, SEEDS_OF_HORROR, 1); takeItems(player, KNEE_BONE, -1); takeItems(player, CANDLE, 1); @@ -359,21 +265,14 @@ public final class Q00412_PathOfTheDarkWizard extends Quest } break; } - case ARKENIA: - { - if (!hasQuestItems(player, SEEDS_OF_LUNACY)) - { - if (!hasAtLeastOneQuestItem(player, HUB_SCENT, HEART_OF_LUNACY)) - { + case ARKENIA: { + if (!hasQuestItems(player, SEEDS_OF_LUNACY)) { + if (!hasAtLeastOneQuestItem(player, HUB_SCENT, HEART_OF_LUNACY)) { giveItems(player, HUB_SCENT, 1); htmltext = "30419-01.html"; - } - else if (hasQuestItems(player, HUB_SCENT) && (getQuestItemsCount(player, HEART_OF_LUNACY) < 3)) - { + } else if (hasQuestItems(player, HUB_SCENT) && (getQuestItemsCount(player, HEART_OF_LUNACY) < 3)) { htmltext = "30419-02.html"; - } - else - { + } else { giveItems(player, SEEDS_OF_LUNACY, 1); takeItems(player, HEART_OF_LUNACY, -1); takeItems(player, HUB_SCENT, 1); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00413_PathOfTheShillienOracle/Q00413_PathOfTheShillienOracle.java b/src/main/java/com/l2jserver/datapack/quests/Q00413_PathOfTheShillienOracle/Q00413_PathOfTheShillienOracle.java index 7c4389e2bc..488effab52 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00413_PathOfTheShillienOracle/Q00413_PathOfTheShillienOracle.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00413_PathOfTheShillienOracle/Q00413_PathOfTheShillienOracle.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Path Of The Shillien Oracle (413) * @author ivantotov */ -public final class Q00413_PathOfTheShillienOracle extends Quest -{ +public final class Q00413_PathOfTheShillienOracle extends Quest { // NPCs private static final int MAGISTER_SIDRA = 30330; private static final int PRIEST_ADONIUS = 30375; @@ -57,8 +56,7 @@ public final class Q00413_PathOfTheShillienOracle extends Quest // Misc private static final int MIN_LEVEL = 18; - public Q00413_PathOfTheShillienOracle() - { + public Q00413_PathOfTheShillienOracle() { super(413, Q00413_PathOfTheShillienOracle.class.getSimpleName(), "Path of the Shillien Oracle"); addStartNpc(MAGISTER_SIDRA); addTalkId(MAGISTER_SIDRA, PRIEST_ADONIUS, MAGISTER_TALBOT); @@ -67,51 +65,34 @@ public final class Q00413_PathOfTheShillienOracle extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (player.getClassId() == ClassId.darkMage) - { - if (player.getLevel() >= MIN_LEVEL) - { - if (hasQuestItems(player, ORB_OF_ABYSS)) - { + switch (event) { + case "ACCEPT": { + if (player.getClassId() == ClassId.darkMage) { + if (player.getLevel() >= MIN_LEVEL) { + if (hasQuestItems(player, ORB_OF_ABYSS)) { htmltext = "30330-04.htm"; - } - else - { + } else { htmltext = "30330-05.htm"; } - } - else - { + } else { htmltext = "30330-02.htm"; } - } - else if (player.getClassId() == ClassId.shillienOracle) - { + } else if (player.getClassId() == ClassId.shillienOracle) { htmltext = "30330-02a.htm"; - } - else - { + } else { htmltext = "30330-03.htm"; } break; } - case "30330-06.htm": - { - if (!hasQuestItems(player, SIDRAS_LETTER)) - { + case "30330-06.htm": { + if (!hasQuestItems(player, SIDRAS_LETTER)) { giveItems(player, SIDRAS_LETTER, 1); } qs.startQuest(); @@ -120,15 +101,12 @@ public final class Q00413_PathOfTheShillienOracle extends Quest } case "30330-06a.html": case "30375-02.html": - case "30375-03.html": - { + case "30375-03.html": { htmltext = event; break; } - case "30375-04.html": - { - if (hasQuestItems(player, PRAYER_OF_ADONIUS)) - { + case "30375-04.html": { + if (hasQuestItems(player, PRAYER_OF_ADONIUS)) { takeItems(player, PRAYER_OF_ADONIUS, 1); giveItems(player, PENITENTS_MARK, 1); qs.setCond(5, true); @@ -136,10 +114,8 @@ public final class Q00413_PathOfTheShillienOracle extends Quest htmltext = event; break; } - case "30377-02.html": - { - if (hasQuestItems(player, SIDRAS_LETTER)) - { + case "30377-02.html": { + if (hasQuestItems(player, SIDRAS_LETTER)) { takeItems(player, SIDRAS_LETTER, 1); giveItems(player, BLANK_SHEET, 5); qs.setCond(2, true); @@ -152,44 +128,31 @@ public final class Q00413_PathOfTheShillienOracle extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { case ZOMBIE_SOLDIER: case ZOMBIE_WARRIOR: case SHIELD_SKELETON: - case SKELETON_INFANTRYMAN: - { - if (hasQuestItems(killer, PENITENTS_MARK) && (getQuestItemsCount(killer, ASHEN_BONES) < 10)) - { + case SKELETON_INFANTRYMAN: { + if (hasQuestItems(killer, PENITENTS_MARK) && (getQuestItemsCount(killer, ASHEN_BONES) < 10)) { giveItems(killer, ASHEN_BONES, 1); - if (getQuestItemsCount(killer, ASHEN_BONES) == 10) - { + if (getQuestItemsCount(killer, ASHEN_BONES) == 10) { qs.setCond(6, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case DARK_SUCCUBUS: - { - if (hasQuestItems(killer, BLANK_SHEET)) - { + case DARK_SUCCUBUS: { + if (hasQuestItems(killer, BLANK_SHEET)) { giveItems(killer, BLOODY_RUNE, 1); takeItems(killer, BLANK_SHEET, 1); - if (!hasQuestItems(killer, BLANK_SHEET) && (getQuestItemsCount(killer, BLOODY_RUNE) == 5)) - { + if (!hasQuestItems(killer, BLANK_SHEET) && (getQuestItemsCount(killer, BLOODY_RUNE) == 5)) { qs.setCond(3, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -201,50 +164,31 @@ public final class Q00413_PathOfTheShillienOracle extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated() || qs.isCompleted()) - { - if (npc.getId() == MAGISTER_SIDRA) - { + if (qs.isCreated() || qs.isCompleted()) { + if (npc.getId() == MAGISTER_SIDRA) { htmltext = "30330-01.htm"; } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case MAGISTER_SIDRA: - { - if (hasQuestItems(player, SIDRAS_LETTER)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case MAGISTER_SIDRA: { + if (hasQuestItems(player, SIDRAS_LETTER)) { htmltext = "30330-07.html"; - } - else if (hasAtLeastOneQuestItem(player, BLANK_SHEET, BLOODY_RUNE)) - { + } else if (hasAtLeastOneQuestItem(player, BLANK_SHEET, BLOODY_RUNE)) { htmltext = "30330-08.html"; - } - else if (!hasQuestItems(player, ANDARIEL_BOOK) && hasAtLeastOneQuestItem(player, PRAYER_OF_ADONIUS, GARMIELS_BOOK, PENITENTS_MARK, ASHEN_BONES)) - { + } else if (!hasQuestItems(player, ANDARIEL_BOOK) && hasAtLeastOneQuestItem(player, PRAYER_OF_ADONIUS, GARMIELS_BOOK, PENITENTS_MARK, ASHEN_BONES)) { htmltext = "30330-09.html"; - } - else if (hasAtLeastOneQuestItem(player, ANDARIEL_BOOK, GARMIELS_BOOK)) - { + } else if (hasAtLeastOneQuestItem(player, ANDARIEL_BOOK, GARMIELS_BOOK)) { giveAdena(player, 163800, true); giveItems(player, ORB_OF_ABYSS, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 320534, 26532); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 456128, 33230); - } - else - { + } else { addExpAndSp(player, 591724, 39928); } qs.exitQuest(false, true); @@ -254,65 +198,42 @@ public final class Q00413_PathOfTheShillienOracle extends Quest } break; } - case PRIEST_ADONIUS: - { - if (hasQuestItems(player, PRAYER_OF_ADONIUS)) - { + case PRIEST_ADONIUS: { + if (hasQuestItems(player, PRAYER_OF_ADONIUS)) { htmltext = "30375-01.html"; - } - else if (hasQuestItems(player, PENITENTS_MARK) && !hasAtLeastOneQuestItem(player, ASHEN_BONES, ANDARIEL_BOOK)) - { + } else if (hasQuestItems(player, PENITENTS_MARK) && !hasAtLeastOneQuestItem(player, ASHEN_BONES, ANDARIEL_BOOK)) { htmltext = "30375-05.html"; - } - else if (hasQuestItems(player, PENITENTS_MARK)) - { - if (hasQuestItems(player, ASHEN_BONES) && (getQuestItemsCount(player, ASHEN_BONES) < 10)) - { + } else if (hasQuestItems(player, PENITENTS_MARK)) { + if (hasQuestItems(player, ASHEN_BONES) && (getQuestItemsCount(player, ASHEN_BONES) < 10)) { htmltext = "30375-06.html"; - } - else - { + } else { takeItems(player, PENITENTS_MARK, 1); takeItems(player, ASHEN_BONES, -1); giveItems(player, ANDARIEL_BOOK, 1); qs.setCond(7, true); htmltext = "30375-07.html"; } - } - else if (hasQuestItems(player, ANDARIEL_BOOK)) - { + } else if (hasQuestItems(player, ANDARIEL_BOOK)) { htmltext = "30375-08.html"; } break; } - case MAGISTER_TALBOT: - { - if (hasQuestItems(player, SIDRAS_LETTER)) - { + case MAGISTER_TALBOT: { + if (hasQuestItems(player, SIDRAS_LETTER)) { htmltext = "30377-01.html"; - } - else if (!hasQuestItems(player, BLOODY_RUNE) && (getQuestItemsCount(player, BLANK_SHEET) == 5)) - { + } else if (!hasQuestItems(player, BLOODY_RUNE) && (getQuestItemsCount(player, BLANK_SHEET) == 5)) { htmltext = "30377-03.html"; - } - else if (hasQuestItems(player, BLOODY_RUNE) && (getQuestItemsCount(player, BLOODY_RUNE) < 5)) - { + } else if (hasQuestItems(player, BLOODY_RUNE) && (getQuestItemsCount(player, BLOODY_RUNE) < 5)) { htmltext = "30377-04.html"; - } - else if (getQuestItemsCount(player, BLOODY_RUNE) >= 5) - { + } else if (getQuestItemsCount(player, BLOODY_RUNE) >= 5) { takeItems(player, BLOODY_RUNE, -1); giveItems(player, GARMIELS_BOOK, 1); giveItems(player, PRAYER_OF_ADONIUS, 1); qs.setCond(4, true); htmltext = "30377-05.html"; - } - else if (hasAtLeastOneQuestItem(player, PRAYER_OF_ADONIUS, PENITENTS_MARK, ASHEN_BONES)) - { + } else if (hasAtLeastOneQuestItem(player, PRAYER_OF_ADONIUS, PENITENTS_MARK, ASHEN_BONES)) { htmltext = "30377-06.html"; - } - else if (hasQuestItems(player, ANDARIEL_BOOK, GARMIELS_BOOK)) - { + } else if (hasQuestItems(player, ANDARIEL_BOOK, GARMIELS_BOOK)) { htmltext = "30377-07.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00414_PathOfTheOrcRaider/Q00414_PathOfTheOrcRaider.java b/src/main/java/com/l2jserver/datapack/quests/Q00414_PathOfTheOrcRaider/Q00414_PathOfTheOrcRaider.java index f7c3e7f534..2651c8c8f7 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00414_PathOfTheOrcRaider/Q00414_PathOfTheOrcRaider.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00414_PathOfTheOrcRaider/Q00414_PathOfTheOrcRaider.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Path Of The Orc Raider (414) * @author ivantotov */ -public final class Q00414_PathOfTheOrcRaider extends Quest -{ +public final class Q00414_PathOfTheOrcRaider extends Quest { // NPCs private static final int PREFECT_KARUKIA = 30570; private static final int PREFRCT_KASMAN = 30501; @@ -56,8 +55,7 @@ public final class Q00414_PathOfTheOrcRaider extends Quest // Misc private static final int MIN_LEVEL = 18; - public Q00414_PathOfTheOrcRaider() - { + public Q00414_PathOfTheOrcRaider() { super(414, Q00414_PathOfTheOrcRaider.class.getSimpleName(), "Path Of The Orc Raider"); addStartNpc(PREFECT_KARUKIA); addTalkId(PREFECT_KARUKIA, PREFRCT_KASMAN, PREFRCT_TAZEER); @@ -66,56 +64,38 @@ public final class Q00414_PathOfTheOrcRaider extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (player.getClassId() == ClassId.orcFighter) - { - if (player.getLevel() >= MIN_LEVEL) - { - if (hasQuestItems(player, MARK_OF_RAIDER)) - { + switch (event) { + case "ACCEPT": { + if (player.getClassId() == ClassId.orcFighter) { + if (player.getLevel() >= MIN_LEVEL) { + if (hasQuestItems(player, MARK_OF_RAIDER)) { htmltext = "30570-04.htm"; - } - else - { - if (!hasQuestItems(player, GOBLIN_DWELLING_MAP)) - { + } else { + if (!hasQuestItems(player, GOBLIN_DWELLING_MAP)) { giveItems(player, GOBLIN_DWELLING_MAP, 1); } qs.startQuest(); htmltext = "30570-05.htm"; } - } - else - { + } else { htmltext = "30570-02.htm"; } - } - else if (player.getClassId() == ClassId.orcRaider) - { + } else if (player.getClassId() == ClassId.orcRaider) { htmltext = "30570-02a.htm"; - } - else - { + } else { htmltext = "30570-03.htm"; } break; } - case "30570-07a.html": - { - if (hasQuestItems(player, GOBLIN_DWELLING_MAP) && (getQuestItemsCount(player, KURUKA_RATMAN_TOOTH) >= 10)) - { + case "30570-07a.html": { + if (hasQuestItems(player, GOBLIN_DWELLING_MAP) && (getQuestItemsCount(player, KURUKA_RATMAN_TOOTH) >= 10)) { takeItems(player, GOBLIN_DWELLING_MAP, 1); takeItems(player, KURUKA_RATMAN_TOOTH, -1); giveItems(player, BETRAYER_UMBAR_REPORT, 1); @@ -125,10 +105,8 @@ public final class Q00414_PathOfTheOrcRaider extends Quest } break; } - case "30570-07b.html": - { - if (hasQuestItems(player, GOBLIN_DWELLING_MAP) && (getQuestItemsCount(player, KURUKA_RATMAN_TOOTH) >= 10)) - { + case "30570-07b.html": { + if (hasQuestItems(player, GOBLIN_DWELLING_MAP) && (getQuestItemsCount(player, KURUKA_RATMAN_TOOTH) >= 10)) { takeItems(player, GOBLIN_DWELLING_MAP, 1); takeItems(player, KURUKA_RATMAN_TOOTH, -1); qs.setCond(5, true); @@ -137,18 +115,14 @@ public final class Q00414_PathOfTheOrcRaider extends Quest } break; } - case "31978-04.html": - { - if (qs.isMemoState(2)) - { + case "31978-04.html": { + if (qs.isMemoState(2)) { htmltext = event; } break; } - case "31978-02.html": - { - if (qs.isMemoState(2)) - { + case "31978-02.html": { + if (qs.isMemoState(2)) { qs.setMemoState(3); qs.setCond(6, true); htmltext = event; @@ -160,78 +134,54 @@ public final class Q00414_PathOfTheOrcRaider extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case GOBLIN_TOMB_RAIDER_LEADER: - { - if (hasQuestItems(killer, GOBLIN_DWELLING_MAP) && (getQuestItemsCount(killer, KURUKA_RATMAN_TOOTH) < 10) && (getQuestItemsCount(killer, GREEN_BLOOD) <= 20)) - { - if (getRandom(100) < (getQuestItemsCount(killer, GREEN_BLOOD) * 5)) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case GOBLIN_TOMB_RAIDER_LEADER: { + if (hasQuestItems(killer, GOBLIN_DWELLING_MAP) && (getQuestItemsCount(killer, KURUKA_RATMAN_TOOTH) < 10) && (getQuestItemsCount(killer, GREEN_BLOOD) <= 20)) { + if (getRandom(100) < (getQuestItemsCount(killer, GREEN_BLOOD) * 5)) { takeItems(killer, GREEN_BLOOD, -1); addAttackDesire(addSpawn(KURUKA_RATMAN_LEADER, npc, true, 0, true), killer); - } - else - { + } else { giveItems(killer, GREEN_BLOOD, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case KURUKA_RATMAN_LEADER: - { - if (hasQuestItems(killer, GOBLIN_DWELLING_MAP) && (getQuestItemsCount(killer, KURUKA_RATMAN_TOOTH) < 10)) - { + case KURUKA_RATMAN_LEADER: { + if (hasQuestItems(killer, GOBLIN_DWELLING_MAP) && (getQuestItemsCount(killer, KURUKA_RATMAN_TOOTH) < 10)) { takeItems(killer, GREEN_BLOOD, -1); - if (getQuestItemsCount(killer, KURUKA_RATMAN_TOOTH) >= 9) - { + if (getQuestItemsCount(killer, KURUKA_RATMAN_TOOTH) >= 9) { giveItems(killer, KURUKA_RATMAN_TOOTH, 1); qs.setCond(2, true); - } - else - { + } else { giveItems(killer, KURUKA_RATMAN_TOOTH, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case UMBAR_ORC: - { - if (hasAtLeastOneQuestItem(killer, BETRAYER_UMBAR_REPORT, BETRAYER_ZAKAN_REPORT) && (getQuestItemsCount(killer, HEAD_OF_BETRAYER) < 2) && (getRandom(10) < 2)) - { + case UMBAR_ORC: { + if (hasAtLeastOneQuestItem(killer, BETRAYER_UMBAR_REPORT, BETRAYER_ZAKAN_REPORT) && (getQuestItemsCount(killer, HEAD_OF_BETRAYER) < 2) && (getRandom(10) < 2)) { giveItems(killer, HEAD_OF_BETRAYER, 1); - if (hasQuestItems(killer, BETRAYER_ZAKAN_REPORT)) - { + if (hasQuestItems(killer, BETRAYER_ZAKAN_REPORT)) { takeItems(killer, BETRAYER_ZAKAN_REPORT, 1); - } - else if (hasQuestItems(killer, BETRAYER_UMBAR_REPORT)) - { + } else if (hasQuestItems(killer, BETRAYER_UMBAR_REPORT)) { takeItems(killer, BETRAYER_UMBAR_REPORT, 1); } - if (getQuestItemsCount(killer, HEAD_OF_BETRAYER) == 2) - { + if (getQuestItemsCount(killer, HEAD_OF_BETRAYER) == 2) { qs.setCond(4, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case TIMORA_ORC: - { - if (qs.isMemoState(3) && !hasQuestItems(killer, TIMORA_ORC_HEAD)) - { - if (getRandom(100) < 60) - { + case TIMORA_ORC: { + if (qs.isMemoState(3) && !hasQuestItems(killer, TIMORA_ORC_HEAD)) { + if (getRandom(100) < 60) { giveItems(killer, TIMORA_ORC_HEAD, 1); qs.setCond(7, true); } @@ -244,69 +194,43 @@ public final class Q00414_PathOfTheOrcRaider extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated() || qs.isCompleted()) - { - if (npc.getId() == PREFECT_KARUKIA) - { + if (qs.isCreated() || qs.isCompleted()) { + if (npc.getId() == PREFECT_KARUKIA) { htmltext = "30570-01.htm"; } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case PREFECT_KARUKIA: - { - if (hasQuestItems(player, GOBLIN_DWELLING_MAP) && (getQuestItemsCount(player, KURUKA_RATMAN_TOOTH) < 10)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case PREFECT_KARUKIA: { + if (hasQuestItems(player, GOBLIN_DWELLING_MAP) && (getQuestItemsCount(player, KURUKA_RATMAN_TOOTH) < 10)) { htmltext = "30570-06.html"; - } - else if (hasQuestItems(player, GOBLIN_DWELLING_MAP) && (getQuestItemsCount(player, KURUKA_RATMAN_TOOTH) >= 10)) - { - if (!hasAtLeastOneQuestItem(player, BETRAYER_UMBAR_REPORT, BETRAYER_ZAKAN_REPORT)) - { + } else if (hasQuestItems(player, GOBLIN_DWELLING_MAP) && (getQuestItemsCount(player, KURUKA_RATMAN_TOOTH) >= 10)) { + if (!hasAtLeastOneQuestItem(player, BETRAYER_UMBAR_REPORT, BETRAYER_ZAKAN_REPORT)) { htmltext = "30570-07.html"; } - } - else if (hasQuestItems(player, HEAD_OF_BETRAYER) || hasAtLeastOneQuestItem(player, BETRAYER_UMBAR_REPORT, BETRAYER_ZAKAN_REPORT)) - { + } else if (hasQuestItems(player, HEAD_OF_BETRAYER) || hasAtLeastOneQuestItem(player, BETRAYER_UMBAR_REPORT, BETRAYER_ZAKAN_REPORT)) { htmltext = "30570-08.html"; - } - else if (qs.isMemoState(2)) - { + } else if (qs.isMemoState(2)) { htmltext = "30570-07b.html"; } break; } - case PREFRCT_KASMAN: - { - if (!hasQuestItems(player, HEAD_OF_BETRAYER) && (getQuestItemsCount(player, BETRAYER_UMBAR_REPORT, BETRAYER_ZAKAN_REPORT) >= 2)) - { + case PREFRCT_KASMAN: { + if (!hasQuestItems(player, HEAD_OF_BETRAYER) && (getQuestItemsCount(player, BETRAYER_UMBAR_REPORT, BETRAYER_ZAKAN_REPORT) >= 2)) { htmltext = "30501-01.html"; - } - else if (getQuestItemsCount(player, HEAD_OF_BETRAYER) == 1) - { + } else if (getQuestItemsCount(player, HEAD_OF_BETRAYER) == 1) { htmltext = "30501-02.html"; - } - else if (getQuestItemsCount(player, HEAD_OF_BETRAYER) == 2) - { + } else if (getQuestItemsCount(player, HEAD_OF_BETRAYER) == 2) { giveAdena(player, 163800, true); giveItems(player, MARK_OF_RAIDER, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 320534, 21312); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 456128, 28010); - } - else - { + } else { addExpAndSp(player, 591724, 34708); } qs.exitQuest(false, true); @@ -316,33 +240,21 @@ public final class Q00414_PathOfTheOrcRaider extends Quest } break; } - case PREFRCT_TAZEER: - { - if (qs.isMemoState(2)) - { + case PREFRCT_TAZEER: { + if (qs.isMemoState(2)) { htmltext = "31978-01.html"; - } - else if (qs.isMemoState(3)) - { - if (!hasQuestItems(player, TIMORA_ORC_HEAD)) - { + } else if (qs.isMemoState(3)) { + if (!hasQuestItems(player, TIMORA_ORC_HEAD)) { htmltext = "31978-03.html"; - } - else - { + } else { giveAdena(player, 81900, true); giveItems(player, MARK_OF_RAIDER, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 160267, 10656); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 228064, 14005); - } - else - { + } else { addExpAndSp(player, 295862, 17354); } qs.exitQuest(false, true); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00415_PathOfTheOrcMonk/Q00415_PathOfTheOrcMonk.java b/src/main/java/com/l2jserver/datapack/quests/Q00415_PathOfTheOrcMonk/Q00415_PathOfTheOrcMonk.java index 59503ab4b3..4c39cd9ad9 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00415_PathOfTheOrcMonk/Q00415_PathOfTheOrcMonk.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00415_PathOfTheOrcMonk/Q00415_PathOfTheOrcMonk.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.util.Util; * Path Of The Orc Monk (415) * @author ivantotov */ -public final class Q00415_PathOfTheOrcMonk extends Quest -{ +public final class Q00415_PathOfTheOrcMonk extends Quest { // NPCs private static final int PREFECT_KASMAN = 30501; private static final int GANTAKI_ZU_URUTU = 30587; @@ -82,8 +81,7 @@ public final class Q00415_PathOfTheOrcMonk extends Quest // Misc private static final int MIN_LEVEL = 18; - public Q00415_PathOfTheOrcMonk() - { + public Q00415_PathOfTheOrcMonk() { super(415, Q00415_PathOfTheOrcMonk.class.getSimpleName(), "Path Of The Orc Monk"); addStartNpc(GANTAKI_ZU_URUTU); addTalkId(GANTAKI_ZU_URUTU, PREFECT_KASMAN, KHAVATARI_ROSHEEK, KHAVATARI_TORUKU, SEER_MOIRA, KHAVATARI_AREN); @@ -93,59 +91,41 @@ public final class Q00415_PathOfTheOrcMonk extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (player.getClassId() == ClassId.orcFighter) - { - if (player.getLevel() >= MIN_LEVEL) - { - if (hasQuestItems(player, KHAVATARI_TOTEM)) - { + switch (event) { + case "ACCEPT": { + if (player.getClassId() == ClassId.orcFighter) { + if (player.getLevel() >= MIN_LEVEL) { + if (hasQuestItems(player, KHAVATARI_TOTEM)) { htmltext = "30587-04.htm"; - } - else - { + } else { htmltext = "30587-05.htm"; } - } - else - { + } else { htmltext = "30587-03.htm"; } - } - else if (player.getClassId() == ClassId.orcMonk) - { + } else if (player.getClassId() == ClassId.orcMonk) { htmltext = "30587-02a.htm"; - } - else - { + } else { htmltext = "30587-02.htm"; } break; } - case "30587-06.htm": - { + case "30587-06.htm": { qs.startQuest(); giveItems(player, POMEGRANATE, 1); htmltext = event; break; } - case "30587-09b.html": - { - if (hasQuestItems(player, FIERY_SPIRIT_SCROLL, ROSHEEKS_LETTER)) - { + case "30587-09b.html": { + if (hasQuestItems(player, FIERY_SPIRIT_SCROLL, ROSHEEKS_LETTER)) { takeItems(player, ROSHEEKS_LETTER, 1); giveItems(player, GANTAKIS_LETTRT_OF_RECOMMENDATION, 1); qs.setCond(9); @@ -153,10 +133,8 @@ public final class Q00415_PathOfTheOrcMonk extends Quest } break; } - case "30587-09c.html": - { - if (hasQuestItems(player, FIERY_SPIRIT_SCROLL, ROSHEEKS_LETTER)) - { + case "30587-09c.html": { + if (hasQuestItems(player, FIERY_SPIRIT_SCROLL, ROSHEEKS_LETTER)) { takeItems(player, ROSHEEKS_LETTER, 1); qs.setMemoState(2); qs.setCond(14); @@ -164,31 +142,22 @@ public final class Q00415_PathOfTheOrcMonk extends Quest } break; } - case "31979-02.html": - { - if (qs.isMemoState(5)) - { + case "31979-02.html": { + if (qs.isMemoState(5)) { htmltext = event; } break; } - case "31979-03.html": - { - if (qs.isMemoState(5)) - { + case "31979-03.html": { + if (qs.isMemoState(5)) { giveAdena(player, 81900, true); giveItems(player, KHAVATARI_TOTEM, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 160267, 12646); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 228064, 15995); - } - else - { + } else { addExpAndSp(player, 295862, 19344); } qs.exitQuest(false, true); @@ -198,37 +167,29 @@ public final class Q00415_PathOfTheOrcMonk extends Quest } break; } - case "31979-04.html": - { - if (qs.isMemoState(5)) - { + case "31979-04.html": { + if (qs.isMemoState(5)) { qs.setCond(20); htmltext = event; } break; } - case "32056-02.html": - { - if (qs.isMemoState(2)) - { + case "32056-02.html": { + if (qs.isMemoState(2)) { htmltext = event; } break; } - case "32056-03.html": - { - if (qs.isMemoState(2)) - { + case "32056-03.html": { + if (qs.isMemoState(2)) { qs.setMemoState(3); qs.setCond(15); htmltext = event; } break; } - case "32056-08.html": - { - if (qs.isMemoState(4) && (getQuestItemsCount(player, HORN_OF_BAAR_DRE_VANUL) >= 1)) - { + case "32056-08.html": { + if (qs.isMemoState(4) && (getQuestItemsCount(player, HORN_OF_BAAR_DRE_VANUL) >= 1)) { takeItems(player, HORN_OF_BAAR_DRE_VANUL, -1); qs.setMemoState(5); qs.setCond(19); @@ -241,30 +202,21 @@ public final class Q00415_PathOfTheOrcMonk extends Quest } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { final QuestState qs = getQuestState(attacker, false); - if ((qs != null) && qs.isStarted()) - { - switch (npc.getScriptValue()) - { - case 0: - { - if (!checkWeapon(attacker)) - { + if ((qs != null) && qs.isStarted()) { + switch (npc.getScriptValue()) { + case 0: { + if (!checkWeapon(attacker)) { npc.setScriptValue(2); - } - else - { + } else { npc.setScriptValue(1); npc.getVariables().set("Q00415_last_attacker", attacker.getObjectId()); } break; } - case 1: - { - if ((npc.getVariables().getInt("Q00415_last_attacker") != attacker.getObjectId()) || !checkWeapon(attacker)) - { + case 1: { + if ((npc.getVariables().getInt("Q00415_last_attacker") != attacker.getObjectId()) || !checkWeapon(attacker)) { npc.setScriptValue(2); } break; @@ -275,20 +227,14 @@ public final class Q00415_PathOfTheOrcMonk extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && npc.isScriptValue(1) && Util.checkIfInRange(1500, npc, killer, true)) - { + if ((qs != null) && qs.isStarted() && npc.isScriptValue(1) && Util.checkIfInRange(1500, npc, killer, true)) { final long ItemCount = getQuestItemsCount(killer, RATMAN_FANG, LANGK_LIZARDMAN_TOOTH, FELIM_LIZARDMAN_TOOTH, VUKU_ORK_TUSK); - switch (npc.getId()) - { - case FELIM_LIZARDMAN_WARRIOR: - { - if (hasQuestItems(killer, LEATHER_POUCH_4TF) && (getQuestItemsCount(killer, FELIM_LIZARDMAN_TOOTH) < 3)) - { - if (ItemCount >= 11) - { + switch (npc.getId()) { + case FELIM_LIZARDMAN_WARRIOR: { + if (hasQuestItems(killer, LEATHER_POUCH_4TF) && (getQuestItemsCount(killer, FELIM_LIZARDMAN_TOOTH) < 3)) { + if (ItemCount >= 11) { takeItems(killer, LEATHER_POUCH_4TF, 1); giveItems(killer, LEATHER_POUCH_4TF_FULL, 1); takeItems(killer, VUKU_ORK_TUSK, -1); @@ -296,21 +242,16 @@ public final class Q00415_PathOfTheOrcMonk extends Quest takeItems(killer, LANGK_LIZARDMAN_TOOTH, -1); takeItems(killer, FELIM_LIZARDMAN_TOOTH, -1); qs.setCond(12, true); - } - else - { + } else { giveItems(killer, FELIM_LIZARDMAN_TOOTH, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case VUKU_ORC_FIGHTER: - { - if (hasQuestItems(killer, LEATHER_POUCH_4TF) && (getQuestItemsCount(killer, VUKU_ORK_TUSK) < 3)) - { - if (ItemCount >= 11) - { + case VUKU_ORC_FIGHTER: { + if (hasQuestItems(killer, LEATHER_POUCH_4TF) && (getQuestItemsCount(killer, VUKU_ORK_TUSK) < 3)) { + if (ItemCount >= 11) { takeItems(killer, LEATHER_POUCH_4TF, 1); giveItems(killer, LEATHER_POUCH_4TF_FULL, 1); takeItems(killer, VUKU_ORK_TUSK, -1); @@ -318,21 +259,16 @@ public final class Q00415_PathOfTheOrcMonk extends Quest takeItems(killer, LANGK_LIZARDMAN_TOOTH, -1); takeItems(killer, FELIM_LIZARDMAN_TOOTH, -1); qs.setCond(12, true); - } - else - { + } else { giveItems(killer, VUKU_ORK_TUSK, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case LANGK_LIZZARDMAN_WARRIOR: - { - if (hasQuestItems(killer, LEATHER_POUCH_4TF) && (getQuestItemsCount(killer, LANGK_LIZARDMAN_TOOTH) < 3)) - { - if (ItemCount >= 11) - { + case LANGK_LIZZARDMAN_WARRIOR: { + if (hasQuestItems(killer, LEATHER_POUCH_4TF) && (getQuestItemsCount(killer, LANGK_LIZARDMAN_TOOTH) < 3)) { + if (ItemCount >= 11) { takeItems(killer, LEATHER_POUCH_4TF, 1); giveItems(killer, LEATHER_POUCH_4TF_FULL, 1); takeItems(killer, VUKU_ORK_TUSK, -1); @@ -340,21 +276,16 @@ public final class Q00415_PathOfTheOrcMonk extends Quest takeItems(killer, LANGK_LIZARDMAN_TOOTH, -1); takeItems(killer, FELIM_LIZARDMAN_TOOTH, -1); qs.setCond(12, true); - } - else - { + } else { giveItems(killer, LANGK_LIZARDMAN_TOOTH, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case RATMAN_WARRIOR: - { - if (hasQuestItems(killer, LEATHER_POUCH_4TF) && (getQuestItemsCount(killer, RATMAN_FANG) < 3)) - { - if (ItemCount >= 11) - { + case RATMAN_WARRIOR: { + if (hasQuestItems(killer, LEATHER_POUCH_4TF) && (getQuestItemsCount(killer, RATMAN_FANG) < 3)) { + if (ItemCount >= 11) { takeItems(killer, LEATHER_POUCH_4TF, 1); giveItems(killer, LEATHER_POUCH_4TF_FULL, 1); takeItems(killer, VUKU_ORK_TUSK, -1); @@ -362,112 +293,80 @@ public final class Q00415_PathOfTheOrcMonk extends Quest takeItems(killer, LANGK_LIZARDMAN_TOOTH, -1); takeItems(killer, FELIM_LIZARDMAN_TOOTH, -1); qs.setCond(12, true); - } - else - { + } else { giveItems(killer, RATMAN_FANG, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case SCARLET_SALAMANDER: - { - if (hasQuestItems(killer, LEATHER_POUCH_3RD)) - { - if (getQuestItemsCount(killer, SCARLET_SALAMANDER_SCALE) == 4) - { + case SCARLET_SALAMANDER: { + if (hasQuestItems(killer, LEATHER_POUCH_3RD)) { + if (getQuestItemsCount(killer, SCARLET_SALAMANDER_SCALE) == 4) { takeItems(killer, LEATHER_POUCH_3RD, 1); giveItems(killer, LEATHER_POUCH_3RD_FULL, 1); takeItems(killer, SCARLET_SALAMANDER_SCALE, -1); qs.setCond(7, true); - } - else - { + } else { giveItems(killer, SCARLET_SALAMANDER_SCALE, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case KASHA_FANG_SPIDER: - { - if (qs.isMemoState(3) && (getQuestItemsCount(killer, KASHA_SPIDERS_TOOTH) < 6)) - { - if (getRandom(100) < 70) - { + case KASHA_FANG_SPIDER: { + if (qs.isMemoState(3) && (getQuestItemsCount(killer, KASHA_SPIDERS_TOOTH) < 6)) { + if (getRandom(100) < 70) { giveItems(killer, KASHA_SPIDERS_TOOTH, 1); - if (getQuestItemsCount(killer, KASHA_SPIDERS_TOOTH) >= 6) - { + if (getQuestItemsCount(killer, KASHA_SPIDERS_TOOTH) >= 6) { qs.setCond(16, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case KASHA_BLADE_SPIDER: - { - if (hasQuestItems(killer, LEATHER_POUCH_2ND)) - { - if (getQuestItemsCount(killer, KASHA_BLADE_SPIDER_TALON) == 4) - { + case KASHA_BLADE_SPIDER: { + if (hasQuestItems(killer, LEATHER_POUCH_2ND)) { + if (getQuestItemsCount(killer, KASHA_BLADE_SPIDER_TALON) == 4) { takeItems(killer, LEATHER_POUCH_2ND, 1); giveItems(killer, LEATHER_POUCH_2ND_FULL, 1); takeItems(killer, KASHA_BLADE_SPIDER_TALON, -1); qs.setCond(5, true); - } - else - { + } else { giveItems(killer, KASHA_BLADE_SPIDER_TALON, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } - } - else if (qs.isMemoState(3) && (getQuestItemsCount(killer, KASHA_SPIDERS_TOOTH) < 6)) - { - if (getRandom(100) < 70) - { + } else if (qs.isMemoState(3) && (getQuestItemsCount(killer, KASHA_SPIDERS_TOOTH) < 6)) { + if (getRandom(100) < 70) { giveItems(killer, KASHA_SPIDERS_TOOTH, 1); - if (getQuestItemsCount(killer, KASHA_SPIDERS_TOOTH) == 6) - { + if (getQuestItemsCount(killer, KASHA_SPIDERS_TOOTH) == 6) { qs.setCond(16, true); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case KASHA_BEAR: - { - if (hasQuestItems(killer, LEATHER_POUCH_1ST)) - { - if (getQuestItemsCount(killer, KASHA_BEAR_CLAW) == 4) - { + case KASHA_BEAR: { + if (hasQuestItems(killer, LEATHER_POUCH_1ST)) { + if (getQuestItemsCount(killer, KASHA_BEAR_CLAW) == 4) { takeItems(killer, LEATHER_POUCH_1ST, 1); giveItems(killer, LEATHER_POUCH_1ST_FULL, 1); takeItems(killer, KASHA_BEAR_CLAW, -1); qs.setCond(3, true); - } - else - { + } else { giveItems(killer, KASHA_BEAR_CLAW, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case BAAR_DRE_VANUL: - { - if (qs.isMemoState(4) && !hasQuestItems(killer, HORN_OF_BAAR_DRE_VANUL)) - { - if (getRandom(100) < 90) - { + case BAAR_DRE_VANUL: { + if (qs.isMemoState(4) && !hasQuestItems(killer, HORN_OF_BAAR_DRE_VANUL)) { + if (getRandom(100) < 90) { giveItems(killer, HORN_OF_BAAR_DRE_VANUL, 1); qs.setCond(18, true); } @@ -480,86 +379,54 @@ public final class Q00415_PathOfTheOrcMonk extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); final int memoState = qs.getMemoState(); String htmltext = getNoQuestMsg(player); - if (qs.isCreated() || qs.isCompleted()) - { - if (npc.getId() == GANTAKI_ZU_URUTU) - { + if (qs.isCreated() || qs.isCompleted()) { + if (npc.getId() == GANTAKI_ZU_URUTU) { htmltext = "30587-01.htm"; } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case GANTAKI_ZU_URUTU: - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case GANTAKI_ZU_URUTU: { final long letterCount = getQuestItemsCount(player, LEATHER_POUCH_1ST, LEATHER_POUCH_2ND, LEATHER_POUCH_3RD, LEATHER_POUCH_1ST_FULL, LEATHER_POUCH_2ND_FULL, LEATHER_POUCH_3RD_FULL); - if (memoState == 2) - { + if (memoState == 2) { htmltext = "30587-09c.html"; - } - else if (hasQuestItems(player, POMEGRANATE) && !hasAtLeastOneQuestItem(player, FIERY_SPIRIT_SCROLL, GANTAKIS_LETTRT_OF_RECOMMENDATION, ROSHEEKS_LETTER) && (letterCount == 0)) - { + } else if (hasQuestItems(player, POMEGRANATE) && !hasAtLeastOneQuestItem(player, FIERY_SPIRIT_SCROLL, GANTAKIS_LETTRT_OF_RECOMMENDATION, ROSHEEKS_LETTER) && (letterCount == 0)) { htmltext = "30587-07.html"; - } - else if (!hasAtLeastOneQuestItem(player, FIERY_SPIRIT_SCROLL, POMEGRANATE, GANTAKIS_LETTRT_OF_RECOMMENDATION, ROSHEEKS_LETTER) && (letterCount == 1)) - { + } else if (!hasAtLeastOneQuestItem(player, FIERY_SPIRIT_SCROLL, POMEGRANATE, GANTAKIS_LETTRT_OF_RECOMMENDATION, ROSHEEKS_LETTER) && (letterCount == 1)) { htmltext = "30587-08.html"; - } - else if (hasQuestItems(player, FIERY_SPIRIT_SCROLL, ROSHEEKS_LETTER) && !hasAtLeastOneQuestItem(player, POMEGRANATE, GANTAKIS_LETTRT_OF_RECOMMENDATION) && (letterCount == 0)) - { + } else if (hasQuestItems(player, FIERY_SPIRIT_SCROLL, ROSHEEKS_LETTER) && !hasAtLeastOneQuestItem(player, POMEGRANATE, GANTAKIS_LETTRT_OF_RECOMMENDATION) && (letterCount == 0)) { htmltext = "30587-09a.html"; - } - else if (memoState < 2) - { - if (hasQuestItems(player, FIERY_SPIRIT_SCROLL, GANTAKIS_LETTRT_OF_RECOMMENDATION) && !hasAtLeastOneQuestItem(player, POMEGRANATE, ROSHEEKS_LETTER) && (letterCount == 0)) - { + } else if (memoState < 2) { + if (hasQuestItems(player, FIERY_SPIRIT_SCROLL, GANTAKIS_LETTRT_OF_RECOMMENDATION) && !hasAtLeastOneQuestItem(player, POMEGRANATE, ROSHEEKS_LETTER) && (letterCount == 0)) { htmltext = "30587-10.html"; - } - else if (hasQuestItems(player, FIERY_SPIRIT_SCROLL) && !hasAtLeastOneQuestItem(player, POMEGRANATE, GANTAKIS_LETTRT_OF_RECOMMENDATION, ROSHEEKS_LETTER) && (letterCount == 0)) - { + } else if (hasQuestItems(player, FIERY_SPIRIT_SCROLL) && !hasAtLeastOneQuestItem(player, POMEGRANATE, GANTAKIS_LETTRT_OF_RECOMMENDATION, ROSHEEKS_LETTER) && (letterCount == 0)) { htmltext = "30587-11.html"; } } break; } - case PREFECT_KASMAN: - { - if (hasQuestItems(player, GANTAKIS_LETTRT_OF_RECOMMENDATION)) - { + case PREFECT_KASMAN: { + if (hasQuestItems(player, GANTAKIS_LETTRT_OF_RECOMMENDATION)) { takeItems(player, GANTAKIS_LETTRT_OF_RECOMMENDATION, 1); giveItems(player, FIG, 1); qs.setCond(10); htmltext = "30501-01.html"; - } - else if (hasQuestItems(player, FIG) && !hasAtLeastOneQuestItem(player, LEATHER_POUCH_4TF, LEATHER_POUCH_4TF_FULL)) - { + } else if (hasQuestItems(player, FIG) && !hasAtLeastOneQuestItem(player, LEATHER_POUCH_4TF, LEATHER_POUCH_4TF_FULL)) { htmltext = "30501-02.html"; - } - else if (!hasQuestItems(player, FIG) && hasAtLeastOneQuestItem(player, LEATHER_POUCH_4TF, LEATHER_POUCH_4TF_FULL)) - { + } else if (!hasQuestItems(player, FIG) && hasAtLeastOneQuestItem(player, LEATHER_POUCH_4TF, LEATHER_POUCH_4TF_FULL)) { htmltext = "30501-03.html"; - } - else if (hasQuestItems(player, IRON_WILL_SCROLL)) - { + } else if (hasQuestItems(player, IRON_WILL_SCROLL)) { giveAdena(player, 163800, true); giveItems(player, KHAVATARI_TOTEM, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 320534, 25292); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 456128, 31990); - } - else - { + } else { addExpAndSp(player, 591724, 38688); } qs.exitQuest(false, true); @@ -569,127 +436,85 @@ public final class Q00415_PathOfTheOrcMonk extends Quest } break; } - case KHAVATARI_ROSHEEK: - { - if (hasQuestItems(player, POMEGRANATE)) - { + case KHAVATARI_ROSHEEK: { + if (hasQuestItems(player, POMEGRANATE)) { takeItems(player, POMEGRANATE, 1); giveItems(player, LEATHER_POUCH_1ST, 1); qs.setCond(2); htmltext = "30590-01.html"; - } - else if (hasQuestItems(player, LEATHER_POUCH_1ST) && !hasQuestItems(player, LEATHER_POUCH_1ST_FULL)) - { + } else if (hasQuestItems(player, LEATHER_POUCH_1ST) && !hasQuestItems(player, LEATHER_POUCH_1ST_FULL)) { htmltext = "30590-02.html"; - } - else if (!hasQuestItems(player, LEATHER_POUCH_1ST) && hasQuestItems(player, LEATHER_POUCH_1ST_FULL)) - { + } else if (!hasQuestItems(player, LEATHER_POUCH_1ST) && hasQuestItems(player, LEATHER_POUCH_1ST_FULL)) { giveItems(player, LEATHER_POUCH_2ND, 1); takeItems(player, LEATHER_POUCH_1ST_FULL, 1); qs.setCond(4); htmltext = "30590-03.html"; - } - else if (hasQuestItems(player, LEATHER_POUCH_2ND) && !hasQuestItems(player, LEATHER_POUCH_2ND_FULL)) - { + } else if (hasQuestItems(player, LEATHER_POUCH_2ND) && !hasQuestItems(player, LEATHER_POUCH_2ND_FULL)) { htmltext = "30590-04.html"; - } - else if (!hasQuestItems(player, LEATHER_POUCH_2ND) && hasQuestItems(player, LEATHER_POUCH_2ND_FULL)) - { + } else if (!hasQuestItems(player, LEATHER_POUCH_2ND) && hasQuestItems(player, LEATHER_POUCH_2ND_FULL)) { giveItems(player, LEATHER_POUCH_3RD, 1); takeItems(player, LEATHER_POUCH_2ND_FULL, 1); qs.setCond(6); htmltext = "30590-05.html"; - } - else if (hasQuestItems(player, LEATHER_POUCH_3RD) && !hasQuestItems(player, LEATHER_POUCH_3RD_FULL)) - { + } else if (hasQuestItems(player, LEATHER_POUCH_3RD) && !hasQuestItems(player, LEATHER_POUCH_3RD_FULL)) { htmltext = "30590-06.html"; - } - else if (!hasQuestItems(player, LEATHER_POUCH_3RD) && hasQuestItems(player, LEATHER_POUCH_3RD_FULL)) - { + } else if (!hasQuestItems(player, LEATHER_POUCH_3RD) && hasQuestItems(player, LEATHER_POUCH_3RD_FULL)) { takeItems(player, LEATHER_POUCH_3RD_FULL, 1); giveItems(player, FIERY_SPIRIT_SCROLL, 1); giveItems(player, ROSHEEKS_LETTER, 1); qs.setCond(8); htmltext = "30590-07.html"; - } - else if (hasQuestItems(player, ROSHEEKS_LETTER, FIERY_SPIRIT_SCROLL)) - { + } else if (hasQuestItems(player, ROSHEEKS_LETTER, FIERY_SPIRIT_SCROLL)) { htmltext = "30590-08.html"; - } - else if (!hasQuestItems(player, ROSHEEKS_LETTER) && hasQuestItems(player, FIERY_SPIRIT_SCROLL)) - { + } else if (!hasQuestItems(player, ROSHEEKS_LETTER) && hasQuestItems(player, FIERY_SPIRIT_SCROLL)) { htmltext = "30590-09.html"; } break; } - case KHAVATARI_TORUKU: - { - if (hasQuestItems(player, FIG)) - { + case KHAVATARI_TORUKU: { + if (hasQuestItems(player, FIG)) { takeItems(player, FIG, 1); giveItems(player, LEATHER_POUCH_4TF, 1); qs.setCond(11); htmltext = "30591-01.html"; - } - else if (hasQuestItems(player, LEATHER_POUCH_4TF) && !hasQuestItems(player, LEATHER_POUCH_4TF_FULL)) - { + } else if (hasQuestItems(player, LEATHER_POUCH_4TF) && !hasQuestItems(player, LEATHER_POUCH_4TF_FULL)) { htmltext = "30591-02.html"; - } - else if (!hasQuestItems(player, LEATHER_POUCH_4TF) && hasQuestItems(player, LEATHER_POUCH_4TF_FULL)) - { + } else if (!hasQuestItems(player, LEATHER_POUCH_4TF) && hasQuestItems(player, LEATHER_POUCH_4TF_FULL)) { takeItems(player, LEATHER_POUCH_4TF_FULL, 1); giveItems(player, IRON_WILL_SCROLL, 1); giveItems(player, TORUKUS_LETTER, 1); qs.setCond(13); htmltext = "30591-03.html"; - } - else if (hasQuestItems(player, IRON_WILL_SCROLL, TORUKUS_LETTER)) - { + } else if (hasQuestItems(player, IRON_WILL_SCROLL, TORUKUS_LETTER)) { htmltext = "30591-04.html"; } break; } - case SEER_MOIRA: - { - if (memoState == 5) - { + case SEER_MOIRA: { + if (memoState == 5) { htmltext = "31979-01.html"; } break; } - case KHAVATARI_AREN: - { - if (memoState == 2) - { + case KHAVATARI_AREN: { + if (memoState == 2) { htmltext = "32056-01.html"; - } - else if (memoState == 3) - { - if (getQuestItemsCount(player, KASHA_SPIDERS_TOOTH) < 6) - { + } else if (memoState == 3) { + if (getQuestItemsCount(player, KASHA_SPIDERS_TOOTH) < 6) { htmltext = "32056-04.html"; - } - else - { + } else { takeItems(player, KASHA_SPIDERS_TOOTH, -1); qs.setMemoState(4); qs.setCond(17); htmltext = "32056-05.html"; } - } - else if (memoState == 4) - { - if (!hasQuestItems(player, HORN_OF_BAAR_DRE_VANUL)) - { + } else if (memoState == 4) { + if (!hasQuestItems(player, HORN_OF_BAAR_DRE_VANUL)) { htmltext = "32056-06.html"; - } - else - { + } else { htmltext = "32056-07.html"; } - } - else if (memoState == 5) - { + } else if (memoState == 5) { htmltext = "32056-09.html"; } break; @@ -699,8 +524,7 @@ public final class Q00415_PathOfTheOrcMonk extends Quest return htmltext; } - private static boolean checkWeapon(L2PcInstance player) - { + private static boolean checkWeapon(L2PcInstance player) { L2ItemInstance weapon = player.getActiveWeaponInstance(); return ((weapon == null) || (weapon.getItemType() == WeaponType.FIST) || (weapon.getItemType() == WeaponType.DUALFIST)); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java b/src/main/java/com/l2jserver/datapack/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java index 29650d5c60..0e0ae4fc6a 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java @@ -37,8 +37,7 @@ import com.l2jserver.gameserver.network.serverpackets.SocialAction; * Path of the Orc Shaman (416) * @author Adry_85 */ -public final class Q00416_PathOfTheOrcShaman extends Quest -{ +public final class Q00416_PathOfTheOrcShaman extends Quest { // NPCs private static final int UMOS = 30502; private static final int TATARU_ZU_HESTUI = 30585; @@ -71,8 +70,7 @@ public final class Q00416_PathOfTheOrcShaman extends Quest private static final int MIN_LEVEL = 18; // Mobs private static final Map<Integer, ItemChanceHolder> MOBS = new HashMap<>(); - static - { + static { MOBS.put(20415, new ItemChanceHolder(FIRST_FIERY_EGG, 1.0, 1)); // scarlet_salamander MOBS.put(20478, new ItemChanceHolder(KASHA_BLADE_SPIDER_HUSK, 1.0, 1)); // kasha_blade_spider MOBS.put(20479, new ItemChanceHolder(KASHA_BEAR_PELT, 1.0, 1)); // kasha_bear @@ -82,8 +80,7 @@ public final class Q00416_PathOfTheOrcShaman extends Quest MOBS.put(27056, new ItemChanceHolder(DURKA_PARASITE, 1.0, 9)); // durka_spirit } - public Q00416_PathOfTheOrcShaman() - { + public Q00416_PathOfTheOrcShaman() { super(416, Q00416_PathOfTheOrcShaman.class.getSimpleName(), "Path of the Orc Shaman"); addStartNpc(TATARU_ZU_HESTUI); addTalkId(TATARU_ZU_HESTUI, UMOS, MOIRA, DEAD_LEOPARDS_CARCASS, DUDA_MARA_TOTEM_SPIRIT, HESTUI_TOTEM_SPIRIT, TOTEM_SPIRIT_OF_GANDI); @@ -93,64 +90,45 @@ public final class Q00416_PathOfTheOrcShaman extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "START": - { - if (player.getClassId() != ClassId.orcMage) - { - if (player.getClassId() == ClassId.orcShaman) - { + switch (event) { + case "START": { + if (player.getClassId() != ClassId.orcMage) { + if (player.getClassId() == ClassId.orcShaman) { htmltext = "30585-02.htm"; - } - else - { + } else { htmltext = "30585-03.htm"; } - } - else if (player.getLevel() < MIN_LEVEL) - { + } else if (player.getLevel() < MIN_LEVEL) { htmltext = "30585-04.htm"; - } - else if (hasQuestItems(player, MASK_OF_MEDIUM)) - { + } else if (hasQuestItems(player, MASK_OF_MEDIUM)) { htmltext = "30585-05.htm"; - } - else - { + } else { htmltext = "30585-06.htm"; } break; } - case "30585-07.htm": - { + case "30585-07.htm": { st.startQuest(); st.setMemoState(1); giveItems(player, FIRE_CHARM, 1); htmltext = event; break; } - case "30585-12.html": - { - if (hasQuestItems(player, TOTEM_SPIRIT_CLAW)) - { + case "30585-12.html": { + if (hasQuestItems(player, TOTEM_SPIRIT_CLAW)) { htmltext = event; } break; } - case "30585-13.html": - { - if (hasQuestItems(player, TOTEM_SPIRIT_CLAW)) - { + case "30585-13.html": { + if (hasQuestItems(player, TOTEM_SPIRIT_CLAW)) { takeItems(player, TOTEM_SPIRIT_CLAW, -1); giveItems(player, TATARUS_LETTER, 1); st.setCond(5, true); @@ -158,10 +136,8 @@ public final class Q00416_PathOfTheOrcShaman extends Quest } break; } - case "30585-14.html": - { - if (hasQuestItems(player, TOTEM_SPIRIT_CLAW)) - { + case "30585-14.html": { + if (hasQuestItems(player, TOTEM_SPIRIT_CLAW)) { takeItems(player, TOTEM_SPIRIT_CLAW, -1); st.setCond(12, true); st.setMemoState(100); @@ -169,23 +145,16 @@ public final class Q00416_PathOfTheOrcShaman extends Quest } break; } - case "30502-07.html": - { - if (hasQuestItems(player, TOTEM_SPIRIT_BLOOD)) - { + case "30502-07.html": { + if (hasQuestItems(player, TOTEM_SPIRIT_BLOOD)) { takeItems(player, TOTEM_SPIRIT_BLOOD, -1); giveItems(player, MASK_OF_MEDIUM, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 320534, 22992); - } - else if (level >= 19) - { + } else if (level >= 19) { addExpAndSp(player, 456128, 29690); - } - else - { + } else { addExpAndSp(player, 591724, 36388); } giveAdena(player, 163800, true); @@ -196,36 +165,28 @@ public final class Q00416_PathOfTheOrcShaman extends Quest } break; } - case "32090-05.html": - { - if (st.isMemoState(106)) - { + case "32090-05.html": { + if (st.isMemoState(106)) { htmltext = event; } break; } - case "32090-06.html": - { - if (st.isMemoState(106)) - { + case "32090-06.html": { + if (st.isMemoState(106)) { st.setMemoState(107); st.setCond(18, true); htmltext = event; } break; } - case "30593-02.html": - { - if (hasQuestItems(player, BLOOD_CAULDRON)) - { + case "30593-02.html": { + if (hasQuestItems(player, BLOOD_CAULDRON)) { htmltext = event; } break; } - case "30593-03.html": - { - if (hasQuestItems(player, BLOOD_CAULDRON)) - { + case "30593-03.html": { + if (hasQuestItems(player, BLOOD_CAULDRON)) { takeItems(player, BLOOD_CAULDRON, -1); giveItems(player, SPIRIT_NET, 1); st.setCond(9, true); @@ -233,18 +194,14 @@ public final class Q00416_PathOfTheOrcShaman extends Quest } break; } - case "30592-02.html": - { - if (hasQuestItems(player, HESTUI_MASK, SECOND_FIERY_EGG)) - { + case "30592-02.html": { + if (hasQuestItems(player, HESTUI_MASK, SECOND_FIERY_EGG)) { htmltext = event; } break; } - case "30592-03.html": - { - if (hasQuestItems(player, HESTUI_MASK, SECOND_FIERY_EGG)) - { + case "30592-03.html": { + if (hasQuestItems(player, HESTUI_MASK, SECOND_FIERY_EGG)) { takeItems(player, -1, HESTUI_MASK, SECOND_FIERY_EGG); giveItems(player, TOTEM_SPIRIT_CLAW, 1); st.setCond(4, true); @@ -252,20 +209,16 @@ public final class Q00416_PathOfTheOrcShaman extends Quest } break; } - case "32057-02.html": - { - if (st.isMemoState(101)) - { + case "32057-02.html": { + if (st.isMemoState(101)) { st.setMemoState(102); st.setCond(14, true); htmltext = event; } break; } - case "32057-05.html": - { - if (st.isMemoState(109)) - { + case "32057-05.html": { + if (st.isMemoState(109)) { st.setMemoState(110); st.setCond(21, true); htmltext = event; @@ -277,45 +230,35 @@ public final class Q00416_PathOfTheOrcShaman extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getRandomPartyMemberState(player, -1, 3, npc); - if (st == null) - { + if (st == null) { return super.onKill(npc, player, isSummon); } - if (npc.getId() == BLACK_LEOPARD) - { - switch (st.getMemoState()) - { - case 102: - { + if (npc.getId() == BLACK_LEOPARD) { + switch (st.getMemoState()) { + case 102: { st.setMemoState(103); break; } - case 103: - { + case 103: { st.setMemoState(104); st.setCond(15, true); - if (getRandom(100) < 66) - { + if (getRandom(100) < 66) { npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.MY_DEAR_FRIEND_OF_S1_WHO_HAS_GONE_ON_AHEAD_OF_ME).addStringParameter(st.getPlayer().getName())); } break; } - case 105: - { + case 105: { st.setMemoState(106); st.setCond(17, true); - if (getRandom(100) < 66) - { + if (getRandom(100) < 66) { npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.LISTEN_TO_TEJAKAR_GANDI_YOUNG_OROKA_THE_SPIRIT_OF_THE_SLAIN_LEOPARD_IS_CALLING_YOU_S1).addStringParameter(st.getPlayer().getName())); } break; } - case 107: - { + case 107: { st.setMemoState(108); st.setCond(19, true); break; @@ -325,48 +268,34 @@ public final class Q00416_PathOfTheOrcShaman extends Quest } final ItemChanceHolder item = MOBS.get(npc.getId()); - if (item.getCount() == st.getCond()) - { - if (st.isCond(1) && hasQuestItems(st.getPlayer(), FIRE_CHARM)) - { + if (item.getCount() == st.getCond()) { + if (st.isCond(1) && hasQuestItems(st.getPlayer(), FIRE_CHARM)) { if (giveItemRandomly(st.getPlayer(), npc, item.getId(), 1, 1, item.getChance(), true) // - && hasQuestItems(st.getPlayer(), FIRST_FIERY_EGG, KASHA_BLADE_SPIDER_HUSK, KASHA_BEAR_PELT)) - { + && hasQuestItems(st.getPlayer(), FIRST_FIERY_EGG, KASHA_BLADE_SPIDER_HUSK, KASHA_BEAR_PELT)) { st.setCond(2, true); } - } - else if (st.isCond(6) && hasQuestItems(st.getPlayer(), FLAME_CHARM)) - { - if (giveItemRandomly(st.getPlayer(), npc, item.getId(), 1, 3, item.getChance(), true)) - { + } else if (st.isCond(6) && hasQuestItems(st.getPlayer(), FLAME_CHARM)) { + if (giveItemRandomly(st.getPlayer(), npc, item.getId(), 1, 3, item.getChance(), true)) { st.setCond(7); } - } - else if (st.isCond(9) && hasQuestItems(st.getPlayer(), SPIRIT_NET) // + } else if (st.isCond(9) && hasQuestItems(st.getPlayer(), SPIRIT_NET) // && !hasQuestItems(st.getPlayer(), BOUND_DURKA_SPIRIT) // - && (getQuestItemsCount(st.getPlayer(), DURKA_PARASITE) <= 8)) - { - if ((npc.getId() == 20038) || (npc.getId() == 20043)) - { + && (getQuestItemsCount(st.getPlayer(), DURKA_PARASITE) <= 8)) { + if ((npc.getId() == 20038) || (npc.getId() == 20043)) { final int random = getRandom(10); final long itemCount = getQuestItemsCount(st.getPlayer(), DURKA_PARASITE); if ((((itemCount == 5) && (random < 1))) // || ((itemCount == 6) && (random < 2)) // || ((itemCount == 7) && (random < 2)) // - || (itemCount >= 8)) - { + || (itemCount >= 8)) { takeItems(player, DURKA_PARASITE, -1); addSpawn(DURKA_SPIRIT, npc.getX(), npc.getY(), npc.getZ(), 0, true, 0, false); playSound(st.getPlayer(), Sound.ITEMSOUND_QUEST_BEFORE_BATTLE); - } - else - { + } else { giveItems(st.getPlayer(), DURKA_PARASITE, 1); playSound(st.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); } - } - else - { + } else { giveItems(st.getPlayer(), BOUND_DURKA_SPIRIT, 1); takeItems(st.getPlayer(), -1, DURKA_PARASITE, SPIRIT_NET); } @@ -376,130 +305,83 @@ public final class Q00416_PathOfTheOrcShaman extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCreated()) - { - if (npc.getId() == TATARU_ZU_HESTUI) - { + if (st.isCreated()) { + if (npc.getId() == TATARU_ZU_HESTUI) { htmltext = "30585-01.htm"; } - } - else if (st.isStarted()) - { - switch (npc.getId()) - { - case TATARU_ZU_HESTUI: - { - if (st.isMemoState(1)) - { - if (hasQuestItems(player, FIRE_CHARM)) - { - if (getQuestItemsCount(player, KASHA_BEAR_PELT, KASHA_BLADE_SPIDER_HUSK, FIRST_FIERY_EGG) < 3) - { + } else if (st.isStarted()) { + switch (npc.getId()) { + case TATARU_ZU_HESTUI: { + if (st.isMemoState(1)) { + if (hasQuestItems(player, FIRE_CHARM)) { + if (getQuestItemsCount(player, KASHA_BEAR_PELT, KASHA_BLADE_SPIDER_HUSK, FIRST_FIERY_EGG) < 3) { htmltext = "30585-08.html"; - } - else - { + } else { takeItems(player, -1, FIRE_CHARM, KASHA_BEAR_PELT, KASHA_BLADE_SPIDER_HUSK, FIRST_FIERY_EGG); giveItems(player, HESTUI_MASK, 1); giveItems(player, SECOND_FIERY_EGG, 1); st.setCond(3, true); htmltext = "30585-09.html"; } - } - else if (hasQuestItems(player, HESTUI_MASK, SECOND_FIERY_EGG)) - { + } else if (hasQuestItems(player, HESTUI_MASK, SECOND_FIERY_EGG)) { htmltext = "30585-10.html"; - } - else if (hasQuestItems(player, TOTEM_SPIRIT_CLAW)) - { + } else if (hasQuestItems(player, TOTEM_SPIRIT_CLAW)) { htmltext = "30585-11.html"; - } - else if (hasQuestItems(player, TATARUS_LETTER)) - { + } else if (hasQuestItems(player, TATARUS_LETTER)) { htmltext = "30585-15.html"; - } - else if (hasAtLeastOneQuestItem(player, GRIZZLY_BLOOD, FLAME_CHARM, BLOOD_CAULDRON, SPIRIT_NET, BOUND_DURKA_SPIRIT, TOTEM_SPIRIT_BLOOD)) - { + } else if (hasAtLeastOneQuestItem(player, GRIZZLY_BLOOD, FLAME_CHARM, BLOOD_CAULDRON, SPIRIT_NET, BOUND_DURKA_SPIRIT, TOTEM_SPIRIT_BLOOD)) { htmltext = "30585-16.html"; } - } - else if (st.isMemoState(100)) - { + } else if (st.isMemoState(100)) { htmltext = "30585-14.html"; } break; } - case UMOS: - { - if (st.isMemoState(1)) - { - if (hasQuestItems(player, TATARUS_LETTER)) - { + case UMOS: { + if (st.isMemoState(1)) { + if (hasQuestItems(player, TATARUS_LETTER)) { giveItems(player, FLAME_CHARM, 1); takeItems(player, TATARUS_LETTER, -1); st.setCond(6, true); htmltext = "30502-01.html"; - } - else if (hasQuestItems(player, FLAME_CHARM)) - { - if (getQuestItemsCount(player, GRIZZLY_BLOOD) < 3) - { + } else if (hasQuestItems(player, FLAME_CHARM)) { + if (getQuestItemsCount(player, GRIZZLY_BLOOD) < 3) { htmltext = "30502-02.html"; - } - else - { + } else { takeItems(player, -1, FLAME_CHARM, GRIZZLY_BLOOD); giveItems(player, BLOOD_CAULDRON, 1); st.setCond(8, true); htmltext = "30502-03.html"; } - } - else if (hasQuestItems(player, BLOOD_CAULDRON)) - { + } else if (hasQuestItems(player, BLOOD_CAULDRON)) { htmltext = "30502-04.html"; - } - else if (hasAtLeastOneQuestItem(player, BOUND_DURKA_SPIRIT, SPIRIT_NET)) - { + } else if (hasAtLeastOneQuestItem(player, BOUND_DURKA_SPIRIT, SPIRIT_NET)) { htmltext = "30502-05.html"; - } - else if (hasQuestItems(player, TOTEM_SPIRIT_BLOOD)) - { + } else if (hasQuestItems(player, TOTEM_SPIRIT_BLOOD)) { htmltext = "30502-06.html"; } } break; } - case MOIRA: - { + case MOIRA: { final int memoState = st.getMemoState(); - if (memoState == 100) - { + if (memoState == 100) { st.setMemoState(101); st.setCond(13, true); htmltext = "31979-01.html"; - } - else if ((memoState >= 101) && (memoState < 108)) - { + } else if ((memoState >= 101) && (memoState < 108)) { htmltext = "31979-02.html"; - } - else if (memoState == 110) - { + } else if (memoState == 110) { giveItems(player, MASK_OF_MEDIUM, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 160267, 11496); - } - else if (level >= 19) - { + } else if (level >= 19) { addExpAndSp(player, 228064, 14845); - } - else - { + } else { addExpAndSp(player, 295862, 18194); } giveAdena(player, 81900, true); @@ -510,40 +392,32 @@ public final class Q00416_PathOfTheOrcShaman extends Quest } break; } - case DEAD_LEOPARDS_CARCASS: - { - switch (st.getMemoState()) - { + case DEAD_LEOPARDS_CARCASS: { + switch (st.getMemoState()) { case 102: - case 103: - { + case 103: { htmltext = "32090-01.html"; break; } - case 104: - { + case 104: { st.setMemoState(105); st.setCond(16, true); htmltext = "32090-03.html"; break; } - case 105: - { + case 105: { htmltext = "32090-01.html"; break; } - case 106: - { + case 106: { htmltext = "32090-04.html"; break; } - case 107: - { + case 107: { htmltext = "32090-07.html"; break; } - case 108: - { + case 108: { st.setMemoState(109); st.setCond(20, true); htmltext = "32090-08.html"; @@ -552,67 +426,46 @@ public final class Q00416_PathOfTheOrcShaman extends Quest } break; } - case DUDA_MARA_TOTEM_SPIRIT: - { - if (st.isMemoState(1)) - { - if (hasQuestItems(player, BLOOD_CAULDRON)) - { + case DUDA_MARA_TOTEM_SPIRIT: { + if (st.isMemoState(1)) { + if (hasQuestItems(player, BLOOD_CAULDRON)) { htmltext = "30593-01.html"; - } - else if (hasQuestItems(player, SPIRIT_NET) && !hasQuestItems(player, BOUND_DURKA_SPIRIT)) - { + } else if (hasQuestItems(player, SPIRIT_NET) && !hasQuestItems(player, BOUND_DURKA_SPIRIT)) { htmltext = "30593-04.html"; - } - else if (!hasQuestItems(player, SPIRIT_NET) && hasQuestItems(player, BOUND_DURKA_SPIRIT)) - { + } else if (!hasQuestItems(player, SPIRIT_NET) && hasQuestItems(player, BOUND_DURKA_SPIRIT)) { takeItems(player, BOUND_DURKA_SPIRIT, -1); giveItems(player, TOTEM_SPIRIT_BLOOD, 1); st.setCond(11, true); htmltext = "30593-05.html"; - } - else if (hasQuestItems(player, TOTEM_SPIRIT_BLOOD)) - { + } else if (hasQuestItems(player, TOTEM_SPIRIT_BLOOD)) { htmltext = "30593-06.html"; } } break; } - case HESTUI_TOTEM_SPIRIT: - { - if (st.isMemoState(1)) - { - if (hasQuestItems(player, HESTUI_MASK, SECOND_FIERY_EGG)) - { + case HESTUI_TOTEM_SPIRIT: { + if (st.isMemoState(1)) { + if (hasQuestItems(player, HESTUI_MASK, SECOND_FIERY_EGG)) { htmltext = "30592-01.html"; - } - else if (hasQuestItems(player, TOTEM_SPIRIT_CLAW)) - { + } else if (hasQuestItems(player, TOTEM_SPIRIT_CLAW)) { htmltext = "30592-04.html"; - } - else if (hasAtLeastOneQuestItem(player, GRIZZLY_BLOOD, FLAME_CHARM, BLOOD_CAULDRON, SPIRIT_NET, BOUND_DURKA_SPIRIT, TOTEM_SPIRIT_BLOOD, TATARUS_LETTER)) - { + } else if (hasAtLeastOneQuestItem(player, GRIZZLY_BLOOD, FLAME_CHARM, BLOOD_CAULDRON, SPIRIT_NET, BOUND_DURKA_SPIRIT, TOTEM_SPIRIT_BLOOD, TATARUS_LETTER)) { htmltext = "30592-05.html"; } } break; } - case TOTEM_SPIRIT_OF_GANDI: - { - switch (st.getMemoState()) - { - case 101: - { + case TOTEM_SPIRIT_OF_GANDI: { + switch (st.getMemoState()) { + case 101: { htmltext = "32057-01.html"; break; } - case 102: - { + case 102: { htmltext = "32057-03.html"; break; } - case 109: - { + case 109: { htmltext = "32057-04.html"; break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00417_PathOfTheScavenger/Q00417_PathOfTheScavenger.java b/src/main/java/com/l2jserver/datapack/quests/Q00417_PathOfTheScavenger/Q00417_PathOfTheScavenger.java index 460b746bb0..7c550e8724 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00417_PathOfTheScavenger/Q00417_PathOfTheScavenger.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00417_PathOfTheScavenger/Q00417_PathOfTheScavenger.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.util.Util; * Path Of The Scavenger (417) * @author ivantotov */ -public final class Q00417_PathOfTheScavenger extends Quest -{ +public final class Q00417_PathOfTheScavenger extends Quest { // NPCs private static final int WAREHOUSE_KEEPER_RAUT = 30316; private static final int TRADER_SHARI = 30517; @@ -76,8 +75,7 @@ public final class Q00417_PathOfTheScavenger extends Quest private static final String FIRST_ATTACKER = "FIRST_ATTACKER"; private static final String FLAG = "FLAG"; - public Q00417_PathOfTheScavenger() - { + public Q00417_PathOfTheScavenger() { super(417, Q00417_PathOfTheScavenger.class.getSimpleName(), "Path Of The Scavenger"); addStartNpc(COLLECTOR_PIPI); addTalkId(COLLECTOR_PIPI, WAREHOUSE_KEEPER_RAUT, TRADER_MION, TRADER_SHARI, HEAD_BLACKSMITH_BRONK, PRIEST_OF_THE_EARTH_ZIMENF, MASTER_TOMA, TORAI, WAREHOUSE_CHIEF_YASENI); @@ -87,78 +85,56 @@ public final class Q00417_PathOfTheScavenger extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (player.getClassId() == ClassId.dwarvenFighter) - { - if (player.getLevel() >= MIN_LEVEL) - { - if (hasQuestItems(player, RING_OF_RAVEN)) - { + switch (event) { + case "ACCEPT": { + if (player.getClassId() == ClassId.dwarvenFighter) { + if (player.getLevel() >= MIN_LEVEL) { + if (hasQuestItems(player, RING_OF_RAVEN)) { htmltext = "30524-04.htm"; - } - else - { + } else { qs.startQuest(); qs.setMemoStateEx(1, 0); giveItems(player, PIPPIS_LETTER_OF_RECOMMENDATION, 1); htmltext = "30524-05.htm"; } - } - else - { + } else { htmltext = "30524-02.htm"; } - } - else if (player.getClassId() == ClassId.scavenger) - { + } else if (player.getClassId() == ClassId.scavenger) { htmltext = "30524-02a.htm"; - } - else - { + } else { htmltext = "30524-08.htm"; } break; } case "30524-03.html": case "30557-02.html": - case "30519-06.html": - { + case "30519-06.html": { htmltext = event; break; } - case "reply_1": - { - if (hasQuestItems(player, PIPPIS_LETTER_OF_RECOMMENDATION)) - { + case "reply_1": { + if (hasQuestItems(player, PIPPIS_LETTER_OF_RECOMMENDATION)) { takeItems(player, PIPPIS_LETTER_OF_RECOMMENDATION, 1); - switch (getRandom(3)) - { - case 0: - { + switch (getRandom(3)) { + case 0: { giveItems(player, ZIMENFS_POTION, 1); htmltext = "30519-02.html"; break; } - case 1: - { + case 1: { giveItems(player, SHARIS_AXE, 1); htmltext = "30519-03.html"; break; } - case 2: - { + case 2: { giveItems(player, BRONKS_INGOT, 1); htmltext = "30519-04.html"; break; @@ -167,47 +143,34 @@ public final class Q00417_PathOfTheScavenger extends Quest } break; } - case "30519-07.html": - { + case "30519-07.html": { qs.setMemoStateEx(1, qs.getMemoStateEx(1) + 1); htmltext = event; break; } - case "reply_2": - { - switch (getRandom(2)) - { - case 0: - { + case "reply_2": { + switch (getRandom(2)) { + case 0: { htmltext = "30519-06.html"; break; } - case 1: - { + case 1: { htmltext = "30519-11.html"; break; } } break; } - case "reply_3": - { - if ((qs.getMemoStateEx(1) % 10) < 2) - { + case "reply_3": { + if ((qs.getMemoStateEx(1) % 10) < 2) { qs.setMemoStateEx(1, qs.getMemoStateEx(1) + 1); htmltext = "30519-07.html"; - } - else if (((qs.getMemoStateEx(1) % 10) == 2) && qs.isMemoState(0)) - { + } else if (((qs.getMemoStateEx(1) % 10) == 2) && qs.isMemoState(0)) { htmltext = "30519-07.html"; - } - else if (((qs.getMemoStateEx(1) % 10) == 2) && qs.isMemoState(1)) - { + } else if (((qs.getMemoStateEx(1) % 10) == 2) && qs.isMemoState(1)) { qs.setMemoStateEx(1, qs.getMemoStateEx(1) + 1); htmltext = "30519-09.html"; - } - else if (((qs.getMemoStateEx(1) % 10) >= 3) && qs.isMemoState(1)) - { + } else if (((qs.getMemoStateEx(1) % 10) >= 3) && qs.isMemoState(1)) { giveItems(player, MIONS_LETTER, 1); takeItems(player, SHARIS_AXE, 1); takeItems(player, ZIMENFS_POTION, 1); @@ -217,27 +180,22 @@ public final class Q00417_PathOfTheScavenger extends Quest } break; } - case "reply_4": - { + case "reply_4": { takeItems(player, ZIMENFS_PAY, 1); takeItems(player, SHARIS_PAY, 1); takeItems(player, BRONKS_PAY, 1); - switch (getRandom(3)) - { - case 0: - { + switch (getRandom(3)) { + case 0: { giveItems(player, ZIMENFS_POTION, 1); htmltext = "30519-02.html"; break; } - case 1: - { + case 1: { giveItems(player, SHARIS_AXE, 1); htmltext = "30519-03.html"; break; } - case 2: - { + case 2: { giveItems(player, BRONKS_INGOT, 1); htmltext = "30519-04.html"; break; @@ -245,10 +203,8 @@ public final class Q00417_PathOfTheScavenger extends Quest } break; } - case "30556-05b.html": - { - if (hasQuestItems(player, TARANTULA_PICTURE) && (getQuestItemsCount(player, BEAD) >= 20)) - { + case "30556-05b.html": { + if (hasQuestItems(player, TARANTULA_PICTURE) && (getQuestItemsCount(player, BEAD) >= 20)) { takeItems(player, TARANTULA_PICTURE, 1); takeItems(player, BEAD, -1); giveItems(player, BEAD_PARCEL, 1); @@ -257,10 +213,8 @@ public final class Q00417_PathOfTheScavenger extends Quest } break; } - case "30556-06b.html": - { - if (hasQuestItems(player, TARANTULA_PICTURE) && (getQuestItemsCount(player, BEAD) >= 20)) - { + case "30556-06b.html": { + if (hasQuestItems(player, TARANTULA_PICTURE) && (getQuestItemsCount(player, BEAD) >= 20)) { takeItems(player, TARANTULA_PICTURE, 1); takeItems(player, BEAD, -1); giveItems(player, BEAD_PARCEL2, 1); @@ -270,10 +224,8 @@ public final class Q00417_PathOfTheScavenger extends Quest } break; } - case "30316-02.html": - { - if (hasQuestItems(player, BEAD_PARCEL)) - { + case "30316-02.html": { + if (hasQuestItems(player, BEAD_PARCEL)) { takeItems(player, BEAD_PARCEL, 1); giveItems(player, ROUTS_TELEPORT_SCROLL, 1); qs.setCond(10, true); @@ -281,10 +233,8 @@ public final class Q00417_PathOfTheScavenger extends Quest } break; } - case "30316-03.html": - { - if (hasQuestItems(player, BEAD_PARCEL)) - { + case "30316-03.html": { + if (hasQuestItems(player, BEAD_PARCEL)) { giveItems(player, ROUTS_TELEPORT_SCROLL, 1); takeItems(player, BEAD_PARCEL, 1); qs.setCond(10, true); @@ -292,10 +242,8 @@ public final class Q00417_PathOfTheScavenger extends Quest } break; } - case "30557-03.html": - { - if (hasQuestItems(player, ROUTS_TELEPORT_SCROLL)) - { + case "30557-03.html": { + if (hasQuestItems(player, ROUTS_TELEPORT_SCROLL)) { takeItems(player, ROUTS_TELEPORT_SCROLL, 1); giveItems(player, SUCCUBUS_UNDIES, 1); qs.setCond(11, true); @@ -304,23 +252,16 @@ public final class Q00417_PathOfTheScavenger extends Quest } break; } - case "31958-02.html": - { - if (qs.isMemoState(2) && hasQuestItems(player, BEAD_PARCEL2)) - { + case "31958-02.html": { + if (qs.isMemoState(2) && hasQuestItems(player, BEAD_PARCEL2)) { giveAdena(player, 163800, true); giveItems(player, RING_OF_RAVEN, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 320534, 35412); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 456128, 42110); - } - else - { + } else { addExpAndSp(player, 591724, 48808); } qs.exitQuest(false, true); @@ -335,28 +276,20 @@ public final class Q00417_PathOfTheScavenger extends Quest } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) { final QuestState qs = getQuestState(attacker, false); - if ((qs != null) && qs.isStarted()) - { - switch (npc.getId()) - { - - case HUNTER_BEAR: - { - switch (npc.getScriptValue()) - { - case 0: - { + if ((qs != null) && qs.isStarted()) { + switch (npc.getId()) { + + case HUNTER_BEAR: { + switch (npc.getScriptValue()) { + case 0: { npc.setScriptValue(1); npc.getVariables().set(FIRST_ATTACKER, attacker.getObjectId()); break; } - case 1: - { - if (npc.getVariables().getInt(FIRST_ATTACKER) != attacker.getObjectId()) - { + case 1: { + if (npc.getVariables().getInt(FIRST_ATTACKER) != attacker.getObjectId()) { npc.setScriptValue(2); } break; @@ -366,17 +299,14 @@ public final class Q00417_PathOfTheScavenger extends Quest } case HUNTER_TARANTULA: case PLUNDER_TARANTULA: - case HONEY_BEAR: - { - if (npc.isScriptValue(0)) - { + case HONEY_BEAR: { + if (npc.isScriptValue(0)) { npc.setScriptValue(1); npc.getVariables().set(FIRST_ATTACKER, attacker.getObjectId()); } // TODO: This should be skill parameter and not last skill casted. - if ((attacker.getLastSkillCast() != null) && (attacker.getLastSkillCast().getId() == SPOIL)) - { + if ((attacker.getLastSkillCast() != null) && (attacker.getLastSkillCast().getId() == SPOIL)) { npc.setScriptValue(2); attacker.setLastSkillCast(null); // Reset last skill cast. } @@ -388,49 +318,35 @@ public final class Q00417_PathOfTheScavenger extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true) && npc.isAttackable()) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true) && npc.isAttackable()) { final boolean firstAttacker = (killer.getObjectId() == npc.getVariables().getInt(FIRST_ATTACKER)); - switch (npc.getId()) - { - case HUNTER_BEAR: - { - if (npc.isScriptValue(1) && firstAttacker && hasQuestItems(killer, BEAR_PICTURE) && (getQuestItemsCount(killer, HONEY_JAR) < 5)) - { + switch (npc.getId()) { + case HUNTER_BEAR: { + if (npc.isScriptValue(1) && firstAttacker && hasQuestItems(killer, BEAR_PICTURE) && (getQuestItemsCount(killer, HONEY_JAR) < 5)) { final int flag = qs.getInt(FLAG); - if ((flag > 0) && (getRandom(100) < (20 * flag))) - { + if ((flag > 0) && (getRandom(100) < (20 * flag))) { addSpawn(HONEY_BEAR, npc, true, 0, true); qs.set(FLAG, 0); - } - else - { + } else { qs.set(FLAG, flag + 1); } } break; } - case HONEY_BEAR: - { - if (npc.isScriptValue(2) && firstAttacker && ((L2Attackable) npc).isSpoiled() && hasQuestItems(killer, BEAR_PICTURE)) - { - if (giveItemRandomly(killer, npc, HONEY_JAR, 1, 5, 1.0, true)) - { + case HONEY_BEAR: { + if (npc.isScriptValue(2) && firstAttacker && ((L2Attackable) npc).isSpoiled() && hasQuestItems(killer, BEAR_PICTURE)) { + if (giveItemRandomly(killer, npc, HONEY_JAR, 1, 5, 1.0, true)) { qs.setCond(6); } } break; } case HUNTER_TARANTULA: - case PLUNDER_TARANTULA: - { - if (npc.isScriptValue(2) && firstAttacker && ((L2Attackable) npc).isSpoiled() && hasQuestItems(killer, TARANTULA_PICTURE)) - { - if (giveItemRandomly(killer, npc, BEAD, 1, 20, 1.0, true)) - { + case PLUNDER_TARANTULA: { + if (npc.isScriptValue(2) && firstAttacker && ((L2Attackable) npc).isSpoiled() && hasQuestItems(killer, TARANTULA_PICTURE)) { + if (giveItemRandomly(killer, npc, BEAD, 1, 20, 1.0, true)) { qs.setCond(8); } } @@ -442,59 +358,37 @@ public final class Q00417_PathOfTheScavenger extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated() || qs.isCompleted()) - { - if (npc.getId() == COLLECTOR_PIPI) - { + if (qs.isCreated() || qs.isCompleted()) { + if (npc.getId() == COLLECTOR_PIPI) { htmltext = "30524-01.htm"; } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case COLLECTOR_PIPI: - { - if (hasQuestItems(player, PIPPIS_LETTER_OF_RECOMMENDATION)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case COLLECTOR_PIPI: { + if (hasQuestItems(player, PIPPIS_LETTER_OF_RECOMMENDATION)) { htmltext = "30524-06.html"; - } - else - { + } else { htmltext = "30524-07.html"; } break; } - case TRADER_MION: - { - if (hasQuestItems(player, PIPPIS_LETTER_OF_RECOMMENDATION)) - { + case TRADER_MION: { + if (hasQuestItems(player, PIPPIS_LETTER_OF_RECOMMENDATION)) { qs.setCond(2, true); htmltext = "30519-01.html"; - } - else if ((getQuestItemsCount(player, SHARIS_AXE) + getQuestItemsCount(player, BRONKS_INGOT) + getQuestItemsCount(player, ZIMENFS_POTION)) == 1) - { - if ((qs.getMemoStateEx(1) % 10) == 0) - { + } else if ((getQuestItemsCount(player, SHARIS_AXE) + getQuestItemsCount(player, BRONKS_INGOT) + getQuestItemsCount(player, ZIMENFS_POTION)) == 1) { + if ((qs.getMemoStateEx(1) % 10) == 0) { htmltext = "30519-05.html"; - } - else if ((qs.getMemoStateEx(1) % 10) > 0) - { + } else if ((qs.getMemoStateEx(1) % 10) > 0) { htmltext = "30519-08.html"; } - } - else if ((getQuestItemsCount(player, SHARIS_PAY) + getQuestItemsCount(player, BRONKS_PAY) + getQuestItemsCount(player, ZIMENFS_PAY)) == 1) - { - if (qs.getMemoStateEx(1) < 50) - { + } else if ((getQuestItemsCount(player, SHARIS_PAY) + getQuestItemsCount(player, BRONKS_PAY) + getQuestItemsCount(player, ZIMENFS_PAY)) == 1) { + if (qs.getMemoStateEx(1) < 50) { htmltext = "30519-12.html"; - } - else - { + } else { giveItems(player, MIONS_LETTER, 1); takeItems(player, SHARIS_PAY, 1); takeItems(player, ZIMENFS_PAY, 1); @@ -502,30 +396,21 @@ public final class Q00417_PathOfTheScavenger extends Quest qs.setCond(4, true); htmltext = "30519-15.html"; } - } - else if (hasQuestItems(player, MIONS_LETTER)) - { + } else if (hasQuestItems(player, MIONS_LETTER)) { htmltext = "30519-13.html"; - } - else if (hasAtLeastOneQuestItem(player, BEAR_PICTURE, TARANTULA_PICTURE, BEAD_PARCEL, ROUTS_TELEPORT_SCROLL, SUCCUBUS_UNDIES)) - { + } else if (hasAtLeastOneQuestItem(player, BEAR_PICTURE, TARANTULA_PICTURE, BEAD_PARCEL, ROUTS_TELEPORT_SCROLL, SUCCUBUS_UNDIES)) { htmltext = "30519-14.html"; } break; } - case TRADER_SHARI: - { - if (hasQuestItems(player, SHARIS_AXE)) - { - if (qs.getMemoStateEx(1) < 20) - { + case TRADER_SHARI: { + if (hasQuestItems(player, SHARIS_AXE)) { + if (qs.getMemoStateEx(1) < 20) { takeItems(player, SHARIS_AXE, 1); giveItems(player, SHARIS_PAY, 1); qs.setMemoStateEx(1, qs.getMemoStateEx(1) + 10); htmltext = "30517-01.html"; - } - else - { + } else { takeItems(player, SHARIS_AXE, 1); giveItems(player, SHARIS_PAY, 1); qs.setMemoState(1); @@ -533,26 +418,19 @@ public final class Q00417_PathOfTheScavenger extends Quest qs.setCond(3, true); htmltext = "30517-02.html"; } - } - else if (hasQuestItems(player, SHARIS_PAY)) - { + } else if (hasQuestItems(player, SHARIS_PAY)) { htmltext = "30517-03.html"; } break; } - case HEAD_BLACKSMITH_BRONK: - { - if (hasQuestItems(player, BRONKS_INGOT)) - { - if (qs.getMemoStateEx(1) < 20) - { + case HEAD_BLACKSMITH_BRONK: { + if (hasQuestItems(player, BRONKS_INGOT)) { + if (qs.getMemoStateEx(1) < 20) { takeItems(player, BRONKS_INGOT, 1); giveItems(player, BRONKS_PAY, 1); qs.setMemoStateEx(1, qs.getMemoStateEx(1) + 10); htmltext = "30525-01.html"; - } - else - { + } else { takeItems(player, BRONKS_INGOT, 1); giveItems(player, BRONKS_PAY, 1); qs.setMemoState(1); @@ -560,26 +438,19 @@ public final class Q00417_PathOfTheScavenger extends Quest qs.setCond(3, true); htmltext = "30525-02.html"; } - } - else if (hasQuestItems(player, BRONKS_PAY)) - { + } else if (hasQuestItems(player, BRONKS_PAY)) { htmltext = "30525-03.html"; } break; } - case PRIEST_OF_THE_EARTH_ZIMENF: - { - if (hasQuestItems(player, ZIMENFS_POTION)) - { - if (qs.getMemoStateEx(1) < 20) - { + case PRIEST_OF_THE_EARTH_ZIMENF: { + if (hasQuestItems(player, ZIMENFS_POTION)) { + if (qs.getMemoStateEx(1) < 20) { takeItems(player, ZIMENFS_POTION, 1); giveItems(player, ZIMENFS_PAY, 1); qs.setMemoStateEx(1, qs.getMemoStateEx(1) + 10); htmltext = "30538-01.html"; - } - else - { + } else { takeItems(player, ZIMENFS_POTION, 1); giveItems(player, ZIMENFS_PAY, 1); qs.setMemoState(1); @@ -587,88 +458,57 @@ public final class Q00417_PathOfTheScavenger extends Quest qs.setCond(3, true); htmltext = "30538-02.html"; } - } - else if (hasQuestItems(player, ZIMENFS_PAY)) - { + } else if (hasQuestItems(player, ZIMENFS_PAY)) { htmltext = "30538-03.html"; } break; } - case MASTER_TOMA: - { - if (hasQuestItems(player, MIONS_LETTER)) - { + case MASTER_TOMA: { + if (hasQuestItems(player, MIONS_LETTER)) { takeItems(player, MIONS_LETTER, 1); giveItems(player, BEAR_PICTURE, 1); qs.setCond(5, true); qs.set(FLAG, 0); htmltext = "30556-01.html"; - } - else if (hasQuestItems(player, BEAR_PICTURE)) - { - if (getQuestItemsCount(player, HONEY_JAR) < 5) - { + } else if (hasQuestItems(player, BEAR_PICTURE)) { + if (getQuestItemsCount(player, HONEY_JAR) < 5) { htmltext = "30556-02.html"; - } - else - { + } else { takeItems(player, BEAR_PICTURE, 1); giveItems(player, TARANTULA_PICTURE, 1); takeItems(player, HONEY_JAR, -1); qs.setCond(7, true); htmltext = "30556-03.html"; } - } - else if (hasQuestItems(player, TARANTULA_PICTURE)) - { - if (getQuestItemsCount(player, BEAD) < 20) - { + } else if (hasQuestItems(player, TARANTULA_PICTURE)) { + if (getQuestItemsCount(player, BEAD) < 20) { htmltext = "30556-04.html"; - } - else - { + } else { htmltext = "30556-05a.html"; } - } - else if (hasQuestItems(player, BEAD_PARCEL) && !hasQuestItems(player, BEAD_PARCEL2)) - { + } else if (hasQuestItems(player, BEAD_PARCEL) && !hasQuestItems(player, BEAD_PARCEL2)) { htmltext = "30556-06a.html"; - } - else if (hasQuestItems(player, BEAD_PARCEL2) && !hasQuestItems(player, BEAD_PARCEL) && qs.isMemoState(2)) - { + } else if (hasQuestItems(player, BEAD_PARCEL2) && !hasQuestItems(player, BEAD_PARCEL) && qs.isMemoState(2)) { htmltext = "30556-06c.html"; - } - else if (hasAtLeastOneQuestItem(player, ROUTS_TELEPORT_SCROLL, SUCCUBUS_UNDIES)) - { + } else if (hasAtLeastOneQuestItem(player, ROUTS_TELEPORT_SCROLL, SUCCUBUS_UNDIES)) { htmltext = "30556-07.html"; } break; } - case WAREHOUSE_KEEPER_RAUT: - { - if (hasQuestItems(player, BEAD_PARCEL)) - { + case WAREHOUSE_KEEPER_RAUT: { + if (hasQuestItems(player, BEAD_PARCEL)) { htmltext = "30316-01.html"; - } - else if (hasQuestItems(player, ROUTS_TELEPORT_SCROLL)) - { + } else if (hasQuestItems(player, ROUTS_TELEPORT_SCROLL)) { htmltext = "30316-04.html"; - } - else if (hasQuestItems(player, SUCCUBUS_UNDIES)) - { + } else if (hasQuestItems(player, SUCCUBUS_UNDIES)) { giveAdena(player, 81900, true); giveItems(player, RING_OF_RAVEN, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 160267, 17706); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 228064, 21055); - } - else - { + } else { addExpAndSp(player, 295862, 24404); } qs.exitQuest(false, true); @@ -678,18 +518,14 @@ public final class Q00417_PathOfTheScavenger extends Quest } break; } - case TORAI: - { - if (hasQuestItems(player, ROUTS_TELEPORT_SCROLL)) - { + case TORAI: { + if (hasQuestItems(player, ROUTS_TELEPORT_SCROLL)) { htmltext = "30557-01.html"; } break; } - case WAREHOUSE_CHIEF_YASENI: - { - if (hasQuestItems(player, BEAD_PARCEL2) && !hasQuestItems(player, BEAD_PARCEL) && qs.isMemoState(2)) - { + case WAREHOUSE_CHIEF_YASENI: { + if (hasQuestItems(player, BEAD_PARCEL2) && !hasQuestItems(player, BEAD_PARCEL) && qs.isMemoState(2)) { htmltext = "31958-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00418_PathOfTheArtisan/Q00418_PathOfTheArtisan.java b/src/main/java/com/l2jserver/datapack/quests/Q00418_PathOfTheArtisan/Q00418_PathOfTheArtisan.java index b573a5fea2..c06a15e24d 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00418_PathOfTheArtisan/Q00418_PathOfTheArtisan.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00418_PathOfTheArtisan/Q00418_PathOfTheArtisan.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Path Of The Artisan (418) * @author ivantotov */ -public final class Q00418_PathOfTheArtisan extends Quest -{ +public final class Q00418_PathOfTheArtisan extends Quest { // NPCs private static final int BLACKSMITH_SILVERA = 30527; private static final int BLACKSMITH_PINTER = 30298; @@ -60,8 +59,7 @@ public final class Q00418_PathOfTheArtisan extends Quest // Misc private static final int MIN_LEVEL = 18; - public Q00418_PathOfTheArtisan() - { + public Q00418_PathOfTheArtisan() { super(418, Q00418_PathOfTheArtisan.class.getSimpleName(), "Path Of The Artisan"); addStartNpc(BLACKSMITH_SILVERA); addTalkId(BLACKSMITH_SILVERA, BLACKSMITH_PINTER, BLACKSMITH_KLUTO, IRON_GATES_LOCKIRIN, WAREHOUSE_KEEPER_RYDEL, MINERAL_TRADER_HITCHI, RAILROAD_WORKER_OBI); @@ -70,56 +68,39 @@ public final class Q00418_PathOfTheArtisan extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (player.getClassId() == ClassId.dwarvenFighter) - { - if (player.getLevel() >= MIN_LEVEL) - { - if (hasQuestItems(player, FINAL_PASS_CERTIFICATE)) - { + switch (event) { + case "ACCEPT": { + if (player.getClassId() == ClassId.dwarvenFighter) { + if (player.getLevel() >= MIN_LEVEL) { + if (hasQuestItems(player, FINAL_PASS_CERTIFICATE)) { htmltext = "30527-04.htm"; - } - else - { + } else { htmltext = "30527-05.htm"; } - } - else - { + } else { htmltext = "30527-03.htm"; } - } - else if (player.getClassId() == ClassId.artisan) - { + } else if (player.getClassId() == ClassId.artisan) { htmltext = "30527-02a.htm"; - } - else - { + } else { htmltext = "30527-02.htm"; } break; } - case "30527-06.htm": - { + case "30527-06.htm": { qs.startQuest(); giveItems(player, SILVERYS_RING, 1); htmltext = event; break; } - case "30527-08b.html": - { + case "30527-08b.html": { takeItems(player, SILVERYS_RING, 1); takeItems(player, BOOGLE_RATMAN_TOOTH, -1); takeItems(player, BOOGLE_RATMAN_LEADERS_TOOTH, -1); @@ -128,8 +109,7 @@ public final class Q00418_PathOfTheArtisan extends Quest htmltext = event; break; } - case "30527-08c.html": - { + case "30527-08c.html": { takeItems(player, SILVERYS_RING, 1); takeItems(player, BOOGLE_RATMAN_TOOTH, -1); takeItems(player, BOOGLE_RATMAN_LEADERS_TOOTH, -1); @@ -156,15 +136,12 @@ public final class Q00418_PathOfTheArtisan extends Quest case "32052-06.html": case "32052-10.html": case "32052-11.html": - case "32052-12.html": - { + case "32052-12.html": { htmltext = event; break; } - case "30298-03.html": - { - if (hasQuestItems(player, KLUTOS_LETTER)) - { + case "30298-03.html": { + if (hasQuestItems(player, KLUTOS_LETTER)) { takeItems(player, KLUTOS_LETTER, 1); giveItems(player, FOOTPRINT_OF_THIEF, 1); qs.setCond(5, true); @@ -172,10 +149,8 @@ public final class Q00418_PathOfTheArtisan extends Quest } break; } - case "30298-06.html": - { - if (hasQuestItems(player, FOOTPRINT_OF_THIEF, STOLEN_SECRET_BOX)) - { + case "30298-06.html": { + if (hasQuestItems(player, FOOTPRINT_OF_THIEF, STOLEN_SECRET_BOX)) { giveItems(player, PASS_2ND_CERTIFICATE, 1); takeItems(player, FOOTPRINT_OF_THIEF, 1); takeItems(player, STOLEN_SECRET_BOX, 1); @@ -185,37 +160,28 @@ public final class Q00418_PathOfTheArtisan extends Quest } break; } - case "30317-04.html": - { + case "30317-04.html": { giveItems(player, KLUTOS_LETTER, 1); qs.setCond(4, true); htmltext = event; break; } - case "30317-07.html": - { + case "30317-07.html": { giveItems(player, KLUTOS_LETTER, 1); qs.setCond(4); htmltext = event; break; } - case "30317-10.html": - { - if (hasQuestItems(player, PASS_2ND_CERTIFICATE, SECRET_BOX)) - { + case "30317-10.html": { + if (hasQuestItems(player, PASS_2ND_CERTIFICATE, SECRET_BOX)) { giveAdena(player, 163800, true); giveItems(player, FINAL_PASS_CERTIFICATE, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 320534, 32452); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 456128, 30150); - } - else - { + } else { addExpAndSp(player, 591724, 36848); } qs.exitQuest(false, true); @@ -225,23 +191,16 @@ public final class Q00418_PathOfTheArtisan extends Quest } break; } - case "30317-12.html": - { - if (hasQuestItems(player, PASS_2ND_CERTIFICATE, SECRET_BOX)) - { + case "30317-12.html": { + if (hasQuestItems(player, PASS_2ND_CERTIFICATE, SECRET_BOX)) { giveAdena(player, 81900, true); giveItems(player, FINAL_PASS_CERTIFICATE, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 160267, 11726); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 228064, 15075); - } - else - { + } else { addExpAndSp(player, 295862, 18424); } qs.exitQuest(false, true); @@ -251,23 +210,16 @@ public final class Q00418_PathOfTheArtisan extends Quest } break; } - case "30531-05.html": - { - if (qs.isMemoState(101)) - { + case "30531-05.html": { + if (qs.isMemoState(101)) { giveAdena(player, 81900, true); giveItems(player, FINAL_PASS_CERTIFICATE, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 160267, 11726); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 228064, 15075); - } - else - { + } else { addExpAndSp(player, 295862, 18424); } qs.exitQuest(false, true); @@ -277,23 +229,16 @@ public final class Q00418_PathOfTheArtisan extends Quest } break; } - case "31956-04.html": - { - if (qs.isMemoState(201)) - { + case "31956-04.html": { + if (qs.isMemoState(201)) { giveAdena(player, 81900, true); giveItems(player, FINAL_PASS_CERTIFICATE, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 160267, 11726); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 228064, 15075); - } - else - { + } else { addExpAndSp(player, 295862, 18424); } qs.exitQuest(false, true); @@ -304,70 +249,53 @@ public final class Q00418_PathOfTheArtisan extends Quest break; } case "31963-02.html": - case "31963-06.html": - { - if (qs.isMemoState(100)) - { + case "31963-06.html": { + if (qs.isMemoState(100)) { htmltext = event; } break; } - case "31963-03.html": - { - if (qs.isMemoState(100)) - { + case "31963-03.html": { + if (qs.isMemoState(100)) { qs.setMemoState(101); qs.setCond(10, true); htmltext = event; } break; } - case "31963-05.html": - { - if (qs.isMemoState(100)) - { + case "31963-05.html": { + if (qs.isMemoState(100)) { qs.setMemoState(102); qs.setCond(11, true); htmltext = event; } break; } - case "31963-07.html": - { - if (qs.isMemoState(100)) - { + case "31963-07.html": { + if (qs.isMemoState(100)) { qs.setMemoState(201); qs.setCond(12, true); htmltext = event; } break; } - case "31963-09.html": - { - if (qs.isMemoState(100)) - { + case "31963-09.html": { + if (qs.isMemoState(100)) { qs.setMemoState(202); htmltext = event; } break; } - case "31963-10.html": - { - if (qs.isMemoState(202)) - { + case "31963-10.html": { + if (qs.isMemoState(202)) { giveAdena(player, 81900, true); giveItems(player, FINAL_PASS_CERTIFICATE, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 160267, 11726); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 228064, 15075); - } - else - { + } else { addExpAndSp(player, 295862, 18424); } qs.exitQuest(false, true); @@ -377,33 +305,24 @@ public final class Q00418_PathOfTheArtisan extends Quest } break; } - case "32052-07.html": - { - if (qs.isMemoState(10)) - { + case "32052-07.html": { + if (qs.isMemoState(10)) { qs.setMemoState(100); qs.setCond(9, true); htmltext = event; } break; } - case "32052-13.html": - { - if (qs.isMemoState(102)) - { + case "32052-13.html": { + if (qs.isMemoState(102)) { giveAdena(player, 81900, true); giveItems(player, FINAL_PASS_CERTIFICATE, 1); final int level = player.getLevel(); - if (level >= 20) - { + if (level >= 20) { addExpAndSp(player, 160267, 11726); - } - else if (level == 19) - { + } else if (level == 19) { addExpAndSp(player, 228064, 15075); - } - else - { + } else { addExpAndSp(player, 295862, 18424); } qs.exitQuest(false, true); @@ -418,42 +337,29 @@ public final class Q00418_PathOfTheArtisan extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case VUKU_ORC_FIGHTER: - { - if (hasQuestItems(killer, FOOTPRINT_OF_THIEF) && !hasQuestItems(killer, STOLEN_SECRET_BOX)) - { - if (getRandom(10) < 2) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case VUKU_ORC_FIGHTER: { + if (hasQuestItems(killer, FOOTPRINT_OF_THIEF) && !hasQuestItems(killer, STOLEN_SECRET_BOX)) { + if (getRandom(10) < 2) { giveItems(killer, STOLEN_SECRET_BOX, 1); qs.setCond(6, true); } } break; } - case BOOGLE_RATMAN: - { - if (hasQuestItems(killer, SILVERYS_RING) && (getQuestItemsCount(killer, BOOGLE_RATMAN_TOOTH) < 10)) - { - if (getRandom(10) < 7) - { - if (getQuestItemsCount(killer, BOOGLE_RATMAN_TOOTH) == 9) - { + case BOOGLE_RATMAN: { + if (hasQuestItems(killer, SILVERYS_RING) && (getQuestItemsCount(killer, BOOGLE_RATMAN_TOOTH) < 10)) { + if (getRandom(10) < 7) { + if (getQuestItemsCount(killer, BOOGLE_RATMAN_TOOTH) == 9) { giveItems(killer, BOOGLE_RATMAN_TOOTH, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if (getQuestItemsCount(killer, BOOGLE_RATMAN_LEADERS_TOOTH) >= 2) - { + if (getQuestItemsCount(killer, BOOGLE_RATMAN_LEADERS_TOOTH) >= 2) { qs.setCond(2); } - } - else - { + } else { giveItems(killer, BOOGLE_RATMAN_TOOTH, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -461,24 +367,17 @@ public final class Q00418_PathOfTheArtisan extends Quest } break; } - case BOOGLE_RATMAN_LEADER: - { - if (hasQuestItems(killer, SILVERYS_RING) && (getQuestItemsCount(killer, BOOGLE_RATMAN_LEADERS_TOOTH) < 2)) - { - if (getRandom(10) < 5) - { - if (getQuestItemsCount(killer, BOOGLE_RATMAN_LEADERS_TOOTH) == 1) - { + case BOOGLE_RATMAN_LEADER: { + if (hasQuestItems(killer, SILVERYS_RING) && (getQuestItemsCount(killer, BOOGLE_RATMAN_LEADERS_TOOTH) < 2)) { + if (getRandom(10) < 5) { + if (getQuestItemsCount(killer, BOOGLE_RATMAN_LEADERS_TOOTH) == 1) { giveItems(killer, BOOGLE_RATMAN_LEADERS_TOOTH, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - if (getQuestItemsCount(killer, BOOGLE_RATMAN_TOOTH) >= 10) - { + if (getQuestItemsCount(killer, BOOGLE_RATMAN_TOOTH) >= 10) { qs.setCond(2); } } - } - else - { + } else { giveItems(killer, BOOGLE_RATMAN_LEADERS_TOOTH, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -491,141 +390,97 @@ public final class Q00418_PathOfTheArtisan extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated() || qs.isCompleted()) - { - if (npc.getId() == BLACKSMITH_SILVERA) - { + if (qs.isCreated() || qs.isCompleted()) { + if (npc.getId() == BLACKSMITH_SILVERA) { htmltext = "30527-01.htm"; } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case BLACKSMITH_SILVERA: - { - if (hasQuestItems(player, SILVERYS_RING) && ((getQuestItemsCount(player, BOOGLE_RATMAN_TOOTH) + getQuestItemsCount(player, BOOGLE_RATMAN_LEADERS_TOOTH)) < 12)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case BLACKSMITH_SILVERA: { + if (hasQuestItems(player, SILVERYS_RING) && ((getQuestItemsCount(player, BOOGLE_RATMAN_TOOTH) + getQuestItemsCount(player, BOOGLE_RATMAN_LEADERS_TOOTH)) < 12)) { htmltext = "30527-07.html"; - } - else if (hasQuestItems(player, SILVERYS_RING) && (getQuestItemsCount(player, BOOGLE_RATMAN_TOOTH) >= 10) && (getQuestItemsCount(player, BOOGLE_RATMAN_LEADERS_TOOTH) >= 2)) - { + } else if (hasQuestItems(player, SILVERYS_RING) && (getQuestItemsCount(player, BOOGLE_RATMAN_TOOTH) >= 10) && (getQuestItemsCount(player, BOOGLE_RATMAN_LEADERS_TOOTH) >= 2)) { htmltext = "30527-08a.html"; - } - else if (hasQuestItems(player, PASS_1ST_CERTIFICATE)) - { + } else if (hasQuestItems(player, PASS_1ST_CERTIFICATE)) { htmltext = "30527-09.html"; - } - else if (!hasQuestItems(player, PASS_1ST_CERTIFICATE) && qs.isMemoState(10)) - { + } else if (!hasQuestItems(player, PASS_1ST_CERTIFICATE) && qs.isMemoState(10)) { htmltext = "30527-09a.html"; } break; } - case BLACKSMITH_PINTER: - { - if (hasQuestItems(player, PASS_1ST_CERTIFICATE, KLUTOS_LETTER)) - { + case BLACKSMITH_PINTER: { + if (hasQuestItems(player, PASS_1ST_CERTIFICATE, KLUTOS_LETTER)) { htmltext = "30298-01.html"; - } - else if (hasQuestItems(player, PASS_1ST_CERTIFICATE, FOOTPRINT_OF_THIEF) && !hasQuestItems(player, STOLEN_SECRET_BOX)) - { + } else if (hasQuestItems(player, PASS_1ST_CERTIFICATE, FOOTPRINT_OF_THIEF) && !hasQuestItems(player, STOLEN_SECRET_BOX)) { htmltext = "30298-04.html"; - } - else if (hasQuestItems(player, PASS_1ST_CERTIFICATE, FOOTPRINT_OF_THIEF, STOLEN_SECRET_BOX)) - { + } else if (hasQuestItems(player, PASS_1ST_CERTIFICATE, FOOTPRINT_OF_THIEF, STOLEN_SECRET_BOX)) { htmltext = "30298-05.html"; - } - else if (hasQuestItems(player, PASS_1ST_CERTIFICATE, PASS_2ND_CERTIFICATE, SECRET_BOX)) - { + } else if (hasQuestItems(player, PASS_1ST_CERTIFICATE, PASS_2ND_CERTIFICATE, SECRET_BOX)) { htmltext = "30298-07.html"; } break; } - case BLACKSMITH_KLUTO: - { - if (hasQuestItems(player, PASS_1ST_CERTIFICATE) && !hasAtLeastOneQuestItem(player, FOOTPRINT_OF_THIEF, KLUTOS_LETTER, PASS_2ND_CERTIFICATE, SECRET_BOX)) - { + case BLACKSMITH_KLUTO: { + if (hasQuestItems(player, PASS_1ST_CERTIFICATE) && !hasAtLeastOneQuestItem(player, FOOTPRINT_OF_THIEF, KLUTOS_LETTER, PASS_2ND_CERTIFICATE, SECRET_BOX)) { htmltext = "30317-01.html"; - } - else if (hasQuestItems(player, PASS_1ST_CERTIFICATE) && hasAtLeastOneQuestItem(player, KLUTOS_LETTER, FOOTPRINT_OF_THIEF)) - { + } else if (hasQuestItems(player, PASS_1ST_CERTIFICATE) && hasAtLeastOneQuestItem(player, KLUTOS_LETTER, FOOTPRINT_OF_THIEF)) { htmltext = "30317-08.html"; - } - else if (hasQuestItems(player, PASS_1ST_CERTIFICATE, PASS_2ND_CERTIFICATE, SECRET_BOX)) - { + } else if (hasQuestItems(player, PASS_1ST_CERTIFICATE, PASS_2ND_CERTIFICATE, SECRET_BOX)) { htmltext = "30317-09.html"; } break; } - case IRON_GATES_LOCKIRIN: - { - if (qs.isMemoState(101)) - { + case IRON_GATES_LOCKIRIN: { + if (qs.isMemoState(101)) { htmltext = "30531-01.html"; } break; } - case WAREHOUSE_KEEPER_RYDEL: - { - if (qs.isMemoState(201)) - { + case WAREHOUSE_KEEPER_RYDEL: { + if (qs.isMemoState(201)) { htmltext = "31956-01.html"; } break; } - case MINERAL_TRADER_HITCHI: - { - switch (qs.getMemoState()) - { - case 100: - { + case MINERAL_TRADER_HITCHI: { + switch (qs.getMemoState()) { + case 100: { htmltext = "31963-01.html"; break; } - case 101: - { + case 101: { htmltext = "31963-04.html"; break; } - case 102: - { + case 102: { htmltext = "31963-06a.html"; break; } - case 201: - { + case 201: { htmltext = "31963-08.html"; break; } - case 202: - { + case 202: { htmltext = "31963-11.html"; break; } } break; } - case RAILROAD_WORKER_OBI: - { - switch (qs.getMemoState()) - { - case 10: - { + case RAILROAD_WORKER_OBI: { + switch (qs.getMemoState()) { + case 10: { htmltext = "32052-01.html"; break; } - case 100: - { + case 100: { htmltext = "32052-08.html"; break; } - case 102: - { + case 102: { htmltext = "32052-09.html"; break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00419_GetAPet/Q00419_GetAPet.java b/src/main/java/com/l2jserver/datapack/quests/Q00419_GetAPet/Q00419_GetAPet.java index ca0d24bf88..d880a4f3f3 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00419_GetAPet/Q00419_GetAPet.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00419_GetAPet/Q00419_GetAPet.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.util.Util; * Get A Pet (419) * @author ivantotov */ -public final class Q00419_GetAPet extends Quest -{ +public final class Q00419_GetAPet extends Quest { // NPCs private static final int GUARD_METTY = 30072; private static final int ACCESSORY_MERCHANT_ELICE = 30091; @@ -77,8 +76,7 @@ public final class Q00419_GetAPet extends Quest // Links private static final Map<Integer, String> LINKS = new HashMap<>(); - static - { + static { LINKS.put(1110001, "<a action=\"bypass -h Quest Q00419_GetAPet 30731-14.html\">Can be used for item transportation.</a><br>"); LINKS.put(1110002, "<a action=\"bypass -h Quest Q00419_GetAPet 30731-14.html\">Can help during hunting by assisting in attacks.</a><br>"); LINKS.put(1110003, "<a action=\"bypass -h Quest Q00419_GetAPet QUESTIONS\">Can be sent to the village to buy items.</a><br>"); @@ -151,8 +149,7 @@ public final class Q00419_GetAPet extends Quest LINKS.put(1110070, "<a action=\"bypass -h Quest Q00419_GetAPet 30731-14.html\">None of the above.</a><br>"); } - public Q00419_GetAPet() - { + public Q00419_GetAPet() { super(419, Q00419_GetAPet.class.getSimpleName(), "Get A Pet"); addStartNpc(PET_MENAGER_MARTIN); addTalkId(PET_MENAGER_MARTIN, GUARD_METTY, ACCESSORY_MERCHANT_ELICE, GATEKEEPER_BELLA); @@ -161,49 +158,33 @@ public final class Q00419_GetAPet extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { - if (qs.isCreated()) - { + switch (event) { + case "ACCEPT": { + if (qs.isCreated()) { qs.startQuest(); - if (player.getRace() == Race.HUMAN) - { + if (player.getRace() == Race.HUMAN) { giveItems(player, ANIMAL_SLAYERS_1ST_LIST, 1); htmltext = "30731-04.htm"; - } - else if (player.getRace() == Race.ELF) - { + } else if (player.getRace() == Race.ELF) { giveItems(player, ANIMAL_SLAYERS_2ND_LIST, 1); htmltext = "30731-05.htm"; - } - else if (player.getRace() == Race.DARK_ELF) - { + } else if (player.getRace() == Race.DARK_ELF) { giveItems(player, ANIMAL_SLAYERS_3RD_LIST, 1); htmltext = "30731-06.htm"; - } - else if (player.getRace() == Race.ORC) - { + } else if (player.getRace() == Race.ORC) { giveItems(player, ANIMAL_SLAYERS_4TH_LIST, 1); htmltext = "30731-07.htm"; - } - else if (player.getRace() == Race.DWARF) - { + } else if (player.getRace() == Race.DWARF) { giveItems(player, ANIMAL_SLAYERS_5TH_LIST, 1); htmltext = "30731-08.htm"; - } - else if (player.getRace() == Race.KAMAEL) - { + } else if (player.getRace() == Race.KAMAEL) { giveItems(player, ANIMAL_SLAYERS_LIST, 1); htmltext = "30731-08a.htm"; } @@ -214,62 +195,43 @@ public final class Q00419_GetAPet extends Quest case "30072-02.html": case "30091-02.html": case "30256-02.html": - case "30256-03.html": - { + case "30256-03.html": { htmltext = event; break; } - case "30731-12.html": - { - if (player.getRace() == Race.HUMAN) - { - if (hasQuestItems(player, ANIMAL_SLAYERS_1ST_LIST) && (getQuestItemsCount(player, BLOODY_FANG) >= 50)) - { + case "30731-12.html": { + if (player.getRace() == Race.HUMAN) { + if (hasQuestItems(player, ANIMAL_SLAYERS_1ST_LIST) && (getQuestItemsCount(player, BLOODY_FANG) >= 50)) { takeItems(player, ANIMAL_SLAYERS_1ST_LIST, -1); takeItems(player, BLOODY_FANG, -1); giveItems(player, ANIMAL_LOVERS_LIST, 1); } - } - else if (player.getRace() == Race.ELF) - { - if (hasQuestItems(player, ANIMAL_SLAYERS_2ND_LIST) && (getQuestItemsCount(player, BLOODY_CLAW) >= 50)) - { + } else if (player.getRace() == Race.ELF) { + if (hasQuestItems(player, ANIMAL_SLAYERS_2ND_LIST) && (getQuestItemsCount(player, BLOODY_CLAW) >= 50)) { takeItems(player, ANIMAL_SLAYERS_2ND_LIST, -1); takeItems(player, BLOODY_CLAW, -1); giveItems(player, ANIMAL_LOVERS_LIST, 1); } - } - else if (player.getRace() == Race.DARK_ELF) - { - if (hasQuestItems(player, ANIMAL_SLAYERS_3RD_LIST) && (getQuestItemsCount(player, BLOODY_NAIL) >= 50)) - { + } else if (player.getRace() == Race.DARK_ELF) { + if (hasQuestItems(player, ANIMAL_SLAYERS_3RD_LIST) && (getQuestItemsCount(player, BLOODY_NAIL) >= 50)) { takeItems(player, ANIMAL_SLAYERS_3RD_LIST, -1); takeItems(player, BLOODY_NAIL, -1); giveItems(player, ANIMAL_LOVERS_LIST, 1); } - } - else if (player.getRace() == Race.ORC) - { - if (hasQuestItems(player, ANIMAL_SLAYERS_4TH_LIST) && (getQuestItemsCount(player, BLOODY_KASHA_FANG) >= 50)) - { + } else if (player.getRace() == Race.ORC) { + if (hasQuestItems(player, ANIMAL_SLAYERS_4TH_LIST) && (getQuestItemsCount(player, BLOODY_KASHA_FANG) >= 50)) { takeItems(player, ANIMAL_SLAYERS_4TH_LIST, -1); takeItems(player, BLOODY_KASHA_FANG, -1); giveItems(player, ANIMAL_LOVERS_LIST, 1); } - } - else if (player.getRace() == Race.DWARF) - { - if (hasQuestItems(player, ANIMAL_SLAYERS_5TH_LIST) && (getQuestItemsCount(player, BLOODY_TARANTULA_NAIL) >= 50)) - { + } else if (player.getRace() == Race.DWARF) { + if (hasQuestItems(player, ANIMAL_SLAYERS_5TH_LIST) && (getQuestItemsCount(player, BLOODY_TARANTULA_NAIL) >= 50)) { takeItems(player, ANIMAL_SLAYERS_5TH_LIST, -1); takeItems(player, BLOODY_TARANTULA_NAIL, -1); giveItems(player, ANIMAL_LOVERS_LIST, 1); } - } - else if (player.getRace() == Race.KAMAEL) - { - if (hasQuestItems(player, ANIMAL_SLAYERS_LIST) && (getQuestItemsCount(player, BLOODY_RED_CLAW) >= 50)) - { + } else if (player.getRace() == Race.KAMAEL) { + if (hasQuestItems(player, ANIMAL_SLAYERS_LIST) && (getQuestItemsCount(player, BLOODY_RED_CLAW) >= 50)) { takeItems(player, ANIMAL_SLAYERS_LIST, -1); takeItems(player, BLOODY_RED_CLAW, -1); giveItems(player, ANIMAL_LOVERS_LIST, 1); @@ -280,30 +242,23 @@ public final class Q00419_GetAPet extends Quest break; } - case "QUESTIONS": - { - if (((qs.getMemoState() & 15) == 10) && hasQuestItems(player, ANIMAL_LOVERS_LIST)) - { + case "QUESTIONS": { + if (((qs.getMemoState() & 15) == 10) && hasQuestItems(player, ANIMAL_LOVERS_LIST)) { takeItems(player, ANIMAL_LOVERS_LIST, -1); giveItems(player, WOLF_COLLAR, 1); qs.exitQuest(true, true); htmltext = "30731-15.html"; - } - else - { + } else { boolean findResponse = false; int linkId = 0; - while (!findResponse) - { + while (!findResponse) { final int randomLinkOffset = getRandom(14) + 4; int i7 = 1; - for (int i = 1; i <= randomLinkOffset; i++) - { + for (int i = 1; i <= randomLinkOffset; i++) { i7 = i7 * 2; } - if (((i7 & qs.getMemoState()) == 0) && (randomLinkOffset < 18)) - { + if (((i7 & qs.getMemoState()) == 0) && (randomLinkOffset < 18)) { findResponse = true; qs.setMemoState((qs.getMemoState() + 1) | i7); linkId = 1110000 + (5 * (randomLinkOffset - 4)); @@ -317,31 +272,21 @@ public final class Q00419_GetAPet extends Quest int replyOffset3 = 0; int replyOffset4 = 0; int i8 = 0; - while (linkCount < 5) - { + while (linkCount < 5) { final int randomReplyOffset = getRandom(4) + 1; int i7 = 1; - for (int i = 1; i <= randomReplyOffset; i++) - { + for (int i = 1; i <= randomReplyOffset; i++) { i7 = i7 * 2; } - if (((i7 & i8) == 0) && (randomReplyOffset < 5)) - { - if (linkCount == 1) - { + if (((i7 & i8) == 0) && (randomReplyOffset < 5)) { + if (linkCount == 1) { replyOffset1 = randomReplyOffset; - } - else if (linkCount == 2) - { + } else if (linkCount == 2) { replyOffset2 = randomReplyOffset; - } - else if (linkCount == 3) - { + } else if (linkCount == 3) { replyOffset3 = randomReplyOffset; - } - else if (linkCount == 4) - { + } else if (linkCount == 4) { replyOffset4 = randomReplyOffset; } linkCount++; @@ -358,8 +303,7 @@ public final class Q00419_GetAPet extends Quest } break; } - case "30731-14.html": - { + case "30731-14.html": { qs.setMemoState(0); htmltext = event; break; @@ -369,292 +313,199 @@ public final class Q00419_GetAPet extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case LESSER_DARK_HORROR: - { - if (hasQuestItems(killer, ANIMAL_SLAYERS_3RD_LIST) && (getQuestItemsCount(killer, BLOODY_NAIL) < 50)) - { - if (getRandom(100) < 60) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case LESSER_DARK_HORROR: { + if (hasQuestItems(killer, ANIMAL_SLAYERS_3RD_LIST) && (getQuestItemsCount(killer, BLOODY_NAIL) < 50)) { + if (getRandom(100) < 60) { giveItems(killer, BLOODY_NAIL, 1); - if (getQuestItemsCount(killer, BLOODY_NAIL) >= 50) - { + if (getQuestItemsCount(killer, BLOODY_NAIL) >= 50) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case PROWLER: - { - if (hasQuestItems(killer, ANIMAL_SLAYERS_3RD_LIST) && (getQuestItemsCount(killer, BLOODY_NAIL) < 50)) - { - if (getRandom(100) < 100) - { + case PROWLER: { + if (hasQuestItems(killer, ANIMAL_SLAYERS_3RD_LIST) && (getQuestItemsCount(killer, BLOODY_NAIL) < 50)) { + if (getRandom(100) < 100) { giveItems(killer, BLOODY_NAIL, 1); - if (getQuestItemsCount(killer, BLOODY_NAIL) >= 50) - { + if (getQuestItemsCount(killer, BLOODY_NAIL) >= 50) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case GIANT_SPIDER: - { - if (hasQuestItems(killer, ANIMAL_SLAYERS_1ST_LIST)) - { - if ((getQuestItemsCount(killer, BLOODY_FANG) < 50) && (getRandom(100) < 60)) - { + case GIANT_SPIDER: { + if (hasQuestItems(killer, ANIMAL_SLAYERS_1ST_LIST)) { + if ((getQuestItemsCount(killer, BLOODY_FANG) < 50) && (getRandom(100) < 60)) { giveItems(killer, BLOODY_FANG, 1); - if (getQuestItemsCount(killer, BLOODY_FANG) >= 50) - { + if (getQuestItemsCount(killer, BLOODY_FANG) >= 50) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case DARK_HORROR: - { - if (hasQuestItems(killer, ANIMAL_SLAYERS_3RD_LIST)) - { - if ((getQuestItemsCount(killer, BLOODY_NAIL) < 50) && (getRandom(100) < 75)) - { + case DARK_HORROR: { + if (hasQuestItems(killer, ANIMAL_SLAYERS_3RD_LIST)) { + if ((getQuestItemsCount(killer, BLOODY_NAIL) < 50) && (getRandom(100) < 75)) { giveItems(killer, BLOODY_NAIL, 1); - if (getQuestItemsCount(killer, BLOODY_NAIL) >= 50) - { + if (getQuestItemsCount(killer, BLOODY_NAIL) >= 50) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case TALON_SPIDER: - { - if (hasQuestItems(killer, ANIMAL_SLAYERS_1ST_LIST)) - { - if ((getQuestItemsCount(killer, BLOODY_FANG) < 50) && (getRandom(100) < 75)) - { + case TALON_SPIDER: { + if (hasQuestItems(killer, ANIMAL_SLAYERS_1ST_LIST)) { + if ((getQuestItemsCount(killer, BLOODY_FANG) < 50) && (getRandom(100) < 75)) { giveItems(killer, BLOODY_FANG, 1); - if (getQuestItemsCount(killer, BLOODY_FANG) >= 50) - { + if (getQuestItemsCount(killer, BLOODY_FANG) >= 50) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case BLADE_SPIDER: - { - if (hasQuestItems(killer, ANIMAL_SLAYERS_1ST_LIST)) - { - if ((getQuestItemsCount(killer, BLOODY_FANG) < 50) && (getRandom(100) < 100)) - { + case BLADE_SPIDER: { + if (hasQuestItems(killer, ANIMAL_SLAYERS_1ST_LIST)) { + if ((getQuestItemsCount(killer, BLOODY_FANG) < 50) && (getRandom(100) < 100)) { giveItems(killer, BLOODY_FANG, 1); - if (getQuestItemsCount(killer, BLOODY_FANG) >= 50) - { + if (getQuestItemsCount(killer, BLOODY_FANG) >= 50) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case HOOK_SPIDER: - { - if (hasQuestItems(killer, ANIMAL_SLAYERS_2ND_LIST)) - { - if ((getQuestItemsCount(killer, BLOODY_CLAW) < 50) && (getRandom(100) < 75)) - { + case HOOK_SPIDER: { + if (hasQuestItems(killer, ANIMAL_SLAYERS_2ND_LIST)) { + if ((getQuestItemsCount(killer, BLOODY_CLAW) < 50) && (getRandom(100) < 75)) { giveItems(killer, BLOODY_CLAW, 1); - if (getQuestItemsCount(killer, BLOODY_CLAW) >= 50) - { + if (getQuestItemsCount(killer, BLOODY_CLAW) >= 50) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case HUNTER_TARANTULA: - { - if (hasQuestItems(killer, ANIMAL_SLAYERS_5TH_LIST)) - { - if ((getQuestItemsCount(killer, BLOODY_TARANTULA_NAIL) < 50) && (getRandom(100) < 75)) - { + case HUNTER_TARANTULA: { + if (hasQuestItems(killer, ANIMAL_SLAYERS_5TH_LIST)) { + if ((getQuestItemsCount(killer, BLOODY_TARANTULA_NAIL) < 50) && (getRandom(100) < 75)) { giveItems(killer, BLOODY_TARANTULA_NAIL, 1); - if (getQuestItemsCount(killer, BLOODY_TARANTULA_NAIL) >= 50) - { + if (getQuestItemsCount(killer, BLOODY_TARANTULA_NAIL) >= 50) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case CRIMSON_SPIDER: - { - if (hasQuestItems(killer, ANIMAL_SLAYERS_2ND_LIST) && (getQuestItemsCount(killer, BLOODY_CLAW) < 50)) - { - if (getRandom(100) < 60) - { + case CRIMSON_SPIDER: { + if (hasQuestItems(killer, ANIMAL_SLAYERS_2ND_LIST) && (getQuestItemsCount(killer, BLOODY_CLAW) < 50)) { + if (getRandom(100) < 60) { giveItems(killer, BLOODY_CLAW, 1); - if (getQuestItemsCount(killer, BLOODY_CLAW) >= 50) - { + if (getQuestItemsCount(killer, BLOODY_CLAW) >= 50) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case PINCER_SPIDER: - { - if (hasQuestItems(killer, ANIMAL_SLAYERS_2ND_LIST)) - { - if ((getQuestItemsCount(killer, BLOODY_CLAW) < 50) && (getRandom(100) < 100)) - { + case PINCER_SPIDER: { + if (hasQuestItems(killer, ANIMAL_SLAYERS_2ND_LIST)) { + if ((getQuestItemsCount(killer, BLOODY_CLAW) < 50) && (getRandom(100) < 100)) { giveItems(killer, BLOODY_CLAW, 1); - if (getQuestItemsCount(killer, BLOODY_CLAW) >= 50) - { + if (getQuestItemsCount(killer, BLOODY_CLAW) >= 50) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case KASHA_SPIDER: - { - if (hasQuestItems(killer, ANIMAL_SLAYERS_4TH_LIST)) - { - if ((getQuestItemsCount(killer, BLOODY_KASHA_FANG) < 50) && (getRandom(100) < 60)) - { + case KASHA_SPIDER: { + if (hasQuestItems(killer, ANIMAL_SLAYERS_4TH_LIST)) { + if ((getQuestItemsCount(killer, BLOODY_KASHA_FANG) < 50) && (getRandom(100) < 60)) { giveItems(killer, BLOODY_KASHA_FANG, 1); - if (getQuestItemsCount(killer, BLOODY_KASHA_FANG) >= 50) - { + if (getQuestItemsCount(killer, BLOODY_KASHA_FANG) >= 50) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case KASHA_FANG_SPIDER: - { - if (hasQuestItems(killer, ANIMAL_SLAYERS_4TH_LIST) && (getQuestItemsCount(killer, BLOODY_KASHA_FANG) < 50)) - { - if (getRandom(100) < 75) - { + case KASHA_FANG_SPIDER: { + if (hasQuestItems(killer, ANIMAL_SLAYERS_4TH_LIST) && (getQuestItemsCount(killer, BLOODY_KASHA_FANG) < 50)) { + if (getRandom(100) < 75) { giveItems(killer, BLOODY_KASHA_FANG, 1); - if (getQuestItemsCount(killer, BLOODY_KASHA_FANG) >= 50) - { + if (getQuestItemsCount(killer, BLOODY_KASHA_FANG) >= 50) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case KASHA_BLADE_SPIDER: - { - if (hasQuestItems(killer, ANIMAL_SLAYERS_4TH_LIST)) - { - if ((getQuestItemsCount(killer, BLOODY_KASHA_FANG) < 50) && (getRandom(100) < 100)) - { + case KASHA_BLADE_SPIDER: { + if (hasQuestItems(killer, ANIMAL_SLAYERS_4TH_LIST)) { + if ((getQuestItemsCount(killer, BLOODY_KASHA_FANG) < 50) && (getRandom(100) < 100)) { giveItems(killer, BLOODY_KASHA_FANG, 1); - if (getQuestItemsCount(killer, BLOODY_KASHA_FANG) >= 50) - { + if (getQuestItemsCount(killer, BLOODY_KASHA_FANG) >= 50) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case PLUNDER_TARANTULA: - { - if (hasQuestItems(killer, ANIMAL_SLAYERS_5TH_LIST)) - { - if ((getQuestItemsCount(killer, BLOODY_TARANTULA_NAIL) < 50) && (getRandom(100) < 100)) - { + case PLUNDER_TARANTULA: { + if (hasQuestItems(killer, ANIMAL_SLAYERS_5TH_LIST)) { + if ((getQuestItemsCount(killer, BLOODY_TARANTULA_NAIL) < 50) && (getRandom(100) < 100)) { giveItems(killer, BLOODY_TARANTULA_NAIL, 1); - if (getQuestItemsCount(killer, BLOODY_TARANTULA_NAIL) >= 50) - { + if (getQuestItemsCount(killer, BLOODY_TARANTULA_NAIL) >= 50) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } } break; } - case CRIMSON_SPIDER2: - { - if (hasQuestItems(killer, ANIMAL_SLAYERS_LIST)) - { - if ((getQuestItemsCount(killer, BLOODY_RED_CLAW) < 50) && (getRandom(100) < 75)) - { + case CRIMSON_SPIDER2: { + if (hasQuestItems(killer, ANIMAL_SLAYERS_LIST)) { + if ((getQuestItemsCount(killer, BLOODY_RED_CLAW) < 50) && (getRandom(100) < 75)) { giveItems(killer, BLOODY_RED_CLAW, 1); - if (getQuestItemsCount(killer, BLOODY_RED_CLAW) >= 50) - { + if (getQuestItemsCount(killer, BLOODY_RED_CLAW) >= 50) { playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -667,146 +518,84 @@ public final class Q00419_GetAPet extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == PET_MENAGER_MARTIN) - { - if (player.getLevel() < MIN_LEVEL) - { + if (qs.isCreated()) { + if (npc.getId() == PET_MENAGER_MARTIN) { + if (player.getLevel() < MIN_LEVEL) { htmltext = "30731-01.htm"; - } - else - { + } else { htmltext = "30731-02.htm"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case PET_MENAGER_MARTIN: - { - if (hasQuestItems(player, ANIMAL_SLAYERS_LIST)) - { - if (getQuestItemsCount(player, BLOODY_RED_CLAW) < 50) - { - if (!hasQuestItems(player, BLOODY_RED_CLAW)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case PET_MENAGER_MARTIN: { + if (hasQuestItems(player, ANIMAL_SLAYERS_LIST)) { + if (getQuestItemsCount(player, BLOODY_RED_CLAW) < 50) { + if (!hasQuestItems(player, BLOODY_RED_CLAW)) { htmltext = "30731-09.html"; - } - else - { + } else { htmltext = "30731-10.html"; } - } - else - { + } else { htmltext = "30731-11.html"; } - } - else if (hasQuestItems(player, ANIMAL_SLAYERS_1ST_LIST)) - { - if (getQuestItemsCount(player, BLOODY_FANG) < 50) - { - if (!hasQuestItems(player, BLOODY_FANG)) - { + } else if (hasQuestItems(player, ANIMAL_SLAYERS_1ST_LIST)) { + if (getQuestItemsCount(player, BLOODY_FANG) < 50) { + if (!hasQuestItems(player, BLOODY_FANG)) { htmltext = "30731-09.html"; - } - else - { + } else { htmltext = "30731-10.html"; } - } - else - { + } else { htmltext = "30731-11.html"; } - } - else if (hasQuestItems(player, ANIMAL_SLAYERS_2ND_LIST)) - { - if (getQuestItemsCount(player, BLOODY_CLAW) < 50) - { - if (!hasQuestItems(player, BLOODY_CLAW)) - { + } else if (hasQuestItems(player, ANIMAL_SLAYERS_2ND_LIST)) { + if (getQuestItemsCount(player, BLOODY_CLAW) < 50) { + if (!hasQuestItems(player, BLOODY_CLAW)) { htmltext = "30731-09.html"; - } - else - { + } else { htmltext = "30731-10.html"; } - } - else - { + } else { htmltext = "30731-11.html"; } - } - else if (hasQuestItems(player, ANIMAL_SLAYERS_3RD_LIST)) - { - if (getQuestItemsCount(player, BLOODY_NAIL) < 50) - { - if (!hasQuestItems(player, BLOODY_NAIL)) - { + } else if (hasQuestItems(player, ANIMAL_SLAYERS_3RD_LIST)) { + if (getQuestItemsCount(player, BLOODY_NAIL) < 50) { + if (!hasQuestItems(player, BLOODY_NAIL)) { htmltext = "30731-09.html"; - } - else - { + } else { htmltext = "30731-10.html"; } - } - else - { + } else { htmltext = "30731-11.html"; } - } - else if (hasQuestItems(player, ANIMAL_SLAYERS_4TH_LIST)) - { - if (getQuestItemsCount(player, BLOODY_KASHA_FANG) < 50) - { - if (!hasQuestItems(player, BLOODY_KASHA_FANG)) - { + } else if (hasQuestItems(player, ANIMAL_SLAYERS_4TH_LIST)) { + if (getQuestItemsCount(player, BLOODY_KASHA_FANG) < 50) { + if (!hasQuestItems(player, BLOODY_KASHA_FANG)) { htmltext = "30731-09.html"; - } - else - { + } else { htmltext = "30731-10.html"; } - } - else - { + } else { htmltext = "30731-11.html"; } - } - else if (hasQuestItems(player, ANIMAL_SLAYERS_5TH_LIST)) - { - if (getQuestItemsCount(player, BLOODY_TARANTULA_NAIL) < 50) - { - if (!hasQuestItems(player, BLOODY_TARANTULA_NAIL)) - { + } else if (hasQuestItems(player, ANIMAL_SLAYERS_5TH_LIST)) { + if (getQuestItemsCount(player, BLOODY_TARANTULA_NAIL) < 50) { + if (!hasQuestItems(player, BLOODY_TARANTULA_NAIL)) { htmltext = "30731-09.html"; - } - else - { + } else { htmltext = "30731-10.html"; } - } - else - { + } else { htmltext = "30731-11.html"; } - } - else if (hasQuestItems(player, ANIMAL_LOVERS_LIST)) - { - if ((qs.getMemoState() != 14) && (qs.getMemoState() != 1879048192)) - { + } else if (hasQuestItems(player, ANIMAL_LOVERS_LIST)) { + if ((qs.getMemoState() != 14) && (qs.getMemoState() != 1879048192)) { htmltext = "30731-16.html"; - } - else - { + } else { qs.setMemoState(1879048192); htmltext = "30731-13.html"; } @@ -814,28 +603,22 @@ public final class Q00419_GetAPet extends Quest } break; } - case GUARD_METTY: - { - if (hasQuestItems(player, ANIMAL_LOVERS_LIST)) - { + case GUARD_METTY: { + if (hasQuestItems(player, ANIMAL_LOVERS_LIST)) { qs.setMemoState(qs.getMemoState() | 4); htmltext = "30072-01.html"; } break; } - case ACCESSORY_MERCHANT_ELICE: - { - if (hasQuestItems(player, ANIMAL_LOVERS_LIST)) - { + case ACCESSORY_MERCHANT_ELICE: { + if (hasQuestItems(player, ANIMAL_LOVERS_LIST)) { qs.setMemoState(qs.getMemoState() | 8); htmltext = "30091-01.html"; } break; } - case GATEKEEPER_BELLA: - { - if (hasQuestItems(player, ANIMAL_LOVERS_LIST)) - { + case GATEKEEPER_BELLA: { + if (hasQuestItems(player, ANIMAL_LOVERS_LIST)) { qs.setMemoState(qs.getMemoState() | 2); htmltext = "30256-01.html"; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00420_LittleWing/Q00420_LittleWing.java b/src/main/java/com/l2jserver/datapack/quests/Q00420_LittleWing/Q00420_LittleWing.java index db2864962e..e21e7ad814 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00420_LittleWing/Q00420_LittleWing.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00420_LittleWing/Q00420_LittleWing.java @@ -37,8 +37,7 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * Little Wing (420) * @author Pandragon */ -public final class Q00420_LittleWing extends Quest -{ +public final class Q00420_LittleWing extends Quest { // NPCs private static final int MARIA = 30608; private static final int CRONOS = 30610; @@ -81,8 +80,7 @@ public final class Q00420_LittleWing extends Quest private static final int BREKA_OVERLORD = 20270; private static final int ROAD_SCAVENGER = 20551; private static final int LETO_WARRIOR = 20580; - private static final int[] DELUXE_STONE_BREAKERS = - { + private static final int[] DELUXE_STONE_BREAKERS = { 20589, // Fline 20590, // Liele 20591, // Valley Treant @@ -119,8 +117,7 @@ public final class Q00420_LittleWing extends Quest // Misc private static final int MIN_LVL = 35; - public Q00420_LittleWing() - { + public Q00420_LittleWing() { super(420, Q00420_LittleWing.class.getSimpleName(), "Little Wing"); addStartNpc(COOPER); addTalkId(MARIA, CRONOS, BYRON, MIMYU, EXARION, ZWOV, KALIBRAN, SUZET, SHAMHAI, COOPER); @@ -130,41 +127,33 @@ public final class Q00420_LittleWing extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { + switch (event) { case "30610-02.html": case "30610-03.html": case "30610-04.html": case "30711-02.html": case "30747-05.html": case "30747-06.html": - case "30751-02.html": - { + case "30751-02.html": { htmltext = event; break; } - case "30829-02.htm": - { - if (qs.isCreated()) - { + case "30829-02.htm": { + if (qs.isCreated()) { qs.startQuest(); htmltext = event; } break; } - case "30610-05.html": - { - if (qs.isCond(1)) - { + case "30610-05.html": { + if (qs.isCond(1)) { qs.setCond(2, true); qs.set("old_stone", 0); qs.set("fairy_stone", 1); @@ -173,10 +162,8 @@ public final class Q00420_LittleWing extends Quest } break; } - case "30610-06.html": - { - if (qs.isCond(1)) - { + case "30610-06.html": { + if (qs.isCond(1)) { qs.setCond(2, true); qs.set("old_stone", 0); qs.set("fairy_stone", 2); @@ -185,10 +172,8 @@ public final class Q00420_LittleWing extends Quest } break; } - case "30610-12.html": - { - if (qs.isCond(5)) - { + case "30610-12.html": { + if (qs.isCond(5)) { qs.setCond(2, true); qs.set("old_stone", qs.getInt("fairy_stone")); qs.set("fairy_stone", 1); @@ -197,10 +182,8 @@ public final class Q00420_LittleWing extends Quest } break; } - case "30610-13.html": - { - if (qs.isCond(5)) - { + case "30610-13.html": { + if (qs.isCond(5)) { qs.setCond(2, true); qs.set("old_stone", qs.getInt("fairy_stone")); qs.set("fairy_stone", 2); @@ -209,12 +192,9 @@ public final class Q00420_LittleWing extends Quest } break; } - case "30608-03.html": - { - if (qs.isCond(2)) - { - if ((qs.getInt("fairy_stone") == 1) && (getQuestItemsCount(player, COAL) >= 10) && (getQuestItemsCount(player, CHARCOAL) >= 10) && (getQuestItemsCount(player, GEMSTONE_D) >= 1) && (getQuestItemsCount(player, SILVER_NUGGET) >= 3) && (getQuestItemsCount(player, TOAD_SKIN) >= 10)) - { + case "30608-03.html": { + if (qs.isCond(2)) { + if ((qs.getInt("fairy_stone") == 1) && (getQuestItemsCount(player, COAL) >= 10) && (getQuestItemsCount(player, CHARCOAL) >= 10) && (getQuestItemsCount(player, GEMSTONE_D) >= 1) && (getQuestItemsCount(player, SILVER_NUGGET) >= 3) && (getQuestItemsCount(player, TOAD_SKIN) >= 10)) { takeItems(player, FAIRY_STONE_LIST, -1); takeItems(player, COAL, 10); takeItems(player, CHARCOAL, 10); @@ -228,12 +208,10 @@ public final class Q00420_LittleWing extends Quest } break; } - case "30608-05.html": - { - if (qs.isCond(2)) - { - if ((qs.getInt("fairy_stone") == 2) && (getQuestItemsCount(player, COAL) >= 10) && (getQuestItemsCount(player, CHARCOAL) >= 10) && (getQuestItemsCount(player, GEMSTONE_C) >= 1) && (getQuestItemsCount(player, STONE_OF_PURITY) >= 1) && (getQuestItemsCount(player, SILVER_NUGGET) >= 5) && (getQuestItemsCount(player, TOAD_SKIN) >= 20)) - { + case "30608-05.html": { + if (qs.isCond(2)) { + if ((qs.getInt("fairy_stone") == 2) && (getQuestItemsCount(player, COAL) >= 10) && (getQuestItemsCount(player, CHARCOAL) >= 10) && (getQuestItemsCount(player, GEMSTONE_C) >= 1) && (getQuestItemsCount(player, STONE_OF_PURITY) >= 1) + && (getQuestItemsCount(player, SILVER_NUGGET) >= 5) && (getQuestItemsCount(player, TOAD_SKIN) >= 20)) { takeItems(player, DELUXE_STONE_LIST, -1); takeItems(player, COAL, 10); takeItems(player, CHARCOAL, 10); @@ -248,30 +226,22 @@ public final class Q00420_LittleWing extends Quest } break; } - case "30711-03.html": - { - if (qs.isCond(3)) - { + case "30711-03.html": { + if (qs.isCond(3)) { qs.setCond(4, true); - if (qs.getInt("fairy_stone") == 2) - { + if (qs.getInt("fairy_stone") == 2) { htmltext = "30711-04.html"; - } - else - { + } else { htmltext = event; } } break; } case "30747-02.html": - case "30747-04.html": - { - if (qs.isCond(4) && ((getQuestItemsCount(player, FAIRY_STONE) + getQuestItemsCount(player, DELUXE_FAIRY_STONE)) > 0)) - { + case "30747-04.html": { + if (qs.isCond(4) && ((getQuestItemsCount(player, FAIRY_STONE) + getQuestItemsCount(player, DELUXE_FAIRY_STONE)) > 0)) { takeItems(player, -1, FAIRY_STONE, DELUXE_FAIRY_STONE); - if (qs.getInt("fairy_stone") == 2) - { + if (qs.getInt("fairy_stone") == 2) { giveItems(player, FAIRY_DUST, 1); } qs.setCond(5, true); @@ -280,58 +250,42 @@ public final class Q00420_LittleWing extends Quest break; } case "30747-07.html": - case "30747-08.html": - { - if (qs.isCond(5) && (getQuestItemsCount(player, MONKSHOOD_JUICE) == 0)) - { + case "30747-08.html": { + if (qs.isCond(5) && (getQuestItemsCount(player, MONKSHOOD_JUICE) == 0)) { giveItems(player, MONKSHOOD_JUICE, 1); htmltext = event; } break; } - case "30747-12.html": - { - if (qs.isCond(7)) - { - if ((qs.getInt("fairy_stone") == 1) || (getQuestItemsCount(player, FAIRY_DUST) == 0)) - { + case "30747-12.html": { + if (qs.isCond(7)) { + if ((qs.getInt("fairy_stone") == 1) || (getQuestItemsCount(player, FAIRY_DUST) == 0)) { giveReward(player); qs.exitQuest(true, true); htmltext = "30747-16.html"; - } - else - { + } else { qs.setCond(8, false); htmltext = event; } - } - else if (qs.isCond(8)) - { + } else if (qs.isCond(8)) { htmltext = event; } break; } - case "30747-13.html": - { - if (qs.isCond(8)) - { + case "30747-13.html": { + if (qs.isCond(8)) { giveReward(player); qs.exitQuest(true, true); htmltext = event; } break; } - case "30747-15.html": - { - if (qs.isCond(8) && (getQuestItemsCount(player, FAIRY_DUST) > 1)) - { - if (getRandom(100) < 5) - { + case "30747-15.html": { + if (qs.isCond(8) && (getQuestItemsCount(player, FAIRY_DUST) > 1)) { + if (getRandom(100) < 5) { giveItems(player, HATCHLING_ARMOR, 1); htmltext = "30747-14.html"; - } - else - { + } else { giveItems(player, HATCHLING_FOOD, 20); htmltext = event; } @@ -341,10 +295,8 @@ public final class Q00420_LittleWing extends Quest } break; } - case "30748-02.html": - { - if (qs.isCond(5)) - { + case "30748-02.html": { + if (qs.isCond(5)) { takeItems(player, MONKSHOOD_JUICE, -1); giveItems(player, EXARION_SCALE, 1); qs.setCond(6, true); @@ -353,10 +305,8 @@ public final class Q00420_LittleWing extends Quest } break; } - case "30749-02.html": - { - if (qs.isCond(5)) - { + case "30749-02.html": { + if (qs.isCond(5)) { takeItems(player, MONKSHOOD_JUICE, -1); giveItems(player, ZWOV_SCALE, 1); qs.setCond(6, true); @@ -365,10 +315,8 @@ public final class Q00420_LittleWing extends Quest } break; } - case "30750-02.html": - { - if (qs.isCond(5)) - { + case "30750-02.html": { + if (qs.isCond(5)) { takeItems(player, MONKSHOOD_JUICE, -1); giveItems(player, KALIBRAN_SCALE, 1); qs.setCond(6, true); @@ -377,10 +325,8 @@ public final class Q00420_LittleWing extends Quest } break; } - case "30750-05.html": - { - if (qs.isCond(6) && (getQuestItemsCount(player, KALIBRAN_EGG) >= 20)) - { + case "30750-05.html": { + if (qs.isCond(6) && (getQuestItemsCount(player, KALIBRAN_EGG) >= 20)) { takeItems(player, -1, KALIBRAN_SCALE, KALIBRAN_EGG); giveItems(player, KALIBRAN_EGG, 1); qs.setCond(7, true); @@ -388,10 +334,8 @@ public final class Q00420_LittleWing extends Quest } break; } - case "30751-03.html": - { - if (qs.isCond(5)) - { + case "30751-03.html": { + if (qs.isCond(5)) { takeItems(player, MONKSHOOD_JUICE, -1); giveItems(player, SUZET_SCALE, 1); qs.setCond(6, true); @@ -400,10 +344,8 @@ public final class Q00420_LittleWing extends Quest } break; } - case "30752-02.html": - { - if (qs.isCond(5)) - { + case "30752-02.html": { + if (qs.isCond(5)) { takeItems(player, MONKSHOOD_JUICE, -1); giveItems(player, SHAMHAI_SCALE, 1); qs.setCond(6, true); @@ -417,11 +359,9 @@ public final class Q00420_LittleWing extends Quest } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { final QuestState qs = getQuestState(attacker, false); - if ((qs != null) && (getQuestItemsCount(attacker, DELUXE_FAIRY_STONE) > 0) && (getRandom(100) < 30)) - { + if ((qs != null) && (getQuestItemsCount(attacker, DELUXE_FAIRY_STONE) > 0) && (getRandom(100) < 30)) { takeItems(attacker, DELUXE_FAIRY_STONE, -1); qs.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.THE_STONE_THE_ELVEN_STONE_BROKE)); @@ -430,68 +370,48 @@ public final class Q00420_LittleWing extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (qs.getState()) - { - case State.CREATED: - { - if (npc.getId() == COOPER) - { + switch (qs.getState()) { + case State.CREATED: { + if (npc.getId() == COOPER) { htmltext = ((talker.getLevel() >= MIN_LVL) ? "30829-01.htm" : "30829-03.html"); } break; } - case State.STARTED: - { - switch (npc.getId()) - { - case COOPER: - { + case State.STARTED: { + switch (npc.getId()) { + case COOPER: { htmltext = "30829-04.html"; break; } - case CRONOS: - { - switch (qs.getCond()) - { - case 1: - { + case CRONOS: { + switch (qs.getCond()) { + case 1: { htmltext = "30610-01.html"; break; } - case 2: - { + case 2: { htmltext = "30610-07.html"; break; } - case 3: - { - if (qs.getInt("old_stone") > 0) - { + case 3: { + if (qs.getInt("old_stone") > 0) { htmltext = "30610-14.html"; - } - else - { + } else { htmltext = "30610-08.html"; } break; } - case 4: - { + case 4: { htmltext = "30610-09.html"; break; } - case 5: - { - if ((getQuestItemsCount(talker, FAIRY_STONE) == 0) && (getQuestItemsCount(talker, DELUXE_FAIRY_STONE) == 0)) - { + case 5: { + if ((getQuestItemsCount(talker, FAIRY_STONE) == 0) && (getQuestItemsCount(talker, DELUXE_FAIRY_STONE) == 0)) { htmltext = "30610-10.html"; - } - else - { + } else { htmltext = "30610-11.html"; } break; @@ -499,73 +419,51 @@ public final class Q00420_LittleWing extends Quest } break; } - case MARIA: - { - switch (qs.getCond()) - { - case 2: - { - if ((qs.getInt("fairy_stone") == 1) && (getQuestItemsCount(talker, COAL) >= 10) && (getQuestItemsCount(talker, CHARCOAL) >= 10) && (getQuestItemsCount(talker, GEMSTONE_D) >= 1) && (getQuestItemsCount(talker, SILVER_NUGGET) >= 3) && (getQuestItemsCount(talker, TOAD_SKIN) >= 10)) - { + case MARIA: { + switch (qs.getCond()) { + case 2: { + if ((qs.getInt("fairy_stone") == 1) && (getQuestItemsCount(talker, COAL) >= 10) && (getQuestItemsCount(talker, CHARCOAL) >= 10) && (getQuestItemsCount(talker, GEMSTONE_D) >= 1) && (getQuestItemsCount(talker, SILVER_NUGGET) >= 3) + && (getQuestItemsCount(talker, TOAD_SKIN) >= 10)) { htmltext = "30608-02.html"; - } - else if ((qs.getInt("fairy_stone") == 2) && (getQuestItemsCount(talker, COAL) >= 10) && (getQuestItemsCount(talker, CHARCOAL) >= 10) && (getQuestItemsCount(talker, GEMSTONE_C) >= 1) && (getQuestItemsCount(talker, STONE_OF_PURITY) >= 1) && (getQuestItemsCount(talker, SILVER_NUGGET) >= 5) && (getQuestItemsCount(talker, TOAD_SKIN) >= 20)) - { + } else if ((qs.getInt("fairy_stone") == 2) && (getQuestItemsCount(talker, COAL) >= 10) && (getQuestItemsCount(talker, CHARCOAL) >= 10) && (getQuestItemsCount(talker, GEMSTONE_C) >= 1) && (getQuestItemsCount(talker, STONE_OF_PURITY) >= 1) + && (getQuestItemsCount(talker, SILVER_NUGGET) >= 5) && (getQuestItemsCount(talker, TOAD_SKIN) >= 20)) { htmltext = "30608-04.html"; - } - else - { + } else { htmltext = "30608-01.html"; } break; } - case 3: - { + case 3: { htmltext = "30608-06.html"; break; } } break; } - case BYRON: - { - switch (qs.getCond()) - { - case 2: - { + case BYRON: { + switch (qs.getCond()) { + case 2: { htmltext = "30711-10.html"; break; } - case 3: - { - if (qs.getInt("old_stone") == 0) - { + case 3: { + if (qs.getInt("old_stone") == 0) { htmltext = "30711-01.html"; - } - else if (qs.getInt("old_stone") == 1) - { + } else if (qs.getInt("old_stone") == 1) { qs.setCond(5, true); htmltext = "30711-05.html"; - } - else - { + } else { qs.setCond(4, true); htmltext = "30711-06.html"; } break; } - case 4: - { - if ((getQuestItemsCount(talker, FAIRY_STONE) == 0) && (getQuestItemsCount(talker, DELUXE_FAIRY_STONE) == 0)) - { + case 4: { + if ((getQuestItemsCount(talker, FAIRY_STONE) == 0) && (getQuestItemsCount(talker, DELUXE_FAIRY_STONE) == 0)) { htmltext = "30711-09.html"; - } - else if (getQuestItemsCount(talker, FAIRY_STONE) == 0) - { + } else if (getQuestItemsCount(talker, FAIRY_STONE) == 0) { htmltext = "30711-08.html"; - } - else - { + } else { htmltext = "30711-07.html"; } break; @@ -573,229 +471,166 @@ public final class Q00420_LittleWing extends Quest } break; } - case MIMYU: - { - switch (qs.getCond()) - { - case 4: - { - if (getQuestItemsCount(talker, FAIRY_STONE) > 0) - { + case MIMYU: { + switch (qs.getCond()) { + case 4: { + if (getQuestItemsCount(talker, FAIRY_STONE) > 0) { htmltext = "30747-01.html"; - } - else if (getQuestItemsCount(talker, DELUXE_FAIRY_STONE) > 0) - { + } else if (getQuestItemsCount(talker, DELUXE_FAIRY_STONE) > 0) { htmltext = "30747-03.html"; } break; } - case 5: - { - if (getQuestItemsCount(talker, MONKSHOOD_JUICE) > 0) - { + case 5: { + if (getQuestItemsCount(talker, MONKSHOOD_JUICE) > 0) { htmltext = "30747-09.html"; - } - else if (qs.getInt("fairy_stone") == 1) - { + } else if (qs.getInt("fairy_stone") == 1) { htmltext = "30747-05.html"; - } - else - { + } else { htmltext = "30747-06.html"; } break; } - case 6: - { - if ((getQuestItemsCount(talker, EXARION_EGG) >= 20) || (getQuestItemsCount(talker, ZWOV_EGG) >= 20) || (getQuestItemsCount(talker, KALIBRAN_EGG) >= 20) || (getQuestItemsCount(talker, SUZET_EGG) >= 20) || (getQuestItemsCount(talker, SHAMHAI_EGG) >= 20)) - { + case 6: { + if ((getQuestItemsCount(talker, EXARION_EGG) >= 20) || (getQuestItemsCount(talker, ZWOV_EGG) >= 20) || (getQuestItemsCount(talker, KALIBRAN_EGG) >= 20) || (getQuestItemsCount(talker, SUZET_EGG) >= 20) || (getQuestItemsCount(talker, SHAMHAI_EGG) >= 20)) { htmltext = "30747-10.html"; - } - else - { + } else { htmltext = "30747-09.html"; } break; } - case 7: - { + case 7: { htmltext = "30747-11.html"; break; } - case 8: - { + case 8: { htmltext = "30747-12.html"; break; } } break; } - case EXARION: - { - switch (qs.getCond()) - { - case 5: - { - if (getQuestItemsCount(talker, MONKSHOOD_JUICE) > 0) - { + case EXARION: { + switch (qs.getCond()) { + case 5: { + if (getQuestItemsCount(talker, MONKSHOOD_JUICE) > 0) { htmltext = "30748-01.html"; } break; } - case 6: - { - if (getQuestItemsCount(talker, EXARION_EGG) >= 20) - { + case 6: { + if (getQuestItemsCount(talker, EXARION_EGG) >= 20) { takeItems(talker, -1, EXARION_SCALE, EXARION_EGG); giveItems(talker, EXARION_EGG, 1); qs.setCond(7, true); htmltext = "30748-04.html"; - } - else - { + } else { htmltext = "30748-03.html"; } break; } - case 7: - { + case 7: { htmltext = "30748-05.html"; break; } } break; } - case ZWOV: - { - switch (qs.getCond()) - { - case 5: - { - if (getQuestItemsCount(talker, MONKSHOOD_JUICE) > 0) - { + case ZWOV: { + switch (qs.getCond()) { + case 5: { + if (getQuestItemsCount(talker, MONKSHOOD_JUICE) > 0) { htmltext = "30749-01.html"; } break; } - case 6: - { - if (getQuestItemsCount(talker, ZWOV_EGG) >= 20) - { + case 6: { + if (getQuestItemsCount(talker, ZWOV_EGG) >= 20) { takeItems(talker, -1, ZWOV_SCALE, ZWOV_EGG); giveItems(talker, ZWOV_EGG, 1); qs.setCond(7, true); htmltext = "30749-04.html"; - } - else - { + } else { htmltext = "30749-03.html"; } break; } - case 7: - { + case 7: { htmltext = "30749-05.html"; break; } } break; } - case KALIBRAN: - { - switch (qs.getCond()) - { - case 5: - { - if (getQuestItemsCount(talker, MONKSHOOD_JUICE) > 0) - { + case KALIBRAN: { + switch (qs.getCond()) { + case 5: { + if (getQuestItemsCount(talker, MONKSHOOD_JUICE) > 0) { htmltext = "30750-01.html"; } break; } - case 6: - { - if (getQuestItemsCount(talker, KALIBRAN_EGG) >= 20) - { + case 6: { + if (getQuestItemsCount(talker, KALIBRAN_EGG) >= 20) { htmltext = "30750-04.html"; - } - else - { + } else { htmltext = "30750-03.html"; } break; } - case 7: - { + case 7: { htmltext = "30750-06.html"; break; } } break; } - case SUZET: - { - switch (qs.getCond()) - { - case 5: - { - if (getQuestItemsCount(talker, MONKSHOOD_JUICE) > 0) - { + case SUZET: { + switch (qs.getCond()) { + case 5: { + if (getQuestItemsCount(talker, MONKSHOOD_JUICE) > 0) { htmltext = "30751-01.html"; } break; } - case 6: - { - if (getQuestItemsCount(talker, SUZET_EGG) >= 20) - { + case 6: { + if (getQuestItemsCount(talker, SUZET_EGG) >= 20) { takeItems(talker, -1, SUZET_SCALE, SUZET_EGG); giveItems(talker, SUZET_EGG, 1); qs.setCond(7, true); htmltext = "30751-05.html"; - } - else - { + } else { htmltext = "30751-04.html"; } break; } - case 7: - { + case 7: { htmltext = "30751-06.html"; break; } } break; } - case SHAMHAI: - { - switch (qs.getCond()) - { - case 5: - { - if (getQuestItemsCount(talker, MONKSHOOD_JUICE) > 0) - { + case SHAMHAI: { + switch (qs.getCond()) { + case 5: { + if (getQuestItemsCount(talker, MONKSHOOD_JUICE) > 0) { htmltext = "30752-01.html"; } break; } - case 6: - { - if (getQuestItemsCount(talker, SHAMHAI_EGG) >= 20) - { + case 6: { + if (getQuestItemsCount(talker, SHAMHAI_EGG) >= 20) { takeItems(talker, -1, SHAMHAI_SCALE, SHAMHAI_EGG); giveItems(talker, SHAMHAI_EGG, 1); qs.setCond(7, true); htmltext = "30752-04.html"; - } - else - { + } else { htmltext = "30752-03.html"; } break; } - case 7: - { + case 7: { htmltext = "30752-05.html"; break; } @@ -805,8 +640,7 @@ public final class Q00420_LittleWing extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(talker); break; } @@ -815,24 +649,16 @@ public final class Q00420_LittleWing extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc); - if (qs != null) - { - if (qs.isCond(2) && (npc.getId() == TOAD_LORD)) - { - if (qs.getInt("fairy_stone") == 1) - { + if (qs != null) { + if (qs.isCond(2) && (npc.getId() == TOAD_LORD)) { + if (qs.getInt("fairy_stone") == 1) { giveItemRandomly(qs.getPlayer(), npc, TOAD_SKIN, 1, 10, 0.3, true); - } - else - { + } else { giveItemRandomly(qs.getPlayer(), npc, TOAD_SKIN, 1, 20, 0.3, true); } - } - else if (qs.isCond(6) && (npc.getId() == qs.getInt("drake_hunt"))) - { + } else if (qs.isCond(6) && (npc.getId() == qs.getInt("drake_hunt"))) { giveItemRandomly(qs.getPlayer(), npc, EGG_DROPS.get(npc.getId()), 1, 20, 0.5, true); } } @@ -843,39 +669,25 @@ public final class Q00420_LittleWing extends Quest * Gives the reward to the player. * @param player the player */ - private static void giveReward(L2PcInstance player) - { + private static void giveReward(L2PcInstance player) { final int random = getRandom(100); - for (int i : EGGS) - { - if (hasQuestItems(player, i)) - { + for (int i : EGGS) { + if (hasQuestItems(player, i)) { final int mul = EGGS.indexOf(i) * 5; - if (hasQuestItems(player, FAIRY_DUST)) - { - if (random < (45 + mul)) - { + if (hasQuestItems(player, FAIRY_DUST)) { + if (random < (45 + mul)) { giveItems(player, DRAGONFLUTE_OF_WIND, 1); - } - else if (random < (75 + mul)) - { + } else if (random < (75 + mul)) { giveItems(player, DRAGONFLUTE_OF_STAR, 1); - } - else - { + } else { giveItems(player, DRAGONFLUTE_OF_TWILIGHT, 1); } } - if (random < (50 + mul)) - { + if (random < (50 + mul)) { giveItems(player, DRAGONFLUTE_OF_WIND, 1); - } - else if (random < (85 + mul)) - { + } else if (random < (85 + mul)) { giveItems(player, DRAGONFLUTE_OF_STAR, 1); - } - else - { + } else { giveItems(player, DRAGONFLUTE_OF_TWILIGHT, 1); } takeItems(player, i, -1); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00421_LittleWingsBigAdventure/Q00421_LittleWingsBigAdventure.java b/src/main/java/com/l2jserver/datapack/quests/Q00421_LittleWingsBigAdventure/Q00421_LittleWingsBigAdventure.java index 3b3445ce5d..745bbd1caf 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00421_LittleWingsBigAdventure/Q00421_LittleWingsBigAdventure.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00421_LittleWingsBigAdventure/Q00421_LittleWingsBigAdventure.java @@ -106,15 +106,13 @@ public final class Q00421_LittleWingsBigAdventure extends Quest { if (flute.getEnchantLevel() < MIN_HACHLING_LVL) { htmltext = "30610-06.html"; - } - else { + } else { qs.startQuest(); qs.setMemoState(100); qs.set("fluteObjectId", flute.getObjectId()); htmltext = event; } - } - else { + } else { htmltext = "30610-06.html"; } } @@ -125,11 +123,9 @@ public final class Q00421_LittleWingsBigAdventure extends Quest { if (summon == null) { htmltext = "30747-02.html"; - } - else if (summon.getControlObjectId() != qs.getInt("fluteObjectId")) { + } else if (summon.getControlObjectId() != qs.getInt("fluteObjectId")) { htmltext = "30747-03.html"; - } - else { + } else { htmltext = event; } break; @@ -139,11 +135,9 @@ public final class Q00421_LittleWingsBigAdventure extends Quest { if (summon == null) { htmltext = "30747-06.html"; - } - else if (summon.getControlObjectId() != qs.getInt("fluteObjectId")) { + } else if (summon.getControlObjectId() != qs.getInt("fluteObjectId")) { htmltext = "30747-06.html"; - } - else { + } else { giveItems(player, FAIRY_LEAF, 4); qs.setCond(2, true); qs.setMemoState(0); @@ -178,14 +172,11 @@ public final class Q00421_LittleWingsBigAdventure extends Quest { if (talker.getLevel() < MIN_PLAYER_LVL) { htmltext = "30610-01.htm"; - } - else if (fluteCount > 1) { + } else if (fluteCount > 1) { htmltext = "30610-02.htm"; - } - else if (getFlute(talker).getEnchantLevel() < MIN_HACHLING_LVL) { + } else if (getFlute(talker).getEnchantLevel() < MIN_HACHLING_LVL) { htmltext = "30610-03.html"; - } - else { + } else { htmltext = "30610-04.htm"; } break; @@ -213,11 +204,9 @@ public final class Q00421_LittleWingsBigAdventure extends Quest { if (summon == null) { htmltext = "30747-02.html"; - } - else if (summon.getControlObjectId() != qs.getInt("fluteObjectId")) { + } else if (summon.getControlObjectId() != qs.getInt("fluteObjectId")) { htmltext = "30747-03.html"; - } - else { + } else { htmltext = "30747-04.html"; } break; @@ -251,12 +240,10 @@ public final class Q00421_LittleWingsBigAdventure extends Quest { if (summon == null) { htmltext = "30747-12.html"; - } - else if (summon.getControlObjectId() == qs.getInt("fluteObjectId")) { + } else if (summon.getControlObjectId() == qs.getInt("fluteObjectId")) { qs.setMemoState(16); htmltext = "30747-13.html"; - } - else { + } else { htmltext = "30747-14.html"; } } @@ -266,14 +253,12 @@ public final class Q00421_LittleWingsBigAdventure extends Quest { if (!hasQuestItems(talker, FAIRY_LEAF)) { if (talker.hasSummon()) { htmltext = "30747-15.html"; - } - else { + } else { final long fluteCount = getQuestItemsCount(talker, DRAGONFLUTE_OF_WIND, DRAGONFLUTE_OF_STAR, DRAGONFLUTE_OF_TWILIGHT); if (fluteCount > 1) { htmltext = "30747-17.html"; - } - else if (fluteCount == 1) { + } else if (fluteCount == 1) { final L2ItemInstance flute = getFlute(talker); if (flute.getObjectId() == qs.getInt("fluteObjectId")) { @@ -296,8 +281,7 @@ public final class Q00421_LittleWingsBigAdventure extends Quest { qs.exitQuest(true, true); htmltext = "30747-16.html"; - } - else { + } else { npc.setTarget(talker); npc.doCast(CURSE_OF_MIMYU); htmltext = "30747-18.html"; @@ -330,8 +314,7 @@ public final class Q00421_LittleWingsBigAdventure extends Quest { npc.setTarget(attacker); npc.doCast(DRYAD_ROOT); } - } - else if (getRandom(100) < 2) { + } else if (getRandom(100) < 2) { if (hasQuestItems(attacker, FAIRY_LEAF)) { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.GIVE_ME_A_FAIRY_LEAF)); takeItems(attacker, FAIRY_LEAF, 1); @@ -345,8 +328,7 @@ public final class Q00421_LittleWingsBigAdventure extends Quest { } } } - } - else { + } else { switch (getRandom(3)) { case 0: npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.WHY_DO_YOU_BOTHER_ME_AGAIN)); @@ -359,13 +341,11 @@ public final class Q00421_LittleWingsBigAdventure extends Quest { break; } } - } - else if (getRandom(100) < 30) { + } else if (getRandom(100) < 30) { npc.setTarget(attacker); npc.doCast(VICIOUS_POISON); } - } - else if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.67)) && (getRandom(100) < 30)) { + } else if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.67)) && (getRandom(100) < 30)) { npc.setTarget(attacker); npc.doCast(VICIOUS_POISON); } @@ -395,11 +375,9 @@ public final class Q00421_LittleWingsBigAdventure extends Quest { final int fluteItemId; if (hasQuestItems(player, DRAGONFLUTE_OF_WIND)) { fluteItemId = DRAGONFLUTE_OF_WIND; - } - else if (hasQuestItems(player, DRAGONFLUTE_OF_STAR)) { + } else if (hasQuestItems(player, DRAGONFLUTE_OF_STAR)) { fluteItemId = DRAGONFLUTE_OF_STAR; - } - else { + } else { fluteItemId = DRAGONFLUTE_OF_TWILIGHT; } return player.getInventory().getItemByItemId(fluteItemId); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00422_RepentYourSins/Q00422_RepentYourSins.java b/src/main/java/com/l2jserver/datapack/quests/Q00422_RepentYourSins/Q00422_RepentYourSins.java index 12a75a8ce7..1f801de41a 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00422_RepentYourSins/Q00422_RepentYourSins.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00422_RepentYourSins/Q00422_RepentYourSins.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Repent Your Sins (422) * @author ivantotov */ -public final class Q00422_RepentYourSins extends Quest -{ +public final class Q00422_RepentYourSins extends Quest { // NPCs private static final int BLACKSMITH_PUSHKIN = 30300; private static final int PIOTUR = 30597; @@ -62,8 +61,7 @@ public final class Q00422_RepentYourSins extends Quest private static final int TUREK_WAR_HOUND = 20494; private static final int TRISALIM_TARANTULA = 20561; - public Q00422_RepentYourSins() - { + public Q00422_RepentYourSins() { super(422, Q00422_RepentYourSins.class.getSimpleName(), "Repent Your Sins"); addStartNpc(BLACK_JUDGE); addTalkId(BLACK_JUDGE, BLACKSMITH_PUSHKIN, PIOTUR, ELDER_CASIAN, KATARI, MAGISTER_JOAN); @@ -72,61 +70,45 @@ public final class Q00422_RepentYourSins extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { + switch (event) { + case "ACCEPT": { qs.startQuest(); - if ((player.getLevel() > 20) && (player.getLevel() < 31)) - { + if ((player.getLevel() > 20) && (player.getLevel() < 31)) { playSound(player, Sound.ITEMSOUND_QUEST_ACCEPT); qs.setMemoState(2); qs.setCond(3); htmltext = "30981-04.htm"; - } - else if (player.getLevel() < 21) - { + } else if (player.getLevel() < 21) { qs.setMemoState(1); qs.setMemoStateEx(1, 0); qs.setCond(2); htmltext = "30981-03.htm"; - } - else if ((player.getLevel() > 30) && (player.getLevel() < 41)) - { + } else if ((player.getLevel() > 30) && (player.getLevel() < 41)) { qs.setMemoState(3); qs.setCond(4); htmltext = "30981-05.htm"; - } - else - { + } else { qs.setMemoState(4); qs.setCond(5); htmltext = "30981-06.htm"; } break; } - case "30981-11.html": - { - if ((qs.getMemoState() >= 9) && (qs.getMemoState() <= 12)) - { - if (hasAtLeastOneQuestItem(player, MANACLES_OF_PENITENT, PENITENTS_MANACLES1)) - { - if (hasQuestItems(player, PENITENTS_MANACLES1)) - { + case "30981-11.html": { + if ((qs.getMemoState() >= 9) && (qs.getMemoState() <= 12)) { + if (hasAtLeastOneQuestItem(player, MANACLES_OF_PENITENT, PENITENTS_MANACLES1)) { + if (hasQuestItems(player, PENITENTS_MANACLES1)) { takeItems(player, PENITENTS_MANACLES1, 1); } - if (hasQuestItems(player, MANACLES_OF_PENITENT)) - { + if (hasQuestItems(player, MANACLES_OF_PENITENT)) { takeItems(player, MANACLES_OF_PENITENT, 1); } qs.setMemoStateEx(1, player.getLevel()); @@ -138,60 +120,44 @@ public final class Q00422_RepentYourSins extends Quest break; } case "30981-14.html": - case "30981-17.html": - { - if ((qs.getMemoState() >= 9) && (qs.getMemoState() <= 12)) - { + case "30981-17.html": { + if ((qs.getMemoState() >= 9) && (qs.getMemoState() <= 12)) { htmltext = event; } break; } - case "30981-15t.html": - { + case "30981-15t.html": { final L2ItemInstance petItem = player.getInventory().getItemByItemId(PENITENTS_MANACLES); final int petLevel = (petItem == null) ? 0 : petItem.getEnchantLevel(); - if ((qs.getMemoState() >= 9) && (qs.getMemoState() <= 12) && (petLevel > qs.getMemoStateEx(1))) - { + if ((qs.getMemoState() >= 9) && (qs.getMemoState() <= 12) && (petLevel > qs.getMemoStateEx(1))) { final L2Summon summon = player.getSummon(); - if (summon != null) - { + if (summon != null) { htmltext = event; - } - else - { + } else { int i1 = 0; - if (player.getLevel() > qs.getMemoStateEx(1)) - { + if (player.getLevel() > qs.getMemoStateEx(1)) { i1 = petLevel - qs.getMemoStateEx(1) - (player.getLevel() - qs.getMemoStateEx(1)); - } - else - { + } else { i1 = petLevel - qs.getMemoStateEx(1); } - if (i1 < 0) - { + if (i1 < 0) { i1 = 0; } int i0 = getRandom(i1) + 1; - if (player.getPkKills() <= i0) - { + if (player.getPkKills() <= i0) { giveItems(player, MANACLES_OF_PENITENT, 1); - if (petItem != null) - { + if (petItem != null) { takeItems(player, PENITENTS_MANACLES, -1); } htmltext = "30981-15.html"; player.setPkKills(0); qs.exitQuest(true, true); - } - else - { + } else { giveItems(player, MANACLES_OF_PENITENT, 1); - if (petItem != null) - { + if (petItem != null) { takeItems(player, PENITENTS_MANACLES, -1); } htmltext = "30981-16.html"; @@ -203,10 +169,8 @@ public final class Q00422_RepentYourSins extends Quest } break; } - case "30981-18.html": - { - if ((qs.getMemoState() >= 9) && (qs.getMemoState() <= 12)) - { + case "30981-18.html": { + if ((qs.getMemoState() >= 9) && (qs.getMemoState() <= 12)) { qs.exitQuest(true, true); htmltext = event; } @@ -217,67 +181,47 @@ public final class Q00422_RepentYourSins extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case SCAVENGER_WERERAT: - { - if (qs.isMemoState(5) && (getQuestItemsCount(killer, RATMAN_SCAVENGERS_SKULL) < 10)) - { - if (getQuestItemsCount(killer, RATMAN_SCAVENGERS_SKULL) == 9) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case SCAVENGER_WERERAT: { + if (qs.isMemoState(5) && (getQuestItemsCount(killer, RATMAN_SCAVENGERS_SKULL) < 10)) { + if (getQuestItemsCount(killer, RATMAN_SCAVENGERS_SKULL) == 9) { giveItems(killer, RATMAN_SCAVENGERS_SKULL, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { giveItems(killer, RATMAN_SCAVENGERS_SKULL, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case TYRANT_KINGPIN: - { - if (qs.isMemoState(7) && !hasQuestItems(killer, TYRANT_KINGPINS_HEART)) - { + case TYRANT_KINGPIN: { + if (qs.isMemoState(7) && !hasQuestItems(killer, TYRANT_KINGPINS_HEART)) { giveItems(killer, TYRANT_KINGPINS_HEART, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); } break; } - case TUREK_WAR_HOUND: - { - if (qs.isMemoState(6) && (getQuestItemsCount(killer, TUREK_WAR_HOUNDS_TAIL) < 10)) - { - if (getQuestItemsCount(killer, TUREK_WAR_HOUNDS_TAIL) == 9) - { + case TUREK_WAR_HOUND: { + if (qs.isMemoState(6) && (getQuestItemsCount(killer, TUREK_WAR_HOUNDS_TAIL) < 10)) { + if (getQuestItemsCount(killer, TUREK_WAR_HOUNDS_TAIL) == 9) { giveItems(killer, TUREK_WAR_HOUNDS_TAIL, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { giveItems(killer, TUREK_WAR_HOUNDS_TAIL, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } } break; } - case TRISALIM_TARANTULA: - { - if (qs.isMemoState(8) && (getQuestItemsCount(killer, TRISALIM_TARANTULAS_VENOM_SAC) < 3)) - { - if (getQuestItemsCount(killer, TRISALIM_TARANTULAS_VENOM_SAC) == 2) - { + case TRISALIM_TARANTULA: { + if (qs.isMemoState(8) && (getQuestItemsCount(killer, TRISALIM_TARANTULAS_VENOM_SAC) < 3)) { + if (getQuestItemsCount(killer, TRISALIM_TARANTULAS_VENOM_SAC) == 2) { giveItems(killer, TRISALIM_TARANTULAS_VENOM_SAC, 1); playSound(killer, Sound.ITEMSOUND_QUEST_MIDDLE); - } - else - { + } else { giveItems(killer, TRISALIM_TARANTULAS_VENOM_SAC, 1); playSound(killer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -290,83 +234,52 @@ public final class Q00422_RepentYourSins extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); final int memoState = qs.getMemoState(); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == BLACK_JUDGE) - { - if (player.getPkKills() == 0) - { + if (qs.isCreated()) { + if (npc.getId() == BLACK_JUDGE) { + if (player.getPkKills() == 0) { htmltext = "30981-01.htm"; - } - else - { + } else { htmltext = "30981-02.htm"; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case BLACK_JUDGE: - { - if (memoState == 1000) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case BLACK_JUDGE: { + if (memoState == 1000) { takeItems(player, PENITENTS_MANACLES, 1); - } - else if (memoState < 9) - { + } else if (memoState < 9) { htmltext = "30981-07.html"; - } - else if ((memoState >= 9) && (memoState <= 12)) - { - if (!hasAtLeastOneQuestItem(player, MANUAL_OF_MANACLES, MANACLES_OF_PENITENT, PENITENTS_MANACLES1, PENITENTS_MANACLES)) - { + } else if ((memoState >= 9) && (memoState <= 12)) { + if (!hasAtLeastOneQuestItem(player, MANUAL_OF_MANACLES, MANACLES_OF_PENITENT, PENITENTS_MANACLES1, PENITENTS_MANACLES)) { giveItems(player, MANUAL_OF_MANACLES, 1); qs.setCond(14, true); htmltext = "30981-08.html"; - } - else if (hasQuestItems(player, MANUAL_OF_MANACLES) && !hasAtLeastOneQuestItem(player, MANACLES_OF_PENITENT, PENITENTS_MANACLES1, PENITENTS_MANACLES)) - { + } else if (hasQuestItems(player, MANUAL_OF_MANACLES) && !hasAtLeastOneQuestItem(player, MANACLES_OF_PENITENT, PENITENTS_MANACLES1, PENITENTS_MANACLES)) { htmltext = "30981-09.html"; - } - else if (hasQuestItems(player, PENITENTS_MANACLES1) && !hasAtLeastOneQuestItem(player, MANUAL_OF_MANACLES, MANACLES_OF_PENITENT, PENITENTS_MANACLES)) - { + } else if (hasQuestItems(player, PENITENTS_MANACLES1) && !hasAtLeastOneQuestItem(player, MANUAL_OF_MANACLES, MANACLES_OF_PENITENT, PENITENTS_MANACLES)) { htmltext = "30981-10.html"; - } - else if (hasQuestItems(player, PENITENTS_MANACLES)) - { + } else if (hasQuestItems(player, PENITENTS_MANACLES)) { final L2ItemInstance petItem = player.getInventory().getItemByItemId(PENITENTS_MANACLES); final int petLevel = (petItem == null) ? 0 : petItem.getEnchantLevel(); - if (petLevel < (qs.getMemoStateEx(1) + 1)) - { + if (petLevel < (qs.getMemoStateEx(1) + 1)) { htmltext = "30981-12.html"; - } - else - { + } else { htmltext = "30981-13.html"; } - } - else if (hasQuestItems(player, MANACLES_OF_PENITENT) && !hasQuestItems(player, PENITENTS_MANACLES)) - { + } else if (hasQuestItems(player, MANACLES_OF_PENITENT) && !hasQuestItems(player, PENITENTS_MANACLES)) { htmltext = "30981-16t.html"; } } break; } - case BLACKSMITH_PUSHKIN: - { - if ((memoState >= 9) && (memoState <= 12)) - { - if (!hasAtLeastOneQuestItem(player, PENITENTS_MANACLES1, PENITENTS_MANACLES, MANACLES_OF_PENITENT) && hasQuestItems(player, MANUAL_OF_MANACLES)) - { - if ((getQuestItemsCount(player, BLACKSMITHS_FRAME) > 0) && (getQuestItemsCount(player, STEEL) >= 5) && (getQuestItemsCount(player, ADAMANTITE_NUGGET) >= 2) && (getQuestItemsCount(player, SILVER_NUGGET) >= 10) && (getQuestItemsCount(player, COKES) >= 10)) - { + case BLACKSMITH_PUSHKIN: { + if ((memoState >= 9) && (memoState <= 12)) { + if (!hasAtLeastOneQuestItem(player, PENITENTS_MANACLES1, PENITENTS_MANACLES, MANACLES_OF_PENITENT) && hasQuestItems(player, MANUAL_OF_MANACLES)) { + if ((getQuestItemsCount(player, BLACKSMITHS_FRAME) > 0) && (getQuestItemsCount(player, STEEL) >= 5) && (getQuestItemsCount(player, ADAMANTITE_NUGGET) >= 2) && (getQuestItemsCount(player, SILVER_NUGGET) >= 10) && (getQuestItemsCount(player, COKES) >= 10)) { takeItems(player, SILVER_NUGGET, 10); takeItems(player, ADAMANTITE_NUGGET, 2); takeItems(player, COKES, 10); @@ -376,128 +289,88 @@ public final class Q00422_RepentYourSins extends Quest takeItems(player, MANUAL_OF_MANACLES, 1); qs.setCond(15, true); htmltext = "30300-01.html"; - } - else - { + } else { htmltext = "30300-02.html"; } - } - else if (hasAtLeastOneQuestItem(player, PENITENTS_MANACLES1, PENITENTS_MANACLES, MANACLES_OF_PENITENT)) - { + } else if (hasAtLeastOneQuestItem(player, PENITENTS_MANACLES1, PENITENTS_MANACLES, MANACLES_OF_PENITENT)) { htmltext = "30300-03.html"; } } break; } - case PIOTUR: - { - if (memoState == 2) - { + case PIOTUR: { + if (memoState == 2) { qs.setMemoState(6); qs.setCond(7, true); htmltext = "30597-01.html"; - } - else if (memoState == 6) - { - if (getQuestItemsCount(player, TUREK_WAR_HOUNDS_TAIL) < 10) - { + } else if (memoState == 6) { + if (getQuestItemsCount(player, TUREK_WAR_HOUNDS_TAIL) < 10) { htmltext = "30597-02.html"; - } - else - { + } else { takeItems(player, TUREK_WAR_HOUNDS_TAIL, -1); qs.setMemoState(10); qs.setCond(11, true); htmltext = "30597-03.html"; } - } - else if (memoState == 10) - { + } else if (memoState == 10) { htmltext = "30597-04.html"; } break; } - case ELDER_CASIAN: - { - if (memoState == 3) - { + case ELDER_CASIAN: { + if (memoState == 3) { qs.setMemoState(7); qs.setCond(8, true); htmltext = "30612-01.html"; - } - else if (memoState == 7) - { - if (!hasQuestItems(player, TYRANT_KINGPINS_HEART)) - { + } else if (memoState == 7) { + if (!hasQuestItems(player, TYRANT_KINGPINS_HEART)) { htmltext = "30612-02.html"; - } - else - { + } else { takeItems(player, TYRANT_KINGPINS_HEART, -1); qs.setMemoState(11); qs.setCond(12, true); htmltext = "30612-03.html"; } - } - else if (memoState == 11) - { + } else if (memoState == 11) { htmltext = "30612-04.html"; } break; } - case KATARI: - { - if (memoState == 1) - { + case KATARI: { + if (memoState == 1) { qs.setMemoState(5); qs.setCond(6, true); htmltext = "30668-01.html"; - } - else if (memoState == 5) - { - if (getQuestItemsCount(player, RATMAN_SCAVENGERS_SKULL) < 10) - { + } else if (memoState == 5) { + if (getQuestItemsCount(player, RATMAN_SCAVENGERS_SKULL) < 10) { htmltext = "30668-02.html"; - } - else - { + } else { takeItems(player, RATMAN_SCAVENGERS_SKULL, -1); qs.setMemoState(9); qs.setCond(10, true); htmltext = "30668-03.html"; } - } - else if (memoState == 9) - { + } else if (memoState == 9) { htmltext = "30668-04.html"; } break; } - case MAGISTER_JOAN: - { - if (memoState == 4) - { + case MAGISTER_JOAN: { + if (memoState == 4) { qs.setMemoState(8); qs.setCond(9, true); htmltext = "30718-01.html"; - } - else if (memoState == 8) - { - if (getQuestItemsCount(player, TRISALIM_TARANTULAS_VENOM_SAC) < 3) - { + } else if (memoState == 8) { + if (getQuestItemsCount(player, TRISALIM_TARANTULAS_VENOM_SAC) < 3) { htmltext = "30718-02.html"; - } - else - { + } else { takeItems(player, TRISALIM_TARANTULAS_VENOM_SAC, -1); qs.setMemoState(12); qs.setCond(13, true); htmltext = "30718-03.html"; } - } - else if (memoState == 12) - { + } else if (memoState == 12) { htmltext = "30718-04.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00423_TakeYourBestShot/Q00423_TakeYourBestShot.java b/src/main/java/com/l2jserver/datapack/quests/Q00423_TakeYourBestShot/Q00423_TakeYourBestShot.java index c2c6748b8f..127d1ec3c6 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00423_TakeYourBestShot/Q00423_TakeYourBestShot.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00423_TakeYourBestShot/Q00423_TakeYourBestShot.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.util.Util; * Take Your Best Shot (423) * @author ivantotov */ -public final class Q00423_TakeYourBestShot extends Quest -{ +public final class Q00423_TakeYourBestShot extends Quest { // NPCs private static final int BATRACOS = 32740; private static final int JOHNNY = 32744; @@ -41,8 +40,7 @@ public final class Q00423_TakeYourBestShot extends Quest // Misc private static final int MIN_LEVEL = 82; - public Q00423_TakeYourBestShot() - { + public Q00423_TakeYourBestShot() { super(423, Q00423_TakeYourBestShot.class.getSimpleName(), "Take Your Best Shot!"); addStartNpc(JOHNNY, BATRACOS); addTalkId(JOHNNY, BATRACOS); @@ -50,21 +48,16 @@ public final class Q00423_TakeYourBestShot extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "32744-06.htm": - { - if (qs.isCreated() && (player.getLevel() >= MIN_LEVEL)) - { + switch (event) { + case "32744-06.htm": { + if (qs.isCreated() && (player.getLevel() >= MIN_LEVEL)) { qs.startQuest(); qs.setMemoState(1); htmltext = event; @@ -72,16 +65,13 @@ public final class Q00423_TakeYourBestShot extends Quest break; } case "32744-04.html": - case "32744-05.htm": - { - if (!hasQuestItems(player, SEER_UGOROS_PASS) && (player.getLevel() >= MIN_LEVEL)) - { + case "32744-05.htm": { + if (!hasQuestItems(player, SEER_UGOROS_PASS) && (player.getLevel() >= MIN_LEVEL)) { htmltext = event; } break; } - case "32744-07.html": - { + case "32744-07.html": { htmltext = event; break; } @@ -90,17 +80,12 @@ public final class Q00423_TakeYourBestShot extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) - { - switch (npc.getId()) - { - case TANTA_GUARD: - { - if ((qs.isMemoState(1)) && !hasQuestItems(killer, SEER_UGOROS_PASS)) - { + if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { + switch (npc.getId()) { + case TANTA_GUARD: { + if ((qs.isMemoState(1)) && !hasQuestItems(killer, SEER_UGOROS_PASS)) { qs.setMemoState(2); qs.setCond(2, true); } @@ -112,52 +97,33 @@ public final class Q00423_TakeYourBestShot extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (npc.getId() == JOHNNY) - { - if (hasQuestItems(player, SEER_UGOROS_PASS)) - { + if (qs.isCreated()) { + if (npc.getId() == JOHNNY) { + if (hasQuestItems(player, SEER_UGOROS_PASS)) { htmltext = "32744-02.htm"; - } - else - { + } else { htmltext = ((player.getLevel() >= MIN_LEVEL) && player.hasQuestCompleted(Q00249_PoisonedPlainsOfTheLizardmen.class.getSimpleName())) ? "32744-03.htm" : "32744-01.htm"; } - } - else if (npc.getId() == BATRACOS) - { + } else if (npc.getId() == BATRACOS) { htmltext = (qs.hasQuestItems(SEER_UGOROS_PASS)) ? "32740-04.html" : "32740-01.html"; } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case JOHNNY: - { - if (qs.isMemoState(1)) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case JOHNNY: { + if (qs.isMemoState(1)) { htmltext = "32744-08.html"; - } - else if (qs.isMemoState(2)) - { + } else if (qs.isMemoState(2)) { htmltext = "32744-09.html"; } break; } - case BATRACOS: - { - if (qs.isMemoState(1)) - { + case BATRACOS: { + if (qs.isMemoState(1)) { htmltext = "32740-02.html"; - } - else if (qs.isMemoState(2)) - { + } else if (qs.isMemoState(2)) { giveItems(player, SEER_UGOROS_PASS, 1); qs.exitQuest(true, true); htmltext = "32740-03.html"; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00426_QuestForFishingShot/Q00426_QuestForFishingShot.java b/src/main/java/com/l2jserver/datapack/quests/Q00426_QuestForFishingShot/Q00426_QuestForFishingShot.java index d0e7c7d066..b0c1320d6a 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00426_QuestForFishingShot/Q00426_QuestForFishingShot.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00426_QuestForFishingShot/Q00426_QuestForFishingShot.java @@ -371,13 +371,11 @@ public class Q00426_QuestForFishingShot extends Quest { if (MOBS_SPECIAL.containsKey(npc.getId())) { if (getRandom(1000) <= MOBS_SPECIAL.get(npc.getId())._chance) { rewardItems(qs.getPlayer(), SWEET_FLUID, MOBS_SPECIAL.get(npc.getId())._reward + 1); - } - else { + } else { rewardItems(qs.getPlayer(), SWEET_FLUID, MOBS_SPECIAL.get(npc.getId())._reward); } playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); - } - else { + } else { if (getRandom(1000) <= MOBS.get(npc.getId())._chance) { rewardItems(qs.getPlayer(), SWEET_FLUID, MOBS.get(npc.getId())._reward); playSound(qs.getPlayer(), Sound.ITEMSOUND_QUEST_ITEMGET); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00431_WeddingMarch/Q00431_WeddingMarch.java b/src/main/java/com/l2jserver/datapack/quests/Q00431_WeddingMarch/Q00431_WeddingMarch.java index 0b881b08f4..dd797578cc 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00431_WeddingMarch/Q00431_WeddingMarch.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00431_WeddingMarch/Q00431_WeddingMarch.java @@ -30,13 +30,11 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by CubicVirtuoso. * @author eyjine */ -public class Q00431_WeddingMarch extends Quest -{ +public class Q00431_WeddingMarch extends Quest { // NPC private static final int KANTABILON = 31042; // Monsters - private static final int[] MOBS = - { + private static final int[] MOBS = { 20786, // Lienrik 20787, // Lienrik Lad }; @@ -47,8 +45,7 @@ public class Q00431_WeddingMarch extends Quest private static final int MIN_LEVEL = 38; private static final int CRYSTAL_COUNT = 50; - public Q00431_WeddingMarch() - { + public Q00431_WeddingMarch() { super(431, Q00431_WeddingMarch.class.getSimpleName(), "Wedding March"); addStartNpc(KANTABILON); addTalkId(KANTABILON); @@ -57,24 +54,18 @@ public class Q00431_WeddingMarch extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - if (event.equalsIgnoreCase("31042-02.htm")) - { + if (event.equalsIgnoreCase("31042-02.htm")) { st.startQuest(); htmltext = event; - } - else if (event.equalsIgnoreCase("31042-06.html")) - { - if (st.getQuestItemsCount(SILVER_CRYSTAL) < CRYSTAL_COUNT) - { + } else if (event.equalsIgnoreCase("31042-06.html")) { + if (st.getQuestItemsCount(SILVER_CRYSTAL) < CRYSTAL_COUNT) { return "31042-05.html"; } st.giveItems(WEDDING_ECHO_CRYSTAL, 25); @@ -85,21 +76,15 @@ public class Q00431_WeddingMarch extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance member = getRandomPartyMember(player, 1); - if (member != null) - { + if (member != null) { final QuestState st = getQuestState(member, false); - if (getRandomBoolean()) - { + if (getRandomBoolean()) { st.giveItems(SILVER_CRYSTAL, 1); - if (st.getQuestItemsCount(SILVER_CRYSTAL) >= CRYSTAL_COUNT) - { + if (st.getQuestItemsCount(SILVER_CRYSTAL) >= CRYSTAL_COUNT) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -108,12 +93,10 @@ public class Q00431_WeddingMarch extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? "31042-01.htm" : "31042-00.htm"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00432_BirthdayPartySong/Q00432_BirthdayPartySong.java b/src/main/java/com/l2jserver/datapack/quests/Q00432_BirthdayPartySong/Q00432_BirthdayPartySong.java index eb71d45da8..b6214a5709 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00432_BirthdayPartySong/Q00432_BirthdayPartySong.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00432_BirthdayPartySong/Q00432_BirthdayPartySong.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by CubicVirtuoso. * @author malyelfik */ -public class Q00432_BirthdayPartySong extends Quest -{ +public class Q00432_BirthdayPartySong extends Quest { // NPC private static final int OCTAVIA = 31043; // Monster @@ -41,8 +40,7 @@ public class Q00432_BirthdayPartySong extends Quest // Reward private static final int ECHO_CRYSTAL = 7061; - public Q00432_BirthdayPartySong() - { + public Q00432_BirthdayPartySong() { super(432, Q00432_BirthdayPartySong.class.getSimpleName(), "Birthday Party Song"); addStartNpc(OCTAVIA); addTalkId(OCTAVIA); @@ -51,24 +49,20 @@ public class Q00432_BirthdayPartySong extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "31043-02.htm": st.startQuest(); break; case "31043-05.html": - if (st.getQuestItemsCount(RED_CRYSTAL) < 50) - { + if (st.getQuestItemsCount(RED_CRYSTAL) < 50) { return "31043-06.html"; } @@ -83,19 +77,14 @@ public class Q00432_BirthdayPartySong extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isCond(1) && getRandomBoolean()) - { + if ((st != null) && st.isCond(1) && getRandomBoolean()) { st.giveItems(RED_CRYSTAL, 1); - if (st.getQuestItemsCount(RED_CRYSTAL) == 50) - { + if (st.getQuestItemsCount(RED_CRYSTAL) == 50) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -103,12 +92,10 @@ public class Q00432_BirthdayPartySong extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= 31) ? "31043-01.htm" : "31043-00.htm"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00450_GraveRobberRescue/Q00450_GraveRobberRescue.java b/src/main/java/com/l2jserver/datapack/quests/Q00450_GraveRobberRescue/Q00450_GraveRobberRescue.java index fcc423df29..1c87c806e7 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00450_GraveRobberRescue/Q00450_GraveRobberRescue.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00450_GraveRobberRescue/Q00450_GraveRobberRescue.java @@ -36,8 +36,7 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * Grave Robber Rescue (450) * @author malyelfik */ -public class Q00450_GraveRobberRescue extends Quest -{ +public class Q00450_GraveRobberRescue extends Quest { // NPCs private static final int KANEMIKA = 32650; private static final int WARRIOR = 32651; @@ -48,8 +47,7 @@ public class Q00450_GraveRobberRescue extends Quest // Misc private static final int MIN_LEVEL = 80; - public Q00450_GraveRobberRescue() - { + public Q00450_GraveRobberRescue() { super(450, Q00450_GraveRobberRescue.class.getSimpleName(), "Grave Robber Rescue"); addStartNpc(KANEMIKA); addTalkId(KANEMIKA, WARRIOR); @@ -57,18 +55,15 @@ public class Q00450_GraveRobberRescue extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "32650-04.htm": case "32650-05.htm": case "32650-06.html": @@ -89,17 +84,13 @@ public class Q00450_GraveRobberRescue extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - if (npc.getId() == KANEMIKA) - { - switch (st.getState()) - { + if (npc.getId() == KANEMIKA) { + switch (st.getState()) { case State.COMPLETED: - if (!st.isNowAvailable()) - { + if (!st.isNowAvailable()) { htmltext = "32650-03.html"; break; } @@ -108,28 +99,21 @@ public class Q00450_GraveRobberRescue extends Quest htmltext = (player.getLevel() >= MIN_LEVEL) ? "32650-01.htm" : "32650-02.htm"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = (!st.hasQuestItems(EVIDENCE_OF_MIGRATION)) ? "32650-08.html" : "32650-09.html"; - } - else - { + } else { st.giveAdena(65000, true); // Glory days reward: 6 886 980 exp, 8 116 410 sp, 371 400 Adena st.exitQuest(QuestType.DAILY, true); htmltext = "32650-10.html"; } break; } - } - else if (st.isCond(1)) - { - if (npc.isBusy()) - { + } else if (st.isCond(1)) { + if (npc.isBusy()) { return null; } - if (getRandom(100) < 66) - { + if (getRandom(100) < 66) { st.giveItems(EVIDENCE_OF_MIGRATION, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(npc.getX() + 100, npc.getY() + 100, npc.getZ(), 0)); @@ -137,20 +121,14 @@ public class Q00450_GraveRobberRescue extends Quest startQuestTimer("despawn", 3000, npc, player); - if (st.getQuestItemsCount(EVIDENCE_OF_MIGRATION) == 10) - { + if (st.getQuestItemsCount(EVIDENCE_OF_MIGRATION) == 10) { st.setCond(2, true); } htmltext = "32651-01.html"; - } - else - { - if (getRandom(100) < 50) - { + } else { + if (getRandom(100) < 50) { npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.GRUNT_OH)); - } - else - { + } else { npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.GRUNT_WHATS_WRONG_WITH_ME)); } npc.deleteMe(); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00451_LuciensAltar/Q00451_LuciensAltar.java b/src/main/java/com/l2jserver/datapack/quests/Q00451_LuciensAltar/Q00451_LuciensAltar.java index 71735e1a23..79895614e2 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00451_LuciensAltar/Q00451_LuciensAltar.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00451_LuciensAltar/Q00451_LuciensAltar.java @@ -31,12 +31,10 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by Bloodshed. * @author malyelfik */ -public class Q00451_LuciensAltar extends Quest -{ +public class Q00451_LuciensAltar extends Quest { // NPCs private static final int DAICHIR = 30537; - private static final int[] ALTARS = - { + private static final int[] ALTARS = { 32706, 32707, 32708, @@ -50,8 +48,7 @@ public class Q00451_LuciensAltar extends Quest // Misc private static final int MIN_LEVEL = 80; - public Q00451_LuciensAltar() - { + public Q00451_LuciensAltar() { super(451, Q00451_LuciensAltar.class.getSimpleName(), "Lucien's Altar"); addStartNpc(DAICHIR); addTalkId(ALTARS); @@ -60,22 +57,17 @@ public class Q00451_LuciensAltar extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - if (event.equals("30537-04.htm")) - { + if (event.equals("30537-04.htm")) { htmltext = event; - } - else if (event.equals("30537-05.htm")) - { + } else if (event.equals("30537-05.htm")) { st.startQuest(); st.giveItems(REPLENISHED_BEAD, 5); htmltext = event; @@ -84,18 +76,14 @@ public class Q00451_LuciensAltar extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); final int npcId = npc.getId(); - if (npcId == DAICHIR) - { - switch (st.getState()) - { + if (npcId == DAICHIR) { + switch (st.getState()) { case State.COMPLETED: - if (!st.isNowAvailable()) - { + if (!st.isNowAvailable()) { htmltext = "30537-03.html"; break; } @@ -104,44 +92,32 @@ public class Q00451_LuciensAltar extends Quest htmltext = (player.getLevel() >= MIN_LEVEL) ? "30537-01.htm" : "30537-02.htm"; break; case State.STARTED: - if (st.isCond(1)) - { - if (st.isSet("32706") || st.isSet("32707") || st.isSet("32708") || st.isSet("32709") || st.isSet("32710")) - { + if (st.isCond(1)) { + if (st.isSet("32706") || st.isSet("32707") || st.isSet("32708") || st.isSet("32709") || st.isSet("32710")) { htmltext = "30537-10.html"; - } - else - { + } else { htmltext = "30537-09.html"; } - } - else - { + } else { st.giveAdena(255380, true); // Tauti reward: 13 773 960 exp, 16 232 820 sp, 742 800 Adena st.exitQuest(QuestType.DAILY, true); htmltext = "30537-08.html"; } break; } - } - else if (st.isCond(1) && st.hasQuestItems(REPLENISHED_BEAD)) - { - if (st.getInt(String.valueOf(npcId)) == 0) - { + } else if (st.isCond(1) && st.hasQuestItems(REPLENISHED_BEAD)) { + if (st.getInt(String.valueOf(npcId)) == 0) { st.set(String.valueOf(npcId), "1"); st.takeItems(REPLENISHED_BEAD, 1); st.giveItems(DISCHARGED_BEAD, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - if (st.getQuestItemsCount(DISCHARGED_BEAD) >= 5) - { + if (st.getQuestItemsCount(DISCHARGED_BEAD) >= 5) { st.setCond(2, true); } htmltext = "recharge.html"; - } - else - { + } else { htmltext = "findother.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00452_FindingtheLostSoldiers/Q00452_FindingtheLostSoldiers.java b/src/main/java/com/l2jserver/datapack/quests/Q00452_FindingtheLostSoldiers/Q00452_FindingtheLostSoldiers.java index b2edd6f6e2..31f174abac 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00452_FindingtheLostSoldiers/Q00452_FindingtheLostSoldiers.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00452_FindingtheLostSoldiers/Q00452_FindingtheLostSoldiers.java @@ -30,20 +30,17 @@ import com.l2jserver.gameserver.model.quest.State; * @author Gigiikun * @version 2012-08-10 */ -public class Q00452_FindingtheLostSoldiers extends Quest -{ +public class Q00452_FindingtheLostSoldiers extends Quest { private static final int JAKAN = 32773; private static final int TAG_ID = 15513; - private static final int[] SOLDIER_CORPSES = - { + private static final int[] SOLDIER_CORPSES = { 32769, 32770, 32771, 32772 }; - public Q00452_FindingtheLostSoldiers() - { + public Q00452_FindingtheLostSoldiers() { super(452, Q00452_FindingtheLostSoldiers.class.getSimpleName(), "Finding the Lost Soldiers"); addStartNpc(JAKAN); addTalkId(JAKAN); @@ -52,40 +49,28 @@ public class Q00452_FindingtheLostSoldiers extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } String htmltext = event; - if (npc.getId() == JAKAN) - { - if (event.equals("32773-3.htm")) - { + if (npc.getId() == JAKAN) { + if (event.equals("32773-3.htm")) { st.startQuest(); } - } - else - { - if (st.isCond(1)) - { - if (getRandom(10) < 5) - { + } else { + if (st.isCond(1)) { + if (getRandom(10) < 5) { st.giveItems(TAG_ID, 1); - } - else - { + } else { htmltext = "corpse-3.html"; } st.setCond(2, true); npc.deleteMe(); - } - else - { + } else { htmltext = "corpse-3.html"; } } @@ -93,24 +78,18 @@ public class Q00452_FindingtheLostSoldiers extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - if (npc.getId() == JAKAN) - { - switch (st.getState()) - { + if (npc.getId() == JAKAN) { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() < 84) ? "32773-0.html" : "32773-1.htm"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "32773-4.html"; - } - else if (st.isCond(2)) - { + } else if (st.isCond(2)) { htmltext = "32773-5.html"; st.takeItems(TAG_ID, -1); st.giveAdena(95200, true); @@ -119,22 +98,16 @@ public class Q00452_FindingtheLostSoldiers extends Quest } break; case State.COMPLETED: - if (st.isNowAvailable()) - { + if (st.isNowAvailable()) { st.setState(State.CREATED); htmltext = (player.getLevel() < 84) ? "32773-0.html" : "32773-1.htm"; - } - else - { + } else { htmltext = "32773-6.html"; } break; } - } - else - { - if (st.isCond(1)) - { + } else { + if (st.isCond(1)) { htmltext = "corpse-1.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00453_NotStrongEnoughAlone/Q00453_NotStrongEnoughAlone.java b/src/main/java/com/l2jserver/datapack/quests/Q00453_NotStrongEnoughAlone/Q00453_NotStrongEnoughAlone.java index 91e6480a67..13b7763119 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00453_NotStrongEnoughAlone/Q00453_NotStrongEnoughAlone.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00453_NotStrongEnoughAlone/Q00453_NotStrongEnoughAlone.java @@ -33,12 +33,10 @@ import com.l2jserver.gameserver.util.Util; * Not Strong Enough Alone (453) * @author malyelfik */ -public class Q00453_NotStrongEnoughAlone extends Quest -{ +public class Q00453_NotStrongEnoughAlone extends Quest { // NPC private static final int KLEMIS = 32734; - private static final int[] MONSTER1 = - { + private static final int[] MONSTER1 = { 22746, 22747, 22748, @@ -48,8 +46,7 @@ public class Q00453_NotStrongEnoughAlone extends Quest 22752, 22753 }; - private static final int[] MONSTER2 = - { + private static final int[] MONSTER2 = { 22754, 22755, 22756, @@ -57,8 +54,7 @@ public class Q00453_NotStrongEnoughAlone extends Quest 22758, 22759 }; - private static final int[] MONSTER3 = - { + private static final int[] MONSTER3 = { 22760, 22761, 22762, @@ -68,8 +64,7 @@ public class Q00453_NotStrongEnoughAlone extends Quest }; // Reward - private static final int[][] REWARD = - { + private static final int[][] REWARD = { { 15815, 15816, @@ -98,8 +93,7 @@ public class Q00453_NotStrongEnoughAlone extends Quest } }; - public Q00453_NotStrongEnoughAlone() - { + public Q00453_NotStrongEnoughAlone() { super(453, Q00453_NotStrongEnoughAlone.class.getSimpleName(), "Not Strong Enought Alone"); addStartNpc(KLEMIS); addTalkId(KLEMIS); @@ -108,43 +102,31 @@ public class Q00453_NotStrongEnoughAlone extends Quest addKillId(MONSTER3); } - private void increaseKill(L2PcInstance player, L2Npc npc) - { + private void increaseKill(L2PcInstance player, L2Npc npc) { QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return; } int npcId = npc.getId(); - if (Util.checkIfInRange(1500, npc, player, false)) - { + if (Util.checkIfInRange(1500, npc, player, false)) { final ExQuestNpcLogList log = new ExQuestNpcLogList(getId()); - if (Util.contains(MONSTER1, npcId) && st.isCond(2)) - { - if (npcId == MONSTER1[4]) - { + if (Util.contains(MONSTER1, npcId) && st.isCond(2)) { + if (npcId == MONSTER1[4]) { npcId = MONSTER1[0]; - } - else if (npcId == MONSTER1[5]) - { + } else if (npcId == MONSTER1[5]) { npcId = MONSTER1[1]; - } - else if (npcId == MONSTER1[6]) - { + } else if (npcId == MONSTER1[6]) { npcId = MONSTER1[2]; - } - else if (npcId == MONSTER1[7]) - { + } else if (npcId == MONSTER1[7]) { npcId = MONSTER1[3]; } int i = st.getInt(String.valueOf(npcId)); - if (i < 15) - { + if (i < 15) { st.set(Integer.toString(npcId), Integer.toString(i + 1)); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -155,25 +137,17 @@ public class Q00453_NotStrongEnoughAlone extends Quest log.addNpc(MONSTER1[1], st.getInt(String.valueOf(MONSTER1[1]))); log.addNpc(MONSTER1[2], st.getInt(String.valueOf(MONSTER1[2]))); log.addNpc(MONSTER1[3], st.getInt(String.valueOf(MONSTER1[3]))); - } - else if (Util.contains(MONSTER2, npcId) && st.isCond(3)) - { - if (npcId == MONSTER2[3]) - { + } else if (Util.contains(MONSTER2, npcId) && st.isCond(3)) { + if (npcId == MONSTER2[3]) { npcId = MONSTER2[0]; - } - else if (npcId == MONSTER2[4]) - { + } else if (npcId == MONSTER2[4]) { npcId = MONSTER2[1]; - } - else if (npcId == MONSTER2[5]) - { + } else if (npcId == MONSTER2[5]) { npcId = MONSTER2[2]; } int i = st.getInt(String.valueOf(npcId)); - if (i < 20) - { + if (i < 20) { st.set(Integer.toString(npcId), Integer.toString(i + 1)); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -183,25 +157,17 @@ public class Q00453_NotStrongEnoughAlone extends Quest log.addNpc(MONSTER2[0], st.getInt(String.valueOf(MONSTER2[0]))); log.addNpc(MONSTER2[1], st.getInt(String.valueOf(MONSTER2[1]))); log.addNpc(MONSTER2[2], st.getInt(String.valueOf(MONSTER2[2]))); - } - else if (Util.contains(MONSTER3, npcId) && st.isCond(4)) - { - if (npcId == MONSTER3[3]) - { + } else if (Util.contains(MONSTER3, npcId) && st.isCond(4)) { + if (npcId == MONSTER3[3]) { npcId = MONSTER3[0]; - } - else if (npcId == MONSTER3[4]) - { + } else if (npcId == MONSTER3[4]) { npcId = MONSTER3[1]; - } - else if (npcId == MONSTER3[5]) - { + } else if (npcId == MONSTER3[5]) { npcId = MONSTER3[2]; } int i = st.getInt(String.valueOf(npcId)); - if (i < 20) - { + if (i < 20) { st.set(Integer.toString(npcId), Integer.toString(i + 1)); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -217,94 +183,69 @@ public class Q00453_NotStrongEnoughAlone extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return htmltext; } - if (event.equalsIgnoreCase("32734-06.htm")) - { + if (event.equalsIgnoreCase("32734-06.htm")) { st.startQuest(); - } - else if (event.equalsIgnoreCase("32734-07.html")) - { + } else if (event.equalsIgnoreCase("32734-07.html")) { st.setCond(2, true); - } - else if (event.equalsIgnoreCase("32734-08.html")) - { + } else if (event.equalsIgnoreCase("32734-08.html")) { st.setCond(3, true); - } - else if (event.equalsIgnoreCase("32734-09.html")) - { + } else if (event.equalsIgnoreCase("32734-09.html")) { st.setCond(4, true); } return htmltext; } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { - if (player.getParty() != null) - { - for (L2PcInstance member : player.getParty().getMembers()) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { + if (player.getParty() != null) { + for (L2PcInstance member : player.getParty().getMembers()) { increaseKill(member, npc); } - } - else - { + } else { increaseKill(player, npc); } return null; } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: - if ((player.getLevel() >= 84) && player.hasQuestCompleted(Q10282_ToTheSeedOfAnnihilation.class.getSimpleName())) - { + if ((player.getLevel() >= 84) && player.hasQuestCompleted(Q10282_ToTheSeedOfAnnihilation.class.getSimpleName())) { htmltext = "32734-01.htm"; - } - else - { + } else { htmltext = "32734-03.html"; } break; case State.STARTED: - switch (st.getCond()) - { - case 1: - { + switch (st.getCond()) { + case 1: { htmltext = "32734-10.html"; break; } - case 2: - { + case 2: { htmltext = "32734-11.html"; break; } - case 3: - { + case 3: { htmltext = "32734-12.html"; break; } - case 4: - { + case 4: { htmltext = "32734-13.html"; break; } - case 5: - { + case 5: { st.giveItems(REWARD[getRandom(REWARD.length)][getRandom(REWARD[0].length)], 1); st.exitQuest(QuestType.DAILY, true); htmltext = "32734-14.html"; @@ -313,19 +254,13 @@ public class Q00453_NotStrongEnoughAlone extends Quest } break; case State.COMPLETED: - if (!st.isNowAvailable()) - { + if (!st.isNowAvailable()) { htmltext = "32734-02.htm"; - } - else - { + } else { st.setState(State.CREATED); - if ((player.getLevel() >= 84) && player.hasQuestCompleted(Q10282_ToTheSeedOfAnnihilation.class.getSimpleName())) - { + if ((player.getLevel() >= 84) && player.hasQuestCompleted(Q10282_ToTheSeedOfAnnihilation.class.getSimpleName())) { htmltext = "32734-01.htm"; - } - else - { + } else { htmltext = "32734-03.html"; } } @@ -334,12 +269,9 @@ public class Q00453_NotStrongEnoughAlone extends Quest return htmltext; } - private static void checkProgress(QuestState st, int count, int... mobs) - { - for (int mob : mobs) - { - if (st.getInt(String.valueOf(mob)) < count) - { + private static void checkProgress(QuestState st, int count, int... mobs) { + for (int mob : mobs) { + if (st.getInt(String.valueOf(mob)) < count) { return; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java b/src/main/java/com/l2jserver/datapack/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java index 6215effeed..89f91c4993 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java @@ -45,8 +45,7 @@ import com.l2jserver.gameserver.util.Util; * Completely Lost (454) * @author Zoey76 */ -public final class Q00454_CompletelyLost extends Quest -{ +public final class Q00454_CompletelyLost extends Quest { // NPCs private static final int INJURED_SOLDIER = 32738; private static final int ERMIAN = 32736; @@ -54,8 +53,7 @@ public final class Q00454_CompletelyLost extends Quest private static final int MIN_LEVEL = 84; private static final Location MOVE_TO = new Location(-180219, 186341, -10600); - public Q00454_CompletelyLost() - { + public Q00454_CompletelyLost() { super(454, Q00454_CompletelyLost.class.getSimpleName(), "Completely Lost"); addStartNpc(INJURED_SOLDIER); addTalkId(INJURED_SOLDIER, ERMIAN); @@ -66,52 +64,37 @@ public final class Q00454_CompletelyLost extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - switch (event) - { - case "QUEST_TIMER": - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + switch (event) { + case "QUEST_TIMER": { npc.broadcastEvent("SCE_IM_ERMIAN", 300, null); startQuestTimer("QUEST_TIMER", 100, npc, null); break; } - case "SAY_TIMER1": - { + case "SAY_TIMER1": { // TODO: npc.changeStatus(3); broadcastNpcSay(npc, NpcStringId.GASP); break; } - case "SAY_TIMER2": - { + case "SAY_TIMER2": { broadcastNpcSay(npc, NpcStringId.SOB_TO_SEE_ERMIAN_AGAIN_CAN_I_GO_TO_MY_FAMILY_NOW); startQuestTimer("EXPIRED_TIMER", 2000, npc, null); break; } - case "CHECK_TIMER": - { + case "CHECK_TIMER": { final L2PcInstance leader = npc.getVariables().getObject("leader", L2PcInstance.class); - if (leader != null) - { + if (leader != null) { double dist = Util.calculateDistance(npc, leader, false, false); - if (dist > 1000) - { - if (((dist > 5000) && (dist < 6900)) || ((dist > 31000) && (dist < 32000))) - { + if (dist > 1000) { + if (((dist > 5000) && (dist < 6900)) || ((dist > 31000) && (dist < 32000))) { npc.teleToLocation(leader); - } - else if (npc.getVariables().getInt("whisper", 0) == 0) - { + } else if (npc.getVariables().getInt("whisper", 0) == 0) { whisper(npc, leader, NpcStringId.WHERE_ARE_YOU_I_CANT_SEE_ANYTHING); npc.getVariables().set("whisper", 1); - } - else if (npc.getVariables().getInt("whisper", 0) == 1) - { + } else if (npc.getVariables().getInt("whisper", 0) == 1) { whisper(npc, leader, NpcStringId.WHERE_ARE_YOU_REALLY_I_CANT_FOLLOW_YOU_LIKE_THIS); npc.getVariables().set("whisper", 2); - } - else if (npc.getVariables().getInt("whisper", 0) == 2) - { + } else if (npc.getVariables().getInt("whisper", 0) == 2) { whisper(npc, leader, NpcStringId.IM_SORRY_THIS_IS_IT_FOR_ME); npc.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_FAILURE", npc, null); } @@ -120,107 +103,84 @@ public final class Q00454_CompletelyLost extends Quest startQuestTimer("CHECK_TIMER", 2000, npc, null); break; } - case "TIME_LIMIT1": - { + case "TIME_LIMIT1": { final L2PcInstance leader = npc.getVariables().getObject("leader", L2PcInstance.class); - if (leader != null) - { + if (leader != null) { startQuestTimer("TIME_LIMIT2", 150000, npc, null); whisper(npc, leader, NpcStringId.IS_IT_STILL_LONG_OFF); } break; } - case "TIME_LIMIT2": - { + case "TIME_LIMIT2": { final L2PcInstance leader = npc.getVariables().getObject("leader", L2PcInstance.class); - if (leader != null) - { + if (leader != null) { startQuestTimer("TIME_LIMIT3", 150000, npc, null); whisper(npc, leader, NpcStringId.IS_ERMIAN_WELL_EVEN_I_CANT_BELIEVE_THAT_I_SURVIVED_IN_A_PLACE_LIKE_THIS); } break; } - case "TIME_LIMIT3": - { + case "TIME_LIMIT3": { final L2PcInstance leader = npc.getVariables().getObject("leader", L2PcInstance.class); - if (leader != null) - { + if (leader != null) { startQuestTimer("TIME_LIMIT4", 150000, npc, null); whisper(npc, leader, NpcStringId.I_DONT_KNOW_HOW_LONG_ITS_BEEN_SINCE_I_PARTED_COMPANY_WITH_YOU_TIME_DOESNT_SEEM_TO_MOVE_IT_JUST_FEELS_TOO_LONG); } break; } - case "TIME_LIMIT4": - { + case "TIME_LIMIT4": { final L2PcInstance leader = npc.getVariables().getObject("leader", L2PcInstance.class); - if (leader != null) - { + if (leader != null) { startQuestTimer("TIME_LIMIT5", 150000, npc, null); whisper(npc, leader, NpcStringId.SORRY_TO_SAY_THIS_BUT_THE_PLACE_YOU_STRUCK_ME_BEFORE_NOW_HURTS_GREATLY); } break; } - case "TIME_LIMIT5": - { + case "TIME_LIMIT5": { final L2PcInstance leader = npc.getVariables().getObject("leader", L2PcInstance.class); - if (leader != null) - { + if (leader != null) { whisper(npc, leader, NpcStringId.UGH_IM_SORRY_IT_LOOKS_LIKE_THIS_IS_IT_FOR_ME_I_WANTED_TO_LIVE_AND_SEE_MY_FAMILY); } npc.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_FAILURE", npc, null); startQuestTimer("EXPIRED_TIMER", 2000, npc, null); break; } - case "EXPIRED_TIMER": - { + case "EXPIRED_TIMER": { npc.deleteMe(); break; } } // For NPC-only timers, player is null and no further checks or actions are required. - if (player == null) - { + if (player == null) { return null; } final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "32738-04.htm": - { - if (qs.isCreated() && qs.isNowAvailable() && (player.getLevel() >= MIN_LEVEL)) - { - if (npc.getVariables().getInt("quest_escort", 0) == 0) - { + switch (event) { + case "32738-04.htm": { + if (qs.isCreated() && qs.isNowAvailable() && (player.getLevel() >= MIN_LEVEL)) { + if (npc.getVariables().getInt("quest_escort", 0) == 0) { npc.getVariables().set("leader", player); npc.getVariables().set("quest_escort", 1); - if (player.isInParty()) - { + if (player.isInParty()) { npc.getVariables().set("partyId", player.getParty().getLeaderObjectId()); } qs.setMemoState(1); qs.startQuest(); htmltext = event; - } - else - { + } else { final L2PcInstance leader = npc.getVariables().getObject("leader", L2PcInstance.class); - if (leader.isInParty() && leader.getParty().containsPlayer(player)) - { + if (leader.isInParty() && leader.getParty().containsPlayer(player)) { qs.startQuest(); qs.setMemoState(1); htmltext = getHtm(player.getHtmlPrefix(), "32738-04a.htm"); htmltext = htmltext.replaceAll("leader", leader.getName()); - } - else - { + } else { htmltext = getHtm(player.getHtmlPrefix(), "32738-01b.htm"); htmltext = htmltext.replaceAll("leader", leader.getName()); } @@ -228,47 +188,34 @@ public final class Q00454_CompletelyLost extends Quest } break; } - case "agree1": - { - if (qs.isMemoState(1)) - { + case "agree1": { + if (qs.isMemoState(1)) { final L2PcInstance leader = npc.getVariables().getObject("leader", L2PcInstance.class); - if (leader != null) - { - if (leader.isInParty()) - { + if (leader != null) { + if (leader.isInParty()) { qs.setMemoState(2); npc.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_START", npc, null); htmltext = "32738-06.html"; - } - else - { + } else { htmltext = "32738-05a.html"; } } } break; } - case "agree2": - { - if (qs.isMemoState(1)) - { + case "agree2": { + if (qs.isMemoState(1)) { qs.setMemoState(2); htmltext = "32738-06.html"; npc.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_START", npc, null); final L2PcInstance leader = npc.getVariables().getObject("leader", L2PcInstance.class); - if (leader != null) - { - if (leader.isInParty()) - { - for (L2PcInstance member : leader.getParty().getMembers()) - { - if (member != null) - { + if (leader != null) { + if (leader.isInParty()) { + for (L2PcInstance member : leader.getParty().getMembers()) { + if (member != null) { final QuestState qsMember = getQuestState(member, false); if ((qsMember != null) && qsMember.isMemoState(1) // - && (npc.getVariables().getInt("partyId", 0) == leader.getParty().getLeaderObjectId())) - { + && (npc.getVariables().getInt("partyId", 0) == leader.getParty().getLeaderObjectId())) { qsMember.setMemoState(2); } } @@ -278,10 +225,8 @@ public final class Q00454_CompletelyLost extends Quest } break; } - case "32738-07.html": - { - if (qs.isMemoState(1)) - { + case "32738-07.html": { + if (qs.isMemoState(1)) { htmltext = event; } break; @@ -293,8 +238,7 @@ public final class Q00454_CompletelyLost extends Quest @RegisterEvent(EventType.ON_CREATURE_ATTACKED) @RegisterType(ListenerRegisterType.NPC) @Id(INJURED_SOLDIER) - public TerminateReturn onAttacked(OnCreatureAttacked event) - { + public TerminateReturn onAttacked(OnCreatureAttacked event) { final L2Npc npc = (L2Npc) event.getTarget(); // TODO: npc.changeStatus(2); npc.getVariables().set("state", 1); @@ -306,14 +250,10 @@ public final class Q00454_CompletelyLost extends Quest } @Override - public String onEventReceived(String eventName, L2Npc sender, L2Npc receiver, L2Object reference) - { - switch (eventName) - { - case "SCE_IM_ERMIAN": - { - if (receiver.getVariables().getInt("state", 0) == 2) - { + public String onEventReceived(String eventName, L2Npc sender, L2Npc receiver, L2Object reference) { + switch (eventName) { + case "SCE_IM_ERMIAN": { + if (receiver.getVariables().getInt("state", 0) == 2) { receiver.getVariables().set("state", 3); receiver.getVariables().set("ermian", sender); receiver.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); @@ -322,11 +262,9 @@ public final class Q00454_CompletelyLost extends Quest } break; } - case "SCE_A_SEED_ESCORT_QUEST_START": - { + case "SCE_A_SEED_ESCORT_QUEST_START": { final L2PcInstance leader = receiver.getVariables().getObject("leader", L2PcInstance.class); - if (leader != null) - { + if (leader != null) { receiver.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, leader); } @@ -336,30 +274,21 @@ public final class Q00454_CompletelyLost extends Quest receiver.getVariables().set("quest_escort", 99); break; } - case "SCE_A_SEED_ESCORT_QUEST_SUCCESS": - { + case "SCE_A_SEED_ESCORT_QUEST_SUCCESS": { final L2PcInstance leader = receiver.getVariables().getObject("leader", L2PcInstance.class); - if (leader != null) - { - if (leader.isInParty()) - { - for (L2PcInstance member : leader.getParty().getMembers()) - { - if (member != null) - { + if (leader != null) { + if (leader.isInParty()) { + for (L2PcInstance member : leader.getParty().getMembers()) { + if (member != null) { final QuestState qs = getQuestState(member, false); - if ((qs != null) && qs.isMemoState(2)) - { + if ((qs != null) && qs.isMemoState(2)) { qs.setMemoState(4); } } } - } - else - { + } else { final QuestState qs = getQuestState(leader, false); - if ((qs != null) && qs.isMemoState(2)) - { + if ((qs != null) && qs.isMemoState(2)) { qs.setMemoState(4); } } @@ -373,30 +302,21 @@ public final class Q00454_CompletelyLost extends Quest cancelQuestTimer("TIME_LIMIT5", receiver, null); break; } - case "SCE_A_SEED_ESCORT_QUEST_FAILURE": - { + case "SCE_A_SEED_ESCORT_QUEST_FAILURE": { final L2PcInstance leader = receiver.getVariables().getObject("leader", L2PcInstance.class); - if (leader != null) - { - if (leader.isInParty()) - { - for (L2PcInstance member : leader.getParty().getMembers()) - { - if (member != null) - { + if (leader != null) { + if (leader.isInParty()) { + for (L2PcInstance member : leader.getParty().getMembers()) { + if (member != null) { final QuestState qs = getQuestState(member, false); - if ((qs != null) && qs.isMemoState(2)) - { + if ((qs != null) && qs.isMemoState(2)) { qs.setMemoState(3); } } } - } - else - { + } else { final QuestState qs = getQuestState(leader, false); - if ((qs != null) && qs.isMemoState(2)) - { + if ((qs != null) && qs.isMemoState(2)) { qs.setMemoState(3); } } @@ -416,349 +336,207 @@ public final class Q00454_CompletelyLost extends Quest } @Override - public void onMoveFinished(L2Npc npc) - { + public void onMoveFinished(L2Npc npc) { final L2Npc ermian = npc.getVariables().getObject("ermian", L2Npc.class); - if (ermian != null) - { + if (ermian != null) { npc.setHeading(Util.calculateHeadingFrom(npc, ermian)); startQuestTimer("SAY_TIMER2", 2000, npc, null); } } @Override - public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) - { - if (creature.isPlayer() && (npc.getVariables().getInt("state", 0) == 0)) - { + public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) { + if (creature.isPlayer() && (npc.getVariables().getInt("state", 0) == 0)) { addAttackDesire(npc, creature.getActingPlayer(), 10); } return super.onSeeCreature(npc, creature, isSummon); } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { startQuestTimer("QUEST_TIMER", 1000, npc, null); return super.onSpawn(npc); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (qs.getState()) - { - case State.COMPLETED: - { - if (!qs.isNowAvailable()) - { + switch (qs.getState()) { + case State.COMPLETED: { + if (!qs.isNowAvailable()) { htmltext = "32738-02.htm"; break; } qs.setState(State.CREATED); } - case State.CREATED: - { - if (player.getLevel() >= MIN_LEVEL) - { + case State.CREATED: { + if (player.getLevel() >= MIN_LEVEL) { final int quest_escort = npc.getVariables().getInt("quest_escort", 0); - if (quest_escort == 0) - { + if (quest_escort == 0) { htmltext = "32738-01.htm"; - } - else if (quest_escort == 99) - { + } else if (quest_escort == 99) { htmltext = "32738-01c.htm"; - } - else - { + } else { final L2PcInstance leader = npc.getVariables().getObject("leader", L2PcInstance.class); - if (leader.isInParty() && leader.getParty().containsPlayer(player)) - { + if (leader.isInParty() && leader.getParty().containsPlayer(player)) { htmltext = getHtm(player.getHtmlPrefix(), "32738-01a.htm"); htmltext = htmltext.replaceAll("leader", leader.getName()); htmltext = htmltext.replaceAll("name", player.getName()); - } - else - { + } else { htmltext = getHtm(player.getHtmlPrefix(), "32738-01b.htm"); htmltext = htmltext.replaceAll("leader", leader.getName()); } } - } - else - { + } else { htmltext = "32738-03.htm"; } break; } - case State.STARTED: - { - switch (npc.getId()) - { - case INJURED_SOLDIER: - { - if (qs.isMemoState(1)) - { + case State.STARTED: { + switch (npc.getId()) { + case INJURED_SOLDIER: { + if (qs.isMemoState(1)) { htmltext = "32738-05.html"; - } - else if (qs.isMemoState(2)) - { + } else if (qs.isMemoState(2)) { htmltext = "32738-08.html"; } break; } - case ERMIAN: - { - switch (qs.getMemoState()) - { + case ERMIAN: { + switch (qs.getMemoState()) { case 1: - case 2: - { + case 2: { htmltext = "32736-01.html"; break; } - case 3: - { + case 3: { qs.exitQuest(QuestType.DAILY, true); htmltext = "32736-02.html"; break; } - case 4: - { + case 4: { final int group = getRandom(3); final int chance = getRandom(100); - if (group == 0) - { - if (getRandomBoolean()) - { - if (chance < 11) - { + if (group == 0) { + if (getRandomBoolean()) { + if (chance < 11) { giveItems(player, 15792, 1); // Recipe - Sealed Vesper Helmet (60%) - } - else if ((chance <= 11) && (chance < 22)) - { + } else if ((chance <= 11) && (chance < 22)) { giveItems(player, 15798, 1); // Recipe - Sealed Vesper Gaiter (60%) - } - else if ((chance <= 22) && (chance < 33)) - { + } else if ((chance <= 22) && (chance < 33)) { giveItems(player, 15795, 1); // Recipe - Sealed Vesper Breastplate (60%) - } - else if ((chance <= 33) && (chance < 44)) - { + } else if ((chance <= 33) && (chance < 44)) { giveItems(player, 15801, 1); // Recipe - Sealed Vesper Gauntlet (60%) - } - else if ((chance <= 44) && (chance < 55)) - { + } else if ((chance <= 44) && (chance < 55)) { giveItems(player, 15808, 1); // Recipe - Sealed Vesper Shield (60%) - } - else if ((chance <= 55) && (chance < 66)) - { + } else if ((chance <= 55) && (chance < 66)) { giveItems(player, 15804, 1); // Recipe - Sealed Vesper Boots (60%) - } - else if ((chance <= 66) && (chance < 77)) - { + } else if ((chance <= 66) && (chance < 77)) { giveItems(player, 15809, 1); // Recipe - Sealed Vesper Ring (70%) - } - else if ((chance <= 77) && (chance < 88)) - { + } else if ((chance <= 77) && (chance < 88)) { giveItems(player, 15810, 1); // Recipe - Sealed Vesper Earring (70%) - } - else - { + } else { giveItems(player, 15811, 1); // Recipe - Sealed Vesper Necklace (70%) } - } - else - { - if (chance < 11) - { + } else { + if (chance < 11) { giveItems(player, 15660, 3); // Sealed Vesper Helmet Piece - } - else if ((chance <= 11) && (chance < 22)) - { + } else if ((chance <= 11) && (chance < 22)) { giveItems(player, 15666, 3); // Sealed Vesper Gaiter Piece - } - else if ((chance <= 22) && (chance < 33)) - { + } else if ((chance <= 22) && (chance < 33)) { giveItems(player, 15663, 3); // Sealed Vesper Breastplate Piece - } - else if ((chance <= 33) && (chance < 44)) - { + } else if ((chance <= 33) && (chance < 44)) { giveItems(player, 15667, 3); // Sealed Vesper Gauntlet Piece - } - else if ((chance <= 44) && (chance < 55)) - { + } else if ((chance <= 44) && (chance < 55)) { giveItems(player, 15669, 3); // Sealed Vesper Verteidiger Piece - } - else if ((chance <= 55) && (chance < 66)) - { + } else if ((chance <= 55) && (chance < 66)) { giveItems(player, 15668, 3); // Sealed Vesper Boots Piece - } - else if ((chance <= 66) && (chance < 77)) - { + } else if ((chance <= 66) && (chance < 77)) { giveItems(player, 15769, 3); // Sealed Vesper Ring Gem - } - else if ((chance <= 77) && (chance < 88)) - { + } else if ((chance <= 77) && (chance < 88)) { giveItems(player, 15770, 3); // Sealed Vesper Earring Gem - } - else - { + } else { giveItems(player, 15771, 3); // Sealed Vesper Necklace Gem } } - } - else if (group == 1) - { - if (getRandomBoolean()) - { - if (chance < 12) - { + } else if (group == 1) { + if (getRandomBoolean()) { + if (chance < 12) { giveItems(player, 15805, 1); // Recipe - Sealed Vesper Leather Boots (60%) - } - else if ((chance <= 12) && (chance < 24)) - { + } else if ((chance <= 12) && (chance < 24)) { giveItems(player, 15796, 1); // Recipe - Sealed Vesper Leather Breastplate (60%) - } - else if ((chance <= 24) && (chance < 36)) - { + } else if ((chance <= 24) && (chance < 36)) { giveItems(player, 15793, 1); // Recipe - Sealed Vesper Leather Helmet (60%) - } - else if ((chance <= 36) && (chance < 48)) - { + } else if ((chance <= 36) && (chance < 48)) { giveItems(player, 15799, 1); // Recipe - Sealed Vesper Leather Legging (60%) - } - else if ((chance <= 48) && (chance < 60)) - { + } else if ((chance <= 48) && (chance < 60)) { giveItems(player, 15802, 1); // Recipe - Sealed Vesper Leather Gloves (60%) - } - else if ((chance <= 60) && (chance < 72)) - { + } else if ((chance <= 60) && (chance < 72)) { giveItems(player, 15809, 1); // Recipe - Sealed Vesper Ring (70%) - } - else if ((chance <= 72) && (chance < 84)) - { + } else if ((chance <= 72) && (chance < 84)) { giveItems(player, 15810, 1); // Recipe - Sealed Vesper Earring (70%) - } - else - { + } else { giveItems(player, 15811, 1); // Recipe - Sealed Vesper Necklace (70%) } - } - else - { - if (chance < 12) - { + } else { + if (chance < 12) { giveItems(player, 15672, 3); // Sealed Vesper Leather Boots Piece - } - else if ((chance <= 12) && (chance < 24)) - { + } else if ((chance <= 12) && (chance < 24)) { giveItems(player, 15664, 3); // Sealed Vesper Leather Breastplate Piece - } - else if ((chance <= 24) && (chance < 36)) - { + } else if ((chance <= 24) && (chance < 36)) { giveItems(player, 15661, 3); // Sealed Vesper Leather Helmet Piece - } - else if ((chance <= 36) && (chance < 48)) - { + } else if ((chance <= 36) && (chance < 48)) { giveItems(player, 15670, 3); // Sealed Vesper Leather Legging Piece - } - else if ((chance <= 48) && (chance < 60)) - { + } else if ((chance <= 48) && (chance < 60)) { giveItems(player, 15671, 3); // Sealed Vesper Leather Gloves Piece - } - else if ((chance <= 60) && (chance < 72)) - { + } else if ((chance <= 60) && (chance < 72)) { giveItems(player, 15769, 3); // Sealed Vesper Ring Gem - } - else if ((chance <= 72) && (chance < 84)) - { + } else if ((chance <= 72) && (chance < 84)) { giveItems(player, 15770, 3); // Sealed Vesper Earring Gem - } - else - { + } else { giveItems(player, 15771, 3); // Sealed Vesper Necklace Gem } } - } - else if (getRandomBoolean()) - { - if (chance < 11) - { + } else if (getRandomBoolean()) { + if (chance < 11) { giveItems(player, 15800, 1); - } - else if ((chance <= 11) && (chance < 22)) // Recipe - Sealed Vesper Stockings (60%) + } else if ((chance <= 11) && (chance < 22)) // Recipe - Sealed Vesper Stockings (60%) { giveItems(player, 15803, 1); // Recipe - Sealed Vesper Gloves (60%) - } - else if ((chance <= 22) && (chance < 33)) - { + } else if ((chance <= 22) && (chance < 33)) { giveItems(player, 15806, 1); // Recipe - Sealed Vesper Shoes (60%) - } - else if ((chance <= 33) && (chance < 44)) - { + } else if ((chance <= 33) && (chance < 44)) { giveItems(player, 15807, 1); // Recipe - Sealed Vesper Sigil (60%) - } - else if ((chance <= 44) && (chance < 55)) - { + } else if ((chance <= 44) && (chance < 55)) { giveItems(player, 15797, 1); // Recipe - Sealed Vesper Tunic (60%) - } - else if ((chance <= 55) && (chance < 66)) - { + } else if ((chance <= 55) && (chance < 66)) { giveItems(player, 15794, 1); // Recipe - Sealed Vesper Circlet (60%) - } - else if ((chance <= 66) && (chance < 77)) - { + } else if ((chance <= 66) && (chance < 77)) { giveItems(player, 15809, 1); // Recipe - Sealed Vesper Ring (70%) - } - else if ((chance <= 77) && (chance < 88)) - { + } else if ((chance <= 77) && (chance < 88)) { giveItems(player, 15810, 1); // Recipe - Sealed Vesper Earring (70%) - } - else - { + } else { giveItems(player, 15811, 1); // Recipe - Sealed Vesper Necklace (70%) } - } - else - { - if (chance < 11) - { + } else { + if (chance < 11) { giveItems(player, 15673, 3); // Sealed Vesper Stockings Piece - } - else if ((chance <= 11) && (chance < 22)) - { + } else if ((chance <= 11) && (chance < 22)) { giveItems(player, 15674, 3); // Sealed Vesper Gloves Piece - } - else if ((chance <= 22) && (chance < 33)) - { + } else if ((chance <= 22) && (chance < 33)) { giveItems(player, 15675, 3); // Sealed Vesper Shoes Piece - } - else if ((chance <= 33) && (chance < 44)) - { + } else if ((chance <= 33) && (chance < 44)) { giveItems(player, 15691, 3); // Sealed Vesper Sigil Piece - } - else if ((chance <= 44) && (chance < 55)) - { + } else if ((chance <= 44) && (chance < 55)) { giveItems(player, 15665, 3); // Sealed Vesper Tunic Piece - } - else if ((chance <= 55) && (chance < 66)) - { + } else if ((chance <= 55) && (chance < 66)) { giveItems(player, 15662, 3); // Sealed Vesper Circlet Piece - } - else if ((chance <= 66) && (chance < 77)) - { + } else if ((chance <= 66) && (chance < 77)) { giveItems(player, 15769, 3); // Sealed Vesper Ring Gem - } - else if ((chance <= 77) && (chance < 88)) - { + } else if ((chance <= 77) && (chance < 88)) { giveItems(player, 15770, 3); // Sealed Vesper Earring Gem - } - else - { + } else { giveItems(player, 15771, 3); // Sealed Vesper Necklace Gem } } @@ -782,8 +560,7 @@ public final class Q00454_CompletelyLost extends Quest * @param npc the NPC * @param stringId the NPC String */ - private static void broadcastNpcSay(L2Npc npc, NpcStringId stringId) - { + private static void broadcastNpcSay(L2Npc npc, NpcStringId stringId) { Broadcast.toKnownPlayers(npc, new NpcSay(npc, Say2.NPC_ALL, stringId)); } @@ -793,8 +570,7 @@ public final class Q00454_CompletelyLost extends Quest * @param player the player * @param stringId the NPC String */ - private static void whisper(L2Npc npc, L2PcInstance player, NpcStringId stringId) - { + private static void whisper(L2Npc npc, L2PcInstance player, NpcStringId stringId) { player.sendPacket(new NpcSay(npc.getObjectId(), Say2.TELL, npc.getId(), stringId)); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00455_WingsOfSand/Q00455_WingsOfSand.java b/src/main/java/com/l2jserver/datapack/quests/Q00455_WingsOfSand/Q00455_WingsOfSand.java index ec69405e8d..ecb66f523f 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00455_WingsOfSand/Q00455_WingsOfSand.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00455_WingsOfSand/Q00455_WingsOfSand.java @@ -34,11 +34,9 @@ import com.l2jserver.gameserver.util.Util; * Wings of Sand (455) * @author Zoey76 */ -public class Q00455_WingsOfSand extends Quest -{ +public class Q00455_WingsOfSand extends Quest { // NPCs - private static final int[] SEPARATED_SOULS = - { + private static final int[] SEPARATED_SOULS = { 32864, 32865, 32866, @@ -63,8 +61,7 @@ public class Q00455_WingsOfSand extends Quest private static final int MIN_LEVEL = 80; private static final int CHANCE = 350; - public Q00455_WingsOfSand() - { + public Q00455_WingsOfSand() { super(455, Q00455_WingsOfSand.class.getSimpleName(), "Wings of Sand"); addStartNpc(SEPARATED_SOULS); addTalkId(SEPARATED_SOULS); @@ -73,47 +70,36 @@ public class Q00455_WingsOfSand extends Quest } @Override - public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) - { + public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && Util.checkIfInRange(1500, npc, player, false) && (getRandom(1000) < CHANCE)) - { + if ((st != null) && Util.checkIfInRange(1500, npc, player, false) && (getRandom(1000) < CHANCE)) { st.giveItems(LARGE_BABY_DRAGON, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - if (st.getQuestItemsCount(LARGE_BABY_DRAGON) == 1) - { + if (st.getQuestItemsCount(LARGE_BABY_DRAGON) == 1) { st.setCond(2, true); - } - else if (st.getQuestItemsCount(LARGE_BABY_DRAGON) == 2) - { + } else if (st.getQuestItemsCount(LARGE_BABY_DRAGON) == 2) { st.setCond(3, true); } } } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - if (player.getLevel() >= MIN_LEVEL) - { - switch (event) - { + if (player.getLevel() >= MIN_LEVEL) { + switch (event) { case "32864-02.htm": case "32864-03.htm": - case "32864-04.htm": - { + case "32864-04.htm": { htmltext = event; break; } - case "32864-05.htm": - { + case "32864-05.htm": { st.startQuest(); htmltext = event; break; @@ -124,44 +110,34 @@ public class Q00455_WingsOfSand extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { executeForEachPlayer(killer, npc, isSummon, true, false); return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { - if (player.getLevel() >= MIN_LEVEL) - { + switch (st.getState()) { + case State.CREATED: { + if (player.getLevel() >= MIN_LEVEL) { htmltext = "32864-01.htm"; } break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "32864-06.html"; break; } - case 2: - { + case 2: { giveItems(st); htmltext = "32864-07.html"; break; } - case 3: - { + case 3: { giveItems(st); htmltext = "32864-07.html"; break; @@ -169,17 +145,12 @@ public class Q00455_WingsOfSand extends Quest } break; } - case State.COMPLETED: - { - if (!st.isNowAvailable()) - { + case State.COMPLETED: { + if (!st.isNowAvailable()) { htmltext = "32864-08.html"; - } - else - { + } else { st.setState(State.CREATED); - if (player.getLevel() >= MIN_LEVEL) - { + if (player.getLevel() >= MIN_LEVEL) { htmltext = "32864-01.htm"; } } @@ -193,48 +164,29 @@ public class Q00455_WingsOfSand extends Quest * Reward the player. * @param st the quest state of the player to reward */ - private static final void giveItems(QuestState st) - { + private static final void giveItems(QuestState st) { int chance; int parts; - for (int i = 1; i <= (st.getCond() - 1); i++) - { + for (int i = 1; i <= (st.getCond() - 1); i++) { chance = getRandom(1000); parts = getRandom(1, 2); - if (chance < 50) - { + if (chance < 50) { st.giveItems(getRandom(15815, 15825), 1); // Weapon Recipes - } - else if (chance < 100) - { + } else if (chance < 100) { st.giveItems(getRandom(15792, 15808), parts); // Armor Recipes - } - else if (chance < 150) - { + } else if (chance < 150) { st.giveItems(getRandom(15809, 15811), parts); // Jewelry Recipes - } - else if (chance < 250) - { + } else if (chance < 250) { st.giveItems(ARMOR_PARTS.get(getRandom(ARMOR_PARTS.size())), parts); // Armor Parts - } - else if (chance < 500) - { + } else if (chance < 500) { st.giveItems(getRandom(15634, 15644), parts); // Weapon Parts - } - else if (chance < 750) - { + } else if (chance < 750) { st.giveItems(getRandom(15769, 15771), parts); // Jewelry Parts - } - else if (chance < 900) - { + } else if (chance < 900) { st.giveItems(getRandom(9552, 9557), 1); // Crystals - } - else if (chance < 970) - { + } else if (chance < 970) { st.giveItems(6578, 1); // Blessed Scroll: Enchant Armor (S-Grade) - } - else - { + } else { st.giveItems(6577, 1); // Blessed Scroll: Enchant Weapon (S-Grade) } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00456_DontKnowDontCare/Q00456_DontKnowDontCare.java b/src/main/java/com/l2jserver/datapack/quests/Q00456_DontKnowDontCare/Q00456_DontKnowDontCare.java index d774b2498f..19aea77445 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00456_DontKnowDontCare/Q00456_DontKnowDontCare.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00456_DontKnowDontCare/Q00456_DontKnowDontCare.java @@ -45,8 +45,7 @@ import com.l2jserver.gameserver.util.Util; * Don't Know, Don't Care (456) * @author lion, ivantotov, jurchiks */ -public final class Q00456_DontKnowDontCare extends Quest -{ +public final class Q00456_DontKnowDontCare extends Quest { // NPCs // @formatter:off private static final int[] SEPARATED_SOUL = @@ -68,8 +67,7 @@ public final class Q00456_DontKnowDontCare extends Quest private static final Map<Integer, Integer> MONSTER_ESSENCES = new HashMap<>(); private static final String TIMER_UNSPAWN_RAID_CORPSE = "TIMER_UNSPAWN_RAID_CORPSE"; - static - { + static { MONSTER_NPCS.put(25725, DRAKE_LORD_CORPSE); MONSTER_NPCS.put(25726, BEHEMOTH_LEADER_CORPSE); MONSTER_NPCS.put(25727, DRAGON_BEAST_CORPSE); @@ -79,8 +77,7 @@ public final class Q00456_DontKnowDontCare extends Quest } // Rewards - private static final int[] WEAPONS = - { + private static final int[] WEAPONS = { 15558, // Periel Sword 15559, // Skull Edge 15560, // Vigwik Axe @@ -96,8 +93,7 @@ public final class Q00456_DontKnowDontCare extends Quest 15570, // Finale Blade 15571, // Dominion Crossbow }; - private static final int[] ARMOR = - { + private static final int[] ARMOR = { 15743, // Sealed Vorpal Helmet 15746, // Sealed Vorpal Breastplate 15749, // Sealed Vorpal Gaiters @@ -116,14 +112,12 @@ public final class Q00456_DontKnowDontCare extends Quest 15757, // Sealed Vorpal Shoes 15759, // Sealed Vorpal Sigil }; - private static final int[] ACCESSORIES = - { + private static final int[] ACCESSORIES = { 15763, // Sealed Vorpal Ring 15764, // Sealed Vorpal Earring 15765, // Sealed Vorpal Necklace }; - private static final int[] ATTRIBUTE_CRYSTALS = - { + private static final int[] ATTRIBUTE_CRYSTALS = { 9552, // Fire Crystal 9553, // Water Crystal 9554, // Earth Crystal @@ -137,8 +131,7 @@ public final class Q00456_DontKnowDontCare extends Quest private static final int GEMSTONE_S = 2134; private final Map<Integer, Set<Integer>> allowedPlayerMap = new ConcurrentHashMap<>(); - public Q00456_DontKnowDontCare() - { + public Q00456_DontKnowDontCare() { super(456, Q00456_DontKnowDontCare.class.getSimpleName(), "Don't Know, Don't Care"); addStartNpc(SEPARATED_SOUL); addTalkId(SEPARATED_SOUL); @@ -149,34 +142,26 @@ public final class Q00456_DontKnowDontCare extends Quest } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); final Set<Integer> allowedPlayers = allowedPlayerMap.get(npc.getObjectId()); - if ((qs == null) || !qs.isCond(1) || (allowedPlayers == null) || !allowedPlayers.contains(player.getObjectId())) - { + if ((qs == null) || !qs.isCond(1) || (allowedPlayers == null) || !allowedPlayers.contains(player.getObjectId())) { return npc.getId() + "-02.html"; } final int essence = MONSTER_ESSENCES.get(npc.getId()); final String htmltext; - if (hasQuestItems(player, essence)) - { + if (hasQuestItems(player, essence)) { htmltext = npc.getId() + "-03.html"; - } - else - { + } else { giveItems(player, essence, 1); htmltext = npc.getId() + "-01.html"; - if (hasQuestItems(player, getRegisteredItemIds())) - { + if (hasQuestItems(player, getRegisteredItemIds())) { qs.setCond(2, true); - } - else - { + } else { playSound(player, Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -185,17 +170,13 @@ public final class Q00456_DontKnowDontCare extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (Util.contains(SEPARATED_SOUL, npc.getId())) - { - switch (qs.getState()) - { + if (Util.contains(SEPARATED_SOUL, npc.getId())) { + switch (qs.getState()) { case State.COMPLETED: - if (!qs.isNowAvailable()) - { + if (!qs.isNowAvailable()) { htmltext = "32864-02.html"; break; } @@ -205,17 +186,13 @@ public final class Q00456_DontKnowDontCare extends Quest htmltext = ((player.getLevel() >= MIN_LEVEL) ? "32864-01.htm" : "32864-03.html"); break; case State.STARTED: - switch (qs.getCond()) - { - case 1: - { + switch (qs.getCond()) { + case 1: { htmltext = (hasAtLeastOneQuestItem(player, getRegisteredItemIds()) ? "32864-09.html" : "32864-08.html"); break; } - case 2: - { - if (hasQuestItems(player, getRegisteredItemIds())) - { + case 2: { + if (hasQuestItems(player, getRegisteredItemIds())) { rewardPlayer(player, npc); qs.exitQuest(QuestType.DAILY, true); htmltext = "32864-10.html"; @@ -230,33 +207,26 @@ public final class Q00456_DontKnowDontCare extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = player != null ? getQuestState(player, false) : null; String htmltext = null; - switch (event) - { + switch (event) { case "32864-04.htm": case "32864-05.htm": - case "32864-06.htm": - { - if ((qs != null) && qs.isCreated()) - { + case "32864-06.htm": { + if ((qs != null) && qs.isCreated()) { htmltext = event; } break; } - case "32864-07.htm": - { - if ((qs != null) && qs.isCreated()) - { + case "32864-07.htm": { + if ((qs != null) && qs.isCreated()) { qs.startQuest(); htmltext = event; } break; } - case TIMER_UNSPAWN_RAID_CORPSE: - { + case TIMER_UNSPAWN_RAID_CORPSE: { allowedPlayerMap.remove(npc.getObjectId()); npc.deleteMe(); break; @@ -267,27 +237,22 @@ public final class Q00456_DontKnowDontCare extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (!killer.isInParty() || !killer.getParty().isInCommandChannel()) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (!killer.isInParty() || !killer.getParty().isInCommandChannel()) { // only the killing cc gets the quest return super.onKill(npc, killer, isSummon); } final L2CommandChannel cc = killer.getParty().getCommandChannel(); - if (cc.getMemberCount() < MIN_PLAYERS) - { + if (cc.getMemberCount() < MIN_PLAYERS) { return super.onKill(npc, killer, isSummon); } Set<Integer> allowedPlayers = new HashSet<>(); - for (AggroInfo aggro : ((L2Attackable) npc).getAggroList().values()) - { - if ((aggro.getAttacker() == null) || !aggro.getAttacker().isPlayer()) - { + for (AggroInfo aggro : ((L2Attackable) npc).getAggroList().values()) { + if ((aggro.getAttacker() == null) || !aggro.getAttacker().isPlayer()) { continue; } @@ -296,14 +261,12 @@ public final class Q00456_DontKnowDontCare extends Quest if (attacker.isInParty() // && attacker.getParty().isInCommandChannel() // && attacker.getParty().getCommandChannel().equals(cc) // only players from the same cc are allowed - && Util.checkIfInRange(1500, npc, attacker, true)) - { + && Util.checkIfInRange(1500, npc, attacker, true)) { allowedPlayers.add(attacker.getObjectId()); } } - if (!allowedPlayers.isEmpty()) - { + if (!allowedPlayers.isEmpty()) { // This depends on the boss respawn delay being at least 5 minutes. final L2Npc spawned = addSpawn(MONSTER_NPCS.get(npc.getId()), npc, true, 0); allowedPlayerMap.put(spawned.getObjectId(), allowedPlayers); @@ -313,42 +276,26 @@ public final class Q00456_DontKnowDontCare extends Quest return super.onKill(npc, killer, isSummon); } - private static void rewardPlayer(L2PcInstance player, L2Npc npc) - { + private static void rewardPlayer(L2PcInstance player, L2Npc npc) { int chance = getRandom(10000); final int reward; int count = 1; - if (chance < 170) - { + if (chance < 170) { reward = ARMOR[getRandom(ARMOR.length)]; - } - else if (chance < 200) - { + } else if (chance < 200) { reward = ACCESSORIES[getRandom(ACCESSORIES.length)]; - } - else if (chance < 270) - { + } else if (chance < 270) { reward = WEAPONS[getRandom(WEAPONS.length)]; - } - else if (chance < 325) - { + } else if (chance < 325) { reward = BLESSED_SCROLL_ENCHANT_WEAPON_S; - } - else if (chance < 425) - { + } else if (chance < 425) { reward = BLESSED_SCROLL_ENCHANT_ARMOR_S; - } - else if (chance < 925) - { + } else if (chance < 925) { reward = ATTRIBUTE_CRYSTALS[getRandom(ATTRIBUTE_CRYSTALS.length)]; - } - else if (chance < 1100) - { + } else if (chance < 1100) { reward = SCROLL_ENCHANT_WEAPON_S; - } - else - { + } else { reward = GEMSTONE_S; count = 3; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00457_LostAndFound/Q00457_LostAndFound.java b/src/main/java/com/l2jserver/datapack/quests/Q00457_LostAndFound/Q00457_LostAndFound.java index 30b2758e1b..6b9acaab00 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00457_LostAndFound/Q00457_LostAndFound.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00457_LostAndFound/Q00457_LostAndFound.java @@ -38,13 +38,11 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * Lost and Found (457) * @author nonom */ -public final class Q00457_LostAndFound extends Quest -{ +public final class Q00457_LostAndFound extends Quest { // NPCs private static final int GUMIEL = 32759; private static final int ESCORT_CHECKER = 32764; - private static final int[] SOLINA_CLAN = - { + private static final int[] SOLINA_CLAN = { 22789, // Guide Solina 22790, // Seeker Solina 22791, // Savior Solina @@ -56,8 +54,7 @@ public final class Q00457_LostAndFound extends Quest private static final int MIN_LV = 82; private static Set<L2Spawn> _escortCheckers; - public Q00457_LostAndFound() - { + public Q00457_LostAndFound() { super(457, Q00457_LostAndFound.class.getSimpleName(), "Lost and Found"); addStartNpc(GUMIEL); addSpawnId(ESCORT_CHECKER); @@ -67,19 +64,15 @@ public final class Q00457_LostAndFound extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } String htmltext = null; - switch (event) - { - case "32759-06.html": - { + switch (event) { + case "32759-06.html": { npc.setScriptValue(0); st.startQuest(); npc.setTarget(player); @@ -91,59 +84,44 @@ public final class Q00457_LostAndFound extends Quest startQuestTimer("TALK_TIME2", 30000, npc, player); break; } - case "TALK_TIME": - { + case "TALK_TIME": { broadcastNpcSay(npc, player, NpcStringId.AH_I_THINK_I_REMEMBER_THIS_PLACE, false); break; } - case "TALK_TIME2": - { + case "TALK_TIME2": { broadcastNpcSay(npc, player, NpcStringId.WHAT_WERE_YOU_DOING_HERE, false); startQuestTimer("TALK_TIME3", 10 * 1000, npc, player); break; } - case "TALK_TIME3": - { + case "TALK_TIME3": { broadcastNpcSay(npc, player, NpcStringId.I_GUESS_YOURE_THE_SILENT_TYPE_THEN_ARE_YOU_LOOKING_FOR_TREASURE_LIKE_ME, false); break; } - case "TIME_LIMIT": - { + case "TIME_LIMIT": { startQuestTimer("STOP", 2000, npc, player); st.exitQuest(QuestType.DAILY); break; } - case "CHECK": - { + case "CHECK": { final double distance = npc.calculateDistance(player, true, false); - if (distance > 1000) - { - if (distance > 5000) - { + if (distance > 1000) { + if (distance > 5000) { startQuestTimer("STOP", 2000, npc, player); st.exitQuest(QuestType.DAILY); - } - else if (npc.isScriptValue(0)) - { + } else if (npc.isScriptValue(0)) { broadcastNpcSay(npc, player, NpcStringId.HEY_DONT_GO_SO_FAST, true); npc.setScriptValue(1); - } - else if (npc.isScriptValue(1)) - { + } else if (npc.isScriptValue(1)) { broadcastNpcSay(npc, player, NpcStringId.ITS_HARD_TO_FOLLOW, true); npc.setScriptValue(2); - } - else if (npc.isScriptValue(2)) - { + } else if (npc.isScriptValue(2)) { startQuestTimer("STOP", 2000, npc, player); st.exitQuest(QuestType.DAILY); } } - for (L2Spawn escortSpawn : _escortCheckers) - { + for (L2Spawn escortSpawn : _escortCheckers) { final L2Npc escort = escortSpawn.getLastSpawn(); - if ((escort != null) && npc.isInsideRadius(escort, 1000, false, false)) - { + if ((escort != null) && npc.isInsideRadius(escort, 1000, false, false)) { startQuestTimer("STOP", 1000, npc, player); startQuestTimer("BYE", 3000, npc, player); cancelQuestTimer("CHECK", npc, player); @@ -156,8 +134,7 @@ public final class Q00457_LostAndFound extends Quest } break; } - case "STOP": - { + case "STOP": { npc.setTarget(null); npc.getAI().stopFollow(); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); @@ -167,13 +144,11 @@ public final class Q00457_LostAndFound extends Quest cancelQuestTimer("TALK_TIME2", npc, player); break; } - case "BYE": - { + case "BYE": { npc.deleteMe(); break; } - default: - { + default: { htmltext = event; break; } @@ -182,48 +157,37 @@ public final class Q00457_LostAndFound extends Quest } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { - if (npc.getTarget() != null) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { + if (npc.getTarget() != null) { return npc.getTarget().equals(player) ? "32759-08.html" : "32759-01a.html"; } return "32759.html"; } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getQuestState(player, true); - if ((getRandom(100) < CHANCE_SPAWN) && st.isNowAvailable() && (player.getLevel() >= MIN_LV)) - { + if ((getRandom(100) < CHANCE_SPAWN) && st.isNowAvailable() && (player.getLevel() >= MIN_LV)) { addSpawn(GUMIEL, npc); } return super.onKill(npc, player, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); QuestState st = getQuestState(player, true); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getLevel() >= MIN_LV) ? "32759-01.htm" : "32759-03.html"; break; } - case State.COMPLETED: - { - if (st.isNowAvailable()) - { + case State.COMPLETED: { + if (st.isNowAvailable()) { st.setState(State.CREATED); htmltext = (player.getLevel() >= MIN_LV) ? "32759-01.htm" : "32759-03.html"; - } - else - { + } else { htmltext = "32759-02.html"; } break; @@ -233,14 +197,12 @@ public final class Q00457_LostAndFound extends Quest } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { _escortCheckers = SpawnTable.getInstance().getSpawns(ESCORT_CHECKER); return super.onSpawn(npc); } - public void broadcastNpcSay(L2Npc npc, L2PcInstance player, NpcStringId stringId, boolean whisper) - { + public void broadcastNpcSay(L2Npc npc, L2PcInstance player, NpcStringId stringId, boolean whisper) { ((whisper) ? player : npc).sendPacket(new NpcSay(npc.getObjectId(), ((whisper) ? Say2.TELL : Say2.ALL), npc.getId(), stringId)); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00458_PerfectForm/Q00458_PerfectForm.java b/src/main/java/com/l2jserver/datapack/quests/Q00458_PerfectForm/Q00458_PerfectForm.java index 05da7e9448..2d6cdebd3a 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00458_PerfectForm/Q00458_PerfectForm.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00458_PerfectForm/Q00458_PerfectForm.java @@ -32,29 +32,24 @@ import com.l2jserver.gameserver.network.serverpackets.ExQuestNpcLogList; * Perfect Form (458) * @author jurchiks */ -public class Q00458_PerfectForm extends Quest -{ +public class Q00458_PerfectForm extends Quest { // NPCs private static final int KELLEYIA = 32768; // Monsters // Level 4 (full grown) feedable beasts - private static final int[] KOOKABURRAS = - { + private static final int[] KOOKABURRAS = { 18878, 18879 }; - private static final int[] COUGARS = - { + private static final int[] COUGARS = { 18885, 18886 }; - private static final int[] BUFFALOS = - { + private static final int[] BUFFALOS = { 18892, 18893 }; - private static final int[] GRENDELS = - { + private static final int[] GRENDELS = { 18899, 18900 }; @@ -73,8 +68,7 @@ public class Q00458_PerfectForm extends Quest }; // @formatter:on - public Q00458_PerfectForm() - { + public Q00458_PerfectForm() { super(458, Q00458_PerfectForm.class.getSimpleName(), "Perfect Form"); addStartNpc(KELLEYIA); addTalkId(KELLEYIA); @@ -85,12 +79,10 @@ public class Q00458_PerfectForm extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String noQuest = getNoQuestMsg(player); final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return noQuest; } @@ -98,99 +90,68 @@ public class Q00458_PerfectForm extends Quest int overHits = 0; boolean overHitHtml = false; - switch (event) - { + switch (event) { case "32768-10.htm": st.startQuest(); break; case "results1": - if (st.isCond(2)) - { + if (st.isCond(2)) { final int overhitsTotal = st.getInt("overhitsTotal"); - if (overhitsTotal >= 35) - { + if (overhitsTotal >= 35) { htmltext = "32768-14a.html"; - } - else if (overhitsTotal >= 10) - { + } else if (overhitsTotal >= 10) { htmltext = "32768-14b.html"; - } - else - { + } else { htmltext = "32768-14c.html"; } overHits = overhitsTotal; overHitHtml = true; - } - else - { + } else { htmltext = noQuest; } break; case "results2": - if (st.isCond(2)) - { + if (st.isCond(2)) { final int overhitsCritical = st.getInt("overhitsCritical"); - if (overhitsCritical >= 30) - { + if (overhitsCritical >= 30) { htmltext = "32768-15a.html"; - } - else if (overhitsCritical >= 5) - { + } else if (overhitsCritical >= 5) { htmltext = "32768-15b.html"; - } - else - { + } else { htmltext = "32768-15c.html"; } overHits = overhitsCritical; overHitHtml = true; - } - else - { + } else { htmltext = noQuest; } break; case "results3": - if (st.isCond(2)) - { + if (st.isCond(2)) { final int overhitsConsecutive = st.getInt("overhitsConsecutive"); - if (overhitsConsecutive >= 20) - { + if (overhitsConsecutive >= 20) { htmltext = "32768-16a.html"; - } - else if (overhitsConsecutive >= 7) - { + } else if (overhitsConsecutive >= 7) { htmltext = "32768-16b.html"; - } - else - { + } else { htmltext = "32768-16c.html"; } overHits = overhitsConsecutive; overHitHtml = true; - } - else - { + } else { htmltext = noQuest; } break; case "32768-17.html": - if (st.isCond(2)) - { + if (st.isCond(2)) { int overhitsConsecutive = st.getInt("overhitsConsecutive"); - if (overhitsConsecutive >= 20) - { + if (overhitsConsecutive >= 20) { int rnd = getRandom(ICARUS_WEAPON_RECIPES.length); st.rewardItems(ICARUS_WEAPON_RECIPES[rnd], 1); - } - else if (overhitsConsecutive >= 7) - { + } else if (overhitsConsecutive >= 7) { int rnd = getRandom(ICARUS_WEAPON_PIECES.length); st.rewardItems(ICARUS_WEAPON_PIECES[rnd], 5); - } - else - { + } else { int rnd = getRandom(ICARUS_WEAPON_PIECES.length); st.rewardItems(ICARUS_WEAPON_PIECES[rnd], 2); // not sure if this should use rewardItems @@ -198,16 +159,13 @@ public class Q00458_PerfectForm extends Quest st.giveItems(15483, 10); // Crystal Spice Crate } st.exitQuest(QuestType.DAILY, true); - } - else - { + } else { htmltext = noQuest; } break; } - if (overHitHtml) - { + if (overHitHtml) { htmltext = getHtm(player.getHtmlPrefix(), htmltext); htmltext = htmltext.replace("<?number?>", String.valueOf(overHits)); } @@ -215,32 +173,26 @@ public class Q00458_PerfectForm extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isCond(1)) - { + if ((st != null) && st.isCond(1)) { int npcId = npc.getId(); - if ((npcId == KOOKABURRAS[0]) || (npcId == COUGARS[0]) || (npcId == BUFFALOS[0]) || (npcId == GRENDELS[0])) - { + if ((npcId == KOOKABURRAS[0]) || (npcId == COUGARS[0]) || (npcId == BUFFALOS[0]) || (npcId == GRENDELS[0])) { npcId++; } String variable = String.valueOf(npcId); // i3 int currentValue = st.getInt(variable); - if (currentValue < 10) - { + if (currentValue < 10) { st.set(variable, String.valueOf(currentValue + 1)); // IncreaseNPCLogByID L2Attackable mob = (L2Attackable) npc; - if (mob.isOverhit()) - { + if (mob.isOverhit()) { st.set("overhitsTotal", String.valueOf(st.getInt("overhitsTotal") + 1)); // memoStateEx 1 int maxHp = mob.getMaxHp(); // L2Attackable#calculateOverhitExp() way of calculating overhit % seems illogical double overhitPercentage = (maxHp + mob.getOverhitDamage()) / maxHp; - if (overhitPercentage >= 1.2) - { + if (overhitPercentage >= 1.2) { st.set("overhitsCritical", String.valueOf(st.getInt("overhitsCritical") + 1)); // memoStateEx 2 } int overhitsConsecutive = st.getInt("overhitsConsecutive") + 1; @@ -248,24 +200,18 @@ public class Q00458_PerfectForm extends Quest /* * Retail logic (makes for a long/messy string in database): int i0 = overhitsConsecutive % 100; int i1 = overhitsConsecutive - (i0 * 100); if (i0 < i1) { st.set("overhitsConsecutive", String.valueOf((i1 * 100) + i1)); } */ - } - else - { + } else { // st.set("overhitsConsecutive", String.valueOf((st.getInt("overhitsConsecutive") % 100) * 100)); - if (st.getInt("overhitsConsecutive") > 0) - { + if (st.getInt("overhitsConsecutive") > 0) { // avoid writing to database if variable is already zero st.set("overhitsConsecutive", "0"); } } - if ((st.getInt("18879") == 10) && (st.getInt("18886") == 10) && (st.getInt("18893") == 10) && (st.getInt("18900") == 10)) - { + if ((st.getInt("18879") == 10) && (st.getInt("18886") == 10) && (st.getInt("18893") == 10) && (st.getInt("18900") == 10)) { st.setCond(2, true); // st.set("overhitsConsecutive", String.valueOf(st.getInt("overhitsConsecutive") % 100)); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -282,15 +228,12 @@ public class Q00458_PerfectForm extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.COMPLETED: - if (!st.isNowAvailable()) - { + if (!st.isNowAvailable()) { htmltext = "32768-18.htm"; break; } @@ -300,15 +243,11 @@ public class Q00458_PerfectForm extends Quest htmltext = (player.getLevel() > 81) ? "32768-01.htm" : "32768-00.htm"; break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: - if ((st.getInt("18879") == 0) && (st.getInt("18886") == 0) && (st.getInt("18893") == 0) && (st.getInt("18900") == 0)) - { + if ((st.getInt("18879") == 0) && (st.getInt("18886") == 0) && (st.getInt("18893") == 0) && (st.getInt("18900") == 0)) { htmltext = "32768-11.html"; - } - else - { + } else { htmltext = "32768-12.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00461_RumbleInTheBase/Q00461_RumbleInTheBase.java b/src/main/java/com/l2jserver/datapack/quests/Q00461_RumbleInTheBase/Q00461_RumbleInTheBase.java index afa68656d5..100fcd259a 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00461_RumbleInTheBase/Q00461_RumbleInTheBase.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00461_RumbleInTheBase/Q00461_RumbleInTheBase.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.model.quest.State; * Rumble in the Base (461) * @author malyelfik */ -public class Q00461_RumbleInTheBase extends Quest -{ +public class Q00461_RumbleInTheBase extends Quest { // NPC private static final int STAN = 30200; // Items @@ -44,8 +43,7 @@ public class Q00461_RumbleInTheBase extends Quest // Mobs private static final Map<Integer, Integer> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(22780, 581); MONSTERS.put(22781, 772); MONSTERS.put(22782, 581); @@ -55,8 +53,7 @@ public class Q00461_RumbleInTheBase extends Quest MONSTERS.put(18908, 782); } - public Q00461_RumbleInTheBase() - { + public Q00461_RumbleInTheBase() { super(461, Q00461_RumbleInTheBase.class.getSimpleName(), "Rumble in the Base"); addStartNpc(STAN); addTalkId(STAN); @@ -65,64 +62,49 @@ public class Q00461_RumbleInTheBase extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return htmltext; } - if (event.equalsIgnoreCase("30200-05.htm")) - { + if (event.equalsIgnoreCase("30200-05.htm")) { st.startQuest(); htmltext = event; - } - else if (event.equalsIgnoreCase("30200-04.htm")) - { + } else if (event.equalsIgnoreCase("30200-04.htm")) { htmltext = event; } return htmltext; } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { QuestState st = null; - if (getRandom(1000) >= MONSTERS.get(npc.getId())) - { + if (getRandom(1000) >= MONSTERS.get(npc.getId())) { return super.onKill(npc, player, isSummon); } - if (npc.getId() == 18908) - { + if (npc.getId() == 18908) { st = getQuestState(player, false); - if ((st != null) && st.isCond(1) && (st.getQuestItemsCount(SHINY_SALMON) < 5)) - { + if ((st != null) && st.isCond(1) && (st.getQuestItemsCount(SHINY_SALMON) < 5)) { st.giveItems(SHINY_SALMON, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - if ((st.getQuestItemsCount(SHINY_SALMON) >= 5) && (st.getQuestItemsCount(SHOES_STRING_OF_SEL_MAHUM) >= 10)) - { + if ((st.getQuestItemsCount(SHINY_SALMON) >= 5) && (st.getQuestItemsCount(SHOES_STRING_OF_SEL_MAHUM) >= 10)) { st.setCond(2, true); } } - } - else - { + } else { final L2PcInstance member = getRandomPartyMember(player, 1); - if (member == null) - { + if (member == null) { return super.onKill(npc, player, isSummon); } st = getQuestState(member, false); - if (st.getQuestItemsCount(SHOES_STRING_OF_SEL_MAHUM) < 10) - { + if (st.getQuestItemsCount(SHOES_STRING_OF_SEL_MAHUM) < 10) { st.giveItems(SHOES_STRING_OF_SEL_MAHUM, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - if ((st.getQuestItemsCount(SHINY_SALMON) >= 5) && (st.getQuestItemsCount(SHOES_STRING_OF_SEL_MAHUM) >= 10)) - { + if ((st.getQuestItemsCount(SHINY_SALMON) >= 5) && (st.getQuestItemsCount(SHOES_STRING_OF_SEL_MAHUM) >= 10)) { st.setCond(2, true); } } @@ -131,34 +113,26 @@ public class Q00461_RumbleInTheBase extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = ((player.getLevel() >= 82) && player.hasQuestCompleted(Q00252_ItSmellsDelicious.class.getSimpleName())) ? "30200-01.htm" : "30200-02.htm"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "30200-06.html"; - } - else - { + } else { st.addExpAndSp(224784, 342528); st.exitQuest(QuestType.DAILY, true); htmltext = "30200-07.html"; } break; case State.COMPLETED: - if (!st.isNowAvailable()) - { + if (!st.isNowAvailable()) { htmltext = "30200-03.htm"; - } - else - { + } else { st.setState(State.CREATED); htmltext = ((player.getLevel() >= 82) && player.hasQuestCompleted(Q00252_ItSmellsDelicious.class.getSimpleName())) ? "30200-01.htm" : "30200-02.htm"; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00463_IMustBeaGenius/Q00463_IMustBeaGenius.java b/src/main/java/com/l2jserver/datapack/quests/Q00463_IMustBeaGenius/Q00463_IMustBeaGenius.java index 4454ff5896..182e049464 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00463_IMustBeaGenius/Q00463_IMustBeaGenius.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00463_IMustBeaGenius/Q00463_IMustBeaGenius.java @@ -37,26 +37,21 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * @author Gnacik, malyelfik * @version 2010-08-19 Based on Freya PTS */ -public class Q00463_IMustBeaGenius extends Quest -{ - private static class DropInfo - { +public class Q00463_IMustBeaGenius extends Quest { + private static class DropInfo { private final int _count; private final int _chance; - public DropInfo(int count, int chance) - { + public DropInfo(int count, int chance) { _count = count; _chance = chance; } - public int getCount() - { + public int getCount() { return _count; } - public int getSpecialChance() - { + public int getSpecialChance() { return _chance; } } @@ -70,8 +65,7 @@ public class Q00463_IMustBeaGenius extends Quest // Mobs private static final Map<Integer, DropInfo> MOBS = new HashMap<>(); - static - { + static { MOBS.put(22801, new DropInfo(5, 0)); MOBS.put(22802, new DropInfo(5, 0)); MOBS.put(22803, new DropInfo(5, 0)); @@ -104,8 +98,7 @@ public class Q00463_IMustBeaGenius extends Quest // Misc @formatter:on private static final int MIN_LEVEL = 70; - public Q00463_IMustBeaGenius() - { + public Q00463_IMustBeaGenius() { super(463, Q00463_IMustBeaGenius.class.getSimpleName(), "I Must Be a Genius"); addStartNpc(GUTENHAGEN); addTalkId(GUTENHAGEN); @@ -114,17 +107,14 @@ public class Q00463_IMustBeaGenius extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "32069-03.htm": st.startQuest(); int number = getRandom(51) + 550; @@ -136,8 +126,7 @@ public class Q00463_IMustBeaGenius extends Quest htmltext = getHtm(player.getHtmlPrefix(), event).replace("%num%", st.get("number")); break; case "reward": - if (st.isCond(2)) - { + if (st.isCond(2)) { int rnd = getRandom(REWARD.length); String str = (REWARD[rnd][2] < 10) ? "0" + REWARD[rnd][2] : String.valueOf(REWARD[rnd][2]); @@ -156,45 +145,36 @@ public class Q00463_IMustBeaGenius extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return super.onKill(npc, player, isSummon); } - if (st.isCond(1)) - { + if (st.isCond(1)) { boolean msg = false; int number = MOBS.get(npc.getId()).getCount(); - if (MOBS.get(npc.getId()).getSpecialChance() == st.getInt("chance")) - { + if (MOBS.get(npc.getId()).getSpecialChance() == st.getInt("chance")) { number = getRandom(100) + 1; } - if (number > 0) - { + if (number > 0) { st.giveItems(CORPSE_LOG, number); msg = true; - } - else if ((number < 0) && ((st.getQuestItemsCount(CORPSE_LOG) + number) > 0)) - { + } else if ((number < 0) && ((st.getQuestItemsCount(CORPSE_LOG) + number) > 0)) { st.takeItems(CORPSE_LOG, Math.abs(number)); msg = true; } - if (msg) - { + if (msg) { final NpcSay ns = new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.ATT_ATTACK_S1_RO_ROGUE_S2); ns.addStringParameter(player.getName()); ns.addStringParameter(String.valueOf(number)); npc.broadcastPacket(ns); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - if (st.getQuestItemsCount(CORPSE_LOG) == st.getInt("number")) - { + if (st.getQuestItemsCount(CORPSE_LOG) == st.getInt("number")) { st.takeItems(CORPSE_LOG, -1); st.giveItems(COLLECTION, 1); st.setCond(2, true); @@ -205,15 +185,12 @@ public class Q00463_IMustBeaGenius extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.COMPLETED: - if (!st.isNowAvailable()) - { + if (!st.isNowAvailable()) { htmltext = "32069-07.htm"; break; } @@ -222,18 +199,12 @@ public class Q00463_IMustBeaGenius extends Quest htmltext = (player.getLevel() >= MIN_LEVEL) ? "32069-01.htm" : "32069-00.htm"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "32069-04.html"; - } - else - { - if (st.getInt("var") == 1) - { + } else { + if (st.getInt("var") == 1) { htmltext = "32069-06a.html"; - } - else - { + } else { st.takeItems(COLLECTION, -1); st.set("var", "1"); htmltext = "32069-06.html"; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00464_Oath/Q00464_Oath.java b/src/main/java/com/l2jserver/datapack/quests/Q00464_Oath/Q00464_Oath.java index 0ea8f61e0b..452b92d9bd 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00464_Oath/Q00464_Oath.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00464_Oath/Q00464_Oath.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.model.quest.State; * Oath (464) * @author malyelfik */ -public class Q00464_Oath extends Quest -{ +public class Q00464_Oath extends Quest { // NPCs @formatter:off private static final int[][] NPC = { @@ -61,8 +60,7 @@ public class Q00464_Oath extends Quest // Monsters private static final Map<Integer, Integer> MOBS = new HashMap<>(); - static - { + static { MOBS.put(22799, 9); MOBS.put(22794, 6); MOBS.put(22800, 10); @@ -77,11 +75,9 @@ public class Q00464_Oath extends Quest MOBS.put(22793, 5); } - public Q00464_Oath() - { + public Q00464_Oath() { super(464, Q00464_Oath.class.getSimpleName(), "Oath"); - for (int[] npc : NPC) - { + for (int[] npc : NPC) { addTalkId(npc[0]); } addKillId(MOBS.keySet()); @@ -90,20 +86,16 @@ public class Q00464_Oath extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "32596-04.html": - if (!st.hasQuestItems(BOOK)) - { + if (!st.hasQuestItems(BOOK)) { return getNoQuestMsg(player); } @@ -112,8 +104,7 @@ public class Q00464_Oath extends Quest st.setCond(cond, true); st.takeItems(BOOK, 1); st.giveItems(BOOK2, 1); - switch (cond) - { + switch (cond) { case 2: htmltext = "32596-04.html"; break; @@ -141,8 +132,7 @@ public class Q00464_Oath extends Quest } break; case "end_quest": - if (!st.hasQuestItems(BOOK2)) - { + if (!st.hasQuestItems(BOOK2)) { return getNoQuestMsg(player); } @@ -163,14 +153,12 @@ public class Q00464_Oath extends Quest } @Override - public String onItemTalk(L2ItemInstance item, L2PcInstance player) - { + public String onItemTalk(L2ItemInstance item, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); boolean startQuest = false; - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: startQuest = true; break; @@ -178,29 +166,22 @@ public class Q00464_Oath extends Quest htmltext = "strongbox-02.html"; break; case State.COMPLETED: - if (st.isNowAvailable()) - { + if (st.isNowAvailable()) { st.setState(State.CREATED); startQuest = true; - } - else - { + } else { htmltext = "strongbox-03.html"; } break; } - if (startQuest) - { - if (player.getLevel() >= MIN_LEVEL) - { + if (startQuest) { + if (player.getLevel() >= MIN_LEVEL) { st.startQuest(); st.takeItems(STRONGBOX, 1); st.giveItems(BOOK, 1); htmltext = "strongbox-01.htm"; - } - else - { + } else { htmltext = "strongbox-00.htm"; } } @@ -208,10 +189,8 @@ public class Q00464_Oath extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (getRandom(1000) < MOBS.get(npc.getId())) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (getRandom(1000) < MOBS.get(npc.getId())) { npc.dropItem(killer, STRONGBOX, 1); } @@ -219,17 +198,13 @@ public class Q00464_Oath extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - if (st.isStarted()) - { + if (st.isStarted()) { int npcId = npc.getId(); - if (npcId == NPC[0][0]) - { - switch (st.getCond()) - { + if (npcId == NPC[0][0]) { + switch (st.getCond()) { case 1: htmltext = "32596-01.html"; break; @@ -258,9 +233,7 @@ public class Q00464_Oath extends Quest htmltext = "32596-05g.html"; break; } - } - else if ((st.getCond() > 1) && (st.getInt("npc") == npcId)) - { + } else if ((st.getCond() > 1) && (st.getInt("npc") == npcId)) { htmltext = npcId + "-01.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00501_ProofOfClanAlliance/Q00501_ProofOfClanAlliance.java b/src/main/java/com/l2jserver/datapack/quests/Q00501_ProofOfClanAlliance/Q00501_ProofOfClanAlliance.java index 52d713240a..1f10639ab0 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00501_ProofOfClanAlliance/Q00501_ProofOfClanAlliance.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00501_ProofOfClanAlliance/Q00501_ProofOfClanAlliance.java @@ -42,8 +42,7 @@ import com.l2jserver.gameserver.util.Util; * Proof of Clan Alliance (501) * @author Zoey76 */ -public final class Q00501_ProofOfClanAlliance extends Quest -{ +public final class Q00501_ProofOfClanAlliance extends Quest { // NPCs private static final int SIR_KRISTOF_RODEMAI = 30756; private static final int STATUE_OF_OFFERING = 30757; @@ -97,8 +96,7 @@ public final class Q00501_ProofOfClanAlliance extends Quest private static final int CLAN_MEMBER_MIN_LEVEL = 40; private static final int ADENA_TO_RESTART_GAME = 10000; - public Q00501_ProofOfClanAlliance() - { + public Q00501_ProofOfClanAlliance() { super(501, Q00501_ProofOfClanAlliance.class.getSimpleName(), "Proof of Clan Alliance"); addStartNpc(SIR_KRISTOF_RODEMAI, STATUE_OF_OFFERING); addTalkId(SIR_KRISTOF_RODEMAI, STATUE_OF_OFFERING, ATHREA, KALIS); @@ -107,51 +105,40 @@ public final class Q00501_ProofOfClanAlliance extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "30756-06.html": case "30756-08.html": case "30757-05.html": case "30758-02.html": case "30758-04.html": case "30759-02.html": - case "30759-04.html": - { + case "30759-04.html": { htmltext = event; break; } - case "30756-07.html": - { - if (qs.isCreated() && player.isClanLeader() && (player.getClan().getLevel() == CLAN_MIN_LEVEL)) - { + case "30756-07.html": { + if (qs.isCreated() && player.isClanLeader() && (player.getClan().getLevel() == CLAN_MIN_LEVEL)) { qs.startQuest(); qs.setMemoState(1); htmltext = event; } break; } - case "30757-04.html": - { - if (getRandom(10) > 5) - { - if (qs.getInt("flag") != 2501) - { + case "30757-04.html": { + if (getRandom(10) > 5) { + if (qs.getInt("flag") != 2501) { giveItems(player, SYMBOL_OF_LOYALTY, 1); qs.set("flag", 2501); } htmltext = event; - } - else - { + } else { npc.setTarget(player); npc.doCast(DIE_YOU_FOOL); startQuestTimer("SYMBOL_OF_LOYALTY", 4000, npc, player); @@ -159,61 +146,46 @@ public final class Q00501_ProofOfClanAlliance extends Quest } break; } - case "30758-03.html": - { + case "30758-03.html": { final QuestState lqs = getLeaderQuestState(player, getName()); - if (lqs != null) - { - if (npc.getSummonedNpcCount() < 4) - { + if (lqs != null) { + if (npc.getSummonedNpcCount() < 4) { lqs.setMemoState(4); lqs.set("flag", 0); npc.setScriptValue(0); - for (Location loc : LOCS) - { + for (Location loc : LOCS) { final L2Npc box = addSpawn(npc, getRandom(BOX_OF_ATHREA_1, BOX_OF_ATHREA_5), loc, false, 300000); box.disableCoreAI(true); box.setIsNoRndWalk(true); } htmltext = event; - } - else - { + } else { htmltext = "30758-03a.html"; } } break; } - case "30758-07.html": - { - if (player.getAdena() >= ADENA_TO_RESTART_GAME) - { - if (npc.getSummonedNpcCount() < 4) - { + case "30758-07.html": { + if (player.getAdena() >= ADENA_TO_RESTART_GAME) { + if (npc.getSummonedNpcCount() < 4) { takeItems(player, Inventory.ADENA_ID, ADENA_TO_RESTART_GAME); } htmltext = event; - } - else - { + } else { htmltext = "30758-06.html"; } break; } - case "30759-03.html": - { - if (qs.isMemoState(1)) - { + case "30759-03.html": { + if (qs.isMemoState(1)) { qs.setCond(2, true); qs.setMemoState(2); htmltext = event; } break; } - case "30759-07.html": - { - if (qs.isMemoState(2) && (getQuestItemsCount(player, SYMBOL_OF_LOYALTY) >= 3)) - { + case "30759-07.html": { + if (qs.isMemoState(2) && (getQuestItemsCount(player, SYMBOL_OF_LOYALTY) >= 3)) { takeItems(player, SYMBOL_OF_LOYALTY, -1); giveItems(player, ANTIDOTE_RECIPE_LIST, 1); npc.setTarget(player); @@ -224,10 +196,8 @@ public final class Q00501_ProofOfClanAlliance extends Quest } break; } - case "SYMBOL_OF_LOYALTY": - { - if (player.isDead() && (qs.getInt("flag") != 2501)) - { + case "SYMBOL_OF_LOYALTY": { + if (player.isDead() && (qs.getInt("flag") != 2501)) { giveItems(player, SYMBOL_OF_LOYALTY, 1); qs.set("flag", 2501); } @@ -238,40 +208,30 @@ public final class Q00501_ProofOfClanAlliance extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc); - if (qs == null) - { + if (qs == null) { return super.onKill(npc, killer, isSummon); } final L2PcInstance player = qs.getPlayer(); final QuestState lqs = getLeaderQuestState(player, getName()); - if (lqs != null) - { - switch (npc.getId()) - { - case OEL_MAHUM_WITCH_DOCTOR: - { - if ((getRandom(10) == 1) && (lqs.getMemoState() >= 3) && (lqs.getMemoState() < 6)) - { + if (lqs != null) { + switch (npc.getId()) { + case OEL_MAHUM_WITCH_DOCTOR: { + if ((getRandom(10) == 1) && (lqs.getMemoState() >= 3) && (lqs.getMemoState() < 6)) { giveItemRandomly(player, npc, HERB_OF_OEL_MAHUM, 1, 0, 1.0, true); } break; } - case HARIT_LIZARDMAN_SHAMAN: - { - if ((getRandom(10) == 1) && (lqs.getMemoState() >= 3) && (lqs.getMemoState() < 6)) - { + case HARIT_LIZARDMAN_SHAMAN: { + if ((getRandom(10) == 1) && (lqs.getMemoState() >= 3) && (lqs.getMemoState() < 6)) { giveItemRandomly(player, npc, HERB_OF_HARIT, 1, 0, 1.0, true); } break; } - case VANOR_SILENOS_SHAMAN: - { - if ((getRandom(10) == 1) && (lqs.getMemoState() >= 3) && (lqs.getMemoState() < 6)) - { + case VANOR_SILENOS_SHAMAN: { + if ((getRandom(10) == 1) && (lqs.getMemoState() >= 3) && (lqs.getMemoState() < 6)) { giveItemRandomly(player, npc, HERB_OF_VANOR, 1, 0, 1.0, true); } break; @@ -280,36 +240,24 @@ public final class Q00501_ProofOfClanAlliance extends Quest case BOX_OF_ATHREA_2: case BOX_OF_ATHREA_3: case BOX_OF_ATHREA_4: - case BOX_OF_ATHREA_5: - { + case BOX_OF_ATHREA_5: { final L2Character summoner = npc.getSummoner(); - if ((summoner != null) && summoner.isNpc() && lqs.isMemoState(4)) - { + if ((summoner != null) && summoner.isNpc() && lqs.isMemoState(4)) { final L2Npc arthea = (L2Npc) summoner; - if ((lqs.getInt("flag") == 3) && arthea.isScriptValue(15)) - { + if ((lqs.getInt("flag") == 3) && arthea.isScriptValue(15)) { lqs.set("flag", lqs.getInt("flag") + 1); npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.BINGO)); - } - else if ((lqs.getInt("flag") == 2) && arthea.isScriptValue(14)) - { + } else if ((lqs.getInt("flag") == 2) && arthea.isScriptValue(14)) { lqs.set("flag", lqs.getInt("flag") + 1); npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.BINGO)); - } - else if ((lqs.getInt("flag") == 1) && arthea.isScriptValue(13)) - { + } else if ((lqs.getInt("flag") == 1) && arthea.isScriptValue(13)) { lqs.set("flag", lqs.getInt("flag") + 1); npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.BINGO)); - } - else if ((lqs.getInt("flag") == 0) && arthea.isScriptValue(12)) - { + } else if ((lqs.getInt("flag") == 0) && arthea.isScriptValue(12)) { lqs.set("flag", lqs.getInt("flag") + 1); npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.BINGO)); - } - else if (lqs.getInt("flag") < 4) - { - if (getRandom(4) == 0) - { + } else if (lqs.getInt("flag") < 4) { + if (getRandom(4) == 0) { lqs.set("flag", lqs.getInt("flag") + 1); npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.BINGO)); } @@ -324,61 +272,41 @@ public final class Q00501_ProofOfClanAlliance extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); final QuestState lqs = getLeaderQuestState(player, getName()); String htmltext = getNoQuestMsg(player); - switch (npc.getId()) - { - case SIR_KRISTOF_RODEMAI: - { - switch (qs.getState()) - { - case State.CREATED: - { - if (player.isClanLeader()) - { + switch (npc.getId()) { + case SIR_KRISTOF_RODEMAI: { + switch (qs.getState()) { + case State.CREATED: { + if (player.isClanLeader()) { final L2Clan clan = player.getClan(); - if (clan.getLevel() < CLAN_MIN_LEVEL) - { + if (clan.getLevel() < CLAN_MIN_LEVEL) { htmltext = "30756-01.html"; - } - else if (clan.getLevel() == CLAN_MIN_LEVEL) - { - if (hasQuestItems(player, ALLIANCE_MANIFESTO)) - { + } else if (clan.getLevel() == CLAN_MIN_LEVEL) { + if (hasQuestItems(player, ALLIANCE_MANIFESTO)) { htmltext = "30756-03.html"; - } - else - { + } else { htmltext = "30756-04.html"; } - } - else - { + } else { htmltext = "30756-02.html"; } - } - else - { + } else { htmltext = "30756-05.html"; } break; } - case State.STARTED: - { - if (qs.isMemoState(6) && hasQuestItems(player, VOUCHER_OF_FAITH)) - { + case State.STARTED: { + if (qs.isMemoState(6) && hasQuestItems(player, VOUCHER_OF_FAITH)) { takeItems(player, VOUCHER_OF_FAITH, -1); giveItems(player, ALLIANCE_MANIFESTO, 1); addExpAndSp(player, 0, 120000); qs.exitQuest(false); htmltext = "30756-09.html"; - } - else - { + } else { htmltext = "30756-10.html"; } break; @@ -386,63 +314,43 @@ public final class Q00501_ProofOfClanAlliance extends Quest } break; } - case STATUE_OF_OFFERING: - { - if ((lqs != null) && lqs.isMemoState(2)) - { - if (!player.isClanLeader()) - { - if (player.getLevel() >= CLAN_MEMBER_MIN_LEVEL) - { + case STATUE_OF_OFFERING: { + if ((lqs != null) && lqs.isMemoState(2)) { + if (!player.isClanLeader()) { + if (player.getLevel() >= CLAN_MEMBER_MIN_LEVEL) { htmltext = (qs.getInt("flag") != 2501) ? "30757-01.html" : "30757-01b.html"; - } - else - { + } else { htmltext = "30757-02.html"; } - } - else - { + } else { htmltext = "30757-01a.html"; } - } - else - { + } else { htmltext = "30757-06.html"; } break; } - case ATHREA: - { - if (lqs != null) - { - switch (lqs.getMemoState()) - { - case 3: - { - if (hasQuestItems(lqs.getPlayer(), ANTIDOTE_RECIPE_LIST) && !hasQuestItems(lqs.getPlayer(), BLOOD_OF_EVA)) - { + case ATHREA: { + if (lqs != null) { + switch (lqs.getMemoState()) { + case 3: { + if (hasQuestItems(lqs.getPlayer(), ANTIDOTE_RECIPE_LIST) && !hasQuestItems(lqs.getPlayer(), BLOOD_OF_EVA)) { lqs.set("flag", 0); htmltext = "30758-01.html"; } break; } - case 4: - { - if (lqs.getInt("flag") < 4) - { + case 4: { + if (lqs.getInt("flag") < 4) { htmltext = "30758-05.html"; - } - else - { + } else { giveItems(player, BLOOD_OF_EVA, 1); lqs.setMemoState(5); htmltext = "30758-08.html"; } break; } - case 5: - { + case 5: { htmltext = "30758-09.html"; break; } @@ -450,22 +358,14 @@ public final class Q00501_ProofOfClanAlliance extends Quest } break; } - case KALIS: - { - if (qs.isMemoState(1) && !hasQuestItems(player, SYMBOL_OF_LOYALTY)) - { + case KALIS: { + if (qs.isMemoState(1) && !hasQuestItems(player, SYMBOL_OF_LOYALTY)) { htmltext = "30759-01.html"; - } - else if (qs.isMemoState(2) && (getQuestItemsCount(player, SYMBOL_OF_LOYALTY) < 3)) - { + } else if (qs.isMemoState(2) && (getQuestItemsCount(player, SYMBOL_OF_LOYALTY) < 3)) { htmltext = "30759-05.html"; - } - else if ((getQuestItemsCount(player, SYMBOL_OF_LOYALTY) >= 3) && !hasAbnormal(player)) - { + } else if ((getQuestItemsCount(player, SYMBOL_OF_LOYALTY) >= 3) && !hasAbnormal(player)) { htmltext = "30759-06.html"; - } - else if (qs.isMemoState(5) && hasQuestItems(player, BLOOD_OF_EVA) && hasQuestItems(player, HERB_OF_VANOR) && hasQuestItems(player, HERB_OF_HARIT) && hasQuestItems(player, HERB_OF_OEL_MAHUM) && hasAbnormal(player)) - { + } else if (qs.isMemoState(5) && hasQuestItems(player, BLOOD_OF_EVA) && hasQuestItems(player, HERB_OF_VANOR) && hasQuestItems(player, HERB_OF_HARIT) && hasQuestItems(player, HERB_OF_OEL_MAHUM) && hasAbnormal(player)) { giveItems(player, VOUCHER_OF_FAITH, 1); giveItems(player, POTION_OF_RECOVERY, 1); takeItems(player, BLOOD_OF_EVA, -1); @@ -476,23 +376,15 @@ public final class Q00501_ProofOfClanAlliance extends Quest qs.setCond(4, true); qs.setMemoState(6); htmltext = "30759-08.html"; - } - else if ((qs.isMemoState(3) || qs.isMemoState(4) || qs.isMemoState(5)) && !hasAbnormal(player)) - { + } else if ((qs.isMemoState(3) || qs.isMemoState(4) || qs.isMemoState(5)) && !hasAbnormal(player)) { takeItems(player, ANTIDOTE_RECIPE_LIST, -1); qs.setMemoState(1); htmltext = "30759-09.html"; - } - else if ((qs.getMemoState() < 6) && (getQuestItemsCount(player, SYMBOL_OF_LOYALTY) >= 3) && !hasAtLeastOneQuestItem(player, BLOOD_OF_EVA, HERB_OF_VANOR, HERB_OF_HARIT, HERB_OF_OEL_MAHUM) && hasAbnormal(player)) - { + } else if ((qs.getMemoState() < 6) && (getQuestItemsCount(player, SYMBOL_OF_LOYALTY) >= 3) && !hasAtLeastOneQuestItem(player, BLOOD_OF_EVA, HERB_OF_VANOR, HERB_OF_HARIT, HERB_OF_OEL_MAHUM) && hasAbnormal(player)) { htmltext = "30759-10.html"; - } - else if (qs.isMemoState(6)) - { + } else if (qs.isMemoState(6)) { htmltext = "30759-11.html"; - } - else if ((lqs != null) && !player.isClanLeader()) - { + } else if ((lqs != null) && !player.isClanLeader()) { htmltext = "30759-12.html"; } break; @@ -506,8 +398,7 @@ public final class Q00501_ProofOfClanAlliance extends Quest * @param player the player to check * @return {@code true} if the player has {@link AbnormalType#FATAL_POISON} abnormal */ - private static boolean hasAbnormal(L2PcInstance player) - { + private static boolean hasAbnormal(L2PcInstance player) { return player.getEffectList().getBuffInfoByAbnormalType(AbnormalType.FATAL_POISON) != null; } @@ -517,13 +408,10 @@ public final class Q00501_ProofOfClanAlliance extends Quest * @param quest the quest name * @return the clan leader's quest state */ - private static QuestState getLeaderQuestState(L2PcInstance player, String quest) - { - if (player.getClan() != null) - { + private static QuestState getLeaderQuestState(L2PcInstance player, String quest) { + if (player.getClan() != null) { final L2PcInstance leader = player.getClan().getLeader().getPlayerInstance(); - if (leader != null) - { + if (leader != null) { return leader.getQuestState(quest); } } @@ -531,54 +419,43 @@ public final class Q00501_ProofOfClanAlliance extends Quest } @Override - public QuestState getRandomPartyMemberState(L2PcInstance player, int condition, int playerChance, L2Npc target) - { - if ((player == null) || (playerChance < 1)) - { + public QuestState getRandomPartyMemberState(L2PcInstance player, int condition, int playerChance, L2Npc target) { + if ((player == null) || (playerChance < 1)) { return null; } QuestState qs = getQuestState(player, false); - if (!player.isInParty()) - { - if (!Util.checkIfInRange(1500, player, target, true)) - { + if (!player.isInParty()) { + if (!Util.checkIfInRange(1500, player, target, true)) { return null; } return qs; } final List<QuestState> candidates = new ArrayList<>(); - if ((qs != null) && (playerChance > 0)) - { - for (int i = 0; i < playerChance; i++) - { + if ((qs != null) && (playerChance > 0)) { + for (int i = 0; i < playerChance; i++) { candidates.add(qs); } } - for (L2PcInstance member : player.getParty().getMembers()) - { - if (member == player) - { + for (L2PcInstance member : player.getParty().getMembers()) { + if (member == player) { continue; } qs = getQuestState(member, false); - if (qs != null) - { + if (qs != null) { candidates.add(qs); } } - if (candidates.isEmpty()) - { + if (candidates.isEmpty()) { return null; } qs = candidates.get(getRandom(candidates.size())); - if (!Util.checkIfInRange(1500, qs.getPlayer(), target, true)) - { + if (!Util.checkIfInRange(1500, qs.getPlayer(), target, true)) { return null; } return qs; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00503_PursuitOfClanAmbition/Q00503_PursuitOfClanAmbition.java b/src/main/java/com/l2jserver/datapack/quests/Q00503_PursuitOfClanAmbition/Q00503_PursuitOfClanAmbition.java index c117f363c2..607f5b7070 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00503_PursuitOfClanAmbition/Q00503_PursuitOfClanAmbition.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00503_PursuitOfClanAmbition/Q00503_PursuitOfClanAmbition.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.util.Util; * Pursuit Of Clan Ambition (503) * @author ivantotov, Zoey76 */ -public final class Q00503_PursuitOfClanAmbition extends Quest -{ +public final class Q00503_PursuitOfClanAmbition extends Quest { // NPCs private static final int HEAD_BLACKSMITH_KUSTO = 30512; private static final int MARTIEN = 30645; @@ -76,8 +75,7 @@ public final class Q00503_PursuitOfClanAmbition extends Quest private static final int IMPERIAL_GRAVEKEEPER = 27181; private static final int BLITZ_WYRM = 27178; - public Q00503_PursuitOfClanAmbition() - { + public Q00503_PursuitOfClanAmbition() { super(503, Q00503_PursuitOfClanAmbition.class.getSimpleName(), "Pursuit Of Clan Ambition"); addStartNpc(SIR_GUSTAV_ATHEBALDT); addTalkId(SIR_GUSTAV_ATHEBALDT, HEAD_BLACKSMITH_KUSTO, MARTIEN, WITCH_ATHREA, WITCH_KALIS, CORPSE_OF_FRITZ, CORPSE_OF_LUTZ, CORPSE_OF_KURTZ, BALTHAZAR, IMPERIAL_COFFER, WITCH_CLEO, SIR_ERIC_RODEMAI); @@ -87,27 +85,21 @@ public final class Q00503_PursuitOfClanAmbition extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (event.startsWith("DESPAWN")) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (event.startsWith("DESPAWN")) { npc.deleteMe(); return super.onAdvEvent(event, npc, player); } final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "30760-08.html": - { - if (qs.isCreated()) - { + switch (event) { + case "30760-08.html": { + if (qs.isCreated()) { giveItems(player, GUSTAVS_1ST_LETTER, 1); qs.startQuest(); qs.setMemoState(1000); @@ -115,26 +107,22 @@ public final class Q00503_PursuitOfClanAmbition extends Quest } break; } - case "30760-12.html": - { + case "30760-12.html": { giveItems(player, GUSTAVS_2ND_LETTER, 1); qs.setMemoState(4000); qs.setCond(4); htmltext = event; break; } - case "30760-16.html": - { + case "30760-16.html": { giveItems(player, GUSTAVS_3RD_LETTER, 1); qs.setMemoState(7000); qs.setCond(7); htmltext = event; break; } - case "30760-20.html": - { - if (hasQuestItems(player, SCEPTER_OF_JUDGMENT)) - { + case "30760-20.html": { + if (hasQuestItems(player, SCEPTER_OF_JUDGMENT)) { giveItems(player, SEAL_OF_ASPIRATION, 1); addExpAndSp(player, 0, 250000); qs.exitQuest(false, true); @@ -142,17 +130,14 @@ public final class Q00503_PursuitOfClanAmbition extends Quest } break; } - case "30760-22.html": - { + case "30760-22.html": { qs.setMemoState(10000); qs.setCond(12); htmltext = event; break; } - case "30760-23.html": - { - if (hasQuestItems(player, SCEPTER_OF_JUDGMENT)) - { + case "30760-23.html": { + if (hasQuestItems(player, SCEPTER_OF_JUDGMENT)) { giveItems(player, SEAL_OF_ASPIRATION, 1); addExpAndSp(player, 0, 250000); qs.exitQuest(false, true); @@ -160,37 +145,30 @@ public final class Q00503_PursuitOfClanAmbition extends Quest } break; } - case "30512-03.html": - { - if (hasQuestItems(player, BROOCH_OF_THE_MAGPIE)) - { + case "30512-03.html": { + if (hasQuestItems(player, BROOCH_OF_THE_MAGPIE)) { takeItems(player, BROOCH_OF_THE_MAGPIE, -1); giveItems(player, BLACK_ANVIL_COIN, 1); } htmltext = event; break; } - case "30645-03.html": - { + case "30645-03.html": { takeItems(player, GUSTAVS_1ST_LETTER, -1); qs.setMemoState(2000); qs.setCond(2, true); htmltext = event; break; } - case "30761-02.html": - { - if (qs.isMemoState(2000) || qs.isMemoState(2011) || qs.isMemoState(2010) || qs.isMemoState(2001)) - { + case "30761-02.html": { + if (qs.isMemoState(2000) || qs.isMemoState(2011) || qs.isMemoState(2010) || qs.isMemoState(2001)) { giveItems(player, BLITZ_WYRM_EGG, 3); qs.setMemoState(qs.getMemoState() + 100); addAttackDesire(addSpawn(BLITZ_WYRM, npc, true, 0, false), player); addAttackDesire(addSpawn(BLITZ_WYRM, npc, true, 0, false), player); startQuestTimer("DESPAWN", 10000, npc, player); htmltext = event; - } - else if (qs.isMemoState(2100) || qs.isMemoState(2111) || qs.isMemoState(2110) || qs.isMemoState(2101)) - { + } else if (qs.isMemoState(2100) || qs.isMemoState(2111) || qs.isMemoState(2110) || qs.isMemoState(2101)) { addAttackDesire(addSpawn(BLITZ_WYRM, npc, true, 0, false), player); addAttackDesire(addSpawn(BLITZ_WYRM, npc, true, 0, false), player); startQuestTimer("DESPAWN", 10000, npc, player); @@ -198,10 +176,8 @@ public final class Q00503_PursuitOfClanAmbition extends Quest } break; } - case "30762-02.html": - { - if (qs.isMemoState(2000) || qs.isMemoState(2101) || qs.isMemoState(2001) || qs.isMemoState(2100)) - { + case "30762-02.html": { + if (qs.isMemoState(2000) || qs.isMemoState(2101) || qs.isMemoState(2001) || qs.isMemoState(2100)) { giveItems(player, BLITZ_WYRM_EGG, 3); giveItems(player, MIST_DRAKES_EGG, 4); qs.setMemoState(qs.getMemoState() + 10); @@ -209,9 +185,7 @@ public final class Q00503_PursuitOfClanAmbition extends Quest addAttackDesire(addSpawn(BLITZ_WYRM, npc, true, 0, false), player); startQuestTimer("DESPAWN", 10000, npc, player); htmltext = event; - } - else if (qs.isMemoState(2100) || qs.isMemoState(2111) || qs.isMemoState(2011) || qs.isMemoState(2110)) - { + } else if (qs.isMemoState(2100) || qs.isMemoState(2111) || qs.isMemoState(2011) || qs.isMemoState(2110)) { addAttackDesire(addSpawn(BLITZ_WYRM, npc, true, 0, false), player); addAttackDesire(addSpawn(BLITZ_WYRM, npc, true, 0, false), player); startQuestTimer("DESPAWN", 10000, npc, player); @@ -219,10 +193,8 @@ public final class Q00503_PursuitOfClanAmbition extends Quest } break; } - case "30763-02.html": - { - if (qs.isMemoState(2000) || qs.isMemoState(2110) || qs.isMemoState(2010) || qs.isMemoState(2100)) - { + case "30763-02.html": { + if (qs.isMemoState(2000) || qs.isMemoState(2110) || qs.isMemoState(2010) || qs.isMemoState(2100)) { giveItems(player, BROOCH_OF_THE_MAGPIE, 1); giveItems(player, MIST_DRAKES_EGG, 6); qs.setMemoState(qs.getMemoState() + 1); @@ -231,16 +203,14 @@ public final class Q00503_PursuitOfClanAmbition extends Quest } break; } - case "30764-03.html": - { + case "30764-03.html": { takeItems(player, GUSTAVS_2ND_LETTER, -1); qs.setMemoState(5000); qs.setCond(5, true); htmltext = event; break; } - case "30764-06.html": - { + case "30764-06.html": { takeItems(player, GUSTAVS_2ND_LETTER, -1); takeItems(player, BLACK_ANVIL_COIN, -1); giveItems(player, RECIPE_SPITEFUL_SOUL_ENERGY, 1); @@ -249,16 +219,14 @@ public final class Q00503_PursuitOfClanAmbition extends Quest htmltext = event; break; } - case "30765-04.html": - { + case "30765-04.html": { takeItems(player, IMPERIAL_KEY, -1); giveItems(player, SCEPTER_OF_JUDGMENT, 1); qs.setMemoState(8700); htmltext = event; break; } - case "30766-04.html": - { + case "30766-04.html": { qs.setMemoState(8100); qs.setCond(9, true); npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.BLOOD_AND_HONOR)); @@ -266,10 +234,8 @@ public final class Q00503_PursuitOfClanAmbition extends Quest htmltext = event; break; } - case "30766-08.html": - { - if (hasQuestItems(player, SCEPTER_OF_JUDGMENT)) - { + case "30766-08.html": { + if (hasQuestItems(player, SCEPTER_OF_JUDGMENT)) { giveItems(player, SEAL_OF_ASPIRATION, 1); addExpAndSp(player, 0, 250000); qs.exitQuest(false, true); @@ -277,16 +243,14 @@ public final class Q00503_PursuitOfClanAmbition extends Quest } break; } - case "30868-04.html": - { + case "30868-04.html": { takeItems(player, GUSTAVS_3RD_LETTER, -1); qs.setMemoState(8000); qs.setCond(8, true); htmltext = event; break; } - case "30868-10.html": - { + case "30868-10.html": { qs.setMemoState(9000); qs.setCond(11, true); htmltext = event; @@ -302,13 +266,11 @@ public final class Q00503_PursuitOfClanAmbition extends Quest case "30765-05a.html": case "30766-03.html": case "30868-03.html": - case "30868-06a.html": - { + case "30868-06a.html": { htmltext = event; break; } - case "SPAWN_WITCH": - { + case "SPAWN_WITCH": { final L2Npc athrea = addSpawn(WITCH_ATHREA, 160688, 21296, -3714, 0, false, 0); athrea.setScriptValue(50301); final L2Npc kalis = addSpawn(WITCH_KALIS, 160690, 21176, -3712, 0, false, 0); @@ -320,39 +282,31 @@ public final class Q00503_PursuitOfClanAmbition extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); - if ((qs == null) || !qs.isStarted() || !Util.checkIfInRange(1500, npc, killer, true)) - { + if ((qs == null) || !qs.isStarted() || !Util.checkIfInRange(1500, npc, killer, true)) { return super.onKill(npc, killer, isSummon); } final L2Clan clan = killer.getClan(); - if (clan == null) - { + if (clan == null) { return super.onKill(npc, killer, isSummon); } final L2PcInstance leader = clan.getLeader().getPlayerInstance(); - if ((leader == null) || !Util.checkIfInRange(1500, npc, leader, true)) - { + if ((leader == null) || !Util.checkIfInRange(1500, npc, leader, true)) { return super.onKill(npc, killer, isSummon); } final QuestState leaderQS = getQuestState(leader, false); - if (leaderQS == null) - { + if (leaderQS == null) { return super.onKill(npc, killer, isSummon); } - switch (npc.getId()) - { + switch (npc.getId()) { case DRAKE: - case DRAKE2: - { - if ((leaderQS.getMemoState() >= 2000) || (leaderQS.getMemoState() < 3000)) - { + case DRAKE2: { + if ((leaderQS.getMemoState() >= 2000) || (leaderQS.getMemoState() < 3000)) { giveItemRandomly(leader, MIST_DRAKES_EGG, 1, 10, 0.1, true); giveItemRandomly(leader, DRAKES_EGG, 1, 10, 0.5, true); @@ -360,69 +314,51 @@ public final class Q00503_PursuitOfClanAmbition extends Quest break; } case THUNDER_WYRM: - case THUNDER_WYRM2: - { - if ((leaderQS.getMemoState() >= 2000) || (leaderQS.getMemoState() < 3000)) - { + case THUNDER_WYRM2: { + if ((leaderQS.getMemoState() >= 2000) || (leaderQS.getMemoState() < 3000)) { giveItemRandomly(leader, THUNDER_WYRM_EGG, 1, 10, 0.5, true); } break; } - case GRAVE_GUARD: - { - if ((leaderQS.getMemoState() < 8511) || (leaderQS.getMemoState() >= 8500)) - { + case GRAVE_GUARD: { + if ((leaderQS.getMemoState() < 8511) || (leaderQS.getMemoState() >= 8500)) { leaderQS.setMemoState(leaderQS.getMemoState() + 1); - if ((leaderQS.getMemoState() >= 8505) && (getRandom(100) < 50)) - { + if ((leaderQS.getMemoState() >= 8505) && (getRandom(100) < 50)) { leaderQS.setMemoState(8500); addSpawn(GRAVE_KEYMASTER, npc, true, 0, false); - } - else if (leaderQS.getMemoState() >= 8510) - { + } else if (leaderQS.getMemoState() >= 8510) { leaderQS.setMemoState(8500); addSpawn(GRAVE_KEYMASTER, npc, true, 0, false); } } break; } - case SPITEFUL_SOUL_LEADER: - { - if (leaderQS.getMemoState() == 5000) - { + case SPITEFUL_SOUL_LEADER: { + if (leaderQS.getMemoState() == 5000) { final int rand = getRandom(100); - if (rand < 10) - { + if (rand < 10) { giveItemRandomly(leader, SPITEFUL_SOUL_ENERGY, 1, 10, 1, false); - } - else if (rand < 60) - { + } else if (rand < 60) { giveItems(leader, SPITEFUL_SOUL_VENGEANCE, 1); } } break; } - case BLITZ_WYRM: - { - if ((leaderQS.getMemoState() >= 2000) || (leaderQS.getMemoState() < 3000)) - { + case BLITZ_WYRM: { + if ((leaderQS.getMemoState() >= 2000) || (leaderQS.getMemoState() < 3000)) { giveItemRandomly(leader, BLITZ_WYRM_EGG, 1, 10, 1, true); } break; } - case GRAVE_KEYMASTER: - { - if (leaderQS.getMemoState() >= 8500) - { + case GRAVE_KEYMASTER: { + if (leaderQS.getMemoState() >= 8500) { giveItemRandomly(leader, IMPERIAL_KEY, 1, 6, 1, true); } break; } - case IMPERIAL_GRAVEKEEPER: - { - if ((leaderQS.getMemoState() < 8511) || (leaderQS.getMemoState() >= 8500)) - { + case IMPERIAL_GRAVEKEEPER: { + if ((leaderQS.getMemoState() < 8511) || (leaderQS.getMemoState() >= 8500)) { addSpawn(IMPERIAL_COFFER, npc, true, 0, false); } break; @@ -432,166 +368,97 @@ public final class Q00503_PursuitOfClanAmbition extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); final QuestState lqs = getLeaderQuestState(player, getName()); String htmltext = getNoQuestMsg(player); - if (qs.isCreated() || qs.isCompleted()) - { - if (npc.getId() == SIR_GUSTAV_ATHEBALDT) - { - if (lqs != null) - { - if (player.isClanLeader()) - { + if (qs.isCreated() || qs.isCompleted()) { + if (npc.getId() == SIR_GUSTAV_ATHEBALDT) { + if (lqs != null) { + if (player.isClanLeader()) { L2Clan clan = player.getClan(); - if (clan != null) - { - if (clan.getLevel() < 4) - { + if (clan != null) { + if (clan.getLevel() < 4) { htmltext = "30760-01.html"; - } - else if (clan.getLevel() >= 5) - { + } else if (clan.getLevel() >= 5) { htmltext = "30760-02.html"; - } - else if ((clan.getLevel() == 4) && hasQuestItems(player, SEAL_OF_ASPIRATION)) - { + } else if ((clan.getLevel() == 4) && hasQuestItems(player, SEAL_OF_ASPIRATION)) { htmltext = "30760-03.html"; - } - else if ((clan.getLevel() == 4) && !hasQuestItems(player, SEAL_OF_ASPIRATION)) - { + } else if ((clan.getLevel() == 4) && !hasQuestItems(player, SEAL_OF_ASPIRATION)) { htmltext = "30760-04.html"; } } - } - else - { + } else { htmltext = "30760-04t.html"; } } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case SIR_GUSTAV_ATHEBALDT: - { - if (lqs != null) - { - if (qs.getMemoState() == 1000) - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case SIR_GUSTAV_ATHEBALDT: { + if (lqs != null) { + if (qs.getMemoState() == 1000) { htmltext = "30760-09.html"; - } - else if (qs.getMemoState() == 2000) - { + } else if (qs.getMemoState() == 2000) { htmltext = "30760-10.html"; - } - else if (qs.getMemoState() == 3000) - { - if (!player.isClanLeader()) - { + } else if (qs.getMemoState() == 3000) { + if (!player.isClanLeader()) { htmltext = "30760-11t.html"; - } - else - { + } else { htmltext = "30760-11.html"; } - } - else if (qs.getMemoState() == 4000) - { + } else if (qs.getMemoState() == 4000) { htmltext = "30760-13.html"; - } - else if (qs.getMemoState() == 5000) - { + } else if (qs.getMemoState() == 5000) { htmltext = "30760-14.html"; - } - else if (qs.getMemoState() == 6000) - { - if (!player.isClanLeader()) - { + } else if (qs.getMemoState() == 6000) { + if (!player.isClanLeader()) { htmltext = "30760-15t.html"; - } - else - { + } else { htmltext = "30760-15.html"; } - } - else if (qs.getMemoState() == 7000) - { + } else if (qs.getMemoState() == 7000) { htmltext = "30760-17.html"; - } - else if ((qs.getMemoState() >= 8000) && (qs.getMemoState() < 8700)) - { + } else if ((qs.getMemoState() >= 8000) && (qs.getMemoState() < 8700)) { htmltext = "30760-18.html"; - } - else if ((qs.getMemoState() >= 8700) && (qs.getMemoState() < 10000) && player.isClanLeader()) - { + } else if ((qs.getMemoState() >= 8700) && (qs.getMemoState() < 10000) && player.isClanLeader()) { htmltext = "30760-19.html"; - } - else if ((qs.getMemoState() == 9000) && !player.isClanLeader()) - { + } else if ((qs.getMemoState() == 9000) && !player.isClanLeader()) { htmltext = "30760-19t.html"; - } - else if (qs.getMemoState() == 10000) - { - if (!player.isClanLeader()) - { + } else if (qs.getMemoState() == 10000) { + if (!player.isClanLeader()) { htmltext = "30760-24t.html"; - } - else - { + } else { htmltext = "30760-24.html"; } } } break; } - case HEAD_BLACKSMITH_KUSTO: - { - if ((lqs != null) && !player.isClanLeader()) - { + case HEAD_BLACKSMITH_KUSTO: { + if ((lqs != null) && !player.isClanLeader()) { htmltext = "30512-01a.html"; - } - else if (!hasAtLeastOneQuestItem(player, BROOCH_OF_THE_MAGPIE, BLACK_ANVIL_COIN)) - { + } else if (!hasAtLeastOneQuestItem(player, BROOCH_OF_THE_MAGPIE, BLACK_ANVIL_COIN)) { htmltext = "30512-01.html"; - } - else if (hasQuestItems(player, BROOCH_OF_THE_MAGPIE)) - { + } else if (hasQuestItems(player, BROOCH_OF_THE_MAGPIE)) { htmltext = "30512-02.html"; - } - else if ((lqs != null) && hasQuestItems(player, BLACK_ANVIL_COIN) && !hasQuestItems(player, BROOCH_OF_THE_MAGPIE)) - { + } else if ((lqs != null) && hasQuestItems(player, BLACK_ANVIL_COIN) && !hasQuestItems(player, BROOCH_OF_THE_MAGPIE)) { htmltext = "30512-04.html"; } break; } - case MARTIEN: - { - if (lqs != null) - { - if ((qs.getMemoState() == 1000)) - { - if (!player.isClanLeader()) - { + case MARTIEN: { + if (lqs != null) { + if ((qs.getMemoState() == 1000)) { + if (!player.isClanLeader()) { htmltext = "30645-01.html"; - } - else - { + } else { htmltext = "30645-02.html"; } - } - else if ((qs.getMemoState() < 3000) && (qs.getMemoState() >= 2000)) - { - if ((getQuestItemsCount(player, MIST_DRAKES_EGG) < 10) || (getQuestItemsCount(player, BLITZ_WYRM_EGG) < 10) || (getQuestItemsCount(player, THUNDER_WYRM_EGG) < 10) || (getQuestItemsCount(player, DRAKES_EGG) < 10)) - { + } else if ((qs.getMemoState() < 3000) && (qs.getMemoState() >= 2000)) { + if ((getQuestItemsCount(player, MIST_DRAKES_EGG) < 10) || (getQuestItemsCount(player, BLITZ_WYRM_EGG) < 10) || (getQuestItemsCount(player, THUNDER_WYRM_EGG) < 10) || (getQuestItemsCount(player, DRAKES_EGG) < 10)) { htmltext = "30645-04.html"; - } - else - { + } else { takeItems(player, MIST_DRAKES_EGG, -1); takeItems(player, BLITZ_WYRM_EGG, -1); takeItems(player, DRAKES_EGG, -1); @@ -600,196 +467,126 @@ public final class Q00503_PursuitOfClanAmbition extends Quest qs.setCond(3, true); htmltext = "30645-05.html"; } - } - else if ((qs.getMemoState() == 3000)) - { + } else if ((qs.getMemoState() == 3000)) { htmltext = "30645-07.html"; - } - else if ((qs.getMemoState() > 3000)) - { + } else if ((qs.getMemoState() > 3000)) { htmltext = "30645-08.html"; } } break; } - case WITCH_ATHREA: - { - if (lqs != null) - { + case WITCH_ATHREA: { + if (lqs != null) { htmltext = "30758-01.html"; } break; } - case WITCH_KALIS: - { - if (lqs != null) - { + case WITCH_KALIS: { + if (lqs != null) { htmltext = "30759-01.html"; } break; } - case CORPSE_OF_FRITZ: - { - if ((qs.getMemoState() < 3000) && (qs.getMemoState() >= 2000)) - { + case CORPSE_OF_FRITZ: { + if ((qs.getMemoState() < 3000) && (qs.getMemoState() >= 2000)) { htmltext = "30761-01.html"; } break; } - case CORPSE_OF_LUTZ: - { - if ((qs.getMemoState() < 3000) && (qs.getMemoState() >= 2000)) - { + case CORPSE_OF_LUTZ: { + if ((qs.getMemoState() < 3000) && (qs.getMemoState() >= 2000)) { htmltext = "30762-01.html"; } break; } - case CORPSE_OF_KURTZ: - { - if (((qs.getMemoState() < 3000) && (qs.getMemoState() == 2000)) || (qs.getMemoState() == 2110) || (qs.getMemoState() == 2010) || (qs.getMemoState() == 2100)) - { + case CORPSE_OF_KURTZ: { + if (((qs.getMemoState() < 3000) && (qs.getMemoState() == 2000)) || (qs.getMemoState() == 2110) || (qs.getMemoState() == 2010) || (qs.getMemoState() == 2100)) { htmltext = "30763-01.html"; - } - else if ((qs.getMemoState() == 2001) || (qs.getMemoState() == 2111) || (qs.getMemoState() == 2011) || (qs.getMemoState() == 2101)) - { + } else if ((qs.getMemoState() == 2001) || (qs.getMemoState() == 2111) || (qs.getMemoState() == 2011) || (qs.getMemoState() == 2101)) { htmltext = "30763-03.html"; } break; } - case BALTHAZAR: - { - if (lqs != null) - { - if ((qs.getMemoState() == 4000)) - { - if (!player.isClanLeader()) - { + case BALTHAZAR: { + if (lqs != null) { + if ((qs.getMemoState() == 4000)) { + if (!player.isClanLeader()) { htmltext = "30764-01.html"; - } - else if (!hasQuestItems(player, BLACK_ANVIL_COIN) && player.isClanLeader()) - { + } else if (!hasQuestItems(player, BLACK_ANVIL_COIN) && player.isClanLeader()) { htmltext = "30764-02.html"; - } - else if (hasQuestItems(player, BLACK_ANVIL_COIN)) - { + } else if (hasQuestItems(player, BLACK_ANVIL_COIN)) { htmltext = "30764-04.html"; } - } - else if ((qs.getMemoState() == 5000)) - { - if (getQuestItemsCount(player, SPITEFUL_SOUL_ENERGY) < 10) - { + } else if ((qs.getMemoState() == 5000)) { + if (getQuestItemsCount(player, SPITEFUL_SOUL_ENERGY) < 10) { htmltext = "30764-07a.html"; - } - else - { + } else { takeItems(player, SPITEFUL_SOUL_ENERGY, -1); qs.setMemoState(6000); qs.setCond(6, true); htmltext = "30764-08a.html"; } - } - else if ((qs.getMemoState() >= 6000)) - { + } else if ((qs.getMemoState() >= 6000)) { htmltext = "30764-09.html"; } } break; } - case IMPERIAL_COFFER: - { - if (lqs != null) - { - if ((qs.getMemoState() >= 8500) && (qs.getMemoState() < 8700)) - { - if (getQuestItemsCount(player, IMPERIAL_KEY) >= 6) - { - if (!player.isClanLeader()) - { + case IMPERIAL_COFFER: { + if (lqs != null) { + if ((qs.getMemoState() >= 8500) && (qs.getMemoState() < 8700)) { + if (getQuestItemsCount(player, IMPERIAL_KEY) >= 6) { + if (!player.isClanLeader()) { htmltext = "30765-01.html"; - } - else - { + } else { htmltext = "30765-03.html"; } } - } - else if (qs.getMemoState() >= 8700) - { + } else if (qs.getMemoState() >= 8700) { htmltext = "30765-05.html"; } } break; } - case WITCH_CLEO: - { - if (lqs != null) - { - if (!player.isClanLeader()) - { + case WITCH_CLEO: { + if (lqs != null) { + if (!player.isClanLeader()) { htmltext = "30766-01.html"; - } - else if (qs.getMemoState() == 8000) - { + } else if (qs.getMemoState() == 8000) { htmltext = "30766-02.html"; - } - else if (qs.getMemoState() == 8100) - { + } else if (qs.getMemoState() == 8100) { htmltext = "30766-05.html"; - } - else if ((qs.getMemoState() > 8100) && (qs.getMemoState() < 10000)) - { + } else if ((qs.getMemoState() > 8100) && (qs.getMemoState() < 10000)) { htmltext = "30766-06.html"; - } - else if ((qs.getMemoState() == 10000) && player.isClanLeader()) - { + } else if ((qs.getMemoState() == 10000) && player.isClanLeader()) { htmltext = "30766-07.html"; } } break; } - case SIR_ERIC_RODEMAI: - { - if (lqs != null) - { - if (qs.getMemoState() == 7000) - { - if (!player.isClanLeader()) - { + case SIR_ERIC_RODEMAI: { + if (lqs != null) { + if (qs.getMemoState() == 7000) { + if (!player.isClanLeader()) { htmltext = "30868-01.html"; - } - else - { + } else { htmltext = "30868-02.html"; } - } - else if (qs.getMemoState() == 8000) - { + } else if (qs.getMemoState() == 8000) { htmltext = "30868-05.html"; - } - else if (qs.getMemoState() == 8100) - { - if (player.isClanLeader()) - { + } else if (qs.getMemoState() == 8100) { + if (player.isClanLeader()) { qs.setMemoState(8500); qs.setCond(10, true); htmltext = "30868-06.html"; - } - else - { + } else { htmltext = "30868-07.html"; } - } - else if ((qs.getMemoState() < 8511) && (qs.getMemoState() >= 8500)) - { + } else if ((qs.getMemoState() < 8511) && (qs.getMemoState() >= 8500)) { htmltext = "30868-08.html"; - } - else if (qs.getMemoState() == 8700) - { + } else if (qs.getMemoState() == 8700) { htmltext = "30868-09.html"; - } - else if (qs.getMemoState() >= 9000) - { + } else if (qs.getMemoState() >= 9000) { htmltext = "30868-11.html"; } break; @@ -801,36 +598,28 @@ public final class Q00503_PursuitOfClanAmbition extends Quest } @Override - public String onSpawn(L2Npc npc) - { - switch (npc.getId()) - { - case WITCH_ATHREA: - { - if (npc.isScriptValue(50301)) - { + public String onSpawn(L2Npc npc) { + switch (npc.getId()) { + case WITCH_ATHREA: { + if (npc.isScriptValue(50301)) { startQuestTimer("DESPAWN_WITCH_ATHREA", 5000, npc, null); npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.WAR_AND_DEATH)); } break; } - case WITCH_KALIS: - { - if (npc.isScriptValue(50302)) - { + case WITCH_KALIS: { + if (npc.isScriptValue(50302)) { startQuestTimer("DESPAWN_WITCH_KALIS", 5000, npc, null); npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.AMBITION_AND_POWER)); } break; } - case IMPERIAL_COFFER: - { + case IMPERIAL_COFFER: { startQuestTimer("DESPAWN_IMPERIAL_COFFER", 180000, npc, null); npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.CURSE_OF_THE_GODS_ON_THE_ONE_THAT_DEFILES_THE_PROPERTY_OF_THE_EMPIRE)); break; } - case BLITZ_WYRM: - { + case BLITZ_WYRM: { startQuestTimer("DESPAWN_BLITZ_WYRM", 180000, npc, null); break; } @@ -838,13 +627,10 @@ public final class Q00503_PursuitOfClanAmbition extends Quest return super.onSpawn(npc); } - private static QuestState getLeaderQuestState(L2PcInstance player, String quest) - { - if (player.getClan() != null) - { + private static QuestState getLeaderQuestState(L2PcInstance player, String quest) { + if (player.getClan() != null) { final L2PcInstance leader = player.getClan().getLeader().getPlayerInstance(); - if (leader != null) - { + if (leader != null) { return leader.getQuestState(quest); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00504_CompetitionForTheBanditStronghold/Q00504_CompetitionForTheBanditStronghold.java b/src/main/java/com/l2jserver/datapack/quests/Q00504_CompetitionForTheBanditStronghold/Q00504_CompetitionForTheBanditStronghold.java index 1ba63a603d..d4b1a5b893 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00504_CompetitionForTheBanditStronghold/Q00504_CompetitionForTheBanditStronghold.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00504_CompetitionForTheBanditStronghold/Q00504_CompetitionForTheBanditStronghold.java @@ -36,8 +36,7 @@ import com.l2jserver.gameserver.model.quest.State; * Competition for the Bandit Stronghold (504) * @author BiggBoss, Zoey76 */ -public final class Q00504_CompetitionForTheBanditStronghold extends Quest -{ +public final class Q00504_CompetitionForTheBanditStronghold extends Quest { // Misc private static final SiegableHall BANDIT_STRONGHOLD = ClanHallSiegeManager.getInstance().getSiegableHall(35); // NPC @@ -49,8 +48,7 @@ public final class Q00504_CompetitionForTheBanditStronghold extends Quest private static final int CONTEST_CERTIFICATE = 4333; private static final int TROPHY_OF_ALLIANCE = 5009; - static - { + static { MONSTERS.put(20570, 6); // Tarlk Bugbear MONSTERS.put(20571, 7); // Tarlk Bugbear Warrior MONSTERS.put(20572, 8); // Tarlk Bugbear High Warrior @@ -58,8 +56,7 @@ public final class Q00504_CompetitionForTheBanditStronghold extends Quest MONSTERS.put(20574, 7); // Elder Tarlk Basilisk } - public Q00504_CompetitionForTheBanditStronghold() - { + public Q00504_CompetitionForTheBanditStronghold() { super(504, Q00504_CompetitionForTheBanditStronghold.class.getSimpleName(), "Competition for the Bandit Stronghold"); addStartNpc(MESSENGER); addTalkId(MESSENGER); @@ -67,12 +64,10 @@ public final class Q00504_CompetitionForTheBanditStronghold extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if ((st != null) && event.equals("35437-02.htm")) - { + if ((st != null) && event.equals("35437-02.htm")) { st.startQuest(); st.giveItems(CONTEST_CERTIFICATE, 1); htmltext = "35437-02.htm"; @@ -81,23 +76,17 @@ public final class Q00504_CompetitionForTheBanditStronghold extends Quest } @Override - public final String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public final String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st == null) || !st.hasQuestItems(CONTEST_CERTIFICATE) || !st.isStarted()) - { + if ((st == null) || !st.hasQuestItems(CONTEST_CERTIFICATE) || !st.isStarted()) { return null; } - if (getRandom(10) < MONSTERS.get(npc.getId())) - { + if (getRandom(10) < MONSTERS.get(npc.getId())) { st.giveItems(TARLK_AMULET, 1); - if (st.getQuestItemsCount(TARLK_AMULET) < 30) - { + if (st.getQuestItemsCount(TARLK_AMULET) < 30) { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); } } @@ -105,55 +94,36 @@ public final class Q00504_CompetitionForTheBanditStronghold extends Quest } @Override - public final String onTalk(L2Npc npc, L2PcInstance player) - { + public final String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); final L2Clan clan = player.getClan(); String htmltext = getNoQuestMsg(player); - if (!BANDIT_STRONGHOLD.isWaitingBattle()) - { + if (!BANDIT_STRONGHOLD.isWaitingBattle()) { htmltext = getHtm(player.getHtmlPrefix(), "35437-09.html"); final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); htmltext = htmltext.replaceAll("%nextSiege%", sdf.format(BANDIT_STRONGHOLD.getSiegeDate().getTime())); - } - else if ((clan == null) || (clan.getLevel() < 4)) - { + } else if ((clan == null) || (clan.getLevel() < 4)) { htmltext = "35437-04.html"; - } - else if (!player.isClanLeader()) - { + } else if (!player.isClanLeader()) { htmltext = "35437-05.html"; - } - else if ((clan.getHideoutId() > 0) || (clan.getFortId() > 0) || (clan.getCastleId() > 0)) - { + } else if ((clan.getHideoutId() > 0) || (clan.getFortId() > 0) || (clan.getCastleId() > 0)) { htmltext = "35437-10.html"; - } - else - { - switch (st.getState()) - { - case State.CREATED: - { - if (!BANDIT_STRONGHOLD.isWaitingBattle()) - { + } else { + switch (st.getState()) { + case State.CREATED: { + if (!BANDIT_STRONGHOLD.isWaitingBattle()) { htmltext = getHtm(player.getHtmlPrefix(), "35437-03.html"); final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); htmltext = htmltext.replaceAll("%nextSiege%", sdf.format(BANDIT_STRONGHOLD.getSiegeDate().getTime())); - } - else - { + } else { htmltext = "35437-01.htm"; } break; } - case State.STARTED: - { - if (st.getQuestItemsCount(TARLK_AMULET) < 30) - { + case State.STARTED: { + if (st.getQuestItemsCount(TARLK_AMULET) < 30) { htmltext = "35437-07.html"; - } - else - { + } else { st.takeItems(TARLK_AMULET, 30); st.rewardItems(TROPHY_OF_ALLIANCE, 1); st.exitQuest(true); @@ -161,8 +131,7 @@ public final class Q00504_CompetitionForTheBanditStronghold extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = "35437-07a.html"; break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00508_AClansReputation/Q00508_AClansReputation.java b/src/main/java/com/l2jserver/datapack/quests/Q00508_AClansReputation/Q00508_AClansReputation.java index 6771da8994..26cd8228af 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00508_AClansReputation/Q00508_AClansReputation.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00508_AClansReputation/Q00508_AClansReputation.java @@ -40,15 +40,13 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Original Jython script by chris_00, @katmai and DrLecter. * @author Adry_85 */ -public class Q00508_AClansReputation extends Quest -{ +public class Q00508_AClansReputation extends Quest { // NPC private static final int SIR_ERIC_RODEMAI = 30868; private static final Map<Integer, List<Integer>> REWARD_POINTS = new HashMap<>(); - static - { + static { REWARD_POINTS.put(1, Arrays.asList(25252, 8277, 560)); // Palibati Queen Themis REWARD_POINTS.put(2, Arrays.asList(25478, 14883, 584)); // Shilen's Priest Hisilrome REWARD_POINTS.put(3, Arrays.asList(25255, 8280, 602)); // Gargoyle Lord Tiphon @@ -57,8 +55,7 @@ public class Q00508_AClansReputation extends Quest REWARD_POINTS.put(6, Arrays.asList(25524, 8494, 768)); // Flamestone Giant } - private static final int[] RAID_BOSS = - { + private static final int[] RAID_BOSS = { 25252, 25478, 25255, @@ -67,8 +64,7 @@ public class Q00508_AClansReputation extends Quest 25524 }; - public Q00508_AClansReputation() - { + public Q00508_AClansReputation() { super(508, Q00508_AClansReputation.class.getSimpleName(), "A Clan's Reputation"); addStartNpc(SIR_ERIC_RODEMAI); addTalkId(SIR_ERIC_RODEMAI); @@ -76,16 +72,13 @@ public class Q00508_AClansReputation extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - switch (event) - { + switch (event) { case "30868-0.html": st.startQuest(); break; @@ -121,34 +114,25 @@ public class Q00508_AClansReputation extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { - if (player.getClan() == null) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { + if (player.getClan() == null) { return null; } QuestState st = null; - if (player.isClanLeader()) - { + if (player.isClanLeader()) { st = player.getQuestState(getName()); - } - else - { + } else { L2PcInstance pleader = player.getClan().getLeader().getPlayerInstance(); - if ((pleader != null) && player.isInsideRadius(pleader, 1500, true, false)) - { + if ((pleader != null) && player.isInsideRadius(pleader, 1500, true, false)) { st = pleader.getQuestState(getName()); } } - if ((st != null) && st.isStarted()) - { + if ((st != null) && st.isStarted()) { int raid = st.getInt("raid"); - if (REWARD_POINTS.containsKey(raid)) - { - if ((npc.getId() == REWARD_POINTS.get(raid).get(0)) && !st.hasQuestItems(REWARD_POINTS.get(raid).get(1))) - { + if (REWARD_POINTS.containsKey(raid)) { + if ((npc.getId() == REWARD_POINTS.get(raid).get(0)) && !st.hasQuestItems(REWARD_POINTS.get(raid).get(1))) { st.rewardItems(REWARD_POINTS.get(raid).get(1), 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -158,29 +142,24 @@ public class Q00508_AClansReputation extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); L2Clan clan = player.getClan(); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = ((clan == null) || !player.isClanLeader() || (clan.getLevel() < 5)) ? "30868-0a.htm" : "30868-0b.htm"; break; case State.STARTED: - if ((clan == null) || !player.isClanLeader()) - { + if ((clan == null) || !player.isClanLeader()) { st.exitQuest(true); return "30868-8.html"; } int raid = st.getInt("raid"); - if (REWARD_POINTS.containsKey(raid)) - { - if (st.hasQuestItems(REWARD_POINTS.get(raid).get(1))) - { + if (REWARD_POINTS.containsKey(raid)) { + if (st.hasQuestItems(REWARD_POINTS.get(raid).get(1))) { htmltext = "30868-" + raid + "b.html"; st.playSound(Sound.ITEMSOUND_QUEST_FANFARE_1); st.takeItems(REWARD_POINTS.get(raid).get(1), -1); @@ -188,14 +167,10 @@ public class Q00508_AClansReputation extends Quest clan.addReputationScore(rep, true); player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CLAN_QUEST_COMPLETED_AND_S1_POINTS_GAINED).addInt(rep)); clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan)); - } - else - { + } else { htmltext = "30868-" + raid + "a.html"; } - } - else - { + } else { htmltext = "30868-0.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00509_AClansFame/Q00509_AClansFame.java b/src/main/java/com/l2jserver/datapack/quests/Q00509_AClansFame/Q00509_AClansFame.java index 44d8185747..60378443b0 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00509_AClansFame/Q00509_AClansFame.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00509_AClansFame/Q00509_AClansFame.java @@ -39,31 +39,27 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * A Clan's Fame (509) * @author Adry_85 */ -public class Q00509_AClansFame extends Quest -{ +public class Q00509_AClansFame extends Quest { // NPC private static final int VALDIS = 31331; private static final Map<Integer, List<Integer>> REWARD_POINTS = new HashMap<>(); - static - { + static { REWARD_POINTS.put(1, Arrays.asList(25290, 8489, 1378)); // Daimon The White-Eyed REWARD_POINTS.put(2, Arrays.asList(25293, 8490, 1378)); // Hestia, Guardian Deity Of The Hot Springs REWARD_POINTS.put(3, Arrays.asList(25523, 8491, 1070)); // Plague Golem REWARD_POINTS.put(4, Arrays.asList(25322, 8492, 782)); // Demon's Agent Falston } - private static final int[] RAID_BOSS = - { + private static final int[] RAID_BOSS = { 25290, 25293, 25523, 25322 }; - public Q00509_AClansFame() - { + public Q00509_AClansFame() { super(509, Q00509_AClansFame.class.getSimpleName(), "A Clan's Fame"); addStartNpc(VALDIS); addTalkId(VALDIS); @@ -71,16 +67,13 @@ public class Q00509_AClansFame extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - switch (event) - { + switch (event) { case "31331-0.html": st.startQuest(); break; @@ -108,34 +101,25 @@ public class Q00509_AClansFame extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { - if (player.getClan() == null) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { + if (player.getClan() == null) { return null; } QuestState st = null; - if (player.isClanLeader()) - { + if (player.isClanLeader()) { st = player.getQuestState(getName()); - } - else - { + } else { L2PcInstance pleader = player.getClan().getLeader().getPlayerInstance(); - if ((pleader != null) && player.isInsideRadius(pleader, 1500, true, false)) - { + if ((pleader != null) && player.isInsideRadius(pleader, 1500, true, false)) { st = pleader.getQuestState(getName()); } } - if ((st != null) && st.isStarted()) - { + if ((st != null) && st.isStarted()) { int raid = st.getInt("raid"); - if (REWARD_POINTS.containsKey(raid)) - { - if ((npc.getId() == REWARD_POINTS.get(raid).get(0)) && !st.hasQuestItems(REWARD_POINTS.get(raid).get(1))) - { + if (REWARD_POINTS.containsKey(raid)) { + if ((npc.getId() == REWARD_POINTS.get(raid).get(0)) && !st.hasQuestItems(REWARD_POINTS.get(raid).get(1))) { st.rewardItems(REWARD_POINTS.get(raid).get(1), 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -145,29 +129,24 @@ public class Q00509_AClansFame extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); L2Clan clan = player.getClan(); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = ((clan == null) || !player.isClanLeader() || (clan.getLevel() < 6)) ? "31331-0a.htm" : "31331-0b.htm"; break; case State.STARTED: - if ((clan == null) || !player.isClanLeader()) - { + if ((clan == null) || !player.isClanLeader()) { st.exitQuest(true); return "31331-6.html"; } int raid = st.getInt("raid"); - if (REWARD_POINTS.containsKey(raid)) - { - if (st.hasQuestItems(REWARD_POINTS.get(raid).get(1))) - { + if (REWARD_POINTS.containsKey(raid)) { + if (st.hasQuestItems(REWARD_POINTS.get(raid).get(1))) { htmltext = "31331-" + raid + "b.html"; st.playSound(Sound.ITEMSOUND_QUEST_FANFARE_1); st.takeItems(REWARD_POINTS.get(raid).get(1), -1); @@ -175,14 +154,10 @@ public class Q00509_AClansFame extends Quest clan.addReputationScore(rep, true); player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CLAN_QUEST_COMPLETED_AND_S1_POINTS_GAINED).addInt(rep)); clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan)); - } - else - { + } else { htmltext = "31331-" + raid + "a.html"; } - } - else - { + } else { htmltext = "31331-0.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00510_AClansPrestige/Q00510_AClansPrestige.java b/src/main/java/com/l2jserver/datapack/quests/Q00510_AClansPrestige/Q00510_AClansPrestige.java index b96141e9b3..7d396a06e9 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00510_AClansPrestige/Q00510_AClansPrestige.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00510_AClansPrestige/Q00510_AClansPrestige.java @@ -33,22 +33,19 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * A Clan's Prestige (510) * @author Adry_85 */ -public class Q00510_AClansPrestige extends Quest -{ +public class Q00510_AClansPrestige extends Quest { // NPC private static final int VALDIS = 31331; // Quest Item private static final int TYRANNOSAURUS_CLAW = 8767; - private static final int[] MOBS = - { + private static final int[] MOBS = { 22215, 22216, 22217 }; - public Q00510_AClansPrestige() - { + public Q00510_AClansPrestige() { super(510, Q00510_AClansPrestige.class.getSimpleName(), "A Clan's Prestige"); addStartNpc(VALDIS); addTalkId(VALDIS); @@ -56,16 +53,13 @@ public class Q00510_AClansPrestige extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - switch (event) - { + switch (event) { case "31331-3.html": st.startQuest(); break; @@ -77,29 +71,22 @@ public class Q00510_AClansPrestige extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { - if (player.getClan() == null) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { + if (player.getClan() == null) { return null; } QuestState st = null; - if (player.isClanLeader()) - { + if (player.isClanLeader()) { st = getQuestState(player, false); - } - else - { + } else { L2PcInstance pleader = player.getClan().getLeader().getPlayerInstance(); - if ((pleader != null) && player.isInsideRadius(pleader, 1500, true, false)) - { + if ((pleader != null) && player.isInsideRadius(pleader, 1500, true, false)) { st = getQuestState(pleader, false); } } - if ((st != null) && st.isStarted()) - { + if ((st != null) && st.isStarted()) { st.rewardItems(TYRANNOSAURUS_CLAW, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -107,29 +94,23 @@ public class Q00510_AClansPrestige extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); L2Clan clan = player.getClan(); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = ((clan == null) || !player.isClanLeader() || (clan.getLevel() < 5)) ? "31331-0.htm" : "31331-1.htm"; break; case State.STARTED: - if ((clan == null) || !player.isClanLeader()) - { + if ((clan == null) || !player.isClanLeader()) { st.exitQuest(true); return "31331-8.html"; } - if (!st.hasQuestItems(TYRANNOSAURUS_CLAW)) - { + if (!st.hasQuestItems(TYRANNOSAURUS_CLAW)) { htmltext = "31331-4.html"; - } - else - { + } else { int count = (int) st.getQuestItemsCount(TYRANNOSAURUS_CLAW); int reward = (count < 10) ? (30 * count) : (59 + (30 * count)); st.playSound(Sound.ITEMSOUND_QUEST_FANFARE_1); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00511_AwlUnderFoot/Q00511_AwlUnderFoot.java b/src/main/java/com/l2jserver/datapack/quests/Q00511_AwlUnderFoot/Q00511_AwlUnderFoot.java index 65a18dacc0..e50dd809c0 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00511_AwlUnderFoot/Q00511_AwlUnderFoot.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00511_AwlUnderFoot/Q00511_AwlUnderFoot.java @@ -44,74 +44,55 @@ import com.l2jserver.gameserver.util.Util; * Awl Under Foot (511) * @author Gigiikun */ -public final class Q00511_AwlUnderFoot extends Quest -{ - protected class FAUWorld extends InstanceWorld - { +public final class Q00511_AwlUnderFoot extends Quest { + protected class FAUWorld extends InstanceWorld { } - public static class FortDungeon - { + public static class FortDungeon { private final int INSTANCEID; private long _reEnterTime = 0; - public FortDungeon(int iId) - { + public FortDungeon(int iId) { INSTANCEID = iId; } - public int getInstanceId() - { + public int getInstanceId() { return INSTANCEID; } - public long getReEnterTime() - { + public long getReEnterTime() { return _reEnterTime; } - public void setReEnterTime(long time) - { + public void setReEnterTime(long time) { _reEnterTime = time; } } - private class spawnRaid implements Runnable - { + private class spawnRaid implements Runnable { private final FAUWorld _world; - public spawnRaid(FAUWorld world) - { + public spawnRaid(FAUWorld world) { _world = world; } @Override - public void run() - { - try - { + public void run() { + try { int spawnId; - if (_world.getStatus() == 0) - { + if (_world.getStatus() == 0) { spawnId = RAIDS1[getRandom(RAIDS1.length)]; - } - else if (_world.getStatus() == 1) - { + } else if (_world.getStatus() == 1) { spawnId = RAIDS2[getRandom(RAIDS2.length)]; - } - else - { + } else { spawnId = RAIDS3[getRandom(RAIDS3.length)]; } L2Npc raid = addSpawn(spawnId, 53319, 245814, -6576, 0, false, 0, false, _world.getInstanceId()); - if (raid instanceof L2RaidBossInstance) - { + if (raid instanceof L2RaidBossInstance) { ((L2RaidBossInstance) raid).setUseRaidCurse(false); } - } - catch (Exception e) - { + } catch (Exception e) { _log.warning("Fortress AwlUnderFoot Raid Spawn error: " + e); } } @@ -128,21 +109,18 @@ public final class Q00511_AwlUnderFoot extends Quest // REWARDS private static final int KNIGHT_EPALUETTE = 9912; // MONSTER TO KILL -- Only last 3 Raids (lvl ordered) give DL_MARK - protected static final int[] RAIDS1 = - { + protected static final int[] RAIDS1 = { 25572, 25575, 25578 }; - protected static final int[] RAIDS2 = - { + protected static final int[] RAIDS2 = { 25579, 25582, 25585, 25588 }; - protected static final int[] RAIDS3 = - { + protected static final int[] RAIDS3 = { 25589, 25592, 25593 @@ -151,8 +129,7 @@ public final class Q00511_AwlUnderFoot extends Quest // Skill private static final SkillHolder RAID_CURSE = new SkillHolder(5456); - public Q00511_AwlUnderFoot() - { + public Q00511_AwlUnderFoot() { super(511, Q00511_AwlUnderFoot.class.getSimpleName(), "instances"); _fortDungeons.put(35666, new FortDungeon(22)); _fortDungeons.put(35698, new FortDungeon(23)); @@ -176,8 +153,7 @@ public final class Q00511_AwlUnderFoot extends Quest _fortDungeons.put(36326, new FortDungeon(41)); _fortDungeons.put(36364, new FortDungeon(42)); - for (int i : _fortDungeons.keySet()) - { + for (int i : _fortDungeons.keySet()) { addStartNpc(i); addTalkId(i); } @@ -186,91 +162,68 @@ public final class Q00511_AwlUnderFoot extends Quest addKillId(RAIDS2); addKillId(RAIDS3); - for (int i = 25572; i <= 25595; i++) - { + for (int i = 25572; i <= 25595; i++) { addAttackId(i); } } - private String checkConditions(L2PcInstance player) - { - if (debug) - { + private String checkConditions(L2PcInstance player) { + if (debug) { return null; } L2Party party = player.getParty(); - if (party == null) - { + if (party == null) { return "FortressWarden-03.htm"; } - if (party.getLeader() != player) - { + if (party.getLeader() != player) { return getHtm(player.getHtmlPrefix(), "FortressWarden-04.htm").replace("%leader%", party.getLeader().getName()); } - for (L2PcInstance partyMember : party.getMembers()) - { + for (L2PcInstance partyMember : party.getMembers()) { final QuestState st = getQuestState(partyMember, false); - if ((st == null) || (st.getInt("cond") < 1)) - { + if ((st == null) || (st.getInt("cond") < 1)) { return getHtm(player.getHtmlPrefix(), "FortressWarden-05.htm").replace("%player%", partyMember.getName()); } - if (!Util.checkIfInRange(1000, player, partyMember, true)) - { + if (!Util.checkIfInRange(1000, player, partyMember, true)) { return getHtm(player.getHtmlPrefix(), "FortressWarden-06.htm").replace("%player%", partyMember.getName()); } } return null; } - private String checkFortCondition(L2PcInstance player, L2Npc npc, boolean isEnter) - { + private String checkFortCondition(L2PcInstance player, L2Npc npc, boolean isEnter) { Fort fortress = npc.getFort(); FortDungeon dungeon = _fortDungeons.get(npc.getId()); - if ((player == null) || (fortress == null) || (dungeon == null)) - { + if ((player == null) || (fortress == null) || (dungeon == null)) { return "FortressWarden-01.htm"; } - if ((player.getClan() == null) || (player.getClan().getFortId() != fortress.getResidenceId())) - { + if ((player.getClan() == null) || (player.getClan().getFortId() != fortress.getResidenceId())) { return "FortressWarden-01.htm"; - } - else if (fortress.getFortState() == 0) - { + } else if (fortress.getFortState() == 0) { return "FortressWarden-02a.htm"; - } - else if (fortress.getFortState() == 2) - { + } else if (fortress.getFortState() == 2) { return "FortressWarden-02b.htm"; - } - else if (isEnter && (dungeon.getReEnterTime() > System.currentTimeMillis())) - { + } else if (isEnter && (dungeon.getReEnterTime() > System.currentTimeMillis())) { return "FortressWarden-07.htm"; } L2Party party = player.getParty(); - if (party == null) - { + if (party == null) { return "FortressWarden-03.htm"; } - for (L2PcInstance partyMember : party.getMembers()) - { - if ((partyMember.getClan() == null) || (partyMember.getClan().getFortId() == 0) || (partyMember.getClan().getFortId() != fortress.getResidenceId())) - { + for (L2PcInstance partyMember : party.getMembers()) { + if ((partyMember.getClan() == null) || (partyMember.getClan().getFortId() == 0) || (partyMember.getClan().getFortId() != fortress.getResidenceId())) { return getHtm(player.getHtmlPrefix(), "FortressWarden-05.htm").replace("%player%", partyMember.getName()); } } return null; } - protected String enterInstance(L2PcInstance player, String template, int[] coords, FortDungeon dungeon, String ret) - { + protected String enterInstance(L2PcInstance player, String template, int[] coords, FortDungeon dungeon, String ret) { // check for existing instances for this player InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); // existing instance - if (world != null) - { - if (!(world instanceof FAUWorld)) - { + if (world != null) { + if (!(world instanceof FAUWorld)) { player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON); return ""; } @@ -278,13 +231,11 @@ public final class Q00511_AwlUnderFoot extends Quest return ""; } // New instance - if (ret != null) - { + if (ret != null) { return ret; } ret = checkConditions(player); - if (ret != null) - { + if (ret != null) { return ret; } L2Party party = player.getParty(); @@ -301,15 +252,11 @@ public final class Q00511_AwlUnderFoot extends Quest ThreadPoolManager.getInstance().scheduleGeneral(new spawnRaid((FAUWorld) world), RAID_SPAWN_DELAY); // teleport players - if (player.getParty() == null) - { + if (player.getParty() == null) { teleportPlayer(player, coords, instanceId); world.addAllowed(player.getObjectId()); - } - else - { - for (L2PcInstance partyMember : party.getMembers()) - { + } else { + for (L2PcInstance partyMember : party.getMembers()) { teleportPlayer(partyMember, coords, instanceId); world.addAllowed(partyMember.getObjectId()); getQuestState(partyMember, true); @@ -319,11 +266,9 @@ public final class Q00511_AwlUnderFoot extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; - if (event.equalsIgnoreCase("enter")) - { + if (event.equalsIgnoreCase("enter")) { int[] tele = new int[3]; tele[0] = 53322; tele[1] = 246380; @@ -332,37 +277,26 @@ public final class Q00511_AwlUnderFoot extends Quest } QuestState st = getQuestState(player, true); - if (event.equalsIgnoreCase("FortressWarden-10.htm")) - { - if (st.isCond(0)) - { + if (event.equalsIgnoreCase("FortressWarden-10.htm")) { + if (st.isCond(0)) { st.startQuest(); } - } - else if (event.equalsIgnoreCase("FortressWarden-15.htm")) - { + } else if (event.equalsIgnoreCase("FortressWarden-15.htm")) { st.exitQuest(true, true); } return htmltext; } @Override - public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isSummon) - { + public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isSummon) { L2Playable attacker = (isSummon ? player.getSummon() : player); - if ((attacker.getLevel() - npc.getLevel()) >= 9) - { - if ((attacker.getBuffCount() > 0) || (attacker.getDanceCount() > 0)) - { + if ((attacker.getLevel() - npc.getLevel()) >= 9) { + if ((attacker.getBuffCount() > 0) || (attacker.getDanceCount() > 0)) { npc.setTarget(attacker); npc.doSimultaneousCast(RAID_CURSE); - } - else if (player.getParty() != null) - { - for (L2PcInstance pmember : player.getParty().getMembers()) - { - if ((pmember.getBuffCount() > 0) || (pmember.getDanceCount() > 0)) - { + } else if (player.getParty() != null) { + for (L2PcInstance pmember : player.getParty().getMembers()) { + if ((pmember.getBuffCount() > 0) || (pmember.getDanceCount() > 0)) { npc.setTarget(pmember); npc.doSimultaneousCast(RAID_CURSE); } @@ -373,32 +307,23 @@ public final class Q00511_AwlUnderFoot extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - if (tmpworld instanceof FAUWorld) - { + if (tmpworld instanceof FAUWorld) { FAUWorld world = (FAUWorld) tmpworld; - if (Util.contains(RAIDS3, npc.getId())) - { - if (player.getParty() != null) - { - for (L2PcInstance pl : player.getParty().getMembers()) - { + if (Util.contains(RAIDS3, npc.getId())) { + if (player.getParty() != null) { + for (L2PcInstance pl : player.getParty().getMembers()) { rewardPlayer(pl); } - } - else - { + } else { rewardPlayer(player); } Instance instanceObj = InstanceManager.getInstance().getInstance(world.getInstanceId()); instanceObj.setDuration(360000); instanceObj.removeNpcs(); - } - else - { + } else { world.incStatus(); ThreadPoolManager.getInstance().scheduleGeneral(new spawnRaid(world), RAID_SPAWN_DELAY); } @@ -407,67 +332,50 @@ public final class Q00511_AwlUnderFoot extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = Quest.getNoQuestMsg(player); final QuestState st = getQuestState(player, true); String ret = checkFortCondition(player, npc, false); - if (ret != null) - { + if (ret != null) { return ret; } int npcId = npc.getId(); int cond = 0; - if (st.getState() == State.CREATED) - { + if (st.getState() == State.CREATED) { st.set("cond", "0"); - } - else - { + } else { cond = st.getInt("cond"); } - if (_fortDungeons.containsKey(npcId) && (cond == 0)) - { - if (player.getLevel() >= 60) - { + if (_fortDungeons.containsKey(npcId) && (cond == 0)) { + if (player.getLevel() >= 60) { htmltext = "FortressWarden-09.htm"; - } - else - { + } else { htmltext = "FortressWarden-00.htm"; st.exitQuest(true); } - } - else if (_fortDungeons.containsKey(npcId) && (cond > 0) && (st.getState() == State.STARTED)) - { + } else if (_fortDungeons.containsKey(npcId) && (cond > 0) && (st.getState() == State.STARTED)) { long count = st.getQuestItemsCount(DL_MARK); - if ((cond == 1) && (count > 0)) - { + if ((cond == 1) && (count > 0)) { htmltext = "FortressWarden-14.htm"; st.takeItems(DL_MARK, -1); st.rewardItems(KNIGHT_EPALUETTE, count); - } - else if ((cond == 1) && (count == 0)) - { + } else if ((cond == 1) && (count == 0)) { htmltext = "FortressWarden-10.htm"; } } return htmltext; } - private void rewardPlayer(L2PcInstance player) - { + private void rewardPlayer(L2PcInstance player) { QuestState st = getQuestState(player, false); - if (st.isCond(1)) - { + if (st.isCond(1)) { st.giveItems(DL_MARK, 140); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } - private void teleportPlayer(L2PcInstance player, int[] coords, int instanceId) - { + private void teleportPlayer(L2PcInstance player, int[] coords, int instanceId) { player.setInstanceId(instanceId); player.teleToLocation(coords[0], coords[1], coords[2]); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00512_BladeUnderFoot/Q00512_BladeUnderFoot.java b/src/main/java/com/l2jserver/datapack/quests/Q00512_BladeUnderFoot/Q00512_BladeUnderFoot.java index 7c296a79ba..f8187c0abf 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00512_BladeUnderFoot/Q00512_BladeUnderFoot.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00512_BladeUnderFoot/Q00512_BladeUnderFoot.java @@ -33,33 +33,27 @@ import com.l2jserver.gameserver.util.Util; * @author Adry_85 * @since 2.6.0.0 */ -public class Q00512_BladeUnderFoot extends Quest -{ - private static final class DropInfo - { +public class Q00512_BladeUnderFoot extends Quest { + private static final class DropInfo { public final int _firstChance; public final int _secondChance; - public DropInfo(int firstChance, int secondChance) - { + public DropInfo(int firstChance, int secondChance) { _firstChance = firstChance; _secondChance = secondChance; } - public int getFirstChance() - { + public int getFirstChance() { return _firstChance; } - public int getSecondChance() - { + public int getSecondChance() { return _secondChance; } } // NPCs - private static final int[] WARDEN = - { + private static final int[] WARDEN = { 36403, // Gludio 36404, // Dion 36405, // Giran @@ -79,15 +73,13 @@ public class Q00512_BladeUnderFoot extends Quest private static final int KNIGHTS_EPAULETTE = 9912; // Raid Bosses private static final Map<Integer, DropInfo> RAID_BOSSES = new HashMap<>(); - static - { + static { RAID_BOSSES.put(25563, new DropInfo(175, 1443)); // Beautiful Atrielle RAID_BOSSES.put(25566, new DropInfo(176, 1447)); // Nagen the Tomboy RAID_BOSSES.put(25569, new DropInfo(177, 1450)); // Jax the Destroyer } - public Q00512_BladeUnderFoot() - { + public Q00512_BladeUnderFoot() { super(512, Q00512_BladeUnderFoot.class.getSimpleName(), "Blade Under Foot"); addStartNpc(WARDEN); addTalkId(WARDEN); @@ -96,16 +88,13 @@ public class Q00512_BladeUnderFoot extends Quest } @Override - public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) - { + public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && Util.checkIfInRange(1500, npc, player, false)) - { + if ((st != null) && Util.checkIfInRange(1500, npc, player, false)) { int playerCount = player.getParty().getMemberCount(); int itemCount = RAID_BOSSES.get(npc.getId()).getSecondChance(); - if (playerCount > 0) - { + if (playerCount > 0) { itemCount /= playerCount; } @@ -115,28 +104,20 @@ public class Q00512_BladeUnderFoot extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "36403-02.htm": - { - if (player.getLevel() >= MIN_LEVEL) - { - if ((npc.isMyLord(player) || ((npc.getCastle().getResidenceId() == player.getClan().getCastleId()) && (player.getClan().getCastleId() > 0)))) - { + switch (event) { + case "36403-02.htm": { + if (player.getLevel() >= MIN_LEVEL) { + if ((npc.isMyLord(player) || ((npc.getCastle().getResidenceId() == player.getClan().getCastleId()) && (player.getClan().getCastleId() > 0)))) { st.startQuest(); htmltext = event; - } - else - { + } else { htmltext = "36403-03.htm"; } } @@ -146,13 +127,11 @@ public class Q00512_BladeUnderFoot extends Quest case "36403-05.html": case "36403-06.html": case "36403-07.html": - case "36403-10.html": - { + case "36403-10.html": { htmltext = event; break; } - case "36403-11.html": - { + case "36403-11.html": { st.exitQuest(true, true); htmltext = event; break; @@ -162,17 +141,12 @@ public class Q00512_BladeUnderFoot extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getQuestState(player, false); - if (st != null) - { - if (player.getParty() != null) - { + if (st != null) { + if (player.getParty() != null) { executeForEachPlayer(player, npc, isSummon, true, false); - } - else - { + } else { st.giveItems(FRAGMENT_OF_THE_DUNGEON_LEADER_MARK, RAID_BOSSES.get(npc.getId()).getFirstChance()); st.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); } @@ -181,31 +155,21 @@ public class Q00512_BladeUnderFoot extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCreated()) - { - if (player.getLevel() >= MIN_LEVEL) - { + if (st.isCreated()) { + if (player.getLevel() >= MIN_LEVEL) { htmltext = (npc.isMyLord(player) || ((player.getClan() != null) && (npc.getCastle().getResidenceId() == player.getClan().getCastleId()) && (player.getClan().getCastleId() > 0))) ? "36403-01.htm" : "36403-03.htm"; - } - else - { + } else { htmltext = "36403-08.htm"; } - } - else if (st.isStarted()) - { - if (hasQuestItems(player, FRAGMENT_OF_THE_DUNGEON_LEADER_MARK)) - { + } else if (st.isStarted()) { + if (hasQuestItems(player, FRAGMENT_OF_THE_DUNGEON_LEADER_MARK)) { giveItems(player, KNIGHTS_EPAULETTE, getQuestItemsCount(player, FRAGMENT_OF_THE_DUNGEON_LEADER_MARK)); takeItems(player, FRAGMENT_OF_THE_DUNGEON_LEADER_MARK, -1); htmltext = "36403-09.html"; - } - else - { + } else { htmltext = "36403-12.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00551_OlympiadStarter/Q00551_OlympiadStarter.java b/src/main/java/com/l2jserver/datapack/quests/Q00551_OlympiadStarter/Q00551_OlympiadStarter.java index 1a41146c4c..846ffd311d 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00551_OlympiadStarter/Q00551_OlympiadStarter.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00551_OlympiadStarter/Q00551_OlympiadStarter.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.model.quest.State; * Olympiad Starter (551) * @author Gnacik, Adry_85 */ -public class Q00551_OlympiadStarter extends Quest -{ +public class Q00551_OlympiadStarter extends Quest { private static final int MANAGER = 31688; private static final int CERT_3 = 17238; @@ -43,8 +42,7 @@ public class Q00551_OlympiadStarter extends Quest private static final int OLY_CHEST = 17169; private static final int MEDAL_OF_GLORY = 21874; - public Q00551_OlympiadStarter() - { + public Q00551_OlympiadStarter() { super(551, Q00551_OlympiadStarter.class.getSimpleName(), "Olympiad Starter"); addStartNpc(MANAGER); addTalkId(MANAGER); @@ -53,36 +51,28 @@ public class Q00551_OlympiadStarter extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } String htmltext = event; - switch (event) - { - case "31688-03.html": - { + switch (event) { + case "31688-03.html": { st.startQuest(); st.setMemoState(1); st.setMemoStateEx(1, 0); break; } - case "31688-04.html": - { - if ((st.getQuestItemsCount(CERT_3) + st.getQuestItemsCount(CERT_5)) > 0) - { - if (st.hasQuestItems(CERT_3)) - { + case "31688-04.html": { + if ((st.getQuestItemsCount(CERT_3) + st.getQuestItemsCount(CERT_5)) > 0) { + if (st.hasQuestItems(CERT_3)) { st.giveItems(OLY_CHEST, 1); st.takeItems(CERT_3, -1); } - if (st.hasQuestItems(CERT_5)) - { + if (st.hasQuestItems(CERT_5)) { st.giveItems(OLY_CHEST, 1); st.giveItems(MEDAL_OF_GLORY, 3); st.takeItems(CERT_5, -1); @@ -97,29 +87,20 @@ public class Q00551_OlympiadStarter extends Quest } @Override - public void onOlympiadLose(L2PcInstance loser, CompetitionType type) - { - if (loser != null) - { + public void onOlympiadLose(L2PcInstance loser, CompetitionType type) { + if (loser != null) { final QuestState st = getQuestState(loser, false); - if ((st != null) && st.isStarted() && st.isMemoState(1)) - { + if ((st != null) && st.isStarted() && st.isMemoState(1)) { final int memoStateEx = st.getMemoStateEx(1); - if (memoStateEx == 9) - { + if (memoStateEx == 9) { st.setMemoStateEx(1, st.getMemoStateEx(1) + 1); st.setMemoState(2); st.setCond(2, true); st.giveItems(CERT_10, 1); - } - else if (memoStateEx < 9) - { - if (st.isMemoStateEx(1, 2)) - { + } else if (memoStateEx < 9) { + if (st.isMemoStateEx(1, 2)) { st.giveItems(CERT_3, 1); - } - else if (st.isMemoStateEx(1, 4)) - { + } else if (st.isMemoStateEx(1, 4)) { st.giveItems(CERT_5, 1); } @@ -131,34 +112,24 @@ public class Q00551_OlympiadStarter extends Quest } @Override - public void onOlympiadMatchFinish(Participant winner, Participant looser, CompetitionType type) - { - if (winner != null) - { + public void onOlympiadMatchFinish(Participant winner, Participant looser, CompetitionType type) { + if (winner != null) { final L2PcInstance player = winner.getPlayer(); - if (player == null) - { + if (player == null) { return; } final QuestState st = getQuestState(player, false); - if ((st != null) && st.isStarted() && st.isMemoState(1)) - { + if ((st != null) && st.isStarted() && st.isMemoState(1)) { final int memoStateEx = st.getMemoStateEx(1); - if (memoStateEx == 9) - { + if (memoStateEx == 9) { st.setMemoStateEx(1, st.getMemoStateEx(1) + 1); st.setMemoState(2); st.setCond(2, true); st.giveItems(CERT_10, 1); - } - else if (memoStateEx < 9) - { - if (st.isMemoStateEx(1, 2)) - { + } else if (memoStateEx < 9) { + if (st.isMemoStateEx(1, 2)) { st.giveItems(CERT_3, 1); - } - else if (st.isMemoStateEx(1, 4)) - { + } else if (st.isMemoStateEx(1, 4)) { st.giveItems(CERT_5, 1); } @@ -168,32 +139,23 @@ public class Q00551_OlympiadStarter extends Quest } } - if (looser != null) - { + if (looser != null) { final L2PcInstance player = looser.getPlayer(); - if (player == null) - { + if (player == null) { return; } final QuestState st = getQuestState(player, false); - if ((st != null) && st.isStarted() && st.isMemoState(1)) - { + if ((st != null) && st.isStarted() && st.isMemoState(1)) { final int memoStateEx = st.getMemoStateEx(1); - if (memoStateEx == 9) - { + if (memoStateEx == 9) { st.setMemoStateEx(1, st.getMemoStateEx(1) + 1); st.setMemoState(2); st.setCond(2, true); st.giveItems(CERT_10, 1); - } - else if (memoStateEx < 9) - { - if (st.isMemoStateEx(1, 2)) - { + } else if (memoStateEx < 9) { + if (st.isMemoStateEx(1, 2)) { st.giveItems(CERT_3, 1); - } - else if (st.isMemoStateEx(1, 4)) - { + } else if (st.isMemoStateEx(1, 4)) { st.giveItems(CERT_5, 1); } @@ -205,38 +167,24 @@ public class Q00551_OlympiadStarter extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - if ((player.getLevel() < 75) || !player.isNoble()) - { + if ((player.getLevel() < 75) || !player.isNoble()) { htmltext = "31688-00.htm"; - } - else if (st.isCreated()) - { + } else if (st.isCreated()) { htmltext = "31688-01.htm"; - } - else if (st.isCompleted()) - { - if (st.isNowAvailable()) - { + } else if (st.isCompleted()) { + if (st.isNowAvailable()) { st.setState(State.CREATED); htmltext = (player.getLevel() < 75) || !player.isNoble() ? "31688-00.htm" : "31688-01.htm"; - } - else - { + } else { htmltext = "31688-05.html"; } - } - else if (st.isStarted()) - { - if (st.isMemoState(1)) - { + } else if (st.isStarted()) { + if (st.isMemoState(1)) { htmltext = (((st.getQuestItemsCount(CERT_3) + st.getQuestItemsCount(CERT_5) + st.getQuestItemsCount(CERT_10)) > 0) ? "31688-07.html" : "31688-06.html"); - } - else if (st.isMemoState(2)) - { + } else if (st.isMemoState(2)) { st.giveItems(OLY_CHEST, 4); st.giveItems(MEDAL_OF_GLORY, 5); st.exitQuest(QuestType.DAILY, true); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00552_OlympiadVeteran/Q00552_OlympiadVeteran.java b/src/main/java/com/l2jserver/datapack/quests/Q00552_OlympiadVeteran/Q00552_OlympiadVeteran.java index d5471ce311..37eb631e9b 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00552_OlympiadVeteran/Q00552_OlympiadVeteran.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00552_OlympiadVeteran/Q00552_OlympiadVeteran.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.State; * Olympiad Veteran (552) * @author lion */ -public class Q00552_OlympiadVeteran extends Quest -{ +public class Q00552_OlympiadVeteran extends Quest { // NPC private static final int MANAGER = 31688; // Items @@ -41,8 +40,7 @@ public class Q00552_OlympiadVeteran extends Quest private static final int CLASS_BATTLE_CERTIFICATE = 17243; private static final int OLY_CHEST = 17169; - public Q00552_OlympiadVeteran() - { + public Q00552_OlympiadVeteran() { super(552, Q00552_OlympiadVeteran.class.getSimpleName(), "Olympiad Veteran"); addStartNpc(MANAGER); addTalkId(MANAGER); @@ -51,30 +49,22 @@ public class Q00552_OlympiadVeteran extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } String htmltext = event; - if (event.equalsIgnoreCase("31688-03.html")) - { + if (event.equalsIgnoreCase("31688-03.html")) { st.startQuest(); - } - else if (event.equalsIgnoreCase("31688-04.html")) - { + } else if (event.equalsIgnoreCase("31688-04.html")) { final long count = st.getQuestItemsCount(TEAM_EVENT_CERTIFICATE) + st.getQuestItemsCount(CLASS_FREE_BATTLE_CERTIFICATE) + st.getQuestItemsCount(CLASS_BATTLE_CERTIFICATE); - if (count > 0) - { + if (count > 0) { st.giveItems(OLY_CHEST, count); st.exitQuest(QuestType.DAILY, true); - } - else - { + } else { htmltext = getNoQuestMsg(player); } } @@ -82,48 +72,37 @@ public class Q00552_OlympiadVeteran extends Quest } @Override - public void onOlympiadMatchFinish(Participant winner, Participant looser, CompetitionType type) - { - if (winner != null) - { + public void onOlympiadMatchFinish(Participant winner, Participant looser, CompetitionType type) { + if (winner != null) { final L2PcInstance player = winner.getPlayer(); - if (player == null) - { + if (player == null) { return; } final QuestState st = getQuestState(player, false); - if ((st != null) && st.isStarted()) - { + if ((st != null) && st.isStarted()) { int matches; - switch (type) - { - case CLASSED: - { + switch (type) { + case CLASSED: { matches = st.getInt("classed") + 1; st.set("classed", String.valueOf(matches)); - if ((matches == 5) && !st.hasQuestItems(CLASS_BATTLE_CERTIFICATE)) - { + if ((matches == 5) && !st.hasQuestItems(CLASS_BATTLE_CERTIFICATE)) { st.giveItems(CLASS_BATTLE_CERTIFICATE, 1); } break; } - case NON_CLASSED: - { + case NON_CLASSED: { matches = st.getInt("nonclassed") + 1; st.set("nonclassed", String.valueOf(matches)); - if ((matches == 5) && !st.hasQuestItems(CLASS_FREE_BATTLE_CERTIFICATE)) - { + if ((matches == 5) && !st.hasQuestItems(CLASS_FREE_BATTLE_CERTIFICATE)) { st.giveItems(CLASS_FREE_BATTLE_CERTIFICATE, 1); } break; } - case TEAMS: - { + case TEAMS: { matches = st.getInt("teams") + 1; st.set("teams", String.valueOf(matches)); - if ((matches == 5) && !st.hasQuestItems(TEAM_EVENT_CERTIFICATE)) - { + if ((matches == 5) && !st.hasQuestItems(TEAM_EVENT_CERTIFICATE)) { st.giveItems(TEAM_EVENT_CERTIFICATE, 1); } break; @@ -132,45 +111,35 @@ public class Q00552_OlympiadVeteran extends Quest } } - if (looser != null) - { + if (looser != null) { final L2PcInstance player = looser.getPlayer(); - if (player == null) - { + if (player == null) { return; } final QuestState st = getQuestState(player, false); - if ((st != null) && st.isStarted()) - { + if ((st != null) && st.isStarted()) { int matches; - switch (type) - { - case CLASSED: - { + switch (type) { + case CLASSED: { matches = st.getInt("classed") + 1; st.set("classed", String.valueOf(matches)); - if (matches == 5) - { + if (matches == 5) { st.giveItems(CLASS_BATTLE_CERTIFICATE, 1); } break; } - case NON_CLASSED: - { + case NON_CLASSED: { matches = st.getInt("nonclassed") + 1; st.set("nonclassed", String.valueOf(matches)); - if (matches == 5) - { + if (matches == 5) { st.giveItems(CLASS_FREE_BATTLE_CERTIFICATE, 1); } break; } - case TEAMS: - { + case TEAMS: { matches = st.getInt("teams") + 1; st.set("teams", String.valueOf(matches)); - if (matches == 5) - { + if (matches == 5) { st.giveItems(TEAM_EVENT_CERTIFICATE, 1); } break; @@ -181,42 +150,28 @@ public class Q00552_OlympiadVeteran extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - if ((player.getLevel() < 75) || !player.isNoble()) - { + if ((player.getLevel() < 75) || !player.isNoble()) { htmltext = "31688-00.htm"; - } - else if (st.isCreated()) - { + } else if (st.isCreated()) { htmltext = "31688-01.htm"; - } - else if (st.isCompleted()) - { - if (st.isNowAvailable()) - { + } else if (st.isCompleted()) { + if (st.isNowAvailable()) { st.setState(State.CREATED); htmltext = (player.getLevel() < 75) || !player.isNoble() ? "31688-00.htm" : "31688-01.htm"; - } - else - { + } else { htmltext = "31688-05.html"; } - } - else if (st.isStarted()) - { + } else if (st.isStarted()) { final long count = st.getQuestItemsCount(TEAM_EVENT_CERTIFICATE) + st.getQuestItemsCount(CLASS_FREE_BATTLE_CERTIFICATE) + st.getQuestItemsCount(CLASS_BATTLE_CERTIFICATE); - if (count == 3) - { + if (count == 3) { htmltext = "31688-04.html"; st.giveItems(OLY_CHEST, 4); st.exitQuest(QuestType.DAILY, true); - } - else - { + } else { htmltext = "31688-s" + count + ".html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00553_OlympiadUndefeated/Q00553_OlympiadUndefeated.java b/src/main/java/com/l2jserver/datapack/quests/Q00553_OlympiadUndefeated/Q00553_OlympiadUndefeated.java index cb3fd7f650..acfeeb8f2f 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00553_OlympiadUndefeated/Q00553_OlympiadUndefeated.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00553_OlympiadUndefeated/Q00553_OlympiadUndefeated.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.State; * Olympiad Undefeated (553) * @author lion */ -public class Q00553_OlympiadUndefeated extends Quest -{ +public class Q00553_OlympiadUndefeated extends Quest { // NPC private static final int MANAGER = 31688; // Items @@ -42,8 +41,7 @@ public class Q00553_OlympiadUndefeated extends Quest private static final int OLY_CHEST = 17169; private static final int MEDAL_OF_GLORY = 21874; - public Q00553_OlympiadUndefeated() - { + public Q00553_OlympiadUndefeated() { super(553, Q00553_OlympiadUndefeated.class.getSimpleName(), "Olympiad Undefeated"); addStartNpc(MANAGER); addTalkId(MANAGER); @@ -52,34 +50,25 @@ public class Q00553_OlympiadUndefeated extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } String htmltext = event; - if (event.equalsIgnoreCase("31688-03.html")) - { + if (event.equalsIgnoreCase("31688-03.html")) { st.startQuest(); - } - else if (event.equalsIgnoreCase("31688-04.html")) - { + } else if (event.equalsIgnoreCase("31688-04.html")) { final long count = st.getQuestItemsCount(WIN_CONF_2) + st.getQuestItemsCount(WIN_CONF_5); - if (count > 0) - { + if (count > 0) { st.giveItems(OLY_CHEST, count); - if (count == 2) - { + if (count == 2) { st.giveItems(MEDAL_OF_GLORY, 3); } st.exitQuest(QuestType.DAILY, true); - } - else - { + } else { htmltext = getNoQuestMsg(player); } } @@ -87,38 +76,30 @@ public class Q00553_OlympiadUndefeated extends Quest } @Override - public void onOlympiadMatchFinish(Participant winner, Participant looser, CompetitionType type) - { - if (winner != null) - { + public void onOlympiadMatchFinish(Participant winner, Participant looser, CompetitionType type) { + if (winner != null) { final L2PcInstance player = winner.getPlayer(); - if (player == null) - { + if (player == null) { return; } final QuestState st = getQuestState(player, false); - if ((st != null) && st.isStarted() && (st.isCond(1))) - { + if ((st != null) && st.isStarted() && (st.isCond(1))) { final int matches = st.getInt("undefeatable") + 1; st.set("undefeatable", String.valueOf(matches)); - switch (matches) - { + switch (matches) { case 2: - if (!st.hasQuestItems(WIN_CONF_2)) - { + if (!st.hasQuestItems(WIN_CONF_2)) { st.giveItems(WIN_CONF_2, 1); } break; case 5: - if (!st.hasQuestItems(WIN_CONF_5)) - { + if (!st.hasQuestItems(WIN_CONF_5)) { st.giveItems(WIN_CONF_5, 1); } break; case 10: - if (!st.hasQuestItems(WIN_CONF_10)) - { + if (!st.hasQuestItems(WIN_CONF_10)) { st.giveItems(WIN_CONF_10, 1); st.setCond(2); } @@ -127,17 +108,14 @@ public class Q00553_OlympiadUndefeated extends Quest } } - if (looser != null) - { + if (looser != null) { final L2PcInstance player = looser.getPlayer(); - if (player == null) - { + if (player == null) { return; } final QuestState st = getQuestState(player, false); - if ((st != null) && st.isStarted() && (st.isCond(1))) - { + if ((st != null) && st.isStarted() && (st.isCond(1))) { st.unset("undefeatable"); st.takeItems(WIN_CONF_2, -1); st.takeItems(WIN_CONF_5, -1); @@ -147,42 +125,28 @@ public class Q00553_OlympiadUndefeated extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - if ((player.getLevel() < 75) || !player.isNoble()) - { + if ((player.getLevel() < 75) || !player.isNoble()) { htmltext = "31688-00.htm"; - } - else if (st.isCreated()) - { + } else if (st.isCreated()) { htmltext = "31688-01.htm"; - } - else if (st.isCompleted()) - { - if (st.isNowAvailable()) - { + } else if (st.isCompleted()) { + if (st.isNowAvailable()) { st.setState(State.CREATED); htmltext = (player.getLevel() < 75) || !player.isNoble() ? "31688-00.htm" : "31688-01.htm"; - } - else - { + } else { htmltext = "31688-05.html"; } - } - else - { + } else { final long count = st.getQuestItemsCount(WIN_CONF_2) + st.getQuestItemsCount(WIN_CONF_5) + st.getQuestItemsCount(WIN_CONF_10); - if ((count == 3) && st.isCond(2)) - { + if ((count == 3) && st.isCond(2)) { st.giveItems(OLY_CHEST, 4); st.giveItems(MEDAL_OF_GLORY, 5); st.exitQuest(QuestType.DAILY, true); htmltext = "31688-04.html"; - } - else - { + } else { htmltext = "31688-w" + count + ".html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00601_WatchingEyes/Q00601_WatchingEyes.java b/src/main/java/com/l2jserver/datapack/quests/Q00601_WatchingEyes/Q00601_WatchingEyes.java index 50098e1f0a..3083da88f6 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00601_WatchingEyes/Q00601_WatchingEyes.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00601_WatchingEyes/Q00601_WatchingEyes.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by disKret. * @author malyelfik */ -public class Q00601_WatchingEyes extends Quest -{ +public class Q00601_WatchingEyes extends Quest { // NPC private static final int EYE_OF_ARGOS = 31683; // Item @@ -42,8 +41,7 @@ public class Q00601_WatchingEyes extends Quest // Monsters private static final Map<Integer, Integer> MOBS = new HashMap<>(); - static - { + static { MOBS.put(21308, 790); MOBS.put(21309, 820); MOBS.put(21306, 850); @@ -52,8 +50,7 @@ public class Q00601_WatchingEyes extends Quest } // Reward - private static final int[][] REWARD = - { + private static final int[][] REWARD = { { 6699, 90000 @@ -72,8 +69,7 @@ public class Q00601_WatchingEyes extends Quest } }; - public Q00601_WatchingEyes() - { + public Q00601_WatchingEyes() { super(601, Q00601_WatchingEyes.class.getSimpleName(), "Watching Eyes"); addStartNpc(EYE_OF_ARGOS); addTalkId(EYE_OF_ARGOS); @@ -82,30 +78,25 @@ public class Q00601_WatchingEyes extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "31683-02.htm": st.startQuest(); break; case "31683-05.html": - if (st.getQuestItemsCount(PROOF_OF_AVENGER) < 100) - { + if (st.getQuestItemsCount(PROOF_OF_AVENGER) < 100) { return "31683-06.html"; } int i = getRandom(4); - if (i < 3) - { + if (i < 3) { st.giveItems(REWARD[i][0], 5); st.addExpAndSp(120000, 10000); } @@ -120,19 +111,14 @@ public class Q00601_WatchingEyes extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isCond(1) && (getRandom(1000) < MOBS.get(npc.getId()))) - { + if ((st != null) && st.isCond(1) && (getRandom(1000) < MOBS.get(npc.getId()))) { st.giveItems(PROOF_OF_AVENGER, 1); - if (st.getQuestItemsCount(PROOF_OF_AVENGER) == 100) - { + if (st.getQuestItemsCount(PROOF_OF_AVENGER) == 100) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -140,12 +126,10 @@ public class Q00601_WatchingEyes extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= 71) ? "31683-01.htm" : "31683-00.htm"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00602_ShadowOfLight/Q00602_ShadowOfLight.java b/src/main/java/com/l2jserver/datapack/quests/Q00602_ShadowOfLight/Q00602_ShadowOfLight.java index 4b9edd40a8..86ab1d65aa 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00602_ShadowOfLight/Q00602_ShadowOfLight.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00602_ShadowOfLight/Q00602_ShadowOfLight.java @@ -30,22 +30,19 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by disKret. * @author malyelfik */ -public class Q00602_ShadowOfLight extends Quest -{ +public class Q00602_ShadowOfLight extends Quest { // NPC private static final int EYE_OF_ARGOS = 31683; // Item private static final int EYE_OF_DARKNESS = 7189; // Monsters - private static final int[] MOBS = - { + private static final int[] MOBS = { 21299, 21304 }; // Reward - private static final int[][] REWARD = - { + private static final int[][] REWARD = { { 6699, 40000, @@ -72,8 +69,7 @@ public class Q00602_ShadowOfLight extends Quest } }; - public Q00602_ShadowOfLight() - { + public Q00602_ShadowOfLight() { super(602, Q00602_ShadowOfLight.class.getSimpleName(), "Shadow of Light"); addStartNpc(EYE_OF_ARGOS); addTalkId(EYE_OF_ARGOS); @@ -82,30 +78,25 @@ public class Q00602_ShadowOfLight extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "31683-02.htm": st.startQuest(); break; case "31683-05.html": - if (st.getQuestItemsCount(EYE_OF_DARKNESS) < 100) - { + if (st.getQuestItemsCount(EYE_OF_DARKNESS) < 100) { return "31683-06.html"; } int i = getRandom(4); - if (i < 3) - { + if (i < 3) { st.giveItems(REWARD[i][0], 3); } st.giveAdena(REWARD[i][1], true); @@ -120,26 +111,20 @@ public class Q00602_ShadowOfLight extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return super.onKill(npc, player, isSummon); } int chance = (npc.getId() == MOBS[0]) ? 560 : 800; - if (st.isCond(1) && (getRandom(1000) < chance)) - { + if (st.isCond(1) && (getRandom(1000) < chance)) { st.giveItems(EYE_OF_DARKNESS, 1); - if (st.getQuestItemsCount(EYE_OF_DARKNESS) == 100) - { + if (st.getQuestItemsCount(EYE_OF_DARKNESS) == 100) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -147,12 +132,10 @@ public class Q00602_ShadowOfLight extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= 68) ? "31683-01.htm" : "31683-00.htm"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00603_DaimonTheWhiteEyedPart1/Q00603_DaimonTheWhiteEyedPart1.java b/src/main/java/com/l2jserver/datapack/quests/Q00603_DaimonTheWhiteEyedPart1/Q00603_DaimonTheWhiteEyedPart1.java index 05d643b07f..adb755edd1 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00603_DaimonTheWhiteEyedPart1/Q00603_DaimonTheWhiteEyedPart1.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00603_DaimonTheWhiteEyedPart1/Q00603_DaimonTheWhiteEyedPart1.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.State; * Daimon the White-Eyed - Part 1 (603) * @author Pandragon */ -public final class Q00603_DaimonTheWhiteEyedPart1 extends Quest -{ +public final class Q00603_DaimonTheWhiteEyedPart1 extends Quest { // NPC private static final int EYE_OF_ARGOS = 31683; private static final int TABLET_1 = 31548; @@ -55,8 +54,7 @@ public final class Q00603_DaimonTheWhiteEyedPart1 extends Quest // Misc private static final int MIN_LVL = 73; - public Q00603_DaimonTheWhiteEyedPart1() - { + public Q00603_DaimonTheWhiteEyedPart1() { super(603, Q00603_DaimonTheWhiteEyedPart1.class.getSimpleName(), "Daimon the White-Eyed - Part 1"); addStartNpc(EYE_OF_ARGOS); addTalkId(EYE_OF_ARGOS, TABLET_1, TABLET_2, TABLET_3, TABLET_4, TABLET_5); @@ -65,21 +63,16 @@ public final class Q00603_DaimonTheWhiteEyedPart1 extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { - case "31683-03.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "31683-03.htm": { + if (qs.isCreated()) { qs.set("tablet_" + TABLET_1, 0); qs.set("tablet_" + TABLET_2, 0); qs.set("tablet_" + TABLET_3, 0); @@ -94,10 +87,8 @@ public final class Q00603_DaimonTheWhiteEyedPart1 extends Quest case "31549-02.html": case "31550-02.html": case "31551-02.html": - case "31552-02.html": - { - if (qs.getCond() < 6) - { + case "31552-02.html": { + if (qs.getCond() < 6) { giveItems(player, BROKEN_CRYSTAL, 1); qs.set("TABLET_" + npc.getId(), 1); qs.setCond(qs.getCond() + 1, true); @@ -105,29 +96,22 @@ public final class Q00603_DaimonTheWhiteEyedPart1 extends Quest } break; } - case "31683-06.html": - { - if (qs.isCond(6) && (getQuestItemsCount(player, BROKEN_CRYSTAL) >= 5)) - { + case "31683-06.html": { + if (qs.isCond(6) && (getQuestItemsCount(player, BROKEN_CRYSTAL) >= 5)) { takeItems(player, BROKEN_CRYSTAL, -1); qs.setCond(7, true); htmltext = event; } break; } - case "31683-10.html": - { - if (qs.isCond(8)) - { - if (getQuestItemsCount(player, SPIRIT_OF_DARKNESS) >= 200) - { + case "31683-10.html": { + if (qs.isCond(8)) { + if (getQuestItemsCount(player, SPIRIT_OF_DARKNESS) >= 200) { takeItems(player, SPIRIT_OF_DARKNESS, -1); giveItems(player, UNFINISHED_CRYSTAL, 1); qs.exitQuest(true, true); htmltext = event; - } - else - { + } else { htmltext = "31683-11.html"; } } @@ -138,64 +122,48 @@ public final class Q00603_DaimonTheWhiteEyedPart1 extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (qs.getState()) - { - case State.CREATED: - { - if (npc.getId() == EYE_OF_ARGOS) - { + switch (qs.getState()) { + case State.CREATED: { + if (npc.getId() == EYE_OF_ARGOS) { htmltext = ((talker.getLevel() < MIN_LVL) ? "31683-02.html" : "31683-01.htm"); } break; } - case State.STARTED: - { - if (npc.getId() == EYE_OF_ARGOS) - { - switch (qs.getCond()) - { + case State.STARTED: { + if (npc.getId() == EYE_OF_ARGOS) { + switch (qs.getCond()) { case 1: case 2: case 3: case 4: - case 5: - { + case 5: { htmltext = "31683-04.html"; break; } - case 6: - { + case 6: { htmltext = "31683-05.html"; break; } - case 7: - { + case 7: { htmltext = "31683-07.html"; break; } - case 8: - { + case 8: { htmltext = "31683-08.html"; break; } } - } - else if (qs.getInt("TABLET_" + npc.getId()) == 0) - { + } else if (qs.getInt("TABLET_" + npc.getId()) == 0) { htmltext = npc.getId() + "-01.html"; - } - else - { + } else { htmltext = npc.getId() + "-03.html"; } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(talker); break; } @@ -204,13 +172,10 @@ public final class Q00603_DaimonTheWhiteEyedPart1 extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, 7, 3, npc); - if (qs != null) - { - if (giveItemRandomly(qs.getPlayer(), npc, SPIRIT_OF_DARKNESS, 1, 200, MONSTER_CHANCES.get(npc.getId()), true)) - { + if (qs != null) { + if (giveItemRandomly(qs.getPlayer(), npc, SPIRIT_OF_DARKNESS, 1, 200, MONSTER_CHANCES.get(npc.getId()), true)) { qs.setCond(8, true); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00604_DaimonTheWhiteEyedPart2/Q00604_DaimonTheWhiteEyedPart2.java b/src/main/java/com/l2jserver/datapack/quests/Q00604_DaimonTheWhiteEyedPart2/Q00604_DaimonTheWhiteEyedPart2.java index c88323663c..6c329287da 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00604_DaimonTheWhiteEyedPart2/Q00604_DaimonTheWhiteEyedPart2.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00604_DaimonTheWhiteEyedPart2/Q00604_DaimonTheWhiteEyedPart2.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.util.Util; * Daimon the White-Eyed - Part 2 (604) * @author Adry_85 */ -public final class Q00604_DaimonTheWhiteEyedPart2 extends Quest -{ +public final class Q00604_DaimonTheWhiteEyedPart2 extends Quest { // NPCs private static final int DAIMONS_ALTAR = 31541; private static final int EYE_OF_ARGOS = 31683; @@ -57,8 +56,7 @@ public final class Q00604_DaimonTheWhiteEyedPart2 extends Quest private static final int DYE_W2I2_C = 4599; // Greater Dye of WIT <Wit+2 Int-2> private static final int DYE_W2M2_C = 4600; // Greater Dye of WIT <Wit+2 Men-2> - public Q00604_DaimonTheWhiteEyedPart2() - { + public Q00604_DaimonTheWhiteEyedPart2() { super(604, Q00604_DaimonTheWhiteEyedPart2.class.getSimpleName(), "Daimon the White-Eyed - Part 2"); addStartNpc(EYE_OF_ARGOS); addTalkId(EYE_OF_ARGOS, DAIMONS_ALTAR); @@ -68,15 +66,11 @@ public final class Q00604_DaimonTheWhiteEyedPart2 extends Quest } @Override - public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) - { + public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) { final QuestState qs = getQuestState(player, false); - if ((qs != null) && (qs.getMemoState() >= 11) && (qs.getMemoState() <= 21)) - { - if (Util.checkIfInRange(1500, npc, player, false)) - { - if (hasQuestItems(player, ESSENCE_OF_DAIMON)) - { + if ((qs != null) && (qs.getMemoState() >= 11) && (qs.getMemoState() <= 21)) { + if (Util.checkIfInRange(1500, npc, player, false)) { + if (hasQuestItems(player, ESSENCE_OF_DAIMON)) { qs.setCond(3, true); qs.setMemoState(22); } @@ -88,12 +82,9 @@ public final class Q00604_DaimonTheWhiteEyedPart2 extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if ("DESPAWN".equals(event)) - { - if (isDaimonSpawned()) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if ("DESPAWN".equals(event)) { + if (isDaimonSpawned()) { npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getTemplate().getDisplayId(), NpcStringId.CAN_LIGHT_EXIST_WITHOUT_DARKNESS)); npc.deleteMe(); } @@ -101,16 +92,13 @@ public final class Q00604_DaimonTheWhiteEyedPart2 extends Quest } final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "31683-04.htm": - { + switch (event) { + case "31683-04.htm": { takeItems(player, UNFINISHED_SUMMON_CRYSTAL, 1); qs.startQuest(); qs.setMemoState(11); @@ -118,68 +106,46 @@ public final class Q00604_DaimonTheWhiteEyedPart2 extends Quest htmltext = event; break; } - case "31683-07.html": - { - if (hasQuestItems(player, ESSENCE_OF_DAIMON)) - { + case "31683-07.html": { + if (hasQuestItems(player, ESSENCE_OF_DAIMON)) { final int reward; final int random = getRandom(1000); takeItems(player, ESSENCE_OF_DAIMON, 1); - if (random < 167) - { + if (random < 167) { reward = DYE_I2M2_C; - } - else if (random < 334) - { + } else if (random < 334) { reward = DYE_I2W2_C; - } - else if (random < 501) - { + } else if (random < 501) { reward = DYE_M2I2_C; - } - else if (random < 668) - { + } else if (random < 668) { reward = DYE_M2W2_C; - } - else if (random < 835) - { + } else if (random < 835) { reward = DYE_W2I2_C; - } - else - { + } else { reward = DYE_W2M2_C; } rewardItems(player, reward, 5); qs.exitQuest(true, true); htmltext = event; - } - else - { + } else { htmltext = "31683-08.html"; } break; } - case "31541-02.html": - { - if (hasQuestItems(player, SUMMON_CRYSTAL)) - { - if (!isDaimonSpawned()) - { + case "31541-02.html": { + if (hasQuestItems(player, SUMMON_CRYSTAL)) { + if (!isDaimonSpawned()) { takeItems(player, SUMMON_CRYSTAL, 1); htmltext = event; addSpawn(DAIMON_THE_WHITE_EYED, DAIMON_THE_WHITE_EYED_LOC); npc.deleteMe(); qs.setMemoState(21); qs.setCond(2, true); - } - else - { + } else { htmltext = "31541-03.html"; } - } - else - { + } else { htmltext = "31541-04.html"; } break; @@ -189,77 +155,51 @@ public final class Q00604_DaimonTheWhiteEyedPart2 extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { executeForEachPlayer(killer, npc, isSummon, true, false); return super.onKill(npc, killer, isSummon); } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { startQuestTimer("DESPAWN", 1200000, npc, null); npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getTemplate().getDisplayId(), NpcStringId.WHO_IS_CALLING_ME)); return super.onSpawn(npc); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - if (player.getLevel() < MIN_LEVEL) - { + if (qs.isCreated()) { + if (player.getLevel() < MIN_LEVEL) { htmltext = "31683-01.htm"; - } - else if (!hasQuestItems(player, UNFINISHED_SUMMON_CRYSTAL)) - { + } else if (!hasQuestItems(player, UNFINISHED_SUMMON_CRYSTAL)) { htmltext = "31683-02.htm"; - } - else - { + } else { htmltext = "31683-03.htm"; } - } - else if (qs.isStarted()) - { - if (npc.getId() == EYE_OF_ARGOS) - { - if (qs.isMemoState(11)) - { + } else if (qs.isStarted()) { + if (npc.getId() == EYE_OF_ARGOS) { + if (qs.isMemoState(11)) { htmltext = "31683-05.html"; - } - else if (qs.getMemoState() >= 22) - { + } else if (qs.getMemoState() >= 22) { htmltext = (hasQuestItems(player, ESSENCE_OF_DAIMON)) ? "31683-06.html" : "31683-09.html"; } - } - else - { - if (qs.isMemoState(11)) - { - if (hasQuestItems(player, SUMMON_CRYSTAL)) - { + } else { + if (qs.isMemoState(11)) { + if (hasQuestItems(player, SUMMON_CRYSTAL)) { htmltext = "31541-01.html"; } - } - else if (qs.isMemoState(21)) - { - if (!isDaimonSpawned()) - { + } else if (qs.isMemoState(21)) { + if (!isDaimonSpawned()) { addSpawn(DAIMON_THE_WHITE_EYED, DAIMON_THE_WHITE_EYED_LOC); npc.deleteMe(); htmltext = "31541-02.html"; - } - else - { + } else { htmltext = "31541-03.html"; } - } - else if (qs.getMemoState() >= 22) - { + } else if (qs.getMemoState() >= 22) { htmltext = "31541-05.html"; } } @@ -267,8 +207,7 @@ public final class Q00604_DaimonTheWhiteEyedPart2 extends Quest return htmltext; } - private static boolean isDaimonSpawned() - { + private static boolean isDaimonSpawned() { return SpawnTable.getInstance().findAny(DAIMON_THE_WHITE_EYED) != null; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00605_AllianceWithKetraOrcs/Q00605_AllianceWithKetraOrcs.java b/src/main/java/com/l2jserver/datapack/quests/Q00605_AllianceWithKetraOrcs/Q00605_AllianceWithKetraOrcs.java index 677fe9fd98..bc3d81329b 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00605_AllianceWithKetraOrcs/Q00605_AllianceWithKetraOrcs.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00605_AllianceWithKetraOrcs/Q00605_AllianceWithKetraOrcs.java @@ -32,20 +32,16 @@ import com.l2jserver.gameserver.model.quest.State; * Alliance with Ketra Orcs (605) * @author malyelfik */ -public class Q00605_AllianceWithKetraOrcs extends Quest -{ - private static class DropInfo - { +public class Q00605_AllianceWithKetraOrcs extends Quest { + private static class DropInfo { private final int _chance; private final int _minCond; private final int _itemId; - public DropInfo(int chance, int minCond) - { + public DropInfo(int chance, int minCond) { _chance = chance; _minCond = minCond; - switch (_minCond) - { + switch (_minCond) { case 1: _itemId = VARKA_BADGE_SOLDIER; break; @@ -58,18 +54,15 @@ public class Q00605_AllianceWithKetraOrcs extends Quest } } - public int getMinCond() - { + public int getMinCond() { return _minCond; } - public int getChance() - { + public int getChance() { return _chance; } - public int getItemId() - { + public int getItemId() { return _itemId; } } @@ -78,8 +71,7 @@ public class Q00605_AllianceWithKetraOrcs extends Quest private static final int WAHKAN = 31371; // Monsters private static final Map<Integer, DropInfo> MOBS = new HashMap<>(); - static - { + static { MOBS.put(21350, new DropInfo(500, 1)); // Varka Silenos Recruit MOBS.put(21351, new DropInfo(500, 1)); // Varka Silenos Footman MOBS.put(21353, new DropInfo(509, 1)); // Varka Silenos Scout @@ -108,16 +100,14 @@ public class Q00605_AllianceWithKetraOrcs extends Quest private static final int VARKA_BADGE_CAPTAIN = 7218; private static final int VALOR_TOTEM = 7219; private static final int WISDOM_TOTEM = 7220; - private static final int[] KETRA_MARKS = - { + private static final int[] KETRA_MARKS = { 7211, // Mark of Ketra's Alliance - Level 1 7212, // Mark of Ketra's Alliance - Level 2 7213, // Mark of Ketra's Alliance - Level 3 7214, // Mark of Ketra's Alliance - Level 4 7215, // Mark of Ketra's Alliance - Level 5 }; - private static final int[] VARKA_MARKS = - { + private static final int[] VARKA_MARKS = { 7221, // Mark of Varka's Alliance - Level 1 7222, // Mark of Varka's Alliance - Level 2 7223, // Mark of Varka's Alliance - Level 3 @@ -126,24 +116,21 @@ public class Q00605_AllianceWithKetraOrcs extends Quest }; // Misc private static final int MIN_LEVEL = 74; - private static final int[] SOLDIER_BADGE_COUNT = - { + private static final int[] SOLDIER_BADGE_COUNT = { 100, // cond 1 200, // cond 2 300, // cond 3 300, // cond 4 400, // cond 5 }; - private static final int[] OFFICER_BADGE_COUNT = - { + private static final int[] OFFICER_BADGE_COUNT = { 0, // cond 1 100, // cond 2 200, // cond 3 300, // cond 4 400, // cond 5 }; - private static final int[] CAPTAIN_BADGE_COUNT = - { + private static final int[] CAPTAIN_BADGE_COUNT = { 0, // cond 1 0, // cond 2 100, // cond 3 @@ -151,8 +138,7 @@ public class Q00605_AllianceWithKetraOrcs extends Quest 200, // cond 5 }; - public Q00605_AllianceWithKetraOrcs() - { + public Q00605_AllianceWithKetraOrcs() { super(605, Q00605_AllianceWithKetraOrcs.class.getSimpleName(), "Alliance with Ketra Orcs"); addStartNpc(WAHKAN); addTalkId(WAHKAN); @@ -160,11 +146,9 @@ public class Q00605_AllianceWithKetraOrcs extends Quest registerQuestItems(VARKA_BADGE_SOLDIER, VARKA_BADGE_OFFICER, VARKA_BADGE_CAPTAIN); } - private boolean canGetItem(QuestState st, int itemId) - { + private boolean canGetItem(QuestState st, int itemId) { int count = 0; - switch (itemId) - { + switch (itemId) { case VARKA_BADGE_SOLDIER: count = SOLDIER_BADGE_COUNT[st.getCond() - 1]; break; @@ -175,40 +159,33 @@ public class Q00605_AllianceWithKetraOrcs extends Quest count = CAPTAIN_BADGE_COUNT[st.getCond() - 1]; break; } - if (st.getQuestItemsCount(itemId) < count) - { + if (st.getQuestItemsCount(itemId) < count) { return true; } return false; } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "31371-12a.html": case "31371-12b.html": case "31371-25.html": break; case "31371-04.htm": - if (hasAtLeastOneQuestItem(player, VARKA_MARKS)) - { + if (hasAtLeastOneQuestItem(player, VARKA_MARKS)) { return "31371-03.htm"; } st.setState(State.STARTED); st.playSound(Sound.ITEMSOUND_QUEST_ACCEPT); - for (int i = 0; i < KETRA_MARKS.length; i++) - { - if (st.hasQuestItems(KETRA_MARKS[i])) - { + for (int i = 0; i < KETRA_MARKS.length; i++) { + if (st.hasQuestItems(KETRA_MARKS[i])) { st.setCond(i + 2); return "31371-0" + (i + 5) + ".htm"; } @@ -216,8 +193,7 @@ public class Q00605_AllianceWithKetraOrcs extends Quest st.setCond(1); break; case "31371-12.html": - if (st.getQuestItemsCount(VARKA_BADGE_SOLDIER) < SOLDIER_BADGE_COUNT[0]) - { + if (st.getQuestItemsCount(VARKA_BADGE_SOLDIER) < SOLDIER_BADGE_COUNT[0]) { return getNoQuestMsg(player); } st.takeItems(VARKA_BADGE_SOLDIER, -1); @@ -225,8 +201,7 @@ public class Q00605_AllianceWithKetraOrcs extends Quest st.setCond(2, true); break; case "31371-15.html": - if ((st.getQuestItemsCount(VARKA_BADGE_SOLDIER) < SOLDIER_BADGE_COUNT[1]) || (st.getQuestItemsCount(VARKA_BADGE_OFFICER) < OFFICER_BADGE_COUNT[1])) - { + if ((st.getQuestItemsCount(VARKA_BADGE_SOLDIER) < SOLDIER_BADGE_COUNT[1]) || (st.getQuestItemsCount(VARKA_BADGE_OFFICER) < OFFICER_BADGE_COUNT[1])) { return getNoQuestMsg(player); } takeItems(player, -1, VARKA_BADGE_SOLDIER, VARKA_BADGE_OFFICER, KETRA_MARKS[0]); @@ -234,8 +209,7 @@ public class Q00605_AllianceWithKetraOrcs extends Quest st.setCond(3, true); break; case "31371-18.html": - if ((st.getQuestItemsCount(VARKA_BADGE_SOLDIER) < SOLDIER_BADGE_COUNT[2]) || (st.getQuestItemsCount(VARKA_BADGE_OFFICER) < OFFICER_BADGE_COUNT[2]) || (st.getQuestItemsCount(VARKA_BADGE_CAPTAIN) < CAPTAIN_BADGE_COUNT[2])) - { + if ((st.getQuestItemsCount(VARKA_BADGE_SOLDIER) < SOLDIER_BADGE_COUNT[2]) || (st.getQuestItemsCount(VARKA_BADGE_OFFICER) < OFFICER_BADGE_COUNT[2]) || (st.getQuestItemsCount(VARKA_BADGE_CAPTAIN) < CAPTAIN_BADGE_COUNT[2])) { return getNoQuestMsg(player); } takeItems(player, -1, VARKA_BADGE_SOLDIER, VARKA_BADGE_OFFICER, VARKA_BADGE_CAPTAIN, KETRA_MARKS[1]); @@ -243,8 +217,7 @@ public class Q00605_AllianceWithKetraOrcs extends Quest st.setCond(4, true); break; case "31371-21.html": - if (!st.hasQuestItems(VALOR_TOTEM) || (st.getQuestItemsCount(VARKA_BADGE_SOLDIER) < SOLDIER_BADGE_COUNT[3]) || (st.getQuestItemsCount(VARKA_BADGE_OFFICER) < OFFICER_BADGE_COUNT[3]) || (st.getQuestItemsCount(VARKA_BADGE_CAPTAIN) < CAPTAIN_BADGE_COUNT[3])) - { + if (!st.hasQuestItems(VALOR_TOTEM) || (st.getQuestItemsCount(VARKA_BADGE_SOLDIER) < SOLDIER_BADGE_COUNT[3]) || (st.getQuestItemsCount(VARKA_BADGE_OFFICER) < OFFICER_BADGE_COUNT[3]) || (st.getQuestItemsCount(VARKA_BADGE_CAPTAIN) < CAPTAIN_BADGE_COUNT[3])) { return getNoQuestMsg(player); } takeItems(player, -1, VARKA_BADGE_SOLDIER, VARKA_BADGE_OFFICER, VARKA_BADGE_CAPTAIN, VALOR_TOTEM, KETRA_MARKS[2]); @@ -264,15 +237,12 @@ public class Q00605_AllianceWithKetraOrcs extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final L2PcInstance member = getRandomPartyMemberState(killer, State.STARTED); - if (member != null) - { + if (member != null) { final QuestState st = getQuestState(member, false); final DropInfo info = MOBS.get(npc.getId()); - if ((st.getCond() >= info.getMinCond()) && (st.getCond() < 6) && canGetItem(st, info.getItemId()) && (getRandom(1000) < info.getChance())) - { + if ((st.getCond() >= info.getMinCond()) && (st.getCond() < 6) && canGetItem(st, info.getItemId()) && (getRandom(1000) < info.getChance())) { st.giveItems(info.getItemId(), 1); } } @@ -280,18 +250,15 @@ public class Q00605_AllianceWithKetraOrcs extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? "31371-01.htm" : "31371-02.htm"; break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = (st.getQuestItemsCount(VARKA_BADGE_SOLDIER) >= SOLDIER_BADGE_COUNT[0]) ? "31371-11.html" : "31371-10.html"; break; @@ -308,8 +275,7 @@ public class Q00605_AllianceWithKetraOrcs extends Quest break; case 5: if (!st.hasQuestItems(KETRA_MARKS[3]) || !st.hasQuestItems(WISDOM_TOTEM) || (st.getQuestItemsCount(VARKA_BADGE_SOLDIER) < SOLDIER_BADGE_COUNT[4]) || (st.getQuestItemsCount(VARKA_BADGE_OFFICER) < OFFICER_BADGE_COUNT[4]) - || (st.getQuestItemsCount(VARKA_BADGE_CAPTAIN) < CAPTAIN_BADGE_COUNT[4])) - { + || (st.getQuestItemsCount(VARKA_BADGE_CAPTAIN) < CAPTAIN_BADGE_COUNT[4])) { return "31371-22.html"; } st.setCond(6, true); @@ -318,8 +284,7 @@ public class Q00605_AllianceWithKetraOrcs extends Quest htmltext = "31371-23.html"; break; case 6: - if (st.hasQuestItems(KETRA_MARKS[4])) - { + if (st.hasQuestItems(KETRA_MARKS[4])) { htmltext = "31371-24.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00606_BattleAgainstVarkaSilenos/Q00606_BattleAgainstVarkaSilenos.java b/src/main/java/com/l2jserver/datapack/quests/Q00606_BattleAgainstVarkaSilenos/Q00606_BattleAgainstVarkaSilenos.java index 62a422f97f..4bbd74e7cc 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00606_BattleAgainstVarkaSilenos/Q00606_BattleAgainstVarkaSilenos.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00606_BattleAgainstVarkaSilenos/Q00606_BattleAgainstVarkaSilenos.java @@ -32,14 +32,12 @@ import com.l2jserver.gameserver.model.quest.State; * Battle against Varka Silenos (606) * @author malyelfik */ -public class Q00606_BattleAgainstVarkaSilenos extends Quest -{ +public class Q00606_BattleAgainstVarkaSilenos extends Quest { // NPC private static final int KADUN = 31370; // Monsters private static final Map<Integer, Integer> MOBS = new HashMap<>(); - static - { + static { MOBS.put(21350, 500); // Varka Silenos Recruit MOBS.put(21353, 510); // Varka Silenos Scout MOBS.put(21354, 522); // Varka Silenos Hunter @@ -63,8 +61,7 @@ public class Q00606_BattleAgainstVarkaSilenos extends Quest private static final int MIN_LEVEL = 74; private static final int MANE_COUNT = 100; - public Q00606_BattleAgainstVarkaSilenos() - { + public Q00606_BattleAgainstVarkaSilenos() { super(606, Q00606_BattleAgainstVarkaSilenos.class.getSimpleName(), "Battle against Varka Silenos"); addStartNpc(KADUN); addTalkId(KADUN); @@ -73,25 +70,21 @@ public class Q00606_BattleAgainstVarkaSilenos extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "31370-03.htm": st.startQuest(); break; case "31370-06.html": break; case "31370-07.html": - if (st.getQuestItemsCount(MANE) < MANE_COUNT) - { + if (st.getQuestItemsCount(MANE) < MANE_COUNT) { return "31370-08.html"; } st.takeItems(MANE, MANE_COUNT); @@ -108,11 +101,9 @@ public class Q00606_BattleAgainstVarkaSilenos extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final L2PcInstance member = getRandomPartyMember(killer, 1); - if ((member != null) && (getRandom(1000) < MOBS.get(npc.getId()))) - { + if ((member != null) && (getRandom(1000) < MOBS.get(npc.getId()))) { final QuestState st = getQuestState(member, false); st.giveItems(MANE, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); @@ -121,12 +112,10 @@ public class Q00606_BattleAgainstVarkaSilenos extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? "31370-01.htm" : "31370-02.htm"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00607_ProveYourCourageKetra/Q00607_ProveYourCourageKetra.java b/src/main/java/com/l2jserver/datapack/quests/Q00607_ProveYourCourageKetra/Q00607_ProveYourCourageKetra.java index e680a2732d..6c249ad672 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00607_ProveYourCourageKetra/Q00607_ProveYourCourageKetra.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00607_ProveYourCourageKetra/Q00607_ProveYourCourageKetra.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.util.Util; * Prove Your Courage! (Ketra) (607) * @author malyelfik */ -public class Q00607_ProveYourCourageKetra extends Quest -{ +public class Q00607_ProveYourCourageKetra extends Quest { // NPC private static final int KADUN = 31370; // Monster @@ -42,8 +41,7 @@ public class Q00607_ProveYourCourageKetra extends Quest // Misc private static final int MIN_LEVEL = 75; - public Q00607_ProveYourCourageKetra() - { + public Q00607_ProveYourCourageKetra() { super(607, Q00607_ProveYourCourageKetra.class.getSimpleName(), "Prove Your Courage! (Ketra)"); addStartNpc(KADUN); addTalkId(KADUN); @@ -52,40 +50,32 @@ public class Q00607_ProveYourCourageKetra extends Quest } @Override - public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) - { + public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) - { + if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) { st.giveItems(SHADITH_HEAD, 1); st.setCond(2, true); } } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "31370-04.htm": st.startQuest(); break; case "31370-07.html": - if (st.hasQuestItems(SHADITH_HEAD) && st.isCond(2)) - { + if (st.hasQuestItems(SHADITH_HEAD) && st.isCond(2)) { st.giveItems(VALOR_TOTEM, 1); st.addExpAndSp(10000, 0); st.exitQuest(true, true); - } - else - { + } else { htmltext = getNoQuestMsg(player); } break; @@ -97,19 +87,16 @@ public class Q00607_ProveYourCourageKetra extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { executeForEachPlayer(killer, npc, isSummon, true, false); return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? (st.hasQuestItems(KETRA_ALLIANCE_THREE)) ? "31370-01.htm" : "31370-02.htm" : "31370-03.htm"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00608_SlayTheEnemyCommanderKetra/Q00608_SlayTheEnemyCommanderKetra.java b/src/main/java/com/l2jserver/datapack/quests/Q00608_SlayTheEnemyCommanderKetra/Q00608_SlayTheEnemyCommanderKetra.java index e0a5b163c7..738c76eaa1 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00608_SlayTheEnemyCommanderKetra/Q00608_SlayTheEnemyCommanderKetra.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00608_SlayTheEnemyCommanderKetra/Q00608_SlayTheEnemyCommanderKetra.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.util.Util; * Slay the Enemy Commander! (Ketra) (608) * @author malyelfik */ -public class Q00608_SlayTheEnemyCommanderKetra extends Quest -{ +public class Q00608_SlayTheEnemyCommanderKetra extends Quest { // NPC private static final int KADUN = 31370; // Monster @@ -42,8 +41,7 @@ public class Q00608_SlayTheEnemyCommanderKetra extends Quest // Misc private static final int MIN_LEVEL = 75; - public Q00608_SlayTheEnemyCommanderKetra() - { + public Q00608_SlayTheEnemyCommanderKetra() { super(608, Q00608_SlayTheEnemyCommanderKetra.class.getSimpleName(), "Slay the Enemy Commander! (Ketra)"); addStartNpc(KADUN); addTalkId(KADUN); @@ -52,40 +50,32 @@ public class Q00608_SlayTheEnemyCommanderKetra extends Quest } @Override - public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) - { + public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) - { + if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) { st.giveItems(MOS_HEAD, 1); st.setCond(2, true); } } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "31370-04.htm": st.startQuest(); break; case "31370-07.html": - if (st.hasQuestItems(MOS_HEAD) && st.isCond(2)) - { + if (st.hasQuestItems(MOS_HEAD) && st.isCond(2)) { st.giveItems(WISDOM_TOTEM, 1); st.addExpAndSp(10000, 0); st.exitQuest(true, true); - } - else - { + } else { htmltext = getNoQuestMsg(player); } break; @@ -97,19 +87,16 @@ public class Q00608_SlayTheEnemyCommanderKetra extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { executeForEachPlayer(killer, npc, isSummon, true, false); return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? (st.hasQuestItems(KETRA_ALLIANCE_FOUR)) ? "31370-01.htm" : "31370-02.htm" : "31370-03.htm"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00609_MagicalPowerOfWaterPart1/Q00609_MagicalPowerOfWaterPart1.java b/src/main/java/com/l2jserver/datapack/quests/Q00609_MagicalPowerOfWaterPart1/Q00609_MagicalPowerOfWaterPart1.java index 98f596967b..14e5445a10 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00609_MagicalPowerOfWaterPart1/Q00609_MagicalPowerOfWaterPart1.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00609_MagicalPowerOfWaterPart1/Q00609_MagicalPowerOfWaterPart1.java @@ -32,16 +32,14 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * Magical Power of Water - Part 1 (609) * @author Joxit */ -public class Q00609_MagicalPowerOfWaterPart1 extends Quest -{ +public class Q00609_MagicalPowerOfWaterPart1 extends Quest { // NPCs private static final int WAHKAN = 31371; private static final int ASEFA = 31372; private static final int UDANS_BOX = 31561; private static final int UDANS_EYE = 31684; // Monsters - private static final int[] VARKA_MOBS = - { + private static final int[] VARKA_MOBS = { 21350, // Varka Silenos Recruit 21351, // Varka Silenos Footman 21353, // Varka Silenos Scout @@ -69,8 +67,7 @@ public class Q00609_MagicalPowerOfWaterPart1 extends Quest private static final int STOLEN_GREEN_TOTEM = 7237; private static final int WISDOM_STONE = 7081; private static final int GREEN_TOTEM = 7238; - private static final int[] KETRA_MARKS = - { + private static final int[] KETRA_MARKS = { 7211, // Mark of Ketra's Alliance - Level 1 7212, // Mark of Ketra's Alliance - Level 2 7213, // Mark of Ketra's Alliance - Level 3 @@ -83,8 +80,7 @@ public class Q00609_MagicalPowerOfWaterPart1 extends Quest // Misc private static final int MIN_LEVEL = 74; - public Q00609_MagicalPowerOfWaterPart1() - { + public Q00609_MagicalPowerOfWaterPart1() { super(609, Q00609_MagicalPowerOfWaterPart1.class.getSimpleName(), "Magical Power of Water - Part 1"); addStartNpc(WAHKAN); addTalkId(ASEFA, WAHKAN, UDANS_BOX); @@ -93,34 +89,25 @@ public class Q00609_MagicalPowerOfWaterPart1 extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "31371-02.html": st.startQuest(); htmltext = event; break; case "open_box": - if (!st.hasQuestItems(KEY)) - { + if (!st.hasQuestItems(KEY)) { htmltext = "31561-02.html"; - } - else if (st.isCond(2)) - { - if (st.isSet("spawned")) - { + } else if (st.isCond(2)) { + if (st.isSet("spawned")) { st.takeItems(KEY, 1); htmltext = "31561-04.html"; - } - else - { + } else { st.giveItems(STOLEN_GREEN_TOTEM, 1); st.takeItems(KEY, 1); st.setCond(3, true); @@ -137,11 +124,9 @@ public class Q00609_MagicalPowerOfWaterPart1 extends Quest } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { final QuestState st = getQuestState(attacker, false); - if ((st != null) && st.isCond(2) && !st.isSet("spawned")) - { + if ((st != null) && st.isCond(2) && !st.isSet("spawned")) { st.set("spawned", "1"); npc.setTarget(attacker); npc.doCast(GOW); @@ -153,45 +138,36 @@ public class Q00609_MagicalPowerOfWaterPart1 extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case WAHKAN: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? (hasAtLeastOneQuestItem(player, KETRA_MARKS)) ? "31371-01.htm" : "31371-00a.html" : "31371-00b.html"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "31371-03.html"; } break; } break; case ASEFA: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: htmltext = "31372-01.html"; st.setCond(2, true); break; case 2: - if (st.isSet("spawned")) - { + if (st.isSet("spawned")) { st.unset("spawned"); npc.setTarget(player); npc.doCast(DISPEL_GOW); htmltext = "31372-03.html"; - } - else - { + } else { htmltext = "31372-02.html"; } break; @@ -205,8 +181,7 @@ public class Q00609_MagicalPowerOfWaterPart1 extends Quest } break; case UDANS_BOX: - if (st.isCond(2)) - { + if (st.isCond(2)) { htmltext = "31561-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00610_MagicalPowerOfWaterPart2/Q00610_MagicalPowerOfWaterPart2.java b/src/main/java/com/l2jserver/datapack/quests/Q00610_MagicalPowerOfWaterPart2/Q00610_MagicalPowerOfWaterPart2.java index f27c0f1ac8..fc3f5363f7 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00610_MagicalPowerOfWaterPart2/Q00610_MagicalPowerOfWaterPart2.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00610_MagicalPowerOfWaterPart2/Q00610_MagicalPowerOfWaterPart2.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.util.Util; * Magical Power of Water - Part 2 (610) * @author Joxit */ -public class Q00610_MagicalPowerOfWaterPart2 extends Quest -{ +public class Q00610_MagicalPowerOfWaterPart2 extends Quest { // NPCs private static final int ASEFA = 31372; private static final int VARKA_TOTEM = 31560; @@ -47,8 +46,7 @@ public class Q00610_MagicalPowerOfWaterPart2 extends Quest // Misc private static final int MIN_LEVEL = 75; - public Q00610_MagicalPowerOfWaterPart2() - { + public Q00610_MagicalPowerOfWaterPart2() { super(610, Q00610_MagicalPowerOfWaterPart2.class.getSimpleName(), "Magical Power of Water - Part 2"); addStartNpc(ASEFA); addTalkId(ASEFA, VARKA_TOTEM); @@ -57,31 +55,23 @@ public class Q00610_MagicalPowerOfWaterPart2 extends Quest final String test = loadGlobalQuestVar("Q00610_respawn"); final long remain = (!test.isEmpty()) ? (Long.parseLong(test) - System.currentTimeMillis()) : 0; - if (remain > 0) - { + if (remain > 0) { startQuestTimer("spawn_npc", remain, null, null); - } - else - { + } else { addSpawn(VARKA_TOTEM, 105452, -36775, -1050, 34000, false, 0, true); } } @Override - public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) - { + public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && Util.checkIfInRange(1500, npc, player, false)) - { - if (npc.getId() == ASHUTAR) - { - switch (st.getCond()) - { + if ((st != null) && Util.checkIfInRange(1500, npc, player, false)) { + if (npc.getId() == ASHUTAR) { + switch (st.getCond()) { case 1: // take the item and give the heart st.takeItems(GREEN_TOTEM, 1); case 2: - if (!st.hasQuestItems(ASHUTAR_HEART)) - { + if (!st.hasQuestItems(ASHUTAR_HEART)) { st.giveItems(ASHUTAR_HEART, 1); } st.setCond(3, true); @@ -92,32 +82,25 @@ public class Q00610_MagicalPowerOfWaterPart2 extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - if (player != null) - { + if (player != null) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } - switch (event) - { + switch (event) { case "31372-02.html": st.startQuest(); htmltext = event; break; case "give_heart": - if (st.hasQuestItems(ASHUTAR_HEART)) - { + if (st.hasQuestItems(ASHUTAR_HEART)) { st.addExpAndSp(10000, 0); st.exitQuest(true, true); htmltext = "31372-06.html"; - } - else - { + } else { htmltext = "31372-07.html"; } break; @@ -125,17 +108,12 @@ public class Q00610_MagicalPowerOfWaterPart2 extends Quest htmltext = (st.hasQuestItems(GREEN_TOTEM)) ? spawnAshutar(npc, st) : "31560-04.html"; break; } - } - else - { - if (event.equals("despawn_ashutar")) - { + } else { + if (event.equals("despawn_ashutar")) { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.THE_POWER_OF_CONSTRAINT_IS_GETTING_WEAKER_YOUR_RITUAL_HAS_FAILED)); npc.deleteMe(); addSpawn(VARKA_TOTEM, 105452, -36775, -1050, 34000, false, 0, true); - } - else if (event.equals("spawn_npc")) - { + } else if (event.equals("spawn_npc")) { addSpawn(VARKA_TOTEM, 105452, -36775, -1050, 34000, false, 0, true); } } @@ -143,8 +121,7 @@ public class Q00610_MagicalPowerOfWaterPart2 extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final int respawnMinDelay = (int) (43200000 * npc().getRaidMinRespawnMultiplier()); final int respawnMaxDelay = (int) (129600000 * npc().getRaidMaxRespawnMultiplier()); final int respawnDelay = getRandom(respawnMinDelay, respawnMaxDelay); @@ -156,15 +133,12 @@ public class Q00610_MagicalPowerOfWaterPart2 extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case ASEFA: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? (st.hasQuestItems(GREEN_TOTEM)) ? "31372-01.htm" : "31372-00a.html" : "31372-00b.html"; break; @@ -174,10 +148,8 @@ public class Q00610_MagicalPowerOfWaterPart2 extends Quest } break; case VARKA_TOTEM: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: htmltext = "31560-01.html"; break; @@ -194,14 +166,11 @@ public class Q00610_MagicalPowerOfWaterPart2 extends Quest return htmltext; } - private String spawnAshutar(L2Npc npc, QuestState st) - { - if (getQuestTimer("spawn_npc", null, null) != null) - { + private String spawnAshutar(L2Npc npc, QuestState st) { + if (getQuestTimer("spawn_npc", null, null) != null) { return "31560-03.html"; } - if (st.isCond(1)) - { + if (st.isCond(1)) { st.takeItems(GREEN_TOTEM, 1); st.setCond(2, true); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00611_AllianceWithVarkaSilenos/Q00611_AllianceWithVarkaSilenos.java b/src/main/java/com/l2jserver/datapack/quests/Q00611_AllianceWithVarkaSilenos/Q00611_AllianceWithVarkaSilenos.java index b4c0d4c609..330c549092 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00611_AllianceWithVarkaSilenos/Q00611_AllianceWithVarkaSilenos.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00611_AllianceWithVarkaSilenos/Q00611_AllianceWithVarkaSilenos.java @@ -32,20 +32,16 @@ import com.l2jserver.gameserver.model.quest.State; * Alliance with Varka Silenos (611) * @author malyelfik */ -public class Q00611_AllianceWithVarkaSilenos extends Quest -{ - private static class DropInfo - { +public class Q00611_AllianceWithVarkaSilenos extends Quest { + private static class DropInfo { private final int _chance; private final int _minCond; private final int _itemId; - public DropInfo(int chance, int minCond) - { + public DropInfo(int chance, int minCond) { _chance = chance; _minCond = minCond; - switch (_minCond) - { + switch (_minCond) { case 1: _itemId = KETRA_BADGE_SOLDIER; break; @@ -58,18 +54,15 @@ public class Q00611_AllianceWithVarkaSilenos extends Quest } } - public int getMinCond() - { + public int getMinCond() { return _minCond; } - public int getChance() - { + public int getChance() { return _chance; } - public int getItemId() - { + public int getItemId() { return _itemId; } } @@ -78,8 +71,7 @@ public class Q00611_AllianceWithVarkaSilenos extends Quest private static final int NARAN_ASHANUK = 31378; // Monsters private static final Map<Integer, DropInfo> MOBS = new HashMap<>(); - static - { + static { MOBS.put(21324, new DropInfo(500, 1)); // Ketra Orc Footman MOBS.put(21325, new DropInfo(500, 1)); // Ketra's War Hound MOBS.put(21327, new DropInfo(509, 1)); // Ketra Orc Raider @@ -108,16 +100,14 @@ public class Q00611_AllianceWithVarkaSilenos extends Quest private static final int KETRA_BADGE_CAPTAIN = 7228; private static final int VALOR_FEATHER = 7229; private static final int WISDOM_FEATHER = 7230; - private static final int[] KETRA_MARKS = - { + private static final int[] KETRA_MARKS = { 7211, // Mark of Ketra's Alliance - Level 1 7212, // Mark of Ketra's Alliance - Level 2 7213, // Mark of Ketra's Alliance - Level 3 7214, // Mark of Ketra's Alliance - Level 4 7215, // Mark of Ketra's Alliance - Level 5 }; - private static final int[] VARKA_MARKS = - { + private static final int[] VARKA_MARKS = { 7221, // Mark of Varka's Alliance - Level 1 7222, // Mark of Varka's Alliance - Level 2 7223, // Mark of Varka's Alliance - Level 3 @@ -126,24 +116,21 @@ public class Q00611_AllianceWithVarkaSilenos extends Quest }; // Misc private static final int MIN_LEVEL = 74; - private static final int[] SOLDIER_BADGE_COUNT = - { + private static final int[] SOLDIER_BADGE_COUNT = { 100, // cond 1 200, // cond 2 300, // cond 3 300, // cond 4 400, // cond 5 }; - private static final int[] OFFICER_BADGE_COUNT = - { + private static final int[] OFFICER_BADGE_COUNT = { 0, // cond 1 100, // cond 2 200, // cond 3 300, // cond 4 400, // cond 5 }; - private static final int[] CAPTAIN_BADGE_COUNT = - { + private static final int[] CAPTAIN_BADGE_COUNT = { 0, // cond 1 0, // cond 2 100, // cond 3 @@ -151,8 +138,7 @@ public class Q00611_AllianceWithVarkaSilenos extends Quest 200, // cond 5 }; - public Q00611_AllianceWithVarkaSilenos() - { + public Q00611_AllianceWithVarkaSilenos() { super(611, Q00611_AllianceWithVarkaSilenos.class.getSimpleName(), "Alliance with Varka Silenos"); addStartNpc(NARAN_ASHANUK); addTalkId(NARAN_ASHANUK); @@ -160,11 +146,9 @@ public class Q00611_AllianceWithVarkaSilenos extends Quest registerQuestItems(KETRA_BADGE_CAPTAIN, KETRA_BADGE_OFFICER, KETRA_BADGE_SOLDIER); } - private boolean canGetItem(QuestState st, int itemId) - { + private boolean canGetItem(QuestState st, int itemId) { int count = 0; - switch (itemId) - { + switch (itemId) { case KETRA_BADGE_SOLDIER: count = SOLDIER_BADGE_COUNT[st.getCond() - 1]; break; @@ -175,40 +159,33 @@ public class Q00611_AllianceWithVarkaSilenos extends Quest count = CAPTAIN_BADGE_COUNT[st.getCond() - 1]; break; } - if (st.getQuestItemsCount(itemId) < count) - { + if (st.getQuestItemsCount(itemId) < count) { return true; } return false; } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "31378-12a.html": case "31378-12b.html": case "31378-25.html": break; case "31378-04.htm": - if (hasAtLeastOneQuestItem(player, KETRA_MARKS)) - { + if (hasAtLeastOneQuestItem(player, KETRA_MARKS)) { return "31378-03.htm"; } st.setState(State.STARTED); st.playSound(Sound.ITEMSOUND_QUEST_ACCEPT); - for (int i = 0; i < VARKA_MARKS.length; i++) - { - if (st.hasQuestItems(VARKA_MARKS[i])) - { + for (int i = 0; i < VARKA_MARKS.length; i++) { + if (st.hasQuestItems(VARKA_MARKS[i])) { st.setCond(i + 2); return "31378-0" + (i + 5) + ".htm"; } @@ -216,8 +193,7 @@ public class Q00611_AllianceWithVarkaSilenos extends Quest st.setCond(1); break; case "31378-12.html": - if (st.getQuestItemsCount(KETRA_BADGE_SOLDIER) < SOLDIER_BADGE_COUNT[0]) - { + if (st.getQuestItemsCount(KETRA_BADGE_SOLDIER) < SOLDIER_BADGE_COUNT[0]) { return getNoQuestMsg(player); } st.takeItems(KETRA_BADGE_SOLDIER, -1); @@ -225,8 +201,7 @@ public class Q00611_AllianceWithVarkaSilenos extends Quest st.setCond(2, true); break; case "31378-15.html": - if ((st.getQuestItemsCount(KETRA_BADGE_SOLDIER) < SOLDIER_BADGE_COUNT[1]) || (st.getQuestItemsCount(KETRA_BADGE_OFFICER) < OFFICER_BADGE_COUNT[1])) - { + if ((st.getQuestItemsCount(KETRA_BADGE_SOLDIER) < SOLDIER_BADGE_COUNT[1]) || (st.getQuestItemsCount(KETRA_BADGE_OFFICER) < OFFICER_BADGE_COUNT[1])) { return getNoQuestMsg(player); } takeItems(player, -1, KETRA_BADGE_SOLDIER, KETRA_BADGE_OFFICER, VARKA_MARKS[0]); @@ -234,8 +209,7 @@ public class Q00611_AllianceWithVarkaSilenos extends Quest st.setCond(3, true); break; case "31378-18.html": - if ((st.getQuestItemsCount(KETRA_BADGE_SOLDIER) < SOLDIER_BADGE_COUNT[2]) || (st.getQuestItemsCount(KETRA_BADGE_OFFICER) < OFFICER_BADGE_COUNT[2]) || (st.getQuestItemsCount(KETRA_BADGE_CAPTAIN) < CAPTAIN_BADGE_COUNT[2])) - { + if ((st.getQuestItemsCount(KETRA_BADGE_SOLDIER) < SOLDIER_BADGE_COUNT[2]) || (st.getQuestItemsCount(KETRA_BADGE_OFFICER) < OFFICER_BADGE_COUNT[2]) || (st.getQuestItemsCount(KETRA_BADGE_CAPTAIN) < CAPTAIN_BADGE_COUNT[2])) { return getNoQuestMsg(player); } takeItems(player, -1, KETRA_BADGE_SOLDIER, KETRA_BADGE_OFFICER, KETRA_BADGE_CAPTAIN, VARKA_MARKS[1]); @@ -243,8 +217,7 @@ public class Q00611_AllianceWithVarkaSilenos extends Quest st.setCond(4, true); break; case "31378-21.html": - if (!st.hasQuestItems(VALOR_FEATHER) || (st.getQuestItemsCount(KETRA_BADGE_SOLDIER) < SOLDIER_BADGE_COUNT[3]) || (st.getQuestItemsCount(KETRA_BADGE_OFFICER) < OFFICER_BADGE_COUNT[3]) || (st.getQuestItemsCount(KETRA_BADGE_CAPTAIN) < CAPTAIN_BADGE_COUNT[3])) - { + if (!st.hasQuestItems(VALOR_FEATHER) || (st.getQuestItemsCount(KETRA_BADGE_SOLDIER) < SOLDIER_BADGE_COUNT[3]) || (st.getQuestItemsCount(KETRA_BADGE_OFFICER) < OFFICER_BADGE_COUNT[3]) || (st.getQuestItemsCount(KETRA_BADGE_CAPTAIN) < CAPTAIN_BADGE_COUNT[3])) { return getNoQuestMsg(player); } takeItems(player, -1, KETRA_BADGE_SOLDIER, KETRA_BADGE_OFFICER, KETRA_BADGE_CAPTAIN, VALOR_FEATHER, VARKA_MARKS[2]); @@ -264,15 +237,12 @@ public class Q00611_AllianceWithVarkaSilenos extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final L2PcInstance member = getRandomPartyMemberState(killer, State.STARTED); - if (member != null) - { + if (member != null) { final QuestState st = getQuestState(member, false); final DropInfo info = MOBS.get(npc.getId()); - if ((st.getCond() >= info.getMinCond()) && (st.getCond() < 6) && canGetItem(st, info.getItemId()) && (getRandom(1000) < info.getChance())) - { + if ((st.getCond() >= info.getMinCond()) && (st.getCond() < 6) && canGetItem(st, info.getItemId()) && (getRandom(1000) < info.getChance())) { st.giveItems(info.getItemId(), 1); } } @@ -280,18 +250,15 @@ public class Q00611_AllianceWithVarkaSilenos extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? "31378-01.htm" : "31378-02.htm"; break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = (st.getQuestItemsCount(KETRA_BADGE_SOLDIER) >= SOLDIER_BADGE_COUNT[0]) ? "31378-11.html" : "31378-10.html"; break; @@ -308,8 +275,7 @@ public class Q00611_AllianceWithVarkaSilenos extends Quest break; case 5: if (!st.hasQuestItems(VARKA_MARKS[3]) || !st.hasQuestItems(WISDOM_FEATHER) || (st.getQuestItemsCount(KETRA_BADGE_SOLDIER) < SOLDIER_BADGE_COUNT[4]) || (st.getQuestItemsCount(KETRA_BADGE_OFFICER) < OFFICER_BADGE_COUNT[4]) - || (st.getQuestItemsCount(KETRA_BADGE_CAPTAIN) < CAPTAIN_BADGE_COUNT[4])) - { + || (st.getQuestItemsCount(KETRA_BADGE_CAPTAIN) < CAPTAIN_BADGE_COUNT[4])) { return "31378-22.html"; } st.setCond(6, true); @@ -318,8 +284,7 @@ public class Q00611_AllianceWithVarkaSilenos extends Quest htmltext = "31378-23.html"; break; case 6: - if (st.hasQuestItems(VARKA_MARKS[4])) - { + if (st.hasQuestItems(VARKA_MARKS[4])) { htmltext = "31378-24.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00612_BattleAgainstKetraOrcs/Q00612_BattleAgainstKetraOrcs.java b/src/main/java/com/l2jserver/datapack/quests/Q00612_BattleAgainstKetraOrcs/Q00612_BattleAgainstKetraOrcs.java index e3c1415cea..badbff78fa 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00612_BattleAgainstKetraOrcs/Q00612_BattleAgainstKetraOrcs.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00612_BattleAgainstKetraOrcs/Q00612_BattleAgainstKetraOrcs.java @@ -32,14 +32,12 @@ import com.l2jserver.gameserver.model.quest.State; * Battle against Ketra Orcs (612) * @author malyelfik */ -public class Q00612_BattleAgainstKetraOrcs extends Quest -{ +public class Q00612_BattleAgainstKetraOrcs extends Quest { // NPC private static final int ASHAS = 31377; // Monsters private static final Map<Integer, Integer> MOBS = new HashMap<>(); - static - { + static { MOBS.put(21324, 500); // Ketra Orc Footman MOBS.put(21327, 510); // Ketra Orc Raider MOBS.put(21328, 522); // Ketra Orc Scout @@ -63,8 +61,7 @@ public class Q00612_BattleAgainstKetraOrcs extends Quest private static final int MIN_LEVEL = 74; private static final int MOLAR_COUNT = 100; - public Q00612_BattleAgainstKetraOrcs() - { + public Q00612_BattleAgainstKetraOrcs() { super(612, Q00612_BattleAgainstKetraOrcs.class.getSimpleName(), "Battle against Ketra Orcs"); addStartNpc(ASHAS); addTalkId(ASHAS); @@ -73,25 +70,21 @@ public class Q00612_BattleAgainstKetraOrcs extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "31377-03.htm": st.startQuest(); break; case "31377-06.html": break; case "31377-07.html": - if (st.getQuestItemsCount(MOLAR) < MOLAR_COUNT) - { + if (st.getQuestItemsCount(MOLAR) < MOLAR_COUNT) { return "31377-08.html"; } st.takeItems(MOLAR, MOLAR_COUNT); @@ -108,11 +101,9 @@ public class Q00612_BattleAgainstKetraOrcs extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final L2PcInstance member = getRandomPartyMember(killer, 1); - if ((member != null) && (getRandom(1000) < MOBS.get(npc.getId()))) - { + if ((member != null) && (getRandom(1000) < MOBS.get(npc.getId()))) { final QuestState st = getQuestState(member, false); st.giveItems(MOLAR, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); @@ -121,12 +112,10 @@ public class Q00612_BattleAgainstKetraOrcs extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? "31377-01.htm" : "31377-02.htm"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00613_ProveYourCourageVarka/Q00613_ProveYourCourageVarka.java b/src/main/java/com/l2jserver/datapack/quests/Q00613_ProveYourCourageVarka/Q00613_ProveYourCourageVarka.java index 97963b01ae..c22fbc6d11 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00613_ProveYourCourageVarka/Q00613_ProveYourCourageVarka.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00613_ProveYourCourageVarka/Q00613_ProveYourCourageVarka.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.util.Util; * Prove Your Courage! (Varka) (613) * @author malyelfik */ -public class Q00613_ProveYourCourageVarka extends Quest -{ +public class Q00613_ProveYourCourageVarka extends Quest { // NPC private static final int ASHAS = 31377; // Monster @@ -42,8 +41,7 @@ public class Q00613_ProveYourCourageVarka extends Quest // Misc private static final int MIN_LEVEL = 75; - public Q00613_ProveYourCourageVarka() - { + public Q00613_ProveYourCourageVarka() { super(613, Q00613_ProveYourCourageVarka.class.getSimpleName(), "Prove Your Courage! (Varka)"); addStartNpc(ASHAS); addTalkId(ASHAS); @@ -52,40 +50,32 @@ public class Q00613_ProveYourCourageVarka extends Quest } @Override - public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) - { + public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) - { + if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) { st.giveItems(HEKATON_HEAD, 1); st.setCond(2, true); } } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "31377-04.htm": st.startQuest(); break; case "31377-07.html": - if (st.hasQuestItems(HEKATON_HEAD) && st.isCond(2)) - { + if (st.hasQuestItems(HEKATON_HEAD) && st.isCond(2)) { st.giveItems(VALOR_FEATHER, 1); st.addExpAndSp(10000, 0); st.exitQuest(true, true); - } - else - { + } else { htmltext = getNoQuestMsg(player); } break; @@ -97,19 +87,16 @@ public class Q00613_ProveYourCourageVarka extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { executeForEachPlayer(killer, npc, isSummon, true, false); return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? (st.hasQuestItems(VARKA_ALLIANCE_THREE)) ? "31377-01.htm" : "31377-02.htm" : "31377-03.htm"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00614_SlayTheEnemyCommanderVarka/Q00614_SlayTheEnemyCommanderVarka.java b/src/main/java/com/l2jserver/datapack/quests/Q00614_SlayTheEnemyCommanderVarka/Q00614_SlayTheEnemyCommanderVarka.java index 7441318ae5..c2614ebe49 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00614_SlayTheEnemyCommanderVarka/Q00614_SlayTheEnemyCommanderVarka.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00614_SlayTheEnemyCommanderVarka/Q00614_SlayTheEnemyCommanderVarka.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.util.Util; * Slay the Enemy Commander! (Varka) (614) * @author malyelfik */ -public class Q00614_SlayTheEnemyCommanderVarka extends Quest -{ +public class Q00614_SlayTheEnemyCommanderVarka extends Quest { // NPC private static final int ASHAS = 31377; // Monster @@ -42,8 +41,7 @@ public class Q00614_SlayTheEnemyCommanderVarka extends Quest // Misc private static final int MIN_LEVEL = 75; - public Q00614_SlayTheEnemyCommanderVarka() - { + public Q00614_SlayTheEnemyCommanderVarka() { super(614, Q00614_SlayTheEnemyCommanderVarka.class.getSimpleName(), "Slay the Enemy Commander! (Varka)"); addStartNpc(ASHAS); addTalkId(ASHAS); @@ -52,40 +50,32 @@ public class Q00614_SlayTheEnemyCommanderVarka extends Quest } @Override - public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) - { + public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) - { + if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) { st.giveItems(TAYR_HEAD, 1); st.setCond(2, true); } } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "31377-04.htm": st.startQuest(); break; case "31377-07.html": - if (st.hasQuestItems(TAYR_HEAD) && st.isCond(2)) - { + if (st.hasQuestItems(TAYR_HEAD) && st.isCond(2)) { st.giveItems(WISDOM_FEATHER, 1); st.addExpAndSp(10000, 0); st.exitQuest(true, true); - } - else - { + } else { htmltext = getNoQuestMsg(player); } break; @@ -97,19 +87,16 @@ public class Q00614_SlayTheEnemyCommanderVarka extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { executeForEachPlayer(killer, npc, isSummon, true, false); return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? (st.hasQuestItems(VARKA_ALLIANCE_FOUR)) ? "31377-01.htm" : "31377-02.htm" : "31377-03.htm"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00615_MagicalPowerOfFirePart1/Q00615_MagicalPowerOfFirePart1.java b/src/main/java/com/l2jserver/datapack/quests/Q00615_MagicalPowerOfFirePart1/Q00615_MagicalPowerOfFirePart1.java index 769c487c13..8c5dcd3296 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00615_MagicalPowerOfFirePart1/Q00615_MagicalPowerOfFirePart1.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00615_MagicalPowerOfFirePart1/Q00615_MagicalPowerOfFirePart1.java @@ -32,16 +32,14 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * Magical Power of Fire - Part 1 (615) * @author Joxit */ -public class Q00615_MagicalPowerOfFirePart1 extends Quest -{ +public class Q00615_MagicalPowerOfFirePart1 extends Quest { // NPCs private static final int NARAN = 31378; private static final int UDAN = 31379; private static final int ASEFA_BOX = 31559; private static final int ASEFA_EYE = 31684; // Monsters - private static final int[] KETRA_MOBS = - { + private static final int[] KETRA_MOBS = { 21324, // Ketra Orc Footman 21325, // Ketra's War Hound 21327, // Ketra Orc Raider @@ -69,8 +67,7 @@ public class Q00615_MagicalPowerOfFirePart1 extends Quest private static final int STOLEN_RED_TOTEM = 7242; private static final int WISDOM_STONE = 7081; private static final int RED_TOTEM = 7243; - private static final int[] VARKA_MARKS = - { + private static final int[] VARKA_MARKS = { 7221, // Mark of Varka's Alliance - Level 1 7222, // Mark of Varka's Alliance - Level 2 7223, // Mark of Varka's Alliance - Level 3 @@ -83,8 +80,7 @@ public class Q00615_MagicalPowerOfFirePart1 extends Quest // Misc private static final int MIN_LEVEL = 74; - public Q00615_MagicalPowerOfFirePart1() - { + public Q00615_MagicalPowerOfFirePart1() { super(615, Q00615_MagicalPowerOfFirePart1.class.getSimpleName(), "Magical Power of Fire - Part 1"); addStartNpc(NARAN); addTalkId(UDAN, NARAN, ASEFA_BOX); @@ -93,34 +89,25 @@ public class Q00615_MagicalPowerOfFirePart1 extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "31378-02.html": st.startQuest(); htmltext = event; break; case "open_box": - if (!st.hasQuestItems(KEY)) - { + if (!st.hasQuestItems(KEY)) { htmltext = "31559-02.html"; - } - else if (st.isCond(2)) - { - if (st.isSet("spawned")) - { + } else if (st.isCond(2)) { + if (st.isSet("spawned")) { st.takeItems(KEY, 1); htmltext = "31559-04.html"; - } - else - { + } else { st.giveItems(STOLEN_RED_TOTEM, 1); st.takeItems(KEY, 1); st.setCond(3, true); @@ -137,11 +124,9 @@ public class Q00615_MagicalPowerOfFirePart1 extends Quest } @Override - public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) - { + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { final QuestState st = getQuestState(attacker, false); - if ((st != null) && st.isCond(2) && !st.isSet("spawned")) - { + if ((st != null) && st.isCond(2) && !st.isSet("spawned")) { st.set("spawned", "1"); npc.setTarget(attacker); npc.doCast(GOW); @@ -153,45 +138,36 @@ public class Q00615_MagicalPowerOfFirePart1 extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case NARAN: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? (hasAtLeastOneQuestItem(player, VARKA_MARKS)) ? "31378-01.htm" : "31378-00a.html" : "31378-00b.html"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "31378-03.html"; } break; } break; case UDAN: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: htmltext = "31379-01.html"; st.setCond(2, true); break; case 2: - if (st.isSet("spawned")) - { + if (st.isSet("spawned")) { st.unset("spawned"); npc.setTarget(player); npc.doCast(DISPEL_GOW.getSkill()); htmltext = "31379-03.html"; - } - else - { + } else { htmltext = "31379-02.html"; } break; @@ -205,8 +181,7 @@ public class Q00615_MagicalPowerOfFirePart1 extends Quest } break; case ASEFA_BOX: - if (st.isCond(2)) - { + if (st.isCond(2)) { htmltext = "31559-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00616_MagicalPowerOfFirePart2/Q00616_MagicalPowerOfFirePart2.java b/src/main/java/com/l2jserver/datapack/quests/Q00616_MagicalPowerOfFirePart2/Q00616_MagicalPowerOfFirePart2.java index 963e269679..8af92c8290 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00616_MagicalPowerOfFirePart2/Q00616_MagicalPowerOfFirePart2.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00616_MagicalPowerOfFirePart2/Q00616_MagicalPowerOfFirePart2.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.util.Util; * Magical Power of Fire - Part 2 (616) * @author Joxit */ -public class Q00616_MagicalPowerOfFirePart2 extends Quest -{ +public class Q00616_MagicalPowerOfFirePart2 extends Quest { // NPCs private static final int UDAN = 31379; private static final int KETRA_TOTEM = 31558; @@ -47,8 +46,7 @@ public class Q00616_MagicalPowerOfFirePart2 extends Quest // Misc private static final int MIN_LEVEL = 75; - public Q00616_MagicalPowerOfFirePart2() - { + public Q00616_MagicalPowerOfFirePart2() { super(616, Q00616_MagicalPowerOfFirePart2.class.getSimpleName(), "Magical Power of Fire - Part 2"); addStartNpc(UDAN); addTalkId(UDAN, KETRA_TOTEM); @@ -57,31 +55,23 @@ public class Q00616_MagicalPowerOfFirePart2 extends Quest final String test = loadGlobalQuestVar("Q00616_respawn"); final long remain = (!test.isEmpty()) ? (Long.parseLong(test) - System.currentTimeMillis()) : 0; - if (remain > 0) - { + if (remain > 0) { startQuestTimer("spawn_npc", remain, null, null); - } - else - { + } else { addSpawn(KETRA_TOTEM, 142368, -82512, -6487, 58000, false, 0, true); } } @Override - public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) - { + public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && Util.checkIfInRange(1500, npc, player, false)) - { - if (npc.getId() == NASTRON) - { - switch (st.getCond()) - { + if ((st != null) && Util.checkIfInRange(1500, npc, player, false)) { + if (npc.getId() == NASTRON) { + switch (st.getCond()) { case 1: // take the item and give the heart st.takeItems(RED_TOTEM, 1); case 2: - if (!st.hasQuestItems(NASTRON_HEART)) - { + if (!st.hasQuestItems(NASTRON_HEART)) { st.giveItems(NASTRON_HEART, 1); } st.setCond(3, true); @@ -92,32 +82,25 @@ public class Q00616_MagicalPowerOfFirePart2 extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - if (player != null) - { + if (player != null) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } - switch (event) - { + switch (event) { case "31379-02.html": st.startQuest(); htmltext = event; break; case "give_heart": - if (st.hasQuestItems(NASTRON_HEART)) - { + if (st.hasQuestItems(NASTRON_HEART)) { st.addExpAndSp(10000, 0); st.exitQuest(true, true); htmltext = "31379-06.html"; - } - else - { + } else { htmltext = "31379-07.html"; } break; @@ -125,17 +108,12 @@ public class Q00616_MagicalPowerOfFirePart2 extends Quest htmltext = (st.hasQuestItems(RED_TOTEM)) ? spawnNastron(npc, st) : "31558-04.html"; break; } - } - else - { - if (event.equals("despawn_nastron")) - { + } else { + if (event.equals("despawn_nastron")) { npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.THE_POWER_OF_CONSTRAINT_IS_GETTING_WEAKER_YOUR_RITUAL_HAS_FAILED)); npc.deleteMe(); addSpawn(KETRA_TOTEM, 142368, -82512, -6487, 58000, false, 0, true); - } - else if (event.equals("spawn_npc")) - { + } else if (event.equals("spawn_npc")) { addSpawn(KETRA_TOTEM, 142368, -82512, -6487, 58000, false, 0, true); } } @@ -143,8 +121,7 @@ public class Q00616_MagicalPowerOfFirePart2 extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final int respawnMinDelay = (int) (43200000 * npc().getRaidMinRespawnMultiplier()); final int respawnMaxDelay = (int) (129600000 * npc().getRaidMaxRespawnMultiplier()); final int respawnDelay = getRandom(respawnMinDelay, respawnMaxDelay); @@ -156,15 +133,12 @@ public class Q00616_MagicalPowerOfFirePart2 extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case UDAN: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? (st.hasQuestItems(RED_TOTEM)) ? "31379-01.htm" : "31379-00a.html" : "31379-00b.html"; break; @@ -174,10 +148,8 @@ public class Q00616_MagicalPowerOfFirePart2 extends Quest } break; case KETRA_TOTEM: - if (st.isStarted()) - { - switch (st.getCond()) - { + if (st.isStarted()) { + switch (st.getCond()) { case 1: htmltext = "31558-01.html"; break; @@ -194,14 +166,11 @@ public class Q00616_MagicalPowerOfFirePart2 extends Quest return htmltext; } - private String spawnNastron(L2Npc npc, QuestState st) - { - if (getQuestTimer("spawn_npc", null, null) != null) - { + private String spawnNastron(L2Npc npc, QuestState st) { + if (getQuestTimer("spawn_npc", null, null) != null) { return "31558-03.html"; } - if (st.isCond(1)) - { + if (st.isCond(1)) { st.takeItems(RED_TOTEM, 1); st.setCond(2, true); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00617_GatherTheFlames/Q00617_GatherTheFlames.java b/src/main/java/com/l2jserver/datapack/quests/Q00617_GatherTheFlames/Q00617_GatherTheFlames.java index 1377e81fa0..fcfeff0e63 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00617_GatherTheFlames/Q00617_GatherTheFlames.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00617_GatherTheFlames/Q00617_GatherTheFlames.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Gather the Flames (617) * @author malyelfik */ -public class Q00617_GatherTheFlames extends Quest -{ +public class Q00617_GatherTheFlames extends Quest { // NPCs private static final int HILDA = 31271; private static final int VULCAN = 31539; @@ -40,8 +39,7 @@ public class Q00617_GatherTheFlames extends Quest // Item private static final int TORCH = 7264; // Reward - private static final int[] REWARD = - { + private static final int[] REWARD = { 6881, 6883, 6885, @@ -57,8 +55,7 @@ public class Q00617_GatherTheFlames extends Quest // Monsters private static final Map<Integer, Integer> MOBS = new HashMap<>(); - static - { + static { MOBS.put(22634, 639); MOBS.put(22635, 611); MOBS.put(22636, 649); @@ -77,8 +74,7 @@ public class Q00617_GatherTheFlames extends Quest MOBS.put(22649, 685); } - public Q00617_GatherTheFlames() - { + public Q00617_GatherTheFlames() { super(617, Q00617_GatherTheFlames.class.getSimpleName(), "Gather the Flames"); addStartNpc(HILDA, VULCAN); addTalkId(ROONEY, HILDA, VULCAN); @@ -87,17 +83,14 @@ public class Q00617_GatherTheFlames extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } String htmltext = event; - switch (event) - { + switch (event) { case "31539-03.htm": case "31271-03.htm": st.startQuest(); @@ -107,8 +100,7 @@ public class Q00617_GatherTheFlames extends Quest case "31539-06.html": break; case "31539-07.html": - if ((st.getQuestItemsCount(TORCH) < 1000) || !st.isStarted()) - { + if ((st.getQuestItemsCount(TORCH) < 1000) || !st.isStarted()) { return getNoQuestMsg(player); } st.giveItems(REWARD[getRandom(REWARD.length)], 1); @@ -125,8 +117,7 @@ public class Q00617_GatherTheFlames extends Quest case "6895": case "6897": case "6899": - if ((st.getQuestItemsCount(TORCH) < 1200) || !st.isStarted()) - { + if ((st.getQuestItemsCount(TORCH) < 1200) || !st.isStarted()) { return getNoQuestMsg(player); } st.giveItems(Integer.valueOf(event), 1); @@ -135,8 +126,7 @@ public class Q00617_GatherTheFlames extends Quest break; case "6887": case "6881": - if ((st.getQuestItemsCount(TORCH) < 1200) || !st.isStarted()) - { + if ((st.getQuestItemsCount(TORCH) < 1200) || !st.isStarted()) { return getNoQuestMsg(player); } st.giveItems(Integer.valueOf(event), 1); @@ -151,22 +141,17 @@ public class Q00617_GatherTheFlames extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(player, 1); - if (partyMember == null) - { + if (partyMember == null) { return super.onKill(npc, player, isSummon); } final QuestState st = getQuestState(partyMember, false); - if (getRandom(1000) < MOBS.get(npc.getId())) - { + if (getRandom(1000) < MOBS.get(npc.getId())) { st.giveItems(TORCH, 2); - } - else - { + } else { st.giveItems(TORCH, 1); } st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); @@ -174,35 +159,26 @@ public class Q00617_GatherTheFlames extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case ROONEY: - if (st.isStarted()) - { + if (st.isStarted()) { htmltext = (st.getQuestItemsCount(TORCH) >= 1200) ? "32049-02.html" : "32049-01.html"; } break; case VULCAN: - if (st.isCreated()) - { + if (st.isCreated()) { htmltext = (player.getLevel() >= 74) ? "31539-01.htm" : "31539-02.htm"; - } - else - { + } else { htmltext = (st.getQuestItemsCount(TORCH) >= 1000) ? "31539-04.html" : "31539-05.html"; } break; case HILDA: - if (st.isCreated()) - { + if (st.isCreated()) { htmltext = (player.getLevel() >= 74) ? "31271-01.htm" : "31271-02.htm"; - } - else - { + } else { htmltext = "31271-04.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00618_IntoTheFlame/Q00618_IntoTheFlame.java b/src/main/java/com/l2jserver/datapack/quests/Q00618_IntoTheFlame/Q00618_IntoTheFlame.java index c9d2d586c1..7c4e03763e 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00618_IntoTheFlame/Q00618_IntoTheFlame.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00618_IntoTheFlame/Q00618_IntoTheFlame.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Into The Flame (618) * @author St3eT */ -public class Q00618_IntoTheFlame extends Quest -{ +public class Q00618_IntoTheFlame extends Quest { // NPCs private static final int KLEIN = 31540; private static final int HILDA = 31271; @@ -45,8 +44,7 @@ public class Q00618_IntoTheFlame extends Quest // Misc private static final int MIN_LEVEL = 60; private static final int REQUIRED_COUNT = 50; - static - { + static { MONSTERS.put(21274, 630); MONSTERS.put(21276, 630); MONSTERS.put(21282, 670); @@ -57,8 +55,7 @@ public class Q00618_IntoTheFlame extends Quest MONSTERS.put(21292, 710); } - public Q00618_IntoTheFlame() - { + public Q00618_IntoTheFlame() { super(618, Q00618_IntoTheFlame.class.getSimpleName(), "Into the Flame"); addStartNpc(KLEIN); addTalkId(HILDA, KLEIN); @@ -67,49 +64,39 @@ public class Q00618_IntoTheFlame extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "31540-03.htm": st.startQuest(); htmltext = event; break; case "31540-05.html": - if (!st.hasQuestItems(VACUALITE)) - { + if (!st.hasQuestItems(VACUALITE)) { htmltext = "31540-03.htm"; - } - else - { + } else { st.giveItems(VACUALITE_FLOATING_STONE, 1); st.exitQuest(true, true); htmltext = event; } break; case "31271-02.html": - if (st.isCond(1)) - { + if (st.isCond(1)) { st.setCond(2, true); htmltext = event; } break; case "31271-05.html": - if ((st.getQuestItemsCount(VACUALITE_ORE) == REQUIRED_COUNT) && st.isCond(3)) - { + if ((st.getQuestItemsCount(VACUALITE_ORE) == REQUIRED_COUNT) && st.isCond(3)) { st.takeItems(VACUALITE_ORE, -1); st.giveItems(VACUALITE, 1); st.setCond(4, true); htmltext = event; - } - else - { + } else { htmltext = "31271-03.html"; } break; @@ -118,21 +105,15 @@ public class Q00618_IntoTheFlame extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) { final L2PcInstance member = getRandomPartyMember(player, 2); - if (member != null) - { + if (member != null) { final QuestState qs = getQuestState(member, false); - if ((qs.getQuestItemsCount(VACUALITE_ORE) < REQUIRED_COUNT) && (getRandom(1000) < MONSTERS.get(npc.getId()))) - { + if ((qs.getQuestItemsCount(VACUALITE_ORE) < REQUIRED_COUNT) && (getRandom(1000) < MONSTERS.get(npc.getId()))) { qs.giveItems(VACUALITE_ORE, 1); - if (qs.getQuestItemsCount(VACUALITE_ORE) >= REQUIRED_COUNT) - { + if (qs.getQuestItemsCount(VACUALITE_ORE) >= REQUIRED_COUNT) { qs.setCond(3, true); - } - else - { + } else { qs.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -141,28 +122,20 @@ public class Q00618_IntoTheFlame extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { - case KLEIN: - { - if (st.isCreated()) - { + switch (npc.getId()) { + case KLEIN: { + if (st.isCreated()) { htmltext = (player.getLevel() < MIN_LEVEL) ? "31540-01.html" : "31540-02.htm"; - } - else if (st.isStarted()) - { + } else if (st.isStarted()) { htmltext = st.isCond(4) ? "31540-04.html" : "31540-03.htm"; } break; } - case HILDA: - { - switch (st.getCond()) - { + case HILDA: { + switch (st.getCond()) { case 1: htmltext = "31271-01.html"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00619_RelicsOfTheOldEmpire/Q00619_RelicsOfTheOldEmpire.java b/src/main/java/com/l2jserver/datapack/quests/Q00619_RelicsOfTheOldEmpire/Q00619_RelicsOfTheOldEmpire.java index f086c7bfc4..50555e6e33 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00619_RelicsOfTheOldEmpire/Q00619_RelicsOfTheOldEmpire.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00619_RelicsOfTheOldEmpire/Q00619_RelicsOfTheOldEmpire.java @@ -31,33 +31,27 @@ import com.l2jserver.gameserver.util.Util; * Relics of the Old Empire (619) * @author Adry_85, jurchiks */ -public final class Q00619_RelicsOfTheOldEmpire extends Quest -{ - private static final class DropInfo - { +public final class Q00619_RelicsOfTheOldEmpire extends Quest { + private static final class DropInfo { public final double _dropChance; public final int _doubleItemChance; public final boolean _dropEntrancePass; - public DropInfo(double dropChance, int doubleItemChance, boolean dropEntrancePass) - { + public DropInfo(double dropChance, int doubleItemChance, boolean dropEntrancePass) { _dropChance = dropChance; _doubleItemChance = doubleItemChance; _dropEntrancePass = dropEntrancePass; } - public double getDropChance() - { + public double getDropChance() { return _dropChance; } - public int getDoubleItemChance() - { + public int getDoubleItemChance() { return _doubleItemChance; } - public boolean getDropEntrancePass() - { + public boolean getDropEntrancePass() { return _dropEntrancePass; } } @@ -71,8 +65,7 @@ public final class Q00619_RelicsOfTheOldEmpire extends Quest private static final int MIN_LEVEL = 74; private static final int REQUIRED_RELIC_COUNT = 1000; // Reward - private static final int[] RECIPES = - { + private static final int[] RECIPES = { 6881, // Recipe: Forgotten Blade (60%) 6883, // Recipe: Basalt Battlehammer (60%) 6885, // Recipe: Imperial Staff (60%) @@ -86,8 +79,7 @@ public final class Q00619_RelicsOfTheOldEmpire extends Quest }; // Mobs private static final Map<Integer, DropInfo> MOBS = new HashMap<>(); - static - { + static { MOBS.put(21396, new DropInfo(0.51, 0, true)); // carrion_scarab MOBS.put(21397, new DropInfo(0.50, 0, true)); // carrion_scarab_a MOBS.put(21398, new DropInfo(0.95, 0, true)); // soldier_scarab @@ -213,8 +205,7 @@ public final class Q00619_RelicsOfTheOldEmpire extends Quest }; // @formatter:on - public Q00619_RelicsOfTheOldEmpire() - { + public Q00619_RelicsOfTheOldEmpire() { super(619, Q00619_RelicsOfTheOldEmpire.class.getSimpleName(), "Relics of the Old Empire"); addStartNpc(GHOST_OF_ADVENTURER); addTalkId(GHOST_OF_ADVENTURER); @@ -224,40 +215,32 @@ public final class Q00619_RelicsOfTheOldEmpire extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "31538-02.htm": - { + switch (event) { + case "31538-02.htm": { st.startQuest(); htmltext = event; break; } - case "31538-05.html": - { + case "31538-05.html": { htmltext = event; break; } - case "31538-06.html": - { - if (st.getQuestItemsCount(BROKEN_RELIC_PART) >= REQUIRED_RELIC_COUNT) - { + case "31538-06.html": { + if (st.getQuestItemsCount(BROKEN_RELIC_PART) >= REQUIRED_RELIC_COUNT) { st.rewardItems(RECIPES[getRandom(RECIPES.length)], 1); st.takeItems(BROKEN_RELIC_PART, REQUIRED_RELIC_COUNT); htmltext = event; } break; } - case "31538-08.html": - { + case "31538-08.html": { st.exitQuest(true, true); htmltext = event; break; @@ -267,35 +250,26 @@ public final class Q00619_RelicsOfTheOldEmpire extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getRandomPartyMemberState(player, -1, 3, npc); - if (st != null) - { + if (st != null) { int npcId = npc.getId(); - if (Util.contains(ARCHON_OF_HALISHA, npcId)) - { + if (Util.contains(ARCHON_OF_HALISHA, npcId)) { final int itemCount = ((getRandom(100) < 79) ? 4 : 3); st.giveItemRandomly(npc, BROKEN_RELIC_PART, itemCount, 0, 1.0, true); - } - else - { + } else { final DropInfo info = MOBS.get(npcId); final int itemCount; - if (info.getDoubleItemChance() > 0) - { + if (info.getDoubleItemChance() > 0) { itemCount = ((getRandom(100) < info.getDoubleItemChance()) ? 2 : 1); - } - else - { + } else { itemCount = 1; } st.giveItemRandomly(npc, BROKEN_RELIC_PART, itemCount, 0, info.getDropChance(), true); - if (info.getDropEntrancePass()) - { + if (info.getDropEntrancePass()) { st.giveItemRandomly(npc, ENTRANCE_PASS_TO_THE_SEPULCHER, 1, 0, 1.0 / 30, false); } } @@ -304,16 +278,12 @@ public final class Q00619_RelicsOfTheOldEmpire extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCreated()) - { + if (st.isCreated()) { htmltext = ((player.getLevel() >= MIN_LEVEL) ? "31538-01.htm" : "31538-03.html"); - } - else if (st.isStarted()) - { + } else if (st.isStarted()) { htmltext = ((getQuestItemsCount(player, BROKEN_RELIC_PART) >= REQUIRED_RELIC_COUNT) ? "31538-04.html" : "31538-07.html"); } return htmltext; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00620_FourGoblets/Q00620_FourGoblets.java b/src/main/java/com/l2jserver/datapack/quests/Q00620_FourGoblets/Q00620_FourGoblets.java index 7b07163160..c600fbe665 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00620_FourGoblets/Q00620_FourGoblets.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00620_FourGoblets/Q00620_FourGoblets.java @@ -35,8 +35,7 @@ import com.l2jserver.gameserver.util.Util; * @author Adry_85 * @since 2.6.0.0 */ -public class Q00620_FourGoblets extends Quest -{ +public class Q00620_FourGoblets extends Quest { // NPCs private static final int GHOST_OF_WIGOTH_1 = 31452; private static final int NAMELESS_SPIRIT = 31453; @@ -137,8 +136,7 @@ public class Q00620_FourGoblets extends Quest private static final Map<Integer, Double> MOB1 = new HashMap<>(); private static final Map<Integer, Integer> MOB2 = new HashMap<>(); private static final Map<Integer, Integer> MOB3 = new HashMap<>(); - static - { + static { MOB1.put(18141, 0.9); MOB1.put(18142, 0.9); MOB1.put(18143, 0.9); @@ -219,8 +217,7 @@ public class Q00620_FourGoblets extends Quest MOB3.put(18219, 50); } - public Q00620_FourGoblets() - { + public Q00620_FourGoblets() { super(620, Q00620_FourGoblets.class.getSimpleName(), "Four Goblets"); addStartNpc(NAMELESS_SPIRIT); addTalkId(NAMELESS_SPIRIT, GHOST_OF_WIGOTH_1, GHOST_OF_WIGOTH_2, GHOST_CHAMBERLAIN_OF_ELMOREDEN_1, CONQUERORS_SEPULCHER_MANAGER, EMPERORS_SEPULCHER_MANAGER, GREAT_SAGES_SEPULCHER_MANAGER, JUDGES_SEPULCHER_MANAGER); @@ -232,47 +229,36 @@ public class Q00620_FourGoblets extends Quest } @Override - public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) - { + public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && Util.checkIfInRange(1500, npc, player, false)) - { - switch (npc.getId()) - { - case HALISHA_ALECTIA: - { - if (!hasQuestItems(player, GOBLET_OF_ALECTIA) && !hasQuestItems(player, ANTIQUE_BROOCH)) - { + if ((st != null) && Util.checkIfInRange(1500, npc, player, false)) { + switch (npc.getId()) { + case HALISHA_ALECTIA: { + if (!hasQuestItems(player, GOBLET_OF_ALECTIA) && !hasQuestItems(player, ANTIQUE_BROOCH)) { giveItems(player, GOBLET_OF_ALECTIA, 1); } st.setMemoStateEx(1, 2); break; } - case HALISHA_TISHAS: - { - if (!hasQuestItems(player, GOBLET_OF_TISHAS) && !hasQuestItems(player, ANTIQUE_BROOCH)) - { + case HALISHA_TISHAS: { + if (!hasQuestItems(player, GOBLET_OF_TISHAS) && !hasQuestItems(player, ANTIQUE_BROOCH)) { giveItems(player, GOBLET_OF_TISHAS, 1); } st.setMemoStateEx(1, 2); break; } - case HALISHA_MEKARA: - { - if (!hasQuestItems(player, GOBLET_OF_MEKARA) && !hasQuestItems(player, ANTIQUE_BROOCH)) - { + case HALISHA_MEKARA: { + if (!hasQuestItems(player, GOBLET_OF_MEKARA) && !hasQuestItems(player, ANTIQUE_BROOCH)) { giveItems(player, GOBLET_OF_MEKARA, 1); } st.setMemoStateEx(1, 2); break; } - case HALISHA_MORIGUL: - { - if (!hasQuestItems(player, GOBLET_OF_MORIGUL) && !hasQuestItems(player, ANTIQUE_BROOCH)) - { + case HALISHA_MORIGUL: { + if (!hasQuestItems(player, GOBLET_OF_MORIGUL) && !hasQuestItems(player, ANTIQUE_BROOCH)) { giveItems(player, GOBLET_OF_MORIGUL, 1); } @@ -284,17 +270,14 @@ public class Q00620_FourGoblets extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "31453-02.htm": case "31453-03.htm": case "31453-04.htm": @@ -316,33 +299,27 @@ public class Q00620_FourGoblets extends Quest case "31453-24.html": case "31453-25.html": case "31453-27.html": - case "31452-04.html": - { + case "31452-04.html": { htmltext = event; break; } - case "31453-12.htm": - { + case "31453-12.htm": { st.setMemoState(0); st.startQuest(); - if (hasQuestItems(player, ANTIQUE_BROOCH)) - { + if (hasQuestItems(player, ANTIQUE_BROOCH)) { st.setCond(2); } htmltext = event; break; } - case "31453-15.html": - { + case "31453-15.html": { takeItems(player, -1, CHAPEL_KEY, USED_GRAVE_PASS); st.exitQuest(true, true); htmltext = event; break; } - case "31453-28.html": - { - if (hasQuestItems(player, GOBLET_OF_ALECTIA, GOBLET_OF_TISHAS, GOBLET_OF_MEKARA, GOBLET_OF_MORIGUL)) - { + case "31453-28.html": { + if (hasQuestItems(player, GOBLET_OF_ALECTIA, GOBLET_OF_TISHAS, GOBLET_OF_MEKARA, GOBLET_OF_MORIGUL)) { giveItems(player, ANTIQUE_BROOCH, 1); st.setCond(2, true); takeItems(player, 1, GOBLET_OF_ALECTIA, GOBLET_OF_TISHAS, GOBLET_OF_MEKARA, GOBLET_OF_MORIGUL); @@ -350,17 +327,14 @@ public class Q00620_FourGoblets extends Quest } break; } - case "31454-02.html": - { + case "31454-02.html": { player.teleToLocation(ENTER_LOC, 0); htmltext = event; break; } - case "31454-04.html": - { + case "31454-04.html": { final int memoStateEx = st.getMemoStateEx(1); - if (((memoStateEx == 2) || (memoStateEx == 3)) && (getQuestItemsCount(player, BROKEN_RELIC_PART) >= 1000)) - { + if (((memoStateEx == 2) || (memoStateEx == 3)) && (getQuestItemsCount(player, BROKEN_RELIC_PART) >= 1000)) { htmltext = event; } break; @@ -374,66 +348,51 @@ public class Q00620_FourGoblets extends Quest case "6895": case "6897": case "6899": - case "7580": - { + case "7580": { final int memoStateEx = st.getMemoStateEx(1); - if (((memoStateEx == 2) || (memoStateEx == 3)) && (getQuestItemsCount(player, BROKEN_RELIC_PART) >= 1000)) - { + if (((memoStateEx == 2) || (memoStateEx == 3)) && (getQuestItemsCount(player, BROKEN_RELIC_PART) >= 1000)) { giveItems(player, Integer.valueOf(event), 1); takeItems(player, BROKEN_RELIC_PART, 1000); htmltext = "31454-05.html"; } break; } - case "31454-07.html": - { + case "31454-07.html": { final int memoStateEx = st.getMemoStateEx(1); - if (((memoStateEx == 2) || (memoStateEx == 3)) && hasQuestItems(player, SEALED_BOX)) - { + if (((memoStateEx == 2) || (memoStateEx == 3)) && hasQuestItems(player, SEALED_BOX)) { if (getRandom(100) < 100) // TODO (Adry_85): Check random function. { boolean i2 = getReward(player); htmltext = ((i2 == true) ? event : "31454-08.html"); - } - else - { + } else { takeItems(player, SEALED_BOX, 1); htmltext = "31454-09.html"; } } break; } - case "EXIT": - { + case "EXIT": { takeItems(player, CHAPEL_KEY, -1); player.teleToLocation(EXIT_LOC, 0); return ""; } - case "31919-02.html": - { - if (hasQuestItems(player, SEALED_BOX)) - { - if (getRandom(100) < 50) - { + case "31919-02.html": { + if (hasQuestItems(player, SEALED_BOX)) { + if (getRandom(100) < 50) { boolean i2 = getReward(player); htmltext = ((i2 == true) ? event : "31919-03.html"); - } - else - { + } else { takeItems(player, SEALED_BOX, 1); htmltext = "31919-04.html"; } - } - else - { + } else { htmltext = "31919-05.html"; } break; } - case "ENTER": - { + case "ENTER": { // TODO (Adry_85): Need rework FourSepulchersManager.getInstance().tryEntry(npc, player); return ""; @@ -443,35 +402,25 @@ public class Q00620_FourGoblets extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { - switch (npc.getId()) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { + switch (npc.getId()) { case HALISHA_ALECTIA: case HALISHA_TISHAS: case HALISHA_MEKARA: - case HALISHA_MORIGUL: - { + case HALISHA_MORIGUL: { executeForEachPlayer(player, npc, isSummon, true, false); break; } - default: - { + default: { final QuestState st = getRandomPartyMemberState(player, -1, 3, npc); - if (st != null) - { + if (st != null) { int npcId = npc.getId(); - if (MOB1.containsKey(npcId)) - { + if (MOB1.containsKey(npcId)) { st.giveItemRandomly(npc, SEALED_BOX, 1, 0, MOB1.get(npcId), true); - } - else if (MOB2.containsKey(npcId)) - { + } else if (MOB2.containsKey(npcId)) { final int itemCount = ((getRandom(100) < MOB2.get(npc.getId())) ? 2 : 1); st.giveItemRandomly(npc, SEALED_BOX, itemCount, 0, 1.0, true); - } - else - { + } else { final int itemCount = ((getRandom(100) < MOB3.get(npc.getId())) ? 5 : 4); st.giveItemRandomly(npc, SEALED_BOX, itemCount, 0, 1.0, true); } @@ -483,104 +432,66 @@ public class Q00620_FourGoblets extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCreated()) - { + if (st.isCreated()) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "31453-01.htm" : "31453-13.html"; - } - else if (st.isStarted()) - { - switch (npc.getId()) - { - case NAMELESS_SPIRIT: - { - if (!hasQuestItems(player, ANTIQUE_BROOCH)) - { - if (hasQuestItems(player, GOBLET_OF_ALECTIA, GOBLET_OF_TISHAS, GOBLET_OF_MEKARA, GOBLET_OF_MORIGUL)) - { + } else if (st.isStarted()) { + switch (npc.getId()) { + case NAMELESS_SPIRIT: { + if (!hasQuestItems(player, ANTIQUE_BROOCH)) { + if (hasQuestItems(player, GOBLET_OF_ALECTIA, GOBLET_OF_TISHAS, GOBLET_OF_MEKARA, GOBLET_OF_MORIGUL)) { htmltext = "31453-26.html"; - } - else - { + } else { htmltext = "31453-14.html"; } - } - else - { + } else { htmltext = "31453-29.html"; } break; } - case GHOST_OF_WIGOTH_1: - { - if (!hasQuestItems(player, ANTIQUE_BROOCH)) - { - if (hasQuestItems(player, GOBLET_OF_ALECTIA, GOBLET_OF_TISHAS, GOBLET_OF_MEKARA, GOBLET_OF_MORIGUL)) - { + case GHOST_OF_WIGOTH_1: { + if (!hasQuestItems(player, ANTIQUE_BROOCH)) { + if (hasQuestItems(player, GOBLET_OF_ALECTIA, GOBLET_OF_TISHAS, GOBLET_OF_MEKARA, GOBLET_OF_MORIGUL)) { htmltext = "31452-01.html"; - } - else - { - if ((getQuestItemsCount(player, GOBLET_OF_ALECTIA, GOBLET_OF_TISHAS, GOBLET_OF_MEKARA, GOBLET_OF_MORIGUL)) < 3) - { + } else { + if ((getQuestItemsCount(player, GOBLET_OF_ALECTIA, GOBLET_OF_TISHAS, GOBLET_OF_MEKARA, GOBLET_OF_MORIGUL)) < 3) { htmltext = "31452-02.html"; - } - else - { + } else { htmltext = "31452-03.html"; } } - } - else - { + } else { htmltext = "31452-05.html"; } break; } - case GHOST_OF_WIGOTH_2: - { + case GHOST_OF_WIGOTH_2: { final int memoStateEx = st.getMemoStateEx(1); final long brokenRelicPartCount = getQuestItemsCount(player, BROKEN_RELIC_PART); - if (memoStateEx == 2) - { - if (hasQuestItems(player, GOBLET_OF_ALECTIA, GOBLET_OF_TISHAS, GOBLET_OF_MEKARA, GOBLET_OF_MORIGUL)) - { - if (!hasQuestItems(player, SEALED_BOX)) - { + if (memoStateEx == 2) { + if (hasQuestItems(player, GOBLET_OF_ALECTIA, GOBLET_OF_TISHAS, GOBLET_OF_MEKARA, GOBLET_OF_MORIGUL)) { + if (!hasQuestItems(player, SEALED_BOX)) { htmltext = ((brokenRelicPartCount < 1000) ? "31454-01.html" : "31454-03.html"); - } - else - { + } else { htmltext = ((brokenRelicPartCount < 1000) ? "31454-06.html" : "31454-10.html"); } st.setMemoStateEx(1, 3); - } - else - { - if (!hasQuestItems(player, SEALED_BOX)) - { + } else { + if (!hasQuestItems(player, SEALED_BOX)) { htmltext = ((brokenRelicPartCount < 1000) ? "31454-11.html" : "31454-12.html"); - } - else - { + } else { htmltext = ((brokenRelicPartCount < 1000) ? "31454-13.html" : "31454-14.html"); } st.setMemoStateEx(1, 3); } - } - else if (memoStateEx == 3) - { - if (!hasQuestItems(player, SEALED_BOX)) - { + } else if (memoStateEx == 3) { + if (!hasQuestItems(player, SEALED_BOX)) { htmltext = ((brokenRelicPartCount < 1000) ? "31454-15.html" : "31454-12.html"); - } - else - { + } else { htmltext = ((brokenRelicPartCount < 1000) ? "31454-13.html" : "31454-14.html"); } @@ -588,28 +499,23 @@ public class Q00620_FourGoblets extends Quest } break; } - case GHOST_CHAMBERLAIN_OF_ELMOREDEN_1: - { + case GHOST_CHAMBERLAIN_OF_ELMOREDEN_1: { htmltext = "31919-01.html"; break; } - case CONQUERORS_SEPULCHER_MANAGER: - { + case CONQUERORS_SEPULCHER_MANAGER: { htmltext = "31921-01.html"; break; } - case EMPERORS_SEPULCHER_MANAGER: - { + case EMPERORS_SEPULCHER_MANAGER: { htmltext = "31922-01.html"; break; } - case GREAT_SAGES_SEPULCHER_MANAGER: - { + case GREAT_SAGES_SEPULCHER_MANAGER: { htmltext = "31923-01.html"; break; } - case JUDGES_SEPULCHER_MANAGER: - { + case JUDGES_SEPULCHER_MANAGER: { htmltext = "31924-01.html"; break; } @@ -618,340 +524,199 @@ public class Q00620_FourGoblets extends Quest return htmltext; } - private boolean getReward(L2PcInstance player) - { + private boolean getReward(L2PcInstance player) { boolean i2 = false; - switch (getRandom(5)) - { - case 0: - { + switch (getRandom(5)) { + case 0: { i2 = true; giveAdena(player, 10000, true); break; } - case 1: - { - if (getRandom(1000) < 848) - { + case 1: { + if (getRandom(1000) < 848) { i2 = true; int i1 = getRandom(1000); - if (i1 < 43) - { + if (i1 < 43) { giveItems(player, CORD); - } - else if (i1 < 66) - { + } else if (i1 < 66) { giveItems(player, METALLIC_FIBER); - } - else if (i1 < 184) - { + } else if (i1 < 184) { giveItems(player, MITHRIL_ORE); - } - else if (i1 < 250) - { + } else if (i1 < 250) { giveItems(player, COARSE_BONE_POWDER); - } - else if (i1 < 287) - { + } else if (i1 < 287) { giveItems(player, METALLIC_THREAD); - } - else if (i1 < 484) - { + } else if (i1 < 484) { giveItems(player, ORIHARUKON_ORE); - } - else if (i1 < 681) - { + } else if (i1 < 681) { giveItems(player, COMPOUND_BRAID); - } - else if (i1 < 799) - { + } else if (i1 < 799) { giveItems(player, ADAMANTITE_NUGGET); - } - else if (i1 < 902) - { + } else if (i1 < 902) { giveItems(player, CRAFTED_LEATHER); - } - else - { + } else { giveItems(player, ASOFE); } } - if (getRandom(1000) < 323) - { + if (getRandom(1000) < 323) { i2 = true; int i1 = getRandom(1000); - if (i1 < 335) - { + if (i1 < 335) { giveItems(player, SYNTETHIC_COKES); - } - else if (i1 < 556) - { + } else if (i1 < 556) { giveItems(player, MOLD_LUBRICANT); - } - else if (i1 < 725) - { + } else if (i1 < 725) { giveItems(player, MITHRIL_ALLOY); - } - else if (i1 < 872) - { + } else if (i1 < 872) { giveItems(player, DURABLE_METAL_PLATE); - } - else if (i1 < 962) - { + } else if (i1 < 962) { giveItems(player, ORIHARUKON); - } - else if (i1 < 986) - { + } else if (i1 < 986) { giveItems(player, MAESTRO_ANVIL_LOCK); - } - else - { + } else { giveItems(player, MAESTRO_MOLD); } } break; } - case 2: - { - if (getRandom(1000) < 847) - { + case 2: { + if (getRandom(1000) < 847) { i2 = true; int i1 = getRandom(1000); - if (i1 < 148) - { + if (i1 < 148) { giveItems(player, BRAIDED_HEMP); - } - else if (i1 < 175) - { + } else if (i1 < 175) { giveItems(player, LEATHER); - } - else if (i1 < 273) - { + } else if (i1 < 273) { giveItems(player, COKES); - } - else if (i1 < 322) - { + } else if (i1 < 322) { giveItems(player, STEEL); - } - else if (i1 < 357) - { + } else if (i1 < 357) { giveItems(player, HIGH_GRADE_SUEDE); - } - else if (i1 < 554) - { + } else if (i1 < 554) { giveItems(player, STONE_OF_PURITY); - } - else if (i1 < 685) - { + } else if (i1 < 685) { giveItems(player, STEEL_MOLD); - } - else if (i1 < 803) - { + } else if (i1 < 803) { giveItems(player, METAL_HARDENER); - } - else if (i1 < 901) - { + } else if (i1 < 901) { giveItems(player, MOLD_GLUE); - } - else - { + } else { giveItems(player, THONS); } } - if (getRandom(1000) < 251) - { + if (getRandom(1000) < 251) { i2 = true; int i1 = getRandom(1000); - if (i1 < 350) - { + if (i1 < 350) { giveItems(player, VARNISH_OF_PURITY); - } - else if (i1 < 587) - { + } else if (i1 < 587) { giveItems(player, ENRIA); - } - else if (i1 < 798) - { + } else if (i1 < 798) { giveItems(player, SILVER_MOLD); - } - else if (i1 < 922) - { + } else if (i1 < 922) { giveItems(player, MOLD_HARDENER); - } - else if (i1 < 966) - { + } else if (i1 < 966) { giveItems(player, BLACKSMITHS_FRAMES); - } - else if (i1 < 996) - { + } else if (i1 < 996) { giveItems(player, ARTISANS_FRAMES); - } - else - { + } else { giveItems(player, CRAFTSMAN_MOLD); } } break; } - case 3: - { - if (getRandom(1000) < 31) - { + case 3: { + if (getRandom(1000) < 31) { i2 = true; int i1 = getRandom(1000); - if (i1 < 223) - { + if (i1 < 223) { giveItems(player, ENCHANT_ARMOR_A_GRADE); - } - else if (i1 < 893) - { + } else if (i1 < 893) { giveItems(player, ENCHANT_ARMOR_B_GRADE); - } - else - { + } else { giveItems(player, ENCHANT_ARMOR_S_GRADE); } } - if (getRandom(1000) < 5) - { + if (getRandom(1000) < 5) { i2 = true; int i1 = getRandom(1000); - if (i1 < 202) - { + if (i1 < 202) { giveItems(player, ENCHANT_WEAPON_A_GRADE); - } - else if (i1 < 928) - { + } else if (i1 < 928) { giveItems(player, ENCHANT_WEAPON_B_GRADE); - } - else - { + } else { giveItems(player, ENCHANT_WEAPON_S_GRADE); } } break; } - case 4: - { - if (getRandom(1000) < 329) - { + case 4: { + if (getRandom(1000) < 329) { i2 = true; int i1 = getRandom(1000); - if (i1 < 88) - { + if (i1 < 88) { giveItems(player, SEALED_TATEOSSIAN_EARRING_PART); - } - else if (i1 < 185) - { + } else if (i1 < 185) { giveItems(player, SEALED_TATEOSSIAN_RING_GEM); - } - else if (i1 < 238) - { + } else if (i1 < 238) { giveItems(player, SEALED_TATEOSSIAN_NECKLACE_CHAIN); - } - else if (i1 < 262) - { + } else if (i1 < 262) { giveItems(player, SEALED_IMPERIAL_CRUSADER_BREASTPLATE_PART); - } - else if (i1 < 292) - { + } else if (i1 < 292) { giveItems(player, SEALED_IMPERIAL_CRUSADER_GAITERS_PATTERN); - } - else if (i1 < 356) - { + } else if (i1 < 356) { giveItems(player, SEALED_IMPERIAL_CRUSADER_GAUNTLETS_DESIGN); - } - else if (i1 < 420) - { + } else if (i1 < 420) { giveItems(player, SEALED_IMPERIAL_CRUSADER_BOOTS_DESIGN); - } - else if (i1 < 482) - { + } else if (i1 < 482) { giveItems(player, SEALED_IMPERIAL_CRUSADER_SHIELD_PART); - } - else if (i1 < 554) - { + } else if (i1 < 554) { giveItems(player, SEALED_IMPERIAL_CRUSADER_HELMET_PATTERN); - } - else if (i1 < 576) - { + } else if (i1 < 576) { giveItems(player, SEALED_DRACONIC_LEATHER_ARMOR_PART); - } - else if (i1 < 640) - { + } else if (i1 < 640) { giveItems(player, SEALED_DRACONIC_LEATHER_GLOVES_FABRIC); - } - else if (i1 < 704) - { + } else if (i1 < 704) { giveItems(player, SEALED_DRACONIC_LEATHER_BOOTS_DESIGN); - } - else if (i1 < 777) - { + } else if (i1 < 777) { giveItems(player, SEALED_DRACONIC_LEATHER_HELMET_PATTERN); - } - else if (i1 < 799) - { + } else if (i1 < 799) { giveItems(player, SEALED_MAJOR_ARCANA_ROBE_PART); - } - else if (i1 < 863) - { + } else if (i1 < 863) { giveItems(player, SEALED_MAJOR_ARCANA_GLOVES_FABRIC); - } - else if (i1 < 927) - { + } else if (i1 < 927) { giveItems(player, SEALED_MAJOR_ARCANA_BOOTS_DESIGN); - } - else - { + } else { giveItems(player, SEALED_MAJOR_ARCANA_CIRCLET_PATTERN); } } - if (getRandom(1000) < 54) - { + if (getRandom(1000) < 54) { i2 = true; int i1 = getRandom(1000); - if (i1 < 100) - { + if (i1 < 100) { giveItems(player, FORGOTTEN_BLADE_EDGE); - } - else if (i1 < 198) - { + } else if (i1 < 198) { giveItems(player, BASALT_BATTLEHAMMER_HEAD); - } - else if (i1 < 298) - { + } else if (i1 < 298) { giveItems(player, IMPERIAL_STAFF_HEAD); - } - else if (i1 < 398) - { + } else if (i1 < 398) { giveItems(player, ANGEL_SLAYER_BLADE); - } - else if (i1 < 499) - { + } else if (i1 < 499) { giveItems(player, DRACONIC_BOW_SHAFT); - } - else if (i1 < 601) - { + } else if (i1 < 601) { giveItems(player, DRAGON_HUNTER_AXE_BLADE); - } - else if (i1 < 703) - { + } else if (i1 < 703) { giveItems(player, SAINT_SPEAR_BLADE); - } - else if (i1 < 801) - { + } else if (i1 < 801) { giveItems(player, DEMON_SPLINTER_BLADE); - } - else if (i1 < 902) - { + } else if (i1 < 902) { giveItems(player, HEAVENS_DIVIDER_EDGE); - } - else - { + } else { giveItems(player, ARCANA_MACE_HEAD); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00621_EggDelivery/Q00621_EggDelivery.java b/src/main/java/com/l2jserver/datapack/quests/Q00621_EggDelivery/Q00621_EggDelivery.java index 8d8ef9a7fd..e50912d9f3 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00621_EggDelivery/Q00621_EggDelivery.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00621_EggDelivery/Q00621_EggDelivery.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.State; * Egg Delivery (621) * @author Janiko */ -public final class Q00621_EggDelivery extends Quest -{ +public final class Q00621_EggDelivery extends Quest { // NPCs private static final int JEREMY = 31521; private static final int PULIN = 31543; @@ -54,8 +53,7 @@ public final class Q00621_EggDelivery extends Quest // Talkers private static final List<Integer> TALKERS = Arrays.asList(NAFF, CROCUS, KUBER, BOELIN); - public Q00621_EggDelivery() - { + public Q00621_EggDelivery() { super(621, Q00621_EggDelivery.class.getSimpleName(), "Egg Delivery"); addStartNpc(JEREMY); addTalkId(JEREMY, PULIN, VALENTINE); @@ -64,56 +62,41 @@ public final class Q00621_EggDelivery extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { - case "31521-03.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "31521-03.htm": { + if (qs.isCreated()) { qs.startQuest(); giveItems(player, BOILED_EGG, 5); htmltext = event; } break; } - case "31521-06.html": - { - if (qs.isCond(6)) - { - if (getQuestItemsCount(player, EGG_PRICE) >= 5) - { + case "31521-06.html": { + if (qs.isCond(6)) { + if (getQuestItemsCount(player, EGG_PRICE) >= 5) { qs.setCond(7, true); takeItems(player, EGG_PRICE, -1); htmltext = event; - } - else - { + } else { htmltext = "31521-07.html"; } } break; } - case "31543-02.html": - { - if (qs.isCond(1)) - { - if (hasQuestItems(player, BOILED_EGG)) - { + case "31543-02.html": { + if (qs.isCond(1)) { + if (hasQuestItems(player, BOILED_EGG)) { qs.setCond(2, true); takeItems(player, BOILED_EGG, 1); giveItems(player, EGG_PRICE, 1); htmltext = event; - } - else - { + } else { htmltext = "31543-03.html"; } } @@ -122,44 +105,30 @@ public final class Q00621_EggDelivery extends Quest case "31544-02.html": case "31545-02.html": case "31546-02.html": - case "31547-02.html": - { - if (TALKERS.contains(npc.getId()) && qs.isCond(TALKERS.indexOf(npc.getId()) + 2)) - { - if (hasQuestItems(player, BOILED_EGG)) - { + case "31547-02.html": { + if (TALKERS.contains(npc.getId()) && qs.isCond(TALKERS.indexOf(npc.getId()) + 2)) { + if (hasQuestItems(player, BOILED_EGG)) { qs.setCond(qs.getCond() + 1, true); takeItems(player, BOILED_EGG, 1); giveItems(player, EGG_PRICE, 1); htmltext = event; - } - else - { + } else { htmltext = npc.getId() + "-03.html"; } } break; } - case "31584-02.html": - { - if (qs.isCond(7)) - { + case "31584-02.html": { + if (qs.isCond(7)) { int rnd = getRandom(1000); - if (rnd < 800) - { + if (rnd < 800) { rewardItems(player, QUICK_STEP_POTION, 1); giveAdena(player, 18800, true); - } - else if (rnd < 880) - { + } else if (rnd < 880) { rewardItems(player, SEALED_RING_OF_AURAKYRA, 1); - } - else if (rnd < 960) - { + } else if (rnd < 960) { rewardItems(player, SEALED_SANDDRAGONS_EARING, 1); - } - else if (rnd < 1000) - { + } else if (rnd < 1000) { rewardItems(player, SEALED_DRAGON_NECKLACE, 1); } qs.exitQuest(true, true); @@ -172,42 +141,30 @@ public final class Q00621_EggDelivery extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (npc.getId()) - { - case JEREMY: - { - switch (qs.getState()) - { - case State.CREATED: - { + switch (npc.getId()) { + case JEREMY: { + switch (qs.getState()) { + case State.CREATED: { htmltext = (talker.getLevel() >= MIN_LVL) ? "31521-01.htm" : "31521-02.htm"; break; } - case State.STARTED: - { - switch (qs.getCond()) - { - case 1: - { + case State.STARTED: { + switch (qs.getCond()) { + case 1: { htmltext = "31521-04.html"; break; } - case 6: - { - if (hasQuestItems(talker, EGG_PRICE)) - { + case 6: { + if (hasQuestItems(talker, EGG_PRICE)) { htmltext = "31521-05.html"; } break; } - case 7: - { - if (!hasQuestItems(talker, BOILED_EGG)) - { + case 7: { + if (!hasQuestItems(talker, BOILED_EGG)) { htmltext = "31521-08.html"; } break; @@ -215,30 +172,23 @@ public final class Q00621_EggDelivery extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(talker); break; } } break; } - case PULIN: - { - if (qs.isStarted()) - { - switch (qs.getCond()) - { - case 1: - { - if (getQuestItemsCount(talker, BOILED_EGG) >= 5) - { + case PULIN: { + if (qs.isStarted()) { + switch (qs.getCond()) { + case 1: { + if (getQuestItemsCount(talker, BOILED_EGG) >= 5) { htmltext = "31543-01.html"; } break; } - case 2: - { + case 2: { htmltext = "31543-04.html"; break; } @@ -249,26 +199,21 @@ public final class Q00621_EggDelivery extends Quest case NAFF: case CROCUS: case KUBER: - case BOELIN: - { - if (qs.isStarted()) - { + case BOELIN: { + if (qs.isStarted()) { final int cond = TALKERS.indexOf(npc.getId()) + 2; if (qs.isCond(cond) && hasQuestItems(talker, EGG_PRICE)) // 2,3,4,5 { htmltext = npc.getId() + "-01.html"; - } - else if (qs.isCond(cond + 1)) // 3,4,5,6 + } else if (qs.isCond(cond + 1)) // 3,4,5,6 { htmltext = npc.getId() + "-04.html"; } } break; } - case VALENTINE: - { - if (qs.isStarted() && qs.isCond(7)) - { + case VALENTINE: { + if (qs.isStarted() && qs.isCond(7)) { htmltext = "31584-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00622_SpecialtyLiquorDelivery/Q00622_SpecialtyLiquorDelivery.java b/src/main/java/com/l2jserver/datapack/quests/Q00622_SpecialtyLiquorDelivery/Q00622_SpecialtyLiquorDelivery.java index a1c45881da..b43b53bbb9 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00622_SpecialtyLiquorDelivery/Q00622_SpecialtyLiquorDelivery.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00622_SpecialtyLiquorDelivery/Q00622_SpecialtyLiquorDelivery.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.State; * Specialty Liquor Delivery (622) * @author Janiko */ -public final class Q00622_SpecialtyLiquorDelivery extends Quest -{ +public final class Q00622_SpecialtyLiquorDelivery extends Quest { // NPCs private static final int JEREMY = 31521; private static final int PULIN = 31543; @@ -54,8 +53,7 @@ public final class Q00622_SpecialtyLiquorDelivery extends Quest // Talkers private static final List<Integer> TALKERS = Arrays.asList(KUBER, CROCUS, NAFF, PULIN); - public Q00622_SpecialtyLiquorDelivery() - { + public Q00622_SpecialtyLiquorDelivery() { super(622, Q00622_SpecialtyLiquorDelivery.class.getSimpleName(), "Specialty Liquor Delivery"); addStartNpc(JEREMY); addTalkId(JEREMY, BOELIN, LIETTA); @@ -64,56 +62,41 @@ public final class Q00622_SpecialtyLiquorDelivery extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { - case "31521-03.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "31521-03.htm": { + if (qs.isCreated()) { qs.startQuest(); giveItems(player, SPECIAL_DRINK, 5); htmltext = event; } break; } - case "31521-06.html": - { - if (qs.isCond(6)) - { - if (getQuestItemsCount(player, SPECIAL_DRINK_PRICE) >= 5) - { + case "31521-06.html": { + if (qs.isCond(6)) { + if (getQuestItemsCount(player, SPECIAL_DRINK_PRICE) >= 5) { qs.setCond(7, true); takeItems(player, -1, SPECIAL_DRINK_PRICE); htmltext = event; - } - else - { + } else { htmltext = "31521-07.html"; } } break; } - case "31547-02.html": - { - if (qs.isCond(1)) - { - if (hasQuestItems(player, SPECIAL_DRINK)) - { + case "31547-02.html": { + if (qs.isCond(1)) { + if (hasQuestItems(player, SPECIAL_DRINK)) { qs.setCond(2, true); takeItems(player, SPECIAL_DRINK, 1); giveItems(player, SPECIAL_DRINK_PRICE, 1); htmltext = event; - } - else - { + } else { htmltext = "31547-03.html"; } } @@ -122,44 +105,30 @@ public final class Q00622_SpecialtyLiquorDelivery extends Quest case "31543-02.html": case "31544-02.html": case "31545-02.html": - case "31546-02.html": - { - if (TALKERS.contains(npc.getId()) && qs.isCond(TALKERS.indexOf(npc.getId()) + 2)) - { - if (hasQuestItems(player, SPECIAL_DRINK)) - { + case "31546-02.html": { + if (TALKERS.contains(npc.getId()) && qs.isCond(TALKERS.indexOf(npc.getId()) + 2)) { + if (hasQuestItems(player, SPECIAL_DRINK)) { qs.setCond(qs.getCond() + 1, true); takeItems(player, SPECIAL_DRINK, 1); giveItems(player, SPECIAL_DRINK_PRICE, 1); htmltext = event; - } - else - { + } else { htmltext = npc.getId() + "-03.html"; } } break; } - case "31267-02.html": - { - if (qs.isCond(7)) - { + case "31267-02.html": { + if (qs.isCond(7)) { int rnd = getRandom(1000); - if (rnd < 800) - { + if (rnd < 800) { rewardItems(player, QUICK_STEP_POTION, 1); giveAdena(player, 18800, true); - } - else if (rnd < 880) - { + } else if (rnd < 880) { rewardItems(player, SEALED_RING_OF_AURAKYRA, 1); - } - else if (rnd < 960) - { + } else if (rnd < 960) { rewardItems(player, SEALED_SANDDRAGONS_EARING, 1); - } - else - { + } else { rewardItems(player, SEALED_DRAGON_NECKLACE, 1); } qs.exitQuest(true, true); @@ -172,42 +141,30 @@ public final class Q00622_SpecialtyLiquorDelivery extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (npc.getId()) - { - case JEREMY: - { - switch (qs.getState()) - { - case State.CREATED: - { + switch (npc.getId()) { + case JEREMY: { + switch (qs.getState()) { + case State.CREATED: { htmltext = (talker.getLevel() >= MIN_LVL) ? "31521-01.htm" : "31521-02.htm"; break; } - case State.STARTED: - { - switch (qs.getCond()) - { - case 1: - { + case State.STARTED: { + switch (qs.getCond()) { + case 1: { htmltext = "31521-04.html"; break; } - case 6: - { - if (hasQuestItems(talker, SPECIAL_DRINK_PRICE)) - { + case 6: { + if (hasQuestItems(talker, SPECIAL_DRINK_PRICE)) { htmltext = "31521-05.html"; } break; } - case 7: - { - if (!hasQuestItems(talker, SPECIAL_DRINK)) - { + case 7: { + if (!hasQuestItems(talker, SPECIAL_DRINK)) { htmltext = "31521-08.html"; } break; @@ -215,30 +172,23 @@ public final class Q00622_SpecialtyLiquorDelivery extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(talker); break; } } break; } - case BOELIN: - { - if (qs.isStarted()) - { - switch (qs.getCond()) - { - case 1: - { - if (getQuestItemsCount(talker, SPECIAL_DRINK) >= 5) - { + case BOELIN: { + if (qs.isStarted()) { + switch (qs.getCond()) { + case 1: { + if (getQuestItemsCount(talker, SPECIAL_DRINK) >= 5) { htmltext = "31547-01.html"; } break; } - case 2: - { + case 2: { htmltext = "31547-04.html"; break; } @@ -249,26 +199,21 @@ public final class Q00622_SpecialtyLiquorDelivery extends Quest case KUBER: case CROCUS: case NAFF: - case PULIN: - { - if (qs.isStarted()) - { + case PULIN: { + if (qs.isStarted()) { final int cond = TALKERS.indexOf(npc.getId()) + 2; if (qs.isCond(cond) && hasQuestItems(talker, SPECIAL_DRINK_PRICE)) // 2,3,4,5 { htmltext = npc.getId() + "-01.html"; - } - else if (qs.isCond(cond + 1)) // 3,4,5,6 + } else if (qs.isCond(cond + 1)) // 3,4,5,6 { htmltext = npc.getId() + "-04.html"; } } break; } - case LIETTA: - { - if (qs.isStarted() && qs.isCond(7)) - { + case LIETTA: { + if (qs.isStarted() && qs.isCond(7)) { htmltext = "31267-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00623_TheFinestFood/Q00623_TheFinestFood.java b/src/main/java/com/l2jserver/datapack/quests/Q00623_TheFinestFood/Q00623_TheFinestFood.java index 62b361757b..111ca5d1d7 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00623_TheFinestFood/Q00623_TheFinestFood.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00623_TheFinestFood/Q00623_TheFinestFood.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * The Finest Food (623) * @author janiko */ -public final class Q00623_TheFinestFood extends Quest -{ +public final class Q00623_TheFinestFood extends Quest { // NPCs private static final int JEREMY = 31521; // Monsters @@ -51,15 +50,13 @@ public final class Q00623_TheFinestFood extends Quest private static final int MIN_LVL = 71; private static final Map<Integer, ItemHolder> MONSTER_DROPS = new HashMap<>(); - static - { + static { MONSTER_DROPS.put(THERMAL_BUFFALO, BUFFALO_MEAT); MONSTER_DROPS.put(THERMAL_FLAVA, LEAF_OF_FLAVA); MONSTER_DROPS.put(THERMAL_ANTELOPE, HORN_OF_ANTELOPE); } - public Q00623_TheFinestFood() - { + public Q00623_TheFinestFood() { super(623, Q00623_TheFinestFood.class.getSimpleName(), "The Finest Food"); addStartNpc(JEREMY); addTalkId(JEREMY); @@ -68,57 +65,40 @@ public final class Q00623_TheFinestFood extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { - case "31521-03.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "31521-03.htm": { + if (qs.isCreated()) { qs.startQuest(); htmltext = event; } break; } - case "31521-06.html": - { - if (qs.isCond(2)) - { - if (hasAllItems(player, true, LEAF_OF_FLAVA, BUFFALO_MEAT, HORN_OF_ANTELOPE)) - { + case "31521-06.html": { + if (qs.isCond(2)) { + if (hasAllItems(player, true, LEAF_OF_FLAVA, BUFFALO_MEAT, HORN_OF_ANTELOPE)) { int random = getRandom(1000); - if (random < 120) - { + if (random < 120) { giveAdena(player, 25000, true); rewardItems(player, RING_OF_AURAKYRA); - } - else if (random < 240) - { + } else if (random < 240) { giveAdena(player, 65000, true); rewardItems(player, SEALED_SANDDRAGONS_EARING); - } - else if (random < 340) - { + } else if (random < 340) { giveAdena(player, 25000, true); rewardItems(player, DRAGON_NECKLACE); - } - else if (random < 940) - { + } else if (random < 940) { giveAdena(player, 73000, true); addExpAndSp(player, 230000, 18200); } qs.exitQuest(true, true); htmltext = event; - } - else - { + } else { htmltext = "31521-07.html"; } } @@ -129,36 +109,25 @@ public final class Q00623_TheFinestFood extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (npc.getId()) - { - case JEREMY: - { - if (qs.isCreated()) - { + switch (npc.getId()) { + case JEREMY: { + if (qs.isCreated()) { htmltext = (talker.getLevel() >= MIN_LVL) ? "31521-01.htm" : "31521-02.htm"; - } - else if (qs.isStarted()) - { - switch (qs.getCond()) - { - case 1: - { + } else if (qs.isStarted()) { + switch (qs.getCond()) { + case 1: { htmltext = "31521-04.html"; break; } - case 2: - { + case 2: { htmltext = "31521-05.html"; break; } } - } - else if (qs.isCompleted()) - { + } else if (qs.isCompleted()) { htmltext = getAlreadyCompletedMsg(talker); } break; @@ -168,14 +137,11 @@ public final class Q00623_TheFinestFood extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc); final ItemHolder holder = MONSTER_DROPS.get(npc.getId()); - if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, holder.getId(), 1, holder.getCount(), 1, true)) - { - if (hasAllItems(qs.getPlayer(), true, BUFFALO_MEAT, HORN_OF_ANTELOPE, LEAF_OF_FLAVA)) - { + if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, holder.getId(), 1, holder.getCount(), 1, true)) { + if (hasAllItems(qs.getPlayer(), true, BUFFALO_MEAT, HORN_OF_ANTELOPE, LEAF_OF_FLAVA)) { qs.setCond(2); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00624_TheFinestIngredientsPart1/Q00624_TheFinestIngredientsPart1.java b/src/main/java/com/l2jserver/datapack/quests/Q00624_TheFinestIngredientsPart1/Q00624_TheFinestIngredientsPart1.java index 342a248aae..c1bf89eb41 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00624_TheFinestIngredientsPart1/Q00624_TheFinestIngredientsPart1.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00624_TheFinestIngredientsPart1/Q00624_TheFinestIngredientsPart1.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.model.quest.State; * The Finest Ingredients - Part 1. * @author Citizen, jurchiks, xban1x */ -public final class Q00624_TheFinestIngredientsPart1 extends Quest -{ +public final class Q00624_TheFinestIngredientsPart1 extends Quest { // NPC private static final int JEREMY = 31521; // Items @@ -46,16 +45,14 @@ public final class Q00624_TheFinestIngredientsPart1 extends Quest // Misc private static final int MIN_LVL = 73; private static final Map<Integer, Integer> MONSTER_DROPS = new HashMap<>(); - static - { + static { MONSTER_DROPS.put(21314, FOOT_OF_BANDERSNATCHLING); // Hot Springs Bandersnatchling MONSTER_DROPS.put(21317, SECRET_SPICE); // Hot Springs Atroxspawn MONSTER_DROPS.put(21319, TRUNK_OF_NEPENTHES); // Hot Springs Nepenthes MONSTER_DROPS.put(21321, SECRET_SPICE); // Hot Springs Atrox } - public Q00624_TheFinestIngredientsPart1() - { + public Q00624_TheFinestIngredientsPart1() { super(624, Q00624_TheFinestIngredientsPart1.class.getSimpleName(), "The Finest Ingredients - Part 1"); addStartNpc(JEREMY); addTalkId(JEREMY); @@ -64,31 +61,23 @@ public final class Q00624_TheFinestIngredientsPart1 extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st != null) - { - switch (event) - { - case "31521-02.htm": - { + if (st != null) { + switch (event) { + case "31521-02.htm": { st.startQuest(); htmltext = event; break; } - case "31521-05.html": - { - if (st.isCond(2) && (getQuestItemsCount(player, getRegisteredItemIds()) == 150)) - { + case "31521-05.html": { + if (st.isCond(2) && (getQuestItemsCount(player, getRegisteredItemIds()) == 150)) { st.giveItems(ICE_CRYSTAL, 1); st.giveItems(SOY_SAUCE_JAR, 1); st.exitQuest(true, true); htmltext = "31521-05.html"; - } - else - { + } else { htmltext = "31521-06.html"; } break; @@ -99,27 +88,20 @@ public final class Q00624_TheFinestIngredientsPart1 extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(killer, 1); - if ((partyMember != null) && partyMember.isInsideRadius(npc, 1500, true, false)) - { + if ((partyMember != null) && partyMember.isInsideRadius(npc, 1500, true, false)) { final int item = MONSTER_DROPS.get(npc.getId()); final long count = getQuestItemsCount(partyMember, item); - if ((count + 1) >= 50) - { - if (count < 50) - { + if ((count + 1) >= 50) { + if (count < 50) { giveItems(partyMember, item, 50 - count); playSound(partyMember, Sound.ITEMSOUND_QUEST_FANFARE_MIDDLE); } - if (getQuestItemsCount(partyMember, getRegisteredItemIds()) == 150) - { + if (getQuestItemsCount(partyMember, getRegisteredItemIds()) == 150) { getQuestState(partyMember, false).setCond(2, true); } - } - else - { + } else { giveItems(partyMember, item, 1); playSound(partyMember, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -128,28 +110,21 @@ public final class Q00624_TheFinestIngredientsPart1 extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getLevel() >= MIN_LVL) ? "31521-01.htm" : "31521-00.htm"; break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "31521-03.html"; break; } - case 2: - { + case 2: { htmltext = "31521-04.html"; break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00625_TheFinestIngredientsPart2/Q00625_TheFinestIngredientsPart2.java b/src/main/java/com/l2jserver/datapack/quests/Q00625_TheFinestIngredientsPart2/Q00625_TheFinestIngredientsPart2.java index 15964d0981..65ea9a0557 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00625_TheFinestIngredientsPart2/Q00625_TheFinestIngredientsPart2.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00625_TheFinestIngredientsPart2/Q00625_TheFinestIngredientsPart2.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.util.Util; * The Finest Ingredients Part - 2 (625) * @author Janiko */ -public final class Q00625_TheFinestIngredientsPart2 extends Quest -{ +public final class Q00625_TheFinestIngredientsPart2 extends Quest { // NPCs private static final int JEREMY = 31521; private static final int YETIS_TABLE = 31542; @@ -58,8 +57,7 @@ public final class Q00625_TheFinestIngredientsPart2 extends Quest // Misc private static final int MIN_LVL = 73; - public Q00625_TheFinestIngredientsPart2() - { + public Q00625_TheFinestIngredientsPart2() { super(625, Q00625_TheFinestIngredientsPart2.class.getSimpleName(), "The Finest Ingredients - Part 2"); addStartNpc(JEREMY); addTalkId(JEREMY, YETIS_TABLE); @@ -69,21 +67,16 @@ public final class Q00625_TheFinestIngredientsPart2 extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { - case "31521-04.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "31521-04.htm": { + if (qs.isCreated()) { qs.startQuest(); takeItem(player, SOY_SOURCE_JAR); giveItems(player, FOOD_FOR_BUMBALUMP); @@ -91,77 +84,51 @@ public final class Q00625_TheFinestIngredientsPart2 extends Quest } break; } - case "31521-08.html": - { - if (qs.isCond(3)) - { - if (hasItem(player, SPECIAL_YETI_MEAT)) - { + case "31521-08.html": { + if (qs.isCond(3)) { + if (hasItem(player, SPECIAL_YETI_MEAT)) { int random = getRandom(1000); - if (random < 167) - { + if (random < 167) { rewardItems(player, GREATER_DYE_OF_STR_1); - } - else if (random < 334) - { + } else if (random < 334) { rewardItems(player, GREATER_DYE_OF_STR_2); - } - else if (random < 501) - { + } else if (random < 501) { rewardItems(player, GREATER_DYE_OF_CON_1); - } - else if (random < 668) - { + } else if (random < 668) { rewardItems(player, GREATER_DYE_OF_CON_2); - } - else if (random < 835) - { + } else if (random < 835) { rewardItems(player, GREATER_DYE_OF_DEX_1); - } - else if (random < 1000) - { + } else if (random < 1000) { rewardItems(player, GREATER_DYE_OF_DEX_2); } qs.exitQuest(false, true); htmltext = event; - } - else - { + } else { htmltext = "31521-09.html"; } } break; } - case "31542-02.html": - { - if (qs.isCond(1)) - { - if (hasItem(player, FOOD_FOR_BUMBALUMP)) - { - if (!isBumbalumpSpawned()) - { + case "31542-02.html": { + if (qs.isCond(1)) { + if (hasItem(player, FOOD_FOR_BUMBALUMP)) { + if (!isBumbalumpSpawned()) { qs.setCond(2, true); takeItem(player, FOOD_FOR_BUMBALUMP); L2Npc umpaloopa = addSpawn(ICICLE_EMPEROR_BUMBALUMP, ICICLE_EMPEROR_BUMBALUMP_LOC); umpaloopa.setSummoner(player); htmltext = event; - } - else - { + } else { htmltext = "31542-03.html"; } - } - else - { + } else { htmltext = "31542-04.html"; } } break; } - case "NPC_TALK": - { - if (isBumbalumpSpawned()) - { + case "NPC_TALK": { + if (isBumbalumpSpawned()) { npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getTemplate().getDisplayId(), NpcStringId.OOOH)); } break; @@ -171,80 +138,56 @@ public final class Q00625_TheFinestIngredientsPart2 extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (npc.getId()) - { - case JEREMY: - { - if (qs.isCreated()) - { - if (talker.getLevel() >= MIN_LVL) - { + switch (npc.getId()) { + case JEREMY: { + if (qs.isCreated()) { + if (talker.getLevel() >= MIN_LVL) { htmltext = (hasItem(talker, SOY_SOURCE_JAR)) ? "31521-01.htm" : "31521-02.htm"; - } - else - { + } else { htmltext = "31521-03.htm"; } - } - else if (qs.isStarted()) - { - switch (qs.getCond()) - { - case 1: - { + } else if (qs.isStarted()) { + switch (qs.getCond()) { + case 1: { htmltext = "31521-05.html"; break; } - case 2: - { + case 2: { htmltext = "31521-06.html"; break; } - case 3: - { + case 3: { htmltext = "31521-07.html"; break; } } - } - else if (qs.isCompleted()) - { + } else if (qs.isCompleted()) { htmltext = getAlreadyCompletedMsg(talker); } break; } - case YETIS_TABLE: - { - switch (qs.getCond()) - { - case 1: - { - if (hasItem(talker, FOOD_FOR_BUMBALUMP)) - { + case YETIS_TABLE: { + switch (qs.getCond()) { + case 1: { + if (hasItem(talker, FOOD_FOR_BUMBALUMP)) { htmltext = "31542-01.html"; } break; } - case 2: - { - if (!isBumbalumpSpawned()) - { + case 2: { + if (!isBumbalumpSpawned()) { L2Npc umpaloopa = addSpawn(ICICLE_EMPEROR_BUMBALUMP, ICICLE_EMPEROR_BUMBALUMP_LOC); umpaloopa.setSummoner(talker); htmltext = "31542-02.html"; - } - else - { + } else { htmltext = "31542-03.html"; } break; } - case 3: - { + case 3: { htmltext = "31542-05.html"; break; } @@ -257,21 +200,17 @@ public final class Q00625_TheFinestIngredientsPart2 extends Quest } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { startQuestTimer("NPC_TALK", 1000 * 1200, npc, null); npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getTemplate().getDisplayId(), NpcStringId.I_SMELL_SOMETHING_DELICIOUS)); return super.onSpawn(npc); } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, 1, 2, npc); - if ((qs != null) && Util.checkIfInRange(1500, npc, killer, true)) - { - if (npc.getSummoner() == killer) - { + if ((qs != null) && Util.checkIfInRange(1500, npc, killer, true)) { + if (npc.getSummoner() == killer) { qs.setCond(3, true); giveItems(qs.getPlayer(), SPECIAL_YETI_MEAT); } @@ -279,8 +218,7 @@ public final class Q00625_TheFinestIngredientsPart2 extends Quest return super.onKill(npc, killer, isSummon); } - private static boolean isBumbalumpSpawned() - { + private static boolean isBumbalumpSpawned() { return SpawnTable.getInstance().findAny(ICICLE_EMPEROR_BUMBALUMP) != null; } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00626_ADarkTwilight/Q00626_ADarkTwilight.java b/src/main/java/com/l2jserver/datapack/quests/Q00626_ADarkTwilight/Q00626_ADarkTwilight.java index 48e26cc7c7..fc075a0c1a 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00626_ADarkTwilight/Q00626_ADarkTwilight.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00626_ADarkTwilight/Q00626_ADarkTwilight.java @@ -35,16 +35,14 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by disKret. * @author Citizen */ -public class Q00626_ADarkTwilight extends Quest -{ +public class Q00626_ADarkTwilight extends Quest { // NPCs private static final int HIERARCH = 31517; // Items private static final int BLOOD_OF_SAINT = 7169; // Monsters private static final Map<Integer, Integer> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(21520, 641); // Eye of Splendor MONSTERS.put(21523, 648); // Flash of Splendor MONSTERS.put(21524, 692); // Blade of Splendor @@ -68,8 +66,7 @@ public class Q00626_ADarkTwilight extends Quest private static final int XP_COUNT = 162773; private static final int SP_COUNT = 12500; - public Q00626_ADarkTwilight() - { + public Q00626_ADarkTwilight() { super(626, Q00626_ADarkTwilight.class.getSimpleName(), "A Dark Twilight"); addStartNpc(HIERARCH); addTalkId(HIERARCH); @@ -78,24 +75,20 @@ public class Q00626_ADarkTwilight extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "31517-05.html": break; case "31517-02.htm": st.startQuest(); break; case "Exp": - if (st.getQuestItemsCount(BLOOD_OF_SAINT) < ITEMS_COUNT_REQUIRED) - { + if (st.getQuestItemsCount(BLOOD_OF_SAINT) < ITEMS_COUNT_REQUIRED) { return "31517-06.html"; } st.addExpAndSp(XP_COUNT, SP_COUNT); @@ -103,8 +96,7 @@ public class Q00626_ADarkTwilight extends Quest htmltext = "31517-07.html"; break; case "Adena": - if (st.getQuestItemsCount(BLOOD_OF_SAINT) < ITEMS_COUNT_REQUIRED) - { + if (st.getQuestItemsCount(BLOOD_OF_SAINT) < ITEMS_COUNT_REQUIRED) { return "31517-06.html"; } st.giveAdena(ADENA_COUNT, true); @@ -119,22 +111,16 @@ public class Q00626_ADarkTwilight extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(killer, 1); - if (partyMember != null) - { + if (partyMember != null) { final QuestState st = getQuestState(partyMember, false); final double chance = MONSTERS.get(npc.getId()) * rates().getRateQuestDrop(); - if (getRandom(1000) < chance) - { + if (getRandom(1000) < chance) { st.giveItems(BLOOD_OF_SAINT, 1); - if (st.getQuestItemsCount(BLOOD_OF_SAINT) < ITEMS_COUNT_REQUIRED) - { + if (st.getQuestItemsCount(BLOOD_OF_SAINT) < ITEMS_COUNT_REQUIRED) { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - } - else - { + } else { st.setCond(2, true); } } @@ -143,18 +129,15 @@ public class Q00626_ADarkTwilight extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL_REQUIRED) ? "31517-01.htm" : "31517-00.htm"; break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "31517-03.html"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00627_HeartInSearchOfPower/Q00627_HeartInSearchOfPower.java b/src/main/java/com/l2jserver/datapack/quests/Q00627_HeartInSearchOfPower/Q00627_HeartInSearchOfPower.java index f09fc55fb6..20f153c330 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00627_HeartInSearchOfPower/Q00627_HeartInSearchOfPower.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00627_HeartInSearchOfPower/Q00627_HeartInSearchOfPower.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.model.quest.State; * Heart in Search of Power (627) * @author Citizen */ -public class Q00627_HeartInSearchOfPower extends Quest -{ +public class Q00627_HeartInSearchOfPower extends Quest { // NPCs private static final int MYSTERIOUS_NECROMANCER = 31518; private static final int ENFEUX = 31519; @@ -45,8 +44,7 @@ public class Q00627_HeartInSearchOfPower extends Quest private static final int GEM_OF_SAINTS = 7172; // Monsters private static final Map<Integer, Integer> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(21520, 661); // Eye of Splendor MONSTERS.put(21523, 668); // Flash of Splendor MONSTERS.put(21524, 714); // Blade of Splendor @@ -71,8 +69,7 @@ public class Q00627_HeartInSearchOfPower extends Quest private static final int ENRIA = 4042; private static final int MOLD_HARDENER = 4041; - public Q00627_HeartInSearchOfPower() - { + public Q00627_HeartInSearchOfPower() { super(627, Q00627_HeartInSearchOfPower.class.getSimpleName(), "Heart in Search of Power"); addStartNpc(MYSTERIOUS_NECROMANCER); addTalkId(MYSTERIOUS_NECROMANCER, ENFEUX); @@ -81,22 +78,18 @@ public class Q00627_HeartInSearchOfPower extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "31518-02.htm": st.startQuest(); break; case "31518-06.html": - if (st.getQuestItemsCount(BEAD_OF_OBEDIENCE) < BEAD_OF_OBEDIENCE_COUNT_REQUIRED) - { + if (st.getQuestItemsCount(BEAD_OF_OBEDIENCE) < BEAD_OF_OBEDIENCE_COUNT_REQUIRED) { return "31518-05.html"; } st.giveItems(SEAL_OF_LIGHT, 1); @@ -108,12 +101,10 @@ public class Q00627_HeartInSearchOfPower extends Quest case "Thons": case "Enrias": case "Mold_Hardener": - if (!st.hasQuestItems(GEM_OF_SAINTS)) - { + if (!st.hasQuestItems(GEM_OF_SAINTS)) { return "31518-11.html"; } - switch (event) - { + switch (event) { case "Adena": st.giveAdena(100000, true); break; @@ -138,14 +129,11 @@ public class Q00627_HeartInSearchOfPower extends Quest st.exitQuest(true); break; case "31519-02.html": - if (st.hasQuestItems(SEAL_OF_LIGHT) && st.isCond(3)) - { + if (st.hasQuestItems(SEAL_OF_LIGHT) && st.isCond(3)) { st.giveItems(GEM_OF_SAINTS, 1); st.takeItems(SEAL_OF_LIGHT, -1); st.setCond(4); - } - else - { + } else { htmltext = getNoQuestMsg(player); } break; @@ -159,22 +147,16 @@ public class Q00627_HeartInSearchOfPower extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(killer, 1); - if (partyMember != null) - { + if (partyMember != null) { final QuestState st = getQuestState(partyMember, false); final double chance = MONSTERS.get(npc.getId()) * rates().getRateQuestDrop(); - if (getRandom(1000) < chance) - { + if (getRandom(1000) < chance) { st.giveItems(BEAD_OF_OBEDIENCE, 1); - if (st.getQuestItemsCount(BEAD_OF_OBEDIENCE) < BEAD_OF_OBEDIENCE_COUNT_REQUIRED) - { + if (st.getQuestItemsCount(BEAD_OF_OBEDIENCE) < BEAD_OF_OBEDIENCE_COUNT_REQUIRED) { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - } - else - { + } else { st.setCond(2, true); } } @@ -183,24 +165,19 @@ public class Q00627_HeartInSearchOfPower extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: - if (npc.getId() == MYSTERIOUS_NECROMANCER) - { + if (npc.getId() == MYSTERIOUS_NECROMANCER) { htmltext = (player.getLevel() >= MIN_LEVEL_REQUIRED) ? "31518-01.htm" : "31518-00.htm"; } break; case State.STARTED: - switch (npc.getId()) - { + switch (npc.getId()) { case MYSTERIOUS_NECROMANCER: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "31518-03.html"; break; @@ -216,8 +193,7 @@ public class Q00627_HeartInSearchOfPower extends Quest } break; case ENFEUX: - switch (st.getCond()) - { + switch (st.getCond()) { case 3: htmltext = "31519-01.html"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00628_HuntGoldenRam/Q00628_HuntGoldenRam.java b/src/main/java/com/l2jserver/datapack/quests/Q00628_HuntGoldenRam/Q00628_HuntGoldenRam.java index 3996d55673..275e3ab400 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00628_HuntGoldenRam/Q00628_HuntGoldenRam.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00628_HuntGoldenRam/Q00628_HuntGoldenRam.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.model.quest.State; * Hunt of the Golden Ram Mercenary Force (628) * @author netvirus, Zoey76 */ -public final class Q00628_HuntGoldenRam extends Quest -{ +public final class Q00628_HuntGoldenRam extends Quest { // NPCs private static final int KAHMAN = 31554; // Items @@ -47,8 +46,7 @@ public final class Q00628_HuntGoldenRam extends Quest // Mobs private static final Map<Integer, ItemChanceHolder> MOBS_DROP_CHANCES = new HashMap<>(); - static - { + static { MOBS_DROP_CHANCES.put(21508, new ItemChanceHolder(SPLINTER_STAKATO_CHITIN, 0.500, 1)); // splinter_stakato MOBS_DROP_CHANCES.put(21509, new ItemChanceHolder(SPLINTER_STAKATO_CHITIN, 0.430, 1)); // splinter_stakato_worker MOBS_DROP_CHANCES.put(21510, new ItemChanceHolder(SPLINTER_STAKATO_CHITIN, 0.521, 1)); // splinter_stakato_soldier @@ -61,8 +59,7 @@ public final class Q00628_HuntGoldenRam extends Quest MOBS_DROP_CHANCES.put(21517, new ItemChanceHolder(NEEDLE_STAKATO_CHITIN, 0.744, 2)); // needle_stakato_drone_a } - public Q00628_HuntGoldenRam() - { + public Q00628_HuntGoldenRam() { super(628, Q00628_HuntGoldenRam.class.getSimpleName(), "Hunt of the Golden Ram Mercenary Force"); addStartNpc(KAHMAN); addTalkId(KAHMAN); @@ -71,43 +68,31 @@ public final class Q00628_HuntGoldenRam extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { - case "accept": - { - if (qs.isCreated() && (player.getLevel() >= MIN_LVL)) - { + switch (event) { + case "accept": { + if (qs.isCreated() && (player.getLevel() >= MIN_LVL)) { qs.startQuest(); - if (hasQuestItems(player, GOLDEN_RAM_BADGE_SOLDIER)) - { + if (hasQuestItems(player, GOLDEN_RAM_BADGE_SOLDIER)) { qs.setCond(3); htmltext = "31554-05.htm"; - } - else if (hasQuestItems(player, GOLDEN_RAM_BADGE_RECRUIT)) - { + } else if (hasQuestItems(player, GOLDEN_RAM_BADGE_RECRUIT)) { qs.setCond(2); htmltext = "31554-04.htm"; - } - else - { + } else { htmltext = "31554-03.htm"; } } break; } - case "31554-08.html": - { - if (getQuestItemsCount(player, SPLINTER_STAKATO_CHITIN) >= REQUIRED_ITEM_COUNT) - { + case "31554-08.html": { + if (getQuestItemsCount(player, SPLINTER_STAKATO_CHITIN) >= REQUIRED_ITEM_COUNT) { giveItems(player, GOLDEN_RAM_BADGE_RECRUIT, 1); takeItems(player, SPLINTER_STAKATO_CHITIN, -1); qs.setCond(2, true); @@ -116,18 +101,14 @@ public final class Q00628_HuntGoldenRam extends Quest break; } case "31554-12.html": - case "31554-13.html": - { - if (qs.isStarted()) - { + case "31554-13.html": { + if (qs.isStarted()) { htmltext = event; } break; } - case "31554-14.html": - { - if (qs.isStarted()) - { + case "31554-14.html": { + if (qs.isStarted()) { qs.exitQuest(true, true); htmltext = event; } @@ -138,14 +119,11 @@ public final class Q00628_HuntGoldenRam extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, -1, 1, npc); - if (qs != null) - { + if (qs != null) { final ItemChanceHolder item = MOBS_DROP_CHANCES.get(npc.getId()); - if ((item.getCount() <= qs.getCond()) && !qs.isCond(3)) - { + if ((item.getCount() <= qs.getCond()) && !qs.isCond(3)) { giveItemRandomly(qs.getPlayer(), npc, item.getId(), 1, REQUIRED_ITEM_COUNT, item.getChance(), true); } } @@ -153,61 +131,44 @@ public final class Q00628_HuntGoldenRam extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (qs.getState()) - { - case State.CREATED: - { + switch (qs.getState()) { + case State.CREATED: { htmltext = ((player.getLevel() >= MIN_LVL) ? "31554-01.htm" : "31554-02.htm"); break; } - case State.STARTED: - { + case State.STARTED: { final long itemCountSplinter = getQuestItemsCount(player, SPLINTER_STAKATO_CHITIN); final long itemCountNeedle = getQuestItemsCount(player, NEEDLE_STAKATO_CHITIN); - switch (qs.getCond()) - { - case 1: - { + switch (qs.getCond()) { + case 1: { htmltext = ((itemCountSplinter >= REQUIRED_ITEM_COUNT) ? "31554-07.html" : "31554-06.html"); break; } - case 2: - { - if (hasQuestItems(player, GOLDEN_RAM_BADGE_RECRUIT)) - { - if ((itemCountSplinter >= REQUIRED_ITEM_COUNT) && (itemCountNeedle >= REQUIRED_ITEM_COUNT)) - { + case 2: { + if (hasQuestItems(player, GOLDEN_RAM_BADGE_RECRUIT)) { + if ((itemCountSplinter >= REQUIRED_ITEM_COUNT) && (itemCountNeedle >= REQUIRED_ITEM_COUNT)) { takeItems(player, GOLDEN_RAM_BADGE_RECRUIT, -1); takeItems(player, SPLINTER_STAKATO_CHITIN, -1); takeItems(player, NEEDLE_STAKATO_CHITIN, -1); giveItems(player, GOLDEN_RAM_BADGE_SOLDIER, 1); qs.setCond(3, true); htmltext = "31554-10.html"; - } - else - { + } else { htmltext = "31554-09.html"; } - } - else - { + } else { qs.setCond(1); htmltext = ((itemCountSplinter >= REQUIRED_ITEM_COUNT) ? "31554-07.html" : "31554-06.html"); } break; } - case 3: - { - if (hasQuestItems(player, GOLDEN_RAM_BADGE_SOLDIER)) - { + case 3: { + if (hasQuestItems(player, GOLDEN_RAM_BADGE_SOLDIER)) { htmltext = "31554-11.html"; - } - else - { + } else { qs.setCond(1); htmltext = ((itemCountSplinter >= REQUIRED_ITEM_COUNT) ? "31554-07.html" : "31554-06.html"); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00629_CleanUpTheSwampOfScreams/Q00629_CleanUpTheSwampOfScreams.java b/src/main/java/com/l2jserver/datapack/quests/Q00629_CleanUpTheSwampOfScreams/Q00629_CleanUpTheSwampOfScreams.java index 22eafbe282..048aa193f3 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00629_CleanUpTheSwampOfScreams/Q00629_CleanUpTheSwampOfScreams.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00629_CleanUpTheSwampOfScreams/Q00629_CleanUpTheSwampOfScreams.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Clean Up The Swamp Of Screams (629) * @author netvirus */ -public final class Q00629_CleanUpTheSwampOfScreams extends Quest -{ +public final class Q00629_CleanUpTheSwampOfScreams extends Quest { // NPC private static final int PIERCE = 31553; // Items @@ -43,8 +42,7 @@ public final class Q00629_CleanUpTheSwampOfScreams extends Quest // Mobs private static final Map<Integer, Double> MOBS_DROP_CHANCES = new HashMap<>(); - static - { + static { MOBS_DROP_CHANCES.put(21508, 0.599); // splinter_stakato MOBS_DROP_CHANCES.put(21509, 0.524); // splinter_stakato_worker MOBS_DROP_CHANCES.put(21510, 0.640); // splinter_stakato_soldier @@ -57,8 +55,7 @@ public final class Q00629_CleanUpTheSwampOfScreams extends Quest MOBS_DROP_CHANCES.put(21517, 0.999); // needle_stakato_drone_a } - public Q00629_CleanUpTheSwampOfScreams() - { + public Q00629_CleanUpTheSwampOfScreams() { super(629, Q00629_CleanUpTheSwampOfScreams.class.getSimpleName(), "Clean Up The Swamp Of Screams"); addStartNpc(PIERCE); addTalkId(PIERCE); @@ -67,53 +64,40 @@ public final class Q00629_CleanUpTheSwampOfScreams extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { - case "31553-03.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "31553-03.htm": { + if (qs.isCreated()) { qs.startQuest(); htmltext = event; } break; } case "31553-04.html": - case "31553-06.html": - { - if (qs.isStarted()) - { + case "31553-06.html": { + if (qs.isStarted()) { htmltext = event; } break; } - case "31553-07.html": - { - if (qs.isStarted() && (getQuestItemsCount(player, TALON_OF_STAKATO) >= REQUIRED_TALON_COUNT)) - { + case "31553-07.html": { + if (qs.isStarted() && (getQuestItemsCount(player, TALON_OF_STAKATO) >= REQUIRED_TALON_COUNT)) { rewardItems(player, GOLDEN_RAM_COIN, 20); takeItems(player, TALON_OF_STAKATO, 100); htmltext = event; - } - else - { + } else { htmltext = "31553-08.html"; } break; } - case "31553-09.html": - { - if (qs.isStarted()) - { + case "31553-09.html": { + if (qs.isStarted()) { qs.exitQuest(true, true); htmltext = event; } @@ -124,27 +108,21 @@ public final class Q00629_CleanUpTheSwampOfScreams extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, -1, 2, npc); - if (qs != null) - { + if (qs != null) { giveItemRandomly(qs.getPlayer(), npc, TALON_OF_STAKATO, 1, 0, MOBS_DROP_CHANCES.get(npc.getId()), true); } return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { + if (qs.isCreated()) { htmltext = ((player.getLevel() >= MIN_LVL) ? "31553-01.htm" : "31553-02.htm"); - } - else if (qs.isStarted()) - { + } else if (qs.isStarted()) { htmltext = ((getQuestItemsCount(player, TALON_OF_STAKATO) >= REQUIRED_TALON_COUNT) ? "31553-04.html" : "31553-05.html"); } return htmltext; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00631_DeliciousTopChoiceMeat/Q00631_DeliciousTopChoiceMeat.java b/src/main/java/com/l2jserver/datapack/quests/Q00631_DeliciousTopChoiceMeat/Q00631_DeliciousTopChoiceMeat.java index 2b81a51e95..017ed47e7e 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00631_DeliciousTopChoiceMeat/Q00631_DeliciousTopChoiceMeat.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00631_DeliciousTopChoiceMeat/Q00631_DeliciousTopChoiceMeat.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Delicious Top Choice Meat (631) * @author Adry_85 */ -public class Q00631_DeliciousTopChoiceMeat extends Quest -{ +public class Q00631_DeliciousTopChoiceMeat extends Quest { // NPC private static final int TUNATUN = 31537; // Items @@ -41,8 +40,7 @@ public class Q00631_DeliciousTopChoiceMeat extends Quest private static final int MIN_LEVEL = 82; private static final int PRIME_MEAT_COUNT = 120; // Rewards - private static final int[] RECIPE = - { + private static final int[] RECIPE = { 10373, // Recipe - Icarus Sawsword (60%) 10374, // Recipe - Icarus Disperser (60%) 10375, // Recipe - Icarus Spirit (60%) @@ -54,8 +52,7 @@ public class Q00631_DeliciousTopChoiceMeat extends Quest 10381, // Recipe - Icarus Spitter (60%) }; - private static final int[] PIECE = - { + private static final int[] PIECE = { 10397, // Icarus Sawsword Piece 10398, // Icarus Disperser Piece 10399, // Icarus Spirit Piece @@ -71,8 +68,7 @@ public class Q00631_DeliciousTopChoiceMeat extends Quest private static final int CRYSTAL_SPICE_COMPRESSED_PACK = 15483; private static final Map<Integer, Double> MOBS_MEAT = new HashMap<>(); - static - { + static { MOBS_MEAT.put(18878, 0.172); // Full Grown Kookaburra MOBS_MEAT.put(18879, 0.334); // Full Grown Kookaburra MOBS_MEAT.put(18885, 0.172); // Full Grown Cougar @@ -83,8 +79,7 @@ public class Q00631_DeliciousTopChoiceMeat extends Quest MOBS_MEAT.put(18900, 0.349); // Full Grown Grendel } - public Q00631_DeliciousTopChoiceMeat() - { + public Q00631_DeliciousTopChoiceMeat() { super(631, Q00631_DeliciousTopChoiceMeat.class.getSimpleName(), "Delicious Top Choice Meat"); addStartNpc(TUNATUN); addTalkId(TUNATUN); @@ -93,83 +88,63 @@ public class Q00631_DeliciousTopChoiceMeat extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "quest_accept": - { - if (player.getLevel() >= MIN_LEVEL) - { + switch (event) { + case "quest_accept": { + if (player.getLevel() >= MIN_LEVEL) { st.startQuest(); htmltext = "31537-02.html"; - } - else - { + } else { htmltext = "31537-03.html"; } break; } - case "31537-06.html": - { - if (st.isCond(2) && (getQuestItemsCount(player, PRIME_MEAT) >= PRIME_MEAT_COUNT)) - { - switch (getRandom(10)) - { - case 0: - { + case "31537-06.html": { + if (st.isCond(2) && (getQuestItemsCount(player, PRIME_MEAT) >= PRIME_MEAT_COUNT)) { + switch (getRandom(10)) { + case 0: { st.rewardItems(RECIPE[getRandom(RECIPE.length)], 1); break; } - case 1: - { + case 1: { st.rewardItems(PIECE[getRandom(PIECE.length)], 1); break; } - case 2: - { + case 2: { st.rewardItems(PIECE[getRandom(PIECE.length)], 2); break; } - case 3: - { + case 3: { st.rewardItems(PIECE[getRandom(PIECE.length)], 3); break; } - case 4: - { + case 4: { st.rewardItems(PIECE[getRandom(PIECE.length)], getRandom(5) + 2); break; } - case 5: - { + case 5: { st.rewardItems(PIECE[getRandom(PIECE.length)], getRandom(7) + 2); break; } - case 6: - { + case 6: { st.rewardItems(GOLDEN_SPICE_CRATE, 1); break; } - case 7: - { + case 7: { st.rewardItems(GOLDEN_SPICE_CRATE, 2); break; } - case 8: - { + case 8: { st.rewardItems(CRYSTAL_SPICE_COMPRESSED_PACK, 1); break; } - case 9: - { + case 9: { st.rewardItems(CRYSTAL_SPICE_COMPRESSED_PACK, 2); break; } @@ -184,13 +159,10 @@ public class Q00631_DeliciousTopChoiceMeat extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getRandomPartyMemberState(player, 1, 3, npc); - if (st != null) - { - if (st.giveItemRandomly(npc, PRIME_MEAT, 1, PRIME_MEAT_COUNT, MOBS_MEAT.get(npc.getId()), true)) - { + if (st != null) { + if (st.giveItemRandomly(npc, PRIME_MEAT, 1, PRIME_MEAT_COUNT, MOBS_MEAT.get(npc.getId()), true)) { st.setCond(2, true); } } @@ -198,27 +170,18 @@ public class Q00631_DeliciousTopChoiceMeat extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCreated()) - { + if (st.isCreated()) { htmltext = "31537-01.htm"; - } - else if (st.isStarted()) - { - if (st.isCond(1)) - { - if (st.getQuestItemsCount(PRIME_MEAT) < PRIME_MEAT_COUNT) - { + } else if (st.isStarted()) { + if (st.isCond(1)) { + if (st.getQuestItemsCount(PRIME_MEAT) < PRIME_MEAT_COUNT) { htmltext = "31537-04.html"; } - } - else if (st.isCond(2)) - { - if (st.getQuestItemsCount(PRIME_MEAT) >= PRIME_MEAT_COUNT) - { + } else if (st.isCond(2)) { + if (st.getQuestItemsCount(PRIME_MEAT) >= PRIME_MEAT_COUNT) { htmltext = "31537-05.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00632_NecromancersRequest/Q00632_NecromancersRequest.java b/src/main/java/com/l2jserver/datapack/quests/Q00632_NecromancersRequest/Q00632_NecromancersRequest.java index ea755c3ad6..2f0e64ddac 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00632_NecromancersRequest/Q00632_NecromancersRequest.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00632_NecromancersRequest/Q00632_NecromancersRequest.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Necromancer's Request (632) * @author Zoey76 */ -public final class Q00632_NecromancersRequest extends Quest -{ +public final class Q00632_NecromancersRequest extends Quest { // NPC private static final int MYSTERIOUS_WIZARD = 31522; // Items @@ -44,8 +43,7 @@ public final class Q00632_NecromancersRequest extends Quest // Monsters private static final Map<Integer, Double> BRAIN_MONSTERS = new HashMap<>(); private static final Map<Integer, Double> HEART_MONSTERS = new HashMap<>(); - static - { + static { BRAIN_MONSTERS.put(21547, 0.565); // Corrupted Knight BRAIN_MONSTERS.put(21548, 0.484); // Resurrected Knight BRAIN_MONSTERS.put(21549, 0.585); // Corrupted Guard @@ -77,8 +75,7 @@ public final class Q00632_NecromancersRequest extends Quest HEART_MONSTERS.put(21595, 0.392); // Vampire Warlord } - public Q00632_NecromancersRequest() - { + public Q00632_NecromancersRequest() { super(632, Q00632_NecromancersRequest.class.getSimpleName(), "Necromancer's Request"); addStartNpc(MYSTERIOUS_WIZARD); addTalkId(MYSTERIOUS_WIZARD); @@ -88,49 +85,38 @@ public final class Q00632_NecromancersRequest extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "31522-104.htm": - { - if (player.getLevel() >= MIN_LEVEL) - { + switch (event) { + case "31522-104.htm": { + if (player.getLevel() >= MIN_LEVEL) { qs.startQuest(); qs.setMemoState(11); htmltext = event; } break; } - case "31522-201.html": - { + case "31522-201.html": { htmltext = event; break; } - case "31522-202.html": - { - if (getQuestItemsCount(player, VAMPIRES_HEART) >= REQUIRED_ITEM_COUNT) - { + case "31522-202.html": { + if (getQuestItemsCount(player, VAMPIRES_HEART) >= REQUIRED_ITEM_COUNT) { takeItems(player, VAMPIRES_HEART, -1); giveAdena(player, ADENA_REWARD, true); qs.setMemoState(11); htmltext = event; - } - else - { + } else { htmltext = "31522-203.html"; } break; } - case "31522-204.html": - { + case "31522-204.html": { takeItems(player, VAMPIRES_HEART, -1); qs.exitQuest(true, true); htmltext = event; @@ -141,21 +127,15 @@ public final class Q00632_NecromancersRequest extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(player, -1, 3, npc); - if (qs != null) - { - if (BRAIN_MONSTERS.containsKey(npc.getId())) - { + if (qs != null) { + if (BRAIN_MONSTERS.containsKey(npc.getId())) { qs.giveItemRandomly(npc, ZOMBIES_BRAIN, 1, 0, BRAIN_MONSTERS.get(npc.getId()), true); - } - else - { + } else { qs.giveItemRandomly(npc, VAMPIRES_HEART, 1, 0, HEART_MONSTERS.get(npc.getId()), true); - if (getQuestItemsCount(player, VAMPIRES_HEART) >= REQUIRED_ITEM_COUNT) - { + if (getQuestItemsCount(player, VAMPIRES_HEART) >= REQUIRED_ITEM_COUNT) { qs.setCond(2); qs.setMemoState(12); } @@ -165,22 +145,15 @@ public final class Q00632_NecromancersRequest extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { + if (qs.isCreated()) { htmltext = player.getLevel() >= MIN_LEVEL ? "31522-101.htm" : "31522-103.htm"; - } - else if (qs.isStarted()) - { - if (qs.isMemoState(11)) - { + } else if (qs.isStarted()) { + if (qs.isMemoState(11)) { htmltext = "31522-106.html"; - } - else if (qs.isMemoState(12) && (getQuestItemsCount(player, VAMPIRES_HEART) >= REQUIRED_ITEM_COUNT)) - { + } else if (qs.isMemoState(12) && (getQuestItemsCount(player, VAMPIRES_HEART) >= REQUIRED_ITEM_COUNT)) { htmltext = "31522-105.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00633_InTheForgottenVillage/Q00633_InTheForgottenVillage.java b/src/main/java/com/l2jserver/datapack/quests/Q00633_InTheForgottenVillage/Q00633_InTheForgottenVillage.java index ed45a4ad28..d444baf713 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00633_InTheForgottenVillage/Q00633_InTheForgottenVillage.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00633_InTheForgottenVillage/Q00633_InTheForgottenVillage.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * In The Forgotten Village (633) * @author netvirus */ -public final class Q00633_InTheForgottenVillage extends Quest -{ +public final class Q00633_InTheForgottenVillage extends Quest { // NPC private static final int MINA = 31388; // Items @@ -43,8 +42,7 @@ public final class Q00633_InTheForgottenVillage extends Quest private static final int RIB_BONE_REQUIRED_COUNT = 200; // Mobs private static final Map<Integer, ItemChanceHolder> MOBS_DROP_CHANCES = new HashMap<>(); - static - { + static { MOBS_DROP_CHANCES.put(21553, new ItemChanceHolder(ZOMBIES_LIVER, 0.417)); // Trampled Man MOBS_DROP_CHANCES.put(21554, new ItemChanceHolder(ZOMBIES_LIVER, 0.417)); // Trampled Man MOBS_DROP_CHANCES.put(21557, new ItemChanceHolder(RIB_BONE_OF_A_BLACK_MAGUS, 0.394)); // Bone Snatcher @@ -74,8 +72,7 @@ public final class Q00633_InTheForgottenVillage extends Quest MOBS_DROP_CHANCES.put(21601, new ItemChanceHolder(RIB_BONE_OF_A_BLACK_MAGUS, 0.677)); // Requiem Behemoth } - public Q00633_InTheForgottenVillage() - { + public Q00633_InTheForgottenVillage() { super(633, Q00633_InTheForgottenVillage.class.getSimpleName(), "In The Forgotten Village"); addStartNpc(MINA); addTalkId(MINA); @@ -84,21 +81,16 @@ public final class Q00633_InTheForgottenVillage extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { - case "31388-03.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "31388-03.htm": { + if (qs.isCreated()) { qs.startQuest(); htmltext = event; } @@ -106,37 +98,28 @@ public final class Q00633_InTheForgottenVillage extends Quest } case "31388-04.html": case "31388-05.html": - case "31388-06.html": - { - if (qs.isStarted()) - { + case "31388-06.html": { + if (qs.isStarted()) { htmltext = event; } break; } - case "31388-07.html": - { - if (qs.isCond(2)) - { - if (getQuestItemsCount(player, RIB_BONE_OF_A_BLACK_MAGUS) >= RIB_BONE_REQUIRED_COUNT) - { + case "31388-07.html": { + if (qs.isCond(2)) { + if (getQuestItemsCount(player, RIB_BONE_OF_A_BLACK_MAGUS) >= RIB_BONE_REQUIRED_COUNT) { giveAdena(player, 25000, true); addExpAndSp(player, 305235, 0); takeItems(player, RIB_BONE_OF_A_BLACK_MAGUS, -1); qs.setCond(1, true); htmltext = event; - } - else - { + } else { htmltext = "31388-08.html"; } } break; } - case "31388-09.html": - { - if (qs.isStarted()) - { + case "31388-09.html": { + if (qs.isStarted()) { qs.exitQuest(true, true); htmltext = event; } @@ -147,24 +130,18 @@ public final class Q00633_InTheForgottenVillage extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc); - if (qs != null) - { + if (qs != null) { final ItemChanceHolder info = MOBS_DROP_CHANCES.get(npc.getId()); - switch (info.getId()) - { - case RIB_BONE_OF_A_BLACK_MAGUS: - { - if (qs.isCond(1) && giveItemRandomly(qs.getPlayer(), npc, RIB_BONE_OF_A_BLACK_MAGUS, 1, RIB_BONE_REQUIRED_COUNT, info.getChance(), true)) - { + switch (info.getId()) { + case RIB_BONE_OF_A_BLACK_MAGUS: { + if (qs.isCond(1) && giveItemRandomly(qs.getPlayer(), npc, RIB_BONE_OF_A_BLACK_MAGUS, 1, RIB_BONE_REQUIRED_COUNT, info.getChance(), true)) { qs.setCond(2); } break; } - case ZOMBIES_LIVER: - { + case ZOMBIES_LIVER: { giveItemRandomly(qs.getPlayer(), npc, ZOMBIES_LIVER, 1, 0, info.getChance(), true); break; } @@ -174,16 +151,12 @@ public final class Q00633_InTheForgottenVillage extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { + if (qs.isCreated()) { htmltext = ((player.getLevel() >= MIN_LVL) ? "31388-01.htm" : "31388-02.htm"); - } - else if (qs.isStarted()) - { + } else if (qs.isStarted()) { htmltext = ((getQuestItemsCount(player, RIB_BONE_OF_A_BLACK_MAGUS) >= RIB_BONE_REQUIRED_COUNT) ? "31388-04.html" : "31388-05.html"); } return htmltext; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00634_InSearchOfFragmentsOfDimension/Q00634_InSearchOfFragmentsOfDimension.java b/src/main/java/com/l2jserver/datapack/quests/Q00634_InSearchOfFragmentsOfDimension/Q00634_InSearchOfFragmentsOfDimension.java index cf220d3a58..3ece82d657 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00634_InSearchOfFragmentsOfDimension/Q00634_InSearchOfFragmentsOfDimension.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00634_InSearchOfFragmentsOfDimension/Q00634_InSearchOfFragmentsOfDimension.java @@ -27,11 +27,9 @@ import com.l2jserver.gameserver.model.quest.QuestState; * In Search of Fragments of Dimension (634) * @author Adry_85 */ -public final class Q00634_InSearchOfFragmentsOfDimension extends Quest -{ +public final class Q00634_InSearchOfFragmentsOfDimension extends Quest { // NPCs - private static final int[] DIMENSIONAL_GATE_KEEPER = - { + private static final int[] DIMENSIONAL_GATE_KEEPER = { 31494, 31495, 31496, @@ -53,8 +51,7 @@ public final class Q00634_InSearchOfFragmentsOfDimension extends Quest // Misc private static final int MIN_LEVEL = 20; // Monsters - private static final int[] MOBS = - { + private static final int[] MOBS = { 21208, // Hallowed Watchman 21209, // Hallowed Seer 21210, // Vault Guardian @@ -106,8 +103,7 @@ public final class Q00634_InSearchOfFragmentsOfDimension extends Quest 21256, // Underground Werewolf }; - public Q00634_InSearchOfFragmentsOfDimension() - { + public Q00634_InSearchOfFragmentsOfDimension() { super(634, Q00634_InSearchOfFragmentsOfDimension.class.getSimpleName(), "In Search of Fragments of Dimension"); addStartNpc(DIMENSIONAL_GATE_KEEPER); addTalkId(DIMENSIONAL_GATE_KEEPER); @@ -115,36 +111,28 @@ public final class Q00634_InSearchOfFragmentsOfDimension extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "31494-02.htm": - { + switch (event) { + case "31494-02.htm": { qs.startQuest(); htmltext = event; break; } case "31494-05.html": - case "31494-06.html": - { - if (qs.isStarted()) - { + case "31494-06.html": { + if (qs.isStarted()) { htmltext = event; } break; } - case "31494-07.html": - { - if (qs.isStarted()) - { + case "31494-07.html": { + if (qs.isStarted()) { qs.exitQuest(true, true); htmltext = event; } @@ -155,14 +143,11 @@ public final class Q00634_InSearchOfFragmentsOfDimension extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(player, -1, 3, npc); - if (qs != null) - { + if (qs != null) { final int i0 = (int) ((0.15 * npc.getLevel()) + 1.6); - if (getRandom(100) < 10) - { + if (getRandom(100) < 10) { giveItemRandomly(qs.getPlayer(), npc, DIMENSIONAL_FRAGMENT, i0, 0, 1.0, true); } } @@ -170,16 +155,12 @@ public final class Q00634_InSearchOfFragmentsOfDimension extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { + if (qs.isCreated()) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "31494-01.htm" : "31494-03.htm"; - } - else if (qs.isStarted()) - { + } else if (qs.isStarted()) { htmltext = "31494-04.html"; } return htmltext; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00635_IntoTheDimensionalRift/Q00635_IntoTheDimensionalRift.java b/src/main/java/com/l2jserver/datapack/quests/Q00635_IntoTheDimensionalRift/Q00635_IntoTheDimensionalRift.java index a6abd247cd..ae6dffcd90 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00635_IntoTheDimensionalRift/Q00635_IntoTheDimensionalRift.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00635_IntoTheDimensionalRift/Q00635_IntoTheDimensionalRift.java @@ -25,10 +25,8 @@ import com.l2jserver.gameserver.model.quest.Quest; * NOTE: Dummy Quest shown in players' questlist when inside the rift * @author malyelfik */ -public class Q00635_IntoTheDimensionalRift extends Quest -{ - public Q00635_IntoTheDimensionalRift() - { +public class Q00635_IntoTheDimensionalRift extends Quest { + public Q00635_IntoTheDimensionalRift() { super(635, Q00635_IntoTheDimensionalRift.class.getSimpleName(), "Into the Dimensional Rift"); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00636_TruthBeyond/Q00636_TruthBeyond.java b/src/main/java/com/l2jserver/datapack/quests/Q00636_TruthBeyond/Q00636_TruthBeyond.java index a94b9f9a42..0ca508618e 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00636_TruthBeyond/Q00636_TruthBeyond.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00636_TruthBeyond/Q00636_TruthBeyond.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.zone.L2ZoneType; * Original Jython script by Polo, BiTi and DrLecter. * @author DS */ -public final class Q00636_TruthBeyond extends Quest -{ +public final class Q00636_TruthBeyond extends Quest { private static final int ELIYAH = 31329; private static final int FLAURON = 32010; private static final int ZONE = 30100; @@ -40,8 +39,7 @@ public final class Q00636_TruthBeyond extends Quest private static final int FADED_MARK = 8065; private static final int MARK = 8067; - public Q00636_TruthBeyond() - { + public Q00636_TruthBeyond() { super(636, Q00636_TruthBeyond.class.getSimpleName(), "The Truth Beyond the Gate"); addStartNpc(ELIYAH); addTalkId(ELIYAH, FLAURON); @@ -49,20 +47,15 @@ public final class Q00636_TruthBeyond extends Quest } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } - if ("31329-04.htm".equals(event)) - { + if ("31329-04.htm".equals(event)) { st.startQuest(); - } - else if ("32010-02.htm".equals(event)) - { + } else if ("32010-02.htm".equals(event)) { st.giveItems(VISITOR_MARK, 1); st.exitQuest(true, true); } @@ -70,13 +63,10 @@ public final class Q00636_TruthBeyond extends Quest } @Override - public final String onEnterZone(L2Character character, L2ZoneType zone) - { + public final String onEnterZone(L2Character character, L2ZoneType zone) { // QuestState already null on enter because quest is finished - if (character.isPlayer()) - { - if (character.getActingPlayer().destroyItemByItemId("Mark", VISITOR_MARK, 1, character, false)) - { + if (character.isPlayer()) { + if (character.getActingPlayer().destroyItemByItemId("Mark", VISITOR_MARK, 1, character, false)) { character.getActingPlayer().addItem("Mark", FADED_MARK, 1, character, true); } } @@ -84,40 +74,30 @@ public final class Q00636_TruthBeyond extends Quest } @Override - public final String onTalk(L2Npc npc, L2PcInstance player) - { + public final String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - if (npc.getId() == ELIYAH) - { - if (st.hasQuestItems(VISITOR_MARK) || st.hasQuestItems(FADED_MARK) || st.hasQuestItems(MARK)) - { + if (npc.getId() == ELIYAH) { + if (st.hasQuestItems(VISITOR_MARK) || st.hasQuestItems(FADED_MARK) || st.hasQuestItems(MARK)) { st.exitQuest(true); return "31329-mark.htm"; } - if (st.getState() == State.CREATED) - { - if (player.getLevel() > 72) - { + if (st.getState() == State.CREATED) { + if (player.getLevel() > 72) { return "31329-02.htm"; } st.exitQuest(true); return "31329-01.htm"; - } - else if (st.getState() == State.STARTED) - { + } else if (st.getState() == State.STARTED) { return "31329-05.htm"; } - } - else if (st.getState() == State.STARTED) // Flauron only + } else if (st.getState() == State.STARTED) // Flauron only { - if (st.isCond(1)) - { + if (st.isCond(1)) { return "32010-01.htm"; } st.exitQuest(true); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00637_ThroughOnceMore/Q00637_ThroughOnceMore.java b/src/main/java/com/l2jserver/datapack/quests/Q00637_ThroughOnceMore/Q00637_ThroughOnceMore.java index e12b36b2bc..a9c1b54177 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00637_ThroughOnceMore/Q00637_ThroughOnceMore.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00637_ThroughOnceMore/Q00637_ThroughOnceMore.java @@ -32,11 +32,9 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by BiTi! and DrLecter. * @author DS */ -public final class Q00637_ThroughOnceMore extends Quest -{ +public final class Q00637_ThroughOnceMore extends Quest { private static final int FLAURON = 32010; - private static final int[] MOBS = - { + private static final int[] MOBS = { 21565, 21566, 21567 @@ -48,8 +46,7 @@ public final class Q00637_ThroughOnceMore extends Quest private static final double DROP_CHANCE = 90; - public Q00637_ThroughOnceMore() - { + public Q00637_ThroughOnceMore() { super(637, Q00637_ThroughOnceMore.class.getSimpleName(), "Through the Gate Once More"); addStartNpc(FLAURON); addTalkId(FLAURON); @@ -58,50 +55,37 @@ public final class Q00637_ThroughOnceMore extends Quest } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } - if ("32010-03.htm".equals(event)) - { + if ("32010-03.htm".equals(event)) { st.startQuest(); - } - else if ("32010-10.htm".equals(event)) - { + } else if ("32010-10.htm".equals(event)) { st.exitQuest(true); } return event; } @Override - public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && (st.getState() == State.STARTED)) - { + if ((st != null) && (st.getState() == State.STARTED)) { final long count = st.getQuestItemsCount(NECRO_HEART); - if (count < 10) - { + if (count < 10) { int chance = (int) (rates().getRateQuestDrop() * DROP_CHANCE); int numItems = chance / 100; chance = chance % 100; - if (getRandom(100) < chance) - { + if (getRandom(100) < chance) { numItems++; } - if (numItems > 0) - { - if ((count + numItems) >= 10) - { + if (numItems > 0) { + if ((count + numItems) >= 10) { numItems = 10 - (int) count; st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -113,41 +97,31 @@ public final class Q00637_ThroughOnceMore extends Quest } @Override - public final String onTalk(L2Npc npc, L2PcInstance player) - { + public final String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } final byte id = st.getState(); - if (id == State.CREATED) - { - if (player.getLevel() > 72) - { - if (st.hasQuestItems(FADED_MARK)) - { + if (id == State.CREATED) { + if (player.getLevel() > 72) { + if (st.hasQuestItems(FADED_MARK)) { return "32010-02.htm"; } - if (st.hasQuestItems(VISITOR_MARK)) - { + if (st.hasQuestItems(VISITOR_MARK)) { st.exitQuest(true); return "32010-01a.htm"; } - if (st.hasQuestItems(MARK)) - { + if (st.hasQuestItems(MARK)) { st.exitQuest(true); return "32010-0.htm"; } } st.exitQuest(true); return "32010-01.htm"; - } - else if (id == State.STARTED) - { - if ((st.isCond(2)) && (st.getQuestItemsCount(NECRO_HEART) == 10)) - { + } else if (id == State.STARTED) { + if ((st.isCond(2)) && (st.getQuestItemsCount(NECRO_HEART) == 10)) { st.takeItems(NECRO_HEART, 10); st.takeItems(FADED_MARK, 1); st.giveItems(MARK, 1); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00638_SeekersOfTheHolyGrail/Q00638_SeekersOfTheHolyGrail.java b/src/main/java/com/l2jserver/datapack/quests/Q00638_SeekersOfTheHolyGrail/Q00638_SeekersOfTheHolyGrail.java index ba94686160..8a5a641cee 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00638_SeekersOfTheHolyGrail/Q00638_SeekersOfTheHolyGrail.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00638_SeekersOfTheHolyGrail/Q00638_SeekersOfTheHolyGrail.java @@ -31,39 +31,32 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Seekers Of The Holy Grail (638) * @author netvirus */ -public final class Q00638_SeekersOfTheHolyGrail extends Quest -{ - private static class DropInfo extends ItemChanceHolder - { +public final class Q00638_SeekersOfTheHolyGrail extends Quest { + private static class DropInfo extends ItemChanceHolder { private final int _keyId; private final int _keyChance; private final int _keyCount; - public DropInfo(int itemId, double chance) - { + public DropInfo(int itemId, double chance) { this(itemId, chance, 0, 0, 0); } - public DropInfo(int itemId, double chance, int keyId, int keyChance, int count) - { + public DropInfo(int itemId, double chance, int keyId, int keyChance, int count) { super(itemId, chance); _keyId = keyId; _keyChance = keyChance; _keyCount = count; } - public int getKeyId() - { + public int getKeyId() { return _keyId; } - public int getKeyChance() - { + public int getKeyChance() { return _keyChance; } - public int getKeyCount() - { + public int getKeyCount() { return _keyCount; } } @@ -83,8 +76,7 @@ public final class Q00638_SeekersOfTheHolyGrail extends Quest private static final int SCROLL_ENCHANT_A_S = 960; // Mobs private static final Map<Integer, DropInfo> MOBS_DROP_CHANCES = new HashMap<>(); - static - { + static { MOBS_DROP_CHANCES.put(22136, new DropInfo(TOTEM, 0.55)); // Gatekeeper Zombie MOBS_DROP_CHANCES.put(22137, new DropInfo(TOTEM, 0.06)); // Penance Guard MOBS_DROP_CHANCES.put(22138, new DropInfo(TOTEM, 0.06)); // Chapel Guard @@ -136,8 +128,7 @@ public final class Q00638_SeekersOfTheHolyGrail extends Quest MOBS_DROP_CHANCES.put(22194, new DropInfo(TOTEM, 0.03)); // Ritual Sacrifice } - public Q00638_SeekersOfTheHolyGrail() - { + public Q00638_SeekersOfTheHolyGrail() { super(638, Q00638_SeekersOfTheHolyGrail.class.getSimpleName(), "Seekers Of The Holy Grail"); addStartNpc(INNOCENTIN); addTalkId(INNOCENTIN); @@ -146,52 +137,37 @@ public final class Q00638_SeekersOfTheHolyGrail extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { - case "31328-03.htm": - { - if (qs.isCreated()) - { + switch (event) { + case "31328-03.htm": { + if (qs.isCreated()) { qs.startQuest(); htmltext = event; } break; } - case "31328-06.html": - { - if (qs.isStarted()) - { + case "31328-06.html": { + if (qs.isStarted()) { htmltext = event; } break; } - case "reward": - { - if (qs.isStarted() && (getQuestItemsCount(player, TOTEM) >= TOTEMS_REQUIRED_COUNT)) - { - if (getRandom(100) < 80) - { - if (getRandomBoolean()) - { + case "reward": { + if (qs.isStarted() && (getQuestItemsCount(player, TOTEM) >= TOTEMS_REQUIRED_COUNT)) { + if (getRandom(100) < 80) { + if (getRandomBoolean()) { rewardItems(player, SCROLL_ENCHANT_A_S, 1); - } - else - { + } else { rewardItems(player, SCROLL_ENCHANT_W_S, 1); } htmltext = "31328-07.html"; - } - else - { + } else { giveAdena(player, 3576000, true); htmltext = "31328-08.html"; } @@ -199,10 +175,8 @@ public final class Q00638_SeekersOfTheHolyGrail extends Quest } break; } - case "31328-09.html": - { - if (qs.isStarted()) - { + case "31328-09.html": { + if (qs.isStarted()) { qs.exitQuest(true, true); htmltext = "31328-09.html"; } @@ -213,16 +187,12 @@ public final class Q00638_SeekersOfTheHolyGrail extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc); - if (qs != null) - { + if (qs != null) { final DropInfo info = MOBS_DROP_CHANCES.get(npc.getId()); - if (giveItemRandomly(qs.getPlayer(), npc, info.getId(), 1, 0, info.getChance(), true)) - { - if ((info.getKeyId() > 0) && (getRandom(100) < info.getKeyChance())) - { + if (giveItemRandomly(qs.getPlayer(), npc, info.getId(), 1, 0, info.getChance(), true)) { + if ((info.getKeyId() > 0) && (getRandom(100) < info.getKeyChance())) { npc.dropItem(qs.getPlayer(), info.getKeyId(), info.getKeyCount()); } } @@ -231,16 +201,12 @@ public final class Q00638_SeekersOfTheHolyGrail extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { + if (qs.isCreated()) { htmltext = ((player.getLevel() >= MIN_LVL) ? "31328-01.htm" : "31328-02.htm"); - } - else if (qs.isStarted()) - { + } else if (qs.isStarted()) { htmltext = ((getQuestItemsCount(player, TOTEM) >= TOTEMS_REQUIRED_COUNT) ? "31328-04.html" : "31328-05.html"); } return htmltext; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00639_GuardiansOfTheHolyGrail/Q00639_GuardiansOfTheHolyGrail.java b/src/main/java/com/l2jserver/datapack/quests/Q00639_GuardiansOfTheHolyGrail/Q00639_GuardiansOfTheHolyGrail.java index 4ee1db0bb1..00da47e773 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00639_GuardiansOfTheHolyGrail/Q00639_GuardiansOfTheHolyGrail.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00639_GuardiansOfTheHolyGrail/Q00639_GuardiansOfTheHolyGrail.java @@ -28,24 +28,20 @@ import com.l2jserver.gameserver.model.quest.QuestState; * NOTE: This quest is no longer available since Freya(CT2.5) * @author corbin12 */ -public final class Q00639_GuardiansOfTheHolyGrail extends Quest -{ +public final class Q00639_GuardiansOfTheHolyGrail extends Quest { // NPC private static final int DOMINIC = 31350; - public Q00639_GuardiansOfTheHolyGrail() - { + public Q00639_GuardiansOfTheHolyGrail() { super(639, Q00639_GuardiansOfTheHolyGrail.class.getSimpleName(), "Guardians of the Holy Grail"); addStartNpc(DOMINIC); addTalkId(DOMINIC); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); - if (st != null) - { + if (st != null) { st.exitQuest(true); } return "31350-01.html"; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00641_AttackSailren/Q00641_AttackSailren.java b/src/main/java/com/l2jserver/datapack/quests/Q00641_AttackSailren/Q00641_AttackSailren.java index f0cb3aad76..3dd8cf2dae 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00641_AttackSailren/Q00641_AttackSailren.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00641_AttackSailren/Q00641_AttackSailren.java @@ -30,16 +30,14 @@ import com.l2jserver.gameserver.model.quest.State; * Attack Sailren! (641) * @author Adry_85 */ -public class Q00641_AttackSailren extends Quest -{ +public class Q00641_AttackSailren extends Quest { // NPC private static final int SHILENS_STONE_STATUE = 32109; // Items public static final int GAZKH_FRAGMENT = 8782; public static final int GAZKH = 8784; - public static int[] MOBS = - { + public static int[] MOBS = { 22196, // Velociraptor 22197, // Velociraptor 22198, // Velociraptor @@ -48,8 +46,7 @@ public class Q00641_AttackSailren extends Quest 22199, // Pterosaur }; - public Q00641_AttackSailren() - { + public Q00641_AttackSailren() { super(641, Q00641_AttackSailren.class.getSimpleName(), "Attack Sailren!"); addStartNpc(SHILENS_STONE_STATUE); addTalkId(SHILENS_STONE_STATUE); @@ -58,22 +55,18 @@ public class Q00641_AttackSailren extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - switch (event) - { + switch (event) { case "32109-1.html": st.startQuest(); break; case "32109-2a.html": - if (st.getQuestItemsCount(GAZKH_FRAGMENT) >= 30) - { + if (st.getQuestItemsCount(GAZKH_FRAGMENT) >= 30) { st.giveItems(GAZKH, 1); st.exitQuest(true, true); } @@ -83,21 +76,15 @@ public class Q00641_AttackSailren extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(player, 1); - if (partyMember != null) - { + if (partyMember != null) { final QuestState st = getQuestState(partyMember, false); - if (st != null) - { + if (st != null) { st.giveItems(GAZKH_FRAGMENT, 1); - if (st.getQuestItemsCount(GAZKH_FRAGMENT) < 30) - { + if (st.getQuestItemsCount(GAZKH_FRAGMENT) < 30) { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - } - else - { + } else { st.setCond(2, true); } } @@ -106,19 +93,14 @@ public class Q00641_AttackSailren extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: - if (player.getLevel() < 77) - { + if (player.getLevel() < 77) { htmltext = "32109-0.htm"; - } - else - { + } else { htmltext = (player.hasQuestCompleted(Q00126_TheNameOfEvil2.class.getSimpleName())) ? "32109-0a.htm" : "32109-0b.htm"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00642_APowerfulPrimevalCreature/Q00642_APowerfulPrimevalCreature.java b/src/main/java/com/l2jserver/datapack/quests/Q00642_APowerfulPrimevalCreature/Q00642_APowerfulPrimevalCreature.java index 6046a62a0f..e0f06a3699 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00642_APowerfulPrimevalCreature/Q00642_APowerfulPrimevalCreature.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00642_APowerfulPrimevalCreature/Q00642_APowerfulPrimevalCreature.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * A Powerful Primeval Creature (642) * @author Adry_85 */ -public class Q00642_APowerfulPrimevalCreature extends Quest -{ +public class Q00642_APowerfulPrimevalCreature extends Quest { // NPC private static final int DINN = 32105; // Items @@ -44,8 +43,7 @@ public class Q00642_APowerfulPrimevalCreature extends Quest private static final Map<Integer, Double> MOBS_TISSUE = new HashMap<>(); - static - { + static { MOBS_TISSUE.put(22196, 0.309); // Velociraptor MOBS_TISSUE.put(22197, 0.309); // Velociraptor MOBS_TISSUE.put(22198, 0.309); // Velociraptor @@ -57,8 +55,7 @@ public class Q00642_APowerfulPrimevalCreature extends Quest MOBS_TISSUE.put(22223, 0.309); // Velociraptor } - public Q00642_APowerfulPrimevalCreature() - { + public Q00642_APowerfulPrimevalCreature() { super(642, Q00642_APowerfulPrimevalCreature.class.getSimpleName(), "A Powerful Primeval Creature"); addStartNpc(DINN); addTalkId(DINN); @@ -68,50 +65,37 @@ public class Q00642_APowerfulPrimevalCreature extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = event; - switch (event) - { - case "32105-05.html": - { + switch (event) { + case "32105-05.html": { qs.startQuest(); break; } - case "32105-06.htm": - { + case "32105-06.htm": { qs.exitQuest(true); break; } - case "32105-09.html": - { - if (hasQuestItems(player, DINOSAUR_TISSUE)) - { + case "32105-09.html": { + if (hasQuestItems(player, DINOSAUR_TISSUE)) { giveAdena(player, 5000 * getQuestItemsCount(player, DINOSAUR_TISSUE), true); takeItems(player, DINOSAUR_TISSUE, -1); - } - else - { + } else { htmltext = "32105-14.html"; } break; } - case "exit": - { - if (hasQuestItems(player, DINOSAUR_TISSUE)) - { + case "exit": { + if (hasQuestItems(player, DINOSAUR_TISSUE)) { giveAdena(player, 5000 * getQuestItemsCount(player, DINOSAUR_TISSUE), true); qs.exitQuest(true, true); htmltext = "32105-12.html"; - } - else - { + } else { qs.exitQuest(true, true); htmltext = "32105-13.html"; } @@ -122,39 +106,30 @@ public class Q00642_APowerfulPrimevalCreature extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc); - if (qs == null) - { + if (qs == null) { return null; } int npcId = npc.getId(); - if (MOBS_TISSUE.containsKey(npcId)) - { + if (MOBS_TISSUE.containsKey(npcId)) { giveItemRandomly(qs.getPlayer(), npc, DINOSAUR_TISSUE, 1, 0, MOBS_TISSUE.get(npcId), true); - } - else - { + } else { giveItemRandomly(qs.getPlayer(), npc, DINOSAUR_EGG, 1, 0, 1.0, true); } return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { + if (qs.isCreated()) { htmltext = player.getLevel() < MIN_LEVEL ? "32105-01.htm" : "32105-02.htm"; - } - else if (qs.isStarted()) - { + } else if (qs.isStarted()) { htmltext = (hasAtLeastOneQuestItem(player, DINOSAUR_TISSUE, DINOSAUR_EGG)) ? "32105-08.html" : "32105-07.html"; } return htmltext; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00643_RiseAndFallOfTheElrokiTribe/Q00643_RiseAndFallOfTheElrokiTribe.java b/src/main/java/com/l2jserver/datapack/quests/Q00643_RiseAndFallOfTheElrokiTribe/Q00643_RiseAndFallOfTheElrokiTribe.java index d4b1229c56..9f279b98d0 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00643_RiseAndFallOfTheElrokiTribe/Q00643_RiseAndFallOfTheElrokiTribe.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00643_RiseAndFallOfTheElrokiTribe/Q00643_RiseAndFallOfTheElrokiTribe.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.util.Util; * Rise and Fall of the Elroki Tribe (643) * @author Adry_85 */ -public class Q00643_RiseAndFallOfTheElrokiTribe extends Quest -{ +public class Q00643_RiseAndFallOfTheElrokiTribe extends Quest { // NPCs private static final int SINGSING = 32106; private static final int KARAKAWEI = 32117; @@ -46,8 +45,7 @@ public class Q00643_RiseAndFallOfTheElrokiTribe extends Quest private static final int CHANCE_DEINO = 558; private boolean isFirstTalk = true; // Rewards - private static final int[] PIECE = - { + private static final int[] PIECE = { 8712, // Sirra's Blade Edge 8713, // Sword of Ipos Blade 8714, // Barakiel's Axe Piece @@ -61,8 +59,7 @@ public class Q00643_RiseAndFallOfTheElrokiTribe extends Quest 8722, // Daimon Crystal Fragment }; // Mobs - private static final int[] MOBS1 = - { + private static final int[] MOBS1 = { 22200, // Ornithomimus 22201, // Ornithomimus 22202, // Ornithomimus @@ -84,8 +81,7 @@ public class Q00643_RiseAndFallOfTheElrokiTribe extends Quest 22227, // Wild Strider }; - private static final int[] MOBS2 = - { + private static final int[] MOBS2 = { 22742, // Ornithomimus 22743, // Deinonychus 22744, // Ornithomimus @@ -94,8 +90,7 @@ public class Q00643_RiseAndFallOfTheElrokiTribe extends Quest private static final int DEINONYCHUS = 22203; - public Q00643_RiseAndFallOfTheElrokiTribe() - { + public Q00643_RiseAndFallOfTheElrokiTribe() { super(643, Q00643_RiseAndFallOfTheElrokiTribe.class.getSimpleName(), "Rise and Fall of the Elroki Tribe"); addStartNpc(SINGSING); addTalkId(SINGSING, KARAKAWEI); @@ -106,17 +101,14 @@ public class Q00643_RiseAndFallOfTheElrokiTribe extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "32106-02.htm": case "32106-04.htm": case "32106-05.html": @@ -124,53 +116,39 @@ public class Q00643_RiseAndFallOfTheElrokiTribe extends Quest case "32106-13.html": case "32117-02.html": case "32117-06.html": - case "32117-07.html": - { + case "32117-07.html": { htmltext = event; break; } - case "quest_accept": - { - if (player.getLevel() >= MIN_LEVEL) - { + case "quest_accept": { + if (player.getLevel() >= MIN_LEVEL) { st.startQuest(); htmltext = "32106-03.html"; - } - else - { + } else { htmltext = "32106-07.html"; } break; } - case "32106-09.html": - { + case "32106-09.html": { st.giveAdena(1374 * st.getQuestItemsCount(BONES_OF_A_PLAINS_DINOSAUR), true); st.takeItems(BONES_OF_A_PLAINS_DINOSAUR, -1); htmltext = event; break; } - case "exit": - { - if (!st.hasQuestItems(BONES_OF_A_PLAINS_DINOSAUR)) - { + case "exit": { + if (!st.hasQuestItems(BONES_OF_A_PLAINS_DINOSAUR)) { htmltext = "32106-11.html"; - } - else - { + } else { st.giveAdena(1374 * st.getQuestItemsCount(BONES_OF_A_PLAINS_DINOSAUR), true); htmltext = "32106-12.html"; } st.exitQuest(true, true); break; } - case "exchange": - { - if (st.getQuestItemsCount(BONES_OF_A_PLAINS_DINOSAUR) < 300) - { + case "exchange": { + if (st.getQuestItemsCount(BONES_OF_A_PLAINS_DINOSAUR) < 300) { htmltext = "32117-04.html"; - } - else - { + } else { st.rewardItems(PIECE[getRandom(PIECE.length)], 5); st.takeItems(BONES_OF_A_PLAINS_DINOSAUR, 300); st.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); @@ -183,46 +161,36 @@ public class Q00643_RiseAndFallOfTheElrokiTribe extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(player, 1); - if (partyMember == null) - { + if (partyMember == null) { return super.onKill(npc, player, isSummon); } final QuestState st = getQuestState(partyMember, false); int npcId = npc.getId(); - if (Util.contains(MOBS1, npcId)) - { + if (Util.contains(MOBS1, npcId)) { double chance = CHANCE_MOBS1 * rates().getRateQuestDrop(); - if (getRandom(1000) < chance) - { + if (getRandom(1000) < chance) { st.rewardItems(BONES_OF_A_PLAINS_DINOSAUR, 2); - } - else - { + } else { st.rewardItems(BONES_OF_A_PLAINS_DINOSAUR, 1); } st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } - if (Util.contains(MOBS2, npcId)) - { + if (Util.contains(MOBS2, npcId)) { double chance = CHANCE_MOBS2 * rates().getRateQuestDrop(); - if (getRandom(1000) < chance) - { + if (getRandom(1000) < chance) { st.rewardItems(BONES_OF_A_PLAINS_DINOSAUR, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } - if (npcId == DEINONYCHUS) - { + if (npcId == DEINONYCHUS) { double chance = CHANCE_DEINO * rates().getRateQuestDrop(); - if (getRandom(1000) < chance) - { + if (getRandom(1000) < chance) { st.rewardItems(BONES_OF_A_PLAINS_DINOSAUR, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -231,32 +199,22 @@ public class Q00643_RiseAndFallOfTheElrokiTribe extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getLevel() >= MIN_LEVEL) ? "32106-01.htm" : "32106-06.html"; break; } - case State.STARTED: - { - if (npc.getId() == SINGSING) - { + case State.STARTED: { + if (npc.getId() == SINGSING) { htmltext = (st.hasQuestItems(BONES_OF_A_PLAINS_DINOSAUR)) ? "32106-08.html" : "32106-14.html"; - } - else if (npc.getId() == KARAKAWEI) - { - if (isFirstTalk) - { + } else if (npc.getId() == KARAKAWEI) { + if (isFirstTalk) { isFirstTalk = false; htmltext = "32117-01.html"; - } - else - { + } else { htmltext = "32117-03.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00644_GraveRobberAnnihilation/Q00644_GraveRobberAnnihilation.java b/src/main/java/com/l2jserver/datapack/quests/Q00644_GraveRobberAnnihilation/Q00644_GraveRobberAnnihilation.java index 58da8eace9..89de6509f6 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00644_GraveRobberAnnihilation/Q00644_GraveRobberAnnihilation.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00644_GraveRobberAnnihilation/Q00644_GraveRobberAnnihilation.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.model.quest.State; * Grave Robber Annihilation (644) * @author netvirus */ -public final class Q00644_GraveRobberAnnihilation extends Quest -{ +public final class Q00644_GraveRobberAnnihilation extends Quest { // NPC private static final int KARUDA = 32017; // Item @@ -46,8 +45,7 @@ public final class Q00644_GraveRobberAnnihilation extends Quest // Rewards private static final Map<String, ItemHolder> REWARDS = new HashMap<>(); - static - { + static { MONSTER_DROP_CHANCES.put(22003, 0.714); // Grave Robber Scout MONSTER_DROP_CHANCES.put(22004, 0.841); // Grave Robber Lookout MONSTER_DROP_CHANCES.put(22005, 0.778); // Grave Robber Ranger @@ -62,8 +60,7 @@ public final class Q00644_GraveRobberAnnihilation extends Quest REWARDS.put("ironore", new ItemHolder(1869, 30)); // Iron Ore } - public Q00644_GraveRobberAnnihilation() - { + public Q00644_GraveRobberAnnihilation() { super(644, Q00644_GraveRobberAnnihilation.class.getSimpleName(), "Grave Robber Annihilation"); addStartNpc(KARUDA); addTalkId(KARUDA); @@ -72,30 +69,23 @@ public final class Q00644_GraveRobberAnnihilation extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { - case "32017-03.htm": - { - if (st.isCreated()) - { + switch (event) { + case "32017-03.htm": { + if (st.isCreated()) { st.startQuest(); htmltext = event; } break; } - case "32017-06.html": - { - if (st.isCond(2) && (st.getQuestItemsCount(ORC_GOODS) >= ORC_GOODS_REQUIRED_COUNT)) - { + case "32017-06.html": { + if (st.isCond(2) && (st.getQuestItemsCount(ORC_GOODS) >= ORC_GOODS_REQUIRED_COUNT)) { htmltext = event; } break; @@ -105,10 +95,8 @@ public final class Q00644_GraveRobberAnnihilation extends Quest case "animalbone": case "charcoal": case "coal": - case "ironore": - { - if (st.isCond(2)) - { + case "ironore": { + if (st.isCond(2)) { final ItemHolder reward = REWARDS.get(event); st.rewardItems(reward.getId(), reward.getCount()); st.exitQuest(true, true); @@ -121,36 +109,27 @@ public final class Q00644_GraveRobberAnnihilation extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc); - if ((qs != null) && qs.giveItemRandomly(npc, ORC_GOODS, 1, ORC_GOODS_REQUIRED_COUNT, MONSTER_DROP_CHANCES.get(npc.getId()), true)) - { + if ((qs != null) && qs.giveItemRandomly(npc, ORC_GOODS, 1, ORC_GOODS_REQUIRED_COUNT, MONSTER_DROP_CHANCES.get(npc.getId()), true)) { qs.setCond(2, true); } return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = ((player.getLevel() >= MIN_LVL) ? "32017-01.htm" : "32017-02.htm"); break; } - case State.STARTED: - { - if (st.isCond(2) && (st.getQuestItemsCount(ORC_GOODS) >= ORC_GOODS_REQUIRED_COUNT)) - { + case State.STARTED: { + if (st.isCond(2) && (st.getQuestItemsCount(ORC_GOODS) >= ORC_GOODS_REQUIRED_COUNT)) { htmltext = "32017-04.html"; - } - else - { + } else { htmltext = "32017-05.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00645_GhostsOfBatur/Q00645_GhostsOfBatur.java b/src/main/java/com/l2jserver/datapack/quests/Q00645_GhostsOfBatur/Q00645_GhostsOfBatur.java index b363b47555..22f31b0fc1 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00645_GhostsOfBatur/Q00645_GhostsOfBatur.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00645_GhostsOfBatur/Q00645_GhostsOfBatur.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.util.Util; * Ghosts of Batur (645) * @author Zoey76 */ -public class Q00645_GhostsOfBatur extends Quest -{ +public class Q00645_GhostsOfBatur extends Quest { // NPC private static final int KARUDA = 32017; // Monsters @@ -43,15 +42,13 @@ public class Q00645_GhostsOfBatur extends Quest private static final int CURSED_BURIAL_ITEMS = 14861; // New item // Misc private static final int MIN_LEVEL = 80; - private static final int[] CHANCES = - { + private static final int[] CHANCES = { 516, 664, 686 }; - public Q00645_GhostsOfBatur() - { + public Q00645_GhostsOfBatur() { super(645, Q00645_GhostsOfBatur.class.getSimpleName(), "Ghosts of Batur"); addStartNpc(KARUDA); addTalkId(KARUDA); @@ -60,33 +57,26 @@ public class Q00645_GhostsOfBatur extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - if (player.getLevel() >= MIN_LEVEL) - { - switch (event) - { - case "32017-03.htm": - { + if (player.getLevel() >= MIN_LEVEL) { + switch (event) { + case "32017-03.htm": { st.startQuest(); htmltext = event; break; } case "32017-06.html": - case "32017-08.html": - { + case "32017-08.html": { htmltext = event; break; } - case "32017-09.html": - { + case "32017-09.html": { st.exitQuest(true, true); htmltext = event; break; @@ -97,21 +87,15 @@ public class Q00645_GhostsOfBatur extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final L2PcInstance player = getRandomPartyMember(killer, 1); - if ((player != null) && Util.checkIfInRange(1500, npc, player, false)) - { - if (getRandom(1000) < CHANCES[npc.getId() - CONTAMINATED_MOREK_WARRIOR]) - { + if ((player != null) && Util.checkIfInRange(1500, npc, player, false)) { + if (getRandom(1000) < CHANCES[npc.getId() - CONTAMINATED_MOREK_WARRIOR]) { final QuestState st = getQuestState(player, false); st.giveItems(CURSED_BURIAL_ITEMS, 1); - if (st.isCond(1) && (st.getQuestItemsCount(CURSED_BURIAL_ITEMS) >= 500)) - { + if (st.isCond(1) && (st.getQuestItemsCount(CURSED_BURIAL_ITEMS) >= 500)) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -120,30 +104,23 @@ public class Q00645_GhostsOfBatur extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getLevel() >= MIN_LEVEL) ? "32017-01.htm" : "32017-02.html"; break; } - case State.STARTED: - { + case State.STARTED: { // Support for old quest reward. final long count = st.getQuestItemsCount(CURSED_GRAVE_GOODS); - if ((count > 0) && (count < 180)) - { + if ((count > 0) && (count < 180)) { st.giveAdena(56000 + (count * 64), false); st.addExpAndSp(138000, 7997); st.exitQuest(true, true); htmltext = "32017-07.html"; - } - else - { + } else { htmltext = st.hasQuestItems(CURSED_BURIAL_ITEMS) ? "32017-04.html" : "32017-05.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00646_SignsOfRevolt/Q00646_SignsOfRevolt.java b/src/main/java/com/l2jserver/datapack/quests/Q00646_SignsOfRevolt/Q00646_SignsOfRevolt.java index c4d1e1c71f..9ad87b0962 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00646_SignsOfRevolt/Q00646_SignsOfRevolt.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00646_SignsOfRevolt/Q00646_SignsOfRevolt.java @@ -28,26 +28,22 @@ import com.l2jserver.gameserver.model.quest.QuestState; * NOTE: This quest is no longer available since Gracia Epilogue * @author malyelfik */ -public class Q00646_SignsOfRevolt extends Quest -{ +public class Q00646_SignsOfRevolt extends Quest { // NPC private static final int TORRANT = 32016; // Misc private static final int MIN_LEVEL = 80; - public Q00646_SignsOfRevolt() - { + public Q00646_SignsOfRevolt() { super(646, Q00646_SignsOfRevolt.class.getSimpleName(), "Signs of Revolt"); addStartNpc(TORRANT); addTalkId(TORRANT); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); - if (st != null) - { + if (st != null) { st.exitQuest(true); } return (player.getLevel() >= MIN_LEVEL) ? "32016-01.html" : "32016-02.html"; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00647_InfluxOfMachines/Q00647_InfluxOfMachines.java b/src/main/java/com/l2jserver/datapack/quests/Q00647_InfluxOfMachines/Q00647_InfluxOfMachines.java index b3453c5efb..27f0c81fc6 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00647_InfluxOfMachines/Q00647_InfluxOfMachines.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00647_InfluxOfMachines/Q00647_InfluxOfMachines.java @@ -32,14 +32,12 @@ import com.l2jserver.gameserver.model.quest.State; * Influx of Machines (647) * @author malyelfik */ -public class Q00647_InfluxOfMachines extends Quest -{ +public class Q00647_InfluxOfMachines extends Quest { // NPC private static final int GUTENHAGEN = 32069; // Monsters private static final Map<Integer, Integer> MOBS = new HashMap<>(); - static - { + static { MOBS.put(22801, 280); // Cruel Pincer Golem MOBS.put(22802, 227); // Cruel Pincer Golem MOBS.put(22803, 286); // Cruel Pincer Golem @@ -55,8 +53,7 @@ public class Q00647_InfluxOfMachines extends Quest } // Item private static final int BROKEN_GOLEM_FRAGMENT = 15521; - private static final int[] RECIPES = - { + private static final int[] RECIPES = { 6881, // Recipe: Forgotten Blade (60%) 6883, // Recipe: Basalt Battlehammer (60%) 6885, // Recipe: Imperial Staff (60%) @@ -72,8 +69,7 @@ public class Q00647_InfluxOfMachines extends Quest private static final int MIN_LEVEL = 70; private static final int FRAGMENT_COUNT = 500; - public Q00647_InfluxOfMachines() - { + public Q00647_InfluxOfMachines() { super(647, Q00647_InfluxOfMachines.class.getSimpleName(), "Influx of Machines"); addStartNpc(GUTENHAGEN); addTalkId(GUTENHAGEN); @@ -82,30 +78,24 @@ public class Q00647_InfluxOfMachines extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "32069-03.htm": st.startQuest(); htmltext = event; break; case "32069-06.html": - if (st.isCond(2) && (st.getQuestItemsCount(BROKEN_GOLEM_FRAGMENT) >= FRAGMENT_COUNT)) - { + if (st.isCond(2) && (st.getQuestItemsCount(BROKEN_GOLEM_FRAGMENT) >= FRAGMENT_COUNT)) { st.giveItems(RECIPES[getRandom(RECIPES.length)], 1); st.exitQuest(true, true); htmltext = event; - } - else - { + } else { htmltext = "32069-07.html"; } break; @@ -114,21 +104,15 @@ public class Q00647_InfluxOfMachines extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance member = getRandomPartyMember(player, 1); - if (member != null) - { + if (member != null) { final QuestState st = getQuestState(member, false); - if (st.isCond(1) && (getRandom(1000) < MOBS.get(npc.getId()))) - { + if (st.isCond(1) && (getRandom(1000) < MOBS.get(npc.getId()))) { st.giveItems(BROKEN_GOLEM_FRAGMENT, 1); - if (st.getQuestItemsCount(BROKEN_GOLEM_FRAGMENT) >= FRAGMENT_COUNT) - { + if (st.getQuestItemsCount(BROKEN_GOLEM_FRAGMENT) >= FRAGMENT_COUNT) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -137,22 +121,17 @@ public class Q00647_InfluxOfMachines extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? "32069-01.htm" : "32069-02.htm"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "32069-04.html"; - } - else if (st.isCond(2) && (st.getQuestItemsCount(BROKEN_GOLEM_FRAGMENT) >= FRAGMENT_COUNT)) - { + } else if (st.isCond(2) && (st.getQuestItemsCount(BROKEN_GOLEM_FRAGMENT) >= FRAGMENT_COUNT)) { htmltext = "32069-05.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00648_AnIceMerchantsDream/Q00648_AnIceMerchantsDream.java b/src/main/java/com/l2jserver/datapack/quests/Q00648_AnIceMerchantsDream/Q00648_AnIceMerchantsDream.java index b367bf85e6..3e1cd3e475 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00648_AnIceMerchantsDream/Q00648_AnIceMerchantsDream.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00648_AnIceMerchantsDream/Q00648_AnIceMerchantsDream.java @@ -32,26 +32,21 @@ import com.l2jserver.gameserver.model.quest.QuestState; * An Ice Merchant's Dream (648) * @author netvirus, Adry_85 */ -public final class Q00648_AnIceMerchantsDream extends Quest -{ - private static class DropInfo - { +public final class Q00648_AnIceMerchantsDream extends Quest { + private static class DropInfo { private final double _firstChance; private final double _secondChance; - public DropInfo(double firstChance, double secondChance) - { + public DropInfo(double firstChance, double secondChance) { _firstChance = firstChance; _secondChance = secondChance; } - public double getFirstChance() - { + public double getFirstChance() { return _firstChance; } - public double getSecondChance() - { + public double getSecondChance() { return _secondChance; } } @@ -67,8 +62,7 @@ public final class Q00648_AnIceMerchantsDream extends Quest private static final int MIN_LVL = 53; // Monsters private static final Map<Integer, DropInfo> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(22080, new DropInfo(0.285, 0.048)); // Massive Maze Bandersnatch MONSTERS.put(22081, new DropInfo(0.443, 0.0)); // Lost Watcher MONSTERS.put(22082, new DropInfo(0.510, 0.0)); // Elder Lost Watcher @@ -90,8 +84,7 @@ public final class Q00648_AnIceMerchantsDream extends Quest MONSTERS.put(22098, new DropInfo(0.717, 0.074)); // Frost Yeti } - public Q00648_AnIceMerchantsDream() - { + public Q00648_AnIceMerchantsDream() { super(648, Q00648_AnIceMerchantsDream.class.getSimpleName(), "An Ice Merchants Dream"); addStartNpc(RAFFORTY); addTalkId(RAFFORTY, ICE_SHELF); @@ -100,78 +93,57 @@ public final class Q00648_AnIceMerchantsDream extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); final QuestState q115 = player.getQuestState(Q00115_TheOtherSideOfTruth.class.getSimpleName()); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "ACCEPT": - { + switch (event) { + case "ACCEPT": { st.startQuest(); - if ((q115 != null) && (q115.isCompleted())) - { + if ((q115 != null) && (q115.isCompleted())) { htmltext = "32020-04.htm"; - } - else - { + } else { st.setCond(2); htmltext = "32020-05.htm"; } break; } - case "ASK": - { - if (st.getCond() >= 1) - { + case "ASK": { + if (st.getCond() >= 1) { htmltext = ((q115 != null) && !q115.isCompleted()) ? "32020-14.html" : "32020-15.html"; } break; } - case "LATER": - { - if (st.getCond() >= 1) - { + case "LATER": { + if (st.getCond() >= 1) { htmltext = ((q115 != null) && !q115.isCompleted()) ? "32020-19.html" : "32020-20.html"; } break; } - case "REWARD": - { - if (st.getCond() >= 1) - { + case "REWARD": { + if (st.getCond() >= 1) { final long silverCryCount = getQuestItemsCount(player, SILVER_ICE_CRYSTAL); final long blackCryCount = getQuestItemsCount(player, BLACK_ICE_CRYSTAL); - if ((silverCryCount + blackCryCount) > 0) - { + if ((silverCryCount + blackCryCount) > 0) { giveAdena(player, (silverCryCount * 300) + (blackCryCount * 1200), true); takeItems(player, -1, SILVER_ICE_CRYSTAL, BLACK_ICE_CRYSTAL); htmltext = ((q115 != null) && !q115.isCompleted()) ? "32020-16.html" : "32020-17.html"; - } - else - { + } else { htmltext = "32020-18.html"; } } break; } - case "QUIT": - { - if (st.getCond() >= 1) - { - if ((q115 != null) && !q115.isCompleted()) - { + case "QUIT": { + if (st.getCond() >= 1) { + if ((q115 != null) && !q115.isCompleted()) { htmltext = "32020-21.html"; st.exitQuest(true, true); - } - else - { + } else { htmltext = "32020-22.html"; } } @@ -180,36 +152,28 @@ public final class Q00648_AnIceMerchantsDream extends Quest case "32020-06.html": case "32020-07.html": case "32020-08.html": - case "32020-09.html": - { - if (st.getCond() >= 1) - { + case "32020-09.html": { + if (st.getCond() >= 1) { htmltext = event; } break; } - case "32020-23.html": - { - if (st.getCond() >= 1) - { + case "32020-23.html": { + if (st.getCond() >= 1) { st.exitQuest(true, true); htmltext = event; } break; } - case "32023-04.html": - { - if ((st.getCond() >= 1) && hasQuestItems(player, SILVER_ICE_CRYSTAL) && (st.getInt("ex") == 0)) - { + case "32023-04.html": { + if ((st.getCond() >= 1) && hasQuestItems(player, SILVER_ICE_CRYSTAL) && (st.getInt("ex") == 0)) { st.set("ex", ((getRandom(4) + 1) * 10)); htmltext = event; } break; } - case "32023-05.html": - { - if ((st.getCond() >= 1) && hasQuestItems(player, SILVER_ICE_CRYSTAL) && (st.getInt("ex") > 0)) - { + case "32023-05.html": { + if ((st.getCond() >= 1) && hasQuestItems(player, SILVER_ICE_CRYSTAL) && (st.getInt("ex") > 0)) { takeItems(player, SILVER_ICE_CRYSTAL, 1); int val = (st.getInt("ex") + 1); st.set("ex", val); @@ -218,10 +182,8 @@ public final class Q00648_AnIceMerchantsDream extends Quest } break; } - case "32023-06.html": - { - if ((st.getCond() >= 1) && hasQuestItems(player, SILVER_ICE_CRYSTAL) && (st.getInt("ex") > 0)) - { + case "32023-06.html": { + if ((st.getCond() >= 1) && hasQuestItems(player, SILVER_ICE_CRYSTAL) && (st.getInt("ex") > 0)) { takeItems(player, SILVER_ICE_CRYSTAL, 1); int val = (st.getInt("ex") + 2); st.set("ex", val); @@ -230,21 +192,16 @@ public final class Q00648_AnIceMerchantsDream extends Quest } break; } - case "REPLY4": - { - if ((st.getCond() >= 1) && (st.getInt("ex") > 0)) - { + case "REPLY4": { + if ((st.getCond() >= 1) && (st.getInt("ex") > 0)) { int ex = st.getInt("ex"); int val1 = ex / 10; int val2 = ex - (val1 * 10); - if (val1 == val2) - { + if (val1 == val2) { htmltext = "32023-07.html"; giveItems(player, BLACK_ICE_CRYSTAL, 1); playSound(player, Sound.ITEMSOUND_ENCHANT_SUCCESS); - } - else - { + } else { htmltext = "32023-08.html"; playSound(player, Sound.ITEMSOUND_ENCHANT_FAILED); } @@ -252,21 +209,16 @@ public final class Q00648_AnIceMerchantsDream extends Quest } break; } - case "REPLY5": - { - if ((st.getCond() >= 1) && (st.getInt("ex") > 0)) - { + case "REPLY5": { + if ((st.getCond() >= 1) && (st.getInt("ex") > 0)) { int ex = st.getInt("ex"); int val1 = ex / 10; int val2 = ((ex - (val1 * 10)) + 2); - if (val1 == val2) - { + if (val1 == val2) { htmltext = "32023-07.html"; giveItems(player, BLACK_ICE_CRYSTAL, 1); playSound(player, Sound.ITEMSOUND_ENCHANT_SUCCESS); - } - else - { + } else { htmltext = "32023-08.html"; playSound(player, Sound.ITEMSOUND_ENCHANT_FAILED); } @@ -279,22 +231,17 @@ public final class Q00648_AnIceMerchantsDream extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getRandomPartyMemberState(killer, -1, 3, npc); - if (st != null) - { + if (st != null) { final DropInfo info = MONSTERS.get(npc.getId()); - if (st.getCond() >= 1) - { + if (st.getCond() >= 1) { giveItemRandomly(st.getPlayer(), npc, SILVER_ICE_CRYSTAL, 1, 0, info.getFirstChance(), true); } - if (info.getSecondChance() > 0) - { + if (info.getSecondChance() > 0) { final QuestState st2 = st.getPlayer().getQuestState(Q00115_TheOtherSideOfTruth.class.getSimpleName()); - if ((st.getCond() >= 2) && (st2 != null) && st2.isCompleted()) - { + if ((st.getCond() >= 2) && (st2 != null) && st2.isCompleted()) { giveItemRandomly(st.getPlayer(), npc, SILVER_HEMOCYTE, 1, 0, info.getSecondChance(), true); } } @@ -303,68 +250,45 @@ public final class Q00648_AnIceMerchantsDream extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (npc.getId()) - { - case RAFFORTY: - { - if (st.isCreated()) - { - if (player.getLevel() < MIN_LVL) - { + switch (npc.getId()) { + case RAFFORTY: { + if (st.isCreated()) { + if (player.getLevel() < MIN_LVL) { htmltext = "32020-01.htm"; - } - else - { + } else { htmltext = (player.hasQuestCompleted(Q00115_TheOtherSideOfTruth.class.getSimpleName())) ? "32020-02.htm" : "32020-03.htm"; } - } - else if (st.isStarted()) - { + } else if (st.isStarted()) { final long hasQuestItems = getQuestItemsCount(player, SILVER_ICE_CRYSTAL, BLACK_ICE_CRYSTAL); - if (player.hasQuestCompleted(Q00115_TheOtherSideOfTruth.class.getSimpleName())) - { + if (player.hasQuestCompleted(Q00115_TheOtherSideOfTruth.class.getSimpleName())) { htmltext = (hasQuestItems > 0) ? "32020-13.html" : "32020-11.html"; - if (st.isCond(1)) - { + if (st.isCond(1)) { st.setCond(2, true); } - } - else - { + } else { htmltext = (hasQuestItems > 0) ? "32020-12.html" : "32020-10.html"; } } break; } - case ICE_SHELF: - { + case ICE_SHELF: { // TODO: In High Five this quest have an updated reward system. - if (st.isStarted()) - { - if (hasQuestItems(player, SILVER_ICE_CRYSTAL)) - { + if (st.isStarted()) { + if (hasQuestItems(player, SILVER_ICE_CRYSTAL)) { final int val = st.getInt("ex") % 10; - if (val == 0) - { + if (val == 0) { htmltext = "32023-03.html"; st.set("ex", 0); - } - else - { + } else { htmltext = "32023-09.html"; } - } - else - { + } else { htmltext = "32023-02.html"; } - } - else - { + } else { htmltext = "32023-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00649_ALooterAndARailroadMan/Q00649_ALooterAndARailroadMan.java b/src/main/java/com/l2jserver/datapack/quests/Q00649_ALooterAndARailroadMan/Q00649_ALooterAndARailroadMan.java index 1779a3cbe7..bd78269dec 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00649_ALooterAndARailroadMan/Q00649_ALooterAndARailroadMan.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00649_ALooterAndARailroadMan/Q00649_ALooterAndARailroadMan.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.util.Util; * A Looter And A Railroad Man (649) * @author netvirus */ -public final class Q00649_ALooterAndARailroadMan extends Quest -{ +public final class Q00649_ALooterAndARailroadMan extends Quest { // Npc private static final int RAILMAN_OBI = 32052; // Item @@ -44,8 +43,7 @@ public final class Q00649_ALooterAndARailroadMan extends Quest // Monsters private static final Map<Integer, Integer> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(22017, 529); // Bandit Sweeper MONSTERS.put(22018, 452); // Bandit Hound MONSTERS.put(22019, 606); // Bandit Watchman @@ -56,8 +54,7 @@ public final class Q00649_ALooterAndARailroadMan extends Quest MONSTERS.put(22026, 1000); // Bandit Captain } - public Q00649_ALooterAndARailroadMan() - { + public Q00649_ALooterAndARailroadMan() { super(649, Q00649_ALooterAndARailroadMan.class.getSimpleName(), "A Looter and a Railroad Man"); addStartNpc(RAILMAN_OBI); addTalkId(RAILMAN_OBI); @@ -66,30 +63,23 @@ public final class Q00649_ALooterAndARailroadMan extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "32052-03.htm": - { - if (st.isCreated()) - { + switch (event) { + case "32052-03.htm": { + if (st.isCreated()) { st.startQuest(); htmltext = event; } break; } - case "32052-06.html": - { - if (st.isCond(2) && st.hasQuestItems(THIEF_GUILD_MARK)) - { + case "32052-06.html": { + if (st.isCond(2) && st.hasQuestItems(THIEF_GUILD_MARK)) { st.giveAdena(21698, true); st.exitQuest(true, true); htmltext = event; @@ -100,19 +90,15 @@ public final class Q00649_ALooterAndARailroadMan extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getLevel() >= MIN_LVL) ? "32052-01.htm" : "32052-02.htm"; break; } - case State.STARTED: - { + case State.STARTED: { htmltext = (st.getQuestItemsCount(THIEF_GUILD_MARK) == 200) ? "32052-04.html" : "32052-05.html"; break; } @@ -121,18 +107,13 @@ public final class Q00649_ALooterAndARailroadMan extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, killer, false) && (getRandom(1000) < MONSTERS.get(npc.getId()))) - { + if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, killer, false) && (getRandom(1000) < MONSTERS.get(npc.getId()))) { st.giveItems(THIEF_GUILD_MARK, 1); - if (st.getQuestItemsCount(THIEF_GUILD_MARK) == 200) - { + if (st.getQuestItemsCount(THIEF_GUILD_MARK) == 200) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00650_ABrokenDream/Q00650_ABrokenDream.java b/src/main/java/com/l2jserver/datapack/quests/Q00650_ABrokenDream/Q00650_ABrokenDream.java index 3fe3897222..816cacfbe0 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00650_ABrokenDream/Q00650_ABrokenDream.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00650_ABrokenDream/Q00650_ABrokenDream.java @@ -36,8 +36,7 @@ import com.l2jserver.gameserver.util.Util; * A Broken Dream (650) * @author netvirus */ -public final class Q00650_ABrokenDream extends Quest -{ +public final class Q00650_ABrokenDream extends Quest { // Npc private static final int GHOST_OF_A_RAILROAD_ENGINEER = 32054; // Item @@ -47,14 +46,12 @@ public final class Q00650_ABrokenDream extends Quest // Monsters private static final Map<Integer, Integer> MONSTER_DROP_CHANCES = new HashMap<>(); - static - { + static { MONSTER_DROP_CHANCES.put(22027, 575); // Forgotten Crewman MONSTER_DROP_CHANCES.put(22028, 515); // Vagabond of the Ruins } - public Q00650_ABrokenDream() - { + public Q00650_ABrokenDream() { super(650, Q00650_ABrokenDream.class.getSimpleName(), "A Broken Dream"); addStartNpc(GHOST_OF_A_RAILROAD_ENGINEER); addTalkId(GHOST_OF_A_RAILROAD_ENGINEER); @@ -63,39 +60,30 @@ public final class Q00650_ABrokenDream extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { - case "32054-03.htm": - { - if (st.isCreated()) - { + switch (event) { + case "32054-03.htm": { + if (st.isCreated()) { st.startQuest(); htmltext = event; } break; } case "32054-07.html": - case "32054-08.html": - { - if (st.isStarted()) - { + case "32054-08.html": { + if (st.isStarted()) { htmltext = event; } break; } - case "32054-09.html": - { - if (st.isStarted()) - { + case "32054-09.html": { + if (st.isStarted()) { st.exitQuest(true, true); htmltext = event; } @@ -106,26 +94,19 @@ public final class Q00650_ABrokenDream extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { - if (player.getLevel() < MIN_LVL) - { + switch (st.getState()) { + case State.CREATED: { + if (player.getLevel() < MIN_LVL) { htmltext = "32054-02.htm"; - } - else - { + } else { htmltext = player.hasQuestCompleted(Q00117_TheOceanOfDistantStars.class.getSimpleName()) ? "32054-01.htm" : "32054-04.htm"; } break; } - case State.STARTED: - { + case State.STARTED: { htmltext = st.hasQuestItems(REMNANTS_OF_OLD_DWARVES_DREAMS) ? "32054-05.html" : "32054-06.html"; break; } @@ -134,34 +115,27 @@ public final class Q00650_ABrokenDream extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final List<L2PcInstance> randomList = new ArrayList<>(); final QuestState st = getQuestState(killer, false); - if ((st != null) && st.isStarted()) - { + if ((st != null) && st.isStarted()) { randomList.add(killer); randomList.add(killer); } final int monsterChance = MONSTER_DROP_CHANCES.get(npc.getId()); - if (killer.isInParty()) - { - for (L2PcInstance member : killer.getParty().getMembers()) - { + if (killer.isInParty()) { + for (L2PcInstance member : killer.getParty().getMembers()) { final QuestState qs = getQuestState(member, false); - if ((qs != null) && qs.isStarted()) - { + if ((qs != null) && qs.isStarted()) { randomList.add(member); } } } - if (!randomList.isEmpty()) - { + if (!randomList.isEmpty()) { final L2PcInstance player = randomList.get(getRandom(randomList.size())); - if ((getRandom(1000) < monsterChance) && Util.checkIfInRange(1500, npc, player, true)) - { + if ((getRandom(1000) < monsterChance) && Util.checkIfInRange(1500, npc, player, true)) { giveItems(player, REMNANTS_OF_OLD_DWARVES_DREAMS, 1); playSound(player, Sound.ITEMSOUND_QUEST_ITEMGET); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00651_RunawayYouth/Q00651_RunawayYouth.java b/src/main/java/com/l2jserver/datapack/quests/Q00651_RunawayYouth/Q00651_RunawayYouth.java index e034f7e4f9..dcf04300e5 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00651_RunawayYouth/Q00651_RunawayYouth.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00651_RunawayYouth/Q00651_RunawayYouth.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.State; * Runaway Youth (651) * @author malyelfik */ -public class Q00651_RunawayYouth extends Quest -{ +public class Q00651_RunawayYouth extends Quest { // NPCs private static final int BATIDAE = 31989; private static final int IVAN = 32014; @@ -38,31 +37,24 @@ public class Q00651_RunawayYouth extends Quest // Misc private static final int MIN_LEVEL = 26; - public Q00651_RunawayYouth() - { + public Q00651_RunawayYouth() { super(651, Q00651_RunawayYouth.class.getSimpleName(), "Runaway Youth"); addStartNpc(IVAN); addTalkId(BATIDAE, IVAN); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - if (event.equals("32014-03.html")) - { + if (event.equals("32014-03.html")) { htmltext = event; - } - else if (event.equals("32014-04.htm")) - { - if (!st.hasQuestItems(SOE)) - { + } else if (event.equals("32014-04.htm")) { + if (!st.hasQuestItems(SOE)) { return "32014-05.htm"; } st.startQuest(); @@ -74,15 +66,12 @@ public class Q00651_RunawayYouth extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case IVAN: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? "32014-01.htm" : "32014-01a.htm"; break; @@ -92,8 +81,7 @@ public class Q00651_RunawayYouth extends Quest } break; case BATIDAE: - if (st.isStarted()) - { + if (st.isStarted()) { st.giveAdena(2883, true); st.exitQuest(true, true); htmltext = "31989-01.html"; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00652_AnAgedExAdventurer/Q00652_AnAgedExAdventurer.java b/src/main/java/com/l2jserver/datapack/quests/Q00652_AnAgedExAdventurer/Q00652_AnAgedExAdventurer.java index 7bffec84d6..b1740a0ec9 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00652_AnAgedExAdventurer/Q00652_AnAgedExAdventurer.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00652_AnAgedExAdventurer/Q00652_AnAgedExAdventurer.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.State; * An Aged Ex-Adventurer (652) * @author malyelfik */ -public class Q00652_AnAgedExAdventurer extends Quest -{ +public class Q00652_AnAgedExAdventurer extends Quest { // NPCs private static final int TANTAN = 32012; private static final int SARA = 30180; @@ -37,27 +36,22 @@ public class Q00652_AnAgedExAdventurer extends Quest private static final int SOULSHOT_C = 1464; private static final int ENCHANT_ARMOR_D = 956; - public Q00652_AnAgedExAdventurer() - { + public Q00652_AnAgedExAdventurer() { super(652, Q00652_AnAgedExAdventurer.class.getSimpleName(), "An Aged Ex-Adventurer"); addStartNpc(TANTAN); addTalkId(TANTAN, SARA); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - if (event.equals("32012-04.htm")) - { - if (st.getQuestItemsCount(SOULSHOT_C) < 100) - { + if (event.equals("32012-04.htm")) { + if (st.getQuestItemsCount(SOULSHOT_C) < 100) { return "32012-05.htm"; } @@ -65,24 +59,19 @@ public class Q00652_AnAgedExAdventurer extends Quest st.takeItems(SOULSHOT_C, 100); npc.deleteMe(); htmltext = event; - } - else if (event.equals("32012-03.html")) - { + } else if (event.equals("32012-03.html")) { htmltext = event; } return htmltext; } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case TANTAN: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= 46) ? "32012-01.htm" : "32012-01a.htm"; break; @@ -92,16 +81,12 @@ public class Q00652_AnAgedExAdventurer extends Quest } break; case SARA: - if (st.isStarted()) - { - if (getRandom(10) <= 4) - { + if (st.isStarted()) { + if (getRandom(10) <= 4) { st.giveItems(ENCHANT_ARMOR_D, 1); st.giveAdena(5026, true); htmltext = "30180-01.html"; - } - else - { + } else { st.giveAdena(10000, true); htmltext = "30180-02.html"; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00653_WildMaiden/Q00653_WildMaiden.java b/src/main/java/com/l2jserver/datapack/quests/Q00653_WildMaiden/Q00653_WildMaiden.java index 18ebce1d4e..135b86bf3c 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00653_WildMaiden/Q00653_WildMaiden.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00653_WildMaiden/Q00653_WildMaiden.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.State; * Wild Maiden (653) * @author malyelfik */ -public class Q00653_WildMaiden extends Quest -{ +public class Q00653_WildMaiden extends Quest { // NPCs private static final int GALIBREDO = 30181; private static final int SUKI = 32013; @@ -38,31 +37,24 @@ public class Q00653_WildMaiden extends Quest // Misc private static final int MIN_LEVEL = 36; - public Q00653_WildMaiden() - { + public Q00653_WildMaiden() { super(653, Q00653_WildMaiden.class.getSimpleName(), "Wild Maiden"); addStartNpc(SUKI); addTalkId(GALIBREDO, SUKI); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - if (event.equals("32013-03.html")) - { + if (event.equals("32013-03.html")) { htmltext = event; - } - else if (event.equals("32013-04.htm")) - { - if (!st.hasQuestItems(SOE)) - { + } else if (event.equals("32013-04.htm")) { + if (!st.hasQuestItems(SOE)) { return "32013-05.htm"; } st.startQuest(); @@ -74,15 +66,12 @@ public class Q00653_WildMaiden extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case SUKI: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? "32013-01.htm" : "32013-01a.htm"; break; @@ -92,8 +81,7 @@ public class Q00653_WildMaiden extends Quest } break; case GALIBREDO: - if (st.isStarted()) - { + if (st.isStarted()) { st.giveAdena(2553, true); st.exitQuest(true, true); htmltext = "30181-01.html"; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00654_JourneyToASettlement/Q00654_JourneyToASettlement.java b/src/main/java/com/l2jserver/datapack/quests/Q00654_JourneyToASettlement/Q00654_JourneyToASettlement.java index a9bc50f471..ccb140a369 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00654_JourneyToASettlement/Q00654_JourneyToASettlement.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00654_JourneyToASettlement/Q00654_JourneyToASettlement.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Journey to a Settlement (654) * @author Adry_85 */ -public final class Q00654_JourneyToASettlement extends Quest -{ +public final class Q00654_JourneyToASettlement extends Quest { // NPC private static final int NAMELESS_SPIRIT = 31453; // Items @@ -42,14 +41,12 @@ public final class Q00654_JourneyToASettlement extends Quest private static final int MIN_LEVEL = 74; private static final Map<Integer, Double> MOBS_SKIN = new HashMap<>(); - static - { + static { MOBS_SKIN.put(21294, 0.840); // Canyon Antelope MOBS_SKIN.put(21295, 0.893); // Canyon Antelope Slave } - public Q00654_JourneyToASettlement() - { + public Q00654_JourneyToASettlement() { super(654, Q00654_JourneyToASettlement.class.getSimpleName(), "Journey to a Settlement"); addStartNpc(NAMELESS_SPIRIT); addTalkId(NAMELESS_SPIRIT); @@ -58,37 +55,29 @@ public final class Q00654_JourneyToASettlement extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "31453-02.htm": - { + switch (event) { + case "31453-02.htm": { st.startQuest(); st.setMemoState(1); htmltext = event; break; } - case "31453-03.html": - { - if (st.isMemoState(1)) - { + case "31453-03.html": { + if (st.isMemoState(1)) { st.setMemoState(2); st.setCond(2, true); htmltext = event; } } - case "31453-07.html": - { - if (st.isMemoState(2) && st.hasQuestItems(ANTELOPE_SKIN)) - { + case "31453-07.html": { + if (st.isMemoState(2) && st.hasQuestItems(ANTELOPE_SKIN)) { giveItems(player, FRINTEZZAS_SCROLL, 1); st.exitQuest(true, true); htmltext = event; @@ -99,35 +88,26 @@ public final class Q00654_JourneyToASettlement extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getRandomPartyMemberState(player, 2, 3, npc); - if ((st != null) && giveItemRandomly(st.getPlayer(), npc, ANTELOPE_SKIN, 1, 1, MOBS_SKIN.get(npc.getId()), true)) - { + if ((st != null) && giveItemRandomly(st.getPlayer(), npc, ANTELOPE_SKIN, 1, 1, MOBS_SKIN.get(npc.getId()), true)) { st.setCond(3); } return super.onKill(npc, player, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCreated()) - { + if (st.isCreated()) { htmltext = ((player.getLevel() >= MIN_LEVEL) && player.hasQuestCompleted(Q00119_LastImperialPrince.class.getSimpleName())) ? "31453-01.htm" : "31453-04.htm"; - } - else if (st.isStarted()) - { - if (st.isMemoState(1)) - { + } else if (st.isStarted()) { + if (st.isMemoState(1)) { st.setMemoState(2); st.setCond(2, true); htmltext = "31453-03.html"; - } - else if (st.isMemoState(2)) - { + } else if (st.isMemoState(2)) { htmltext = (hasQuestItems(player, ANTELOPE_SKIN) ? "31453-06.html" : "31453-05.html"); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00655_AGrandPlanForTamingWildBeasts/Q00655_AGrandPlanForTamingWildBeasts.java b/src/main/java/com/l2jserver/datapack/quests/Q00655_AGrandPlanForTamingWildBeasts/Q00655_AGrandPlanForTamingWildBeasts.java index 9215dc6924..5599b0165b 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00655_AGrandPlanForTamingWildBeasts/Q00655_AGrandPlanForTamingWildBeasts.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00655_AGrandPlanForTamingWildBeasts/Q00655_AGrandPlanForTamingWildBeasts.java @@ -37,8 +37,7 @@ import com.l2jserver.gameserver.util.Util; * A Grand Plan for Taming Wild Beasts (655) * @author Zoey76 */ -public final class Q00655_AGrandPlanForTamingWildBeasts extends Quest -{ +public final class Q00655_AGrandPlanForTamingWildBeasts extends Quest { // NPCs private static final int MESSENGER = 35627; // Items @@ -50,8 +49,7 @@ public final class Q00655_AGrandPlanForTamingWildBeasts extends Quest private static final int MINUTES_TO_SIEGE = 3600; private static final String PATH_TO_HTML = "data/scripts/conquerablehalls/flagwar/WildBeastReserve/messenger_initial.htm"; - public Q00655_AGrandPlanForTamingWildBeasts() - { + public Q00655_AGrandPlanForTamingWildBeasts() { super(655, Q00655_AGrandPlanForTamingWildBeasts.class.getSimpleName(), "A Grand Plan for Taming Wild Beasts"); addStartNpc(MESSENGER); addTalkId(MESSENGER); @@ -59,45 +57,34 @@ public final class Q00655_AGrandPlanForTamingWildBeasts extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; final L2Clan clan = player.getClan(); final long minutesToSiege = getMinutesToSiege(); - switch (event) - { - case "35627-06.html": - { - if (qs.isCreated()) - { + switch (event) { + case "35627-06.html": { + if (qs.isCreated()) { if ((clan != null) && (clan.getLevel() >= REQUIRED_CLAN_LEVEL) && (clan.getFortId() == 0) // - && player.isClanLeader() && (minutesToSiege > 0) && (minutesToSiege < MINUTES_TO_SIEGE)) - { + && player.isClanLeader() && (minutesToSiege > 0) && (minutesToSiege < MINUTES_TO_SIEGE)) { qs.startQuest(); htmltext = event; } } break; } - case "35627-06a.html": - { + case "35627-06a.html": { htmltext = event; break; } - case "35627-11.html": - { - if ((minutesToSiege > 0) && (minutesToSiege < MINUTES_TO_SIEGE)) - { + case "35627-11.html": { + if ((minutesToSiege > 0) && (minutesToSiege < MINUTES_TO_SIEGE)) { htmltext = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), PATH_TO_HTML); - } - else - { + } else { htmltext = getHtm(player.getHtmlPrefix(), event); htmltext = htmltext.replace("%next_siege%", getSiegeDate()); } @@ -108,80 +95,51 @@ public final class Q00655_AGrandPlanForTamingWildBeasts extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); final long minutesToSiege = getMinutesToSiege(); - if (qs.isCreated()) - { + if (qs.isCreated()) { final L2Clan clan = talker.getClan(); - if (clan == null) - { + if (clan == null) { return htmltext; } - if ((minutesToSiege > 0) && (minutesToSiege < MINUTES_TO_SIEGE)) - { - if (talker.isClanLeader()) - { - if (clan.getFortId() == 0) - { - if (clan.getLevel() >= REQUIRED_CLAN_LEVEL) - { + if ((minutesToSiege > 0) && (minutesToSiege < MINUTES_TO_SIEGE)) { + if (talker.isClanLeader()) { + if (clan.getFortId() == 0) { + if (clan.getLevel() >= REQUIRED_CLAN_LEVEL) { htmltext = "35627-01.html"; - } - else - { + } else { htmltext = "35627-03.html"; } - } - else - { + } else { htmltext = "35627-04.html"; } - } - else - { - if ((clan.getFortId() == ClanHallSiegeEngine.BEAST_FARM) && (minutesToSiege > 0) && (minutesToSiege < MINUTES_TO_SIEGE)) - { + } else { + if ((clan.getFortId() == ClanHallSiegeEngine.BEAST_FARM) && (minutesToSiege > 0) && (minutesToSiege < MINUTES_TO_SIEGE)) { htmltext = HtmCache.getInstance().getHtm(talker.getHtmlPrefix(), PATH_TO_HTML); - } - else - { + } else { htmltext = "35627-05.html"; } } - } - else - { + } else { htmltext = getHtm(talker.getHtmlPrefix(), "35627-02.html"); htmltext = htmltext.replace("%next_siege%", getSiegeDate()); } - } - else - { - if ((minutesToSiege < 0) || (minutesToSiege > MINUTES_TO_SIEGE)) - { + } else { + if ((minutesToSiege < 0) || (minutesToSiege > MINUTES_TO_SIEGE)) { takeItems(talker, TRAINER_LICENSE, -1); takeItems(talker, CRYSTAL_OF_PURITY, -1); qs.exitQuest(true, true); htmltext = "35627-07.html"; - } - else - { - if (hasQuestItems(talker, TRAINER_LICENSE)) - { + } else { + if (hasQuestItems(talker, TRAINER_LICENSE)) { htmltext = "35627-09.html"; - } - else - { - if (getQuestItemsCount(talker, CRYSTAL_OF_PURITY) < REQUIRED_CRYSTAL_COUNT) - { + } else { + if (getQuestItemsCount(talker, CRYSTAL_OF_PURITY) < REQUIRED_CRYSTAL_COUNT) { htmltext = "35627-08.html"; - } - else - { + } else { giveItems(talker, TRAINER_LICENSE, 1); takeItems(talker, CRYSTAL_OF_PURITY, -1); qs.setCond(3, true); @@ -197,11 +155,9 @@ public final class Q00655_AGrandPlanForTamingWildBeasts extends Quest * Gets the Wild Beast Reserve's siege date. * @return the siege date */ - private static String getSiegeDate() - { + private static String getSiegeDate() { final SiegableHall hall = ClanHallSiegeManager.getInstance().getSiegableHall(ClanHallSiegeEngine.BEAST_FARM); - if (hall != null) - { + if (hall != null) { final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return sdf.format(hall.getSiegeDate().getTime()); } @@ -212,11 +168,9 @@ public final class Q00655_AGrandPlanForTamingWildBeasts extends Quest * Gets the minutes to next siege. * @return minutes to next siege */ - private static long getMinutesToSiege() - { + private static long getMinutesToSiege() { final SiegableHall hall = ClanHallSiegeManager.getInstance().getSiegableHall(ClanHallSiegeEngine.BEAST_FARM); - if (hall != null) - { + if (hall != null) { return (hall.getNextSiegeTime() - Calendar.getInstance().getTimeInMillis()) / 3600; } return -1; @@ -227,28 +181,20 @@ public final class Q00655_AGrandPlanForTamingWildBeasts extends Quest * @param player the player * @param npc the wild beast */ - public static void reward(L2PcInstance player, L2Npc npc) - { + public static void reward(L2PcInstance player, L2Npc npc) { final L2Clan clan = player.getClan(); final L2PcInstance clanLeader = clan != null ? clan.getLeader().getPlayerInstance() : null; - if (clanLeader != null) - { + if (clanLeader != null) { final QuestState qs655 = clanLeader.getQuestState(Q00655_AGrandPlanForTamingWildBeasts.class.getSimpleName()); - if (qs655 != null) - { - if ((getQuestItemsCount(clanLeader, CRYSTAL_OF_PURITY) < REQUIRED_CRYSTAL_COUNT) && Util.checkIfInRange(2000, clanLeader, npc, true)) - { - if (clanLeader.getLevel() >= REQUIRED_CLAN_LEVEL) - { + if (qs655 != null) { + if ((getQuestItemsCount(clanLeader, CRYSTAL_OF_PURITY) < REQUIRED_CRYSTAL_COUNT) && Util.checkIfInRange(2000, clanLeader, npc, true)) { + if (clanLeader.getLevel() >= REQUIRED_CLAN_LEVEL) { giveItems(clanLeader, CRYSTAL_OF_PURITY, 1); } - if (getQuestItemsCount(clanLeader, CRYSTAL_OF_PURITY) >= 9) - { + if (getQuestItemsCount(clanLeader, CRYSTAL_OF_PURITY) >= 9) { qs655.setCond(2, true); - } - else - { + } else { playSound(clanLeader, Sound.ITEMSOUND_QUEST_ITEMGET); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00659_IdRatherBeCollectingFairyBreath/Q00659_IdRatherBeCollectingFairyBreath.java b/src/main/java/com/l2jserver/datapack/quests/Q00659_IdRatherBeCollectingFairyBreath/Q00659_IdRatherBeCollectingFairyBreath.java index 462b4f68b1..b65df84d4f 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00659_IdRatherBeCollectingFairyBreath/Q00659_IdRatherBeCollectingFairyBreath.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00659_IdRatherBeCollectingFairyBreath/Q00659_IdRatherBeCollectingFairyBreath.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * I'd Rather Be Collecting Fairy Breath (659) * @author Adry_85 */ -public final class Q00659_IdRatherBeCollectingFairyBreath extends Quest -{ +public final class Q00659_IdRatherBeCollectingFairyBreath extends Quest { // NPC private static final int GALATEA = 30634; // Item @@ -40,8 +39,7 @@ public final class Q00659_IdRatherBeCollectingFairyBreath extends Quest private static final int MIN_LEVEL = 26; // Mobs private static final Map<Integer, Double> MOBS = new HashMap<>(); - static - { + static { MOBS.put(20078, 0.98); // whispering_wind MOBS.put(21023, 0.82); // sobing_wind MOBS.put(21024, 0.86); // babbleing_wind @@ -49,8 +47,7 @@ public final class Q00659_IdRatherBeCollectingFairyBreath extends Quest MOBS.put(21026, 0.96); // singing_wind } - public Q00659_IdRatherBeCollectingFairyBreath() - { + public Q00659_IdRatherBeCollectingFairyBreath() { super(659, Q00659_IdRatherBeCollectingFairyBreath.class.getSimpleName(), "I'd Rather Be Collecting Fairy Breath"); addStartNpc(GALATEA); addTalkId(GALATEA); @@ -59,46 +56,36 @@ public final class Q00659_IdRatherBeCollectingFairyBreath extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "30634-02.htm": - { + switch (event) { + case "30634-02.htm": { st.startQuest(); htmltext = event; break; } - case "REWARD": - { - if (hasQuestItems(player, FAIRY_BREATH)) - { + case "REWARD": { + if (hasQuestItems(player, FAIRY_BREATH)) { final long count = getQuestItemsCount(player, FAIRY_BREATH); final long bonus = ((count >= 10) ? 5365 : 0); st.takeItems(FAIRY_BREATH, -1); st.giveAdena((count * 50) + bonus, true); htmltext = "30634-05.html"; - } - else - { + } else { htmltext = "30634-06.html"; } break; } - case "30634-07.html": - { + case "30634-07.html": { htmltext = event; break; } - case "30634-08.html": - { + case "30634-08.html": { st.exitQuest(true, true); htmltext = event; break; @@ -108,27 +95,21 @@ public final class Q00659_IdRatherBeCollectingFairyBreath extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getRandomPartyMemberState(player, -1, 3, npc); - if (st != null) - { + if (st != null) { st.giveItemRandomly(npc, FAIRY_BREATH, 1, 0, MOBS.get(npc.getId()), true); } return super.onKill(npc, player, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCreated()) - { + if (st.isCreated()) { htmltext = ((player.getLevel() >= MIN_LEVEL) ? "30634-01.htm" : "30634-03.html"); - } - else if (st.isStarted()) - { + } else if (st.isStarted()) { htmltext = (hasQuestItems(player, FAIRY_BREATH) ? "30634-04.html" : "30634-09.html"); } return htmltext; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00660_AidingTheFloranVillage/Q00660_AidingTheFloranVillage.java b/src/main/java/com/l2jserver/datapack/quests/Q00660_AidingTheFloranVillage/Q00660_AidingTheFloranVillage.java index 94f9781826..605b596ea0 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00660_AidingTheFloranVillage/Q00660_AidingTheFloranVillage.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00660_AidingTheFloranVillage/Q00660_AidingTheFloranVillage.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.model.quest.State; * Aiding the Floran Village (660) * @author Zoey76 */ -public final class Q00660_AidingTheFloranVillage extends Quest -{ +public final class Q00660_AidingTheFloranVillage extends Quest { // NPC private static final int ALEX = 30291; private static final int MARIA = 30608; @@ -57,8 +56,7 @@ public final class Q00660_AidingTheFloranVillage extends Quest private static final int DELU_LIZARDMAN_COMMANDER = 21107; // Delu Lizardman Commander private static final Map<Integer, ItemChanceHolder> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(21102, new ItemChanceHolder(WATCHING_EYES, 0.500)); // Watchman of the Plains MONSTERS.put(21106, new ItemChanceHolder(WATCHING_EYES, 0.630)); // Cursed Seer MONSTERS.put(21103, new ItemChanceHolder(ROUGHLY_HEWN_ROCK_GOLEM_SHARD, 0.520)); // Roughly Hewn Rock Golem @@ -67,8 +65,7 @@ public final class Q00660_AidingTheFloranVillage extends Quest MONSTERS.put(21105, new ItemChanceHolder(DELU_LIZARDMANS_SCALE, 0.750)); // Delu Lizardman Special Agent } - public Q00660_AidingTheFloranVillage() - { + public Q00660_AidingTheFloranVillage() { super(660, Q00660_AidingTheFloranVillage.class.getSimpleName(), "Aiding the Floran Village"); addStartNpc(MARIA, ALEX); addTalkId(MARIA, ALEX); @@ -78,26 +75,19 @@ public final class Q00660_AidingTheFloranVillage extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "30608-06.htm": - { - if (player.getLevel() >= MIN_LEVEL) - { + switch (event) { + case "30608-06.htm": { + if (player.getLevel() >= MIN_LEVEL) { qs.startQuest(); htmltext = event; - } - else - { + } else { htmltext = "30608-06a.htm"; } break; @@ -108,151 +98,112 @@ public final class Q00660_AidingTheFloranVillage extends Quest case "30291-09.html": case "30291-10.html": case "30291-14.html": - case "30291-18.html": - { + case "30291-18.html": { htmltext = event; break; } - case "30291-03.htm": - { - if (player.getLevel() >= MIN_LEVEL) - { - if (qs.isCreated()) - { + case "30291-03.htm": { + if (player.getLevel() >= MIN_LEVEL) { + if (qs.isCreated()) { qs.setState(State.STARTED); qs.setCond(2); playSound(player, Sound.ITEMSOUND_QUEST_ACCEPT); } htmltext = event; - } - else - { + } else { htmltext = "30291-02.htm"; } break; } - case "30291-06.html": - { + case "30291-06.html": { final long itemCount = getQuestItemsCount(player, WATCHING_EYES) + getQuestItemsCount(player, ROUGHLY_HEWN_ROCK_GOLEM_SHARD) + getQuestItemsCount(player, DELU_LIZARDMANS_SCALE); - if (itemCount > 0) - { + if (itemCount > 0) { giveAdena(player, itemCount * 100, true); takeItems(player, -1, WATCHING_EYES, ROUGHLY_HEWN_ROCK_GOLEM_SHARD, DELU_LIZARDMANS_SCALE); htmltext = event; - } - else - { + } else { htmltext = "30291-08.html"; } break; } - case "30291-08a.html": - { + case "30291-08a.html": { qs.exitQuest(true, true); takeItems(player, -1, WATCHING_EYES, ROUGHLY_HEWN_ROCK_GOLEM_SHARD, DELU_LIZARDMANS_SCALE); htmltext = event; break; } - case "30291-12.html": - { + case "30291-12.html": { final long itemCount1 = getQuestItemsCount(player, WATCHING_EYES); final long itemCount2 = getQuestItemsCount(player, ROUGHLY_HEWN_ROCK_GOLEM_SHARD); final long itemCount3 = getQuestItemsCount(player, DELU_LIZARDMANS_SCALE); final long itemCount = itemCount1 + itemCount2 + itemCount3; - if (itemCount < 100) - { + if (itemCount < 100) { htmltext = "30291-11.html"; - } - else - { + } else { tradeItems(player, 100, itemCount1, itemCount2, itemCount3); - if (getRandom(99) > 50) - { + if (getRandom(99) > 50) { giveItems(player, SCROLL_ENCHANT_ARMOR_D_GRADE, 1); giveAdena(player, ADENA_REWARD_1, true); htmltext = event; - } - else - { + } else { giveAdena(player, ADENA_REWARD_2, true); htmltext = "30291-13.html"; } } break; } - case "30291-16.html": - { + case "30291-16.html": { final long itemCount1 = getQuestItemsCount(player, WATCHING_EYES); final long itemCount2 = getQuestItemsCount(player, ROUGHLY_HEWN_ROCK_GOLEM_SHARD); final long itemCount3 = getQuestItemsCount(player, DELU_LIZARDMANS_SCALE); final long itemCount = itemCount1 + itemCount2 + itemCount3; - if (itemCount < 200) - { + if (itemCount < 200) { htmltext = "30291-15.html"; - } - else - { + } else { tradeItems(player, 200, itemCount1, itemCount2, itemCount3); - if (getRandom(100) >= 50) - { - if (getRandom(2) == 0) - { + if (getRandom(100) >= 50) { + if (getRandom(2) == 0) { giveItems(player, SCROLL_ENCHANT_ARMOR_D_GRADE, 1); giveAdena(player, ADENA_REWARD_3, true); - } - else - { + } else { giveItems(player, SCROLL_ENCHANT_WEAPON_D_GRADE, 1); } htmltext = event; - } - else - { + } else { giveAdena(player, ADENA_REWARD_4, true); htmltext = "30291-17.html"; } } break; } - case "30291-20.html": - { + case "30291-20.html": { final long itemCount1 = getQuestItemsCount(player, WATCHING_EYES); final long itemCount2 = getQuestItemsCount(player, ROUGHLY_HEWN_ROCK_GOLEM_SHARD); final long itemCount3 = getQuestItemsCount(player, DELU_LIZARDMANS_SCALE); final long itemCount = itemCount1 + itemCount2 + itemCount3; - if (itemCount < 500) - { + if (itemCount < 500) { htmltext = "30291-19.html"; - } - else - { + } else { tradeItems(player, 500, itemCount1, itemCount2, itemCount3); - if (getRandom(100) >= 50) - { + if (getRandom(100) >= 50) { giveItems(player, SCROLL_ENCHANT_ARMOR_D_GRADE, 1); giveAdena(player, ADENA_REWARD_5, true); htmltext = event; - } - else - { + } else { giveAdena(player, ADENA_REWARD_6, true); htmltext = "30291-21.html"; } } break; } - case "30291-22.html": - { + case "30291-22.html": { final long itemCount = getQuestItemsCount(player, WATCHING_EYES) + getQuestItemsCount(player, ROUGHLY_HEWN_ROCK_GOLEM_SHARD) + getQuestItemsCount(player, DELU_LIZARDMANS_SCALE); - if (itemCount <= 0) - { + if (itemCount <= 0) { htmltext = "30291-23.html"; - } - else - { + } else { giveAdena(player, itemCount * 100, true); htmltext = event; } @@ -266,24 +217,16 @@ public final class Q00660_AidingTheFloranVillage extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(player, 2, 2, npc); - if (qs != null) - { + if (qs != null) { final ItemChanceHolder item = MONSTERS.get(npc.getId()); - if (item != null) - { + if (item != null) { giveItemRandomly(player, npc, item.getId(), item.getCount(), 0, item.getChance(), true); - } - else - { - if (getRandom(100) < DELU_LIZARDMAN_COMMANDER_DOUBLE_ITEM_CHANCE) - { + } else { + if (getRandom(100) < DELU_LIZARDMAN_COMMANDER_DOUBLE_ITEM_CHANCE) { giveItems(player, DELU_LIZARDMANS_SCALE, 2); - } - else - { + } else { giveItems(player, DELU_LIZARDMANS_SCALE, 1); } playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); @@ -293,48 +236,35 @@ public final class Q00660_AidingTheFloranVillage extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { - switch (npc.getId()) - { - case MARIA: - { + if (qs.isCreated()) { + switch (npc.getId()) { + case MARIA: { htmltext = player.getLevel() >= MIN_LEVEL ? "30608-01.htm" : "30608-04.html"; break; } - case ALEX: - { + case ALEX: { htmltext = player.getLevel() >= MIN_LEVEL ? "30291-01.htm" : "30291-02.htm"; break; } } - } - else if (qs.isStarted()) - { - switch (npc.getId()) - { - case MARIA: - { + } else if (qs.isStarted()) { + switch (npc.getId()) { + case MARIA: { htmltext = "30608-05.html"; break; } - case ALEX: - { - switch (qs.getCond()) - { - case 1: - { + case ALEX: { + switch (qs.getCond()) { + case 1: { // Quest started with Maria. qs.setCond(2, true); htmltext = "30291-04.html"; break; } - case 2: - { + case 2: { htmltext = "30291-05.html"; break; } @@ -346,36 +276,26 @@ public final class Q00660_AidingTheFloranVillage extends Quest return htmltext; } - private static final void tradeItems(L2PcInstance player, long required, long itemCount1, long itemCount2, long itemCount3) - { - if (itemCount1 < required) - { + private static final void tradeItems(L2PcInstance player, long required, long itemCount1, long itemCount2, long itemCount3) { + if (itemCount1 < required) { takeItems(player, WATCHING_EYES, itemCount1); required -= itemCount1; - } - else - { + } else { takeItems(player, WATCHING_EYES, required); required = 0; } - if (itemCount2 < required) - { + if (itemCount2 < required) { takeItems(player, ROUGHLY_HEWN_ROCK_GOLEM_SHARD, itemCount2); required -= itemCount2; - } - else - { + } else { takeItems(player, ROUGHLY_HEWN_ROCK_GOLEM_SHARD, required); required = 0; } - if (itemCount3 < required) - { + if (itemCount3 < required) { takeItems(player, DELU_LIZARDMANS_SCALE, itemCount3); - } - else - { + } else { takeItems(player, DELU_LIZARDMANS_SCALE, required); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00661_MakingTheHarvestGroundsSafe/Q00661_MakingTheHarvestGroundsSafe.java b/src/main/java/com/l2jserver/datapack/quests/Q00661_MakingTheHarvestGroundsSafe/Q00661_MakingTheHarvestGroundsSafe.java index 32aadd3675..0eed99ce0e 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00661_MakingTheHarvestGroundsSafe/Q00661_MakingTheHarvestGroundsSafe.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00661_MakingTheHarvestGroundsSafe/Q00661_MakingTheHarvestGroundsSafe.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.model.quest.State; * Making the Harvest Grounds Safe (661) * @author Pandragon */ -public final class Q00661_MakingTheHarvestGroundsSafe extends Quest -{ +public final class Q00661_MakingTheHarvestGroundsSafe extends Quest { // NPC private static final int NORMAN = 30210; // Items @@ -50,8 +49,7 @@ public final class Q00661_MakingTheHarvestGroundsSafe extends Quest // Misc private static final int MIN_LVL = 21; - public Q00661_MakingTheHarvestGroundsSafe() - { + public Q00661_MakingTheHarvestGroundsSafe() { super(661, Q00661_MakingTheHarvestGroundsSafe.class.getSimpleName(), "Making the Harvest Grounds Safe"); addStartNpc(NORMAN); addTalkId(NORMAN); @@ -60,42 +58,34 @@ public final class Q00661_MakingTheHarvestGroundsSafe extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { + switch (event) { case "30210-01.htm": case "30210-02.htm": case "30210-04.html": - case "30210-06.html": - { + case "30210-06.html": { htmltext = event; break; } - case "30210-03.htm": - { - if (qs.isCreated()) - { + case "30210-03.htm": { + if (qs.isCreated()) { qs.startQuest(); htmltext = event; } break; } - case "30210-08.html": - { + case "30210-08.html": { long stingCount = getQuestItemsCount(player, BIG_HORNET_STING); long gemCount = getQuestItemsCount(player, CLOUD_GEM); long clawCount = getQuestItemsCount(player, YOUNG_ARANEID_CLAW); long reward = (57 * stingCount) + (56 * gemCount) + (60 * clawCount); - if ((stingCount + gemCount + clawCount) >= 10) - { + if ((stingCount + gemCount + clawCount) >= 10) { reward += 5773; } takeItems(player, BIG_HORNET_STING, -1); @@ -105,8 +95,7 @@ public final class Q00661_MakingTheHarvestGroundsSafe extends Quest htmltext = event; break; } - case "30210-09.html": - { + case "30210-09.html": { qs.exitQuest(true, true); htmltext = event; break; @@ -116,25 +105,18 @@ public final class Q00661_MakingTheHarvestGroundsSafe extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = getQuestState(talker, true); String htmltext = getNoQuestMsg(talker); - switch (qs.getState()) - { - case State.CREATED: - { + switch (qs.getState()) { + case State.CREATED: { htmltext = (talker.getLevel() >= MIN_LVL) ? "30210-01.htm" : "30210-02.htm"; break; } - case State.STARTED: - { - if (hasQuestItems(talker, BIG_HORNET_STING, CLOUD_GEM, YOUNG_ARANEID_CLAW)) - { + case State.STARTED: { + if (hasQuestItems(talker, BIG_HORNET_STING, CLOUD_GEM, YOUNG_ARANEID_CLAW)) { htmltext = "30210-04.html"; - } - else - { + } else { htmltext = "30210-05.html"; } break; @@ -144,11 +126,9 @@ public final class Q00661_MakingTheHarvestGroundsSafe extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc); - if (qs != null) - { + if (qs != null) { final ItemChanceHolder item = MONSTER_CHANCES.get(npc.getId()); giveItemRandomly(qs.getPlayer(), npc, item.getId(), item.getCount(), 0, item.getChance(), true); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00662_AGameOfCards/Q00662_AGameOfCards.java b/src/main/java/com/l2jserver/datapack/quests/Q00662_AGameOfCards/Q00662_AGameOfCards.java index fae5c01083..d03fd593f2 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00662_AGameOfCards/Q00662_AGameOfCards.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00662_AGameOfCards/Q00662_AGameOfCards.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.util.Util; * A Game of Cards (662) * @author Zoey76 */ -public final class Q00662_AGameOfCards extends Quest -{ +public final class Q00662_AGameOfCards extends Quest { // NPC private static final int KLUMP = 30845; // Items @@ -47,8 +46,7 @@ public final class Q00662_AGameOfCards extends Quest // Monsters private static final Map<Integer, Integer> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(20672, 357); // Trives MONSTERS.put(20673, 357); // Falibati MONSTERS.put(20674, 583); // Doom Knight @@ -89,8 +87,7 @@ public final class Q00662_AGameOfCards extends Quest MONSTERS.put(18001, 232); // Blood Queen } - public Q00662_AGameOfCards() - { + public Q00662_AGameOfCards() { super(662, Q00662_AGameOfCards.class.getSimpleName(), "A Game of Cards"); addStartNpc(KLUMP); addTalkId(KLUMP); @@ -98,23 +95,17 @@ public final class Q00662_AGameOfCards extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { - case "30845-03.htm": - { - if (player.getLevel() >= MIN_LEVEL) - { - if (st.isCreated()) - { + switch (event) { + case "30845-03.htm": { + if (player.getLevel() >= MIN_LEVEL) { + if (st.isCreated()) { st.startQuest(); } htmltext = event; @@ -126,117 +117,76 @@ public final class Q00662_AGameOfCards extends Quest case "30845-09.html": case "30845-09a.html": case "30845-09b.html": - case "30845-10.html": - { + case "30845-10.html": { htmltext = event; break; } - case "30845-07.html": - { + case "30845-07.html": { st.exitQuest(true, true); htmltext = event; break; } - case "return": - { + case "return": { htmltext = st.getQuestItemsCount(RED_GEM) < REQUIRED_CHIP_COUNT ? "30845-04.html" : "30845-05.html"; break; } - case "30845-11.html": - { - if (st.getQuestItemsCount(RED_GEM) >= REQUIRED_CHIP_COUNT) - { + case "30845-11.html": { + if (st.getQuestItemsCount(RED_GEM) >= REQUIRED_CHIP_COUNT) { int i1 = 0; int i2 = 0; int i3 = 0; int i4 = 0; int i5 = 0; - while ((i1 == i2) || (i1 == i3) || (i1 == i4) || (i1 == i5) || (i2 == i3) || (i2 == i4) || (i2 == i5) || (i3 == i4) || (i3 == i5) || (i4 == i5)) - { + while ((i1 == i2) || (i1 == i3) || (i1 == i4) || (i1 == i5) || (i2 == i3) || (i2 == i4) || (i2 == i5) || (i3 == i4) || (i3 == i5) || (i4 == i5)) { i1 = getRandom(70) + 1; i2 = getRandom(70) + 1; i3 = getRandom(70) + 1; i4 = getRandom(70) + 1; i5 = getRandom(70) + 1; } - if (i1 >= 57) - { + if (i1 >= 57) { i1 = i1 - 56; - } - else if (i1 >= 43) - { + } else if (i1 >= 43) { i1 = i1 - 42; - } - else if (i1 >= 29) - { + } else if (i1 >= 29) { i1 = i1 - 28; - } - else if (i1 >= 15) - { + } else if (i1 >= 15) { i1 = i1 - 14; } - if (i2 >= 57) - { + if (i2 >= 57) { i2 = i2 - 56; - } - else if (i2 >= 43) - { + } else if (i2 >= 43) { i2 = i2 - 42; - } - else if (i2 >= 29) - { + } else if (i2 >= 29) { i2 = i2 - 28; - } - else if (i2 >= 15) - { + } else if (i2 >= 15) { i2 = i2 - 14; } - if (i3 >= 57) - { + if (i3 >= 57) { i3 = i3 - 56; - } - else if (i3 >= 43) - { + } else if (i3 >= 43) { i3 = i3 - 42; - } - else if (i3 >= 29) - { + } else if (i3 >= 29) { i3 = i3 - 28; - } - else if (i3 >= 15) - { + } else if (i3 >= 15) { i3 = i3 - 14; } - if (i4 >= 57) - { + if (i4 >= 57) { i4 = i4 - 56; - } - else if (i4 >= 43) - { + } else if (i4 >= 43) { i4 = i4 - 42; - } - else if (i4 >= 29) - { + } else if (i4 >= 29) { i4 = i4 - 28; - } - else if (i4 >= 15) - { + } else if (i4 >= 15) { i4 = i4 - 14; } - if (i5 >= 57) - { + if (i5 >= 57) { i5 = i5 - 56; - } - else if (i5 >= 43) - { + } else if (i5 >= 43) { i5 = i5 - 42; - } - else if (i5 >= 29) - { + } else if (i5 >= 29) { i5 = i5 - 28; - } - else if (i5 >= 15) - { + } else if (i5 >= 15) { i5 = i5 - 14; } st.set("v1", (i4 * 1000000) + (i3 * 10000) + (i2 * 100) + i1); @@ -250,8 +200,7 @@ public final class Q00662_AGameOfCards extends Quest case "turncard2": case "turncard3": case "turncard4": - case "turncard5": - { + case "turncard5": { final int cond = st.getInt("v1"); int i1 = st.getInt("ExMemoState"); int i5 = i1 % 100; @@ -260,226 +209,163 @@ public final class Q00662_AGameOfCards extends Quest int i2 = (cond % 10000) / 100; int i3 = (cond % 1000000) / 10000; int i4 = (cond % 100000000) / 1000000; - switch (event) - { - case "turncard1": - { - if ((i9 % 2) < 1) - { + switch (event) { + case "turncard1": { + if ((i9 % 2) < 1) { i9 = i9 + 1; } - if ((i9 % 32) < 31) - { + if ((i9 % 32) < 31) { st.set("ExMemoState", (i9 * 100) + i5); } break; } - case "turncard2": - { - if ((i9 % 4) < 2) - { + case "turncard2": { + if ((i9 % 4) < 2) { i9 = i9 + 2; } - if ((i9 % 32) < 31) - { + if ((i9 % 32) < 31) { st.set("ExMemoState", (i9 * 100) + i5); } break; } - case "turncard3": - { - if ((i9 % 8) < 4) - { + case "turncard3": { + if ((i9 % 8) < 4) { i9 = i9 + 4; } - if ((i9 % 32) < 31) - { + if ((i9 % 32) < 31) { st.set("ExMemoState", (i9 * 100) + i5); } break; } - case "turncard4": - { - if ((i9 % 16) < 8) - { + case "turncard4": { + if ((i9 % 16) < 8) { i9 = i9 + 8; } - if ((i9 % 32) < 31) - { + if ((i9 % 32) < 31) { st.set("ExMemoState", (i9 * 100) + i5); } break; } - case "turncard5": - { - if ((i9 % 32) < 16) - { + case "turncard5": { + if ((i9 % 32) < 16) { i9 = i9 + 16; } - if ((i9 % 32) < 31) - { + if ((i9 % 32) < 31) { st.set("ExMemoState", (i9 * 100) + i5); } break; } } - if ((i9 % 32) < 31) - { + if ((i9 % 32) < 31) { htmltext = getHtm(player.getHtmlPrefix(), "30845-12.html"); - } - else if ((i9 % 32) == 31) - { + } else if ((i9 % 32) == 31) { int i6 = 0; int i8 = 0; - if ((i1 >= 1) && (i1 <= 14) && (i2 >= 1) && (i2 <= 14) && (i3 >= 1) && (i3 <= 14) && (i4 >= 1) && (i4 <= 14) && (i5 >= 1) && (i5 <= 14)) - { - if (i1 == i2) - { + if ((i1 >= 1) && (i1 <= 14) && (i2 >= 1) && (i2 <= 14) && (i3 >= 1) && (i3 <= 14) && (i4 >= 1) && (i4 <= 14) && (i5 >= 1) && (i5 <= 14)) { + if (i1 == i2) { i6 = i6 + 10; i8 = i8 + 8; } - if (i1 == i3) - { + if (i1 == i3) { i6 = i6 + 10; i8 = i8 + 4; } - if (i1 == i4) - { + if (i1 == i4) { i6 = i6 + 10; i8 = i8 + 2; } - if (i1 == i5) - { + if (i1 == i5) { i6 = i6 + 10; i8 = i8 + 1; } - if ((i6 % 100) < 10) - { - if ((i8 % 16) < 8) - { - if ((i8 % 8) < 4) - { - if (i2 == i3) - { + if ((i6 % 100) < 10) { + if ((i8 % 16) < 8) { + if ((i8 % 8) < 4) { + if (i2 == i3) { i6 = i6 + 10; i8 = i8 + 4; } } - if ((i8 % 4) < 2) - { - if (i2 == i4) - { + if ((i8 % 4) < 2) { + if (i2 == i4) { i6 = i6 + 10; i8 = i8 + 2; } } - if ((i8 % 2) < 1) - { - if (i2 == i5) - { + if ((i8 % 2) < 1) { + if (i2 == i5) { i6 = i6 + 10; i8 = i8 + 1; } } } - } - else if ((i6 % 10) == 0) - { - if ((i8 % 16) < 8) - { - if ((i8 % 8) < 4) - { - if (i2 == i3) - { + } else if ((i6 % 10) == 0) { + if ((i8 % 16) < 8) { + if ((i8 % 8) < 4) { + if (i2 == i3) { i6 = i6 + 1; i8 = i8 + 4; } } - if ((i8 % 4) < 2) - { - if (i2 == i4) - { + if ((i8 % 4) < 2) { + if (i2 == i4) { i6 = i6 + 1; i8 = i8 + 2; } } - if ((i8 % 2) < 1) - { - if (i2 == i5) - { + if ((i8 % 2) < 1) { + if (i2 == i5) { i6 = i6 + 1; i8 = i8 + 1; } } } } - if ((i6 % 100) < 10) - { - if ((i8 % 8) < 4) - { - if ((i8 % 4) < 2) - { - if (i3 == i4) - { + if ((i6 % 100) < 10) { + if ((i8 % 8) < 4) { + if ((i8 % 4) < 2) { + if (i3 == i4) { i6 = i6 + 10; i8 = i8 + 2; } } - if ((i8 % 2) < 1) - { - if (i3 == i5) - { + if ((i8 % 2) < 1) { + if (i3 == i5) { i6 = i6 + 10; i8 = i8 + 1; } } } - } - else if ((i6 % 10) == 0) - { - if ((i8 % 8) < 4) - { - if ((i8 % 4) < 2) - { - if (i3 == i4) - { + } else if ((i6 % 10) == 0) { + if ((i8 % 8) < 4) { + if ((i8 % 4) < 2) { + if (i3 == i4) { i6 = i6 + 1; i8 = i8 + 2; } } - if ((i8 % 2) < 1) - { - if (i3 == i5) - { + if ((i8 % 2) < 1) { + if (i3 == i5) { i6 = i6 + 1; i8 = i8 + 1; } } } } - if ((i6 % 100) < 10) - { - if ((i8 % 4) < 2) - { - if ((i8 % 2) < 1) - { - if (i4 == i5) - { + if ((i6 % 100) < 10) { + if ((i8 % 4) < 2) { + if ((i8 % 2) < 1) { + if (i4 == i5) { i6 = i6 + 10; i8 = i8 + 1; } } } - } - else if ((i6 % 10) == 0) - { - if ((i8 % 4) < 2) - { - if ((i8 % 2) < 1) - { - if (i4 == i5) - { + } else if ((i6 % 10) == 0) { + if ((i8 % 4) < 2) { + if ((i8 % 2) < 1) { + if (i4 == i5) { i6 = i6 + 1; i8 = i8 + 1; } @@ -488,118 +374,88 @@ public final class Q00662_AGameOfCards extends Quest } } - if (i6 == 40) - { + if (i6 == 40) { rewardItems(player, ZIGGOS_GEMSTONE, 43); rewardItems(player, 959, 3); rewardItems(player, 729, 1); st.set("ExMemoState", 0); st.set("v1", 0); htmltext = getHtm(player.getHtmlPrefix(), "30845-13.html"); - } - else if (i6 == 30) - { + } else if (i6 == 30) { rewardItems(player, 959, 2); rewardItems(player, 951, 2); st.set("ExMemoState", 0); st.set("v1", 0); htmltext = getHtm(player.getHtmlPrefix(), "30845-14.html"); - } - else if ((i6 == 21) || (i6 == 12)) - { + } else if ((i6 == 21) || (i6 == 12)) { rewardItems(player, 729, 1); rewardItems(player, 947, 2); rewardItems(player, 955, 1); st.set("ExMemoState", 0); st.set("v1", 0); htmltext = getHtm(player.getHtmlPrefix(), "30845-15.html"); - } - else if (i6 == 20) - { + } else if (i6 == 20) { rewardItems(player, 951, 2); st.set("ExMemoState", 0); st.set("v1", 0); htmltext = getHtm(player.getHtmlPrefix(), "30845-16.html"); - } - else if (i6 == 11) - { + } else if (i6 == 11) { rewardItems(player, 951, 1); st.set("ExMemoState", 0); st.set("v1", 0); htmltext = getHtm(player.getHtmlPrefix(), "30845-17.html"); - } - else if (i6 == 10) - { + } else if (i6 == 10) { rewardItems(player, 956, 2); st.set("ExMemoState", 0); st.set("v1", 0); htmltext = getHtm(player.getHtmlPrefix(), "30845-18.html"); - } - else if (i6 == 0) - { + } else if (i6 == 0) { st.set("ExMemoState", 0); st.set("v1", 0); htmltext = getHtm(player.getHtmlPrefix(), "30845-19.html"); } } - if (htmltext != null) - { - if ((i9 % 2) < 1) - { + if (htmltext != null) { + if ((i9 % 2) < 1) { htmltext = htmltext.replaceAll("FontColor1", "FFFF00"); htmltext = htmltext.replaceAll("Cell1", "?"); - } - else - { + } else { htmltext = htmltext.replaceAll("FontColor1", "FF6F6F"); htmltext = setHtml(htmltext, i1, "Cell1"); } - if ((i9 % 4) < 2) - { + if ((i9 % 4) < 2) { htmltext = htmltext.replaceAll("FontColor2", "FFFF00"); htmltext = htmltext.replaceAll("Cell2", "?"); - } - else - { + } else { htmltext = htmltext.replaceAll("FontColor2", "FF6F6F"); htmltext = setHtml(htmltext, i2, "Cell2"); } - if ((i9 % 8) < 4) - { + if ((i9 % 8) < 4) { htmltext = htmltext.replaceAll("FontColor3", "FFFF00"); htmltext = htmltext.replaceAll("Cell3", "?"); - } - else - { + } else { htmltext = htmltext.replaceAll("FontColor3", "FF6F6F"); htmltext = setHtml(htmltext, i3, "Cell3"); } - if ((i9 % 16) < 8) - { + if ((i9 % 16) < 8) { htmltext = htmltext.replaceAll("FontColor4", "FFFF00"); htmltext = htmltext.replaceAll("Cell4", "?"); - } - else - { + } else { htmltext = htmltext.replaceAll("FontColor4", "FF6F6F"); htmltext = setHtml(htmltext, i4, "Cell4"); } - if ((i9 % 32) < 16) - { + if ((i9 % 32) < 16) { htmltext = htmltext.replaceAll("FontColor5", "FFFF00"); htmltext = htmltext.replaceAll("Cell5", "?"); - } - else - { + } else { htmltext = htmltext.replaceAll("FontColor5", "FF6F6F"); htmltext = setHtml(htmltext, i5, "Cell5"); } } break; } - case "playagain": - { + case "playagain": { htmltext = st.getQuestItemsCount(RED_GEM) < REQUIRED_CHIP_COUNT ? "30845-21.html" : "30845-20.html"; break; } @@ -608,25 +464,18 @@ public final class Q00662_AGameOfCards extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = player.getLevel() < MIN_LEVEL ? "30845-02.html" : "30845-01.htm"; break; } - case State.STARTED: - { - if (st.isCond(1)) - { + case State.STARTED: { + if (st.isCond(1)) { htmltext = st.getQuestItemsCount(RED_GEM) < REQUIRED_CHIP_COUNT ? "30845-04.html" : "30845-05.html"; - } - else if (st.getInt("ExMemoState") != 0) - { + } else if (st.getInt("ExMemoState") != 0) { int i0 = st.getInt("v1"); int i1 = st.getInt("ExMemoState"); int i5 = i1 % 100; @@ -637,63 +486,47 @@ public final class Q00662_AGameOfCards extends Quest int i4 = (i0 % 100000000) / 1000000; htmltext = getHtm(player.getHtmlPrefix(), "30845-11a.html"); - if ((i9 % 2) < 1) - { + if ((i9 % 2) < 1) { htmltext = htmltext.replaceAll("FontColor1", "FFFF00"); htmltext = htmltext.replaceAll("Cell1", "?"); - } - else - { + } else { htmltext = htmltext.replaceAll("FontColor1", "FF6F6F"); htmltext = setHtml(htmltext, i1, "Cell1"); } - if ((i9 % 4) < 2) - { + if ((i9 % 4) < 2) { htmltext = htmltext.replaceAll("FontColor2", "FFFF00"); htmltext = htmltext.replaceAll("Cell2", "?"); - } - else - { + } else { htmltext = htmltext.replaceAll("FontColor2", "FF6F6F"); htmltext = setHtml(htmltext, i2, "Cell2"); } - if ((i9 % 8) < 4) - { + if ((i9 % 8) < 4) { htmltext = htmltext.replaceAll("FontColor3", "FFFF00"); htmltext = htmltext.replaceAll("Cell3", "?"); - } - else - { + } else { htmltext = htmltext.replaceAll("FontColor3", "FF6F6F"); htmltext = setHtml(htmltext, i3, "Cell3"); } - if ((i9 % 16) < 8) - { + if ((i9 % 16) < 8) { htmltext = htmltext.replaceAll("FontColor4", "FFFF00"); htmltext = htmltext.replaceAll("Cell4", "?"); - } - else - { + } else { htmltext = htmltext.replaceAll("FontColor4", "FF6F6F"); htmltext = setHtml(htmltext, i4, "Cell4"); } - if ((i9 % 32) < 16) - { + if ((i9 % 32) < 16) { htmltext = htmltext.replaceAll("FontColor5", "FFFF00"); htmltext = htmltext.replaceAll("Cell5", "?"); - } - else - { + } else { htmltext = htmltext.replaceAll("FontColor5", "FF6F6F"); htmltext = setHtml(htmltext, i5, "Cell5"); } } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } @@ -702,31 +535,24 @@ public final class Q00662_AGameOfCards extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final List<L2PcInstance> players = new ArrayList<>(); players.add(killer); players.add(killer); - if (killer.isInParty()) - { - for (L2PcInstance member : killer.getParty().getMembers()) - { - if (getQuestState(member, false) != null) - { + if (killer.isInParty()) { + for (L2PcInstance member : killer.getParty().getMembers()) { + if (getQuestState(member, false) != null) { players.add(member); } } } final L2PcInstance player = players.get(getRandom(players.size())); - if ((player != null) && Util.checkIfInRange(1500, npc, player, false)) - { - if (MONSTERS.get(npc.getId()) < getRandom(1000)) - { + if ((player != null) && Util.checkIfInRange(1500, npc, player, false)) { + if (MONSTERS.get(npc.getId()) < getRandom(1000)) { final QuestState st = getQuestState(player, false); - if (st != null) - { + if (st != null) { giveItemRandomly(st.getPlayer(), npc, RED_GEM, 1, 0, MONSTERS.get(npc.getId()), true); } } @@ -734,83 +560,66 @@ public final class Q00662_AGameOfCards extends Quest return super.onKill(npc, killer, isSummon); } - private static String setHtml(String htmltext, int var, String regex) - { + private static String setHtml(String htmltext, int var, String regex) { String replacement = null; - switch (var) - { - case 1: - { + switch (var) { + case 1: { replacement = "!"; break; } - case 2: - { + case 2: { replacement = "="; break; } - case 3: - { + case 3: { replacement = "T"; break; } - case 4: - { + case 4: { replacement = "V"; break; } - case 5: - { + case 5: { replacement = "O"; break; } - case 6: - { + case 6: { replacement = "P"; break; } - case 7: - { + case 7: { replacement = "S"; break; } - case 8: - { + case 8: { replacement = "E"; break; } - case 9: - { + case 9: { replacement = "H"; break; } - case 10: - { + case 10: { replacement = "A"; break; } - case 11: - { + case 11: { replacement = "R"; break; } - case 12: - { + case 12: { replacement = "D"; break; } - case 13: - { + case 13: { replacement = "I"; break; } - case 14: - { + case 14: { replacement = "N"; break; } - default: - { + default: { replacement = "ERROR"; break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00663_SeductiveWhispers/Q00663_SeductiveWhispers.java b/src/main/java/com/l2jserver/datapack/quests/Q00663_SeductiveWhispers/Q00663_SeductiveWhispers.java index 6cdc493d11..5701997dab 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00663_SeductiveWhispers/Q00663_SeductiveWhispers.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00663_SeductiveWhispers/Q00663_SeductiveWhispers.java @@ -37,8 +37,7 @@ import com.l2jserver.gameserver.util.Util; * @author Zoey76 * @since 2.6.0.0 */ -public class Q00663_SeductiveWhispers extends Quest -{ +public class Q00663_SeductiveWhispers extends Quest { // NPCs private static final int WILBERT = 30846; // Misc @@ -93,8 +92,7 @@ public class Q00663_SeductiveWhispers extends Quest private static final int SPITEFUL_SOUL_LEADER_CHANCE = 100; private static final Map<Integer, Integer> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(20674, 807); MONSTERS.put(20678, 372); MONSTERS.put(20954, 460); @@ -123,8 +121,7 @@ public class Q00663_SeductiveWhispers extends Quest MONSTERS.put(21010, 595); } - public Q00663_SeductiveWhispers() - { + public Q00663_SeductiveWhispers() { super(663, Q00663_SeductiveWhispers.class.getSimpleName(), "Seductive Whispers"); addStartNpc(WILBERT); addTalkId(WILBERT); @@ -133,75 +130,54 @@ public class Q00663_SeductiveWhispers extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (qs.getState()) - { - case State.CREATED: - { + switch (qs.getState()) { + case State.CREATED: { htmltext = player.getLevel() < MIN_LEVEL ? "30846-02.html" : "30846-01.htm"; break; } - case State.STARTED: - { - if ((qs.getMemoState() < 4) && (qs.getMemoState() >= 1)) - { - if (hasQuestItems(player, SPIRIT_BEAD)) - { + case State.STARTED: { + if ((qs.getMemoState() < 4) && (qs.getMemoState() >= 1)) { + if (hasQuestItems(player, SPIRIT_BEAD)) { htmltext = "30846-05.html"; - } - else - { + } else { htmltext = "30846-04.html"; } } - if ((qs.getMemoState() / 1000) == 0) - { - switch (qs.getMemoState() % 10) - { - case 4: - { + if ((qs.getMemoState() / 1000) == 0) { + switch (qs.getMemoState() % 10) { + case 4: { htmltext = "30846-05a.html"; break; } - case 5: - { + case 5: { htmltext = "30846-11.html"; break; } - case 6: - { + case 6: { htmltext = "30846-15.html"; break; } - case 7: - { - if (((qs.getMemoState() % 100) / 10) >= 7) - { + case 7: { + if (((qs.getMemoState() % 100) / 10) >= 7) { qs.setMemoState(1); giveAdena(player, 2384000, true); giveItems(player, SCROLL_ENCHANT_WEAPON_A_GRADE); giveItems(player, SCROLL_ENCHANT_ARMOR_A_GRADE); htmltext = "30846-17.html"; - } - else - { + } else { final int winCount = (qs.getMemoState() / 10) + 1; htmltext = getHtml(player, "30846-16.html", 0, 0, winCount, 0); } break; } } - } - else if (qs.isMemoState(1005)) - { + } else if (qs.isMemoState(1005)) { htmltext = "30846-23.html"; - } - else if (qs.isMemoState(1006)) - { + } else if (qs.isMemoState(1006)) { htmltext = "30846-26.html"; } break; @@ -211,29 +187,22 @@ public class Q00663_SeductiveWhispers extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { - case "30846-01a.htm": - { - if (player.getLevel() >= MIN_LEVEL) - { + switch (event) { + case "30846-01a.htm": { + if (player.getLevel() >= MIN_LEVEL) { htmltext = event; } break; } - case "30846-03.htm": - { - if (qs.isCreated() && (player.getLevel() >= MIN_LEVEL)) - { + case "30846-03.htm": { + if (qs.isCreated() && (player.getLevel() >= MIN_LEVEL)) { qs.startQuest(); qs.setMemoState(1); htmltext = event; @@ -242,32 +211,23 @@ public class Q00663_SeductiveWhispers extends Quest } case "30846-06.html": case "30846-07.html": - case "30846-08.html": - { + case "30846-08.html": { htmltext = event; break; } - case "30846-09.html": - { - if (qs.isStarted() && ((qs.getMemoState() % 10) <= 4)) - { + case "30846-09.html": { + if (qs.isStarted() && ((qs.getMemoState() % 10) <= 4)) { final int memoState = qs.getMemoState() / 10; - if (memoState < 1) - { - if (getQuestItemsCount(player, SPIRIT_BEAD) >= 50) - { + if (memoState < 1) { + if (getQuestItemsCount(player, SPIRIT_BEAD) >= 50) { takeItems(player, SPIRIT_BEAD, 50); qs.setMemoState(5); qs.setMemoStateEx(1, 0); htmltext = event; - } - else - { + } else { htmltext = "30846-10.html"; } - } - else - { + } else { qs.setMemoState((memoState * 10) + 5); qs.setMemoStateEx(1, 0); htmltext = "30846-09a.html"; @@ -275,10 +235,8 @@ public class Q00663_SeductiveWhispers extends Quest } break; } - case "30846-14.html": - { - if (qs.isStarted() && ((qs.getMemoState() % 10) == 5) && ((qs.getMemoState() / 1000) == 0)) - { + case "30846-14.html": { + if (qs.isStarted() && ((qs.getMemoState() % 10) == 5) && ((qs.getMemoState() / 1000) == 0)) { final int card1pic = Math.max(qs.getMemoStateEx(1), 0); final int i1 = card1pic % 10; final int i2 = (card1pic - i1) / 10; @@ -286,52 +244,37 @@ public class Q00663_SeductiveWhispers extends Quest final int rdn2 = getRandom(5) + 1; final int winCount = (qs.getMemoState() / 10) + 1; final int card2pic = (rdn1 * 10) + rdn2; - if (rdn1 == i2) - { + if (rdn1 == i2) { final int i3 = rdn2 + i1; - if (((i3 % 5) == 0) && (i3 != 10)) - { - if (((qs.getMemoState() % 100) / 10) >= 7) - { + if (((i3 % 5) == 0) && (i3 != 10)) { + if (((qs.getMemoState() % 100) / 10) >= 7) { giveAdena(player, 2384000, true); giveItems(player, SCROLL_ENCHANT_WEAPON_A_GRADE); giveItems(player, SCROLL_ENCHANT_ARMOR_A_GRADE); qs.setMemoState(4); htmltext = getHtml(player, "30846-14.html", card1pic, card2pic, winCount, -1); - } - else - { + } else { qs.setMemoState(((qs.getMemoState() / 10) * 10) + 7); htmltext = getHtml(player, "30846-13.html", card1pic, card2pic, winCount, -1); } - } - else - { + } else { qs.setMemoState(((qs.getMemoState() / 10) * 10) + 6); qs.setMemoStateEx(1, card2pic); htmltext = getHtml(player, "30846-12.html", card1pic, card2pic, winCount, -1); } - } - else if (rdn1 != i2) - { - if ((rdn2 == 5) || (i1 == 5)) - { - if (((qs.getMemoState() % 100) / 10) >= 7) - { + } else if (rdn1 != i2) { + if ((rdn2 == 5) || (i1 == 5)) { + if (((qs.getMemoState() % 100) / 10) >= 7) { giveAdena(player, 2384000, true); giveItems(player, SCROLL_ENCHANT_WEAPON_A_GRADE); giveItems(player, SCROLL_ENCHANT_ARMOR_A_GRADE); qs.setMemoState(4); htmltext = getHtml(player, "30846-14.html", card1pic, card2pic, winCount, -1); - } - else - { + } else { qs.setMemoState(((qs.getMemoState() / 10) * 10) + 7); htmltext = getHtml(player, "30846-13.html", card1pic, card2pic, winCount, -1); } - } - else - { + } else { qs.setMemoState(((qs.getMemoState() / 10) * 10) + 6); qs.setMemoStateEx(1, card2pic); htmltext = getHtml(player, "30846-12.html", card1pic, card2pic, winCount, -1); @@ -340,41 +283,30 @@ public class Q00663_SeductiveWhispers extends Quest } break; } - case "30846-19.html": - { - if (qs.isStarted() && ((qs.getMemoState() % 10) == 6) && ((qs.getMemoState() / 1000) == 0)) - { + case "30846-19.html": { + if (qs.isStarted() && ((qs.getMemoState() % 10) == 6) && ((qs.getMemoState() / 1000) == 0)) { final int card1pic = Math.max(qs.getMemoStateEx(1), 0); int i1 = card1pic % 10; int i2 = (card1pic - i1) / 10; int rnd1 = getRandom(2) + 1; int rnd2 = getRandom(5) + 1; int card2pic = (rnd1 * 10) + rnd2; - if (rnd1 == i2) - { + if (rnd1 == i2) { int i3 = rnd2 + i1; - if (((i3 % 5) == 0) && (i3 != 10)) - { + if (((i3 % 5) == 0) && (i3 != 10)) { qs.setMemoState(1); qs.setMemoStateEx(1, 0); htmltext = getHtml(player, "30846-19.html", card1pic, card2pic, -1, -1); - } - else - { + } else { qs.setMemoState(((qs.getMemoState() / 10) * 10) + 5); qs.setMemoStateEx(1, card2pic); htmltext = getHtml(player, "30846-18.html", card1pic, card2pic, -1, -1); } - } - else if (rnd1 != i2) - { - if ((rnd2 == 5) || (i1 == 5)) - { + } else if (rnd1 != i2) { + if ((rnd2 == 5) || (i1 == 5)) { qs.setMemoState(1); htmltext = getHtml(player, "30846-19.html", card1pic, card2pic, -1, -1); - } - else - { + } else { qs.setMemoState(((qs.getMemoState() / 10) * 10) + 5); qs.setMemoStateEx(1, card2pic); htmltext = getHtml(player, "30846-18.html", card1pic, card2pic, -1, -1); @@ -383,195 +315,108 @@ public class Q00663_SeductiveWhispers extends Quest } break; } - case "30846-20.html": - { - if (qs.isStarted() && ((qs.getMemoState() % 10) == 7) && ((qs.getMemoState() / 1000) == 0)) - { + case "30846-20.html": { + if (qs.isStarted() && ((qs.getMemoState() % 10) == 7) && ((qs.getMemoState() / 1000) == 0)) { qs.setMemoState((((qs.getMemoState() / 10) + 1) * 10) + 4); qs.setMemoStateEx(1, 0); htmltext = event; } break; } - case "30846-21.html": - { - if (qs.isStarted() && ((qs.getMemoState() % 10) == 7) && ((qs.getMemoState() / 1000) == 0)) - { + case "30846-21.html": { + if (qs.isStarted() && ((qs.getMemoState() % 10) == 7) && ((qs.getMemoState() / 1000) == 0)) { int i0 = qs.getMemoState() / 10; - if (i0 == 0) - { + if (i0 == 0) { giveAdena(player, 40000, true); - } - else if (i0 == 1) - { + } else if (i0 == 1) { giveAdena(player, 80000, true); - } - else if (i0 == 2) - { + } else if (i0 == 2) { giveAdena(player, 110000, true); giveItems(player, SCROLL_ENCHANT_WEAPON_D_GRADE, 1); - } - else if (i0 == 3) - { + } else if (i0 == 3) { giveAdena(player, 199000, true); giveItems(player, SCROLL_ENCHANT_WEAPON_C_GRADE, 1); - } - else if (i0 == 4) - { + } else if (i0 == 4) { giveAdena(player, 388000, true); final int rdn = getRandom(18) + 1; - if (rdn == 1) - { + if (rdn == 1) { giveItems(player, RECIPE_GREAT_SWORD_60); - } - else if (rdn == 2) - { + } else if (rdn == 2) { giveItems(player, RECIPE_HEAVY_WAR_AXE_60); - } - else if (rdn == 3) - { + } else if (rdn == 3) { giveItems(player, RECIPE_SPRITES_STAFF_60); - } - else if (rdn == 4) - { + } else if (rdn == 4) { giveItems(player, RECIPE_KESHANBERK_60); - } - else if (rdn == 5) - { + } else if (rdn == 5) { giveItems(player, RECIPE_SWORD_OF_VALHALLA_60); - } - else if (rdn == 6) - { + } else if (rdn == 6) { giveItems(player, RECIPE_KRIS_60); - } - else if (rdn == 7) - { + } else if (rdn == 7) { giveItems(player, RECIPE_HELL_KNIFE_60); - } - else if (rdn == 8) - { + } else if (rdn == 8) { giveItems(player, RECIPE_ARTHRO_NAIL_60); - } - else if (rdn == 9) - { + } else if (rdn == 9) { giveItems(player, RECIPE_DARK_ELVEN_LONG_BOW_60); - } - else if (rdn == 10) - { + } else if (rdn == 10) { giveItems(player, RECIPE_GREAT_AXE_60); - } - else if (rdn == 11) - { + } else if (rdn == 11) { giveItems(player, RECIPE_SWORD_OF_DAMASCUS_60); - } - else if (rdn == 12) - { + } else if (rdn == 12) { giveItems(player, RECIPE_LANCE_60); - } - else if (rdn == 13) - { + } else if (rdn == 13) { giveItems(player, RECIPE_DEADMANS_GLORY_60); - } - else if (rdn == 14) - { + } else if (rdn == 14) { giveItems(player, RECIPE_ART_OF_BATTLE_AXE_60); - } - else if (rdn == 15) - { + } else if (rdn == 15) { giveItems(player, RECIPE_TAFF_OF_EVIL_SPIRITS_60); - } - else if (rdn == 16) - { + } else if (rdn == 16) { giveItems(player, RECIPE_DEMONS_DAGGER_60); - } - else if (rdn == 17) - { + } else if (rdn == 17) { giveItems(player, RECIPE_BELLION_CESTUS_60); - } - else if (rdn == 18) - { + } else if (rdn == 18) { giveItems(player, RECIPE_BOW_OF_PERIL_60); } - } - else if (i0 == 5) - { + } else if (i0 == 5) { giveAdena(player, 675000, true); final int rnd = getRandom(18) + 1; - if (rnd == 1) - { + if (rnd == 1) { giveItems(player, GREAT_SWORD_BLADE); - } - else if (rnd == 2) - { + } else if (rnd == 2) { giveItems(player, GREAT_AXE_HEAD); - } - else if (rnd == 3) - { + } else if (rnd == 3) { giveItems(player, DARK_ELVEN_LONGBOW_SHAFT); - } - else if (rnd == 4) - { + } else if (rnd == 4) { giveItems(player, SWORD_OF_VALHALLA_BLADE); - } - else if (rnd == 5) - { + } else if (rnd == 5) { giveItems(player, ARTHRO_NAIL_BLADE); - } - else if (rnd == 6) - { + } else if (rnd == 6) { giveItems(player, SPRITES_STAFF_HEAD); - } - else if (rnd == 7) - { + } else if (rnd == 7) { giveItems(player, KRIS_EDGE); - } - else if (rnd == 8) - { + } else if (rnd == 8) { giveItems(player, KESHANBERK_BLADE); - } - else if (rnd == 9) - { + } else if (rnd == 9) { giveItems(player, HEAVY_WAR_AXE_HEAD); - } - else if (rnd == 10) - { + } else if (rnd == 10) { giveItems(player, HELL_KNIFE_EDGE); - } - else if (rnd == 11) - { + } else if (rnd == 11) { giveItems(player, SWORD_OF_DAMASCUS_BLADE); - } - else if (rnd == 12) - { + } else if (rnd == 12) { giveItems(player, LANCE_BLADE); - } - else if (rnd == 13) - { + } else if (rnd == 13) { giveItems(player, BELLION_CESTUS_EDGE); - } - else if (rnd == 14) - { + } else if (rnd == 14) { giveItems(player, EVIL_SPIRIT_HEAD); - } - else if (rnd == 15) - { + } else if (rnd == 15) { giveItems(player, DEADMANS_GLORY_STONE); - } - else if (rnd == 16) - { + } else if (rnd == 16) { giveItems(player, ART_OF_BATTLE_AXE_BLADE); - } - else if (rnd == 17) - { + } else if (rnd == 17) { giveItems(player, DEMONS_DAGGER_EDGE); - } - else if (rnd == 18) - { + } else if (rnd == 18) { giveItems(player, BOW_OF_PERIL_SHAFT); } - } - else if (i0 == 6) - { + } else if (i0 == 6) { giveAdena(player, 1284000, true); giveItems(player, SCROLL_ENCHANT_WEAPON_B_GRADE); giveItems(player, SCROLL_ENCHANT_ARMOR_B_GRADE); @@ -582,38 +427,28 @@ public class Q00663_SeductiveWhispers extends Quest } break; } - case "30846-21a.html": - { - if (qs.isStarted() && qs.isMemoState(1)) - { + case "30846-21a.html": { + if (qs.isStarted() && qs.isMemoState(1)) { htmltext = event; } break; } - case "30846-22.html": - { - if (qs.isStarted() && ((qs.getMemoState() % 10) == 1)) - { - if (getQuestItemsCount(player, SPIRIT_BEAD) >= 1) - { + case "30846-22.html": { + if (qs.isStarted() && ((qs.getMemoState() % 10) == 1)) { + if (getQuestItemsCount(player, SPIRIT_BEAD) >= 1) { takeItems(player, SPIRIT_BEAD, 1); qs.setMemoState(1005); htmltext = event; - } - else - { + } else { htmltext = "30846-22a.html"; } } break; } - case "30846-25.html": - { - if (qs.isStarted() && qs.isMemoState(1005)) - { + case "30846-25.html": { + if (qs.isStarted() && qs.isMemoState(1005)) { int card1pic = qs.getMemoStateEx(1); - if (card1pic < 0) - { + if (card1pic < 0) { card1pic = 0; } int card1 = card1pic % 10; @@ -621,34 +456,25 @@ public class Q00663_SeductiveWhispers extends Quest int rnd1 = getRandom(2) + 1; int rnd2 = getRandom(5) + 1; int card2pic = (rnd1 * 10) + rnd2; - if (rnd1 == i2) - { + if (rnd1 == i2) { int i3 = rnd2 + card1; - if (((i3 % 5) == 0) && (i3 != 10)) - { + if (((i3 % 5) == 0) && (i3 != 10)) { qs.setMemoState(1); qs.setMemoStateEx(1, 0); giveAdena(player, 800, true); htmltext = getHtml(player, "30846-25.html", card1pic, card2pic, -1, card1); - } - else - { + } else { qs.setMemoState(1006); qs.setMemoStateEx(1, card2pic); htmltext = getHtml(player, "30846-24.html", card1pic, card2pic, -1, -1); } - } - else if (rnd1 != i2) - { - if ((rnd2 == 5) || (card1 == 5)) - { + } else if (rnd1 != i2) { + if ((rnd2 == 5) || (card1 == 5)) { qs.setMemoState(1); qs.setMemoStateEx(1, 0); giveAdena(player, 800, true); htmltext = getHtml(player, "30846-25.html", card1pic, card2pic, -1, -1); - } - else - { + } else { qs.setMemoState(1006); qs.setMemoStateEx(1, card2pic); htmltext = getHtml(player, "30846-24.html", card1pic, card2pic, -1, -1); @@ -657,42 +483,31 @@ public class Q00663_SeductiveWhispers extends Quest } break; } - case "30846-29.html": - { - if (qs.isStarted() && qs.isMemoState(1006)) - { + case "30846-29.html": { + if (qs.isStarted() && qs.isMemoState(1006)) { final int card1pic = Math.max(qs.getMemoStateEx(1), 0); int i1 = card1pic % 10; int i2 = (card1pic - i1) / 10; int rnd1 = getRandom(2) + 1; int rnd2 = getRandom(5) + 1; int card2pic = (rnd1 * 10) + rnd2; - if (rnd1 == i2) - { + if (rnd1 == i2) { final int i3 = rnd2 + i1; - if (((i3 % 5) == 0) && (i3 != 10)) - { + if (((i3 % 5) == 0) && (i3 != 10)) { qs.setMemoState(1); qs.setMemoStateEx(1, 0); htmltext = getHtml(player, "30846-29.html", card1pic, card2pic, 0, -1); - } - else - { + } else { qs.setMemoState(1005); qs.setMemoStateEx(1, card2pic); htmltext = getHtml(player, "30846-28.html", card1pic, card2pic, 0, -1); } - } - else if (rnd1 != i2) - { - if ((rnd2 == 5) || (i1 == 5)) - { + } else if (rnd1 != i2) { + if ((rnd2 == 5) || (i1 == 5)) { qs.setMemoState(1); qs.setMemoStateEx(1, 0); htmltext = getHtml(player, "30846-29.html", card1pic, card2pic, 0, -1); - } - else - { + } else { qs.setMemoState(1005); qs.setMemoStateEx(1, card2pic); htmltext = getHtml(player, "30846-28.html", card1pic, card2pic, 0, -1); @@ -701,20 +516,16 @@ public class Q00663_SeductiveWhispers extends Quest } break; } - case "30846-30.html": - { - if (qs.isStarted()) - { + case "30846-30.html": { + if (qs.isStarted()) { qs.exitQuest(true); htmltext = event; } break; } case "30846-31.html": - case "30846-32.html": - { - if (qs.isStarted()) - { + case "30846-32.html": { + if (qs.isStarted()) { htmltext = event; } break; @@ -724,48 +535,35 @@ public class Q00663_SeductiveWhispers extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final List<L2PcInstance> players = new LinkedList<>(); final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isStarted() && (qs.getMemoState() >= 1) && (qs.getMemoState() <= 4)) - { + if ((qs != null) && qs.isStarted() && (qs.getMemoState() >= 1) && (qs.getMemoState() <= 4)) { players.add(killer); players.add(killer); } - if (killer.isInParty()) - { - for (L2PcInstance partyMember : killer.getParty().getMembers()) - { + if (killer.isInParty()) { + for (L2PcInstance partyMember : killer.getParty().getMembers()) { final QuestState partyMemberQuestState = getQuestState(partyMember, false); - if ((partyMemberQuestState != null) && partyMemberQuestState.isStarted() && (partyMemberQuestState.getMemoState() >= 1) && (partyMemberQuestState.getMemoState() <= 4)) - { + if ((partyMemberQuestState != null) && partyMemberQuestState.isStarted() && (partyMemberQuestState.getMemoState() >= 1) && (partyMemberQuestState.getMemoState() <= 4)) { players.add(partyMember); } } } - if (!players.isEmpty()) - { + if (!players.isEmpty()) { final L2PcInstance rewardedPlayer = players.get(getRandom(players.size())); - if (Util.checkIfInRange(1500, npc, rewardedPlayer, false)) - { + if (Util.checkIfInRange(1500, npc, rewardedPlayer, false)) { final int rnd = getRandom(1000); - if (npc.getId() == SPITEFUL_SOUL_LEADER) - { - if (rnd <= SPITEFUL_SOUL_LEADER_CHANCE) - { + if (npc.getId() == SPITEFUL_SOUL_LEADER) { + if (rnd <= SPITEFUL_SOUL_LEADER_CHANCE) { giveItems(rewardedPlayer, SPIRIT_BEAD, 2); - } - else - { + } else { giveItems(rewardedPlayer, SPIRIT_BEAD, 1); } - } - else if (rnd < MONSTERS.get(npc.getId())) - { + } else if (rnd < MONSTERS.get(npc.getId())) { giveItems(rewardedPlayer, SPIRIT_BEAD, 1); playSound(rewardedPlayer, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -774,18 +572,15 @@ public class Q00663_SeductiveWhispers extends Quest return super.onKill(npc, killer, isSummon); } - private String getHtml(L2PcInstance player, String htmlName, int card1pic, int card2pic, int winCount, int card1) - { + private String getHtml(L2PcInstance player, String htmlName, int card1pic, int card2pic, int winCount, int card1) { String html = getHtm(player.getHtmlPrefix(), htmlName); html = html.replace("<?card1pic?>", Integer.toString(card1pic)); html = html.replace("<?card2pic?>", Integer.toString(card2pic)); html = html.replace("<?name?>", player.getName()); - if (winCount >= 0) - { + if (winCount >= 0) { html = html.replace("<?wincount?>", Integer.toString(winCount)); } - if (card1 >= 0) - { + if (card1 >= 0) { html = html.replace("<?card1?>", Integer.toString(card1)); } return html; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00688_DefeatTheElrokianRaiders/Q00688_DefeatTheElrokianRaiders.java b/src/main/java/com/l2jserver/datapack/quests/Q00688_DefeatTheElrokianRaiders/Q00688_DefeatTheElrokianRaiders.java index e1ce369ad9..23ba068ee2 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00688_DefeatTheElrokianRaiders/Q00688_DefeatTheElrokianRaiders.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00688_DefeatTheElrokianRaiders/Q00688_DefeatTheElrokianRaiders.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.model.quest.State; * Defeat the Elrokian Raiders! (688) * @author Adry_85 */ -public class Q00688_DefeatTheElrokianRaiders extends Quest -{ +public class Q00688_DefeatTheElrokianRaiders extends Quest { // NPCs private static final int ELROKI = 22214; private static final int DINN = 32105; @@ -42,8 +41,7 @@ public class Q00688_DefeatTheElrokianRaiders extends Quest private static final int MIN_LEVEL = 75; private static final int DROP_RATE = 448; - public Q00688_DefeatTheElrokianRaiders() - { + public Q00688_DefeatTheElrokianRaiders() { super(688, Q00688_DefeatTheElrokianRaiders.class.getSimpleName(), "Defeat the Elrokian Raiders!"); addStartNpc(DINN); addTalkId(DINN); @@ -52,54 +50,40 @@ public class Q00688_DefeatTheElrokianRaiders extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "32105-02.htm": - case "32105-10.html": - { + case "32105-10.html": { htmltext = event; break; } - case "32105-03.html": - { + case "32105-03.html": { st.startQuest(); htmltext = event; break; } - case "32105-06.html": - { - if (st.hasQuestItems(DINOSAUR_FANG_NECKLACE)) - { + case "32105-06.html": { + if (st.hasQuestItems(DINOSAUR_FANG_NECKLACE)) { st.giveAdena(3000 * st.getQuestItemsCount(DINOSAUR_FANG_NECKLACE), true); st.takeItems(DINOSAUR_FANG_NECKLACE, -1); htmltext = event; } break; } - case "donation": - { - if (st.getQuestItemsCount(DINOSAUR_FANG_NECKLACE) < 100) - { + case "donation": { + if (st.getQuestItemsCount(DINOSAUR_FANG_NECKLACE) < 100) { htmltext = "32105-07.html"; - } - else - { - if (getRandom(1000) < 500) - { + } else { + if (getRandom(1000) < 500) { st.giveAdena(450000, true); htmltext = "32105-08.html"; - } - else - { + } else { st.giveAdena(150000, true); htmltext = "32105-09.html"; } @@ -107,10 +91,8 @@ public class Q00688_DefeatTheElrokianRaiders extends Quest } break; } - case "32105-11.html": - { - if (st.hasQuestItems(DINOSAUR_FANG_NECKLACE)) - { + case "32105-11.html": { + if (st.hasQuestItems(DINOSAUR_FANG_NECKLACE)) { st.giveAdena(3000 * st.getQuestItemsCount(DINOSAUR_FANG_NECKLACE), true); } st.exitQuest(true, true); @@ -122,19 +104,16 @@ public class Q00688_DefeatTheElrokianRaiders extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(player, 1); - if (partyMember == null) - { + if (partyMember == null) { return super.onKill(npc, player, isSummon); } final QuestState st = getQuestState(partyMember, false); double chance = (DROP_RATE * rates().getRateQuestDrop()); - if (getRandom(1000) < chance) - { + if (getRandom(1000) < chance) { st.rewardItems(DINOSAUR_FANG_NECKLACE, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -142,19 +121,15 @@ public class Q00688_DefeatTheElrokianRaiders extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getLevel() >= MIN_LEVEL) ? "32105-01.htm" : "32105-04.html"; break; } - case State.STARTED: - { + case State.STARTED: { htmltext = (st.hasQuestItems(DINOSAUR_FANG_NECKLACE)) ? "32105-05.html" : "32105-12.html"; break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00690_JudesRequest/Q00690_JudesRequest.java b/src/main/java/com/l2jserver/datapack/quests/Q00690_JudesRequest/Q00690_JudesRequest.java index d8bbe779ac..1fb949d68e 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00690_JudesRequest/Q00690_JudesRequest.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00690_JudesRequest/Q00690_JudesRequest.java @@ -31,16 +31,14 @@ import com.l2jserver.gameserver.model.quest.State; * Jude's Request (690) * @author malyelfik */ -public class Q00690_JudesRequest extends Quest -{ +public class Q00690_JudesRequest extends Quest { // NPCs private static final int JUDE = 32356; private static final int LESSER_EVIL = 22398; private static final int GREATER_EVIL = 22399; // Items private static final int EVIL_WEAPON = 10327; - private static final int[][] REWARDS = - { + private static final int[][] REWARDS = { { 10373, 10374, @@ -65,8 +63,7 @@ public class Q00690_JudesRequest extends Quest } }; - public Q00690_JudesRequest() - { + public Q00690_JudesRequest() { super(690, Q00690_JudesRequest.class.getSimpleName(), "Jude's Request"); addStartNpc(JUDE); addTalkId(JUDE); @@ -74,50 +71,35 @@ public class Q00690_JudesRequest extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - if (event.equalsIgnoreCase("32356-03.htm")) - { + if (event.equalsIgnoreCase("32356-03.htm")) { st.startQuest(); - } - else if (event.equalsIgnoreCase("32356-07.htm")) - { - if (st.getQuestItemsCount(EVIL_WEAPON) >= 200) - { + } else if (event.equalsIgnoreCase("32356-07.htm")) { + if (st.getQuestItemsCount(EVIL_WEAPON) >= 200) { st.giveItems(REWARDS[0][getRandom(REWARDS[0].length)], 1); st.takeItems(EVIL_WEAPON, 200); st.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); htmltext = "32356-07.htm"; - } - else - { + } else { htmltext = "32356-07a.htm"; } - } - else if (event.equalsIgnoreCase("32356-08.htm")) - { + } else if (event.equalsIgnoreCase("32356-08.htm")) { st.takeItems(EVIL_WEAPON, -1); st.exitQuest(true, true); - } - else if (event.equalsIgnoreCase("32356-09.htm")) - { - if (st.getQuestItemsCount(EVIL_WEAPON) >= 5) - { + } else if (event.equalsIgnoreCase("32356-09.htm")) { + if (st.getQuestItemsCount(EVIL_WEAPON) >= 5) { st.giveItems(REWARDS[1][getRandom(REWARDS[1].length)], 1); st.takeItems(EVIL_WEAPON, 5); st.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); htmltext = "32356-09.htm"; - } - else - { + } else { htmltext = "32356-09a.htm"; } } @@ -125,23 +107,18 @@ public class Q00690_JudesRequest extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { L2PcInstance partyMember = getRandomPartyMember(player, 1); - if (partyMember == null) - { + if (partyMember == null) { return null; } final QuestState st = getQuestState(partyMember, false); final int npcId = npc.getId(); int chance = 0; - if (npcId == LESSER_EVIL) - { + if (npcId == LESSER_EVIL) { chance = 173; - } - else if (npcId == GREATER_EVIL) - { + } else if (npcId == GREATER_EVIL) { chance = 246; } // Apply the quest drop rate: @@ -149,8 +126,7 @@ public class Q00690_JudesRequest extends Quest // Normalize chance %= 1000; - if (getRandom(1000) <= chance) - { + if (getRandom(1000) <= chance) { st.giveItems(EVIL_WEAPON, Math.max(chance / 1000, 1)); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -158,33 +134,23 @@ public class Q00690_JudesRequest extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: - if (player.getLevel() >= 78) - { + if (player.getLevel() >= 78) { htmltext = "32356-01.htm"; - } - else - { + } else { htmltext = "32356-02.htm"; } break; case State.STARTED: - if (st.getQuestItemsCount(EVIL_WEAPON) >= 200) - { + if (st.getQuestItemsCount(EVIL_WEAPON) >= 200) { htmltext = "32356-04.htm"; - } - else if (st.getQuestItemsCount(EVIL_WEAPON) < 5) - { + } else if (st.getQuestItemsCount(EVIL_WEAPON) < 5) { htmltext = "32356-05a.htm"; - } - else - { + } else { htmltext = "32356-05.htm"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00691_MatrasSuspiciousRequest/Q00691_MatrasSuspiciousRequest.java b/src/main/java/com/l2jserver/datapack/quests/Q00691_MatrasSuspiciousRequest/Q00691_MatrasSuspiciousRequest.java index d3e218cb67..15321eb1b8 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00691_MatrasSuspiciousRequest/Q00691_MatrasSuspiciousRequest.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00691_MatrasSuspiciousRequest/Q00691_MatrasSuspiciousRequest.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.model.quest.State; * Matras' Suspicious Request (691) * @author GKR */ -public final class Q00691_MatrasSuspiciousRequest extends Quest -{ +public final class Q00691_MatrasSuspiciousRequest extends Quest { // NPC private static final int MATRAS = 32245; // Items @@ -43,8 +42,7 @@ public final class Q00691_MatrasSuspiciousRequest extends Quest private static final int DYNASTY_SOUL_II = 10413; // Reward private static final Map<Integer, Integer> REWARD_CHANCES = new HashMap<>(); - static - { + static { REWARD_CHANCES.put(22363, 890); REWARD_CHANCES.put(22364, 261); REWARD_CHANCES.put(22365, 560); @@ -59,8 +57,7 @@ public final class Q00691_MatrasSuspiciousRequest extends Quest // Misc private static final int MIN_LEVEL = 76; - public Q00691_MatrasSuspiciousRequest() - { + public Q00691_MatrasSuspiciousRequest() { super(691, Q00691_MatrasSuspiciousRequest.class.getSimpleName(), "Matras' Suspicious Request"); addStartNpc(MATRAS); addTalkId(MATRAS); @@ -68,17 +65,14 @@ public final class Q00691_MatrasSuspiciousRequest extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "32245-02.htm": case "32245-11.html": htmltext = event; @@ -88,24 +82,19 @@ public final class Q00691_MatrasSuspiciousRequest extends Quest htmltext = event; break; case "take_reward": - if (st.isStarted()) - { + if (st.isStarted()) { final int gemsCount = st.getInt("submitted_gems"); - if (gemsCount >= 744) - { + if (gemsCount >= 744) { st.set("submitted_gems", Integer.toString(gemsCount - 744)); st.giveItems(DYNASTY_SOUL_II, 1); htmltext = "32245-09.html"; - } - else - { + } else { htmltext = getHtm(player.getHtmlPrefix(), "32245-10.html").replace("%itemcount%", st.get("submitted_gems")); } } break; case "32245-08.html": - if (st.isStarted()) - { + if (st.isStarted()) { final int submittedCount = st.getInt("submitted_gems"); final int broughtCount = (int) st.getQuestItemsCount(RED_GEM); final int finalCount = submittedCount + broughtCount; @@ -115,8 +104,7 @@ public final class Q00691_MatrasSuspiciousRequest extends Quest } break; case "32245-12.html": - if (st.isStarted()) - { + if (st.isStarted()) { st.giveAdena((st.getInt("submitted_gems") * 10000), true); st.exitQuest(true, true); htmltext = event; @@ -127,11 +115,9 @@ public final class Q00691_MatrasSuspiciousRequest extends Quest } @Override - public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance pl = getRandomPartyMember(player, 1); - if (pl == null) - { + if (pl == null) { return super.onKill(npc, player, isSummon); } @@ -139,8 +125,7 @@ public final class Q00691_MatrasSuspiciousRequest extends Quest int chance = (int) (rates().getRateQuestDrop() * REWARD_CHANCES.get(npc.getId())); int numItems = Math.max((chance / 1000), 1); chance = chance % 1000; - if (getRandom(1000) <= chance) - { + if (getRandom(1000) <= chance) { st.giveItems(RED_GEM, numItems); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -148,26 +133,19 @@ public final class Q00691_MatrasSuspiciousRequest extends Quest } @Override - public final String onTalk(L2Npc npc, L2PcInstance player) - { + public final String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? "32245-01.htm" : "32245-03.html"; break; case State.STARTED: - if (st.hasQuestItems(RED_GEM)) - { + if (st.hasQuestItems(RED_GEM)) { htmltext = "32245-05.html"; - } - else if (st.getInt("submitted_gems") > 0) - { + } else if (st.getInt("submitted_gems") > 0) { htmltext = getHtm(player.getHtmlPrefix(), "32245-07.html").replace("%itemcount%", st.get("submitted_gems")); - } - else - { + } else { htmltext = "32245-06.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00692_HowtoOpposeEvil/Q00692_HowtoOpposeEvil.java b/src/main/java/com/l2jserver/datapack/quests/Q00692_HowtoOpposeEvil/Q00692_HowtoOpposeEvil.java index 8003a58442..355f5841c6 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00692_HowtoOpposeEvil/Q00692_HowtoOpposeEvil.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00692_HowtoOpposeEvil/Q00692_HowtoOpposeEvil.java @@ -34,13 +34,11 @@ import com.l2jserver.gameserver.model.quest.QuestState; * How to Oppose Evil (692) * @author Gigiikun */ -public final class Q00692_HowtoOpposeEvil extends Quest -{ +public final class Q00692_HowtoOpposeEvil extends Quest { private static final int DILIOS = 32549; private static final int KIRKLAN = 32550; private static final int LEKONS_CERTIFICATE = 13857; - private static final int[] QUEST_ITEMS = - { + private static final int[] QUEST_ITEMS = { 13863, 13864, 13865, @@ -51,8 +49,7 @@ public final class Q00692_HowtoOpposeEvil extends Quest }; private static final Map<Integer, ItemHolder> QUEST_MOBS = new HashMap<>(); - static - { + static { // Seed of Infinity QUEST_MOBS.put(22509, new ItemHolder(13863, 500)); QUEST_MOBS.put(22510, new ItemHolder(13863, 500)); @@ -103,8 +100,7 @@ public final class Q00692_HowtoOpposeEvil extends Quest QUEST_MOBS.put(22765, new ItemHolder(15536, 125)); } - public Q00692_HowtoOpposeEvil() - { + public Q00692_HowtoOpposeEvil() { super(692, Q00692_HowtoOpposeEvil.class.getSimpleName(), "How to Oppose Evil"); addStartNpc(DILIOS); addTalkId(DILIOS, KIRKLAN); @@ -112,60 +108,37 @@ public final class Q00692_HowtoOpposeEvil extends Quest } @Override - public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - if (event.equalsIgnoreCase("32549-03.htm")) - { + if (event.equalsIgnoreCase("32549-03.htm")) { st.startQuest(); - } - else if (event.equalsIgnoreCase("32550-04.htm")) - { + } else if (event.equalsIgnoreCase("32550-04.htm")) { st.setCond(3); - } - else if (event.equalsIgnoreCase("32550-07.htm")) - { - if (!giveReward(st, 13863, 5, 13796, 1)) - { + } else if (event.equalsIgnoreCase("32550-07.htm")) { + if (!giveReward(st, 13863, 5, 13796, 1)) { return "32550-08.htm"; } - } - else if (event.equalsIgnoreCase("32550-09.htm")) - { - if (!giveReward(st, 13798, 1, 57, 5000)) - { + } else if (event.equalsIgnoreCase("32550-09.htm")) { + if (!giveReward(st, 13798, 1, 57, 5000)) { return "32550-10.htm"; } - } - else if (event.equalsIgnoreCase("32550-12.htm")) - { - if (!giveReward(st, 13865, 5, 13841, 1)) - { + } else if (event.equalsIgnoreCase("32550-12.htm")) { + if (!giveReward(st, 13865, 5, 13841, 1)) { return "32550-13.htm"; } - } - else if (event.equalsIgnoreCase("32550-14.htm")) - { - if (!giveReward(st, 13867, 1, 57, 5000)) - { + } else if (event.equalsIgnoreCase("32550-14.htm")) { + if (!giveReward(st, 13867, 1, 57, 5000)) { return "32550-15.htm"; } - } - else if (event.equalsIgnoreCase("32550-17.htm")) - { - if (!giveReward(st, 15536, 5, 15486, 1)) - { + } else if (event.equalsIgnoreCase("32550-17.htm")) { + if (!giveReward(st, 15536, 5, 15486, 1)) { return "32550-18.htm"; } - } - else if (event.equalsIgnoreCase("32550-19.htm")) - { - if (!giveReward(st, 15535, 1, 57, 5000)) - { + } else if (event.equalsIgnoreCase("32550-19.htm")) { + if (!giveReward(st, 15535, 1, 57, 5000)) { return "32550-20.htm"; } } @@ -173,26 +146,21 @@ public final class Q00692_HowtoOpposeEvil extends Quest } @Override - public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(player, 3); - if (partyMember == null) - { + if (partyMember == null) { return null; } final QuestState st = getQuestState(partyMember, false); final int npcId = npc.getId(); - if ((st != null) && QUEST_MOBS.containsKey(npcId)) - { + if ((st != null) && QUEST_MOBS.containsKey(npcId)) { int chance = (int) (QUEST_MOBS.get(npcId).getCount() * rates().getRateQuestDrop()); int numItems = chance / 1000; chance = chance % 1000; - if (getRandom(1000) < chance) - { + if (getRandom(1000) < chance) { numItems++; } - if (numItems > 0) - { + if (numItems > 0) { st.giveItems(QUEST_MOBS.get(npcId).getId(), numItems); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -201,41 +169,26 @@ public final class Q00692_HowtoOpposeEvil extends Quest } @Override - public final String onTalk(L2Npc npc, L2PcInstance player) - { + public final String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - if (st.isCreated()) - { + if (st.isCreated()) { htmltext = (player.getLevel() >= 75) ? "32549-01.htm" : "32549-00.htm"; - } - else - { - if (npc.getId() == DILIOS) - { - if (st.isCond(1) && st.hasQuestItems(LEKONS_CERTIFICATE)) - { + } else { + if (npc.getId() == DILIOS) { + if (st.isCond(1) && st.hasQuestItems(LEKONS_CERTIFICATE)) { htmltext = "32549-04.htm"; st.takeItems(LEKONS_CERTIFICATE, -1); st.setCond(2); - } - else if (st.isCond(2)) - { + } else if (st.isCond(2)) { htmltext = "32549-05.htm"; } - } - else - { - if (st.isCond(2)) - { + } else { + if (st.isCond(2)) { htmltext = "32550-01.htm"; - } - else if (st.isCond(3)) - { - for (int i : QUEST_ITEMS) - { - if (st.getQuestItemsCount(i) > 0) - { + } else if (st.isCond(3)) { + for (int i : QUEST_ITEMS) { + if (st.getQuestItemsCount(i) > 0) { return "32550-05.htm"; } } @@ -246,11 +199,9 @@ public final class Q00692_HowtoOpposeEvil extends Quest return htmltext; } - private static final boolean giveReward(QuestState st, int itemId, int minCount, int rewardItemId, long rewardCount) - { + private static final boolean giveReward(QuestState st, int itemId, int minCount, int rewardItemId, long rewardCount) { long count = st.getQuestItemsCount(itemId); - if (count < minCount) - { + if (count < minCount) { return false; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00695_DefendTheHallOfSuffering/Q00695_DefendTheHallOfSuffering.java b/src/main/java/com/l2jserver/datapack/quests/Q00695_DefendTheHallOfSuffering/Q00695_DefendTheHallOfSuffering.java index 989071d57d..54fa5ccd1b 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00695_DefendTheHallOfSuffering/Q00695_DefendTheHallOfSuffering.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00695_DefendTheHallOfSuffering/Q00695_DefendTheHallOfSuffering.java @@ -29,42 +29,34 @@ import com.l2jserver.gameserver.model.quest.QuestState; * @author Adry_85 * @since 2.6.0.0 */ -public class Q00695_DefendTheHallOfSuffering extends Quest -{ +public class Q00695_DefendTheHallOfSuffering extends Quest { // NPC private static final int TEPIOS = 32603; // Misc private static final int MIN_LEVEL = 75; private static final int MAX_LEVEL = 82; - public Q00695_DefendTheHallOfSuffering() - { + public Q00695_DefendTheHallOfSuffering() { super(695, Q00695_DefendTheHallOfSuffering.class.getSimpleName(), "Defend the Hall of Suffering"); addStartNpc(TEPIOS); addTalkId(TEPIOS); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "32603-02.html": - { + switch (event) { + case "32603-02.html": { htmltext = event; break; } - case "32603-03.htm": - { - if (player.getLevel() >= MIN_LEVEL) - { + case "32603-03.htm": { + if (player.getLevel() >= MIN_LEVEL) { st.startQuest(false); st.setMemoState(2); st.playSound(Sound.ITEMSOUND_QUEST_MIDDLE); @@ -77,29 +69,20 @@ public class Q00695_DefendTheHallOfSuffering extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCreated()) - { + if (st.isCreated()) { final int playerLevel = player.getLevel(); - if ((playerLevel >= MIN_LEVEL) && (playerLevel <= MAX_LEVEL)) - { + if ((playerLevel >= MIN_LEVEL) && (playerLevel <= MAX_LEVEL)) { // TODO (Adry_85): This quest can only be carried out during the Seed of Infinity 4th period or Seed of Infinity 5th period. htmltext = "32603-01.htm"; - } - else if (playerLevel < MIN_LEVEL) - { + } else if (playerLevel < MIN_LEVEL) { htmltext = "32603-04.htm"; - } - else - { + } else { htmltext = "32603-05.html"; } - } - else if (st.isStarted() && (st.isMemoState(2))) - { + } else if (st.isStarted() && (st.isMemoState(2))) { htmltext = "32603-06.htm"; } return htmltext; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00699_GuardianOfTheSkies/Q00699_GuardianOfTheSkies.java b/src/main/java/com/l2jserver/datapack/quests/Q00699_GuardianOfTheSkies/Q00699_GuardianOfTheSkies.java index a0e6f490bb..7f316062c1 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00699_GuardianOfTheSkies/Q00699_GuardianOfTheSkies.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00699_GuardianOfTheSkies/Q00699_GuardianOfTheSkies.java @@ -33,15 +33,13 @@ import com.l2jserver.gameserver.model.quest.State; * Guardian of the Skies * @author xban1x */ -public class Q00699_GuardianOfTheSkies extends Quest -{ +public class Q00699_GuardianOfTheSkies extends Quest { // NPC private static final int LEKON = 32557; // Monsters private static final int VALDSTONE = 25623; private static final Map<Integer, Integer> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(22614, 840); // Vulture Rider lvl 1 MONSTERS.put(22615, 857); // Vulture Rider lvl 2 MONSTERS.put(25633, 719); // Vulture Rider lvl 3 @@ -54,8 +52,7 @@ public class Q00699_GuardianOfTheSkies extends Quest private static final int BONUS = 8335; private static final int BONUS_COUNT = 10; - public Q00699_GuardianOfTheSkies() - { + public Q00699_GuardianOfTheSkies() { super(699, Q00699_GuardianOfTheSkies.class.getSimpleName(), "Guardian of the Skies"); addStartNpc(LEKON); addTalkId(LEKON); @@ -65,28 +62,22 @@ public class Q00699_GuardianOfTheSkies extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st != null) - { - switch (event) - { + if (st != null) { + switch (event) { case "32557-03.htm": - case "32557-08.html": - { + case "32557-08.html": { htmltext = event; break; } - case "32557-04.htm": - { + case "32557-04.htm": { st.startQuest(); htmltext = event; break; } - case "32557-09.html": - { + case "32557-09.html": { st.exitQuest(true, true); htmltext = event; break; @@ -97,37 +88,24 @@ public class Q00699_GuardianOfTheSkies extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if (st != null) - { - if (npc.getId() == VALDSTONE) - { + if (st != null) { + if (npc.getId() == VALDSTONE) { int amount = 0, chance = getRandom(1000); - if (chance < 215) - { + if (chance < 215) { amount = getRandom(10) + 90; - } - else if (chance < 446) - { + } else if (chance < 446) { amount = getRandom(10) + 80; - } - else if (chance < 715) - { + } else if (chance < 715) { amount = getRandom(10) + 70; - } - else - { + } else { amount = getRandom(10) + 60; } st.giveItems(VULTURES_GOLDEN_FEATHER, amount); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - } - else - { - if (getRandom(1000) < MONSTERS.get(npc.getId())) - { + } else { + if (getRandom(1000) < MONSTERS.get(npc.getId())) { st.giveItems(VULTURES_GOLDEN_FEATHER, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -137,29 +115,22 @@ public class Q00699_GuardianOfTheSkies extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { st = player.getQuestState(Q10273_GoodDayToFly.class.getSimpleName()); htmltext = ((st == null) || (!st.isCompleted()) || (player.getLevel() < MIN_LVL)) ? "32557-02.htm" : "32557-01.htm"; break; } - case State.STARTED: - { + case State.STARTED: { final long feathers = st.getQuestItemsCount(VULTURES_GOLDEN_FEATHER); - if (feathers > 0) - { + if (feathers > 0) { st.giveAdena(((feathers * VULTURES_GOLDEN_FEATHER_ADENA) + (feathers > BONUS_COUNT ? BONUS : 0)), true); st.takeItems(VULTURES_GOLDEN_FEATHER, -1); htmltext = (feathers > BONUS_COUNT) ? "32557-07.html" : "32557-06.html"; - } - else - { + } else { htmltext = "32557-05.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00700_CursedLife/Q00700_CursedLife.java b/src/main/java/com/l2jserver/datapack/quests/Q00700_CursedLife/Q00700_CursedLife.java index fd7aab20d0..96dbb739cf 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00700_CursedLife/Q00700_CursedLife.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00700_CursedLife/Q00700_CursedLife.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.model.quest.State; * Cursed Life (700) * @author xban1x */ -public class Q00700_CursedLife extends Quest -{ +public class Q00700_CursedLife extends Quest { // NPC private static final int ORBYU = 32560; // Monsters @@ -62,8 +61,7 @@ public class Q00700_CursedLife extends Quest private static final int SWALLOWED_SKULL_ADENA = 50000; private static final int BONUS = 16670; - public Q00700_CursedLife() - { + public Q00700_CursedLife() { super(700, Q00700_CursedLife.class.getSimpleName(), "Cursed Life"); addStartNpc(ORBYU); addTalkId(ORBYU); @@ -73,34 +71,27 @@ public class Q00700_CursedLife extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, false); String htmltext = null; - if (st != null) - { - switch (event) - { - case "32560-02.htm": - { + if (st != null) { + switch (event) { + case "32560-02.htm": { st = player.getQuestState(Q10273_GoodDayToFly.class.getSimpleName()); htmltext = ((player.getLevel() < MIN_LVL) || (st == null) || (!st.isCompleted())) ? "32560-03.htm" : event; break; } case "32560-04.htm": - case "32560-09.html": - { + case "32560-09.html": { htmltext = event; break; } - case "32560-05.htm": - { + case "32560-05.htm": { st.startQuest(); htmltext = event; break; } - case "32560-10.html": - { + case "32560-10.html": { st.exitQuest(true, true); htmltext = event; break; @@ -111,31 +102,24 @@ public class Q00700_CursedLife extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = "32560-01.htm"; break; } - case State.STARTED: - { + case State.STARTED: { long bones = st.getQuestItemsCount(SWALLOWED_BONES); long ribs = st.getQuestItemsCount(SWALLOWED_STERNUM); long skulls = st.getQuestItemsCount(SWALLOWED_SKULL); long sum = bones + ribs + skulls; - if (sum > 0) - { + if (sum > 0) { st.giveAdena(((bones * SWALLOWED_BONES_ADENA) + (ribs * SWALLOWED_STERNUM_ADENA) + (skulls * SWALLOWED_SKULL_ADENA) + (sum >= 10 ? BONUS : 0)), true); takeItems(player, -1, SWALLOWED_BONES, SWALLOWED_STERNUM, SWALLOWED_SKULL); htmltext = sum < 10 ? "32560-07.html" : "32560-08.html"; - } - else - { + } else { htmltext = "32560-06.html"; } break; @@ -145,117 +129,70 @@ public class Q00700_CursedLife extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getQuestState(player, false); - if (st != null) - { - if (npc.getId() == ROK) - { + if (st != null) { + if (npc.getId() == ROK) { int amount = 0, chance = getRandom(1000); - if (chance < 700) - { + if (chance < 700) { amount = 1; - } - else if (chance < 885) - { + } else if (chance < 885) { amount = 2; - } - else if (chance < 949) - { + } else if (chance < 949) { amount = 3; - } - else if (chance < 966) - { + } else if (chance < 966) { amount = getRandom(5) + 4; - } - else if (chance < 985) - { + } else if (chance < 985) { amount = getRandom(9) + 4; - } - else if (chance < 993) - { + } else if (chance < 993) { amount = getRandom(7) + 13; - } - else if (chance < 997) - { + } else if (chance < 997) { amount = getRandom(15) + 9; - } - else if (chance < 999) - { + } else if (chance < 999) { amount = getRandom(23) + 53; - } - else - { + } else { amount = getRandom(49) + 76; } st.giveItems(SWALLOWED_BONES, amount); chance = getRandom(1000); - if (chance < 520) - { + if (chance < 520) { amount = 1; - } - else if (chance < 771) - { + } else if (chance < 771) { amount = 2; - } - else if (chance < 836) - { + } else if (chance < 836) { amount = 3; - } - else if (chance < 985) - { + } else if (chance < 985) { amount = getRandom(2) + 4; - } - else if (chance < 995) - { + } else if (chance < 995) { amount = getRandom(4) + 5; - } - else - { + } else { amount = getRandom(8) + 6; } st.giveItems(SWALLOWED_STERNUM, amount); chance = getRandom(1000); - if (chance < 185) - { + if (chance < 185) { amount = getRandom(2) + 1; - } - else if (chance < 370) - { + } else if (chance < 370) { amount = getRandom(6) + 2; - } - else if (chance < 570) - { + } else if (chance < 570) { amount = getRandom(6) + 7; - } - else if (chance < 850) - { + } else if (chance < 850) { amount = getRandom(6) + 12; - } - else - { + } else { amount = getRandom(6) + 17; } st.giveItems(SWALLOWED_SKULL, amount); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - } - else - { + } else { Integer[] chances = MONSTERS.get(npc.getId()); int chance = getRandom(1000); - if (chance < chances[0]) - { + if (chance < chances[0]) { st.giveItems(SWALLOWED_BONES, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - } - else if (chance < chances[1]) - { + } else if (chance < chances[1]) { st.giveItems(SWALLOWED_STERNUM, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - } - else if (chance < chances[2]) - { + } else if (chance < chances[2]) { st.giveItems(SWALLOWED_SKULL, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00701_ProofOfExistence/Q00701_ProofOfExistence.java b/src/main/java/com/l2jserver/datapack/quests/Q00701_ProofOfExistence/Q00701_ProofOfExistence.java index 129947f909..768ccf7af4 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00701_ProofOfExistence/Q00701_ProofOfExistence.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00701_ProofOfExistence/Q00701_ProofOfExistence.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.model.quest.State; * Proof of Existence (701) * @author malyelfik */ -public class Q00701_ProofOfExistence extends Quest -{ +public class Q00701_ProofOfExistence extends Quest { // NPC private static final int ARTIUS = 32559; // Items @@ -43,8 +42,7 @@ public class Q00701_ProofOfExistence extends Quest // Monsters private static final int ENIRA = 25625; private static final Map<Integer, Integer> MOBS = new HashMap<>(); - static - { + static { MOBS.put(22606, 518); // Floating Skull MOBS.put(22607, 858); // Floating Skull MOBS.put(22608, 482); // Floating Zombie @@ -55,8 +53,7 @@ public class Q00701_ProofOfExistence extends Quest // Misc private static final int MIN_LEVEL = 78; - public Q00701_ProofOfExistence() - { + public Q00701_ProofOfExistence() { super(701, Q00701_ProofOfExistence.class.getSimpleName(), "Proof of Existence"); addStartNpc(ARTIUS); addTalkId(ARTIUS); @@ -66,16 +63,13 @@ public class Q00701_ProofOfExistence extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = event; - switch (event) - { + switch (event) { case "32559-03.htm": case "32559-08.html": break; @@ -93,43 +87,29 @@ public class Q00701_ProofOfExistence extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance member = getRandomPartyMember(player, 1); - if (member == null) - { + if (member == null) { return super.onKill(npc, player, isSummon); } final QuestState st = getQuestState(member, false); - if (npc.getId() == ENIRA) - { + if (npc.getId() == ENIRA) { final int chance = getRandom(1000); final int count; - if (chance < 708) - { + if (chance < 708) { count = getRandom(2) + 1; - } - else if (chance < 978) - { + } else if (chance < 978) { count = getRandom(3) + 3; - } - else if (chance < 994) - { + } else if (chance < 994) { count = getRandom(4) + 6; - } - else if (chance < 998) - { + } else if (chance < 998) { count = getRandom(4) + 10; - } - else - { + } else { count = getRandom(5) + 14; } st.giveItems(BANSHEE_QUEENS_EYE, count); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - } - else if (getRandom(1000) < MOBS.get(npc.getId())) - { + } else if (getRandom(1000) < MOBS.get(npc.getId())) { st.giveItems(DEADMANS_REMAINS, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -137,31 +117,24 @@ public class Q00701_ProofOfExistence extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = ((player.getLevel() >= MIN_LEVEL) && player.hasQuestCompleted(Q10273_GoodDayToFly.class.getSimpleName())) ? "32559-01.htm" : "32559-02.htm"; break; case State.STARTED: - if (st.hasQuestItems(BANSHEE_QUEENS_EYE)) - { + if (st.hasQuestItems(BANSHEE_QUEENS_EYE)) { st.giveAdena((st.getQuestItemsCount(DEADMANS_REMAINS) * 2500) + (st.getQuestItemsCount(BANSHEE_QUEENS_EYE) * 50000) + 23835, true); st.takeItems(BANSHEE_QUEENS_EYE, -1); st.takeItems(DEADMANS_REMAINS, -1); htmltext = "32559-07.html"; - } - else if (st.hasQuestItems(DEADMANS_REMAINS)) - { + } else if (st.hasQuestItems(DEADMANS_REMAINS)) { st.giveAdena(st.getQuestItemsCount(DEADMANS_REMAINS) * 2500, true); st.takeItems(DEADMANS_REMAINS, -1); htmltext = "32559-06.html"; - } - else - { + } else { htmltext = "32559-05.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00702_ATrapForRevenge/Q00702_ATrapForRevenge.java b/src/main/java/com/l2jserver/datapack/quests/Q00702_ATrapForRevenge/Q00702_ATrapForRevenge.java index 8d067b2817..c165f2242f 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00702_ATrapForRevenge/Q00702_ATrapForRevenge.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00702_ATrapForRevenge/Q00702_ATrapForRevenge.java @@ -30,14 +30,12 @@ import com.l2jserver.gameserver.model.quest.State; * A Trap for Revenge (702) * @author malyelfik */ -public class Q00702_ATrapForRevenge extends Quest -{ +public class Q00702_ATrapForRevenge extends Quest { // NPC private static final int PLENOS = 32563; private static final int LEKON = 32557; private static final int TENIUS = 32555; - private static final int[] MONSTERS = - { + private static final int[] MONSTERS = { 22612, 22613, 25632, @@ -53,8 +51,7 @@ public class Q00702_ATrapForRevenge extends Quest private static final int VARIANT_DRAKE_WING_HORNS = 13880; private static final int EXTRACTED_RED_STAR_STONE = 14009; - public Q00702_ATrapForRevenge() - { + public Q00702_ATrapForRevenge() { super(702, Q00702_ATrapForRevenge.class.getSimpleName(), "A Trap for Revenge"); addStartNpc(PLENOS); addTalkId(PLENOS, LEKON, TENIUS); @@ -63,196 +60,120 @@ public class Q00702_ATrapForRevenge extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - if (event.equalsIgnoreCase("32563-04.htm")) - { + if (event.equalsIgnoreCase("32563-04.htm")) { st.startQuest(); - } - else if (event.equalsIgnoreCase("32563-07.html")) - { + } else if (event.equalsIgnoreCase("32563-07.html")) { htmltext = st.hasQuestItems(DRAKES_FLESH) ? "32563-08.html" : "32563-07.html"; - } - else if (event.equalsIgnoreCase("32563-09.html")) - { + } else if (event.equalsIgnoreCase("32563-09.html")) { st.giveAdena(st.getQuestItemsCount(DRAKES_FLESH) * 100, false); st.takeItems(DRAKES_FLESH, -1); - } - else if (event.equalsIgnoreCase("32563-11.html")) - { - if (st.hasQuestItems(VARIANT_DRAKE_WING_HORNS)) - { + } else if (event.equalsIgnoreCase("32563-11.html")) { + if (st.hasQuestItems(VARIANT_DRAKE_WING_HORNS)) { st.giveAdena(st.getQuestItemsCount(VARIANT_DRAKE_WING_HORNS) * 200000, false); st.takeItems(VARIANT_DRAKE_WING_HORNS, -1); htmltext = "32563-12.html"; - } - else - { + } else { htmltext = "32563-11.html"; } - } - else if (event.equalsIgnoreCase("32563-14.html")) - { + } else if (event.equalsIgnoreCase("32563-14.html")) { st.exitQuest(true, true); - } - else if (event.equalsIgnoreCase("32557-03.html")) - { - if (!st.hasQuestItems(ROTTEN_BLOOD) && (st.getQuestItemsCount(EXTRACTED_RED_STAR_STONE) < 100)) - { + } else if (event.equalsIgnoreCase("32557-03.html")) { + if (!st.hasQuestItems(ROTTEN_BLOOD) && (st.getQuestItemsCount(EXTRACTED_RED_STAR_STONE) < 100)) { htmltext = "32557-03.html"; - } - else if (st.hasQuestItems(ROTTEN_BLOOD) && (st.getQuestItemsCount(EXTRACTED_RED_STAR_STONE) < 100)) - { + } else if (st.hasQuestItems(ROTTEN_BLOOD) && (st.getQuestItemsCount(EXTRACTED_RED_STAR_STONE) < 100)) { htmltext = "32557-04.html"; - } - else if (!st.hasQuestItems(ROTTEN_BLOOD) && (st.getQuestItemsCount(EXTRACTED_RED_STAR_STONE) >= 100)) - { + } else if (!st.hasQuestItems(ROTTEN_BLOOD) && (st.getQuestItemsCount(EXTRACTED_RED_STAR_STONE) >= 100)) { htmltext = "32557-05.html"; - } - else if (st.hasQuestItems(ROTTEN_BLOOD) && (st.getQuestItemsCount(EXTRACTED_RED_STAR_STONE) >= 100)) - { + } else if (st.hasQuestItems(ROTTEN_BLOOD) && (st.getQuestItemsCount(EXTRACTED_RED_STAR_STONE) >= 100)) { st.giveItems(BAIT_FOR_DRAKES, 1); st.takeItems(ROTTEN_BLOOD, 1); st.takeItems(EXTRACTED_RED_STAR_STONE, 100); htmltext = "32557-06.html"; } - } - else if (event.equalsIgnoreCase("32555-03.html")) - { + } else if (event.equalsIgnoreCase("32555-03.html")) { st.setCond(2, true); - } - else if (event.equalsIgnoreCase("32555-05.html")) - { + } else if (event.equalsIgnoreCase("32555-05.html")) { st.exitQuest(true, true); - } - else if (event.equalsIgnoreCase("32555-06.html")) - { - if (st.getQuestItemsCount(DRAKES_FLESH) < 100) - { + } else if (event.equalsIgnoreCase("32555-06.html")) { + if (st.getQuestItemsCount(DRAKES_FLESH) < 100) { htmltext = "32555-06.html"; - } - else - { + } else { htmltext = "32555-07.html"; } - } - else if (event.equalsIgnoreCase("32555-08.html")) - { + } else if (event.equalsIgnoreCase("32555-08.html")) { st.giveItems(ROTTEN_BLOOD, 1); st.takeItems(DRAKES_FLESH, 100); - } - else if (event.equalsIgnoreCase("32555-10.html")) - { - if (st.hasQuestItems(VARIANT_DRAKE_WING_HORNS)) - { + } else if (event.equalsIgnoreCase("32555-10.html")) { + if (st.hasQuestItems(VARIANT_DRAKE_WING_HORNS)) { htmltext = "32555-11.html"; - } - else - { + } else { htmltext = "32555-10.html"; } - } - else if (event.equalsIgnoreCase("32555-15.html")) - { + } else if (event.equalsIgnoreCase("32555-15.html")) { int i0 = getRandom(1000); int i1 = getRandom(1000); - if ((i0 >= 500) && (i1 >= 600)) - { + if ((i0 >= 500) && (i1 >= 600)) { st.giveAdena(getRandom(49917) + 125000, false); - if (i1 < 720) - { + if (i1 < 720) { st.giveItems(9628, getRandom(3) + 1); st.giveItems(9629, getRandom(3) + 1); - } - else if (i1 < 840) - { + } else if (i1 < 840) { st.giveItems(9629, getRandom(3) + 1); st.giveItems(9630, getRandom(3) + 1); - } - else if (i1 < 960) - { + } else if (i1 < 960) { st.giveItems(9628, getRandom(3) + 1); st.giveItems(9630, getRandom(3) + 1); - } - else if (i1 < 1000) - { + } else if (i1 < 1000) { st.giveItems(9628, getRandom(3) + 1); st.giveItems(9629, getRandom(3) + 1); st.giveItems(9630, getRandom(3) + 1); } htmltext = "32555-15.html"; - } - else if ((i0 >= 500) && (i1 < 600)) - { + } else if ((i0 >= 500) && (i1 < 600)) { st.giveAdena(getRandom(49917) + 125000, false); - if (i1 < 210) - { - } - else if (i1 < 340) - { + if (i1 < 210) { + } else if (i1 < 340) { st.giveItems(9628, getRandom(3) + 1); - } - else if (i1 < 470) - { + } else if (i1 < 470) { st.giveItems(9629, getRandom(3) + 1); - } - else if (i1 < 600) - { + } else if (i1 < 600) { st.giveItems(9630, getRandom(3) + 1); } htmltext = "32555-16.html"; - } - else if ((i0 < 500) && (i1 >= 600)) - { + } else if ((i0 < 500) && (i1 >= 600)) { st.giveAdena(getRandom(49917) + 25000, false); - if (i1 < 720) - { + if (i1 < 720) { st.giveItems(9628, getRandom(3) + 1); st.giveItems(9629, getRandom(3) + 1); - } - else if (i1 < 840) - { + } else if (i1 < 840) { st.giveItems(9629, getRandom(3) + 1); st.giveItems(9630, getRandom(3) + 1); - } - else if (i1 < 960) - { + } else if (i1 < 960) { st.giveItems(9628, getRandom(3) + 1); st.giveItems(9630, getRandom(3) + 1); - } - else if (i1 < 1000) - { + } else if (i1 < 1000) { st.giveItems(9628, getRandom(3) + 1); st.giveItems(9629, getRandom(3) + 1); st.giveItems(9630, getRandom(3) + 1); } htmltext = "32555-17.html"; - } - else if ((i0 < 500) && (i1 < 600)) - { + } else if ((i0 < 500) && (i1 < 600)) { st.giveAdena(getRandom(49917) + 25000, false); - if (i1 < 210) - { - } - else if (i1 < 340) - { + if (i1 < 210) { + } else if (i1 < 340) { st.giveItems(9628, getRandom(3) + 1); - } - else if (i1 < 470) - { + } else if (i1 < 470) { st.giveItems(9629, getRandom(3) + 1); - } - else if (i1 < 600) - { + } else if (i1 < 600) { st.giveItems(9630, getRandom(3) + 1); } @@ -264,93 +185,65 @@ public class Q00702_ATrapForRevenge extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(player, 2); - if (partyMember == null) - { + if (partyMember == null) { return null; } final QuestState st = getQuestState(partyMember, false); final int chance = getRandom(1000); - switch (npc.getId()) - { + switch (npc.getId()) { case 22612: - if (chance < 413) - { + if (chance < 413) { st.giveItems(DRAKES_FLESH, 2); - } - else - { + } else { st.giveItems(DRAKES_FLESH, 1); } break; case 22613: - if (chance < 440) - { + if (chance < 440) { st.giveItems(DRAKES_FLESH, 2); - } - else - { + } else { st.giveItems(DRAKES_FLESH, 1); } break; case 25632: - if (chance < 996) - { + if (chance < 996) { st.giveItems(DRAKES_FLESH, 1); } break; case 22610: - if (chance < 485) - { + if (chance < 485) { st.giveItems(DRAKES_FLESH, 2); - } - else - { + } else { st.giveItems(DRAKES_FLESH, 1); } break; case 22611: - if (chance < 451) - { + if (chance < 451) { st.giveItems(DRAKES_FLESH, 2); - } - else - { + } else { st.giveItems(DRAKES_FLESH, 1); } break; case 25631: - if (chance < 485) - { + if (chance < 485) { st.giveItems(DRAKES_FLESH, 2); - } - else - { + } else { st.giveItems(DRAKES_FLESH, 1); } break; case 25626: int count = 0; - if (chance < 708) - { + if (chance < 708) { count = getRandom(2) + 1; - } - else if (chance < 978) - { + } else if (chance < 978) { count = getRandom(3) + 3; - } - else if (chance < 994) - { + } else if (chance < 994) { count = getRandom(4) + 6; - } - else if (chance < 998) - { + } else if (chance < 998) { count = getRandom(4) + 10; - } - else if (chance < 1000) - { + } else if (chance < 1000) { count = getRandom(5) + 14; } st.giveItems(VARIANT_DRAKE_WING_HORNS, count); @@ -361,14 +254,11 @@ public class Q00702_ATrapForRevenge extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - if (npc.getId() == PLENOS) - { - switch (st.getState()) - { + if (npc.getId() == PLENOS) { + switch (st.getState()) { case State.CREATED: htmltext = (player.hasQuestCompleted(Q10273_GoodDayToFly.class.getSimpleName()) && (player.getLevel() >= 78)) ? "32563-01.htm" : "32563-02.htm"; break; @@ -377,12 +267,9 @@ public class Q00702_ATrapForRevenge extends Quest break; } } - if (st.getState() == State.STARTED) - { - if (npc.getId() == LEKON) - { - switch (st.getCond()) - { + if (st.getState() == State.STARTED) { + if (npc.getId() == LEKON) { + switch (st.getCond()) { case 1: htmltext = "32557-01.html"; break; @@ -390,11 +277,8 @@ public class Q00702_ATrapForRevenge extends Quest htmltext = "32557-02.html"; break; } - } - else if (npc.getId() == TENIUS) - { - switch (st.getCond()) - { + } else if (npc.getId() == TENIUS) { + switch (st.getCond()) { case 1: htmltext = "32555-01.html"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00901_HowLavasaurusesAreMade/Q00901_HowLavasaurusesAreMade.java b/src/main/java/com/l2jserver/datapack/quests/Q00901_HowLavasaurusesAreMade/Q00901_HowLavasaurusesAreMade.java index 777cdcdf16..8c76a479cd 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00901_HowLavasaurusesAreMade/Q00901_HowLavasaurusesAreMade.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00901_HowLavasaurusesAreMade/Q00901_HowLavasaurusesAreMade.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.model.quest.State; * How Lavasauruses Are Made (901) * @author UnAfraid, nonom, malyelfik */ -public class Q00901_HowLavasaurusesAreMade extends Quest -{ +public class Q00901_HowLavasaurusesAreMade extends Quest { // NPC private static final int ROONEY = 32049; // Monsters @@ -50,8 +49,7 @@ public class Q00901_HowLavasaurusesAreMade extends Quest private static final int TOTEM_OF_COURAGE = 21901; private static final int TOTEM_OF_FORTITUDE = 21902; - public Q00901_HowLavasaurusesAreMade() - { + public Q00901_HowLavasaurusesAreMade() { super(901, Q00901_HowLavasaurusesAreMade.class.getSimpleName(), "How Lavasauruses Are Made"); addStartNpc(ROONEY); addTalkId(ROONEY); @@ -60,17 +58,14 @@ public class Q00901_HowLavasaurusesAreMade extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } String htmltext = event; - switch (event) - { + switch (event) { case "32049-03.htm": case "32049-08.html": case "32049-09.html": @@ -104,13 +99,10 @@ public class Q00901_HowLavasaurusesAreMade extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isCond(1)) - { - switch (npc.getId()) - { + if ((st != null) && st.isCond(1)) { + switch (npc.getId()) { case LAVASAURUS_NEWBORN: giveQuestItems(st, FRAGMENT_STONE); break; @@ -129,44 +121,33 @@ public class Q00901_HowLavasaurusesAreMade extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (st.getPlayer().getLevel() >= 76) ? "32049-01.htm" : "32049-02.htm"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "32049-05.html"; - } - else if (st.isCond(2)) - { - if (gotAllQuestItems(st)) - { + } else if (st.isCond(2)) { + if (gotAllQuestItems(st)) { st.takeItems(FRAGMENT_STONE, -1); st.takeItems(FRAGMENT_HEAD, -1); st.takeItems(FRAGMENT_BODY, -1); st.takeItems(FRAGMENT_HORN, -1); htmltext = "32049-06.html"; - } - else - { + } else { htmltext = "32049-07.html"; } } break; case State.COMPLETED: - if (st.isNowAvailable()) - { + if (st.isNowAvailable()) { st.setState(State.CREATED); htmltext = (st.getPlayer().getLevel() >= 76) ? "32049-01.htm" : "32049-02.html"; - } - else - { + } else { htmltext = "32049-16.html"; } break; @@ -174,21 +155,16 @@ public class Q00901_HowLavasaurusesAreMade extends Quest return htmltext; } - public static void giveQuestItems(QuestState st, int itemId) - { - if (st.getQuestItemsCount(itemId) < 10) - { + public static void giveQuestItems(QuestState st, int itemId) { + if (st.getQuestItemsCount(itemId) < 10) { st.giveItems(itemId, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - } - else if (gotAllQuestItems(st)) - { + } else if (gotAllQuestItems(st)) { st.setCond(2, true); } } - public static boolean gotAllQuestItems(QuestState st) - { + public static boolean gotAllQuestItems(QuestState st) { return (st.getQuestItemsCount(FRAGMENT_STONE) >= 10) && (st.getQuestItemsCount(FRAGMENT_HEAD) >= 10) && (st.getQuestItemsCount(FRAGMENT_BODY) >= 10) && (st.getQuestItemsCount(FRAGMENT_HORN) >= 10); } } \ No newline at end of file diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00902_ReclaimOurEra/Q00902_ReclaimOurEra.java b/src/main/java/com/l2jserver/datapack/quests/Q00902_ReclaimOurEra/Q00902_ReclaimOurEra.java index 2d4f2230cd..f376ead33b 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00902_ReclaimOurEra/Q00902_ReclaimOurEra.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00902_ReclaimOurEra/Q00902_ReclaimOurEra.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.util.Util; * Reclaim Our Era (902) * @author netvirus */ -public final class Q00902_ReclaimOurEra extends Quest -{ +public final class Q00902_ReclaimOurEra extends Quest { // Npc private static final int MATHIAS = 31340; // Misc @@ -47,8 +46,7 @@ public final class Q00902_ReclaimOurEra extends Quest // Monsters private static final Map<Integer, Integer> MONSTER_DROPS = new HashMap<>(); - static - { + static { MONSTER_DROPS.put(25309, SHATTERED_BONES); // Varka's Hero Shadith MONSTER_DROPS.put(25312, SHATTERED_BONES); // Varka's Commander Mos MONSTER_DROPS.put(25315, SHATTERED_BONES); // Varka's Chief Horus @@ -62,8 +60,7 @@ public final class Q00902_ReclaimOurEra extends Quest MONSTER_DROPS.put(25701, ANAIS_SCROLL); // Anais - Master of Splendor } - public Q00902_ReclaimOurEra() - { + public Q00902_ReclaimOurEra() { super(902, Q00902_ReclaimOurEra.class.getSimpleName(), "Reclaim Our Era"); addStartNpc(MATHIAS); addTalkId(MATHIAS); @@ -71,76 +68,59 @@ public final class Q00902_ReclaimOurEra extends Quest registerQuestItems(SHATTERED_BONES, CANNIBALISTIC_STAKATO_LDR_CLAW, ANAIS_SCROLL); } - private void giveItem(L2Npc npc, L2PcInstance player) - { + private void giveItem(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && (st.isStarted()) && (!st.isCond(5)) && Util.checkIfInRange(1500, npc, player, false)) - { + if ((st != null) && (st.isStarted()) && (!st.isCond(5)) && Util.checkIfInRange(1500, npc, player, false)) { st.giveItems(MONSTER_DROPS.get(npc.getId()), 1); st.setCond(5, true); } } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); String htmltext = null; - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { - case "31340-04.htm": - { - if (st.isCreated()) - { + switch (event) { + case "31340-04.htm": { + if (st.isCreated()) { htmltext = event; } break; } - case "31340-05.html": - { - if (st.isCreated()) - { + case "31340-05.html": { + if (st.isCreated()) { st.startQuest(); htmltext = event; } break; } - case "31340-06.html": - { - if (st.isCond(1)) - { + case "31340-06.html": { + if (st.isCond(1)) { st.setCond(2, true); htmltext = event; } break; } - case "31340-07.html": - { - if (st.isCond(1)) - { + case "31340-07.html": { + if (st.isCond(1)) { st.setCond(3, true); htmltext = event; } break; } - case "31340-08.html": - { - if (st.isCond(1)) - { + case "31340-08.html": { + if (st.isCond(1)) { st.setCond(4, true); htmltext = event; } break; } - case "31340-10.html": - { - if (st.isCond(1)) - { + case "31340-10.html": { + if (st.isCond(1)) { htmltext = event; } break; @@ -150,81 +130,59 @@ public final class Q00902_ReclaimOurEra extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { - if (killer.isInParty()) - { - for (L2PcInstance member : killer.getParty().getMembers()) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { + if (killer.isInParty()) { + for (L2PcInstance member : killer.getParty().getMembers()) { giveItem(npc, member); } - } - else - { + } else { giveItem(npc, killer); } return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.COMPLETED: - { - if (!st.isNowAvailable()) - { + switch (st.getState()) { + case State.COMPLETED: { + if (!st.isNowAvailable()) { htmltext = "31340-02.htm"; break; } st.setState(State.CREATED); } - case State.CREATED: - { + case State.CREATED: { htmltext = (player.getLevel() >= MIN_LVL) ? "31340-01.htm" : "31340-03.htm"; break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "31340-09.html"; break; } - case 2: - { + case 2: { htmltext = "31340-11.html"; break; } - case 3: - { + case 3: { htmltext = "31340-12.html"; break; } - case 4: - { + case 4: { htmltext = "31340-13.html"; break; } - case 5: - { - if (st.hasQuestItems(SHATTERED_BONES)) - { + case 5: { + if (st.hasQuestItems(SHATTERED_BONES)) { st.giveItems(PROOF_OF_CHALLENGE, 1); st.giveAdena(134038, true); - } - else if (st.hasQuestItems(CANNIBALISTIC_STAKATO_LDR_CLAW)) - { + } else if (st.hasQuestItems(CANNIBALISTIC_STAKATO_LDR_CLAW)) { st.giveItems(PROOF_OF_CHALLENGE, 3); st.giveAdena(210119, true); - } - else if (st.hasQuestItems(ANAIS_SCROLL)) - { + } else if (st.hasQuestItems(ANAIS_SCROLL)) { st.giveItems(PROOF_OF_CHALLENGE, 3); st.giveAdena(348155, true); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00903_TheCallOfAntharas/Q00903_TheCallOfAntharas.java b/src/main/java/com/l2jserver/datapack/quests/Q00903_TheCallOfAntharas/Q00903_TheCallOfAntharas.java index b5c843cea1..f7533f91a7 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00903_TheCallOfAntharas/Q00903_TheCallOfAntharas.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00903_TheCallOfAntharas/Q00903_TheCallOfAntharas.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * The Call of Antharas (903) * @author Zoey76 */ -public class Q00903_TheCallOfAntharas extends Quest -{ +public class Q00903_TheCallOfAntharas extends Quest { // NPC private static final int THEODRIC = 30755; // Monsters @@ -46,8 +45,7 @@ public class Q00903_TheCallOfAntharas extends Quest // Misc private static final int MIN_LEVEL = 83; - public Q00903_TheCallOfAntharas() - { + public Q00903_TheCallOfAntharas() { super(903, Q00903_TheCallOfAntharas.class.getSimpleName(), "The Call of Antharas"); addStartNpc(THEODRIC); addTalkId(THEODRIC); @@ -56,55 +54,43 @@ public class Q00903_TheCallOfAntharas extends Quest } @Override - public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) - { + public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && Util.checkIfInRange(1500, npc, player, false)) - { - switch (npc.getId()) - { - case BEHEMOTH_DRAGON: - { + if ((st != null) && Util.checkIfInRange(1500, npc, player, false)) { + switch (npc.getId()) { + case BEHEMOTH_DRAGON: { st.giveItems(BEHEMOTH_DRAGON_LEATHER, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); break; } - case TARASK_DRAGON: - { + case TARASK_DRAGON: { st.giveItems(TARASK_DRAGONS_LEATHER_FRAGMENT, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); break; } } - if (st.hasQuestItems(BEHEMOTH_DRAGON_LEATHER) && st.hasQuestItems(TARASK_DRAGONS_LEATHER_FRAGMENT)) - { + if (st.hasQuestItems(BEHEMOTH_DRAGON_LEATHER) && st.hasQuestItems(TARASK_DRAGONS_LEATHER_FRAGMENT)) { st.setCond(2, true); } } } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - if ((player.getLevel() >= MIN_LEVEL) && st.hasQuestItems(PORTAL_STONE)) - { - switch (event) - { - case "30755-05.htm": - { + if ((player.getLevel() >= MIN_LEVEL) && st.hasQuestItems(PORTAL_STONE)) { + switch (event) { + case "30755-05.htm": { htmltext = event; break; } - case "30755-06.html": - { + case "30755-06.html": { st.startQuest(); htmltext = event; break; @@ -115,46 +101,33 @@ public class Q00903_TheCallOfAntharas extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { executeForEachPlayer(killer, npc, isSummon, true, false); return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { - if (player.getLevel() < MIN_LEVEL) - { + switch (st.getState()) { + case State.CREATED: { + if (player.getLevel() < MIN_LEVEL) { htmltext = "30755-03.html"; - } - else if (!st.hasQuestItems(PORTAL_STONE)) - { + } else if (!st.hasQuestItems(PORTAL_STONE)) { htmltext = "30755-04.html"; - } - else - { + } else { htmltext = "30755-01.htm"; } break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "30755-07.html"; break; } - case 2: - { + case 2: { st.giveItems(SCROLL_ANTHARAS_CALL, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); st.exitQuest(QuestType.DAILY, true); @@ -164,25 +137,16 @@ public class Q00903_TheCallOfAntharas extends Quest } break; } - case State.COMPLETED: - { - if (!st.isNowAvailable()) - { + case State.COMPLETED: { + if (!st.isNowAvailable()) { htmltext = "30755-02.html"; - } - else - { + } else { st.setState(State.CREATED); - if (player.getLevel() < MIN_LEVEL) - { + if (player.getLevel() < MIN_LEVEL) { htmltext = "30755-03.html"; - } - else if (!st.hasQuestItems(PORTAL_STONE)) - { + } else if (!st.hasQuestItems(PORTAL_STONE)) { htmltext = "30755-04.html"; - } - else - { + } else { htmltext = "30755-01.htm"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00904_DragonTrophyAntharas/Q00904_DragonTrophyAntharas.java b/src/main/java/com/l2jserver/datapack/quests/Q00904_DragonTrophyAntharas/Q00904_DragonTrophyAntharas.java index 22a1a231d9..828be46f3a 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00904_DragonTrophyAntharas/Q00904_DragonTrophyAntharas.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00904_DragonTrophyAntharas/Q00904_DragonTrophyAntharas.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Dragon Trophy - Antharas (904) * @author Zoey76 */ -public final class Q00904_DragonTrophyAntharas extends Quest -{ +public final class Q00904_DragonTrophyAntharas extends Quest { // NPC private static final int THEODRIC = 30755; // Monster @@ -43,8 +42,7 @@ public final class Q00904_DragonTrophyAntharas extends Quest // Misc private static final int MIN_LEVEL = 84; - public Q00904_DragonTrophyAntharas() - { + public Q00904_DragonTrophyAntharas() { super(904, Q00904_DragonTrophyAntharas.class.getSimpleName(), "Dragon Trophy - Antharas"); addStartNpc(THEODRIC); addTalkId(THEODRIC); @@ -52,37 +50,29 @@ public final class Q00904_DragonTrophyAntharas extends Quest } @Override - public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) - { + public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) - { + if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) { st.setCond(2, true); } } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - if ((player.getLevel() >= MIN_LEVEL) && st.hasQuestItems(PORTAL_STONE)) - { - switch (event) - { + if ((player.getLevel() >= MIN_LEVEL) && st.hasQuestItems(PORTAL_STONE)) { + switch (event) { case "30755-05.htm": - case "30755-06.htm": - { + case "30755-06.htm": { htmltext = event; break; } - case "30755-07.html": - { + case "30755-07.html": { st.startQuest(); htmltext = event; break; @@ -93,46 +83,33 @@ public final class Q00904_DragonTrophyAntharas extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { executeForEachPlayer(killer, npc, isSummon, true, true); return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { - if (player.getLevel() < MIN_LEVEL) - { + switch (st.getState()) { + case State.CREATED: { + if (player.getLevel() < MIN_LEVEL) { htmltext = "30755-02.html"; - } - else if (!st.hasQuestItems(PORTAL_STONE)) - { + } else if (!st.hasQuestItems(PORTAL_STONE)) { htmltext = "30755-04.html"; - } - else - { + } else { htmltext = "30755-01.htm"; } break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "30755-08.html"; break; } - case 2: - { + case 2: { st.giveItems(MEDAL_OF_GLORY, 30); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); st.exitQuest(QuestType.DAILY, true); @@ -142,25 +119,16 @@ public final class Q00904_DragonTrophyAntharas extends Quest } break; } - case State.COMPLETED: - { - if (!st.isNowAvailable()) - { + case State.COMPLETED: { + if (!st.isNowAvailable()) { htmltext = "30755-03.html"; - } - else - { + } else { st.setState(State.CREATED); - if (player.getLevel() < MIN_LEVEL) - { + if (player.getLevel() < MIN_LEVEL) { htmltext = "30755-02.html"; - } - else if (!st.hasQuestItems(PORTAL_STONE)) - { + } else if (!st.hasQuestItems(PORTAL_STONE)) { htmltext = "30755-04.html"; - } - else - { + } else { htmltext = "30755-01.htm"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00905_RefinedDragonBlood/Q00905_RefinedDragonBlood.java b/src/main/java/com/l2jserver/datapack/quests/Q00905_RefinedDragonBlood/Q00905_RefinedDragonBlood.java index 2175ad1006..db26971ccf 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00905_RefinedDragonBlood/Q00905_RefinedDragonBlood.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00905_RefinedDragonBlood/Q00905_RefinedDragonBlood.java @@ -34,11 +34,9 @@ import com.l2jserver.gameserver.util.Util; * Refined Dragon Blood (905) * @author Zoey76 */ -public final class Q00905_RefinedDragonBlood extends Quest -{ +public final class Q00905_RefinedDragonBlood extends Quest { // NPCs - private static final int[] SEPARATED_SOULS = - { + private static final int[] SEPARATED_SOULS = { 32864, 32865, 32866, @@ -55,8 +53,7 @@ public final class Q00905_RefinedDragonBlood extends Quest private static final int REFINED_BLUE_DRAGON_BLOOD = 21904; // Monsters private static final Map<Integer, Integer> MONSTERS = new HashMap<>(); - static - { + static { MONSTERS.put(22844, UNREFINED_BLUE_DRAGON_BLOOD); // Dragon Knight MONSTERS.put(22845, UNREFINED_BLUE_DRAGON_BLOOD); // Dragon Knight MONSTERS.put(22846, UNREFINED_BLUE_DRAGON_BLOOD); // Elite Dragon Knight @@ -72,8 +69,7 @@ public final class Q00905_RefinedDragonBlood extends Quest private static final int MIN_LEVEL = 83; private static final int DRAGON_BLOOD_COUNT = 10; - public Q00905_RefinedDragonBlood() - { + public Q00905_RefinedDragonBlood() { super(905, Q00905_RefinedDragonBlood.class.getSimpleName(), "Refined Dragon Blood"); addStartNpc(SEPARATED_SOULS); addTalkId(SEPARATED_SOULS); @@ -82,22 +78,16 @@ public final class Q00905_RefinedDragonBlood extends Quest } @Override - public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) - { + public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) - { + if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) { final int itemId = MONSTERS.get(npc.getId()); - if (st.getQuestItemsCount(itemId) < DRAGON_BLOOD_COUNT) - { + if (st.getQuestItemsCount(itemId) < DRAGON_BLOOD_COUNT) { st.giveItems(itemId, 1); - if ((st.getQuestItemsCount(UNREFINED_RED_DRAGON_BLOOD) >= DRAGON_BLOOD_COUNT) && (st.getQuestItemsCount(UNREFINED_BLUE_DRAGON_BLOOD) >= DRAGON_BLOOD_COUNT)) - { + if ((st.getQuestItemsCount(UNREFINED_RED_DRAGON_BLOOD) >= DRAGON_BLOOD_COUNT) && (st.getQuestItemsCount(UNREFINED_BLUE_DRAGON_BLOOD) >= DRAGON_BLOOD_COUNT)) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -105,42 +95,34 @@ public final class Q00905_RefinedDragonBlood extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - if (player.getLevel() >= MIN_LEVEL) - { - switch (event) - { + if (player.getLevel() >= MIN_LEVEL) { + switch (event) { case "32864-04.htm": case "32864-09.html": - case "32864-10.html": - { + case "32864-10.html": { htmltext = event; break; } - case "32864-05.htm": - { + case "32864-05.htm": { st.startQuest(); htmltext = event; break; } - case "32864-11.html": - { + case "32864-11.html": { st.giveItems(REFINED_RED_DRAGON_BLOOD, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); st.exitQuest(QuestType.DAILY, true); htmltext = event; break; } - case "32864-12.html": - { + case "32864-12.html": { st.giveItems(REFINED_BLUE_DRAGON_BLOOD, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); st.exitQuest(QuestType.DAILY, true); @@ -153,42 +135,31 @@ public final class Q00905_RefinedDragonBlood extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { executeForEachPlayer(killer, npc, isSummon, true, false); return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getLevel() < MIN_LEVEL) ? "32864-02.html" : "32864-01.htm"; break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "32864-06.html"; break; } - case 2: - { - if (!st.isSet("wait")) - { + case 2: { + if (!st.isSet("wait")) { htmltext = "32864-07.html"; st.set("wait", 1); - } - else - { + } else { htmltext = "32864-08.html"; } break; @@ -196,14 +167,10 @@ public final class Q00905_RefinedDragonBlood extends Quest } break; } - case State.COMPLETED: - { - if (!st.isNowAvailable()) - { + case State.COMPLETED: { + if (!st.isNowAvailable()) { htmltext = "32864-03.html"; - } - else - { + } else { st.setState(State.CREATED); htmltext = (player.getLevel() < MIN_LEVEL) ? "32864-02.html" : "32864-01.htm"; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00906_TheCallOfValakas/Q00906_TheCallOfValakas.java b/src/main/java/com/l2jserver/datapack/quests/Q00906_TheCallOfValakas/Q00906_TheCallOfValakas.java index c43f1a3117..aa8e0134ab 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00906_TheCallOfValakas/Q00906_TheCallOfValakas.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00906_TheCallOfValakas/Q00906_TheCallOfValakas.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * The Call of Valakas (906) * @author Zoey76 */ -public class Q00906_TheCallOfValakas extends Quest -{ +public class Q00906_TheCallOfValakas extends Quest { // NPC private static final int KLEIN = 31540; // Monster @@ -44,8 +43,7 @@ public class Q00906_TheCallOfValakas extends Quest // Misc private static final int MIN_LEVEL = 83; - public Q00906_TheCallOfValakas() - { + public Q00906_TheCallOfValakas() { super(906, Q00906_TheCallOfValakas.class.getSimpleName(), "The Call of Valakas"); addStartNpc(KLEIN); addTalkId(KLEIN); @@ -54,11 +52,9 @@ public class Q00906_TheCallOfValakas extends Quest } @Override - public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) - { + public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && Util.checkIfInRange(1500, npc, player, false)) - { + if ((st != null) && Util.checkIfInRange(1500, npc, player, false)) { st.giveItems(LAVASAURUS_ALPHA_FRAGMENT, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); st.setCond(2, true); @@ -66,26 +62,20 @@ public class Q00906_TheCallOfValakas extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - if ((player.getLevel() >= MIN_LEVEL) && st.hasQuestItems(VACUALITE_FLOATING_STONE)) - { - switch (event) - { - case "31540-05.htm": - { + if ((player.getLevel() >= MIN_LEVEL) && st.hasQuestItems(VACUALITE_FLOATING_STONE)) { + switch (event) { + case "31540-05.htm": { htmltext = event; break; } - case "31540-06.html": - { + case "31540-06.html": { st.startQuest(); htmltext = event; break; @@ -96,46 +86,33 @@ public class Q00906_TheCallOfValakas extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { executeForEachPlayer(killer, npc, isSummon, true, false); return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { - if (player.getLevel() < MIN_LEVEL) - { + switch (st.getState()) { + case State.CREATED: { + if (player.getLevel() < MIN_LEVEL) { htmltext = "31540-03.html"; - } - else if (!st.hasQuestItems(VACUALITE_FLOATING_STONE)) - { + } else if (!st.hasQuestItems(VACUALITE_FLOATING_STONE)) { htmltext = "31540-04.html"; - } - else - { + } else { htmltext = "31540-01.htm"; } break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "31540-07.html"; break; } - case 2: - { + case 2: { st.giveItems(SCROLL_VALAKAS_CALL, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); st.exitQuest(QuestType.DAILY, true); @@ -145,25 +122,16 @@ public class Q00906_TheCallOfValakas extends Quest } break; } - case State.COMPLETED: - { - if (!st.isNowAvailable()) - { + case State.COMPLETED: { + if (!st.isNowAvailable()) { htmltext = "31540-02.html"; - } - else - { + } else { st.setState(State.CREATED); - if (player.getLevel() < MIN_LEVEL) - { + if (player.getLevel() < MIN_LEVEL) { htmltext = "31540-03.html"; - } - else if (!st.hasQuestItems(VACUALITE_FLOATING_STONE)) - { + } else if (!st.hasQuestItems(VACUALITE_FLOATING_STONE)) { htmltext = "31540-04.html"; - } - else - { + } else { htmltext = "31540-01.htm"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00907_DragonTrophyValakas/Q00907_DragonTrophyValakas.java b/src/main/java/com/l2jserver/datapack/quests/Q00907_DragonTrophyValakas/Q00907_DragonTrophyValakas.java index c01af1158c..2379853780 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00907_DragonTrophyValakas/Q00907_DragonTrophyValakas.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00907_DragonTrophyValakas/Q00907_DragonTrophyValakas.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Dragon Trophy - Valakas (907) * @author Zoey76 */ -public class Q00907_DragonTrophyValakas extends Quest -{ +public class Q00907_DragonTrophyValakas extends Quest { // NPC private static final int KLEIN = 31540; // Monster @@ -43,8 +42,7 @@ public class Q00907_DragonTrophyValakas extends Quest // Misc private static final int MIN_LEVEL = 84; - public Q00907_DragonTrophyValakas() - { + public Q00907_DragonTrophyValakas() { super(907, Q00907_DragonTrophyValakas.class.getSimpleName(), "Dragon Trophy - Valakas"); addStartNpc(KLEIN); addTalkId(KLEIN); @@ -52,37 +50,29 @@ public class Q00907_DragonTrophyValakas extends Quest } @Override - public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) - { + public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) - { + if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) { st.setCond(2, true); } } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - if ((player.getLevel() >= MIN_LEVEL) && st.hasQuestItems(VACUALITE_FLOATING_STONE)) - { - switch (event) - { + if ((player.getLevel() >= MIN_LEVEL) && st.hasQuestItems(VACUALITE_FLOATING_STONE)) { + switch (event) { case "31540-05.htm": - case "31540-06.htm": - { + case "31540-06.htm": { htmltext = event; break; } - case "31540-07.html": - { + case "31540-07.html": { st.startQuest(); htmltext = event; break; @@ -93,46 +83,33 @@ public class Q00907_DragonTrophyValakas extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { executeForEachPlayer(killer, npc, isSummon, true, true); return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { - if (player.getLevel() < MIN_LEVEL) - { + switch (st.getState()) { + case State.CREATED: { + if (player.getLevel() < MIN_LEVEL) { htmltext = "31540-02.html"; - } - else if (!st.hasQuestItems(VACUALITE_FLOATING_STONE)) - { + } else if (!st.hasQuestItems(VACUALITE_FLOATING_STONE)) { htmltext = "31540-04.html"; - } - else - { + } else { htmltext = "31540-01.htm"; } break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "31540-08.html"; break; } - case 2: - { + case 2: { st.giveItems(MEDAL_OF_GLORY, 30); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); st.exitQuest(QuestType.DAILY, true); @@ -142,25 +119,16 @@ public class Q00907_DragonTrophyValakas extends Quest } break; } - case State.COMPLETED: - { - if (!st.isNowAvailable()) - { + case State.COMPLETED: { + if (!st.isNowAvailable()) { htmltext = "31540-03.html"; - } - else - { + } else { st.setState(State.CREATED); - if (player.getLevel() < MIN_LEVEL) - { + if (player.getLevel() < MIN_LEVEL) { htmltext = "31540-02.html"; - } - else if (!st.hasQuestItems(VACUALITE_FLOATING_STONE)) - { + } else if (!st.hasQuestItems(VACUALITE_FLOATING_STONE)) { htmltext = "31540-04.html"; - } - else - { + } else { htmltext = "31540-01.htm"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q00998_FallenAngelSelect/Q00998_FallenAngelSelect.java b/src/main/java/com/l2jserver/datapack/quests/Q00998_FallenAngelSelect/Q00998_FallenAngelSelect.java index ea692752b7..f4db04e156 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q00998_FallenAngelSelect/Q00998_FallenAngelSelect.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q00998_FallenAngelSelect/Q00998_FallenAngelSelect.java @@ -33,15 +33,13 @@ import com.l2jserver.gameserver.model.quest.State; * NOTE: This quest is used for start quest 142 or 143 * @author Nono */ -public class Q00998_FallenAngelSelect extends Quest -{ +public class Q00998_FallenAngelSelect extends Quest { // NPCs private static final int NATOOLS = 30894; // Misc private static final int MIN_LEVEL = 38; - public Q00998_FallenAngelSelect() - { + public Q00998_FallenAngelSelect() { super(998, Q00998_FallenAngelSelect.class.getSimpleName(), "Fallen Angel - Select"); setIsCustom(true); addStartNpc(NATOOLS); @@ -49,16 +47,13 @@ public class Q00998_FallenAngelSelect extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } - switch (event) - { + switch (event) { case "30894-01.html": case "30894-02.html": case "30894-03.html": @@ -73,11 +68,9 @@ public class Q00998_FallenAngelSelect extends Quest return null; } - private void startQuest(String name, L2PcInstance player) - { + private void startQuest(String name, L2PcInstance player) { final Quest q = QuestManager.getInstance().getQuest(name); - if (q != null) - { + if (q != null) { q.newQuestState(player); q.notifyEvent("30894-01.html", null, player); player.getQuestState(getName()).setState(State.COMPLETED); @@ -85,12 +78,10 @@ public class Q00998_FallenAngelSelect extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); final QuestState qs = player.getQuestState(Q00141_ShadowFoxPart3.class.getSimpleName()); - if ((st == null) || !st.isStarted()) - { + if ((st == null) || !st.isStarted()) { return getNoQuestMsg(player); } return ((player.getLevel() >= MIN_LEVEL) && (qs != null) && qs.isCompleted()) ? "30894-01.html" : "30894-00.html"; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10267_JourneyToGracia/Q10267_JourneyToGracia.java b/src/main/java/com/l2jserver/datapack/quests/Q10267_JourneyToGracia/Q10267_JourneyToGracia.java index 2b6742d119..ca04bfcd5f 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10267_JourneyToGracia/Q10267_JourneyToGracia.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10267_JourneyToGracia/Q10267_JourneyToGracia.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by Kerberos. * @author nonom */ -public class Q10267_JourneyToGracia extends Quest -{ +public class Q10267_JourneyToGracia extends Quest { // NPCs private static final int ORVEN = 30857; private static final int KEUCEREUS = 32548; @@ -38,8 +37,7 @@ public class Q10267_JourneyToGracia extends Quest // Item private static final int LETTER = 13810; - public Q10267_JourneyToGracia() - { + public Q10267_JourneyToGracia() { super(10267, Q10267_JourneyToGracia.class.getSimpleName(), "Journey to Gracia"); addStartNpc(ORVEN); addTalkId(ORVEN, KEUCEREUS, PAPIKU); @@ -47,16 +45,13 @@ public class Q10267_JourneyToGracia extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - switch (event) - { + switch (event) { case "30857-06.html": st.startQuest(); st.giveItems(LETTER, 1); @@ -74,15 +69,12 @@ public class Q10267_JourneyToGracia extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case ORVEN: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() < 75) ? "30857-00.html" : "30857-01.htm"; break; @@ -95,18 +87,14 @@ public class Q10267_JourneyToGracia extends Quest } break; case PAPIKU: - if (st.isStarted()) - { + if (st.isStarted()) { htmltext = st.isCond(1) ? "32564-01.html" : "32564-03.html"; } break; case KEUCEREUS: - if (st.isStarted() && st.isCond(2)) - { + if (st.isStarted() && st.isCond(2)) { htmltext = "32548-01.html"; - } - else if (st.isCompleted()) - { + } else if (st.isCompleted()) { htmltext = "32548-03.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10268_ToTheSeedOfInfinity/Q10268_ToTheSeedOfInfinity.java b/src/main/java/com/l2jserver/datapack/quests/Q10268_ToTheSeedOfInfinity/Q10268_ToTheSeedOfInfinity.java index 1b3a1fbd05..52772b25ec 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10268_ToTheSeedOfInfinity/Q10268_ToTheSeedOfInfinity.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10268_ToTheSeedOfInfinity/Q10268_ToTheSeedOfInfinity.java @@ -29,16 +29,14 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by Kerberos. * @author nonom */ -public class Q10268_ToTheSeedOfInfinity extends Quest -{ +public class Q10268_ToTheSeedOfInfinity extends Quest { // NPCs private static final int KEUCEREUS = 32548; private static final int TEPIOS = 32603; // Item private static final int INTRODUCTION = 13811; - public Q10268_ToTheSeedOfInfinity() - { + public Q10268_ToTheSeedOfInfinity() { super(10268, Q10268_ToTheSeedOfInfinity.class.getSimpleName(), "To the Seed of Infinity"); addStartNpc(KEUCEREUS); addTalkId(KEUCEREUS, TEPIOS); @@ -46,16 +44,13 @@ public class Q10268_ToTheSeedOfInfinity extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - if (event.equals("32548-05.html")) - { + if (event.equals("32548-05.html")) { st.startQuest(); st.giveItems(INTRODUCTION, 1); } @@ -63,15 +58,12 @@ public class Q10268_ToTheSeedOfInfinity extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case KEUCEREUS: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() < 75) ? "32548-00.html" : "32548-01.htm"; break; @@ -84,8 +76,7 @@ public class Q10268_ToTheSeedOfInfinity extends Quest } break; case TEPIOS: - switch (st.getState()) - { + switch (st.getState()) { case State.STARTED: htmltext = "32530-01.html"; st.giveAdena(16671, true); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10269_ToTheSeedOfDestruction/Q10269_ToTheSeedOfDestruction.java b/src/main/java/com/l2jserver/datapack/quests/Q10269_ToTheSeedOfDestruction/Q10269_ToTheSeedOfDestruction.java index 82707693f4..73364ff585 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10269_ToTheSeedOfDestruction/Q10269_ToTheSeedOfDestruction.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10269_ToTheSeedOfDestruction/Q10269_ToTheSeedOfDestruction.java @@ -29,16 +29,14 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by Kerberos. * @author nonom */ -public class Q10269_ToTheSeedOfDestruction extends Quest -{ +public class Q10269_ToTheSeedOfDestruction extends Quest { // NPCs private static final int KEUCEREUS = 32548; private static final int ALLENOS = 32526; // Item private static final int INTRODUCTION = 13812; - public Q10269_ToTheSeedOfDestruction() - { + public Q10269_ToTheSeedOfDestruction() { super(10269, Q10269_ToTheSeedOfDestruction.class.getSimpleName(), "To the Seed of Destruction"); addStartNpc(KEUCEREUS); addTalkId(KEUCEREUS, ALLENOS); @@ -46,16 +44,13 @@ public class Q10269_ToTheSeedOfDestruction extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - if (event.equals("32548-05.html")) - { + if (event.equals("32548-05.html")) { st.startQuest(); st.giveItems(INTRODUCTION, 1); } @@ -63,15 +58,12 @@ public class Q10269_ToTheSeedOfDestruction extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case KEUCEREUS: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() < 75) ? "32548-00.html" : "32548-01.htm"; break; @@ -84,8 +76,7 @@ public class Q10269_ToTheSeedOfDestruction extends Quest } break; case ALLENOS: - switch (st.getState()) - { + switch (st.getState()) { case State.STARTED: htmltext = "32526-01.html"; st.giveAdena(29174, true); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10270_BirthOfTheSeed/Q10270_BirthOfTheSeed.java b/src/main/java/com/l2jserver/datapack/quests/Q10270_BirthOfTheSeed/Q10270_BirthOfTheSeed.java index 4b94de4a9c..34f8f4e35e 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10270_BirthOfTheSeed/Q10270_BirthOfTheSeed.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10270_BirthOfTheSeed/Q10270_BirthOfTheSeed.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.util.Util; * @author Adry_85 * @since 2.6.0.0 */ -public final class Q10270_BirthOfTheSeed extends Quest -{ +public final class Q10270_BirthOfTheSeed extends Quest { // NPCs private static final int ARTIUS = 32559; private static final int PLENOS = 32563; @@ -53,8 +52,7 @@ public final class Q10270_BirthOfTheSeed extends Quest // Location private static final Location INSTANCE_EXIT = new Location(-185057, 242821, 1576); - public Q10270_BirthOfTheSeed() - { + public Q10270_BirthOfTheSeed() { super(10270, Q10270_BirthOfTheSeed.class.getSimpleName(), "Birth of the Seed"); addStartNpc(PLENOS); addTalkId(PLENOS, GINBY, LELRIKIA, ARTIUS); @@ -63,35 +61,26 @@ public final class Q10270_BirthOfTheSeed extends Quest } @Override - public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) - { + public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isMemoState(2) && Util.checkIfInRange(1500, npc, player, false)) - { - switch (npc.getId()) - { - case YEHAN_KLODEKUS: - { - if (!st.hasQuestItems(YEHAN_KLODEKUS_BADGE)) - { + if ((st != null) && st.isMemoState(2) && Util.checkIfInRange(1500, npc, player, false)) { + switch (npc.getId()) { + case YEHAN_KLODEKUS: { + if (!st.hasQuestItems(YEHAN_KLODEKUS_BADGE)) { st.giveItems(YEHAN_KLODEKUS_BADGE, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } break; } - case YEHAN_KLANIKUS: - { - if (!st.hasQuestItems(YEHAN_KLANIKUS_BADGE)) - { + case YEHAN_KLANIKUS: { + if (!st.hasQuestItems(YEHAN_KLANIKUS_BADGE)) { st.giveItems(YEHAN_KLANIKUS_BADGE, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } break; } - case COHEMENES: - { - if (!st.hasQuestItems(LICH_CRYSTAL)) - { + case COHEMENES: { + if (!st.hasQuestItems(LICH_CRYSTAL)) { st.giveItems(LICH_CRYSTAL, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -102,56 +91,41 @@ public final class Q10270_BirthOfTheSeed extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "32563-02.htm": - { + switch (event) { + case "32563-02.htm": { htmltext = event; break; } - case "32563-03.htm": - { + case "32563-03.htm": { st.startQuest(false); st.setMemoState(1); playSound(player, Sound.ITEMSOUND_QUEST_MIDDLE); htmltext = event; break; } - case "32566-02.html": - { - if (st.isMemoState(4)) - { + case "32566-02.html": { + if (st.isMemoState(4)) { final QuestState st1 = player.getQuestState(Q10272_LightFragment.class.getSimpleName()); - if ((st1 == null) || (st1.isStarted() && (st1.getMemoState() < 10))) - { + if ((st1 == null) || (st1.isStarted() && (st1.getMemoState() < 10))) { htmltext = event; - } - else if ((st1.isStarted() && (st1.getMemoState() >= 10)) || st1.isCompleted()) - { + } else if ((st1.isStarted() && (st1.getMemoState() >= 10)) || st1.isCompleted()) { htmltext = "32566-03.html"; } } break; } - case "32566-04.html": - { - if (st.isMemoState(4)) - { - if (getQuestItemsCount(player, Inventory.ADENA_ID) < 10000) - { + case "32566-04.html": { + if (st.isMemoState(4)) { + if (getQuestItemsCount(player, Inventory.ADENA_ID) < 10000) { htmltext = event; - } - else - { + } else { takeItems(player, Inventory.ADENA_ID, 10000); st.setMemoState(5); htmltext = "32566-05.html"; @@ -159,37 +133,29 @@ public final class Q10270_BirthOfTheSeed extends Quest } break; } - case "32566-06.html": - { - if (st.isMemoState(5)) - { + case "32566-06.html": { + if (st.isMemoState(5)) { htmltext = event; } break; } case "32567-02.html": - case "32567-03.html": - { - if (st.isMemoState(10)) - { + case "32567-03.html": { + if (st.isMemoState(10)) { htmltext = event; } break; } - case "32567-04.html": - { - if (st.isMemoState(10)) - { + case "32567-04.html": { + if (st.isMemoState(10)) { st.setMemoState(11); st.setCond(5, true); htmltext = event; } break; } - case "32567-05.html": - { - if (st.isMemoState(11)) - { + case "32567-05.html": { + if (st.isMemoState(11)) { st.setMemoState(20); player.setInstanceId(0); player.teleToLocation(INSTANCE_EXIT, true); @@ -197,23 +163,18 @@ public final class Q10270_BirthOfTheSeed extends Quest } break; } - case "32559-02.html": - { - if (st.isMemoState(1)) - { + case "32559-02.html": { + if (st.isMemoState(1)) { st.setMemoState(2); st.setCond(2, true); htmltext = event; } break; } - case "32559-08.html": - { - if (st.isMemoState(3)) - { + case "32559-08.html": { + if (st.isMemoState(3)) { final QuestState st1 = player.getQuestState(Q10272_LightFragment.class.getSimpleName()); - if ((st1 == null) || (st1.isStarted() && (st1.getMemoState() < 10))) - { + if ((st1 == null) || (st1.isStarted() && (st1.getMemoState() < 10))) { st.setMemoState(4); st.setCond(4, true); htmltext = event; @@ -221,13 +182,10 @@ public final class Q10270_BirthOfTheSeed extends Quest } break; } - case "32559-10.html": - { - if (st.isMemoState(3)) - { + case "32559-10.html": { + if (st.isMemoState(3)) { final QuestState st1 = player.getQuestState(Q10272_LightFragment.class.getSimpleName()); - if ((st1 != null) && ((st1.isStarted() && (st1.getMemoState() >= 10)) || st1.isCompleted())) - { + if ((st1 != null) && ((st1.isStarted() && (st1.getMemoState() >= 10)) || st1.isCompleted())) { st.setMemoState(4); st.setCond(4, true); htmltext = event; @@ -240,130 +198,87 @@ public final class Q10270_BirthOfTheSeed extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { executeForEachPlayer(killer, npc, isSummon, true, false); return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCompleted()) - { - if (npc.getId() == PLENOS) - { + if (st.isCompleted()) { + if (npc.getId() == PLENOS) { htmltext = "32563-05.html"; - } - else if (npc.getId() == ARTIUS) - { + } else if (npc.getId() == ARTIUS) { htmltext = "32559-03.html"; } - } - else if (st.isCreated()) - { + } else if (st.isCreated()) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "32563-01.htm" : "32563-04.htm"; - } - else if (st.isStarted()) - { - switch (npc.getId()) - { - case PLENOS: - { - if (st.isMemoState(1)) - { + } else if (st.isStarted()) { + switch (npc.getId()) { + case PLENOS: { + if (st.isMemoState(1)) { htmltext = "32563-06.html"; } break; } - case GINBY: - { + case GINBY: { final int memoState = st.getMemoState(); - if (memoState == 4) - { + if (memoState == 4) { htmltext = "32566-01.html"; - } - else if (memoState < 4) - { + } else if (memoState < 4) { htmltext = "32566-07.html"; - } - else if (memoState == 5) - { + } else if (memoState == 5) { htmltext = "32566-06.html"; - } - else if ((memoState >= 10) && (memoState < 20)) - { + } else if ((memoState >= 10) && (memoState < 20)) { htmltext = "32566-08.html"; - } - else if (memoState == 20) - { + } else if (memoState == 20) { htmltext = "32566-09.html"; } break; } - case LELRIKIA: - { + case LELRIKIA: { final int memoState = st.getMemoState(); - if (memoState == 10) - { + if (memoState == 10) { htmltext = "32567-01.html"; - } - else if (memoState == 11) - { + } else if (memoState == 11) { htmltext = "32567-06.html"; } break; } - case ARTIUS: - { - switch (st.getMemoState()) - { - case 1: - { + case ARTIUS: { + switch (st.getMemoState()) { + case 1: { htmltext = "32559-01.html"; break; } - case 2: - { - if (hasQuestItems(player, YEHAN_KLODEKUS_BADGE, YEHAN_KLANIKUS_BADGE, LICH_CRYSTAL)) - { + case 2: { + if (hasQuestItems(player, YEHAN_KLODEKUS_BADGE, YEHAN_KLANIKUS_BADGE, LICH_CRYSTAL)) { st.setMemoState(3); st.setCond(3, true); takeItems(player, -1, YEHAN_KLODEKUS_BADGE, YEHAN_KLANIKUS_BADGE, LICH_CRYSTAL); htmltext = "32559-04.html"; - } - else - { - if (!hasQuestItems(player, YEHAN_KLODEKUS_BADGE) && !hasQuestItems(player, YEHAN_KLANIKUS_BADGE) && !hasQuestItems(player, LICH_CRYSTAL)) - { + } else { + if (!hasQuestItems(player, YEHAN_KLODEKUS_BADGE) && !hasQuestItems(player, YEHAN_KLANIKUS_BADGE) && !hasQuestItems(player, LICH_CRYSTAL)) { htmltext = "32559-05.html"; - } - else - { + } else { htmltext = "32559-06.html"; } } break; } - case 3: - { + case 3: { final QuestState st1 = player.getQuestState(Q10272_LightFragment.class.getSimpleName()); - if ((st1 == null) || (st1.isStarted() && (st1.getMemoState() < 10))) - { + if ((st1 == null) || (st1.isStarted() && (st1.getMemoState() < 10))) { htmltext = "32559-07.html"; - } - else if ((st1.isStarted() && (st1.getMemoState() >= 10)) || st1.isCompleted()) - { + } else if ((st1.isStarted() && (st1.getMemoState() >= 10)) || st1.isCompleted()) { htmltext = "32559-09.html"; } break; } - case 20: - { - if (player.getLevel() >= MIN_LEVEL) - { + case 20: { + if (player.getLevel() >= MIN_LEVEL) { giveAdena(player, 133590, true); addExpAndSp(player, 625343, 48222); st.exitQuest(false, true); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10271_TheEnvelopingDarkness/Q10271_TheEnvelopingDarkness.java b/src/main/java/com/l2jserver/datapack/quests/Q10271_TheEnvelopingDarkness/Q10271_TheEnvelopingDarkness.java index 9ac20d1975..0146f05983 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10271_TheEnvelopingDarkness/Q10271_TheEnvelopingDarkness.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10271_TheEnvelopingDarkness/Q10271_TheEnvelopingDarkness.java @@ -29,15 +29,13 @@ import com.l2jserver.gameserver.model.quest.State; * The Enveloping Darkness (10271) * @author Gladicek */ -public class Q10271_TheEnvelopingDarkness extends Quest -{ +public class Q10271_TheEnvelopingDarkness extends Quest { private static final int ORBYU = 32560; private static final int EL = 32556; private static final int MEDIBAL_CORPSE = 32528; private static final int MEDIBAL_DOCUMENT = 13852; - public Q10271_TheEnvelopingDarkness() - { + public Q10271_TheEnvelopingDarkness() { super(10271, Q10271_TheEnvelopingDarkness.class.getSimpleName(), "The Enveloping Darkness"); addStartNpc(ORBYU); addTalkId(ORBYU, EL, MEDIBAL_CORPSE); @@ -45,16 +43,13 @@ public class Q10271_TheEnvelopingDarkness extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - switch (event) - { + switch (event) { case "32560-05.html": st.startQuest(); break; @@ -62,8 +57,7 @@ public class Q10271_TheEnvelopingDarkness extends Quest st.setCond(2, true); break; case "32556-09.html": - if (st.hasQuestItems(MEDIBAL_DOCUMENT)) - { + if (st.hasQuestItems(MEDIBAL_DOCUMENT)) { st.takeItems(MEDIBAL_DOCUMENT, -1); st.setCond(4, true); } @@ -75,21 +69,17 @@ public class Q10271_TheEnvelopingDarkness extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case ORBYU: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = ((player.getLevel() >= 75) && player.hasQuestCompleted(Q10269_ToTheSeedOfDestruction.class.getSimpleName())) ? "32560-01.htm" : "32560-02.html"; break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "32560-05.html"; // TODO this html should most probably be different break; @@ -114,14 +104,10 @@ public class Q10271_TheEnvelopingDarkness extends Quest break; case EL: - if (st.isCompleted()) - { + if (st.isCompleted()) { htmltext = "32556-02.html"; - } - else if (st.isStarted()) - { - switch (st.getCond()) - { + } else if (st.isStarted()) { + switch (st.getCond()) { case 1: htmltext = "32556-01.html"; break; @@ -138,14 +124,10 @@ public class Q10271_TheEnvelopingDarkness extends Quest } break; case MEDIBAL_CORPSE: - if (st.isCompleted()) - { + if (st.isCompleted()) { htmltext = "32528-02.html"; - } - else if (st.isStarted()) - { - switch (st.getCond()) - { + } else if (st.isStarted()) { + switch (st.getCond()) { case 2: htmltext = "32528-01.html"; st.setCond(3, true); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10272_LightFragment/Q10272_LightFragment.java b/src/main/java/com/l2jserver/datapack/quests/Q10272_LightFragment/Q10272_LightFragment.java index c3aaec8937..1228a66598 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10272_LightFragment/Q10272_LightFragment.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10272_LightFragment/Q10272_LightFragment.java @@ -33,15 +33,13 @@ import com.l2jserver.gameserver.model.quest.State; * Light Fragment (10272) * @author Gladicek */ -public class Q10272_LightFragment extends Quest -{ +public class Q10272_LightFragment extends Quest { private static final int ORBYU = 32560; private static final int ARTIUS = 32559; private static final int GINBY = 32566; private static final int LELRIKIA = 32567; private static final int LEKON = 32557; - private static final int[] MOBS = - { + private static final int[] MOBS = { 22536, // Royal Guard Captain 22537, // Dragon Steed Troop Grand Magician 22538, // Dragon Steed Troop Commander @@ -63,8 +61,7 @@ public class Q10272_LightFragment extends Quest private static final int LIGHT_FRAGMENT = 13855; private static final double DROP_CHANCE = 60; - public Q10272_LightFragment() - { + public Q10272_LightFragment() { super(10272, Q10272_LightFragment.class.getSimpleName(), "Light Fragment"); addStartNpc(ORBYU); addTalkId(ORBYU, ARTIUS, GINBY, LELRIKIA, LEKON); @@ -73,63 +70,47 @@ public class Q10272_LightFragment extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - switch (event) - { - case "32560-06.html": - { + switch (event) { + case "32560-06.html": { st.startQuest(); break; } - case "32559-03.html": - { + case "32559-03.html": { st.setCond(2, true); break; } - case "32559-07.html": - { + case "32559-07.html": { st.setCond(3, true); break; } - case "pay": - { - if (st.getQuestItemsCount(Inventory.ADENA_ID) >= 10000) - { + case "pay": { + if (st.getQuestItemsCount(Inventory.ADENA_ID) >= 10000) { st.takeItems(Inventory.ADENA_ID, 10000); event = "32566-05.html"; - } - else - { + } else { event = "32566-04a.html"; } break; } - case "32567-04.html": - { + case "32567-04.html": { st.setCond(4, true); break; } - case "32559-12.html": - { + case "32559-12.html": { st.setCond(5, true); break; } - case "32557-03.html": - { - if (st.getQuestItemsCount(LIGHT_FRAGMENT_POWDER) >= 100) - { + case "32557-03.html": { + if (st.getQuestItemsCount(LIGHT_FRAGMENT_POWDER) >= 100) { st.takeItems(LIGHT_FRAGMENT_POWDER, 100); st.set("wait", "1"); - } - else - { + } else { event = "32557-04.html"; } break; @@ -141,29 +122,22 @@ public class Q10272_LightFragment extends Quest } @Override - public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isCond(5)) - { + if ((st != null) && st.isCond(5)) { final long count = st.getQuestItemsCount(FRAGMENT_POWDER); - if (count < 100) - { + if (count < 100) { int chance = (int) (rates().getRateQuestDrop() * DROP_CHANCE); int numItems = chance / 100; chance = chance % 100; - if (getRandom(100) < chance) - { + if (getRandom(100) < chance) { numItems++; } - if (numItems > 0) - { - if ((count + numItems) > 100) - { + if (numItems > 0) { + if ((count + numItems) > 100) { numItems = 100 - (int) count; } - if (numItems > 0) - { + if (numItems > 0) { st.giveItems(FRAGMENT_POWDER, numItems); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -174,23 +148,16 @@ public class Q10272_LightFragment extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); QuestState st = getQuestState(player, true); - switch (npc.getId()) - { - case ORBYU: - { - switch (st.getState()) - { + switch (npc.getId()) { + case ORBYU: { + switch (st.getState()) { case State.CREATED: - if (player.getLevel() < 75) - { + if (player.getLevel() < 75) { htmltext = "32560-03.html"; - } - else - { + } else { htmltext = (player.hasQuestCompleted(Q10271_TheEnvelopingDarkness.class.getSimpleName())) ? "32560-01.htm" : "32560-02.html"; } break; @@ -203,16 +170,11 @@ public class Q10272_LightFragment extends Quest } break; } - case ARTIUS: - { - if (st.isCompleted()) - { + case ARTIUS: { + if (st.isCompleted()) { htmltext = "32559-19.html"; - } - else - { - switch (st.getCond()) - { + } else { + switch (st.getCond()) { case 1: htmltext = "32559-01.html"; break; @@ -226,23 +188,17 @@ public class Q10272_LightFragment extends Quest htmltext = "32559-10.html"; break; case 5: - if (st.getQuestItemsCount(FRAGMENT_POWDER) >= 100) - { + if (st.getQuestItemsCount(FRAGMENT_POWDER) >= 100) { htmltext = "32559-15.html"; st.setCond(6, true); - } - else - { + } else { htmltext = st.hasQuestItems(FRAGMENT_POWDER) ? "32559-14.html" : "32559-13.html"; } break; case 6: - if (st.getQuestItemsCount(LIGHT_FRAGMENT_POWDER) < 100) - { + if (st.getQuestItemsCount(LIGHT_FRAGMENT_POWDER) < 100) { htmltext = "32559-16.html"; - } - else - { + } else { htmltext = "32559-17.html"; st.setCond(7, true); } @@ -260,10 +216,8 @@ public class Q10272_LightFragment extends Quest } break; } - case GINBY: - { - switch (st.getCond()) - { + case GINBY: { + switch (st.getCond()) { case 1: case 2: htmltext = "32566-02.html"; @@ -283,10 +237,8 @@ public class Q10272_LightFragment extends Quest } break; } - case LELRIKIA: - { - switch (st.getCond()) - { + case LELRIKIA: { + switch (st.getCond()) { case 3: htmltext = "32567-01.html"; break; @@ -296,20 +248,15 @@ public class Q10272_LightFragment extends Quest } break; } - case LEKON: - { - switch (st.getCond()) - { + case LEKON: { + switch (st.getCond()) { case 7: - if (st.getInt("wait") == 1) - { + if (st.getInt("wait") == 1) { htmltext = "32557-05.html"; st.unset("wait"); st.setCond(8, true); st.giveItems(LIGHT_FRAGMENT, 1); - } - else - { + } else { htmltext = "32557-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10273_GoodDayToFly/Q10273_GoodDayToFly.java b/src/main/java/com/l2jserver/datapack/quests/Q10273_GoodDayToFly/Q10273_GoodDayToFly.java index 1056acf815..94c880eea3 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10273_GoodDayToFly/Q10273_GoodDayToFly.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10273_GoodDayToFly/Q10273_GoodDayToFly.java @@ -31,13 +31,11 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by Kerberos v1.0 on 2009/04/25 * @author nonom */ -public class Q10273_GoodDayToFly extends Quest -{ +public class Q10273_GoodDayToFly extends Quest { // NPC private static final int LEKON = 32557; // Monsters - private static final int[] MOBS = - { + private static final int[] MOBS = { 22614, // Vulture Rider 22615, // Vulture Rider }; @@ -48,8 +46,7 @@ public class Q10273_GoodDayToFly extends Quest private static final SkillHolder AURA_BIRD_FALCON = new SkillHolder(5982, 1); private static final SkillHolder AURA_BIRD_OWL = new SkillHolder(5983, 1); - public Q10273_GoodDayToFly() - { + public Q10273_GoodDayToFly() { super(10273, Q10273_GoodDayToFly.class.getSimpleName(), "Good Day to Fly"); addStartNpc(LEKON); addTalkId(LEKON); @@ -58,16 +55,13 @@ public class Q10273_GoodDayToFly extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - switch (event) - { + switch (event) { case "32557-06.htm": st.startQuest(); break; @@ -80,8 +74,7 @@ public class Q10273_GoodDayToFly extends Quest AURA_BIRD_OWL.getSkill().applyEffects(player, player); break; case "32557-13.html": - switch (st.getInt("transform")) - { + switch (st.getInt("transform")) { case 1: AURA_BIRD_FALCON.getSkill().applyEffects(player, player); break; @@ -95,24 +88,18 @@ public class Q10273_GoodDayToFly extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); - if ((st == null) || !st.isStarted()) - { + if ((st == null) || !st.isStarted()) { return null; } final long count = st.getQuestItemsCount(MARK); - if (st.isCond(1) && (count < 5)) - { + if (st.isCond(1) && (count < 5)) { st.giveItems(MARK, 1); - if (count == 4) - { + if (count == 4) { st.setCond(2, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -120,13 +107,11 @@ public class Q10273_GoodDayToFly extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); final int transform = st.getInt("transform"); - switch (st.getState()) - { + switch (st.getState()) { case State.COMPLETED: htmltext = "32557-0a.html"; break; @@ -134,27 +119,19 @@ public class Q10273_GoodDayToFly extends Quest htmltext = (player.getLevel() < 75) ? "32557-00.html" : "32557-01.htm"; break; default: - if (st.getQuestItemsCount(MARK) >= 5) - { + if (st.getQuestItemsCount(MARK) >= 5) { htmltext = "32557-14.html"; - if (transform == 1) - { + if (transform == 1) { st.giveItems(13553, 1); - } - else if (transform == 2) - { + } else if (transform == 2) { st.giveItems(13554, 1); } st.giveItems(13857, 1); st.addExpAndSp(25160, 2525); st.exitQuest(false, true); - } - else if (transform == 0) - { + } else if (transform == 0) { htmltext = "32557-07.html"; - } - else - { + } else { htmltext = "32557-11.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10274_CollectingInTheAir/Q10274_CollectingInTheAir.java b/src/main/java/com/l2jserver/datapack/quests/Q10274_CollectingInTheAir/Q10274_CollectingInTheAir.java index 46f2c3f3a6..269511f28f 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10274_CollectingInTheAir/Q10274_CollectingInTheAir.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10274_CollectingInTheAir/Q10274_CollectingInTheAir.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.model.skills.Skill; * Original Jython script by Kerberos v1.0 on 2009/04/26. * @author nonom */ -public class Q10274_CollectingInTheAir extends Quest -{ +public class Q10274_CollectingInTheAir extends Quest { // NPC private static final int LEKON = 32557; // Items @@ -43,8 +42,7 @@ public class Q10274_CollectingInTheAir extends Quest private static final int BLUE = 13859; private static final int GREEN = 13860; // Monsters - private static final int MOBS[] = - { + private static final int MOBS[] = { 18684, // Red Star Stone 18685, // Red Star Stone 18686, // Red Star Stone @@ -56,8 +54,7 @@ public class Q10274_CollectingInTheAir extends Quest 18692, // Green Star Stone }; - public Q10274_CollectingInTheAir() - { + public Q10274_CollectingInTheAir() { super(10274, Q10274_CollectingInTheAir.class.getSimpleName(), "Collecting in the Air"); addStartNpc(LEKON); addTalkId(LEKON); @@ -66,16 +63,13 @@ public class Q10274_CollectingInTheAir extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - if (event.equals("32557-03.html")) - { + if (event.equals("32557-03.html")) { st.startQuest(); st.giveItems(SCROLL, 8); } @@ -83,18 +77,14 @@ public class Q10274_CollectingInTheAir extends Quest } @Override - public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) - { + public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) { final QuestState st = getQuestState(caster, false); - if ((st == null) || !st.isStarted()) - { + if ((st == null) || !st.isStarted()) { return null; } - if (st.isCond(1) && (skill.getId() == 2630)) - { - switch (npc.getId()) - { + if (st.isCond(1) && (skill.getId() == 2630)) { + switch (npc.getId()) { case 18684: case 18685: case 18686: @@ -118,12 +108,10 @@ public class Q10274_CollectingInTheAir extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); QuestState st = getQuestState(player, true); - switch (st.getState()) - { + switch (st.getState()) { case State.COMPLETED: htmltext = "32557-0a.html"; break; @@ -131,15 +119,12 @@ public class Q10274_CollectingInTheAir extends Quest htmltext = ((player.getLevel() >= 75) && player.hasQuestCompleted(Q10273_GoodDayToFly.class.getSimpleName())) ? "32557-01.htm" : "32557-00.html"; break; case State.STARTED: - if ((st.getQuestItemsCount(RED) + st.getQuestItemsCount(BLUE) + st.getQuestItemsCount(GREEN)) >= 8) - { + if ((st.getQuestItemsCount(RED) + st.getQuestItemsCount(BLUE) + st.getQuestItemsCount(GREEN)) >= 8) { htmltext = "32557-05.html"; st.giveItems(13728, 1); st.addExpAndSp(25160, 2525); st.exitQuest(false, true); - } - else - { + } else { htmltext = "32557-04.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10275_ContainingTheAttributePower/Q10275_ContainingTheAttributePower.java b/src/main/java/com/l2jserver/datapack/quests/Q10275_ContainingTheAttributePower/Q10275_ContainingTheAttributePower.java index 700aa0f2c2..6de982880c 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10275_ContainingTheAttributePower/Q10275_ContainingTheAttributePower.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10275_ContainingTheAttributePower/Q10275_ContainingTheAttributePower.java @@ -34,8 +34,7 @@ import com.l2jserver.gameserver.util.Util; * Original Jython script by Kerberos v1.0 on 2009/05/03. * @author nonom */ -public class Q10275_ContainingTheAttributePower extends Quest -{ +public class Q10275_ContainingTheAttributePower extends Quest { // NPCs private static final int HOLLY = 30839; private static final int WEBER = 31307; @@ -52,8 +51,7 @@ public class Q10275_ContainingTheAttributePower extends Quest private static final SkillHolder BLESSING_OF_FIRE = new SkillHolder(2635, 1); private static final SkillHolder BLESSING_OF_EARTH = new SkillHolder(2636, 1); - public Q10275_ContainingTheAttributePower() - { + public Q10275_ContainingTheAttributePower() { super(10275, Q10275_ContainingTheAttributePower.class.getSimpleName(), "Containing the Attribute Power"); addStartNpc(HOLLY, WEBER); addTalkId(HOLLY, WEBER, YIN, YANG); @@ -62,17 +60,14 @@ public class Q10275_ContainingTheAttributePower extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { + switch (event) { case "30839-02.html": case "31307-02.html": st.startQuest(); @@ -92,16 +87,14 @@ public class Q10275_ContainingTheAttributePower extends Quest st.giveItems(YANGSWORD, 1, AttributeType.EARTH.getId(), 10); break; case "32325-06.html": - if (st.hasQuestItems(YINSWORD)) - { + if (st.hasQuestItems(YINSWORD)) { st.takeItems(YINSWORD, 1); htmltext = "32325-07.html"; } st.giveItems(YINSWORD, 1, AttributeType.FIRE.getId(), 10); break; case "32326-06.html": - if (st.hasQuestItems(YANGSWORD)) - { + if (st.hasQuestItems(YANGSWORD)) { st.takeItems(YANGSWORD, 1); htmltext = "32326-07.html"; } @@ -119,8 +112,7 @@ public class Q10275_ContainingTheAttributePower extends Quest break; } - if (Util.isDigit(event)) - { + if (Util.isDigit(event)) { htmltext = Integer.toString(npc.getId()) + "-1" + event + ".html"; st.giveItems(10520 + Integer.valueOf(event), 2); st.addExpAndSp(202160, 20375); @@ -131,40 +123,29 @@ public class Q10275_ContainingTheAttributePower extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } - switch (npc.getId()) - { + switch (npc.getId()) { case AIR: - if ((st.isCond(8) || st.isCond(10)) && (st.getItemEquipped(Inventory.PAPERDOLL_RHAND) == YANGSWORD) && (st.getQuestItemsCount(SOULPIECEAIR) < 6) && (getRandom(100) < 30)) - { + if ((st.isCond(8) || st.isCond(10)) && (st.getItemEquipped(Inventory.PAPERDOLL_RHAND) == YANGSWORD) && (st.getQuestItemsCount(SOULPIECEAIR) < 6) && (getRandom(100) < 30)) { st.giveItems(SOULPIECEAIR, 1); - if (st.getQuestItemsCount(SOULPIECEAIR) >= 6) - { + if (st.getQuestItemsCount(SOULPIECEAIR) >= 6) { st.setCond(st.getCond() + 1, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } break; case WATER: - if (((st.getCond() >= 3) || (st.getCond() <= 5)) && (st.getItemEquipped(Inventory.PAPERDOLL_RHAND) == YINSWORD) && (st.getQuestItemsCount(SOULPIECEWATER) < 6) && (getRandom(100) < 30)) - { + if (((st.getCond() >= 3) || (st.getCond() <= 5)) && (st.getItemEquipped(Inventory.PAPERDOLL_RHAND) == YINSWORD) && (st.getQuestItemsCount(SOULPIECEWATER) < 6) && (getRandom(100) < 30)) { st.giveItems(SOULPIECEWATER, 1); - if (st.getQuestItemsCount(SOULPIECEWATER) >= 6) - { + if (st.getQuestItemsCount(SOULPIECEWATER) >= 6) { st.setCond(st.getCond() + 1, true); - } - else - { + } else { st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } } @@ -175,22 +156,17 @@ public class Q10275_ContainingTheAttributePower extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { - case HOLLY: - { - switch (st.getState()) - { + switch (npc.getId()) { + case HOLLY: { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() > 75) ? "30839-01.htm" : "30839-00.html"; break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "30839-03.html"; break; @@ -205,16 +181,13 @@ public class Q10275_ContainingTheAttributePower extends Quest } break; } - case WEBER: - { - switch (st.getState()) - { + case WEBER: { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() > 75) ? "31307-01.htm" : "31307-00.html"; break; case State.STARTED: - switch (st.getCond()) - { + switch (st.getCond()) { case 1: htmltext = "31307-03.html"; break; @@ -229,12 +202,9 @@ public class Q10275_ContainingTheAttributePower extends Quest } break; } - case YIN: - { - if (st.isStarted()) - { - switch (st.getCond()) - { + case YIN: { + if (st.isStarted()) { + switch (st.getCond()) { case 2: htmltext = "32325-01.html"; break; @@ -254,12 +224,9 @@ public class Q10275_ContainingTheAttributePower extends Quest } break; } - case YANG: - { - if (st.isStarted()) - { - switch (st.getCond()) - { + case YANG: { + if (st.isStarted()) { + switch (st.getCond()) { case 7: htmltext = "32326-01.html"; break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10276_MutatedKaneusGludio/Q10276_MutatedKaneusGludio.java b/src/main/java/com/l2jserver/datapack/quests/Q10276_MutatedKaneusGludio/Q10276_MutatedKaneusGludio.java index 7b547c5016..782a0fde74 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10276_MutatedKaneusGludio/Q10276_MutatedKaneusGludio.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10276_MutatedKaneusGludio/Q10276_MutatedKaneusGludio.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by Gnacik on 2010-06-29. * @author nonom */ -public class Q10276_MutatedKaneusGludio extends Quest -{ +public class Q10276_MutatedKaneusGludio extends Quest { // NPCs private static final int BATHIS = 30332; private static final int ROHMER = 30344; @@ -44,8 +43,7 @@ public class Q10276_MutatedKaneusGludio extends Quest private static final int TISSUE_TK = 13830; private static final int TISSUE_OA = 13831; - public Q10276_MutatedKaneusGludio() - { + public Q10276_MutatedKaneusGludio() { super(10276, Q10276_MutatedKaneusGludio.class.getSimpleName(), "Mutated Kaneus - Gludio"); addStartNpc(BATHIS); addTalkId(BATHIS, ROHMER); @@ -54,16 +52,13 @@ public class Q10276_MutatedKaneusGludio extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - switch (event) - { + switch (event) { case "30332-03.htm": st.startQuest(); break; @@ -76,49 +71,38 @@ public class Q10276_MutatedKaneusGludio extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { QuestState st = getQuestState(killer, false); - if (st == null) - { + if (st == null) { return null; } final int npcId = npc.getId(); - if (killer.getParty() != null) - { + if (killer.getParty() != null) { final List<QuestState> PartyMembers = new ArrayList<>(); - for (L2PcInstance member : killer.getParty().getMembers()) - { + for (L2PcInstance member : killer.getParty().getMembers()) { st = getQuestState(member, false); - if ((st != null) && st.isStarted() && (((npcId == TOMLAN_KAMOS) && !st.hasQuestItems(TISSUE_TK)) || ((npcId == OL_ARIOSH) && !st.hasQuestItems(TISSUE_OA)))) - { + if ((st != null) && st.isStarted() && (((npcId == TOMLAN_KAMOS) && !st.hasQuestItems(TISSUE_TK)) || ((npcId == OL_ARIOSH) && !st.hasQuestItems(TISSUE_OA)))) { PartyMembers.add(st); } } - if (!PartyMembers.isEmpty()) - { + if (!PartyMembers.isEmpty()) { rewardItem(npcId, PartyMembers.get(getRandom(PartyMembers.size()))); } - } - else if (st.isStarted()) - { + } else if (st.isStarted()) { rewardItem(npcId, st); } return null; } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case BATHIS: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() > 17) ? "30332-01.htm" : "30332-00.htm"; break; @@ -131,8 +115,7 @@ public class Q10276_MutatedKaneusGludio extends Quest } break; case ROHMER: - switch (st.getState()) - { + switch (st.getState()) { case State.STARTED: htmltext = (st.hasQuestItems(TISSUE_TK) && st.hasQuestItems(TISSUE_OA)) ? "30344-02.htm" : "30344-01.htm"; break; @@ -151,15 +134,11 @@ public class Q10276_MutatedKaneusGludio extends Quest * @param npcId the ID of the killed monster * @param st the quest state of the killer or party member */ - private final void rewardItem(int npcId, QuestState st) - { - if ((npcId == TOMLAN_KAMOS) && !st.hasQuestItems(TISSUE_TK)) - { + private final void rewardItem(int npcId, QuestState st) { + if ((npcId == TOMLAN_KAMOS) && !st.hasQuestItems(TISSUE_TK)) { st.giveItems(TISSUE_TK, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - } - else if ((npcId == OL_ARIOSH) && !st.hasQuestItems(TISSUE_OA)) - { + } else if ((npcId == OL_ARIOSH) && !st.hasQuestItems(TISSUE_OA)) { st.giveItems(TISSUE_OA, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10277_MutatedKaneusDion/Q10277_MutatedKaneusDion.java b/src/main/java/com/l2jserver/datapack/quests/Q10277_MutatedKaneusDion/Q10277_MutatedKaneusDion.java index bbb98e93dc..25ee0758b3 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10277_MutatedKaneusDion/Q10277_MutatedKaneusDion.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10277_MutatedKaneusDion/Q10277_MutatedKaneusDion.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by Gnacik on 2010-06-29. * @author nonom */ -public class Q10277_MutatedKaneusDion extends Quest -{ +public class Q10277_MutatedKaneusDion extends Quest { // NPCs private static final int LUKAS = 30071; private static final int MIRIEN = 30461; @@ -44,8 +43,7 @@ public class Q10277_MutatedKaneusDion extends Quest private static final int TISSUE_CH = 13832; private static final int TISSUE_SF = 13833; - public Q10277_MutatedKaneusDion() - { + public Q10277_MutatedKaneusDion() { super(10277, Q10277_MutatedKaneusDion.class.getSimpleName(), "Mutated Kaneus - Dion"); addStartNpc(LUKAS); addTalkId(LUKAS, MIRIEN); @@ -54,16 +52,13 @@ public class Q10277_MutatedKaneusDion extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - switch (event) - { + switch (event) { case "30071-03.html": st.startQuest(); break; @@ -76,49 +71,38 @@ public class Q10277_MutatedKaneusDion extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { QuestState st = getQuestState(killer, false); - if (st == null) - { + if (st == null) { return super.onKill(npc, killer, isSummon); } final int npcId = npc.getId(); - if (killer.getParty() != null) - { + if (killer.getParty() != null) { final List<QuestState> PartyMembers = new ArrayList<>(); - for (L2PcInstance member : killer.getParty().getMembers()) - { + for (L2PcInstance member : killer.getParty().getMembers()) { st = getQuestState(member, false); - if ((st != null) && st.isStarted() && (((npcId == CRIMSON_HATU) && !st.hasQuestItems(TISSUE_CH)) || ((npcId == SEER_FLOUROS) && !st.hasQuestItems(TISSUE_SF)))) - { + if ((st != null) && st.isStarted() && (((npcId == CRIMSON_HATU) && !st.hasQuestItems(TISSUE_CH)) || ((npcId == SEER_FLOUROS) && !st.hasQuestItems(TISSUE_SF)))) { PartyMembers.add(st); } } - if (!PartyMembers.isEmpty()) - { + if (!PartyMembers.isEmpty()) { rewardItem(npcId, PartyMembers.get(getRandom(PartyMembers.size()))); } - } - else if (st.isStarted()) - { + } else if (st.isStarted()) { rewardItem(npcId, st); } return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case LUKAS: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() > 27) ? "30071-01.htm" : "30071-00.html"; break; @@ -131,8 +115,7 @@ public class Q10277_MutatedKaneusDion extends Quest } break; case MIRIEN: - switch (st.getState()) - { + switch (st.getState()) { case State.STARTED: htmltext = (st.hasQuestItems(TISSUE_CH) && st.hasQuestItems(TISSUE_SF)) ? "30461-02.html" : "30461-01.html"; break; @@ -151,15 +134,11 @@ public class Q10277_MutatedKaneusDion extends Quest * @param npcId the ID of the killed monster * @param st the quest state of the killer or party member */ - private final void rewardItem(int npcId, QuestState st) - { - if ((npcId == CRIMSON_HATU) && !st.hasQuestItems(TISSUE_CH)) - { + private final void rewardItem(int npcId, QuestState st) { + if ((npcId == CRIMSON_HATU) && !st.hasQuestItems(TISSUE_CH)) { st.giveItems(TISSUE_CH, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - } - else if ((npcId == SEER_FLOUROS) && !st.hasQuestItems(TISSUE_SF)) - { + } else if ((npcId == SEER_FLOUROS) && !st.hasQuestItems(TISSUE_SF)) { st.giveItems(TISSUE_SF, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10278_MutatedKaneusHeine/Q10278_MutatedKaneusHeine.java b/src/main/java/com/l2jserver/datapack/quests/Q10278_MutatedKaneusHeine/Q10278_MutatedKaneusHeine.java index 5b963d6005..88c43db4fe 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10278_MutatedKaneusHeine/Q10278_MutatedKaneusHeine.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10278_MutatedKaneusHeine/Q10278_MutatedKaneusHeine.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by Gnacik on 2010-06-29. * @author nonom */ -public class Q10278_MutatedKaneusHeine extends Quest -{ +public class Q10278_MutatedKaneusHeine extends Quest { // NPCs private static final int GOSTA = 30916; private static final int MINEVIA = 30907; @@ -44,8 +43,7 @@ public class Q10278_MutatedKaneusHeine extends Quest private static final int TISSUE_BO = 13834; private static final int TISSUE_WB = 13835; - public Q10278_MutatedKaneusHeine() - { + public Q10278_MutatedKaneusHeine() { super(10278, Q10278_MutatedKaneusHeine.class.getSimpleName(), "Mutated Kaneus - Heine"); addStartNpc(GOSTA); addTalkId(GOSTA, MINEVIA); @@ -54,16 +52,13 @@ public class Q10278_MutatedKaneusHeine extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - switch (event) - { + switch (event) { case "30916-03.htm": st.startQuest(); break; @@ -76,49 +71,38 @@ public class Q10278_MutatedKaneusHeine extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { QuestState st = getQuestState(killer, false); - if (st == null) - { + if (st == null) { return null; } final int npcId = npc.getId(); - if (killer.getParty() != null) - { + if (killer.getParty() != null) { final List<QuestState> PartyMembers = new ArrayList<>(); - for (L2PcInstance member : killer.getParty().getMembers()) - { + for (L2PcInstance member : killer.getParty().getMembers()) { st = getQuestState(member, false); - if ((st != null) && st.isStarted() && (((npcId == BLADE_OTIS) && !st.hasQuestItems(TISSUE_BO)) || ((npcId == WEIRD_BUNEI) && !st.hasQuestItems(TISSUE_WB)))) - { + if ((st != null) && st.isStarted() && (((npcId == BLADE_OTIS) && !st.hasQuestItems(TISSUE_BO)) || ((npcId == WEIRD_BUNEI) && !st.hasQuestItems(TISSUE_WB)))) { PartyMembers.add(st); } } - if (!PartyMembers.isEmpty()) - { + if (!PartyMembers.isEmpty()) { rewardItem(npcId, PartyMembers.get(getRandom(PartyMembers.size()))); } - } - else if (st.isStarted()) - { + } else if (st.isStarted()) { rewardItem(npcId, st); } return null; } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case GOSTA: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() > 37) ? "30916-01.htm" : "30916-00.htm"; break; @@ -131,8 +115,7 @@ public class Q10278_MutatedKaneusHeine extends Quest } break; case MINEVIA: - switch (st.getState()) - { + switch (st.getState()) { case State.STARTED: htmltext = (st.hasQuestItems(TISSUE_BO) && st.hasQuestItems(TISSUE_WB)) ? "30907-02.htm" : "30907-01.htm"; break; @@ -151,15 +134,11 @@ public class Q10278_MutatedKaneusHeine extends Quest * @param npcId the ID of the killed monster * @param st the quest state of the killer or party member */ - private final void rewardItem(int npcId, QuestState st) - { - if ((npcId == BLADE_OTIS) && !st.hasQuestItems(TISSUE_BO)) - { + private final void rewardItem(int npcId, QuestState st) { + if ((npcId == BLADE_OTIS) && !st.hasQuestItems(TISSUE_BO)) { st.giveItems(TISSUE_BO, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - } - else if ((npcId == WEIRD_BUNEI) && !st.hasQuestItems(TISSUE_WB)) - { + } else if ((npcId == WEIRD_BUNEI) && !st.hasQuestItems(TISSUE_WB)) { st.giveItems(TISSUE_WB, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10279_MutatedKaneusOren/Q10279_MutatedKaneusOren.java b/src/main/java/com/l2jserver/datapack/quests/Q10279_MutatedKaneusOren/Q10279_MutatedKaneusOren.java index 16ad67782d..3d206a99ba 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10279_MutatedKaneusOren/Q10279_MutatedKaneusOren.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10279_MutatedKaneusOren/Q10279_MutatedKaneusOren.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by Gnacik on 2010-06-29. * @author nonom */ -public class Q10279_MutatedKaneusOren extends Quest -{ +public class Q10279_MutatedKaneusOren extends Quest { // NPCs private static final int MOUEN = 30196; private static final int ROVIA = 30189; @@ -44,8 +43,7 @@ public class Q10279_MutatedKaneusOren extends Quest private static final int TISSUE_KA = 13836; private static final int TISSUE_KM = 13837; - public Q10279_MutatedKaneusOren() - { + public Q10279_MutatedKaneusOren() { super(10279, Q10279_MutatedKaneusOren.class.getSimpleName(), "Mutated Kaneus - Oren"); addStartNpc(MOUEN); addTalkId(MOUEN, ROVIA); @@ -54,16 +52,13 @@ public class Q10279_MutatedKaneusOren extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - switch (event) - { + switch (event) { case "30196-03.htm": st.startQuest(); break; @@ -76,49 +71,38 @@ public class Q10279_MutatedKaneusOren extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { QuestState st = getQuestState(killer, false); - if (st == null) - { + if (st == null) { return null; } final int npcId = npc.getId(); - if (killer.getParty() != null) - { + if (killer.getParty() != null) { final List<QuestState> PartyMembers = new ArrayList<>(); - for (L2PcInstance member : killer.getParty().getMembers()) - { + for (L2PcInstance member : killer.getParty().getMembers()) { st = getQuestState(member, false); - if ((st != null) && st.isStarted() && (((npcId == KAIM_ABIGORE) && !st.hasQuestItems(TISSUE_KA)) || ((npcId == KNIGHT_MONTAGNAR) && !st.hasQuestItems(TISSUE_KM)))) - { + if ((st != null) && st.isStarted() && (((npcId == KAIM_ABIGORE) && !st.hasQuestItems(TISSUE_KA)) || ((npcId == KNIGHT_MONTAGNAR) && !st.hasQuestItems(TISSUE_KM)))) { PartyMembers.add(st); } } - if (!PartyMembers.isEmpty()) - { + if (!PartyMembers.isEmpty()) { rewardItem(npcId, PartyMembers.get(getRandom(PartyMembers.size()))); } - } - else if (st.isStarted()) - { + } else if (st.isStarted()) { rewardItem(npcId, st); } return null; } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case MOUEN: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() > 47) ? "30196-01.htm" : "30196-00.htm"; break; @@ -131,8 +115,7 @@ public class Q10279_MutatedKaneusOren extends Quest } break; case ROVIA: - switch (st.getState()) - { + switch (st.getState()) { case State.STARTED: htmltext = (st.hasQuestItems(TISSUE_KA) && st.hasQuestItems(TISSUE_KM)) ? "30189-02.htm" : "30189-01.htm"; break; @@ -151,15 +134,11 @@ public class Q10279_MutatedKaneusOren extends Quest * @param npcId the ID of the killed monster * @param st the quest state of the killer or party member */ - private final void rewardItem(int npcId, QuestState st) - { - if ((npcId == KAIM_ABIGORE) && !st.hasQuestItems(TISSUE_KA)) - { + private final void rewardItem(int npcId, QuestState st) { + if ((npcId == KAIM_ABIGORE) && !st.hasQuestItems(TISSUE_KA)) { st.giveItems(TISSUE_KA, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - } - else if ((npcId == KNIGHT_MONTAGNAR) && !st.hasQuestItems(TISSUE_KM)) - { + } else if ((npcId == KNIGHT_MONTAGNAR) && !st.hasQuestItems(TISSUE_KM)) { st.giveItems(TISSUE_KM, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10280_MutatedKaneusSchuttgart/Q10280_MutatedKaneusSchuttgart.java b/src/main/java/com/l2jserver/datapack/quests/Q10280_MutatedKaneusSchuttgart/Q10280_MutatedKaneusSchuttgart.java index 69ad2240fe..4909a9a87a 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10280_MutatedKaneusSchuttgart/Q10280_MutatedKaneusSchuttgart.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10280_MutatedKaneusSchuttgart/Q10280_MutatedKaneusSchuttgart.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by Gnacik on 2010-06-29. * @author nonom */ -public class Q10280_MutatedKaneusSchuttgart extends Quest -{ +public class Q10280_MutatedKaneusSchuttgart extends Quest { // NPCs private static final int VISHOTSKY = 31981; private static final int ATRAXIA = 31972; @@ -44,8 +43,7 @@ public class Q10280_MutatedKaneusSchuttgart extends Quest private static final int TISSUE_VS = 13838; private static final int TISSUE_KB = 13839; - public Q10280_MutatedKaneusSchuttgart() - { + public Q10280_MutatedKaneusSchuttgart() { super(10280, Q10280_MutatedKaneusSchuttgart.class.getSimpleName(), "Mutated Kaneus - Schuttgart"); addStartNpc(VISHOTSKY); addTalkId(VISHOTSKY, ATRAXIA); @@ -54,16 +52,13 @@ public class Q10280_MutatedKaneusSchuttgart extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - switch (event) - { + switch (event) { case "31981-03.htm": st.startQuest(); break; @@ -76,49 +71,38 @@ public class Q10280_MutatedKaneusSchuttgart extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { QuestState st = getQuestState(killer, false); - if (st == null) - { + if (st == null) { return null; } final int npcId = npc.getId(); - if (killer.getParty() != null) - { + if (killer.getParty() != null) { final List<QuestState> PartyMembers = new ArrayList<>(); - for (L2PcInstance member : killer.getParty().getMembers()) - { + for (L2PcInstance member : killer.getParty().getMembers()) { st = getQuestState(member, false); - if ((st != null) && st.isStarted() && (((npcId == VENOMOUS_STORACE) && !st.hasQuestItems(TISSUE_VS)) || ((npcId == KEL_BILETTE) && !st.hasQuestItems(TISSUE_KB)))) - { + if ((st != null) && st.isStarted() && (((npcId == VENOMOUS_STORACE) && !st.hasQuestItems(TISSUE_VS)) || ((npcId == KEL_BILETTE) && !st.hasQuestItems(TISSUE_KB)))) { PartyMembers.add(st); } } - if (!PartyMembers.isEmpty()) - { + if (!PartyMembers.isEmpty()) { rewardItem(npcId, PartyMembers.get(getRandom(PartyMembers.size()))); } - } - else if (st.isStarted()) - { + } else if (st.isStarted()) { rewardItem(npcId, st); } return null; } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case VISHOTSKY: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() > 57) ? "31981-01.htm" : "31981-00.htm"; break; @@ -131,8 +115,7 @@ public class Q10280_MutatedKaneusSchuttgart extends Quest } break; case ATRAXIA: - switch (st.getState()) - { + switch (st.getState()) { case State.STARTED: htmltext = (st.hasQuestItems(TISSUE_VS) && st.hasQuestItems(TISSUE_KB)) ? "31972-02.htm" : "31972-01.htm"; break; @@ -151,15 +134,11 @@ public class Q10280_MutatedKaneusSchuttgart extends Quest * @param npcId the ID of the killed monster * @param st the quest state of the killer or party member */ - private final void rewardItem(int npcId, QuestState st) - { - if ((npcId == VENOMOUS_STORACE) && !st.hasQuestItems(TISSUE_VS)) - { + private final void rewardItem(int npcId, QuestState st) { + if ((npcId == VENOMOUS_STORACE) && !st.hasQuestItems(TISSUE_VS)) { st.giveItems(TISSUE_VS, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); - } - else if ((npcId == KEL_BILETTE) && !st.hasQuestItems(TISSUE_KB)) - { + } else if ((npcId == KEL_BILETTE) && !st.hasQuestItems(TISSUE_KB)) { st.giveItems(TISSUE_KB, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10281_MutatedKaneusRune/Q10281_MutatedKaneusRune.java b/src/main/java/com/l2jserver/datapack/quests/Q10281_MutatedKaneusRune/Q10281_MutatedKaneusRune.java index c18c46ecca..a1c53c3d24 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10281_MutatedKaneusRune/Q10281_MutatedKaneusRune.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10281_MutatedKaneusRune/Q10281_MutatedKaneusRune.java @@ -33,8 +33,7 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by Gnacik on 2010-06-29. * @author nonom */ -public class Q10281_MutatedKaneusRune extends Quest -{ +public class Q10281_MutatedKaneusRune extends Quest { // NPCs private static final int MATHIAS = 31340; private static final int KAYAN = 31335; @@ -42,8 +41,7 @@ public class Q10281_MutatedKaneusRune extends Quest // Item private static final int TISSUE_WA = 13840; - public Q10281_MutatedKaneusRune() - { + public Q10281_MutatedKaneusRune() { super(10281, Q10281_MutatedKaneusRune.class.getSimpleName(), "Mutated Kaneus - Rune"); addStartNpc(MATHIAS); addTalkId(MATHIAS, KAYAN); @@ -52,16 +50,13 @@ public class Q10281_MutatedKaneusRune extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - switch (event) - { + switch (event) { case "31340-03.htm": st.startQuest(); break; @@ -74,49 +69,38 @@ public class Q10281_MutatedKaneusRune extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { QuestState st = getQuestState(killer, false); - if (st == null) - { + if (st == null) { return null; } final int npcId = npc.getId(); - if (killer.getParty() != null) - { + if (killer.getParty() != null) { final List<QuestState> PartyMembers = new ArrayList<>(); - for (L2PcInstance member : killer.getParty().getMembers()) - { + for (L2PcInstance member : killer.getParty().getMembers()) { st = getQuestState(member, false); - if ((st != null) && st.isStarted() && !st.hasQuestItems(TISSUE_WA)) - { + if ((st != null) && st.isStarted() && !st.hasQuestItems(TISSUE_WA)) { PartyMembers.add(st); } } - if (!PartyMembers.isEmpty()) - { + if (!PartyMembers.isEmpty()) { rewardItem(npcId, PartyMembers.get(getRandom(PartyMembers.size()))); } - } - else if (st.isStarted() && !st.hasQuestItems(TISSUE_WA)) - { + } else if (st.isStarted() && !st.hasQuestItems(TISSUE_WA)) { rewardItem(npcId, st); } return null; } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case MATHIAS: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() > 67) ? "31340-01.htm" : "31340-00.htm"; break; @@ -129,8 +113,7 @@ public class Q10281_MutatedKaneusRune extends Quest } break; case KAYAN: - switch (st.getState()) - { + switch (st.getState()) { case State.STARTED: htmltext = st.hasQuestItems(TISSUE_WA) ? "31335-02.htm" : "31335-01.htm"; break; @@ -149,8 +132,7 @@ public class Q10281_MutatedKaneusRune extends Quest * @param npcId the ID of the killed monster * @param st the quest state of the killer or party member */ - private final void rewardItem(int npcId, QuestState st) - { + private final void rewardItem(int npcId, QuestState st) { st.giveItems(TISSUE_WA, 1); st.playSound(Sound.ITEMSOUND_QUEST_ITEMGET); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10282_ToTheSeedOfAnnihilation/Q10282_ToTheSeedOfAnnihilation.java b/src/main/java/com/l2jserver/datapack/quests/Q10282_ToTheSeedOfAnnihilation/Q10282_ToTheSeedOfAnnihilation.java index af3f35606c..9a585dde9b 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10282_ToTheSeedOfAnnihilation/Q10282_ToTheSeedOfAnnihilation.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10282_ToTheSeedOfAnnihilation/Q10282_ToTheSeedOfAnnihilation.java @@ -29,16 +29,14 @@ import com.l2jserver.gameserver.model.quest.State; * Original Jython script by Gnacik 2010-08-13 Based on Freya PTS. * @author nonom */ -public class Q10282_ToTheSeedOfAnnihilation extends Quest -{ +public class Q10282_ToTheSeedOfAnnihilation extends Quest { // NPCs private static final int KBALDIR = 32733; private static final int KLEMIS = 32734; // Item private static final int SOA_ORDERS = 15512; - public Q10282_ToTheSeedOfAnnihilation() - { + public Q10282_ToTheSeedOfAnnihilation() { super(10282, Q10282_ToTheSeedOfAnnihilation.class.getSimpleName(), "To the Seed of Annihilation"); addStartNpc(KBALDIR); addTalkId(KBALDIR, KLEMIS); @@ -46,17 +44,14 @@ public class Q10282_ToTheSeedOfAnnihilation extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return htmltext; } - switch (event) - { + switch (event) { case "32733-07.htm": st.startQuest(); st.giveItems(SOA_ORDERS, 1); @@ -70,20 +65,15 @@ public class Q10282_ToTheSeedOfAnnihilation extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); final int npcId = npc.getId(); - switch (st.getState()) - { + switch (st.getState()) { case State.COMPLETED: - if (npcId == KBALDIR) - { + if (npcId == KBALDIR) { htmltext = "32733-09.htm"; - } - else if (npcId == KLEMIS) - { + } else if (npcId == KLEMIS) { htmltext = "32734-03.htm"; } break; @@ -91,14 +81,10 @@ public class Q10282_ToTheSeedOfAnnihilation extends Quest htmltext = (player.getLevel() < 84) ? "32733-00.htm" : "32733-01.htm"; break; case State.STARTED: - if (st.isCond(1)) - { - if (npcId == KBALDIR) - { + if (st.isCond(1)) { + if (npcId == KBALDIR) { htmltext = "32733-08.htm"; - } - else if (npcId == KLEMIS) - { + } else if (npcId == KLEMIS) { htmltext = "32734-01.htm"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10283_RequestOfIceMerchant/Q10283_RequestOfIceMerchant.java b/src/main/java/com/l2jserver/datapack/quests/Q10283_RequestOfIceMerchant/Q10283_RequestOfIceMerchant.java index 7c868eb51e..bbadd231b7 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10283_RequestOfIceMerchant/Q10283_RequestOfIceMerchant.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10283_RequestOfIceMerchant/Q10283_RequestOfIceMerchant.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * @author Adry_85 * @since 2.6.0.0 */ -public class Q10283_RequestOfIceMerchant extends Quest -{ +public class Q10283_RequestOfIceMerchant extends Quest { // NPCs private static final int RAFFORTY = 32020; private static final int KIER = 32022; @@ -41,18 +40,15 @@ public class Q10283_RequestOfIceMerchant extends Quest private boolean isBusy = false; private int talker = 0; - public Q10283_RequestOfIceMerchant() - { + public Q10283_RequestOfIceMerchant() { super(10283, Q10283_RequestOfIceMerchant.class.getSimpleName(), "Request of Ice Merchant"); addStartNpc(RAFFORTY); addTalkId(RAFFORTY, KIER, JINIA); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if ((npc.getId() == JINIA) && "DESPAWN".equals(event)) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if ((npc.getId() == JINIA) && "DESPAWN".equals(event)) { isBusy = false; talker = 0; npc.deleteMe(); @@ -60,76 +56,59 @@ public class Q10283_RequestOfIceMerchant extends Quest } final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "32020-03.htm": - { + switch (event) { + case "32020-03.htm": { htmltext = event; break; } - case "32020-04.htm": - { + case "32020-04.htm": { st.startQuest(); st.setMemoState(1); htmltext = event; break; } case "32020-05.html": - case "32020-06.html": - { - if (st.isMemoState(1)) - { + case "32020-06.html": { + if (st.isMemoState(1)) { htmltext = event; } break; } - case "32020-07.html": - { - if (st.isMemoState(1)) - { + case "32020-07.html": { + if (st.isMemoState(1)) { st.setMemoState(2); st.setCond(2); htmltext = event; } break; } - case "32022-02.html": - { - if (st.isMemoState(2)) - { - if (!isBusy) - { + case "32022-02.html": { + if (st.isMemoState(2)) { + if (!isBusy) { isBusy = true; talker = player.getObjectId(); st.setCond(3); addSpawn(JINIA, 104476, -107535, -3688, 44954, false, 0, false); - } - else - { + } else { htmltext = (talker == player.getObjectId() ? event : "32022-03.html"); } } break; } case "32760-02.html": - case "32760-03.html": - { - if (st.isMemoState(2)) - { + case "32760-03.html": { + if (st.isMemoState(2)) { htmltext = event; } break; } - case "32760-04.html": - { - if (st.isMemoState(2)) - { + case "32760-04.html": { + if (st.isMemoState(2)) { giveAdena(player, 190000, true); addExpAndSp(player, 627000, 50300); st.exitQuest(false, true); @@ -143,53 +122,35 @@ public class Q10283_RequestOfIceMerchant extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCompleted()) - { - if (npc.getId() == RAFFORTY) - { + if (st.isCompleted()) { + if (npc.getId() == RAFFORTY) { htmltext = "32020-02.html"; - } - else if (npc.getId() == JINIA) - { + } else if (npc.getId() == JINIA) { htmltext = "32760-06.html"; } - } - else if (st.isCreated()) - { + } else if (st.isCreated()) { htmltext = ((player.getLevel() >= MIN_LEVEL) && player.hasQuestCompleted(Q00115_TheOtherSideOfTruth.class.getSimpleName())) ? "32020-01.htm" : "32020-08.htm"; - } - else if (st.isStarted()) - { - switch (npc.getId()) - { - case RAFFORTY: - { - if (st.isMemoState(1)) - { + } else if (st.isStarted()) { + switch (npc.getId()) { + case RAFFORTY: { + if (st.isMemoState(1)) { htmltext = "32020-09.html"; - } - else if (st.isMemoState(2)) - { + } else if (st.isMemoState(2)) { htmltext = "32020-10.html"; } break; } - case KIER: - { - if (st.isMemoState(2)) - { + case KIER: { + if (st.isMemoState(2)) { htmltext = "32022-01.html"; } break; } - case JINIA: - { - if (st.isMemoState(2)) - { + case JINIA: { + if (st.isMemoState(2)) { htmltext = (talker == player.getObjectId() ? "32760-01.html" : "32760-05.html"); } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10284_AcquisitionOfDivineSword/Q10284_AcquisitionOfDivineSword.java b/src/main/java/com/l2jserver/datapack/quests/Q10284_AcquisitionOfDivineSword/Q10284_AcquisitionOfDivineSword.java index f346ef77ae..a84aaf323c 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10284_AcquisitionOfDivineSword/Q10284_AcquisitionOfDivineSword.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10284_AcquisitionOfDivineSword/Q10284_AcquisitionOfDivineSword.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * @author Adry_85 * @since 2.6.0.0 */ -public final class Q10284_AcquisitionOfDivineSword extends Quest -{ +public final class Q10284_AcquisitionOfDivineSword extends Quest { // NPCs private static final int RAFFORTY = 32020; private static final int KRUN = 32653; @@ -46,8 +45,7 @@ public final class Q10284_AcquisitionOfDivineSword extends Quest // Location private static final Location EXIT_LOC = new Location(113793, -109342, -845, 0); - public Q10284_AcquisitionOfDivineSword() - { + public Q10284_AcquisitionOfDivineSword() { super(10284, Q10284_AcquisitionOfDivineSword.class.getSimpleName(), "Acquisition of Divine Sword"); addStartNpc(RAFFORTY); addTalkId(RAFFORTY, JINIA, TARUN, KRUN); @@ -55,19 +53,15 @@ public final class Q10284_AcquisitionOfDivineSword extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "32020-02.html": - { + switch (event) { + case "32020-02.html": { st.startQuest(); st.setMemoState(1); st.setMemoStateEx(1, 0); // Custom line @@ -82,91 +76,64 @@ public final class Q10284_AcquisitionOfDivineSword extends Quest case "32760-03a.html": case "32760-03b.html": case "32760-04a.html": - case "32760-04b.html": - { - if (st.isMemoState(1)) - { + case "32760-04b.html": { + if (st.isMemoState(1)) { htmltext = event; } break; } - case "32760-02c.html": - { - if (st.isMemoState(1)) - { + case "32760-02c.html": { + if (st.isMemoState(1)) { st.setMemoStateEx(1, 1); htmltext = event; } break; } - case "another_story": - { - if (st.isMemoState(1)) - { + case "another_story": { + if (st.isMemoState(1)) { final int memoStateEx1 = st.getMemoStateEx(1); final int memoStateEx2 = st.getMemoStateEx(2); final int memoStateEx3 = st.getMemoStateEx(3); - if ((memoStateEx1 == 1) && (memoStateEx2 == 0) && (memoStateEx3 == 0)) - { + if ((memoStateEx1 == 1) && (memoStateEx2 == 0) && (memoStateEx3 == 0)) { htmltext = "32760-05a.html"; - } - else if ((memoStateEx1 == 0) && (memoStateEx2 == 1) && (memoStateEx3 == 0)) - { + } else if ((memoStateEx1 == 0) && (memoStateEx2 == 1) && (memoStateEx3 == 0)) { htmltext = "32760-05b.html"; - } - else if ((memoStateEx1 == 0) && (memoStateEx2 == 0) && (memoStateEx3 == 1)) - { + } else if ((memoStateEx1 == 0) && (memoStateEx2 == 0) && (memoStateEx3 == 1)) { htmltext = "32760-05c.html"; - } - else if ((memoStateEx1 == 0) && (memoStateEx2 == 1) && (memoStateEx3 == 1)) - { + } else if ((memoStateEx1 == 0) && (memoStateEx2 == 1) && (memoStateEx3 == 1)) { htmltext = "32760-05d.html"; - } - else if ((memoStateEx1 == 1) && (memoStateEx2 == 0) && (memoStateEx3 == 1)) - { + } else if ((memoStateEx1 == 1) && (memoStateEx2 == 0) && (memoStateEx3 == 1)) { htmltext = "32760-05e.html"; - } - else if ((memoStateEx1 == 1) && (memoStateEx2 == 1) && (memoStateEx3 == 0)) - { + } else if ((memoStateEx1 == 1) && (memoStateEx2 == 1) && (memoStateEx3 == 0)) { htmltext = "32760-05f.html"; - } - else if ((memoStateEx1 == 1) && (memoStateEx2 == 1) && (memoStateEx3 == 1)) - { + } else if ((memoStateEx1 == 1) && (memoStateEx2 == 1) && (memoStateEx3 == 1)) { htmltext = "32760-05g.html"; } } break; } - case "32760-03c.html": - { - if (st.isMemoState(1)) - { + case "32760-03c.html": { + if (st.isMemoState(1)) { st.setMemoStateEx(2, 1); htmltext = event; } break; } - case "32760-04c.html": - { - if (st.isMemoState(1)) - { + case "32760-04c.html": { + if (st.isMemoState(1)) { st.setMemoStateEx(3, 1); htmltext = event; } break; } - case "32760-06.html": - { - if (st.isMemoState(1) && (st.isMemoStateEx(1, 1)) && (st.isMemoStateEx(2, 1)) && (st.isMemoStateEx(3, 1))) - { + case "32760-06.html": { + if (st.isMemoState(1) && (st.isMemoStateEx(1, 1)) && (st.isMemoStateEx(2, 1)) && (st.isMemoStateEx(3, 1))) { htmltext = event; } break; } - case "32760-07.html": - { - if (st.isMemoState(1) && (st.isMemoStateEx(1, 1)) && (st.isMemoStateEx(2, 1)) && (st.isMemoStateEx(3, 1))) - { + case "32760-07.html": { + if (st.isMemoState(1) && (st.isMemoStateEx(1, 1)) && (st.isMemoStateEx(2, 1)) && (st.isMemoStateEx(3, 1))) { st.setMemoStateEx(1, 0); st.setMemoStateEx(2, 0); st.setMemoStateEx(3, 0); @@ -179,10 +146,8 @@ public final class Q10284_AcquisitionOfDivineSword extends Quest } break; } - case "exit_instance": - { - if (st.isMemoState(2)) - { + case "exit_instance": { + if (st.isMemoState(2)) { player.teleToLocation(EXIT_LOC, 0); } break; @@ -190,10 +155,8 @@ public final class Q10284_AcquisitionOfDivineSword extends Quest case "32654-02.html": case "32654-03.html": case "32653-02.html": - case "32653-03.html": - { - if (st.isMemoState(2)) - { + case "32653-03.html": { + if (st.isMemoState(2)) { htmltext = event; } break; @@ -203,95 +166,62 @@ public final class Q10284_AcquisitionOfDivineSword extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCompleted()) - { - if (npc.getId() == RAFFORTY) - { + if (st.isCompleted()) { + if (npc.getId() == RAFFORTY) { htmltext = "32020-05.html"; } - } - else if (st.isCreated()) - { + } else if (st.isCreated()) { htmltext = ((player.getLevel() >= MIN_LEVEL) && player.hasQuestCompleted(Q10283_RequestOfIceMerchant.class.getSimpleName())) ? "32020-01.htm" : "32020-04.html"; - } - else if (st.isStarted()) - { - switch (npc.getId()) - { - case RAFFORTY: - { - switch (st.getMemoState()) - { - case 1: - { + } else if (st.isStarted()) { + switch (npc.getId()) { + case RAFFORTY: { + switch (st.getMemoState()) { + case 1: { htmltext = (player.getLevel() >= MIN_LEVEL) ? "32020-06.html" : "32020-08.html"; break; } - case 2: - { + case 2: { htmltext = "32020-07.html"; break; } } break; } - case JINIA: - { - if (st.isMemoState(1)) - { + case JINIA: { + if (st.isMemoState(1)) { final int memoStateEx1 = st.getMemoStateEx(1); final int memoStateEx2 = st.getMemoStateEx(2); final int memoStateEx3 = st.getMemoStateEx(3); - if ((memoStateEx1 == 0) && (memoStateEx2 == 0) && (memoStateEx3 == 0)) - { + if ((memoStateEx1 == 0) && (memoStateEx2 == 0) && (memoStateEx3 == 0)) { htmltext = "32760-01.html"; - } - else if ((memoStateEx1 == 1) && (memoStateEx2 == 0) && (memoStateEx3 == 0)) - { + } else if ((memoStateEx1 == 1) && (memoStateEx2 == 0) && (memoStateEx3 == 0)) { htmltext = "32760-01a.html"; - } - else if ((memoStateEx1 == 0) && (memoStateEx2 == 1) && (memoStateEx3 == 0)) - { + } else if ((memoStateEx1 == 0) && (memoStateEx2 == 1) && (memoStateEx3 == 0)) { htmltext = "32760-01b.html"; - } - else if ((memoStateEx1 == 0) && (memoStateEx2 == 0) && (memoStateEx3 == 1)) - { + } else if ((memoStateEx1 == 0) && (memoStateEx2 == 0) && (memoStateEx3 == 1)) { htmltext = "32760-01c.html"; - } - else if ((memoStateEx1 == 0) && (memoStateEx2 == 1) && (memoStateEx3 == 1)) - { + } else if ((memoStateEx1 == 0) && (memoStateEx2 == 1) && (memoStateEx3 == 1)) { htmltext = "32760-01d.html"; - } - else if ((memoStateEx1 == 1) && (memoStateEx2 == 0) && (memoStateEx3 == 1)) - { + } else if ((memoStateEx1 == 1) && (memoStateEx2 == 0) && (memoStateEx3 == 1)) { htmltext = "32760-01e.html"; - } - else if ((memoStateEx1 == 1) && (memoStateEx2 == 1) && (memoStateEx3 == 0)) - { + } else if ((memoStateEx1 == 1) && (memoStateEx2 == 1) && (memoStateEx3 == 0)) { htmltext = "32760-01f.html"; - } - else if ((memoStateEx1 == 1) && (memoStateEx2 == 1) && (memoStateEx3 == 1)) - { + } else if ((memoStateEx1 == 1) && (memoStateEx2 == 1) && (memoStateEx3 == 1)) { htmltext = "32760-01g.html"; } } break; } - case TARUN: - { - switch (st.getMemoState()) - { - case 2: - { + case TARUN: { + switch (st.getMemoState()) { + case 2: { htmltext = (player.getLevel() >= MIN_LEVEL) ? "32654-01.html" : "32654-05.html"; break; } - case 3: - { + case 3: { st.giveAdena(296425, true); st.addExpAndSp(921805, 82230); st.exitQuest(false, true); @@ -301,17 +231,13 @@ public final class Q10284_AcquisitionOfDivineSword extends Quest } break; } - case KRUN: - { - switch (st.getMemoState()) - { - case 2: - { + case KRUN: { + switch (st.getMemoState()) { + case 2: { htmltext = (player.getLevel() >= MIN_LEVEL) ? "32653-01.html" : "32653-05.html"; break; } - case 3: - { + case 3: { st.giveAdena(296425, true); st.addExpAndSp(921805, 82230); st.exitQuest(false, true); diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10285_MeetingSirra/Q10285_MeetingSirra.java b/src/main/java/com/l2jserver/datapack/quests/Q10285_MeetingSirra/Q10285_MeetingSirra.java index d6f5e8082a..27d27cacfd 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10285_MeetingSirra/Q10285_MeetingSirra.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10285_MeetingSirra/Q10285_MeetingSirra.java @@ -35,8 +35,7 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * @author Adry_85 * @since 2.6.0.0 */ -public final class Q10285_MeetingSirra extends Quest -{ +public final class Q10285_MeetingSirra extends Quest { // NPCs private static final int RAFFORTY = 32020; private static final int FREYAS_STEWARD = 32029; @@ -50,60 +49,48 @@ public final class Q10285_MeetingSirra extends Quest private static final Location EXIT_LOC = new Location(113793, -109342, -845, 0); private static final Location FREYA_LOC = new Location(103045, -124361, -2768, 0); - public Q10285_MeetingSirra() - { + public Q10285_MeetingSirra() { super(10285, Q10285_MeetingSirra.class.getSimpleName(), "Meeting Sirra"); addStartNpc(RAFFORTY); addTalkId(RAFFORTY, JINIA, KEGOR, SIRRA, JINIA2, FREYAS_STEWARD); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "32020-02.htm": - { + switch (event) { + case "32020-02.htm": { htmltext = event; break; } - case "32020-03.htm": - { + case "32020-03.htm": { st.startQuest(); st.setMemoState(1); st.setMemoStateEx(1, 0); htmltext = event; break; } - case "32760-02.html": - { - if (st.isMemoState(1) && st.isMemoStateEx(1, 0)) - { + case "32760-02.html": { + if (st.isMemoState(1) && st.isMemoStateEx(1, 0)) { st.setMemoStateEx(1, 1); st.setCond(3, true); htmltext = event; } break; } - case "32760-05.html": - { - if (st.isMemoState(1) && st.isMemoStateEx(1, 2)) - { + case "32760-05.html": { + if (st.isMemoState(1) && st.isMemoStateEx(1, 2)) { htmltext = event; } break; } - case "32760-06.html": - { - if (st.isMemoState(1) && st.isMemoStateEx(1, 2)) - { + case "32760-06.html": { + if (st.isMemoState(1) && st.isMemoStateEx(1, 2)) { final L2Npc sirra = addSpawn(SIRRA, -23905, -8790, -5384, 56238, false, 0, false, npc.getInstanceId()); sirra.broadcastPacket(new NpcSay(sirra.getObjectId(), Say2.NPC_ALL, sirra.getId(), NpcStringId.THERES_NOTHING_YOU_CANT_SAY_I_CANT_LISTEN_TO_YOU_ANYMORE)); st.setMemoStateEx(1, 3); @@ -114,28 +101,22 @@ public final class Q10285_MeetingSirra extends Quest } case "32760-09.html": case "32760-10.html": - case "32760-11.html": - { - if (st.isMemoState(1) && st.isMemoStateEx(1, 4)) - { + case "32760-11.html": { + if (st.isMemoState(1) && st.isMemoStateEx(1, 4)) { htmltext = event; } break; } - case "32760-12.html": - { - if (st.isMemoState(1) && st.isMemoStateEx(1, 4)) - { + case "32760-12.html": { + if (st.isMemoState(1) && st.isMemoStateEx(1, 4)) { st.setMemoStateEx(1, 5); st.setCond(7, true); htmltext = event; } break; } - case "32760-13.html": - { - if (st.isMemoState(1) && st.isMemoStateEx(1, 5)) - { + case "32760-13.html": { + if (st.isMemoState(1) && st.isMemoStateEx(1, 5)) { st.setMemoStateEx(1, 0); st.setMemoState(2); final InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); @@ -145,19 +126,15 @@ public final class Q10285_MeetingSirra extends Quest } break; } - case "32760-14.html": - { - if (st.isMemoState(2)) - { + case "32760-14.html": { + if (st.isMemoState(2)) { player.teleToLocation(EXIT_LOC, 0); htmltext = event; } break; } - case "32761-02.html": - { - if (st.isMemoState(1) && st.isMemoStateEx(1, 1)) - { + case "32761-02.html": { + if (st.isMemoState(1) && st.isMemoStateEx(1, 1)) { st.setMemoStateEx(1, 2); st.setCond(4, true); htmltext = event; @@ -169,18 +146,14 @@ public final class Q10285_MeetingSirra extends Quest case "32762-04.html": case "32762-05.html": case "32762-06.html": - case "32762-07.html": - { - if (st.isMemoState(1) && st.isMemoStateEx(1, 3)) - { + case "32762-07.html": { + if (st.isMemoState(1) && st.isMemoStateEx(1, 3)) { htmltext = event; } break; } - case "32762-08.html": - { - if (st.isMemoState(1) && st.isMemoStateEx(1, 3)) - { + case "32762-08.html": { + if (st.isMemoState(1) && st.isMemoStateEx(1, 3)) { st.setMemoStateEx(1, 4); st.setCond(6, true); htmltext = event; @@ -189,18 +162,14 @@ public final class Q10285_MeetingSirra extends Quest break; } case "32781-02.html": - case "32781-03.html": - { - if (st.isMemoState(2)) - { + case "32781-03.html": { + if (st.isMemoState(2)) { htmltext = event; } break; } - case "TELEPORT": - { - if (player.getLevel() >= MIN_LEVEL) - { + case "TELEPORT": { + if (player.getLevel() >= MIN_LEVEL) { player.teleToLocation(FREYA_LOC, 0); } break; @@ -210,41 +179,28 @@ public final class Q10285_MeetingSirra extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCompleted()) - { - if (npc.getId() == RAFFORTY) - { + if (st.isCompleted()) { + if (npc.getId() == RAFFORTY) { htmltext = "32020-05.htm"; } - } - else if (st.isCreated()) - { + } else if (st.isCreated()) { htmltext = ((player.getLevel() >= MIN_LEVEL) && player.hasQuestCompleted(Q10284_AcquisitionOfDivineSword.class.getSimpleName())) ? "32020-01.htm" : "32020-04.htm"; - } - else if (st.isStarted()) - { - switch (npc.getId()) - { - case RAFFORTY: - { - switch (st.getMemoState()) - { - case 1: - { + } else if (st.isStarted()) { + switch (npc.getId()) { + case RAFFORTY: { + switch (st.getMemoState()) { + case 1: { htmltext = (player.getLevel() >= MIN_LEVEL) ? "32020-06.html" : "32020-09.html"; break; } - case 2: - { + case 2: { htmltext = "32020-07.html"; break; } - case 3: - { + case 3: { st.giveAdena(283425, true); st.addExpAndSp(939075, 83855); st.exitQuest(false, true); @@ -254,39 +210,30 @@ public final class Q10285_MeetingSirra extends Quest } break; } - case JINIA: - { - if (st.isMemoState(1)) - { - switch (st.getMemoStateEx(1)) - { - case 0: - { + case JINIA: { + if (st.isMemoState(1)) { + switch (st.getMemoStateEx(1)) { + case 0: { htmltext = "32760-01.html"; break; } - case 1: - { + case 1: { htmltext = "32760-03.html"; break; } - case 2: - { + case 2: { htmltext = "32760-04.html"; break; } - case 3: - { + case 3: { htmltext = "32760-07.html"; break; } - case 4: - { + case 4: { htmltext = "32760-08.html"; break; } - case 5: - { + case 5: { htmltext = "32760-15.html"; break; } @@ -294,24 +241,18 @@ public final class Q10285_MeetingSirra extends Quest } break; } - case KEGOR: - { - if (st.isMemoState(1)) - { - switch (st.getMemoStateEx(1)) - { - case 1: - { + case KEGOR: { + if (st.isMemoState(1)) { + switch (st.getMemoStateEx(1)) { + case 1: { htmltext = "32761-01.html"; break; } - case 2: - { + case 2: { htmltext = "32761-03.html"; break; } - case 3: - { + case 3: { htmltext = "32761-04.html"; break; } @@ -319,37 +260,26 @@ public final class Q10285_MeetingSirra extends Quest } break; } - case SIRRA: - { - if (st.isMemoState(1)) - { - if (st.isMemoStateEx(1, 3)) - { + case SIRRA: { + if (st.isMemoState(1)) { + if (st.isMemoStateEx(1, 3)) { htmltext = "32762-01.html"; - } - else if (st.isMemoStateEx(1, 4)) - { + } else if (st.isMemoStateEx(1, 4)) { htmltext = "32762-09.html"; } } break; } - case JINIA2: - { - if (st.isMemoState(2)) - { + case JINIA2: { + if (st.isMemoState(2)) { htmltext = "32781-01.html"; - } - else if (st.isMemoState(3)) - { + } else if (st.isMemoState(3)) { htmltext = "32781-04.html"; } break; } - case FREYAS_STEWARD: - { - if (st.isMemoState(2)) - { + case FREYAS_STEWARD: { + if (st.isMemoState(2)) { htmltext = "32029-01.html"; st.setCond(8, true); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10286_ReunionWithSirra/Q10286_ReunionWithSirra.java b/src/main/java/com/l2jserver/datapack/quests/Q10286_ReunionWithSirra/Q10286_ReunionWithSirra.java index 0eb34f9ce5..be732b94a4 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10286_ReunionWithSirra/Q10286_ReunionWithSirra.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10286_ReunionWithSirra/Q10286_ReunionWithSirra.java @@ -35,8 +35,7 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; * @author Adry_85 * @since 2.6.0.0 */ -public final class Q10286_ReunionWithSirra extends Quest -{ +public final class Q10286_ReunionWithSirra extends Quest { // NPCs private static final int RAFFORTY = 32020; private static final int JINIA = 32760; @@ -49,8 +48,7 @@ public final class Q10286_ReunionWithSirra extends Quest // Location private static final Location EXIT_LOC = new Location(113793, -109342, -845, 0); - public Q10286_ReunionWithSirra() - { + public Q10286_ReunionWithSirra() { super(10286, Q10286_ReunionWithSirra.class.getSimpleName(), "Reunion with Sirra"); addStartNpc(RAFFORTY); addTalkId(RAFFORTY, JINIA, SIRRA, JINIA2); @@ -58,28 +56,22 @@ public final class Q10286_ReunionWithSirra extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "32020-02.htm": - { + switch (event) { + case "32020-02.htm": { st.startQuest(); st.setMemoState(1); htmltext = event; break; } - case "32020-03.html": - { - if (st.isMemoState(1)) - { + case "32020-03.html": { + if (st.isMemoState(1)) { st.setMemoStateEx(1, 0); htmltext = event; } @@ -87,18 +79,14 @@ public final class Q10286_ReunionWithSirra extends Quest } case "32760-02.html": case "32760-03.html": - case "32760-04.html": - { - if (st.isMemoState(1)) - { + case "32760-04.html": { + if (st.isMemoState(1)) { htmltext = event; } break; } - case "32760-05.html": - { - if (st.isMemoState(1)) - { + case "32760-05.html": { + if (st.isMemoState(1)) { final L2Npc sirra = addSpawn(SIRRA, -23905, -8790, -5384, 56238, false, 0, false, npc.getInstanceId()); sirra.broadcastPacket(new NpcSay(sirra.getObjectId(), Say2.NPC_ALL, sirra.getId(), NpcStringId.YOU_ADVANCED_BRAVELY_BUT_GOT_SUCH_A_TINY_RESULT_HOHOHO)); st.setMemoStateEx(1, 1); @@ -107,10 +95,8 @@ public final class Q10286_ReunionWithSirra extends Quest } break; } - case "32760-07.html": - { - if (st.isMemoState(1) && st.isMemoStateEx(1, 2)) - { + case "32760-07.html": { + if (st.isMemoState(1) && st.isMemoStateEx(1, 2)) { st.setMemoState(2); final InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); world.removeAllowed(player.getObjectId()); @@ -119,10 +105,8 @@ public final class Q10286_ReunionWithSirra extends Quest } break; } - case "32760-08.html": - { - if (st.isMemoState(2)) - { + case "32760-08.html": { + if (st.isMemoState(2)) { st.setCond(5, true); player.teleToLocation(EXIT_LOC, 0); htmltext = event; // TODO: missing "jinia_npc_q10286_10.htm" @@ -130,20 +114,15 @@ public final class Q10286_ReunionWithSirra extends Quest break; } case "32762-02.html": - case "32762-03.html": - { - if (st.isMemoState(1) && st.isMemoStateEx(1, 1)) - { + case "32762-03.html": { + if (st.isMemoState(1) && st.isMemoStateEx(1, 1)) { htmltext = event; } break; } - case "32762-04.html": - { - if (st.isMemoState(1) && st.isMemoStateEx(1, 1)) - { - if (!st.hasQuestItems(BLACK_FROZEN_CORE)) - { + case "32762-04.html": { + if (st.isMemoState(1) && st.isMemoStateEx(1, 1)) { + if (!st.hasQuestItems(BLACK_FROZEN_CORE)) { st.giveItems(BLACK_FROZEN_CORE, 5); } st.setMemoStateEx(1, 2); @@ -153,10 +132,8 @@ public final class Q10286_ReunionWithSirra extends Quest break; } case "32781-02.html": - case "32781-03.html": - { - if (st.isMemoState(2)) - { + case "32781-03.html": { + if (st.isMemoState(2)) { htmltext = event; } break; @@ -166,55 +143,37 @@ public final class Q10286_ReunionWithSirra extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCompleted()) - { - if (npc.getId() == RAFFORTY) - { + if (st.isCompleted()) { + if (npc.getId() == RAFFORTY) { htmltext = "32020-05.html"; } - } - else if (st.isCreated()) - { + } else if (st.isCreated()) { htmltext = ((player.getLevel() >= MIN_LEVEL) && player.hasQuestCompleted(Q10285_MeetingSirra.class.getSimpleName())) ? "32020-01.htm" : "32020-04.htm"; - } - else if (st.isStarted()) - { - switch (npc.getId()) - { - case RAFFORTY: - { - if (st.isMemoState(1)) - { + } else if (st.isStarted()) { + switch (npc.getId()) { + case RAFFORTY: { + if (st.isMemoState(1)) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "32020-06.html" : "32020-08.html"; - } - else if (st.isMemoState(2)) - { + } else if (st.isMemoState(2)) { htmltext = "32020-07.html"; } break; } - case JINIA: - { - if (st.isMemoState(1)) - { - switch (st.getMemoStateEx(1)) - { - case 0: - { + case JINIA: { + if (st.isMemoState(1)) { + switch (st.getMemoStateEx(1)) { + case 0: { htmltext = "32760-01.html"; break; } - case 1: - { + case 1: { htmltext = "32760-05.html"; break; } - case 2: - { + case 2: { htmltext = "32760-06.html"; break; } @@ -222,25 +181,18 @@ public final class Q10286_ReunionWithSirra extends Quest } break; } - case SIRRA: - { - if (st.isMemoState(1)) - { - if (st.isMemoStateEx(1, 1)) - { + case SIRRA: { + if (st.isMemoState(1)) { + if (st.isMemoStateEx(1, 1)) { htmltext = "32762-01.html"; - } - else if (st.isMemoStateEx(1, 2)) - { + } else if (st.isMemoStateEx(1, 2)) { htmltext = "32762-05.html"; } } break; } - case JINIA2: - { - if (st.isMemoState(10)) - { + case JINIA2: { + if (st.isMemoState(10)) { st.addExpAndSp(2152200, 181070); st.exitQuest(false, true); htmltext = "32781-01.html"; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10287_StoryOfThoseLeft/Q10287_StoryOfThoseLeft.java b/src/main/java/com/l2jserver/datapack/quests/Q10287_StoryOfThoseLeft/Q10287_StoryOfThoseLeft.java index a93fab23a2..49958487d7 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10287_StoryOfThoseLeft/Q10287_StoryOfThoseLeft.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10287_StoryOfThoseLeft/Q10287_StoryOfThoseLeft.java @@ -32,8 +32,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * @author Adry_85 * @since 2.6.0.0 */ -public final class Q10287_StoryOfThoseLeft extends Quest -{ +public final class Q10287_StoryOfThoseLeft extends Quest { // NPCs private static final int RAFFORTY = 32020; private static final int JINIA = 32760; @@ -43,27 +42,22 @@ public final class Q10287_StoryOfThoseLeft extends Quest // Location private static final Location EXIT_LOC = new Location(113793, -109342, -845, 0); - public Q10287_StoryOfThoseLeft() - { + public Q10287_StoryOfThoseLeft() { super(10287, Q10287_StoryOfThoseLeft.class.getSimpleName(), "Story of Those Left"); addStartNpc(RAFFORTY); addTalkId(RAFFORTY, JINIA, KEGOR); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "32020-02.htm": - { + switch (event) { + case "32020-02.htm": { st.startQuest(); st.setMemoState(1); st.setMemoStateEx(1, 0); @@ -71,54 +65,42 @@ public final class Q10287_StoryOfThoseLeft extends Quest htmltext = event; break; } - case "32020-08.html": - { - if (st.isMemoState(2)) - { + case "32020-08.html": { + if (st.isMemoState(2)) { htmltext = event; } break; } - case "32760-02.html": - { - if (st.isMemoState(1)) - { + case "32760-02.html": { + if (st.isMemoState(1)) { htmltext = event; } break; } - case "32760-03.html": - { - if (st.isMemoState(1)) - { + case "32760-03.html": { + if (st.isMemoState(1)) { st.setMemoStateEx(1, 1); st.setCond(3, true); htmltext = event; } break; } - case "32760-06.html": - { - if (st.isMemoState(2)) - { + case "32760-06.html": { + if (st.isMemoState(2)) { st.setCond(5, true); player.teleToLocation(EXIT_LOC, 0); htmltext = event; // TODO: missing "jinia_npc_q10287_06.htm" } break; } - case "32761-02.html": - { - if (st.isMemoState(1) && st.isMemoStateEx(1, 1) && st.isMemoStateEx(2, 0)) - { + case "32761-02.html": { + if (st.isMemoState(1) && st.isMemoStateEx(1, 1) && st.isMemoStateEx(2, 0)) { htmltext = event; } break; } - case "32761-03.html": - { - if (st.isMemoState(1) && st.isMemoStateEx(1, 1) && st.isMemoStateEx(2, 0)) - { + case "32761-03.html": { + if (st.isMemoState(1) && st.isMemoStateEx(1, 1) && st.isMemoStateEx(2, 0)) { st.setMemoStateEx(2, 1); st.setCond(4, true); htmltext = event; @@ -130,10 +112,8 @@ public final class Q10287_StoryOfThoseLeft extends Quest case "10551": case "10552": case "10553": - case "14219": - { - if (st.isMemoState(2)) - { + case "14219": { + if (st.isMemoState(2)) { st.rewardItems(Integer.valueOf(event), 1); htmltext = "32020-09.html"; st.exitQuest(false, true); @@ -145,56 +125,36 @@ public final class Q10287_StoryOfThoseLeft extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCompleted()) - { - if (npc.getId() == RAFFORTY) - { + if (st.isCompleted()) { + if (npc.getId() == RAFFORTY) { htmltext = "32020-04.html"; } - } - else if (st.isCreated()) - { - if (npc.getId() == RAFFORTY) - { + } else if (st.isCreated()) { + if (npc.getId() == RAFFORTY) { htmltext = ((player.getLevel() >= MIN_LEVEL) && player.hasQuestCompleted(Q10286_ReunionWithSirra.class.getSimpleName())) ? "32020-01.htm" : "32020-03.htm"; } - } - else if (st.isStarted()) - { - switch (npc.getId()) - { - case RAFFORTY: - { - if (st.isMemoState(1)) - { + } else if (st.isStarted()) { + switch (npc.getId()) { + case RAFFORTY: { + if (st.isMemoState(1)) { htmltext = (player.getLevel() >= MIN_LEVEL) ? "32020-05.html" : "32020-06.html"; - } - else if (st.isMemoState(2)) - { + } else if (st.isMemoState(2)) { htmltext = "32020-07.html"; } break; } - case JINIA: - { - if (st.isMemoState(1)) - { + case JINIA: { + if (st.isMemoState(1)) { final int memoStateEx1 = st.getMemoStateEx(1); final int memoStateEx2 = st.getMemoStateEx(2); - if ((memoStateEx1 == 0) && (memoStateEx2 == 0)) - { + if ((memoStateEx1 == 0) && (memoStateEx2 == 0)) { htmltext = "32760-01.html"; - } - else if ((memoStateEx1 == 1) && (memoStateEx2 == 0)) - { + } else if ((memoStateEx1 == 1) && (memoStateEx2 == 0)) { htmltext = "32760-04.html"; - } - else if ((memoStateEx1 == 1) && (memoStateEx2 == 1)) - { + } else if ((memoStateEx1 == 1) && (memoStateEx2 == 1)) { st.setCond(5, true); st.setMemoState(2); st.setMemoStateEx(1, 0); @@ -207,22 +167,15 @@ public final class Q10287_StoryOfThoseLeft extends Quest } break; } - case KEGOR: - { - if (st.isMemoState(1)) - { + case KEGOR: { + if (st.isMemoState(1)) { final int memoStateEx1 = st.getMemoStateEx(1); final int memoStateEx2 = st.getMemoStateEx(2); - if ((memoStateEx1 == 1) && (memoStateEx2 == 0)) - { + if ((memoStateEx1 == 1) && (memoStateEx2 == 0)) { htmltext = "32761-01.html"; - } - else if ((memoStateEx1 == 0) && (memoStateEx2 == 0)) - { + } else if ((memoStateEx1 == 0) && (memoStateEx2 == 0)) { htmltext = "32761-04.html"; - } - else if ((memoStateEx1 == 1) && (memoStateEx2 == 1)) - { + } else if ((memoStateEx1 == 1) && (memoStateEx2 == 1)) { htmltext = "32761-05.html"; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10288_SecretMission/Q10288_SecretMission.java b/src/main/java/com/l2jserver/datapack/quests/Q10288_SecretMission/Q10288_SecretMission.java index e71edbf60a..e2f0ab0566 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10288_SecretMission/Q10288_SecretMission.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10288_SecretMission/Q10288_SecretMission.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.State; * Secret Mission (10288) * @author Gnacik */ -public class Q10288_SecretMission extends Quest -{ +public class Q10288_SecretMission extends Quest { // NPCs private static final int DOMINIC = 31350; private static final int AQUILANI = 32780; @@ -40,8 +39,7 @@ public class Q10288_SecretMission extends Quest // Location private static final Location TELEPORT = new Location(118833, -80589, -2688); - public Q10288_SecretMission() - { + public Q10288_SecretMission() { super(10288, Q10288_SecretMission.class.getSimpleName(), "Secret Mission"); addStartNpc(AQUILANI, DOMINIC); addFirstTalkId(AQUILANI); @@ -50,21 +48,17 @@ public class Q10288_SecretMission extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } String htmltext = event; - switch (event) - { + switch (event) { case "31350-03.html": - if (player.getLevel() < 82) - { + if (player.getLevel() < 82) { htmltext = "31350-02b.html"; } break; @@ -73,22 +67,19 @@ public class Q10288_SecretMission extends Quest st.giveItems(LETTER, 1); break; case "32780-03.html": - if (st.isCond(1) && st.hasQuestItems(LETTER)) - { + if (st.isCond(1) && st.hasQuestItems(LETTER)) { st.setCond(2, true); } break; case "32757-03.html": - if (st.isCond(2) && st.hasQuestItems(LETTER)) - { + if (st.isCond(2) && st.hasQuestItems(LETTER)) { st.giveAdena(106583, true); st.addExpAndSp(417788, 46320); st.exitQuest(false, true); } break; case "teleport": - if ((npc.getId() == AQUILANI) && st.isCompleted()) - { + if ((npc.getId() == AQUILANI) && st.isCompleted()) { player.teleToLocation(TELEPORT); return null; } @@ -97,33 +88,27 @@ public class Q10288_SecretMission extends Quest } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, false); // dialog only changes when you talk to Aquilani after quest completion - if ((st != null) && st.isCompleted()) - { + if ((st != null) && st.isCompleted()) { return "32780-05.html"; } return "data/html/default/32780.htm"; } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (npc.getId()) - { + switch (npc.getId()) { case DOMINIC: - switch (st.getState()) - { + switch (st.getState()) { case State.CREATED: htmltext = "31350-01.htm"; break; case State.STARTED: - if (st.isCond(1)) - { + if (st.isCond(1)) { htmltext = "31350-06.html"; } break; @@ -133,21 +118,16 @@ public class Q10288_SecretMission extends Quest } break; case AQUILANI: - if (st.isStarted()) - { - if (st.isCond(1) && st.hasQuestItems(LETTER)) - { + if (st.isStarted()) { + if (st.isCond(1) && st.hasQuestItems(LETTER)) { htmltext = "32780-01.html"; - } - else if (st.isCond(2)) - { + } else if (st.isCond(2)) { htmltext = "32780-04.html"; } } break; case GREYMORE: - if (st.isStarted() && st.isCond(2) && st.hasQuestItems(LETTER)) - { + if (st.isStarted() && st.isCond(2) && st.hasQuestItems(LETTER)) { return "32757-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10289_FadeToBlack/Q10289_FadeToBlack.java b/src/main/java/com/l2jserver/datapack/quests/Q10289_FadeToBlack/Q10289_FadeToBlack.java index 5f37cc0de0..56c9120fe2 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10289_FadeToBlack/Q10289_FadeToBlack.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10289_FadeToBlack/Q10289_FadeToBlack.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Fade to Black (10289) * @author Plim */ -public class Q10289_FadeToBlack extends Quest -{ +public class Q10289_FadeToBlack extends Quest { // NPC private static final int GREYMORE = 32757; // Items @@ -39,8 +38,7 @@ public class Q10289_FadeToBlack extends Quest // Monster private static final int ANAYS = 25701; - public Q10289_FadeToBlack() - { + public Q10289_FadeToBlack() { super(10289, Q10289_FadeToBlack.class.getSimpleName(), "Fade to Black"); addStartNpc(GREYMORE); addTalkId(GREYMORE); @@ -49,17 +47,14 @@ public class Q10289_FadeToBlack extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { QuestState qs = getQuestState(player, false); String htmltext = null; - if (qs == null) - { + if (qs == null) { return htmltext; } - switch (event) - { + switch (event) { case "32757-02.htm": htmltext = event; break; @@ -68,16 +63,11 @@ public class Q10289_FadeToBlack extends Quest htmltext = event; break; case "32757-06.html": - if (qs.isCond(2) && hasQuestItems(player, MARK_OF_DARKNESS)) - { + if (qs.isCond(2) && hasQuestItems(player, MARK_OF_DARKNESS)) { htmltext = "32757-07.html"; - } - else if (qs.isCond(3) && hasQuestItems(player, MARK_OF_SPLENDOR)) - { + } else if (qs.isCond(3) && hasQuestItems(player, MARK_OF_SPLENDOR)) { htmltext = "32757-08.html"; - } - else - { + } else { htmltext = event; } break; @@ -101,11 +91,9 @@ public class Q10289_FadeToBlack extends Quest case "28": case "29": case "30": - if (qs.isCond(3) && hasQuestItems(player, MARK_OF_SPLENDOR)) - { + if (qs.isCond(3) && hasQuestItems(player, MARK_OF_SPLENDOR)) { // see 32757-08.html for recipe list (all moirai armor 60%) - switch (event) - { + switch (event) { case "11": rewardItems(player, 15775, 1); giveAdena(player, 420920, true); @@ -188,8 +176,7 @@ public class Q10289_FadeToBlack extends Quest } long marksOfDarkness = getQuestItemsCount(player, MARK_OF_DARKNESS); - if (marksOfDarkness > 0) - { + if (marksOfDarkness > 0) { addExpAndSp(player, 55983 * marksOfDarkness, 136500 * (int) marksOfDarkness); } qs.exitQuest(false, true); @@ -201,27 +188,21 @@ public class Q10289_FadeToBlack extends Quest } @Override - public String onKill(L2Npc anays, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc anays, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, -1, 3, anays); - if (qs != null) - { - if (qs.getPlayer().isInParty()) - { + if (qs != null) { + if (qs.getPlayer().isInParty()) { // if player is in party, reward all members final L2Party party = qs.getPlayer().getParty(); final int rnd = getRandom(party.getMemberCount()); int idx = 0; - for (L2PcInstance member : party.getMembers()) - { + for (L2PcInstance member : party.getMembers()) { // only one lucky player will get the good item, the rest will get the bad one rewardPlayer(getQuestState(member, false), (idx == rnd)); idx++; } - } - else - { + } else { // if no party, the winner gets it all rewardPlayer(qs, true); } @@ -230,32 +211,23 @@ public class Q10289_FadeToBlack extends Quest } @Override - public boolean checkPartyMember(QuestState qs, L2Npc npc) - { + public boolean checkPartyMember(QuestState qs, L2Npc npc) { return (qs.getCond() < 3); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (qs.isCreated()) - { + if (qs.isCreated()) { final QuestState q10288 = player.getQuestState(Q10288_SecretMission.class.getSimpleName()); - if ((player.getLevel() < 82) || (q10288 == null) || !q10288.isCompleted()) - { + if ((player.getLevel() < 82) || (q10288 == null) || !q10288.isCompleted()) { htmltext = "32757-00.htm"; - } - else - { + } else { htmltext = "32757-01.htm"; } - } - else if (qs.isStarted()) - { - switch (qs.getCond()) - { + } else if (qs.isStarted()) { + switch (qs.getCond()) { case 1: htmltext = "32757-04.html"; break; @@ -264,18 +236,14 @@ public class Q10289_FadeToBlack extends Quest htmltext = "32757-05.html"; break; } - } - else - { + } else { htmltext = "32757-10.html"; } return htmltext; } - private static final void rewardPlayer(QuestState qs, boolean isLucky) - { - if ((qs != null) && qs.isCond(1)) - { + private static final void rewardPlayer(QuestState qs, boolean isLucky) { + if ((qs != null) && qs.isCond(1)) { giveItems(qs.getPlayer(), (isLucky ? MARK_OF_SPLENDOR : MARK_OF_DARKNESS), 1); qs.setCond(isLucky ? 3 : 2, true); } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10290_LandDragonConqueror/Q10290_LandDragonConqueror.java b/src/main/java/com/l2jserver/datapack/quests/Q10290_LandDragonConqueror/Q10290_LandDragonConqueror.java index b8a8c9b12b..45a13571be 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10290_LandDragonConqueror/Q10290_LandDragonConqueror.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10290_LandDragonConqueror/Q10290_LandDragonConqueror.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Land Dragon Conqueror (10290) * @author malyelfik */ -public final class Q10290_LandDragonConqueror extends Quest -{ +public final class Q10290_LandDragonConqueror extends Quest { // NPC private static final int THEODRIC = 30755; // Monster @@ -46,8 +45,7 @@ public final class Q10290_LandDragonConqueror extends Quest // Misc private static final int MIN_LEVEL = 83; - public Q10290_LandDragonConqueror() - { + public Q10290_LandDragonConqueror() { super(10290, Q10290_LandDragonConqueror.class.getSimpleName(), "Land Dragon Conqueror"); addStartNpc(THEODRIC); addTalkId(THEODRIC); @@ -56,16 +54,13 @@ public final class Q10290_LandDragonConqueror extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - if (event.equals("30755-05.htm")) - { + if (event.equals("30755-05.htm")) { st.startQuest(); st.giveItems(SHABBY_NECKLACE, 1); } @@ -73,21 +68,16 @@ public final class Q10290_LandDragonConqueror extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { - if (!player.isInParty()) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { + if (!player.isInParty()) { return super.onKill(npc, player, isSummon); } - Function<L2PcInstance, Boolean> rewardCheck = p -> - { - if (Util.checkIfInRange(8000, npc, p, false)) - { + Function<L2PcInstance, Boolean> rewardCheck = p -> { + if (Util.checkIfInRange(8000, npc, p, false)) { QuestState st = getQuestState(p, false); - if ((st != null) && st.isCond(1) && st.hasQuestItems(SHABBY_NECKLACE)) - { + if ((st != null) && st.isCond(1) && st.hasQuestItems(SHABBY_NECKLACE)) { st.takeItems(SHABBY_NECKLACE, -1); st.giveItems(MIRACLE_NECKLACE, 1); st.setCond(2, true); @@ -97,52 +87,36 @@ public final class Q10290_LandDragonConqueror extends Quest }; // rewards go only to command channel, not to a single party or player (retail Freya AI) - if (player.getParty().isInCommandChannel()) - { + if (player.getParty().isInCommandChannel()) { player.getParty().getCommandChannel().forEachMember(rewardCheck); - } - else - { + } else { player.getParty().forEachMember(rewardCheck); } return super.onKill(npc, player, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { - if (player.getLevel() < MIN_LEVEL) - { + switch (st.getState()) { + case State.CREATED: { + if (player.getLevel() < MIN_LEVEL) { htmltext = "30755-00.htm"; - } - else - { + } else { htmltext = st.hasQuestItems(PORTAL_STONE) ? "30755-02.htm" : "30755-01.htm"; } break; } - case State.STARTED: - { - if (st.isCond(1)) - { - if (st.hasQuestItems(SHABBY_NECKLACE)) - { + case State.STARTED: { + if (st.isCond(1)) { + if (st.hasQuestItems(SHABBY_NECKLACE)) { htmltext = "30755-06.html"; - } - else - { + } else { st.giveItems(SHABBY_NECKLACE, 1); htmltext = "30755-07.html"; } - } - else if ((st.isCond(2)) && st.hasQuestItems(MIRACLE_NECKLACE)) - { + } else if ((st.isCond(2)) && st.hasQuestItems(MIRACLE_NECKLACE)) { htmltext = "30755-08.html"; st.giveAdena(131236, true); st.addExpAndSp(702557, 76334); @@ -151,8 +125,7 @@ public final class Q10290_LandDragonConqueror extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = "30755-09.html"; break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10291_FireDragonDestroyer/Q10291_FireDragonDestroyer.java b/src/main/java/com/l2jserver/datapack/quests/Q10291_FireDragonDestroyer/Q10291_FireDragonDestroyer.java index 798a6d50dd..f57fb6eedf 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10291_FireDragonDestroyer/Q10291_FireDragonDestroyer.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10291_FireDragonDestroyer/Q10291_FireDragonDestroyer.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * Fire Dragon Destroyer (10291) * @author malyelfik */ -public class Q10291_FireDragonDestroyer extends Quest -{ +public class Q10291_FireDragonDestroyer extends Quest { // NPC private static final int KLEIN = 31540; // Monster @@ -44,8 +43,7 @@ public class Q10291_FireDragonDestroyer extends Quest private static final int VALAKAS_SLAYER_CIRCLET = 8567; - public Q10291_FireDragonDestroyer() - { + public Q10291_FireDragonDestroyer() { super(10291, Q10291_FireDragonDestroyer.class.getSimpleName(), "Fire Dragon Destroyer"); addStartNpc(KLEIN); addTalkId(KLEIN); @@ -54,16 +52,13 @@ public class Q10291_FireDragonDestroyer extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return getNoQuestMsg(player); } - if (event.equals("31540-05.htm")) - { + if (event.equals("31540-05.htm")) { st.startQuest(); st.giveItems(POOR_NECKLACE, 1); } @@ -72,21 +67,16 @@ public class Q10291_FireDragonDestroyer extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { - if (!player.isInParty()) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { + if (!player.isInParty()) { return super.onKill(npc, player, isSummon); } - Function<L2PcInstance, Boolean> rewardCheck = p -> - { - if (Util.checkIfInRange(8000, npc, p, false)) - { + Function<L2PcInstance, Boolean> rewardCheck = p -> { + if (Util.checkIfInRange(8000, npc, p, false)) { QuestState st = getQuestState(p, false); - if ((st != null) && st.isCond(1) && st.hasQuestItems(POOR_NECKLACE)) - { + if ((st != null) && st.isCond(1) && st.hasQuestItems(POOR_NECKLACE)) { st.takeItems(POOR_NECKLACE, -1); st.giveItems(VALOR_NECKLACE, 1); st.setCond(2, true); @@ -96,52 +86,36 @@ public class Q10291_FireDragonDestroyer extends Quest }; // Rewards go only to command channel, not to a single party or player. - if (player.getParty().isInCommandChannel()) - { + if (player.getParty().isInCommandChannel()) { player.getParty().getCommandChannel().forEachMember(rewardCheck); - } - else - { + } else { player.getParty().forEachMember(rewardCheck); } return super.onKill(npc, player, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); - switch (st.getState()) - { - case State.CREATED: - { - if (player.getLevel() < 83) - { + switch (st.getState()) { + case State.CREATED: { + if (player.getLevel() < 83) { htmltext = "31540-00.htm"; - } - else - { + } else { htmltext = st.hasQuestItems(FLOATING_STONE) ? "31540-02.htm" : "31540-01.htm"; } break; } - case State.STARTED: - { - if (st.isCond(1)) - { - if (st.hasQuestItems(POOR_NECKLACE)) - { + case State.STARTED: { + if (st.isCond(1)) { + if (st.hasQuestItems(POOR_NECKLACE)) { htmltext = "31540-06.html"; - } - else - { + } else { st.giveItems(POOR_NECKLACE, 1); htmltext = "31540-07.html"; } - } - else if (st.isCond(2) && st.hasQuestItems(VALOR_NECKLACE)) - { + } else if (st.isCond(2) && st.hasQuestItems(VALOR_NECKLACE)) { htmltext = "31540-08.html"; st.giveAdena(126549, true); st.addExpAndSp(717291, 77397); @@ -150,8 +124,7 @@ public class Q10291_FireDragonDestroyer extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = "31540-09.html"; break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10292_SevenSignsGirlOfDoubt/Q10292_SevenSignsGirlOfDoubt.java b/src/main/java/com/l2jserver/datapack/quests/Q10292_SevenSignsGirlOfDoubt/Q10292_SevenSignsGirlOfDoubt.java index d11749624b..cb75e84672 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10292_SevenSignsGirlOfDoubt/Q10292_SevenSignsGirlOfDoubt.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10292_SevenSignsGirlOfDoubt/Q10292_SevenSignsGirlOfDoubt.java @@ -31,8 +31,7 @@ import com.l2jserver.gameserver.util.Util; * @author Adry_85 * @since 2.6.0.0 */ -public final class Q10292_SevenSignsGirlOfDoubt extends Quest -{ +public final class Q10292_SevenSignsGirlOfDoubt extends Quest { // NPCs private static final int HARDIN = 30832; private static final int WOOD = 32593; @@ -48,8 +47,7 @@ public final class Q10292_SevenSignsGirlOfDoubt extends Quest // Monster private static final int CREATURE_OF_THE_DUSK1 = 27422; private static final int CREATURE_OF_THE_DUSK2 = 27424; - private static final int[] MOBS = - { + private static final int[] MOBS = { 22801, // Cruel Pincer Golem 22802, // Cruel Pincer Golem 22803, // Cruel Pincer Golem @@ -58,8 +56,7 @@ public final class Q10292_SevenSignsGirlOfDoubt extends Quest 22806, // Horrifying Jackhammer Golem }; - public Q10292_SevenSignsGirlOfDoubt() - { + public Q10292_SevenSignsGirlOfDoubt() { super(10292, Q10292_SevenSignsGirlOfDoubt.class.getSimpleName(), "Seven Signs, Girl of Doubt"); addStartNpc(WOOD); addSpawnId(ELCADIA); @@ -70,122 +67,96 @@ public final class Q10292_SevenSignsGirlOfDoubt extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "32593-02.htm": case "32593-04.htm": case "32597-02.html": - case "32597-04.html": - { + case "32597-04.html": { htmltext = event; break; } - case "32593-03.htm": - { + case "32593-03.htm": { st.startQuest(); st.setMemoState(1); htmltext = event; break; } - case "32597-03.html": - { + case "32597-03.html": { st.setMemoState(2); st.setCond(2, true); htmltext = event; break; } - case "32784-02.html": - { - if (st.isMemoState(2)) - { + case "32784-02.html": { + if (st.isMemoState(2)) { htmltext = event; } break; } - case "32784-03.html": - { - if (st.isMemoState(2)) - { + case "32784-03.html": { + if (st.isMemoState(2)) { st.setMemoState(3); st.setCond(3, true); htmltext = event; } break; } - case "32784-05.html": - { - if (st.isMemoState(4)) - { + case "32784-05.html": { + if (st.isMemoState(4)) { htmltext = event; } break; } - case "32784-06.html": - { - if (st.isMemoState(4)) - { + case "32784-06.html": { + if (st.isMemoState(4)) { st.setMemoState(5); st.setCond(5, true); htmltext = event; } break; } - case "SPAWN": - { - if (!npc.getVariables().getBoolean(I_QUEST1, false)) - { + case "SPAWN": { + if (!npc.getVariables().getBoolean(I_QUEST1, false)) { npc.getVariables().set(I_QUEST1, true); addSpawn(CREATURE_OF_THE_DUSK1, 89440, -238016, -9632, getRandom(360), false, 0, false, player.getInstanceId()); addSpawn(CREATURE_OF_THE_DUSK2, 89524, -238131, -9632, getRandom(360), false, 0, false, player.getInstanceId()); - } - else - { + } else { htmltext = "32784-07.html"; } break; } case "32784-11.html": - case "32784-12.html": - { - if (st.isMemoState(6)) - { + case "32784-12.html": { + if (st.isMemoState(6)) { htmltext = event; } break; } - case "32784-13.html": - { - if (st.isMemoState(6)) - { + case "32784-13.html": { + if (st.isMemoState(6)) { st.setMemoState(7); st.setCond(7, true); htmltext = event; } break; } - case "30832-02.html": - { - if (st.isMemoState(7)) - { + case "30832-02.html": { + if (st.isMemoState(7)) { st.setMemoState(8); st.setCond(8, true); htmltext = event; } break; } - case "30832-03.html": - { - if (st.isMemoState(8)) - { + case "30832-03.html": { + if (st.isMemoState(8)) { htmltext = event; } break; @@ -195,23 +166,16 @@ public final class Q10292_SevenSignsGirlOfDoubt extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st = getRandomPartyMemberState(player, -1, 3, npc); - if (st != null) - { - if (Util.contains(MOBS, npc.getId())) - { - if (giveItemRandomly(st.getPlayer(), npc, ELCADIAS_MARK.getId(), 1, ELCADIAS_MARK.getCount(), 0.7, true) && st.isMemoState(3)) - { + if (st != null) { + if (Util.contains(MOBS, npc.getId())) { + if (giveItemRandomly(st.getPlayer(), npc, ELCADIAS_MARK.getId(), 1, ELCADIAS_MARK.getCount(), 0.7, true) && st.isMemoState(3)) { st.setCond(4, true); } - } - else - { + } else { killCount++; - if (killCount == 2) - { + if (killCount == 2) { st.setMemoState(6); st.setCond(6); } @@ -221,74 +185,50 @@ public final class Q10292_SevenSignsGirlOfDoubt extends Quest } @Override - public String onSpawn(L2Npc npc) - { + public String onSpawn(L2Npc npc) { npc.getVariables().set(I_QUEST1, false); return super.onSpawn(npc); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCompleted()) - { - if (npc.getId() == WOOD) - { + if (st.isCompleted()) { + if (npc.getId() == WOOD) { htmltext = "32593-05.html"; } - } - else if (st.isCreated()) - { + } else if (st.isCreated()) { htmltext = ((player.getLevel() >= MIN_LEVEL) && player.hasQuestCompleted(Q00198_SevenSignsEmbryo.class.getSimpleName())) ? "32593-01.htm" : "32593-06.htm"; - } - else if (st.isStarted()) - { - switch (npc.getId()) - { - case WOOD: - { - if ((st.getMemoState() > 0) && (st.getMemoState() < 9)) - { + } else if (st.isStarted()) { + switch (npc.getId()) { + case WOOD: { + if ((st.getMemoState() > 0) && (st.getMemoState() < 9)) { htmltext = "32593-07.html"; } break; } - case FRANZ: - { + case FRANZ: { final int memoState = st.getMemoState(); - if (memoState == 1) - { + if (memoState == 1) { htmltext = "32597-01.html"; - } - else if ((memoState >= 2) && (memoState < 7)) - { + } else if ((memoState >= 2) && (memoState < 7)) { htmltext = "32597-05.html"; - } - else if (memoState == 7) - { + } else if (memoState == 7) { htmltext = "32597-06.html"; } break; } - case ELCADIA: - { - switch (st.getMemoState()) - { - case 2: - { + case ELCADIA: { + switch (st.getMemoState()) { + case 2: { htmltext = "32784-01.html"; break; } - case 3: - { - if (!hasItem(player, ELCADIAS_MARK)) - { + case 3: { + if (!hasItem(player, ELCADIAS_MARK)) { htmltext = "32784-03.html"; - } - else - { + } else { takeItem(player, ELCADIAS_MARK); st.setMemoState(4); st.setCond(4, true); @@ -296,34 +236,26 @@ public final class Q10292_SevenSignsGirlOfDoubt extends Quest } break; } - case 4: - { + case 4: { htmltext = "32784-08.html"; break; } - case 5: - { + case 5: { htmltext = "32784-09.html"; break; } - case 6: - { + case 6: { htmltext = "32784-10.html"; break; } - case 7: - { + case 7: { htmltext = "32784-14.html"; break; } - case 8: - { - if (player.isSubClassActive()) - { + case 8: { + if (player.isSubClassActive()) { htmltext = "32784-15.html"; - } - else - { + } else { addExpAndSp(player, 10000000, 1000000); st.exitQuest(false, true); htmltext = "32784-16.html"; @@ -333,14 +265,10 @@ public final class Q10292_SevenSignsGirlOfDoubt extends Quest } break; } - case HARDIN: - { - if (st.isMemoState(7)) - { + case HARDIN: { + if (st.isMemoState(7)) { htmltext = "30832-01.html"; - } - else if (st.isMemoState(8)) - { + } else if (st.isMemoState(8)) { htmltext = "30832-03.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10293_SevenSignsForbiddenBookOfTheElmoreAdenKingdom/Q10293_SevenSignsForbiddenBookOfTheElmoreAdenKingdom.java b/src/main/java/com/l2jserver/datapack/quests/Q10293_SevenSignsForbiddenBookOfTheElmoreAdenKingdom/Q10293_SevenSignsForbiddenBookOfTheElmoreAdenKingdom.java index 12a629e6b8..ff980db79d 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10293_SevenSignsForbiddenBookOfTheElmoreAdenKingdom/Q10293_SevenSignsForbiddenBookOfTheElmoreAdenKingdom.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10293_SevenSignsForbiddenBookOfTheElmoreAdenKingdom/Q10293_SevenSignsForbiddenBookOfTheElmoreAdenKingdom.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Seven Signs, Forbidden Book of the Elmore-Aden Kingdom (10293) * @author Adry_85 */ -public final class Q10293_SevenSignsForbiddenBookOfTheElmoreAdenKingdom extends Quest -{ +public final class Q10293_SevenSignsForbiddenBookOfTheElmoreAdenKingdom extends Quest { // NPCs private static final int SOPHIA1 = 32596; private static final int ELCADIA = 32784; @@ -46,8 +45,7 @@ public final class Q10293_SevenSignsForbiddenBookOfTheElmoreAdenKingdom extends // Misc private static final int MIN_LEVEL = 81; - public Q10293_SevenSignsForbiddenBookOfTheElmoreAdenKingdom() - { + public Q10293_SevenSignsForbiddenBookOfTheElmoreAdenKingdom() { super(10293, Q10293_SevenSignsForbiddenBookOfTheElmoreAdenKingdom.class.getSimpleName(), "Seven Signs, Forbidden Book of the Elmore-Aden Kingdom"); addFirstTalkId(SOPHIA3); addStartNpc(ELCADIA); @@ -56,129 +54,100 @@ public final class Q10293_SevenSignsForbiddenBookOfTheElmoreAdenKingdom extends } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "32784-03.htm": case "32784-05.html": case "32861-13.html": case "32863-02.html": - case "32863-03.html": - { + case "32863-03.html": { htmltext = event; break; } - case "32784-04.html": - { + case "32784-04.html": { qs.startQuest(); htmltext = event; break; } case "32784-07.html": - case "32784-08.html": - { - if (qs.isCond(8)) - { + case "32784-08.html": { + if (qs.isCond(8)) { htmltext = event; } break; } - case "REWARD": - { - if (player.isSubClassActive()) - { + case "REWARD": { + if (player.isSubClassActive()) { htmltext = "32784-10.html"; - } - else - { + } else { addExpAndSp(player, 15000000, 1500000); qs.exitQuest(false, true); htmltext = "32784-09.html"; } break; } - case "32785-02.html": - { - if (qs.isCond(1)) - { + case "32785-02.html": { + if (qs.isCond(1)) { htmltext = event; } break; } - case "32785-07.html": - { - if (qs.isCond(4)) - { + case "32785-07.html": { + if (qs.isCond(4)) { qs.setCond(5, true); htmltext = event; } break; } case "32596-03.html": - case "32596-04.html": - { - if ((qs.getCond() >= 1) && (qs.getCond() < 8)) - { + case "32596-04.html": { + if ((qs.getCond() >= 1) && (qs.getCond() < 8)) { htmltext = event; } break; } case "32861-02.html": - case "32861-03.html": - { - if (qs.isCond(1)) - { + case "32861-03.html": { + if (qs.isCond(1)) { htmltext = event; } break; } - case "32861-04.html": - { - if (qs.isCond(1)) - { + case "32861-04.html": { + if (qs.isCond(1)) { qs.setCond(2, true); htmltext = event; } break; } - case "32861-07.html": - { - if (qs.isCond(3)) - { + case "32861-07.html": { + if (qs.isCond(3)) { htmltext = event; } break; } - case "32861-08.html": - { - if (qs.isCond(3)) - { + case "32861-08.html": { + if (qs.isCond(3)) { qs.setCond(4, true); htmltext = event; } break; } - case "32861-11.html": - { - if (qs.isCond(5)) - { + case "32861-11.html": { + if (qs.isCond(5)) { qs.setCond(6, true); htmltext = event; } break; } - case "32809-02.html": - { - if (qs.isCond(6)) - { + case "32809-02.html": { + if (qs.isCond(6)) { qs.setCond(7, true); giveItems(player, SOLINAS_BIOGRAPHY, 1); htmltext = event; @@ -188,10 +157,8 @@ public final class Q10293_SevenSignsForbiddenBookOfTheElmoreAdenKingdom extends case "32810-02.html": case "32811-02.html": case "32812-02.html": - case "32813-02.html": - { - if (qs.isCond(6)) - { + case "32813-02.html": { + if (qs.isCond(6)) { htmltext = event; } break; @@ -201,194 +168,145 @@ public final class Q10293_SevenSignsForbiddenBookOfTheElmoreAdenKingdom extends } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if ((qs.getCond() >= 1) && (qs.getCond() < 8)) - { + if ((qs.getCond() >= 1) && (qs.getCond() < 8)) { htmltext = "32863-01.html"; - } - else - { + } else { htmltext = "32863-04.html"; } return htmltext; } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (npc.getId()) - { - case ELCADIA: - { - if (qs.isCompleted()) - { + switch (npc.getId()) { + case ELCADIA: { + if (qs.isCompleted()) { htmltext = "32784-02.html"; - } - else if (qs.isCreated()) - { + } else if (qs.isCreated()) { htmltext = ((player.getLevel() >= MIN_LEVEL) && player.hasQuestCompleted(Q10292_SevenSignsGirlOfDoubt.class.getSimpleName())) ? "32784-01.htm" : "32784-11.htm"; - } - else if (qs.isStarted()) - { - if (qs.isCond(1)) - { + } else if (qs.isStarted()) { + if (qs.isCond(1)) { htmltext = "32784-06.html"; - } - else if (qs.isCond(8)) - { + } else if (qs.isCond(8)) { htmltext = "32784-07.html"; } } break; } - case ELCADIA_INSTANCE: - { - switch (qs.getCond()) - { - case 1: - { + case ELCADIA_INSTANCE: { + switch (qs.getCond()) { + case 1: { htmltext = "32785-01.html"; break; } - case 2: - { + case 2: { htmltext = "32785-04.html"; qs.setCond(3, true); break; } - case 3: - { + case 3: { htmltext = "32785-05.html"; break; } - case 4: - { + case 4: { htmltext = "32785-06.html"; break; } - case 5: - { + case 5: { htmltext = "32785-08.html"; break; } - case 6: - { + case 6: { htmltext = "32785-09.html"; break; } - case 7: - { + case 7: { qs.setCond(8, true); htmltext = "32785-11.html"; break; } - case 8: - { + case 8: { htmltext = "32785-12.html"; break; } } break; } - case SOPHIA1: - { - if (qs.isStarted()) - { - if ((qs.getCond() >= 1) && (qs.getCond() < 8)) - { + case SOPHIA1: { + if (qs.isStarted()) { + if ((qs.getCond() >= 1) && (qs.getCond() < 8)) { htmltext = "32596-01.html"; - } - else - { + } else { htmltext = "32596-05.html"; } } break; } - case SOPHIA2: - { - switch (qs.getCond()) - { - case 1: - { + case SOPHIA2: { + switch (qs.getCond()) { + case 1: { htmltext = "32861-01.html"; break; } - case 2: - { + case 2: { htmltext = "32861-05.html"; break; } - case 3: - { + case 3: { htmltext = "32861-06.html"; break; } - case 4: - { + case 4: { htmltext = "32861-09.html"; break; } - case 5: - { + case 5: { htmltext = "32861-10.html"; break; } case 6: - case 7: - { + case 7: { htmltext = "32861-12.html"; break; } - case 8: - { + case 8: { htmltext = "32861-14.html"; break; } } break; } - case PILE_OF_BOOKS1: - { - if (qs.isCond(6)) - { + case PILE_OF_BOOKS1: { + if (qs.isCond(6)) { htmltext = "32809-01.html"; } break; } - case PILE_OF_BOOKS2: - { - if (qs.isCond(6)) - { + case PILE_OF_BOOKS2: { + if (qs.isCond(6)) { htmltext = "32810-01.html"; } break; } - case PILE_OF_BOOKS3: - { - if (qs.isCond(6)) - { + case PILE_OF_BOOKS3: { + if (qs.isCond(6)) { htmltext = "32811-01.html"; } break; } - case PILE_OF_BOOKS4: - { - if (qs.isCond(6)) - { + case PILE_OF_BOOKS4: { + if (qs.isCond(6)) { htmltext = "32812-01.html"; } break; } - case PILE_OF_BOOKS5: - { - if (qs.isCond(6)) - { + case PILE_OF_BOOKS5: { + if (qs.isCond(6)) { htmltext = "32813-01.html"; } break; diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10294_SevenSignsToTheMonasteryOfSilence/Q10294_SevenSignsToTheMonasteryOfSilence.java b/src/main/java/com/l2jserver/datapack/quests/Q10294_SevenSignsToTheMonasteryOfSilence/Q10294_SevenSignsToTheMonasteryOfSilence.java index 1715a2c6a6..2c51fda7ca 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10294_SevenSignsToTheMonasteryOfSilence/Q10294_SevenSignsToTheMonasteryOfSilence.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10294_SevenSignsToTheMonasteryOfSilence/Q10294_SevenSignsToTheMonasteryOfSilence.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Seven Signs, To the Monastery of Silence (10294) * @author Adry_85 */ -public final class Q10294_SevenSignsToTheMonasteryOfSilence extends Quest -{ +public final class Q10294_SevenSignsToTheMonasteryOfSilence extends Quest { // NPCs private static final int ELCADIA = 32784; private static final int ELCADIA_INSTANCE = 32787; @@ -68,23 +67,20 @@ public final class Q10294_SevenSignsToTheMonasteryOfSilence extends Quest // Buffs private static final SkillHolder VAMPIRIC_RAGE = new SkillHolder(6727); private static final SkillHolder RESIST_HOLY = new SkillHolder(6729); - private static final SkillHolder[] MAGE_BUFFS = - { + private static final SkillHolder[] MAGE_BUFFS = { new SkillHolder(6714), // Wind Walk of Elcadia new SkillHolder(6721), // Empower of Elcadia new SkillHolder(6722), // Acumen of Elcadia new SkillHolder(6717), // Berserker Spirit of Elcadia }; - private static final SkillHolder[] WARRIOR_BUFFS = - { + private static final SkillHolder[] WARRIOR_BUFFS = { new SkillHolder(6714), // Wind Walk of Elcadia new SkillHolder(6715), // Haste of Elcadia new SkillHolder(6716), // Might of Elcadia new SkillHolder(6717), // Berserker Spirit of Elcadia }; - public Q10294_SevenSignsToTheMonasteryOfSilence() - { + public Q10294_SevenSignsToTheMonasteryOfSilence() { super(10294, Q10294_SevenSignsToTheMonasteryOfSilence.class.getSimpleName(), "Seven Signs, To the Monastery of Silence"); addFirstTalkId(ELCADIA_INSTANCE); addStartNpc(ELCADIA, ODD_GLOBE, ELCADIA_INSTANCE, RELIC_GUARDIAN); @@ -92,41 +88,32 @@ public final class Q10294_SevenSignsToTheMonasteryOfSilence extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); - if (qs == null) - { + if (qs == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "32784-03.htm": - case "32784-04.htm": - { + case "32784-04.htm": { htmltext = event; break; } - case "32784-05.html": - { + case "32784-05.html": { qs.startQuest(); htmltext = event; break; } - case "32792-02.html": - { - if (qs.isCond(1)) - { + case "32792-02.html": { + if (qs.isCond(1)) { htmltext = event; } break; } - case "32792-03.html": - { - if (qs.isCond(1)) - { + case "32792-03.html": { + if (qs.isCond(1)) { qs.setCond(2, true); htmltext = event; } @@ -165,18 +152,14 @@ public final class Q10294_SevenSignsToTheMonasteryOfSilence extends Quest case "32807-07.html": case "32807-08.html": case "32807-09.html": - case "32807-10.html": - { - if (qs.isCond(2)) - { + case "32807-10.html": { + if (qs.isCond(2)) { htmltext = event; } break; } - case "32792-08.html": - { - if (qs.isCond(3)) - { + case "32792-08.html": { + if (qs.isCond(3)) { qs.unset("good1"); qs.unset("good2"); qs.unset("good3"); @@ -187,100 +170,81 @@ public final class Q10294_SevenSignsToTheMonasteryOfSilence extends Quest } break; } - case "BUFF": - { + case "BUFF": { npc.setTarget(player); - if (player.isMageClass()) - { - for (SkillHolder skill : MAGE_BUFFS) - { + if (player.isMageClass()) { + for (SkillHolder skill : MAGE_BUFFS) { npc.doSimultaneousCast(skill); } - } - else - { - for (SkillHolder skill : WARRIOR_BUFFS) - { + } else { + for (SkillHolder skill : WARRIOR_BUFFS) { npc.doSimultaneousCast(skill); } } break; } - case "RIGHT_BOOK1": - { + case "RIGHT_BOOK1": { qs.set("good1", "1"); npc.setDisplayEffect(1); startQuestTimer("SPAWN_MOBS", 22000, npc, player); htmltext = "32821-02.html"; - if (hasCheckedAllRightBooks(qs)) - { + if (hasCheckedAllRightBooks(qs)) { player.showQuestMovie(25); } break; } - case "RIGHT_BOOK2": - { + case "RIGHT_BOOK2": { qs.set("good2", "1"); npc.setDisplayEffect(1); npc.setTarget(player); npc.doCast(VAMPIRIC_RAGE); htmltext = "32821-02.html"; - if (hasCheckedAllRightBooks(qs)) - { + if (hasCheckedAllRightBooks(qs)) { player.showQuestMovie(25); } break; } - case "RIGHT_BOOK3": - { + case "RIGHT_BOOK3": { qs.set("good3", "1"); npc.setDisplayEffect(1); final L2Npc jude = addSpawn(JUDE_VAN_ETINA, 85783, -253471, -8320, 65, false, 0, false, player.getInstanceId()); jude.setTarget(player); jude.doCast(RESIST_HOLY); htmltext = "32821-02.html"; - if (hasCheckedAllRightBooks(qs)) - { + if (hasCheckedAllRightBooks(qs)) { player.showQuestMovie(25); } break; } - case "RIGHT_BOOK4": - { + case "RIGHT_BOOK4": { qs.set("good4", "1"); npc.setDisplayEffect(1); final L2Npc solina = addSpawn(SOLINAS_EVIL_THOUGHTS, 85793, -247581, -8320, 0, false, 0, false, player.getInstanceId()); solina.setTarget(player); solina.doCast(RESIST_HOLY); htmltext = "32821-02.html"; - if (hasCheckedAllRightBooks(qs)) - { + if (hasCheckedAllRightBooks(qs)) { player.showQuestMovie(25); } break; } - case "DONE1": - { + case "DONE1": { htmltext = ((qs.getInt("good1") == 1) ? "32804-05.html" : "32804-03.html"); break; } - case "DONE2": - { + case "DONE2": { htmltext = ((qs.getInt("good2") == 1) ? "32805-05.html" : "32805-03.html"); break; } - case "DONE3": - { + case "DONE3": { htmltext = ((qs.getInt("good3") == 1) ? "32806-05.html" : "32806-03.html"); break; } - case "DONE4": - { + case "DONE4": { htmltext = ((qs.getInt("good4") == 1) ? "32807-05.html" : "32807-03.html"); break; } - case "SPAWN_MOBS": - { + case "SPAWN_MOBS": { addSpawn(JUDE_EVIL_THOUGHTS, 88655, -250591, -8320, 144, false, 0, false, player.getInstanceId()); addSpawn(GUIDE_SOLINA, 88655, -250591, -8320, 144, false, 0, false, player.getInstanceId()); addSpawn(SOLINA_LAY_BROTHER, 88655, -250591, -8320, 144, false, 0, false, player.getInstanceId()); @@ -292,95 +256,67 @@ public final class Q10294_SevenSignsToTheMonasteryOfSilence extends Quest } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) - { + public String onFirstTalk(L2Npc npc, L2PcInstance player) { return "32787.html"; } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (npc.getId()) - { - case ELCADIA: - { - if (qs.isCompleted()) - { + switch (npc.getId()) { + case ELCADIA: { + if (qs.isCompleted()) { htmltext = "32784-02.html"; - } - else if (qs.isCreated()) - { + } else if (qs.isCreated()) { htmltext = ((player.getLevel() >= MIN_LEVEL) && player.hasQuestCompleted(Q10293_SevenSignsForbiddenBookOfTheElmoreAdenKingdom.class.getSimpleName())) ? "32784-01.htm" : "32784-07.htm"; - } - else if (qs.isStarted()) - { - if (qs.isCond(1)) - { + } else if (qs.isStarted()) { + if (qs.isCond(1)) { htmltext = "32784-06.html"; } } break; } - case ERIS_EVIL_THOUGHTS: - { - switch (qs.getCond()) - { - case 1: - { + case ERIS_EVIL_THOUGHTS: { + switch (qs.getCond()) { + case 1: { htmltext = "32792-01.html"; break; } - case 2: - { + case 2: { htmltext = "32792-04.html"; break; } - case 3: - { + case 3: { htmltext = ((player.isSubClassActive()) ? "32792-09.html" : "32792-07.html"); break; } } break; } - case RELIC_GUARDIAN: - { - if (qs.isCond(2)) - { - if (hasCheckedAllRightBooks(qs)) - { + case RELIC_GUARDIAN: { + if (qs.isCond(2)) { + if (hasCheckedAllRightBooks(qs)) { qs.setCond(3, true); htmltext = "32803-04.html"; - } - else - { + } else { htmltext = "32803-01.html"; } - } - else if (qs.isCond(3)) - { + } else if (qs.isCond(3)) { htmltext = "32803-05.html"; } break; } - case ODD_GLOBE: - { - if (qs.getCond() < 3) - { + case ODD_GLOBE: { + if (qs.getCond() < 3) { htmltext = "32815-01.html"; } break; } - case ELCADIA_INSTANCE: - { - if (qs.isCond(1)) - { + case ELCADIA_INSTANCE: { + if (qs.isCond(1)) { htmltext = "32787-01.html"; - } - else if (qs.isCond(2)) - { + } else if (qs.isCond(2)) { htmltext = "32787-02.html"; } break; @@ -396,31 +332,25 @@ public final class Q10294_SevenSignsToTheMonasteryOfSilence extends Quest case READING_DESK12: case READING_DESK14: case READING_DESK15: - case READING_DESK16: - { - if (qs.isCond(2)) - { + case READING_DESK16: { + if (qs.isCond(2)) { htmltext = "32822-01.html"; } break; } - case READING_DESK1: - { + case READING_DESK1: { htmltext = ((qs.getInt("good1") == 1) ? "32821-03.html" : "32821-01.html"); break; } - case READING_DESK5: - { + case READING_DESK5: { htmltext = ((qs.getInt("good2") == 1) ? "32821-03.html" : "32825-01.html"); break; } - case READING_DESK9: - { + case READING_DESK9: { htmltext = ((qs.getInt("good3") == 1) ? "32821-03.html" : "32829-01.html"); break; } - case READING_DESK13: - { + case READING_DESK13: { htmltext = ((qs.getInt("good4") == 1) ? "32821-03.html" : "32833-01.html"); break; } @@ -429,10 +359,8 @@ public final class Q10294_SevenSignsToTheMonasteryOfSilence extends Quest case RELIC_WATCHER1: case RELIC_WATCHER2: case RELIC_WATCHER3: - case RELIC_WATCHER4: - { - if (qs.isCond(2)) - { + case RELIC_WATCHER4: { + if (qs.isCond(2)) { htmltext = npc.getId() + "-01.html"; } break; @@ -441,8 +369,7 @@ public final class Q10294_SevenSignsToTheMonasteryOfSilence extends Quest return htmltext; } - public boolean hasCheckedAllRightBooks(QuestState qs) - { + public boolean hasCheckedAllRightBooks(QuestState qs) { return ((qs.getInt("good1") == 1) && (qs.getInt("good2") == 1) && (qs.getInt("good3") == 1) && (qs.getInt("good4") == 1)); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10295_SevenSignsSolinasTomb/Q10295_SevenSignsSolinasTomb.java b/src/main/java/com/l2jserver/datapack/quests/Q10295_SevenSignsSolinasTomb/Q10295_SevenSignsSolinasTomb.java index 4a9dbd509e..58b5de8458 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10295_SevenSignsSolinasTomb/Q10295_SevenSignsSolinasTomb.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10295_SevenSignsSolinasTomb/Q10295_SevenSignsSolinasTomb.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * @author Adry_85 * @since 2.6.0.0 */ -public final class Q10295_SevenSignsSolinasTomb extends Quest -{ +public final class Q10295_SevenSignsSolinasTomb extends Quest { // NPCs private static final int ELCADIA = 32787; private static final int ERISS_EVIL_THOUGHTS = 32792; @@ -59,8 +58,7 @@ public final class Q10295_SevenSignsSolinasTomb extends Quest // Misc private static final int MIN_LEVEL = 81; - public Q10295_SevenSignsSolinasTomb() - { + public Q10295_SevenSignsSolinasTomb() { super(10295, Q10295_SevenSignsSolinasTomb.class.getSimpleName(), "Seven Signs, Solina's Tomb"); addStartNpc(ERISS_EVIL_THOUGHTS); addTalkId(ERISS_EVIL_THOUGHTS, SOLINAS_EVIL_THOUGHTS, SOLINA, ERIS, ANAIS, JUDE_VAN_ETINA, TELEPORT_CONTROL_DEVICE_1, POWERFUL_DEVICE_1, POWERFUL_DEVICE_2, POWERFUL_DEVICE_3, POWERFUL_DEVICE_4, TELEPORT_CONTROL_DEVICE_2, TOMB_OF_THE_SAINTESS, TELEPORT_CONTROL_DEVICE_3, ALTAR_OF_HALLOWS_1, ALTAR_OF_HALLOWS_2, ALTAR_OF_HALLOWS_3, ALTAR_OF_HALLOWS_4, ELCADIA); @@ -68,46 +66,37 @@ public final class Q10295_SevenSignsSolinasTomb extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { + switch (event) { case "32792-02.htm": case "32792-04.htm": case "32792-05.htm": case "32792-06.htm": - case "32793-06.html": - { + case "32793-06.html": { htmltext = event; break; } - case "32792-03.htm": - { + case "32792-03.htm": { st.startQuest(); st.setMemoState(1); htmltext = event; break; } case "32793-02.html": - case "32793-03.html": - { - if (st.isMemoState(3)) - { + case "32793-03.html": { + if (st.isMemoState(3)) { htmltext = event; } break; } - case "32793-04.html": - { - if (st.isMemoState(3)) - { + case "32793-04.html": { + if (st.isMemoState(3)) { st.setMemoState(4); st.setCond(2, true); htmltext = event; @@ -115,160 +104,112 @@ public final class Q10295_SevenSignsSolinasTomb extends Quest break; } case "32793-05.html": - case "32794-02.html": - { - if (st.isMemoState(4)) - { + case "32794-02.html": { + if (st.isMemoState(4)) { st.setMemoState(5); htmltext = event; } break; } - case "32793-07.html": - { - if (st.isMemoState(5)) - { + case "32793-07.html": { + if (st.isMemoState(5)) { htmltext = event; } break; } - case "32793-08.html": - { - if (st.isMemoState(5)) - { + case "32793-08.html": { + if (st.isMemoState(5)) { st.setMemoState(6); st.setCond(3, true); htmltext = event; } break; } - case "32837-02.html": - { - if (st.getMemoState() > 1) - { + case "32837-02.html": { + if (st.getMemoState() > 1) { takeItems(player, -1, SCROLL_OF_ABSTINENCE, SHIELD_OF_SACRIFICE, SWORD_OF_HOLY_SPIRIT, STAFF_OF_BLESSING); htmltext = event; } break; } - case "32838-02.html": - { - if (st.isMemoState(1)) - { - if (hasQuestItems(player, SCROLL_OF_ABSTINENCE)) - { + case "32838-02.html": { + if (st.isMemoState(1)) { + if (hasQuestItems(player, SCROLL_OF_ABSTINENCE)) { htmltext = event; - } - else - { + } else { htmltext = "32838-03.html"; } } break; } - case "32839-02.html": - { - if (st.isMemoState(1)) - { - if (hasQuestItems(player, SHIELD_OF_SACRIFICE)) - { + case "32839-02.html": { + if (st.isMemoState(1)) { + if (hasQuestItems(player, SHIELD_OF_SACRIFICE)) { htmltext = event; - } - else - { + } else { htmltext = "32839-03.html"; } } break; } - case "32840-02.html": - { - if (st.isMemoState(1)) - { - if (hasQuestItems(player, SWORD_OF_HOLY_SPIRIT)) - { + case "32840-02.html": { + if (st.isMemoState(1)) { + if (hasQuestItems(player, SWORD_OF_HOLY_SPIRIT)) { htmltext = event; - } - else - { + } else { htmltext = "32840-03.html"; } } break; } - case "32841-02.html": - { - if (st.isMemoState(1)) - { - if (hasQuestItems(player, STAFF_OF_BLESSING)) - { + case "32841-02.html": { + if (st.isMemoState(1)) { + if (hasQuestItems(player, STAFF_OF_BLESSING)) { htmltext = event; - } - else - { + } else { htmltext = "32841-03.html"; } } break; } - case "32857-02.html": - { - if (st.isMemoState(1)) - { - if (hasQuestItems(player, STAFF_OF_BLESSING)) - { + case "32857-02.html": { + if (st.isMemoState(1)) { + if (hasQuestItems(player, STAFF_OF_BLESSING)) { htmltext = event; - } - else - { + } else { giveItems(player, STAFF_OF_BLESSING, 1); htmltext = "32857-03.html"; } } break; } - case "32858-02.html": - { - if (st.isMemoState(1)) - { - if (hasQuestItems(player, SWORD_OF_HOLY_SPIRIT)) - { + case "32858-02.html": { + if (st.isMemoState(1)) { + if (hasQuestItems(player, SWORD_OF_HOLY_SPIRIT)) { htmltext = event; - } - else - { + } else { giveItems(player, SWORD_OF_HOLY_SPIRIT, 1); htmltext = "32858-03.html"; } } break; } - case "32859-02.html": - { - if (st.isMemoState(1)) - { - if (hasQuestItems(player, SCROLL_OF_ABSTINENCE)) - { + case "32859-02.html": { + if (st.isMemoState(1)) { + if (hasQuestItems(player, SCROLL_OF_ABSTINENCE)) { htmltext = event; - } - else - { + } else { giveItems(player, SCROLL_OF_ABSTINENCE, 1); htmltext = "32859-03.html"; } } break; } - case "32860-02.html": - { - if (st.isMemoState(1)) - { - if (hasQuestItems(player, SHIELD_OF_SACRIFICE)) - { + case "32860-02.html": { + if (st.isMemoState(1)) { + if (hasQuestItems(player, SHIELD_OF_SACRIFICE)) { htmltext = event; - } - else - { + } else { giveItems(player, SHIELD_OF_SACRIFICE, 1); htmltext = "32860-03.html"; } @@ -280,51 +221,31 @@ public final class Q10295_SevenSignsSolinasTomb extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCompleted()) - { - if (npc.getId() == ERISS_EVIL_THOUGHTS) - { + if (st.isCompleted()) { + if (npc.getId() == ERISS_EVIL_THOUGHTS) { htmltext = "32792-07.html"; } - } - else if (st.isCreated()) - { - if ((player.getLevel() >= MIN_LEVEL) && player.hasQuestCompleted(Q10294_SevenSignsToTheMonasteryOfSilence.class.getSimpleName())) - { + } else if (st.isCreated()) { + if ((player.getLevel() >= MIN_LEVEL) && player.hasQuestCompleted(Q10294_SevenSignsToTheMonasteryOfSilence.class.getSimpleName())) { htmltext = "32792-01.htm"; } - } - else if (st.isStarted()) - { - switch (npc.getId()) - { - case ERISS_EVIL_THOUGHTS: - { + } else if (st.isStarted()) { + switch (npc.getId()) { + case ERISS_EVIL_THOUGHTS: { final int memoState = st.getMemoState(); - if (memoState == 1) - { + if (memoState == 1) { htmltext = "32792-12.html"; - } - else if (memoState == 2) - { + } else if (memoState == 2) { htmltext = "32792-08.html"; - } - else if ((memoState > 2) && (memoState < 6)) - { + } else if ((memoState > 2) && (memoState < 6)) { htmltext = "32792-09.html"; - } - else if (memoState == 6) - { - if (player.isSubClassActive()) - { + } else if (memoState == 6) { + if (player.isSubClassActive()) { htmltext = "32792-10.html"; - } - else - { + } else { addExpAndSp(player, 125000000, 12500000); st.exitQuest(false, true); htmltext = "32792-11.html"; @@ -332,219 +253,159 @@ public final class Q10295_SevenSignsSolinasTomb extends Quest } break; } - case SOLINAS_EVIL_THOUGHTS: - { - switch (st.getMemoState()) - { - case 3: - { + case SOLINAS_EVIL_THOUGHTS: { + switch (st.getMemoState()) { + case 3: { htmltext = "32793-01.html"; break; } - case 4: - { + case 4: { htmltext = "32793-09.html"; break; } - case 5: - { + case 5: { htmltext = "32793-10.html"; break; } - case 6: - { + case 6: { htmltext = "32793-11.html"; break; } } break; } - case SOLINA: - { - if (st.isMemoState(4)) - { + case SOLINA: { + if (st.isMemoState(4)) { htmltext = "32794-01.html"; - } - else if (st.isMemoState(5)) - { + } else if (st.isMemoState(5)) { htmltext = "32794-03.html"; } break; } - case ERIS: - { - if (st.isMemoState(4)) - { + case ERIS: { + if (st.isMemoState(4)) { htmltext = "32795-01.html"; - } - else if (st.isMemoState(5)) - { + } else if (st.isMemoState(5)) { htmltext = "32795-02.html"; } break; } - case ANAIS: - { - if (st.isMemoState(4)) - { + case ANAIS: { + if (st.isMemoState(4)) { htmltext = "32796-01.html"; - } - else if (st.isMemoState(5)) - { + } else if (st.isMemoState(5)) { htmltext = "32796-02.html"; } break; } - case JUDE_VAN_ETINA: - { - if (st.isMemoState(4)) - { + case JUDE_VAN_ETINA: { + if (st.isMemoState(4)) { htmltext = "32797-01.html"; - } - else if (st.isMemoState(5)) - { + } else if (st.isMemoState(5)) { htmltext = "32797-02.html"; } break; } - case TELEPORT_CONTROL_DEVICE_1: - { - if (st.getMemoState() > 1) - { + case TELEPORT_CONTROL_DEVICE_1: { + if (st.getMemoState() > 1) { takeItems(player, -1, SCROLL_OF_ABSTINENCE, SHIELD_OF_SACRIFICE, SWORD_OF_HOLY_SPIRIT, STAFF_OF_BLESSING); htmltext = "32837-01.html"; - } - else if (st.isMemoState(1)) - { + } else if (st.isMemoState(1)) { htmltext = "32837-03.html"; } break; } - case POWERFUL_DEVICE_1: - { - if (st.isMemoState(1)) - { + case POWERFUL_DEVICE_1: { + if (st.isMemoState(1)) { htmltext = "32838-01.html"; } break; } - case POWERFUL_DEVICE_2: - { - if (st.isMemoState(1)) - { + case POWERFUL_DEVICE_2: { + if (st.isMemoState(1)) { htmltext = "32839-01.html"; } break; } - case POWERFUL_DEVICE_3: - { - if (st.isMemoState(1)) - { + case POWERFUL_DEVICE_3: { + if (st.isMemoState(1)) { htmltext = "32840-01.html"; } break; } - case POWERFUL_DEVICE_4: - { - if (st.isMemoState(1)) - { + case POWERFUL_DEVICE_4: { + if (st.isMemoState(1)) { htmltext = "32841-01.html"; } break; } - case TELEPORT_CONTROL_DEVICE_2: - { - if (st.getMemoState() > 2) - { + case TELEPORT_CONTROL_DEVICE_2: { + if (st.getMemoState() > 2) { htmltext = "32842-01.html"; } break; } - case TOMB_OF_THE_SAINTESS: - { - if (st.isMemoState(2)) - { + case TOMB_OF_THE_SAINTESS: { + if (st.isMemoState(2)) { htmltext = "32843-01.html"; - } - else if (st.getMemoState() > 2) - { + } else if (st.getMemoState() > 2) { htmltext = "32843-02.html"; } break; } - case TELEPORT_CONTROL_DEVICE_3: - { - if (st.getMemoState() > 2) - { + case TELEPORT_CONTROL_DEVICE_3: { + if (st.getMemoState() > 2) { htmltext = "32844-01.html"; } break; } - case ALTAR_OF_HALLOWS_1: - { - if (st.isMemoState(1)) - { + case ALTAR_OF_HALLOWS_1: { + if (st.isMemoState(1)) { htmltext = "32857-01.html"; } break; } - case ALTAR_OF_HALLOWS_2: - { - if (st.isMemoState(1)) - { + case ALTAR_OF_HALLOWS_2: { + if (st.isMemoState(1)) { htmltext = "32858-01.html"; } break; } - case ALTAR_OF_HALLOWS_3: - { - if (st.isMemoState(1)) - { + case ALTAR_OF_HALLOWS_3: { + if (st.isMemoState(1)) { htmltext = "32859-01.html"; } break; } - case ALTAR_OF_HALLOWS_4: - { - if (st.isMemoState(1)) - { + case ALTAR_OF_HALLOWS_4: { + if (st.isMemoState(1)) { htmltext = "32860-01.html"; } break; } - case ELCADIA: - { + case ELCADIA: { final int memoState = st.getMemoState(); - if (memoState < 1) - { + if (memoState < 1) { htmltext = "32787-01.html"; - } - else - { - switch (memoState) - { - case 1: - { + } else { + switch (memoState) { + case 1: { htmltext = "32787-02.html"; break; } - case 2: - { + case 2: { htmltext = "32787-03.html"; break; } - case 3: - { + case 3: { htmltext = "32787-04.html"; break; } - case 4: - { + case 4: { htmltext = "32787-05.html"; break; } - case 5: - { + case 5: { htmltext = "32787-06.html"; break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10296_SevenSignsOneWhoSeeksThePowerOfTheSeal/Q10296_SevenSignsOneWhoSeeksThePowerOfTheSeal.java b/src/main/java/com/l2jserver/datapack/quests/Q10296_SevenSignsOneWhoSeeksThePowerOfTheSeal/Q10296_SevenSignsOneWhoSeeksThePowerOfTheSeal.java index ed90c95bb6..aaf84fb879 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10296_SevenSignsOneWhoSeeksThePowerOfTheSeal/Q10296_SevenSignsOneWhoSeeksThePowerOfTheSeal.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10296_SevenSignsOneWhoSeeksThePowerOfTheSeal/Q10296_SevenSignsOneWhoSeeksThePowerOfTheSeal.java @@ -29,8 +29,7 @@ import com.l2jserver.gameserver.model.quest.QuestState; * @author Adry_85 * @since 2.6.0.0 */ -public final class Q10296_SevenSignsOneWhoSeeksThePowerOfTheSeal extends Quest -{ +public final class Q10296_SevenSignsOneWhoSeeksThePowerOfTheSeal extends Quest { // NPCs private static final int HARDIN = 30832; private static final int WOOD = 32593; @@ -44,81 +43,62 @@ public final class Q10296_SevenSignsOneWhoSeeksThePowerOfTheSeal extends Quest // Misc private static final int MIN_LEVEL = 81; - public Q10296_SevenSignsOneWhoSeeksThePowerOfTheSeal() - { + public Q10296_SevenSignsOneWhoSeeksThePowerOfTheSeal() { super(10296, Q10296_SevenSignsOneWhoSeeksThePowerOfTheSeal.class.getSimpleName(), "Seven Signs, One Who Seeks the Power of the Seal"); addStartNpc(ERISS_EVIL_THOUGHTS, ODD_GLOBE); addTalkId(ERISS_EVIL_THOUGHTS, ODD_GLOBE, HARDIN, WOOD, FRANZ, ELCADIA, ELCADIA_2); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - switch (event) - { - case "32792-02.htm": - { + switch (event) { + case "32792-02.htm": { htmltext = event; break; } - case "32792-03.htm": - { + case "32792-03.htm": { st.startQuest(); st.setMemoState(1); htmltext = event; break; } - case "30832-03.html": - { - if (st.isMemoState(4)) - { + case "30832-03.html": { + if (st.isMemoState(4)) { htmltext = event; } break; } - case "30832-04.html": - { - if (st.isMemoState(4)) - { + case "30832-04.html": { + if (st.isMemoState(4)) { st.setMemoState(5); st.setCond(5, true); htmltext = event; } break; } - case "32593-03.html": - { - if (st.isMemoState(5)) - { + case "32593-03.html": { + if (st.isMemoState(5)) { htmltext = event; } break; } - case "32597-02.html": - { - if (st.isMemoState(5)) - { + case "32597-02.html": { + if (st.isMemoState(5)) { htmltext = event; } break; } - case "32597-03.html": - { - if (st.isMemoState(5)) - { - if (player.isSubClassActive()) - { + case "32597-03.html": { + if (st.isMemoState(5)) { + if (player.isSubClassActive()) { htmltext = event; - } - else - { + } else { addExpAndSp(player, 125000000, 12500000); giveItems(player, CERTIFICATE_OF_DAWN, 1); st.exitQuest(false, true); @@ -127,18 +107,14 @@ public final class Q10296_SevenSignsOneWhoSeeksThePowerOfTheSeal extends Quest } break; } - case "32784-02.html": - { - if (st.isMemoState(3)) - { + case "32784-02.html": { + if (st.isMemoState(3)) { htmltext = event; } break; } - case "32784-03.html": - { - if (st.isMemoState(3)) - { + case "32784-03.html": { + if (st.isMemoState(3)) { st.setMemoState(4); st.setCond(4, true); htmltext = event; @@ -150,134 +126,88 @@ public final class Q10296_SevenSignsOneWhoSeeksThePowerOfTheSeal extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - if (st.isCompleted()) - { - if (npc.getId() == ERISS_EVIL_THOUGHTS) - { + if (st.isCompleted()) { + if (npc.getId() == ERISS_EVIL_THOUGHTS) { htmltext = "32792-04.html"; } - } - else if (st.isCreated()) - { - if (player.hasQuestCompleted(Q10295_SevenSignsSolinasTomb.class.getSimpleName())) - { - if ((npc.getId() == ERISS_EVIL_THOUGHTS) && (player.getLevel() >= MIN_LEVEL)) - { + } else if (st.isCreated()) { + if (player.hasQuestCompleted(Q10295_SevenSignsSolinasTomb.class.getSimpleName())) { + if ((npc.getId() == ERISS_EVIL_THOUGHTS) && (player.getLevel() >= MIN_LEVEL)) { htmltext = "32792-01.htm"; - } - else - { + } else { htmltext = "32815-01.html"; } } - } - else if (st.isStarted()) - { - switch (npc.getId()) - { - case ERISS_EVIL_THOUGHTS: - { - if (st.isMemoState(1)) - { + } else if (st.isStarted()) { + switch (npc.getId()) { + case ERISS_EVIL_THOUGHTS: { + if (st.isMemoState(1)) { st.setMemoState(2); st.setCond(2, true); htmltext = "32792-05.html"; - } - else if (st.isMemoState(2)) - { + } else if (st.isMemoState(2)) { htmltext = "32792-06.html"; } break; } - case ODD_GLOBE: - { + case ODD_GLOBE: { final int memoState = st.getMemoState(); - if ((memoState > 0) && (memoState <= 2)) - { + if ((memoState > 0) && (memoState <= 2)) { htmltext = "32815-01.html"; - } - else if (memoState > 2) - { + } else if (memoState > 2) { htmltext = "32815-02.html"; } break; } - case HARDIN: - { + case HARDIN: { final int memoState = st.getMemoState(); - if (memoState < 4) - { + if (memoState < 4) { htmltext = "30832-01.html"; - } - else if (memoState == 4) - { + } else if (memoState == 4) { htmltext = "30832-02.html"; - } - else if (memoState > 4) - { + } else if (memoState > 4) { htmltext = "30832-04.html"; } break; } - case WOOD: - { + case WOOD: { final int memoState = st.getMemoState(); - if (memoState < 5) - { + if (memoState < 5) { htmltext = "32593-01.html"; - } - else if (memoState == 5) - { + } else if (memoState == 5) { htmltext = "32593-02.html"; - } - else if (memoState > 5) - { + } else if (memoState > 5) { htmltext = "32593-04.html"; } break; } - case FRANZ: - { - if (st.isMemoState(5)) - { + case FRANZ: { + if (st.isMemoState(5)) { htmltext = "32597-01.html"; } break; } - case ELCADIA: - { + case ELCADIA: { final int memoState = st.getMemoState(); - if (memoState == 3) - { + if (memoState == 3) { htmltext = "32784-01.html"; - } - else if (memoState > 3) - { + } else if (memoState > 3) { htmltext = "32784-04.html"; } break; } - case ELCADIA_2: - { + case ELCADIA_2: { final int memoState = st.getMemoState(); - if (memoState < 1) - { + if (memoState < 1) { htmltext = "32787-01.html"; - } - else if (memoState < 2) - { + } else if (memoState < 2) { htmltext = "32787-02.html"; - } - else if (memoState == 2) - { + } else if (memoState == 2) { htmltext = "32787-03.html"; - } - else - { + } else { st.setCond(3, true); htmltext = "32787-04.html"; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10501_ZakenEmbroideredSoulCloak/Q10501_ZakenEmbroideredSoulCloak.java b/src/main/java/com/l2jserver/datapack/quests/Q10501_ZakenEmbroideredSoulCloak/Q10501_ZakenEmbroideredSoulCloak.java index a8fed55592..7a711b357c 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10501_ZakenEmbroideredSoulCloak/Q10501_ZakenEmbroideredSoulCloak.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10501_ZakenEmbroideredSoulCloak/Q10501_ZakenEmbroideredSoulCloak.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.util.Util; * Zaken Embroidered Soul Cloak (10501) * @author Zoey76 */ -public class Q10501_ZakenEmbroideredSoulCloak extends Quest -{ +public class Q10501_ZakenEmbroideredSoulCloak extends Quest { // NPC private static final int OLF_ADAMS = 32612; // Monster @@ -43,8 +42,7 @@ public class Q10501_ZakenEmbroideredSoulCloak extends Quest private static final int MIN_LEVEL = 78; private static final int FRAGMENT_COUNT = 20; - public Q10501_ZakenEmbroideredSoulCloak() - { + public Q10501_ZakenEmbroideredSoulCloak() { super(10501, Q10501_ZakenEmbroideredSoulCloak.class.getSimpleName(), "Zaken Embroidered Soul Cloak"); addStartNpc(OLF_ADAMS); addTalkId(OLF_ADAMS); @@ -53,20 +51,15 @@ public class Q10501_ZakenEmbroideredSoulCloak extends Quest } @Override - public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) - { + public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) - { + if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) { final long currentCount = getQuestItemsCount(player, ZAKENS_SOUL_FRAGMENT); final long count = getRandom(1, 3); - if (count >= (FRAGMENT_COUNT - currentCount)) - { + if (count >= (FRAGMENT_COUNT - currentCount)) { giveItems(player, ZAKENS_SOUL_FRAGMENT, FRAGMENT_COUNT - currentCount); st.setCond(2, true); - } - else - { + } else { giveItems(player, ZAKENS_SOUL_FRAGMENT, count); playSound(player, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -74,11 +67,9 @@ public class Q10501_ZakenEmbroideredSoulCloak extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && (player.getLevel() >= MIN_LEVEL) && event.equals("32612-04.html")) - { + if ((st != null) && (player.getLevel() >= MIN_LEVEL) && event.equals("32612-04.html")) { st.startQuest(); return event; } @@ -86,37 +77,28 @@ public class Q10501_ZakenEmbroideredSoulCloak extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { executeForEachPlayer(killer, npc, isSummon, true, true); return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getLevel() < MIN_LEVEL) ? "32612-02.html" : "32612-01.htm"; break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "32612-05.html"; break; } - case 2: - { - if (getQuestItemsCount(player, ZAKENS_SOUL_FRAGMENT) >= FRAGMENT_COUNT) - { + case 2: { + if (getQuestItemsCount(player, ZAKENS_SOUL_FRAGMENT) >= FRAGMENT_COUNT) { giveItems(player, SOUL_CLOAK_OF_ZAKEN, 1); playSound(player, Sound.ITEMSOUND_QUEST_ITEMGET); st.exitQuest(false, true); @@ -127,8 +109,7 @@ public class Q10501_ZakenEmbroideredSoulCloak extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = "32612-03.html"; break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10502_FreyaEmbroideredSoulCloak/Q10502_FreyaEmbroideredSoulCloak.java b/src/main/java/com/l2jserver/datapack/quests/Q10502_FreyaEmbroideredSoulCloak/Q10502_FreyaEmbroideredSoulCloak.java index f18536bbbd..eb4ba65b7e 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10502_FreyaEmbroideredSoulCloak/Q10502_FreyaEmbroideredSoulCloak.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10502_FreyaEmbroideredSoulCloak/Q10502_FreyaEmbroideredSoulCloak.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.util.Util; * Freya Embroidered Soul Cloak (10502) * @author Zoey76 */ -public class Q10502_FreyaEmbroideredSoulCloak extends Quest -{ +public class Q10502_FreyaEmbroideredSoulCloak extends Quest { // NPC private static final int OLF_ADAMS = 32612; // Monster @@ -43,8 +42,7 @@ public class Q10502_FreyaEmbroideredSoulCloak extends Quest private static final int MIN_LEVEL = 82; private static final int FRAGMENT_COUNT = 20; - public Q10502_FreyaEmbroideredSoulCloak() - { + public Q10502_FreyaEmbroideredSoulCloak() { super(10502, Q10502_FreyaEmbroideredSoulCloak.class.getSimpleName(), "Freya Embroidered Soul Cloak"); addStartNpc(OLF_ADAMS); addTalkId(OLF_ADAMS); @@ -53,20 +51,15 @@ public class Q10502_FreyaEmbroideredSoulCloak extends Quest } @Override - public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) - { + public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) - { + if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) { final long currentCount = getQuestItemsCount(player, FREYAS_SOUL_FRAGMENT); final long count = getRandom(1, 3); - if (count >= (FRAGMENT_COUNT - currentCount)) - { + if (count >= (FRAGMENT_COUNT - currentCount)) { giveItems(player, FREYAS_SOUL_FRAGMENT, FRAGMENT_COUNT - currentCount); st.setCond(2, true); - } - else - { + } else { giveItems(player, FREYAS_SOUL_FRAGMENT, count); playSound(player, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -74,11 +67,9 @@ public class Q10502_FreyaEmbroideredSoulCloak extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && (player.getLevel() >= MIN_LEVEL) && event.equals("32612-04.html")) - { + if ((st != null) && (player.getLevel() >= MIN_LEVEL) && event.equals("32612-04.html")) { st.startQuest(); return event; } @@ -86,37 +77,28 @@ public class Q10502_FreyaEmbroideredSoulCloak extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { executeForEachPlayer(killer, npc, isSummon, true, true); return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getLevel() < MIN_LEVEL) ? "32612-02.html" : "32612-01.htm"; break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "32612-05.html"; break; } - case 2: - { - if (getQuestItemsCount(player, FREYAS_SOUL_FRAGMENT) >= FRAGMENT_COUNT) - { + case 2: { + if (getQuestItemsCount(player, FREYAS_SOUL_FRAGMENT) >= FRAGMENT_COUNT) { giveItems(player, SOUL_CLOAK_OF_FREYA, 1); playSound(player, Sound.ITEMSOUND_QUEST_ITEMGET); st.exitQuest(false, true); @@ -127,8 +109,7 @@ public class Q10502_FreyaEmbroideredSoulCloak extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = "32612-03.html"; break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10503_FrintezzaEmbroideredSoulCloak/Q10503_FrintezzaEmbroideredSoulCloak.java b/src/main/java/com/l2jserver/datapack/quests/Q10503_FrintezzaEmbroideredSoulCloak/Q10503_FrintezzaEmbroideredSoulCloak.java index 9cbc96b231..95c63a7ef4 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10503_FrintezzaEmbroideredSoulCloak/Q10503_FrintezzaEmbroideredSoulCloak.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10503_FrintezzaEmbroideredSoulCloak/Q10503_FrintezzaEmbroideredSoulCloak.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.util.Util; * Frintezza Embroidered Soul Cloak (10503) * @author Zoey76 */ -public class Q10503_FrintezzaEmbroideredSoulCloak extends Quest -{ +public class Q10503_FrintezzaEmbroideredSoulCloak extends Quest { // NPC private static final int OLF_ADAMS = 32612; // Monster @@ -44,8 +43,7 @@ public class Q10503_FrintezzaEmbroideredSoulCloak extends Quest private static final int MIN_LEVEL = 80; private static final int FRAGMENT_COUNT = 20; - public Q10503_FrintezzaEmbroideredSoulCloak() - { + public Q10503_FrintezzaEmbroideredSoulCloak() { super(10503, Q10503_FrintezzaEmbroideredSoulCloak.class.getSimpleName(), "Frintezza Embroidered Soul Cloak"); addStartNpc(OLF_ADAMS); addTalkId(OLF_ADAMS); @@ -54,20 +52,15 @@ public class Q10503_FrintezzaEmbroideredSoulCloak extends Quest } @Override - public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) - { + public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) - { + if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) { final long currentCount = getQuestItemsCount(player, FRINTEZZAS_SOUL_FRAGMENT); final long count = getRandom(1, 3); - if (count >= (FRAGMENT_COUNT - currentCount)) - { + if (count >= (FRAGMENT_COUNT - currentCount)) { giveItems(player, FRINTEZZAS_SOUL_FRAGMENT, FRAGMENT_COUNT - currentCount); st.setCond(2, true); - } - else - { + } else { giveItems(player, FRINTEZZAS_SOUL_FRAGMENT, count); playSound(player, Sound.ITEMSOUND_QUEST_ITEMGET); } @@ -75,11 +68,9 @@ public class Q10503_FrintezzaEmbroideredSoulCloak extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if ((st != null) && (player.getLevel() >= MIN_LEVEL) && event.equals("32612-04.html")) - { + if ((st != null) && (player.getLevel() >= MIN_LEVEL) && event.equals("32612-04.html")) { st.startQuest(); return event; } @@ -87,37 +78,28 @@ public class Q10503_FrintezzaEmbroideredSoulCloak extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { executeForEachPlayer(killer, npc, isSummon, true, true); return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { + switch (st.getState()) { + case State.CREATED: { htmltext = (player.getLevel() < MIN_LEVEL) ? "32612-02.html" : "32612-01.htm"; break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { htmltext = "32612-05.html"; break; } - case 2: - { - if (getQuestItemsCount(player, FRINTEZZAS_SOUL_FRAGMENT) >= FRAGMENT_COUNT) - { + case 2: { + if (getQuestItemsCount(player, FRINTEZZAS_SOUL_FRAGMENT) >= FRAGMENT_COUNT) { giveItems(player, SOUL_CLOAK_OF_FRINTEZZA, 1); playSound(player, Sound.ITEMSOUND_QUEST_ITEMGET); st.exitQuest(false, true); @@ -128,8 +110,7 @@ public class Q10503_FrintezzaEmbroideredSoulCloak extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = "32612-03.html"; break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10504_JewelOfAntharas/Q10504_JewelOfAntharas.java b/src/main/java/com/l2jserver/datapack/quests/Q10504_JewelOfAntharas/Q10504_JewelOfAntharas.java index ba2be3d157..1de5a9b305 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10504_JewelOfAntharas/Q10504_JewelOfAntharas.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10504_JewelOfAntharas/Q10504_JewelOfAntharas.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.util.Util; * Jewel of Antharas (10504) * @author Zoey76 */ -public final class Q10504_JewelOfAntharas extends Quest -{ +public final class Q10504_JewelOfAntharas extends Quest { // NPC private static final int THEODRIC = 30755; // Monster @@ -44,8 +43,7 @@ public final class Q10504_JewelOfAntharas extends Quest // Misc private static final int MIN_LEVEL = 84; - public Q10504_JewelOfAntharas() - { + public Q10504_JewelOfAntharas() { super(10504, Q10504_JewelOfAntharas.class.getSimpleName(), "Jewel of Antharas"); addStartNpc(THEODRIC); addTalkId(THEODRIC); @@ -54,11 +52,9 @@ public final class Q10504_JewelOfAntharas extends Quest } @Override - public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) - { + public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) - { + if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) { takeItems(player, CLEAR_CRYSTAL, -1); giveItems(player, FILLED_CRYSTAL_ANTHARAS_ENERGY, 1); playSound(player, Sound.ITEMSOUND_QUEST_ITEMGET); @@ -67,27 +63,21 @@ public final class Q10504_JewelOfAntharas extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - if ((player.getLevel() >= MIN_LEVEL) && hasQuestItems(player, PORTAL_STONE)) - { - switch (event) - { + if ((player.getLevel() >= MIN_LEVEL) && hasQuestItems(player, PORTAL_STONE)) { + switch (event) { case "30755-05.htm": - case "30755-06.htm": - { + case "30755-06.htm": { htmltext = event; break; } - case "30755-07.html": - { + case "30755-07.html": { st.startQuest(); giveItems(player, CLEAR_CRYSTAL, 1); htmltext = event; @@ -99,54 +89,38 @@ public final class Q10504_JewelOfAntharas extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { executeForEachPlayer(killer, npc, isSummon, true, true); return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { - if (player.getLevel() < MIN_LEVEL) - { + switch (st.getState()) { + case State.CREATED: { + if (player.getLevel() < MIN_LEVEL) { htmltext = "30755-02.html"; - } - else if (!hasQuestItems(player, PORTAL_STONE)) - { + } else if (!hasQuestItems(player, PORTAL_STONE)) { htmltext = "30755-04.html"; - } - else - { + } else { htmltext = "30755-01.htm"; } break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { - if (hasQuestItems(player, CLEAR_CRYSTAL)) - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { + if (hasQuestItems(player, CLEAR_CRYSTAL)) { htmltext = "30755-08.html"; - } - else - { + } else { giveItems(player, CLEAR_CRYSTAL, 1); htmltext = "30755-09.html"; } break; } - case 2: - { + case 2: { giveItems(player, JEWEL_OF_ANTHARAS, 1); playSound(player, Sound.ITEMSOUND_QUEST_ITEMGET); st.exitQuest(false, true); @@ -156,8 +130,7 @@ public final class Q10504_JewelOfAntharas extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = "30755-03.html"; break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/Q10505_JewelOfValakas/Q10505_JewelOfValakas.java b/src/main/java/com/l2jserver/datapack/quests/Q10505_JewelOfValakas/Q10505_JewelOfValakas.java index b6ca18f5a8..30d47ac70a 100644 --- a/src/main/java/com/l2jserver/datapack/quests/Q10505_JewelOfValakas/Q10505_JewelOfValakas.java +++ b/src/main/java/com/l2jserver/datapack/quests/Q10505_JewelOfValakas/Q10505_JewelOfValakas.java @@ -30,8 +30,7 @@ import com.l2jserver.gameserver.util.Util; * Jewel of Valakas (10505) * @author Zoey76 */ -public class Q10505_JewelOfValakas extends Quest -{ +public class Q10505_JewelOfValakas extends Quest { // NPC private static final int KLEIN = 31540; // Monster @@ -44,8 +43,7 @@ public class Q10505_JewelOfValakas extends Quest // Misc private static final int MIN_LEVEL = 83; - public Q10505_JewelOfValakas() - { + public Q10505_JewelOfValakas() { super(10505, Q10505_JewelOfValakas.class.getSimpleName(), "Jewel of Valakas"); addStartNpc(KLEIN); addTalkId(KLEIN); @@ -54,11 +52,9 @@ public class Q10505_JewelOfValakas extends Quest } @Override - public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) - { + public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) { final QuestState st = getQuestState(player, false); - if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) - { + if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) { takeItems(player, EMPTY_CRYSTAL, -1); giveItems(player, FILLED_CRYSTAL_VALAKAS_ENERGY, 1); playSound(player, Sound.ITEMSOUND_QUEST_ITEMGET); @@ -67,27 +63,21 @@ public class Q10505_JewelOfValakas extends Quest } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); - if (st == null) - { + if (st == null) { return null; } String htmltext = null; - if ((player.getLevel() >= MIN_LEVEL) && hasQuestItems(player, VACUALITE_FLOATING_STONE)) - { - switch (event) - { + if ((player.getLevel() >= MIN_LEVEL) && hasQuestItems(player, VACUALITE_FLOATING_STONE)) { + switch (event) { case "31540-05.htm": - case "31540-06.htm": - { + case "31540-06.htm": { htmltext = event; break; } - case "31540-07.html": - { + case "31540-07.html": { st.startQuest(); giveItems(player, EMPTY_CRYSTAL, 1); htmltext = event; @@ -99,54 +89,38 @@ public class Q10505_JewelOfValakas extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { executeForEachPlayer(killer, npc, isSummon, true, true); return super.onKill(npc, killer, isSummon); } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); - switch (st.getState()) - { - case State.CREATED: - { - if (player.getLevel() < MIN_LEVEL) - { + switch (st.getState()) { + case State.CREATED: { + if (player.getLevel() < MIN_LEVEL) { htmltext = "31540-02.html"; - } - else if (!hasQuestItems(player, VACUALITE_FLOATING_STONE)) - { + } else if (!hasQuestItems(player, VACUALITE_FLOATING_STONE)) { htmltext = "31540-04.html"; - } - else - { + } else { htmltext = "31540-01.htm"; } break; } - case State.STARTED: - { - switch (st.getCond()) - { - case 1: - { - if (hasQuestItems(player, EMPTY_CRYSTAL)) - { + case State.STARTED: { + switch (st.getCond()) { + case 1: { + if (hasQuestItems(player, EMPTY_CRYSTAL)) { htmltext = "31540-08.html"; - } - else - { + } else { giveItems(player, EMPTY_CRYSTAL, 1); htmltext = "31540-09.html"; } break; } - case 2: - { + case 2: { giveItems(player, JEWEL_OF_VALAKAS, 1); playSound(player, Sound.ITEMSOUND_QUEST_ITEMGET); st.exitQuest(false, true); @@ -156,8 +130,7 @@ public class Q10505_JewelOfValakas extends Quest } break; } - case State.COMPLETED: - { + case State.COMPLETED: { htmltext = "31540-03.html"; break; } diff --git a/src/main/java/com/l2jserver/datapack/quests/QuestMasterHandler.java b/src/main/java/com/l2jserver/datapack/quests/QuestMasterHandler.java index 34750f7dff..22deffe22e 100644 --- a/src/main/java/com/l2jserver/datapack/quests/QuestMasterHandler.java +++ b/src/main/java/com/l2jserver/datapack/quests/QuestMasterHandler.java @@ -524,12 +524,10 @@ import com.l2jserver.datapack.quests.Q10505_JewelOfValakas.Q10505_JewelOfValakas /** * @author NosBit */ -public class QuestMasterHandler -{ +public class QuestMasterHandler { private static final Logger _log = Logger.getLogger(QuestMasterHandler.class.getName()); - private static final Class<?>[] QUESTS = - { + private static final Class<?>[] QUESTS = { Q00001_LettersOfLove.class, Q00002_WhatWomenWant.class, Q00003_WillTheSealBeBroken.class, @@ -1031,16 +1029,11 @@ public class QuestMasterHandler Q10505_JewelOfValakas.class }; - public static void main(String[] args) - { - for (Class<?> quest : QUESTS) - { - try - { + public static void main(String[] args) { + for (Class<?> quest : QUESTS) { + try { quest.getDeclaredConstructor().newInstance(); - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.SEVERE, QuestMasterHandler.class.getSimpleName() + ": Failed loading " + quest.getSimpleName() + ":", e); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00717_ForTheSakeOfTheTerritoryGludio.java b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00717_ForTheSakeOfTheTerritoryGludio.java index bbf061d063..b91127fb14 100644 --- a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00717_ForTheSakeOfTheTerritoryGludio.java +++ b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00717_ForTheSakeOfTheTerritoryGludio.java @@ -24,28 +24,23 @@ import com.l2jserver.gameserver.network.NpcStringId; * For the Sake of the Territory - Gludio (717) * @author Gigiikun */ -public final class Q00717_ForTheSakeOfTheTerritoryGludio extends TerritoryWarSuperClass -{ - public Q00717_ForTheSakeOfTheTerritoryGludio() - { +public final class Q00717_ForTheSakeOfTheTerritoryGludio extends TerritoryWarSuperClass { + public Q00717_ForTheSakeOfTheTerritoryGludio() { super(717, Q00717_ForTheSakeOfTheTerritoryGludio.class.getSimpleName(), "For the Sake of the Territory - Gludio"); CATAPULT_ID = 36499; TERRITORY_ID = 81; - LEADER_IDS = new int[] - { + LEADER_IDS = new int[] { 36508, 36510, 36513, 36591 }; - GUARD_IDS = new int[] - { + GUARD_IDS = new int[] { 36509, 36511, 36512 }; - npcString = new NpcStringId[] - { + npcString = new NpcStringId[] { NpcStringId.THE_CATAPULT_OF_GLUDIO_HAS_BEEN_DESTROYED }; registerKillIds(); diff --git a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00718_ForTheSakeOfTheTerritoryDion.java b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00718_ForTheSakeOfTheTerritoryDion.java index 761aef9516..d7b1db10bb 100644 --- a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00718_ForTheSakeOfTheTerritoryDion.java +++ b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00718_ForTheSakeOfTheTerritoryDion.java @@ -24,28 +24,23 @@ import com.l2jserver.gameserver.network.NpcStringId; * For the Sake of the Territory - Dion (718) * @author Gigiikun */ -public final class Q00718_ForTheSakeOfTheTerritoryDion extends TerritoryWarSuperClass -{ - public Q00718_ForTheSakeOfTheTerritoryDion() - { +public final class Q00718_ForTheSakeOfTheTerritoryDion extends TerritoryWarSuperClass { + public Q00718_ForTheSakeOfTheTerritoryDion() { super(718, Q00718_ForTheSakeOfTheTerritoryDion.class.getSimpleName(), "For the Sake of the Territory - Dion"); CATAPULT_ID = 36500; TERRITORY_ID = 82; - LEADER_IDS = new int[] - { + LEADER_IDS = new int[] { 36514, 36516, 36519, 36592 }; - GUARD_IDS = new int[] - { + GUARD_IDS = new int[] { 36515, 36517, 36518 }; - npcString = new NpcStringId[] - { + npcString = new NpcStringId[] { NpcStringId.THE_CATAPULT_OF_DION_HAS_BEEN_DESTROYED }; registerKillIds(); diff --git a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00719_ForTheSakeOfTheTerritoryGiran.java b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00719_ForTheSakeOfTheTerritoryGiran.java index 8613d85070..6ae261ff6c 100644 --- a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00719_ForTheSakeOfTheTerritoryGiran.java +++ b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00719_ForTheSakeOfTheTerritoryGiran.java @@ -24,28 +24,23 @@ import com.l2jserver.gameserver.network.NpcStringId; * For the Sake of the Territory - Giran (719) * @author Gigiikun */ -public final class Q00719_ForTheSakeOfTheTerritoryGiran extends TerritoryWarSuperClass -{ - public Q00719_ForTheSakeOfTheTerritoryGiran() - { +public final class Q00719_ForTheSakeOfTheTerritoryGiran extends TerritoryWarSuperClass { + public Q00719_ForTheSakeOfTheTerritoryGiran() { super(719, Q00719_ForTheSakeOfTheTerritoryGiran.class.getSimpleName(), "For the Sake of the Territory - Giran"); CATAPULT_ID = 36501; TERRITORY_ID = 83; - LEADER_IDS = new int[] - { + LEADER_IDS = new int[] { 36520, 36522, 36525, 36593 }; - GUARD_IDS = new int[] - { + GUARD_IDS = new int[] { 36521, 36523, 36524 }; - npcString = new NpcStringId[] - { + npcString = new NpcStringId[] { NpcStringId.THE_CATAPULT_OF_GIRAN_HAS_BEEN_DESTROYED }; registerKillIds(); diff --git a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00720_ForTheSakeOfTheTerritoryOren.java b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00720_ForTheSakeOfTheTerritoryOren.java index 93f9d5ce4d..a9222e1f4a 100644 --- a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00720_ForTheSakeOfTheTerritoryOren.java +++ b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00720_ForTheSakeOfTheTerritoryOren.java @@ -24,28 +24,23 @@ import com.l2jserver.gameserver.network.NpcStringId; * For the Sake of the Territory - Oren (720) * @author Gigiikun */ -public final class Q00720_ForTheSakeOfTheTerritoryOren extends TerritoryWarSuperClass -{ - public Q00720_ForTheSakeOfTheTerritoryOren() - { +public final class Q00720_ForTheSakeOfTheTerritoryOren extends TerritoryWarSuperClass { + public Q00720_ForTheSakeOfTheTerritoryOren() { super(720, Q00720_ForTheSakeOfTheTerritoryOren.class.getSimpleName(), "For the Sake of the Territory - Oren"); CATAPULT_ID = 36502; TERRITORY_ID = 84; - LEADER_IDS = new int[] - { + LEADER_IDS = new int[] { 36526, 36528, 36531, 36594 }; - GUARD_IDS = new int[] - { + GUARD_IDS = new int[] { 36527, 36529, 36530 }; - npcString = new NpcStringId[] - { + npcString = new NpcStringId[] { NpcStringId.THE_CATAPULT_OF_OREN_HAS_BEEN_DESTROYED }; registerKillIds(); diff --git a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00721_ForTheSakeOfTheTerritoryAden.java b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00721_ForTheSakeOfTheTerritoryAden.java index 3452100da0..7649a2d15e 100644 --- a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00721_ForTheSakeOfTheTerritoryAden.java +++ b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00721_ForTheSakeOfTheTerritoryAden.java @@ -24,28 +24,23 @@ import com.l2jserver.gameserver.network.NpcStringId; * For the Sake of the Territory - Aden (721) * @author Gigiikun */ -public final class Q00721_ForTheSakeOfTheTerritoryAden extends TerritoryWarSuperClass -{ - public Q00721_ForTheSakeOfTheTerritoryAden() - { +public final class Q00721_ForTheSakeOfTheTerritoryAden extends TerritoryWarSuperClass { + public Q00721_ForTheSakeOfTheTerritoryAden() { super(721, Q00721_ForTheSakeOfTheTerritoryAden.class.getSimpleName(), "For the Sake of the Territory - Aden"); CATAPULT_ID = 36503; TERRITORY_ID = 85; - LEADER_IDS = new int[] - { + LEADER_IDS = new int[] { 36532, 36534, 36537, 36595 }; - GUARD_IDS = new int[] - { + GUARD_IDS = new int[] { 36533, 36535, 36536 }; - npcString = new NpcStringId[] - { + npcString = new NpcStringId[] { NpcStringId.THE_CATAPULT_OF_ADEN_HAS_BEEN_DESTROYED }; registerKillIds(); diff --git a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00722_ForTheSakeOfTheTerritoryInnadril.java b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00722_ForTheSakeOfTheTerritoryInnadril.java index 7e6e4afa92..0a1f989422 100644 --- a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00722_ForTheSakeOfTheTerritoryInnadril.java +++ b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00722_ForTheSakeOfTheTerritoryInnadril.java @@ -24,28 +24,23 @@ import com.l2jserver.gameserver.network.NpcStringId; * For the Sake of the Territory - Innadril (722) * @author Gigiikun */ -public final class Q00722_ForTheSakeOfTheTerritoryInnadril extends TerritoryWarSuperClass -{ - public Q00722_ForTheSakeOfTheTerritoryInnadril() - { +public final class Q00722_ForTheSakeOfTheTerritoryInnadril extends TerritoryWarSuperClass { + public Q00722_ForTheSakeOfTheTerritoryInnadril() { super(722, Q00722_ForTheSakeOfTheTerritoryInnadril.class.getSimpleName(), "For the Sake of the Territory - Innadril"); CATAPULT_ID = 36504; TERRITORY_ID = 86; - LEADER_IDS = new int[] - { + LEADER_IDS = new int[] { 36538, 36540, 36543, 36596 }; - GUARD_IDS = new int[] - { + GUARD_IDS = new int[] { 36539, 36541, 36542 }; - npcString = new NpcStringId[] - { + npcString = new NpcStringId[] { NpcStringId.THE_CATAPULT_OF_INNADRIL_HAS_BEEN_DESTROYED }; registerKillIds(); diff --git a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00723_ForTheSakeOfTheTerritoryGoddard.java b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00723_ForTheSakeOfTheTerritoryGoddard.java index cf49ce09ca..b630fb569d 100644 --- a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00723_ForTheSakeOfTheTerritoryGoddard.java +++ b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00723_ForTheSakeOfTheTerritoryGoddard.java @@ -24,28 +24,23 @@ import com.l2jserver.gameserver.network.NpcStringId; * For the Sake of the Territory - Goddard (723) * @author Gigiikun */ -public final class Q00723_ForTheSakeOfTheTerritoryGoddard extends TerritoryWarSuperClass -{ - public Q00723_ForTheSakeOfTheTerritoryGoddard() - { +public final class Q00723_ForTheSakeOfTheTerritoryGoddard extends TerritoryWarSuperClass { + public Q00723_ForTheSakeOfTheTerritoryGoddard() { super(723, Q00723_ForTheSakeOfTheTerritoryGoddard.class.getSimpleName(), "For the Sake of the Territory - Goddard"); CATAPULT_ID = 36505; TERRITORY_ID = 87; - LEADER_IDS = new int[] - { + LEADER_IDS = new int[] { 36544, 36546, 36549, 36597 }; - GUARD_IDS = new int[] - { + GUARD_IDS = new int[] { 36545, 36547, 36548 }; - npcString = new NpcStringId[] - { + npcString = new NpcStringId[] { NpcStringId.THE_CATAPULT_OF_GODDARD_HAS_BEEN_DESTROYED }; registerKillIds(); diff --git a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00724_ForTheSakeOfTheTerritoryRune.java b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00724_ForTheSakeOfTheTerritoryRune.java index bab9e0dd31..5a25490f7d 100644 --- a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00724_ForTheSakeOfTheTerritoryRune.java +++ b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00724_ForTheSakeOfTheTerritoryRune.java @@ -24,28 +24,23 @@ import com.l2jserver.gameserver.network.NpcStringId; * For the Sake of the Territory - Rune (724) * @author Gigiikun */ -public final class Q00724_ForTheSakeOfTheTerritoryRune extends TerritoryWarSuperClass -{ - public Q00724_ForTheSakeOfTheTerritoryRune() - { +public final class Q00724_ForTheSakeOfTheTerritoryRune extends TerritoryWarSuperClass { + public Q00724_ForTheSakeOfTheTerritoryRune() { super(724, Q00724_ForTheSakeOfTheTerritoryRune.class.getSimpleName(), "For the Sake of the Territory - Rune"); CATAPULT_ID = 36506; TERRITORY_ID = 88; - LEADER_IDS = new int[] - { + LEADER_IDS = new int[] { 36550, 36552, 36555, 36598 }; - GUARD_IDS = new int[] - { + GUARD_IDS = new int[] { 36551, 36553, 36554 }; - npcString = new NpcStringId[] - { + npcString = new NpcStringId[] { NpcStringId.THE_CATAPULT_OF_RUNE_HAS_BEEN_DESTROYED }; registerKillIds(); diff --git a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00725_ForTheSakeOfTheTerritorySchuttgart.java b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00725_ForTheSakeOfTheTerritorySchuttgart.java index 006bdfe204..7fb3dd9d43 100644 --- a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00725_ForTheSakeOfTheTerritorySchuttgart.java +++ b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00725_ForTheSakeOfTheTerritorySchuttgart.java @@ -24,28 +24,23 @@ import com.l2jserver.gameserver.network.NpcStringId; * For the Sake of the Territory - Schuttgart (725) * @author Gigiikun */ -public final class Q00725_ForTheSakeOfTheTerritorySchuttgart extends TerritoryWarSuperClass -{ - public Q00725_ForTheSakeOfTheTerritorySchuttgart() - { +public final class Q00725_ForTheSakeOfTheTerritorySchuttgart extends TerritoryWarSuperClass { + public Q00725_ForTheSakeOfTheTerritorySchuttgart() { super(725, Q00725_ForTheSakeOfTheTerritorySchuttgart.class.getSimpleName(), "For the Sake of the Territory - Schuttgart"); CATAPULT_ID = 36507; TERRITORY_ID = 89; - LEADER_IDS = new int[] - { + LEADER_IDS = new int[] { 36556, 36558, 36561, 36599 }; - GUARD_IDS = new int[] - { + GUARD_IDS = new int[] { 36557, 36559, 36560 }; - npcString = new NpcStringId[] - { + npcString = new NpcStringId[] { NpcStringId.THE_CATAPULT_OF_SCHUTTGART_HAS_BEEN_DESTROYED }; registerKillIds(); diff --git a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00729_ProtectTheTerritoryCatapult.java b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00729_ProtectTheTerritoryCatapult.java index 790f63f53a..68c89ed2a7 100644 --- a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00729_ProtectTheTerritoryCatapult.java +++ b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00729_ProtectTheTerritoryCatapult.java @@ -22,13 +22,10 @@ package com.l2jserver.datapack.quests.TerritoryWarScripts; * Protect the Territory Catapult! (729) * @author Gigiikun */ -public final class Q00729_ProtectTheTerritoryCatapult extends TerritoryWarSuperClass -{ - public Q00729_ProtectTheTerritoryCatapult() - { +public final class Q00729_ProtectTheTerritoryCatapult extends TerritoryWarSuperClass { + public Q00729_ProtectTheTerritoryCatapult() { super(729, Q00729_ProtectTheTerritoryCatapult.class.getSimpleName(), "Protect the Territory Catapult"); - NPC_IDS = new int[] - { + NPC_IDS = new int[] { 36499, 36500, 36501, @@ -43,8 +40,7 @@ public final class Q00729_ProtectTheTerritoryCatapult extends TerritoryWarSuperC } @Override - public int getTerritoryIdForThisNPCId(int npcId) - { + public int getTerritoryIdForThisNPCId(int npcId) { return npcId - 36418; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00730_ProtectTheSuppliesSafe.java b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00730_ProtectTheSuppliesSafe.java index 7189dae673..09d8ca5a4d 100644 --- a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00730_ProtectTheSuppliesSafe.java +++ b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00730_ProtectTheSuppliesSafe.java @@ -22,13 +22,10 @@ package com.l2jserver.datapack.quests.TerritoryWarScripts; * Protect the Supplies Safe (730) * @author Gigiikun */ -public final class Q00730_ProtectTheSuppliesSafe extends TerritoryWarSuperClass -{ - public Q00730_ProtectTheSuppliesSafe() - { +public final class Q00730_ProtectTheSuppliesSafe extends TerritoryWarSuperClass { + public Q00730_ProtectTheSuppliesSafe() { super(730, Q00730_ProtectTheSuppliesSafe.class.getSimpleName(), "Protect the Supplies Safe"); - NPC_IDS = new int[] - { + NPC_IDS = new int[] { 36591, 36592, 36593, @@ -43,8 +40,7 @@ public final class Q00730_ProtectTheSuppliesSafe extends TerritoryWarSuperClass } @Override - public int getTerritoryIdForThisNPCId(int npcId) - { + public int getTerritoryIdForThisNPCId(int npcId) { return npcId - 36510; } } diff --git a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00731_ProtectTheMilitaryAssociationLeader.java b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00731_ProtectTheMilitaryAssociationLeader.java index e9760d7073..298d851943 100644 --- a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00731_ProtectTheMilitaryAssociationLeader.java +++ b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00731_ProtectTheMilitaryAssociationLeader.java @@ -22,13 +22,10 @@ package com.l2jserver.datapack.quests.TerritoryWarScripts; * Protect the Military Association Leader (731) * @author Gigiikun */ -public final class Q00731_ProtectTheMilitaryAssociationLeader extends TerritoryWarSuperClass -{ - public Q00731_ProtectTheMilitaryAssociationLeader() - { +public final class Q00731_ProtectTheMilitaryAssociationLeader extends TerritoryWarSuperClass { + public Q00731_ProtectTheMilitaryAssociationLeader() { super(731, Q00731_ProtectTheMilitaryAssociationLeader.class.getSimpleName(), "Protect the Military Association Leader"); - NPC_IDS = new int[] - { + NPC_IDS = new int[] { 36508, 36514, 36520, @@ -43,8 +40,7 @@ public final class Q00731_ProtectTheMilitaryAssociationLeader extends TerritoryW } @Override - public int getTerritoryIdForThisNPCId(int npcId) - { + public int getTerritoryIdForThisNPCId(int npcId) { return 81 + ((npcId - 36508) / 6); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00732_ProtectTheReligiousAssociationLeader.java b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00732_ProtectTheReligiousAssociationLeader.java index 11f565db6a..0b0c42ab4b 100644 --- a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00732_ProtectTheReligiousAssociationLeader.java +++ b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00732_ProtectTheReligiousAssociationLeader.java @@ -22,13 +22,10 @@ package com.l2jserver.datapack.quests.TerritoryWarScripts; * Protect the Religious Association Leader (732) * @author Gigiikun */ -public final class Q00732_ProtectTheReligiousAssociationLeader extends TerritoryWarSuperClass -{ - public Q00732_ProtectTheReligiousAssociationLeader() - { +public final class Q00732_ProtectTheReligiousAssociationLeader extends TerritoryWarSuperClass { + public Q00732_ProtectTheReligiousAssociationLeader() { super(732, Q00732_ProtectTheReligiousAssociationLeader.class.getSimpleName(), "Protect the Religious Association Leader"); - NPC_IDS = new int[] - { + NPC_IDS = new int[] { 36510, 36516, 36522, @@ -43,8 +40,7 @@ public final class Q00732_ProtectTheReligiousAssociationLeader extends Territory } @Override - public int getTerritoryIdForThisNPCId(int npcId) - { + public int getTerritoryIdForThisNPCId(int npcId) { return 81 + ((npcId - 36510) / 6); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00733_ProtectTheEconomicAssociationLeader.java b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00733_ProtectTheEconomicAssociationLeader.java index 26a3759ce8..a286e20bfe 100644 --- a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00733_ProtectTheEconomicAssociationLeader.java +++ b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00733_ProtectTheEconomicAssociationLeader.java @@ -22,13 +22,10 @@ package com.l2jserver.datapack.quests.TerritoryWarScripts; * Protect the Economic Association Leader (733) * @author Gigiikun */ -public final class Q00733_ProtectTheEconomicAssociationLeader extends TerritoryWarSuperClass -{ - public Q00733_ProtectTheEconomicAssociationLeader() - { +public final class Q00733_ProtectTheEconomicAssociationLeader extends TerritoryWarSuperClass { + public Q00733_ProtectTheEconomicAssociationLeader() { super(733, Q00733_ProtectTheEconomicAssociationLeader.class.getSimpleName(), "Protect the Economic Association Leader"); - NPC_IDS = new int[] - { + NPC_IDS = new int[] { 36513, 36519, 36525, @@ -43,8 +40,7 @@ public final class Q00733_ProtectTheEconomicAssociationLeader extends TerritoryW } @Override - public int getTerritoryIdForThisNPCId(int npcId) - { + public int getTerritoryIdForThisNPCId(int npcId) { return 81 + ((npcId - 36513) / 6); } } diff --git a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00734_PierceThroughAShield.java b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00734_PierceThroughAShield.java index baa343055e..e67074af5d 100644 --- a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00734_PierceThroughAShield.java +++ b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00734_PierceThroughAShield.java @@ -24,13 +24,10 @@ import com.l2jserver.gameserver.network.NpcStringId; * Pierce through a Shield! (734) * @author Gigiikun */ -public final class Q00734_PierceThroughAShield extends TerritoryWarSuperClass -{ - public Q00734_PierceThroughAShield() - { +public final class Q00734_PierceThroughAShield extends TerritoryWarSuperClass { + public Q00734_PierceThroughAShield() { super(734, Q00734_PierceThroughAShield.class.getSimpleName(), "Pierce through a Shield"); - CLASS_IDS = new int[] - { + CLASS_IDS = new int[] { 6, 91, 5, @@ -42,8 +39,7 @@ public final class Q00734_PierceThroughAShield extends TerritoryWarSuperClass }; RANDOM_MIN = 10; RANDOM_MAX = 15; - npcString = new NpcStringId[] - { + npcString = new NpcStringId[] { NpcStringId.YOU_HAVE_DEFEATED_S2_OF_S1_KNIGHTS, NpcStringId.YOU_WEAKENED_THE_ENEMYS_DEFENSE }; diff --git a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00735_MakeSpearsDull.java b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00735_MakeSpearsDull.java index 9ecb7b66db..5a5b7e6f9e 100644 --- a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00735_MakeSpearsDull.java +++ b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00735_MakeSpearsDull.java @@ -24,13 +24,10 @@ import com.l2jserver.gameserver.network.NpcStringId; * Make Spears Dull! (735) * @author Gigiikun */ -public final class Q00735_MakeSpearsDull extends TerritoryWarSuperClass -{ - public Q00735_MakeSpearsDull() - { +public final class Q00735_MakeSpearsDull extends TerritoryWarSuperClass { + public Q00735_MakeSpearsDull() { super(735, Q00735_MakeSpearsDull.class.getSimpleName(), "Make Spears Dull"); - CLASS_IDS = new int[] - { + CLASS_IDS = new int[] { 23, 101, 36, @@ -70,8 +67,7 @@ public final class Q00735_MakeSpearsDull extends TerritoryWarSuperClass }; RANDOM_MIN = 15; RANDOM_MAX = 20; - npcString = new NpcStringId[] - { + npcString = new NpcStringId[] { NpcStringId.YOU_HAVE_DEFEATED_S2_OF_S1_WARRIORS_AND_ROGUES, NpcStringId.YOU_WEAKENED_THE_ENEMYS_ATTACK }; diff --git a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00736_WeakenTheMagic.java b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00736_WeakenTheMagic.java index ad31a14489..e8b13ebc85 100644 --- a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00736_WeakenTheMagic.java +++ b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00736_WeakenTheMagic.java @@ -24,13 +24,10 @@ import com.l2jserver.gameserver.network.NpcStringId; * Weaken the magic! (736) * @author Gigiikun */ -public final class Q00736_WeakenTheMagic extends TerritoryWarSuperClass -{ - public Q00736_WeakenTheMagic() - { +public final class Q00736_WeakenTheMagic extends TerritoryWarSuperClass { + public Q00736_WeakenTheMagic() { super(736, Q00736_WeakenTheMagic.class.getSimpleName(), "Weaken the magic"); - CLASS_IDS = new int[] - { + CLASS_IDS = new int[] { 40, 110, 27, @@ -48,8 +45,7 @@ public final class Q00736_WeakenTheMagic extends TerritoryWarSuperClass }; RANDOM_MIN = 10; RANDOM_MAX = 15; - npcString = new NpcStringId[] - { + npcString = new NpcStringId[] { NpcStringId.YOU_HAVE_DEFEATED_S2_OF_S1_ENEMIES, NpcStringId.YOU_WEAKENED_THE_ENEMYS_MAGIC }; diff --git a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00737_DenyBlessings.java b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00737_DenyBlessings.java index 8028329308..a2a2733e7c 100644 --- a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00737_DenyBlessings.java +++ b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00737_DenyBlessings.java @@ -24,13 +24,10 @@ import com.l2jserver.gameserver.network.NpcStringId; * Deny Blessings (737) * @author Gigiikun */ -public final class Q00737_DenyBlessings extends TerritoryWarSuperClass -{ - public Q00737_DenyBlessings() - { +public final class Q00737_DenyBlessings extends TerritoryWarSuperClass { + public Q00737_DenyBlessings() { super(737, Q00737_DenyBlessings.class.getSimpleName(), "Deny Blessings"); - CLASS_IDS = new int[] - { + CLASS_IDS = new int[] { 43, 112, 30, @@ -44,8 +41,7 @@ public final class Q00737_DenyBlessings extends TerritoryWarSuperClass }; RANDOM_MIN = 3; RANDOM_MAX = 8; - npcString = new NpcStringId[] - { + npcString = new NpcStringId[] { NpcStringId.YOU_HAVE_DEFEATED_S2_OF_S1_HEALERS_AND_BUFFERS, NpcStringId.YOU_WEAKENED_THE_ENEMYS_ATTACK }; diff --git a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00738_DestroyKeyTargets.java b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00738_DestroyKeyTargets.java index cd635a42a0..5058a7dcec 100644 --- a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00738_DestroyKeyTargets.java +++ b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/Q00738_DestroyKeyTargets.java @@ -24,13 +24,10 @@ import com.l2jserver.gameserver.network.NpcStringId; * Destroy Key Targets (738) * @author Gigiikun */ -public final class Q00738_DestroyKeyTargets extends TerritoryWarSuperClass -{ - public Q00738_DestroyKeyTargets() - { +public final class Q00738_DestroyKeyTargets extends TerritoryWarSuperClass { + public Q00738_DestroyKeyTargets() { super(738, Q00738_DestroyKeyTargets.class.getSimpleName(), "Destroy Key Targets"); - CLASS_IDS = new int[] - { + CLASS_IDS = new int[] { 51, 115, 57, @@ -38,8 +35,7 @@ public final class Q00738_DestroyKeyTargets extends TerritoryWarSuperClass }; RANDOM_MIN = 3; RANDOM_MAX = 8; - npcString = new NpcStringId[] - { + npcString = new NpcStringId[] { NpcStringId.YOU_HAVE_DEFEATED_S2_OF_S1_WARSMITHS_AND_OVERLORDS, NpcStringId.YOU_DESTROYED_THE_ENEMYS_PROFESSIONALS }; diff --git a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/TerritoryWarSuperClass.java b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/TerritoryWarSuperClass.java index 0833e8861b..76c699e5d3 100644 --- a/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/TerritoryWarSuperClass.java +++ b/src/main/java/com/l2jserver/datapack/quests/TerritoryWarScripts/TerritoryWarSuperClass.java @@ -47,8 +47,7 @@ import com.l2jserver.gameserver.util.Util; * Territory War quests superclass. * @author Gigiikun */ -public class TerritoryWarSuperClass extends Quest -{ +public class TerritoryWarSuperClass extends Quest { private static Map<Integer, TerritoryWarSuperClass> _forTheSakeScripts = new HashMap<>(); private static Map<Integer, TerritoryWarSuperClass> _protectTheScripts = new HashMap<>(); private static Map<Integer, TerritoryWarSuperClass> _killTheScripts = new HashMap<>(); @@ -66,12 +65,10 @@ public class TerritoryWarSuperClass extends Quest public int RANDOM_MIN; public int RANDOM_MAX; - public TerritoryWarSuperClass(int questId, String name, String descr) - { + public TerritoryWarSuperClass(int questId, String name, String descr) { super(questId, name, descr); - if (questId < 0) - { + if (questId < 0) { // Outpost and Ward handled by the Super Class script addSkillSeeId(36590); @@ -79,15 +76,11 @@ public class TerritoryWarSuperClass extends Quest final Calendar cal = Calendar.getInstance(); final long nextSiegeDate = GlobalVariablesManager.getInstance().getLong(TerritoryWarManager.GLOBAL_VARIABLE, 0); - if (nextSiegeDate > System.currentTimeMillis()) - { + if (nextSiegeDate > System.currentTimeMillis()) { cal.setTimeInMillis(nextSiegeDate); - } - else - { + } else { // Let's check if territory war date was in the past - if (cal.before(Calendar.getInstance())) - { + if (cal.before(Calendar.getInstance())) { cal.setTimeInMillis(System.currentTimeMillis()); } @@ -96,8 +89,7 @@ public class TerritoryWarSuperClass extends Quest cal.set(Calendar.HOUR_OF_DAY, hasOwnedCastle ? 20 : 22); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); - if (cal.before(Calendar.getInstance())) - { + if (cal.before(Calendar.getInstance())) { cal.add(Calendar.WEEK_OF_YEAR, 2); } GlobalVariablesManager.getInstance().set(TerritoryWarManager.GLOBAL_VARIABLE, cal.getTimeInMillis()); @@ -107,45 +99,35 @@ public class TerritoryWarSuperClass extends Quest } } - public int getTerritoryIdForThisNPCId(int npcid) - { + public int getTerritoryIdForThisNPCId(int npcid) { return 0; } - private void handleKillTheQuest(L2PcInstance player) - { + private void handleKillTheQuest(L2PcInstance player) { QuestState st = getQuestState(player, false); int kill = 1; int max = 10; - if (st == null) - { + if (st == null) { st = newQuestState(player); } - if (!st.isCompleted()) - { - if (!st.isStarted()) - { + if (!st.isCompleted()) { + if (!st.isStarted()) { st.setState(State.STARTED); st.setCond(1); st.set("kill", "1"); max = getRandom(RANDOM_MIN, RANDOM_MAX); st.set("max", String.valueOf(max)); - } - else - { + } else { kill = st.getInt("kill") + 1; max = st.getInt("max"); } - if (kill >= max) - { + if (kill >= max) { TerritoryWarManager.getInstance().giveTWQuestPoint(player); addExpAndSp(player, 534000, 51000); st.set("doneDate", String.valueOf(Calendar.getInstance().get(Calendar.DAY_OF_YEAR))); st.exitQuest(true); player.sendPacket(new ExShowScreenMessage(npcString[1], 2, 10000)); - } - else - { + } else { st.set("kill", String.valueOf(kill)); ExShowScreenMessage message = new ExShowScreenMessage(npcString[0], 2, 10000); @@ -154,9 +136,7 @@ public class TerritoryWarSuperClass extends Quest player.sendPacket(message); } - } - else if (st.getInt("doneDate") != Calendar.getInstance().get(Calendar.DAY_OF_YEAR)) - { + } else if (st.getInt("doneDate") != Calendar.getInstance().get(Calendar.DAY_OF_YEAR)) { st.setState(State.STARTED); st.setCond(1); st.set("kill", "1"); @@ -167,9 +147,7 @@ public class TerritoryWarSuperClass extends Quest message.addStringParameter(String.valueOf(max)); message.addStringParameter(String.valueOf(kill)); player.sendPacket(message); - } - else if (player.isGM()) - { + } else if (player.isGM()) { // just for test player.sendMessage("Cleaning " + getName() + " Territory War quest by force!"); st.setState(State.STARTED); @@ -186,24 +164,17 @@ public class TerritoryWarSuperClass extends Quest } @Override - public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isSummon) - { - if ((npc.getCurrentHp() == npc.getMaxHp()) && Util.contains(NPC_IDS, npc.getId())) - { + public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isSummon) { + if ((npc.getCurrentHp() == npc.getMaxHp()) && Util.contains(NPC_IDS, npc.getId())) { int territoryId = getTerritoryIdForThisNPCId(npc.getId()); - if ((territoryId >= 81) && (territoryId <= 89)) - { - for (L2PcInstance pl : L2World.getInstance().getPlayers()) - { - if (pl.getSiegeSide() == territoryId) - { + if ((territoryId >= 81) && (territoryId <= 89)) { + for (L2PcInstance pl : L2World.getInstance().getPlayers()) { + if (pl.getSiegeSide() == territoryId) { QuestState st = pl.getQuestState(getName()); - if (st == null) - { + if (st == null) { st = newQuestState(pl); } - if (!st.isStarted()) - { + if (!st.isStarted()) { st.setState(State.STARTED, false); st.setCond(1); } @@ -215,33 +186,24 @@ public class TerritoryWarSuperClass extends Quest } @Override - public String onDeath(L2Character killer, L2Character victim, QuestState qs) - { - if ((killer == victim) || !(victim instanceof L2PcInstance) || (victim.getLevel() < 61)) - { + public String onDeath(L2Character killer, L2Character victim, QuestState qs) { + if ((killer == victim) || !(victim instanceof L2PcInstance) || (victim.getLevel() < 61)) { return ""; } L2PcInstance actingPlayer = killer.getActingPlayer(); - if ((actingPlayer != null) && (qs.getPlayer() != null)) - { - if (actingPlayer.getParty() != null) - { - for (L2PcInstance pl : actingPlayer.getParty().getMembers()) - { - if ((pl.getSiegeSide() == qs.getPlayer().getSiegeSide()) || (pl.getSiegeSide() == 0) || !Util.checkIfInRange(2000, killer, pl, false)) - { + if ((actingPlayer != null) && (qs.getPlayer() != null)) { + if (actingPlayer.getParty() != null) { + for (L2PcInstance pl : actingPlayer.getParty().getMembers()) { + if ((pl.getSiegeSide() == qs.getPlayer().getSiegeSide()) || (pl.getSiegeSide() == 0) || !Util.checkIfInRange(2000, killer, pl, false)) { continue; } - if (pl == actingPlayer) - { + if (pl == actingPlayer) { handleStepsForHonor(actingPlayer); handleBecomeMercenaryQuest(actingPlayer, false); } handleKillTheQuest(pl); } - } - else if ((actingPlayer.getSiegeSide() != qs.getPlayer().getSiegeSide()) && (actingPlayer.getSiegeSide() > 0)) - { + } else if ((actingPlayer.getSiegeSide() != qs.getPlayer().getSiegeSide()) && (actingPlayer.getSiegeSide() > 0)) { handleKillTheQuest(actingPlayer); handleStepsForHonor(actingPlayer); handleBecomeMercenaryQuest(actingPlayer, false); @@ -252,36 +214,28 @@ public class TerritoryWarSuperClass extends Quest } @Override - public String onEnterWorld(L2PcInstance player) - { + public String onEnterWorld(L2PcInstance player) { int territoryId = TerritoryWarManager.getInstance().getRegisteredTerritoryId(player); - if (territoryId > 0) - { + if (territoryId > 0) { // register Territory Quest TerritoryWarSuperClass territoryQuest = _forTheSakeScripts.get(territoryId); QuestState st = player.getQuestState(territoryQuest.getName()); - if (st == null) - { + if (st == null) { st = territoryQuest.newQuestState(player); } st.setState(State.STARTED, false); st.setCond(1); // register player on Death - if (player.getLevel() >= 61) - { + if (player.getLevel() >= 61) { TerritoryWarSuperClass killthe = _killTheScripts.get(player.getClassId().getId()); - if (killthe != null) - { + if (killthe != null) { st = player.getQuestState(killthe.getName()); - if (st == null) - { + if (st == null) { st = killthe.newQuestState(player); } player.addNotifyQuestOfDeath(st); - } - else - { + } else { _log.warning("TerritoryWar: Missing Kill the quest for player " + player.getName() + " whose class id: " + player.getClassId().getId()); } } @@ -290,67 +244,49 @@ public class TerritoryWarSuperClass extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) - { + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { TerritoryWarManager manager = TerritoryWarManager.getInstance(); - if (npc.getId() == CATAPULT_ID) - { + if (npc.getId() == CATAPULT_ID) { manager.territoryCatapultDestroyed(TERRITORY_ID - 80); manager.giveTWPoint(killer, TERRITORY_ID, 4); manager.announceToParticipants(new ExShowScreenMessage(npcString[0], 2, 10000), 135000, 13500); handleBecomeMercenaryQuest(killer, true); - } - else if (Util.contains(LEADER_IDS, npc.getId())) - { + } else if (Util.contains(LEADER_IDS, npc.getId())) { manager.giveTWPoint(killer, TERRITORY_ID, 3); } - if ((killer.getSiegeSide() != TERRITORY_ID) && (TerritoryWarManager.getInstance().getTerritory(killer.getSiegeSide() - 80) != null)) - { + if ((killer.getSiegeSide() != TERRITORY_ID) && (TerritoryWarManager.getInstance().getTerritory(killer.getSiegeSide() - 80) != null)) { manager.getTerritory(killer.getSiegeSide() - 80).getQuestDone()[0]++; } return super.onKill(npc, killer, isSummon); } @Override - public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) - { - if (Util.contains(targets, npc)) - { - if (skill.getId() == 845) - { - if (TerritoryWarManager.getInstance().getHQForClan(caster.getClan()) != npc) - { + public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) { + if (Util.contains(targets, npc)) { + if (skill.getId() == 845) { + if (TerritoryWarManager.getInstance().getHQForClan(caster.getClan()) != npc) { return super.onSkillSee(npc, caster, skill, targets, isSummon); } npc.deleteMe(); TerritoryWarManager.getInstance().setHQForClan(caster.getClan(), null); - } - else if (skill.getId() == 847) - { - if (TerritoryWarManager.getInstance().getHQForTerritory(caster.getSiegeSide()) != npc) - { + } else if (skill.getId() == 847) { + if (TerritoryWarManager.getInstance().getHQForTerritory(caster.getSiegeSide()) != npc) { return super.onSkillSee(npc, caster, skill, targets, isSummon); } TerritoryWard ward = TerritoryWarManager.getInstance().getTerritoryWard(caster); - if (ward == null) - { + if (ward == null) { return super.onSkillSee(npc, caster, skill, targets, isSummon); } - if ((caster.getSiegeSide() - 80) == ward.getOwnerCastleId()) - { - for (TerritoryNPCSpawn wardSpawn : TerritoryWarManager.getInstance().getTerritory(ward.getOwnerCastleId()).getOwnedWard()) - { - if (wardSpawn.getId() == ward.getTerritoryId()) - { + if ((caster.getSiegeSide() - 80) == ward.getOwnerCastleId()) { + for (TerritoryNPCSpawn wardSpawn : TerritoryWarManager.getInstance().getTerritory(ward.getOwnerCastleId()).getOwnedWard()) { + if (wardSpawn.getId() == ward.getTerritoryId()) { wardSpawn.setNPC(wardSpawn.getNpc().getSpawn().doSpawn()); ward.unSpawnMe(); ward.setNpc(wardSpawn.getNpc()); } } - } - else - { + } else { ward.unSpawnMe(); ward.setNpc(TerritoryWarManager.getInstance().addTerritoryWard(ward.getTerritoryId(), caster.getSiegeSide() - 80, ward.getOwnerCastleId(), true)); ward.setOwnerCastleId(caster.getSiegeSide() - 80); @@ -362,76 +298,57 @@ public class TerritoryWarSuperClass extends Quest } // Used to register NPCs "For the Sake of the Territory ..." quests - public void registerKillIds() - { + public void registerKillIds() { addKillId(CATAPULT_ID); - for (int mobid : LEADER_IDS) - { + for (int mobid : LEADER_IDS) { addKillId(mobid); } - for (int mobid : GUARD_IDS) - { + for (int mobid : GUARD_IDS) { addKillId(mobid); } } @Override - public void setOnEnterWorld(boolean val) - { + public void setOnEnterWorld(boolean val) { super.setOnEnterWorld(val); - for (L2PcInstance player : L2World.getInstance().getPlayers()) - { - if (player.getSiegeSide() > 0) - { + for (L2PcInstance player : L2World.getInstance().getPlayers()) { + if (player.getSiegeSide() > 0) { TerritoryWarSuperClass territoryQuest = _forTheSakeScripts.get(player.getSiegeSide()); - if (territoryQuest == null) - { + if (territoryQuest == null) { continue; } QuestState st = player.hasQuestState(territoryQuest.getName()) ? player.getQuestState(territoryQuest.getName()) : territoryQuest.newQuestState(player); - if (val) - { + if (val) { st.setState(State.STARTED, false); st.setCond(1); // register player on Death - if (player.getLevel() >= 61) - { + if (player.getLevel() >= 61) { TerritoryWarSuperClass killthe = _killTheScripts.get(player.getClassId().getId()); - if (killthe != null) - { + if (killthe != null) { st = player.getQuestState(killthe.getName()); - if (st == null) - { + if (st == null) { st = killthe.newQuestState(player); } player.addNotifyQuestOfDeath(st); - } - else - { + } else { _log.warning("TerritoryWar: Missing Kill the quest for player " + player.getName() + " whose class id: " + player.getClassId().getId()); } } - } - else - { + } else { st.exitQuest(false); - for (Quest q : _protectTheScripts.values()) - { + for (Quest q : _protectTheScripts.values()) { st = player.getQuestState(q.getName()); - if (st != null) - { + if (st != null) { st.exitQuest(false); } } // unregister player on Death TerritoryWarSuperClass killthe = _killTheScripts.get(player.getClassIndex()); - if (killthe != null) - { + if (killthe != null) { st = player.getQuestState(killthe.getName()); - if (st != null) - { + if (st != null) { player.removeNotifyQuestOfDeath(st); } } @@ -440,71 +357,52 @@ public class TerritoryWarSuperClass extends Quest } } - private static void handleBecomeMercenaryQuest(L2PcInstance player, boolean catapult) - { + private static void handleBecomeMercenaryQuest(L2PcInstance player, boolean catapult) { int enemyCount = 10, catapultCount = 1; QuestState st = player.getQuestState(Q00147_PathtoBecominganEliteMercenary.class.getSimpleName()); - if ((st != null) && st.isCompleted()) - { + if ((st != null) && st.isCompleted()) { st = player.getQuestState(Q00148_PathtoBecominganExaltedMercenary.class.getSimpleName()); enemyCount = 30; catapultCount = 2; } - if ((st != null) && st.isStarted()) - { + if ((st != null) && st.isStarted()) { final int cond = st.getCond(); - if (catapult) - { - if ((cond == 1) || (cond == 2)) - { + if (catapult) { + if ((cond == 1) || (cond == 2)) { final int count = st.getInt("catapult") + 1; st.set("catapult", String.valueOf(count)); - if (count >= catapultCount) - { + if (count >= catapultCount) { st.setCond((cond == 1) ? 3 : 4); } } - } - else if ((cond == 1) || (cond == 3)) - { + } else if ((cond == 1) || (cond == 3)) { final int kills = st.getInt("kills") + 1; st.set("kills", Integer.toString(kills)); - if (kills >= enemyCount) - { + if (kills >= enemyCount) { st.setCond((cond == 1) ? 2 : 4); } } } } - private static void handleStepsForHonor(L2PcInstance player) - { + private static void handleStepsForHonor(L2PcInstance player) { final QuestState _sfh = player.getQuestState(Q00176_StepsForHonor.class.getSimpleName()); - if ((_sfh != null) && _sfh.isStarted()) - { + if ((_sfh != null) && _sfh.isStarted()) { final int cond = _sfh.getCond(); - if ((cond == 1) || (cond == 3) || (cond == 5) || (cond == 7)) - { + if ((cond == 1) || (cond == 3) || (cond == 5) || (cond == 7)) { final int kills = _sfh.getInt("kills") + 1; _sfh.set("kills", kills); - if ((cond == 1) && (kills >= 9)) - { + if ((cond == 1) && (kills >= 9)) { _sfh.setCond(2); _sfh.set("kills", "0"); - } - else if ((cond == 3) && (kills >= 18)) - { + } else if ((cond == 3) && (kills >= 18)) { _sfh.setCond(4); _sfh.set("kills", "0"); - } - else if ((cond == 5) && (kills >= 27)) - { + } else if ((cond == 5) && (kills >= 27)) { _sfh.setCond(6); _sfh.set("kills", "0"); - } - else if ((cond == 7) && (kills >= 36)) - { + } else if ((cond == 7) && (kills >= 36)) { _sfh.setCond(8); _sfh.unset("kills"); } @@ -512,8 +410,7 @@ public class TerritoryWarSuperClass extends Quest } } - public static void main(String[] args) - { + public static void main(String[] args) { // initialize superclass new TerritoryWarSuperClass(-1, TerritoryWarSuperClass.class.getSimpleName(), "Territory War Superclass"); @@ -550,28 +447,23 @@ public class TerritoryWarSuperClass extends Quest _protectTheScripts.put(economic.getId(), economic); // "Kill" quests TerritoryWarSuperClass knights = new Q00734_PierceThroughAShield(); - for (int i : knights.CLASS_IDS) - { + for (int i : knights.CLASS_IDS) { _killTheScripts.put(i, knights); } TerritoryWarSuperClass warriors = new Q00735_MakeSpearsDull(); - for (int i : warriors.CLASS_IDS) - { + for (int i : warriors.CLASS_IDS) { _killTheScripts.put(i, warriors); } TerritoryWarSuperClass wizards = new Q00736_WeakenTheMagic(); - for (int i : wizards.CLASS_IDS) - { + for (int i : wizards.CLASS_IDS) { _killTheScripts.put(i, wizards); } TerritoryWarSuperClass priests = new Q00737_DenyBlessings(); - for (int i : priests.CLASS_IDS) - { + for (int i : priests.CLASS_IDS) { _killTheScripts.put(i, priests); } TerritoryWarSuperClass keys = new Q00738_DestroyKeyTargets(); - for (int i : keys.CLASS_IDS) - { + for (int i : keys.CLASS_IDS) { _killTheScripts.put(i, keys); } } diff --git a/src/main/java/com/l2jserver/datapack/vehicles/BoatGiranTalking.java b/src/main/java/com/l2jserver/datapack/vehicles/BoatGiranTalking.java index 1f489c49b5..a5084320be 100644 --- a/src/main/java/com/l2jserver/datapack/vehicles/BoatGiranTalking.java +++ b/src/main/java/com/l2jserver/datapack/vehicles/BoatGiranTalking.java @@ -33,13 +33,11 @@ import com.l2jserver.gameserver.network.serverpackets.CreatureSay; /** * @author DS */ -public class BoatGiranTalking implements Runnable -{ +public class BoatGiranTalking implements Runnable { private static final Logger _log = Logger.getLogger(BoatGiranTalking.class.getName()); // Time: 868s - private static final VehiclePathPoint[] GIRAN_TO_TALKING = - { + private static final VehiclePathPoint[] GIRAN_TO_TALKING = { new VehiclePathPoint(51914, 189023, -3610, 150, 800), new VehiclePathPoint(60567, 189789, -3610, 150, 800), new VehiclePathPoint(63732, 197457, -3610, 200, 800), @@ -61,14 +59,12 @@ public class BoatGiranTalking implements Runnable new VehiclePathPoint(-94242, 261659, -3610, 150, 800) }; - private static final VehiclePathPoint[] TALKING_DOCK = - { + private static final VehiclePathPoint[] TALKING_DOCK = { new VehiclePathPoint(-96622, 261660, -3610, 150, 800) }; // Time: 1398s - private static final VehiclePathPoint[] TALKING_TO_GIRAN = - { + private static final VehiclePathPoint[] TALKING_TO_GIRAN = { new VehiclePathPoint(-113925, 261660, -3610, 150, 800), new VehiclePathPoint(-126107, 249116, -3610, 180, 800), new VehiclePathPoint(-126107, 234499, -3610, 180, 800), @@ -119,8 +115,7 @@ public class BoatGiranTalking implements Runnable private final CreatureSay ARRIVAL_GIRAN5; private final CreatureSay ARRIVAL_GIRAN1; - public BoatGiranTalking(L2BoatInstance boat) - { + public BoatGiranTalking(L2BoatInstance boat) { _boat = boat; ARRIVED_AT_GIRAN = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_ARRIVED_AT_GIRAN); @@ -149,12 +144,9 @@ public class BoatGiranTalking implements Runnable } @Override - public void run() - { - try - { - switch (_cycle) - { + public void run() { + try { + switch (_cycle) { case 0: BoatManager.getInstance().broadcastPacket(GIRAN_DOCK, TALKING_DOCK[0], LEAVE_GIRAN5); ThreadPoolManager.getInstance().scheduleGeneral(this, 240000); @@ -186,16 +178,13 @@ public class BoatGiranTalking implements Runnable BoatManager.getInstance().broadcastPacket(TALKING_DOCK[0], GIRAN_DOCK, ARRIVAL_TALKING1); break; case 7: - if (BoatManager.getInstance().dockBusy(BoatManager.TALKING_ISLAND)) - { - if (_shoutCount == 0) - { + if (BoatManager.getInstance().dockBusy(BoatManager.TALKING_ISLAND)) { + if (_shoutCount == 0) { BoatManager.getInstance().broadcastPacket(TALKING_DOCK[0], GIRAN_DOCK, BUSY_TALKING); } _shoutCount++; - if (_shoutCount > 35) - { + if (_shoutCount > 35) { _shoutCount = 0; } @@ -257,22 +246,17 @@ public class BoatGiranTalking implements Runnable } _shoutCount = 0; _cycle++; - if (_cycle > 18) - { + if (_cycle > 18) { _cycle = 0; } - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, e.getMessage()); } } - public static void main(String[] args) - { + public static void main(String[] args) { final L2BoatInstance boat = BoatManager.getInstance().getNewBoat(2, 48950, 190613, -3610, 60800); - if (boat != null) - { + if (boat != null) { boat.registerEngine(new BoatGiranTalking(boat)); boat.runEngine(180000); } diff --git a/src/main/java/com/l2jserver/datapack/vehicles/BoatGludinRune.java b/src/main/java/com/l2jserver/datapack/vehicles/BoatGludinRune.java index 985e3a4bbe..b1d9e1baee 100644 --- a/src/main/java/com/l2jserver/datapack/vehicles/BoatGludinRune.java +++ b/src/main/java/com/l2jserver/datapack/vehicles/BoatGludinRune.java @@ -33,13 +33,11 @@ import com.l2jserver.gameserver.network.serverpackets.CreatureSay; /** * @author DS */ -public class BoatGludinRune implements Runnable -{ +public class BoatGludinRune implements Runnable { private static final Logger _log = Logger.getLogger(BoatGludinRune.class.getName()); // Time: 1151s - private static final VehiclePathPoint[] GLUDIN_TO_RUNE = - { + private static final VehiclePathPoint[] GLUDIN_TO_RUNE = { new VehiclePathPoint(-95686, 155514, -3610, 150, 800), new VehiclePathPoint(-98112, 159040, -3610, 150, 800), new VehiclePathPoint(-104192, 160608, -3610, 200, 1800), @@ -69,14 +67,12 @@ public class BoatGludinRune implements Runnable new VehiclePathPoint(36819, -35315, -3610, 220, 800) }; - private static final VehiclePathPoint[] RUNE_DOCK = - { + private static final VehiclePathPoint[] RUNE_DOCK = { new VehiclePathPoint(34381, -37680, -3610, 200, 800) }; // Time: 967s - private static final VehiclePathPoint[] RUNE_TO_GLUDIN = - { + private static final VehiclePathPoint[] RUNE_TO_GLUDIN = { new VehiclePathPoint(32750, -39300, -3610, 150, 800), new VehiclePathPoint(27440, -39328, -3610, 180, 1000), new VehiclePathPoint(21456, -34272, -3610, 200, 1000), @@ -101,8 +97,7 @@ public class BoatGludinRune implements Runnable new VehiclePathPoint(-95686, 148218, -3610, 200, 800) }; - private static final VehiclePathPoint[] GLUDIN_DOCK = - { + private static final VehiclePathPoint[] GLUDIN_DOCK = { new VehiclePathPoint(-95686, 150514, -3610, 150, 800) }; @@ -134,8 +129,7 @@ public class BoatGludinRune implements Runnable private final CreatureSay ARRIVAL_GLUDIN5; private final CreatureSay ARRIVAL_GLUDIN1; - public BoatGludinRune(L2BoatInstance boat) - { + public BoatGludinRune(L2BoatInstance boat) { _boat = boat; ARRIVED_AT_GLUDIN = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_ARRIVED_AT_GLUDIN); @@ -164,12 +158,9 @@ public class BoatGludinRune implements Runnable } @Override - public void run() - { - try - { - switch (_cycle) - { + public void run() { + try { + switch (_cycle) { case 0: BoatManager.getInstance().broadcastPacket(GLUDIN_DOCK[0], RUNE_DOCK[0], LEAVE_GLUDIN5); ThreadPoolManager.getInstance().scheduleGeneral(this, 240000); @@ -206,16 +197,13 @@ public class BoatGludinRune implements Runnable BoatManager.getInstance().broadcastPacket(RUNE_DOCK[0], GLUDIN_DOCK[0], ARRIVAL_RUNE1); break; case 8: - if (BoatManager.getInstance().dockBusy(BoatManager.RUNE_HARBOR)) - { - if (_shoutCount == 0) - { + if (BoatManager.getInstance().dockBusy(BoatManager.RUNE_HARBOR)) { + if (_shoutCount == 0) { BoatManager.getInstance().broadcastPacket(RUNE_DOCK[0], GLUDIN_DOCK[0], BUSY_RUNE); } _shoutCount++; - if (_shoutCount > 35) - { + if (_shoutCount > 35) { _shoutCount = 0; } @@ -266,16 +254,13 @@ public class BoatGludinRune implements Runnable BoatManager.getInstance().broadcastPacket(GLUDIN_DOCK[0], RUNE_DOCK[0], ARRIVAL_GLUDIN1); break; case 18: - if (BoatManager.getInstance().dockBusy(BoatManager.GLUDIN_HARBOR)) - { - if (_shoutCount == 0) - { + if (BoatManager.getInstance().dockBusy(BoatManager.GLUDIN_HARBOR)) { + if (_shoutCount == 0) { BoatManager.getInstance().broadcastPacket(GLUDIN_DOCK[0], RUNE_DOCK[0], BUSY_GLUDIN); } _shoutCount++; - if (_shoutCount > 35) - { + if (_shoutCount > 35) { _shoutCount = 0; } @@ -293,22 +278,17 @@ public class BoatGludinRune implements Runnable } _shoutCount = 0; _cycle++; - if (_cycle > 19) - { + if (_cycle > 19) { _cycle = 0; } - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, e.getMessage()); } } - public static void main(String[] args) - { + public static void main(String[] args) { final L2BoatInstance boat = BoatManager.getInstance().getNewBoat(3, -95686, 150514, -3610, 16723); - if (boat != null) - { + if (boat != null) { boat.registerEngine(new BoatGludinRune(boat)); boat.runEngine(180000); BoatManager.getInstance().dockShip(BoatManager.GLUDIN_HARBOR, true); diff --git a/src/main/java/com/l2jserver/datapack/vehicles/BoatInnadrilTour.java b/src/main/java/com/l2jserver/datapack/vehicles/BoatInnadrilTour.java index 64006d0235..a5de1100c1 100644 --- a/src/main/java/com/l2jserver/datapack/vehicles/BoatInnadrilTour.java +++ b/src/main/java/com/l2jserver/datapack/vehicles/BoatInnadrilTour.java @@ -33,13 +33,11 @@ import com.l2jserver.gameserver.network.serverpackets.CreatureSay; /** * @author DS */ -public class BoatInnadrilTour implements Runnable -{ +public class BoatInnadrilTour implements Runnable { private static final Logger _log = Logger.getLogger(BoatInnadrilTour.class.getName()); // Time: 1867s - private static final VehiclePathPoint[] TOUR = - { + private static final VehiclePathPoint[] TOUR = { new VehiclePathPoint(105129, 226240, -3610, 150, 800), new VehiclePathPoint(90604, 238797, -3610, 150, 800), new VehiclePathPoint(74853, 237943, -3610, 150, 800), @@ -91,8 +89,7 @@ public class BoatInnadrilTour implements Runnable private final CreatureSay ARRIVAL5; private final CreatureSay ARRIVAL1; - public BoatInnadrilTour(L2BoatInstance boat) - { + public BoatInnadrilTour(L2BoatInstance boat) { _boat = boat; ARRIVED_AT_INNADRIL = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.INNADRIL_BOAT_ANCHOR_10_MINUTES); @@ -109,12 +106,9 @@ public class BoatInnadrilTour implements Runnable } @Override - public void run() - { - try - { - switch (_cycle) - { + public void run() { + try { + switch (_cycle) { case 0: BoatManager.getInstance().broadcastPacket(DOCK, DOCK, LEAVE_INNADRIL5); ThreadPoolManager.getInstance().scheduleGeneral(this, 240000); @@ -158,22 +152,17 @@ public class BoatInnadrilTour implements Runnable break; } _cycle++; - if (_cycle > 9) - { + if (_cycle > 9) { _cycle = 0; } - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, e.getMessage()); } } - public static void main(String[] args) - { + public static void main(String[] args) { final L2BoatInstance boat = BoatManager.getInstance().getNewBoat(4, 111264, 226240, -3610, 32768); - if (boat != null) - { + if (boat != null) { boat.registerEngine(new BoatInnadrilTour(boat)); boat.runEngine(180000); } diff --git a/src/main/java/com/l2jserver/datapack/vehicles/BoatRunePrimeval.java b/src/main/java/com/l2jserver/datapack/vehicles/BoatRunePrimeval.java index 5434b7f8a2..b8a313f715 100644 --- a/src/main/java/com/l2jserver/datapack/vehicles/BoatRunePrimeval.java +++ b/src/main/java/com/l2jserver/datapack/vehicles/BoatRunePrimeval.java @@ -33,13 +33,11 @@ import com.l2jserver.gameserver.network.serverpackets.CreatureSay; /** * @author DS */ -public class BoatRunePrimeval implements Runnable -{ +public class BoatRunePrimeval implements Runnable { private static final Logger _log = Logger.getLogger(BoatRunePrimeval.class.getName()); // Time: 239s - private static final VehiclePathPoint[] RUNE_TO_PRIMEVAL = - { + private static final VehiclePathPoint[] RUNE_TO_PRIMEVAL = { new VehiclePathPoint(32750, -39300, -3610, 180, 800), new VehiclePathPoint(27440, -39328, -3610, 250, 1000), new VehiclePathPoint(19616, -39360, -3610, 270, 1000), @@ -55,8 +53,7 @@ public class BoatRunePrimeval implements Runnable }; // Time: 221s - private static final VehiclePathPoint[] PRIMEVAL_TO_RUNE = - { + private static final VehiclePathPoint[] PRIMEVAL_TO_RUNE = { new VehiclePathPoint(15528, -27279, -3610, 180, 800), new VehiclePathPoint(22304, -29664, -3610, 290, 800), new VehiclePathPoint(33824, -26880, -3610, 290, 800), @@ -67,8 +64,7 @@ public class BoatRunePrimeval implements Runnable new VehiclePathPoint(36819, -35315, -3610, 220, 800) }; - private static final VehiclePathPoint[] RUNE_DOCK = - { + private static final VehiclePathPoint[] RUNE_DOCK = { new VehiclePathPoint(34381, -37680, -3610, 220, 800) }; @@ -86,8 +82,7 @@ public class BoatRunePrimeval implements Runnable private final CreatureSay LEAVING_PRIMEVAL; private final CreatureSay BUSY_RUNE; - public BoatRunePrimeval(L2BoatInstance boat) - { + public BoatRunePrimeval(L2BoatInstance boat) { _boat = boat; ARRIVED_AT_RUNE = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.ARRIVED_AT_RUNE); @@ -100,12 +95,9 @@ public class BoatRunePrimeval implements Runnable } @Override - public void run() - { - try - { - switch (_cycle) - { + public void run() { + try { + switch (_cycle) { case 0: BoatManager.getInstance().dockShip(BoatManager.RUNE_HARBOR, false); BoatManager.getInstance().broadcastPackets(RUNE_DOCK[0], PRIMEVAL_DOCK, LEAVING_RUNE, Sound.ITEMSOUND_SHIP_ARRIVAL_DEPARTURE.withObject(_boat)); @@ -122,16 +114,13 @@ public class BoatRunePrimeval implements Runnable _boat.executePath(PRIMEVAL_TO_RUNE); break; case 3: - if (BoatManager.getInstance().dockBusy(BoatManager.RUNE_HARBOR)) - { - if (_shoutCount == 0) - { + if (BoatManager.getInstance().dockBusy(BoatManager.RUNE_HARBOR)) { + if (_shoutCount == 0) { BoatManager.getInstance().broadcastPacket(RUNE_DOCK[0], PRIMEVAL_DOCK, BUSY_RUNE); } _shoutCount++; - if (_shoutCount > 35) - { + if (_shoutCount > 35) { _shoutCount = 0; } @@ -148,22 +137,17 @@ public class BoatRunePrimeval implements Runnable } _shoutCount = 0; _cycle++; - if (_cycle > 4) - { + if (_cycle > 4) { _cycle = 0; } - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, e.getMessage()); } } - public static void main(String[] args) - { + public static void main(String[] args) { final L2BoatInstance boat = BoatManager.getInstance().getNewBoat(5, 34381, -37680, -3610, 40785); - if (boat != null) - { + if (boat != null) { boat.registerEngine(new BoatRunePrimeval(boat)); boat.runEngine(180000); BoatManager.getInstance().dockShip(BoatManager.RUNE_HARBOR, true); diff --git a/src/main/java/com/l2jserver/datapack/vehicles/BoatTalkingGludin.java b/src/main/java/com/l2jserver/datapack/vehicles/BoatTalkingGludin.java index c9c6488225..5e347fe75e 100644 --- a/src/main/java/com/l2jserver/datapack/vehicles/BoatTalkingGludin.java +++ b/src/main/java/com/l2jserver/datapack/vehicles/BoatTalkingGludin.java @@ -33,13 +33,11 @@ import com.l2jserver.gameserver.network.serverpackets.CreatureSay; /** * @author DS */ -public class BoatTalkingGludin implements Runnable -{ +public class BoatTalkingGludin implements Runnable { private static final Logger _log = Logger.getLogger(BoatTalkingGludin.class.getName()); // Time: 919s - private static final VehiclePathPoint[] TALKING_TO_GLUDIN = - { + private static final VehiclePathPoint[] TALKING_TO_GLUDIN = { new VehiclePathPoint(-121385, 261660, -3610, 180, 800), new VehiclePathPoint(-127694, 253312, -3610, 200, 800), new VehiclePathPoint(-129274, 237060, -3610, 250, 800), @@ -52,14 +50,12 @@ public class BoatTalkingGludin implements Runnable new VehiclePathPoint(-95686, 149718, -3610, 150, 800) }; - private static final VehiclePathPoint[] GLUDIN_DOCK = - { + private static final VehiclePathPoint[] GLUDIN_DOCK = { new VehiclePathPoint(-95686, 150514, -3610, 150, 800) }; // Time: 780s - private static final VehiclePathPoint[] GLUDIN_TO_TALKING = - { + private static final VehiclePathPoint[] GLUDIN_TO_TALKING = { new VehiclePathPoint(-95686, 155514, -3610, 180, 800), new VehiclePathPoint(-95686, 185514, -3610, 250, 800), new VehiclePathPoint(-60136, 238816, -3610, 200, 800), @@ -71,8 +67,7 @@ public class BoatTalkingGludin implements Runnable new VehiclePathPoint(-94242, 261659, -3610, 150, 1800) }; - private static final VehiclePathPoint[] TALKING_DOCK = - { + private static final VehiclePathPoint[] TALKING_DOCK = { new VehiclePathPoint(-96622, 261660, -3610, 150, 1800) }; @@ -103,8 +98,7 @@ public class BoatTalkingGludin implements Runnable private final CreatureSay ARRIVAL_TALKING5; private final CreatureSay ARRIVAL_TALKING1; - public BoatTalkingGludin(L2BoatInstance boat) - { + public BoatTalkingGludin(L2BoatInstance boat) { _boat = boat; _cycle = 0; @@ -133,12 +127,9 @@ public class BoatTalkingGludin implements Runnable } @Override - public void run() - { - try - { - switch (_cycle) - { + public void run() { + try { + switch (_cycle) { case 0: BoatManager.getInstance().broadcastPacket(TALKING_DOCK[0], GLUDIN_DOCK[0], LEAVE_TALKING5); ThreadPoolManager.getInstance().scheduleGeneral(this, 240000); @@ -171,16 +162,13 @@ public class BoatTalkingGludin implements Runnable BoatManager.getInstance().broadcastPacket(GLUDIN_DOCK[0], TALKING_DOCK[0], ARRIVAL_GLUDIN1); break; case 7: - if (BoatManager.getInstance().dockBusy(BoatManager.GLUDIN_HARBOR)) - { - if (_shoutCount == 0) - { + if (BoatManager.getInstance().dockBusy(BoatManager.GLUDIN_HARBOR)) { + if (_shoutCount == 0) { BoatManager.getInstance().broadcastPacket(GLUDIN_DOCK[0], TALKING_DOCK[0], BUSY_GLUDIN); } _shoutCount++; - if (_shoutCount > 35) - { + if (_shoutCount > 35) { _shoutCount = 0; } @@ -227,16 +215,13 @@ public class BoatTalkingGludin implements Runnable BoatManager.getInstance().broadcastPacket(TALKING_DOCK[0], GLUDIN_DOCK[0], ARRIVAL_TALKING1); break; case 16: - if (BoatManager.getInstance().dockBusy(BoatManager.TALKING_ISLAND)) - { - if (_shoutCount == 0) - { + if (BoatManager.getInstance().dockBusy(BoatManager.TALKING_ISLAND)) { + if (_shoutCount == 0) { BoatManager.getInstance().broadcastPacket(TALKING_DOCK[0], GLUDIN_DOCK[0], BUSY_TALKING); } _shoutCount++; - if (_shoutCount > 35) - { + if (_shoutCount > 35) { _shoutCount = 0; } @@ -254,22 +239,17 @@ public class BoatTalkingGludin implements Runnable } _shoutCount = 0; _cycle++; - if (_cycle > 17) - { + if (_cycle > 17) { _cycle = 0; } - } - catch (Exception e) - { + } catch (Exception e) { _log.log(Level.WARNING, e.getMessage()); } } - public static void main(String[] args) - { + public static void main(String[] args) { final L2BoatInstance boat = BoatManager.getInstance().getNewBoat(1, -96622, 261660, -3610, 32768); - if (boat != null) - { + if (boat != null) { boat.registerEngine(new BoatTalkingGludin(boat)); boat.runEngine(180000); BoatManager.getInstance().dockShip(BoatManager.TALKING_ISLAND, true); diff --git a/src/main/java/com/l2jserver/datapack/village_master/Alliance/Alliance.java b/src/main/java/com/l2jserver/datapack/village_master/Alliance/Alliance.java index 1529730047..53211a69f7 100644 --- a/src/main/java/com/l2jserver/datapack/village_master/Alliance/Alliance.java +++ b/src/main/java/com/l2jserver/datapack/village_master/Alliance/Alliance.java @@ -25,8 +25,7 @@ import com.l2jserver.gameserver.model.quest.Quest; /** * @author UnAfraid */ -public final class Alliance extends Quest -{ +public final class Alliance extends Quest { // @formatter:off private static final int[] NPCS = { @@ -45,31 +44,26 @@ public final class Alliance extends Quest }; // @formatter:on - private Alliance() - { + private Alliance() { super(-1, Alliance.class.getSimpleName(), "village_master"); addStartNpc(NPCS); addTalkId(NPCS); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (!"9001-01.htm".equals(event) && (player.getClan() == null)) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (!"9001-01.htm".equals(event) && (player.getClan() == null)) { return "9001-04.htm"; } return event; } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { return "9001-01.htm"; } - public static void main(String[] args) - { + public static void main(String[] args) { new Alliance(); } } diff --git a/src/main/java/com/l2jserver/datapack/village_master/Clan/Clan.java b/src/main/java/com/l2jserver/datapack/village_master/Clan/Clan.java index ce297e5def..d2ba568cdb 100644 --- a/src/main/java/com/l2jserver/datapack/village_master/Clan/Clan.java +++ b/src/main/java/com/l2jserver/datapack/village_master/Clan/Clan.java @@ -28,8 +28,7 @@ import com.l2jserver.gameserver.model.quest.Quest; /** * @author UnAfraid */ -public final class Clan extends Quest -{ +public final class Clan extends Quest { // @formatter:off private static final int[] NPCS = { @@ -48,8 +47,7 @@ public final class Clan extends Quest }; // @formatter:on private static final Map<String, String> LEADER_REQUIRED = new HashMap<>(); - static - { + static { LEADER_REQUIRED.put("9000-03.htm", "9000-03-no.htm"); LEADER_REQUIRED.put("9000-04.htm", "9000-04-no.htm"); LEADER_REQUIRED.put("9000-05.htm", "9000-05-no.htm"); @@ -63,20 +61,16 @@ public final class Clan extends Quest LEADER_REQUIRED.put("9000-15.htm", "9000-07-no.htm"); } - private Clan() - { + private Clan() { super(-1, Clan.class.getSimpleName(), "village_master"); addStartNpc(NPCS); addTalkId(NPCS); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { - if (LEADER_REQUIRED.containsKey(event)) - { - if (!player.isClanLeader()) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + if (LEADER_REQUIRED.containsKey(event)) { + if (!player.isClanLeader()) { return LEADER_REQUIRED.get(event); } } @@ -84,13 +78,11 @@ public final class Clan extends Quest } @Override - public String onTalk(L2Npc npc, L2PcInstance talker) - { + public String onTalk(L2Npc npc, L2PcInstance talker) { return "9000-01.htm"; } - public static void main(String[] args) - { + public static void main(String[] args) { new Clan(); } } diff --git a/src/main/java/com/l2jserver/datapack/village_master/DarkElfChange1/DarkElfChange1.java b/src/main/java/com/l2jserver/datapack/village_master/DarkElfChange1/DarkElfChange1.java index 4eacaea935..b3eb25bb59 100644 --- a/src/main/java/com/l2jserver/datapack/village_master/DarkElfChange1/DarkElfChange1.java +++ b/src/main/java/com/l2jserver/datapack/village_master/DarkElfChange1/DarkElfChange1.java @@ -30,11 +30,9 @@ import com.l2jserver.gameserver.model.base.ClassId; * @author Adry_85 * @since 2.6.0.0 */ -public final class DarkElfChange1 extends AbstractNpcAI -{ +public final class DarkElfChange1 extends AbstractNpcAI { // NPCs - private static int[] NPCS = - { + private static int[] NPCS = { 30290, // Xenos 30297, // Tobias 30462, // Tronix @@ -56,19 +54,16 @@ public final class DarkElfChange1 extends AbstractNpcAI // Misc private static final int MIN_LEVEL = 20; - private DarkElfChange1() - { + private DarkElfChange1() { super(DarkElfChange1.class.getSimpleName(), "village_master"); addStartNpc(NPCS); addTalkId(NPCS); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { + switch (event) { case "30290-01.htm": case "30290-02.htm": case "30290-03.htm": @@ -124,16 +119,14 @@ public final class DarkElfChange1 extends AbstractNpcAI case "32096-11.htm": case "32096-12.htm": case "32096-13.htm": - case "32096-14.htm": - { + case "32096-14.htm": { htmltext = event; break; } case "32": case "35": case "39": - case "42": - { + case "42": { htmltext = ClassChangeRequested(player, npc, Integer.valueOf(event)); break; } @@ -141,36 +134,22 @@ public final class DarkElfChange1 extends AbstractNpcAI return htmltext; } - private String ClassChangeRequested(L2PcInstance player, L2Npc npc, int classId) - { + private String ClassChangeRequested(L2PcInstance player, L2Npc npc, int classId) { String htmltext = null; - if (player.isInCategory(CategoryType.SECOND_CLASS_GROUP)) - { + if (player.isInCategory(CategoryType.SECOND_CLASS_GROUP)) { htmltext = npc.getId() + "-15.htm"; - } - else if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)) - { + } else if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)) { htmltext = npc.getId() + "-16.htm"; - } - else if (player.isInCategory(CategoryType.FOURTH_CLASS_GROUP)) - { + } else if (player.isInCategory(CategoryType.FOURTH_CLASS_GROUP)) { htmltext = "30290-34.htm"; - } - else if ((classId == PALUS_KNIGHT) && (player.getClassId() == ClassId.darkFighter)) - { - if (player.getLevel() < MIN_LEVEL) - { - if (hasQuestItems(player, GAZE_OF_ABYSS)) - { + } else if ((classId == PALUS_KNIGHT) && (player.getClassId() == ClassId.darkFighter)) { + if (player.getLevel() < MIN_LEVEL) { + if (hasQuestItems(player, GAZE_OF_ABYSS)) { htmltext = npc.getId() + "-17.htm"; - } - else - { + } else { htmltext = npc.getId() + "-18.htm"; } - } - else if (hasQuestItems(player, GAZE_OF_ABYSS)) - { + } else if (hasQuestItems(player, GAZE_OF_ABYSS)) { takeItems(player, GAZE_OF_ABYSS, -1); player.setClassId(PALUS_KNIGHT); player.setBaseClass(PALUS_KNIGHT); @@ -178,27 +157,17 @@ public final class DarkElfChange1 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_D_GRADE, 15); htmltext = npc.getId() + "-19.htm"; - } - else - { + } else { htmltext = npc.getId() + "-20.htm"; } - } - else if ((classId == ASSASSIN) && (player.getClassId() == ClassId.darkFighter)) - { - if (player.getLevel() < MIN_LEVEL) - { - if (hasQuestItems(player, IRON_HEART)) - { + } else if ((classId == ASSASSIN) && (player.getClassId() == ClassId.darkFighter)) { + if (player.getLevel() < MIN_LEVEL) { + if (hasQuestItems(player, IRON_HEART)) { htmltext = npc.getId() + "-21.htm"; - } - else - { + } else { htmltext = npc.getId() + "-22.htm"; } - } - else if (hasQuestItems(player, IRON_HEART)) - { + } else if (hasQuestItems(player, IRON_HEART)) { takeItems(player, IRON_HEART, -1); player.setClassId(ASSASSIN); player.setBaseClass(ASSASSIN); @@ -206,27 +175,17 @@ public final class DarkElfChange1 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_D_GRADE, 15); htmltext = npc.getId() + "-23.htm"; - } - else - { + } else { htmltext = npc.getId() + "-24.htm"; } - } - else if ((classId == DARK_WIZARD) && (player.getClassId() == ClassId.darkMage)) - { - if (player.getLevel() < MIN_LEVEL) - { - if (hasQuestItems(player, DARK_JEWEL)) - { + } else if ((classId == DARK_WIZARD) && (player.getClassId() == ClassId.darkMage)) { + if (player.getLevel() < MIN_LEVEL) { + if (hasQuestItems(player, DARK_JEWEL)) { htmltext = npc.getId() + "-25.htm"; - } - else - { + } else { htmltext = npc.getId() + "-26.htm"; } - } - else if (hasQuestItems(player, DARK_JEWEL)) - { + } else if (hasQuestItems(player, DARK_JEWEL)) { takeItems(player, DARK_JEWEL, -1); player.setClassId(DARK_WIZARD); player.setBaseClass(DARK_WIZARD); @@ -234,27 +193,17 @@ public final class DarkElfChange1 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_D_GRADE, 15); htmltext = npc.getId() + "-27.htm"; - } - else - { + } else { htmltext = npc.getId() + "-28.htm"; } - } - else if ((classId == SHILLIEN_ORACLE) && (player.getClassId() == ClassId.darkMage)) - { - if (player.getLevel() < MIN_LEVEL) - { - if (hasQuestItems(player, ORB_OF_ABYSS)) - { + } else if ((classId == SHILLIEN_ORACLE) && (player.getClassId() == ClassId.darkMage)) { + if (player.getLevel() < MIN_LEVEL) { + if (hasQuestItems(player, ORB_OF_ABYSS)) { htmltext = npc.getId() + "-29.htm"; - } - else - { + } else { htmltext = npc.getId() + "-30.htm"; } - } - else if (hasQuestItems(player, ORB_OF_ABYSS)) - { + } else if (hasQuestItems(player, ORB_OF_ABYSS)) { takeItems(player, ORB_OF_ABYSS, -1); player.setClassId(SHILLIEN_ORACLE); player.setBaseClass(SHILLIEN_ORACLE); @@ -262,9 +211,7 @@ public final class DarkElfChange1 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_D_GRADE, 15); htmltext = npc.getId() + "-31.htm"; - } - else - { + } else { htmltext = npc.getId() + "-32.htm"; } } @@ -272,29 +219,21 @@ public final class DarkElfChange1 extends AbstractNpcAI } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; - if (player.getRace() == Race.DARK_ELF) - { - if (player.isInCategory(CategoryType.FIGHTER_GROUP)) - { + if (player.getRace() == Race.DARK_ELF) { + if (player.isInCategory(CategoryType.FIGHTER_GROUP)) { htmltext = npc.getId() + "-01.htm"; - } - else if ((player.isInCategory(CategoryType.MAGE_GROUP))) - { + } else if ((player.isInCategory(CategoryType.MAGE_GROUP))) { htmltext = npc.getId() + "-08.htm"; } - } - else - { + } else { htmltext = npc.getId() + "-33.htm"; } return htmltext; } - public static void main(String[] args) - { + public static void main(String[] args) { new DarkElfChange1(); } } diff --git a/src/main/java/com/l2jserver/datapack/village_master/DarkElfChange2/DarkElfChange2.java b/src/main/java/com/l2jserver/datapack/village_master/DarkElfChange2/DarkElfChange2.java index 376da91c62..1f4b0a0c1d 100644 --- a/src/main/java/com/l2jserver/datapack/village_master/DarkElfChange2/DarkElfChange2.java +++ b/src/main/java/com/l2jserver/datapack/village_master/DarkElfChange2/DarkElfChange2.java @@ -29,11 +29,9 @@ import com.l2jserver.gameserver.model.base.ClassId; * @author Adry_85 * @since 2.6.0.0 */ -public final class DarkElfChange2 extends AbstractNpcAI -{ +public final class DarkElfChange2 extends AbstractNpcAI { // NPCs - private static final int[] NPCS = - { + private static final int[] NPCS = { 30195, // Brecson 30474, // Angus 30699, // Medown @@ -72,19 +70,16 @@ public final class DarkElfChange2 extends AbstractNpcAI // Misc private static final int MIN_LEVEL = 40; - private DarkElfChange2() - { + private DarkElfChange2() { super(DarkElfChange2.class.getSimpleName(), "village_master"); addStartNpc(NPCS); addTalkId(NPCS); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { + switch (event) { case "30195-02.htm": case "30195-03.htm": case "30195-04.htm": @@ -109,8 +104,7 @@ public final class DarkElfChange2 extends AbstractNpcAI case "30195-23.htm": case "30195-24.htm": case "30195-25.htm": - case "30195-26.htm": - { + case "30195-26.htm": { htmltext = event; break; } @@ -120,8 +114,7 @@ public final class DarkElfChange2 extends AbstractNpcAI case "37": case "40": case "41": - case "43": - { + case "43": { htmltext = ClassChangeRequested(player, Integer.valueOf(event)); break; } @@ -129,28 +122,18 @@ public final class DarkElfChange2 extends AbstractNpcAI return htmltext; } - private String ClassChangeRequested(L2PcInstance player, int classId) - { + private String ClassChangeRequested(L2PcInstance player, int classId) { String htmltext = null; - if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)) - { + if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)) { htmltext = "30195-29.htm"; - } - else if ((classId == SHILLIEN_KNIGHT) && (player.getClassId() == ClassId.palusKnight)) - { - if (player.getLevel() < MIN_LEVEL) - { - if (hasQuestItems(player, MARK_OF_DUTY, MARK_OF_FATE, MARK_OF_WITCHCRAFT)) - { + } else if ((classId == SHILLIEN_KNIGHT) && (player.getClassId() == ClassId.palusKnight)) { + if (player.getLevel() < MIN_LEVEL) { + if (hasQuestItems(player, MARK_OF_DUTY, MARK_OF_FATE, MARK_OF_WITCHCRAFT)) { htmltext = "30195-30.htm"; - } - else - { + } else { htmltext = "30195-31.htm"; } - } - else if (hasQuestItems(player, MARK_OF_DUTY, MARK_OF_FATE, MARK_OF_WITCHCRAFT)) - { + } else if (hasQuestItems(player, MARK_OF_DUTY, MARK_OF_FATE, MARK_OF_WITCHCRAFT)) { takeItems(player, -1, MARK_OF_DUTY, MARK_OF_FATE, MARK_OF_WITCHCRAFT); player.setClassId(SHILLIEN_KNIGHT); player.setBaseClass(SHILLIEN_KNIGHT); @@ -158,27 +141,17 @@ public final class DarkElfChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30195-32.htm"; - } - else - { + } else { htmltext = "30195-33.htm"; } - } - else if ((classId == BLADEDANCER) && (player.getClassId() == ClassId.palusKnight)) - { - if (player.getLevel() < MIN_LEVEL) - { - if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_FATE, MARK_OF_DUELIST)) - { + } else if ((classId == BLADEDANCER) && (player.getClassId() == ClassId.palusKnight)) { + if (player.getLevel() < MIN_LEVEL) { + if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_FATE, MARK_OF_DUELIST)) { htmltext = "30195-34.htm"; - } - else - { + } else { htmltext = "30195-35.htm"; } - } - else if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_FATE, MARK_OF_DUELIST)) - { + } else if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_FATE, MARK_OF_DUELIST)) { takeItems(player, -1, MARK_OF_CHALLENGER, MARK_OF_FATE, MARK_OF_DUELIST); player.setClassId(BLADEDANCER); player.setBaseClass(BLADEDANCER); @@ -186,27 +159,17 @@ public final class DarkElfChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30195-36.htm"; - } - else - { + } else { htmltext = "30195-37.htm"; } - } - else if ((classId == ABYSS_WALKER) && (player.getClassId() == ClassId.assassin)) - { - if (player.getLevel() < MIN_LEVEL) - { - if (hasQuestItems(player, MARK_OF_SEEKER, MARK_OF_FATE, MARK_OF_SEARCHER)) - { + } else if ((classId == ABYSS_WALKER) && (player.getClassId() == ClassId.assassin)) { + if (player.getLevel() < MIN_LEVEL) { + if (hasQuestItems(player, MARK_OF_SEEKER, MARK_OF_FATE, MARK_OF_SEARCHER)) { htmltext = "30195-38.htm"; - } - else - { + } else { htmltext = "30195-39.htm"; } - } - else if (hasQuestItems(player, MARK_OF_SEEKER, MARK_OF_FATE, MARK_OF_SEARCHER)) - { + } else if (hasQuestItems(player, MARK_OF_SEEKER, MARK_OF_FATE, MARK_OF_SEARCHER)) { takeItems(player, -1, MARK_OF_SEEKER, MARK_OF_FATE, MARK_OF_SEARCHER); player.setClassId(ABYSS_WALKER); player.setBaseClass(ABYSS_WALKER); @@ -214,27 +177,17 @@ public final class DarkElfChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30195-40.htm"; - } - else - { + } else { htmltext = "30195-41.htm"; } - } - else if ((classId == PHANTOM_RANGER) && (player.getClassId() == ClassId.assassin)) - { - if (player.getLevel() < MIN_LEVEL) - { - if (hasQuestItems(player, MARK_OF_SEEKER, MARK_OF_FATE, MARK_OF_SAGITTARIUS)) - { + } else if ((classId == PHANTOM_RANGER) && (player.getClassId() == ClassId.assassin)) { + if (player.getLevel() < MIN_LEVEL) { + if (hasQuestItems(player, MARK_OF_SEEKER, MARK_OF_FATE, MARK_OF_SAGITTARIUS)) { htmltext = "30195-42.htm"; - } - else - { + } else { htmltext = "30195-43.htm"; } - } - else if (hasQuestItems(player, MARK_OF_SEEKER, MARK_OF_FATE, MARK_OF_SAGITTARIUS)) - { + } else if (hasQuestItems(player, MARK_OF_SEEKER, MARK_OF_FATE, MARK_OF_SAGITTARIUS)) { takeItems(player, -1, MARK_OF_SEEKER, MARK_OF_FATE, MARK_OF_SAGITTARIUS); player.setClassId(PHANTOM_RANGER); player.setBaseClass(PHANTOM_RANGER); @@ -242,27 +195,17 @@ public final class DarkElfChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30195-44.htm"; - } - else - { + } else { htmltext = "30195-45.htm"; } - } - else if ((classId == SPELLHOWLER) && (player.getClassId() == ClassId.darkWizard)) - { - if (player.getLevel() < MIN_LEVEL) - { - if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_FATE, MARK_OF_MAGUS)) - { + } else if ((classId == SPELLHOWLER) && (player.getClassId() == ClassId.darkWizard)) { + if (player.getLevel() < MIN_LEVEL) { + if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_FATE, MARK_OF_MAGUS)) { htmltext = "30195-46.htm"; - } - else - { + } else { htmltext = "30195-47.htm"; } - } - else if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_FATE, MARK_OF_MAGUS)) - { + } else if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_FATE, MARK_OF_MAGUS)) { takeItems(player, -1, MARK_OF_SCHOLAR, MARK_OF_FATE, MARK_OF_MAGUS); player.setClassId(SPELLHOWLER); player.setBaseClass(SPELLHOWLER); @@ -270,27 +213,17 @@ public final class DarkElfChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30195-48.htm"; - } - else - { + } else { htmltext = "30195-49.htm"; } - } - else if ((classId == PHANTOM_SUMMONER) && (player.getClassId() == ClassId.darkWizard)) - { - if (player.getLevel() < MIN_LEVEL) - { - if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_FATE, MARK_OF_SUMMONER)) - { + } else if ((classId == PHANTOM_SUMMONER) && (player.getClassId() == ClassId.darkWizard)) { + if (player.getLevel() < MIN_LEVEL) { + if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_FATE, MARK_OF_SUMMONER)) { htmltext = "30195-50.htm"; - } - else - { + } else { htmltext = "30195-51.htm"; } - } - else if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_FATE, MARK_OF_SUMMONER)) - { + } else if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_FATE, MARK_OF_SUMMONER)) { takeItems(player, -1, MARK_OF_SCHOLAR, MARK_OF_FATE, MARK_OF_SUMMONER); player.setClassId(PHANTOM_SUMMONER); player.setBaseClass(PHANTOM_SUMMONER); @@ -298,27 +231,17 @@ public final class DarkElfChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30195-52.htm"; - } - else - { + } else { htmltext = "30195-53.htm"; } - } - else if ((classId == SHILLIEN_ELDER) && (player.getClassId() == ClassId.shillienOracle)) - { - if (player.getLevel() < MIN_LEVEL) - { - if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_FATE, MARK_OF_REFORMER)) - { + } else if ((classId == SHILLIEN_ELDER) && (player.getClassId() == ClassId.shillienOracle)) { + if (player.getLevel() < MIN_LEVEL) { + if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_FATE, MARK_OF_REFORMER)) { htmltext = "30195-54.htm"; - } - else - { + } else { htmltext = "30195-55.htm"; } - } - else if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_FATE, MARK_OF_REFORMER)) - { + } else if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_FATE, MARK_OF_REFORMER)) { takeItems(player, -1, MARK_OF_PILGRIM, MARK_OF_FATE, MARK_OF_REFORMER); player.setClassId(SHILLIEN_ELDER); player.setBaseClass(SHILLIEN_ELDER); @@ -326,9 +249,7 @@ public final class DarkElfChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30195-56.htm"; - } - else - { + } else { htmltext = "30195-57.htm"; } } @@ -336,46 +257,30 @@ public final class DarkElfChange2 extends AbstractNpcAI } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; - if (player.isInCategory(CategoryType.FOURTH_CLASS_GROUP) && (player.isInCategory(CategoryType.DELF_MALL_CLASS) || player.isInCategory(CategoryType.DELF_FALL_CLASS))) - { + if (player.isInCategory(CategoryType.FOURTH_CLASS_GROUP) && (player.isInCategory(CategoryType.DELF_MALL_CLASS) || player.isInCategory(CategoryType.DELF_FALL_CLASS))) { htmltext = "30195-01.htm"; - } - else if ((player.isInCategory(CategoryType.DELF_MALL_CLASS) || player.isInCategory(CategoryType.DELF_FALL_CLASS))) - { + } else if ((player.isInCategory(CategoryType.DELF_MALL_CLASS) || player.isInCategory(CategoryType.DELF_FALL_CLASS))) { final ClassId classId = player.getClassId(); - if ((classId == ClassId.palusKnight) || (classId == ClassId.shillienKnight) || (classId == ClassId.bladedancer)) - { + if ((classId == ClassId.palusKnight) || (classId == ClassId.shillienKnight) || (classId == ClassId.bladedancer)) { htmltext = "30195-02.htm"; - } - else if ((classId == ClassId.assassin) || (classId == ClassId.abyssWalker) || (classId == ClassId.phantomRanger)) - { + } else if ((classId == ClassId.assassin) || (classId == ClassId.abyssWalker) || (classId == ClassId.phantomRanger)) { htmltext = "30195-09.htm"; - } - else if ((classId == ClassId.darkWizard) || (classId == ClassId.spellhowler) || (classId == ClassId.phantomSummoner)) - { + } else if ((classId == ClassId.darkWizard) || (classId == ClassId.spellhowler) || (classId == ClassId.phantomSummoner)) { htmltext = "30195-16.htm"; - } - else if ((classId == ClassId.shillienOracle) || (classId == ClassId.shillenElder)) - { + } else if ((classId == ClassId.shillienOracle) || (classId == ClassId.shillenElder)) { htmltext = "30195-23.htm"; - } - else - { + } else { htmltext = "30195-27.htm"; } - } - else - { + } else { htmltext = "30195-28.htm"; } return htmltext; } - public static void main(String[] args) - { + public static void main(String[] args) { new DarkElfChange2(); } } diff --git a/src/main/java/com/l2jserver/datapack/village_master/DwarfBlacksmithChange1/DwarfBlacksmithChange1.java b/src/main/java/com/l2jserver/datapack/village_master/DwarfBlacksmithChange1/DwarfBlacksmithChange1.java index e99a6a4e73..af359e1783 100644 --- a/src/main/java/com/l2jserver/datapack/village_master/DwarfBlacksmithChange1/DwarfBlacksmithChange1.java +++ b/src/main/java/com/l2jserver/datapack/village_master/DwarfBlacksmithChange1/DwarfBlacksmithChange1.java @@ -28,11 +28,9 @@ import com.l2jserver.gameserver.model.base.ClassId; * Dwarf class transfer AI. * @author Adry_85 */ -public final class DwarfBlacksmithChange1 extends AbstractNpcAI -{ +public final class DwarfBlacksmithChange1 extends AbstractNpcAI { // NPCs - private static int[] NPCS = - { + private static int[] NPCS = { 30499, // Tapoy 30504, // Mendio 30595, // Opix @@ -45,19 +43,16 @@ public final class DwarfBlacksmithChange1 extends AbstractNpcAI // Class private static final int ARTISAN = 56; - private DwarfBlacksmithChange1() - { + private DwarfBlacksmithChange1() { super(DwarfBlacksmithChange1.class.getSimpleName(), "village_master"); addStartNpc(NPCS); addTalkId(NPCS); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { + switch (event) { case "30499-01.htm": // head_blacksmith_tapoy003f case "30499-02.htm": // head_blacksmith_tapoy006fa case "30499-03.htm": // head_blacksmith_tapoy007fa @@ -78,8 +73,7 @@ public final class DwarfBlacksmithChange1 extends AbstractNpcAI htmltext = event; break; } - case "56": - { + case "56": { htmltext = ClassChangeRequested(player, npc, Integer.valueOf(event)); break; } @@ -87,36 +81,22 @@ public final class DwarfBlacksmithChange1 extends AbstractNpcAI return htmltext; } - private String ClassChangeRequested(L2PcInstance player, L2Npc npc, int classId) - { + private String ClassChangeRequested(L2PcInstance player, L2Npc npc, int classId) { String htmltext = null; - if (player.isInCategory(CategoryType.SECOND_CLASS_GROUP)) - { + if (player.isInCategory(CategoryType.SECOND_CLASS_GROUP)) { htmltext = npc.getId() + "-06.htm"; // fnYouAreSecondClass - } - else if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)) - { + } else if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)) { htmltext = npc.getId() + "-07.htm"; // fnYouAreThirdClass - } - else if (player.isInCategory(CategoryType.FOURTH_CLASS_GROUP)) - { + } else if (player.isInCategory(CategoryType.FOURTH_CLASS_GROUP)) { htmltext = "30499-12.htm"; // fnYouAreFourthClass - } - else if ((classId == ARTISAN) && (player.getClassId() == ClassId.dwarvenFighter)) - { - if (player.getLevel() < 20) - { - if (hasQuestItems(player, FINAL_PASS_CERTIFICATE)) - { + } else if ((classId == ARTISAN) && (player.getClassId() == ClassId.dwarvenFighter)) { + if (player.getLevel() < 20) { + if (hasQuestItems(player, FINAL_PASS_CERTIFICATE)) { htmltext = npc.getId() + "-08.htm"; // fnLowLevel11 - } - else - { + } else { htmltext = npc.getId() + "-09.htm"; // fnLowLevelNoProof11 } - } - else if (hasQuestItems(player, FINAL_PASS_CERTIFICATE)) - { + } else if (hasQuestItems(player, FINAL_PASS_CERTIFICATE)) { takeItems(player, FINAL_PASS_CERTIFICATE, -1); player.setClassId(ARTISAN); player.setBaseClass(ARTISAN); @@ -124,9 +104,7 @@ public final class DwarfBlacksmithChange1 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_D_GRADE, 15); htmltext = npc.getId() + "-10.htm"; // fnAfterClassChange11 - } - else - { + } else { htmltext = npc.getId() + "-11.htm"; // fnNoProof11 } } @@ -134,22 +112,17 @@ public final class DwarfBlacksmithChange1 extends AbstractNpcAI } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; - if (player.isInCategory(CategoryType.WARSMITH_GROUP)) - { + if (player.isInCategory(CategoryType.WARSMITH_GROUP)) { htmltext = npc.getId() + "-01.htm"; // fnClassList1 - } - else - { + } else { htmltext = npc.getId() + "-05.htm"; // fnClassMismatch } return htmltext; } - public static void main(String[] args) - { + public static void main(String[] args) { new DwarfBlacksmithChange1(); } } diff --git a/src/main/java/com/l2jserver/datapack/village_master/DwarfBlacksmithChange2/DwarfBlacksmithChange2.java b/src/main/java/com/l2jserver/datapack/village_master/DwarfBlacksmithChange2/DwarfBlacksmithChange2.java index 8fb14d45d3..2850781bec 100644 --- a/src/main/java/com/l2jserver/datapack/village_master/DwarfBlacksmithChange2/DwarfBlacksmithChange2.java +++ b/src/main/java/com/l2jserver/datapack/village_master/DwarfBlacksmithChange2/DwarfBlacksmithChange2.java @@ -28,11 +28,9 @@ import com.l2jserver.gameserver.model.base.ClassId; * Dwarf class transfer AI. * @author Adry_85 */ -public final class DwarfBlacksmithChange2 extends AbstractNpcAI -{ +public final class DwarfBlacksmithChange2 extends AbstractNpcAI { // NPCs - private static int[] NPCS = - { + private static int[] NPCS = { 30512, // Kusto 30677, // Flutter 30687, // Vergara @@ -51,19 +49,16 @@ public final class DwarfBlacksmithChange2 extends AbstractNpcAI // Class private static final int WARSMITH = 57; - private DwarfBlacksmithChange2() - { + private DwarfBlacksmithChange2() { super(DwarfBlacksmithChange2.class.getSimpleName(), "village_master"); addStartNpc(NPCS); addTalkId(NPCS); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { + switch (event) { case "30512-03.htm": // master_lv3_black006fa case "30512-04.htm": // master_lv3_black007fa case "30512-05.htm": // master_lv3_black007fat @@ -71,8 +66,7 @@ public final class DwarfBlacksmithChange2 extends AbstractNpcAI htmltext = event; break; } - case "57": - { + case "57": { htmltext = ClassChangeRequested(player, Integer.valueOf(event)); break; } @@ -80,28 +74,18 @@ public final class DwarfBlacksmithChange2 extends AbstractNpcAI return htmltext; } - private String ClassChangeRequested(L2PcInstance player, int classId) - { + private String ClassChangeRequested(L2PcInstance player, int classId) { String htmltext = null; - if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)) - { + if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)) { htmltext = "30512-08.htm"; // fnYouAreThirdClass - } - else if ((classId == WARSMITH) && (player.getClassId() == ClassId.artisan)) - { - if (player.getLevel() < 40) - { - if (hasQuestItems(player, MARK_OF_GUILDSMAN, MARK_OF_PROSPERITY, MARK_OF_MAESTRO)) - { + } else if ((classId == WARSMITH) && (player.getClassId() == ClassId.artisan)) { + if (player.getLevel() < 40) { + if (hasQuestItems(player, MARK_OF_GUILDSMAN, MARK_OF_PROSPERITY, MARK_OF_MAESTRO)) { htmltext = "30512-09.htm"; // fnLowLevel11 - } - else - { + } else { htmltext = "30512-10.htm"; // fnLowLevelNoProof11 } - } - else if (hasQuestItems(player, MARK_OF_GUILDSMAN, MARK_OF_PROSPERITY, MARK_OF_MAESTRO)) - { + } else if (hasQuestItems(player, MARK_OF_GUILDSMAN, MARK_OF_PROSPERITY, MARK_OF_MAESTRO)) { takeItems(player, -1, MARK_OF_GUILDSMAN, MARK_OF_PROSPERITY, MARK_OF_MAESTRO); player.setClassId(WARSMITH); player.setBaseClass(WARSMITH); @@ -109,9 +93,7 @@ public final class DwarfBlacksmithChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30512-11.htm"; // fnAfterClassChange11 - } - else - { + } else { htmltext = "30512-12.htm"; // fnNoProof11 } } @@ -119,34 +101,24 @@ public final class DwarfBlacksmithChange2 extends AbstractNpcAI } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; - if (player.isInCategory(CategoryType.FOURTH_CLASS_GROUP)) - { + if (player.isInCategory(CategoryType.FOURTH_CLASS_GROUP)) { htmltext = "30512-01.htm"; // fnYouAreFourthClass - } - else if (player.isInCategory(CategoryType.WARSMITH_GROUP)) - { + } else if (player.isInCategory(CategoryType.WARSMITH_GROUP)) { final ClassId classId = player.getClassId(); - if ((classId == ClassId.artisan) || (classId == ClassId.warsmith)) - { + if ((classId == ClassId.artisan) || (classId == ClassId.warsmith)) { htmltext = "30512-02.htm"; // fnClassList1 - } - else - { + } else { htmltext = "30512-06.htm"; // fnYouAreFirstClass } - } - else - { + } else { htmltext = "30512-07.htm"; // fnClassMismatch } return htmltext; } - public static void main(String[] args) - { + public static void main(String[] args) { new DwarfBlacksmithChange2(); } } diff --git a/src/main/java/com/l2jserver/datapack/village_master/DwarfWarehouseChange1/DwarfWarehouseChange1.java b/src/main/java/com/l2jserver/datapack/village_master/DwarfWarehouseChange1/DwarfWarehouseChange1.java index 4daf3e6bca..5a5121e224 100644 --- a/src/main/java/com/l2jserver/datapack/village_master/DwarfWarehouseChange1/DwarfWarehouseChange1.java +++ b/src/main/java/com/l2jserver/datapack/village_master/DwarfWarehouseChange1/DwarfWarehouseChange1.java @@ -28,11 +28,9 @@ import com.l2jserver.gameserver.model.base.ClassId; * Dwarf class transfer AI. * @author Adry_85 */ -public final class DwarfWarehouseChange1 extends AbstractNpcAI -{ +public final class DwarfWarehouseChange1 extends AbstractNpcAI { // NPCs - private static int[] NPCS = - { + private static int[] NPCS = { 30498, // Moke 30503, // Rikadio 30594, // Ranspo @@ -45,19 +43,16 @@ public final class DwarfWarehouseChange1 extends AbstractNpcAI // Class private static final int SCAVENGER = 54; - private DwarfWarehouseChange1() - { + private DwarfWarehouseChange1() { super(DwarfWarehouseChange1.class.getSimpleName(), "village_master"); addStartNpc(NPCS); addTalkId(NPCS); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { + switch (event) { case "30498-01.htm": // warehouse_chief_moke003f case "30498-02.htm": // warehouse_chief_moke006fa case "30498-03.htm": // warehouse_chief_moke007fa @@ -78,8 +73,7 @@ public final class DwarfWarehouseChange1 extends AbstractNpcAI htmltext = event; break; } - case "54": - { + case "54": { htmltext = ClassChangeRequested(player, npc, Integer.valueOf(event)); break; } @@ -87,36 +81,22 @@ public final class DwarfWarehouseChange1 extends AbstractNpcAI return htmltext; } - private String ClassChangeRequested(L2PcInstance player, L2Npc npc, int classId) - { + private String ClassChangeRequested(L2PcInstance player, L2Npc npc, int classId) { String htmltext = null; - if (player.isInCategory(CategoryType.SECOND_CLASS_GROUP)) - { + if (player.isInCategory(CategoryType.SECOND_CLASS_GROUP)) { htmltext = npc.getId() + "-06.htm"; // fnYouAreSecondClass - } - else if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)) - { + } else if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)) { htmltext = npc.getId() + "-07.htm"; // fnYouAreThirdClass - } - else if (player.isInCategory(CategoryType.FOURTH_CLASS_GROUP)) - { + } else if (player.isInCategory(CategoryType.FOURTH_CLASS_GROUP)) { htmltext = "30498-12.htm"; // fnYouAreFourthClass - } - else if ((classId == SCAVENGER) && (player.getClassId() == ClassId.dwarvenFighter)) - { - if (player.getLevel() < 20) - { - if (hasQuestItems(player, RING_OF_RAVEN)) - { + } else if ((classId == SCAVENGER) && (player.getClassId() == ClassId.dwarvenFighter)) { + if (player.getLevel() < 20) { + if (hasQuestItems(player, RING_OF_RAVEN)) { htmltext = npc.getId() + "-08.htm"; // fnLowLevel11 - } - else - { + } else { htmltext = npc.getId() + "-09.htm"; // fnLowLevelNoProof11 } - } - else if (hasQuestItems(player, RING_OF_RAVEN)) - { + } else if (hasQuestItems(player, RING_OF_RAVEN)) { takeItems(player, RING_OF_RAVEN, -1); player.setClassId(SCAVENGER); player.setBaseClass(SCAVENGER); @@ -124,9 +104,7 @@ public final class DwarfWarehouseChange1 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_D_GRADE, 15); htmltext = npc.getId() + "-10.htm"; // fnAfterClassChange11 - } - else - { + } else { htmltext = npc.getId() + "-11.htm"; // fnNoProof11 } } @@ -134,22 +112,17 @@ public final class DwarfWarehouseChange1 extends AbstractNpcAI } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; - if (player.isInCategory(CategoryType.BOUNTY_HUNTER_GROUP)) - { + if (player.isInCategory(CategoryType.BOUNTY_HUNTER_GROUP)) { htmltext = npc.getId() + "-01.htm"; // fnClassList1 - } - else - { + } else { htmltext = npc.getId() + "-05.htm"; // fnClassMismatch } return htmltext; } - public static void main(String[] args) - { + public static void main(String[] args) { new DwarfWarehouseChange1(); } } diff --git a/src/main/java/com/l2jserver/datapack/village_master/DwarfWarehouseChange2/DwarfWarehouseChange2.java b/src/main/java/com/l2jserver/datapack/village_master/DwarfWarehouseChange2/DwarfWarehouseChange2.java index e330018652..056aa7786d 100644 --- a/src/main/java/com/l2jserver/datapack/village_master/DwarfWarehouseChange2/DwarfWarehouseChange2.java +++ b/src/main/java/com/l2jserver/datapack/village_master/DwarfWarehouseChange2/DwarfWarehouseChange2.java @@ -28,11 +28,9 @@ import com.l2jserver.gameserver.model.base.ClassId; * Dwarf class transfer AI. * @author Adry_85 */ -public final class DwarfWarehouseChange2 extends AbstractNpcAI -{ +public final class DwarfWarehouseChange2 extends AbstractNpcAI { // NPCs - private static int[] NPCS = - { + private static int[] NPCS = { 30511, // Gesto 30676, // Croop 30685, // Baxt @@ -51,19 +49,16 @@ public final class DwarfWarehouseChange2 extends AbstractNpcAI // Class private static final int BOUNTY_HUNTER = 55; - private DwarfWarehouseChange2() - { + private DwarfWarehouseChange2() { super(DwarfWarehouseChange2.class.getSimpleName(), "village_master"); addStartNpc(NPCS); addTalkId(NPCS); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { + switch (event) { case "30511-03.htm": // master_lv3_ware006fa case "30511-04.htm": // master_lv3_ware007fa case "30511-05.htm": // master_lv3_ware007fat @@ -71,8 +66,7 @@ public final class DwarfWarehouseChange2 extends AbstractNpcAI htmltext = event; break; } - case "55": - { + case "55": { htmltext = ClassChangeRequested(player, Integer.valueOf(event)); break; } @@ -80,28 +74,18 @@ public final class DwarfWarehouseChange2 extends AbstractNpcAI return htmltext; } - private String ClassChangeRequested(L2PcInstance player, int classId) - { + private String ClassChangeRequested(L2PcInstance player, int classId) { String htmltext = null; - if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)) - { + if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)) { htmltext = "30511-08.htm"; // fnYouAreThirdClass - } - else if ((classId == BOUNTY_HUNTER) && (player.getClassId() == ClassId.scavenger)) - { - if (player.getLevel() < 40) - { - if (hasQuestItems(player, MARK_OF_GUILDSMAN, MARK_OF_PROSPERITY, MARK_OF_SEARCHER)) - { + } else if ((classId == BOUNTY_HUNTER) && (player.getClassId() == ClassId.scavenger)) { + if (player.getLevel() < 40) { + if (hasQuestItems(player, MARK_OF_GUILDSMAN, MARK_OF_PROSPERITY, MARK_OF_SEARCHER)) { htmltext = "30511-09.htm"; // fnLowLevel11 - } - else - { + } else { htmltext = "30511-10.htm"; // fnLowLevelNoProof11 } - } - else if (hasQuestItems(player, MARK_OF_GUILDSMAN, MARK_OF_PROSPERITY, MARK_OF_SEARCHER)) - { + } else if (hasQuestItems(player, MARK_OF_GUILDSMAN, MARK_OF_PROSPERITY, MARK_OF_SEARCHER)) { takeItems(player, -1, MARK_OF_GUILDSMAN, MARK_OF_PROSPERITY, MARK_OF_SEARCHER); player.setClassId(BOUNTY_HUNTER); player.setBaseClass(BOUNTY_HUNTER); @@ -109,9 +93,7 @@ public final class DwarfWarehouseChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30511-11.htm"; // fnAfterClassChange11 - } - else - { + } else { htmltext = "30511-12.htm"; // fnNoProof11 } } @@ -119,34 +101,24 @@ public final class DwarfWarehouseChange2 extends AbstractNpcAI } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; - if (player.isInCategory(CategoryType.FOURTH_CLASS_GROUP) && player.isInCategory(CategoryType.BOUNTY_HUNTER_GROUP)) - { + if (player.isInCategory(CategoryType.FOURTH_CLASS_GROUP) && player.isInCategory(CategoryType.BOUNTY_HUNTER_GROUP)) { htmltext = "30511-01.htm"; // fnYouAreFourthClass - } - else if (player.isInCategory(CategoryType.BOUNTY_HUNTER_GROUP)) - { + } else if (player.isInCategory(CategoryType.BOUNTY_HUNTER_GROUP)) { final ClassId classId = player.getClassId(); - if ((classId == ClassId.scavenger) || (classId == ClassId.bountyHunter)) - { + if ((classId == ClassId.scavenger) || (classId == ClassId.bountyHunter)) { htmltext = "30511-02.htm"; // fnClassList1 - } - else - { + } else { htmltext = "30511-06.htm"; // fnYouAreFirstClass } - } - else - { + } else { htmltext = "30511-07.htm"; // fnClassMismatch } return htmltext; } - public static void main(String[] args) - { + public static void main(String[] args) { new DwarfWarehouseChange2(); } } diff --git a/src/main/java/com/l2jserver/datapack/village_master/ElfHumanClericChange2/ElfHumanClericChange2.java b/src/main/java/com/l2jserver/datapack/village_master/ElfHumanClericChange2/ElfHumanClericChange2.java index 4c80b395a1..56a5a91c4e 100644 --- a/src/main/java/com/l2jserver/datapack/village_master/ElfHumanClericChange2/ElfHumanClericChange2.java +++ b/src/main/java/com/l2jserver/datapack/village_master/ElfHumanClericChange2/ElfHumanClericChange2.java @@ -28,11 +28,9 @@ import com.l2jserver.gameserver.model.base.ClassId; * Elf Human class transfer AI. * @author Adry_85 */ -public final class ElfHumanClericChange2 extends AbstractNpcAI -{ +public final class ElfHumanClericChange2 extends AbstractNpcAI { // NPCs - private static int[] NPCS = - { + private static int[] NPCS = { 30120, // Maximilian 30191, // Hollint 30857, // Orven @@ -54,19 +52,16 @@ public final class ElfHumanClericChange2 extends AbstractNpcAI private static final int PROPHET = 17; private static final int ELDER = 30; - private ElfHumanClericChange2() - { + private ElfHumanClericChange2() { super(ElfHumanClericChange2.class.getSimpleName(), "village_master"); addStartNpc(NPCS); addTalkId(NPCS); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { + switch (event) { case "30120-02.htm": // master_lv3_hec003h case "30120-03.htm": // master_lv3_hec006ha case "30120-04.htm": // master_lv3_hec007ha @@ -83,8 +78,7 @@ public final class ElfHumanClericChange2 extends AbstractNpcAI } case "16": case "17": - case "30": - { + case "30": { htmltext = ClassChangeRequested(player, Integer.valueOf(event)); break; } @@ -92,28 +86,18 @@ public final class ElfHumanClericChange2 extends AbstractNpcAI return htmltext; } - private String ClassChangeRequested(L2PcInstance player, int classId) - { + private String ClassChangeRequested(L2PcInstance player, int classId) { String htmltext = null; - if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)) - { + if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)) { htmltext = "30120-15.htm"; // fnYouAreThirdClass - } - else if ((classId == BISHOP) && (player.getClassId() == ClassId.cleric)) - { - if (player.getLevel() < 40) - { - if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_TRUST, MARK_OF_HEALER)) - { + } else if ((classId == BISHOP) && (player.getClassId() == ClassId.cleric)) { + if (player.getLevel() < 40) { + if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_TRUST, MARK_OF_HEALER)) { htmltext = "30120-16.htm"; // fnLowLevel11 - } - else - { + } else { htmltext = "30120-17.htm"; // fnLowLevelNoProof11 } - } - else if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_TRUST, MARK_OF_HEALER)) - { + } else if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_TRUST, MARK_OF_HEALER)) { takeItems(player, -1, MARK_OF_PILGRIM, MARK_OF_TRUST, MARK_OF_HEALER); player.setClassId(BISHOP); player.setBaseClass(BISHOP); @@ -121,27 +105,17 @@ public final class ElfHumanClericChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30120-18.htm"; // fnAfterClassChange11 - } - else - { + } else { htmltext = "30120-19.htm"; // fnNoProof11 } - } - else if ((classId == PROPHET) && (player.getClassId() == ClassId.cleric)) - { - if (player.getLevel() < 40) - { - if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_TRUST, MARK_OF_REFORMER)) - { + } else if ((classId == PROPHET) && (player.getClassId() == ClassId.cleric)) { + if (player.getLevel() < 40) { + if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_TRUST, MARK_OF_REFORMER)) { htmltext = "30120-20.htm"; // fnLowLevel12 - } - else - { + } else { htmltext = "30120-21.htm"; // fnLowLevelNoProof12 } - } - else if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_TRUST, MARK_OF_REFORMER)) - { + } else if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_TRUST, MARK_OF_REFORMER)) { takeItems(player, -1, MARK_OF_PILGRIM, MARK_OF_TRUST, MARK_OF_REFORMER); player.setClassId(PROPHET); player.setBaseClass(PROPHET); @@ -149,27 +123,17 @@ public final class ElfHumanClericChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30120-22.htm"; // fnAfterClassChange12 - } - else - { + } else { htmltext = "30120-23.htm"; // fnNoProof12 } - } - else if ((classId == ELDER) && (player.getClassId() == ClassId.oracle)) - { - if (player.getLevel() < 40) - { - if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_LIFE, MARK_OF_HEALER)) - { + } else if ((classId == ELDER) && (player.getClassId() == ClassId.oracle)) { + if (player.getLevel() < 40) { + if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_LIFE, MARK_OF_HEALER)) { htmltext = "30120-24.htm"; // fnLowLevel21 - } - else - { + } else { htmltext = "30120-25.htm"; // fnLowLevelNoProof21 } - } - else if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_LIFE, MARK_OF_HEALER)) - { + } else if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_LIFE, MARK_OF_HEALER)) { takeItems(player, -1, MARK_OF_PILGRIM, MARK_OF_LIFE, MARK_OF_HEALER); player.setClassId(ELDER); player.setBaseClass(ELDER); @@ -177,9 +141,7 @@ public final class ElfHumanClericChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30120-26.htm"; // fnAfterClassChange21 - } - else - { + } else { htmltext = "30120-27.htm"; // fnNoProof21 } } @@ -187,38 +149,26 @@ public final class ElfHumanClericChange2 extends AbstractNpcAI } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; - if (player.isInCategory(CategoryType.CLERIC_GROUP) && player.isInCategory(CategoryType.FOURTH_CLASS_GROUP) && (player.isInCategory(CategoryType.HUMAN_CALL_CLASS) || player.isInCategory(CategoryType.ELF_CALL_CLASS))) - { + if (player.isInCategory(CategoryType.CLERIC_GROUP) && player.isInCategory(CategoryType.FOURTH_CLASS_GROUP) && (player.isInCategory(CategoryType.HUMAN_CALL_CLASS) || player.isInCategory(CategoryType.ELF_CALL_CLASS))) { htmltext = "30120-01.htm"; // fnYouAreFourthClass - } - else if (player.isInCategory(CategoryType.CLERIC_GROUP) && (player.isInCategory(CategoryType.HUMAN_CALL_CLASS) || player.isInCategory(CategoryType.ELF_CALL_CLASS))) - { + } else if (player.isInCategory(CategoryType.CLERIC_GROUP) && (player.isInCategory(CategoryType.HUMAN_CALL_CLASS) || player.isInCategory(CategoryType.ELF_CALL_CLASS))) { final ClassId classId = player.getClassId(); - if ((classId == ClassId.cleric) || (classId == ClassId.bishop) || (classId == ClassId.prophet)) - { + if ((classId == ClassId.cleric) || (classId == ClassId.bishop) || (classId == ClassId.prophet)) { htmltext = "30120-02.htm"; // fnClassList1 - } - else if ((classId == ClassId.oracle) || (classId == ClassId.elder)) - { + } else if ((classId == ClassId.oracle) || (classId == ClassId.elder)) { htmltext = "30120-09.htm"; // fnClassList2 - } - else - { + } else { htmltext = "30120-13.htm"; // fnYouAreFirstClass } - } - else - { + } else { htmltext = "30120-14.htm"; // fnClassMismatch } return htmltext; } - public static void main(String[] args) - { + public static void main(String[] args) { new ElfHumanClericChange2(); } } diff --git a/src/main/java/com/l2jserver/datapack/village_master/ElfHumanFighterChange1/ElfHumanFighterChange1.java b/src/main/java/com/l2jserver/datapack/village_master/ElfHumanFighterChange1/ElfHumanFighterChange1.java index 4615bd9f61..4a7491365e 100644 --- a/src/main/java/com/l2jserver/datapack/village_master/ElfHumanFighterChange1/ElfHumanFighterChange1.java +++ b/src/main/java/com/l2jserver/datapack/village_master/ElfHumanFighterChange1/ElfHumanFighterChange1.java @@ -29,11 +29,9 @@ import com.l2jserver.gameserver.model.base.ClassId; * Elf Human class transfer AI * @author Adry_85 */ -public final class ElfHumanFighterChange1 extends AbstractNpcAI -{ +public final class ElfHumanFighterChange1 extends AbstractNpcAI { // NPCs - private static int[] NPCS = - { + private static int[] NPCS = { 30066, // Pabris 30288, // Rains 30373, // Ramos @@ -54,19 +52,16 @@ public final class ElfHumanFighterChange1 extends AbstractNpcAI private static final int ELVEN_KNIGHT = 19; private static final int ELVEN_SCOUT = 22; - private ElfHumanFighterChange1() - { + private ElfHumanFighterChange1() { super(ElfHumanFighterChange1.class.getSimpleName(), "village_master"); addStartNpc(NPCS); addTalkId(NPCS); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { + switch (event) { case "30066-01.htm": // pabris003h case "30066-02.htm": // pabris006ha case "30066-03.htm": // pabris007ha @@ -143,8 +138,7 @@ public final class ElfHumanFighterChange1 extends AbstractNpcAI case "4": case "7": case "19": - case "22": - { + case "22": { htmltext = ClassChangeRequested(player, npc, Integer.valueOf(event)); break; } @@ -152,36 +146,22 @@ public final class ElfHumanFighterChange1 extends AbstractNpcAI return htmltext; } - private String ClassChangeRequested(L2PcInstance player, L2Npc npc, int classId) - { + private String ClassChangeRequested(L2PcInstance player, L2Npc npc, int classId) { String htmltext = null; - if (player.isInCategory(CategoryType.SECOND_CLASS_GROUP)) - { + if (player.isInCategory(CategoryType.SECOND_CLASS_GROUP)) { htmltext = npc.getId() + "-19.htm"; // fnYouAreSecondClass - } - else if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)) - { + } else if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)) { htmltext = npc.getId() + "-20.htm"; // fnYouAreThirdClass - } - else if (player.isInCategory(CategoryType.FOURTH_CLASS_GROUP)) - { + } else if (player.isInCategory(CategoryType.FOURTH_CLASS_GROUP)) { htmltext = "30066-41.htm"; // fnYouAreFourthClass - } - else if ((classId == WARRIOR) && (player.getClassId() == ClassId.fighter)) - { - if (player.getLevel() < 20) - { - if (hasQuestItems(player, MEDALLION_OF_WARRIOR)) - { + } else if ((classId == WARRIOR) && (player.getClassId() == ClassId.fighter)) { + if (player.getLevel() < 20) { + if (hasQuestItems(player, MEDALLION_OF_WARRIOR)) { htmltext = npc.getId() + "-21.htm"; // fnLowLevel11 - } - else - { + } else { htmltext = npc.getId() + "-22.htm"; // fnLowLevelNoProof11 } - } - else if (hasQuestItems(player, MEDALLION_OF_WARRIOR)) - { + } else if (hasQuestItems(player, MEDALLION_OF_WARRIOR)) { takeItems(player, MEDALLION_OF_WARRIOR, -1); player.setClassId(WARRIOR); player.setBaseClass(WARRIOR); @@ -189,27 +169,17 @@ public final class ElfHumanFighterChange1 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_D_GRADE, 15); htmltext = npc.getId() + "-23.htm"; // fnAfterClassChange11 - } - else - { + } else { htmltext = npc.getId() + "-24.htm"; // fnNoProof11 } - } - else if ((classId == KNIGHT) && (player.getClassId() == ClassId.fighter)) - { - if (player.getLevel() < 20) - { - if (hasQuestItems(player, SWORD_OF_RITUAL)) - { + } else if ((classId == KNIGHT) && (player.getClassId() == ClassId.fighter)) { + if (player.getLevel() < 20) { + if (hasQuestItems(player, SWORD_OF_RITUAL)) { htmltext = npc.getId() + "-25.htm"; // fnLowLevel12 - } - else - { + } else { htmltext = npc.getId() + "-26.htm"; // fnLowLevelNoProof12 } - } - else if (hasQuestItems(player, SWORD_OF_RITUAL)) - { + } else if (hasQuestItems(player, SWORD_OF_RITUAL)) { takeItems(player, SWORD_OF_RITUAL, -1); player.setClassId(KNIGHT); player.setBaseClass(KNIGHT); @@ -217,27 +187,17 @@ public final class ElfHumanFighterChange1 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_D_GRADE, 15); htmltext = npc.getId() + "-27.htm"; // fnAfterClassChange12 - } - else - { + } else { htmltext = npc.getId() + "-28.htm"; // fnNoProof12 } - } - else if ((classId == ROGUE) && (player.getClassId() == ClassId.fighter)) - { - if (player.getLevel() < 20) - { - if (hasQuestItems(player, BEZIQUES_RECOMMENDATION)) - { + } else if ((classId == ROGUE) && (player.getClassId() == ClassId.fighter)) { + if (player.getLevel() < 20) { + if (hasQuestItems(player, BEZIQUES_RECOMMENDATION)) { htmltext = npc.getId() + "-29.htm"; // fnLowLevel13 - } - else - { + } else { htmltext = npc.getId() + "-30.htm"; // fnLowLevelNoProof13 } - } - else if (hasQuestItems(player, BEZIQUES_RECOMMENDATION)) - { + } else if (hasQuestItems(player, BEZIQUES_RECOMMENDATION)) { takeItems(player, BEZIQUES_RECOMMENDATION, -1); player.setClassId(ROGUE); player.setBaseClass(ROGUE); @@ -245,27 +205,17 @@ public final class ElfHumanFighterChange1 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_D_GRADE, 15); htmltext = npc.getId() + "-31.htm"; // fnAfterClassChange13 - } - else - { + } else { htmltext = npc.getId() + "-32.htm"; // fnNoProof13 } - } - else if ((classId == ELVEN_KNIGHT) && (player.getClassId() == ClassId.elvenFighter)) - { - if (player.getLevel() < 20) - { - if (hasQuestItems(player, ELVEN_KNIGHT_BROOCH)) - { + } else if ((classId == ELVEN_KNIGHT) && (player.getClassId() == ClassId.elvenFighter)) { + if (player.getLevel() < 20) { + if (hasQuestItems(player, ELVEN_KNIGHT_BROOCH)) { htmltext = npc.getId() + "-33.htm"; // fnLowLevel21 - } - else - { + } else { htmltext = npc.getId() + "-34.htm"; // fnLowLevelNoProof21 } - } - else if (hasQuestItems(player, ELVEN_KNIGHT_BROOCH)) - { + } else if (hasQuestItems(player, ELVEN_KNIGHT_BROOCH)) { takeItems(player, ELVEN_KNIGHT_BROOCH, -1); player.setClassId(ELVEN_KNIGHT); player.setBaseClass(ELVEN_KNIGHT); @@ -273,27 +223,17 @@ public final class ElfHumanFighterChange1 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_D_GRADE, 15); htmltext = npc.getId() + "-35.htm"; // fnAfterClassChange21 - } - else - { + } else { htmltext = npc.getId() + "-36.htm"; // fnNoProof21 } - } - else if ((classId == ELVEN_SCOUT) && (player.getClassId() == ClassId.elvenFighter)) - { - if (player.getLevel() < 20) - { - if (hasQuestItems(player, REISAS_RECOMMENDATION)) - { + } else if ((classId == ELVEN_SCOUT) && (player.getClassId() == ClassId.elvenFighter)) { + if (player.getLevel() < 20) { + if (hasQuestItems(player, REISAS_RECOMMENDATION)) { htmltext = npc.getId() + "-37.htm"; // fnLowLevel22 - } - else - { + } else { htmltext = npc.getId() + "-38.htm"; // fnLowLevelNoProof22 } - } - else if (hasQuestItems(player, REISAS_RECOMMENDATION)) - { + } else if (hasQuestItems(player, REISAS_RECOMMENDATION)) { takeItems(player, REISAS_RECOMMENDATION, -1); player.setClassId(ELVEN_SCOUT); player.setBaseClass(ELVEN_SCOUT); @@ -301,9 +241,7 @@ public final class ElfHumanFighterChange1 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_D_GRADE, 15); htmltext = npc.getId() + "-39.htm"; // fnAfterClassChange22 - } - else - { + } else { htmltext = npc.getId() + "-40.htm"; // fnNoProof22 } } @@ -311,30 +249,22 @@ public final class ElfHumanFighterChange1 extends AbstractNpcAI } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; final Race playerRace = player.getRace(); - if (player.isInCategory(CategoryType.FIGHTER_GROUP) && ((playerRace == Race.HUMAN) || (playerRace == Race.ELF))) - { - if (playerRace == Race.HUMAN) - { + if (player.isInCategory(CategoryType.FIGHTER_GROUP) && ((playerRace == Race.HUMAN) || (playerRace == Race.ELF))) { + if (playerRace == Race.HUMAN) { htmltext = npc.getId() + "-01.htm"; // fnClassList1 - } - else - { + } else { htmltext = npc.getId() + "-11.htm"; // fnClassList2 } - } - else - { + } else { htmltext = npc.getId() + "-18.htm"; // fnClassMismatch } return htmltext; } - public static void main(String[] args) - { + public static void main(String[] args) { new ElfHumanFighterChange1(); } } diff --git a/src/main/java/com/l2jserver/datapack/village_master/ElfHumanFighterChange2/ElfHumanFighterChange2.java b/src/main/java/com/l2jserver/datapack/village_master/ElfHumanFighterChange2/ElfHumanFighterChange2.java index 3a6281f736..7e230ad4d5 100644 --- a/src/main/java/com/l2jserver/datapack/village_master/ElfHumanFighterChange2/ElfHumanFighterChange2.java +++ b/src/main/java/com/l2jserver/datapack/village_master/ElfHumanFighterChange2/ElfHumanFighterChange2.java @@ -28,11 +28,9 @@ import com.l2jserver.gameserver.model.base.ClassId; * Elf Human class transfer AI. * @author Adry_85 */ -public final class ElfHumanFighterChange2 extends AbstractNpcAI -{ +public final class ElfHumanFighterChange2 extends AbstractNpcAI { // NPCs - private static int[] NPCS = - { + private static int[] NPCS = { 30109, // Hannavalt 30187, // Klaus 30689, // Siria @@ -69,19 +67,16 @@ public final class ElfHumanFighterChange2 extends AbstractNpcAI private static final int PLAINS_WALKER = 23; private static final int SILVER_RANGER = 24; - private ElfHumanFighterChange2() - { + private ElfHumanFighterChange2() { super(ElfHumanFighterChange2.class.getSimpleName(), "village_master"); addStartNpc(NPCS); addTalkId(NPCS); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { + switch (event) { case "30109-02.htm": // master_lv3_hef003w case "30109-03.htm": // master_lv3_hef006wa case "30109-04.htm": // master_lv3_hef007wa @@ -130,8 +125,7 @@ public final class ElfHumanFighterChange2 extends AbstractNpcAI case "20": case "21": case "23": - case "24": - { + case "24": { htmltext = ClassChangeRequested(player, Integer.valueOf(event)); break; } @@ -139,28 +133,18 @@ public final class ElfHumanFighterChange2 extends AbstractNpcAI return htmltext; } - private String ClassChangeRequested(L2PcInstance player, int classId) - { + private String ClassChangeRequested(L2PcInstance player, int classId) { String htmltext = null; - if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)) - { + if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)) { htmltext = "30109-39.htm"; // fnYouAreThirdClass - } - else if ((classId == GLADIATOR) && (player.getClassId() == ClassId.warrior)) - { - if (player.getLevel() < 40) - { - if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_TRUST, MARK_OF_DUELIST)) - { + } else if ((classId == GLADIATOR) && (player.getClassId() == ClassId.warrior)) { + if (player.getLevel() < 40) { + if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_TRUST, MARK_OF_DUELIST)) { htmltext = "30109-40.htm"; // fnLowLevel11 - } - else - { + } else { htmltext = "30109-41.htm"; // fnLowLevelNoProof11 } - } - else if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_TRUST, MARK_OF_DUELIST)) - { + } else if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_TRUST, MARK_OF_DUELIST)) { takeItems(player, -1, MARK_OF_CHALLENGER, MARK_OF_TRUST, MARK_OF_DUELIST); player.setClassId(GLADIATOR); player.setBaseClass(GLADIATOR); @@ -168,27 +152,17 @@ public final class ElfHumanFighterChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30109-42.htm"; // fnAfterClassChange11 - } - else - { + } else { htmltext = "30109-43.htm"; // fnNoProof11 } - } - else if ((classId == WARLORD) && (player.getClassId() == ClassId.warrior)) - { - if (player.getLevel() < 40) - { - if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_TRUST, MARK_OF_CHAMPION)) - { + } else if ((classId == WARLORD) && (player.getClassId() == ClassId.warrior)) { + if (player.getLevel() < 40) { + if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_TRUST, MARK_OF_CHAMPION)) { htmltext = "30109-44.htm"; // fnLowLevel12 - } - else - { + } else { htmltext = "30109-45.htm"; // fnLowLevelNoProof12 } - } - else if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_TRUST, MARK_OF_CHAMPION)) - { + } else if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_TRUST, MARK_OF_CHAMPION)) { takeItems(player, -1, MARK_OF_CHALLENGER, MARK_OF_TRUST, MARK_OF_CHAMPION); player.setClassId(WARLORD); player.setBaseClass(WARLORD); @@ -196,27 +170,17 @@ public final class ElfHumanFighterChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30109-46.htm"; // fnAfterClassChange12 - } - else - { + } else { htmltext = "30109-47.htm"; // fnNoProof12 } - } - else if ((classId == PALADIN) && (player.getClassId() == ClassId.knight)) - { - if (player.getLevel() < 40) - { - if (hasQuestItems(player, MARK_OF_DUTY, MARK_OF_TRUST, MARK_OF_HEALER)) - { + } else if ((classId == PALADIN) && (player.getClassId() == ClassId.knight)) { + if (player.getLevel() < 40) { + if (hasQuestItems(player, MARK_OF_DUTY, MARK_OF_TRUST, MARK_OF_HEALER)) { htmltext = "30109-48.htm"; // fnLowLevel21 - } - else - { + } else { htmltext = "30109-49.htm"; // fnLowLevelNoProof21 } - } - else if (hasQuestItems(player, MARK_OF_DUTY, MARK_OF_TRUST, MARK_OF_HEALER)) - { + } else if (hasQuestItems(player, MARK_OF_DUTY, MARK_OF_TRUST, MARK_OF_HEALER)) { takeItems(player, -1, MARK_OF_DUTY, MARK_OF_TRUST, MARK_OF_HEALER); player.setClassId(PALADIN); player.setBaseClass(PALADIN); @@ -224,27 +188,17 @@ public final class ElfHumanFighterChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30109-50.htm"; // fnAfterClassChange21 - } - else - { + } else { htmltext = "30109-51.htm"; // fnNoProof21 } - } - else if ((classId == DARK_AVENGER) && (player.getClassId() == ClassId.knight)) - { - if (player.getLevel() < 40) - { - if (hasQuestItems(player, MARK_OF_DUTY, MARK_OF_TRUST, MARK_OF_WITCHCRAFT)) - { + } else if ((classId == DARK_AVENGER) && (player.getClassId() == ClassId.knight)) { + if (player.getLevel() < 40) { + if (hasQuestItems(player, MARK_OF_DUTY, MARK_OF_TRUST, MARK_OF_WITCHCRAFT)) { htmltext = "30109-52.htm"; // fnLowLevel22 - } - else - { + } else { htmltext = "30109-53.htm"; // fnLowLevelNoProof22 } - } - else if (hasQuestItems(player, MARK_OF_DUTY, MARK_OF_TRUST, MARK_OF_WITCHCRAFT)) - { + } else if (hasQuestItems(player, MARK_OF_DUTY, MARK_OF_TRUST, MARK_OF_WITCHCRAFT)) { takeItems(player, -1, MARK_OF_DUTY, MARK_OF_TRUST, MARK_OF_WITCHCRAFT); player.setClassId(DARK_AVENGER); player.setBaseClass(DARK_AVENGER); @@ -252,27 +206,17 @@ public final class ElfHumanFighterChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30109-54.htm"; // fnAfterClassChange22 - } - else - { + } else { htmltext = "30109-55.htm"; // fnNoProof22 } - } - else if ((classId == TREASURE_HUNTER) && (player.getClassId() == ClassId.rogue)) - { - if (player.getLevel() < 40) - { - if (hasQuestItems(player, MARK_OF_SEEKER, MARK_OF_TRUST, MARK_OF_SEARCHER)) - { + } else if ((classId == TREASURE_HUNTER) && (player.getClassId() == ClassId.rogue)) { + if (player.getLevel() < 40) { + if (hasQuestItems(player, MARK_OF_SEEKER, MARK_OF_TRUST, MARK_OF_SEARCHER)) { htmltext = "30109-56.htm"; // fnLowLevel31 - } - else - { + } else { htmltext = "30109-57.htm"; // fnLowLevelNoProof31 } - } - else if (hasQuestItems(player, MARK_OF_SEEKER, MARK_OF_TRUST, MARK_OF_SEARCHER)) - { + } else if (hasQuestItems(player, MARK_OF_SEEKER, MARK_OF_TRUST, MARK_OF_SEARCHER)) { takeItems(player, -1, MARK_OF_SEEKER, MARK_OF_TRUST, MARK_OF_SEARCHER); player.setClassId(TREASURE_HUNTER); player.setBaseClass(TREASURE_HUNTER); @@ -280,27 +224,17 @@ public final class ElfHumanFighterChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30109-58.htm"; // fnAfterClassChange31 - } - else - { + } else { htmltext = "30109-59.htm"; // fnNoProof31 } - } - else if ((classId == HAWKEYE) && (player.getClassId() == ClassId.rogue)) - { - if (player.getLevel() < 40) - { - if (hasQuestItems(player, MARK_OF_SEEKER, MARK_OF_TRUST, MARK_OF_SAGITTARIUS)) - { + } else if ((classId == HAWKEYE) && (player.getClassId() == ClassId.rogue)) { + if (player.getLevel() < 40) { + if (hasQuestItems(player, MARK_OF_SEEKER, MARK_OF_TRUST, MARK_OF_SAGITTARIUS)) { htmltext = "30109-60.htm"; // fnLowLevel32 - } - else - { + } else { htmltext = "30109-61.htm"; // fnLowLevelNoProof32 } - } - else if (hasQuestItems(player, MARK_OF_SEEKER, MARK_OF_TRUST, MARK_OF_SAGITTARIUS)) - { + } else if (hasQuestItems(player, MARK_OF_SEEKER, MARK_OF_TRUST, MARK_OF_SAGITTARIUS)) { takeItems(player, -1, MARK_OF_SEEKER, MARK_OF_TRUST, MARK_OF_SAGITTARIUS); player.setClassId(HAWKEYE); player.setBaseClass(HAWKEYE); @@ -308,27 +242,17 @@ public final class ElfHumanFighterChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30109-62.htm"; // fnAfterClassChange32 - } - else - { + } else { htmltext = "30109-63.htm"; // fnNoProof32 } - } - else if ((classId == TEMPLE_KNIGHT) && (player.getClassId() == ClassId.elvenKnight)) - { - if (player.getLevel() < 40) - { - if (hasQuestItems(player, MARK_OF_DUTY, MARK_OF_LIFE, MARK_OF_HEALER)) - { + } else if ((classId == TEMPLE_KNIGHT) && (player.getClassId() == ClassId.elvenKnight)) { + if (player.getLevel() < 40) { + if (hasQuestItems(player, MARK_OF_DUTY, MARK_OF_LIFE, MARK_OF_HEALER)) { htmltext = "30109-64.htm"; // fnLowLevel41 - } - else - { + } else { htmltext = "30109-65.htm"; // fnLowLevelNoProof41 } - } - else if (hasQuestItems(player, MARK_OF_DUTY, MARK_OF_LIFE, MARK_OF_HEALER)) - { + } else if (hasQuestItems(player, MARK_OF_DUTY, MARK_OF_LIFE, MARK_OF_HEALER)) { takeItems(player, -1, MARK_OF_DUTY, MARK_OF_LIFE, MARK_OF_HEALER); player.setClassId(TEMPLE_KNIGHT); player.setBaseClass(TEMPLE_KNIGHT); @@ -336,27 +260,17 @@ public final class ElfHumanFighterChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30109-66.htm"; // fnAfterClassChange41 - } - else - { + } else { htmltext = "30109-67.htm"; // fnNoProof41 } - } - else if ((classId == SWORDSINGER) && (player.getClassId() == ClassId.elvenKnight)) - { - if (player.getLevel() < 40) - { - if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_LIFE, MARK_OF_DUELIST)) - { + } else if ((classId == SWORDSINGER) && (player.getClassId() == ClassId.elvenKnight)) { + if (player.getLevel() < 40) { + if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_LIFE, MARK_OF_DUELIST)) { htmltext = "30109-68.htm"; // fnLowLevel42 - } - else - { + } else { htmltext = "30109-69.htm"; // fnLowLevelNoProof42 } - } - else if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_LIFE, MARK_OF_DUELIST)) - { + } else if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_LIFE, MARK_OF_DUELIST)) { takeItems(player, -1, MARK_OF_CHALLENGER, MARK_OF_LIFE, MARK_OF_DUELIST); player.setClassId(SWORDSINGER); player.setBaseClass(SWORDSINGER); @@ -364,27 +278,17 @@ public final class ElfHumanFighterChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30109-70.htm"; // fnAfterClassChange42 - } - else - { + } else { htmltext = "30109-71.htm"; // fnNoProof42 } - } - else if ((classId == PLAINS_WALKER) && (player.getClassId() == ClassId.elvenScout)) - { - if (player.getLevel() < 40) - { - if (hasQuestItems(player, MARK_OF_SEEKER, MARK_OF_LIFE, MARK_OF_SEARCHER)) - { + } else if ((classId == PLAINS_WALKER) && (player.getClassId() == ClassId.elvenScout)) { + if (player.getLevel() < 40) { + if (hasQuestItems(player, MARK_OF_SEEKER, MARK_OF_LIFE, MARK_OF_SEARCHER)) { htmltext = "30109-72.htm"; // fnLowLevel51 - } - else - { + } else { htmltext = "30109-73.htm"; // fnLowLevelNoProof51 } - } - else if (hasQuestItems(player, MARK_OF_SEEKER, MARK_OF_LIFE, MARK_OF_SEARCHER)) - { + } else if (hasQuestItems(player, MARK_OF_SEEKER, MARK_OF_LIFE, MARK_OF_SEARCHER)) { takeItems(player, -1, MARK_OF_SEEKER, MARK_OF_LIFE, MARK_OF_SEARCHER); player.setClassId(PLAINS_WALKER); player.setBaseClass(PLAINS_WALKER); @@ -392,27 +296,17 @@ public final class ElfHumanFighterChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30109-74.htm"; // fnAfterClassChange51 - } - else - { + } else { htmltext = "30109-75.htm"; // fnNoProof51 } - } - else if ((classId == SILVER_RANGER) && (player.getClassId() == ClassId.elvenScout)) - { - if (player.getLevel() < 40) - { - if (hasQuestItems(player, MARK_OF_SEEKER, MARK_OF_LIFE, MARK_OF_SAGITTARIUS)) - { + } else if ((classId == SILVER_RANGER) && (player.getClassId() == ClassId.elvenScout)) { + if (player.getLevel() < 40) { + if (hasQuestItems(player, MARK_OF_SEEKER, MARK_OF_LIFE, MARK_OF_SAGITTARIUS)) { htmltext = "30109-76.htm"; // fnLowLevel52 - } - else - { + } else { htmltext = "30109-77.htm"; // fnLowLevelNoProof52 } - } - else if (hasQuestItems(player, MARK_OF_SEEKER, MARK_OF_LIFE, MARK_OF_SAGITTARIUS)) - { + } else if (hasQuestItems(player, MARK_OF_SEEKER, MARK_OF_LIFE, MARK_OF_SAGITTARIUS)) { takeItems(player, -1, MARK_OF_SEEKER, MARK_OF_LIFE, MARK_OF_SAGITTARIUS); player.setClassId(SILVER_RANGER); player.setBaseClass(SILVER_RANGER); @@ -420,9 +314,7 @@ public final class ElfHumanFighterChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30109-78.htm"; // fnAfterClassChange52 - } - else - { + } else { htmltext = "30109-79.htm"; // fnNoProof52 } } @@ -430,50 +322,32 @@ public final class ElfHumanFighterChange2 extends AbstractNpcAI } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; - if (player.isInCategory(CategoryType.FIGHTER_GROUP) && player.isInCategory(CategoryType.FOURTH_CLASS_GROUP) && (player.isInCategory(CategoryType.HUMAN_FALL_CLASS) || player.isInCategory(CategoryType.ELF_FALL_CLASS))) - { + if (player.isInCategory(CategoryType.FIGHTER_GROUP) && player.isInCategory(CategoryType.FOURTH_CLASS_GROUP) && (player.isInCategory(CategoryType.HUMAN_FALL_CLASS) || player.isInCategory(CategoryType.ELF_FALL_CLASS))) { htmltext = "30109-01.htm"; // fnYouAreFourthClass - } - else if (player.isInCategory(CategoryType.FIGHTER_GROUP) && (player.isInCategory(CategoryType.HUMAN_FALL_CLASS) || player.isInCategory(CategoryType.ELF_FALL_CLASS))) - { + } else if (player.isInCategory(CategoryType.FIGHTER_GROUP) && (player.isInCategory(CategoryType.HUMAN_FALL_CLASS) || player.isInCategory(CategoryType.ELF_FALL_CLASS))) { final ClassId classId = player.getClassId(); - if ((classId == ClassId.warrior) || (classId == ClassId.gladiator) || (classId == ClassId.warlord)) - { + if ((classId == ClassId.warrior) || (classId == ClassId.gladiator) || (classId == ClassId.warlord)) { htmltext = "30109-02.htm"; // fnClassList1 - } - else if ((classId == ClassId.knight) || (classId == ClassId.paladin) || (classId == ClassId.darkAvenger)) - { + } else if ((classId == ClassId.knight) || (classId == ClassId.paladin) || (classId == ClassId.darkAvenger)) { htmltext = "30109-09.htm"; // fnClassList2 - } - else if ((classId == ClassId.rogue) || (classId == ClassId.treasureHunter) || (classId == ClassId.hawkeye)) - { + } else if ((classId == ClassId.rogue) || (classId == ClassId.treasureHunter) || (classId == ClassId.hawkeye)) { htmltext = "30109-16.htm"; // fnClassList3 - } - else if ((classId == ClassId.elvenKnight) || (classId == ClassId.templeKnight) || (classId == ClassId.swordSinger)) - { + } else if ((classId == ClassId.elvenKnight) || (classId == ClassId.templeKnight) || (classId == ClassId.swordSinger)) { htmltext = "30109-23.htm"; // fnClassList4 - } - else if ((classId == ClassId.elvenScout) || (classId == ClassId.plainsWalker) || (classId == ClassId.silverRanger)) - { + } else if ((classId == ClassId.elvenScout) || (classId == ClassId.plainsWalker) || (classId == ClassId.silverRanger)) { htmltext = "30109-30.htm"; // fnClassList5 - } - else - { + } else { htmltext = "30109-37.htm"; // fnYouAreFirstClass } - } - else - { + } else { htmltext = "30109-38.htm"; // fnClassMismatch } return htmltext; } - public static void main(String[] args) - { + public static void main(String[] args) { new ElfHumanFighterChange2(); } } diff --git a/src/main/java/com/l2jserver/datapack/village_master/ElfHumanWizardChange1/ElfHumanWizardChange1.java b/src/main/java/com/l2jserver/datapack/village_master/ElfHumanWizardChange1/ElfHumanWizardChange1.java index dc03fcc523..2087c75d26 100644 --- a/src/main/java/com/l2jserver/datapack/village_master/ElfHumanWizardChange1/ElfHumanWizardChange1.java +++ b/src/main/java/com/l2jserver/datapack/village_master/ElfHumanWizardChange1/ElfHumanWizardChange1.java @@ -29,11 +29,9 @@ import com.l2jserver.gameserver.model.base.ClassId; * Elf Human class transfer AI * @author Adry_85 */ -public final class ElfHumanWizardChange1 extends AbstractNpcAI -{ +public final class ElfHumanWizardChange1 extends AbstractNpcAI { // NPCs - private static int[] NPCS = - { + private static int[] NPCS = { 30037, // Levian 30070, // Sylvain 30289, // Raymond @@ -53,19 +51,16 @@ public final class ElfHumanWizardChange1 extends AbstractNpcAI private static final int ELVEN_WIZARD = 26; private static final int ORACLE = 29; - private ElfHumanWizardChange1() - { + private ElfHumanWizardChange1() { super(ElfHumanWizardChange1.class.getSimpleName(), "village_master"); addStartNpc(NPCS); addTalkId(NPCS); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { + switch (event) { case "30037-01.htm": // levian003h case "30037-02.htm": // levian006ha case "30037-03.htm": // levian007ha @@ -143,8 +138,7 @@ public final class ElfHumanWizardChange1 extends AbstractNpcAI case "11": case "15": case "26": - case "29": - { + case "29": { htmltext = ClassChangeRequested(player, npc, Integer.valueOf(event)); break; } @@ -152,36 +146,22 @@ public final class ElfHumanWizardChange1 extends AbstractNpcAI return htmltext; } - private String ClassChangeRequested(L2PcInstance player, L2Npc npc, int classId) - { + private String ClassChangeRequested(L2PcInstance player, L2Npc npc, int classId) { String htmltext = null; - if (player.isInCategory(CategoryType.SECOND_CLASS_GROUP)) - { + if (player.isInCategory(CategoryType.SECOND_CLASS_GROUP)) { htmltext = npc.getId() + "-16.htm"; // fnYouAreSecondClass - } - else if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)) - { + } else if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)) { htmltext = npc.getId() + "-17.htm"; // fnYouAreThirdClass - } - else if (player.isInCategory(CategoryType.FOURTH_CLASS_GROUP)) - { + } else if (player.isInCategory(CategoryType.FOURTH_CLASS_GROUP)) { htmltext = "30037-34.htm"; // fnYouAreFourthClass - } - else if ((classId == WIZARD) && (player.getClassId() == ClassId.mage)) - { - if (player.getLevel() < 20) - { - if (hasQuestItems(player, BEAD_OF_SEASON)) - { + } else if ((classId == WIZARD) && (player.getClassId() == ClassId.mage)) { + if (player.getLevel() < 20) { + if (hasQuestItems(player, BEAD_OF_SEASON)) { htmltext = npc.getId() + "-18.htm"; // fnLowLevel11 - } - else - { + } else { htmltext = npc.getId() + "-19.htm"; // fnLowLevelNoProof11 } - } - else if (hasQuestItems(player, BEAD_OF_SEASON)) - { + } else if (hasQuestItems(player, BEAD_OF_SEASON)) { takeItems(player, BEAD_OF_SEASON, -1); player.setClassId(WIZARD); player.setBaseClass(WIZARD); @@ -189,27 +169,17 @@ public final class ElfHumanWizardChange1 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_D_GRADE, 15); htmltext = npc.getId() + "-20.htm"; // fnAfterClassChange11 - } - else - { + } else { htmltext = npc.getId() + "-21.htm"; // fnNoProof11 } - } - else if ((classId == CLERIC) && (player.getClassId() == ClassId.mage)) - { - if (player.getLevel() < 20) - { - if (hasQuestItems(player, MARK_OF_FAITH)) - { + } else if ((classId == CLERIC) && (player.getClassId() == ClassId.mage)) { + if (player.getLevel() < 20) { + if (hasQuestItems(player, MARK_OF_FAITH)) { htmltext = npc.getId() + "-22.htm"; // fnLowLevel12 - } - else - { + } else { htmltext = npc.getId() + "-23.htm"; // fnLowLevelNoProof12 } - } - else if (hasQuestItems(player, MARK_OF_FAITH)) - { + } else if (hasQuestItems(player, MARK_OF_FAITH)) { takeItems(player, MARK_OF_FAITH, -1); player.setClassId(CLERIC); player.setBaseClass(CLERIC); @@ -217,27 +187,17 @@ public final class ElfHumanWizardChange1 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_D_GRADE, 15); htmltext = npc.getId() + "-24.htm"; // fnAfterClassChange12 - } - else - { + } else { htmltext = npc.getId() + "-25.htm"; // fnNoProof12 } - } - else if ((classId == ELVEN_WIZARD) && (player.getClassId() == ClassId.elvenMage)) - { - if (player.getLevel() < 20) - { - if (hasQuestItems(player, ETERNITY_DIAMOND)) - { + } else if ((classId == ELVEN_WIZARD) && (player.getClassId() == ClassId.elvenMage)) { + if (player.getLevel() < 20) { + if (hasQuestItems(player, ETERNITY_DIAMOND)) { htmltext = npc.getId() + "-26.htm"; // fnLowLevel21 - } - else - { + } else { htmltext = npc.getId() + "-27.htm"; // fnLowLevelNoProof21 } - } - else if (hasQuestItems(player, ETERNITY_DIAMOND)) - { + } else if (hasQuestItems(player, ETERNITY_DIAMOND)) { takeItems(player, ETERNITY_DIAMOND, -1); player.setClassId(ELVEN_WIZARD); player.setBaseClass(ELVEN_WIZARD); @@ -245,27 +205,17 @@ public final class ElfHumanWizardChange1 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_D_GRADE, 15); htmltext = npc.getId() + "-28.htm"; // fnAfterClassChange21 - } - else - { + } else { htmltext = npc.getId() + "-29.htm"; // fnNoProof21 } - } - else if ((classId == ORACLE) && (player.getClassId() == ClassId.elvenMage)) - { - if (player.getLevel() < 20) - { - if (hasQuestItems(player, LEAF_OF_ORACLE)) - { + } else if ((classId == ORACLE) && (player.getClassId() == ClassId.elvenMage)) { + if (player.getLevel() < 20) { + if (hasQuestItems(player, LEAF_OF_ORACLE)) { htmltext = npc.getId() + "-30.htm"; // fnLowLevel22 - } - else - { + } else { htmltext = npc.getId() + "-31.htm"; // fnLowLevelNoProof22 } - } - else if (hasQuestItems(player, LEAF_OF_ORACLE)) - { + } else if (hasQuestItems(player, LEAF_OF_ORACLE)) { takeItems(player, LEAF_OF_ORACLE, -1); player.setClassId(ORACLE); player.setBaseClass(ORACLE); @@ -273,9 +223,7 @@ public final class ElfHumanWizardChange1 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_D_GRADE, 15); htmltext = npc.getId() + "-32.htm"; // fnAfterClassChange22 - } - else - { + } else { htmltext = npc.getId() + "-33.htm"; // fnNoProof22 } } @@ -283,30 +231,22 @@ public final class ElfHumanWizardChange1 extends AbstractNpcAI } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; final Race playerRace = player.getRace(); - if (player.isInCategory(CategoryType.MAGE_GROUP) && ((playerRace == Race.HUMAN) || (playerRace == Race.ELF))) - { - if (playerRace == Race.HUMAN) - { + if (player.isInCategory(CategoryType.MAGE_GROUP) && ((playerRace == Race.HUMAN) || (playerRace == Race.ELF))) { + if (playerRace == Race.HUMAN) { htmltext = npc.getId() + "-01.htm"; // fnClassList1 - } - else - { + } else { htmltext = npc.getId() + "-08.htm"; // fnClassList2 } - } - else - { + } else { htmltext = npc.getId() + "-15.htm"; // fnClassMismatch } return htmltext; } - public static void main(String[] args) - { + public static void main(String[] args) { new ElfHumanWizardChange1(); } } diff --git a/src/main/java/com/l2jserver/datapack/village_master/ElfHumanWizardChange2/ElfHumanWizardChange2.java b/src/main/java/com/l2jserver/datapack/village_master/ElfHumanWizardChange2/ElfHumanWizardChange2.java index f3c8af2537..c0f40aa1aa 100644 --- a/src/main/java/com/l2jserver/datapack/village_master/ElfHumanWizardChange2/ElfHumanWizardChange2.java +++ b/src/main/java/com/l2jserver/datapack/village_master/ElfHumanWizardChange2/ElfHumanWizardChange2.java @@ -28,11 +28,9 @@ import com.l2jserver.gameserver.model.base.ClassId; * Elf Human class transfer AI. * @author Adry_85 */ -public final class ElfHumanWizardChange2 extends AbstractNpcAI -{ +public final class ElfHumanWizardChange2 extends AbstractNpcAI { // NPCs - private static int[] NPCS = - { + private static int[] NPCS = { 30115, // Jurek 30174, // Arkenias 30176, // Valleria @@ -58,19 +56,16 @@ public final class ElfHumanWizardChange2 extends AbstractNpcAI private static final int SPELLSINGER = 27; private static final int ELEMENTAL_SUMMONER = 28; - private ElfHumanWizardChange2() - { + private ElfHumanWizardChange2() { super(ElfHumanWizardChange2.class.getSimpleName(), "village_master"); addStartNpc(NPCS); addTalkId(NPCS); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { + switch (event) { case "30115-02.htm": // master_lv3_hew003h case "30115-03.htm": // master_lv3_hew006ha case "30115-04.htm": // master_lv3_hew007ha @@ -96,8 +91,7 @@ public final class ElfHumanWizardChange2 extends AbstractNpcAI case "13": case "14": case "27": - case "28": - { + case "28": { htmltext = ClassChangeRequested(player, Integer.valueOf(event)); break; } @@ -105,28 +99,18 @@ public final class ElfHumanWizardChange2 extends AbstractNpcAI return htmltext; } - private String ClassChangeRequested(L2PcInstance player, int classId) - { + private String ClassChangeRequested(L2PcInstance player, int classId) { String htmltext = null; - if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)) - { + if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)) { htmltext = "30115-21.htm"; // fnYouAreThirdClass - } - else if ((classId == SORCERER) && (player.getClassId() == ClassId.wizard)) - { - if (player.getLevel() < 40) - { - if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_MAGUS)) - { + } else if ((classId == SORCERER) && (player.getClassId() == ClassId.wizard)) { + if (player.getLevel() < 40) { + if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_MAGUS)) { htmltext = "30115-22.htm"; // fnLowLevel11 - } - else - { + } else { htmltext = "30115-23.htm"; // fnLowLevelNoProof11 } - } - else if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_MAGUS)) - { + } else if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_MAGUS)) { takeItems(player, -1, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_MAGUS); player.setClassId(SORCERER); player.setBaseClass(SORCERER); @@ -134,27 +118,17 @@ public final class ElfHumanWizardChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30115-24.htm"; // fnAfterClassChange11 - } - else - { + } else { htmltext = "30115-25.htm"; // fnNoProof11 } - } - else if ((classId == NECROMANCER) && (player.getClassId() == ClassId.wizard)) - { - if (player.getLevel() < 40) - { - if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_WITCHCRAFT)) - { + } else if ((classId == NECROMANCER) && (player.getClassId() == ClassId.wizard)) { + if (player.getLevel() < 40) { + if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_WITCHCRAFT)) { htmltext = "30115-26.htm"; // fnLowLevel12 - } - else - { + } else { htmltext = "30115-27.htm"; // fnLowLevelNoProof12 } - } - else if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_WITCHCRAFT)) - { + } else if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_WITCHCRAFT)) { takeItems(player, -1, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_WITCHCRAFT); player.setClassId(NECROMANCER); player.setBaseClass(NECROMANCER); @@ -162,27 +136,17 @@ public final class ElfHumanWizardChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30115-28.htm"; // fnAfterClassChange12 - } - else - { + } else { htmltext = "30115-29.htm"; // fnNoProof12 } - } - else if ((classId == WARLOCK) && (player.getClassId() == ClassId.wizard)) - { - if (player.getLevel() < 40) - { - if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_SUMMONER)) - { + } else if ((classId == WARLOCK) && (player.getClassId() == ClassId.wizard)) { + if (player.getLevel() < 40) { + if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_SUMMONER)) { htmltext = "30115-30.htm"; // fnLowLevel13 - } - else - { + } else { htmltext = "30115-31.htm"; // fnLowLevelNoProof13 } - } - else if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_SUMMONER)) - { + } else if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_SUMMONER)) { takeItems(player, -1, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_SUMMONER); player.setClassId(WARLOCK); player.setBaseClass(WARLOCK); @@ -190,27 +154,17 @@ public final class ElfHumanWizardChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30115-32.htm"; // fnAfterClassChange13 - } - else - { + } else { htmltext = "30115-33.htm"; // fnNoProof13 } - } - else if ((classId == SPELLSINGER) && (player.getClassId() == ClassId.elvenWizard)) - { - if (player.getLevel() < 40) - { - if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_LIFE, MARK_OF_MAGUS)) - { + } else if ((classId == SPELLSINGER) && (player.getClassId() == ClassId.elvenWizard)) { + if (player.getLevel() < 40) { + if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_LIFE, MARK_OF_MAGUS)) { htmltext = "30115-34.htm"; // fnLowLevel21 - } - else - { + } else { htmltext = "30115-35.htm"; // fnLowLevelNoProof21 } - } - else if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_LIFE, MARK_OF_MAGUS)) - { + } else if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_LIFE, MARK_OF_MAGUS)) { takeItems(player, -1, MARK_OF_SCHOLAR, MARK_OF_LIFE, MARK_OF_MAGUS); player.setClassId(SPELLSINGER); player.setBaseClass(SPELLSINGER); @@ -218,27 +172,17 @@ public final class ElfHumanWizardChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30115-36.htm"; // fnAfterClassChange21 - } - else - { + } else { htmltext = "30115-37.htm"; // fnNoProof21 } - } - else if ((classId == ELEMENTAL_SUMMONER) && (player.getClassId() == ClassId.elvenWizard)) - { - if (player.getLevel() < 40) - { - if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_LIFE, MARK_OF_SUMMONER)) - { + } else if ((classId == ELEMENTAL_SUMMONER) && (player.getClassId() == ClassId.elvenWizard)) { + if (player.getLevel() < 40) { + if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_LIFE, MARK_OF_SUMMONER)) { htmltext = "30115-38.htm"; // fnLowLevel22 - } - else - { + } else { htmltext = "30115-39.htm"; // fnLowLevelNoProof22 } - } - else if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_LIFE, MARK_OF_SUMMONER)) - { + } else if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_LIFE, MARK_OF_SUMMONER)) { takeItems(player, -1, MARK_OF_SCHOLAR, MARK_OF_LIFE, MARK_OF_SUMMONER); player.setClassId(ELEMENTAL_SUMMONER); player.setBaseClass(ELEMENTAL_SUMMONER); @@ -246,9 +190,7 @@ public final class ElfHumanWizardChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30115-40.htm"; // fnAfterClassChange22 - } - else - { + } else { htmltext = "30115-41.htm"; // fnNoProof22 } } @@ -256,38 +198,26 @@ public final class ElfHumanWizardChange2 extends AbstractNpcAI } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; - if (player.isInCategory(CategoryType.WIZARD_GROUP) && player.isInCategory(CategoryType.FOURTH_CLASS_GROUP) && (player.isInCategory(CategoryType.HUMAN_MALL_CLASS) || player.isInCategory(CategoryType.ELF_MALL_CLASS))) - { + if (player.isInCategory(CategoryType.WIZARD_GROUP) && player.isInCategory(CategoryType.FOURTH_CLASS_GROUP) && (player.isInCategory(CategoryType.HUMAN_MALL_CLASS) || player.isInCategory(CategoryType.ELF_MALL_CLASS))) { htmltext = "30115-01.htm"; // fnYouAreFourthClass - } - else if (player.isInCategory(CategoryType.WIZARD_GROUP) && (player.isInCategory(CategoryType.HUMAN_MALL_CLASS) || player.isInCategory(CategoryType.ELF_MALL_CLASS))) - { + } else if (player.isInCategory(CategoryType.WIZARD_GROUP) && (player.isInCategory(CategoryType.HUMAN_MALL_CLASS) || player.isInCategory(CategoryType.ELF_MALL_CLASS))) { final ClassId classId = player.getClassId(); - if ((classId == ClassId.wizard) || (classId == ClassId.sorceror) || (classId == ClassId.necromancer) || (classId == ClassId.warlock)) - { + if ((classId == ClassId.wizard) || (classId == ClassId.sorceror) || (classId == ClassId.necromancer) || (classId == ClassId.warlock)) { htmltext = "30115-02.htm"; // fnClassList1 - } - else if ((classId == ClassId.elvenWizard) || (classId == ClassId.spellsinger) || (classId == ClassId.elementalSummoner)) - { + } else if ((classId == ClassId.elvenWizard) || (classId == ClassId.spellsinger) || (classId == ClassId.elementalSummoner)) { htmltext = "30115-12.htm"; // fnClassList2 - } - else - { + } else { htmltext = "30115-19.htm"; // fnYouAreFirstClass } - } - else - { + } else { htmltext = "30115-20.htm"; // fnClassMismatch } return htmltext; } - public static void main(String[] args) - { + public static void main(String[] args) { new ElfHumanWizardChange2(); } } diff --git a/src/main/java/com/l2jserver/datapack/village_master/KamaelChange1/KamaelChange1.java b/src/main/java/com/l2jserver/datapack/village_master/KamaelChange1/KamaelChange1.java index 2cf7579091..26ae457bd0 100644 --- a/src/main/java/com/l2jserver/datapack/village_master/KamaelChange1/KamaelChange1.java +++ b/src/main/java/com/l2jserver/datapack/village_master/KamaelChange1/KamaelChange1.java @@ -33,11 +33,9 @@ import com.l2jserver.gameserver.model.quest.QuestState; * Kamael class transfer AI. * @author Adry_85 */ -public final class KamaelChange1 extends AbstractNpcAI -{ +public final class KamaelChange1 extends AbstractNpcAI { // NPCs - private static int[] NPCS = - { + private static int[] NPCS = { 32191, // Hanarin 32193, // Yeniche 32196, // Gershwin @@ -50,19 +48,16 @@ public final class KamaelChange1 extends AbstractNpcAI private static final int GWAINS_RECOMMENDATION = 9753; private static final int STEELRAZOR_EVALUATION = 9772; - private KamaelChange1() - { + private KamaelChange1() { super(KamaelChange1.class.getSimpleName(), "village_master"); addStartNpc(NPCS); addTalkId(NPCS); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { + switch (event) { case "32191-02.htm": // master_all_kamael003m case "32191-03.htm": // master_all_kamael006ma case "32191-04.htm": // master_all_kamael007ma @@ -76,8 +71,7 @@ public final class KamaelChange1 extends AbstractNpcAI break; } case "125": - case "126": - { + case "126": { htmltext = ClassChangeRequested(player, Integer.valueOf(event)); break; } @@ -85,43 +79,26 @@ public final class KamaelChange1 extends AbstractNpcAI return htmltext; } - private String ClassChangeRequested(L2PcInstance player, int classId) - { + private String ClassChangeRequested(L2PcInstance player, int classId) { String htmltext = null; - if (CategoryData.getInstance().isInCategory(CategoryType.KAMAEL_SECOND_CLASS_GROUP, classId)) - { - if (player.isInCategory(CategoryType.KAMAEL_SECOND_CLASS_GROUP)) - { + if (CategoryData.getInstance().isInCategory(CategoryType.KAMAEL_SECOND_CLASS_GROUP, classId)) { + if (player.isInCategory(CategoryType.KAMAEL_SECOND_CLASS_GROUP)) { htmltext = "32191-10.htm"; // master_all_kamael004a - } - else if (player.isInCategory(CategoryType.KAMAEL_THIRD_CLASS_GROUP)) - { + } else if (player.isInCategory(CategoryType.KAMAEL_THIRD_CLASS_GROUP)) { htmltext = "32191-11.htm"; // master_all_kamael005a - } - else if (player.isInCategory(CategoryType.KAMAEL_FOURTH_CLASS_GROUP)) - { + } else if (player.isInCategory(CategoryType.KAMAEL_FOURTH_CLASS_GROUP)) { htmltext = "32191-12.htm"; // master_all_kamael100a - } - else if ((classId == 125) && (player.getClassId() == ClassId.maleSoldier)) - { + } else if ((classId == 125) && (player.getClassId() == ClassId.maleSoldier)) { QuestState qs = player.getQuestState(Q00062_PathOfTheTrooper.class.getSimpleName()); - if (player.getLevel() < 20) - { - if ((qs != null) && qs.isCompleted()) - { + if (player.getLevel() < 20) { + if ((qs != null) && qs.isCompleted()) { htmltext = "32191-13.htm"; // master_all_kamael009ma - } - else - { + } else { htmltext = "32191-14.htm"; // master_all_kamael008ma } - } - else if ((qs == null) || !qs.isCompleted()) - { + } else if ((qs == null) || !qs.isCompleted()) { htmltext = "32191-15.htm"; // master_all_kamael010ma - } - else - { + } else { takeItems(player, GWAINS_RECOMMENDATION, -1); player.setClassId(125); player.setBaseClass(125); @@ -130,27 +107,17 @@ public final class KamaelChange1 extends AbstractNpcAI giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_D_GRADE, 15); htmltext = "32191-16.htm"; // master_all_kamael011ma } - } - else if ((classId == 126) && (player.getClassId() == ClassId.femaleSoldier)) - { + } else if ((classId == 126) && (player.getClassId() == ClassId.femaleSoldier)) { QuestState qs = player.getQuestState(Q00063_PathOfTheWarder.class.getSimpleName()); - if (player.getLevel() < 20) - { - if ((qs != null) && qs.isCompleted()) - { + if (player.getLevel() < 20) { + if ((qs != null) && qs.isCompleted()) { htmltext = "32191-17.htm"; // master_all_kamael008fa - } - else - { + } else { htmltext = "32191-18.htm"; // master_all_kamael009fa } - } - else if ((qs == null) || !qs.isCompleted()) - { + } else if ((qs == null) || !qs.isCompleted()) { htmltext = "32191-19.htm"; // master_all_kamael010fa - } - else - { + } else { takeItems(player, STEELRAZOR_EVALUATION, -1); player.setClassId(126); player.setBaseClass(126); @@ -165,41 +132,27 @@ public final class KamaelChange1 extends AbstractNpcAI } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; - if (player.getRace() != Race.KAMAEL) - { + if (player.getRace() != Race.KAMAEL) { htmltext = "32191-01.htm"; // master_all_kamael002a - } - else if (player.isInCategory(CategoryType.KAMAEL_FIRST_CLASS_GROUP)) - { - if (player.getClassId() == ClassId.maleSoldier) - { + } else if (player.isInCategory(CategoryType.KAMAEL_FIRST_CLASS_GROUP)) { + if (player.getClassId() == ClassId.maleSoldier) { htmltext = "32191-02.htm"; // master_all_kamael003m - } - else if (player.getClassId() == ClassId.femaleSoldier) - { + } else if (player.getClassId() == ClassId.femaleSoldier) { htmltext = "32191-06.htm"; // master_all_kamael003f } - } - else if (player.isInCategory(CategoryType.KAMAEL_SECOND_CLASS_GROUP)) - { + } else if (player.isInCategory(CategoryType.KAMAEL_SECOND_CLASS_GROUP)) { htmltext = "32191-10.htm"; // master_all_kamael004a - } - else if (player.isInCategory(CategoryType.KAMAEL_THIRD_CLASS_GROUP)) - { + } else if (player.isInCategory(CategoryType.KAMAEL_THIRD_CLASS_GROUP)) { htmltext = "32191-11.htm"; // master_all_kamael005a - } - else - { + } else { htmltext = "32191-12.htm"; // master_all_kamael100a } return htmltext; } - public static void main(String[] args) - { + public static void main(String[] args) { new KamaelChange1(); } } diff --git a/src/main/java/com/l2jserver/datapack/village_master/KamaelChange2/KamaelChange2.java b/src/main/java/com/l2jserver/datapack/village_master/KamaelChange2/KamaelChange2.java index 5a916885a8..6285566619 100644 --- a/src/main/java/com/l2jserver/datapack/village_master/KamaelChange2/KamaelChange2.java +++ b/src/main/java/com/l2jserver/datapack/village_master/KamaelChange2/KamaelChange2.java @@ -35,11 +35,9 @@ import com.l2jserver.gameserver.util.Util; * Kamael class transfer AI. * @author Adry_85 */ -public final class KamaelChange2 extends AbstractNpcAI -{ +public final class KamaelChange2 extends AbstractNpcAI { // NPCs - private static int[] NPCS_MALE = - { + private static int[] NPCS_MALE = { 32146, // Valpor 32205, // Aetonic 32209, // Ferdinand @@ -50,8 +48,7 @@ public final class KamaelChange2 extends AbstractNpcAI 32229, // Hagel 32233, // Zoldart }; - private static int[] NPCS_FEMALE = - { + private static int[] NPCS_FEMALE = { 32145, // Maynard 32206, // Pieche 32210, // Eddy @@ -69,8 +66,7 @@ public final class KamaelChange2 extends AbstractNpcAI private static final int KAMAEL_INQUISITOR_MARK = 9782; private static final int SOUL_BREAKER_CERTIFICATE = 9806; - private KamaelChange2() - { + private KamaelChange2() { super(KamaelChange2.class.getSimpleName(), "village_master"); addStartNpc(NPCS_MALE); addStartNpc(NPCS_FEMALE); @@ -79,11 +75,9 @@ public final class KamaelChange2 extends AbstractNpcAI } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { + switch (event) { case "32145-05.htm": // master_all_kamael003t case "32145-06.htm": // master_all_kamael006ta case "32145-07.htm": // master_all_kamael007ta @@ -101,8 +95,7 @@ public final class KamaelChange2 extends AbstractNpcAI case "127": case "128": case "129": - case "130": - { + case "130": { htmltext = ClassChangeRequested(player, npc, Integer.valueOf(event)); break; } @@ -110,68 +103,40 @@ public final class KamaelChange2 extends AbstractNpcAI return htmltext; } - private String ClassChangeRequested(L2PcInstance player, L2Npc npc, int classId) - { + private String ClassChangeRequested(L2PcInstance player, L2Npc npc, int classId) { String htmltext = null; - if (CategoryData.getInstance().isInCategory(CategoryType.KAMAEL_THIRD_CLASS_GROUP, classId)) - { - if (player.isInCategory(CategoryType.KAMAEL_FIRST_CLASS_GROUP)) - { - if (Util.contains(NPCS_MALE, npc.getId())) - { + if (CategoryData.getInstance().isInCategory(CategoryType.KAMAEL_THIRD_CLASS_GROUP, classId)) { + if (player.isInCategory(CategoryType.KAMAEL_FIRST_CLASS_GROUP)) { + if (Util.contains(NPCS_MALE, npc.getId())) { htmltext = "32145-02.htm"; // master_all_kamael012b - } - else - { + } else { htmltext = "32145-03.htm"; // master_all_kamael012c } - } - else if (player.isInCategory(CategoryType.KAMAEL_THIRD_CLASS_GROUP)) - { - if (Util.contains(NPCS_MALE, npc.getId())) - { + } else if (player.isInCategory(CategoryType.KAMAEL_THIRD_CLASS_GROUP)) { + if (Util.contains(NPCS_MALE, npc.getId())) { htmltext = "32145-16.htm"; // master_all_kamael005b - } - else - { + } else { htmltext = "32145-17.htm"; // master_all_kamael005c } - } - else if (player.isInCategory(CategoryType.KAMAEL_FOURTH_CLASS_GROUP)) - { - if (Util.contains(NPCS_MALE, npc.getId())) - { + } else if (player.isInCategory(CategoryType.KAMAEL_FOURTH_CLASS_GROUP)) { + if (Util.contains(NPCS_MALE, npc.getId())) { htmltext = "32145-18.htm"; // master_all_kamael100b - } - else - { + } else { htmltext = "32145-19.htm"; // master_all_kamael100c } - } - else if (player.getClassId() == ClassId.trooper) - { - if (Util.contains(NPCS_MALE, npc.getId())) - { - if (classId == 127) - { + } else if (player.getClassId() == ClassId.trooper) { + if (Util.contains(NPCS_MALE, npc.getId())) { + if (classId == 127) { QuestState qs = player.getQuestState(Q00064_CertifiedBerserker.class.getSimpleName()); - if (player.getLevel() < 40) - { - if ((qs != null) && qs.isCompleted()) - { + if (player.getLevel() < 40) { + if ((qs != null) && qs.isCompleted()) { htmltext = "32145-20.htm"; // master_all_kamael008ta - } - else - { + } else { htmltext = "32145-21.htm"; // master_all_kamael009ta } - } - else if ((qs == null) || !qs.isCompleted()) - { + } else if ((qs == null) || !qs.isCompleted()) { htmltext = "32145-22.htm"; // master_all_kamael010ta - } - else - { + } else { takeItems(player, ORKURUS_RECOMMENDATION, -1); player.setClassId(127); player.setBaseClass(127); @@ -180,27 +145,17 @@ public final class KamaelChange2 extends AbstractNpcAI giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "32145-23.htm"; // master_all_kamael011ta } - } - else if (classId == 128) - { + } else if (classId == 128) { QuestState qs = player.getQuestState(Q00065_CertifiedSoulBreaker.class.getSimpleName()); - if (player.getLevel() < 40) - { - if ((qs != null) && qs.isCompleted()) - { + if (player.getLevel() < 40) { + if ((qs != null) && qs.isCompleted()) { htmltext = "32145-24.htm"; // master_all_kamael008msa - } - else - { + } else { htmltext = "32145-25.htm"; // master_all_kamael009msa } - } - else if ((qs == null) || !qs.isCompleted()) - { + } else if ((qs == null) || !qs.isCompleted()) { htmltext = "32145-26.htm"; // master_all_kamael010msa - } - else - { + } else { takeItems(player, SOUL_BREAKER_CERTIFICATE, -1); player.setClassId(128); player.setBaseClass(128); @@ -210,40 +165,24 @@ public final class KamaelChange2 extends AbstractNpcAI htmltext = "32145-27.htm"; // master_all_kamael011msa } } - } - else - { + } else { htmltext = "32145-10.htm"; // master_all_kamael002c } - } - else if (player.getClassId() == ClassId.warder) - { - if (Util.contains(NPCS_MALE, npc.getId())) - { + } else if (player.getClassId() == ClassId.warder) { + if (Util.contains(NPCS_MALE, npc.getId())) { htmltext = "32145-04.htm"; // master_all_kamael002b - } - else - { - if (classId == 129) - { + } else { + if (classId == 129) { QuestState qs = player.getQuestState(Q00065_CertifiedSoulBreaker.class.getSimpleName()); - if (player.getLevel() < 40) - { - if ((qs != null) && qs.isCompleted()) - { + if (player.getLevel() < 40) { + if ((qs != null) && qs.isCompleted()) { htmltext = "32145-28.htm"; // master_all_kamael008fsa - } - else - { + } else { htmltext = "32145-29.htm"; // master_all_kamael009fsa } - } - else if ((qs == null) || !qs.isCompleted()) - { + } else if ((qs == null) || !qs.isCompleted()) { htmltext = "32145-30.htm"; // master_all_kamael010fsa - } - else - { + } else { takeItems(player, SOUL_BREAKER_CERTIFICATE, -1); player.setClassId(129); player.setBaseClass(129); @@ -252,27 +191,17 @@ public final class KamaelChange2 extends AbstractNpcAI giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "32145-31.htm"; // master_all_kamael011fsa } - } - else if (classId == 130) - { + } else if (classId == 130) { QuestState qs = player.getQuestState(Q00066_CertifiedArbalester.class.getSimpleName()); - if (player.getLevel() < 40) - { - if ((qs != null) && qs.isCompleted()) - { + if (player.getLevel() < 40) { + if ((qs != null) && qs.isCompleted()) { htmltext = "32145-32.htm"; // master_all_kamael008wa - } - else - { + } else { htmltext = "32145-33.htm"; // master_all_kamael009wa } - } - else if ((qs == null) || !qs.isCompleted()) - { + } else if ((qs == null) || !qs.isCompleted()) { htmltext = "32145-34.htm"; // master_all_kamael010wa - } - else - { + } else { takeItems(player, KAMAEL_INQUISITOR_MARK, -1); player.setClassId(130); player.setBaseClass(130); @@ -289,107 +218,65 @@ public final class KamaelChange2 extends AbstractNpcAI } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; - if (player.getRace() != Race.KAMAEL) - { + if (player.getRace() != Race.KAMAEL) { htmltext = "32145-01.htm"; // master_all_kamael002a - } - else if (player.isInCategory(CategoryType.KAMAEL_FIRST_CLASS_GROUP)) - { - if (player.getClassId() == ClassId.maleSoldier) - { + } else if (player.isInCategory(CategoryType.KAMAEL_FIRST_CLASS_GROUP)) { + if (player.getClassId() == ClassId.maleSoldier) { htmltext = "32145-02.htm"; // master_all_kamael012b - } - else if (player.getClassId() == ClassId.femaleSoldier) - { + } else if (player.getClassId() == ClassId.femaleSoldier) { htmltext = "32145-03.htm"; // master_all_kamael012c } - } - else if (player.isInCategory(CategoryType.KAMAEL_SECOND_CLASS_GROUP)) - { - if (Util.contains(NPCS_MALE, npc.getId())) - { - if (player.isInCategory(CategoryType.KAMAEL_FEMALE_MAIN_OCCUPATION)) - { + } else if (player.isInCategory(CategoryType.KAMAEL_SECOND_CLASS_GROUP)) { + if (Util.contains(NPCS_MALE, npc.getId())) { + if (player.isInCategory(CategoryType.KAMAEL_FEMALE_MAIN_OCCUPATION)) { htmltext = "32145-04.htm"; // master_all_kamael002b return htmltext; } - if (player.getClassId() == ClassId.trooper) - { + if (player.getClassId() == ClassId.trooper) { htmltext = "32145-05.htm"; // master_all_kamael003t - } - else if (player.getClassId() == ClassId.warder) - { + } else if (player.getClassId() == ClassId.warder) { htmltext = "32145-02.htm"; // master_all_kamael012b } - } - else - { - if (player.isInCategory(CategoryType.KAMAEL_MALE_MAIN_OCCUPATION)) - { + } else { + if (player.isInCategory(CategoryType.KAMAEL_MALE_MAIN_OCCUPATION)) { htmltext = "32145-10.htm"; // master_all_kamael002c return htmltext; } - if (player.getClassId() == ClassId.trooper) - { + if (player.getClassId() == ClassId.trooper) { htmltext = "32145-03.htm"; // master_all_kamael012c - } - else if (player.getClassId() == ClassId.warder) - { + } else if (player.getClassId() == ClassId.warder) { htmltext = "32145-11.htm"; // master_all_kamael003w } } - } - else if (player.isInCategory(CategoryType.KAMAEL_THIRD_CLASS_GROUP)) - { - if (Util.contains(NPCS_MALE, npc.getId())) - { - if (player.isInCategory(CategoryType.KAMAEL_MALE_MAIN_OCCUPATION)) - { + } else if (player.isInCategory(CategoryType.KAMAEL_THIRD_CLASS_GROUP)) { + if (Util.contains(NPCS_MALE, npc.getId())) { + if (player.isInCategory(CategoryType.KAMAEL_MALE_MAIN_OCCUPATION)) { htmltext = "32145-16.htm"; // master_all_kamael005b - } - else - { + } else { htmltext = "32145-04.htm"; // master_all_kamael002b } - } - else - { - if (player.isInCategory(CategoryType.KAMAEL_FEMALE_MAIN_OCCUPATION)) - { + } else { + if (player.isInCategory(CategoryType.KAMAEL_FEMALE_MAIN_OCCUPATION)) { htmltext = "32145-17.htm"; // master_all_kamael005c - } - else - { + } else { htmltext = "32145-10.htm"; // master_all_kamael002c } } - } - else if (player.isInCategory(CategoryType.KAMAEL_FOURTH_CLASS_GROUP)) - { - if (Util.contains(NPCS_MALE, npc.getId())) - { - if (player.isInCategory(CategoryType.KAMAEL_MALE_MAIN_OCCUPATION)) - { + } else if (player.isInCategory(CategoryType.KAMAEL_FOURTH_CLASS_GROUP)) { + if (Util.contains(NPCS_MALE, npc.getId())) { + if (player.isInCategory(CategoryType.KAMAEL_MALE_MAIN_OCCUPATION)) { htmltext = "32145-18.htm"; // master_all_kamael100b - } - else - { + } else { htmltext = "32145-04.htm"; // master_all_kamael002b } - } - else - { - if (player.isInCategory(CategoryType.KAMAEL_FEMALE_MAIN_OCCUPATION)) - { + } else { + if (player.isInCategory(CategoryType.KAMAEL_FEMALE_MAIN_OCCUPATION)) { htmltext = "32145-19.htm"; // master_all_kamael100c - } - else - { + } else { htmltext = "32145-10.htm"; // master_all_kamael002c } } @@ -397,8 +284,7 @@ public final class KamaelChange2 extends AbstractNpcAI return htmltext; } - public static void main(String[] args) - { + public static void main(String[] args) { new KamaelChange2(); } } diff --git a/src/main/java/com/l2jserver/datapack/village_master/OrcChange1/OrcChange1.java b/src/main/java/com/l2jserver/datapack/village_master/OrcChange1/OrcChange1.java index 6119c3206c..61697de36c 100644 --- a/src/main/java/com/l2jserver/datapack/village_master/OrcChange1/OrcChange1.java +++ b/src/main/java/com/l2jserver/datapack/village_master/OrcChange1/OrcChange1.java @@ -29,11 +29,9 @@ import com.l2jserver.gameserver.model.base.ClassId; * Orc class transfer AI. * @author Adry_85 */ -public final class OrcChange1 extends AbstractNpcAI -{ +public final class OrcChange1 extends AbstractNpcAI { // NPCs - private static int[] NPCS = - { + private static int[] NPCS = { 30500, // Osborn 30505, // Drikus 30508, // Castor @@ -46,19 +44,16 @@ public final class OrcChange1 extends AbstractNpcAI private static final int KHAVATARI_TOTEM = 1615; private static final int MASK_OF_MEDIUM = 1631; - private OrcChange1() - { + private OrcChange1() { super(OrcChange1.class.getSimpleName(), "village_master"); addStartNpc(NPCS); addTalkId(NPCS); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { + switch (event) { case "30500-01.htm": // high_prefect_osborn003f case "30500-02.htm": // high_prefect_osborn006fa case "30500-03.htm": // high_prefect_osborn007fa @@ -97,8 +92,7 @@ public final class OrcChange1 extends AbstractNpcAI } case "45": case "47": - case "50": - { + case "50": { htmltext = ClassChangeRequested(player, npc, Integer.valueOf(event)); break; } @@ -106,36 +100,22 @@ public final class OrcChange1 extends AbstractNpcAI return htmltext; } - private String ClassChangeRequested(L2PcInstance player, L2Npc npc, int classId) - { + private String ClassChangeRequested(L2PcInstance player, L2Npc npc, int classId) { String htmltext = null; - if (player.isInCategory(CategoryType.SECOND_CLASS_GROUP)) - { + if (player.isInCategory(CategoryType.SECOND_CLASS_GROUP)) { htmltext = npc.getId() + "-09.htm"; // fnYouAreSecondClass - } - else if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)) - { + } else if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)) { htmltext = npc.getId() + "-10.htm"; // fnYouAreThirdClass - } - else if (player.isInCategory(CategoryType.FOURTH_CLASS_GROUP)) - { + } else if (player.isInCategory(CategoryType.FOURTH_CLASS_GROUP)) { htmltext = "30500-24.htm"; // fnYouAreFourthClass - } - else if ((classId == 45) && (player.getClassId() == ClassId.orcFighter)) - { - if (player.getLevel() < 20) - { - if (hasQuestItems(player, MARK_OF_RAIDER)) - { + } else if ((classId == 45) && (player.getClassId() == ClassId.orcFighter)) { + if (player.getLevel() < 20) { + if (hasQuestItems(player, MARK_OF_RAIDER)) { htmltext = npc.getId() + "-11.htm"; // fnLowLevel11 - } - else - { + } else { htmltext = npc.getId() + "-12.htm"; // fnLowLevelNoProof11 } - } - else if (hasQuestItems(player, MARK_OF_RAIDER)) - { + } else if (hasQuestItems(player, MARK_OF_RAIDER)) { takeItems(player, MARK_OF_RAIDER, -1); player.setClassId(45); player.setBaseClass(45); @@ -143,27 +123,17 @@ public final class OrcChange1 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_D_GRADE, 15); htmltext = npc.getId() + "-14.htm"; // fnAfterClassChange11 - } - else - { + } else { htmltext = npc.getId() + "-13.htm"; // fnNoProof11 } - } - else if ((classId == 47) && (player.getClassId() == ClassId.orcFighter)) - { - if (player.getLevel() < 20) - { - if (hasQuestItems(player, KHAVATARI_TOTEM)) - { + } else if ((classId == 47) && (player.getClassId() == ClassId.orcFighter)) { + if (player.getLevel() < 20) { + if (hasQuestItems(player, KHAVATARI_TOTEM)) { htmltext = npc.getId() + "-15.htm"; // fnLowLevel12 - } - else - { + } else { htmltext = npc.getId() + "-16.htm"; // fnLowLevelNoProof12 } - } - else if (hasQuestItems(player, KHAVATARI_TOTEM)) - { + } else if (hasQuestItems(player, KHAVATARI_TOTEM)) { takeItems(player, KHAVATARI_TOTEM, -1); player.setClassId(47); player.setBaseClass(47); @@ -171,27 +141,17 @@ public final class OrcChange1 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_D_GRADE, 15); htmltext = npc.getId() + "-18.htm"; // fnAfterClassChange12 - } - else - { + } else { htmltext = npc.getId() + "-17.htm"; // fnNoProof12 } - } - else if ((classId == 50) && (player.getClassId() == ClassId.orcMage)) - { - if (player.getLevel() < 20) - { - if (hasQuestItems(player, MASK_OF_MEDIUM)) - { + } else if ((classId == 50) && (player.getClassId() == ClassId.orcMage)) { + if (player.getLevel() < 20) { + if (hasQuestItems(player, MASK_OF_MEDIUM)) { htmltext = npc.getId() + "-19.htm"; // fnLowLevel21 - } - else - { + } else { htmltext = npc.getId() + "-20.htm"; // fnLowLevelNoProof21 } - } - else if (hasQuestItems(player, MASK_OF_MEDIUM)) - { + } else if (hasQuestItems(player, MASK_OF_MEDIUM)) { takeItems(player, MASK_OF_MEDIUM, -1); player.setClassId(50); player.setBaseClass(50); @@ -199,9 +159,7 @@ public final class OrcChange1 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_D_GRADE, 15); htmltext = npc.getId() + "-22.htm"; // fnAfterClassChange21 - } - else - { + } else { htmltext = npc.getId() + "-21.htm"; // fnNoProof21 } } @@ -209,29 +167,21 @@ public final class OrcChange1 extends AbstractNpcAI } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; - if (player.getRace() == Race.ORC) - { - if (player.isInCategory(CategoryType.FIGHTER_GROUP)) - { + if (player.getRace() == Race.ORC) { + if (player.isInCategory(CategoryType.FIGHTER_GROUP)) { htmltext = npc.getId() + "-01.htm"; // fnClassList1 - } - else if (player.isInCategory(CategoryType.MAGE_GROUP)) - { + } else if (player.isInCategory(CategoryType.MAGE_GROUP)) { htmltext = npc.getId() + "-06.htm"; // fnClassList2 } - } - else - { + } else { htmltext = npc.getId() + "-23.htm"; // fnClassMismatch } return htmltext; } - public static void main(String[] args) - { + public static void main(String[] args) { new OrcChange1(); } } diff --git a/src/main/java/com/l2jserver/datapack/village_master/OrcChange2/OrcChange2.java b/src/main/java/com/l2jserver/datapack/village_master/OrcChange2/OrcChange2.java index c24cd49488..c40c57ed21 100644 --- a/src/main/java/com/l2jserver/datapack/village_master/OrcChange2/OrcChange2.java +++ b/src/main/java/com/l2jserver/datapack/village_master/OrcChange2/OrcChange2.java @@ -28,11 +28,9 @@ import com.l2jserver.gameserver.model.base.ClassId; * Orc class transfer AI. * @author Adry_85 */ -public final class OrcChange2 extends AbstractNpcAI -{ +public final class OrcChange2 extends AbstractNpcAI { // NPCs - private static int[] NPCS = - { + private static int[] NPCS = { 30513, // Penatus 30681, // Karia 30704, // Garvarentz @@ -59,19 +57,16 @@ public final class OrcChange2 extends AbstractNpcAI private static final int OVERLORD = 51; private static final int WARCRYER = 52; - private OrcChange2() - { + private OrcChange2() { super(OrcChange2.class.getSimpleName(), "village_master"); addStartNpc(NPCS); addTalkId(NPCS); } @Override - public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) - { + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - switch (event) - { + switch (event) { case "30513-03.htm": // master_lv3_orc006ra case "30513-04.htm": // master_lv3_orc007ra case "30513-05.htm": // master_lv3_orc007rat @@ -92,8 +87,7 @@ public final class OrcChange2 extends AbstractNpcAI case "46": case "48": case "51": - case "52": - { + case "52": { htmltext = ClassChangeRequested(player, Integer.valueOf(event)); break; } @@ -101,28 +95,18 @@ public final class OrcChange2 extends AbstractNpcAI return htmltext; } - private String ClassChangeRequested(L2PcInstance player, int classId) - { + private String ClassChangeRequested(L2PcInstance player, int classId) { String htmltext = null; - if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)) - { + if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)) { htmltext = "30513-19.htm"; // fnYouAreThirdClass - } - else if ((classId == DESTROYER) && (player.getClassId() == ClassId.orcRaider)) - { - if (player.getLevel() < 40) - { - if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_GLORY, MARK_OF_CHAMPION)) - { + } else if ((classId == DESTROYER) && (player.getClassId() == ClassId.orcRaider)) { + if (player.getLevel() < 40) { + if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_GLORY, MARK_OF_CHAMPION)) { htmltext = "30513-20.htm"; // fnLowLevel11 - } - else - { + } else { htmltext = "30513-21.htm"; // fnLowLevelNoProof11 } - } - else if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_GLORY, MARK_OF_CHAMPION)) - { + } else if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_GLORY, MARK_OF_CHAMPION)) { takeItems(player, -1, MARK_OF_CHALLENGER, MARK_OF_GLORY, MARK_OF_CHAMPION); player.setClassId(DESTROYER); player.setBaseClass(DESTROYER); @@ -130,27 +114,17 @@ public final class OrcChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30513-22.htm"; // fnAfterClassChange11 - } - else - { + } else { htmltext = "30513-23.htm"; // fnNoProof11 } - } - else if ((classId == TYRANT) && (player.getClassId() == ClassId.orcMonk)) - { - if (player.getLevel() < 40) - { - if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_GLORY, MARK_OF_DUELIST)) - { + } else if ((classId == TYRANT) && (player.getClassId() == ClassId.orcMonk)) { + if (player.getLevel() < 40) { + if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_GLORY, MARK_OF_DUELIST)) { htmltext = "30513-24.htm"; // fnLowLevel21 - } - else - { + } else { htmltext = "30513-25.htm"; // fnLowLevelNoProof21 } - } - else if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_GLORY, MARK_OF_DUELIST)) - { + } else if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_GLORY, MARK_OF_DUELIST)) { takeItems(player, -1, MARK_OF_CHALLENGER, MARK_OF_GLORY, MARK_OF_DUELIST); player.setClassId(TYRANT); player.setBaseClass(TYRANT); @@ -158,27 +132,17 @@ public final class OrcChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30513-26.htm"; // fnAfterClassChange21 - } - else - { + } else { htmltext = "30513-27.htm"; // fnNoProof21 } - } - else if ((classId == OVERLORD) && (player.getClassId() == ClassId.orcShaman)) - { - if (player.getLevel() < 40) - { - if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_GLORY, MARK_OF_LORD)) - { + } else if ((classId == OVERLORD) && (player.getClassId() == ClassId.orcShaman)) { + if (player.getLevel() < 40) { + if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_GLORY, MARK_OF_LORD)) { htmltext = "30513-28.htm"; // fnLowLevel31 - } - else - { + } else { htmltext = "30513-29.htm"; // fnLowLevelNoProof31 } - } - else if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_GLORY, MARK_OF_LORD)) - { + } else if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_GLORY, MARK_OF_LORD)) { takeItems(player, -1, MARK_OF_PILGRIM, MARK_OF_GLORY, MARK_OF_LORD); player.setClassId(OVERLORD); player.setBaseClass(OVERLORD); @@ -186,27 +150,17 @@ public final class OrcChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30513-30.htm"; // fnAfterClassChange31 - } - else - { + } else { htmltext = "30513-31.htm"; // fnNoProof31 } - } - else if ((classId == WARCRYER) && (player.getClassId() == ClassId.orcShaman)) - { - if (player.getLevel() < 40) - { - if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_GLORY, MARK_OF_WARSPIRIT)) - { + } else if ((classId == WARCRYER) && (player.getClassId() == ClassId.orcShaman)) { + if (player.getLevel() < 40) { + if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_GLORY, MARK_OF_WARSPIRIT)) { htmltext = "30513-32.htm"; // fnLowLevel32 - } - else - { + } else { htmltext = "30513-33.htm"; // fnLowLevelNoProof32 } - } - else if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_GLORY, MARK_OF_WARSPIRIT)) - { + } else if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_GLORY, MARK_OF_WARSPIRIT)) { takeItems(player, -1, MARK_OF_PILGRIM, MARK_OF_GLORY, MARK_OF_WARSPIRIT); player.setClassId(WARCRYER); player.setBaseClass(WARCRYER); @@ -214,9 +168,7 @@ public final class OrcChange2 extends AbstractNpcAI player.broadcastUserInfo(); giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15); htmltext = "30513-34.htm"; // fnAfterClassChange32 - } - else - { + } else { htmltext = "30513-35.htm"; // fnNoProof32 } } @@ -224,42 +176,28 @@ public final class OrcChange2 extends AbstractNpcAI } @Override - public String onTalk(L2Npc npc, L2PcInstance player) - { + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; - if (player.isInCategory(CategoryType.FOURTH_CLASS_GROUP) && (player.isInCategory(CategoryType.ORC_MALL_CLASS) || player.isInCategory(CategoryType.ORC_FALL_CLASS))) - { + if (player.isInCategory(CategoryType.FOURTH_CLASS_GROUP) && (player.isInCategory(CategoryType.ORC_MALL_CLASS) || player.isInCategory(CategoryType.ORC_FALL_CLASS))) { htmltext = "30513-01.htm"; // fnYouAreFourthClass - } - else if (player.isInCategory(CategoryType.ORC_MALL_CLASS) || player.isInCategory(CategoryType.ORC_FALL_CLASS)) - { + } else if (player.isInCategory(CategoryType.ORC_MALL_CLASS) || player.isInCategory(CategoryType.ORC_FALL_CLASS)) { final ClassId classId = player.getClassId(); - if ((classId == ClassId.orcRaider) || (classId == ClassId.destroyer)) - { + if ((classId == ClassId.orcRaider) || (classId == ClassId.destroyer)) { htmltext = "30513-02.htm"; // fnClassList1 - } - else if ((classId == ClassId.orcMonk) || (classId == ClassId.tyrant)) - { + } else if ((classId == ClassId.orcMonk) || (classId == ClassId.tyrant)) { htmltext = "30513-06.htm"; // fnClassList2 - } - else if ((classId == ClassId.orcShaman) || (classId == ClassId.overlord) || (classId == ClassId.warcryer)) - { + } else if ((classId == ClassId.orcShaman) || (classId == ClassId.overlord) || (classId == ClassId.warcryer)) { htmltext = "30513-10.htm"; // fnClassList3 - } - else - { + } else { htmltext = "30513-17.htm"; // fnYouAreFirstClass } - } - else - { + } else { htmltext = "30513-18.htm"; // fnClassMismatch } return htmltext; } - public static void main(String[] args) - { + public static void main(String[] args) { new OrcChange2(); } } -- GitLab